1dnl Process this file with autoconf to produce a configure script. 2 3dnl Checks that we are given a good source directory. 4AC_INIT(latcp.cc) 5AM_INIT_AUTOMAKE(latd, 1.31) 6 7dnl Checks for programs. 8AC_PROG_CC 9AC_PROG_CXX 10AC_PROG_CPP 11AC_PROG_INSTALL 12AC_PROG_MAKE_SET 13 14AC_SUBST(INTERFACE) 15AC_SUBST(LIBLOCKDEV) 16AC_SUBST(LIBUTIL) 17 18dnl Checks for headers. 19AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h sys/socketio.h sys/filio.h \ 20 pty.h termios.h libutil.h util.h mcheck.h netinet/ether.h net/if_ether.h) 21 22dnl Checks for struct ether_header. 23AC_CHECK_HEADERS(net/if_ether.h net/ethernet.h) 24AC_MSG_CHECKING([for struct ether_header]) 25AC_TRY_COMPILE([ 26#include <sys/types.h> 27#include <sys/socket.h> 28#include <net/if.h> 29#ifdef HAVE_NET_IF_ETHER_H 30#include <net/if_ether.h> 31#endif /* HAVE_NET_IF_ETHER_H */ 32#ifdef HAVE_NET_ETHERNET_H 33#include <net/ethernet.h> 34#endif /* HAVE_NET_ETHERNET_H */ 35], [ 36 struct ether_header the_ether_header; 37 unsigned int ethertype; 38 ethertype = the_ether_header.ether_type; 39], , AC_MSG_ERROR([cannot find struct ether_header])) 40AC_MSG_RESULT(yes) 41 42dnl Checks for our network access type. 43latd_raw_type= 44AC_CHECK_HEADER(netpacket/packet.h, [latd_raw_type=linux]) 45if test x$latd_raw_type = x; then 46 AC_CHECK_HEADER(net/bpf.h, [latd_raw_type=bpf]) 47fi 48case x$latd_raw_type in 49xbpf) 50 AC_CHECK_HEADERS(net/if_dl.h) 51 AC_MSG_CHECKING([for AF_LINK support]) 52 AC_EGREP_CPP(_latd_has_af_link, 53[ 54#include <sys/socket.h> 55#ifdef AF_LINK 56_latd_has_af_link 57#endif 58], [ 59 AC_MSG_RESULT(yes) 60 AC_DEFINE(HAVE_AF_LINK) 61], [ 62 AC_MSG_RESULT(no) 63]) 64 ;; 65xlinux) 66 AC_CHECK_HEADERS(features.h) 67 ;; 68*) 69 ;; 70esac 71AC_MSG_CHECKING([for raw Ethernet access method]) 72if test x$latd_raw_type = x; then 73 AC_MSG_ERROR([can't find any raw Ethernet access method]) 74fi 75AC_MSG_RESULT($latd_raw_type) 76INTERFACE=interfaces-$latd_raw_type.o 77 78dnl Checks for sockaddr.sa_len - only needed for BPF access 79if test "x$latd_raw_type" = "xbpf"; then 80 AC_MSG_CHECKING([for sockaddr.sa_len]) 81 AC_TRY_COMPILE([ 82 #include <sys/types.h> 83 #include <sys/socket.h> 84 ],[ 85 struct sockaddr sa; 86 sa.sa_len = 5; 87 ], AC_DEFINE(HAVE_SOCKADDR_SA_LEN)) 88 AC_MSG_RESULT(yes) 89fi 90 91dnl Configure the use of openpty. 92AC_ARG_ENABLE(openpty, 93[ --disable-openpty don't use the system's openpty function [do]], 94, [enable_openpty=yes]) 95if test "x$enable_openpty" = "xyes"; then 96 openpty_found= 97 AC_CHECK_FUNCS(openpty, openpty_found=yes) 98 if test "x$openpty_found" = "x"; then 99 AC_CHECK_LIB(util, openpty, openpty_found=yes) 100 if test "x$openpty_found" = "xyes"; then 101 AC_DEFINE(HAVE_OPENPTY) 102 LIBUTIL=-lutil 103 fi 104 fi 105fi 106 107dnl Configuring the login program 108withval= 109AC_ARG_WITH(login, 110[ --with-login program to use for logins (defaults to local "login") ]) 111if test "x$withval" = "x"; then 112 if test -f /bin/login; then 113 withval="/bin/login" 114 elif test -f /usr/bin/login; then 115 withval="/usr/bin/login" 116 fi 117fi 118AC_DEFINE_UNQUOTED(LOGIN_BIN, "$withval") 119 120dnl Configure "llogin -p" locking 121AC_CHECK_HEADER(lockdev.h) 122AC_CHECK_LIB(lockdev, dev_lock, have_lockdev=yes) 123if test "x$have_lockdev" = "xyes"; then 124 LIBLOCKDEV=-llockdev 125 AC_DEFINE(HAVE_LOCKDEV_H) 126fi 127 128dnl Configure the latcp socket. 129LATCPSOCK=/var/run/latcp 130AC_ARG_WITH(latcp_socket, 131[ --with-latcp-socket=SOCK set the socket for latcp to SOCK [/var/run/latcp]], 132[ ], [with_latcp_socket=yes]) 133case x$with_latcp_socket in 134 xyes | xno | x) ;; 135 *) LATCPSOCK=$with_latcp_socket ;; 136esac 137AC_DEFINE_UNQUOTED(LATCP_SOCKNAME, "$LATCPSOCK") 138 139dnl Configure the llogin socket. 140LLOGINSOCK=/var/run/latlogin 141AC_ARG_WITH(llogin_socket, 142[ --with-llogin-socket=SOCK set the socket for llogin to SOCK [/var/run/latlogin]], 143[ ], [with_llogin_socket=yes]) 144case x$with_llogin_socket in 145 xyes | xno | x) ;; 146 *) LLOGINSOCK=$with_llogin_socket ;; 147esac 148AC_DEFINE_UNQUOTED(LLOGIN_SOCKNAME, "$LLOGINSOCK") 149 150 151dnl Disable default login service 152AC_ARG_ENABLE(defservice, 153[ --disable-defservice disable default login service], 154[ ], [enable_defservice=yes]) 155if test "x$enable_defservice" = "xyes"; then 156 CXXFLAGS="${CXXFLAGS-} -DENABLE_DEFAULT_SERVICE" 157fi 158 159dnl Configure debugging and/or warnings. 160AC_ARG_ENABLE(debug, 161[ --enable-debug compile debuggable programs], 162[enable_debug=yes]) 163if test "x$enable_debug" = "xyes"; then 164 CXXFLAGS="${CXXFLAGS-} -g3 -O0 -DVERBOSE_DEBUG -DNO_FORK" 165fi 166 167AC_ARG_ENABLE(warnings, 168[ --disable-warnings don't compile with warnings turned on], 169[ ], [enable_warnings=yes]) 170if test "x$enable_warnings" = "xyes" -a "x$GCC" = "xyes"; then 171 CXXFLAGS="${CXXFLAGS-} -W" 172fi 173 174dnl Writes files. 175AC_OUTPUT(Makefile) 176 177