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