]> granicus.if.org Git - linux-pam/blobdiff - configure.in
Relevant BUGIDs: none
[linux-pam] / configure.in
index 99ed8d99f42fbefaa885e5d2030995964bd3bbcc..59c90a988eb8f467a2b398a7dc463d84ba42023e 100644 (file)
@@ -2,19 +2,17 @@ dnl Process this file with autoconf to produce a configure script.
 AC_INIT(conf/pam_conv1/pam_conv.y)
 
 dnl The configuration header file
-AC_CONFIG_HEADER(_pam_aconf.h)
+AC_CONFIG_HEADER(config.h)
 
 dnl
 dnl Release specific
 dnl
 
 LIBPAM_VERSION_MAJOR=0
-LIBPAM_VERSION_MINOR=76
+LIBPAM_VERSION_MINOR=81
 
 AC_SUBST(LIBPAM_VERSION_MAJOR)
 AC_SUBST(LIBPAM_VERSION_MINOR)
-AC_DEFINE(LIBPAM_VERSION_MAJOR)
-AC_DEFINE(LIBPAM_VERSION_MINOR)
 
 dnl
 dnl By default, everything under PAM is installed under the root fs.
@@ -22,41 +20,37 @@ dnl
 
 AC_PREFIX_DEFAULT()
 
+dnl
+dnl Useful info (believed to be portable) - in the future
+dnl the LOCALSRCDIR and LOCALOBJDIRs may be different
+dnl
+LOCALSRCDIR=`/bin/pwd`         ; AC_SUBST(LOCALSRCDIR)
+LOCALOBJDIR=`/bin/pwd`         ; AC_SUBST(LOCALOBJDIR)
+OS=`uname|sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
+AC_SUBST(OS)
+
 dnl
 dnl Rules needed for the following (hardcoded Linux defaults for now)
 dnl
 
-CC=gcc                         ; AC_SUBST(CC)
 CONF_CFLAGS=                   ; AC_SUBST(CONF_CFLAGS)
 MKDIR="mkdir -p"               ; AC_SUBST(MKDIR)
-LOCALSRCDIR=`/bin/pwd`         ; AC_SUBST(LOCALSRCDIR)
-OS=`uname|sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
-AC_SUBST(OS)
 
 SHLIBMODE=755                  ; AC_SUBST(SHLIBMODE)
+MANMODE=644                    ; AC_SUBST(MANMODE)
 
 dnl These are most likely platform specific - I think HPUX differs
 USESONAME=yes                  ; AC_SUBST(USESONAME)
-SOSWITCH=-soname               ; AC_SUBST(SOSWITCH)
-NEEDSONAME=no                  ; AC_SUBST(NEEDSONAME)
+SOSWITCH="-Wl,-soname -Wl,"    ; AC_SUBST(SOSWITCH)
+NEEDSONAME=yes                 ; AC_SUBST(NEEDSONAME)
 LDCONFIG=/sbin/ldconfig                ; AC_SUBST(LDCONFIG)
 
-dnl ### Should enable this INSTALL detection.
-dnl ### Would need to distribute GNU's config.guess and config.sub
-dnl AC_PROG_INSTALL
-if test "$OS" = "aix"; then
-  INSTALL=/usr/ucb/install -c
-else
-  INSTALL=/usr/bin/install
-fi
-AC_SUBST(INSTALL)
-
 dnl Checks for programs.
 AC_PROG_CC
 dnl ### AC_PROG_CXX
 AC_PROG_YACC
 AC_PROG_LEX
-dnl AC_PROG_INSTALL
+AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
 
@@ -66,16 +60,43 @@ dnl
 
 dnl lots of debugging information goes to /tmp/pam-debug.log
 AC_ARG_ENABLE(debug,
-[  --enable-debug           qspecify you are building with debugging on],
-       WITH_DEBUG=yes ; AC_DEFINE(DEBUG) , WITH_DEBUG=no)
+[  --enable-debug           specify you are building with debugging on],
+       WITH_DEBUG=yes ; AC_DEFINE([DEBUG],,
+               [lots of stuff gets written to /tmp/pam-debug.log]),
+               WITH_DEBUG=no)
 AC_SUBST(WITH_DEBUG)
 
+AC_ARG_ENABLE(memory-debug,
+[  --enable-memory-debug    specify you want every malloc etc. call tracked],
+       WITH_MEMORY_DEBUG=yes ; AC_DEFINE([MEMORY_DEBUG],,
+               [Every malloc etc. call will be tracked]) , WITH_MEMORY_DEBUG=no)
+AC_SUBST(WITH_MEMORY_DEBUG)
+AH_VERBATIM([_MEMORY_DEBUG], 
+[#ifdef MEMORY_DEBUG
+/*
+ * this is basically a hack - we need to include a semiarbitrary
+ * number of headers to ensure that we don't get silly prototype/macro
+ * confusion.
+ */
+# include <string.h>
+# include <stdlib.h>
+# include <security/pam_malloc.h>
+#endif /* MEMORY_DEBUG */])
+
 dnl build specially named libraries (for debugging purposes)
 AC_ARG_ENABLE(libdebug,
 [  --enable-libdebug        specify you are building debugging libraries],
-       WITH_LIBDEBUG=yes ; AC_DEFINE(WITH_LIBDEBUG) , WITH_LIBDEBUG=no)
+       WITH_LIBDEBUG=yes ; AC_DEFINE([WITH_LIBDEBUG],,
+               [build libraries with different names (suffixed with 'd')]) , WITH_LIBDEBUG=no)
 AC_SUBST(WITH_LIBDEBUG)
 
+dnl have prelude support
+AC_ARG_ENABLE(prelude,
+[  --enable-prelude         build prelude ids support],
+        WITH_PRELUDE=yes ; AC_DEFINE([WITH_PRELUDE],,
+               [Build with prelude ids support]), WITH_PRELUDE=no)
+AC_SUBST(WITH_PRELUDE)
+
 dnl packaging convenience
 AC_ARG_ENABLE(fakeroot,
 [  --enable-fakeroot=<path to packaging directory>], FAKEROOT=$enableval)
@@ -86,6 +107,14 @@ AC_ARG_ENABLE(securedir,
        SECUREDIR=$enableval, SECUREDIR=$libdir/security)
 AC_SUBST(SECUREDIR)
 
+AC_ARG_ENABLE(isadir,
+[  --enable-isadir=<path to arch-specific module files> [default ../../\`basename \$libdir\`/security]],
+ISA=$enableval,
+ISA=../../`basename $libdir`/security)
+unset mylibdirbase
+AC_DEFINE_UNQUOTED(_PAM_ISA,"$ISA",[Define to the path, relative to SECUREDIR, where PAMs specific to this architecture can be found.])
+AC_MSG_RESULT([Defining \$ISA to \"$ISA\".])
+
 AC_ARG_ENABLE(sconfigdir,
 [  --enable-sconfigdir=<path to module conf files> [default \$sysconfdir/security]],
        SCONFIGDIR=$enableval, SCONFIGDIR=$sysconfdir/security)
@@ -101,18 +130,27 @@ AC_ARG_ENABLE(includedir,
        INCLUDEDIR=$enableval, INCLUDEDIR=/usr/include)
 AC_SUBST(INCLUDEDIR)
 
+AC_ARG_ENABLE(docdir,
+[  --enable-docdir=<path to store documentation in - /usr/share/doc/pam>],
+       DOCDIR=$enableval, DOCDIR=/usr/share/doc/pam)
+AC_SUBST(DOCDIR)
+
+AC_ARG_ENABLE(mandir,
+[  --enable-mandir=<path to store manuals in - /usr/share/man>],
+       MANDIR=$enableval, MANDIR=/usr/share/man)
+AC_SUBST(MANDIR)
+
 AC_ARG_ENABLE(pamlocking,
 [  --enable-pamlocking      configure libpam to observe a global authentication lock],
-       WITH_PAMLOCKING=yes ; AC_DEFINE(PAM_LOCKING) , WITH_PAMLOCKING=no)
+       WITH_PAMLOCKING=yes ; AC_DEFINE([PAM_LOCKING],,
+               [libpam should observe a global authentication lock]),
+               WITH_PAMLOCKING=no)
 AC_SUBST(WITH_PAMLOCKING)
 
-AC_ARG_ENABLE(uglyhack,
-[  --enable-uglyhack        configure libpam to try to honor old pam_strerror syntax],
-       AC_DEFINE(UGLY_HACK_FOR_PRIOR_BEHAVIOR_SUPPORT))
-
 AC_ARG_ENABLE(read-both-confs,
 [  --enable-read-both-confs  read both /etc/pam.d and /etc/pam.conf files],
-       AC_DEFINE(PAM_READ_BOTH_CONFS))
+       AC_DEFINE([PAM_READ_BOTH_CONFS],,
+               [read both /etc/pam.d and /etc/pam.conf files]))
 AC_SUBST(PAM_READ_BOTH_CONFS)
 
 AC_ARG_ENABLE(static-libpam, [  --enable-static-libpam   build a libpam.a library],
@@ -157,7 +195,8 @@ exit(1);
 pam_mail_spool="\"/var/spool/mail\"",
 pam_mail_spool="\"/var/spool/mail\"")
 fi
-AC_DEFINE_UNQUOTED(PAM_PATH_MAILDIR, $pam_mail_spool)
+AC_DEFINE_UNQUOTED(PAM_PATH_MAILDIR, $pam_mail_spool,
+       [Path where mails are stored])
 
 dnl Checks for libraries.
 AC_CHECK_LIB(c, __libc_sched_setscheduler, PAM_NEEDS_LIBC=, PAM_NEEDS_LIBC=-lc)
@@ -167,48 +206,80 @@ dnl Checks for the existence of lckpwdf in libc
 AC_CHECK_LIB(c, lckpwdf, HAVE_LCKPWDF=yes, HAVE_LCKPWDF=no)
 AC_SUBST(HAVE_LCKPWDF)
 
-dnl Checks for the existence of libdl - on BSD its part of libc
-AC_CHECK_LIB(dl, dlopen, LIBDL=-ldl) 
+dnl Checks for the existence of libdl - on BSD and Tru64 its part of libc
+AC_CHECK_LIB(dl, dlopen, LIBDL=-ldl)
 AC_SUBST(LIBDL)
 
 dnl
 dnl At least on Solaris, the existing libcrack must be dynamic.
 dnl Ought to introduce a check for this.
 dnl
-AC_CHECK_LIB(crack, FascistCheck, HAVE_LIBCRACK=yes ; AC_DEFINE(HAVE_LIBCRACK),
+AC_CHECK_LIB(crack, FascistCheck, HAVE_LIBCRACK=yes ;
+       AC_DEFINE([HAVE_LIBCRACK],,[Define to 1 if you have the `crack' library (-lcrack).]),
        HAVE_LIBCRACK=no)
 AC_SUBST(HAVE_LIBCRACK)
 
-AC_CHECK_LIB(crypt, fcrypt, HAVE_LIBCRYPT=yes ; AC_DEFINE(HAVE_LIBCRYPT),
+AC_CHECK_LIB(crypt, crypt, HAVE_LIBCRYPT=yes ;
+       AC_DEFINE([HAVE_LIBCRYPT],,[Define to 1 if you have the `crypt' library (-lcrypt).]),
        HAVE_LIBCRYPT=no)
 AC_SUBST(HAVE_LIBCRYPT)
-AC_CHECK_LIB(util, logwtmp, HAVE_LIBUTIL=yes ; AC_DEFINE(HAVE_LIBUTIL),
+AC_CHECK_LIB(util, logwtmp, HAVE_LIBUTIL=yes ;
+       AC_DEFINE([HAVE_LIBUTIL],,[Define to 1 if you have the `util' library (-lutil).]),
        HAVE_LIBUTIL=no)
 AC_SUBST(HAVE_LIBUTIL)
-AC_CHECK_LIB(ndbm, dbm_store, HAVE_LIBNDBM=yes ; AC_DEFINE(HAVE_LIBNDBM),
+AC_CHECK_LIB(ndbm, dbm_store, HAVE_LIBNDBM=yes ;
+       AC_DEFINE([HAVE_LIBNDBM],,[Define to 1 if you have the `ndbm' library (-lndbm).]),
        HAVE_LIBNDBM=no)
 AC_SUBST(HAVE_LIBNDBM)
-AC_CHECK_LIB(db, dbm_store, HAVE_LIBDB=yes ; AC_DEFINE(HAVE_LIBDB),
+AC_CHECK_LIB(db, dbm_store, HAVE_LIBDB=yes ;
+       AC_DEFINE([HAVE_LIBDB],,[Define to 1 if you have the `db' library (-ldb).]),
        HAVE_LIBDB=no)
+if test x$HAVE_LIBDB != xyes ; then
+       AC_CHECK_LIB(db, db_create, HAVE_LIBDB=yes ;
+       AC_DEFINE([HAVE_LIBDB],,[Define to 1 if you have the `db' library (-ldb).]),
+       HAVE_LIBDB=no)
+fi
 AC_SUBST(HAVE_LIBDB)
-AC_CHECK_LIB(fl, yylex, yyterminate, HAVE_LIBFL=yes ; AC_DEFINE(HAVE_LIBFL),
+AC_CHECK_LIB(fl, yylex, yyterminate, HAVE_LIBFL=yes ;
+       AC_DEFINE([HAVE_LIBFL],,[Define to 1 if you have the `fl' library (-lfl).]),
        HAVE_LIBFL=no)
 AC_SUBST(HAVE_LIBFL)
-AC_CHECK_LIB(nsl, yp_maplist, HAVE_LIBNSL=yes ; AC_DEFINE(HAVE_LIBNSL),
+AC_CHECK_LIB(nsl, yp_maplist, HAVE_LIBNSL=yes ;
+       AC_DEFINE([HAVE_LIBNSL],,[Define to 1 if you have the `nsl' library (-lnsl).]),
        HAVE_LIBNSL=no)
 AC_SUBST(HAVE_LIBNSL)
-AC_CHECK_LIB(pwdb, pwdb_db_name, HAVE_LIBPWDB=yes ; AC_DEFINE(HAVE_LIBPWDB),
-       HAVE_LIBPWDB=no)
+
+AC_CHECK_LIB(selinux, getfilecon, HAVE_LIBSELINUX=yes ;
+       AC_DEFINE([HAVE_LIBSELINUX],,[Define to 1 if you have the `nsl' library (-lnsl).]),
+       HAVE_LIBSELINUX=no)
+AC_SUBST(HAVE_LIBSELINUX)
+
+if test $HAVE_LIBSELINUX = yes ; then
+       pwdblibs="$pwdblibs -lselinux"
+fi
+if test $HAVE_LIBNSL = yes ; then
+       pwdblibs="$pwdblibs -lnsl"
+fi
+AC_CHECK_LIB(pwdb, pwdb_db_name, HAVE_LIBPWDB=yes ;
+       AC_DEFINE([HAVE_LIBPWDB],,[Define to 1 if you have the `pwdb' library (-lpwdb).]),
+       HAVE_LIBPWDB=no,$pwdblibs)
 AC_SUBST(HAVE_LIBPWDB)
+unset pwdblibs
+
+AC_CHECK_LIB(fl, yywrap, HAVE_LIBFLEX=yes ;
+       AC_DEFINE([HAVE_LIBFLEX],,[Define to 1 if you have the `fl' library (-lfl).]),
+       HAVE_LIBFLEX=no)
+AC_SUBST(HAVE_LIBFLEX)
+AC_CHECK_LIB(l, yywrap, HAVE_LIBLEX=yes ;
+       AC_DEFINE([HAVE_LIBLEX],,[Define to 1 if you have the `l' library (-ll).]),
+       HAVE_LIBLEX=no)
+AC_SUBST(HAVE_LIBLEX)
 
 dnl Checks for header files.
 AC_HEADER_DIRENT
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/file.h sys/ioctl.h sys/time.h syslog.h termio.h unistd.h)
-
-dnl Linux wants features.h in some of the source files.
-AC_CHECK_HEADERS(features.h)
+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)
 
 dnl For module/pam_cracklib
 AC_CHECK_HEADERS(crypt.h)
@@ -228,7 +299,7 @@ dnl being found.
 dnl Look for cracklib dictionary
 AC_MSG_CHECKING(path to cracklib dictionary)
 DICT_DIR_CANDIDATES="/usr/lib /usr/share/dict /usr/share/lib \
-  /usr/local/lib /usr/local/share/lib"
+  /usr/local/lib /usr/local/share/lib /usr/share/cracklib"
 DICT_FILE_CANDIDATES="pw_dict cracklib_dict"
 CRACKLIB_DICTPATH=""
 for d in $DICT_DIR_CANDIDATES ; do
@@ -243,7 +314,7 @@ for d in $DICT_DIR_CANDIDATES ; do
       done
 done
 if test -z "$CRACKLIB_DICTPATH" ; then
-      AC_MSG_RESULT(none found)
+      AC_MSG_WARN([none found - pam_cracklib will not be built])
 else
       AC_MSG_RESULT($CRACKLIB_DICTPATH)
 fi
@@ -252,9 +323,7 @@ AC_SUBST(CRACKLIB_DICTPATH)
 dnl Set FLAGS, linker options etc. depending on C compiler.
 dnl gcc is tested and much preferred; others less so, if at all
 dnl
-dnl If compiling with gcc, linking is also supposed to be done with gcc;
-dnl since we use linker-specific arguments, we may not gain anything by
-dnl switching LD_L over, but I think we can use LD_D as-is.
+dnl If compiling with gcc, linking is also supposed to be done with gcc
 dnl
 dnl For the moment, gcc is enforced above at "CC=gcc".
 dnl
@@ -269,18 +338,19 @@ GCC_WARNINGS="-Wall -Wwrite-strings \
        -Wnested-externs -Winline -Wshadow"
 
 if test "$GCC" = yes; then
+       CC=gcc                          ; AC_SUBST(CC)
 ### May need per-OS attention
 ### Example: -D_POSIX_SOURCE: needed on Linux but harms Solaris.
        case $OS in
        linux)
-               OS_CFLAGS="-ansi -D_POSIX_SOURCE -pedantic"
-               LD_D="gcc -shared -Xlinker -x"
+               OS_CFLAGS=
+               LD_D="$CC -shared $LDFLAGS"
                WARNINGS="$GCC_WARNINGS"
                PIC="-fPIC"
                DYNTYPE=so
-               LD=ld                           
-               LD_L="$LD -x -shared"
-               RANLIB=ranlib
+               LD=gcc
+               LD_L="$CC -shared $LDFLAGS"
+               RANLIB=:
                STRIP=strip
                CC_STATIC="-Xlinker -export-dynamic"
                ;;
@@ -290,7 +360,7 @@ if test "$GCC" = yes; then
                WARNINGS="$GCC_WARNINGS"
                PIC="-fPIC"
                DYNTYPE=so
-               LD=ld                           
+               LD=ld
                LD_L="$LD -x -shared"
                RANLIB=ranlib
                STRIP=strip
@@ -299,7 +369,7 @@ if test "$GCC" = yes; then
        aix)
                OS_CFLAGS=""
                DYNTYPE=lo
-               LD=ld                           
+               LD=ld
                LD_L=ld -bexpall -bM:SRE -bnoentry
                LD_D="$LD_L"
                RANLIB=ranlib
@@ -313,17 +383,45 @@ else
 ###
 ### Non-gcc needs attention on per-OS basis
 ###
-### [These are Solaris-C specific...]
-       OS_CFLAGS=""
-       WARNINGS=""
-       PIC="-K pic"
-       DYNTYPE=so
-       LD=ld
-       LD_D="cc -z text -G -R."
-       LD_L="$LD_D"
-       RANLIB=ranlib
-       STRIP=strip
-       CC_STATIC=
+       case "$OS" in
+       darwin)
+# add some stuff here (see sourceforge bug 534205)
+# DOCDIR=/System/Documentation/Administration/Libraries/PAM
+# MANDIR=/usr/share/man
+               ;;
+       solaris)
+           ### Support for Solaris-C
+           OS_CFLAGS=""
+           WARNINGS=""
+           PIC="-K pic"
+           LD=ld
+           LD_D="cc -z text -G -R."
+           LD_L="$LD_D"
+           RANLIB=ranlib
+           STRIP=strip
+           CC_STATIC=
+           ;;
+       irix*)
+           OSRELEASE=`uname -r`
+           if test "$OSRELEASE" = 6.5; then
+               OS_CFLAGS=""
+               WARNINGS="-fullwarn"
+               PIC=                    #PIC code is default for IRIX
+               LD="cc -shared"         # modules friendly approach
+               LD_D="cc -shared"
+               LD_L="ld -G -z redlocsym"
+               RANLIB=echo
+               STRIP=strip
+               CC_STATIC=
+           else
+               echo "IRIX prior to 6.5 not allowed for"
+               exit
+           fi
+           ;;
+       *) echo "Native compiler on $OS is not yet supported"
+               exit
+           ;;
+       esac
 fi
 
 AC_SUBST(DYNTYPE)
@@ -354,6 +452,8 @@ AC_FUNC_MEMCMP
 AC_FUNC_VPRINTF
 AC_CHECK_FUNCS(gethostname gettimeofday mkdir select strcspn strdup strerror strspn strstr strtol uname)
 
+AC_CHECK_FUNCS(getpwnam_r getpwuid_r getgrnam_r getgrgid_r getspnam_r getgrouplist)
+
 dnl Checks for programs/utilities
 AC_CHECK_PROG(HAVE_SGML2TXT, sgml2txt, yes, no)
 AC_CHECK_PROG(HAVE_SGML2HTML, sgml2html, yes, no)
@@ -364,6 +464,7 @@ if test $HAVE_SGML2LATEX = "yes" ; then
   else
     PSER="sgml2latex -p"
   fi
+  AC_CHECK_PROG(HAVE_PS2PDF, ps2pdf, yes, no)
 else
   AC_CHECK_PROG(HAVE_SGML2PS, sgml2ps, yes, no)
   if test $HAVE_SGML2PS = yes ; then
@@ -371,6 +472,7 @@ else
   fi
 fi
 AC_SUBST(PSER)
+AC_SUBST(PS2PDF)
 
 dnl Files to be created from when we run configure
 AC_OUTPUT(Make.Rules)