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