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