Annotation of embedaddon/quagga/configure.ac, revision 1.1.1.3

1.1       misho       1: ##
                      2: ## Configure template file for Quagga.
                      3: ## autoconf will generate configure script.
                      4: ##
                      5: ##  Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
                      6: ##  Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st>
                      7: ##
                      8: AC_PREREQ(2.53)
                      9: 
1.1.1.3 ! misho      10: AC_INIT(Quagga, 0.99.21, [https://bugzilla.quagga.net])
1.1       misho      11: AC_CONFIG_SRCDIR(lib/zebra.h)
                     12: AC_CONFIG_MACRO_DIR([m4])
                     13: 
                     14: dnl -----------------------------------
                     15: dnl Get hostname and other information.
                     16: dnl -----------------------------------
                     17: AC_CANONICAL_BUILD()
                     18: AC_CANONICAL_HOST()
                     19: AC_CANONICAL_TARGET()
                     20: 
                     21: AM_INIT_AUTOMAKE(1.6)
                     22: AM_CONFIG_HEADER(config.h)
                     23: 
                     24: AC_CHECK_PROG([GAWK],[gawk],[gawk],[not-in-PATH])
                     25: if test "x$GAWK" = "xnot-in-PATH" ; then
                     26:        AC_MSG_ERROR([GNU awk is required for lib/memtype.h made by memtypes.awk.
                     27: BSD awk complains: awk: gensub doesn't support backreferences (subst "\1") ])
                     28: fi
                     29: AC_ARG_VAR([GAWK],[GNU AWK])
                     30: 
                     31: dnl default is to match previous behavior
                     32: exampledir=${sysconfdir}
                     33: AC_ARG_ENABLE([exampledir],
                     34:          AC_HELP_STRING([--enable-exampledir],
                     35:                         [specify alternate directory for examples]),
                     36:                         exampledir="$enableval",)
                     37: dnl XXX add --exampledir to autoconf standard directory list somehow
                     38: AC_SUBST(exampledir)
                     39: 
                     40: dnl default is to match previous behavior
                     41: pkgsrcrcdir=""
                     42: pkgsrcdir=""
                     43: AC_ARG_ENABLE([pkgsrcrcdir],
                     44:          AC_HELP_STRING([--enable-pkgsrcrcdir],
                     45:                         [specify directory for rc.d scripts]),
                     46:                         pkgsrcrcdir="$enableval"; pkgsrcdir="pkgsrc",)
                     47: dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
                     48: AC_SUBST(pkgsrcdir)
                     49: AC_SUBST(pkgsrcrcdir)
                     50: 
                     51: dnl ------------
                     52: dnl Check CFLAGS
                     53: dnl ------------
                     54: AC_ARG_WITH(cflags,
                     55: [  --with-cflags           Set CFLAGS for use in compilation.])
                     56: if test "x$with_cflags" != "x" ; then
                     57:   CFLAGS="$with_cflags" ; cflags_specified=yes ;
                     58: elif test -n "$CFLAGS" ; then
                     59:   cflags_specified=yes ;
                     60: fi
                     61: 
                     62: dnl --------------------
                     63: dnl Check CC and friends
                     64: dnl --------------------
                     65: AC_LANG([C])
                     66: AC_PROG_CC
                     67: AC_PROG_CPP
                     68: AM_PROG_CC_C_O
                     69: AC_PROG_EGREP
                     70: 
                     71: dnl autoconf 2.59 appears not to support AC_PROG_SED
                     72: dnl AC_PROG_SED
                     73: AC_CHECK_PROG([SED],[sed],[sed],[/bin/false])
                     74: 
1.1.1.3 ! misho      75: dnl pdflatex and latexmk are needed to build HACKING.pdf
        !            76: AC_CHECK_PROG([PDFLATEX],[pdflatex],[pdflatex],[/bin/false])
        !            77: AC_CHECK_PROG([LATEXMK],[latexmk],[latexmk],[/bin/false])
        !            78: if test "x$PDFLATEX" = "x/bin/false" -o "x$LATEXMK" = "x/bin/false"; then
        !            79:        AC_MSG_WARN([Will not be able to make PDF versions of TeX documents])
        !            80: else
        !            81:        HAVE_LATEX=true
        !            82: fi
        !            83: AM_CONDITIONAL([HAVE_LATEX], [test "x$HAVE_LATEX" = "xtrue"])
        !            84: 
1.1       misho      85: dnl ------------------------------------------------------------------
                     86: dnl Intel compiler check. Although Intel tries really hard to make icc
                     87: dnl look like gcc, there are some differences. It's very verbose with
                     88: dnl -Wall and it doesn't support the individual -W options.
                     89: dnl ------------------------------------------------------------------
                     90: if test "x${GCC}" = "xyes" ; then
                     91:   COMPILER="GCC"
                     92:   AC_MSG_CHECKING([whether we are using the Intel compiler])
                     93:   AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
                     94:       [AC_MSG_RESULT([no])],
                     95:       [COMPILER="ICC"
                     96:        AC_MSG_RESULT([yes])]
                     97:   )
                     98: else
                     99:   AC_MSG_CHECKING([whether we are using SunPro compiler])
                    100:   AC_EGREP_CPP([^__SUNPRO_C.*0x5(7|8|9)], ["__SUNPRO_C" __SUNPRO_C],
                    101:       [AC_MSG_RESULT([no])],
                    102:       [COMPILER="SUNPRO"
                    103:        AC_MSG_RESULT([yes])]
                    104:   )
                    105: fi
                    106: 
                    107: dnl ---------------------------------------------
                    108: dnl If CLFAGS doesn\'t exist set default value
                    109: dnl AC_PROG_CC will have set minimal default
                    110: dnl already, eg "-O2 -g" for gcc, "-g" for others
                    111: dnl (Wall is gcc specific... have to make sure
                    112: dnl  gcc is being used before setting it)
                    113: dnl
                    114: dnl Intel icc 8.0 also sets __GNUC__, 
                    115: dnl but doesn't support all these fancy -W options.
                    116: dnl Intel compiler warnings we ignore:
                    117: dnl 279: controlling expression is constant.
                    118: dnl 869: parameter "xxx" was never referenced - to avoid massive warnings
                    119: dnl      about "self", "vty", "argc" and "argv" never referenced in DEFUN
                    120: dnl      macro.
                    121: dnl 981: operands are evaluated in unspecified order.
                    122: dnl
                    123: dnl Sun Studio 10 / SunPro 5.7 is also supported,
                    124: dnl so lets set some sane CFLAGS for it.
                    125: dnl ---------------------------------------------
                    126: 
                    127: AC_MSG_CHECKING([whether to set a default CFLAGS])
                    128: if test "x${cflags_specified}" = "x" ; then
                    129:   case ${COMPILER} in
                    130:     "ICC")
                    131:         CFLAGS="-Os -g -Wall -wd 279,869,981"
                    132:         AC_MSG_RESULT([Intel default])
                    133:         ;;
                    134:     "GCC")
                    135:        CFLAGS="-Os -fno-omit-frame-pointer -g -std=gnu99 -Wall"
                    136:        CFLAGS="${CFLAGS} -Wsign-compare -Wpointer-arith"
                    137:        CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
                    138:        CFLAGS="${CFLAGS} -Wmissing-prototypes -Wmissing-declarations"
                    139:        CFLAGS="${CFLAGS} -Wchar-subscripts -Wcast-qual"
                    140:        # TODO: conditionally addd -Wpacked if handled
                    141:        AC_MSG_RESULT([gcc default])
                    142:        ;;
                    143:     "SUNPRO")
                    144:        CFLAGS="-xO4 -v -g -xspace -xcode=pic32 -xstrconst -xc99"
                    145:        AC_MSG_RESULT([SunPro default])
                    146:        ;;
                    147:     *)
                    148:         AC_MSG_RESULT([unknown compiler])
                    149:         ;;
                    150:   esac
                    151: else
                    152:   AC_MSG_RESULT([CFLAGS supplied by user])
                    153: fi
                    154: 
                    155: dnl --------------
                    156: dnl Check programs
                    157: dnl --------------
                    158: AC_PROG_INSTALL
                    159: AC_PROG_LN_S
                    160: AC_PROG_MAKE_SET
                    161: AC_CHECK_TOOL(AR, ar)
                    162: 
                    163: dnl ---------------------------
                    164: dnl We, perhaps unfortunately,
                    165: dnl depend on GNU Make specific
                    166: dnl constructs.
                    167: dnl Give the user a warning if
                    168: dnl not GNU Make.
                    169: dnl ---------------------------
                    170: AC_CACHE_CHECK([if ${MAKE-make} is GNU make], [quagga_cv_gnu_make],
                    171:        [quagga_cv_gnu_make=no
                    172:         if ${MAKE-make} --version 2>/dev/null | \
                    173:                grep '^GNU Make ' >/dev/null ; then
                    174:                quagga_cv_gnu_make=yes;
                    175:         fi
                    176:        ]
                    177: )
                    178: 
                    179: dnl -----------------
                    180: dnl System extensions
                    181: dnl -----------------
                    182: AC_GNU_SOURCE
                    183: 
                    184: dnl -------
                    185: dnl libtool
                    186: dnl -------
                    187: AC_PROG_LIBTOOL
                    188: 
                    189: dnl ----------------------
                    190: dnl Packages configuration
                    191: dnl ----------------------
                    192: AC_ARG_ENABLE(vtysh,
                    193: [  --enable-vtysh          include integrated vty shell for Quagga])
                    194: AC_ARG_ENABLE(ipv6,
                    195: [  --disable-ipv6          turn off IPv6 related features and daemons])
                    196: AC_ARG_ENABLE(doc,
                    197: [  --disable-doc           do not build docs])
                    198: AC_ARG_ENABLE(zebra,
                    199: [  --disable-zebra         do not build zebra daemon])
                    200: AC_ARG_ENABLE(bgpd,
                    201: [  --disable-bgpd          do not build bgpd])
                    202: AC_ARG_ENABLE(ripd,
                    203: [  --disable-ripd          do not build ripd])
                    204: AC_ARG_ENABLE(ripngd,
                    205: [  --disable-ripngd        do not build ripngd])
                    206: AC_ARG_ENABLE(ospfd,
                    207: [  --disable-ospfd         do not build ospfd])
                    208: AC_ARG_ENABLE(ospf6d,
                    209: [  --disable-ospf6d        do not build ospf6d])
1.1.1.3 ! misho     210: AC_ARG_ENABLE(babeld,
        !           211: [  --disable-babeld        do not build babeld])
1.1       misho     212: AC_ARG_ENABLE(watchquagga,
                    213: [  --disable-watchquagga   do not build watchquagga])
                    214: AC_ARG_ENABLE(isisd,
                    215: [  --enable-isisd          build isisd])
                    216: AC_ARG_ENABLE(solaris,
                    217: [  --enable-solaris          build solaris])
                    218: AC_ARG_ENABLE(bgp-announce,
                    219: [  --disable-bgp-announce, turn off BGP route announcement])
                    220: AC_ARG_ENABLE(netlink,
                    221: [  --enable-netlink        force to use Linux netlink interface])
                    222: AC_ARG_ENABLE(broken-aliases,
                    223: [  --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
                    224: AC_ARG_WITH(crypto,
                    225: [  --without-crypto        do not use libcrypto in SNMP])
                    226: AC_ARG_ENABLE(snmp,
                    227: [  --enable-snmp           enable SNMP support])
                    228: AC_ARG_WITH(libpam,
                    229: [  --with-libpam           use libpam for PAM support in vtysh])
                    230: AC_ARG_ENABLE(tcp-zebra,
                    231: [  --enable-tcp-zebra      enable TCP/IP socket connection between zebra and protocol daemon])
                    232: AC_ARG_ENABLE(opaque-lsa,
                    233:   AC_HELP_STRING([--disable-opaque-lsa],[do not build OSPF Opaque-LSA with OSPFAPI support (RFC2370)]))
                    234: AC_ARG_ENABLE(ospfapi,
                    235: [  --disable-ospfapi       do not build OSPFAPI to access the OSPF LSA Database])
                    236: AC_ARG_ENABLE(ospfclient,
                    237: [  --disable-ospfclient    do not build OSPFAPI client for OSPFAPI, 
                    238:                           (this is the default if --disable-ospfapi is set)])
                    239: AC_ARG_ENABLE(ospf-te,
                    240:   AC_HELP_STRING([--disable-ospf-te],[disable Traffic Engineering Extension to OSPF]))
                    241: AC_ARG_ENABLE(multipath,
                    242: [  --enable-multipath=ARG  enable multipath function, ARG must be digit])
                    243: AC_ARG_ENABLE(user,
                    244:   AC_HELP_STRING([--enable-user=user], [user to run Quagga suite as (default quagga)]))
                    245: AC_ARG_ENABLE(group,
                    246:   AC_HELP_STRING([--enable-group=group], [group to run Quagga suite as (default quagga)]))
                    247: AC_ARG_ENABLE(vty_group,
                    248: [  --enable-vty-group=ARG  set vty sockets to have specified group as owner])
                    249: AC_ARG_ENABLE(configfile_mask,
                    250: [  --enable-configfile-mask=ARG  set mask for config files])
                    251: AC_ARG_ENABLE(logfile_mask,
                    252: [  --enable-logfile-mask=ARG     set mask for log files])
                    253: 
                    254: AC_ARG_ENABLE(rtadv,
                    255: [  --disable-rtadv               disable IPV6 router advertisement feature])
                    256: AC_ARG_ENABLE(irdp,
                    257: [  --enable-irdp                 enable IRDP server support in zebra])
                    258: AC_ARG_ENABLE(isis_topology,
                    259: [  --enable-isis-topology        enable IS-IS topology generator])
                    260: AC_ARG_ENABLE(capabilities,
                    261: [  --disable-capabilities        disable using POSIX capabilities])
                    262: AC_ARG_ENABLE(gcc_ultra_verbose,
                    263: [  --enable-gcc-ultra-verbose    enable ultra verbose GCC warnings])
                    264: AC_ARG_ENABLE(linux24_tcp_md5,
                    265: [  --enable-linux24-tcp-md5  enable support for old, Linux-2.4 RFC2385 patch])
                    266: AC_ARG_ENABLE(gcc-rdynamic,
                    267: [  --enable-gcc-rdynamic   enable gcc linking with -rdynamic for better backtraces])
                    268: AC_ARG_ENABLE(time-check,
                    269: [  --disable-time-check          disable slow thread warning messages])
                    270: AC_ARG_ENABLE(pcreposix,
                    271: [  --enable-pcreposix          enable using PCRE Posix libs for regex functions])
                    272: 
                    273: if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
                    274:   CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
                    275:   CFLAGS="${CFLAGS} -Wmissing-declarations -Wmissing-noreturn"
                    276:   CFLAGS="${CFLAGS} -Wmissing-format-attribute -Wunreachable-code"
                    277:   CFLAGS="${CFLAGS} -Wpacked -Wpadded"
                    278: fi
                    279: 
                    280: if test x"${enable_gcc_rdynamic}" = x"yes" ; then
                    281:   LDFLAGS="${LDFLAGS} -rdynamic"
                    282: fi
                    283: 
                    284: if test x"${enable_time_check}" != x"no" ; then
                    285:   if test x"${enable_time_check}" = x"yes" -o x"${enable_time_check}" = x ; then
                    286:     AC_DEFINE(CONSUMED_TIME_CHECK,5000000,Consumed Time Check)
                    287:   else
                    288:     AC_DEFINE_UNQUOTED(CONSUMED_TIME_CHECK,$enable_time_check,Consumed Time Check)
                    289:   fi
                    290: fi
                    291: 
                    292: if test "${enable_broken_aliases}" = "yes"; then
                    293:   if test "${enable_netlink}" = "yes"
                    294:   then
                    295:     AC_MSG_FAILURE([Sorry you can not use netlink with broken aliases])
                    296:   fi
                    297:   AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
                    298:   enable_netlink=no
                    299: fi
                    300: 
                    301: if test "${enable_tcp_zebra}" = "yes"; then
                    302:   AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
                    303: fi
                    304: 
                    305: if test "${enable_opaque_lsa}" != "no"; then
                    306:   AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
                    307: fi
                    308: 
                    309: if test "${enable_ospf_te}" != "no"; then
                    310:   AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
                    311:   AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
                    312: fi
                    313: 
                    314: if test "${enable_linux24_tcp_md5}" = "yes"; then
                    315:   AC_DEFINE(HAVE_TCP_MD5_LINUX24,,Old Linux 2.4 TCP MD5 Signature Patch)
                    316: fi
                    317: 
                    318: AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
                    319: if test "${enable_rtadv}" != "no"; then
                    320:   AC_MSG_RESULT(yes)
                    321:   AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
                    322: else
                    323:   AC_MSG_RESULT(no)
                    324: fi
                    325: 
                    326: if test "${enable_irdp}" = "yes"; then
                    327:   AC_DEFINE(HAVE_IRDP,, IRDP )
                    328: fi
                    329: 
                    330: if test "${enable_isisd}" = "yes" && test "${enable_isis_topology}" = yes; then
                    331:   AC_DEFINE(TOPOLOGY_GENERATE,,Enable IS-IS topology generator code)
                    332:   ISIS_TOPOLOGY_INCLUDES="-I./topology"
                    333:   ISIS_TOPOLOGY_DIR="topology"
                    334:   ISIS_TOPOLOGY_LIB="./topology/libtopology.a"
                    335: fi
                    336: 
                    337: AC_SUBST(ISIS_TOPOLOGY_INCLUDES)
                    338: AC_SUBST(ISIS_TOPOLOGY_DIR)
                    339: AC_SUBST(ISIS_TOPOLOGY_LIB)
                    340: 
                    341: if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
                    342:   enable_user="quagga"
                    343: elif test "${enable_user}" = "no"; then
                    344:   enable_user="root"
                    345: fi
                    346: 
                    347: if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
                    348:   enable_group="quagga"
                    349: elif test "${enable_group}" = "no"; then
                    350:   enable_group="root"
                    351: fi
                    352: 
                    353: if test x"${enable_vty_group}" = x"yes" ; then
                    354:   AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
                    355: elif test x"${enable_vty_group}" != x""; then
                    356:   if test x"${enable_vty_group}" != x"no"; then
                    357:     AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
                    358:   fi
                    359: fi
                    360: AC_SUBST([enable_user])
                    361: AC_SUBST([enable_group])
                    362: AC_SUBST([enable_vty_group])
                    363: AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
                    364: AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
                    365: 
                    366: enable_configfile_mask=${enable_configfile_mask:-0600}
                    367: AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
                    368: 
                    369: enable_logfile_mask=${enable_logfile_mask:-0600}
                    370: AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
                    371: 
                    372: MULTIPATH_NUM=1
                    373: 
                    374: case "${enable_multipath}" in
                    375:   [[0-9]|[1-9][0-9]])
                    376:     MULTIPATH_NUM="${enable_multipath}"
                    377:     ;;
                    378:   "")
                    379:     ;;
                    380:   *)           
                    381:     AC_MSG_FAILURE([Please specify digit to enable multipath ARG])
                    382:     ;;
                    383: esac
                    384: 
                    385: AC_SUBST(MULTIPATH_NUM)
                    386: 
                    387: dnl ------------------------------------
                    388: dnl Check C keywords and standard  types
                    389: dnl ------------------------------------
                    390: AC_C_CONST
                    391: AC_C_INLINE
                    392: AC_C_RESTRICT
                    393: AC_C_VOLATILE
                    394: AC_HEADER_STDC
                    395: AC_HEADER_TIME
                    396: AC_HEADER_SYS_WAIT
                    397: dnl AC_TYPE_PID_T
                    398: AC_TYPE_UID_T
                    399: AC_TYPE_MODE_T
                    400: AC_TYPE_SIZE_T
                    401: AC_TYPE_SIGNAL
                    402: AC_STRUCT_TM
                    403: 
                    404: dnl -------------------------
                    405: dnl Check other header files.
                    406: dnl -------------------------
                    407: AC_CHECK_HEADERS([stropts.h sys/ksym.h sys/times.h sys/select.h \
                    408:        sys/types.h linux/version.h netdb.h asm/types.h \
                    409:        sys/param.h limits.h signal.h \
                    410:        sys/socket.h netinet/in.h time.h sys/time.h])
                    411: 
                    412: dnl Utility macro to avoid retyping includes all the time
                    413: m4_define([QUAGGA_INCLUDES],
                    414: [#ifdef SUNOS_5
                    415: #define _XPG4_2
                    416: #define __EXTENSIONS__
                    417: #endif
                    418: #include <stdio.h>
                    419: #if STDC_HEADERS
                    420: # include <stdlib.h>
                    421: # include <stddef.h>
                    422: #else
                    423: # if HAVE_STDLIB_H
                    424: #  include <stdlib.h>
                    425: # endif
                    426: #endif
                    427: #if HAVE_SYS_TYPES_H
                    428: # include <sys/types.h>
                    429: #endif
                    430: /* sys/conf.h depends on param.h on FBSD at least */
                    431: #if HAVE_SYS_PARAM_H
                    432: # include <sys/param.h>
                    433: #endif
                    434: /* Required for MAXSIG */
                    435: #if HAVE_SIGNAL_H
                    436: # include <signal.h>
                    437: #endif
                    438: #if HAVE_SYS_SOCKET_H
                    439: # include <sys/socket.h>
                    440: #endif
                    441: #if HAVE_NETINET_IN_H
                    442: # include <netinet/in.h>
                    443: #endif
                    444: #ifdef TIME_WITH_SYS_TIME
                    445: # include <sys/time.h>
                    446: # include <time.h>
                    447: #else
                    448: # ifdef HAVE_SYS_TIME_H
                    449: #  include <sys/time.h>
                    450: # else
                    451: #  include <time.h>
                    452: # endif
                    453: #endif /* TIME_WITH_SYS_TIME */
                    454: ])dnl
                    455: 
                    456: dnl HAVE_NET_IF_H must be discovered by the time the longer AC_CHECK_HEADERS
                    457: dnl round below execution begins, otherwise it doesn't properly detect
                    458: dnl HAVE_NETINET6_IN6_VAR_H, HAVE_NET_IF_VAR_H and HAVE_STRUCT_IN6_ALIASREQ
                    459: dnl on FreeBSD (BZ#408).
                    460: 
                    461: AC_CHECK_HEADERS([net/if.h], [], [], QUAGGA_INCLUDES)
                    462: 
                    463: m4_define([QUAGGA_INCLUDES],
                    464: QUAGGA_INCLUDES
                    465: [#if HAVE_NET_IF_H
                    466: # include <net/if.h>
                    467: #endif
                    468: ])dnl
                    469: 
                    470: dnl Same applies for HAVE_NET_IF_VAR_H, which HAVE_NETINET6_ND6_H and
                    471: dnl HAVE_NETINET_IN_VAR_H depend upon. But if_var.h depends on if.h, hence
                    472: dnl an additional round for it.
                    473: 
                    474: AC_CHECK_HEADERS([net/if_var.h], [], [], QUAGGA_INCLUDES)
                    475: 
                    476: m4_define([QUAGGA_INCLUDES],
                    477: QUAGGA_INCLUDES
                    478: [#if HAVE_NET_IF_VAR_H
                    479: # include <net/if_var.h>
                    480: #endif
                    481: ])dnl
                    482: 
                    483: AC_CHECK_HEADERS([sys/un.h netinet/in_systm.h netinet/in_var.h \
                    484:        net/if_dl.h net/netopt.h net/route.h \
                    485:        inet/nd.h arpa/inet.h netinet/ip_icmp.h \
                    486:        fcntl.h stddef.h sys/ioctl.h syslog.h wchar.h wctype.h \
                    487:        sys/sysctl.h sys/sockio.h kvm.h sys/conf.h],
                    488:        [], [], QUAGGA_INCLUDES)
                    489: 
                    490: AC_CHECK_HEADERS([ucontext.h], [], [],
                    491: [#ifndef __USE_GNU
                    492: #define __USE_GNU
                    493: #endif /* __USE_GNU */
                    494: QUAGGA_INCLUDES
                    495: ])
                    496: 
                    497: m4_define([QUAGGA_INCLUDES],
                    498: QUAGGA_INCLUDES
                    499: [#if HAVE_SYS_UN_H
                    500: # include <sys/un.h>
                    501: #endif
                    502: #if HAVE_NETINET_IN_SYSTM_H
                    503: # include <netinet/in_systm.h>
                    504: #endif
                    505: #if HAVE_NETINET_IN_VAR_H
                    506: # include <netinet/in_var.h>
                    507: #endif
                    508: #if HAVE_NET_IF_DL_H
                    509: # include <net/if_dl.h>
                    510: #endif
                    511: #if HAVE_NET_NETOPT_H
                    512: # include <net/netopt.h>
                    513: #endif
                    514: #if HAVE_NET_ROUTE_H
                    515: # include <net/route.h>
                    516: #endif
                    517: #if HAVE_INET_ND_H
                    518: # include <inet/nd.h>
                    519: #endif
                    520: #if HAVE_ARPA_INET_H
                    521: # include <arpa/inet.h>
                    522: #endif
                    523: /* Required for IDRP */
                    524: #if HAVE_NETINET_IP_ICMP_H
                    525: # include <netinet/ip_icmp.h>
                    526: #endif
                    527: ])dnl
                    528: 
                    529: dnl V6 headers are checked below, after we check for v6
                    530: 
                    531: dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
                    532: case "$host" in
                    533:   [*-sunos5.[6-7]*] | [*-solaris2.[6-7]*])
                    534:       opsys=sol2-6
                    535:       AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.7)
                    536:       AC_DEFINE(SUNOS_5, 1, SunOS 5)
                    537:       AC_CHECK_LIB(xnet, main)
                    538:       CURSES=-lcurses
                    539:   ;;
                    540:   [*-sunos5.[8-9]] \
                    541:   | [*-sunos5.1[0-9]] \
                    542:   | [*-sunos5.1[0-9].[0-9]] \
                    543:   | [*-solaris2.[8-9]] \
                    544:   | [*-solaris2.1[0-9]] \
                    545:   | [*-solaris2.1[0-9].[0-9]])
                    546:       opsys=sol8
                    547:       AC_DEFINE(SUNOS_59, 1, [SunOS 5.8 up])
                    548:       AC_DEFINE(SUNOS_5, 1, [SunOS 5])
                    549:       AC_CHECK_LIB(socket, main)
                    550:       AC_CHECK_LIB(nsl, main)
                    551:       AC_CHECK_LIB(umem, main)
                    552:       AC_CHECK_FUNCS([printstack],
                    553:        [AC_DEFINE([HAVE_PRINTSTACK],1,[Solaris printstack])
                    554:         AC_DEFINE([HAVE_STACK_TRACE],1,[Stack symbols decode functionality])
                    555:        ])
                    556:       CURSES=-lcurses
                    557:   ;;
                    558:   *-sunos5* | *-solaris2*)
                    559:       AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
                    560:       AC_CHECK_LIB(socket, main)
                    561:       AC_CHECK_LIB(nsl, main)
                    562:       CURSES=-lcurses
                    563:   ;;
                    564:   *-linux*)
                    565:       opsys=gnu-linux
                    566:       AC_DEFINE(GNU_LINUX,,GNU Linux)
                    567:   ;;
                    568:   *-nec-sysv4*)
                    569:       AC_CHECK_LIB(nsl, gethostbyname)
                    570:       AC_CHECK_LIB(socket, socket)
                    571:   ;;
                    572:   *-openbsd*)
                    573:       opsys=openbsd
                    574:       AC_DEFINE(OPEN_BSD,,OpenBSD)
                    575:   ;;
                    576:   *-bsdi*)
                    577:       opsys=bsdi
                    578:       OTHER_METHOD="mtu_kvm.o"
                    579:       AC_CHECK_LIB(kvm, main)
                    580:   ;;
                    581:   *-irix6.5)
                    582:       opsys=irix
                    583:       AC_DEFINE(IRIX_65,,IRIX 6.5)
                    584:   ;;
                    585: esac
                    586: 
                    587: AC_SYS_LARGEFILE
                    588: 
                    589: dnl ---------------------
                    590: dnl Integrated VTY option
                    591: dnl ---------------------
                    592: case "${enable_vtysh}" in
                    593:   "yes") VTYSH="vtysh";
                    594:          AC_DEFINE(VTYSH,,VTY shell)
                    595:         AC_PATH_PROG(PERL, perl)
                    596: dnl     Vtysh uses libreadline, which looks for termcap functions at
                    597: dnl     configure time.  We follow readlines search order.
                    598: dnl     The required procedures are in libtermcap on NetBSD, in
                    599: dnl     [TODO] on Linux, and in [TODO] on Solaris.
                    600:         AC_CHECK_LIB(termcap, tputs, LIBREADLINE="$LIBREADLINE -ltermcap",
                    601:           [AC_CHECK_LIB(tinfo, tputs, LIBREADLINE="$LIBREADLINE -ltinfo",
                    602:             [AC_CHECK_LIB(curses, tputs, LIBREADLINE="$LIBREADLINE -lcurses",
                    603:               [AC_CHECK_LIB(ncurses, tputs, 
                    604:                             LIBREADLINE="$LIBREADLINE -lncurses")]
                    605:              )]
                    606:            )]
                    607:          )
                    608:          AC_CHECK_LIB(readline, main, LIBREADLINE="$LIBREADLINE -lreadline",,
                    609:                       "$LIBREADLINE")
                    610:          if test $ac_cv_lib_readline_main = no; then
                    611:            AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
                    612:          fi
                    613:         AC_CHECK_HEADER(readline/history.h)
                    614:         if test $ac_cv_header_readline_history_h = no;then
                    615:            AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
                    616:         fi
                    617:         AC_CHECK_LIB(readline, rl_completion_matches, 
                    618:                      LIBREADLINE="$LIBREADLINE",, "$LIBREADLINE")
                    619:          if test $ac_cv_lib_readline_rl_completion_matches = no; then
                    620:            AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
                    621:         fi
                    622:         ;;
                    623:   "no" ) VTYSH="";;
                    624:   *    ) ;;
                    625: esac
                    626: AC_SUBST(LIBREADLINE)
1.1.1.3 ! misho     627: AM_CONDITIONAL(VTYSH, test "x$VTYSH" = "xvtysh")
1.1       misho     628: 
                    629: dnl ----------
                    630: dnl PAM module
                    631: dnl
                    632: dnl Quagga detects the PAM library it is built against by checking for a
                    633: dnl functional pam_misc.h (Linux-PAM) or openpam.h (OpenPAM) header. pam_misc.h
                    634: dnl is known to #include pam_appl.h, the standard header of a PAM library, and
                    635: dnl openpam.h doesn't do that, although depends on the header too. Hence a
                    636: dnl little assistance to AC_CHECK_HEADER is necessary for the proper detection
                    637: dnl of OpenPAM.
                    638: dnl ----------
                    639: if test "$with_libpam" = "yes"; then
                    640:   AC_CHECK_HEADER([security/pam_misc.h],
                    641:     [AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
                    642:      AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
                    643:      pam_conv_func="misc_conv"
                    644:     ],
                    645:     [], QUAGGA_INCLUDES)
                    646:   AC_CHECK_HEADER([security/openpam.h],
                    647:     [AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
                    648:      AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
                    649:      pam_conv_func="openpam_ttyconv"
                    650:     ],
                    651:     [], QUAGGA_INCLUDES[#include <security/pam_appl.h>])
                    652:   if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
                    653:     AC_MSG_WARN([*** pam support will not be built ***])
                    654:     with_libpam="no"
                    655:   fi
                    656: fi
                    657: 
                    658: if test "$with_libpam" = "yes"; then
                    659: dnl took this test from proftpds configure.in and suited to our needs
                    660: dnl -------------------------------------------------------------------------
                    661: dnl
                    662: dnl This next check looks funky due to a linker problem with some versions
                    663: dnl of the PAM library.  Prior to 0.72 release, the Linux PAM shared library
                    664: dnl omitted requiring libdl linking information. PAM-0.72 or better ships
                    665: dnl with RedHat 6.2 and Debian 2.2 or better.
                    666: AC_CHECK_LIB(pam, pam_start,
                    667:   [AC_CHECK_LIB(pam, $pam_conv_func,
                    668:     [AC_DEFINE(USE_PAM,,Use PAM for authentication)
                    669:      LIBPAM="-lpam"],
                    670:     [AC_DEFINE(USE_PAM,,Use PAM for authentication)
                    671:      LIBPAM="-lpam -lpam_misc"]
                    672:     )
                    673:   ],
                    674: 
                    675:   [AC_CHECK_LIB(pam, pam_end,
                    676:     [AC_CHECK_LIB(pam, $pam_conv_func,
                    677:       [AC_DEFINE(USE_PAM,,Use PAM for authentication)
                    678:        LIBPAM="-lpam -ldl"],
                    679:       [AC_DEFINE(USE_PAM,,Use PAM for authentication)
                    680:        LIBPAM="-lpam -ldl -lpam_misc"]
                    681:      )
                    682:   ],AC_MSG_WARN([*** pam support will not be built ***]),
                    683:   [-ldl])
                    684:   ]
                    685: )
                    686: fi
                    687: AC_SUBST(LIBPAM)
                    688: 
                    689: dnl -------------------------------
                    690: dnl Endian-ness check
                    691: dnl -------------------------------
                    692: AC_WORDS_BIGENDIAN
                    693: 
                    694: dnl -------------------------------
                    695: dnl check the size in byte of the C
                    696: dnl -------------------------------
                    697: dnl AC_CHECK_SIZEOF(char)
                    698: dnl AC_CHECK_SIZEOF(int)
                    699: dnl AC_CHECK_SIZEOF(short)
                    700: dnl AC_CHECK_SIZEOF(long)
                    701: 
                    702: dnl ----------------------------
                    703: dnl check existance of functions
                    704: dnl ----------------------------
                    705: AC_FUNC_CHOWN
                    706: AC_FUNC_FNMATCH
                    707: AC_FUNC_FORK
                    708: AC_FUNC_MEMCMP
                    709: AC_FUNC_MKTIME
                    710: AC_FUNC_STRFTIME
                    711: AC_FUNC_STAT
                    712: AC_FUNC_SELECT_ARGTYPES
                    713: AC_FUNC_STRFTIME
                    714: dnl Avoid AC_FUNC_STRNLEN because it pulls in AC_SYSTEM_EXTENSIONS which
                    715: dnl can lead to strange side effects.  So we just check for strnlen
                    716: dnl directly, see below.
                    717: dnl AC_FUNC_STRNLENdnl
                    718: AC_FUNC_VPRINTF
                    719: 
                    720: dnl -------------------------------
                    721: dnl bgpd needs pow() and hence libm
                    722: dnl -------------------------------
                    723: TMPLIBS="$LIBS"
                    724: AC_CHECK_HEADER([math.h],
                    725:   [AC_CHECK_LIB([m], [pow],
                    726:     [LIBM="-lm"
                    727:      LIBS="$LIBS $LIBM"
                    728:      AC_DEFINE(HAVE_LIBM,, Have libm)
                    729:      AC_CHECK_FUNCS(pow,[],[LIBM=""])
                    730:     ])
                    731: ])
                    732: if test x"$LIBM" = x ; then
                    733:   AC_MSG_WARN([Unable to find working pow function - bgpd may not link])
                    734: fi
                    735: LIBS="$TMPLIBS"
                    736: AC_SUBST(LIBM)
                    737: 
                    738: dnl ---------------
                    739: dnl other functions
                    740: dnl ---------------
                    741: AC_CHECK_FUNCS([dup2 ftruncate getcwd gethostbyname getpagesize gettimeofday \
                    742:        inet_ntoa inet_aton strnlen \
                    743:        memchr memmove memset select socket \
                    744:        strcasecmp strchr strcspn strdup strerror \
                    745:        strncasecmp strndup strrchr strspn strstr \
                    746:        strtol strtoul strlcat strlcpy \
                    747:        daemon snprintf vsnprintf \
                    748:        if_nametoindex if_indextoname getifaddrs \
                    749:        uname fcntl])
                    750: 
                    751: AC_CHECK_FUNCS(setproctitle, ,
                    752:   [AC_CHECK_LIB(util, setproctitle, 
                    753:      [LIBS="$LIBS -lutil"
                    754:       AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
                    755:      ]
                    756:    )
                    757:   ]
                    758: )
                    759: 
                    760: dnl ------------------------------------
                    761: dnl Determine routing get and set method
                    762: dnl ------------------------------------
                    763: AC_MSG_CHECKING(zebra between kernel interface method)
                    764: if test x"$opsys" = x"gnu-linux"; then
                    765:   if test "${enable_netlink}" = "yes";then
                    766:     AC_MSG_RESULT(netlink)
                    767:     RT_METHOD=rt_netlink.o
                    768:     AC_DEFINE(HAVE_NETLINK,,netlink)
                    769:     netlink=yes
                    770:   elif test "${enable_netlink}" = "no"; then
                    771:     AC_MSG_RESULT(ioctl)
                    772:     RT_METHOD=rt_ioctl.o
                    773:     netlink=no
                    774:   else
                    775:     AC_MSG_RESULT(netlink)
                    776:     RT_METHOD=rt_netlink.o
                    777:     AC_DEFINE(HAVE_NETLINK,,netlink)
                    778:     netlink=yes
                    779:   fi
                    780: elif test x"$opsys" = x"sol2-6";then
                    781:   AC_MSG_RESULT(Route socket)
                    782:   KERNEL_METHOD="kernel_socket.o"
                    783:   RT_METHOD="rt_socket.o"
                    784: elif test x"$opsys" = x"sol8";then
                    785:   AC_MSG_RESULT(Route socket)
                    786:   KERNEL_METHOD="kernel_socket.o"
                    787:   RT_METHOD="rt_socket.o"
                    788: elif test "$opsys" = "irix" ; then
                    789:   AC_MSG_RESULT(Route socket)
                    790:   KERNEL_METHOD="kernel_socket.o"
                    791:   RT_METHOD="rt_socket.o"
                    792: else
                    793:   AC_TRY_RUN([#include <errno.h>
                    794: #include <sys/types.h>
                    795: #include <sys/socket.h>
                    796: 
                    797: main ()
                    798: {
                    799:   int ac_sock;
                    800: 
                    801:   ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
                    802:   if (ac_sock < 0 && errno == EINVAL)
                    803:     exit (1);
                    804:   exit (0);
                    805: }],
                    806:   [KERNEL_METHOD=kernel_socket.o
                    807:    RT_METHOD=rt_socket.o
                    808:    AC_MSG_RESULT(socket)],
                    809:   [RT_METHOD=rt_ioctl.o
                    810:    AC_MSG_RESULT(ioctl)],
                    811:   [KERNEL_METHOD=kernel_socket.o
                    812:    RT_METHOD=rt_socket.o
                    813:    AC_MSG_RESULT(socket)])
                    814: fi
                    815: AC_SUBST(RT_METHOD)
                    816: AC_SUBST(KERNEL_METHOD)
                    817: AC_SUBST(OTHER_METHOD)
                    818: 
                    819: dnl --------------------------
                    820: dnl Determine IS-IS I/O method
                    821: dnl --------------------------
                    822: AC_DEFINE(ISIS_METHOD_PFPACKET,        1, [ constant value for isis method pfpacket ])
                    823: AC_DEFINE(ISIS_METHOD_DLPI,    2, [ constant value for isis method dlpi ])
                    824: AC_DEFINE(ISIS_METHOD_BPF,     3, [ constant value for isis method bpf ])
                    825: AC_CHECK_HEADER(net/bpf.h)
                    826: AC_CHECK_HEADER(sys/dlpi.h)
                    827: AC_MSG_CHECKING(zebra IS-IS I/O method)
                    828: if test x"$opsys" = x"gnu-linux"; then
                    829:   AC_MSG_RESULT(pfpacket)
                    830:   ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET"
                    831: elif test x"$opsys" = x"sol2-6" -o x"$opsys" = x"sol8"; then
                    832:   AC_MSG_RESULT(DLPI)
                    833:   ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
                    834: else
                    835:   if test $ac_cv_header_net_bpf_h = no; then
                    836:     if test $ac_cv_header_sys_dlpi_h = no; then
                    837:       AC_MSG_RESULT(none)
                    838:       AC_MSG_WARN([*** IS-IS support will not be built ***])
                    839:       ISISD=""
                    840:     else
                    841:       AC_MSG_RESULT(DLPI)
                    842:     fi
                    843:     ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
                    844:   else
                    845:     AC_MSG_RESULT(BPF)
                    846:     ISIS_METHOD_MACRO="ISIS_METHOD_BPF"
                    847:   fi
                    848: fi
                    849: AC_DEFINE_UNQUOTED(ISIS_METHOD, $ISIS_METHOD_MACRO, [ selected method for isis, == one of the constants ])
                    850: 
                    851: dnl ------------------------------------
                    852: dnl check for broken CMSG_FIRSTHDR macro
                    853: dnl ------------------------------------
                    854: AC_MSG_CHECKING(for broken CMSG_FIRSTHDR)
                    855: AC_RUN_IFELSE([AC_LANG_SOURCE([[
                    856: #ifdef SUNOS_5
                    857: #define _XPG4_2
                    858: #define __EXTENSIONS__
                    859: #endif
                    860: #ifdef HAVE_STDLIB_H
                    861: # include <stdlib.h>
                    862: #endif
                    863: #ifdef HAVE_SYS_TYPES_H
                    864: #include <sys/types.h>
                    865: #endif
                    866: #ifdef HAVE_SYS_SOCKET_H
                    867: #include <sys/socket.h>
                    868: #endif
                    869: 
                    870: main()
                    871: {
                    872:   struct msghdr msg;
                    873:   char buf[4];
                    874: 
                    875:   msg.msg_control = buf;
                    876:   msg.msg_controllen = 0;
                    877: 
                    878:   if (CMSG_FIRSTHDR(&msg) != NULL)
                    879:     exit(0);
                    880:   exit (1);
                    881: }]])],[AC_MSG_RESULT(yes - using workaround) AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)],
                    882: [AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
                    883: 
                    884: dnl ------------------------------
                    885: dnl check kernel route read method
                    886: dnl ------------------------------
                    887: AC_CACHE_CHECK([route read method], [quagga_cv_rtread_method],
                    888: [if test "x$netlink" = xyes; then
                    889:   quagga_cv_rtread_method="netlink"
                    890: else
                    891: for quagga_cv_rtread_method in /proc/net/route /dev/ip /dev/null;
                    892: do
                    893:   test x`ls $quagga_cv_rtread_method 2>/dev/null` = x"$quagga_cv_rtread_method" && break
                    894: done
                    895: case $quagga_cv_rtread_method in
                    896:   "/proc/net/route") quagga_cv_rtread_method="proc";;
                    897:   "/dev/ip")
                    898:                      case "$host" in
                    899:                        *-freebsd*)    quagga_cv_rtread_method="sysctl";;
                    900:                        *)             quagga_cv_rtread_method="getmsg";;
                    901:                      esac;;
                    902:        *)
                    903:                      quagga_cv_rtread_method="sysctl";;
                    904: esac
                    905: fi])
                    906: RTREAD_METHOD=rtread_${quagga_cv_rtread_method}.o
                    907: AC_SUBST(RTREAD_METHOD)
                    908: 
                    909: dnl -----------------------------
                    910: dnl check interface lookup method
                    911: dnl -----------------------------
                    912: IOCTL_METHOD=ioctl.o
                    913: AC_MSG_CHECKING(interface looking up method)
                    914: if test "$netlink" = yes; then
                    915:   AC_MSG_RESULT(netlink)
                    916:   IF_METHOD=if_netlink.o
                    917: elif test "$opsys" = "sol2-6";then
                    918:   AC_MSG_RESULT(Solaris GIF)
                    919:   IF_METHOD=if_ioctl.o
                    920: elif test "$opsys" = "sol8";then
                    921:   AC_MSG_RESULT(Solaris GLIF)
                    922:   IF_METHOD=if_ioctl_solaris.o
                    923:   IOCTL_METHOD=ioctl_solaris.o
                    924: elif test "$opsys" = "irix" ; then
                    925:   AC_MSG_RESULT(IRIX)
                    926:   IF_METHOD=if_ioctl.o
                    927: elif test "$opsys" = "openbsd";then
                    928:   AC_MSG_RESULT(openbsd)
                    929:   IF_METHOD=if_ioctl.o
                    930: elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
                    931:   AC_MSG_RESULT(sysctl)
                    932:     IF_METHOD=if_sysctl.o
                    933:     AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
                    934: else
                    935:     AC_MSG_RESULT(ioctl)
                    936:     IF_METHOD=if_ioctl.o
                    937: fi
                    938: AC_SUBST(IF_METHOD)
                    939: AC_SUBST(IOCTL_METHOD)
                    940: 
                    941: dnl ---------------------------------------------------------------
                    942: dnl figure out how to specify an interface in multicast sockets API
                    943: dnl ---------------------------------------------------------------
                    944: AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], [], QUAGGA_INCLUDES)
                    945: 
                    946: AC_MSG_CHECKING([for BSD struct ip_mreq hack])
                    947: AC_TRY_COMPILE([#ifdef HAVE_SYS_PARAM_H
                    948: #include <sys/param.h>
                    949: #endif],[#if (defined(__FreeBSD__) && ((__FreeBSD_version >= 500022 && __FreeBSD_version < 700000) || (__FreeBSD_version < 500000 && __FreeBSD_version >= 440000))) || (defined(__NetBSD__) && defined(__NetBSD_Version__) && __NetBSD_Version__ >= 106010000)
                    950:   return (0);
                    951: #else
                    952:   #error No support for BSD struct ip_mreq hack detected
                    953: #endif],[AC_MSG_RESULT(yes)
                    954: AC_DEFINE(HAVE_BSD_STRUCT_IP_MREQ_HACK,,[Can pass ifindex in struct ip_mreq])],
                    955: AC_MSG_RESULT(no))
                    956: 
                    957: AC_MSG_CHECKING([for RFC3678 protocol-independed API])
                    958: AC_TRY_COMPILE([
                    959: #include <sys/types.h>
                    960: #include <netinet/in.h>
                    961: ], [struct group_req gr; int sock; setsockopt(sock, IPPROTO_IP, MCAST_JOIN_GROUP, (void*)&gr, sizeof(gr));
                    962: ], [AC_MSG_RESULT(yes)
                    963: AC_DEFINE(HAVE_RFC3678,1,[Have RFC3678 protocol-independed API])],
                    964: AC_MSG_RESULT(no))
                    965: 
                    966: dnl ---------------------------------------------------------------
                    967: dnl figure out how to check link-state
                    968: dnl ---------------------------------------------------------------
                    969: AC_CHECK_HEADER([net/if.h],
                    970:   [AC_CHECK_HEADER( [net/if_media.h],
                    971:     [m4_define([LINK_DETECT_INCLUDES],
                    972:       QUAGGA_INCLUDES
                    973:       [#include <net/if_media.h>
                    974:     ])
                    975:     AC_CHECK_MEMBERS( [struct ifmediareq.ifm_status],
                    976:       AC_DEFINE(HAVE_BSD_LINK_DETECT,,[BSD link-detect]),
                    977:       [], LINK_DETECT_INCLUDES)], 
                    978:     [],
                    979:     QUAGGA_INCLUDES)], 
                    980:   [], QUAGGA_INCLUDES )
                    981: 
                    982: dnl ------------------------
                    983: dnl TCP_MD5SIG socket option
                    984: dnl ------------------------
                    985: 
                    986: AC_CHECK_HEADER([netinet/tcp.h], 
                    987:    [m4_define([MD5_INCLUDES],
                    988:       QUAGGA_INCLUDES
                    989:       [#include <netinet/tcp.h>
                    990:     ])
                    991:     AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)],
                    992:    [],
                    993:    QUAGGA_INCLUDES)
                    994: if test $ac_cv_have_decl_TCP_MD5SIG = no; then
                    995:   AC_CHECK_HEADER([linux/tcp.h],
                    996:        [m4_define([MD5_INCLUDES],
                    997:           QUAGGA_INCLUDES
                    998:           [#include <linux/tcp.h>
                    999:         ])
                   1000:        AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)])
                   1001: fi
                   1002: 
                   1003: dnl -----------------------
                   1004: dnl check proc file system.
                   1005: dnl -----------------------
                   1006: if test "$netlink" != yes; then
                   1007:   if test -r /proc/net/dev; then
                   1008:     AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
                   1009:     IF_PROC=if_proc.o
                   1010:   fi
                   1011:   if test -r /proc/net/if_inet6; then
                   1012:     AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
                   1013:     IF_PROC=if_proc.o
                   1014:   fi
                   1015: fi
                   1016: AC_SUBST(IF_PROC)
                   1017: 
                   1018: dnl -----------------------------
                   1019: dnl check ipforward detect method
                   1020: dnl -----------------------------
                   1021: AC_CACHE_CHECK([ipforward method], [quagga_cv_ipforward_method],
1.1.1.3 ! misho    1022: [if test x$cross_compiling = xyes; then
        !          1023:   if test x"$opsys" = x"gnu-linux"; then
        !          1024:     quagga_cv_ipforward_method=/proc/net/snmp
        !          1025:   else
        !          1026:     quagga_cv_ipforward_method=/dev/ip
        !          1027:   fi
        !          1028: else
        !          1029:   for quagga_cv_ipforward_method in /proc/net/snmp /dev/ip /dev/null;
        !          1030:   do
        !          1031:     test x`ls $quagga_cv_ipforward_method 2>/dev/null` = x"$quagga_cv_ipforward_method" && break
        !          1032:   done
        !          1033: fi
1.1       misho    1034: case $quagga_cv_ipforward_method in
                   1035:   "/proc/net/snmp")  quagga_cv_ipforward_method="proc";;
                   1036:   "/dev/ip")         
                   1037:                      case "$host" in
                   1038:                        *-nec-sysv4*)  quagga_cv_ipforward_method="ews";;
                   1039:                        *-freebsd*)    quagga_cv_ipforward_method="sysctl";;
                   1040:                        *)             quagga_cv_ipforward_method="solaris";;
                   1041:                      esac;;
                   1042:   *)                 quagga_cv_ipforward_method="sysctl";;
                   1043: esac])
                   1044: IPFORWARD=ipforward_${quagga_cv_ipforward_method}.o
                   1045: AC_SUBST(IPFORWARD)
                   1046: 
                   1047: AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
                   1048: 
                   1049: dnl ----------
                   1050: dnl IPv6 check
                   1051: dnl ----------
                   1052: AC_MSG_CHECKING(whether does this OS have IPv6 stack)
                   1053: if test "${enable_ipv6}" = "no"; then
                   1054:   AC_MSG_RESULT(disabled)
                   1055: else
                   1056: dnl ----------
                   1057: dnl INRIA IPv6
                   1058: dnl ----------
                   1059:   if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
                   1060:     zebra_cv_ipv6=yes
                   1061:     AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
                   1062:     AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
                   1063:     RIPNGD="ripngd"
                   1064:     OSPF6D="ospf6d"
                   1065:     LIB_IPV6=""
                   1066:     AC_MSG_RESULT(INRIA IPv6)
                   1067: dnl ---------
                   1068: dnl KAME IPv6
                   1069: dnl ---------
                   1070:   elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
                   1071:     zebra_cv_ipv6=yes
                   1072:     AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
                   1073:     AC_DEFINE(KAME,1,KAME IPv6)
                   1074:     RIPNGD="ripngd"
                   1075:     OSPF6D="ospf6d"
                   1076:     if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
                   1077:       LIB_IPV6="-L/usr/local/v6/lib -linet6"
                   1078:     fi
                   1079:     AC_MSG_RESULT(KAME)
                   1080: dnl -------------------------
                   1081: dnl MUSICA IPv6
                   1082: dnl  default host check
                   1083: dnl  It is not used by Kheops
                   1084: dnl -------------------------
                   1085:   elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
                   1086:     zebra_cv_ipv6=yes
                   1087:     AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
                   1088:     AC_DEFINE(MUSICA,1,Musica IPv6 stack)
                   1089:     AC_DEFINE(KAME,1,KAME IPv6 stack)
                   1090:     RIPNGD="ripngd"
                   1091:     OSPF6D="ospf6d"
                   1092:     if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
                   1093:       LIB_IPV6="-L/usr/local/v6/lib -linet6"
                   1094:     fi
                   1095:     AC_MSG_RESULT(MUSICA)
                   1096: dnl ---------
                   1097: dnl NRL check
                   1098: dnl ---------
                   1099:   elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
                   1100:     zebra_cv_ipv6=yes
                   1101:     AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
                   1102:     AC_DEFINE(NRL,1,NRL)
                   1103:     RIPNGD="ripngd"
                   1104:     OSPF6D="ospf6d"
                   1105:     if test x"$opsys" = x"bsdi";then
                   1106:       AC_DEFINE(BSDI_NRL,,BSDI)
                   1107:       AC_MSG_RESULT(BSDI_NRL)
                   1108:     else
                   1109:       AC_MSG_RESULT(NRL)
                   1110:     fi
                   1111: dnl ------------------------------------
                   1112: dnl Solaris 9, 10 and potentially higher
                   1113: dnl ------------------------------------
                   1114:   elif test x"$opsys" = x"sol8"; then
                   1115:     zebra_cv_ipv6=yes;
                   1116:     AC_DEFINE(HAVE_IPV6, 1, IPv6)
                   1117:     AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
                   1118:     RIPNGD="ripngd"
                   1119:     OSPF6D="ospf6d"
                   1120:     AC_MSG_RESULT(Solaris IPv6)
                   1121: dnl ----------
                   1122: dnl Linux IPv6
                   1123: dnl ----------
                   1124:   elif test "${enable_ipv6}" = "yes"; then
                   1125:     AC_EGREP_CPP(yes, [
                   1126:       #include <linux/version.h>
                   1127:       /* 2.1.128 or later */
                   1128:       #if LINUX_VERSION_CODE >= 0x020180
                   1129:       yes
                   1130:       #endif],
                   1131:       [zebra_cv_ipv6=yes
                   1132:        zebra_cv_linux_ipv6=yes
                   1133:        AC_MSG_RESULT(Linux IPv6)])
                   1134:   else
                   1135:     if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
                   1136:      then
                   1137:       zebra_cv_ipv6=yes
                   1138:       zebra_cv_linux_ipv6=yes
                   1139:       AC_MSG_RESULT(Linux IPv6)
                   1140:     fi
                   1141:   fi
                   1142: 
                   1143:   if test "$zebra_cv_linux_ipv6" = "yes";then
                   1144:     AC_MSG_CHECKING(whether libc has IPv6 support)
                   1145:     AC_TRY_LINK([#include <netinet/in.h>
                   1146:     ],[ int a; a = (int) in6addr_any.s6_addr[0]; if (a != 12345) return a; ],
                   1147:     [AC_MSG_RESULT(yes)
                   1148:       zebra_cv_ipv6=yes
                   1149:       zebra_cv_linux_ipv6=yes],
                   1150:     [AC_MSG_RESULT(no)
                   1151:       zebra_cv_ipv6=no
                   1152:       zebra_cv_linux_ipv6=no])
                   1153:   fi
                   1154: 
                   1155:   if test "$zebra_cv_linux_ipv6" = "yes";then
                   1156:     AC_MSG_CHECKING(for GNU libc >= 2.1)
                   1157:     AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
                   1158:     AC_EGREP_CPP(yes, [
                   1159: #include <features.h>
                   1160: #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
                   1161:   yes
                   1162: #endif], 
                   1163:       [glibc=yes
                   1164:        AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
                   1165:        AC_MSG_RESULT(yes)], 
                   1166:       AC_MSG_RESULT(no)
                   1167:     )
                   1168:     RIPNGD="ripngd"
                   1169:     OSPF6D="ospf6d"
                   1170:     if test "$glibc" != "yes"; then
                   1171:       INCLUDES="-I/usr/inet6/include"
                   1172:       if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
                   1173:          LIB_IPV6="-L/usr/inet6/lib -linet6"
                   1174:       fi
                   1175:     fi
                   1176:   fi
                   1177: 
                   1178: dnl -----------------------
                   1179: dnl Set IPv6 related values
                   1180: dnl -----------------------
                   1181:   LIBS="$LIB_IPV6 $LIBS"
                   1182:   AC_SUBST(LIB_IPV6)
                   1183: 
                   1184:   if test x"$RIPNGD" = x""; then
                   1185:     AC_MSG_RESULT(IPv4 only)
                   1186:   fi
                   1187: fi
                   1188: 
                   1189: dnl ------------------
                   1190: dnl IPv6 header checks
                   1191: dnl ------------------
                   1192: if test "x${zebra_cv_ipv6}" = "xyes"; then
                   1193: AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
                   1194:        netinet6/in6_var.h netinet6/nd6.h], [], [],
                   1195:        QUAGGA_INCLUDES)
                   1196: fi
                   1197: 
                   1198: m4_define([QUAGGA_INCLUDES],dnl
                   1199: QUAGGA_INCLUDES
                   1200: [#if HAVE_NETINET6_IN6_H
                   1201: #include <netinet6/in6.h>
                   1202: #endif
                   1203: #if HAVE_NETINET_IN6_VAR_H
                   1204: #include <netinet/in6_var.h>
                   1205: #endif
                   1206: #if HAVE_NETINET_ICMP6_H
                   1207: # include <netinet/icmp6.h>
                   1208: #endif
                   1209: #if HAVE_NETINET6_IN6_VAR_H
                   1210: # include <netinet6/in6_var.h>
                   1211: #endif
                   1212: #if HAVE_NETINET6_ND6_H
                   1213: # include <netinet6/nd6.h>
                   1214: #endif
                   1215: ])dnl
                   1216: 
                   1217: dnl disable doc check
                   1218: if test "${enable_doc}" = "no";then
                   1219:   DOC=""
                   1220: else
                   1221:   DOC="doc"
                   1222: fi
                   1223: 
                   1224: dnl --------------------
                   1225: dnl Daemon disable check
                   1226: dnl --------------------
                   1227: if test "${enable_zebra}" = "no";then
                   1228:   ZEBRA=""
                   1229: else
                   1230:   ZEBRA="zebra"
                   1231: fi
1.1.1.3 ! misho    1232: AM_CONDITIONAL(ZEBRA, test "x$ZEBRA" = "xzebra")
1.1       misho    1233: 
                   1234: if test "${enable_bgpd}" = "no";then
                   1235:   BGPD=""
                   1236: else
                   1237:   BGPD="bgpd"
                   1238: fi
1.1.1.3 ! misho    1239: AM_CONDITIONAL(BGPD, test "x$BGPD" = "xbgpd")
1.1       misho    1240: 
                   1241: if test "${enable_ripd}" = "no";then
                   1242:   RIPD=""
                   1243: else
                   1244:   RIPD="ripd"
                   1245: fi
1.1.1.3 ! misho    1246: AM_CONDITIONAL(RIPD, test "x$RIPD" = "xripd")
1.1       misho    1247: 
                   1248: if test "${enable_ospfd}" = "no";then
                   1249:   OSPFD=""
                   1250: else
                   1251:   OSPFD="ospfd"
                   1252: fi
1.1.1.3 ! misho    1253: AM_CONDITIONAL(OSPFD, test "x$OSPFD" = "xospfd")
        !          1254: 
        !          1255: if test "${enable_babeld}" = "no";then
        !          1256:   BABELD=""
        !          1257: else
        !          1258:   BABELD="babeld"
        !          1259: fi
        !          1260: AM_CONDITIONAL(BABELD, test "x$BABELD" = "xbabeld")
1.1       misho    1261: 
                   1262: if test "${enable_watchquagga}" = "no";then
                   1263:   WATCHQUAGGA=""
                   1264: else
                   1265:   WATCHQUAGGA="watchquagga"
                   1266: fi
1.1.1.3 ! misho    1267: AM_CONDITIONAL(WATCHQUAGGA, test "x$WATCHQUAGGA" = "xwatchquagga")
1.1       misho    1268: 
                   1269: OSPFCLIENT=""
                   1270: if test "${enable_opaque_lsa}" != "no"; then
                   1271:   if test "${enable_ospfapi}" != "no";then
                   1272:     AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
                   1273: 
                   1274:     if test "${enable_ospfclient}" != "no";then
                   1275:       OSPFCLIENT="ospfclient"
                   1276:     fi
                   1277:   fi
                   1278: 
                   1279: fi
1.1.1.3 ! misho    1280: AM_CONDITIONAL(OSPFCLIENT, test "x$OSPFCLIENT" = "xospfclient")
1.1       misho    1281: 
                   1282: case "${enable_ripngd}" in
                   1283:   "yes") RIPNGD="ripngd";;
                   1284:   "no" ) RIPNGD="";;
                   1285:   *    ) ;;
                   1286: esac
1.1.1.3 ! misho    1287: AM_CONDITIONAL(RIPNGD, test "x$RIPNGD" = "xripngd")
1.1       misho    1288: 
                   1289: case "${enable_ospf6d}" in
                   1290:   "yes") OSPF6D="ospf6d";;
                   1291:   "no" ) OSPF6D="";;
                   1292:   *    ) ;;
                   1293: esac
1.1.1.3 ! misho    1294: AM_CONDITIONAL(OSPF6D, test "x$OSPF6D" = "xospf6d")
1.1       misho    1295: 
                   1296: case "${enable_isisd}" in
                   1297:   "yes") ISISD="isisd";;
                   1298:   "no" ) ISISD="";;
                   1299:   *    ) ;;
                   1300: esac
1.1.1.3 ! misho    1301: AM_CONDITIONAL(ISISD, test "x$ISISD" = "xisisd")
1.1       misho    1302: 
                   1303: # XXX Perhaps auto-enable on Solaris, but that's messy for cross builds.
                   1304: case "${enable_solaris}" in
                   1305:   "yes") SOLARIS="solaris";;
                   1306:   "no" ) SOLARIS="";;
                   1307:   *    ) ;;
                   1308: esac
                   1309: 
                   1310: if test "${enable_bgp_announce}" = "no";then
                   1311:   AC_DEFINE(DISABLE_BGP_ANNOUNCE,1,Disable BGP installation to zebra)
                   1312: else
                   1313:   AC_DEFINE(DISABLE_BGP_ANNOUNCE,0,Disable BGP installation to zebra)
                   1314: fi
                   1315: 
                   1316: AC_SUBST(DOC)
                   1317: AC_SUBST(ZEBRA)
                   1318: AC_SUBST(BGPD)
                   1319: AC_SUBST(RIPD)
                   1320: AC_SUBST(RIPNGD)
                   1321: AC_SUBST(OSPFD)
                   1322: AC_SUBST(OSPF6D)
1.1.1.3 ! misho    1323: AC_SUBST(BABELD)
1.1       misho    1324: AC_SUBST(WATCHQUAGGA)
                   1325: AC_SUBST(ISISD)
                   1326: AC_SUBST(SOLARIS)
                   1327: AC_SUBST(VTYSH)
                   1328: AC_SUBST(INCLUDES)
                   1329: AC_SUBST(CURSES)
                   1330: AC_SUBST(OSPFCLIENT)
                   1331: AC_SUBST(OSPFAPI)
                   1332: AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
                   1333: AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
                   1334: AC_CHECK_LIB(crypt, crypt)
                   1335: AC_CHECK_LIB(resolv, res_init)
                   1336: 
                   1337: dnl ---------------------------------------------------
                   1338: dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
                   1339: dnl ---------------------------------------------------
                   1340: AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
                   1341: AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
                   1342: AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
                   1343: 
                   1344: dnl ---------------------------
                   1345: dnl check system has PCRE regexp
                   1346: dnl ---------------------------
                   1347: if test "x$enable_pcreposix" = "xyes"; then
                   1348:   AC_CHECK_LIB(pcreposix, pcreposix_regexec, ,[enable_pcreposix=no
                   1349:   AC_MSG_WARN([*** falling back to other regex library ***]) ])
                   1350: fi
                   1351: 
                   1352: if test "x$enable_pcreposix" != "xyes"; then
                   1353: dnl ---------------------------
                   1354: dnl check system has GNU regexp
                   1355: dnl ---------------------------
                   1356: AC_MSG_CHECKING(whether system has GNU regex)
                   1357: AC_CHECK_LIB(c, regexec,
                   1358: [AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
                   1359:  LIB_REGEX=""],
                   1360: [LIB_REGEX="regex.o"])
                   1361: fi
                   1362: AC_SUBST(HAVE_LIBPCREPOSIX)
                   1363: AC_SUBST(LIB_REGEX)
                   1364: 
                   1365: dnl ------------------
                   1366: dnl check Net-SNMP library
                   1367: dnl ------------------
                   1368: if test "${enable_snmp}" = "yes"; then
                   1369:     if test "$with_crypto" != "no"; then
                   1370:         LIBS="${LIBS} -lcrypto";
                   1371:     fi
                   1372:     AC_CHECK_LIB(netsnmp, asn_parse_int,
                   1373:        [AC_DEFINE(HAVE_NETSNMP,,Net SNMP) 
                   1374:         AC_DEFINE(HAVE_SNMP,,SNMP)
                   1375:         LIBS="${LIBS} -lnetsnmp"],
                   1376:        [AC_MSG_ERROR([--enable-snmp given, but cannot find support for SNMP])])
                   1377: 
                   1378:     AC_CHECK_HEADER([net-snmp/net-snmp-config.h],
                   1379:         [],
                   1380:         [AC_MSG_ERROR([--enable-snmp given, but cannot find net-snmp-config.h])],
                   1381:        QUAGGA_INCLUDES)
                   1382:     AC_SUBST(SNMP_INCLUDES)
                   1383: fi
                   1384: 
                   1385: dnl ---------------------------
                   1386: dnl sockaddr and netinet checks
                   1387: dnl ---------------------------
                   1388: AC_CHECK_TYPES([struct sockaddr, struct sockaddr_in,
                   1389:        struct sockaddr_in6, struct sockaddr_un, struct sockaddr_dl,
                   1390:        socklen_t,
                   1391:        struct ifaliasreq, struct if6_aliasreq, struct in6_aliasreq,
                   1392:        struct nd_opt_adv_interval, struct rt_addrinfo,
                   1393:        struct nd_opt_homeagent_info, struct nd_opt_adv_interval],
                   1394:        [], [], QUAGGA_INCLUDES)
                   1395: 
                   1396: AC_CHECK_MEMBERS([struct sockaddr.sa_len,
                   1397:        struct sockaddr_in.sin_len, struct sockaddr_un.sun_len,
                   1398:        struct sockaddr_in6.sin6_scope_id,
                   1399:        struct if6_aliasreq.ifra_lifetime,
                   1400:        struct nd_opt_adv_interval.nd_opt_ai_type],
                   1401:        [], [], QUAGGA_INCLUDES)
                   1402: 
                   1403: dnl ---------------------------
                   1404: dnl IRDP/pktinfo/icmphdr checks
                   1405: dnl ---------------------------
                   1406: AC_CHECK_TYPES([struct in_pktinfo], 
                   1407:  [AC_CHECK_TYPES([struct icmphdr],
                   1408:    [if test "${enable_irdp}" != "no"; then
                   1409:       AC_DEFINE(HAVE_IRDP,, IRDP)
                   1410:     fi],
                   1411:    [if test "${enable_irdp}" = "yes"; then
                   1412:       AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
                   1413:     fi], [QUAGGA_INCLUDES])],
                   1414:  [if test "${enable_irdp}" = "yes"; then
                   1415:     AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
                   1416:   fi], [QUAGGA_INCLUDES])
                   1417: 
                   1418: dnl --------------------------------------
                   1419: dnl checking for getrusage struct and call
                   1420: dnl --------------------------------------
                   1421: AC_MSG_CHECKING(whether getrusage is available)
                   1422: AC_TRY_COMPILE([#include <sys/resource.h>
                   1423: ],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
                   1424: [AC_MSG_RESULT(yes)
                   1425:  AC_DEFINE(HAVE_RUSAGE,,rusage)],
                   1426:  AC_MSG_RESULT(no))
                   1427: 
                   1428: dnl --------------------------------------
                   1429: dnl checking for clock_time monotonic struct and call
                   1430: dnl --------------------------------------
                   1431: AC_CHECK_DECL(CLOCK_MONOTONIC,
                   1432:        [AC_CHECK_LIB(rt, clock_gettime, [LIBS="$LIBS -lrt"])
                   1433:         AC_DEFINE(HAVE_CLOCK_MONOTONIC,, Have monotonic clock)
                   1434: ], [AC_MSG_RESULT(no)], [QUAGGA_INCLUDES])
                   1435: 
                   1436: dnl -------------------
                   1437: dnl capabilities checks
                   1438: dnl -------------------
                   1439: if test "${enable_capabilities}" != "no"; then
                   1440:   AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
                   1441:   AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
                   1442:     [AC_MSG_RESULT(yes)
                   1443:      AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
                   1444:      quagga_ac_keepcaps="yes"],
                   1445:      AC_MSG_RESULT(no)
                   1446:   )
                   1447:   if test x"${quagga_ac_keepcaps}" = x"yes"; then
                   1448:     AC_CHECK_HEADERS(sys/capability.h)
                   1449:   fi
                   1450:   if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
                   1451:     AC_CHECK_LIB(cap, cap_init, 
                   1452:       [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
                   1453:        LIBCAP="-lcap"
                   1454:        quagga_ac_lcaps="yes"]
                   1455:     )
                   1456:   else
                   1457:     AC_CHECK_HEADERS(priv.h,
                   1458:      [AC_MSG_CHECKING(Solaris style privileges are available)
                   1459:       AC_TRY_COMPILE([#include <priv.h>],[getpflags(PRIV_AWARE);],
                   1460:          [AC_MSG_RESULT(yes)
                   1461:           AC_DEFINE(HAVE_SOLARIS_CAPABILITIES,1,getpflags)
                   1462:           quagga_ac_scaps="yes"],
                   1463:           AC_MSG_RESULT(no)
                   1464:       )
                   1465:      ]
                   1466:    )
                   1467:   fi
                   1468:   if test x"${quagga_ac_scaps}" = x"yes" \
                   1469:        -o x"${quagga_ac_lcaps}" = x"yes"; then
                   1470:     AC_DEFINE(HAVE_CAPABILITIES,1,capabilities)
                   1471:   fi
                   1472: fi
                   1473: AC_SUBST(LIBCAP)
                   1474: 
                   1475: dnl ---------------------------
                   1476: dnl check for glibc 'backtrace'
                   1477: dnl --------------------------- 
                   1478: AC_CHECK_HEADER([execinfo.h],
                   1479:   [AC_CHECK_FUNC([backtrace],
                   1480:     [AC_DEFINE(HAVE_GLIBC_BACKTRACE,,[Glibc backtrace])
                   1481:      AC_DEFINE(HAVE_STACK_TRACE,,[Stack symbol decoding])
                   1482:   ])
                   1483: ])
                   1484: 
                   1485: dnl -----------------------------------------
                   1486: dnl check for malloc mallinfo struct and call
                   1487: dnl this must try and link using LIBS, in
                   1488: dnl order to check no alternative allocator
                   1489: dnl has been specified, which might not provide
                   1490: dnl mallinfo, e.g. such as Umem on Solaris.
                   1491: dnl -----------------------------------------
                   1492: AC_CHECK_HEADER([malloc.h],
                   1493:  [AC_MSG_CHECKING(whether mallinfo is available)
                   1494:   AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
                   1495:                         [[struct mallinfo ac_x; ac_x = mallinfo ();]])],
                   1496:       [AC_MSG_RESULT(yes)
                   1497:        AC_DEFINE(HAVE_MALLINFO,,mallinfo)],
                   1498:        AC_MSG_RESULT(no)
                   1499:   )
                   1500:  ], [], QUAGGA_INCLUDES)
                   1501: 
                   1502: dnl ----------
                   1503: dnl configure date
                   1504: dnl ----------
                   1505: CONFDATE=`date '+%Y%m%d'`
                   1506: AC_SUBST(CONFDATE)
                   1507: 
                   1508: dnl Conditionally enable PIE support for GNU toolchains.
                   1509: AC_ARG_ENABLE(pie, AS_HELP_STRING([--disable-pie], [Do not build tools as a Position Independent Executables]))
                   1510: if test "$enable_pie" != "no"; then
                   1511:   AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [
                   1512:     save_CFLAGS=$CFLAGS
                   1513:     save_LDFLAGS=$LDFLAGS
                   1514:     CFLAGS="$CFLAGS -fPIE"
                   1515:     LDFLAGS="$LDFLAGS -pie"
                   1516:     AC_LINK_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
                   1517:       [ap_cv_cc_pie=yes], [ap_cv_cc_pie=no]
                   1518:     )
                   1519:     CFLAGS=$save_CFLAGS
                   1520:     LDFLAGS=$save_LDFLAGS
                   1521:   ])
                   1522:   if test "$ap_cv_cc_pie" = "yes"; then
                   1523:     PICFLAGS="-fPIE"
                   1524:     PILDFLAGS="-pie"
                   1525:   fi
                   1526: fi
                   1527: 
                   1528: AC_SUBST(PICFLAGS)
                   1529: AC_SUBST(PILDFLAGS)
                   1530: 
                   1531: dnl ------------------------------
                   1532: dnl set paths for state directory
                   1533: dnl ------------------------------
                   1534: AC_MSG_CHECKING(directory to use for state file)
                   1535: if test "${prefix}" = "NONE"; then
                   1536:   quagga_statedir_prefix="";
                   1537: else
                   1538:   quagga_statedir_prefix=${prefix}
                   1539: fi
                   1540: if test "${localstatedir}" = '${prefix}/var'; then
                   1541:   for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
                   1542:                        ${quagga_statedir_prefix}/var/adm dnl
                   1543:                        ${quagga_statedir_prefix}/etc dnl
                   1544:                        /var/run        dnl
                   1545:                         /var/adm       dnl
                   1546:                         /etc           dnl
                   1547:                         /dev/null;
                   1548:   do
                   1549:     test -d $QUAGGA_STATE_DIR && break
                   1550:   done
                   1551:   quagga_statedir=$QUAGGA_STATE_DIR
                   1552: else
                   1553:   quagga_statedir=${localstatedir}
                   1554: fi
                   1555: if test $quagga_statedir = "/dev/null"; then
                   1556:     AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
                   1557: fi
                   1558: AC_MSG_RESULT(${quagga_statedir})
                   1559: AC_SUBST(quagga_statedir)
                   1560: 
                   1561: AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
                   1562: AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
                   1563: AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
                   1564: AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
                   1565: AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
                   1566: AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
1.1.1.3 ! misho    1567: AC_DEFINE_UNQUOTED(PATH_BABELD_PID, "$quagga_statedir/babeld.pid",babeld PID)
1.1       misho    1568: AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
                   1569: AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
                   1570: AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
                   1571: AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
                   1572: AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
                   1573: AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
                   1574: AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
                   1575: AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
                   1576: AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
1.1.1.3 ! misho    1577: AC_DEFINE_UNQUOTED(BABEL_VTYSH_PATH, "$quagga_statedir/babeld.vty",babeld vty socket)
1.1       misho    1578: AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
                   1579: AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
                   1580: 
                   1581: dnl -------------------------------
                   1582: dnl Quagga sources should always be 
                   1583: dnl current wrt interfaces. Dont
                   1584: dnl allow deprecated interfaces to
                   1585: dnl be exposed.
                   1586: dnl -------------------------------
                   1587: AC_DEFINE(QUAGGA_NO_DEPRECATED_INTERFACES, 1, Hide deprecated interfaces)
                   1588: 
                   1589: dnl ---------------------------
                   1590: dnl Check htonl works correctly
                   1591: dnl ---------------------------
                   1592: AC_MSG_CHECKING(for working htonl)
                   1593: AC_CACHE_VAL(ac_cv_htonl_works,
                   1594:  [AC_LINK_IFELSE([AC_LANG_PROGRAM([QUAGGA_INCLUDES],[htonl (0);])],
                   1595:                [ac_cv_htonl_works=yes], [ac_cv_htonl_works=no])
                   1596:  ]
                   1597: )
                   1598: AC_MSG_RESULT($ac_cv_htonl_works)
                   1599: 
                   1600: AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile 
                   1601:          ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
1.1.1.3 ! misho    1602:          ospf6d/Makefile isisd/Makefile babeld/Makefile vtysh/Makefile
        !          1603:           doc/Makefile ospfclient/Makefile tests/Makefile m4/Makefile
        !          1604:           redhat/Makefile
1.1       misho    1605:          pkgsrc/Makefile
                   1606:          redhat/quagga.spec 
                   1607:          lib/version.h
                   1608:          doc/defines.texi
                   1609:          isisd/topology/Makefile
                   1610:          pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
                   1611:          pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
                   1612: AC_CONFIG_FILES([solaris/Makefile])
                   1613: 
                   1614: AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
                   1615: ## Hack, but working solution to avoid rebuilding of quagga.info.
                   1616: ## It's already in CVS until texinfo 4.7 is more common.
                   1617: AC_OUTPUT
                   1618: 
                   1619: echo "
                   1620: Quagga configuration
                   1621: --------------------
                   1622: quagga version          : ${PACKAGE_VERSION}
                   1623: host operating system  : ${host_os}
                   1624: source code location    : ${srcdir}
                   1625: compiler                : ${CC}
                   1626: compiler flags          : ${CFLAGS}
                   1627: make                    : ${MAKE-make}
                   1628: includes                : ${INCLUDES} ${SNMP_INCLUDES}
                   1629: linker flags            : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM}
                   1630: state file directory    : ${quagga_statedir}
                   1631: config file directory   : `eval echo \`echo ${sysconfdir}\``
                   1632: example directory       : `eval echo \`echo ${exampledir}\``
                   1633: user to run as         : ${enable_user}
                   1634: group to run as                : ${enable_group}
                   1635: group for vty sockets  : ${enable_vty_group}
                   1636: config file mask        : ${enable_configfile_mask}
                   1637: log file mask           : ${enable_logfile_mask}
                   1638: 
                   1639: The above user and group must have read/write access to the state file
                   1640: directory and to the config files in the config file directory."
                   1641: 
                   1642: if test x"$quagga_cv_gnu_make" = x"no"; then echo "
                   1643: Warning: The ${MAKE-make} programme detected, either in your path or
                   1644: via the MAKE variable, is not GNU Make. GNU make may be installed as
                   1645: gmake on some systems. and is required to complete a build of Quagga
                   1646: " > /dev/stderr 
                   1647: fi

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