File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / dhcp / configure.ac
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Oct 9 09:06:54 2012 UTC (11 years, 8 months ago) by misho
Branches: dhcp, MAIN
CVS tags: v4_1_R7p0, v4_1_R7, v4_1_R4, HEAD
dhcp 4.1 r7

    1: AC_INIT([DHCP], [4.1-ESV-R7], [dhcp-users@isc.org])
    2: 
    3: # we specify "foreign" to avoid having to have the GNU mandated files,
    4: # like AUTHORS, COPYING, and such
    5: AM_INIT_AUTOMAKE([foreign])
    6: 
    7: # we specify AM_MAINTAINER_MODE to avoid problems with rebuilding
    8: # the configure and makefiles.  Without it users doing things that
    9: # change the timestamps on the code, like checking it into a cvs
   10: # tree, could trigger a rebuild of the infrastructure files which
   11: # might fail if they don't have the correct tools.
   12: AM_MAINTAINER_MODE 
   13: 
   14: # We want to turn on warnings if we are using gcc and the user did 
   15: # not specify CFLAGS. The autoconf check for the C compiler sets the
   16: # CFLAGS if gcc is used, so we will save it before we run that check.
   17: SAVE_CFLAGS="$CFLAGS"
   18: 
   19: # Now find our C compiler.
   20: AC_PROG_CC
   21: 
   22: # Suppress warnings about --datarootdir
   23: AC_DEFUN([AC_DATAROOTDIR_CHECKED])
   24: 
   25: # If we have gcc, and AC_PROG_CC changed the flags, then we know the
   26: # user did not specify any flags. Add warnings in this case.
   27: if test "$GCC" = "yes"; then
   28: 	if test "$CFLAGS" != "$SAVE_CFLAGS"; then
   29: 		STD_CWARNINGS="$STD_CWARNINGS -Wall -Werror -fno-strict-aliasing"
   30: 	fi
   31: fi
   32: 
   33: # POSIX doesn't include the IPv6 Advanced Socket API and glibc hides
   34: # parts of the IPv6 Advanced Socket API as a result.  This is stupid
   35: # as it breaks how the two halves (Basic and Advanced) of the IPv6
   36: # Socket API were designed to be used but we have to live with it.
   37: # Use this to define _GNU_SOURCE to pull in the IPv6 Advanced Socket API.
   38: AC_USE_SYSTEM_EXTENSIONS
   39: 
   40: AC_PROG_RANLIB
   41: AC_CONFIG_HEADERS([includes/config.h])
   42: 
   43: # we sometimes need to know byte order for building packets
   44: AC_C_BIGENDIAN(AC_SUBST(byte_order, BIG_ENDIAN), 
   45: 	       AC_SUBST(byte_order, LITTLE_ENDIAN))
   46: AC_DEFINE_UNQUOTED([DHCP_BYTE_ORDER], [$byte_order], 
   47: 		   [Define to BIG_ENDIAN for MSB (Motorola or SPARC CPUs)
   48: 		    or LITTLE_ENDIAN for LSB (Intel CPUs).])
   49: 
   50: # Optional compile-time DEBUGging.
   51: AC_ARG_ENABLE(debug,
   52: 	AC_HELP_STRING([--enable-debug],
   53: 		[create a debug-only version of the software (default is no).]),
   54: 		[enable_debug=yes],[enable_debug=no])
   55: # This is very much off by default.
   56: if test "$enable_debug" = "yes" ; then
   57: 	AC_DEFINE([DEBUG], [1],
   58: 		[Define to compile debug-only DHCP software.])
   59: 	# Just override CFLAGS to totally to remove optimization.
   60: 	CFLAGS="-g"
   61: fi
   62: # XXX: there are actually quite a lot more DEBUG_ features we could enable,
   63: # but I don't want to pollute the --help space.
   64: #
   65: #/* #define DEBUG_TOKENS */
   66: #/* #define DEBUG_PACKET */
   67: #/* #define DEBUG_EXPRESSIONS */
   68: #/* #define DEBUG_FIND_LEASE */
   69: #/* #define DEBUG_EXPRESSION_PARSE */
   70: #/* #define DEBUG_CLASS_MATCHING */
   71: #/* #define DEBUG_MEMORY_LEAKAGE */
   72: #/* #define DEBUG_MALLOC_POOL */
   73: #/* #define DEBUG_LEASE_STATE_TRANSITIONS */
   74: #/* #define DEBUG_RC_HISTORY */
   75: #/* #define DEBUG_RC_HISTORY_EXHAUSTIVELY */
   76: #/* #define RC_HISTORY_MAX 10240 */
   77: #/* #define POINTER_DEBUG */
   78: #/* #define DEBUG_FAILOVER_MESSAGES */
   79: #/* #define DEBUG_FAILOVER_TIMING */
   80: #/* #define DEBUG_DUMP_ALL_LEASES */
   81: 
   82: # Failover optional compile-time feature.
   83: AC_ARG_ENABLE(failover,
   84: 	AC_HELP_STRING([--enable-failover],
   85: 		[enable support for failover (default is yes)]))
   86: # Failover is on by default, so define if it is not explicitly disabled.
   87: if test "$enable_failover" != "no"; then
   88: 	AC_DEFINE([FAILOVER_PROTOCOL], [1],
   89: 		  [Define to include Failover Protocol support.])
   90: fi
   91: 
   92: # execute() support.
   93: AC_ARG_ENABLE(execute,
   94: 	AC_HELP_STRING([--enable-execute],
   95: 		[enable support for execute() in config (default is yes)]))
   96: # execute() is on by default, so define if it is not explicitly disabled.
   97: if test "$enable_execute" != "no" ; then
   98: 	AC_DEFINE([ENABLE_EXECUTE], [1],
   99: 		  [Define to include execute() config language support.])
  100: fi
  101: 
  102: # Server tracing support.
  103: AC_ARG_ENABLE(tracing,
  104: 	AC_HELP_STRING([--enable-tracing],
  105: 		[enable support for server activity tracing (default is yes)]))
  106: # tracing is on by default, so define if it is not explicitly disabled.
  107: if test "$enable_tracing" != "no" ; then
  108: 	AC_DEFINE([TRACING], [1],
  109: 		  [Define to include server activity tracing support.])
  110: fi
  111: 
  112: # Delayed-ack feature support (experimental).
  113: AC_ARG_ENABLE(delayed_ack,
  114: 	AC_HELP_STRING([--enable-delayed-ack],
  115: 		       [queues multiple DHCPACK replies (default is no)]))
  116: if test "$enable_delayed_ack" = "yes"; then
  117: 	AC_DEFINE([DELAYED_ACK], [1],
  118: 		  [Define to queue multiple DHCPACK replies per fsync.])
  119: fi
  120: 
  121: # DHCPv6 optional compile-time feature.
  122: AC_ARG_ENABLE(dhcpv6,
  123: 	AC_HELP_STRING([--enable-dhcpv6],
  124: 		       [enable support for DHCPv6 (default is yes)]))
  125: # DHCPv6 is on by default, so define if it is not explicitly disabled.
  126: if test "$enable_dhcpv6" != "no"; then
  127: 	AC_DEFINE([DHCPv6], [1], 
  128: 		  [Define to 1 to include DHCPv6 support.])
  129: fi
  130: 
  131: # PARANOIA is off by default (until we can test it with all features)
  132: AC_ARG_ENABLE(paranoia,
  133: 	AC_HELP_STRING([--enable-paranoia],
  134: 		[enable support for chroot/setuid (default is no)]))
  135: AC_ARG_ENABLE(early_chroot,
  136: 	AC_HELP_STRING([--enable-early-chroot],
  137: 		[enable chrooting prior to configuration (default is no)]))
  138: # If someone enables early chroot, but does not enable paranoia, do so for
  139: # them.
  140: if test "$enable_paranoia" != "yes" && \
  141:    test "$enable_early_chroot" = "yes" ; then
  142: 	enable_paranoia="yes"
  143: fi
  144: 
  145: if test "$enable_paranoia" = "yes" ; then
  146: 	AC_DEFINE([PARANOIA], [1],
  147: 		  [Define to any value to include Ari's PARANOIA patch.])
  148: fi
  149: if test "$enable_early_chroot" = "yes" ; then
  150: 	AC_DEFINE([EARLY_CHROOT], [1],
  151: 		  [Define to any value to chroot() prior to loading config.])
  152: fi
  153: 
  154: AC_ARG_ENABLE(ipv4_pktinfo,
  155: 	AC_HELP_STRING([--enable-ipv4-pktinfo],
  156: 		[enable use of pktinfo on IPv4 sockets (default is no)]))
  157: 
  158: if test "$enable_ipv4_pktinfo" = "yes"; then
  159: 	AC_DEFINE([USE_V4_PKTINFO], [1],
  160: 		[Define to 1 to enable IPv4 packet info support.])
  161: fi
  162: 
  163: AC_ARG_ENABLE(use_sockets,
  164: 	AC_HELP_STRING([--enable-use-sockets],
  165: 		[use the standard BSD socket API (default is no)]))
  166: 
  167: if test "$enable_use_sockets" = "yes"; then
  168: 	AC_DEFINE([USE_SOCKETS], [1],
  169: 		[Define to 1 to use the standard BSD socket API.])
  170: fi
  171: 
  172: # Testing section
  173: 
  174: atf_path="no"
  175: AC_ARG_WITH([atf],
  176:     AC_HELP_STRING([--with-atf=PATH],
  177:                    [specify location where atf was installed]),
  178:     [atf_path="$withval"])
  179: if test "$atf_path" != "no" ; then
  180:     # Config path for pkg-config
  181:     atf_pcp=""
  182:     if test "$atf_path" != "yes" ; then
  183:         if test -f $atf_path/lib/pkgconfig/atf-c.pc ; then
  184:             atf_pcp=$atf_path/lib/pkgconfig
  185:         fi
  186:     else
  187:         # Not specified, try some common paths
  188:         atf_dirs="/usr /usr/local /usr/pkg /opt /opt/local"
  189:         for d in $atf_dirs
  190:         do
  191:             if test -f $d/lib/pkgconfig/atf-c.pc ; then
  192:                 atf_pcp=$d/lib/pkgconfig
  193:             fi
  194:         done
  195:     fi
  196:     if test "$atf_pcp" = "" ; then
  197:         AC_MSG_ERROR([Unable to find atf files in location specified])
  198:     else
  199:         ATF_CFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --cflags atf-c` -DUNIT_TEST"
  200:         ATF_LDFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --libs atf-c`"
  201:         AC_SUBST(ATF_CFLAGS)
  202:         AC_SUBST(ATF_LDFLAGS)
  203:     fi
  204: fi
  205: 
  206: AM_CONDITIONAL(HAVE_ATF, test "$atf_pcp" != "")
  207: ### Uncomment this once docs.lab.isc.org upgrades to automake 1.11
  208: ### AM_COND_IF([HAVE_ATF], [AC_DEFINE([HAVE_ATF], [1], [ATF framework specified?])])
  209: 
  210: ###
  211: ### Path fun.  Older versions of DHCP were installed in /usr/sbin, so we
  212: ### need to look there and potentially overwrite by default (but not if
  213: ### the user configures an alternate value).  LOCALSTATEDIR is totally
  214: ### braindead.  No one uses /usr/local/var/db/ nor /usr/local/var/run, and
  215: ### they would be insane for suggesting it.  We need to look in /var/for
  216: ### 'db' and 'state/dhcp' for db files, and /var/run for pid files by
  217: ### default.
  218: ###
  219: AC_PREFIX_PROGRAM(dhcpd)
  220: 
  221: # XXX - isn't there SOME WAY to default autoconf to /var instead of
  222: # /usr/local/var/no/one/has/this/please/stop/trying?
  223: case "$localstatedir" in
  224: 	'${prefix}/var')
  225: 		localstatedir=/var
  226: 		;;
  227: esac
  228: 
  229: # Allow specification of alternate state files
  230: AC_ARG_WITH(srv-lease-file,
  231: 	AC_HELP_STRING([--with-srv-lease-file=PATH],
  232: 		       [File for dhcpd leases 
  233: 		        (default is LOCALSTATEDIR/db/dhcpd.leases)]),
  234: 	AC_DEFINE_UNQUOTED([_PATH_DHCPD_DB], ["$withval"],
  235: 			   [File for dhcpd leases.]))
  236: 
  237: echo -n "checking for dhcpd.leases location..."
  238: if [[ "x$with_srv_lease_file" = "x" ]] ; then
  239: 	if [[ -d "${localstatedir}/db" ]] ; then
  240: 		with_srv_lease_file="${localstatedir}/db/dhcpd.leases"
  241: 	elif [[ -d "${localstatedir}/state" ]] ; then
  242: 		if [[ -d "${localstatedir}/state/dhcp" ]] ; then
  243: 			with_srv_lease_file="${localstatedir}/state/dhcp/dhcpd.leases"
  244: 		else
  245: 			with_srv_lease_file="${localstatedir}/state/dhcpd.leases"
  246: 		fi
  247: 	elif [[ -d "${localstatedir}/lib" ]] ; then
  248: 		if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
  249: 			with_srv_lease_file="${localstatedir}/lib/dhcp/dhcpd.leases"
  250: 		else
  251: 			with_srv_lease_file="${localstatedir}/lib/dhcpd.leases"
  252: 		fi
  253: 	elif [[ -d "${localstatedir}/etc" ]] ; then
  254: 		with_srv_lease_file="${localstatedir}/etc/dhcpd.leases"
  255: 	else
  256: 		with_srv_lease_file="/etc/dhcpd.leases"
  257: 	fi
  258: fi
  259: echo "$with_srv_lease_file"
  260: 
  261: AC_ARG_WITH(srv6-lease-file,
  262: 	AC_HELP_STRING([--with-srv6-lease-file=PATH],
  263: 		       [File for dhcpd6 leases 
  264: 		        (default is LOCALSTATEDIR/db/dhcpd6.leases)]),
  265: 	AC_DEFINE_UNQUOTED([_PATH_DHCPD6_DB], ["$withval"],
  266: 			   [File for dhcpd6 leases.]))
  267: 
  268: echo -n "checking for dhcpd6.leases location..."
  269: if [[ "x$with_srv6_lease_file" = "x" ]] ; then
  270: 	if [[ -d "${localstatedir}/db" ]] ; then
  271: 		with_srv6_lease_file="${localstatedir}/db/dhcpd6.leases"
  272: 	elif [[ -d "${localstatedir}/state" ]] ; then
  273: 		if [[ -d "${localstatedir}/state/dhcp" ]] ; then
  274: 			with_srv6_lease_file="${localstatedir}/state/dhcp/dhcpd6.leases"
  275: 		else
  276: 			with_srv6_lease_file="${localstatedir}/state/dhcpd6.leases"
  277: 		fi
  278: 	elif [[ -d "${localstatedir}/lib" ]] ; then
  279: 		if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
  280: 			with_srv6_lease_file="${localstatedir}/lib/dhcp/dhcpd6.leases"
  281: 		else
  282: 			with_srv6_lease_file="${localstatedir}/lib/dhcpd6.leases"
  283: 		fi
  284: 	elif [[ -d "${localstatedir}/etc" ]] ; then
  285: 		with_srv6_lease_file="${localstatedir}/etc/dhcpd6.leases"
  286: 	else
  287: 		with_srv6_lease_file="/etc/dhcpd6.leases"
  288: 	fi
  289: fi
  290: echo "$with_srv6_lease_file"
  291: 
  292: AC_ARG_WITH(cli-lease-file,
  293: 	AC_HELP_STRING([--with-cli-lease-file=PATH],
  294: 		       [File for dhclient leases 
  295: 		        (default is LOCALSTATEDIR/db/dhclient.leases)]),
  296: 	AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_DB], ["$withval"],
  297: 			   [File for dhclient leases.]))
  298: 
  299: echo -n "checking for dhclient.leases location..."
  300: if [[ "x$with_cli_lease_file" = "x" ]] ; then
  301: 	if [[ -d "${localstatedir}/db" ]] ; then
  302: 		with_cli_lease_file="${localstatedir}/db/dhclient.leases"
  303: 	elif [[ -d "${localstatedir}/state" ]] ; then
  304: 		if [[ -d "${localstatedir}/state/dhcp" ]] ; then
  305: 			with_cli_lease_file="${localstatedir}/state/dhcp/dhclient.leases"
  306: 		else
  307: 			with_cli_lease_file="${localstatedir}/state/dhclient.leases"
  308: 		fi
  309: 	elif [[ -d "${localstatedir}/lib" ]] ; then
  310: 		if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
  311: 			with_cli_lease_file="${localstatedir}/lib/dhcp/dhclient.leases"
  312: 		else
  313: 			with_cli_lease_file="${localstatedir}/lib/dhclient.leases"
  314: 		fi
  315: 	elif [[ -d "${localstatedir}/etc" ]] ; then
  316: 		with_cli_lease_file="${localstatedir}/etc/dhclient.leases"
  317: 	else
  318: 		with_cli_lease_file="/etc/dhclient.leases"
  319: 	fi
  320: fi
  321: echo "$with_cli_lease_file"
  322: 
  323: AC_ARG_WITH(cli6-lease-file,
  324: 	AC_HELP_STRING([--with-cli6-lease-file=PATH],
  325: 		       [File for dhclient6 leases 
  326: 		        (default is LOCALSTATEDIR/db/dhclient6.leases)]),
  327: 	AC_DEFINE_UNQUOTED([_PATH_DHCLIENT6_DB], ["$withval"],
  328: 			   [File for dhclient6 leases.]))
  329: 
  330: echo -n "checking for dhclient6.leases location..."
  331: if [[ "x$with_cli6_lease_file" = "x" ]] ; then
  332: 	if [[ -d "${localstatedir}/db" ]] ; then
  333: 		with_cli6_lease_file="${localstatedir}/db/dhclient6.leases"
  334: 	elif [[ -d "${localstatedir}/state" ]] ; then
  335: 		if [[ -d "${localstatedir}/state/dhcp" ]] ; then
  336: 			with_cli6_lease_file="${localstatedir}/state/dhcp/dhclient6.leases"
  337: 		else
  338: 			with_cli6_lease_file="${localstatedir}/state/dhclient6.leases"
  339: 		fi
  340: 	elif [[ -d "${localstatedir}/lib" ]] ; then
  341: 		if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
  342: 			with_cli6_lease_file="${localstatedir}/lib/dhcp/dhclient6.leases"
  343: 		else
  344: 			with_cli6_lease_file="${localstatedir}/lib/dhclient6.leases"
  345: 		fi
  346: 	elif [[ -d "${localstatedir}/etc" ]] ; then
  347: 		with_cli6_lease_file="${localstatedir}/etc/dhclient6.leases"
  348: 	else
  349: 		with_cli6_lease_file="/etc/dhclient6.leases"
  350: 	fi
  351: fi
  352: echo "$with_cli6_lease_file"
  353: 
  354: AC_ARG_WITH(srv-pid-file,
  355: 	AC_HELP_STRING([--with-srv-pid-file=PATH],
  356: 		       [File for dhcpd process information
  357: 		        (default is LOCALSTATEDIR/run/dhcpd.pid)]),
  358: 	AC_DEFINE_UNQUOTED([_PATH_DHCPD_PID], ["$withval"],
  359: 			   [File for dhcpd process information.]))
  360: AC_ARG_WITH(srv6-pid-file,
  361: 	AC_HELP_STRING([--with-srv6-pid-file=PATH],
  362: 		       [File for dhcpd6 process information
  363: 		        (default is LOCALSTATEDIR/run/dhcpd6.pid)]),
  364: 	AC_DEFINE_UNQUOTED([_PATH_DHCPD6_PID], ["$withval"],
  365: 			   [File for dhcpd6 process information.]))
  366: AC_ARG_WITH(cli-pid-file,
  367: 	AC_HELP_STRING([--with-cli-pid-file=PATH],
  368: 		       [File for dhclient process information
  369: 		        (default is LOCALSTATEDIR/run/dhclient.pid)]),
  370: 	AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_PID], ["$withval"],
  371: 			   [File for dhclient process information.]))
  372: AC_ARG_WITH(cli6-pid-file,
  373: 	AC_HELP_STRING([--with-cli6-pid-file=PATH],
  374: 		       [File for dhclient6 process information
  375: 		        (default is LOCALSTATEDIR/run/dhclient6.pid)]),
  376: 	AC_DEFINE_UNQUOTED([_PATH_DHCLIENT6_PID], ["$withval"],
  377: 			   [File for dhclient6 process information.]))
  378: AC_ARG_WITH(relay-pid-file,
  379: 	AC_HELP_STRING([--with-relay-pid-file=PATH],
  380: 		       [File for dhcrelay process information
  381: 		        (default is LOCALSTATEDIR/run/dhcrelay.pid)]),
  382: 	AC_DEFINE_UNQUOTED([_PATH_DHCRELAY_PID], ["$withval"],
  383: 			   [File for dhcrelay process information.]))
  384: AC_ARG_WITH(relay6-pid-file,
  385: 	AC_HELP_STRING([--with-relay6-pid-file=PATH],
  386: 		       [File for dhcrelay6 process information
  387: 		        (default is LOCALSTATEDIR/run/dhcrelay6.pid)]),
  388: 	AC_DEFINE_UNQUOTED([_PATH_DHCRELAY6_PID], ["$withval"],
  389: 			   [File for dhcrelay6 process information.]))
  390: 
  391: # Check basic types.
  392: AC_TYPE_INT8_T
  393: AC_TYPE_INT16_T
  394: AC_TYPE_INT32_T
  395: AC_TYPE_INT64_T
  396: 
  397: # Some systems need the u_intX_t types defined across.
  398: AC_CHECK_TYPE([u_int8_t], [], [
  399:   AC_TYPE_UINT8_T
  400:   AC_DEFINE(u_int8_t, [uint8_t], [Define a type for 8-bit unsigned
  401: 				  integers.])
  402: ])
  403: AC_CHECK_TYPE([u_int16_t], [], [
  404:   AC_TYPE_UINT16_T
  405:   AC_DEFINE(u_int16_t, [uint16_t], [Define a type for 16-bit unsigned
  406: 				    integers.])
  407: ])
  408: AC_CHECK_TYPE([u_int32_t], [], [
  409:   AC_TYPE_UINT32_T
  410:   AC_DEFINE(u_int32_t, [uint32_t], [Define a type for 32-bit unsigned
  411: 				    integers.])
  412: ])
  413: AC_CHECK_TYPE([u_int64_t], [], [
  414:   AC_TYPE_UINT64_T
  415:   AC_DEFINE(u_int64_t, [uint64_t], [Define a type for 64-bit unsigned
  416: 				    integers.])
  417: ])
  418: 
  419: # see if ifaddrs.h is available
  420: AC_CHECK_HEADERS(ifaddrs.h)
  421: 
  422: # figure out what IPv4 interface code to use
  423: AC_CHECK_HEADERS(linux/types.h)  # needed for linux/filter.h on old systems
  424: 
  425: AC_CHECK_HEADER(linux/filter.h, DO_LPF=1, ,
  426: [
  427: #ifdef HAVE_LINUX_TYPES_H
  428: #include <linux/types.h>
  429: #endif
  430: ])
  431: if test -n "$DO_LPF"
  432: then
  433: 	AC_DEFINE([HAVE_LPF], [1], 
  434: 		  [Define to 1 to use the Linux Packet Filter interface code.])
  435: else
  436: 	AC_CHECK_HEADER(sys/dlpi.h, DO_DLPI=1)
  437: 	if test -n "$DO_DLPI"
  438: 	then
  439: 		AC_DEFINE([HAVE_DLPI], [1], 
  440: 			  [Define to 1 to use DLPI interface code.])
  441: 	else
  442: 		AC_CHECK_HEADER(net/bpf.h, DO_BPF=1)
  443: 		if test -n "$DO_BPF"
  444: 		then
  445: 			AC_DEFINE([HAVE_BPF], [1],
  446: 	  			  [Define to 1 to use the 
  447: 				   Berkeley Packet Filter interface code.])
  448: 		fi
  449: 	fi
  450: fi
  451: 
  452: # SIOCGLIFCONF uses some transport structures.  Trick is not all platforms
  453: # use the same structures.  We like to use 'struct lifconf' and 'struct
  454: # lifreq', but we'll use these other structures if they're present.  HPUX
  455: # does not define 'struct lifnum', but does use SIOCGLIFNUM - they use an
  456: # int value.
  457: #
  458: AC_MSG_CHECKING([for struct lifnum])
  459: AC_TRY_COMPILE(
  460: [ #include <sys/types.h>
  461:   #include <sys/socket.h>
  462:   #include <net/if.h>
  463: ],
  464: [ struct lifnum a;
  465: ],
  466: 	[AC_MSG_RESULT(yes)
  467: 	 AC_DEFINE([ISC_PLATFORM_HAVELIFNUM], [1],
  468: 		   [Define to 1 if the system has 'struct lifnum'.])],
  469: 	[AC_MSG_RESULT(no)])
  470: 
  471: AC_MSG_CHECKING([for struct if_laddrconf])
  472: AC_TRY_COMPILE(
  473: [ #include <sys/types.h>
  474:   #include <net/if6.h>
  475: ],
  476: [ struct if_laddrconf a;
  477: ],
  478: 	[AC_MSG_RESULT(yes)
  479: 	 AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1],
  480: 		   [Define to 1 if the system has 'struct if_laddrconf'.])],
  481: 	[AC_MSG_RESULT(no)])
  482: 
  483: AC_MSG_CHECKING([for struct if_laddrreq])
  484: AC_TRY_LINK(
  485: [#include <sys/types.h>
  486:  #include <net/if6.h>
  487: ],
  488: [ struct if_laddrreq a;
  489: ],
  490: 	[AC_MSG_RESULT(yes)
  491: 	 AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1],
  492: 		   [Define to 1 if the system has 'struct if_laddrreq'.])],
  493: 	[AC_MSG_RESULT(no)])
  494: 
  495: #
  496: # check for GCC noreturn attribute
  497: #
  498: AC_MSG_CHECKING(for GCC noreturn attribute)
  499: AC_TRY_COMPILE([],[void foo() __attribute__((noreturn));],
  500: 	[AC_MSG_RESULT(yes)
  501: 	 AC_DEFINE([ISC_DHCP_NORETURN], [__attribute__((noreturn))],
  502: 		   [Define to the string for a noreturn attribute.])],
  503: 	[AC_MSG_RESULT(no)
  504: 	 AC_DEFINE([ISC_DHCP_NORETURN], [],
  505: 		   [Define to the string for a noreturn attribute.])])
  506: 
  507: # Look for optional headers.
  508: AC_CHECK_HEADERS(sys/socket.h net/if_dl.h net/if6.h regex.h)
  509: 
  510: # Solaris needs some libraries for functions
  511: AC_SEARCH_LIBS(socket, [socket])
  512: AC_SEARCH_LIBS(inet_ntoa, [nsl])
  513: 
  514: AC_SEARCH_LIBS(inet_aton, [socket nsl], , 
  515: 	AC_DEFINE([NEED_INET_ATON], [1], 
  516: 		  [Define to 1 if the inet_aton() function is missing.]))
  517: 
  518: # Check for a standalone regex library.
  519: AC_SEARCH_LIBS(regcomp, [regex])
  520: 
  521: # For HP/UX we need -lipv6 for if_nametoindex, perhaps others.
  522: AC_SEARCH_LIBS(if_nametoindex, [ipv6])
  523: 
  524: # check for /dev/random (declares HAVE_DEV_RANDOM)
  525: AC_CHECK_FILE(/dev/random,
  526: 	AC_DEFINE([HAVE_DEV_RANDOM], [1], 
  527: 		  [Define to 1 if you have the /dev/random file.]))
  528: 
  529: # see if there is a "sa_len" field in our interface information structure
  530: AC_CHECK_MEMBER(struct sockaddr.sa_len,
  531: 	AC_DEFINE([HAVE_SA_LEN], [], 
  532: 		  [Define to 1 if the sockaddr structure has a length field.]),
  533: 	,
  534: 	[#include <sys/socket.h>])
  535: 
  536: # figure out pointer size
  537: AC_CHECK_SIZEOF(struct iaddr *, , [
  538: #include "includes/inet.h"
  539: #include <stdio.h>
  540: ])
  541: 
  542: # Solaris does not have the msg_control or msg_controlen members 
  543: # in the msghdr structure unless you define:
  544: #
  545: #   _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED, and __EXTENSIONS__
  546: # 
  547: # See the "standards" man page for details.
  548: # 
  549: # We check for the msg_control member, and if it is not found, we check
  550: # again with the appropriate defines added to the CFLAGS. (In order to
  551: # do this we have to remove the check from the cache, which is what the
  552: # "unset" is for.)
  553: AC_CHECK_MEMBER(struct msghdr.msg_control,,
  554: 	[CFLAGS="$CFLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
  555: 	 CFLAGS="$CFLAGS -D__EXTENSIONS__"
  556: 	 unset ac_cv_member_struct_msghdr_msg_control
  557: 	 AC_CHECK_MEMBER(struct msghdr.msg_control,,
  558: 	 	[AC_MSG_ERROR([Missing msg_control member in 
  559: 			       msg_control structure.])],
  560: 		[
  561: #include <sys/types.h>
  562: #include <sys/socket.h>
  563: 		])
  564: 	],
  565: 	[
  566: #include <sys/types.h>
  567: #include <sys/socket.h>
  568: 	])
  569: 
  570: # Append selected warning levels to CFLAGS before substitution (but after
  571: # AC_TRY_COMPILE & etc).
  572: CFLAGS="$CFLAGS $STD_CWARNINGS"
  573: 
  574: AC_C_FLEXIBLE_ARRAY_MEMBER
  575: 
  576: AC_OUTPUT([
  577:   Makefile
  578:   client/Makefile
  579:   common/Makefile
  580:   common/tests/Makefile
  581:   dhcpctl/Makefile
  582:   dst/Makefile
  583:   includes/Makefile
  584:   minires/Makefile
  585:   omapip/Makefile
  586:   relay/Makefile
  587:   server/Makefile
  588:   tests/Makefile
  589:   server/tests/Makefile
  590:   doc/devel/doxyfile
  591: ])
  592: 
  593: cat > config.report << END
  594: 
  595:      ISC DHCP source configure results:
  596:     -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  597: 
  598: Package:
  599:   Name:          $PACKAGE_NAME
  600:   Version:       $PACKAGE_VERSION
  601: 
  602: C Compiler:      $CC
  603: 
  604: Flags:
  605:   DEFS:          $DEFS
  606:   CFLAGS:        $CFLAGS
  607: 
  608: Features:
  609:   debug:         $enable_debug
  610:   failover:      $enable_failover
  611:   execute:       $enable_execute
  612: 
  613: Developer:
  614:   ATF unittests : $atf_path
  615: 
  616: END
  617: # TODO: Add Perl system tests
  618: 
  619: if test "$atf_path" != "no"
  620: then
  621: echo "ATF_CFLAGS  : $ATF_CFLAGS" >> config.report
  622: echo "ATF_LDFLAGS : $ATF_LDFLAGS" >> config.report
  623: echo
  624: fi
  625: 
  626: cat config.report
  627: 
  628: echo
  629: echo Now you can type "make" to build ISC DHCP
  630: echo

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>