]> git.proxmox.com Git - mirror_frr.git/blame - configure.ac
configure: Auto pick-up the correct json env
[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
80db5ac1
DL
10AC_INIT(Quagga, 0.99.24+cl3u2, [https://bugzilla.quagga.net])
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]))
6b6942f9 323
112072ac
DS
324AC_CHECK_HEADERS(json-c/json.h)
325AC_CHECK_LIB(json-c, json_object_get, LIBS="$LIBS -ljson-c")
326if test $ac_cv_lib_json_c_json_object_get = no; then
327 AC_MSG_ERROR([lib json is needed to compile])
328fi
329
8c99b4c1
DL
330if test x"${enable_gcc_rdynamic}" != x"no" ; then
331 if test x"${enable_gcc_rdynamic}" = x"yes" -o x"$COMPILER" = x"GCC"; then
332 LDFLAGS="${LDFLAGS} -rdynamic"
333 fi
3cade26f 334fi
335
924b9229 336if test x"${enable_time_check}" != x"no" ; then
337 if test x"${enable_time_check}" = x"yes" -o x"${enable_time_check}" = x ; then
338 AC_DEFINE(CONSUMED_TIME_CHECK,5000000,Consumed Time Check)
339 else
340 AC_DEFINE_UNQUOTED(CONSUMED_TIME_CHECK,$enable_time_check,Consumed Time Check)
341 fi
342fi
343
37219958
DS
344case "${enable_systemd}" in
345 "no") ;;
346 "yes")
347 AC_CHECK_LIB(systemd, sd_notify, LIBS="$LIBS -lsystemd")
348 if test $ac_cv_lib_systemd_sd_notify = no; then
349 AC_MSG_ERROR([enable systemd has been specified but systemd development env not found on your system])
350 fi
351 ;;
352 "*") ;;
353esac
ddd82ff6 354
0a95a0d0
DS
355if test "${enable_poll}" = "yes" ; then
356 AC_DEFINE(HAVE_POLL,,Compile systemd support in)
357fi
358
000cf1fb
DS
359if test "${enable_cumulus}" = "yes" ; then
360 AC_DEFINE(HAVE_CUMULUS,,Compile Special Cumulus Code in)
361fi
362
576b6b5d
DS
363if test "${enable_shell_access}" = "yes"; then
364 AC_DEFINE(HAVE_SHELL_ACCESS,,Allow user to use ssh/telnet/bash)
365fi
366
5adc2528
AS
367if test "${enable_fpm}" = "yes"; then
368 AC_DEFINE(HAVE_FPM,,Forwarding Plane Manager support)
369fi
370
7ea487bc 371if test "${enable_tcp_zebra}" = "yes"; then
372 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
373fi
374
36de261b 375if test "${enable_opaque_lsa}" != "no"; then
7ea487bc 376 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
377fi
378
36de261b 379if test "${enable_ospf_te}" != "no"; then
7ea487bc 380 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
381 AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
382fi
383
3453a712
PJ
384if test "${enable_linux24_tcp_md5}" = "yes"; then
385 AC_DEFINE(HAVE_TCP_MD5_LINUX24,,Old Linux 2.4 TCP MD5 Signature Patch)
386fi
387
d2a0ccc6 388AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
389if test "${enable_rtadv}" != "no"; then
71c0fb50 390 AC_MSG_RESULT(yes)
d2a0ccc6 391 AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
2487bea1 392else
393 AC_MSG_RESULT(no)
71c0fb50 394fi
7ea487bc 395
ca776988 396if test "${enable_irdp}" = "yes"; then
397 AC_DEFINE(HAVE_IRDP,, IRDP )
398fi
399
c3a9461e 400if test "${enable_isisd}" != "no" && test "${enable_isis_topology}" = yes; then
f695b01f 401 AC_DEFINE(TOPOLOGY_GENERATE,,Enable IS-IS topology generator code)
ee1ac2d5 402 ISIS_TOPOLOGY_INCLUDES="-I\$(srcdir)/topology"
f695b01f 403 ISIS_TOPOLOGY_DIR="topology"
404 ISIS_TOPOLOGY_LIB="./topology/libtopology.a"
405fi
406
407AC_SUBST(ISIS_TOPOLOGY_INCLUDES)
408AC_SUBST(ISIS_TOPOLOGY_DIR)
409AC_SUBST(ISIS_TOPOLOGY_LIB)
410
79cb2169 411if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
e8f2984c 412 enable_user="quagga"
edd7c245 413elif test "${enable_user}" = "no"; then
414 enable_user="root"
415fi
edd7c245 416
79cb2169 417if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
e8f2984c 418 enable_group="quagga"
edd7c245 419elif test "${enable_group}" = "no"; then
420 enable_group="root"
421fi
edd7c245 422
423if test x"${enable_vty_group}" = x"yes" ; then
8d4aee5d 424 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
79cb2169 425elif test x"${enable_vty_group}" != x""; then
8d4aee5d 426 if test x"${enable_vty_group}" != x"no"; then
edd7c245 427 AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
428 fi
429fi
26275b05 430AC_SUBST([enable_user])
431AC_SUBST([enable_group])
432AC_SUBST([enable_vty_group])
433AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
434AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
edd7c245 435
aa593d5e 436enable_configfile_mask=${enable_configfile_mask:-0600}
437AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
438
439enable_logfile_mask=${enable_logfile_mask:-0600}
440AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
441
7a6da5ba 442MPATH_NUM=1
7ea487bc 443
444case "${enable_multipath}" in
7c5d2b76 445 0)
7a6da5ba 446 MPATH_NUM=64
7c5d2b76 447 ;;
90fb3e13 448 [[1-9]|[1-9][0-9]|[1-9][0-9][0-9]])
7a6da5ba 449 MPATH_NUM="${enable_multipath}"
7ea487bc 450 ;;
451 "")
452 ;;
453 *)
6f0e3f6e 454 AC_MSG_FAILURE([Please specify digit to enable multipath ARG])
7ea487bc 455 ;;
456esac
457
7a6da5ba 458AC_DEFINE_UNQUOTED(MULTIPATH_NUM, $MPATH_NUM, Maximum number of paths for a route)
7ea487bc 459
1080c13f
JN
460dnl -----------------------------------
461dnl Add extra version string to package
462dnl name, string and version fields.
463dnl -----------------------------------
464if test "x${EXTRAVERSION}" != "x" ; then
0be793e6
DL
465 VERSION="${VERSION}${EXTRAVERSION}"
466 PACKAGE_VERSION="${PACKAGE_VERSION}${EXTRAVERSION}"
467 PACKAGE_STRING="${PACKAGE_STRING}${EXTRAVERSION}"
1080c13f
JN
468fi
469
a16dcf7c
DL
470if test "x$with_pkg_git_version" = "xyes"; then
471 if test -d "${srcdir}/.git"; then
472 AC_DEFINE(GIT_VERSION, [1], [include git version info])
473 else with_pkg_git_version="no"
474 AC_MSG_WARN([--with-pkg-git-version given, but this is not a git checkout])
475 fi
476fi
477AM_CONDITIONAL([GIT_VERSION], [test "x$with_pkg_git_version" = "xyes"])
0be793e6 478
6f0e3f6e
PJ
479dnl ------------------------------------
480dnl Check C keywords and standard types
481dnl ------------------------------------
482AC_C_CONST
483AC_C_INLINE
484AC_C_RESTRICT
485AC_C_VOLATILE
dc7a2bf1 486AC_HEADER_STDC
6f0e3f6e
PJ
487AC_HEADER_TIME
488AC_HEADER_SYS_WAIT
63a13864 489AC_HEADER_STDBOOL
6f0e3f6e
PJ
490dnl AC_TYPE_PID_T
491AC_TYPE_UID_T
492AC_TYPE_MODE_T
493AC_TYPE_SIZE_T
6f0e3f6e 494AC_STRUCT_TM
dc7a2bf1 495
6f0e3f6e
PJ
496dnl -------------------------
497dnl Check other header files.
498dnl -------------------------
499AC_CHECK_HEADERS([stropts.h sys/ksym.h sys/times.h sys/select.h \
500 sys/types.h linux/version.h netdb.h asm/types.h \
16ffb26f 501 sys/cdefs.h sys/param.h limits.h signal.h \
6511cab2 502 sys/socket.h netinet/in.h time.h sys/time.h])
6f0e3f6e
PJ
503
504dnl Utility macro to avoid retyping includes all the time
505m4_define([QUAGGA_INCLUDES],
506[#ifdef SUNOS_5
507#define _XPG4_2
508#define __EXTENSIONS__
509#endif
510#include <stdio.h>
511#if STDC_HEADERS
512# include <stdlib.h>
513# include <stddef.h>
514#else
515# if HAVE_STDLIB_H
516# include <stdlib.h>
517# endif
518#endif
519#if HAVE_SYS_TYPES_H
520# include <sys/types.h>
521#endif
522/* sys/conf.h depends on param.h on FBSD at least */
523#if HAVE_SYS_PARAM_H
524# include <sys/param.h>
525#endif
526/* Required for MAXSIG */
527#if HAVE_SIGNAL_H
528# include <signal.h>
529#endif
530#if HAVE_SYS_SOCKET_H
531# include <sys/socket.h>
532#endif
ea057677
HT
533#ifdef __APPLE__
534# define __APPLE_USE_RFC_3542
535#endif
6f0e3f6e
PJ
536#if HAVE_NETINET_IN_H
537# include <netinet/in.h>
538#endif
6511cab2
PJ
539#ifdef TIME_WITH_SYS_TIME
540# include <sys/time.h>
541# include <time.h>
542#else
543# ifdef HAVE_SYS_TIME_H
544# include <sys/time.h>
545# else
546# include <time.h>
547# endif
548#endif /* TIME_WITH_SYS_TIME */
6f0e3f6e
PJ
549])dnl
550
2b43bf23
DO
551dnl HAVE_NET_IF_H must be discovered by the time the longer AC_CHECK_HEADERS
552dnl round below execution begins, otherwise it doesn't properly detect
553dnl HAVE_NETINET6_IN6_VAR_H, HAVE_NET_IF_VAR_H and HAVE_STRUCT_IN6_ALIASREQ
554dnl on FreeBSD (BZ#408).
555
556AC_CHECK_HEADERS([net/if.h], [], [], QUAGGA_INCLUDES)
557
558m4_define([QUAGGA_INCLUDES],
559QUAGGA_INCLUDES
560[#if HAVE_NET_IF_H
561# include <net/if.h>
562#endif
563])dnl
564
565dnl Same applies for HAVE_NET_IF_VAR_H, which HAVE_NETINET6_ND6_H and
566dnl HAVE_NETINET_IN_VAR_H depend upon. But if_var.h depends on if.h, hence
567dnl an additional round for it.
568
569AC_CHECK_HEADERS([net/if_var.h], [], [], QUAGGA_INCLUDES)
570
571m4_define([QUAGGA_INCLUDES],
572QUAGGA_INCLUDES
573[#if HAVE_NET_IF_VAR_H
574# include <net/if_var.h>
575#endif
576])dnl
577
578AC_CHECK_HEADERS([sys/un.h netinet/in_systm.h netinet/in_var.h \
579 net/if_dl.h net/netopt.h net/route.h \
11770e10 580 inet/nd.h arpa/inet.h netinet/ip_icmp.h \
6f0e3f6e
PJ
581 fcntl.h stddef.h sys/ioctl.h syslog.h wchar.h wctype.h \
582 sys/sysctl.h sys/sockio.h kvm.h sys/conf.h],
583 [], [], QUAGGA_INCLUDES)
584
585AC_CHECK_HEADERS([ucontext.h], [], [],
586[#ifndef __USE_GNU
587#define __USE_GNU
588#endif /* __USE_GNU */
589QUAGGA_INCLUDES
590])
591
bccbd141
JT
592m4_define([UCONTEXT_INCLUDES],
593[#include <ucontext.h>])dnl
594
595AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.uc_regs],
596 [], [], [UCONTEXT_INCLUDES])
597AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.regs],
598 [AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.regs.nip],
599 [], [], [UCONTEXT_INCLUDES])],
600 [], [UCONTEXT_INCLUDES])
601AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.gregs],
602 [], [], [UCONTEXT_INCLUDES])
603
6f0e3f6e
PJ
604m4_define([QUAGGA_INCLUDES],
605QUAGGA_INCLUDES
2b43bf23 606[#if HAVE_SYS_UN_H
6f0e3f6e
PJ
607# include <sys/un.h>
608#endif
609#if HAVE_NETINET_IN_SYSTM_H
610# include <netinet/in_systm.h>
611#endif
612#if HAVE_NETINET_IN_VAR_H
613# include <netinet/in_var.h>
614#endif
615#if HAVE_NET_IF_DL_H
616# include <net/if_dl.h>
617#endif
6f0e3f6e
PJ
618#if HAVE_NET_NETOPT_H
619# include <net/netopt.h>
620#endif
621#if HAVE_NET_ROUTE_H
622# include <net/route.h>
623#endif
624#if HAVE_INET_ND_H
625# include <inet/nd.h>
626#endif
627#if HAVE_ARPA_INET_H
628# include <arpa/inet.h>
629#endif
11770e10
PJ
630/* Required for IDRP */
631#if HAVE_NETINET_IP_ICMP_H
632# include <netinet/ip_icmp.h>
633#endif
6f0e3f6e 634])dnl
dc7a2bf1 635
fa3232e1 636dnl V6 headers are checked below, after we check for v6
7ea487bc 637
7ea487bc 638dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
639case "$host" in
afd8a129 640 [*-sunos5.[6-7]*] | [*-solaris2.[6-7]*])
7ea487bc 641 opsys=sol2-6
afd8a129 642 AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.7)
19877dd2 643 AC_DEFINE(SUNOS_5, 1, SunOS 5)
7ea487bc 644 AC_CHECK_LIB(xnet, main)
645 CURSES=-lcurses
a77d2023 646 SOLARIS="solaris"
7ea487bc 647 ;;
1b73de8b 648 [*-sunos5.[8-9]] \
649 | [*-sunos5.1[0-9]] \
650 | [*-sunos5.1[0-9].[0-9]] \
651 | [*-solaris2.[8-9]] \
652 | [*-solaris2.1[0-9]] \
653 | [*-solaris2.1[0-9].[0-9]])
afd8a129 654 opsys=sol8
fb66b29c
PJ
655 AC_DEFINE(SUNOS_59, 1, [SunOS 5.8 up])
656 AC_DEFINE(SUNOS_5, 1, [SunOS 5])
19877dd2 657 AC_CHECK_LIB(socket, main)
658 AC_CHECK_LIB(nsl, main)
1b73de8b 659 AC_CHECK_LIB(umem, main)
fb66b29c
PJ
660 AC_CHECK_FUNCS([printstack],
661 [AC_DEFINE([HAVE_PRINTSTACK],1,[Solaris printstack])
662 AC_DEFINE([HAVE_STACK_TRACE],1,[Stack symbols decode functionality])
663 ])
19877dd2 664 CURSES=-lcurses
a77d2023 665 SOLARIS="solaris"
19877dd2 666 ;;
7ea487bc 667 *-sunos5* | *-solaris2*)
19877dd2 668 AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
7ea487bc 669 AC_CHECK_LIB(socket, main)
670 AC_CHECK_LIB(nsl, main)
671 CURSES=-lcurses
a77d2023 672 SOLARIS="solaris"
7ea487bc 673 ;;
c45eb839 674 *-linux*)
7ea487bc 675 opsys=gnu-linux
676 AC_DEFINE(GNU_LINUX,,GNU Linux)
677 ;;
7ea487bc 678 *-openbsd*)
679 opsys=openbsd
680 AC_DEFINE(OPEN_BSD,,OpenBSD)
681 ;;
7ea487bc 682esac
683
62c9f504
PJ
684AC_SYS_LARGEFILE
685
7ea487bc 686dnl ---------------------
687dnl Integrated VTY option
688dnl ---------------------
689case "${enable_vtysh}" in
f0646db0
DS
690 "no") VTYSH="";;
691 *) VTYSH="vtysh";
7ea487bc 692 AC_DEFINE(VTYSH,,VTY shell)
fc9d0745 693dnl Vtysh uses libreadline, which looks for termcap functions at
6f0e3f6e 694dnl configure time. We follow readlines search order.
fc9d0745 695dnl The required procedures are in libtermcap on NetBSD, in
696dnl [TODO] on Linux, and in [TODO] on Solaris.
c0689394 697 AC_CHECK_LIB(termcap, tputs, LIBREADLINE="$LIBREADLINE -ltermcap",
a969459c 698 [AC_CHECK_LIB(tinfo, tputs, LIBREADLINE="$LIBREADLINE -ltinfo",
699 [AC_CHECK_LIB(curses, tputs, LIBREADLINE="$LIBREADLINE -lcurses",
700 [AC_CHECK_LIB(ncurses, tputs,
701 LIBREADLINE="$LIBREADLINE -lncurses")]
702 )]
703 )]
704 )
705 AC_CHECK_LIB(readline, main, LIBREADLINE="$LIBREADLINE -lreadline",,
706 "$LIBREADLINE")
7ea487bc 707 if test $ac_cv_lib_readline_main = no; then
fc9d0745 708 AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
7ea487bc 709 fi
710 AC_CHECK_HEADER(readline/history.h)
711 if test $ac_cv_header_readline_history_h = no;then
712 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
713 fi
a969459c 714 AC_CHECK_LIB(readline, rl_completion_matches,
715 LIBREADLINE="$LIBREADLINE",, "$LIBREADLINE")
3d3de8c4 716 if test $ac_cv_lib_readline_rl_completion_matches = no; then
717 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
718 fi
719 ;;
7ea487bc 720esac
c0689394 721AC_SUBST(LIBREADLINE)
f027d331 722AM_CONDITIONAL(VTYSH, test "x$VTYSH" = "xvtysh")
7ea487bc 723
724dnl ----------
725dnl PAM module
6159928d
DO
726dnl
727dnl Quagga detects the PAM library it is built against by checking for a
728dnl functional pam_misc.h (Linux-PAM) or openpam.h (OpenPAM) header. pam_misc.h
729dnl is known to #include pam_appl.h, the standard header of a PAM library, and
730dnl openpam.h doesn't do that, although depends on the header too. Hence a
731dnl little assistance to AC_CHECK_HEADER is necessary for the proper detection
732dnl of OpenPAM.
7ea487bc 733dnl ----------
24cd435b 734if test "$with_libpam" = "yes"; then
6f0e3f6e
PJ
735 AC_CHECK_HEADER([security/pam_misc.h],
736 [AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
737 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
738 pam_conv_func="misc_conv"
739 ],
740 [], QUAGGA_INCLUDES)
741 AC_CHECK_HEADER([security/openpam.h],
742 [AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
743 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
744 pam_conv_func="openpam_ttyconv"
745 ],
6159928d 746 [], QUAGGA_INCLUDES[#include <security/pam_appl.h>])
24cd435b 747 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
748 AC_MSG_WARN([*** pam support will not be built ***])
749 with_libpam="no"
750 fi
751fi
752
7ea487bc 753if test "$with_libpam" = "yes"; then
6f0e3f6e 754dnl took this test from proftpds configure.in and suited to our needs
7ea487bc 755dnl -------------------------------------------------------------------------
756dnl
757dnl This next check looks funky due to a linker problem with some versions
758dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
759dnl omitted requiring libdl linking information. PAM-0.72 or better ships
760dnl with RedHat 6.2 and Debian 2.2 or better.
761AC_CHECK_LIB(pam, pam_start,
24cd435b 762 [AC_CHECK_LIB(pam, $pam_conv_func,
7ea487bc 763 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
764 LIBPAM="-lpam"],
765 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
766 LIBPAM="-lpam -lpam_misc"]
767 )
768 ],
769
770 [AC_CHECK_LIB(pam, pam_end,
24cd435b 771 [AC_CHECK_LIB(pam, $pam_conv_func,
a159ed93 772 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
7ea487bc 773 LIBPAM="-lpam -ldl"],
a159ed93 774 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
7ea487bc 775 LIBPAM="-lpam -ldl -lpam_misc"]
776 )
777 ],AC_MSG_WARN([*** pam support will not be built ***]),
778 [-ldl])
779 ]
780)
781fi
782AC_SUBST(LIBPAM)
783
784dnl -------------------------------
785dnl Endian-ness check
786dnl -------------------------------
787AC_WORDS_BIGENDIAN
788
789dnl -------------------------------
790dnl check the size in byte of the C
791dnl -------------------------------
792dnl AC_CHECK_SIZEOF(char)
793dnl AC_CHECK_SIZEOF(int)
794dnl AC_CHECK_SIZEOF(short)
795dnl AC_CHECK_SIZEOF(long)
796
797dnl ----------------------------
798dnl check existance of functions
799dnl ----------------------------
6f0e3f6e
PJ
800AC_FUNC_CHOWN
801AC_FUNC_FNMATCH
802AC_FUNC_FORK
6f0e3f6e
PJ
803AC_FUNC_MEMCMP
804AC_FUNC_MKTIME
805AC_FUNC_STRFTIME
6f0e3f6e
PJ
806AC_FUNC_STAT
807AC_FUNC_SELECT_ARGTYPES
808AC_FUNC_STRFTIME
d46d2a24
PJ
809dnl Avoid AC_FUNC_STRNLEN because it pulls in AC_SYSTEM_EXTENSIONS which
810dnl can lead to strange side effects. So we just check for strnlen
811dnl directly, see below.
2b5cb411 812dnl AC_FUNC_STRNLENdnl
6f0e3f6e
PJ
813AC_FUNC_VPRINTF
814
815dnl -------------------------------
816dnl bgpd needs pow() and hence libm
817dnl -------------------------------
818TMPLIBS="$LIBS"
819AC_CHECK_HEADER([math.h],
820 [AC_CHECK_LIB([m], [pow],
821 [LIBM="-lm"
822 LIBS="$LIBS $LIBM"
823 AC_DEFINE(HAVE_LIBM,, Have libm)
824 AC_CHECK_FUNCS(pow,[],[LIBM=""])
825 ])
826])
827if test x"$LIBM" = x ; then
828 AC_MSG_WARN([Unable to find working pow function - bgpd may not link])
829fi
830LIBS="$TMPLIBS"
831AC_SUBST(LIBM)
832
833dnl ---------------
834dnl other functions
835dnl ---------------
836AC_CHECK_FUNCS([dup2 ftruncate getcwd gethostbyname getpagesize gettimeofday \
d46d2a24 837 inet_ntoa inet_aton strnlen \
6f0e3f6e
PJ
838 memchr memmove memset select socket \
839 strcasecmp strchr strcspn strdup strerror \
840 strncasecmp strndup strrchr strspn strstr \
841 strtol strtoul strlcat strlcpy \
842 daemon snprintf vsnprintf \
843 if_nametoindex if_indextoname getifaddrs \
4a9ea50e 844 uname fcntl getgrouplist])
6f0e3f6e 845
7ea487bc 846dnl ------------------------------------
847dnl Determine routing get and set method
848dnl ------------------------------------
849AC_MSG_CHECKING(zebra between kernel interface method)
850if test x"$opsys" = x"gnu-linux"; then
35c4bf71
DL
851 AC_MSG_RESULT(netlink)
852 RT_METHOD=rt_netlink.o
853 AC_DEFINE(HAVE_NETLINK,,netlink)
854 netlink=yes
855 AC_CHECK_DECLS([IFLA_INFO_SLAVE_KIND], [], [], [#include <linux/if_link.h>])
865730ab 856else
19877dd2 857 AC_MSG_RESULT(Route socket)
858 KERNEL_METHOD="kernel_socket.o"
859 RT_METHOD="rt_socket.o"
7ea487bc 860fi
861AC_SUBST(RT_METHOD)
862AC_SUBST(KERNEL_METHOD)
5adc2528 863AM_CONDITIONAL([HAVE_NETLINK], [test "x$netlink" = "xyes"])
7ea487bc 864
238497fc
PJ
865dnl --------------------------
866dnl Determine IS-IS I/O method
867dnl --------------------------
745bf05f
DL
868AC_DEFINE(ISIS_METHOD_PFPACKET, 1, [ constant value for isis method pfpacket ])
869AC_DEFINE(ISIS_METHOD_DLPI, 2, [ constant value for isis method dlpi ])
870AC_DEFINE(ISIS_METHOD_BPF, 3, [ constant value for isis method bpf ])
238497fc
PJ
871AC_CHECK_HEADER(net/bpf.h)
872AC_CHECK_HEADER(sys/dlpi.h)
873AC_MSG_CHECKING(zebra IS-IS I/O method)
874if test x"$opsys" = x"gnu-linux"; then
875 AC_MSG_RESULT(pfpacket)
745bf05f 876 ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET"
238497fc
PJ
877elif test x"$opsys" = x"sol2-6" -o x"$opsys" = x"sol8"; then
878 AC_MSG_RESULT(DLPI)
745bf05f 879 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
238497fc
PJ
880else
881 if test $ac_cv_header_net_bpf_h = no; then
882 if test $ac_cv_header_sys_dlpi_h = no; then
883 AC_MSG_RESULT(none)
884 AC_MSG_WARN([*** IS-IS support will not be built ***])
885 ISISD=""
886 else
887 AC_MSG_RESULT(DLPI)
888 fi
745bf05f 889 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
238497fc
PJ
890 else
891 AC_MSG_RESULT(BPF)
745bf05f 892 ISIS_METHOD_MACRO="ISIS_METHOD_BPF"
238497fc
PJ
893 fi
894fi
745bf05f 895AC_DEFINE_UNQUOTED(ISIS_METHOD, $ISIS_METHOD_MACRO, [ selected method for isis, == one of the constants ])
238497fc 896
b99760ab 897dnl ------------------------------------
898dnl check for broken CMSG_FIRSTHDR macro
899dnl ------------------------------------
6c20046f 900AC_MSG_CHECKING(for broken CMSG_FIRSTHDR)
5b087528 901AC_RUN_IFELSE([AC_LANG_SOURCE([[
b99760ab 902#ifdef SUNOS_5
903#define _XPG4_2
904#define __EXTENSIONS__
905#endif
6f0e3f6e
PJ
906#ifdef HAVE_STDLIB_H
907# include <stdlib.h>
908#endif
909#ifdef HAVE_SYS_TYPES_H
b99760ab 910#include <sys/types.h>
6f0e3f6e
PJ
911#endif
912#ifdef HAVE_SYS_SOCKET_H
b99760ab 913#include <sys/socket.h>
6f0e3f6e 914#endif
b99760ab 915
916main()
917{
918 struct msghdr msg;
919 char buf[4];
920
921 msg.msg_control = buf;
922 msg.msg_controllen = 0;
923
924 if (CMSG_FIRSTHDR(&msg) != NULL)
925 exit(0);
926 exit (1);
5b087528 927}]])],[AC_MSG_RESULT(yes - using workaround) AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)],
d33e8d7b 928[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
b99760ab 929
7ea487bc 930dnl ------------------------------
931dnl check kernel route read method
932dnl ------------------------------
5589ffa7
JJ
933AC_CACHE_CHECK([route read method], [quagga_cv_rtread_method],
934[if test "x$netlink" = xyes; then
935 quagga_cv_rtread_method="netlink"
7ea487bc 936else
35c4bf71 937for quagga_cv_rtread_method in /dev/ip /dev/null;
7ea487bc 938do
5589ffa7 939 test x`ls $quagga_cv_rtread_method 2>/dev/null` = x"$quagga_cv_rtread_method" && break
7ea487bc 940done
5589ffa7 941case $quagga_cv_rtread_method in
9c30ab6b 942 "/dev/ip")
943 case "$host" in
5589ffa7
JJ
944 *-freebsd*) quagga_cv_rtread_method="sysctl";;
945 *) quagga_cv_rtread_method="getmsg";;
9c30ab6b 946 esac;;
5589ffa7
JJ
947 *)
948 quagga_cv_rtread_method="sysctl";;
7ea487bc 949esac
950fi])
5589ffa7 951RTREAD_METHOD=rtread_${quagga_cv_rtread_method}.o
7ea487bc 952AC_SUBST(RTREAD_METHOD)
953
954dnl -----------------------------
955dnl check interface lookup method
956dnl -----------------------------
19877dd2 957IOCTL_METHOD=ioctl.o
7ea487bc 958AC_MSG_CHECKING(interface looking up method)
959if test "$netlink" = yes; then
960 AC_MSG_RESULT(netlink)
961 IF_METHOD=if_netlink.o
19877dd2 962elif test "$opsys" = "sol2-6";then
963 AC_MSG_RESULT(Solaris GIF)
964 IF_METHOD=if_ioctl.o
afd8a129 965elif test "$opsys" = "sol8";then
19877dd2 966 AC_MSG_RESULT(Solaris GLIF)
967 IF_METHOD=if_ioctl_solaris.o
968 IOCTL_METHOD=ioctl_solaris.o
19877dd2 969elif test "$opsys" = "openbsd";then
970 AC_MSG_RESULT(openbsd)
971 IF_METHOD=if_ioctl.o
972elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
973 AC_MSG_RESULT(sysctl)
7ea487bc 974 IF_METHOD=if_sysctl.o
975 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
19877dd2 976else
7ea487bc 977 AC_MSG_RESULT(ioctl)
978 IF_METHOD=if_ioctl.o
7ea487bc 979fi
980AC_SUBST(IF_METHOD)
19877dd2 981AC_SUBST(IOCTL_METHOD)
7ea487bc 982
42c98199 983dnl ---------------------------------------------------------------
984dnl figure out how to specify an interface in multicast sockets API
985dnl ---------------------------------------------------------------
6f0e3f6e 986AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], [], QUAGGA_INCLUDES)
42c98199 987
a724477d
DS
988AC_CHECK_HEADERS([linux/mroute.h], [], [],
989[
990#if HAVE_NETINET_IN_H
991#include<netinet/in.h>
992#endif])
42c98199 993AC_MSG_CHECKING([for BSD struct ip_mreq hack])
994AC_TRY_COMPILE([#ifdef HAVE_SYS_PARAM_H
995#include <sys/param.h>
373ba5cd 996#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 997 return (0);
998#else
999 #error No support for BSD struct ip_mreq hack detected
1000#endif],[AC_MSG_RESULT(yes)
1001AC_DEFINE(HAVE_BSD_STRUCT_IP_MREQ_HACK,,[Can pass ifindex in struct ip_mreq])],
1002AC_MSG_RESULT(no))
1003
10d04cdb
DT
1004AC_MSG_CHECKING([for RFC3678 protocol-independed API])
1005AC_TRY_COMPILE([
1006#include <sys/types.h>
1007#include <netinet/in.h>
1008], [struct group_req gr; int sock; setsockopt(sock, IPPROTO_IP, MCAST_JOIN_GROUP, (void*)&gr, sizeof(gr));
1009], [AC_MSG_RESULT(yes)
1010AC_DEFINE(HAVE_RFC3678,1,[Have RFC3678 protocol-independed API])],
1011AC_MSG_RESULT(no))
1012
c543a173
AS
1013dnl ---------------------------------------------------------------
1014dnl figure out how to check link-state
1015dnl ---------------------------------------------------------------
6418bedf
AS
1016AC_CHECK_HEADER([net/if.h],
1017 [AC_CHECK_HEADER( [net/if_media.h],
1018 [m4_define([LINK_DETECT_INCLUDES],
1019 QUAGGA_INCLUDES
1020 [#include <net/if_media.h>
1021 ])
1022 AC_CHECK_MEMBERS( [struct ifmediareq.ifm_status],
1023 AC_DEFINE(HAVE_BSD_LINK_DETECT,,[BSD link-detect]),
1024 [], LINK_DETECT_INCLUDES)],
1025 [],
1026 QUAGGA_INCLUDES)],
1027 [], QUAGGA_INCLUDES )
c543a173 1028
9234b382
DV
1029dnl ---------------------------------------------------------------
1030dnl Additional, newer way to check link-state using ifi_link_state.
1031dnl Not available in all BSD's when ifmediareq available
1032dnl ---------------------------------------------------------------
1033AC_CHECK_HEADER([net/if.h],
1034 AC_CHECK_MEMBERS([struct if_data.ifi_link_state],
1035 AC_DEFINE(HAVE_BSD_IFI_LINK_STATE,,[BSD ifi_link_state available]),
1036 [], QUAGGA_INCLUDES),
1037 ,)
1038
0df7c91f
PJ
1039dnl ------------------------
1040dnl TCP_MD5SIG socket option
1041dnl ------------------------
1042
1043AC_CHECK_HEADER([netinet/tcp.h],
1044 [m4_define([MD5_INCLUDES],
1045 QUAGGA_INCLUDES
1046 [#include <netinet/tcp.h>
1047 ])
1048 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)],
1049 [],
1050 QUAGGA_INCLUDES)
1051if test $ac_cv_have_decl_TCP_MD5SIG = no; then
1052 AC_CHECK_HEADER([linux/tcp.h],
1053 [m4_define([MD5_INCLUDES],
1054 QUAGGA_INCLUDES
1055 [#include <linux/tcp.h>
1056 ])
1057 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)])
1058fi
1059
7ea487bc 1060dnl -----------------------------
1061dnl check ipforward detect method
1062dnl -----------------------------
5589ffa7 1063AC_CACHE_CHECK([ipforward method], [quagga_cv_ipforward_method],
ca9f342c
DL
1064[if test x$cross_compiling = xyes; then
1065 if test x"$opsys" = x"gnu-linux"; then
1066 quagga_cv_ipforward_method=/proc/net/snmp
1067 else
1068 quagga_cv_ipforward_method=/dev/ip
1069 fi
1070else
1071 for quagga_cv_ipforward_method in /proc/net/snmp /dev/ip /dev/null;
1072 do
1073 test x`ls $quagga_cv_ipforward_method 2>/dev/null` = x"$quagga_cv_ipforward_method" && break
1074 done
1075fi
5589ffa7
JJ
1076case $quagga_cv_ipforward_method in
1077 "/proc/net/snmp") quagga_cv_ipforward_method="proc";;
7ea487bc 1078 "/dev/ip")
1079 case "$host" in
5589ffa7
JJ
1080 *-freebsd*) quagga_cv_ipforward_method="sysctl";;
1081 *) quagga_cv_ipforward_method="solaris";;
7ea487bc 1082 esac;;
5589ffa7 1083 *) quagga_cv_ipforward_method="sysctl";;
7ea487bc 1084esac])
5589ffa7 1085IPFORWARD=ipforward_${quagga_cv_ipforward_method}.o
7ea487bc 1086AC_SUBST(IPFORWARD)
1087
1088AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
1089
1090dnl ----------
1091dnl IPv6 check
1092dnl ----------
1093AC_MSG_CHECKING(whether does this OS have IPv6 stack)
7ea487bc 1094dnl ---------
1095dnl KAME IPv6
1096dnl ---------
1cbb5dfc 1097 if grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
a159ed93 1098 AC_DEFINE(KAME,1,KAME IPv6)
a159ed93 1099 AC_MSG_RESULT(KAME)
19877dd2 1100dnl ------------------------------------
1101dnl Solaris 9, 10 and potentially higher
1102dnl ------------------------------------
afd8a129 1103 elif test x"$opsys" = x"sol8"; then
19877dd2 1104 AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
19877dd2 1105 AC_MSG_RESULT(Solaris IPv6)
7ea487bc 1106dnl ----------
1107dnl Linux IPv6
1108dnl ----------
42bb3dfd 1109 elif test x"$opsys" = x"gnu-linux"; then
3ef0b877 1110 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
d8dc5257
DS
1111 dnl Linux has a compilation problem with mixing
1112 dnl netinet/in.h and linux/in6.h they are not
1113 dnl compatible. There has been discussion on
1114 dnl how to fix it but no real progress on implementation
1115 dnl when they fix it, remove this
1116 AC_DEFINE(IPV6_MINHOPCOUNT, 73, Linux ipv6 Min Hop Count)
42bb3dfd
DL
1117 AC_MSG_RESULT(Linux IPv6)
1118 else
80ec006d 1119 AC_MSG_ERROR([Failed to detect IPv6 stack])
a159ed93 1120 fi
7ea487bc 1121
80ec006d
DL
1122dnl this is unconditial, for compatibility
1123AC_DEFINE(HAVE_IPV6,1,IPv6)
7ea487bc 1124
fa3232e1 1125dnl ------------------
1126dnl IPv6 header checks
1127dnl ------------------
fa3232e1 1128AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
6f0e3f6e
PJ
1129 netinet6/in6_var.h netinet6/nd6.h], [], [],
1130 QUAGGA_INCLUDES)
fa3232e1 1131
6f0e3f6e
PJ
1132m4_define([QUAGGA_INCLUDES],dnl
1133QUAGGA_INCLUDES
1134[#if HAVE_NETINET6_IN6_H
1135#include <netinet6/in6.h>
1136#endif
1137#if HAVE_NETINET_IN6_VAR_H
1138#include <netinet/in6_var.h>
1139#endif
1140#if HAVE_NETINET_ICMP6_H
1141# include <netinet/icmp6.h>
1142#endif
1143#if HAVE_NETINET6_IN6_VAR_H
1144# include <netinet6/in6_var.h>
1145#endif
1146#if HAVE_NETINET6_ND6_H
fbf24544 1147# include <netinet6/nd6.h>
6f0e3f6e
PJ
1148#endif
1149])dnl
1150
cbcd9bfc
JT
1151dnl disable doc check
1152if test "${enable_doc}" = "no";then
1153 DOC=""
1154else
1155 DOC="doc"
1156fi
1157
7ea487bc 1158dnl --------------------
1159dnl Daemon disable check
1160dnl --------------------
1161if test "${enable_zebra}" = "no";then
1162 ZEBRA=""
1163else
1164 ZEBRA="zebra"
1165fi
f027d331 1166AM_CONDITIONAL(ZEBRA, test "x$ZEBRA" = "xzebra")
7ea487bc 1167
1168if test "${enable_bgpd}" = "no";then
1169 BGPD=""
1170else
1171 BGPD="bgpd"
1172fi
f027d331 1173AM_CONDITIONAL(BGPD, test "x$BGPD" = "xbgpd")
7ea487bc 1174
1175if test "${enable_ripd}" = "no";then
1176 RIPD=""
1177else
1178 RIPD="ripd"
1179fi
f027d331 1180AM_CONDITIONAL(RIPD, test "x$RIPD" = "xripd")
7ea487bc 1181
1182if test "${enable_ospfd}" = "no";then
1183 OSPFD=""
1184else
1185 OSPFD="ospfd"
1186fi
f027d331 1187AM_CONDITIONAL(OSPFD, test "x$OSPFD" = "xospfd")
7ea487bc 1188
d0199430 1189if test "${enable_watchquagga}" = "no";then
1190 WATCHQUAGGA=""
1191else
1192 WATCHQUAGGA="watchquagga"
1193fi
f027d331 1194AM_CONDITIONAL(WATCHQUAGGA, test "x$WATCHQUAGGA" = "xwatchquagga")
d0199430 1195
1ef74ef7 1196OSPFCLIENT=""
0d51c7ef 1197if test "${enable_opaque_lsa}" != "no"; then
1ef74ef7 1198 if test "${enable_ospfapi}" != "no";then
9a569848 1199 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
1ef74ef7 1200
1201 if test "${enable_ospfclient}" != "no";then
1202 OSPFCLIENT="ospfclient"
1203 fi
1204 fi
1205
7ea487bc 1206fi
f027d331 1207AM_CONDITIONAL(OSPFCLIENT, test "x$OSPFCLIENT" = "xospfclient")
7ea487bc 1208
1209case "${enable_ripngd}" in
7ea487bc 1210 "no" ) RIPNGD="";;
80ec006d 1211 * ) RIPNGD="ripngd";;
7ea487bc 1212esac
f027d331 1213AM_CONDITIONAL(RIPNGD, test "x$RIPNGD" = "xripngd")
7ea487bc 1214
1215case "${enable_ospf6d}" in
7ea487bc 1216 "no" ) OSPF6D="";;
80ec006d 1217 * ) OSPF6D="ospf6d";;
7ea487bc 1218esac
f027d331 1219AM_CONDITIONAL(OSPF6D, test "x$OSPF6D" = "xospf6d")
7ea487bc 1220
9e867fe6 1221case "${enable_isisd}" in
9e867fe6 1222 "no" ) ISISD="";;
c3a9461e 1223 * ) ISISD="isisd";;
9e867fe6 1224esac
f027d331 1225AM_CONDITIONAL(ISISD, test "x$ISISD" = "xisisd")
9e867fe6 1226
12e41d03 1227case "${enable_pimd}" in
12e41d03 1228 "no" ) PIMD="";;
f0646db0 1229 * ) PIMD="pimd";;
12e41d03
DL
1230esac
1231AM_CONDITIONAL(PIMD, test "x$PIMD" = "xpimd")
1232
7ea487bc 1233if test "${enable_bgp_announce}" = "no";then
750e8146
PJ
1234 AC_DEFINE(DISABLE_BGP_ANNOUNCE,1,Disable BGP installation to zebra)
1235else
1236 AC_DEFINE(DISABLE_BGP_ANNOUNCE,0,Disable BGP installation to zebra)
7ea487bc 1237fi
1238
cbcd9bfc 1239AC_SUBST(DOC)
7ea487bc 1240AC_SUBST(ZEBRA)
1241AC_SUBST(BGPD)
1242AC_SUBST(RIPD)
1243AC_SUBST(RIPNGD)
1244AC_SUBST(OSPFD)
1245AC_SUBST(OSPF6D)
d0199430 1246AC_SUBST(WATCHQUAGGA)
9e867fe6 1247AC_SUBST(ISISD)
12e41d03 1248AC_SUBST(PIMD)
97cee877 1249AC_SUBST(SOLARIS)
7ea487bc 1250AC_SUBST(VTYSH)
7ea487bc 1251AC_SUBST(CURSES)
1252AC_SUBST(OSPFCLIENT)
1ef74ef7 1253AC_SUBST(OSPFAPI)
7ea487bc 1254AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
1255AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
1256AC_CHECK_LIB(crypt, crypt)
1257AC_CHECK_LIB(resolv, res_init)
7ea487bc 1258
25f45887
JJ
1259dnl ---------------------------
1260dnl check system has PCRE regexp
1261dnl ---------------------------
1262if test "x$enable_pcreposix" = "xyes"; then
1263 AC_CHECK_LIB(pcreposix, pcreposix_regexec, ,[enable_pcreposix=no
1264 AC_MSG_WARN([*** falling back to other regex library ***]) ])
1265fi
1266
1267if test "x$enable_pcreposix" != "xyes"; then
7ea487bc 1268dnl ---------------------------
1269dnl check system has GNU regexp
1270dnl ---------------------------
25f45887 1271AC_MSG_CHECKING(whether system has GNU regex)
7ea487bc 1272AC_CHECK_LIB(c, regexec,
1273[AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
1274 LIB_REGEX=""],
1275[LIB_REGEX="regex.o"])
25f45887
JJ
1276fi
1277AC_SUBST(HAVE_LIBPCREPOSIX)
7ea487bc 1278AC_SUBST(LIB_REGEX)
1279
1280dnl ------------------
b1fc9acb 1281dnl check Net-SNMP library
7ea487bc 1282dnl ------------------
d6be5fb9 1283if test "${enable_snmp}" != ""; then
08d7f653
VB
1284 AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], [no])
1285 if test x"$NETSNMP_CONFIG" = x"no"; then
1286 AC_MSG_ERROR([--enable-snmp given but unable to find net-snmp-config])
1287 fi
1288 LIBS="$LIBS `${NETSNMP_CONFIG} --agent-libs`"
1289 CFLAGS="`${NETSNMP_CONFIG} --base-cflags` $CFLAGS"
1290 AC_MSG_CHECKING([whether we can link to Net-SNMP])
1291 AC_LINK_IFELSE([AC_LANG_PROGRAM([
1292int main(void);
1293],
1294[
1295{
1296 return 0;
1297}
1298])],[AC_MSG_RESULT(yes)],[
1299 AC_MSG_RESULT(no)
1300 AC_MSG_ERROR([--enable-snmp given but not usable])])
1301 AC_DEFINE(HAVE_SNMP,,SNMP)
d6be5fb9
VB
1302 case "${enable_snmp}" in
1303 yes)
1304 SNMP_METHOD=agentx
1305 ;;
1306 smux|agentx)
1307 SNMP_METHOD="${enable_snmp}"
1308 ;;
1309 *)
1310 AC_MSG_ERROR([--enable-snmp given with an unknown method (${enable_snmp}). Use smux or agentx])
1311 ;;
1312 esac
1313 AH_TEMPLATE([SNMP_SMUX], [Use SNMP SMUX to interface with snmpd])
1314 AH_TEMPLATE([SNMP_AGENTX], [Use SNMP AgentX to interface with snmpd])
1315 AC_DEFINE_UNQUOTED(AS_TR_CPP(SNMP_${SNMP_METHOD}),,SNMP method to interface with snmpd)
6cf9df08 1316fi
1317
7ea487bc 1318dnl ---------------------------
6f0e3f6e 1319dnl sockaddr and netinet checks
7ea487bc 1320dnl ---------------------------
6f0e3f6e
PJ
1321AC_CHECK_TYPES([struct sockaddr, struct sockaddr_in,
1322 struct sockaddr_in6, struct sockaddr_un, struct sockaddr_dl,
12e41d03
DL
1323 socklen_t, struct vifctl, struct mfcctl, struct sioc_sg_req,
1324 vifi_t, struct sioc_vif_req, struct igmpmsg,
6f0e3f6e
PJ
1325 struct ifaliasreq, struct if6_aliasreq, struct in6_aliasreq,
1326 struct nd_opt_adv_interval, struct rt_addrinfo,
11770e10 1327 struct nd_opt_homeagent_info, struct nd_opt_adv_interval],
6f0e3f6e
PJ
1328 [], [], QUAGGA_INCLUDES)
1329
1330AC_CHECK_MEMBERS([struct sockaddr.sa_len,
1331 struct sockaddr_in.sin_len, struct sockaddr_un.sun_len,
1332 struct sockaddr_in6.sin6_scope_id,
ca3ccd87 1333 struct sockaddr_dl.sdl_len,
6f0e3f6e
PJ
1334 struct if6_aliasreq.ifra_lifetime,
1335 struct nd_opt_adv_interval.nd_opt_ai_type],
1336 [], [], QUAGGA_INCLUDES)
29c4c9bd 1337
6f0e3f6e 1338dnl ---------------------------
11770e10 1339dnl IRDP/pktinfo/icmphdr checks
6f0e3f6e
PJ
1340dnl ---------------------------
1341AC_CHECK_TYPES([struct in_pktinfo],
11770e10
PJ
1342 [AC_CHECK_TYPES([struct icmphdr],
1343 [if test "${enable_irdp}" != "no"; then
1344 AC_DEFINE(HAVE_IRDP,, IRDP)
1345 fi],
1346 [if test "${enable_irdp}" = "yes"; then
1347 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1348 fi], [QUAGGA_INCLUDES])],
6f0e3f6e
PJ
1349 [if test "${enable_irdp}" = "yes"; then
1350 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1351 fi], [QUAGGA_INCLUDES])
29c4c9bd 1352
12e41d03
DL
1353dnl -----------------------
1354dnl checking for IP_PKTINFO
1355dnl -----------------------
1356AC_MSG_CHECKING(for IP_PKTINFO)
1357AC_TRY_COMPILE([#include <netdb.h>], [
1358 int opt = IP_PKTINFO;
1359], [
1360 AC_MSG_RESULT(yes)
1361 AC_DEFINE(HAVE_IP_PKTINFO, 1, [Have IP_PKTINFO])
1362], [
1363 AC_MSG_RESULT(no)
1364])
1365
1366dnl ---------------------------
1367dnl checking for IP_RECVDSTADDR
1368dnl ---------------------------
1369AC_MSG_CHECKING(for IP_RECVDSTADDR)
1370AC_TRY_COMPILE([#include <netinet/in.h>], [
1371 int opt = IP_RECVDSTADDR;
1372], [
1373 AC_MSG_RESULT(yes)
1374 AC_DEFINE(HAVE_IP_RECVDSTADDR, 1, [Have IP_RECVDSTADDR])
1375], [
1376 AC_MSG_RESULT(no)
1377])
1378
1379dnl ----------------------
1380dnl checking for IP_RECVIF
1381dnl ----------------------
1382AC_MSG_CHECKING(for IP_RECVIF)
1383AC_TRY_COMPILE([#include <netinet/in.h>], [
1384 int opt = IP_RECVIF;
1385], [
1386 AC_MSG_RESULT(yes)
1387 AC_DEFINE(HAVE_IP_RECVIF, 1, [Have IP_RECVIF])
1388], [
1389 AC_MSG_RESULT(no)
1390])
1391
7ea487bc 1392dnl --------------------------------------
1393dnl checking for getrusage struct and call
1394dnl --------------------------------------
47f6aef0
SH
1395if test "${enable_rusage}" != "no"; then
1396 AC_MSG_CHECKING(whether getrusage is available)
1397 AC_TRY_COMPILE([#include <sys/resource.h>],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
1398 [AC_MSG_RESULT(yes)
1399 AC_DEFINE(HAVE_RUSAGE,,rusage)],
1400 AC_MSG_RESULT(no))
1401fi
7ea487bc 1402
c4376c9d
SH
1403dnl --------------------------------------
1404dnl checking for clock_time monotonic struct and call
1405dnl --------------------------------------
6511cab2
PJ
1406AC_CHECK_DECL(CLOCK_MONOTONIC,
1407 [AC_CHECK_LIB(rt, clock_gettime, [LIBS="$LIBS -lrt"])
9964fcfc 1408 AC_DEFINE(HAVE_CLOCK_MONOTONIC,, Have monotonic clock)
6511cab2 1409], [AC_MSG_RESULT(no)], [QUAGGA_INCLUDES])
c4376c9d 1410
edd7c245 1411dnl -------------------
1412dnl capabilities checks
1413dnl -------------------
41d3fc96 1414if test "${enable_capabilities}" != "no"; then
1415 AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1416 AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1417 [AC_MSG_RESULT(yes)
1418 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1419 quagga_ac_keepcaps="yes"],
1420 AC_MSG_RESULT(no)
edd7c245 1421 )
41d3fc96 1422 if test x"${quagga_ac_keepcaps}" = x"yes"; then
1423 AC_CHECK_HEADERS(sys/capability.h)
1424 fi
1425 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1426 AC_CHECK_LIB(cap, cap_init,
1427 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1428 LIBCAP="-lcap"
ceacedba 1429 quagga_ac_lcaps="yes"]
41d3fc96 1430 )
ceacedba 1431 else
1432 AC_CHECK_HEADERS(priv.h,
1433 [AC_MSG_CHECKING(Solaris style privileges are available)
1434 AC_TRY_COMPILE([#include <priv.h>],[getpflags(PRIV_AWARE);],
1435 [AC_MSG_RESULT(yes)
1436 AC_DEFINE(HAVE_SOLARIS_CAPABILITIES,1,getpflags)
1437 quagga_ac_scaps="yes"],
1438 AC_MSG_RESULT(no)
1439 )
1440 ]
1441 )
1442 fi
1443 if test x"${quagga_ac_scaps}" = x"yes" \
1444 -o x"${quagga_ac_lcaps}" = x"yes"; then
1445 AC_DEFINE(HAVE_CAPABILITIES,1,capabilities)
41d3fc96 1446 fi
edd7c245 1447fi
1448AC_SUBST(LIBCAP)
1449
fb2d1502 1450dnl ---------------------------
1451dnl check for glibc 'backtrace'
1452dnl ---------------------------
8c99b4c1
DL
1453if test x"${enable_backtrace}" != x"no" ; then
1454 backtrace_ok=no
1455 AC_CHECK_HEADER([execinfo.h], [
1456 AC_SEARCH_LIBS([backtrace], [execinfo], [
1457 AC_DEFINE(HAVE_GLIBC_BACKTRACE,,[Glibc backtrace])
1458 AC_DEFINE(HAVE_STACK_TRACE,,[Stack symbol decoding])
1459 backtrace_ok=yes
1460 ],, [-lm])
eda3529e 1461 ])
8c99b4c1
DL
1462
1463 if test x"${enable_backtrace}" = x"yes" -a x"${backtrace_ok}" = x"no"; then
1464 dnl user explicitly requested backtrace but we failed to find support
1465 AC_MSG_FAILURE([failed to find backtrace support])
1466 fi
1467fi
fb2d1502 1468
41be32bf
PJ
1469dnl -----------------------------------------
1470dnl check for malloc mallinfo struct and call
1471dnl this must try and link using LIBS, in
1472dnl order to check no alternative allocator
1473dnl has been specified, which might not provide
1474dnl mallinfo, e.g. such as Umem on Solaris.
1475dnl -----------------------------------------
6f0e3f6e 1476AC_CHECK_HEADER([malloc.h],
41be32bf
PJ
1477 [AC_MSG_CHECKING(whether mallinfo is available)
1478 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
1479 [[struct mallinfo ac_x; ac_x = mallinfo ();]])],
1480 [AC_MSG_RESULT(yes)
1481 AC_DEFINE(HAVE_MALLINFO,,mallinfo)],
1482 AC_MSG_RESULT(no)
1483 )
6f0e3f6e 1484 ], [], QUAGGA_INCLUDES)
41be32bf 1485
408ad943 1486dnl ----------
1487dnl configure date
1488dnl ----------
1489CONFDATE=`date '+%Y%m%d'`
1490AC_SUBST(CONFDATE)
1491
f281ab97
DL
1492dnl -------
1493dnl DejaGNU
1494dnl -------
1495if test x"$DEJAGNU" = x
1496then
1497 DEJAGNU="\$(top_srcdir)/tests/global-conf.exp"
1498fi
1499RUNTESTDEFAULTFLAGS="-x --tool \$\$tool"
1500
1501AC_SUBST(DEJAGNU)
1502AC_SUBST(RUNTESTDEFAULTFLAGS)
1503
7ea487bc 1504dnl ------------------------------
a159ed93 1505dnl set paths for state directory
23bd12c3 1506dnl ------------------------------
e84999d9 1507AC_MSG_CHECKING(directory to use for state file)
23bd12c3 1508if test "${prefix}" = "NONE"; then
e8f2984c 1509 quagga_statedir_prefix="";
23bd12c3 1510else
e8f2984c 1511 quagga_statedir_prefix=${prefix}
23bd12c3 1512fi
1513if test "${localstatedir}" = '${prefix}/var'; then
e84999d9 1514 for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
e8f2984c 1515 ${quagga_statedir_prefix}/var/adm dnl
1516 ${quagga_statedir_prefix}/etc dnl
a159ed93 1517 /var/run dnl
1518 /var/adm dnl
1519 /etc dnl
1520 /dev/null;
23bd12c3 1521 do
e8f2984c 1522 test -d $QUAGGA_STATE_DIR && break
23bd12c3 1523 done
e84999d9 1524 quagga_statedir=$QUAGGA_STATE_DIR
23bd12c3 1525else
e8f2984c 1526 quagga_statedir=${localstatedir}
a159ed93 1527fi
e8f2984c 1528if test $quagga_statedir = "/dev/null"; then
a159ed93 1529 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1530fi
e84999d9
JJ
1531AC_MSG_RESULT(${quagga_statedir})
1532AC_SUBST(quagga_statedir)
a159ed93 1533
e8f2984c 1534AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1535AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1536AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1537AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1538AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1539AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
9e867fe6 1540AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
12e41d03 1541AC_DEFINE_UNQUOTED(PATH_PIMD_PID, "$quagga_statedir/pimd.pid",pimd PID)
d0199430 1542AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
e8f2984c 1543AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1544AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1545AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1546AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1547AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1548AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1549AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
9e867fe6 1550AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
12e41d03 1551AC_DEFINE_UNQUOTED(PIM_VTYSH_PATH, "$quagga_statedir/pimd.vty",pimd vty socket)
515210bd 1552AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
7ea487bc 1553
1eb8ef25 1554dnl -------------------------------
1555dnl Quagga sources should always be
1556dnl current wrt interfaces. Dont
1557dnl allow deprecated interfaces to
1558dnl be exposed.
1559dnl -------------------------------
1560AC_DEFINE(QUAGGA_NO_DEPRECATED_INTERFACES, 1, Hide deprecated interfaces)
1561
7ea487bc 1562dnl ---------------------------
1563dnl Check htonl works correctly
1564dnl ---------------------------
1565AC_MSG_CHECKING(for working htonl)
6f0e3f6e
PJ
1566AC_CACHE_VAL(ac_cv_htonl_works,
1567 [AC_LINK_IFELSE([AC_LANG_PROGRAM([QUAGGA_INCLUDES],[htonl (0);])],
1568 [ac_cv_htonl_works=yes], [ac_cv_htonl_works=no])
1569 ]
1570)
7ea487bc 1571AC_MSG_RESULT($ac_cv_htonl_works)
1572
14c17fd8 1573AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile
d0199430 1574 ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
41d9cc6a 1575 ospf6d/Makefile isisd/Makefile vtysh/Makefile
f281ab97 1576 doc/Makefile ospfclient/Makefile tests/Makefile m4/Makefile
12e41d03 1577 pimd/Makefile
5bb7e4d1 1578 tests/bgpd.tests/Makefile
c69905b6 1579 tests/libzebra.tests/Makefile
f281ab97 1580 redhat/Makefile
69f1fc22 1581 pkgsrc/Makefile
670bbf19 1582 redhat/quagga.spec
b7a97f82 1583 lib/version.h
14c17fd8 1584 doc/defines.texi
f695b01f 1585 isisd/topology/Makefile
cbd04084 1586 pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
f31293af 1587 pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
26275b05 1588AC_CONFIG_FILES([solaris/Makefile])
1589
670bbf19 1590AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
48577196 1591## Hack, but working solution to avoid rebuilding of quagga.info.
1592## It's already in CVS until texinfo 4.7 is more common.
14c17fd8 1593AC_OUTPUT
7ea487bc 1594
1595echo "
c89f6494 1596Quagga configuration
1597--------------------
1598quagga version : ${PACKAGE_VERSION}
1080c13f 1599host operating system : ${host_os}
7ea487bc 1600source code location : ${srcdir}
1601compiler : ${CC}
1602compiler flags : ${CFLAGS}
6f0e3f6e 1603make : ${MAKE-make}
6f0e3f6e 1604linker flags : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM}
e8f2984c 1605state file directory : ${quagga_statedir}
dc7a2bf1 1606config file directory : `eval echo \`echo ${sysconfdir}\``
d6b72f7a 1607example directory : `eval echo \`echo ${exampledir}\``
8d4aee5d 1608user to run as : ${enable_user}
1609group to run as : ${enable_group}
1610group for vty sockets : ${enable_vty_group}
aa593d5e 1611config file mask : ${enable_configfile_mask}
1612log file mask : ${enable_logfile_mask}
dc7a2bf1 1613
1614The above user and group must have read/write access to the state file
105b8239
PJ
1615directory and to the config files in the config file directory."
1616
1617if test x"$quagga_cv_gnu_make" = x"no"; then echo "
1618Warning: The ${MAKE-make} programme detected, either in your path or
1619via the MAKE variable, is not GNU Make. GNU make may be installed as
1620gmake on some systems. and is required to complete a build of Quagga
1621" > /dev/stderr
1622fi