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

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

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