1dnl Process this file with autoconf to produce a configure script. 2dnl LIC: GPL 3AC_INIT(pppoe.c) 4 5dnl pppd directory for kernel-mode PPPoE 6PPPD_DIR=ppp-2.4.1.pppoe2 7 8AC_CONFIG_HEADER(config.h) 9 10AC_PREFIX_DEFAULT(/usr) 11 12dnl Checks for programs. 13AC_PROG_CC 14AC_PROG_RANLIB 15 16dnl Checks for libraries. 17 18dnl Checks for header files. 19AC_HEADER_STDC 20AC_HEADER_SYS_WAIT 21AC_CHECK_HEADERS(fcntl.h sys/dlpi.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 sys/socket.h sys/cdefs.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) 22AC_CHECK_HEADERS(linux/if.h, [], [], [#include<sys/socket.h>]) 23AC_CHECK_HEADERS(linux/if_pppox.h, [], [], 24[ 25#include<sys/socket.h> 26#include<net/ethernet.h> 27#include<linux/if.h> 28#include<linux/in.h> 29]) 30 31dnl Checks for typedefs, structures, and compiler characteristics. 32AC_C_CONST 33AC_TYPE_PID_T 34AC_HEADER_TIME 35AC_STRUCT_TM 36 37dnl Check for sockaddr_ll 38AC_MSG_CHECKING(for struct sockaddr_ll) 39AC_TRY_COMPILE([#include <asm/types.h> 40#include <linux/if_packet.h> 41#include <linux/if_ether.h> 42], [struct sockaddr_ll sa;], 43ac_cv_struct_sockaddr_ll=yes, 44ac_cv_struct_sockaddr_ll=no) 45AC_MSG_RESULT($ac_cv_struct_sockaddr_ll) 46 47if test "$ac_cv_struct_sockaddr_ll" = yes ; then 48AC_DEFINE(HAVE_STRUCT_SOCKADDR_LL) 49fi 50 51dnl Check for N_HDLC line discipline 52AC_MSG_CHECKING(for N_HDLC line discipline) 53AC_TRY_COMPILE([#include <linux/termios.h>], 54 [int x = N_HDLC;], 55 ac_cv_n_hdlc=yes, 56 ac_cv_n_hdlc=no) 57AC_MSG_RESULT($ac_cv_n_hdlc) 58if test "$ac_cv_n_hdlc" = yes ; then 59AC_DEFINE(HAVE_N_HDLC) 60fi 61 62AC_ARG_ENABLE(plugin, [ --enable-plugin=pppd_src_path build pppd plugin], ac_cv_pluginpath=$enableval, ac_cv_pluginpath=no) 63AC_ARG_ENABLE(debugging, [ --disable-debugging disable debugging code], ac_cv_debugging=$enableval, ac_cv_debugging=yes) 64dnl If we were given "--enable-plugin" without a path, take a stab at where 65dnl the pppd source code might be. 66 67if test "$ac_cv_pluginpath" = "yes" ; then 68 for i in /usr/include /usr/local/include ; do 69 if test -r $i/pppd/pppd.h; then 70 ac_cv_pluginpath=$i 71 fi 72 done 73fi 74 75if test "$ac_cv_pluginpath" = "yes" ; then 76 echo "*** Could not fined pppd/pppd.h anywhere... not building plugin" 77 ac_cv_pluginpath=no 78fi 79 80AC_ARG_ENABLE(licenses, [ --enable-licenses=lic_path build commercial version], ac_cv_licpath=$enableval, ac_cv_licpath=no) 81 82LIC_INCDIR="" 83LIC_LIBDIR="" 84LIC_LIB="" 85LIC_DEFINE="" 86LIC_MAKEFILE_INCLUDE="" 87PPPOE_SERVER_DEPS="" 88if test "$ac_cv_licpath" != "no" ; then 89 LIC_INCDIR="-I$ac_cv_licpath" 90 LIC_LIBDIR="-L$ac_cv_licpath -Llicensed-only" 91 if test -d "../../extra-libs" ; then 92 LIC_LIB="-L../../extra-libs -ltwofish -llicensed-only -ltcl -ldl" 93 else 94 LIC_LIB="-ltwofish -llicensed-only -ltcl -ldl" 95 fi 96 PPPOE_SERVER_DEPS="licensed-only/liblicensed-only.a ../../SERVPOET-VERSION" 97 LIC_DEFINE="-DHAVE_LICENSE=1 -DSERVPOET_VERSION='\"\$(SERVPOET_VERSION)\"'" 98 LIC_MAKEFILE_INCLUDE="include ../../SERVPOET-VERSION" 99fi 100 101dnl Determine whether or not to build Linux pppd plugin 102LINUX_KERNELMODE_PLUGIN="" 103PPPD_INCDIR="" 104if test "$ac_cv_header_linux_if_pppox_h" = yes ; then 105 if test "$ac_cv_pluginpath" != no ; then 106 LINUX_KERNELMODE_PLUGIN=rp-pppoe.so 107 AC_DEFINE(HAVE_LINUX_KERNEL_PPPOE) 108 PPPD_INCDIR=$ac_cv_pluginpath 109 fi 110fi 111 112if test "$PPPD_INCDIR" = "" ; then 113 PPPD_INCDIR=/usr/include 114fi 115 116if test "$ac_cv_debugging" = "yes" ; then 117 AC_DEFINE(DEBUGGING_ENABLED) 118fi 119 120AC_SUBST(LINUX_KERNELMODE_PLUGIN) 121AC_SUBST(PPPD_INCDIR) 122AC_SUBST(PPPD_H) 123 124dnl Determine whether or not to build PPPoE relay 125PPPOE_RELAY="" 126if test "`uname -s`" = "Linux" ; then 127 PPPOE_RELAY=pppoe-relay 128fi 129AC_SUBST(PPPOE_RELAY) 130 131dnl Checks for library functions. 132AC_FUNC_MEMCMP 133AC_FUNC_SETVBUF_REVERSED 134AC_TYPE_SIGNAL 135AC_CHECK_FUNCS(select socket strerror strtol) 136AC_PROG_INSTALL 137 138dnl Integer sizes 139AC_CHECK_SIZEOF(unsigned short) 140AC_CHECK_SIZEOF(unsigned int) 141AC_CHECK_SIZEOF(unsigned long) 142 143dnl Check for location of pppd 144AC_PATH_PROG(PPPD, pppd, NOTFOUND, $PATH:/sbin:/usr/sbin:/usr/local/sbin) 145AC_PATH_PROG(ECHO, echo, echo) 146 147dnl Check for setsid (probably Linux-specific) 148AC_PATH_PROG(SETSID, setsid, "", $PATH:/sbin:/usr/sbin:/usr/local/sbin) 149 150dnl Check for an "id" which accepts "-u" option -- hack for Solaris. 151AC_PATH_PROG(ID, id, "", /usr/xpg4/bin:$PATH) 152 153dnl Check for Linux-specific kernel support for PPPoE 154AC_MSG_CHECKING(for Linux 2.4.X kernel-mode PPPoE support) 155AC_CACHE_VAL(ac_cv_linux_kernel_pppoe,[ 156if test "`uname -s`" = "Linux" ; then 157if test $cross_compiling = "no"; then 158 159dnl Do a bunch of modprobes. Can't hurt; might help. 160modprobe ppp_generic > /dev/null 2>&1 161modprobe ppp_async > /dev/null 2>&1 162modprobe n_hdlc > /dev/null 2>&1 163modprobe ppp_synctty > /dev/null 2>&1 164modprobe pppoe > /dev/null 2>&1 165fi 166AC_TRY_RUN([#include <sys/socket.h> 167#include <net/ethernet.h> 168#include <linux/if.h> 169#include <linux/in.h> 170#include <linux/if_pppox.h> 171int main() 172{ 173 if (socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OE) >= 0) return 0; else return 1; 174} 175], 176ac_cv_linux_kernel_pppoe=yes, ac_cv_linux_kernel_pppoe=no, [ac_cv_linux_kernel_pppoe=no; $ECHO "cross-compiling, default: "]) 177else 178 ac_cv_linux_kernel_pppoe=no 179fi 180]) 181 182AC_MSG_RESULT($ac_cv_linux_kernel_pppoe) 183 184if test "$ac_cv_linux_kernel_pppoe" != yes ; then 185 if test "$LINUX_KERNELMODE_PLUGIN" = rp-pppoe.so; then 186 echo "*** Your kernel does not appear to have built-in PPPoE support," 187 echo "*** but I will build the kernel-mode plugin anyway." 188 fi 189fi 190 191dnl GCC warning level 192if test "$GCC" = yes; then 193 CFLAGS="$CFLAGS -fno-strict-aliasing -Wall -Wstrict-prototypes" 194fi 195 196dnl If we couldn't find pppd, die 197if test "$PPPD" = "NOTFOUND"; then 198 AC_MSG_WARN([*** Oops! I couldn't find pppd, the PPP daemon anywhere.]) 199 AC_MSG_WARN([*** You must install pppd, version 2.3.10 or later.]) 200 AC_MSG_WARN([*** I will keep going, but it may not work.]) 201 PPPD=pppd 202fi 203 204dnl Figure out pppd version. 2.3.7 to 2.3.9 -- issue warning. Less than 205dnl 2.3.7 -- stop 206 207PPPD_VERSION=`$PPPD --version 2>&1 | awk ' /version/ {print $NF}'` 208 209case "$PPPD_VERSION" in 2101.*|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) 211 AC_MSG_WARN([*** Oops! Your version of pppd is $PPPD_VERSION, which is too old.]) 212 AC_MSG_WARN([*** You need at least 2.3.7 (2.3.10 or newer recommended.]) 213 AC_MSG_WARN([*** I will keep going, but it may not work.]) 214 ;; 215 2162.3.7|2.3.8|2.3.9) 217 AC_MSG_WARN([*** Warning. Your version of pppd is $PPPD_VERSION. You will]) 218 AC_MSG_WARN([*** not be able to use connect-on-demand. Upgrade to pppd]) 219 AC_MSG_WARN([*** 2.3.10 or newer if you need connect-on-demand.]) 220 ;; 221 2222*|3*|4*|5*|6*|7*|8*|9*) 223 ;; 224 225*) 226 AC_MSG_WARN([*** Oops. I cannot figure out what version of pppd you have.]) 227 AC_MSG_WARN([*** All I got back was '$PPPD_VERSION']) 228 AC_MSG_WARN([*** I will keep going, but it may not work.]) 229 ;; 230esac 231 232dnl Figure out packing order of structures 233AC_MSG_CHECKING([packing order of bit fields]) 234AC_CACHE_VAL(rpppoe_cv_pack_bitfields,[ 235if test "${rpppoe_cv_pack_bitfields+set}" != set ; then 236AC_TRY_RUN([ 237union foo { 238 struct bar { 239 unsigned int ver:4; 240 unsigned int type:4; 241 } bb; 242 unsigned char baz; 243}; 244 245int 246main(void) 247{ 248 union foo x; 249 x.bb.ver = 1; 250 x.bb.type = 2; 251 if (x.baz == 0x21) { 252 return 1; 253 } else if (x.baz == 0x12) { 254 return 0; 255 } else { 256 return 2; 257 } 258}], rpppoe_cv_pack_bitfields=normal, rpppoe_cv_pack_bitfields=rev, 259$ECHO "no defaults for cross-compiling"; exit 1) 260fi 261]) 262 263if test "$rpppoe_cv_pack_bitfields" = "rev" ; then 264 AC_MSG_RESULT(reversed) 265 AC_DEFINE(PACK_BITFIELDS_REVERSED) 266else 267 AC_MSG_RESULT(normal) 268fi 269 270# Sigh... got to fix this up for tcl 271test "x$prefix" = xNONE && prefix=$ac_default_prefix 272# Let make expand exec_prefix. 273test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' 274 275# Fully resolve WRAPPER for Tcl script. 276WRAPPER=${sbindir}/pppoe-wrapper 277eval "WRAPPER=${WRAPPER}" 278eval "WRAPPER=${WRAPPER}" 279AC_SUBST(WRAPPER) 280 281# Determine what targets to build 282TARGETS="pppoe pppoe-server" 283 284# pppoe-sniff is built only on Linux and Solaris 285if test "$ac_cv_header_linux_if_packet_h" = "yes" -o "$ac_cv_header_sys_dlpi_h" = "yes" ; then 286 TARGETS="$TARGETS pppoe-sniff" 287fi 288 289# pppoe-relay is built only on Linux 290if test "$ac_cv_header_linux_if_packet_h" = "yes" ; then 291 TARGETS="$TARGETS pppoe-relay" 292fi 293 294# plugin is built only if we have kernel support 295if test -n "$LINUX_KERNELMODE_PLUGIN" ; then 296 TARGETS="$TARGETS $LINUX_KERNELMODE_PLUGIN" 297 mkdir plugin > /dev/null 2>&1 298fi 299 300EXTRACONFIGS="" 301# Licensed stuff only for commercial distro (for now) 302if test -n "$LIC_DEFINE" ; then 303 TARGETS="licensed-only $TARGETS" 304 EXTRACONFIGS="$EXTRACONFIGS licensed-only/Makefile" 305fi 306 307RDYNAMIC="" 308# L2TP is only in commercial distro (for now) 309if test -n "$LIC_DEFINE" ; then 310 TARGETS="l2tp $TARGETS" 311 EXTRACONFIGS="$EXTRACONFIGS l2tp/Makefile l2tp/handlers/Makefile" 312 LIC_DEFINE="$LIC_DEFINE -DHAVE_L2TP=1" 313 LIC_LIB="$LIC_LIB -Ll2tp -ll2tp" 314 PPPOE_SERVER_DEPS="$PPPOE_SERVER_DEPS l2tp/libl2tp.a" 315 RDYNAMIC="-rdynamic" 316fi 317 318LIBEVENT=../libevent 319AC_SUBST(TARGETS) 320AC_SUBST(LIC_INCDIR) 321AC_SUBST(LIC_LIBDIR) 322AC_SUBST(LIC_LIB) 323AC_SUBST(LIC_MAKEFILE_INCLUDE) 324AC_SUBST(LIC_DEFINE) 325AC_SUBST(PPPOE_SERVER_DEPS) 326AC_SUBST(RDYNAMIC) 327AC_SUBST(LIBEVENT) 328AC_SUBST(ECHO) 329AC_SUBST(LDFLAGS) 330 331datadir_evaluated=`eval echo $datadir` 332AC_SUBST(datadir_evaluated) 333 334AC_OUTPUT(Makefile libevent/Makefile ../scripts/pppoe-connect ../scripts/pppoe-start ../scripts/pppoe-stop ../scripts/pppoe-init ../scripts/pppoe-init-suse ../scripts/pppoe-init-turbolinux ../scripts/pppoe-setup ../gui/Makefile ../gui/tkpppoe $EXTRACONFIGS) 335 336AC_MSG_RESULT([On this platform, the following targets will be built:]) 337AC_MSG_RESULT([$TARGETS]) 338AC_MSG_RESULT([Type 'make' to compile the software.]) 339