]> git.proxmox.com Git - mirror_frr.git/blame - configure.ac
build/lib: Check for and include stdbool.h by default
[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
63a13864 481AC_HEADER_STDBOOL
6f0e3f6e
PJ
482dnl AC_TYPE_PID_T
483AC_TYPE_UID_T
484AC_TYPE_MODE_T
485AC_TYPE_SIZE_T
486AC_TYPE_SIGNAL
487AC_STRUCT_TM
dc7a2bf1 488
6f0e3f6e
PJ
489dnl -------------------------
490dnl Check other header files.
491dnl -------------------------
492AC_CHECK_HEADERS([stropts.h sys/ksym.h sys/times.h sys/select.h \
493 sys/types.h linux/version.h netdb.h asm/types.h \
16ffb26f 494 sys/cdefs.h sys/param.h limits.h signal.h \
6511cab2 495 sys/socket.h netinet/in.h time.h sys/time.h])
6f0e3f6e
PJ
496
497dnl Utility macro to avoid retyping includes all the time
498m4_define([QUAGGA_INCLUDES],
499[#ifdef SUNOS_5
500#define _XPG4_2
501#define __EXTENSIONS__
502#endif
503#include <stdio.h>
504#if STDC_HEADERS
505# include <stdlib.h>
506# include <stddef.h>
507#else
508# if HAVE_STDLIB_H
509# include <stdlib.h>
510# endif
511#endif
512#if HAVE_SYS_TYPES_H
513# include <sys/types.h>
514#endif
515/* sys/conf.h depends on param.h on FBSD at least */
516#if HAVE_SYS_PARAM_H
517# include <sys/param.h>
518#endif
519/* Required for MAXSIG */
520#if HAVE_SIGNAL_H
521# include <signal.h>
522#endif
523#if HAVE_SYS_SOCKET_H
524# include <sys/socket.h>
525#endif
ea057677
HT
526#ifdef __APPLE__
527# define __APPLE_USE_RFC_3542
528#endif
6f0e3f6e
PJ
529#if HAVE_NETINET_IN_H
530# include <netinet/in.h>
531#endif
6511cab2
PJ
532#ifdef TIME_WITH_SYS_TIME
533# include <sys/time.h>
534# include <time.h>
535#else
536# ifdef HAVE_SYS_TIME_H
537# include <sys/time.h>
538# else
539# include <time.h>
540# endif
541#endif /* TIME_WITH_SYS_TIME */
6f0e3f6e
PJ
542])dnl
543
2b43bf23
DO
544dnl HAVE_NET_IF_H must be discovered by the time the longer AC_CHECK_HEADERS
545dnl round below execution begins, otherwise it doesn't properly detect
546dnl HAVE_NETINET6_IN6_VAR_H, HAVE_NET_IF_VAR_H and HAVE_STRUCT_IN6_ALIASREQ
547dnl on FreeBSD (BZ#408).
548
549AC_CHECK_HEADERS([net/if.h], [], [], QUAGGA_INCLUDES)
550
551m4_define([QUAGGA_INCLUDES],
552QUAGGA_INCLUDES
553[#if HAVE_NET_IF_H
554# include <net/if.h>
555#endif
556])dnl
557
558dnl Same applies for HAVE_NET_IF_VAR_H, which HAVE_NETINET6_ND6_H and
559dnl HAVE_NETINET_IN_VAR_H depend upon. But if_var.h depends on if.h, hence
560dnl an additional round for it.
561
562AC_CHECK_HEADERS([net/if_var.h], [], [], QUAGGA_INCLUDES)
563
564m4_define([QUAGGA_INCLUDES],
565QUAGGA_INCLUDES
566[#if HAVE_NET_IF_VAR_H
567# include <net/if_var.h>
568#endif
569])dnl
570
571AC_CHECK_HEADERS([sys/un.h netinet/in_systm.h netinet/in_var.h \
572 net/if_dl.h net/netopt.h net/route.h \
11770e10 573 inet/nd.h arpa/inet.h netinet/ip_icmp.h \
6f0e3f6e
PJ
574 fcntl.h stddef.h sys/ioctl.h syslog.h wchar.h wctype.h \
575 sys/sysctl.h sys/sockio.h kvm.h sys/conf.h],
576 [], [], QUAGGA_INCLUDES)
577
578AC_CHECK_HEADERS([ucontext.h], [], [],
579[#ifndef __USE_GNU
580#define __USE_GNU
581#endif /* __USE_GNU */
582QUAGGA_INCLUDES
583])
584
bccbd141
JT
585m4_define([UCONTEXT_INCLUDES],
586[#include <ucontext.h>])dnl
587
588AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.uc_regs],
589 [], [], [UCONTEXT_INCLUDES])
590AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.regs],
591 [AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.regs.nip],
592 [], [], [UCONTEXT_INCLUDES])],
593 [], [UCONTEXT_INCLUDES])
594AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.gregs],
595 [], [], [UCONTEXT_INCLUDES])
596
6f0e3f6e
PJ
597m4_define([QUAGGA_INCLUDES],
598QUAGGA_INCLUDES
2b43bf23 599[#if HAVE_SYS_UN_H
6f0e3f6e
PJ
600# include <sys/un.h>
601#endif
602#if HAVE_NETINET_IN_SYSTM_H
603# include <netinet/in_systm.h>
604#endif
605#if HAVE_NETINET_IN_VAR_H
606# include <netinet/in_var.h>
607#endif
608#if HAVE_NET_IF_DL_H
609# include <net/if_dl.h>
610#endif
6f0e3f6e
PJ
611#if HAVE_NET_NETOPT_H
612# include <net/netopt.h>
613#endif
614#if HAVE_NET_ROUTE_H
615# include <net/route.h>
616#endif
617#if HAVE_INET_ND_H
618# include <inet/nd.h>
619#endif
620#if HAVE_ARPA_INET_H
621# include <arpa/inet.h>
622#endif
11770e10
PJ
623/* Required for IDRP */
624#if HAVE_NETINET_IP_ICMP_H
625# include <netinet/ip_icmp.h>
626#endif
6f0e3f6e 627])dnl
dc7a2bf1 628
fa3232e1 629dnl V6 headers are checked below, after we check for v6
7ea487bc 630
7ea487bc 631dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
632case "$host" in
afd8a129 633 [*-sunos5.[6-7]*] | [*-solaris2.[6-7]*])
7ea487bc 634 opsys=sol2-6
afd8a129 635 AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.7)
19877dd2 636 AC_DEFINE(SUNOS_5, 1, SunOS 5)
7ea487bc 637 AC_CHECK_LIB(xnet, main)
638 CURSES=-lcurses
639 ;;
1b73de8b 640 [*-sunos5.[8-9]] \
641 | [*-sunos5.1[0-9]] \
642 | [*-sunos5.1[0-9].[0-9]] \
643 | [*-solaris2.[8-9]] \
644 | [*-solaris2.1[0-9]] \
645 | [*-solaris2.1[0-9].[0-9]])
afd8a129 646 opsys=sol8
fb66b29c
PJ
647 AC_DEFINE(SUNOS_59, 1, [SunOS 5.8 up])
648 AC_DEFINE(SUNOS_5, 1, [SunOS 5])
19877dd2 649 AC_CHECK_LIB(socket, main)
650 AC_CHECK_LIB(nsl, main)
1b73de8b 651 AC_CHECK_LIB(umem, main)
fb66b29c
PJ
652 AC_CHECK_FUNCS([printstack],
653 [AC_DEFINE([HAVE_PRINTSTACK],1,[Solaris printstack])
654 AC_DEFINE([HAVE_STACK_TRACE],1,[Stack symbols decode functionality])
655 ])
19877dd2 656 CURSES=-lcurses
657 ;;
7ea487bc 658 *-sunos5* | *-solaris2*)
19877dd2 659 AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
7ea487bc 660 AC_CHECK_LIB(socket, main)
661 AC_CHECK_LIB(nsl, main)
662 CURSES=-lcurses
663 ;;
c45eb839 664 *-linux*)
7ea487bc 665 opsys=gnu-linux
666 AC_DEFINE(GNU_LINUX,,GNU Linux)
667 ;;
668 *-nec-sysv4*)
669 AC_CHECK_LIB(nsl, gethostbyname)
670 AC_CHECK_LIB(socket, socket)
671 ;;
7ea487bc 672 *-openbsd*)
673 opsys=openbsd
674 AC_DEFINE(OPEN_BSD,,OpenBSD)
675 ;;
676 *-bsdi*)
677 opsys=bsdi
678 OTHER_METHOD="mtu_kvm.o"
679 AC_CHECK_LIB(kvm, main)
680 ;;
49e3b3c0 681 *-irix6.5)
dc7a2bf1 682 opsys=irix
683 AC_DEFINE(IRIX_65,,IRIX 6.5)
684 ;;
7ea487bc 685esac
686
62c9f504
PJ
687AC_SYS_LARGEFILE
688
7ea487bc 689dnl ---------------------
690dnl Integrated VTY option
691dnl ---------------------
692case "${enable_vtysh}" in
f0646db0
DS
693 "no") VTYSH="";;
694 *) VTYSH="vtysh";
7ea487bc 695 AC_DEFINE(VTYSH,,VTY shell)
fc9d0745 696dnl Vtysh uses libreadline, which looks for termcap functions at
6f0e3f6e 697dnl configure time. We follow readlines search order.
fc9d0745 698dnl The required procedures are in libtermcap on NetBSD, in
699dnl [TODO] on Linux, and in [TODO] on Solaris.
c0689394 700 AC_CHECK_LIB(termcap, tputs, LIBREADLINE="$LIBREADLINE -ltermcap",
a969459c 701 [AC_CHECK_LIB(tinfo, tputs, LIBREADLINE="$LIBREADLINE -ltinfo",
702 [AC_CHECK_LIB(curses, tputs, LIBREADLINE="$LIBREADLINE -lcurses",
703 [AC_CHECK_LIB(ncurses, tputs,
704 LIBREADLINE="$LIBREADLINE -lncurses")]
705 )]
706 )]
707 )
708 AC_CHECK_LIB(readline, main, LIBREADLINE="$LIBREADLINE -lreadline",,
709 "$LIBREADLINE")
7ea487bc 710 if test $ac_cv_lib_readline_main = no; then
fc9d0745 711 AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
7ea487bc 712 fi
713 AC_CHECK_HEADER(readline/history.h)
714 if test $ac_cv_header_readline_history_h = no;then
715 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
716 fi
a969459c 717 AC_CHECK_LIB(readline, rl_completion_matches,
718 LIBREADLINE="$LIBREADLINE",, "$LIBREADLINE")
3d3de8c4 719 if test $ac_cv_lib_readline_rl_completion_matches = no; then
720 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
721 fi
722 ;;
7ea487bc 723 "no" ) VTYSH="";;
7ea487bc 724esac
c0689394 725AC_SUBST(LIBREADLINE)
f027d331 726AM_CONDITIONAL(VTYSH, test "x$VTYSH" = "xvtysh")
7ea487bc 727
728dnl ----------
729dnl PAM module
6159928d
DO
730dnl
731dnl Quagga detects the PAM library it is built against by checking for a
732dnl functional pam_misc.h (Linux-PAM) or openpam.h (OpenPAM) header. pam_misc.h
733dnl is known to #include pam_appl.h, the standard header of a PAM library, and
734dnl openpam.h doesn't do that, although depends on the header too. Hence a
735dnl little assistance to AC_CHECK_HEADER is necessary for the proper detection
736dnl of OpenPAM.
7ea487bc 737dnl ----------
24cd435b 738if test "$with_libpam" = "yes"; then
6f0e3f6e
PJ
739 AC_CHECK_HEADER([security/pam_misc.h],
740 [AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
741 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
742 pam_conv_func="misc_conv"
743 ],
744 [], QUAGGA_INCLUDES)
745 AC_CHECK_HEADER([security/openpam.h],
746 [AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
747 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
748 pam_conv_func="openpam_ttyconv"
749 ],
6159928d 750 [], QUAGGA_INCLUDES[#include <security/pam_appl.h>])
24cd435b 751 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
752 AC_MSG_WARN([*** pam support will not be built ***])
753 with_libpam="no"
754 fi
755fi
756
7ea487bc 757if test "$with_libpam" = "yes"; then
6f0e3f6e 758dnl took this test from proftpds configure.in and suited to our needs
7ea487bc 759dnl -------------------------------------------------------------------------
760dnl
761dnl This next check looks funky due to a linker problem with some versions
762dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
763dnl omitted requiring libdl linking information. PAM-0.72 or better ships
764dnl with RedHat 6.2 and Debian 2.2 or better.
765AC_CHECK_LIB(pam, pam_start,
24cd435b 766 [AC_CHECK_LIB(pam, $pam_conv_func,
7ea487bc 767 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
768 LIBPAM="-lpam"],
769 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
770 LIBPAM="-lpam -lpam_misc"]
771 )
772 ],
773
774 [AC_CHECK_LIB(pam, pam_end,
24cd435b 775 [AC_CHECK_LIB(pam, $pam_conv_func,
a159ed93 776 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
7ea487bc 777 LIBPAM="-lpam -ldl"],
a159ed93 778 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
7ea487bc 779 LIBPAM="-lpam -ldl -lpam_misc"]
780 )
781 ],AC_MSG_WARN([*** pam support will not be built ***]),
782 [-ldl])
783 ]
784)
785fi
786AC_SUBST(LIBPAM)
787
788dnl -------------------------------
789dnl Endian-ness check
790dnl -------------------------------
791AC_WORDS_BIGENDIAN
792
793dnl -------------------------------
794dnl check the size in byte of the C
795dnl -------------------------------
796dnl AC_CHECK_SIZEOF(char)
797dnl AC_CHECK_SIZEOF(int)
798dnl AC_CHECK_SIZEOF(short)
799dnl AC_CHECK_SIZEOF(long)
800
801dnl ----------------------------
802dnl check existance of functions
803dnl ----------------------------
6f0e3f6e
PJ
804AC_FUNC_CHOWN
805AC_FUNC_FNMATCH
806AC_FUNC_FORK
6f0e3f6e
PJ
807AC_FUNC_MEMCMP
808AC_FUNC_MKTIME
809AC_FUNC_STRFTIME
6f0e3f6e
PJ
810AC_FUNC_STAT
811AC_FUNC_SELECT_ARGTYPES
812AC_FUNC_STRFTIME
d46d2a24
PJ
813dnl Avoid AC_FUNC_STRNLEN because it pulls in AC_SYSTEM_EXTENSIONS which
814dnl can lead to strange side effects. So we just check for strnlen
815dnl directly, see below.
2b5cb411 816dnl AC_FUNC_STRNLENdnl
6f0e3f6e
PJ
817AC_FUNC_VPRINTF
818
819dnl -------------------------------
820dnl bgpd needs pow() and hence libm
821dnl -------------------------------
822TMPLIBS="$LIBS"
823AC_CHECK_HEADER([math.h],
824 [AC_CHECK_LIB([m], [pow],
825 [LIBM="-lm"
826 LIBS="$LIBS $LIBM"
827 AC_DEFINE(HAVE_LIBM,, Have libm)
828 AC_CHECK_FUNCS(pow,[],[LIBM=""])
829 ])
830])
831if test x"$LIBM" = x ; then
832 AC_MSG_WARN([Unable to find working pow function - bgpd may not link])
833fi
834LIBS="$TMPLIBS"
835AC_SUBST(LIBM)
836
837dnl ---------------
838dnl other functions
839dnl ---------------
840AC_CHECK_FUNCS([dup2 ftruncate getcwd gethostbyname getpagesize gettimeofday \
d46d2a24 841 inet_ntoa inet_aton strnlen \
6f0e3f6e
PJ
842 memchr memmove memset select socket \
843 strcasecmp strchr strcspn strdup strerror \
844 strncasecmp strndup strrchr strspn strstr \
845 strtol strtoul strlcat strlcpy \
846 daemon snprintf vsnprintf \
847 if_nametoindex if_indextoname getifaddrs \
4a9ea50e 848 uname fcntl getgrouplist])
6f0e3f6e 849
7ea487bc 850dnl ------------------------------------
851dnl Determine routing get and set method
852dnl ------------------------------------
853AC_MSG_CHECKING(zebra between kernel interface method)
854if test x"$opsys" = x"gnu-linux"; then
75f13491 855 if test "${enable_netlink}" = "no"; then
7ea487bc 856 AC_MSG_RESULT(ioctl)
857 RT_METHOD=rt_ioctl.o
858 netlink=no
859 else
860 AC_MSG_RESULT(netlink)
861 RT_METHOD=rt_netlink.o
862 AC_DEFINE(HAVE_NETLINK,,netlink)
863 netlink=yes
75f13491 864 AC_CHECK_DECLS([IFLA_INFO_SLAVE_KIND], [], [], [#include <linux/if_link.h>])
7ea487bc 865 fi
19877dd2 866elif test x"$opsys" = x"sol2-6";then
867 AC_MSG_RESULT(Route socket)
868 KERNEL_METHOD="kernel_socket.o"
869 RT_METHOD="rt_socket.o"
afd8a129 870elif test x"$opsys" = x"sol8";then
19877dd2 871 AC_MSG_RESULT(Route socket)
872 KERNEL_METHOD="kernel_socket.o"
873 RT_METHOD="rt_socket.o"
874elif test "$opsys" = "irix" ; then
875 AC_MSG_RESULT(Route socket)
876 KERNEL_METHOD="kernel_socket.o"
877 RT_METHOD="rt_socket.o"
7ea487bc 878else
19877dd2 879 AC_TRY_RUN([#include <errno.h>
7ea487bc 880#include <sys/types.h>
881#include <sys/socket.h>
882
883main ()
884{
885 int ac_sock;
886
887 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
888 if (ac_sock < 0 && errno == EINVAL)
889 exit (1);
890 exit (0);
891}],
892 [KERNEL_METHOD=kernel_socket.o
893 RT_METHOD=rt_socket.o
894 AC_MSG_RESULT(socket)],
895 [RT_METHOD=rt_ioctl.o
896 AC_MSG_RESULT(ioctl)],
897 [KERNEL_METHOD=kernel_socket.o
898 RT_METHOD=rt_socket.o
899 AC_MSG_RESULT(socket)])
7ea487bc 900fi
901AC_SUBST(RT_METHOD)
902AC_SUBST(KERNEL_METHOD)
903AC_SUBST(OTHER_METHOD)
5adc2528 904AM_CONDITIONAL([HAVE_NETLINK], [test "x$netlink" = "xyes"])
7ea487bc 905
238497fc
PJ
906dnl --------------------------
907dnl Determine IS-IS I/O method
908dnl --------------------------
745bf05f
DL
909AC_DEFINE(ISIS_METHOD_PFPACKET, 1, [ constant value for isis method pfpacket ])
910AC_DEFINE(ISIS_METHOD_DLPI, 2, [ constant value for isis method dlpi ])
911AC_DEFINE(ISIS_METHOD_BPF, 3, [ constant value for isis method bpf ])
238497fc
PJ
912AC_CHECK_HEADER(net/bpf.h)
913AC_CHECK_HEADER(sys/dlpi.h)
914AC_MSG_CHECKING(zebra IS-IS I/O method)
915if test x"$opsys" = x"gnu-linux"; then
916 AC_MSG_RESULT(pfpacket)
745bf05f 917 ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET"
238497fc
PJ
918elif test x"$opsys" = x"sol2-6" -o x"$opsys" = x"sol8"; then
919 AC_MSG_RESULT(DLPI)
745bf05f 920 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
238497fc
PJ
921else
922 if test $ac_cv_header_net_bpf_h = no; then
923 if test $ac_cv_header_sys_dlpi_h = no; then
924 AC_MSG_RESULT(none)
925 AC_MSG_WARN([*** IS-IS support will not be built ***])
926 ISISD=""
927 else
928 AC_MSG_RESULT(DLPI)
929 fi
745bf05f 930 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
238497fc
PJ
931 else
932 AC_MSG_RESULT(BPF)
745bf05f 933 ISIS_METHOD_MACRO="ISIS_METHOD_BPF"
238497fc
PJ
934 fi
935fi
745bf05f 936AC_DEFINE_UNQUOTED(ISIS_METHOD, $ISIS_METHOD_MACRO, [ selected method for isis, == one of the constants ])
238497fc 937
b99760ab 938dnl ------------------------------------
939dnl check for broken CMSG_FIRSTHDR macro
940dnl ------------------------------------
6c20046f 941AC_MSG_CHECKING(for broken CMSG_FIRSTHDR)
5b087528 942AC_RUN_IFELSE([AC_LANG_SOURCE([[
b99760ab 943#ifdef SUNOS_5
944#define _XPG4_2
945#define __EXTENSIONS__
946#endif
6f0e3f6e
PJ
947#ifdef HAVE_STDLIB_H
948# include <stdlib.h>
949#endif
950#ifdef HAVE_SYS_TYPES_H
b99760ab 951#include <sys/types.h>
6f0e3f6e
PJ
952#endif
953#ifdef HAVE_SYS_SOCKET_H
b99760ab 954#include <sys/socket.h>
6f0e3f6e 955#endif
b99760ab 956
957main()
958{
959 struct msghdr msg;
960 char buf[4];
961
962 msg.msg_control = buf;
963 msg.msg_controllen = 0;
964
965 if (CMSG_FIRSTHDR(&msg) != NULL)
966 exit(0);
967 exit (1);
5b087528 968}]])],[AC_MSG_RESULT(yes - using workaround) AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)],
d33e8d7b 969[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
b99760ab 970
7ea487bc 971dnl ------------------------------
972dnl check kernel route read method
973dnl ------------------------------
5589ffa7
JJ
974AC_CACHE_CHECK([route read method], [quagga_cv_rtread_method],
975[if test "x$netlink" = xyes; then
976 quagga_cv_rtread_method="netlink"
7ea487bc 977else
5589ffa7 978for quagga_cv_rtread_method in /proc/net/route /dev/ip /dev/null;
7ea487bc 979do
5589ffa7 980 test x`ls $quagga_cv_rtread_method 2>/dev/null` = x"$quagga_cv_rtread_method" && break
7ea487bc 981done
5589ffa7
JJ
982case $quagga_cv_rtread_method in
983 "/proc/net/route") quagga_cv_rtread_method="proc";;
9c30ab6b 984 "/dev/ip")
985 case "$host" in
5589ffa7
JJ
986 *-freebsd*) quagga_cv_rtread_method="sysctl";;
987 *) quagga_cv_rtread_method="getmsg";;
9c30ab6b 988 esac;;
5589ffa7
JJ
989 *)
990 quagga_cv_rtread_method="sysctl";;
7ea487bc 991esac
992fi])
5589ffa7 993RTREAD_METHOD=rtread_${quagga_cv_rtread_method}.o
7ea487bc 994AC_SUBST(RTREAD_METHOD)
995
996dnl -----------------------------
997dnl check interface lookup method
998dnl -----------------------------
19877dd2 999IOCTL_METHOD=ioctl.o
7ea487bc 1000AC_MSG_CHECKING(interface looking up method)
1001if test "$netlink" = yes; then
1002 AC_MSG_RESULT(netlink)
1003 IF_METHOD=if_netlink.o
19877dd2 1004elif test "$opsys" = "sol2-6";then
1005 AC_MSG_RESULT(Solaris GIF)
1006 IF_METHOD=if_ioctl.o
afd8a129 1007elif test "$opsys" = "sol8";then
19877dd2 1008 AC_MSG_RESULT(Solaris GLIF)
1009 IF_METHOD=if_ioctl_solaris.o
1010 IOCTL_METHOD=ioctl_solaris.o
1011elif test "$opsys" = "irix" ; then
1012 AC_MSG_RESULT(IRIX)
1013 IF_METHOD=if_ioctl.o
1014elif test "$opsys" = "openbsd";then
1015 AC_MSG_RESULT(openbsd)
1016 IF_METHOD=if_ioctl.o
1017elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
1018 AC_MSG_RESULT(sysctl)
7ea487bc 1019 IF_METHOD=if_sysctl.o
1020 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
19877dd2 1021else
7ea487bc 1022 AC_MSG_RESULT(ioctl)
1023 IF_METHOD=if_ioctl.o
7ea487bc 1024fi
1025AC_SUBST(IF_METHOD)
19877dd2 1026AC_SUBST(IOCTL_METHOD)
7ea487bc 1027
42c98199 1028dnl ---------------------------------------------------------------
1029dnl figure out how to specify an interface in multicast sockets API
1030dnl ---------------------------------------------------------------
6f0e3f6e 1031AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], [], QUAGGA_INCLUDES)
42c98199 1032
a724477d
DS
1033AC_CHECK_HEADERS([linux/mroute.h], [], [],
1034[
1035#if HAVE_NETINET_IN_H
1036#include<netinet/in.h>
1037#endif])
42c98199 1038AC_MSG_CHECKING([for BSD struct ip_mreq hack])
1039AC_TRY_COMPILE([#ifdef HAVE_SYS_PARAM_H
1040#include <sys/param.h>
373ba5cd 1041#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 1042 return (0);
1043#else
1044 #error No support for BSD struct ip_mreq hack detected
1045#endif],[AC_MSG_RESULT(yes)
1046AC_DEFINE(HAVE_BSD_STRUCT_IP_MREQ_HACK,,[Can pass ifindex in struct ip_mreq])],
1047AC_MSG_RESULT(no))
1048
10d04cdb
DT
1049AC_MSG_CHECKING([for RFC3678 protocol-independed API])
1050AC_TRY_COMPILE([
1051#include <sys/types.h>
1052#include <netinet/in.h>
1053], [struct group_req gr; int sock; setsockopt(sock, IPPROTO_IP, MCAST_JOIN_GROUP, (void*)&gr, sizeof(gr));
1054], [AC_MSG_RESULT(yes)
1055AC_DEFINE(HAVE_RFC3678,1,[Have RFC3678 protocol-independed API])],
1056AC_MSG_RESULT(no))
1057
c543a173
AS
1058dnl ---------------------------------------------------------------
1059dnl figure out how to check link-state
1060dnl ---------------------------------------------------------------
6418bedf
AS
1061AC_CHECK_HEADER([net/if.h],
1062 [AC_CHECK_HEADER( [net/if_media.h],
1063 [m4_define([LINK_DETECT_INCLUDES],
1064 QUAGGA_INCLUDES
1065 [#include <net/if_media.h>
1066 ])
1067 AC_CHECK_MEMBERS( [struct ifmediareq.ifm_status],
1068 AC_DEFINE(HAVE_BSD_LINK_DETECT,,[BSD link-detect]),
1069 [], LINK_DETECT_INCLUDES)],
1070 [],
1071 QUAGGA_INCLUDES)],
1072 [], QUAGGA_INCLUDES )
c543a173 1073
9234b382
DV
1074dnl ---------------------------------------------------------------
1075dnl Additional, newer way to check link-state using ifi_link_state.
1076dnl Not available in all BSD's when ifmediareq available
1077dnl ---------------------------------------------------------------
1078AC_CHECK_HEADER([net/if.h],
1079 AC_CHECK_MEMBERS([struct if_data.ifi_link_state],
1080 AC_DEFINE(HAVE_BSD_IFI_LINK_STATE,,[BSD ifi_link_state available]),
1081 [], QUAGGA_INCLUDES),
1082 ,)
1083
0df7c91f
PJ
1084dnl ------------------------
1085dnl TCP_MD5SIG socket option
1086dnl ------------------------
1087
1088AC_CHECK_HEADER([netinet/tcp.h],
1089 [m4_define([MD5_INCLUDES],
1090 QUAGGA_INCLUDES
1091 [#include <netinet/tcp.h>
1092 ])
1093 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)],
1094 [],
1095 QUAGGA_INCLUDES)
1096if test $ac_cv_have_decl_TCP_MD5SIG = no; then
1097 AC_CHECK_HEADER([linux/tcp.h],
1098 [m4_define([MD5_INCLUDES],
1099 QUAGGA_INCLUDES
1100 [#include <linux/tcp.h>
1101 ])
1102 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)])
1103fi
1104
7ea487bc 1105dnl -----------------------
1106dnl check proc file system.
1107dnl -----------------------
cadfb2cd
SH
1108if test "$netlink" != yes; then
1109 if test -r /proc/net/dev; then
1110 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
1111 IF_PROC=if_proc.o
1112 fi
1113 if test -r /proc/net/if_inet6; then
1114 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
1115 IF_PROC=if_proc.o
1116 fi
7ea487bc 1117fi
1118AC_SUBST(IF_PROC)
1119
1120dnl -----------------------------
1121dnl check ipforward detect method
1122dnl -----------------------------
5589ffa7 1123AC_CACHE_CHECK([ipforward method], [quagga_cv_ipforward_method],
ca9f342c
DL
1124[if test x$cross_compiling = xyes; then
1125 if test x"$opsys" = x"gnu-linux"; then
1126 quagga_cv_ipforward_method=/proc/net/snmp
1127 else
1128 quagga_cv_ipforward_method=/dev/ip
1129 fi
1130else
1131 for quagga_cv_ipforward_method in /proc/net/snmp /dev/ip /dev/null;
1132 do
1133 test x`ls $quagga_cv_ipforward_method 2>/dev/null` = x"$quagga_cv_ipforward_method" && break
1134 done
1135fi
5589ffa7
JJ
1136case $quagga_cv_ipforward_method in
1137 "/proc/net/snmp") quagga_cv_ipforward_method="proc";;
7ea487bc 1138 "/dev/ip")
1139 case "$host" in
5589ffa7
JJ
1140 *-nec-sysv4*) quagga_cv_ipforward_method="ews";;
1141 *-freebsd*) quagga_cv_ipforward_method="sysctl";;
1142 *) quagga_cv_ipforward_method="solaris";;
7ea487bc 1143 esac;;
5589ffa7 1144 *) quagga_cv_ipforward_method="sysctl";;
7ea487bc 1145esac])
5589ffa7 1146IPFORWARD=ipforward_${quagga_cv_ipforward_method}.o
7ea487bc 1147AC_SUBST(IPFORWARD)
1148
1149AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
1150
1151dnl ----------
1152dnl IPv6 check
1153dnl ----------
1154AC_MSG_CHECKING(whether does this OS have IPv6 stack)
1155if test "${enable_ipv6}" = "no"; then
1156 AC_MSG_RESULT(disabled)
1157else
1158dnl ----------
1159dnl INRIA IPv6
1160dnl ----------
a159ed93 1161 if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
1162 zebra_cv_ipv6=yes
1163 AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
1164 AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
1165 RIPNGD="ripngd"
1166 OSPF6D="ospf6d"
1167 LIB_IPV6=""
1168 AC_MSG_RESULT(INRIA IPv6)
7ea487bc 1169dnl ---------
1170dnl KAME IPv6
1171dnl ---------
a159ed93 1172 elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
1173 zebra_cv_ipv6=yes
1174 AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
1175 AC_DEFINE(KAME,1,KAME IPv6)
1176 RIPNGD="ripngd"
1177 OSPF6D="ospf6d"
1178 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
7ea487bc 1179 LIB_IPV6="-L/usr/local/v6/lib -linet6"
a159ed93 1180 fi
1181 AC_MSG_RESULT(KAME)
71c0fb50 1182dnl -------------------------
1183dnl MUSICA IPv6
1184dnl default host check
1185dnl It is not used by Kheops
1186dnl -------------------------
a159ed93 1187 elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
1188 zebra_cv_ipv6=yes
1189 AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
1190 AC_DEFINE(MUSICA,1,Musica IPv6 stack)
1191 AC_DEFINE(KAME,1,KAME IPv6 stack)
1192 RIPNGD="ripngd"
1193 OSPF6D="ospf6d"
1194 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
71c0fb50 1195 LIB_IPV6="-L/usr/local/v6/lib -linet6"
a159ed93 1196 fi
1197 AC_MSG_RESULT(MUSICA)
7ea487bc 1198dnl ---------
1199dnl NRL check
1200dnl ---------
a159ed93 1201 elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
1202 zebra_cv_ipv6=yes
1203 AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
1204 AC_DEFINE(NRL,1,NRL)
1205 RIPNGD="ripngd"
1206 OSPF6D="ospf6d"
1207 if test x"$opsys" = x"bsdi";then
7ea487bc 1208 AC_DEFINE(BSDI_NRL,,BSDI)
1209 AC_MSG_RESULT(BSDI_NRL)
a159ed93 1210 else
7ea487bc 1211 AC_MSG_RESULT(NRL)
a159ed93 1212 fi
19877dd2 1213dnl ------------------------------------
1214dnl Solaris 9, 10 and potentially higher
1215dnl ------------------------------------
afd8a129 1216 elif test x"$opsys" = x"sol8"; then
19877dd2 1217 zebra_cv_ipv6=yes;
1218 AC_DEFINE(HAVE_IPV6, 1, IPv6)
1219 AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
1220 RIPNGD="ripngd"
1221 OSPF6D="ospf6d"
1222 AC_MSG_RESULT(Solaris IPv6)
7ea487bc 1223dnl ----------
1224dnl Linux IPv6
1225dnl ----------
a159ed93 1226 elif test "${enable_ipv6}" = "yes"; then
1227 AC_EGREP_CPP(yes, [
1228 #include <linux/version.h>
1229 /* 2.1.128 or later */
1230 #if LINUX_VERSION_CODE >= 0x020180
1231 yes
1232 #endif],
1233 [zebra_cv_ipv6=yes
1234 zebra_cv_linux_ipv6=yes
1235 AC_MSG_RESULT(Linux IPv6)])
1236 else
1237 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
1238 then
7ea487bc 1239 zebra_cv_ipv6=yes
1240 zebra_cv_linux_ipv6=yes
1241 AC_MSG_RESULT(Linux IPv6)
a159ed93 1242 fi
1243 fi
7ea487bc 1244
850d39f3 1245 if test "$zebra_cv_linux_ipv6" = "yes";then
1246 AC_MSG_CHECKING(whether libc has IPv6 support)
1247 AC_TRY_LINK([#include <netinet/in.h>
1248 ],[ int a; a = (int) in6addr_any.s6_addr[0]; if (a != 12345) return a; ],
1249 [AC_MSG_RESULT(yes)
1250 zebra_cv_ipv6=yes
1251 zebra_cv_linux_ipv6=yes],
1252 [AC_MSG_RESULT(no)
1253 zebra_cv_ipv6=no
1254 zebra_cv_linux_ipv6=no])
1255 fi
1256
a159ed93 1257 if test "$zebra_cv_linux_ipv6" = "yes";then
1258 AC_MSG_CHECKING(for GNU libc >= 2.1)
1259 AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
3ef0b877 1260 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
d8dc5257
DS
1261 dnl Linux has a compilation problem with mixing
1262 dnl netinet/in.h and linux/in6.h they are not
1263 dnl compatible. There has been discussion on
1264 dnl how to fix it but no real progress on implementation
1265 dnl when they fix it, remove this
1266 AC_DEFINE(IPV6_MINHOPCOUNT, 73, Linux ipv6 Min Hop Count)
3ef0b877 1267
a159ed93 1268 AC_EGREP_CPP(yes, [
7ea487bc 1269#include <features.h>
1270#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
1271 yes
a159ed93 1272#endif],
1273 [glibc=yes
a159ed93 1274 AC_MSG_RESULT(yes)],
1275 AC_MSG_RESULT(no)
1276 )
1277 RIPNGD="ripngd"
1278 OSPF6D="ospf6d"
1279 if test "$glibc" != "yes"; then
7ea487bc 1280 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
3ef0b877 1281 INCLUDES="-I/usr/inet6/include"
7ea487bc 1282 LIB_IPV6="-L/usr/inet6/lib -linet6"
1283 fi
a159ed93 1284 fi
1285 fi
7ea487bc 1286
1287dnl -----------------------
1288dnl Set IPv6 related values
1289dnl -----------------------
a159ed93 1290 LIBS="$LIB_IPV6 $LIBS"
1291 AC_SUBST(LIB_IPV6)
7ea487bc 1292
a159ed93 1293 if test x"$RIPNGD" = x""; then
1294 AC_MSG_RESULT(IPv4 only)
1295 fi
7ea487bc 1296fi
1297
fa3232e1 1298dnl ------------------
1299dnl IPv6 header checks
1300dnl ------------------
1301if test "x${zebra_cv_ipv6}" = "xyes"; then
1302AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
6f0e3f6e
PJ
1303 netinet6/in6_var.h netinet6/nd6.h], [], [],
1304 QUAGGA_INCLUDES)
fa3232e1 1305fi
1306
6f0e3f6e
PJ
1307m4_define([QUAGGA_INCLUDES],dnl
1308QUAGGA_INCLUDES
1309[#if HAVE_NETINET6_IN6_H
1310#include <netinet6/in6.h>
1311#endif
1312#if HAVE_NETINET_IN6_VAR_H
1313#include <netinet/in6_var.h>
1314#endif
1315#if HAVE_NETINET_ICMP6_H
1316# include <netinet/icmp6.h>
1317#endif
1318#if HAVE_NETINET6_IN6_VAR_H
1319# include <netinet6/in6_var.h>
1320#endif
1321#if HAVE_NETINET6_ND6_H
fbf24544 1322# include <netinet6/nd6.h>
6f0e3f6e
PJ
1323#endif
1324])dnl
1325
cbcd9bfc
JT
1326dnl disable doc check
1327if test "${enable_doc}" = "no";then
1328 DOC=""
1329else
1330 DOC="doc"
1331fi
1332
7ea487bc 1333dnl --------------------
1334dnl Daemon disable check
1335dnl --------------------
1336if test "${enable_zebra}" = "no";then
1337 ZEBRA=""
1338else
1339 ZEBRA="zebra"
1340fi
f027d331 1341AM_CONDITIONAL(ZEBRA, test "x$ZEBRA" = "xzebra")
7ea487bc 1342
1343if test "${enable_bgpd}" = "no";then
1344 BGPD=""
1345else
1346 BGPD="bgpd"
1347fi
f027d331 1348AM_CONDITIONAL(BGPD, test "x$BGPD" = "xbgpd")
7ea487bc 1349
1350if test "${enable_ripd}" = "no";then
1351 RIPD=""
1352else
1353 RIPD="ripd"
1354fi
f027d331 1355AM_CONDITIONAL(RIPD, test "x$RIPD" = "xripd")
7ea487bc 1356
1357if test "${enable_ospfd}" = "no";then
1358 OSPFD=""
1359else
1360 OSPFD="ospfd"
1361fi
f027d331 1362AM_CONDITIONAL(OSPFD, test "x$OSPFD" = "xospfd")
7ea487bc 1363
d0199430 1364if test "${enable_watchquagga}" = "no";then
1365 WATCHQUAGGA=""
1366else
1367 WATCHQUAGGA="watchquagga"
1368fi
f027d331 1369AM_CONDITIONAL(WATCHQUAGGA, test "x$WATCHQUAGGA" = "xwatchquagga")
d0199430 1370
1ef74ef7 1371OSPFCLIENT=""
0d51c7ef 1372if test "${enable_opaque_lsa}" != "no"; then
1ef74ef7 1373 if test "${enable_ospfapi}" != "no";then
9a569848 1374 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
1ef74ef7 1375
1376 if test "${enable_ospfclient}" != "no";then
1377 OSPFCLIENT="ospfclient"
1378 fi
1379 fi
1380
7ea487bc 1381fi
f027d331 1382AM_CONDITIONAL(OSPFCLIENT, test "x$OSPFCLIENT" = "xospfclient")
7ea487bc 1383
1384case "${enable_ripngd}" in
1385 "yes") RIPNGD="ripngd";;
1386 "no" ) RIPNGD="";;
1387 * ) ;;
1388esac
f027d331 1389AM_CONDITIONAL(RIPNGD, test "x$RIPNGD" = "xripngd")
7ea487bc 1390
1391case "${enable_ospf6d}" in
1392 "yes") OSPF6D="ospf6d";;
1393 "no" ) OSPF6D="";;
1394 * ) ;;
1395esac
f027d331 1396AM_CONDITIONAL(OSPF6D, test "x$OSPF6D" = "xospf6d")
7ea487bc 1397
9e867fe6 1398case "${enable_isisd}" in
1399 "yes") ISISD="isisd";;
1400 "no" ) ISISD="";;
ae399ab0 1401 * ) ;;
9e867fe6 1402esac
f027d331 1403AM_CONDITIONAL(ISISD, test "x$ISISD" = "xisisd")
9e867fe6 1404
12e41d03 1405case "${enable_pimd}" in
12e41d03 1406 "no" ) PIMD="";;
f0646db0 1407 * ) PIMD="pimd";;
12e41d03
DL
1408esac
1409AM_CONDITIONAL(PIMD, test "x$PIMD" = "xpimd")
1410
97cee877
GT
1411# XXX Perhaps auto-enable on Solaris, but that's messy for cross builds.
1412case "${enable_solaris}" in
1413 "yes") SOLARIS="solaris";;
1414 "no" ) SOLARIS="";;
1415 * ) ;;
1416esac
1417
7ea487bc 1418if test "${enable_bgp_announce}" = "no";then
750e8146
PJ
1419 AC_DEFINE(DISABLE_BGP_ANNOUNCE,1,Disable BGP installation to zebra)
1420else
1421 AC_DEFINE(DISABLE_BGP_ANNOUNCE,0,Disable BGP installation to zebra)
7ea487bc 1422fi
1423
cbcd9bfc 1424AC_SUBST(DOC)
7ea487bc 1425AC_SUBST(ZEBRA)
1426AC_SUBST(BGPD)
1427AC_SUBST(RIPD)
1428AC_SUBST(RIPNGD)
1429AC_SUBST(OSPFD)
1430AC_SUBST(OSPF6D)
d0199430 1431AC_SUBST(WATCHQUAGGA)
9e867fe6 1432AC_SUBST(ISISD)
12e41d03 1433AC_SUBST(PIMD)
97cee877 1434AC_SUBST(SOLARIS)
7ea487bc 1435AC_SUBST(VTYSH)
1436AC_SUBST(INCLUDES)
1437AC_SUBST(CURSES)
1438AC_SUBST(OSPFCLIENT)
1ef74ef7 1439AC_SUBST(OSPFAPI)
7ea487bc 1440AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
1441AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
1442AC_CHECK_LIB(crypt, crypt)
1443AC_CHECK_LIB(resolv, res_init)
7ea487bc 1444
25f45887
JJ
1445dnl ---------------------------
1446dnl check system has PCRE regexp
1447dnl ---------------------------
1448if test "x$enable_pcreposix" = "xyes"; then
1449 AC_CHECK_LIB(pcreposix, pcreposix_regexec, ,[enable_pcreposix=no
1450 AC_MSG_WARN([*** falling back to other regex library ***]) ])
1451fi
1452
1453if test "x$enable_pcreposix" != "xyes"; then
7ea487bc 1454dnl ---------------------------
1455dnl check system has GNU regexp
1456dnl ---------------------------
25f45887 1457AC_MSG_CHECKING(whether system has GNU regex)
7ea487bc 1458AC_CHECK_LIB(c, regexec,
1459[AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
1460 LIB_REGEX=""],
1461[LIB_REGEX="regex.o"])
25f45887
JJ
1462fi
1463AC_SUBST(HAVE_LIBPCREPOSIX)
7ea487bc 1464AC_SUBST(LIB_REGEX)
1465
1466dnl ------------------
b1fc9acb 1467dnl check Net-SNMP library
7ea487bc 1468dnl ------------------
d6be5fb9 1469if test "${enable_snmp}" != ""; then
08d7f653
VB
1470 AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], [no])
1471 if test x"$NETSNMP_CONFIG" = x"no"; then
1472 AC_MSG_ERROR([--enable-snmp given but unable to find net-snmp-config])
1473 fi
1474 LIBS="$LIBS `${NETSNMP_CONFIG} --agent-libs`"
1475 CFLAGS="`${NETSNMP_CONFIG} --base-cflags` $CFLAGS"
1476 AC_MSG_CHECKING([whether we can link to Net-SNMP])
1477 AC_LINK_IFELSE([AC_LANG_PROGRAM([
1478int main(void);
1479],
1480[
1481{
1482 return 0;
1483}
1484])],[AC_MSG_RESULT(yes)],[
1485 AC_MSG_RESULT(no)
1486 AC_MSG_ERROR([--enable-snmp given but not usable])])
1487 AC_DEFINE(HAVE_SNMP,,SNMP)
d6be5fb9
VB
1488 case "${enable_snmp}" in
1489 yes)
1490 SNMP_METHOD=agentx
1491 ;;
1492 smux|agentx)
1493 SNMP_METHOD="${enable_snmp}"
1494 ;;
1495 *)
1496 AC_MSG_ERROR([--enable-snmp given with an unknown method (${enable_snmp}). Use smux or agentx])
1497 ;;
1498 esac
1499 AH_TEMPLATE([SNMP_SMUX], [Use SNMP SMUX to interface with snmpd])
1500 AH_TEMPLATE([SNMP_AGENTX], [Use SNMP AgentX to interface with snmpd])
1501 AC_DEFINE_UNQUOTED(AS_TR_CPP(SNMP_${SNMP_METHOD}),,SNMP method to interface with snmpd)
6cf9df08 1502fi
1503
7ea487bc 1504dnl ---------------------------
6f0e3f6e 1505dnl sockaddr and netinet checks
7ea487bc 1506dnl ---------------------------
6f0e3f6e
PJ
1507AC_CHECK_TYPES([struct sockaddr, struct sockaddr_in,
1508 struct sockaddr_in6, struct sockaddr_un, struct sockaddr_dl,
12e41d03
DL
1509 socklen_t, struct vifctl, struct mfcctl, struct sioc_sg_req,
1510 vifi_t, struct sioc_vif_req, struct igmpmsg,
6f0e3f6e
PJ
1511 struct ifaliasreq, struct if6_aliasreq, struct in6_aliasreq,
1512 struct nd_opt_adv_interval, struct rt_addrinfo,
11770e10 1513 struct nd_opt_homeagent_info, struct nd_opt_adv_interval],
6f0e3f6e
PJ
1514 [], [], QUAGGA_INCLUDES)
1515
1516AC_CHECK_MEMBERS([struct sockaddr.sa_len,
1517 struct sockaddr_in.sin_len, struct sockaddr_un.sun_len,
1518 struct sockaddr_in6.sin6_scope_id,
ca3ccd87 1519 struct sockaddr_dl.sdl_len,
6f0e3f6e
PJ
1520 struct if6_aliasreq.ifra_lifetime,
1521 struct nd_opt_adv_interval.nd_opt_ai_type],
1522 [], [], QUAGGA_INCLUDES)
29c4c9bd 1523
6f0e3f6e 1524dnl ---------------------------
11770e10 1525dnl IRDP/pktinfo/icmphdr checks
6f0e3f6e
PJ
1526dnl ---------------------------
1527AC_CHECK_TYPES([struct in_pktinfo],
11770e10
PJ
1528 [AC_CHECK_TYPES([struct icmphdr],
1529 [if test "${enable_irdp}" != "no"; then
1530 AC_DEFINE(HAVE_IRDP,, IRDP)
1531 fi],
1532 [if test "${enable_irdp}" = "yes"; then
1533 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1534 fi], [QUAGGA_INCLUDES])],
6f0e3f6e
PJ
1535 [if test "${enable_irdp}" = "yes"; then
1536 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1537 fi], [QUAGGA_INCLUDES])
29c4c9bd 1538
12e41d03
DL
1539dnl -----------------------
1540dnl checking for IP_PKTINFO
1541dnl -----------------------
1542AC_MSG_CHECKING(for IP_PKTINFO)
1543AC_TRY_COMPILE([#include <netdb.h>], [
1544 int opt = IP_PKTINFO;
1545], [
1546 AC_MSG_RESULT(yes)
1547 AC_DEFINE(HAVE_IP_PKTINFO, 1, [Have IP_PKTINFO])
1548], [
1549 AC_MSG_RESULT(no)
1550])
1551
1552dnl ---------------------------
1553dnl checking for IP_RECVDSTADDR
1554dnl ---------------------------
1555AC_MSG_CHECKING(for IP_RECVDSTADDR)
1556AC_TRY_COMPILE([#include <netinet/in.h>], [
1557 int opt = IP_RECVDSTADDR;
1558], [
1559 AC_MSG_RESULT(yes)
1560 AC_DEFINE(HAVE_IP_RECVDSTADDR, 1, [Have IP_RECVDSTADDR])
1561], [
1562 AC_MSG_RESULT(no)
1563])
1564
1565dnl ----------------------
1566dnl checking for IP_RECVIF
1567dnl ----------------------
1568AC_MSG_CHECKING(for IP_RECVIF)
1569AC_TRY_COMPILE([#include <netinet/in.h>], [
1570 int opt = IP_RECVIF;
1571], [
1572 AC_MSG_RESULT(yes)
1573 AC_DEFINE(HAVE_IP_RECVIF, 1, [Have IP_RECVIF])
1574], [
1575 AC_MSG_RESULT(no)
1576])
1577
7ea487bc 1578dnl --------------------------------------
1579dnl checking for getrusage struct and call
1580dnl --------------------------------------
47f6aef0
SH
1581if test "${enable_rusage}" != "no"; then
1582 AC_MSG_CHECKING(whether getrusage is available)
1583 AC_TRY_COMPILE([#include <sys/resource.h>],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
1584 [AC_MSG_RESULT(yes)
1585 AC_DEFINE(HAVE_RUSAGE,,rusage)],
1586 AC_MSG_RESULT(no))
1587fi
7ea487bc 1588
c4376c9d
SH
1589dnl --------------------------------------
1590dnl checking for clock_time monotonic struct and call
1591dnl --------------------------------------
6511cab2
PJ
1592AC_CHECK_DECL(CLOCK_MONOTONIC,
1593 [AC_CHECK_LIB(rt, clock_gettime, [LIBS="$LIBS -lrt"])
9964fcfc 1594 AC_DEFINE(HAVE_CLOCK_MONOTONIC,, Have monotonic clock)
6511cab2 1595], [AC_MSG_RESULT(no)], [QUAGGA_INCLUDES])
c4376c9d 1596
edd7c245 1597dnl -------------------
1598dnl capabilities checks
1599dnl -------------------
41d3fc96 1600if test "${enable_capabilities}" != "no"; then
1601 AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1602 AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1603 [AC_MSG_RESULT(yes)
1604 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1605 quagga_ac_keepcaps="yes"],
1606 AC_MSG_RESULT(no)
edd7c245 1607 )
41d3fc96 1608 if test x"${quagga_ac_keepcaps}" = x"yes"; then
1609 AC_CHECK_HEADERS(sys/capability.h)
1610 fi
1611 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1612 AC_CHECK_LIB(cap, cap_init,
1613 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1614 LIBCAP="-lcap"
ceacedba 1615 quagga_ac_lcaps="yes"]
41d3fc96 1616 )
ceacedba 1617 else
1618 AC_CHECK_HEADERS(priv.h,
1619 [AC_MSG_CHECKING(Solaris style privileges are available)
1620 AC_TRY_COMPILE([#include <priv.h>],[getpflags(PRIV_AWARE);],
1621 [AC_MSG_RESULT(yes)
1622 AC_DEFINE(HAVE_SOLARIS_CAPABILITIES,1,getpflags)
1623 quagga_ac_scaps="yes"],
1624 AC_MSG_RESULT(no)
1625 )
1626 ]
1627 )
1628 fi
1629 if test x"${quagga_ac_scaps}" = x"yes" \
1630 -o x"${quagga_ac_lcaps}" = x"yes"; then
1631 AC_DEFINE(HAVE_CAPABILITIES,1,capabilities)
41d3fc96 1632 fi
edd7c245 1633fi
1634AC_SUBST(LIBCAP)
1635
fb2d1502 1636dnl ---------------------------
1637dnl check for glibc 'backtrace'
1638dnl ---------------------------
8c99b4c1
DL
1639if test x"${enable_backtrace}" != x"no" ; then
1640 backtrace_ok=no
1641 AC_CHECK_HEADER([execinfo.h], [
1642 AC_SEARCH_LIBS([backtrace], [execinfo], [
1643 AC_DEFINE(HAVE_GLIBC_BACKTRACE,,[Glibc backtrace])
1644 AC_DEFINE(HAVE_STACK_TRACE,,[Stack symbol decoding])
1645 backtrace_ok=yes
1646 ],, [-lm])
eda3529e 1647 ])
8c99b4c1
DL
1648
1649 if test x"${enable_backtrace}" = x"yes" -a x"${backtrace_ok}" = x"no"; then
1650 dnl user explicitly requested backtrace but we failed to find support
1651 AC_MSG_FAILURE([failed to find backtrace support])
1652 fi
1653fi
fb2d1502 1654
41be32bf
PJ
1655dnl -----------------------------------------
1656dnl check for malloc mallinfo struct and call
1657dnl this must try and link using LIBS, in
1658dnl order to check no alternative allocator
1659dnl has been specified, which might not provide
1660dnl mallinfo, e.g. such as Umem on Solaris.
1661dnl -----------------------------------------
6f0e3f6e 1662AC_CHECK_HEADER([malloc.h],
41be32bf
PJ
1663 [AC_MSG_CHECKING(whether mallinfo is available)
1664 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
1665 [[struct mallinfo ac_x; ac_x = mallinfo ();]])],
1666 [AC_MSG_RESULT(yes)
1667 AC_DEFINE(HAVE_MALLINFO,,mallinfo)],
1668 AC_MSG_RESULT(no)
1669 )
6f0e3f6e 1670 ], [], QUAGGA_INCLUDES)
41be32bf 1671
408ad943 1672dnl ----------
1673dnl configure date
1674dnl ----------
1675CONFDATE=`date '+%Y%m%d'`
1676AC_SUBST(CONFDATE)
1677
f281ab97
DL
1678dnl -------
1679dnl DejaGNU
1680dnl -------
1681if test x"$DEJAGNU" = x
1682then
1683 DEJAGNU="\$(top_srcdir)/tests/global-conf.exp"
1684fi
1685RUNTESTDEFAULTFLAGS="-x --tool \$\$tool"
1686
1687AC_SUBST(DEJAGNU)
1688AC_SUBST(RUNTESTDEFAULTFLAGS)
1689
7ea487bc 1690dnl ------------------------------
a159ed93 1691dnl set paths for state directory
23bd12c3 1692dnl ------------------------------
e84999d9 1693AC_MSG_CHECKING(directory to use for state file)
23bd12c3 1694if test "${prefix}" = "NONE"; then
e8f2984c 1695 quagga_statedir_prefix="";
23bd12c3 1696else
e8f2984c 1697 quagga_statedir_prefix=${prefix}
23bd12c3 1698fi
1699if test "${localstatedir}" = '${prefix}/var'; then
e84999d9 1700 for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
e8f2984c 1701 ${quagga_statedir_prefix}/var/adm dnl
1702 ${quagga_statedir_prefix}/etc dnl
a159ed93 1703 /var/run dnl
1704 /var/adm dnl
1705 /etc dnl
1706 /dev/null;
23bd12c3 1707 do
e8f2984c 1708 test -d $QUAGGA_STATE_DIR && break
23bd12c3 1709 done
e84999d9 1710 quagga_statedir=$QUAGGA_STATE_DIR
23bd12c3 1711else
e8f2984c 1712 quagga_statedir=${localstatedir}
a159ed93 1713fi
e8f2984c 1714if test $quagga_statedir = "/dev/null"; then
a159ed93 1715 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1716fi
e84999d9
JJ
1717AC_MSG_RESULT(${quagga_statedir})
1718AC_SUBST(quagga_statedir)
a159ed93 1719
e8f2984c 1720AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1721AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1722AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1723AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1724AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1725AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
9e867fe6 1726AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
12e41d03 1727AC_DEFINE_UNQUOTED(PATH_PIMD_PID, "$quagga_statedir/pimd.pid",pimd PID)
d0199430 1728AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
e8f2984c 1729AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1730AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1731AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1732AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1733AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1734AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1735AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
9e867fe6 1736AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
12e41d03 1737AC_DEFINE_UNQUOTED(PIM_VTYSH_PATH, "$quagga_statedir/pimd.vty",pimd vty socket)
515210bd 1738AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
7ea487bc 1739
1eb8ef25 1740dnl -------------------------------
1741dnl Quagga sources should always be
1742dnl current wrt interfaces. Dont
1743dnl allow deprecated interfaces to
1744dnl be exposed.
1745dnl -------------------------------
1746AC_DEFINE(QUAGGA_NO_DEPRECATED_INTERFACES, 1, Hide deprecated interfaces)
1747
7ea487bc 1748dnl ---------------------------
1749dnl Check htonl works correctly
1750dnl ---------------------------
1751AC_MSG_CHECKING(for working htonl)
6f0e3f6e
PJ
1752AC_CACHE_VAL(ac_cv_htonl_works,
1753 [AC_LINK_IFELSE([AC_LANG_PROGRAM([QUAGGA_INCLUDES],[htonl (0);])],
1754 [ac_cv_htonl_works=yes], [ac_cv_htonl_works=no])
1755 ]
1756)
7ea487bc 1757AC_MSG_RESULT($ac_cv_htonl_works)
1758
14c17fd8 1759AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile
d0199430 1760 ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
41d9cc6a 1761 ospf6d/Makefile isisd/Makefile vtysh/Makefile
f281ab97 1762 doc/Makefile ospfclient/Makefile tests/Makefile m4/Makefile
12e41d03 1763 pimd/Makefile
5bb7e4d1 1764 tests/bgpd.tests/Makefile
c69905b6 1765 tests/libzebra.tests/Makefile
f281ab97 1766 redhat/Makefile
69f1fc22 1767 pkgsrc/Makefile
670bbf19 1768 redhat/quagga.spec
b7a97f82 1769 lib/version.h
14c17fd8 1770 doc/defines.texi
f695b01f 1771 isisd/topology/Makefile
cbd04084 1772 pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
f31293af 1773 pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
26275b05 1774AC_CONFIG_FILES([solaris/Makefile])
1775
670bbf19 1776AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
48577196 1777## Hack, but working solution to avoid rebuilding of quagga.info.
1778## It's already in CVS until texinfo 4.7 is more common.
14c17fd8 1779AC_OUTPUT
7ea487bc 1780
1781echo "
c89f6494 1782Quagga configuration
1783--------------------
1784quagga version : ${PACKAGE_VERSION}
1080c13f 1785host operating system : ${host_os}
7ea487bc 1786source code location : ${srcdir}
1787compiler : ${CC}
1788compiler flags : ${CFLAGS}
6f0e3f6e 1789make : ${MAKE-make}
08d7f653 1790includes : ${INCLUDES}
6f0e3f6e 1791linker flags : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM}
e8f2984c 1792state file directory : ${quagga_statedir}
dc7a2bf1 1793config file directory : `eval echo \`echo ${sysconfdir}\``
d6b72f7a 1794example directory : `eval echo \`echo ${exampledir}\``
8d4aee5d 1795user to run as : ${enable_user}
1796group to run as : ${enable_group}
1797group for vty sockets : ${enable_vty_group}
aa593d5e 1798config file mask : ${enable_configfile_mask}
1799log file mask : ${enable_logfile_mask}
dc7a2bf1 1800
1801The above user and group must have read/write access to the state file
105b8239
PJ
1802directory and to the config files in the config file directory."
1803
1804if test x"$quagga_cv_gnu_make" = x"no"; then echo "
1805Warning: The ${MAKE-make} programme detected, either in your path or
1806via the MAKE variable, is not GNU Make. GNU make may be installed as
1807gmake on some systems. and is required to complete a build of Quagga
1808" > /dev/stderr
1809fi