Annotation of embedaddon/libnet/configure.ac, revision 1.1
1.1 ! misho 1: #
! 2: # Libnet autoconfiguration information file
! 3: # Copyright (c) 1998 - 2002 Mike D. Schiffman <mike@infonexus.com>
! 4: # Modified by: Ali Abdulkadir <autostart.ini@gmail.com>,
! 5: # Joachim Nilsson <troglobit@gmail.com>
! 6: # All rights reserved.
! 7: #
! 8: # Process this file with autoconf to produce a configure script.
! 9:
! 10: AC_INIT([libnet], [1.2], [https://github.com/libnet/libnet/issues],,
! 11: [https://github.com/libnet/libnet])
! 12:
! 13: # Visible in resulting configure script, e.g. with ./configure --version
! 14: AC_COPYRIGHT([Copyright (C) 1998 - 2019 The libnet Developer Community.])
! 15: AC_REVISION(${VERSION})
! 16:
! 17: # the autotools and libtool should be at least these versions
! 18: AC_PREREQ([2.69])
! 19: LT_PREREQ([2.4.2])
! 20:
! 21: AC_PROG_SHELL
! 22: AC_PROG_SED
! 23: AC_CHECK_PROGS([CHMOD],[chmod],[true])
! 24: AC_CANONICAL_TARGET
! 25: AC_CONFIG_SRCDIR([src/libnet_build_ip.c])
! 26: AC_CONFIG_MACRO_DIR([m4])
! 27: AM_INIT_AUTOMAKE([1.14 foreign subdir-objects no-dependencies dist-zip])
! 28: AM_SILENT_RULES([yes])
! 29: AC_CONFIG_HEADERS([include/config.h])
! 30:
! 31: AC_CONFIG_FILES([Makefile \
! 32: Doxyfile \
! 33: libnet-config \
! 34: doc/Makefile \
! 35: doc/man/Makefile \
! 36: doc/man/man1/Makefile \
! 37: doc/man/man3/Makefile \
! 38: include/Makefile \
! 39: include/libnet.h \
! 40: libnet.pc \
! 41: src/Makefile \
! 42: sample/Makefile \
! 43: win32/Makefile])
! 44: AC_CONFIG_FILES([doc/fixmanpages], [chmod a+x doc/fixmanpages])
! 45:
! 46: # Check for the usual programs
! 47: AC_PROG_CC
! 48: AC_PROG_INSTALL
! 49: AC_USE_SYSTEM_EXTENSIONS
! 50: # The default is to use only PIC objects.
! 51: # This can still be overwritten with --without-pic
! 52: LT_INIT([pic-only])
! 53:
! 54: #
! 55: # Check for headers
! 56: #
! 57: AC_CHECK_HEADERS([sys/sockio.h])
! 58: AC_CHECK_FUNCS([gethostbyname2])
! 59: AC_CHECK_FUNCS([getifaddrs])
! 60: AC_TYPE_UINT16_T
! 61: AC_TYPE_UINT32_T
! 62: AC_TYPE_UINT64_T
! 63:
! 64: AC_MSG_CHECKING(for socklen_t)
! 65: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
! 66: #include <sys/types.h>
! 67: #include <sys/socket.h>
! 68: ]], [[ socklen_t x; ]])],[have_socklen_t=yes],[have_socklen_t=no])
! 69: AS_IF([test "x$have_socklen_t" = "xyes"], [
! 70: AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined])])
! 71: AC_MSG_RESULT($have_socklen_t)
! 72:
! 73: #
! 74: # And some custom things
! 75: #
! 76: AC_LIBNET_ENDIAN_CHECK
! 77: AC_SUBST(ENDIANESS)
! 78: AC_SUBST(HAVE_PACKET_SOCKET)
! 79: AC_SUBST(ADDITIONAL_LIBS)
! 80: AC_SUBST(PKG_CONFIG_DEFINES)
! 81: AC_SUBST(PKG_CONFIG_LIBS)
! 82: AC_SUBST(PKG_CONFIG_CFLAGS)
! 83: AC_SUBST(LTLIBOBJS)
! 84:
! 85: # Get link-layer interface type
! 86: AC_ARG_WITH(
! 87: [link-layer],
! 88: [AS_HELP_STRING([--with-link-layer],
! 89: [when cross-compiling, one of * from libnet_link_*.c @<:@autodetect@:>@])])
! 90:
! 91: AC_CHECK_HEADERS([net/pfilt.h sys/net/nit.h net/raw.h sys/dlpi.h linux/socket.h])
! 92:
! 93: AC_MSG_CHECKING(link-layer packet interface type)
! 94:
! 95: AS_IF([test -n "${with_link_layer}"], [
! 96: AS_CASE([${with_link_layer}],
! 97: [bpf], [AC_LIBOBJ([libnet_link_bpf])],
! 98: [pf], [AC_LIBOBJ([libnet_link_pf])],
! 99: [snit], [AC_LIBOBJ([libnet_link_snit])],
! 100: [nit], [AC_LIBOBJ([libnet_link_nit])],
! 101: [snoop], [AC_LIBOBJ([libnet_link_snoop])],
! 102: [dlpi], [AC_LIBOBJ([libnet_link_dlpi])],
! 103: [win32], [AC_LIBOBJ([libnet_link_win32])],
! 104: [none], [AC_LIBOBJ([libnet_link_none])],
! 105: [linux], [AC_LIBOBJ([libnet_link_linux])
! 106: AC_LIBNET_CHECK_PF_PACKET
! 107: AC_LIBNET_LINUX_PROCFS],
! 108: [AC_MSG_ERROR([Invalid link type "${with_link_layer}"])])
! 109: AC_MSG_RESULT(user selected link layer ${with_link_layer})],
! 110: [test "${cross_compiling}" != "yes" -a -r /dev/bpf0], [
! 111: AC_LIBOBJ([libnet_link_bpf])
! 112: AC_MSG_RESULT(found link layer bpf)],
! 113: [test "${ac_cv_header_net_pfilt_h}" = "yes"], [
! 114: AC_LIBOBJ([libnet_link_pf])
! 115: AC_MSG_RESULT(found link layer pf)],
! 116: [test "${cross_compiling}" != "yes" -a -r /dev/nit], [
! 117: AC_LIBOBJ([libnet_link_snit])
! 118: AC_MSG_RESULT(found link layer snit)],
! 119: [test "${ac_cv_header_sys_net_nit_h}" = "yes"], [
! 120: AC_LIBOBJ([libnet_link_nit])
! 121: AC_MSG_RESULT(found link layer nit)],
! 122: [test "${ac_cv_header_net_raw_h}" = "yes"], [
! 123: AC_LIBOBJ([libnet_link_snoop])
! 124: AC_MSG_RESULT(found link layer snoop)],
! 125: [test "${ac_cv_header_sys_dlpi_h}" = "yes"], [
! 126: AC_LIBOBJ([libnet_link_dlpi])
! 127: AC_MSG_RESULT(found link layer dlpi)
! 128: AC_DEFINE(HAVE_DLPI, 1, [Define if the <sys/dlpi.h> header exists.])],
! 129: [test "${ac_cv_header_linux_socket_h}" = "yes"], [
! 130: AC_LIBOBJ([libnet_link_linux])
! 131: AC_MSG_RESULT(found link layer linux)
! 132: AC_LIBNET_CHECK_PF_PACKET
! 133: AC_LIBNET_LINUX_PROCFS],
! 134: [test "${cross_compiling}" != "yes" -a -c /dev/bpf0], [
! 135: # check again in case not readable
! 136: AC_LIBOBJ([libnet_link_bpf])
! 137: AC_MSG_RESULT(found link layer bpf)],
! 138: [test "${cross_compiling}" != "yes" -a -c /dev/nit], [
! 139: # check again in case not readable
! 140: AC_LIBOBJ([libnet_link_snit])
! 141: AC_MSG_RESULT(found link layer snit)],
! 142: [test "$target_os" = "cygwin"], [
! 143: AC_LIBOBJ([libnet_link_win32])
! 144: AC_MSG_RESULT(found link layer win32 wpcap)],
! 145: [test "$host" = "i686-w64-mingw32" -o "x86_64-w64-mingw32" -o "x86_64-pc-mingw64"], [
! 146: AC_LIBOBJ([libnet_link_win32])
! 147: AC_MSG_RESULT(found link layer win32 @<:@WinPcap@:>@)],[
! 148: AC_LIBOBJ([libnet_link_none])
! 149: AC_MSG_WARN(could not find a link-layer packet interface)
! 150: AC_MSG_WARN(link-layer packet injection will not be available)])
! 151:
! 152: # Check for Doxygen and enable its features.
! 153: # For details, see m4/ax_prog_doxygen.m4 and
! 154: # http://www.bioinf.uni-freiburg.de/~mmann/HowTo/automake.html#doxygenSupport
! 155: DX_DOXYGEN_FEATURE(ON)
! 156: DX_DOT_FEATURE(ON)
! 157: DX_CHI_FEATURE(OFF)
! 158: DX_RTF_FEATURE(OFF)
! 159: DX_XML_FEATURE(OFF)
! 160: DX_PDF_FEATURE(OFF)
! 161: DX_PS_FEATURE(OFF)
! 162: DX_CHM_FEATURE(OFF)
! 163: DX_HTML_FEATURE(ON)
! 164: DX_MAN_FEATURE(ON)
! 165: DX_INIT_DOXYGEN(${PACKAGE_NAME}, [${top_builddir}/Doxyfile], [doc])
! 166: AM_CONDITIONAL(ENABLE_DOXYGEN,[test "x${DX_FLAG_doc}" = x1])
! 167: AM_CONDITIONAL(ENABLE_HTML,[test "x${DX_FLAG_html}" = x1])
! 168: AM_CONDITIONAL(ENABLE_MAN,[test "x${DX_FLAG_man}" = x1])
! 169:
! 170: # Check for sample building
! 171: AC_MSG_CHECKING([whether to build sample programs])
! 172: AC_ARG_ENABLE([samples],
! 173: [AS_HELP_STRING([--enable-samples],[do not build sample programs @<:@default=no@:>@])],
! 174: [enable_samples=$enableval],
! 175: [enable_samples=no]
! 176: )
! 177: AC_MSG_RESULT([$enable_samples])
! 178: AM_CONDITIONAL([ENABLE_SAMPLES], [test "$enable_samples" = "yes"])
! 179:
! 180: # what (not) to do if the user disables shared libraries
! 181: AM_CONDITIONAL([COND_SHARED], [test "x$enable_shared" != xno])
! 182:
! 183: # Check and set OS specific parameters
! 184: AS_CASE([$target_os],
! 185: [*linux*], [
! 186: AC_DEFINE(_BSD_SOURCE, 1,
! 187: [Define as necessary to "unhide" header symbols.])
! 188: AC_DEFINE(_DEFAULT_SOURCE, 1,
! 189: [Define as necessary to "unhide" header symbols.])
! 190:
! 191: PKG_CONFIG_DEFINES="-D_BSD_SOURCE -D_DEFAULT_SOURCE"
! 192: AC_CHECK_HEADERS(net/ethernet.h, \
! 193: PKG_CONFIG_DEFINES="$PKG_CONFIG_DEFINES -DHAVE_NET_ETHERNET_H")
! 194: ],
! 195:
! 196: [*freebsd*], [
! 197: PKG_CONFIG_DEFINES="-DHAVE_SOCKADDR_SA_LEN"
! 198: AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [FreeBSD has sa_len in struct sockaddr.])
! 199:
! 200: AC_MSG_CHECKING([FreeBSD version, is SOCK_RAW really raw?])
! 201: AC_TRY_COMPILE([#include <sys/param.h>], [
! 202: #if (__FreeBSD_version >= 1100030)
! 203: return 0;
! 204: #else
! 205: #error FreeBSD pre-11, SOCK_RAW isn't really raw, see https://www.freebsd.org/cgi/man.cgi?ip(4)#end
! 206: #endif],
! 207: AC_MSG_RESULT([yes]),
! 208: AC_MSG_RESULT([no])
! 209: AC_DEFINE(LIBNET_BSD_BYTE_SWAP, 1, [FreeBSD pre-11, libnet must byteswap raw ip_len, ip_off])
! 210: PKG_CONFIG_DEFINES="${PKG_CONFIG_DEFINES} -DLIBNET_BSD_BYTE_SWAP")],
! 211:
! 212: [*netbsd*], [
! 213: AC_DEFINE(LIBNET_BSD_BYTE_SWAP, 1,
! 214: [Define if libnet should byteswap data.])
! 215:
! 216: PKG_CONFIG_DEFINES="-DLIBNET_BSD_BYTE_SWAP"
! 217: ],
! 218:
! 219: [*openbsd*], [
! 220: AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1,
! 221: [Define if the sockaddr structure includes a sa_len member.])
! 222: ],
! 223:
! 224: [*bsdi*], [
! 225: AC_DEFINE(LIBNET_BSD_BYTE_SWAP, 1,
! 226: [Define if libnet should byteswap data.])
! 227: PKG_CONFIG_DEFINES="-DLIBNET_BSD_BYTE_SWAP"
! 228: ],
! 229:
! 230: [*darwin*], [
! 231: AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1,
! 232: [Define if the sockaddr structure includes a sa_len member.])
! 233: AC_DEFINE(LIBNET_BSD_BYTE_SWAP, 1, [Define if libnet should byteswap data.])
! 234: PKG_CONFIG_DEFINES="-DHAVE_SOCKADDR_SA_LEN -DLIBNET_BSD_BYTE_SWAP"
! 235: ],
! 236:
! 237: [*solaris*], [
! 238: AC_DEFINE(HAVE_SOLARIS, 1, [Define if we are running on Solaris.])
! 239: AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
! 240: AC_MSG_CHECKING(for /dev/dlpi device)
! 241: AS_IF([test -c /dev/dlpi], [
! 242: AC_MSG_RESULT(yes)
! 243: AC_DEFINE(HAVE_DEV_DLPI, 1, [Define if /dev/dlpi is available.])
! 244: ], [
! 245: AC_MSG_RESULT(no)
! 246: dir="/dev/dlpi"
! 247: AC_MSG_CHECKING(for $dir directory)
! 248: AS_IF([test -d $dir], [
! 249: AC_MSG_RESULT(yes)
! 250: AC_DEFINE_UNQUOTED(DLPI_DEV_PREFIX, "$dir",
! 251: [Define if /dev/dlpi is a directory.])
! 252: ], [
! 253: AC_MSG_RESULT(no)
! 254: ])
! 255: ])
! 256: AC_CHECK_LIB(socket, socket, ,AC_MSG_ERROR(libsocket not found.))
! 257: AC_CHECK_LIB(nsl, gethostbyname, ,AC_MSG_ERROR(libnsl not found.))
! 258: AC_CHECK_LIB(resolv, hstrerror, ,AC_MSG_ERROR(libresolv not found.))
! 259:
! 260: #
! 261: # Broken checksums?
! 262: #
! 263: AS_CASE([`uname -r`],
! 264: [5.4], [
! 265: AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1,
! 266: [Define if our version of Solaris has broken checksums.])
! 267: ],
! 268: [5.5*], [
! 269: AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1,
! 270: [Define if our version of Solaris has broken checksums.])
! 271: ],
! 272: [5.8], [
! 273: AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1,
! 274: [Define if our version of Solaris has broken checksums.])
! 275: AC_DEFINE(HAVE_SOLARIS_IPV6, 1,
! 276: [Define if our version of Solaris supports IPv6.])
! 277:
! 278: ],
! 279: [5.9], [
! 280: AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1,
! 281: [Define if our version of Solaris has broken checksums.])
! 282: AC_DEFINE(HAVE_SOLARIS_IPV6, 1,
! 283: [Define if our version of Solaris supports IPv6.])
! 284: ],
! 285: [5.10 | 5.11 | 5.12], [
! 286: AC_DEFINE(HAVE_SOLARIS_IPV6, 1,
! 287: [Define if our version of Solaris supports IPv6.])
! 288: ])
! 289:
! 290: ADDITIONAL_LIBS="-lresolv -lsocket -lnsl"
! 291: PKG_CONFIG_LIBS="$PKG_CONFIG_LIBS -lresolv -lsocket -lnsl"
! 292: ],
! 293:
! 294: [*hpux11*], [
! 295: AC_DEFINE(HAVE_HPUX11, 1, [Define if we are building on HP/UX.])
! 296: AC_CHECK_HEADERS(sys/dlpi_ext.h)
! 297: ],
! 298:
! 299: [*cygwin* | *msys*], [
! 300: WIN32="yes"
! 301: AC_SUBST(WIN32)
! 302: CFLAGS="$CFLAGS -mwin32"
! 303: AC_CHECK_LIB(packet, PacketSetMode, ,AC_MSG_ERROR(packet lib not found.))
! 304: AC_CHECK_LIB(wpcap, pcap_setmode, ,AC_MSG_ERROR(pcap lib not found.))
! 305: LIBS="$LIBS -lws2_32"
! 306: ],
! 307:
! 308: [*mingw*], [
! 309: WIN32="yes"
! 310: AC_SUBST(WIN32)
! 311:
! 312: AS_IF([test "$enable_shared" = "yes"], [AC_CHECK_TOOL(WINDRES, windres, :)])
! 313:
! 314: AC_DEFINE(WIN32_LEAN_AND_MEAN, 1, [Define to limit the scope of <windows.h>])
! 315:
! 316: AC_CHECK_LIB(packet, PacketSetMode, ,AC_MSG_ERROR(libpacket.a not found. See README.win32 for more information))
! 317: AC_CHECK_LIB(wpcap, pcap_setmode, ,AC_MSG_ERROR(libwpcap.a not found. See README.win32 for more information))
! 318: LIBS="$LIBS -lws2_32 -liphlpapi"
! 319:
! 320: AS_IF([test "$host" = "i686-w64-mingw32"], [
! 321: CFLAGS="$CFLAGS -march=i686 -mwin32"], [
! 322: CFLAGS="$CFLAGS -mwin32"
! 323:
! 324: AX_CHECK_LINK_FLAG([-Wl,--high-entropy-va],
! 325: [LDFLAGS="$LDFLAGS -Wl,--high-entropy-va"],
! 326: [AC_MSG_NOTICE([Consider updating your toolchain.])])
! 327: ])
! 328:
! 329: AS_IF([test "${cross_compiling}" = "yes"], [
! 330: CFLAGS="$CFLAGS -static-libgcc"])
! 331: ],
! 332:
! 333: [*irix*], [
! 334: CFLAGS="$CFLAGS -DINET6=1"
! 335: ], [
! 336: AC_MSG_WARN(${target_os} is not officially supported yet.)
! 337: AC_MSG_RESULT(Please report this to ${PACKAGE_BUGREPORT})])
! 338:
! 339: # this only matters if we are building for Windows...
! 340: AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
! 341:
! 342: # Create all files from AC_CONFIG_FILES()
! 343: AC_OUTPUT
! 344:
! 345: # Helper variables for summary, below
! 346: AS_IF([test ${DX_FLAG_doc} -eq 1], [rebuild_docs=yes], [rebuild_docs=no])
! 347: link_layer=`"echo"${LTLIBOBJS}"" | sed 's/.*libnet_link_\(.*\)\$.*/\1/'`
! 348:
! 349: AC_MSG_RESULT([
! 350: -=-=-=-=-=-=-=-=-=-= $PACKAGE Configuration Complete =-=-=-=-=-=-=-=-=-=-
! 351:
! 352: Version ....................... ${VERSION}
! 353:
! 354: Host .......................... ${host}
! 355: Operating System .............. ${host_os}
! 356: Host CPU ...................... ${host_cpu}
! 357: Host Vendor ................... ${host_vendor}
! 358: Host OS ....................... ${host_os}
! 359: Prefix ........................ ${prefix}
! 360:
! 361: Cross-compiling ............... ${cross_compiling}
! 362: Compiler is GCC ............... ${ac_cv_c_compiler_gnu}
! 363: CC ............................ ${CC}
! 364: CFLAGS ........................ ${CFLAGS}
! 365: LD ............................ ${LD}
! 366: LDFLAGS ....................... ${LDFLAGS}
! 367: LIBS .......................... ${LIBS}
! 368:
! 369: Link Layer .................... ${link_layer}
! 370: Shared Libraries .............. ${enable_shared}
! 371: Static Libraries .............. ${enable_static}
! 372: PIC ........................... ${pic_mode}
! 373: Build Sample Programs ......... ${enable_samples}
! 374: Rebuild docs .................. ${rebuild_docs}
! 375:
! 376: To override options
! 377:
! 378: $0 --help
! 379:
! 380: Report bugs to ${PACKAGE_BUGREPORT}
! 381:
! 382: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
! 383: To disable silent build and print the full command line of every stage
! 384:
! 385: make V=1
! 386: ])
! 387: AS_IF([test "$WIN32" = "yes"], [AC_MSG_RESULT(
! 388: [To compile shared libraries on MinGW use the bundled WinPcap libraries
! 389: in ./win32/. GCC can NOT produce x64 compatible images with official
! 390: WinPcap Developer Pack. See README.win32 for more info.
! 391: ])])
! 392: AS_IF([test "$rebuild_docs" = "yes"], [AC_MSG_RESULT(
! 393: [To build/update the documentation
! 394:
! 395: make doc
! 396: ])])
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>