dnl Blah blah standard autoconf AC_INIT(Makefile.in) dnl Host type AC_CANONICAL_HOST dnl Check for standard tools AC_PROG_CC AC_PROG_LIBTOOL # Liberated from ethereal's configure.in # # Add any platform-specific compiler flags needed. # AC_MSG_CHECKING(for platform-specific compiler flags) if test "x$GCC" = x then # # Not GCC - assume it's the vendor's compiler. # case "$host_os" in hpux*) # # HP's ANSI C compiler; flags suggested by Jost Martin. # "-Ae" for ANSI C plus extensions such as "long long". # "+O2", for optimization. XXX - works with "-g"? # CFLAGS="-Ae +O2 $CFLAGS" AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2) ;; darwin*) # # It may be called "cc", but it's really a GCC derivative # with a problematic special precompiler and precompiled # headers; turn off the special precompiler, as some # apparently-legal code won't compile with its precompiled # headers. # CFLAGS="-no-cpp-precomp $CFLAGS" AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp) darwin="yes" ;; linux*) AC_MSG_RESULT(none needed) AC_DEFINE(SYS_LINUX, 1, Compiling for Linux OS) linux="yes" ;; freebsd*) AC_MSG_RESULT(none needed) AC_DEFINE(SYS_FREEBSD, 1, Compiling for FreeBSD) ;; openbsd*) AC_MSG_RESULT(none needed) AC_DEFINE(SYS_OPENBSD, 1, Compiling for OpenBSD) ;; cygwin*) AC_MSG_RESULT(none needed) AC_DEFINE(SYS_CYGWIN, 1, Compiling for Cygwin) cygwin="yes" ;; *) AC_MSG_RESULT(none needed) ;; esac else case "$host_os" in solaris*) # the X11 headers don't automatically include prototype info # and a lot don't include the return type CFLAGS="$CFLAGS -Wno-return-type -DFUNCPROTO=15" AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15) ;; darwin*) # # See comments above about Apple's lovely C compiler. # CFLAGS="-no-cpp-precomp $CFLAGS" AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp) darwin="yes" ;; linux*) AC_MSG_RESULT(none needed) AC_DEFINE(SYS_LINUX, 1, Compiling for Linux OS) linux="yes" ;; freebsd*) AC_MSG_RESULT(none needed) AC_DEFINE(SYS_FREEBSD, 1, Compiling for FreeBSD) ;; openbsd*) AC_MSG_RESULT(none needed) AC_DEFINE(SYS_OPENBSD, 1, Compiling for OpenBSD) ;; cygwin*) # Adding -mno-cygwin uses the MingW linking process, precluding the use # of cygwin.dll; linking to cygwin.dll forces GPL CFLAGS="-mno-cygwin $CFLAGS" AC_MSG_RESULT(none needed) AC_DEFINE(SYS_CYGWIN, 1, Compiling for Cygwin) cygwin="yes" ;; *) AC_MSG_RESULT(none needed) ;; esac fi dnl Check for endian AC_C_BIGENDIAN dnl Check for headers and such AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h net/if_arp.h sys/socket.h) dnl Look for linux kernel wireless headers if test "$linux" = "yes"; then AC_MSG_CHECKING(that linux/wireless.h is what we expect) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include #include #include #include #include #include #include #include ]], [[ struct iwreq wrq; wrq.u.essid.flags = 0; ]])], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_LINUX_WIRELESS, 1, Linux wireless extentions present) ],[ AC_MSG_RESULT(no) AC_MSG_ERROR(*** Missing working Linux wireless kernel extensions ***) ]) fi # linux dnl Look for libpcap if test "$cygwin" != "yes"; then AC_CHECK_LIB([pcap], [pcap_open_live], AC_DEFINE(HAVE_LIBPCAP, 1, libpcap packet capture lib), AC_MSG_ERROR(*** Missing working libpcap library ***)) AC_CHECK_HEADER([pcap.h], AC_DEFINE(HAVE_PCAP_H, 1, pcap.h present), AC_MSG_ERROR(*** Missing pcap.h is libpcap-dev installed ***)) LIBS="$LIBS -lpcap" fi dnl Look for airpcap under cygwin if test "$cygwin" = "yes"; then AC_ARG_ENABLE(airpcap, [ --disable-airpcap disable checking for CACE airpcap],,wantairpcap=yes) if test "$wantairpcap" = "yes"; then airpcap_devpack="none" AC_ARG_WITH(airpcap-devpack, [ --with-airpcap[=DIR] Location of the CACE AirPcap device pack NOTE cygwin appears to have link errors if the path is not within the current directory], [ airpcap_devpack="$withval" ]) if test "$airpcap_devpack" = "none"; then AC_MSG_ERROR(No airpcap path provided use --with-airpcap-devpack) fi # devpack none dnl set the lib flags to refer to the devpack files LDFLAGS="$LDFLAGS -L$airpcap_devpack/WinPcap_Devpack/Lib -L$airpcap_devpack/Airpcap_Devpack/Lib" dnl set the CPP flags to refer to the devpack files CPPFLAGS="$CPPFLAGS -I$airpcap_devpack/WinPcap_Devpack/Include -I$airpcap_devpack/Airpcap_Devpack/include" AC_CHECK_LIB([wpcap], [pcap_open_live], AC_DEFINE(HAVE_LIBWPCAP, 1, libwpcap library), AC_MSG_ERROR(Could not link libwpcap check airpcap-devpack path)) AC_CHECK_LIB([wpcap], [pcap_get_airpcap_handle],, AC_MSG_ERROR(Could not use pcap_get_airpcap_handle are you using the CACE airpcap libwpcap)) #AC_CHECK_LIB([airpcap], [AirpcapSetLinkType], # AC_DEFINE(HAVE_LIBAIRPCAP, 1, libairpcap library), # AC_MSG_ERROR(Could not link libairpcap check airpcap-devpack path)) AC_CHECK_HEADER([pcap.h], AC_DEFINE(HAVE_PCAP_H, 1, pcap.h present), AC_MSG_ERROR(Could not find pcap.h check airpcap-devpack path)) AC_CHECK_HEADER([airpcap.h], AC_DEFINE(HAVE_AIRPCAP_H, 1, airpcap.h preset), AC_MSG_ERROR(Could not find airpcap.h check airpcap-devpack path)) LIBS="$LIBS -lwpcap -lairpcap" fi # waitairpcap fi # cygwin havenetlink=no if test "$linux" = "yes"; then havenetlink=yes AC_CHECK_HEADERS([asm/types.h netlink/genl/genl.h netlink/genl/family.h netlink/genl/ctrl.h netlink/msg.h netlink/attr.h linux/nl80211.h linux/if_arp.h linux/wireless.h], AC_DEFINE(HAVE_NETLINKHEADERS, 1, Netlink headers are there), havenetlink=no) #if test "$havenetlink" = "yes"; then # AC_CHECK_LIB([nl], [nl_handle_alloc], # AC_DEFINE(HAVE_LIBNL, 1, libnl netlink library), havenetlink=no) #else # AC_MSG_WARN(Missing libnl or libnl too old support will not be able to control mac80211 vaps) #fi if test "$havenetlink" = "yes"; then PKG_CHECK_MODULES(libnl20, [libnl-2.0], libnl20=yes, libnl20=no) PKG_CHECK_MODULES(libnl1, [libnl-1], libnl1=yes, libnl1=no) if test "$libnl20" = "yes"; then AC_DEFINE(HAVE_LIBNL, 1, libnl netlink library) AC_DEFINE(HAVE_LIBNL20, 1, libnl-2.0 netlink library) NLLIBS="-lnl-genl -lnl" elif test "$libnl1" = "yes"; then AC_DEFINE(HAVE_LIBNL, 1, libnl netlink library) NLLIBS="-lnl" else havenetlink="no" fi fi if test "$havenetlink" = "yes"; then OLIBS="$LIBS" LIBS="$LIBS $NLLIBS" AC_MSG_CHECKING(For mac80211 support in netlink library) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include #include #include #include #include #include #include #include #include #include ]], [[ NL80211_IFTYPE_MONITOR; NL80211_CMD_NEW_INTERFACE; return 0; ]])],[havenetlink=yes],[havenetlink=no LIBS="$OLIBS"]) else AC_MSG_WARN(Missing libnl netlink library will not be able to control mac80211 vaps) havenetlink=no fi if test "$havenetlink" = "yes"; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_LINUX_NETLINK, 1, Netlink works) else AC_MSG_RESULT(no libnl/libnl doesn't have mac80211 support, you need both for any drivers which require mac80211 support.) fi fi AC_CHECK_LIB([m], [pow], AC_DEFINE(HAVE_LIBM, 1, Math lib) LIBS="$LIBS -lm", AC_MSG_ERROR(*** Missing working libm math lib ***) ) AC_CONFIG_HEADER(config.h) CFLAGS=" -DHAVE_CONFIG_H $CFLAGS" dnl Write it AC_OUTPUT(Makefile)