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