dnl Process this file with autoconf to produce a configure script. dnl dnl @(#) $Id$ dnl AC_INIT(calife.c, [3.0], [roberto@keltia.freenix.fr]) AC_CONFIG_HEADER(config.h) AC_PREFIX_DEFAULT(/usr/local) AC_CANONICAL_HOST dnl Checks for programs. AC_PROG_CC BINGRP="wheel" case "$host" in *-*-sunos*) CFLAGS="$CFLAGS -DSUNOS4" os_sunos=yes ;; *-sgi-irix6*) if test "`uname -s`" = "IRIX64"; then CFLAGS="-32 $CFLAGS" LDFLAGS="-32 $LDFLAGS" fi ;; *-ibm-aix3.2|*-ibm-aix3.2.0|*-ibm-aix3.2.1|*-ibm-aix3.2.2|*-ibm-aix3.2.3|*-ibm-aix3.2.4) os_aix=yes CFLAGS="$CFLAGS -DAIX" AC_CHECK_LIB(s, getuserattr) ;; *-ibm-aix*) os_aix=yes CFLAGS="$CFLAGS -DAIX" AC_CHECK_LIB(s, getuserattr) ;; *-sun-solaris2.10) CFLAGS="$CFLAGS -DSUNOS510" os_solaris=yes ;; *-sun-solaris2*) os_solaris=yes WITH_PAM=yes with_pam=yes AC_DEFINE(WITH_PAM) ;; *-apple-darwin10*) os_darwin=yes WITH_PAM=yes with_pam=yes AC_DEFINE(WITH_PAM) CFLAGS="$CFLAGS -DOSX=106" ;; *-apple-darwin*) os_darwin=yes WITH_PAM=yes with_pam=yes AC_DEFINE(WITH_PAM) ;; *-dec-ultrix*) AC_TRY_COMPILE([#include ], [int foo = LOG_DAEMON; ], , AC_DEFINE(NEED_SYS_SYSLOG_H)) ;; *-*-hpux*) # HPUX flags from jgotts@engin.umich.edu CFLAGS="$CFLAGS -DHPUX" BINGRP="sys" os_hpux=yes ;; alpha-dec-osf*) AC_MSG_CHECKING(for OSF/1 C2 security package) osfc2sec=`/usr/sbin/setld -i | grep '^OSFC2SEC'` if test -n "$osfc2sec"; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_OSF1_C2_SECURITY) AC_CHECK_LIB(security, set_auth_parameters, LIBS="$LIBS -lsecurity", AC_MSG_ERROR("Could not find libsecurity even though C2 security installed.")) CONFOBJS="$CONFOBJS osfc2.o" else AC_MSG_RESULT(no) fi ;; *-next-nextstep*) # NeXT has sys/wait.h but use "union wait". AC_DEFINE(HAVE_NON_POSIX_WAIT_H) ;; *-*-linux*|*-*-mklinux*) os_linux=yes CFLAGS="-D_GNU_SOURCE $CFLAGS" AC_CHECK_FUNC(getspnam) if test $ac_cv_func_getspnam = no; then AC_CHECK_LIB(shadow, getspnam) fi if test $ac_cv_func_getspnam = yes; then AC_DEFINE(HAVE_ETC_SHADOW) fi no_shadows_password_checking=yes AC_CHECK_FUNCS(pw_encrypt, pwencrypt=yes) if test $ac_cv_func_pw_encrypt = no; then AC_CHECK_LIB(shadow, pw_encrypt, [ pwencrypt=yes pwencryptlib="-lshadow" ]) fi AC_MSG_CHECKING([whether to enable pw_encrypt]) AC_ARG_ENABLE(deprecated-linux-pw-encrypt, [ --enable-deprecated-linux-pw-encrypt Enable using of deprecated linx pw_encrypt function.], [ if test -z "$pwencrypt"; then AC_MSG_RESULT(no) else AC_DEFINE(crypt,pw_encrypt) AC_MSG_RESULT(no) if test -n "$pwencryptlib"; then LIBS="$LIBS $pwencryptlib" fi fi ], AC_MSG_RESULT(no) ) ;; *-*-sysv4*) CFLAGS="$CFLAGS -DSVR4" AC_CHECK_LIB(gen, openlog) BINGRP="sys" ;; i*86-unknown-sco*) LIBS="$LIBS -L/usr/lib/libp" AC_DEFINE(HAVE_SCO_ETC_SHADOW) AC_DEFINE(SCO) AC_CHECK_LIB(prot, accept_pw) AC_CHECK_LIB(x, chsize) ;; *) ;; esac if test -z "$no_pipe"; then if test -n "$GCC"; then AC_MSG_CHECKING([if the compiler understands -pipe]) OLDCC="$CC" CC="$CC -pipe" AC_TRY_COMPILE(,, AC_MSG_RESULT(yes), CC="$OLDCC" AC_MSG_RESULT(no)) fi fi AC_PROG_INSTALL AC_PATH_PROG(SU_CMD, su, "/bin/su") AC_DEFINE_UNQUOTED(SU_CMD, "$SU_CMD") AC_PATH_PROG(GROFF, groff, ":") AC_PATH_PROG(RM, rm, "/bin/rm") AC_PATH_PROG(MV, mv, "/bin/mv") AC_PROGRAMS_CHECK(MAKEDEP, makedepend makedep, makedepend) if test "$ac_cv_prog_GROFF" = no; then ac_msg='you don''t have groff so use the preformatted man pages' AC_MSG_WARN($ac_msg) fi dnl Checks for libraries. AC_CHECK_LIB(crypt,crypt) dnl Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h libgen.h shadow.h stdarg.h stdlib.h) AC_CHECK_HEADERS(string.h syslog.h unistd.h) AC_CHECK_HEADERS(sys/param.h sys/resource.h sys/time.h) AC_CHECK_HEADERS([utime.h], [], [], [[#ifdef HAVE_UTIME_H # include #endif ]]) AC_CHECK_HEADERS([sys/resource.h], [], [], [[#ifdef HAVE_SYS_TIME_H # include #endif #ifdef HAVE_SYS_RESOURCE_H # include #endif ]]) AC_MSG_CHECKING(whether unistd.h needs _XOPEN_SOURCE for crypt(3)) AC_CACHE_VAL(su_cv_unistd_needs_xopen_source, [AC_EGREP_CPP(yes, [#define crypt yes #include ], su_cv_unistd_needs_xopen_source=no, AC_EGREP_CPP(yes, [#define crypt yes #define _XOPEN_SOURCE #include ], su_cv_unistd_needs_xopen_source=yes, su_cv_unistd_needs_xopen_source=no))]) AC_MSG_RESULT($su_cv_unistd_needs_xopen_source) test $su_cv_unistd_needs_xopen_source = yes && AC_DEFINE(_XOPEN_SOURCE) dnl Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T AC_TYPE_UID_T AC_TYPE_PID_T dnl Checks for library functions. AC_TYPE_SIGNAL AC_CHECK_FUNCS(openlog syslog) AC_CHECK_FUNCS(seteuid) AC_CHECK_FUNCS(setresuid) AC_CHECK_FUNCS(setrlimit getrlimit) AC_CHECK_FUNCS(basename) AC_CHECK_FUNCS(sigaction) AC_CHECK_FUNCS(sigprocmask) AC_CHECK_FUNCS(initgroups) AC_CHECK_FUNCS(getspnam) AC_CHECK_FUNCS(getpassphrase) AC_CHECK_FUNCS(sysconf) dnl Define HAVE_RLIMIT if getrlimit/setrlimit exists and the symbol dnl we're interested in exists (in HP-UX 9, it doesn't !!!). AC_MSG_CHECKING(for a working set/getrlimit) if test $ac_cv_func_setrlimit = yes -a $ac_cv_func_getrlimit = yes; then AC_EGREP_CPP(yes, [#include #ifdef RLIMIT_CORE yes #endif ], have_rlimit_core=yes, have_rlimit_core=no) if test $have_rlimit_core = yes; then AC_DEFINE(HAVE_RLIMIT) fi fi AC_MSG_RESULT($have_rlimit_core) dnl Define NO_SYSLOG if openlog/syslog don't exist if test $ac_cv_func_openlog = no -o $ac_cv_func_syslog = no; then AC_DEFINE(NO_SYSLOG) fi dnl Look for a proper POSIX sysconf AC_MSG_CHECKING(for a working POSIX sysconf) if test $ac_cv_func_sysconf = yes; then AC_EGREP_CPP(yes, [#include #ifdef _SC_LINE_MAX yes #endif ], have_line_max=yes, have_line_max=no) if test $have_line_max = yes; then AC_DEFINE(HAVE_WORKING_SYSCONF) fi fi AC_MSG_RESULT($have_line_max) dnl What style of signal do you have (POSIX, BSD, or SYSV)? AC_MSG_CHECKING(what style of signals to use) if test $ac_cv_func_sigaction = yes -a $ac_cv_func_sigprocmask = yes; then signals_style=POSIX_SIGNALS AC_DEFINE(HAVE_POSIX_SIGNALS) fi AC_MSG_RESULT($signals_style) AC_MSG_CHECKING(how to name the installed binary) AC_ARG_WITH(program, [ --with-program=NAME Installed binary name (default calife)], [ case "$withval" in no) AC_MSG_ERROR(Need PROGRAM.) ;; yes) AC_MSG_ERROR(Need PROGRAM.) ;; *) IPROGRAM="$withval" AC_MSG_RESULT($withval) ;; esac ], IPROGRAM="calife" AC_MSG_RESULT(calife) ) AC_ARG_WITH(pam, [ --with-pam enable PAM support], [case $with_pam in yes) AC_DEFINE(WITH_PAM) AC_MSG_CHECKING(whether to use PAM authentication) AC_MSG_RESULT(yes) with_passwd=no LIBS="$LIBS -lpam" WITH_PAM=yes ;; no) ;; *) AC_MSG_ERROR(["--with-pam does not take an argument."]) ;; esac]) dnl dnl Extra PAM foolishness dnl if test "$with_pam" = "yes"; then dnl dnl Some PAM implementations (MacOS X for example) put the PAM headers dnl in /usr/include/pam instead of /usr/include/security... dnl AC_CHECK_HEADERS([pam/pam_appl.h]) fi if test -n "$WITH_PAM"; then enable_dynamic=yes else if test -n "$GCC"; then AC_MSG_CHECKING(if the command should be linked dynamically) AC_ARG_ENABLE(dynamic, [ --enable-dynamic Build the program dynamically (default static)], [ case "$withval" in no) if test x$os_solaris = xyes -o x$os_hpux = xyes -o \ x$os_darwin = xyes -o x$os_linux = xyes; then ac_msg='it will not work on HP-UX, Linux, MacOS X & Solaris, \ linking dynamically.' AC_MSG_WARN($ac_msg) AC_MSG_RESULT(yes) undef STATIC_LINK else LDFLAGS="$LDFLAGS -static" AC_MSG_RESULT(no) STATIC_LINK=1 fi ;; yes) AC_MSG_RESULT(yes) ;; *) AC_MSG_RESULT(yes) ;; esac ], if test x$os_solaris != xyes -a x$os_hpux != xyes -a \ x$os_darwin != xyes -a x$os_linux != xyes; then LDFLAGS="$LDFLAGS -static" STATIC_LINK=1 fi AC_MSG_RESULT(yes) ) fi fi dnl # WITH_PAM AC_MSG_CHECKING(where to put calife.auth) AC_ARG_WITH(etcdir, [ --with-etcdir=PATH Directory containing calife.auth (default /etc)], [ case "$withval" in no) AC_MSG_ERROR(Need ETCDIR.) ;; yes) ETCDIR="/etc" AC_MSG_RESULT(/etc) ;; *) ETCDIR="$withval" AC_MSG_RESULT($withval) ;; esac ], ETCDIR="/etc" AC_MSG_RESULT(/etc) ) AC_MSG_CHECKING(whether we want to execute /etc/calife.out) AC_ARG_ENABLE(global-rc, [ --enable-global-rc Add /etc/calife.out support], [ case "$withval" in yes) AC_DEFINE(WANT_GLOBAL_RC) AC_MSG_RESULT(yes) ;; no) AC_MSG_RESULT(no) ;; *) AC_DEFINE(WANT_GLOBAL_RC) AC_MSG_RESULT(yes) ;; esac ], AC_MSG_RESULT(no) ) case "$host" in *-*-linux*) # New option to enable/disable getspnam(3) usage AC_MSG_CHECKING(whether we want to disable shadow passwords) AC_ARG_ENABLE(shadow, [ --disable-shadow Disable getspnam(3) usage for some Linuxes], [ case "$withval" in yes) AC_DEFINE(UNUSED_SHADOW) AC_MSG_RESULT(yes) ;; no) AC_MSG_RESULT(no) ;; *) AC_DEFINE(UNUSED_SHADOW) AC_MSG_RESULT(yes) ;; esac ], AC_MSG_RESULT(no) ) esac AC_MSG_CHECKING(whether we want debugging output) AC_ARG_ENABLE(debug, [ --enable-debug Set the debugging mode (default is no)], [ case "$withval" in no) AC_MSG_RESULT(no) ;; yes) AC_DEFINE(DEBUG) AC_MSG_RESULT(yes) ;; *) AC_DEFINE(DEBUG) AC_MSG_RESULT(yes) ;; esac ], AC_MSG_RESULT(no) ) AC_MSG_CHECKING(whether we have a setuid-aware shell) AC_ARG_ENABLE(shellhack, [ --enable-shellhack Try to fool the shell about our setuidness], [ case "$withval" in no) AC_MSG_RESULT(no) ;; yes) AC_DEFINE(NO_SETUID_SHELL) AC_MSG_RESULT(yes) ;; *) AC_MSG_RESULT(no) ;; esac ], AC_MSG_RESULT(no) ) AC_ARG_ENABLE(warnings, [ --enable-warnings Enable -Wall if using gcc.], [ if test -n "$GCC"; then AC_MSG_RESULT(Adding -Wall to CFLAGS.) CFLAGS="$CFLAGS -Wall" fi]) AC_ARG_ENABLE(pedantic, [ --enable-pedantic Enable -pedantic if using gcc.], [ if test -n "$GCC"; then AC_MSG_RESULT(Adding -pedantic to CFLAGS.) CFLAGS="$CFLAGS -pedantic" fi]) AC_SUBST(IPROGRAM) AC_SUBST(ETCDIR) AC_SUBST(GROFF) AC_SUBST(MV) AC_SUBST(RM) AC_SUBST(BINGRP) AC_OUTPUT(Makefile calife.1 calife.auth.5)