]> granicus.if.org Git - linux-pam/blob - configure.in
0b0b18f28b19248a6f152bd8dd22d81afd9d560f
[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 AM_INIT_AUTOMAKE("Linux-PAM", 0.99.2.1)
4 AM_CONFIG_HEADER(config.h)
5 AC_CANONICAL_HOST
6
7 AC_SUBST(PACKAGE)
8 AC_SUBST(VERSION)
9
10 ALL_LINGUAS="cs de es fi fr hu it ja nb pa pl pt_BR pt zh_CN zh_TW"
11
12 dnl
13 dnl By default, everything under PAM is installed below /usr.
14 dnl
15 AC_PREFIX_DEFAULT(/usr)
16
17 dnl and some hacks to use /etc and /lib
18 test "${prefix}" = "NONE" && prefix="/usr"
19 if test ${prefix} = '/usr'
20 then
21 dnl If we use /usr as prefix, use /etc for config files
22         if test ${sysconfdir} = '${prefix}/etc'
23         then
24                 sysconfdir="/etc"
25         fi
26         if test ${libdir} = '${exec_prefix}/lib'
27         then
28                 libdir="/lib"
29         fi
30         if test ${sbindir} = '${exec_prefix}/sbin'
31         then
32                 sbindir="/sbin"
33         fi
34 dnl If we use /usr as prefix, use /usr/share/man for manual pages
35         if test ${mandir} = '${prefix}/man'
36         then
37                 mandir='${prefix}/share/man'
38         fi
39 dnl Add security to include directory
40         if test ${includedir} = '${prefix}/include'
41         then
42                 includedir="${prefix}/include/security"
43         fi
44 fi
45
46
47 dnl Checks for programs.
48 AC_GNU_SOURCE
49 AC_PROG_CC
50 AC_PROG_YACC
51 AM_PROG_LEX
52 AC_PROG_INSTALL
53 AC_PROG_LN_S
54 AC_PROG_MAKE_SET
55 # per default don't build static libraries
56 AC_DISABLE_STATIC
57 AC_PROG_LIBTOOL
58
59 if test "$enable_static" = yes; then
60    CFLAGS="$CFLAGS -DPAM_STATIC"
61 fi
62 if test "$enable_shared" = yes; then
63    CFLAGS="$CFLAGS -DPAM_DYNAMIC"
64 fi
65
66 # Largefile support
67 AC_SYS_LARGEFILE
68
69 if eval "test x$GCC = xyes"; then
70   for flag in \
71       -W \
72       -Wall \
73       -Wbad-function-cast \
74       -Wcast-align \
75       -Wcast-qual \
76       -Wmissing-declarations \
77       -Wmissing-prototypes \
78       -Wpointer-arith \
79       -Wreturn-type \
80       -Wstrict-prototypes \
81       -Wwrite-strings \
82       -Winline \
83       -Wshadow
84   do
85     JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
86   done
87 fi
88
89 AC_C___ATTRIBUTE__
90
91 dnl
92 dnl Check if --version-script is supported by ld
93 dnl 
94 AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
95 [cat > conftest.s <<EOF
96 ${libc_cv_dot_text}
97 _sym:
98 .symver _sym,sym@VERS
99 EOF
100 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
101   libc_cv_asm_symver_directive=yes
102 else
103   libc_cv_asm_symver_directive=no
104 fi
105 rm -f conftest*])
106 AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
107 if test $libc_cv_asm_symver_directive = yes; then
108   cat > conftest.s <<EOF
109 ${libc_cv_dot_text}
110 _sym:
111 .symver _sym,sym@VERS
112 EOF
113   cat > conftest.map <<EOF
114 VERS_1 {
115         global: sym;
116 };
117
118 VERS_2 {
119         global: sym;
120 } VERS_1;
121 EOF
122   if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; 
123 then
124     if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
125                                 -o conftest.so conftest.o
126                                 -nostartfiles -nostdlib
127                                 -Wl,--version-script,conftest.map
128                        1>&AS_MESSAGE_LOG_FD]);
129     then
130       libc_cv_ld_version_script_option=yes
131     else
132       libc_cv_ld_version_script_option=no
133     fi
134   else
135     libc_cv_ld_version_script_option=no
136   fi
137 else
138   libc_cv_ld_version_script_option=no
139 fi
140 rm -f conftest*])
141 AM_CONDITIONAL([HAVE_VERSIONING],
142         [test "$libc_cv_ld_version_script_option" = "yes"])
143
144 dnl
145 dnl check for -fPIE/-pie support
146 dnl
147 AC_ARG_ENABLE(pie,AS_HELP_STRING([--disable-pie],
148                         [Disable position-independent executeables (PIE)]),
149         USE_PIE=$enableval, USE_PIE=yes)
150
151 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
152   cat > conftest.c <<EOF
153 int foo;
154 main () { return 0;}
155 EOF
156   if test "$USE_PIE" = "yes" &&
157         AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -pie -fpie
158                               -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
159   then
160     libc_cv_fpie=yes
161     PIE_CFLAGS="-fpie"
162     PIE_LDFLAGS="-pie"
163   else
164     libc_cv_fpie=no
165     PIE_CFLAGS=""
166     PIE_LDFLAGS=""
167   fi
168   rm -f conftest*])
169 AC_SUBST(libc_cv_fpie)
170 AC_SUBST(PIE_CFLAGS)
171 AC_SUBST(PIE_LDFLAGS)
172
173
174 dnl
175 dnl options and defaults
176 dnl
177
178 AM_PATH_LIBPRELUDE([0.9.0])
179 if test "$LIBPRELUDE_CONFIG" != "no" ; then
180   LIBPRELUDE_CFLAGS="$LIBPRELUDE_CFLAGS -DPRELUDE=1"
181 fi
182
183 dnl lots of debugging information goes to /var/run/pam-debug.log
184 AC_ARG_ENABLE([debug],
185     AC_HELP_STRING([--enable-debug],
186         [specify you are building with debugging on]),
187         WITH_DEBUG=yes ; AC_DEFINE([DEBUG],,
188                 [lots of stuff gets written to /var/run/pam-debug.log]),
189                 WITH_DEBUG=no)
190 AC_SUBST(WITH_DEBUG)
191
192 AC_ARG_ENABLE([memory-debug],
193     AC_HELP_STRING([--enable-memory-debug],[specify you want every malloc etc. call tracked]),
194     WITH_MEMORY_DEBUG=$enableval, WITH_MEMORY_DEBUG=no)
195 if test "$WITH_MEMORY_DEBUG" != "no" ; then
196     AC_DEFINE([MEMORY_DEBUG], 1, [Every malloc etc. call will be tracked])
197 fi
198 AH_VERBATIM([_MEMORY_DEBUG],
199 [#ifdef MEMORY_DEBUG
200 /*
201  * this is basically a hack - we need to include a semiarbitrary
202  * number of headers to ensure that we don't get silly prototype/macro
203  */
204 # include <string.h>
205 # include <stdlib.h>
206 # include <security/pam_malloc.h>
207 #endif /* MEMORY_DEBUG */])
208
209 AC_ARG_ENABLE(securedir,
210 [  --enable-securedir=<path to location of PAMs> [default \$libdir/security]],
211         SECUREDIR=$enableval, SECUREDIR=$libdir/security)
212 AC_SUBST(SECUREDIR)
213
214 AC_ARG_ENABLE([isadir],
215         AC_HELP_STRING([--enable-isadir=DIR],[path to arch-specific module files [default ../../`basename $libdir`/security]]),
216 ISA=$enableval,
217 ISA=../../`basename $libdir`/security)
218 unset mylibdirbase
219 AC_DEFINE_UNQUOTED(_PAM_ISA,"$ISA",[Define to the path, relative to SECUREDIR, where PAMs specific to this architecture can be found.])
220 AC_MSG_RESULT([Defining \$ISA to "$ISA"])
221
222 AC_ARG_ENABLE(sconfigdir,
223 [  --enable-sconfigdir=<path to module conf files> [default \$sysconfdir/security]],
224         SCONFIGDIR=$enableval, SCONFIGDIR=$sysconfdir/security)
225 AC_SUBST(SCONFIGDIR)
226
227 AC_ARG_ENABLE(docdir,
228 [  --enable-docdir=<path to store documentation in - /usr/share/doc/pam>],
229         DOCDIR=$enableval, DOCDIR=/usr/share/doc/pam)
230 AC_SUBST(DOCDIR)
231
232
233 AC_ARG_ENABLE(pamlocking,
234 [  --enable-pamlocking      configure libpam to observe a global authentication lock],
235         WITH_PAMLOCKING=yes ; AC_DEFINE([PAM_LOCKING],,
236                 [libpam should observe a global authentication lock]),
237                 WITH_PAMLOCKING=no)
238 AC_SUBST(WITH_PAMLOCKING)
239
240 AC_ARG_ENABLE(read-both-confs,
241 [  --enable-read-both-confs  read both /etc/pam.d and /etc/pam.conf files],
242         AC_DEFINE([PAM_READ_BOTH_CONFS],,
243                 [read both /etc/pam.d and /etc/pam.conf files]))
244 AC_SUBST(PAM_READ_BOTH_CONFS)
245
246 AC_ARG_ENABLE([lckpwdf],
247         AC_HELP_STRING([--disable-lckpwdf],[do not use the lckpwdf function]),
248         WITH_LCKPWDF=$enableval, WITH_LCKPWDF=yes)
249 if test "$WITH_LCKPWDF" == "yes" ; then
250     AC_DEFINE([USE_LCKPWDF], 1,
251                 [Define to 1 if the lckpwdf function should be used])
252 fi
253
254 AC_CHECK_HEADERS(paths.h)
255 AC_ARG_WITH(mailspool,
256 [  --with-mailspool        path to mail spool directory
257                           [default _PATH_MAILDIR if defined in paths.h, otherwise /var/spool/mail]],
258 with_mailspool=${withval})
259 if test x$with_mailspool != x ; then
260         pam_mail_spool="\"$with_mailspool\""
261 else
262         AC_TRY_RUN([
263 #include <paths.h>
264 int main() {
265 #ifdef _PATH_MAILDIR
266 exit(0);
267 #else
268 exit(1);
269 #endif
270 }], pam_mail_spool="_PATH_MAILDIR",
271 pam_mail_spool="\"/var/spool/mail\"",
272 pam_mail_spool="\"/var/spool/mail\"")
273 fi
274 AC_DEFINE_UNQUOTED(PAM_PATH_MAILDIR, $pam_mail_spool,
275         [Path where mails are stored])
276
277 AC_ARG_WITH(xauth,
278 [  --with-xauth            additional path to check for xauth when it is called from pam_xauth
279                           [added to the default of /usr/X11R6/bin/xauth, /usr/bin/xauth, /usr/bin/X11/xauth]],
280 pam_xauth_path=${withval})
281 if test x$with_xauth == x ; then
282         AC_PATH_PROG(pam_xauth_path, xauth)
283 dnl There is no sense in adding the first default path
284         if test x$pam_xauth_path == x/usr/X11R6/bin/xauth ; then
285                 unset pam_xauth_path
286         fi
287 fi
288
289 if test x$pam_xauth_path != x ; then
290         AC_DEFINE_UNQUOTED(PAM_PATH_XAUTH, "$pam_xauth_path",
291         [Additional path of xauth executable])
292 fi
293
294 dnl Checks for the existence of libdl - on BSD and Tru64 its part of libc
295 AC_CHECK_LIB([dl], [dlopen], LIBDL="-ldl", LIBDL="")
296 AC_SUBST(LIBDL)
297
298 BACKUP_LIBS=$LIBS
299 AC_SEARCH_LIBS([FascistCheck],[crack], LIBCRACK="-l$ac_lib", LIBCRACK="")
300 LIBS=$BACKUP_LIBS
301 AC_SUBST(LIBCRACK)
302 AM_CONDITIONAL([HAVE_LIBCRACK], [test ! -z "$LIBCRACK"])
303
304 dnl Look for Linux Auditing library - see documentation
305 AC_CHECK_HEADER([libaudit.h])
306 BACKUP_LIBS=$LIBS
307 AC_CHECK_LIB(audit, audit_log_user_message, LIBAUDIT=-laudit, LIBAUDIT="")
308 LIBS=$BACKUP_LIBS
309 AC_SUBST(LIBAUDIT)
310 if test ! -z "$LIBAUDIT" ; then
311     AC_DEFINE([HAVE_LIBAUDIT], 1, [Defined if audit support should be compiled in])
312 fi
313
314 BACKUP_LIBS=$LIBS
315 AC_SEARCH_LIBS([crypt],[xcrypt crypt], LIBCRYPT="-l$ac_lib", LIBCRYPT="")
316 LIBS=$BACKUP_LIBS
317 AC_SUBST(LIBCRYPT)
318
319 dnl check for libndbm or libdb as fallback
320 BACKUP_LIBS=$LIBS
321 AC_CHECK_LIB([ndbm],[dbm_store], LIBDB="-lndbm", LIBDB="") 
322 LIBS=$BACKUP_LIBS
323 if test -z "$LIBDB" ; then
324     BACKUP_LIBS=$LIBS
325     AC_CHECK_LIB([db], [dbm_store], LIBDB="-ldb", LIBDB="")
326     LIBS=$BACKUP_LIBS
327 fi
328 if test -z "$LIBDB" ; then
329     BACKUP_LIBS=$LIBS
330     AC_CHECK_LIB([db], [db_create], LIBDB="-ldb", LIBDB="")
331     LIBS=$BACKUP_LIBS
332 fi
333 AC_SUBST(LIBDB)
334 AM_CONDITIONAL([HAVE_LIBDB], [test ! -z "$LIBDB"])
335
336 BACKUP_LIBS=$LIBS
337 AC_CHECK_LIB([nsl],[yp_get_default_domain], LIBNSL="-lnsl", LIBNSL="")
338 LIBS=$BACKUP_LIBS
339 AC_SUBST(LIBNSL)
340
341 BACKUP_LIBS=$LIBS
342 AC_CHECK_LIB([selinux],[getfilecon], LIBSELINUX="-lselinux", LIBSELINUX="")
343 LIBS=$BACKUP_LIBS
344 AC_SUBST(LIBSELINUX)
345 AM_CONDITIONAL([HAVE_LIBSELINUX], [test ! -z "$LIBSELINUX"])
346
347 dnl Checks for Libcap
348 BACKUP_LIBS=$LIBS
349 AC_CHECK_LIB([cap], [cap_get_proc], LIBCAP="-lcap", LIBCAP="" )
350 LIBS=$BACKUP_LIBS
351 AC_SUBST(LIBCAP)
352 AM_CONDITIONAL([HAVE_LIBCAP], [test ! -z "$LIBCAP"])
353
354 BACKUP_LIBS=$LIBS
355 AC_CHECK_LIB([pwdb],[pwdb_db_name], LIBPWDB="-lpwdb", LIBPWDB="")
356 LIBS=$BACKUP_LIBS
357 AC_SUBST(LIBPWDB)
358 AM_CONDITIONAL([HAVE_LIBPWDB], [test ! -z "$LIBPWDB"])
359
360 dnl Checks for header files.
361 AC_HEADER_DIRENT
362 AC_HEADER_STDC
363 AC_HEADER_SYS_WAIT
364 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/file.h sys/ioctl.h sys/time.h syslog.h termio.h unistd.h sys/fsuid.h inittypes.h)
365
366 AC_CHECK_HEADERS(crypt.h)
367 AC_CHECK_HEADERS(crack.h)
368
369 dnl For module/pam_userdb
370 AC_CHECK_HEADERS(ndbm.h db.h)
371 dnl I suspect the following two lines are a hack.
372 HAVE_NDBM_H=$ac_cv_header_ndbm_h
373 AC_SUBST(HAVE_NDBM_H)
374
375 dnl For module/pam_lastlog
376 AC_CHECK_HEADERS(lastlog.h utmp.h utmpx.h)
377
378 dnl Checks for typedefs, structures, and compiler characteristics.
379 AC_C_BIGENDIAN
380 AC_C_CONST
381 AC_TYPE_UID_T
382 AC_TYPE_OFF_T
383 AC_TYPE_PID_T
384 AC_TYPE_SIZE_T
385 AC_HEADER_TIME
386 AC_STRUCT_TM
387
388 dnl Checks for library functions.
389 AC_TYPE_GETGROUPS
390 AC_PROG_GCC_TRADITIONAL
391 AC_FUNC_MEMCMP
392 AC_FUNC_VPRINTF
393 AC_CHECK_FUNCS(gethostname gettimeofday lckpwdf mkdir select strcspn strdup strspn strstr strtol uname)
394
395 AC_CHECK_FUNCS(getpwnam_r getpwuid_r getgrnam_r getgrgid_r getspnam_r getgrouplist)
396
397 dnl Checks for programs/utilities
398 AC_CHECK_PROG(SGML2PS, sgml2ps, yes, no)
399 AC_CHECK_PROG(SGML2TXT, sgml2txt, yes, no)
400 AC_CHECK_PROG(SGML2HTML, sgml2html, yes, no)
401 AC_CHECK_PROG(SGML2LATEX, sgml2latex, yes, no)
402 AC_CHECK_PROG(PS2PDF, ps2pdf, yes, no)
403 AM_CONDITIONAL([HAVE_SGML2PS], [test "$SGML2PS" = yes || test "$SGML2LATEX" = yes])
404 AM_CONDITIONAL([HAVE_SGML2TXT], [test "$SGML2TXT" = yes])
405 AM_CONDITIONAL([HAVE_SGML2HTML], [test "$SGML2HTML" = yes])
406 AM_CONDITIONAL([HAVE_PS2PDF], [test "$PS2PDF" = yes])
407 if test $SGML2LATEX = "yes" ; then
408   if sgml2latex -h | grep -e --paper | grep  ' -p ' > /dev/null ; then
409     PSER="sgml2latex -o ps"
410   else
411     PSER="sgml2latex -p"
412   fi
413 else
414   if test $SGML2PS = yes ; then
415     PSER="sgml2ps"
416   fi
417 fi
418 AC_SUBST(PSER)
419
420 AM_GNU_GETTEXT_VERSION
421 AM_GNU_GETTEXT([external])
422
423 AH_VERBATIM([_ZZENABLE_NLS],
424 [#ifdef ENABLE_NLS
425 #include <libintl.h>
426 #define _(msgid) dgettext("Linux-PAM", msgid)
427 #define N_(msgid) msgid
428 #else
429 #define _(msgid) (msgid)
430 #define N_(msgid) msgid
431 #endif /* ENABLE_NLS */])
432
433 dnl Files to be created from when we run configure
434 AC_OUTPUT(Makefile libpam/Makefile libpamc/Makefile libpamc/test/Makefile \
435         libpam_misc/Makefile conf/Makefile conf/pam_conv1/Makefile \
436         po/Makefile.in \
437         modules/Makefile \
438         modules/pam_access/Makefile modules/pam_cracklib/Makefile \
439         modules/pam_debug/Makefile modules/pam_deny/Makefile \
440         modules/pam_echo/Makefile modules/pam_env/Makefile \
441         modules/pam_filter/Makefile modules/pam_filter/upperLOWER/Makefile \
442         modules/pam_ftp/Makefile modules/pam_group/Makefile \
443         modules/pam_issue/Makefile modules/pam_lastlog/Makefile \
444         modules/pam_limits/Makefile modules/pam_listfile/Makefile \
445         modules/pam_localuser/Makefile modules/pam_mail/Makefile \
446         modules/pam_mkhomedir/Makefile modules/pam_motd/Makefile \
447         modules/pam_nologin/Makefile modules/pam_permit/Makefile \
448         modules/pam_pwdb/Makefile modules/pam_rhosts/Makefile \
449         modules/pam_rootok/Makefile \
450         modules/pam_securetty/Makefile modules/pam_selinux/Makefile \
451         modules/pam_shells/Makefile modules/pam_stress/Makefile \
452         modules/pam_succeed_if/Makefile modules/pam_tally/Makefile \
453         modules/pam_time/Makefile modules/pam_umask/Makefile \
454         modules/pam_unix/Makefile modules/pam_userdb/Makefile \
455         modules/pam_warn/Makefile modules/pam_wheel/Makefile \
456         modules/pam_xauth/Makefile doc/Makefile doc/specs/Makefile \
457         examples/Makefile)