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