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