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