dnl ### autoheader templates ######################################## AH_TEMPLATE([CONFIGINVOCATION], [./configure invocation]) AH_TEMPLATE([DEFPORT], [Socket used to communicate]) AH_TEMPLATE([DEFBASEPORT], [Base socket used for secondary channel]) AH_TEMPLATE([MASTERHOST], [Hostname of console server]) AH_TEMPLATE([CONFIGFILE], [Config file path]) AH_TEMPLATE([PASSWDFILE], [Password file path]) AH_TEMPLATE([LOGFILEPATH], [Logfile path]) AH_TEMPLATE([MAXMEMB], [Number of consoles per child process]) AH_TEMPLATE([CONNECTTIMEOUT], [TCP connection timeout]) AH_TEMPLATE([PIDFILE], [pidfile to write to]) AH_TEMPLATE([USE_LIBWRAP], [use tcp_wrappers libwrap]) AH_TEMPLATE([HAVE_POSIX_REGCOMP], [have POSIX regcomp]) AH_TEMPLATE([HAVE_PAM], [have PAM support]) AH_TEMPLATE([HAVE_OPENSSL], [have openssl support]) AH_TEMPLATE([HAVE_DMALLOC], [have dmalloc support]) dnl ### Normal initialization. ###################################### AC_INIT AC_CONFIG_SRCDIR([conserver/main.c]) AC_CONFIG_HEADER(config.h) AC_DEFINE_UNQUOTED(CONFIGINVOCATION, "$0 $@") dnl ### Set some option defaults. ################################### if test -z "$CFLAGS"; then CFLAGS="-O" fi MKDIR="mkdir -p -m 755" AC_SUBST(MKDIR) dnl ### Custom settings. ############################################ AC_MSG_CHECKING(whether to allow 64bit compilation) AC_ARG_WITH(64bit, AC_HELP_STRING([--with-64bit],[Allow 64bit compilation]), [with_64bit=yes], [with_64bit=no]) AC_MSG_RESULT($with_64bit) AC_MSG_CHECKING(for port number specification) AC_ARG_WITH(port, AC_HELP_STRING([--with-port=PORT],[Specify port number @<:@conserver@:>@]), [case "$withval" in yes|no) AC_DEFINE_UNQUOTED(DEFPORT, "conserver") AC_MSG_RESULT(port 'conserver') ;; *) AC_DEFINE_UNQUOTED(DEFPORT, "$withval") AC_MSG_RESULT(port '$withval') ;; esac], [AC_DEFINE_UNQUOTED(DEFPORT, "conserver") AC_MSG_RESULT(port 'conserver')]) AC_MSG_CHECKING(for secondary channel base port) AC_ARG_WITH(base, AC_HELP_STRING([--with-base=PORT], [Base port for secondary channel @<:@0@:>@]), [case "$withval" in yes|no) AC_DEFINE_UNQUOTED(DEFBASEPORT, "0") AC_MSG_RESULT(port '0') ;; *) AC_DEFINE_UNQUOTED(DEFBASEPORT, "$withval") AC_MSG_RESULT(port '$withval') ;; esac], [AC_DEFINE_UNQUOTED(DEFBASEPORT, "0") AC_MSG_RESULT(port '0')]) AC_MSG_CHECKING(for master conserver hostname) AC_ARG_WITH(master, AC_HELP_STRING([--with-master=MASTER],[Specify master server hostname @<:@console@:>@]), [case "$withval" in yes|no) AC_DEFINE_UNQUOTED(MASTERHOST, "console") AC_MSG_RESULT('console') ;; *) AC_DEFINE_UNQUOTED(MASTERHOST, "$withval") AC_MSG_RESULT('$withval') ;; esac], [AC_DEFINE_UNQUOTED(MASTERHOST, "console") AC_MSG_RESULT('console')]) AC_MSG_CHECKING(for configuration filename) AC_ARG_WITH(cffile, AC_HELP_STRING([--with-cffile=CFFILE],[Specify config filename @<:@SYSCONFDIR/conserver.cf@:>@]), [case "$withval" in yes|no) AC_DEFINE_UNQUOTED(CONFIGFILE, [SYSCONFDIR "/conserver.cf"]) AC_MSG_RESULT('$sysconfdir/conserver.cf') ;; [[\\/]]* | ?:[[\\/]]* ) AC_DEFINE_UNQUOTED(CONFIGFILE, ["$withval"]) AC_MSG_RESULT('$withval') ;; *) AC_DEFINE_UNQUOTED(CONFIGFILE, [SYSCONFDIR "/$withval"]) AC_MSG_RESULT('$sysconfdir/$withval') ;; esac], [AC_DEFINE_UNQUOTED(CONFIGFILE, [SYSCONFDIR "/conserver.cf"]) AC_MSG_RESULT('$sysconfdir/conserver.cf')]) AC_MSG_CHECKING(for password filename) AC_ARG_WITH(pwdfile, AC_HELP_STRING([--with-pwdfile=PWDFILE],[Specify password filename @<:@SYSCONFDIR/conserver.passwd@:>@]), [case "$withval" in yes|no) AC_DEFINE_UNQUOTED(PASSWDFILE, [SYSCONFDIR "/conserver.passwd"]) AC_MSG_RESULT('$sysconfdir/conserver.passwd') ;; [[\\/]]* | ?:[[\\/]]* ) AC_DEFINE_UNQUOTED(PASSWDFILE, ["$withval"]) AC_MSG_RESULT('$withval') ;; *) AC_DEFINE_UNQUOTED(PASSWDFILE, [SYSCONFDIR "/$withval"]) AC_MSG_RESULT('$sysconfdir/$withval') ;; esac], [AC_DEFINE_UNQUOTED(PASSWDFILE, [SYSCONFDIR "/conserver.passwd"]) AC_MSG_RESULT('$sysconfdir/conserver.passwd')]) AC_MSG_CHECKING(for log filename) AC_ARG_WITH(logfile, AC_HELP_STRING([--with-logfile=LOGFILE],[Specify log filename @<:@/var/log/conserver@:>@]), [case "$withval" in yes|no) AC_DEFINE_UNQUOTED(LOGFILEPATH, "/var/log/conserver") AC_MSG_RESULT('/var/log/conserver') ;; *) AC_DEFINE_UNQUOTED(LOGFILEPATH, "$withval") AC_MSG_RESULT('$withval') ;; esac], [AC_DEFINE_UNQUOTED(LOGFILEPATH, "/var/log/conserver") AC_MSG_RESULT('/var/log/conserver')]) AC_SUBST(PIDFILE) AC_MSG_CHECKING(for PID filename) AC_ARG_WITH(pidfile, AC_HELP_STRING([--with-pidfile=PIDFILE],[Specify PID filepath @<:@/var/run/conserver.pid@:>@]), [case "$withval" in yes|no) PIDFILE="/var/run/conserver.pid" ;; *) PIDFILE="$withval" ;; esac], [PIDFILE="/var/run/conserver.pid"]) AC_DEFINE_UNQUOTED(PIDFILE, "$PIDFILE") AC_MSG_RESULT('$PIDFILE') AC_MSG_CHECKING(for MAXMEMB setting) AC_ARG_WITH(maxmemb, AC_HELP_STRING([--with-maxmemb=MAXMEMB],[Specify maximum consoles per process @<:@16@:>@]), [case "$withval" in yes|no) AC_DEFINE_UNQUOTED(MAXMEMB, 16) AC_MSG_RESULT(16) ;; *) if expr "$withval" : '[[0-9]]*$' >/dev/null 2>&1 && test "$withval" -gt 0 -a "$withval" -lt 256; then AC_DEFINE_UNQUOTED(MAXMEMB, $withval) AC_MSG_RESULT($withval) else AC_DEFINE_UNQUOTED(MAXMEMB, 16) AC_MSG_RESULT([value out of bounds (0@]), [if expr "$withval" : '[[0-9]]*$' >/dev/null 2>&1 && test "$withval" -gt 0 -a "$withval" -lt 300; then AC_DEFINE_UNQUOTED(CONNECTTIMEOUT, $withval) AC_MSG_RESULT($withval) else AC_DEFINE_UNQUOTED(CONNECTTIMEOUT, 10) AC_MSG_RESULT([value out of bounds (032bit systems (to override use --with-64bit)]) else AC_MSG_WARN([building a 64bit version of conserver - good luck!]) fi fi dnl ### Checks for header files. ################################### AC_HEADER_STDC AC_CHECK_HEADERS(sys/ioctl.h) dnl ### POSIX terminal I/O AC_CHECK_HEADERS(termios.h) if test "$ac_cv_header_termios_h" != "yes"; then dnl ### SysV terminal I/O AC_CHECK_HEADERS(termio.h) if test "$ac_cv_header_termio_h" != "yes"; then dnl ### BSD terminal I/O AC_CHECK_HEADERS(sgtty.h) if test "$ac_cv_header_sgtty_h" != "yes"; then AC_MSG_ERROR([no usable terminal interface detected]) fi fi fi AC_CHECK_HEADERS(unistd.h getopt.h sys/vlimit.h sys/resource.h ttyent.h sys/ttold.h sys/uio.h sys/proc.h sys/ioctl_compat.h usersec.h sys/select.h stropts.h sys/audit.h shadow.h sys/time.h crypt.h sysexits.h types.h) AC_HEADER_TIME AC_HEADER_SYS_WAIT AC_TYPE_MODE_T AC_TYPE_SIGNAL AC_TYPE_PID_T AC_CHECK_TYPE([sig_atomic_t],, AC_DEFINE(sig_atomic_t, volatile int, [Define if does not define sig_atomic_t]), [#include ]) AC_CHECK_TYPE([in_addr_t],[AC_DEFINE(HAVE_IN_ADDR_T,1, [Defined if in_addr_t exists])],,[$ac_includes_default #include ]) AC_CHECK_TYPE([socklen_t],[AC_DEFINE(HAVE_SOCKLEN_T,1, [Defined if socklen_t exists])],,[$ac_includes_default #include ]) dnl ### Host specific checks. ###################################### AC_CANONICAL_HOST case "$host" in *-*-hpux*) CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1" AC_CHECK_LIB(xnet,t_error,,AC_MSG_ERROR([-lxnet needed on HP-UX])) AC_CHECK_LIB(sec,getspnam) AC_CHECK_HEADERS(hpsecurity.h prot.h) AC_CHECK_FUNCS(bigcrypt iscomsec getprpwnam) ;; esac dnl ### Check for libraries. ####################################### AC_SEARCH_LIBS(socket,socket) AC_SEARCH_LIBS(gethostbyname,nsl) AC_SEARCH_LIBS(crypt,crypt) AC_SUBST(CONSLIBS) AC_SUBST(CONSCPPFLAGS) AC_SUBST(CONSLDFLAGS) AC_ARG_WITH(libwrap, AC_HELP_STRING([--with-libwrap@<:@=PATH@:>@], [Compile in libwrap (tcp_wrappers) support]), [if test "$withval" != "no"; then if test "$withval" != "yes"; then WRAPCPPFLAGS="-I$withval/include" WRAPLDFLAGS="-L$withval/lib" else WRAPCPPFLAGS="" WRAPLDFLAGS="" fi oCPPFLAGS="$CPPFLAGS" oLDFLAGS="$LDFLAGS" oLIBS="$LIBS" CPPFLAGS="$CPPFLAGS $WRAPCPPFLAGS" LDFLAGS="$LDFLAGS $WRAPLDFLAGS" AC_CHECK_HEADER(tcpd.h, [LIBS="$LIBS -lwrap" AC_MSG_CHECKING(for TCP wrappers library -lwrap) AC_TRY_LINK([#include int allow_severity = 0; int deny_severity = 0; ],[hosts_access((void *)0)], [AC_MSG_RESULT(yes) AC_DEFINE(USE_LIBWRAP) CONSLIBS="$CONSLIBS -lwrap" CONSLDFLAGS="$CONSLDFLAGS $WRAPLDFLAGS" CONSCPPFLAGS="$CONSCPPFLAGS $WRAPCPPFLAGS"], [AC_MSG_RESULT(no)])],) LIBS="$oLIBS" CPPFLAGS="$oCPPFLAGS" LDFLAGS="$oLDFLAGS" fi] ) AC_ARG_WITH(openssl, AC_HELP_STRING([--with-openssl@<:@=PATH@:>@], [Compile in OpenSSL support]), [if test "$withval" != "no"; then if test "$withval" != "yes"; then OPENSSLCPPFLAGS="-I$withval/include" OPENSSLLDFLAGS="-L$withval/lib" else OPENSSLCPPFLAGS="" OPENSSLLDFLAGS="" fi oCPPFLAGS="$CPPFLAGS" oLDFLAGS="$LDFLAGS" oLIBS="$LIBS" have_openssl=no CPPFLAGS="$CPPFLAGS $OPENSSLCPPFLAGS" LDFLAGS="$LDFLAGS $OPENSSLLDFLAGS" AC_CHECK_HEADER([openssl/ssl.h], [LIBS="$LIBS -lssl -lcrypto" AC_MSG_CHECKING(for openssl libraries -lssl and -lcrypto) AC_TRY_LINK([#include ],[SSL_library_init()], [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_OPENSSL) have_openssl=yes], [AC_MSG_RESULT(no)])],) if test $have_openssl = no; then LIBS="$oLIBS" CPPFLAGS="$oCPPFLAGS" LDFLAGS="$oLDFLAGS" fi fi] ) AC_ARG_WITH(dmalloc, AC_HELP_STRING([--with-dmalloc@<:@=PATH@:>@], [Compile in dmalloc support]), [if test "$withval" != "no"; then if test "$withval" != "yes"; then DMALLOCCPPFLAGS="-I$withval/include" DMALLOCLDFLAGS="-L$withval/lib" else DMALLOCCPPFLAGS="" DMALLOCLDFLAGS="" fi oCPPFLAGS="$CPPFLAGS" oLDFLAGS="$LDFLAGS" oLIBS="$LIBS" have_dmalloc=no CPPFLAGS="$CPPFLAGS $DMALLOCCPPFLAGS" LDFLAGS="$LDFLAGS $DMALLOCLDFLAGS" AC_CHECK_HEADER([dmalloc.h], [LIBS="$LIBS -ldmalloc" AC_MSG_CHECKING(for dmalloc libraries -ldmalloc) AC_TRY_LINK([#include ],[dmalloc_debug(0)], [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_DMALLOC) have_dmalloc=yes], [AC_MSG_RESULT(no)])],) if test $have_dmalloc = no; then LIBS="$oLIBS" CPPFLAGS="$oCPPFLAGS" LDFLAGS="$oLDFLAGS" fi fi] ) dnl ### Check for needed functions. ################################ dnl The following basically stollen from the less-358 distribution, but dnl modified for my own purposes AC_MSG_CHECKING(for POSIX regex) AC_ARG_WITH(regex, AC_HELP_STRING([--with-regex], [Use regular expressions in conserver.passwd]), [if test "$withval" = yes; then AC_TRY_RUN([ #include #include main() { regex_t r; regmatch_t rm; char *text = "xabcy"; if (regcomp(&r, "abc", 0)) exit(1); if (regexec(&r, text, 1, &rm, 0)) exit(1); if (rm.rm_so != 1) exit(1); /* check for correct offset */ exit(0); } ],have_posix_regex=yes,have_posix_regex=no,have_posix_regex=unknown) if test $have_posix_regex = yes; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_POSIX_REGCOMP) elif test $have_posix_regex = unknown; then AC_TRY_LINK([ #include #include ], [regex_t *r; regfree(r);], AC_MSG_RESULT(yes) AC_DEFINE(HAVE_POSIX_REGCOMP)) else AC_MSG_RESULT(no) fi else AC_MSG_RESULT(no) fi],[AC_MSG_RESULT(no)]) AC_MSG_CHECKING(for PAM support) AC_ARG_WITH(pam, AC_HELP_STRING([--with-pam], [Enable PAM support]), [if test "$withval" = yes; then oLIBS="$LIBS" AC_CHECK_HEADER(security/pam_appl.h, [LIBS="$LIBS -lpam" AC_MSG_CHECKING(for PAM library -lpam) AC_TRY_LINK_FUNC([pam_start], [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PAM) CONSLIBS="$CONSLIBS -lpam"], [LIBS="$LIBS -ldl" AC_MSG_RESULT(no) AC_MSG_CHECKING(for PAM library -lpam with -ldl) AC_TRY_LINK_FUNC([pam_end], [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PAM) CONSLIBS="$CONSLIBS -lpam -ldl"], [AC_MSG_RESULT(no)])])],) LIBS="$oLIBS" else AC_MSG_RESULT(no) fi],[AC_MSG_RESULT(no)]) AC_CHECK_FUNCS(getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt sigaction setsockopt getdtablesize putenv memset memcpy memcmp sysconf getpassphrase getlogin) AC_FUNC_SETPGRP AC_CHECK_FUNC(strcasecmp, [AC_DEFINE(HAVE_STRCASECMP, 1, [Define if strcasecmp is available])], [AC_CHECK_FUNC(stricmp, [AC_DEFINE(HAVE_STRICMP, 1, [Define if stricmp is available])], [AC_MSG_ERROR([strcasecmp or stricmp must be available])])]) dnl Checks for libbsm functions AC_CHECK_HEADERS(bsm/audit.h) AC_CHECK_LIB(bsm, getaudit) AC_CHECK_FUNCS(getaudit getaudit_addr) dnl ### Create output files. ####################################### AC_CONFIG_FILES([Makefile conserver/Makefile conserver.cf/Makefile console/Makefile autologin/Makefile]) AC_CONFIG_FILES([conserver/conserver.rc], [chmod +x conserver/conserver.rc]) AC_OUTPUT