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