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