dnl Process this file with autoconf to produce a configure script. dnl A configure script is provided, in cause you do not have autoconf. AC_PREREQ(2.13) AC_INIT(CHANGES) PACKAGE=`sed -n 's/.*package.*"\(.*\)".*/\1/p' $srcdir/version.h.in|tr -d ' '` VERSION=`sed -n 's/.*version.*"\(.*\)".*/\1/p' $srcdir/version.h.in|tr -d ' '` dnl VERSION needs to be updated in version.h.in such that 'make dist' dnl uses the correct filename for the directory name and tarball and binaries dnl get the right version numbers. AM_INIT_AUTOMAKE($PACKAGE, $VERSION, tac_plus@shrubbery.net) AM_MAINTAINER_MODE() dnl AC_CONFIG_SUBDIRS(etc man share) # what OS dnl ---- XXX: these really should deal with the individual reasons why dnl linux/whatever is different, rather than a blanket stmt dnl is this crack, i mean linux? AH_TEMPLATE(AIX, [define this if your o/s is AIX]) AH_TEMPLATE(FREEBSD, [define this if your o/s is FreeBSD]) AH_TEMPLATE(NETBSD, [define this if your o/s is NetBSD]) AH_TEMPLATE(SOLARIS, [define this if your o/s is Solaris]) AH_TEMPLATE(HPUX, [define this if your o/s is HPux]) AH_TEMPLATE(LINUX, [define this if your o/s is Linux]) AH_TEMPLATE(MIPS, [define this if your o/s is MIPS]) AC_CANONICAL_HOST case "${host_os}" in *aix* ) # For AIX echo "See /usr/lpp/bos/bsdport on your system for details of how " \ "to define bsdcc." CC=bsdcc; export CC # CPPFLAGS="$CFLAGS -I/usr/local/include"; export CPPFLAGS # LDFLAGS="$LDFLAGS -L/usr/local/lib"; export LDFLAGS # LIBS="-lcrypt"; export LIBS AC_DEFINE(AIX) ;; *freebsd* ) #CPPFLAGS="$CFLAGS -I/usr/pkg/include"; export CPPFLAGS #LDFLAGS="$LDFLAGS -L/usr/pkg/lib -Xlinker -rpath -Xlinker /usr/pkg/lib" #export LDFLAGS LIBS="-lcrypt"; export LIBS AC_DEFINE(FREEBSD) ;; *netbsd* ) #CPPFLAGS="$CFLAGS -I/usr/pkg/include"; export CPPFLAGS #LDFLAGS="$LDFLAGS -L/usr/pkg/lib -Xlinker -rpath -Xlinker /usr/pkg/lib" #export LDFLAGS LIBS="-lcrypt"; export LIBS AC_DEFINE(NETBSD) ;; *solaris* ) #CPPFLAGS="$CFLAGS -I/usr/local/include"; export CPPFLAGS #LDFLAGS="$LDFLAGS -L/usr/local/lib"; export LDFLAGS LIBS="-lnsl -lsocket"; export LIBS AC_DEFINE(SOLARIS) ;; *hpux* ) # For HP/UX # CPPFLAGS="$CFLAGS -I/usr/local/include"; export CPPFLAGS # LDFLAGS="$LDFLAGS -L/usr/local/lib"; export LDFLAGS # LIBS="-lcrypt"; export LIBS AC_DEFINE(HPUX) ;; *linux* ) # XXX: not sure if /usr/local is necessary. # XXX: linux libwrap needs -lnsl. configure should check for # existence of libnsl instead of hard-coding CPPFLAGS="$CFLAGS -I/usr/local/include"; export CPPFLAGS LDFLAGS="$LDFLAGS -L/usr/local/lib"; export LDFLAGS LIBS="-lnsl -lcrypt"; export LIBS AC_DEFINE(LINUX) # XXX: does linux need glibc: -DGLIBC ;; *mips* ) CPPFLAGS="$CFLAGS -I/usr/local/include"; export CPPFLAGS LDFLAGS="$LDFLAGS -L/usr/local/lib"; export LDFLAGS LIBS="-lcrypt"; export LIBS AC_DEFINE(MIPS) ;; * ) CPPFLAGS="$CFLAGS -I/usr/local/include"; export CPPFLAGS LDFLAGS="$LDFLAGS -L/usr/local/lib"; export LDFLAGS ;; esac ################## #PATH=${PATH}:/usr/local/bin dnl default install location AC_PREFIX_DEFAULT(/usr/local) dnl this doesnt work well if the program has not been installed before. dnl # guess the --prefix setting dnl AC_PREFIX_PROGRAM(tac_plus) # make sure MAKE sets ${MAKE} AC_PATH_PROG(MAKE,gmake,no) if test $MAKE = no; then unset ac_cv_path_MAKE AC_PATH_PROG(MAKE,make,no) if test $MAKE = no; then AC_MSG_ERROR([can't locate a make.]) exit 1 fi fi AC_PROG_MAKE_SET() AM_MAINTAINER_MODE() # compiler specifics AC_PROG_CC AM_C_PROTOTYPES AC_PROG_CPP AC_C_CONST AC_C_INLINE AC_C_STRINGIZE AC_PROG_INSTALL AC_PROG_RANLIB dnl configure options dnl dnl debug - aka compiler symbols dnl AC_MSG_CHECKING(whether to include symbols) AH_TEMPLATE(DBG, [define this to include debugging support]) AC_ARG_ENABLE(debug, [ --enable-debug include compiler symbols], [ case "$enable_debug" in no) AC_MSG_RESULT(no) ;; yes) AC_MSG_RESULT(yes) DBG="-g" AC_DEFINE(DBG) ;; *) AC_MSG_RESULT(no) ;; esac ], # ie: no --{enable,disable}-debug option, withval == "" AC_MSG_RESULT(no) ) AC_SUBST(DBG) dnl dnl warn - aka gcc warnings dnl dnl XXX: this should only be set for gcc.... AC_MSG_CHECKING(whether to set gcc warnings) AH_TEMPLATE(WARN, [define this to set pedantic gcc warnings]) AC_ARG_ENABLE(warn, [ --enable-warn pedantic gcc warnings], [ case "$enable_debug" in no) AC_MSG_RESULT(no) WARN="" AC_DEFINE(WARN) ;; yes) AC_MSG_RESULT([yes -Wall]) WARN="-Wall" AC_DEFINE(WARN) ;; *) AC_MSG_RESULT(no) WARN="" AC_DEFINE(WARN) ;; esac ], # ie: no --{enable,disable}-warn option, withval == "" WARN="" AC_DEFINE(WARN) AC_MSG_RESULT(no) ) AC_SUBST(WARN) dnl dnl libwarp - aka tcp_wrappers dnl hijacked this from ssh, but mimiced the '*' "clause" for 'yes' dnl AC_MSG_CHECKING(whether to use libwrap) AH_TEMPLATE(LIBWRAP, [define this to include libwrap (tcp_wrappers) support]) AH_TEMPLATE(HAVE_LIBWRAP, []) AC_ARG_WITH(libwrap, [ --with-libwrap[[=PATH]] libwrap (tcp_wrappers) support. PATH is dir above lib, eg: /usr/local. (default)], [ case "$withval" in no) AC_MSG_RESULT(no) ;; yes) AC_MSG_RESULT(yes) AC_DEFINE(LIBWRAP) WRAPLIBS="-lwrap" OLDLIBS="$LIBS" LIBS="$WRAPLIBS $LIBS" AC_TRY_LINK([ int allow_severity; int deny_severity; ], [ hosts_access(); ], [AC_DEFINE(LIBWRAP) WRAPLIBS="-lwrap" AC_DEFINE(HAVE_LIBWRAP) ], [ AC_MSG_ERROR(Could not find libwrap. You must first install tcp_wrappers.) ]) LIBS="$OLDLIBS" ;; *) AC_MSG_RESULT(yes) AC_DEFINE(LIBWRAP) if test -d "$withval"; then WRAPINCS="-I$withval/include" WRAPLIBS="-L$withval/lib -lwrap -R$withval/lib" else WRAPLIBS="$withval" fi OLDLIBS="$LIBS" OLDINCS="$INCLUDES" LIBS="$WRAPLIBS $LIBS" INCLUDES="$WRAPINCS" AC_TRY_LINK([ int allow_severity; int deny_severity; ], [ hosts_access(); ], [], [ AC_MSG_ERROR(Could not find libwrap. You must first install tcp_wrappers.) ]) LIBS="$OLDLIBS" INCLUDES="$OLDINCS" ;; esac ], # XXX: is "no" correct? AC_MSG_RESULT(yes) AC_DEFINE(LIBWRAP) WRAPLIBS="-lwrap" OLDLIBS="$LIBS" LIBS="$WRAPLIBS $LIBS" AC_TRY_LINK([ int allow_severity; int deny_severity; ], [ hosts_access(); ], [AC_DEFINE(LIBWRAP) WRAPLIBS="-lwrap" AC_DEFINE(HAVE_LIBWRAP) ], [ AC_MSG_ERROR(Could not find libwrap. You must first install tcp_wrappers.) ]) LIBS="$OLDLIBS" ) AC_SUBST(WRAPINCS) AC_SUBST(WRAPLIBS) dnl dnl skey - aka One Time Password mechanism dnl AC_MSG_CHECKING([whether to include skey support]) AH_TEMPLATE(SKEY, [define this to include support for skey]) AC_ARG_WITH(skey, [ --with-skey[[=PATH]] libskey (skey) support. PATH is dir above lib, eg: /usr/local], [ case "$withval" in no) AC_MSG_RESULT(no) ;; yes) AC_MSG_RESULT(yes) AC_DEFINE(SKEY) AC_SEARCH_LIBS([skey_get_algorithm], [skey], [ ], [AC_MSG_ERROR(Could not find libskey. You must first install skey or provide a hint to the location of library and includes, as in --with-skey=/usr/local.) ]) ;; *) AC_MSG_RESULT(yes) AC_DEFINE(SKEY) if test -d "$withval" ; then LDFAGS="$LDFLAGS -L$withval/lib" CFLAGS="$CFLAGS -I$withval/include" AC_SEARCH_LIBS([skey_get_algorithm], [skey], [ ], [AC_MSG_ERROR([Could not find libskey.]) ]) else AC_SEARCH_LIBS([skey_get_algorithm], [$withval], [ ], [AC_MSG_ERROR([Could not find lib$withval.]) ]) fi ;; esac ], AC_MSG_RESULT(no) ) AC_SUBST(SKEY) dnl dnl XXX: might be good to have these as config file options dnl or just options for running scripts dnl userid - aka TACPLUS_USERID dnl AC_MSG_CHECKING([whether to setuid()]) AH_TEMPLATE(TACPLUS_USERID, [define this to a UID for setuid() at run-time]) AC_ARG_WITH(userid, [ --with-userid=UID tacacs will setuid(UID) after it binds the tcp port], [ case "$withval" in no) AC_MSG_RESULT(no) ;; yes) AC_MSG_ERROR([--with-userid requires a UID argument.]) ;; *) expr $withval + 1 > /dev/null 2>&1 if test $? != 0 ; then AC_MSG_ERROR([--with-userid requires a numeric UID argument.]) fi AC_MSG_RESULT($withval) AC_DEFINE_UNQUOTED(TACPLUS_USERID, $withval) ;; esac ], # ie: no --{with,without}-userid option, withval == "" AC_MSG_RESULT(no) ) AC_SUBST(TACPLUS_USERID) dnl dnl groupid - aka TACPLUS_GROUPID dnl AC_MSG_CHECKING(whether to setgid()) AH_TEMPLATE(TACPLUS_GROUPID, [define this to a GID for setgid() at run-time]) AC_ARG_WITH(groupid, [ --with-groupid=UID tacacs will setgid(GID) after it binds the tcp port], [ case "$withval" in no) AC_MSG_RESULT(no) ;; yes) AC_MSG_ERROR([--with-groupid requires a GID argument.]) ;; *) expr $withval + 1 > /dev/null 2>&1 if test $? != 0 ; then AC_MSG_ERROR([--with-groupid requires a numeric GID argument.]) fi AC_MSG_RESULT($withval) AC_DEFINE_UNQUOTED(TACPLUS_GROUPID, $withval) ;; esac ], # ie: no --{with,without}-userid option, withval == "" AC_MSG_RESULT(no) ) AC_SUBST(TACPLUS_GROUPID) dnl dnl ACLs - aka tacacs config ACLs dnl AC_MSG_CHECKING(whether to include ACL support) AH_TEMPLATE(ACLS, [define this to include ACL support]) AC_ARG_ENABLE(acls, [ --enable-acls tacacs config ACL support (default)], [ case "$enable_acls" in no) AC_MSG_RESULT(no) use_acls=0 ;; yes) AC_MSG_RESULT(yes) AC_DEFINE(ACLS) use_acls=1 ;; *) AC_MSG_RESULT(yes) AC_DEFINE(ACLS) use_acls=1 ;; esac ], # ie: no --{enable,disable}-acls option, withval == "" AC_MSG_RESULT(yes) AC_DEFINE(ACLS) use_acls=1 ) AC_SUBST(ACLS) dnl dnl UENABLE - aka tacacs config user enable. UENABLE requires ACLS. dnl AC_MSG_CHECKING(whether to include user-enable support) AH_TEMPLATE(UENABLE, [define this to include user-specific enable password support]) AC_ARG_ENABLE(uenable, [ --enable-uenable tacacs config per-user enable support (default)], [ case "$enable_uenable" in no) AC_MSG_RESULT(no) use_uenable=0 ;; yes | *) AC_MSG_RESULT(yes) AC_DEFINE(UENABLE) use_uenable=1 ;; esac ], # ie: no --{enable,disable}-uenable option, withval == "" AC_MSG_RESULT(yes) AC_DEFINE(UENABLE) use_uenable=1 ) AC_SUBST(UENABLE) if test $use_acls -eq 0 -a $use_uenable -eq 1; then AC_MSG_WARN([unenable (user enable) option requires the acls option.]) AC_DEFINE(ACLS) AC_SUBST(ACLS) fi dnl dnl MAXSESS - Enforce a limit on maximum sessions per user dnl AC_MSG_CHECKING(whether to include maximum sessions (maxsess) support) AH_TEMPLATE(MAXSESS, [define this to include MAXSESS support to enforce a limit on maximum sessions per user ]) AC_ARG_ENABLE(maxsess, [ --enable-maxsess Enforce a limit on maximum sessions per user], [ case "$enable_maxsess" in no) AC_MSG_RESULT(no) ;; yes) AC_MSG_RESULT(yes) AC_DEFINE(MAXSESS) ;; *) AC_MSG_RESULT(no) ;; esac ], # ie: no --{enable,disable}-maxsess option, withval == "" AC_MSG_RESULT(no) ) AC_SUBST(MAXSESS) dnl dnl ENABLE_FINGER - use finger(1) to check number of sessions a user has on dnl a NAS. dnl AC_MSG_CHECKING(whether to include maxsess finger support) AH_TEMPLATE(MAXSESS_FINGER, [define this to include support to finger NASes for the number of sessions a user is using]) AC_ARG_ENABLE(finger, [ --enable-finger finger NAS for number of sessions a user is using], [ case "$enable_finger" in no) AC_MSG_RESULT(no) use_finger=0 ;; yes) AC_MSG_RESULT(yes) AC_DEFINE(MAXSESS_FINGER) use_finger=1 ;; *) AC_MSG_RESULT(no) ;; esac ], # ie: no --{enable,disable}-finger option, withval == "" AC_MSG_RESULT(no) ) AC_SUBST(MAXSESS_FINGER) dnl dnl pid file location dnl AC_MSG_CHECKING(for alt pid file FQPN) if test -d /var/run; then TACPLUS_PIDFILE="/var/run/tac_plus.pid" else TACPLUS_PIDFILE="/etc/tac_plus.pid" fi AC_ARG_WITH(pidfile, [ --with-pidfile=PATH alternate pidfile FQPN], [ case "$withval" in *) AC_MSG_RESULT($withval) TACPLUS_PIDFILE=$withval ;; esac ], AC_MSG_RESULT($TACPLUS_PIDFILE) ) AC_SUBST(TACPLUS_PIDFILE) dnl dnl default accounting file location dnl AC_MSG_CHECKING(for alt accounting file FQPN) if test -d /var/log; then TACPLUS_ACCTFILE="/var/log/tac_plus.acct" else TACPLUS_ACCTFILE="/var/tmp/tac_plus.acct" fi AC_ARG_WITH(acctfile, [ --with-acctfile=PATH alternate accounting file FQPN], [ case "$withval" in *) AC_MSG_RESULT($withval) TACPLUS_ACCTFILE=$withval ;; esac ], AC_MSG_RESULT($TACPLUS_ACCTFILE) ) AC_SUBST(TACPLUS_ACCTFILE) dnl dnl default log file location dnl AC_MSG_CHECKING(for alt log file FQPN) if test -d /var/log; then TACPLUS_LOGFILE="/var/log/tac_plus.log" else TACPLUS_LOGFILE="/var/tmp/tac_plus.log" fi AC_ARG_WITH(logfile, [ --with-logfile=PATH alternate log file FQPN], [ case "$withval" in *) AC_MSG_RESULT($withval) TACPLUS_LOGFILE=$withval ;; esac ], AC_MSG_RESULT($TACPLUS_LOGFILE) ) AC_SUBST(TACPLUS_LOGFILE) dnl dnl profiling dnl AC_MSG_CHECKING(whether to profile) AH_TEMPLATE(PROFILE, [define this to include profiling]) AC_ARG_WITH(prof, [ --with-prof Compile in profiling.], [ case "$withval" in yes) AC_MSG_RESULT(yes) #AC_DEFINE(PROF) PROFLAGS="-pg"; export PROFLAGS PROFLIBS="-lc_p -lc"; export PROFLIBS OLDCFLAGS="$CFLAGS" OLDLIBS="$LIBS" CFLAGS="$PROFLAGS $CFLAGS" LIBS="$PROFLIBS $LIBS" AC_TRY_LINK([ ], [ moncontrol(0); ], [AC_DEFINE(PROFILE) ], [ AC_MSG_ERROR(Could not compile with -pg.) ]) CFLAGS="$OLDCFLAGS" LIBS="$OLDLIBS" ;; *) AC_MSG_RESULT(no) ;; esac ], AC_MSG_RESULT(no) ) AC_SUBST(PROFLAGS) AC_SUBST(PROFLIBS) # look for PAM AH_TEMPLATE(HAVE_PAM, [define if your system has libpam]) AC_CHECK_LIB([pam], [pam_start], [AC_DEFINE(HAVE_PAM) LIBS="-lpam $LIBS"]) # check includes/headers AC_HEADER_STDC AC_CHECK_HEADERS(crypt.h ctype.h errno.h fcntl.h malloc.h shadow.h stdlib.h \ stdint.h string.h strings.h sys/types.h sysexits.h syslog.h \ termios.h unistd.h sys/wait.h) dnl AC_CHECK_HEADERS(limits.h memory.h siginfo.h) AH_TEMPLATE([SHADOW_PASSWORDS], [define if your system has a shadow password file]) if test $ac_cv_header_shadow_h = yes ; then AC_DEFINE(SHADOW_PASSWORDS) fi # type checks dnl AC_TYPE_MODE_T dnl AC_TYPE_OFF_T dnl AC_TYPE_PID_T AC_TYPE_SIGNAL dnl AC_TYPE_SIZE_T # check functions AC_CHECK_FUNCS(bzero strerror strchr strcspn) AC_FUNC_SETPGRP AC_HEADER_TIME dnl AC_CHECK_FUNCS(memcpy memmove memset bcopy strrchr \ dnl strstr strtok strrtok index rindex utimes) # need function XXX() or our emulated version dnl AC_CHECK_FUNC([vasprintf], [AC_DEFINE(HAVE_VASPRINTF)], []) # Find an appropriate tar for use in "dist" targets. A "best guess" # is good enough -- if we can't find GNU tar, we don't really care. AC_CHECK_PROGS(TAR, gnutar gtar tar) AC_SUBST(INST_PROGS) INST_PROGS=$progs dnl locate perl 5 AC_PROG_INSTALL AC_PATH_PROG(PERLV_PATH,perl5,no) if test $PERLV_PATH = no; then unset ac_cv_path_PERLV_PATH AC_PATH_PROG(PERLV_PATH,perl,no) if test $PERLV_PATH = no; then AC_MSG_ERROR([can't locate a suitable perl5.]) exit 1 else $PERLV_PATH -e 'require 5;' if test $? -ne 0 ; then AC_MSG_ERROR([can't locate a suitable perl5.]) exit 1 fi fi fi AC_SUBST(PERLV_PATH) AC_SUBST(CFLAGS) AC_SUBST(CPPFLAGS) AC_SUBST(LDFLAGS) dnl AC_SUBST(PG_LDFLAGS) dnl AC_SUBST(PG_CPPFLAGS) # i did this so that i could end up w/ a #define for the config file */ if test "x$prefix" = xNONE; then prefix_save=$prefix prefix=$ac_default_prefix MYSYSCONFDIR=`eval echo $sysconfdir` prefix=$prefix_save else MYSYSCONFDIR=`eval echo $sysconfdir` fi AC_SUBST(MYSYSCONFDIR) # autoheader bits AH_TOP([ #ifndef CONFIG_H #define CONFIG_H 1 ]) AH_BOTTOM([ /* UENABLE requires ACLS */ #ifdef UENABLE # ifndef ACLS # define ACLS 1 # endif #endif /* MAXSESS_FINGER requires MAXSESS */ #ifdef MAXSESS_FINGER # ifndef MAXSESS # define MAXSESS 1 # endif #endif #endif /* CONFIG_H */ ]) AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES(Makefile version.h pathsl.h tac_plus.8 tac_plus.conf.5) AC_OUTPUT()