dnl Process this file with autoconf to produce a configure script. AC_INIT(pppoe.c) AC_CONFIG_HEADER(config.h) AC_PREFIX_DEFAULT(/usr) dnl Checks for programs. AC_PROG_CC dnl Checks for libraries. dnl Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h syslog.h unistd.h net/if_arp.h netinet/if_ether.h getopt.h sys/uio.h sys/param.h fcntl.h net/bpf.h netpacket/packet.h net/ethernet.h asm/types.h linux/if_packet.h linux/if_ether.h linux/if_pppox.h sys/socket.h sys/cdefs.h linux/if.h net/if.h net/if_dl.h net/if_ether.h net/if_types.h netinet/if_ether.h net/if_types.h net/if_dl.h sys/dlpi.h ) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T AC_HEADER_TIME AC_STRUCT_TM dnl Check for an echo which supports -n -- another hack for Solaris AC_PATH_PROG(ECHO, echo, "", /usr/ucb/bin:$PATH) dnl Check for sockaddr_ll $ECHO -n "checking for struct sockaddr_ll... " AC_TRY_COMPILE([#include #include #include ], [struct sockaddr_ll sa;], ac_cv_struct_sockaddr_ll=yes, ac_cv_struct_sockaddr_ll=no) $ECHO $ac_cv_struct_sockaddr_ll if test "$ac_cv_struct_sockaddr_ll" = yes ; then AC_DEFINE(HAVE_STRUCT_SOCKADDR_LL) fi dnl Check for N_HDLC line discipline $ECHO -n "checking for N_HDLC line discipline... " AC_TRY_COMPILE([#include ], [int x = N_HDLC;], ac_cv_n_hdlc=yes, ac_cv_n_hdlc=no) $ECHO $ac_cv_n_hdlc if test "$ac_cv_n_hdlc" = yes ; then AC_DEFINE(HAVE_N_HDLC) fi AC_ARG_ENABLE(plugin, [ --enable-plugin=pppd_src_path build pppd plugin], ac_cv_pluginpath=$enableval, ac_cv_pluginpath=no) dnl Determine whether or not to build Linux pppd plugin LINUX_KERNELMODE_PLUGIN="" PPPD_INCDIR="" if test "$ac_cv_header_linux_if_pppox_h" = yes ; then if test "$ac_cv_pluginpath" != no ; then LINUX_KERNELMODE_PLUGIN=rp-pppoe.so PPPD_INCDIR=$ac_cv_pluginpath fi fi AC_SUBST(LINUX_KERNELMODE_PLUGIN) AC_SUBST(PPPD_INCDIR) dnl Determine whether or not to build PPPoE relay PPPOE_RELAY="" if test "`uname -s`" = "Linux" ; then PPPOE_RELAY=pppoe-relay fi AC_SUBST(PPPOE_RELAY) dnl Checks for library functions. AC_FUNC_MEMCMP AC_FUNC_SETVBUF_REVERSED AC_TYPE_SIGNAL AC_CHECK_FUNCS(select socket strerror strtol) AC_PROG_INSTALL dnl Integer sizes AC_CHECK_SIZEOF(unsigned short) AC_CHECK_SIZEOF(unsigned int) AC_CHECK_SIZEOF(unsigned long) dnl Check for location of pppd AC_PATH_PROG(PPPD, pppd, NOTFOUND, $PATH:/sbin:/usr/sbin:/usr/local/sbin) dnl Check for setsid (probably Linux-specific) AC_PATH_PROG(SETSID, setsid, "", $PATH:/sbin:/usr/sbin:/usr/local/sbin) dnl Check for an "id" which accepts "-u" option -- hack for Solaris. AC_PATH_PROG(ID, id, "", /usr/xpg4/bin:$PATH) dnl Check for Linux-specific kernel support for PPPoE $ECHO -n "checking for Linux 2.4.X kernel-mode PPPoE support..." if test "`uname -s`" = "Linux" ; then AC_TRY_RUN([#include #include #include #include int main() { if (socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OE) >= 0) return 0; else return 1; } ], ac_cv_linux_kernel_pppoe=yes, ac_cv_linux_kernel_pppoe=no) else ac_cv_linux_kernel_pppoe=no fi $ECHO $ac_cv_linux_kernel_pppoe if test "$ac_cv_linux_kernel_pppoe" = yes ; then AC_DEFINE(HAVE_LINUX_KERNEL_PPPOE) fi dnl GCC warning level if test "$GCC" = yes; then CFLAGS="$CFLAGS -Wall -Wstrict-prototypes" fi dnl If we couldn't find pppd, die if test "$PPPD" = "NOTFOUND"; then $ECHO "" $ECHO "*** Oops! I couldn't find pppd, the PPP daemon anywhere." $ECHO "*** You must install pppd, version 2.3.10 or later." $ECHO "*** I will keep going, but it may not work." $ECHO "" fi dnl Figure out pppd version. 2.3.7 to 2.3.9 -- issue warning. Less than dnl 2.3.7 -- stop PPPD_VERSION=`$PPPD --version 2>&1 | awk '{print $NF}'` case "$PPPD_VERSION" in 1.*|2.0.*|2.1.*|2.2.*|2.3.0|2.3.1|2.3.2|2.3.3|2.3.4|2.3.5|2.3.6) $ECHO "" $ECHO "*** Oops! Your version of pppd is $PPPD_VERSION, which is too old." $ECHO "*** You need at least 2.3.7 (2.3.10 or newer recommended.)" $ECHO "*** I will keep going, but it may not work." $ECHO "" ;; 2.3.7|2.3.8|2.3.9) $ECHO "" $ECHO "*** Warning. Your version of pppd is $PPPD_VERSION. You will" $ECHO "*** not be able to use connect-on-demand. Upgrade to pppd" $ECHO "*** 2.3.10 or newer if you need connect-on-demand." $ECHO "" ;; 2*|3*|4*|5*|6*|7*|8*|9*) ;; *) $ECHO "" $ECHO "*** Oops. I cannot figure out what version of pppd you have." $ECHO "*** All I got back was '$PPPD_VERSION'" $ECHO "*** I will keep going, but it may not work." $ECHO "" ;; esac dnl Figure out packing order of structures $ECHO -n "checking packing order of bit fields... " AC_TRY_RUN([ union foo { struct bar { unsigned int ver:4; unsigned int type:4; } bb; unsigned char baz; }; int main(void) { union foo x; x.bb.ver = 1; x.bb.type = 2; if (x.baz == 0x21) { return 1; } else if (x.baz == 0x12) { return 0; } else { return 2; } }], PACK=normal, PACK=rev) if test "$PACK" = "rev" ; then $ECHO "reversed" AC_DEFINE(PACK_BITFIELDS_REVERSED) else $ECHO "normal" fi # Sigh... got to fix this up for tcl test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Fully resolve WRAPPER for Tcl script. WRAPPER=${sbindir}/pppoe-wrapper eval "WRAPPER=${WRAPPER}" eval "WRAPPER=${WRAPPER}" AC_SUBST(WRAPPER) # Determine what targets to build TARGETS="pppoe pppoe-server" # pppoe-sniff is built only on Linux and Solaris if test "$ac_cv_header_linux_if_packet_h" = "yes" -o "$ac_cv_header_sys_dlpi_h" = "yes" ; then TARGETS="$TARGETS pppoe-sniff" fi # pppoe-relay is built only on Linux if test "$ac_cv_header_linux_if_packet_h" = "yes" ; then TARGETS="$TARGETS pppoe-relay" fi # plugin is built only if we have kernel support if test -n "$LINUX_KERNELMODE_PLUGIN" ; then TARGETS="$TARGETS $LINUX_KERNELMODE_PLUGIN" fi AC_SUBST(TARGETS) AC_OUTPUT(Makefile ../scripts/adsl-connect ../scripts/adsl-start ../scripts/adsl-stop ../scripts/adsl-init ../scripts/adsl-init-suse ../scripts/adsl-init-turbolinux ../scripts/adsl-setup ../gui/Makefile ../gui/tkpppoe) $ECHO "" $ECHO "On this platform, the following targets will be built:" $ECHO " $TARGETS" $ECHO "" $ECHO "Type 'make' to compile the software."