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