]> granicus.if.org Git - linux-pam/blob - configure.in
Relevant BUGIDs: 414943
[linux-pam] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(conf/pam_conv1/pam_conv.y)
3
4 dnl The configuration header file
5 AC_CONFIG_HEADER(_pam_aconf.h)
6
7 dnl
8 dnl Release specific
9 dnl
10
11 LIBPAM_VERSION_MAJOR=0
12 LIBPAM_VERSION_MINOR=76
13
14 AC_SUBST(LIBPAM_VERSION_MAJOR)
15 AC_SUBST(LIBPAM_VERSION_MINOR)
16 AC_DEFINE(LIBPAM_VERSION_MAJOR)
17 AC_DEFINE(LIBPAM_VERSION_MINOR)
18
19 dnl
20 dnl By default, everything under PAM is installed under the root fs.
21 dnl
22
23 AC_PREFIX_DEFAULT()
24
25 dnl
26 dnl Rules needed for the following (hardcoded Linux defaults for now)
27 dnl
28
29 CC=gcc                          ; AC_SUBST(CC)
30 CONF_CFLAGS=                    ; AC_SUBST(CONF_CFLAGS)
31 MKDIR="mkdir -p"                ; AC_SUBST(MKDIR)
32 LOCALSRCDIR=`/bin/pwd`          ; AC_SUBST(LOCALSRCDIR)
33 OS=`uname|sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
34 AC_SUBST(OS)
35
36 SHLIBMODE=755                   ; AC_SUBST(SHLIBMODE)
37
38 dnl These are most likely platform specific - I think HPUX differs
39 DYNTYPE=so                      ; AC_SUBST(DYNTYPE)
40 USESONAME=yes                   ; AC_SUBST(USESONAME)
41 SOSWITCH=-soname                ; AC_SUBST(SOSWITCH)
42 NEEDSONAME=no                   ; AC_SUBST(NEEDSONAME)
43 LDCONFIG=/sbin/ldconfig         ; AC_SUBST(LDCONFIG)
44
45 dnl ### Should enable this INSTALL detection.
46 dnl ### Would need to distribute GNU's config.guess and config.sub
47 dnl AC_PROG_INSTALL
48 INSTALL=/usr/bin/install        ; AC_SUBST(INSTALL)
49
50 dnl Checks for programs.
51 AC_PROG_CC
52 dnl ### AC_PROG_CXX
53 AC_PROG_YACC
54 AC_PROG_LEX
55 dnl AC_PROG_INSTALL
56 AC_PROG_LN_S
57 AC_PROG_MAKE_SET
58
59 dnl
60 dnl options and defaults
61 dnl
62
63 dnl lots of debugging information goes to /tmp/pam-debug.log
64 AC_ARG_ENABLE(debug,
65 [  --enable-debug           qspecify you are building with debugging on],
66         WITH_DEBUG=yes ; AC_DEFINE(DEBUG) , WITH_DEBUG=no)
67 AC_SUBST(WITH_DEBUG)
68
69 dnl build specially named libraries (for debugging purposes)
70 AC_ARG_ENABLE(libdebug,
71 [  --enable-libdebug        specify you are building debugging libraries],
72         WITH_LIBDEBUG=yes ; AC_DEFINE(WITH_LIBDEBUG) , WITH_LIBDEBUG=no)
73 AC_SUBST(WITH_LIBDEBUG)
74
75 dnl packaging convenience
76 AC_ARG_ENABLE(fakeroot,
77 [  --enable-fakeroot=<path to packaging directory>], FAKEROOT=$enableval)
78 AC_SUBST(FAKEROOT)
79
80 AC_ARG_ENABLE(securedir,
81 [  --enable-securedir=<path to location of PAMs> [default \$libdir/security]],
82         SECUREDIR=$enableval, SECUREDIR=$libdir/security)
83 AC_SUBST(SECUREDIR)
84
85 AC_ARG_ENABLE(sconfigdir,
86 [  --enable-sconfigdir=<path to module conf files> [default \$sysconfdir/security]],
87         SCONFIGDIR=$enableval, SCONFIGDIR=$sysconfdir/security)
88 AC_SUBST(SCONFIGDIR)
89
90 AC_ARG_ENABLE(suplementedir,
91 [  --enable-suplementedir=<path to module helper binaries> [default \$sbindir]],
92         SUPLEMENTED=$enableval, SUPLEMENTED=$sbindir)
93 AC_SUBST(SUPLEMENTED)
94
95 AC_ARG_ENABLE(includedir,
96 [  --enable-includedir=<path to include location> - where to put <security>],
97         INCLUDEDIR=$enableval, INCLUDEDIR=/usr/include)
98 AC_SUBST(INCLUDEDIR)
99
100 AC_ARG_ENABLE(pamlocking,
101 [  --enable-pamlocking      configure libpam to observe a global authentication lock],
102         WITH_PAMLOCKING=yes ; AC_DEFINE(PAM_LOCKING) , WITH_PAMLOCKING=no)
103 AC_SUBST(WITH_PAMLOCKING)
104
105 AC_ARG_ENABLE(uglyhack,
106 [  --enable-uglyhack        configure libpam to try to honor old pam_strerror syntax],
107         AC_DEFINE(UGLY_HACK_FOR_PRIOR_BEHAVIOR_SUPPORT))
108
109 AC_ARG_ENABLE(read-both-confs,
110 [  --enable-read-both-confs  read both /etc/pam.d and /etc/pam.conf files],
111         AC_DEFINE(PAM_READ_BOTH_CONFS))
112 AC_SUBST(PAM_READ_BOTH_CONFS)
113
114 AC_ARG_ENABLE(static-libpam, [  --enable-static-libpam   build a libpam.a library],
115         STATIC_LIBPAM=yes , STATIC_LIBPAM=no)
116 AC_SUBST(STATIC_LIBPAM)
117
118 AC_ARG_ENABLE(dynamic-libpam,
119 [  --disable-dynamic-libpam do not build a shared libpam library],
120         DYNAMIC_LIBPAM=no, DYNAMIC_LIBPAM=yes)
121 AC_SUBST(DYNAMIC_LIBPAM)
122
123 DYNAMIC=-DPAM_DYNAMIC
124 AC_SUBST(DYNAMIC)
125
126 AC_ARG_ENABLE(static-modules,
127 [  --enable-static-modules  do not make the modules dynamically loadable],
128         STATIC=-DPAM_STATIC)
129 AC_SUBST(STATIC)
130
131 AC_ARG_ENABLE(lckpwdf,
132 [  --disable-lckpwdf do not use the lckpwdf function],
133         WITH_LCKPWDF=no, WITH_LCKPWDF=yes)
134 AC_SUBST(WITH_LCKPWDF)
135
136 AC_CHECK_HEADERS(paths.h)
137 AC_ARG_WITH(mailspool,
138 [  --with-mailspool         path to mail spool directory
139                            [default _PATH_MAILDIR if defined in paths.h, otherwise /var/spool/mail]],
140 with_mailspool=${withval})
141 if test x$with_mailspool != x ; then
142         pam_mail_spool="\"$with_mailspool\""
143 else
144         AC_TRY_RUN([
145 #include <paths.h>
146 int main() {
147 #ifdef _PATH_MAILDIR
148 exit(0);
149 #else
150 exit(1);
151 #endif
152 }], pam_mail_spool="_PATH_MAILDIR",
153 pam_mail_spool="\"/var/spool/mail\"",
154 pam_mail_spool="\"/var/spool/mail\"")
155 fi
156 AC_DEFINE_UNQUOTED(PAM_PATH_MAILDIR, $pam_mail_spool)
157
158 dnl Checks for libraries.
159 AC_CHECK_LIB(c, __libc_sched_setscheduler, PAM_NEEDS_LIBC=, PAM_NEEDS_LIBC=-lc)
160 AC_SUBST(PAM_NEEDS_LIBC)
161
162 dnl Checks for the existence of lckpwdf in libc
163 AC_CHECK_LIB(c, lckpwdf, HAVE_LCKPWDF=yes, HAVE_LCKPWDF=no)
164 AC_SUBST(HAVE_LCKPWDF)
165
166 dnl Checks for the existence of libdl - on BSD its part of libc
167 AC_CHECK_LIB(dl, dlopen, LIBDL=-ldl) 
168 AC_SUBST(LIBDL)
169
170 dnl
171 dnl At least on Solaris, the existing libcrack must be dynamic.
172 dnl Ought to introduce a check for this.
173 dnl
174 AC_CHECK_LIB(crack, FascistCheck, HAVE_LIBCRACK=yes ; AC_DEFINE(HAVE_LIBCRACK),
175         HAVE_LIBCRACK=no)
176 AC_SUBST(HAVE_LIBCRACK)
177
178 AC_CHECK_LIB(crypt, fcrypt, HAVE_LIBCRYPT=yes ; AC_DEFINE(HAVE_LIBCRYPT),
179         HAVE_LIBCRYPT=no)
180 AC_SUBST(HAVE_LIBCRYPT)
181 AC_CHECK_LIB(util, logwtmp, HAVE_LIBUTIL=yes ; AC_DEFINE(HAVE_LIBUTIL),
182         HAVE_LIBUTIL=no)
183 AC_SUBST(HAVE_LIBUTIL)
184 AC_CHECK_LIB(ndbm, dbm_store, HAVE_LIBNDBM=yes ; AC_DEFINE(HAVE_LIBNDBM),
185         HAVE_LIBNDBM=no)
186 AC_SUBST(HAVE_LIBNDBM)
187 AC_CHECK_LIB(db, dbm_store, HAVE_LIBDB=yes ; AC_DEFINE(HAVE_LIBDB),
188         HAVE_LIBDB=no)
189 AC_SUBST(HAVE_LIBDB)
190 AC_CHECK_LIB(fl, yylex, yyterminate, HAVE_LIBFL=yes ; AC_DEFINE(HAVE_LIBFL),
191         HAVE_LIBFL=no)
192 AC_SUBST(HAVE_LIBFL)
193 AC_CHECK_LIB(nsl, yp_maplist, HAVE_LIBNSL=yes ; AC_DEFINE(HAVE_LIBNSL),
194         HAVE_LIBNSL=no)
195 AC_SUBST(HAVE_LIBNSL)
196 AC_CHECK_LIB(pwdb, pwdb_db_name, HAVE_LIBPWDB=yes ; AC_DEFINE(HAVE_LIBPWDB),
197         HAVE_LIBPWDB=no)
198 AC_SUBST(HAVE_LIBPWDB)
199
200 dnl Checks for header files.
201 AC_HEADER_DIRENT
202 AC_HEADER_STDC
203 AC_HEADER_SYS_WAIT
204 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/file.h sys/ioctl.h sys/time.h syslog.h termio.h unistd.h)
205
206 dnl Linux wants features.h in some of the source files.
207 AC_CHECK_HEADERS(features.h)
208
209 dnl For module/pam_cracklib
210 AC_CHECK_HEADERS(crypt.h)
211
212 dnl For module/pam_userdb
213 AC_CHECK_HEADERS(ndbm.h db.h)
214 dnl I suspect the following two lines are a hack.
215 HAVE_NDBM_H=$ac_cv_header_ndbm_h
216 AC_SUBST(HAVE_NDBM_H)
217
218 dnl For module/pam_lastlog
219 AC_CHECK_HEADERS(lastlog.h utmp.h utmpx.h)
220
221 dnl This following rule should be made conditional upon HAVE_LIBCRYPT
222 dnl being found.
223
224 dnl Look for cracklib dictionary
225 AC_MSG_CHECKING(path to cracklib dictionary)
226 DICT_DIR_CANDIDATES="/usr/lib /usr/share/dict /usr/share/lib \
227   /usr/local/lib /usr/local/share/lib"
228 DICT_FILE_CANDIDATES="pw_dict cracklib_dict"
229 CRACKLIB_DICTPATH=""
230 for d in $DICT_DIR_CANDIDATES ; do
231       for f in $DICT_FILE_CANDIDATES ; do
232               if test -r $d/$f.hwm ; then
233                       CRACKLIB_DICTPATH=$d/$f
234                       break 2
235               elif test -r $d/dict/$f.hwm ; then
236                       CRACKLIB_DICTPATH=$d/dict/$f
237                       break 2
238               fi
239       done
240 done
241 if test -z "$CRACKLIB_DICTPATH" ; then
242       AC_MSG_RESULT(none found)
243 else
244       AC_MSG_RESULT($CRACKLIB_DICTPATH)
245 fi
246 AC_SUBST(CRACKLIB_DICTPATH)
247
248 dnl Set FLAGS, linker options etc. depending on C compiler.
249 dnl gcc is tested and much preferred; others less so, if at all
250 dnl
251 dnl If compiling with gcc, linking is also supposed to be done with gcc;
252 dnl since we use linker-specific arguments, we may not gain anything by
253 dnl switching LD_L over, but I think we can use LD_D as-is.
254 dnl
255 dnl For the moment, gcc is enforced above at "CC=gcc".
256 dnl
257 dnl There is an issue over _POSIX_SOURCE _BSD_SOURCE and _GNU_SOURCE .
258 dnl The original "Linux-PAM" had blanket inclusion.  But portability
259 dnl requires their default absence: if particular OSes require them,
260 dnl this should be done selectively.
261
262 GCC_WARNINGS="-Wall -Wwrite-strings \
263         -Wpointer-arith -Wcast-qual -Wcast-align \
264         -Wstrict-prototypes -Wmissing-prototypes \
265         -Wnested-externs -Winline -Wshadow"
266
267 if test "$GCC" = yes; then
268 ###
269 ### Non-Linux needs attention on per-OS basis
270         OS_CFLAGS="-ansi -D_POSIX_SOURCE -pedantic"
271         WARNINGS="$GCC_WARNINGS"
272         PIC="-fPIC"
273 #can/should we use LD=gcc ???
274         LD=ld                           
275         LD_D="gcc -shared -Xlinker -x"
276         LD_L="$LD -x -shared"
277         RANLIB=ranlib
278         STRIP=strip
279         CC_STATIC="-Xlinker -export-dynamic"
280 else
281 ###
282 ### Non-gcc needs attention on per-OS basis
283 ###
284 ### [These are Solaris-C specific...]
285         OS_CFLAGS=""
286         WARNINGS=""
287         PIC="-K pic"
288         LD=ld
289         LD_D="cc -z text -G -R."
290         LD_L="$LD_D"
291         RANLIB=ranlib
292         STRIP=strip
293         CC_STATIC=
294 fi
295
296 AC_SUBST(OS_CFLAGS)
297 AC_SUBST(WARNINGS)
298 AC_SUBST(PIC)
299 AC_SUBST(LD)
300 AC_SUBST(LD_D)
301 AC_SUBST(LD_L)
302 AC_SUBST(RANLIB)
303 AC_SUBST(STRIP)
304 AC_SUBST(CC_STATIC)
305
306 dnl Checks for typedefs, structures, and compiler characteristics.
307 AC_C_BIGENDIAN
308 AC_C_CONST
309 AC_TYPE_UID_T
310 AC_TYPE_OFF_T
311 AC_TYPE_PID_T
312 AC_TYPE_SIZE_T
313 AC_HEADER_TIME
314 AC_STRUCT_TM
315
316 dnl Checks for library functions.
317 AC_TYPE_GETGROUPS
318 AC_PROG_GCC_TRADITIONAL
319 AC_FUNC_MEMCMP
320 AC_FUNC_VPRINTF
321 AC_CHECK_FUNCS(gethostname gettimeofday mkdir select strcspn strdup strerror strspn strstr strtol uname)
322
323 dnl Checks for programs/utilities
324 AC_CHECK_PROG(HAVE_SGML2TXT, sgml2txt, yes, no)
325 AC_CHECK_PROG(HAVE_SGML2HTML, sgml2html, yes, no)
326 AC_CHECK_PROG(HAVE_SGML2LATEX, sgml2latex, yes, no)
327 if test $HAVE_SGML2LATEX = "yes" ; then
328   if sgml2latex -h | grep -e --paper | grep  ' -p ' > /dev/null ; then
329     PSER="sgml2latex -o ps"
330   else
331     PSER="sgml2latex -p"
332   fi
333 else
334   AC_CHECK_PROG(HAVE_SGML2PS, sgml2ps, yes, no)
335   if test $HAVE_SGML2PS = yes ; then
336     PSER="sgml2ps"
337   fi
338 fi
339 AC_SUBST(PSER)
340
341 dnl Files to be created from when we run configure
342 AC_OUTPUT(Make.Rules)