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