home *** CD-ROM | disk | FTP | other *** search
/ ftp.shrubbery.net / 2015-02-07.ftp.shrubbery.net.tar / ftp.shrubbery.net / pub / tac_plus / tacacs+-F4.0.4.27a.tar.gz / tacacs+-F4.0.4.27a.tar / tacacs+-F4.0.4.27a / configure.in < prev    next >
Text File  |  2012-06-28  |  26KB  |  1,038 lines

  1. dnl Process this file with autoconf to produce a configure script.
  2. dnl A configure script is provided, in cause you do not have autoconf.
  3.  
  4. AC_PREREQ(2.13)
  5. AC_INIT(CHANGES)
  6.  
  7. PACKAGE=`sed -n 's/.*package.*"\(.*\)".*/\1/p' $srcdir/version.h.in|tr -d ' '`
  8. VERSION=`sed -n 's/.*version.*"\(.*\)".*/\1/p' $srcdir/version.h.in|tr -d ' '`
  9.  
  10. dnl VERSION needs to be updated in version.h.in such that 'make dist'
  11. dnl uses the correct filename for the directory name and tarball and binaries
  12. dnl get the right version numbers.
  13. AM_INIT_AUTOMAKE($PACKAGE, $VERSION, tac_plus@shrubbery.net)
  14.  
  15. AM_MAINTAINER_MODE()
  16.  
  17. dnl AC_CONFIG_SUBDIRS(etc man share)
  18.  
  19. # what OS
  20. dnl ---- XXX: these really should deal with the individual reasons why
  21. dnl      linux/whatever is different, rather than a blanket stmt
  22. dnl is this crack, i mean linux?
  23. AH_TEMPLATE(AIX, [define this if your o/s is AIX])
  24. AH_TEMPLATE(FREEBSD, [define this if your o/s is FreeBSD])
  25. AH_TEMPLATE(NETBSD, [define this if your o/s is NetBSD])
  26. AH_TEMPLATE(SOLARIS, [define this if your o/s is Solaris])
  27. AH_TEMPLATE(HPUX, [define this if your o/s is HPux])
  28. AH_TEMPLATE(LINUX, [define this if your o/s is Linux])
  29. AH_TEMPLATE(MIPS, [define this if your o/s is MIPS])
  30. AC_CANONICAL_HOST
  31. case "${host_os}" in
  32.     *aix* )
  33.     # For AIX
  34.     echo "See /usr/lpp/bos/bsdport on your system for details of how " \
  35.         "to define bsdcc."
  36.     CC=bsdcc; export CC
  37.     # CPPFLAGS="$CFLAGS -I/usr/local/include"; export CPPFLAGS
  38.     # LDFLAGS="$LDFLAGS -L/usr/local/lib"; export LDFLAGS
  39.     # LIBS="-lcrypt $LIBS"; export LIBS
  40.         AC_DEFINE(AIX)
  41.     ;;
  42.     *freebsd* )
  43.     #CPPFLAGS="$CFLAGS -I/usr/pkg/include"; export CPPFLAGS
  44.     #LDFLAGS="$LDFLAGS -L/usr/pkg/lib -Xlinker -rpath -Xlinker /usr/pkg/lib"
  45.     #export LDFLAGS
  46.     LIBS="-lcrypt $LIBS"; export LIBS
  47.         AC_DEFINE(FREEBSD)
  48.     ;;
  49.     *netbsd* )
  50.     #CPPFLAGS="$CFLAGS -I/usr/pkg/include"; export CPPFLAGS
  51.     #LDFLAGS="$LDFLAGS -L/usr/pkg/lib -Xlinker -rpath -Xlinker /usr/pkg/lib"
  52.     #export LDFLAGS
  53.     LIBS="-lcrypt $LIBS"; export LIBS
  54.         AC_DEFINE(NETBSD)
  55.     ;;
  56.     *solaris* )
  57.     #CPPFLAGS="$CFLAGS -I/usr/local/include"; export CPPFLAGS
  58.     #LDFLAGS="$LDFLAGS -L/usr/local/lib"; export LDFLAGS
  59.     LIBS="-lnsl -lsocket"; export LIBS
  60.         AC_DEFINE(SOLARIS)
  61.     ;;
  62.     *hpux* )
  63.     # For HP/UX
  64.     # CPPFLAGS="$CFLAGS -I/usr/local/include"; export CPPFLAGS
  65.     # LDFLAGS="$LDFLAGS -L/usr/local/lib"; export LDFLAGS
  66.     # LIBS="-lcrypt $LIBS"; export LIBS
  67.         AC_DEFINE(HPUX)
  68.     ;;
  69.     *linux* )
  70.     # XXX: not sure if /usr/local is necessary.
  71.     # XXX: linux libwrap needs -lnsl. configure should check for
  72.     #      existence of libnsl instead of hard-coding
  73.     CPPFLAGS="$CFLAGS -I/usr/local/include"; export CPPFLAGS
  74.     LDFLAGS="$LDFLAGS -L/usr/local/lib -L/lib"; export LDFLAGS
  75.     LIBS="-lnsl -lcrypt $LIBS"; export LIBS
  76.         AC_DEFINE(LINUX)
  77.  
  78.     # XXX: does linux need glibc: -DGLIBC
  79.     ;;
  80.     *mips* )
  81.     CPPFLAGS="$CFLAGS -I/usr/local/include"; export CPPFLAGS
  82.     LDFLAGS="$LDFLAGS -L/usr/local/lib"; export LDFLAGS
  83.     LIBS="-lcrypt $LIBS"; export LIBS
  84.         AC_DEFINE(MIPS)
  85.     ;;
  86.     * )
  87.     CPPFLAGS="$CFLAGS -I/usr/local/include"; export CPPFLAGS
  88.     LDFLAGS="$LDFLAGS -L/usr/local/lib"; export LDFLAGS
  89.     ;;
  90. esac
  91.  
  92. ##################
  93.  
  94. #PATH=${PATH}:/usr/local/bin
  95.  
  96. dnl default install location
  97. AC_PREFIX_DEFAULT(/usr/local)
  98.  
  99. dnl this doesnt work well if the program has not been installed before.
  100. dnl # guess the --prefix setting
  101. dnl AC_PREFIX_PROGRAM(tac_plus)
  102.  
  103. # make sure MAKE sets ${MAKE}
  104. AC_PATH_PROG(MAKE,gmake,no)
  105. if test $MAKE = no; then
  106.     unset ac_cv_path_MAKE
  107.     AC_PATH_PROG(MAKE,make,no)
  108.     if test $MAKE = no; then
  109.     AC_MSG_ERROR([can't locate a make.])
  110.     exit 1
  111.     fi
  112. fi
  113. AC_PROG_MAKE_SET()
  114.  
  115. AM_MAINTAINER_MODE()
  116.  
  117. dnl AC_DISABLE_SHARED()
  118. dnl use libtool, not ranlib
  119. dnl AC_PROG_RANLIB
  120. AC_LIBTOOL_DLOPEN()
  121. AC_PROG_LIBTOOL()
  122.  
  123. ACX_PTHREAD([CC=$PTHREAD_CC; CFLAGS="$CFLAGS $PTHREAD_CFLAGS";
  124.         LIBS="$PTHREAD_LIBS $LIBS"
  125.         AC_DEFINE(HAVE_PTHREAD)])
  126.  
  127. # compiler specifics
  128. AC_PROG_CC
  129. AM_C_PROTOTYPES
  130. AC_PROG_CPP
  131. AC_C_CONST
  132. AC_C_INLINE
  133. AC_C_STRINGIZE
  134.  
  135. # compiler compiler specifics
  136. AM_PROG_LEX
  137. dnl XXX sets LEX and LEXLIB == -fl and YYTEXT?
  138. # see if 'lex' is flex in disguise
  139. if test "$LEX" != "flex" ; then
  140.     AC_MSG_CHECKING([whether lex is flex in disguise])
  141.     # this may not be a valid way to test for flex, but it's cheap.
  142.     $LEX --version > /dev/null 2>&1
  143.     if test $? -ne 0 ; then
  144.         AC_MSG_RESULT()
  145.         AC_MSG_ERROR([registry requires gnu flex.  sorry])
  146.     fi
  147.     AC_MSG_RESULT(yes)
  148. fi
  149. AC_PROG_YACC
  150. # see if 'yacc' is bison in disguise
  151. if test "$YACC" != "bison" ; then
  152.     AC_MSG_CHECKING([whether yacc is bison in disguise])
  153.     # this may not be a valid way to test for bison, but it's cheap.
  154.     $YACC --version > /dev/null 2>&1
  155.     if test $? -ne 0 ; then
  156.         AC_MSG_RESULT()
  157.         AC_MSG_ERROR([registry requires gnu bison.  sorry])
  158.     fi
  159.     AC_MSG_RESULT(yes)
  160. fi
  161.  
  162. # platform specifics
  163. AC_WORDS_BIGENDIAN
  164. AC_LONG_64_BITS
  165.  
  166. AC_PROG_INSTALL
  167.  
  168. dnl configure options
  169. dnl
  170. dnl debug - aka compiler symbols
  171. dnl
  172. AC_MSG_CHECKING(whether to include symbols)
  173. AH_TEMPLATE(DBG, [define this to include debugging support])
  174. AC_ARG_ENABLE(debug,
  175. [
  176.   --enable-debug          include compiler symbols],
  177. [ case "$enable_debug" in
  178.   no)
  179.     AC_MSG_RESULT(no)
  180.     ;;
  181.   yes)
  182.     AC_MSG_RESULT(yes)
  183.     DBG="-g"
  184.     AC_DEFINE(DBG)
  185.     ;;
  186.   *)
  187.     AC_MSG_RESULT(no)
  188.     ;;
  189.   esac ],
  190.   # ie: no --{enable,disable}-debug option, withval == ""
  191.   AC_MSG_RESULT(no)
  192. )
  193. AC_SUBST(DBG)
  194. dnl
  195. dnl warn - aka gcc warnings
  196. dnl
  197. dnl             XXX: this should only be set for gcc....
  198. AC_MSG_CHECKING(whether to set gcc warnings)
  199. AH_TEMPLATE(WARN, [define this to set pedantic gcc warnings])
  200. AC_ARG_ENABLE(warn,
  201. [
  202.   --enable-warn           pedantic gcc warnings],
  203. [ case "$enable_debug" in
  204.   no)
  205.     AC_MSG_RESULT(no)
  206.     WARN=""
  207.     AC_DEFINE(WARN)
  208.     ;;
  209.   yes)
  210.     AC_MSG_RESULT([yes -Wall])
  211.     WARN="-Wall"
  212.     AC_DEFINE(WARN)
  213.     ;;
  214.   *)
  215.     AC_MSG_RESULT(no)
  216.     WARN=""
  217.     AC_DEFINE(WARN)
  218.     ;;
  219.   esac ],
  220.   # ie: no --{enable,disable}-warn option, withval == ""
  221.   WARN=""
  222.   AC_DEFINE(WARN)
  223.   AC_MSG_RESULT(no)
  224. )
  225. AC_SUBST(WARN)
  226.  
  227. dnl
  228. dnl libwarp - aka tcp_wrappers
  229. dnl hijacked this from ssh, but mimiced the '*' "clause" for 'yes'
  230. dnl
  231. AC_MSG_CHECKING(whether to use libwrap)
  232. AH_TEMPLATE(LIBWRAP, [define this to include libwrap (tcp_wrappers) support])
  233. AH_TEMPLATE(HAVE_LIBWRAP, [])
  234. AC_ARG_WITH(libwrap,
  235. [
  236.   --with-libwrap[[=PATH]]   libwrap (tcp_wrappers) support.  PATH is dir above
  237.                           lib, eg: /usr/local. (default)],
  238. [ case "$withval" in
  239.   no)
  240.     AC_MSG_RESULT(no)
  241.     ;;
  242.   yes)
  243.     AC_MSG_RESULT(yes)
  244.     AC_DEFINE(LIBWRAP)
  245.     WRAPLIBS="-lwrap"
  246.     OLDLIBS="$LIBS"
  247.     LIBS="$WRAPLIBS $LIBS"
  248.     AC_TRY_LINK([ int allow_severity; int deny_severity; ],
  249.                 [ hosts_access(); ],
  250.         [AC_DEFINE(LIBWRAP)
  251.         WRAPLIBS="-lwrap"
  252.         AC_DEFINE(HAVE_LIBWRAP) ],
  253.                 [ AC_MSG_ERROR(Could not find libwrap.  You must first install tcp_wrappers.) ])
  254.     LIBS="$OLDLIBS"
  255.     ;;
  256.   *)
  257.     AC_MSG_RESULT(yes)
  258.     AC_DEFINE(LIBWRAP)
  259.     if test -d "$withval"; then
  260.         WRAPINCS="-I$withval/include"
  261.         WRAPLIBS="-L$withval/lib -lwrap -R$withval/lib"
  262.     else
  263.         WRAPLIBS="$withval"
  264.     fi
  265.     OLDLIBS="$LIBS"
  266.     OLDINCS="$INCLUDES"
  267.     LIBS="$WRAPLIBS $LIBS"
  268.     INCLUDES="$WRAPINCS"
  269.     AC_TRY_LINK([ int allow_severity; int deny_severity; ],
  270.                 [ hosts_access(); ],
  271.                 [],
  272.                 [ AC_MSG_ERROR(Could not find libwrap.  You must first install tcp_wrappers.) ])
  273.     LIBS="$OLDLIBS"
  274.     INCLUDES="$OLDINCS"
  275.     ;;
  276.   esac ],
  277.         # XXX: is "no" correct?
  278.   AC_MSG_RESULT(yes)
  279.   AC_DEFINE(LIBWRAP)
  280.   WRAPLIBS="-lwrap"
  281.   OLDLIBS="$LIBS"
  282.   LIBS="$WRAPLIBS $LIBS"
  283.   AC_TRY_LINK([ int allow_severity; int deny_severity; ],
  284.                 [ hosts_access(); ],
  285.         [AC_DEFINE(LIBWRAP)
  286.         WRAPLIBS="-lwrap"
  287.         AC_DEFINE(HAVE_LIBWRAP) ],
  288.                 [ AC_MSG_ERROR(Could not find libwrap.  You must first install tcp_wrappers.) ])
  289.   LIBS="$OLDLIBS"
  290. )
  291. AC_SUBST(WRAPINCS)
  292. AC_SUBST(WRAPLIBS)
  293.  
  294. dnl
  295. dnl skey - aka One Time Password mechanism
  296. dnl
  297. AC_MSG_CHECKING([whether to include skey support])
  298. AH_TEMPLATE(SKEY, [define this to include support for skey])
  299. AC_ARG_WITH(skey,
  300. [  --with-skey[[=PATH]]      libskey (skey) support.  PATH is dir above lib,
  301.                           eg: /usr/local],
  302. [ case "$withval" in
  303.   no)
  304.     AC_MSG_RESULT(no)
  305.     ;;
  306.   yes)
  307.     AC_MSG_RESULT(yes)
  308.     AC_DEFINE(SKEY)
  309.     AC_SEARCH_LIBS([skeychallenge], [skey],
  310.         [ ],
  311.         [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.)])
  312.     ;;
  313.   *)
  314.     AC_MSG_RESULT(yes)
  315.     AC_DEFINE(SKEY)
  316.     if test -d "$withval" ; then
  317.     LDFAGS="$LDFLAGS -L$withval/lib"
  318.         CFLAGS="$CFLAGS -I$withval/include"
  319.         AC_SEARCH_LIBS([skeychallenge], [skey],
  320.             [ ],
  321.             [AC_MSG_ERROR([Could not find libskey.])
  322.     ])
  323.     else
  324.         AC_SEARCH_LIBS([skeychallenge], [$withval],
  325.             [ ],
  326.             [AC_MSG_ERROR([Could not find lib$withval.])
  327.     ])
  328.     fi
  329.     ;;
  330.   esac ],
  331.   AC_MSG_RESULT(no)
  332.   with_skey="no"
  333. )
  334. AC_SUBST(SKEY)
  335. AM_CONDITIONAL([TACSKEY], [test "${with_skey}" != "no"])
  336.  
  337. dnl
  338. dnl aceclnt - aka RSA SecurID
  339. dnl
  340. AC_MSG_CHECKING([whether to include RSA SecurID support])
  341. AH_TEMPLATE(ACECLNT, [define this to include support for RSA SecurID])
  342. AC_ARG_WITH(aceclnt,
  343.     [AS_HELP_STRING([--with-aceclnt[[=PATH]]],[libaceclnt (RSA SecurID) support. PATH is dir above lib, eg: /usr/local])],
  344. [ case "$withval" in
  345.   no)
  346.     AC_MSG_RESULT(no)
  347.     ;;
  348.   yes)
  349.     AC_MSG_RESULT(yes)
  350.     AC_DEFINE(ACECLNT)
  351.     AC_SEARCH_LIBS([SD_Init], [aceclnt],
  352.         [ ],
  353.         [AC_MSG_ERROR(Could not find libaceclnt.  You must first install aceclnt or provide a hint to the location of library and includes, as in --with-aceclnt=/usr/local)])
  354.     ;;
  355.   *)
  356.     AC_MSG_RESULT(yes)
  357.     AC_DEFINE(ACECLNT)
  358.     if test -d "$withval" ; then
  359.     LDFAGS="$LDFLAGS -L$withval/lib"
  360.         CFLAGS="$CFLAGS -I$withval/include"
  361.         AC_SEARCH_LIBS([SD_Init], [aceclnt],
  362.             [ ],
  363.             [AC_MSG_ERROR([Could not find libaceclnt.])
  364.     ])
  365.     else
  366.         AC_SEARCH_LIBS([SD_Init], [$withval],
  367.             [ ],
  368.             [AC_MSG_ERROR([Could not find lib$withval.])
  369.     ])
  370.     fi
  371.     ;;
  372.   esac ],
  373.   AC_MSG_RESULT(no)
  374.   with_aceclnt="no"
  375. )
  376. AC_SUBST(ACECLNT)
  377. AM_CONDITIONAL([TACACECLNT], [test "${with_aceclnt}" != "no"])
  378.  
  379. dnl
  380. dnl        XXX: might be good to have these as config file options
  381. dnl             or just options for running scripts
  382. dnl userid - aka TACPLUS_USERID
  383. dnl
  384. AC_MSG_CHECKING([whether to setuid()])
  385. AH_TEMPLATE(TACPLUS_USERID, [define this to a UID for setuid() at run-time])
  386. AC_ARG_WITH(userid,
  387. [  --with-userid=UID       tacacs will setuid(UID) after it binds the tcp port],
  388. [ case "$withval" in
  389.   no)
  390.     AC_MSG_RESULT(no)
  391.     ;;
  392.   yes)
  393.     AC_MSG_ERROR([--with-userid requires a UID argument.])
  394.     ;;
  395.   *)
  396.     expr $withval + 1 > /dev/null 2>&1
  397.     if test $? != 0  ; then
  398.     AC_MSG_ERROR([--with-userid requires a numeric UID argument.])
  399.     fi
  400.     AC_MSG_RESULT($withval)
  401.     AC_DEFINE_UNQUOTED(TACPLUS_USERID, $withval)
  402.     ;;
  403.   esac ],
  404.   # ie: no --{with,without}-userid option, withval == ""
  405.   AC_MSG_RESULT(no)
  406. )
  407. AC_SUBST(TACPLUS_USERID)
  408.  
  409. dnl
  410. dnl groupid - aka TACPLUS_GROUPID
  411. dnl
  412. AC_MSG_CHECKING(whether to setgid())
  413. AH_TEMPLATE(TACPLUS_GROUPID, [define this to a GID for setgid() at run-time])
  414. AC_ARG_WITH(groupid,
  415. [  --with-groupid=UID      tacacs will setgid(GID) after it binds the tcp port],
  416. [ case "$withval" in
  417.   no)
  418.     AC_MSG_RESULT(no)
  419.     ;;
  420.   yes)
  421.     AC_MSG_ERROR([--with-groupid requires a GID argument.])
  422.     ;;
  423.   *)
  424.     expr $withval + 1 > /dev/null 2>&1
  425.     if test $? != 0  ; then
  426.     AC_MSG_ERROR([--with-groupid requires a numeric GID argument.])
  427.     fi
  428.     AC_MSG_RESULT($withval)
  429.     AC_DEFINE_UNQUOTED(TACPLUS_GROUPID, $withval)
  430.     ;;
  431.   esac ],
  432.   # ie: no --{with,without}-userid option, withval == ""
  433.   AC_MSG_RESULT(no)
  434. )
  435. AC_SUBST(TACPLUS_GROUPID)
  436.  
  437. dnl
  438. dnl ACLs - aka tacacs config ACLs
  439. dnl
  440. AC_MSG_CHECKING(whether to include ACL support)
  441. AH_TEMPLATE(ACLS, [define this to include ACL support])
  442. AC_ARG_ENABLE(acls,
  443. [  --enable-acls           tacacs config ACL support (default)],
  444. [ case "$enable_acls" in
  445.   no)
  446.     AC_MSG_RESULT(no)
  447.     use_acls=0
  448.     ;;
  449.   yes)
  450.     AC_MSG_RESULT(yes)
  451.     AC_DEFINE(ACLS)
  452.     use_acls=1
  453.     ;;
  454.   *)
  455.     AC_MSG_RESULT(yes)
  456.     AC_DEFINE(ACLS)
  457.     use_acls=1
  458.     ;;
  459.   esac ],
  460.   # ie: no --{enable,disable}-acls option, withval == ""
  461.   AC_MSG_RESULT(yes)
  462.   AC_DEFINE(ACLS)
  463.   use_acls=1
  464. )
  465. AC_SUBST(ACLS)
  466.  
  467. dnl
  468. dnl UENABLE - aka tacacs config user enable.  UENABLE requires ACLS.
  469. dnl
  470. AC_MSG_CHECKING(whether to include user-enable support)
  471. AH_TEMPLATE(UENABLE, [define this to include user-specific enable password support])
  472. AC_ARG_ENABLE(uenable,
  473. [  --enable-uenable        tacacs config per-user enable support (default)],
  474. [ case "$enable_uenable" in
  475.   no)
  476.     AC_MSG_RESULT(no)
  477.     use_uenable=0
  478.     ;;
  479.   yes | *)
  480.     AC_MSG_RESULT(yes)
  481.     AC_DEFINE(UENABLE)
  482.     use_uenable=1
  483.     ;;
  484.   esac ],
  485.   # ie: no --{enable,disable}-uenable option, withval == ""
  486.   AC_MSG_RESULT(yes)
  487.   AC_DEFINE(UENABLE)
  488.   use_uenable=1
  489. )
  490. AC_SUBST(UENABLE)
  491. if test $use_acls -eq 0 -a $use_uenable -eq 1; then
  492.     AC_MSG_WARN([unenable (user enable) option requires the acls option.])
  493.     AC_DEFINE(ACLS)
  494.     AC_SUBST(ACLS)
  495. fi
  496.  
  497. dnl
  498. dnl MAXSESS - Enforce a limit on maximum sessions per user
  499. dnl
  500. AC_MSG_CHECKING(whether to include maximum sessions (maxsess) support)
  501. AH_TEMPLATE(MAXSESS, [define this to include MAXSESS support to enforce a limit on maximum sessions per user ])
  502. AC_ARG_ENABLE(maxsess,
  503. [  --enable-maxsess        Enforce a limit on maximum sessions per user],
  504. [ case "$enable_maxsess" in
  505.   no)
  506.     AC_MSG_RESULT(no)
  507.     ;;
  508.   yes)
  509.     AC_MSG_RESULT(yes)
  510.     AC_DEFINE(MAXSESS)
  511.     ;;
  512.   *)
  513.     AC_MSG_RESULT(no)
  514.     ;;
  515.   esac ],
  516.   # ie: no --{enable,disable}-maxsess option, withval == ""
  517.   AC_MSG_RESULT(no)
  518. )
  519. AC_SUBST(MAXSESS)
  520. dnl
  521. dnl ENABLE_FINGER - use finger(1) to check number of sessions a user has on
  522. dnl                 a NAS.
  523. dnl
  524. AC_MSG_CHECKING(whether to include maxsess finger support)
  525. AH_TEMPLATE(MAXSESS_FINGER, [define this to include support to finger NASes for
  526. the number of sessions a user is using])
  527. AC_ARG_ENABLE(finger,
  528. [  --enable-finger         finger NAS for number of sessions a user is using],
  529. [ case "$enable_finger" in
  530.   no)
  531.     AC_MSG_RESULT(no)
  532.     use_finger=0
  533.     ;;
  534.   yes)
  535.     AC_MSG_RESULT(yes)
  536.     AC_DEFINE(MAXSESS_FINGER)
  537.     use_finger=1
  538.     ;;
  539.   *)
  540.     AC_MSG_RESULT(no)
  541.     ;;
  542.   esac ],
  543.   # ie: no --{enable,disable}-finger option, withval == ""
  544.   AC_MSG_RESULT(no)
  545. )
  546. AC_SUBST(MAXSESS_FINGER)
  547. dnl
  548. dnl ARAP_DES - enable DES for ARAP
  549. dnl
  550. AC_MSG_CHECKING(whether to include ARAP DES support)
  551. AH_TEMPLATE(ARAP_DES, [Define this if you have DES routines you can link to for ARAP (See the user guide for more details)])
  552. AC_ARG_ENABLE(arapdes,
  553. [  --enable-arapdes        enable DES for ARAP],
  554. [ case "$enable_arapdes" in
  555.   yes)
  556.     AC_MSG_RESULT(yes)
  557.     AC_DEFINE(ARAP_DES)
  558.     ;;
  559.   * | no)
  560.     AC_MSG_RESULT(no)
  561.     ;;
  562.   esac ],
  563.   # ie: no --{enable,disable}-arapdes option, withval == ""
  564.   AC_MSG_RESULT(no)
  565. )
  566. AC_SUBST(ARAP_DES)
  567. dnl
  568. dnl MSCHAP - enable MSCHAP
  569. dnl
  570. AC_MSG_CHECKING(whether to include MSCHAP support)
  571. AH_TEMPLATE(MSCHAP, [Define this if you need MSCHAP support])
  572. AC_ARG_ENABLE(mschap,
  573. [  --enable-mschap        enable MSCHAP],
  574. [ case "$enable_mschap" in
  575.   yes)
  576.     AC_CHECK_HEADER(mschap_.h)
  577.     AC_MSG_RESULT(yes)
  578.     AC_DEFINE(MSCHAP)
  579.     ;;
  580.   * | no)
  581.     AC_MSG_RESULT(no)
  582.     ;;
  583.   esac ],
  584.   # ie: no --{enable,disable}-mschap option, withval == ""
  585.   AC_MSG_RESULT(no)
  586. )
  587. AC_SUBST(MSCHAP_)
  588. dnl
  589. dnl MSCHAP_DES - enable DES for MSCHAP
  590. dnl
  591. AC_MSG_CHECKING(whether to include MSCHAP DES support)
  592. AH_TEMPLATE(MSCHAP_DES, [Define this if you have DES routines you can link to for MSCHAP (See the user guide for more details)])
  593. AC_ARG_ENABLE(mschapdes,
  594. [  --enable-mschapdes        enable DES for MSCHAP],
  595. [ case "$enable_mschapdes" in
  596.   yes)
  597.     AC_CHECK_HEADER(mschap_des.h)
  598.     AC_MSG_RESULT(yes)
  599.     AC_DEFINE(MSCHAP_DES)
  600.     ;;
  601.   * | no)
  602.     AC_MSG_RESULT(no)
  603.     ;;
  604.   esac ],
  605.   # ie: no --{enable,disable}-mschapdes option, withval == ""
  606.   AC_MSG_RESULT(no)
  607. )
  608. AC_SUBST(MSCHAP_DES)
  609.  
  610. dnl
  611. dnl pid file location
  612. dnl
  613. AC_MSG_CHECKING(for alt pid file FQPN)
  614. if test -d /var/run; then
  615.     TACPLUS_PIDFILE="/var/run/tac_plus.pid"
  616. else
  617.     TACPLUS_PIDFILE="/etc/tac_plus.pid"
  618. fi
  619. AC_ARG_WITH(pidfile,
  620. [  --with-pidfile=PATH     alternate pidfile FQPN],
  621. [ case "$withval" in
  622.   *)
  623.     AC_MSG_RESULT($withval)
  624.     TACPLUS_PIDFILE=$withval
  625.     ;;
  626.   esac ],
  627.   AC_MSG_RESULT($TACPLUS_PIDFILE)
  628. )
  629. AC_SUBST(TACPLUS_PIDFILE)
  630.  
  631. dnl
  632. dnl default accounting file location
  633. dnl
  634. AC_MSG_CHECKING(for alt accounting file FQPN)
  635. if test -d /var/log; then
  636.     TACPLUS_ACCTFILE="/var/log/tac_plus.acct"
  637. else
  638.     TACPLUS_ACCTFILE="/var/tmp/tac_plus.acct"
  639. fi
  640. AC_ARG_WITH(acctfile,
  641. [  --with-acctfile=PATH    alternate accounting file FQPN],
  642. [ case "$withval" in
  643.   *)
  644.     AC_MSG_RESULT($withval)
  645.     TACPLUS_ACCTFILE=$withval
  646.     ;;
  647.   esac ],
  648.   AC_MSG_RESULT($TACPLUS_ACCTFILE)
  649. )
  650. AC_SUBST(TACPLUS_ACCTFILE)
  651.  
  652. dnl
  653. dnl default log file location
  654. dnl
  655. AC_MSG_CHECKING(for alt log file FQPN)
  656. if test -d /var/log; then
  657.     TACPLUS_LOGFILE="/var/log/tac_plus.log"
  658. else
  659.     TACPLUS_LOGFILE="/var/tmp/tac_plus.log"
  660. fi
  661. AC_ARG_WITH(logfile,
  662. [  --with-logfile=PATH     alternate log file FQPN],
  663. [ case "$withval" in
  664.   *)
  665.     AC_MSG_RESULT($withval)
  666.     TACPLUS_LOGFILE=$withval
  667.     ;;
  668.   esac ],
  669.   AC_MSG_RESULT($TACPLUS_LOGFILE)
  670. )
  671. AC_SUBST(TACPLUS_LOGFILE)
  672.  
  673. dnl
  674. dnl default wholog file location
  675. dnl
  676. AC_MSG_CHECKING(for alt wholog file FQPN)
  677. if test -d /var/log; then
  678.     TACPLUS_WHOLOGFILE="/var/log/tacwho.log"
  679. else
  680.     TACPLUS_WHOLOGFILE="/var/tmp/tacwho.log"
  681. fi
  682. AC_ARG_WITH(whologfile,
  683. [  --with-whologfile=PATH     alternate wholog file FQPN],
  684. [ case "$withval" in
  685.   *)
  686.     AC_MSG_RESULT($withval)
  687.     TACPLUS_WHOLOGFILE=$withval
  688.     ;;
  689.   esac ],
  690.   AC_MSG_RESULT($TACPLUS_WHOLOGFILE)
  691. )
  692. AC_SUBST(TACPLUS_WHOLOGFILE)
  693.  
  694. dnl
  695. dnl profiling
  696. dnl
  697. AC_MSG_CHECKING(whether to profile)
  698. AH_TEMPLATE(PROFILE, [define this to include profiling])
  699. AC_ARG_WITH(prof,
  700. [  --with-prof             Compile in profiling.],
  701. [ case "$withval" in
  702.   yes)
  703.     AC_MSG_RESULT(yes)
  704.     #AC_DEFINE(PROF)
  705.     PROFLAGS="-pg"; export PROFLAGS
  706.     PROFLIBS="-lc_p -lc"; export PROFLIBS
  707.     OLDCFLAGS="$CFLAGS"
  708.     OLDLIBS="$LIBS"
  709.     CFLAGS="$PROFLAGS $CFLAGS"
  710.     LIBS="$PROFLIBS $LIBS"
  711.     AC_TRY_LINK([ ],
  712.         [ moncontrol(0); ],
  713.     [AC_DEFINE(PROFILE) ],
  714.         [ AC_MSG_ERROR(Could not compile with -pg.) ])
  715.     CFLAGS="$OLDCFLAGS"
  716.     LIBS="$OLDLIBS"
  717.     ;;
  718.   *)
  719.     AC_MSG_RESULT(no)
  720.     ;;
  721.   esac ],
  722.   AC_MSG_RESULT(no)
  723. )
  724. AC_SUBST(PROFLAGS)
  725. AC_SUBST(PROFLIBS)
  726.  
  727. # look for PAM
  728. AH_TEMPLATE(HAVE_PAM, [define if your system has libpam])
  729. AC_CHECK_LIB([pam], [pam_start],
  730.     [AC_DEFINE(HAVE_PAM)
  731.      LIBS="-lpam $LIBS"])
  732.  
  733. # check includes/headers
  734. AC_HEADER_STDC
  735. AC_HEADER_TIME
  736. AC_CHECK_HEADERS(crypt.h ctype.h errno.h fcntl.h malloc.h shadow.h stdlib.h \
  737.         stdint.h string.h strings.h sys/resource.h sys/socket.h \
  738.         sys/types.h sys/wait.h sysexits.h syslog.h termios.h unistd.h \
  739.         utmp.h utmpx.h wait.h)
  740.  
  741. AH_TEMPLATE([SHADOW_PASSWORDS],
  742.         [define if your system has a shadow password file])
  743. if test $ac_cv_header_shadow_h = yes ; then
  744.     AC_DEFINE(SHADOW_PASSWORDS)
  745. fi
  746.  
  747. # type checks
  748. dnl AC_TYPE_MODE_T
  749. dnl AC_TYPE_OFF_T
  750. dnl AC_TYPE_PID_T
  751. AC_TYPE_SIGNAL
  752. dnl AC_TYPE_SIZE_T
  753. # Do we have socklen_t definition?
  754. AC_CHECK_TYPES([socklen_t], [], [], [#if HAVE_SYS_TYPES_H
  755. # include <sys/types.h>
  756. #endif
  757. #if HAVE_SYS_SOCKET_H
  758. # include <sys/socket.h>
  759. #endif])
  760. # Do we have pid_t definition?
  761. AC_CHECK_TYPES([pid_t], [], [], [#if HAVE_SYS_TYPES_H
  762. # include <sys/types.h>
  763. #endif
  764. #if HAVE_UNISTD_H
  765. # include <unistd.h>
  766. #endif])
  767.  
  768. # check functions
  769. AC_CHECK_FUNCS([getdtablesize memcpy memset random strchr strcspn strerror \
  770.         strrchr wait3 wait4 waitpid])
  771. AC_FUNC_SETPGRP
  772.  
  773. # Is the wait(2) status an int or union
  774. AH_TEMPLATE([UNIONWAIT],
  775.         [define this if your waitpid() takes an union wait status pointer])
  776. AC_MSG_CHECKING([if waitpid takes a union wait])
  777. AC_TRY_COMPILE([#if HAVE_SYS_WAIT_H
  778. # include <sys/wait.h>
  779. #endif
  780. #if HAVE_WAIT_H
  781. # include <wait.h>
  782. #endif], [union wait status;
  783. int pid;
  784. pid = wait (&status);
  785. #ifdef WEXITSTATUS
  786. /* Some POSIX systems have both the new-style macros and the old
  787.    union wait type, and they do not work together.  If union wait
  788.    conflicts with WEXITSTATUS et al, we dont want to use it.
  789.  */
  790. if (WEXITSTATUS(status) != 0)
  791.     pid = -1;
  792. #ifdef WTERMSIG
  793.     /* If we have WEXITSTATUS and WTERMSIG, just use them on ints. */
  794.     -- blow chunks here --
  795. #endif
  796. #endif
  797. #ifdef HAVE_WAITPID
  798.     /* Make sure union wait works with waitpid.  */
  799.     pid = waitpid(-1, &status, 0);
  800. #endif],
  801. [AC_MSG_RESULT(yes)
  802.  AC_DEFINE(UNIONWAIT)],
  803. [AC_MSG_RESULT(no)])
  804.  
  805. # Check for re-arming signal
  806. AH_TEMPLATE([REARMSIGNAL],
  807.         [define this if you find that your daemon quits after being sent
  808.          more than one SIGUSR1. Some systems need to explicitly re-arm
  809.          signals after they've been used once])
  810. AC_MSG_CHECKING([if signals need to be re-armed])
  811. AC_TRY_RUN([#include <signal.h>
  812. #if HAVE_STDLIB_H
  813. #include <stdlib.h>
  814. #endif
  815. #if HAVE_UNISTD_H
  816. #include <unistd.h>
  817. #endif
  818. int hit = 0;
  819. RETSIGTYPE
  820. handler(n)
  821. int n;
  822. {
  823.     hit++;
  824. }
  825. int main()
  826. {
  827.     signal(SIGUSR1, handler);
  828.     kill(getpid(), SIGUSR1);
  829.     kill(getpid(), SIGUSR1);
  830.     if (hit == 2)
  831.         exit(0);
  832.     else
  833.         exit(114);
  834. }],
  835. [AC_MSG_RESULT(no)],
  836. [AC_MSG_RESULT(yes);AC_DEFINE(REARMSIGNAL)],
  837. [AC_MSG_WARN([tac_plus may be less efficient when cross-compiled])
  838.  AC_DEFINE(REARMSIGNAL)],
  839. )
  840.  
  841. # Check for need to reap children when the default is to ignore SIGCHLD
  842. AH_TEMPLATE([REAPCHILD],
  843.         [define this if your o/s needs children reaped even though the
  844.          SIGCHLD default is SIG_IGN])
  845. AH_TEMPLATE([REAPSIGIGN],
  846.         [define this if your o/s needs children reaped even with an
  847.          explicit SIG_IGN])
  848. AC_MSG_CHECKING([if children need to be reaped])
  849. AC_TRY_RUN([#include <signal.h>
  850. #if HAVE_STDLIB_H
  851. #include <stdlib.h>
  852. #endif
  853. #if HAVE_UNISTD_H
  854. #include <unistd.h>
  855. #endif
  856. #if HAVE_SYS_WAIT_H
  857. #include <sys/wait.h>
  858. #endif
  859. #if HAVE_SYS_RESOURCE_H
  860. #include <sys/resource.h>
  861. #endif
  862. #include <errno.h>
  863. pid_t child, pid;
  864. int main()
  865. {
  866.     int status;
  867.     child = vfork();
  868.     if (child == 0)
  869.         exit(1);
  870. #if HAVE_WAIT4
  871.     pid = wait4(child, &status, WNOHANG, NULL);
  872. #else
  873.     do {
  874.         pid = wait3(&status, WNOHANG, NULL);
  875.     } while (pid != child && pid != -1);
  876. #endif
  877.     if (pid == -1 && errno == ECHILD)
  878.         exit(0);
  879.     exit(114);
  880. }],
  881. [AC_MSG_RESULT(no)],
  882. [AC_MSG_RESULT(yes)
  883.  AC_DEFINE(REAPCHILD)
  884.  # try again with SIG_IGN
  885.  AC_MSG_CHECKING([if children need to be reaped with SIG_IGN])
  886.  AC_TRY_RUN([#include <signal.h>
  887. #if HAVE_STDLIB_H
  888. #include <stdlib.h>
  889. #endif
  890. #if HAVE_UNISTD_H
  891. #include <unistd.h>
  892. #endif
  893. #if HAVE_SYS_WAIT_H
  894. #include <sys/wait.h>
  895. #endif
  896. #if HAVE_SYS_RESOURCE_H
  897. #include <sys/resource.h>
  898. #endif
  899. #include <errno.h>
  900. pid_t child, pid;
  901. int main()
  902. {
  903.     int status;
  904.     signal(SIGCHLD, SIG_IGN);
  905.     child = vfork();
  906.     if (child == 0)
  907.         exit(1);
  908. #if HAVE_WAIT4
  909.     pid = wait4(child, &status, WNOHANG, NULL);
  910. #else
  911.     do {
  912.         pid = wait3(&status, WNOHANG, NULL);
  913.     } while (pid != child && pid != -1);
  914. #endif
  915.     if (pid == -1 && errno == ECHILD)
  916.         exit(0);
  917.     exit(114);
  918. }],
  919.  [AC_MSG_RESULT(no)],
  920.  [AC_MSG_RESULT(yes);AC_DEFINE(REAPSIGIGN)])],
  921. [AC_MSG_WARN([tac_plus may be less efficient when cross-compiled])
  922.  AC_DEFINE(REAPCHILD)],
  923. )
  924.  
  925. # Find an appropriate tar for use in "dist" targets.  A "best guess"
  926. # is good enough -- if we can't find GNU tar, we don't really care.
  927. AC_CHECK_PROGS(TAR, gnutar gtar tar)
  928.  
  929. AC_SUBST(INST_PROGS)
  930. INST_PROGS=$progs
  931.  
  932. dnl locate perl 5
  933. AC_PROG_INSTALL
  934. AC_PATH_PROG(PERLV_PATH,perl5,no)
  935. if test $PERLV_PATH = no; then
  936.     unset ac_cv_path_PERLV_PATH
  937.     AC_PATH_PROG(PERLV_PATH,perl,no)
  938.     if test $PERLV_PATH = no; then
  939.         AC_MSG_ERROR([can't locate a suitable perl5.])
  940.         exit 1
  941.     else
  942.         $PERLV_PATH -e 'require 5;'
  943.         if test $? -ne 0 ; then
  944.            AC_MSG_ERROR([can't locate a suitable perl5.])
  945.            exit 1
  946.         fi
  947.     fi
  948. fi
  949. AC_SUBST(PERLV_PATH)
  950.  
  951. AC_SUBST(CFLAGS)
  952. AC_SUBST(CPPFLAGS)
  953. AC_SUBST(LDFLAGS)
  954. dnl AC_SUBST(PG_LDFLAGS)
  955. dnl AC_SUBST(PG_CPPFLAGS)
  956.  
  957. # i did this so that i could end up w/ a #define for the config file */
  958. if test "x$prefix" = xNONE; then
  959.     prefix_save=$prefix
  960.     prefix=$ac_default_prefix
  961.     MYSYSCONFDIR=`eval echo $sysconfdir`
  962.     prefix=$prefix_save
  963. else
  964.     MYSYSCONFDIR=`eval echo $sysconfdir`
  965. fi
  966. AC_SUBST(MYSYSCONFDIR)
  967.  
  968. # autoheader bits
  969. AH_TOP([
  970. #ifndef CONFIG_H
  971. #define CONFIG_H        1
  972. ])
  973. AH_BOTTOM([
  974. /* UENABLE requires ACLS */
  975. #ifdef UENABLE
  976. # ifndef ACLS
  977. #  define ACLS    1
  978. # endif
  979. #endif
  980.  
  981. /* MAXSESS_FINGER requires MAXSESS */
  982. #ifdef MAXSESS_FINGER
  983. # ifndef MAXSESS
  984. #  define MAXSESS    1
  985. # endif
  986. #endif
  987.  
  988. /* Some, eg: solaris 2.6, dont have socklen_t */
  989. #ifndef HAVE_SOCKLEN_T
  990. # define socklen_t    int
  991. #endif
  992.  
  993. /* host specifics */
  994. /* Define this if your password file does not contain age and comment fields. */
  995. #define NO_PWAGE
  996.  
  997. #if AIX
  998. /*
  999.  * The only way to properly compile BSD stuff on AIX is to define a
  1000.  * "bsdcc" compiler on your system.  See /usr/lpp/bos/bsdport on your
  1001.  * system for details. People who do NOT do this tell me that the code
  1002.  * still compiles but that it then doesn't behave correctly e.g. child
  1003.  * processes are not reaped correctly.  Don't expect much sympathy if
  1004.  * you do this.
  1005.  */
  1006. # define _BSD 1
  1007. # define _BSD_INCLUDES
  1008. # define NO_PWAGE
  1009. #endif    /* AIX */
  1010.  
  1011. #if LINUX
  1012. # define NO_PWAGE
  1013. # include <unistd.h>
  1014. # ifdef GLIBC
  1015. #  define CONST_SYSERRLIST
  1016. # endif
  1017. #endif    /* LINUX */
  1018.  
  1019. #if NETBSD
  1020. # define NO_PWAGE
  1021. # define CONST_SYSERRLIST
  1022. #endif
  1023.  
  1024. #if FREEBSD
  1025. # define CONST_SYSERRLIST
  1026. # define NO_PWAGE
  1027. #endif
  1028.  
  1029. #if BSDI
  1030. # define NO_PWAGE
  1031. #endif
  1032. #endif /* CONFIG_H */
  1033. ])
  1034. AC_CONFIG_HEADERS(config.h)
  1035. AC_CONFIG_FILES(Makefile version.h pathsl.h tac_plus.8 tac_plus.conf.5)
  1036.  
  1037. AC_OUTPUT()
  1038.