blob: c1a4d8cdd2042bf01f6c6676bd60368d576fde8d [file] [log] [blame]
paul7ea487b2003-03-17 02:05:07 +00001##
paule8f29842003-08-12 13:08:31 +00002## Configure template file for Quagga.
paul7ea487b2003-03-17 02:05:07 +00003## autoconf will generate configure script.
4##
5## Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
paule8f29842003-08-12 13:08:31 +00006## Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st>
paul7ea487b2003-03-17 02:05:07 +00007##
paule8f29842003-08-12 13:08:31 +00008AC_PREREQ(2.53)
paul7ea487b2003-03-17 02:05:07 +00009
David Lamparter828f2352012-05-01 21:43:53 +020010AC_INIT(Quagga, 0.99.21, [https://bugzilla.quagga.net])
paulfa1253d2003-09-24 05:09:26 +000011AC_CONFIG_SRCDIR(lib/zebra.h)
Paul Jakma62c9f502009-07-19 17:33:21 +010012AC_CONFIG_MACRO_DIR([m4])
ajsdfb9a542005-04-11 14:55:55 +000013
14dnl -----------------------------------
15dnl Get hostname and other information.
16dnl -----------------------------------
17AC_CANONICAL_BUILD()
18AC_CANONICAL_HOST()
19AC_CANONICAL_TARGET()
20
gdt81b81822004-04-07 22:48:47 +000021AM_INIT_AUTOMAKE(1.6)
paul7ea487b2003-03-17 02:05:07 +000022AM_CONFIG_HEADER(config.h)
23
David Lamparter0be793e2012-11-27 01:34:56 +000024AC_PATH_PROG(PERL, perl)
Jeremy Jackson7ec57362009-01-21 22:10:40 -050025AC_CHECK_PROG([GAWK],[gawk],[gawk],[not-in-PATH])
26if test "x$GAWK" = "xnot-in-PATH" ; then
27 AC_MSG_ERROR([GNU awk is required for lib/memtype.h made by memtypes.awk.
28BSD awk complains: awk: gensub doesn't support backreferences (subst "\1") ])
29fi
paul03ecfb62005-04-16 15:38:23 +000030AC_ARG_VAR([GAWK],[GNU AWK])
31
gdtd6b72f72003-12-03 17:24:27 +000032dnl default is to match previous behavior
gdtc4f0efe2003-12-04 15:39:25 +000033exampledir=${sysconfdir}
gdtd6b72f72003-12-03 17:24:27 +000034AC_ARG_ENABLE([exampledir],
35 AC_HELP_STRING([--enable-exampledir],
36 [specify alternate directory for examples]),
37 exampledir="$enableval",)
gdtc4f0efe2003-12-04 15:39:25 +000038dnl XXX add --exampledir to autoconf standard directory list somehow
gdtd6b72f72003-12-03 17:24:27 +000039AC_SUBST(exampledir)
40
gdtcbd04082004-08-31 18:16:36 +000041dnl default is to match previous behavior
42pkgsrcrcdir=""
43pkgsrcdir=""
44AC_ARG_ENABLE([pkgsrcrcdir],
45 AC_HELP_STRING([--enable-pkgsrcrcdir],
46 [specify directory for rc.d scripts]),
47 pkgsrcrcdir="$enableval"; pkgsrcdir="pkgsrc",)
48dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
49AC_SUBST(pkgsrcdir)
50AC_SUBST(pkgsrcrcdir)
51
paul7ea487b2003-03-17 02:05:07 +000052dnl ------------
53dnl Check CFLAGS
54dnl ------------
55AC_ARG_WITH(cflags,
56[ --with-cflags Set CFLAGS for use in compilation.])
57if test "x$with_cflags" != "x" ; then
58 CFLAGS="$with_cflags" ; cflags_specified=yes ;
59elif test -n "$CFLAGS" ; then
60 cflags_specified=yes ;
61fi
62
hasso1969e4b2005-03-27 13:07:23 +000063dnl --------------------
64dnl Check CC and friends
65dnl --------------------
Paul P Komkoff Jr46bc0e42008-08-13 16:17:04 +010066AC_LANG([C])
paul7ea487b2003-03-17 02:05:07 +000067AC_PROG_CC
hasso1969e4b2005-03-27 13:07:23 +000068AC_PROG_CPP
Paul P Komkoff Jr46bc0e42008-08-13 16:17:04 +010069AM_PROG_CC_C_O
hasso1969e4b2005-03-27 13:07:23 +000070AC_PROG_EGREP
Greg Troxel553bdfe2007-02-06 20:10:35 +000071
72dnl autoconf 2.59 appears not to support AC_PROG_SED
73dnl AC_PROG_SED
74AC_CHECK_PROG([SED],[sed],[sed],[/bin/false])
hasso1969e4b2005-03-27 13:07:23 +000075
Paul Jakmafa482832012-03-08 13:51:21 +000076dnl pdflatex and latexmk are needed to build HACKING.pdf
77AC_CHECK_PROG([PDFLATEX],[pdflatex],[pdflatex],[/bin/false])
78AC_CHECK_PROG([LATEXMK],[latexmk],[latexmk],[/bin/false])
79if test "x$PDFLATEX" = "x/bin/false" -o "x$LATEXMK" = "x/bin/false"; then
80 AC_MSG_WARN([Will not be able to make PDF versions of TeX documents])
81else
82 HAVE_LATEX=true
83fi
84AM_CONDITIONAL([HAVE_LATEX], [test "x$HAVE_LATEX" = "xtrue"])
85
hasso1969e4b2005-03-27 13:07:23 +000086dnl ------------------------------------------------------------------
87dnl Intel compiler check. Although Intel tries really hard to make icc
88dnl look like gcc, there are some differences. It's very verbose with
89dnl -Wall and it doesn't support the individual -W options.
90dnl ------------------------------------------------------------------
paul6a4b8832005-11-26 08:28:00 +000091if test "x${GCC}" = "xyes" ; then
92 COMPILER="GCC"
93 AC_MSG_CHECKING([whether we are using the Intel compiler])
94 AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
95 [AC_MSG_RESULT([no])],
96 [COMPILER="ICC"
97 AC_MSG_RESULT([yes])]
98 )
99else
100 AC_MSG_CHECKING([whether we are using SunPro compiler])
101 AC_EGREP_CPP([^__SUNPRO_C.*0x5(7|8|9)], ["__SUNPRO_C" __SUNPRO_C],
102 [AC_MSG_RESULT([no])],
103 [COMPILER="SUNPRO"
104 AC_MSG_RESULT([yes])]
105 )
106fi
paul7ea487b2003-03-17 02:05:07 +0000107
paula49c0ff2004-09-30 06:08:58 +0000108dnl ---------------------------------------------
paul7ea487b2003-03-17 02:05:07 +0000109dnl If CLFAGS doesn\'t exist set default value
paula49c0ff2004-09-30 06:08:58 +0000110dnl AC_PROG_CC will have set minimal default
111dnl already, eg "-O2 -g" for gcc, "-g" for others
paul27eebb32004-07-22 18:16:59 +0000112dnl (Wall is gcc specific... have to make sure
113dnl gcc is being used before setting it)
114dnl
paul6a4b8832005-11-26 08:28:00 +0000115dnl Intel icc 8.0 also sets __GNUC__,
116dnl but doesn't support all these fancy -W options.
hasso1969e4b2005-03-27 13:07:23 +0000117dnl Intel compiler warnings we ignore:
118dnl 279: controlling expression is constant.
119dnl 869: parameter "xxx" was never referenced - to avoid massive warnings
120dnl about "self", "vty", "argc" and "argv" never referenced in DEFUN
121dnl macro.
122dnl 981: operands are evaluated in unspecified order.
paul6a4b8832005-11-26 08:28:00 +0000123dnl
124dnl Sun Studio 10 / SunPro 5.7 is also supported,
125dnl so lets set some sane CFLAGS for it.
126dnl ---------------------------------------------
hasso1969e4b2005-03-27 13:07:23 +0000127
paul6a4b8832005-11-26 08:28:00 +0000128AC_MSG_CHECKING([whether to set a default CFLAGS])
129if test "x${cflags_specified}" = "x" ; then
130 case ${COMPILER} in
131 "ICC")
David Lamparterfd76f412012-12-13 10:35:45 +0100132 CFLAGS="-Os -g -Wall"
paul6a4b8832005-11-26 08:28:00 +0000133 AC_MSG_RESULT([Intel default])
134 ;;
135 "GCC")
Andrew J. Schorr5fa05092007-04-30 19:14:08 +0000136 CFLAGS="-Os -fno-omit-frame-pointer -g -std=gnu99 -Wall"
paul6a4b8832005-11-26 08:28:00 +0000137 CFLAGS="${CFLAGS} -Wsign-compare -Wpointer-arith"
138 CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
139 CFLAGS="${CFLAGS} -Wmissing-prototypes -Wmissing-declarations"
140 CFLAGS="${CFLAGS} -Wchar-subscripts -Wcast-qual"
141 # TODO: conditionally addd -Wpacked if handled
142 AC_MSG_RESULT([gcc default])
143 ;;
144 "SUNPRO")
Paul Jakma105b8232006-05-28 08:02:41 +0000145 CFLAGS="-xO4 -v -g -xspace -xcode=pic32 -xstrconst -xc99"
paul6a4b8832005-11-26 08:28:00 +0000146 AC_MSG_RESULT([SunPro default])
147 ;;
148 *)
149 AC_MSG_RESULT([unknown compiler])
150 ;;
151 esac
152else
153 AC_MSG_RESULT([CFLAGS supplied by user])
hasso1969e4b2005-03-27 13:07:23 +0000154fi
155
paul7ea487b2003-03-17 02:05:07 +0000156dnl --------------
157dnl Check programs
158dnl --------------
paul7ea487b2003-03-17 02:05:07 +0000159AC_PROG_INSTALL
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000160AC_PROG_LN_S
paul7ea487b2003-03-17 02:05:07 +0000161AC_PROG_MAKE_SET
162AC_CHECK_TOOL(AR, ar)
paul7ea487b2003-03-17 02:05:07 +0000163
Paul Jakma105b8232006-05-28 08:02:41 +0000164dnl ---------------------------
165dnl We, perhaps unfortunately,
166dnl depend on GNU Make specific
167dnl constructs.
168dnl Give the user a warning if
169dnl not GNU Make.
170dnl ---------------------------
171AC_CACHE_CHECK([if ${MAKE-make} is GNU make], [quagga_cv_gnu_make],
172 [quagga_cv_gnu_make=no
173 if ${MAKE-make} --version 2>/dev/null | \
174 grep '^GNU Make ' >/dev/null ; then
175 quagga_cv_gnu_make=yes;
176 fi
177 ]
178)
179
Paul Jakmad46d2a22007-05-10 16:53:04 +0000180dnl -----------------
181dnl System extensions
182dnl -----------------
Paul Jakmad46d2a22007-05-10 16:53:04 +0000183AC_GNU_SOURCE
paul7ea487b2003-03-17 02:05:07 +0000184
gdt87efd642004-06-30 17:36:11 +0000185dnl -------
186dnl libtool
187dnl -------
paul0fc42942004-08-19 04:41:21 +0000188AC_PROG_LIBTOOL
gdt87efd642004-06-30 17:36:11 +0000189
paul7ea487b2003-03-17 02:05:07 +0000190dnl ----------------------
191dnl Packages configuration
192dnl ----------------------
Joachim Nilsson1080c132012-05-30 08:15:48 +0200193AC_ARG_WITH(pkg-extra-version,
194 AS_HELP_STRING([--with-pkg-extra-version=VER], [add extra version field, for packagers/distributions]),
195 [EXTRAVERSION=$withval],)
David Lamparter0be793e2012-11-27 01:34:56 +0000196AC_ARG_WITH(pkg-git-version,
197 AS_HELP_STRING([--with-pkg-git-version], [add git information to MOTD and build version string]),
198 [ if test "x$withval" != "xno"; then
199 with_pkg_git_version="1"
200 AC_DEFINE(GIT_VERSION, [1], [include git version info])
201 fi ],)
paul7ea487b2003-03-17 02:05:07 +0000202AC_ARG_ENABLE(vtysh,
gdtfc9d0742004-06-30 14:25:12 +0000203[ --enable-vtysh include integrated vty shell for Quagga])
paul7ea487b2003-03-17 02:05:07 +0000204AC_ARG_ENABLE(ipv6,
205[ --disable-ipv6 turn off IPv6 related features and daemons])
Joakim Tjernlundcbcd9bf2009-02-16 09:40:39 +0100206AC_ARG_ENABLE(doc,
207[ --disable-doc do not build docs])
David Lampartere2b15802012-11-03 09:14:29 -0700208AC_ARG_ENABLE(tests,
209[ --disable-tests do not build tests])
paul7ea487b2003-03-17 02:05:07 +0000210AC_ARG_ENABLE(zebra,
211[ --disable-zebra do not build zebra daemon])
212AC_ARG_ENABLE(bgpd,
213[ --disable-bgpd do not build bgpd])
214AC_ARG_ENABLE(ripd,
215[ --disable-ripd do not build ripd])
216AC_ARG_ENABLE(ripngd,
217[ --disable-ripngd do not build ripngd])
218AC_ARG_ENABLE(ospfd,
219[ --disable-ospfd do not build ospfd])
paul7ea487b2003-03-17 02:05:07 +0000220AC_ARG_ENABLE(ospf6d,
221[ --disable-ospf6d do not build ospf6d])
Paul Jakma57345092011-12-25 17:52:09 +0100222AC_ARG_ENABLE(babeld,
223[ --disable-babeld do not build babeld])
ajsd0199432004-12-22 14:03:52 +0000224AC_ARG_ENABLE(watchquagga,
225[ --disable-watchquagga do not build watchquagga])
jardin9e867fe2003-12-23 08:56:18 +0000226AC_ARG_ENABLE(isisd,
hassoae399ab2004-09-13 20:22:18 +0000227[ --enable-isisd build isisd])
Greg Troxel97cee872007-08-02 13:36:56 +0000228AC_ARG_ENABLE(solaris,
229[ --enable-solaris build solaris])
paul7ea487b2003-03-17 02:05:07 +0000230AC_ARG_ENABLE(bgp-announce,
231[ --disable-bgp-announce, turn off BGP route announcement])
232AC_ARG_ENABLE(netlink,
233[ --enable-netlink force to use Linux netlink interface])
234AC_ARG_ENABLE(broken-aliases,
235[ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
236AC_ARG_ENABLE(snmp,
Vincent Bernatd6be5fb2012-05-24 09:44:43 +0200237[ --enable-snmp=ARG enable SNMP support (smux or agentx)])
paul7ea487b2003-03-17 02:05:07 +0000238AC_ARG_WITH(libpam,
239[ --with-libpam use libpam for PAM support in vtysh])
hasso71c0fb52003-05-25 20:18:13 +0000240AC_ARG_ENABLE(tcp-zebra,
paul7ea487b2003-03-17 02:05:07 +0000241[ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon])
paul7ea487b2003-03-17 02:05:07 +0000242AC_ARG_ENABLE(opaque-lsa,
Paul Jakma36de2612011-03-22 10:18:05 +0000243 AC_HELP_STRING([--disable-opaque-lsa],[do not build OSPF Opaque-LSA with OSPFAPI support (RFC2370)]))
paul1ef74ef2003-03-21 15:16:05 +0000244AC_ARG_ENABLE(ospfapi,
Paul Jakma36de2612011-03-22 10:18:05 +0000245[ --disable-ospfapi do not build OSPFAPI to access the OSPF LSA Database])
paul1ef74ef2003-03-21 15:16:05 +0000246AC_ARG_ENABLE(ospfclient,
247[ --disable-ospfclient do not build OSPFAPI client for OSPFAPI,
248 (this is the default if --disable-ospfapi is set)])
paul7ea487b2003-03-17 02:05:07 +0000249AC_ARG_ENABLE(ospf-te,
Paul Jakma36de2612011-03-22 10:18:05 +0000250 AC_HELP_STRING([--disable-ospf-te],[disable Traffic Engineering Extension to OSPF]))
paul7ea487b2003-03-17 02:05:07 +0000251AC_ARG_ENABLE(multipath,
252[ --enable-multipath=ARG enable multipath function, ARG must be digit])
Paul P Komkoff Jrfe86b482008-08-13 16:56:05 +0100253AC_ARG_ENABLE(user,
254 AC_HELP_STRING([--enable-user=user], [user to run Quagga suite as (default quagga)]))
255AC_ARG_ENABLE(group,
256 AC_HELP_STRING([--enable-group=group], [group to run Quagga suite as (default quagga)]))
pauledd7c242003-06-04 13:59:38 +0000257AC_ARG_ENABLE(vty_group,
paul6b6942f2004-10-22 04:55:05 +0000258[ --enable-vty-group=ARG set vty sockets to have specified group as owner])
gdtaa593d52003-12-22 20:15:53 +0000259AC_ARG_ENABLE(configfile_mask,
260[ --enable-configfile-mask=ARG set mask for config files])
261AC_ARG_ENABLE(logfile_mask,
262[ --enable-logfile-mask=ARG set mask for log files])
pauledd7c242003-06-04 13:59:38 +0000263
hasso71c0fb52003-05-25 20:18:13 +0000264AC_ARG_ENABLE(rtadv,
paul6b6942f2004-10-22 04:55:05 +0000265[ --disable-rtadv disable IPV6 router advertisement feature])
hassoca776982004-06-12 14:33:05 +0000266AC_ARG_ENABLE(irdp,
paul6b6942f2004-10-22 04:55:05 +0000267[ --enable-irdp enable IRDP server support in zebra])
hassof695b012005-04-02 19:03:39 +0000268AC_ARG_ENABLE(isis_topology,
269[ --enable-isis-topology enable IS-IS topology generator])
hasso41d3fc92004-04-06 11:59:00 +0000270AC_ARG_ENABLE(capabilities,
271[ --disable-capabilities disable using POSIX capabilities])
paul6b6942f2004-10-22 04:55:05 +0000272AC_ARG_ENABLE(gcc_ultra_verbose,
273[ --enable-gcc-ultra-verbose enable ultra verbose GCC warnings])
Paul Jakma3453a712009-06-12 14:21:02 +0100274AC_ARG_ENABLE(linux24_tcp_md5,
275[ --enable-linux24-tcp-md5 enable support for old, Linux-2.4 RFC2385 patch])
ajs3cade262004-12-29 17:50:22 +0000276AC_ARG_ENABLE(gcc-rdynamic,
277[ --enable-gcc-rdynamic enable gcc linking with -rdynamic for better backtraces])
ajs924b9222005-04-16 17:11:24 +0000278AC_ARG_ENABLE(time-check,
279[ --disable-time-check disable slow thread warning messages])
Jeremy Jackson25f45882009-01-12 16:06:12 -0500280AC_ARG_ENABLE(pcreposix,
281[ --enable-pcreposix enable using PCRE Posix libs for regex functions])
Avneesh Sachdev5adc2522012-11-13 22:48:59 +0000282AC_ARG_ENABLE(fpm,
283[ --enable-fpm enable Forwarding Plane Manager support])
paul6b6942f2004-10-22 04:55:05 +0000284
285if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
286 CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
287 CFLAGS="${CFLAGS} -Wmissing-declarations -Wmissing-noreturn"
288 CFLAGS="${CFLAGS} -Wmissing-format-attribute -Wunreachable-code"
289 CFLAGS="${CFLAGS} -Wpacked -Wpadded"
290fi
paul7ea487b2003-03-17 02:05:07 +0000291
ajs3cade262004-12-29 17:50:22 +0000292if test x"${enable_gcc_rdynamic}" = x"yes" ; then
293 LDFLAGS="${LDFLAGS} -rdynamic"
294fi
295
ajs924b9222005-04-16 17:11:24 +0000296if test x"${enable_time_check}" != x"no" ; then
297 if test x"${enable_time_check}" = x"yes" -o x"${enable_time_check}" = x ; then
298 AC_DEFINE(CONSUMED_TIME_CHECK,5000000,Consumed Time Check)
299 else
300 AC_DEFINE_UNQUOTED(CONSUMED_TIME_CHECK,$enable_time_check,Consumed Time Check)
301 fi
302fi
303
Avneesh Sachdev5adc2522012-11-13 22:48:59 +0000304if test "${enable_fpm}" = "yes"; then
305 AC_DEFINE(HAVE_FPM,,Forwarding Plane Manager support)
306fi
307
paul7ea487b2003-03-17 02:05:07 +0000308if test "${enable_broken_aliases}" = "yes"; then
309 if test "${enable_netlink}" = "yes"
310 then
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000311 AC_MSG_FAILURE([Sorry you can not use netlink with broken aliases])
paul7ea487b2003-03-17 02:05:07 +0000312 fi
313 AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
314 enable_netlink=no
315fi
316
317if test "${enable_tcp_zebra}" = "yes"; then
318 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
319fi
320
Paul Jakma36de2612011-03-22 10:18:05 +0000321if test "${enable_opaque_lsa}" != "no"; then
paul7ea487b2003-03-17 02:05:07 +0000322 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
323fi
324
Paul Jakma36de2612011-03-22 10:18:05 +0000325if test "${enable_ospf_te}" != "no"; then
paul7ea487b2003-03-17 02:05:07 +0000326 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
327 AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
328fi
329
Paul Jakma3453a712009-06-12 14:21:02 +0100330if test "${enable_linux24_tcp_md5}" = "yes"; then
331 AC_DEFINE(HAVE_TCP_MD5_LINUX24,,Old Linux 2.4 TCP MD5 Signature Patch)
332fi
333
gdtd2a0ccc2003-12-03 18:13:48 +0000334AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
335if test "${enable_rtadv}" != "no"; then
hasso71c0fb52003-05-25 20:18:13 +0000336 AC_MSG_RESULT(yes)
gdtd2a0ccc2003-12-03 18:13:48 +0000337 AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
paul2487bea2003-05-25 23:51:31 +0000338else
339 AC_MSG_RESULT(no)
hasso71c0fb52003-05-25 20:18:13 +0000340fi
paul7ea487b2003-03-17 02:05:07 +0000341
hassoca776982004-06-12 14:33:05 +0000342if test "${enable_irdp}" = "yes"; then
343 AC_DEFINE(HAVE_IRDP,, IRDP )
344fi
345
hassof695b012005-04-02 19:03:39 +0000346if test "${enable_isisd}" = "yes" && test "${enable_isis_topology}" = yes; then
347 AC_DEFINE(TOPOLOGY_GENERATE,,Enable IS-IS topology generator code)
David Lamparteree1ac2d2012-07-19 12:58:59 +0200348 ISIS_TOPOLOGY_INCLUDES="-I\$(srcdir)/topology"
hassof695b012005-04-02 19:03:39 +0000349 ISIS_TOPOLOGY_DIR="topology"
350 ISIS_TOPOLOGY_LIB="./topology/libtopology.a"
351fi
352
353AC_SUBST(ISIS_TOPOLOGY_INCLUDES)
354AC_SUBST(ISIS_TOPOLOGY_DIR)
355AC_SUBST(ISIS_TOPOLOGY_LIB)
356
paul79cb2162003-06-06 12:19:53 +0000357if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
paule8f29842003-08-12 13:08:31 +0000358 enable_user="quagga"
pauledd7c242003-06-04 13:59:38 +0000359elif test "${enable_user}" = "no"; then
360 enable_user="root"
361fi
pauledd7c242003-06-04 13:59:38 +0000362
paul79cb2162003-06-06 12:19:53 +0000363if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
paule8f29842003-08-12 13:08:31 +0000364 enable_group="quagga"
pauledd7c242003-06-04 13:59:38 +0000365elif test "${enable_group}" = "no"; then
366 enable_group="root"
367fi
pauledd7c242003-06-04 13:59:38 +0000368
369if test x"${enable_vty_group}" = x"yes" ; then
paul8d4aee52003-06-06 00:30:35 +0000370 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
paul79cb2162003-06-06 12:19:53 +0000371elif test x"${enable_vty_group}" != x""; then
paul8d4aee52003-06-06 00:30:35 +0000372 if test x"${enable_vty_group}" != x"no"; then
pauledd7c242003-06-04 13:59:38 +0000373 AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
374 fi
375fi
paul26275b02005-04-11 07:10:47 +0000376AC_SUBST([enable_user])
377AC_SUBST([enable_group])
378AC_SUBST([enable_vty_group])
379AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
380AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
pauledd7c242003-06-04 13:59:38 +0000381
gdtaa593d52003-12-22 20:15:53 +0000382enable_configfile_mask=${enable_configfile_mask:-0600}
383AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
384
385enable_logfile_mask=${enable_logfile_mask:-0600}
386AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
387
paul7ea487b2003-03-17 02:05:07 +0000388MULTIPATH_NUM=1
389
390case "${enable_multipath}" in
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000391 [[0-9]|[1-9][0-9]])
paul7ea487b2003-03-17 02:05:07 +0000392 MULTIPATH_NUM="${enable_multipath}"
393 ;;
394 "")
395 ;;
396 *)
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000397 AC_MSG_FAILURE([Please specify digit to enable multipath ARG])
paul7ea487b2003-03-17 02:05:07 +0000398 ;;
399esac
400
paul7ea487b2003-03-17 02:05:07 +0000401AC_SUBST(MULTIPATH_NUM)
402
Joachim Nilsson1080c132012-05-30 08:15:48 +0200403dnl -----------------------------------
404dnl Add extra version string to package
405dnl name, string and version fields.
406dnl -----------------------------------
407if test "x${EXTRAVERSION}" != "x" ; then
David Lamparter0be793e2012-11-27 01:34:56 +0000408 VERSION="${VERSION}${EXTRAVERSION}"
409 PACKAGE_VERSION="${PACKAGE_VERSION}${EXTRAVERSION}"
410 PACKAGE_STRING="${PACKAGE_STRING}${EXTRAVERSION}"
Joachim Nilsson1080c132012-05-30 08:15:48 +0200411fi
412
David Lamparter0be793e2012-11-27 01:34:56 +0000413AM_CONDITIONAL([GIT_VERSION], [test "x$with_pkg_git_version" != "x"])
414
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000415dnl ------------------------------------
416dnl Check C keywords and standard types
417dnl ------------------------------------
418AC_C_CONST
419AC_C_INLINE
420AC_C_RESTRICT
421AC_C_VOLATILE
pauldc7a2bf2003-10-22 00:07:44 +0000422AC_HEADER_STDC
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000423AC_HEADER_TIME
424AC_HEADER_SYS_WAIT
425dnl AC_TYPE_PID_T
426AC_TYPE_UID_T
427AC_TYPE_MODE_T
428AC_TYPE_SIZE_T
429AC_TYPE_SIGNAL
430AC_STRUCT_TM
pauldc7a2bf2003-10-22 00:07:44 +0000431
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000432dnl -------------------------
433dnl Check other header files.
434dnl -------------------------
435AC_CHECK_HEADERS([stropts.h sys/ksym.h sys/times.h sys/select.h \
436 sys/types.h linux/version.h netdb.h asm/types.h \
Stephen Hemmingerb69442d2011-09-13 17:15:51 +0400437 sys/param.h limits.h signal.h \
Paul Jakma6511cab2009-06-18 17:38:01 +0100438 sys/socket.h netinet/in.h time.h sys/time.h])
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000439
440dnl Utility macro to avoid retyping includes all the time
441m4_define([QUAGGA_INCLUDES],
442[#ifdef SUNOS_5
443#define _XPG4_2
444#define __EXTENSIONS__
445#endif
446#include <stdio.h>
447#if STDC_HEADERS
448# include <stdlib.h>
449# include <stddef.h>
450#else
451# if HAVE_STDLIB_H
452# include <stdlib.h>
453# endif
454#endif
455#if HAVE_SYS_TYPES_H
456# include <sys/types.h>
457#endif
458/* sys/conf.h depends on param.h on FBSD at least */
459#if HAVE_SYS_PARAM_H
460# include <sys/param.h>
461#endif
462/* Required for MAXSIG */
463#if HAVE_SIGNAL_H
464# include <signal.h>
465#endif
466#if HAVE_SYS_SOCKET_H
467# include <sys/socket.h>
468#endif
469#if HAVE_NETINET_IN_H
470# include <netinet/in.h>
471#endif
Paul Jakma6511cab2009-06-18 17:38:01 +0100472#ifdef TIME_WITH_SYS_TIME
473# include <sys/time.h>
474# include <time.h>
475#else
476# ifdef HAVE_SYS_TIME_H
477# include <sys/time.h>
478# else
479# include <time.h>
480# endif
481#endif /* TIME_WITH_SYS_TIME */
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000482])dnl
483
Denis Ovsienko2b43bf22011-07-14 16:30:08 +0400484dnl HAVE_NET_IF_H must be discovered by the time the longer AC_CHECK_HEADERS
485dnl round below execution begins, otherwise it doesn't properly detect
486dnl HAVE_NETINET6_IN6_VAR_H, HAVE_NET_IF_VAR_H and HAVE_STRUCT_IN6_ALIASREQ
487dnl on FreeBSD (BZ#408).
488
489AC_CHECK_HEADERS([net/if.h], [], [], QUAGGA_INCLUDES)
490
491m4_define([QUAGGA_INCLUDES],
492QUAGGA_INCLUDES
493[#if HAVE_NET_IF_H
494# include <net/if.h>
495#endif
496])dnl
497
498dnl Same applies for HAVE_NET_IF_VAR_H, which HAVE_NETINET6_ND6_H and
499dnl HAVE_NETINET_IN_VAR_H depend upon. But if_var.h depends on if.h, hence
500dnl an additional round for it.
501
502AC_CHECK_HEADERS([net/if_var.h], [], [], QUAGGA_INCLUDES)
503
504m4_define([QUAGGA_INCLUDES],
505QUAGGA_INCLUDES
506[#if HAVE_NET_IF_VAR_H
507# include <net/if_var.h>
508#endif
509])dnl
510
511AC_CHECK_HEADERS([sys/un.h netinet/in_systm.h netinet/in_var.h \
512 net/if_dl.h net/netopt.h net/route.h \
Paul Jakma11770e12007-06-22 16:14:42 +0000513 inet/nd.h arpa/inet.h netinet/ip_icmp.h \
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000514 fcntl.h stddef.h sys/ioctl.h syslog.h wchar.h wctype.h \
515 sys/sysctl.h sys/sockio.h kvm.h sys/conf.h],
516 [], [], QUAGGA_INCLUDES)
517
518AC_CHECK_HEADERS([ucontext.h], [], [],
519[#ifndef __USE_GNU
520#define __USE_GNU
521#endif /* __USE_GNU */
522QUAGGA_INCLUDES
523])
524
525m4_define([QUAGGA_INCLUDES],
526QUAGGA_INCLUDES
Denis Ovsienko2b43bf22011-07-14 16:30:08 +0400527[#if HAVE_SYS_UN_H
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000528# include <sys/un.h>
529#endif
530#if HAVE_NETINET_IN_SYSTM_H
531# include <netinet/in_systm.h>
532#endif
533#if HAVE_NETINET_IN_VAR_H
534# include <netinet/in_var.h>
535#endif
536#if HAVE_NET_IF_DL_H
537# include <net/if_dl.h>
538#endif
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000539#if HAVE_NET_NETOPT_H
540# include <net/netopt.h>
541#endif
542#if HAVE_NET_ROUTE_H
543# include <net/route.h>
544#endif
545#if HAVE_INET_ND_H
546# include <inet/nd.h>
547#endif
548#if HAVE_ARPA_INET_H
549# include <arpa/inet.h>
550#endif
Paul Jakma11770e12007-06-22 16:14:42 +0000551/* Required for IDRP */
552#if HAVE_NETINET_IP_ICMP_H
553# include <netinet/ip_icmp.h>
554#endif
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000555])dnl
pauldc7a2bf2003-10-22 00:07:44 +0000556
gdtfa3232e2003-12-03 17:52:30 +0000557dnl V6 headers are checked below, after we check for v6
paul7ea487b2003-03-17 02:05:07 +0000558
paul7ea487b2003-03-17 02:05:07 +0000559dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
560case "$host" in
paulafd8a122005-03-12 06:36:10 +0000561 [*-sunos5.[6-7]*] | [*-solaris2.[6-7]*])
paul7ea487b2003-03-17 02:05:07 +0000562 opsys=sol2-6
paulafd8a122005-03-12 06:36:10 +0000563 AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.7)
paul19877dd2004-05-11 10:49:35 +0000564 AC_DEFINE(SUNOS_5, 1, SunOS 5)
paul7ea487b2003-03-17 02:05:07 +0000565 AC_CHECK_LIB(xnet, main)
566 CURSES=-lcurses
567 ;;
paul1b73de82005-04-10 16:31:51 +0000568 [*-sunos5.[8-9]] \
569 | [*-sunos5.1[0-9]] \
570 | [*-sunos5.1[0-9].[0-9]] \
571 | [*-solaris2.[8-9]] \
572 | [*-solaris2.1[0-9]] \
573 | [*-solaris2.1[0-9].[0-9]])
paulafd8a122005-03-12 06:36:10 +0000574 opsys=sol8
Paul Jakmafb66b292006-05-28 08:26:15 +0000575 AC_DEFINE(SUNOS_59, 1, [SunOS 5.8 up])
576 AC_DEFINE(SUNOS_5, 1, [SunOS 5])
paul19877dd2004-05-11 10:49:35 +0000577 AC_CHECK_LIB(socket, main)
578 AC_CHECK_LIB(nsl, main)
paul1b73de82005-04-10 16:31:51 +0000579 AC_CHECK_LIB(umem, main)
Paul Jakmafb66b292006-05-28 08:26:15 +0000580 AC_CHECK_FUNCS([printstack],
581 [AC_DEFINE([HAVE_PRINTSTACK],1,[Solaris printstack])
582 AC_DEFINE([HAVE_STACK_TRACE],1,[Stack symbols decode functionality])
583 ])
paul19877dd2004-05-11 10:49:35 +0000584 CURSES=-lcurses
585 ;;
paul7ea487b2003-03-17 02:05:07 +0000586 *-sunos5* | *-solaris2*)
paul19877dd2004-05-11 10:49:35 +0000587 AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
paul7ea487b2003-03-17 02:05:07 +0000588 AC_CHECK_LIB(socket, main)
589 AC_CHECK_LIB(nsl, main)
590 CURSES=-lcurses
591 ;;
hassoc45eb832005-02-19 13:58:06 +0000592 *-linux*)
paul7ea487b2003-03-17 02:05:07 +0000593 opsys=gnu-linux
594 AC_DEFINE(GNU_LINUX,,GNU Linux)
595 ;;
596 *-nec-sysv4*)
597 AC_CHECK_LIB(nsl, gethostbyname)
598 AC_CHECK_LIB(socket, socket)
599 ;;
paul7ea487b2003-03-17 02:05:07 +0000600 *-openbsd*)
601 opsys=openbsd
602 AC_DEFINE(OPEN_BSD,,OpenBSD)
603 ;;
604 *-bsdi*)
605 opsys=bsdi
606 OTHER_METHOD="mtu_kvm.o"
607 AC_CHECK_LIB(kvm, main)
608 ;;
paul49e3b3c2003-10-23 20:39:50 +0000609 *-irix6.5)
pauldc7a2bf2003-10-22 00:07:44 +0000610 opsys=irix
611 AC_DEFINE(IRIX_65,,IRIX 6.5)
612 ;;
paul7ea487b2003-03-17 02:05:07 +0000613esac
614
Paul Jakma62c9f502009-07-19 17:33:21 +0100615AC_SYS_LARGEFILE
616
paul7ea487b2003-03-17 02:05:07 +0000617dnl ---------------------
618dnl Integrated VTY option
619dnl ---------------------
620case "${enable_vtysh}" in
621 "yes") VTYSH="vtysh";
622 AC_DEFINE(VTYSH,,VTY shell)
gdtfc9d0742004-06-30 14:25:12 +0000623dnl Vtysh uses libreadline, which looks for termcap functions at
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000624dnl configure time. We follow readlines search order.
gdtfc9d0742004-06-30 14:25:12 +0000625dnl The required procedures are in libtermcap on NetBSD, in
626dnl [TODO] on Linux, and in [TODO] on Solaris.
hassoc0689392005-08-25 12:00:58 +0000627 AC_CHECK_LIB(termcap, tputs, LIBREADLINE="$LIBREADLINE -ltermcap",
paula9694592005-08-25 14:50:05 +0000628 [AC_CHECK_LIB(tinfo, tputs, LIBREADLINE="$LIBREADLINE -ltinfo",
629 [AC_CHECK_LIB(curses, tputs, LIBREADLINE="$LIBREADLINE -lcurses",
630 [AC_CHECK_LIB(ncurses, tputs,
631 LIBREADLINE="$LIBREADLINE -lncurses")]
632 )]
633 )]
634 )
635 AC_CHECK_LIB(readline, main, LIBREADLINE="$LIBREADLINE -lreadline",,
636 "$LIBREADLINE")
paul7ea487b2003-03-17 02:05:07 +0000637 if test $ac_cv_lib_readline_main = no; then
gdtfc9d0742004-06-30 14:25:12 +0000638 AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
paul7ea487b2003-03-17 02:05:07 +0000639 fi
640 AC_CHECK_HEADER(readline/history.h)
641 if test $ac_cv_header_readline_history_h = no;then
642 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
643 fi
paula9694592005-08-25 14:50:05 +0000644 AC_CHECK_LIB(readline, rl_completion_matches,
645 LIBREADLINE="$LIBREADLINE",, "$LIBREADLINE")
paul3d3de8c2003-05-23 10:33:49 +0000646 if test $ac_cv_lib_readline_rl_completion_matches = no; then
647 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
648 fi
649 ;;
paul7ea487b2003-03-17 02:05:07 +0000650 "no" ) VTYSH="";;
651 * ) ;;
652esac
hassoc0689392005-08-25 12:00:58 +0000653AC_SUBST(LIBREADLINE)
David Wardf027d332012-04-30 11:36:15 -0400654AM_CONDITIONAL(VTYSH, test "x$VTYSH" = "xvtysh")
paul7ea487b2003-03-17 02:05:07 +0000655
656dnl ----------
657dnl PAM module
Denis Ovsienko61599282011-07-15 00:24:15 +0400658dnl
659dnl Quagga detects the PAM library it is built against by checking for a
660dnl functional pam_misc.h (Linux-PAM) or openpam.h (OpenPAM) header. pam_misc.h
661dnl is known to #include pam_appl.h, the standard header of a PAM library, and
662dnl openpam.h doesn't do that, although depends on the header too. Hence a
663dnl little assistance to AC_CHECK_HEADER is necessary for the proper detection
664dnl of OpenPAM.
paul7ea487b2003-03-17 02:05:07 +0000665dnl ----------
666if test "$with_libpam" = "yes"; then
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000667 AC_CHECK_HEADER([security/pam_misc.h],
668 [AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
669 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
670 pam_conv_func="misc_conv"
671 ],
672 [], QUAGGA_INCLUDES)
673 AC_CHECK_HEADER([security/openpam.h],
674 [AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
675 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
676 pam_conv_func="openpam_ttyconv"
677 ],
Denis Ovsienko61599282011-07-15 00:24:15 +0400678 [], QUAGGA_INCLUDES[#include <security/pam_appl.h>])
paul24cd4352003-05-06 12:16:27 +0000679 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
680 AC_MSG_WARN([*** pam support will not be built ***])
681 with_libpam="no"
682 fi
683fi
684
685if test "$with_libpam" = "yes"; then
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000686dnl took this test from proftpds configure.in and suited to our needs
paul7ea487b2003-03-17 02:05:07 +0000687dnl -------------------------------------------------------------------------
688dnl
689dnl This next check looks funky due to a linker problem with some versions
690dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
691dnl omitted requiring libdl linking information. PAM-0.72 or better ships
692dnl with RedHat 6.2 and Debian 2.2 or better.
693AC_CHECK_LIB(pam, pam_start,
paul24cd4352003-05-06 12:16:27 +0000694 [AC_CHECK_LIB(pam, $pam_conv_func,
paul7ea487b2003-03-17 02:05:07 +0000695 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
696 LIBPAM="-lpam"],
697 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
698 LIBPAM="-lpam -lpam_misc"]
699 )
700 ],
701
702 [AC_CHECK_LIB(pam, pam_end,
paul24cd4352003-05-06 12:16:27 +0000703 [AC_CHECK_LIB(pam, $pam_conv_func,
paula159ed92003-06-04 11:01:45 +0000704 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul7ea487b2003-03-17 02:05:07 +0000705 LIBPAM="-lpam -ldl"],
paula159ed92003-06-04 11:01:45 +0000706 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul7ea487b2003-03-17 02:05:07 +0000707 LIBPAM="-lpam -ldl -lpam_misc"]
708 )
709 ],AC_MSG_WARN([*** pam support will not be built ***]),
710 [-ldl])
711 ]
712)
713fi
714AC_SUBST(LIBPAM)
715
716dnl -------------------------------
717dnl Endian-ness check
718dnl -------------------------------
719AC_WORDS_BIGENDIAN
720
721dnl -------------------------------
722dnl check the size in byte of the C
723dnl -------------------------------
724dnl AC_CHECK_SIZEOF(char)
725dnl AC_CHECK_SIZEOF(int)
726dnl AC_CHECK_SIZEOF(short)
727dnl AC_CHECK_SIZEOF(long)
728
729dnl ----------------------------
730dnl check existance of functions
731dnl ----------------------------
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000732AC_FUNC_CHOWN
733AC_FUNC_FNMATCH
734AC_FUNC_FORK
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000735AC_FUNC_MEMCMP
736AC_FUNC_MKTIME
737AC_FUNC_STRFTIME
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000738AC_FUNC_STAT
739AC_FUNC_SELECT_ARGTYPES
740AC_FUNC_STRFTIME
Paul Jakmad46d2a22007-05-10 16:53:04 +0000741dnl Avoid AC_FUNC_STRNLEN because it pulls in AC_SYSTEM_EXTENSIONS which
742dnl can lead to strange side effects. So we just check for strnlen
743dnl directly, see below.
Paul Jakma2b5cb412007-05-10 17:05:16 +0000744dnl AC_FUNC_STRNLENdnl
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000745AC_FUNC_VPRINTF
746
747dnl -------------------------------
748dnl bgpd needs pow() and hence libm
749dnl -------------------------------
750TMPLIBS="$LIBS"
751AC_CHECK_HEADER([math.h],
752 [AC_CHECK_LIB([m], [pow],
753 [LIBM="-lm"
754 LIBS="$LIBS $LIBM"
755 AC_DEFINE(HAVE_LIBM,, Have libm)
756 AC_CHECK_FUNCS(pow,[],[LIBM=""])
757 ])
758])
759if test x"$LIBM" = x ; then
760 AC_MSG_WARN([Unable to find working pow function - bgpd may not link])
761fi
762LIBS="$TMPLIBS"
763AC_SUBST(LIBM)
764
765dnl ---------------
766dnl other functions
767dnl ---------------
768AC_CHECK_FUNCS([dup2 ftruncate getcwd gethostbyname getpagesize gettimeofday \
Paul Jakmad46d2a22007-05-10 16:53:04 +0000769 inet_ntoa inet_aton strnlen \
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000770 memchr memmove memset select socket \
771 strcasecmp strchr strcspn strdup strerror \
772 strncasecmp strndup strrchr strspn strstr \
773 strtol strtoul strlcat strlcpy \
774 daemon snprintf vsnprintf \
775 if_nametoindex if_indextoname getifaddrs \
776 uname fcntl])
777
paula159ed92003-06-04 11:01:45 +0000778AC_CHECK_FUNCS(setproctitle, ,
779 [AC_CHECK_LIB(util, setproctitle,
780 [LIBS="$LIBS -lutil"
781 AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
782 ]
783 )
784 ]
785)
paul7ea487b2003-03-17 02:05:07 +0000786
787dnl ------------------------------------
788dnl Determine routing get and set method
789dnl ------------------------------------
790AC_MSG_CHECKING(zebra between kernel interface method)
791if test x"$opsys" = x"gnu-linux"; then
792 if test "${enable_netlink}" = "yes";then
793 AC_MSG_RESULT(netlink)
794 RT_METHOD=rt_netlink.o
795 AC_DEFINE(HAVE_NETLINK,,netlink)
796 netlink=yes
797 elif test "${enable_netlink}" = "no"; then
798 AC_MSG_RESULT(ioctl)
799 RT_METHOD=rt_ioctl.o
800 netlink=no
801 else
802 AC_MSG_RESULT(netlink)
803 RT_METHOD=rt_netlink.o
804 AC_DEFINE(HAVE_NETLINK,,netlink)
805 netlink=yes
806 fi
paul19877dd2004-05-11 10:49:35 +0000807elif test x"$opsys" = x"sol2-6";then
808 AC_MSG_RESULT(Route socket)
809 KERNEL_METHOD="kernel_socket.o"
810 RT_METHOD="rt_socket.o"
paulafd8a122005-03-12 06:36:10 +0000811elif test x"$opsys" = x"sol8";then
paul19877dd2004-05-11 10:49:35 +0000812 AC_MSG_RESULT(Route socket)
813 KERNEL_METHOD="kernel_socket.o"
814 RT_METHOD="rt_socket.o"
815elif test "$opsys" = "irix" ; then
816 AC_MSG_RESULT(Route socket)
817 KERNEL_METHOD="kernel_socket.o"
818 RT_METHOD="rt_socket.o"
paul7ea487b2003-03-17 02:05:07 +0000819else
paul19877dd2004-05-11 10:49:35 +0000820 AC_TRY_RUN([#include <errno.h>
paul7ea487b2003-03-17 02:05:07 +0000821#include <sys/types.h>
822#include <sys/socket.h>
823
824main ()
825{
826 int ac_sock;
827
828 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
829 if (ac_sock < 0 && errno == EINVAL)
830 exit (1);
831 exit (0);
832}],
833 [KERNEL_METHOD=kernel_socket.o
834 RT_METHOD=rt_socket.o
835 AC_MSG_RESULT(socket)],
836 [RT_METHOD=rt_ioctl.o
837 AC_MSG_RESULT(ioctl)],
838 [KERNEL_METHOD=kernel_socket.o
839 RT_METHOD=rt_socket.o
840 AC_MSG_RESULT(socket)])
paul7ea487b2003-03-17 02:05:07 +0000841fi
842AC_SUBST(RT_METHOD)
843AC_SUBST(KERNEL_METHOD)
844AC_SUBST(OTHER_METHOD)
Avneesh Sachdev5adc2522012-11-13 22:48:59 +0000845AM_CONDITIONAL([HAVE_NETLINK], [test "x$netlink" = "xyes"])
paul7ea487b2003-03-17 02:05:07 +0000846
Paul Jakma238497f2007-08-07 18:49:18 +0000847dnl --------------------------
848dnl Determine IS-IS I/O method
849dnl --------------------------
David Lamparter745bf052010-02-02 21:49:35 +0100850AC_DEFINE(ISIS_METHOD_PFPACKET, 1, [ constant value for isis method pfpacket ])
851AC_DEFINE(ISIS_METHOD_DLPI, 2, [ constant value for isis method dlpi ])
852AC_DEFINE(ISIS_METHOD_BPF, 3, [ constant value for isis method bpf ])
Paul Jakma238497f2007-08-07 18:49:18 +0000853AC_CHECK_HEADER(net/bpf.h)
854AC_CHECK_HEADER(sys/dlpi.h)
855AC_MSG_CHECKING(zebra IS-IS I/O method)
856if test x"$opsys" = x"gnu-linux"; then
857 AC_MSG_RESULT(pfpacket)
David Lamparter745bf052010-02-02 21:49:35 +0100858 ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET"
Paul Jakma238497f2007-08-07 18:49:18 +0000859elif test x"$opsys" = x"sol2-6" -o x"$opsys" = x"sol8"; then
860 AC_MSG_RESULT(DLPI)
David Lamparter745bf052010-02-02 21:49:35 +0100861 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
Paul Jakma238497f2007-08-07 18:49:18 +0000862else
863 if test $ac_cv_header_net_bpf_h = no; then
864 if test $ac_cv_header_sys_dlpi_h = no; then
865 AC_MSG_RESULT(none)
866 AC_MSG_WARN([*** IS-IS support will not be built ***])
867 ISISD=""
868 else
869 AC_MSG_RESULT(DLPI)
870 fi
David Lamparter745bf052010-02-02 21:49:35 +0100871 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
Paul Jakma238497f2007-08-07 18:49:18 +0000872 else
873 AC_MSG_RESULT(BPF)
David Lamparter745bf052010-02-02 21:49:35 +0100874 ISIS_METHOD_MACRO="ISIS_METHOD_BPF"
Paul Jakma238497f2007-08-07 18:49:18 +0000875 fi
876fi
David Lamparter745bf052010-02-02 21:49:35 +0100877AC_DEFINE_UNQUOTED(ISIS_METHOD, $ISIS_METHOD_MACRO, [ selected method for isis, == one of the constants ])
Paul Jakma238497f2007-08-07 18:49:18 +0000878
ajsb99760a2005-01-04 16:24:43 +0000879dnl ------------------------------------
880dnl check for broken CMSG_FIRSTHDR macro
881dnl ------------------------------------
gdt6c200462005-01-04 17:02:48 +0000882AC_MSG_CHECKING(for broken CMSG_FIRSTHDR)
hasso5b087522005-04-03 23:46:37 +0000883AC_RUN_IFELSE([AC_LANG_SOURCE([[
ajsb99760a2005-01-04 16:24:43 +0000884#ifdef SUNOS_5
885#define _XPG4_2
886#define __EXTENSIONS__
887#endif
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000888#ifdef HAVE_STDLIB_H
889# include <stdlib.h>
890#endif
891#ifdef HAVE_SYS_TYPES_H
ajsb99760a2005-01-04 16:24:43 +0000892#include <sys/types.h>
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000893#endif
894#ifdef HAVE_SYS_SOCKET_H
ajsb99760a2005-01-04 16:24:43 +0000895#include <sys/socket.h>
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000896#endif
ajsb99760a2005-01-04 16:24:43 +0000897
898main()
899{
900 struct msghdr msg;
901 char buf[4];
902
903 msg.msg_control = buf;
904 msg.msg_controllen = 0;
905
906 if (CMSG_FIRSTHDR(&msg) != NULL)
907 exit(0);
908 exit (1);
hasso5b087522005-04-03 23:46:37 +0000909}]])],[AC_MSG_RESULT(yes - using workaround) AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)],
hassod33e8d72005-04-03 13:07:21 +0000910[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
ajsb99760a2005-01-04 16:24:43 +0000911
paul7ea487b2003-03-17 02:05:07 +0000912dnl ------------------------------
913dnl check kernel route read method
914dnl ------------------------------
Jeremy Jackson5589ffa2009-01-21 18:27:37 -0500915AC_CACHE_CHECK([route read method], [quagga_cv_rtread_method],
916[if test "x$netlink" = xyes; then
917 quagga_cv_rtread_method="netlink"
paul7ea487b2003-03-17 02:05:07 +0000918else
Jeremy Jackson5589ffa2009-01-21 18:27:37 -0500919for quagga_cv_rtread_method in /proc/net/route /dev/ip /dev/null;
paul7ea487b2003-03-17 02:05:07 +0000920do
Jeremy Jackson5589ffa2009-01-21 18:27:37 -0500921 test x`ls $quagga_cv_rtread_method 2>/dev/null` = x"$quagga_cv_rtread_method" && break
paul7ea487b2003-03-17 02:05:07 +0000922done
Jeremy Jackson5589ffa2009-01-21 18:27:37 -0500923case $quagga_cv_rtread_method in
924 "/proc/net/route") quagga_cv_rtread_method="proc";;
paul9c30ab62003-07-08 08:36:17 +0000925 "/dev/ip")
926 case "$host" in
Jeremy Jackson5589ffa2009-01-21 18:27:37 -0500927 *-freebsd*) quagga_cv_rtread_method="sysctl";;
928 *) quagga_cv_rtread_method="getmsg";;
paul9c30ab62003-07-08 08:36:17 +0000929 esac;;
Jeremy Jackson5589ffa2009-01-21 18:27:37 -0500930 *)
931 quagga_cv_rtread_method="sysctl";;
paul7ea487b2003-03-17 02:05:07 +0000932esac
933fi])
Jeremy Jackson5589ffa2009-01-21 18:27:37 -0500934RTREAD_METHOD=rtread_${quagga_cv_rtread_method}.o
paul7ea487b2003-03-17 02:05:07 +0000935AC_SUBST(RTREAD_METHOD)
936
937dnl -----------------------------
938dnl check interface lookup method
939dnl -----------------------------
paul19877dd2004-05-11 10:49:35 +0000940IOCTL_METHOD=ioctl.o
paul7ea487b2003-03-17 02:05:07 +0000941AC_MSG_CHECKING(interface looking up method)
942if test "$netlink" = yes; then
943 AC_MSG_RESULT(netlink)
944 IF_METHOD=if_netlink.o
paul19877dd2004-05-11 10:49:35 +0000945elif test "$opsys" = "sol2-6";then
946 AC_MSG_RESULT(Solaris GIF)
947 IF_METHOD=if_ioctl.o
paulafd8a122005-03-12 06:36:10 +0000948elif test "$opsys" = "sol8";then
paul19877dd2004-05-11 10:49:35 +0000949 AC_MSG_RESULT(Solaris GLIF)
950 IF_METHOD=if_ioctl_solaris.o
951 IOCTL_METHOD=ioctl_solaris.o
952elif test "$opsys" = "irix" ; then
953 AC_MSG_RESULT(IRIX)
954 IF_METHOD=if_ioctl.o
955elif test "$opsys" = "openbsd";then
956 AC_MSG_RESULT(openbsd)
957 IF_METHOD=if_ioctl.o
958elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
959 AC_MSG_RESULT(sysctl)
paul7ea487b2003-03-17 02:05:07 +0000960 IF_METHOD=if_sysctl.o
961 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
paul19877dd2004-05-11 10:49:35 +0000962else
paul7ea487b2003-03-17 02:05:07 +0000963 AC_MSG_RESULT(ioctl)
964 IF_METHOD=if_ioctl.o
paul7ea487b2003-03-17 02:05:07 +0000965fi
966AC_SUBST(IF_METHOD)
paul19877dd2004-05-11 10:49:35 +0000967AC_SUBST(IOCTL_METHOD)
paul7ea487b2003-03-17 02:05:07 +0000968
paul42c98192005-05-07 02:22:51 +0000969dnl ---------------------------------------------------------------
970dnl figure out how to specify an interface in multicast sockets API
971dnl ---------------------------------------------------------------
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000972AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], [], QUAGGA_INCLUDES)
paul42c98192005-05-07 02:22:51 +0000973
974AC_MSG_CHECKING([for BSD struct ip_mreq hack])
975AC_TRY_COMPILE([#ifdef HAVE_SYS_PARAM_H
976#include <sys/param.h>
Brad Smith1b54f792012-08-09 00:44:28 +0000977#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__)
paul42c98192005-05-07 02:22:51 +0000978 return (0);
979#else
980 #error No support for BSD struct ip_mreq hack detected
981#endif],[AC_MSG_RESULT(yes)
982AC_DEFINE(HAVE_BSD_STRUCT_IP_MREQ_HACK,,[Can pass ifindex in struct ip_mreq])],
983AC_MSG_RESULT(no))
984
Dmitrij Tejblum10d04cd2011-08-22 11:39:35 +0400985AC_MSG_CHECKING([for RFC3678 protocol-independed API])
986AC_TRY_COMPILE([
987#include <sys/types.h>
988#include <netinet/in.h>
989], [struct group_req gr; int sock; setsockopt(sock, IPPROTO_IP, MCAST_JOIN_GROUP, (void*)&gr, sizeof(gr));
990], [AC_MSG_RESULT(yes)
991AC_DEFINE(HAVE_RFC3678,1,[Have RFC3678 protocol-independed API])],
992AC_MSG_RESULT(no))
993
Andrew J. Schorrc543a172008-01-10 15:24:32 +0000994dnl ---------------------------------------------------------------
995dnl figure out how to check link-state
996dnl ---------------------------------------------------------------
Andrew J. Schorr6418bed2008-01-11 16:33:59 +0000997AC_CHECK_HEADER([net/if.h],
998 [AC_CHECK_HEADER( [net/if_media.h],
999 [m4_define([LINK_DETECT_INCLUDES],
1000 QUAGGA_INCLUDES
1001 [#include <net/if_media.h>
1002 ])
1003 AC_CHECK_MEMBERS( [struct ifmediareq.ifm_status],
1004 AC_DEFINE(HAVE_BSD_LINK_DETECT,,[BSD link-detect]),
1005 [], LINK_DETECT_INCLUDES)],
1006 [],
1007 QUAGGA_INCLUDES)],
1008 [], QUAGGA_INCLUDES )
Andrew J. Schorrc543a172008-01-10 15:24:32 +00001009
Doug VanLeuven9234b382012-10-10 16:12:32 -07001010dnl ---------------------------------------------------------------
1011dnl Additional, newer way to check link-state using ifi_link_state.
1012dnl Not available in all BSD's when ifmediareq available
1013dnl ---------------------------------------------------------------
1014AC_CHECK_HEADER([net/if.h],
1015 AC_CHECK_MEMBERS([struct if_data.ifi_link_state],
1016 AC_DEFINE(HAVE_BSD_IFI_LINK_STATE,,[BSD ifi_link_state available]),
1017 [], QUAGGA_INCLUDES),
1018 ,)
1019
Paul Jakma0df7c912008-07-21 21:02:49 +00001020dnl ------------------------
1021dnl TCP_MD5SIG socket option
1022dnl ------------------------
1023
1024AC_CHECK_HEADER([netinet/tcp.h],
1025 [m4_define([MD5_INCLUDES],
1026 QUAGGA_INCLUDES
1027 [#include <netinet/tcp.h>
1028 ])
1029 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)],
1030 [],
1031 QUAGGA_INCLUDES)
1032if test $ac_cv_have_decl_TCP_MD5SIG = no; then
1033 AC_CHECK_HEADER([linux/tcp.h],
1034 [m4_define([MD5_INCLUDES],
1035 QUAGGA_INCLUDES
1036 [#include <linux/tcp.h>
1037 ])
1038 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)])
1039fi
1040
paul7ea487b2003-03-17 02:05:07 +00001041dnl -----------------------
1042dnl check proc file system.
1043dnl -----------------------
Stephen Hemmingercadfb2c2008-08-16 18:03:44 +01001044if test "$netlink" != yes; then
1045 if test -r /proc/net/dev; then
1046 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
1047 IF_PROC=if_proc.o
1048 fi
1049 if test -r /proc/net/if_inet6; then
1050 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
1051 IF_PROC=if_proc.o
1052 fi
paul7ea487b2003-03-17 02:05:07 +00001053fi
1054AC_SUBST(IF_PROC)
1055
1056dnl -----------------------------
1057dnl check ipforward detect method
1058dnl -----------------------------
Jeremy Jackson5589ffa2009-01-21 18:27:37 -05001059AC_CACHE_CHECK([ipforward method], [quagga_cv_ipforward_method],
David Lamparterca9f3422009-09-16 02:11:00 +02001060[if test x$cross_compiling = xyes; then
1061 if test x"$opsys" = x"gnu-linux"; then
1062 quagga_cv_ipforward_method=/proc/net/snmp
1063 else
1064 quagga_cv_ipforward_method=/dev/ip
1065 fi
1066else
1067 for quagga_cv_ipforward_method in /proc/net/snmp /dev/ip /dev/null;
1068 do
1069 test x`ls $quagga_cv_ipforward_method 2>/dev/null` = x"$quagga_cv_ipforward_method" && break
1070 done
1071fi
Jeremy Jackson5589ffa2009-01-21 18:27:37 -05001072case $quagga_cv_ipforward_method in
1073 "/proc/net/snmp") quagga_cv_ipforward_method="proc";;
paul7ea487b2003-03-17 02:05:07 +00001074 "/dev/ip")
1075 case "$host" in
Jeremy Jackson5589ffa2009-01-21 18:27:37 -05001076 *-nec-sysv4*) quagga_cv_ipforward_method="ews";;
1077 *-freebsd*) quagga_cv_ipforward_method="sysctl";;
1078 *) quagga_cv_ipforward_method="solaris";;
paul7ea487b2003-03-17 02:05:07 +00001079 esac;;
Jeremy Jackson5589ffa2009-01-21 18:27:37 -05001080 *) quagga_cv_ipforward_method="sysctl";;
paul7ea487b2003-03-17 02:05:07 +00001081esac])
Jeremy Jackson5589ffa2009-01-21 18:27:37 -05001082IPFORWARD=ipforward_${quagga_cv_ipforward_method}.o
paul7ea487b2003-03-17 02:05:07 +00001083AC_SUBST(IPFORWARD)
1084
1085AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
1086
1087dnl ----------
1088dnl IPv6 check
1089dnl ----------
1090AC_MSG_CHECKING(whether does this OS have IPv6 stack)
1091if test "${enable_ipv6}" = "no"; then
1092 AC_MSG_RESULT(disabled)
1093else
1094dnl ----------
1095dnl INRIA IPv6
1096dnl ----------
paula159ed92003-06-04 11:01:45 +00001097 if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
1098 zebra_cv_ipv6=yes
1099 AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
1100 AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
1101 RIPNGD="ripngd"
1102 OSPF6D="ospf6d"
1103 LIB_IPV6=""
1104 AC_MSG_RESULT(INRIA IPv6)
paul7ea487b2003-03-17 02:05:07 +00001105dnl ---------
1106dnl KAME IPv6
1107dnl ---------
paula159ed92003-06-04 11:01:45 +00001108 elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
1109 zebra_cv_ipv6=yes
1110 AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
1111 AC_DEFINE(KAME,1,KAME IPv6)
1112 RIPNGD="ripngd"
1113 OSPF6D="ospf6d"
1114 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
paul7ea487b2003-03-17 02:05:07 +00001115 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +00001116 fi
1117 AC_MSG_RESULT(KAME)
hasso71c0fb52003-05-25 20:18:13 +00001118dnl -------------------------
1119dnl MUSICA IPv6
1120dnl default host check
1121dnl It is not used by Kheops
1122dnl -------------------------
paula159ed92003-06-04 11:01:45 +00001123 elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
1124 zebra_cv_ipv6=yes
1125 AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
1126 AC_DEFINE(MUSICA,1,Musica IPv6 stack)
1127 AC_DEFINE(KAME,1,KAME IPv6 stack)
1128 RIPNGD="ripngd"
1129 OSPF6D="ospf6d"
1130 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
hasso71c0fb52003-05-25 20:18:13 +00001131 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +00001132 fi
1133 AC_MSG_RESULT(MUSICA)
paul7ea487b2003-03-17 02:05:07 +00001134dnl ---------
1135dnl NRL check
1136dnl ---------
paula159ed92003-06-04 11:01:45 +00001137 elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
1138 zebra_cv_ipv6=yes
1139 AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
1140 AC_DEFINE(NRL,1,NRL)
1141 RIPNGD="ripngd"
1142 OSPF6D="ospf6d"
1143 if test x"$opsys" = x"bsdi";then
paul7ea487b2003-03-17 02:05:07 +00001144 AC_DEFINE(BSDI_NRL,,BSDI)
1145 AC_MSG_RESULT(BSDI_NRL)
paula159ed92003-06-04 11:01:45 +00001146 else
paul7ea487b2003-03-17 02:05:07 +00001147 AC_MSG_RESULT(NRL)
paula159ed92003-06-04 11:01:45 +00001148 fi
paul19877dd2004-05-11 10:49:35 +00001149dnl ------------------------------------
1150dnl Solaris 9, 10 and potentially higher
1151dnl ------------------------------------
paulafd8a122005-03-12 06:36:10 +00001152 elif test x"$opsys" = x"sol8"; then
paul19877dd2004-05-11 10:49:35 +00001153 zebra_cv_ipv6=yes;
1154 AC_DEFINE(HAVE_IPV6, 1, IPv6)
1155 AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
1156 RIPNGD="ripngd"
1157 OSPF6D="ospf6d"
1158 AC_MSG_RESULT(Solaris IPv6)
paul7ea487b2003-03-17 02:05:07 +00001159dnl ----------
1160dnl Linux IPv6
1161dnl ----------
paula159ed92003-06-04 11:01:45 +00001162 elif test "${enable_ipv6}" = "yes"; then
1163 AC_EGREP_CPP(yes, [
1164 #include <linux/version.h>
1165 /* 2.1.128 or later */
1166 #if LINUX_VERSION_CODE >= 0x020180
1167 yes
1168 #endif],
1169 [zebra_cv_ipv6=yes
1170 zebra_cv_linux_ipv6=yes
1171 AC_MSG_RESULT(Linux IPv6)])
1172 else
1173 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
1174 then
paul7ea487b2003-03-17 02:05:07 +00001175 zebra_cv_ipv6=yes
1176 zebra_cv_linux_ipv6=yes
1177 AC_MSG_RESULT(Linux IPv6)
paula159ed92003-06-04 11:01:45 +00001178 fi
1179 fi
paul7ea487b2003-03-17 02:05:07 +00001180
paula159ed92003-06-04 11:01:45 +00001181 if test "$zebra_cv_linux_ipv6" = "yes";then
hasso850d39f2005-06-30 13:52:20 +00001182 AC_MSG_CHECKING(whether libc has IPv6 support)
1183 AC_TRY_LINK([#include <netinet/in.h>
1184 ],[ int a; a = (int) in6addr_any.s6_addr[0]; if (a != 12345) return a; ],
1185 [AC_MSG_RESULT(yes)
1186 zebra_cv_ipv6=yes
1187 zebra_cv_linux_ipv6=yes],
1188 [AC_MSG_RESULT(no)
1189 zebra_cv_ipv6=no
1190 zebra_cv_linux_ipv6=no])
1191 fi
1192
1193 if test "$zebra_cv_linux_ipv6" = "yes";then
paula159ed92003-06-04 11:01:45 +00001194 AC_MSG_CHECKING(for GNU libc >= 2.1)
1195 AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
1196 AC_EGREP_CPP(yes, [
paul7ea487b2003-03-17 02:05:07 +00001197#include <features.h>
1198#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
1199 yes
paula159ed92003-06-04 11:01:45 +00001200#endif],
1201 [glibc=yes
1202 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
1203 AC_MSG_RESULT(yes)],
1204 AC_MSG_RESULT(no)
1205 )
1206 RIPNGD="ripngd"
1207 OSPF6D="ospf6d"
1208 if test "$glibc" != "yes"; then
paul7ea487b2003-03-17 02:05:07 +00001209 INCLUDES="-I/usr/inet6/include"
1210 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
1211 LIB_IPV6="-L/usr/inet6/lib -linet6"
1212 fi
paula159ed92003-06-04 11:01:45 +00001213 fi
1214 fi
paul7ea487b2003-03-17 02:05:07 +00001215
1216dnl -----------------------
1217dnl Set IPv6 related values
1218dnl -----------------------
paula159ed92003-06-04 11:01:45 +00001219 LIBS="$LIB_IPV6 $LIBS"
1220 AC_SUBST(LIB_IPV6)
paul7ea487b2003-03-17 02:05:07 +00001221
paula159ed92003-06-04 11:01:45 +00001222 if test x"$RIPNGD" = x""; then
1223 AC_MSG_RESULT(IPv4 only)
1224 fi
paul7ea487b2003-03-17 02:05:07 +00001225fi
1226
gdtfa3232e2003-12-03 17:52:30 +00001227dnl ------------------
1228dnl IPv6 header checks
1229dnl ------------------
1230if test "x${zebra_cv_ipv6}" = "xyes"; then
1231AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001232 netinet6/in6_var.h netinet6/nd6.h], [], [],
1233 QUAGGA_INCLUDES)
gdtfa3232e2003-12-03 17:52:30 +00001234fi
1235
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001236m4_define([QUAGGA_INCLUDES],dnl
1237QUAGGA_INCLUDES
1238[#if HAVE_NETINET6_IN6_H
1239#include <netinet6/in6.h>
1240#endif
1241#if HAVE_NETINET_IN6_VAR_H
1242#include <netinet/in6_var.h>
1243#endif
1244#if HAVE_NETINET_ICMP6_H
1245# include <netinet/icmp6.h>
1246#endif
1247#if HAVE_NETINET6_IN6_VAR_H
1248# include <netinet6/in6_var.h>
1249#endif
1250#if HAVE_NETINET6_ND6_H
Hasso Tepperfbf24542007-06-25 19:30:59 +00001251# include <netinet6/nd6.h>
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001252#endif
1253])dnl
1254
Joakim Tjernlundcbcd9bf2009-02-16 09:40:39 +01001255dnl disable doc check
1256if test "${enable_doc}" = "no";then
1257 DOC=""
1258else
1259 DOC="doc"
1260fi
1261
David Lampartere2b15802012-11-03 09:14:29 -07001262dnl can't use TESTS as name, that's special with automake
1263if test "${enable_tests}" = "no";then
1264 BUILD_TESTS=""
1265else
1266 BUILD_TESTS="tests"
1267fi
1268
paul7ea487b2003-03-17 02:05:07 +00001269dnl --------------------
1270dnl Daemon disable check
1271dnl --------------------
1272if test "${enable_zebra}" = "no";then
1273 ZEBRA=""
1274else
1275 ZEBRA="zebra"
1276fi
David Wardf027d332012-04-30 11:36:15 -04001277AM_CONDITIONAL(ZEBRA, test "x$ZEBRA" = "xzebra")
paul7ea487b2003-03-17 02:05:07 +00001278
1279if test "${enable_bgpd}" = "no";then
1280 BGPD=""
1281else
1282 BGPD="bgpd"
1283fi
David Wardf027d332012-04-30 11:36:15 -04001284AM_CONDITIONAL(BGPD, test "x$BGPD" = "xbgpd")
paul7ea487b2003-03-17 02:05:07 +00001285
1286if test "${enable_ripd}" = "no";then
1287 RIPD=""
1288else
1289 RIPD="ripd"
1290fi
David Wardf027d332012-04-30 11:36:15 -04001291AM_CONDITIONAL(RIPD, test "x$RIPD" = "xripd")
paul7ea487b2003-03-17 02:05:07 +00001292
1293if test "${enable_ospfd}" = "no";then
1294 OSPFD=""
1295else
1296 OSPFD="ospfd"
1297fi
David Wardf027d332012-04-30 11:36:15 -04001298AM_CONDITIONAL(OSPFD, test "x$OSPFD" = "xospfd")
paul7ea487b2003-03-17 02:05:07 +00001299
Paul Jakma57345092011-12-25 17:52:09 +01001300if test "${enable_babeld}" = "no";then
1301 BABELD=""
1302else
1303 BABELD="babeld"
1304fi
David Wardf027d332012-04-30 11:36:15 -04001305AM_CONDITIONAL(BABELD, test "x$BABELD" = "xbabeld")
Paul Jakma57345092011-12-25 17:52:09 +01001306
ajsd0199432004-12-22 14:03:52 +00001307if test "${enable_watchquagga}" = "no";then
1308 WATCHQUAGGA=""
1309else
1310 WATCHQUAGGA="watchquagga"
1311fi
David Wardf027d332012-04-30 11:36:15 -04001312AM_CONDITIONAL(WATCHQUAGGA, test "x$WATCHQUAGGA" = "xwatchquagga")
ajsd0199432004-12-22 14:03:52 +00001313
paul1ef74ef2003-03-21 15:16:05 +00001314OSPFCLIENT=""
Greg Troxel0d51c7e2011-03-24 10:19:43 -04001315if test "${enable_opaque_lsa}" != "no"; then
paul1ef74ef2003-03-21 15:16:05 +00001316 if test "${enable_ospfapi}" != "no";then
paul9a569842003-03-28 01:45:13 +00001317 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
paul1ef74ef2003-03-21 15:16:05 +00001318
1319 if test "${enable_ospfclient}" != "no";then
1320 OSPFCLIENT="ospfclient"
1321 fi
1322 fi
1323
paul7ea487b2003-03-17 02:05:07 +00001324fi
David Wardf027d332012-04-30 11:36:15 -04001325AM_CONDITIONAL(OSPFCLIENT, test "x$OSPFCLIENT" = "xospfclient")
paul7ea487b2003-03-17 02:05:07 +00001326
1327case "${enable_ripngd}" in
1328 "yes") RIPNGD="ripngd";;
1329 "no" ) RIPNGD="";;
1330 * ) ;;
1331esac
David Wardf027d332012-04-30 11:36:15 -04001332AM_CONDITIONAL(RIPNGD, test "x$RIPNGD" = "xripngd")
paul7ea487b2003-03-17 02:05:07 +00001333
1334case "${enable_ospf6d}" in
1335 "yes") OSPF6D="ospf6d";;
1336 "no" ) OSPF6D="";;
1337 * ) ;;
1338esac
David Wardf027d332012-04-30 11:36:15 -04001339AM_CONDITIONAL(OSPF6D, test "x$OSPF6D" = "xospf6d")
paul7ea487b2003-03-17 02:05:07 +00001340
jardin9e867fe2003-12-23 08:56:18 +00001341case "${enable_isisd}" in
1342 "yes") ISISD="isisd";;
1343 "no" ) ISISD="";;
hassoae399ab2004-09-13 20:22:18 +00001344 * ) ;;
jardin9e867fe2003-12-23 08:56:18 +00001345esac
David Wardf027d332012-04-30 11:36:15 -04001346AM_CONDITIONAL(ISISD, test "x$ISISD" = "xisisd")
jardin9e867fe2003-12-23 08:56:18 +00001347
Greg Troxel97cee872007-08-02 13:36:56 +00001348# XXX Perhaps auto-enable on Solaris, but that's messy for cross builds.
1349case "${enable_solaris}" in
1350 "yes") SOLARIS="solaris";;
1351 "no" ) SOLARIS="";;
1352 * ) ;;
1353esac
1354
paul7ea487b2003-03-17 02:05:07 +00001355if test "${enable_bgp_announce}" = "no";then
Paul Jakma750e8142008-07-22 21:11:48 +00001356 AC_DEFINE(DISABLE_BGP_ANNOUNCE,1,Disable BGP installation to zebra)
1357else
1358 AC_DEFINE(DISABLE_BGP_ANNOUNCE,0,Disable BGP installation to zebra)
paul7ea487b2003-03-17 02:05:07 +00001359fi
1360
Joakim Tjernlundcbcd9bf2009-02-16 09:40:39 +01001361AC_SUBST(DOC)
David Lampartere2b15802012-11-03 09:14:29 -07001362AC_SUBST(BUILD_TESTS)
paul7ea487b2003-03-17 02:05:07 +00001363AC_SUBST(ZEBRA)
1364AC_SUBST(BGPD)
1365AC_SUBST(RIPD)
1366AC_SUBST(RIPNGD)
1367AC_SUBST(OSPFD)
1368AC_SUBST(OSPF6D)
Paul Jakma57345092011-12-25 17:52:09 +01001369AC_SUBST(BABELD)
ajsd0199432004-12-22 14:03:52 +00001370AC_SUBST(WATCHQUAGGA)
jardin9e867fe2003-12-23 08:56:18 +00001371AC_SUBST(ISISD)
Greg Troxel97cee872007-08-02 13:36:56 +00001372AC_SUBST(SOLARIS)
paul7ea487b2003-03-17 02:05:07 +00001373AC_SUBST(VTYSH)
1374AC_SUBST(INCLUDES)
1375AC_SUBST(CURSES)
1376AC_SUBST(OSPFCLIENT)
paul1ef74ef2003-03-21 15:16:05 +00001377AC_SUBST(OSPFAPI)
paul7ea487b2003-03-17 02:05:07 +00001378AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
1379AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
1380AC_CHECK_LIB(crypt, crypt)
1381AC_CHECK_LIB(resolv, res_init)
paul7ea487b2003-03-17 02:05:07 +00001382
1383dnl ---------------------------------------------------
1384dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
1385dnl ---------------------------------------------------
paula159ed92003-06-04 11:01:45 +00001386AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
1387AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
1388AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
paul7ea487b2003-03-17 02:05:07 +00001389
1390dnl ---------------------------
Jeremy Jackson25f45882009-01-12 16:06:12 -05001391dnl check system has PCRE regexp
1392dnl ---------------------------
1393if test "x$enable_pcreposix" = "xyes"; then
1394 AC_CHECK_LIB(pcreposix, pcreposix_regexec, ,[enable_pcreposix=no
1395 AC_MSG_WARN([*** falling back to other regex library ***]) ])
1396fi
1397
1398if test "x$enable_pcreposix" != "xyes"; then
1399dnl ---------------------------
paul7ea487b2003-03-17 02:05:07 +00001400dnl check system has GNU regexp
1401dnl ---------------------------
Jeremy Jackson25f45882009-01-12 16:06:12 -05001402AC_MSG_CHECKING(whether system has GNU regex)
paul7ea487b2003-03-17 02:05:07 +00001403AC_CHECK_LIB(c, regexec,
1404[AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
1405 LIB_REGEX=""],
1406[LIB_REGEX="regex.o"])
Jeremy Jackson25f45882009-01-12 16:06:12 -05001407fi
1408AC_SUBST(HAVE_LIBPCREPOSIX)
paul7ea487b2003-03-17 02:05:07 +00001409AC_SUBST(LIB_REGEX)
1410
1411dnl ------------------
paulb1fc9ac2006-01-31 10:09:27 +00001412dnl check Net-SNMP library
paul7ea487b2003-03-17 02:05:07 +00001413dnl ------------------
Vincent Bernatd6be5fb2012-05-24 09:44:43 +02001414if test "${enable_snmp}" != ""; then
Vincent Bernat08d7f652012-05-22 22:29:17 +02001415 AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], [no])
1416 if test x"$NETSNMP_CONFIG" = x"no"; then
1417 AC_MSG_ERROR([--enable-snmp given but unable to find net-snmp-config])
1418 fi
1419 LIBS="$LIBS `${NETSNMP_CONFIG} --agent-libs`"
1420 CFLAGS="`${NETSNMP_CONFIG} --base-cflags` $CFLAGS"
1421 AC_MSG_CHECKING([whether we can link to Net-SNMP])
1422 AC_LINK_IFELSE([AC_LANG_PROGRAM([
1423int main(void);
1424],
1425[
1426{
1427 return 0;
1428}
1429])],[AC_MSG_RESULT(yes)],[
1430 AC_MSG_RESULT(no)
1431 AC_MSG_ERROR([--enable-snmp given but not usable])])
1432 AC_DEFINE(HAVE_SNMP,,SNMP)
Vincent Bernatd6be5fb2012-05-24 09:44:43 +02001433 case "${enable_snmp}" in
1434 yes)
1435 SNMP_METHOD=agentx
1436 ;;
1437 smux|agentx)
1438 SNMP_METHOD="${enable_snmp}"
1439 ;;
1440 *)
1441 AC_MSG_ERROR([--enable-snmp given with an unknown method (${enable_snmp}). Use smux or agentx])
1442 ;;
1443 esac
1444 AH_TEMPLATE([SNMP_SMUX], [Use SNMP SMUX to interface with snmpd])
1445 AH_TEMPLATE([SNMP_AGENTX], [Use SNMP AgentX to interface with snmpd])
1446 AC_DEFINE_UNQUOTED(AS_TR_CPP(SNMP_${SNMP_METHOD}),,SNMP method to interface with snmpd)
paul7ea487b2003-03-17 02:05:07 +00001447fi
1448
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001449dnl ---------------------------
1450dnl sockaddr and netinet checks
1451dnl ---------------------------
1452AC_CHECK_TYPES([struct sockaddr, struct sockaddr_in,
1453 struct sockaddr_in6, struct sockaddr_un, struct sockaddr_dl,
1454 socklen_t,
1455 struct ifaliasreq, struct if6_aliasreq, struct in6_aliasreq,
1456 struct nd_opt_adv_interval, struct rt_addrinfo,
Paul Jakma11770e12007-06-22 16:14:42 +00001457 struct nd_opt_homeagent_info, struct nd_opt_adv_interval],
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001458 [], [], QUAGGA_INCLUDES)
paul7ea487b2003-03-17 02:05:07 +00001459
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001460AC_CHECK_MEMBERS([struct sockaddr.sa_len,
1461 struct sockaddr_in.sin_len, struct sockaddr_un.sun_len,
1462 struct sockaddr_in6.sin6_scope_id,
1463 struct if6_aliasreq.ifra_lifetime,
1464 struct nd_opt_adv_interval.nd_opt_ai_type],
1465 [], [], QUAGGA_INCLUDES)
hasso71c0fb52003-05-25 20:18:13 +00001466
paul7ea487b2003-03-17 02:05:07 +00001467dnl ---------------------------
Paul Jakma11770e12007-06-22 16:14:42 +00001468dnl IRDP/pktinfo/icmphdr checks
paul7ea487b2003-03-17 02:05:07 +00001469dnl ---------------------------
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001470AC_CHECK_TYPES([struct in_pktinfo],
Paul Jakma11770e12007-06-22 16:14:42 +00001471 [AC_CHECK_TYPES([struct icmphdr],
1472 [if test "${enable_irdp}" != "no"; then
1473 AC_DEFINE(HAVE_IRDP,, IRDP)
1474 fi],
1475 [if test "${enable_irdp}" = "yes"; then
1476 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1477 fi], [QUAGGA_INCLUDES])],
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001478 [if test "${enable_irdp}" = "yes"; then
1479 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1480 fi], [QUAGGA_INCLUDES])
vincent29c4c9b2005-03-25 13:05:47 +00001481
paul7ea487b2003-03-17 02:05:07 +00001482dnl --------------------------------------
1483dnl checking for getrusage struct and call
1484dnl --------------------------------------
1485AC_MSG_CHECKING(whether getrusage is available)
1486AC_TRY_COMPILE([#include <sys/resource.h>
1487],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
1488[AC_MSG_RESULT(yes)
1489 AC_DEFINE(HAVE_RUSAGE,,rusage)],
1490 AC_MSG_RESULT(no))
1491
Stephen Hemmingerc4376c92009-05-28 15:29:10 -07001492dnl --------------------------------------
1493dnl checking for clock_time monotonic struct and call
1494dnl --------------------------------------
Paul Jakma6511cab2009-06-18 17:38:01 +01001495AC_CHECK_DECL(CLOCK_MONOTONIC,
1496 [AC_CHECK_LIB(rt, clock_gettime, [LIBS="$LIBS -lrt"])
Dmitry Tejblum9964fcf2009-11-05 16:50:36 +03001497 AC_DEFINE(HAVE_CLOCK_MONOTONIC,, Have monotonic clock)
Paul Jakma6511cab2009-06-18 17:38:01 +01001498], [AC_MSG_RESULT(no)], [QUAGGA_INCLUDES])
Stephen Hemmingerc4376c92009-05-28 15:29:10 -07001499
pauledd7c242003-06-04 13:59:38 +00001500dnl -------------------
1501dnl capabilities checks
1502dnl -------------------
hasso41d3fc92004-04-06 11:59:00 +00001503if test "${enable_capabilities}" != "no"; then
1504 AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1505 AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1506 [AC_MSG_RESULT(yes)
1507 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1508 quagga_ac_keepcaps="yes"],
1509 AC_MSG_RESULT(no)
pauledd7c242003-06-04 13:59:38 +00001510 )
hasso41d3fc92004-04-06 11:59:00 +00001511 if test x"${quagga_ac_keepcaps}" = x"yes"; then
1512 AC_CHECK_HEADERS(sys/capability.h)
1513 fi
1514 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1515 AC_CHECK_LIB(cap, cap_init,
1516 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1517 LIBCAP="-lcap"
paulceacedb2005-09-29 14:39:32 +00001518 quagga_ac_lcaps="yes"]
hasso41d3fc92004-04-06 11:59:00 +00001519 )
paulceacedb2005-09-29 14:39:32 +00001520 else
1521 AC_CHECK_HEADERS(priv.h,
1522 [AC_MSG_CHECKING(Solaris style privileges are available)
1523 AC_TRY_COMPILE([#include <priv.h>],[getpflags(PRIV_AWARE);],
1524 [AC_MSG_RESULT(yes)
1525 AC_DEFINE(HAVE_SOLARIS_CAPABILITIES,1,getpflags)
1526 quagga_ac_scaps="yes"],
1527 AC_MSG_RESULT(no)
1528 )
1529 ]
1530 )
1531 fi
1532 if test x"${quagga_ac_scaps}" = x"yes" \
1533 -o x"${quagga_ac_lcaps}" = x"yes"; then
1534 AC_DEFINE(HAVE_CAPABILITIES,1,capabilities)
hasso41d3fc92004-04-06 11:59:00 +00001535 fi
pauledd7c242003-06-04 13:59:38 +00001536fi
1537AC_SUBST(LIBCAP)
1538
paulfb2d1502003-06-04 09:40:54 +00001539dnl ---------------------------
1540dnl check for glibc 'backtrace'
1541dnl ---------------------------
Dmitrij Tejblumeda35292011-09-15 20:00:33 +04001542AC_CHECK_HEADER([execinfo.h],
1543 [AC_CHECK_FUNC([backtrace],
1544 [AC_DEFINE(HAVE_GLIBC_BACKTRACE,,[Glibc backtrace])
1545 AC_DEFINE(HAVE_STACK_TRACE,,[Stack symbol decoding])
1546 ])
1547])
paulfb2d1502003-06-04 09:40:54 +00001548
Paul Jakma41be32b2006-03-30 13:53:59 +00001549dnl -----------------------------------------
1550dnl check for malloc mallinfo struct and call
1551dnl this must try and link using LIBS, in
1552dnl order to check no alternative allocator
1553dnl has been specified, which might not provide
1554dnl mallinfo, e.g. such as Umem on Solaris.
1555dnl -----------------------------------------
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001556AC_CHECK_HEADER([malloc.h],
Paul Jakma41be32b2006-03-30 13:53:59 +00001557 [AC_MSG_CHECKING(whether mallinfo is available)
1558 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
1559 [[struct mallinfo ac_x; ac_x = mallinfo ();]])],
1560 [AC_MSG_RESULT(yes)
1561 AC_DEFINE(HAVE_MALLINFO,,mallinfo)],
1562 AC_MSG_RESULT(no)
1563 )
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001564 ], [], QUAGGA_INCLUDES)
Paul Jakma41be32b2006-03-30 13:53:59 +00001565
paul408ad942003-05-20 00:03:33 +00001566dnl ----------
1567dnl configure date
1568dnl ----------
1569CONFDATE=`date '+%Y%m%d'`
1570AC_SUBST(CONFDATE)
1571
Paul P Komkoff Jr46bc0e42008-08-13 16:17:04 +01001572dnl Conditionally enable PIE support for GNU toolchains.
Paul P Komkoff Jr46bc0e42008-08-13 16:17:04 +01001573AC_ARG_ENABLE(pie, AS_HELP_STRING([--disable-pie], [Do not build tools as a Position Independent Executables]))
Paul P Komkoff Jr0e9de562008-09-24 16:42:35 +01001574if test "$enable_pie" != "no"; then
Paul P Komkoff Jr46bc0e42008-08-13 16:17:04 +01001575 AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [
1576 save_CFLAGS=$CFLAGS
1577 save_LDFLAGS=$LDFLAGS
1578 CFLAGS="$CFLAGS -fPIE"
1579 LDFLAGS="$LDFLAGS -pie"
1580 AC_LINK_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
1581 [ap_cv_cc_pie=yes], [ap_cv_cc_pie=no]
1582 )
1583 CFLAGS=$save_CFLAGS
1584 LDFLAGS=$save_LDFLAGS
1585 ])
1586 if test "$ap_cv_cc_pie" = "yes"; then
1587 PICFLAGS="-fPIE"
1588 PILDFLAGS="-pie"
1589 fi
1590fi
1591
1592AC_SUBST(PICFLAGS)
1593AC_SUBST(PILDFLAGS)
1594
paul7ea487b2003-03-17 02:05:07 +00001595dnl ------------------------------
paula159ed92003-06-04 11:01:45 +00001596dnl set paths for state directory
paul23bd12c2003-04-07 06:11:09 +00001597dnl ------------------------------
Jeremy Jacksone84999d2009-01-21 20:29:39 -05001598AC_MSG_CHECKING(directory to use for state file)
paul23bd12c2003-04-07 06:11:09 +00001599if test "${prefix}" = "NONE"; then
paule8f29842003-08-12 13:08:31 +00001600 quagga_statedir_prefix="";
paul23bd12c2003-04-07 06:11:09 +00001601else
paule8f29842003-08-12 13:08:31 +00001602 quagga_statedir_prefix=${prefix}
paul23bd12c2003-04-07 06:11:09 +00001603fi
1604if test "${localstatedir}" = '${prefix}/var'; then
Jeremy Jacksone84999d2009-01-21 20:29:39 -05001605 for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
paule8f29842003-08-12 13:08:31 +00001606 ${quagga_statedir_prefix}/var/adm dnl
1607 ${quagga_statedir_prefix}/etc dnl
paula159ed92003-06-04 11:01:45 +00001608 /var/run dnl
1609 /var/adm dnl
1610 /etc dnl
1611 /dev/null;
paul23bd12c2003-04-07 06:11:09 +00001612 do
paule8f29842003-08-12 13:08:31 +00001613 test -d $QUAGGA_STATE_DIR && break
paul23bd12c2003-04-07 06:11:09 +00001614 done
Jeremy Jacksone84999d2009-01-21 20:29:39 -05001615 quagga_statedir=$QUAGGA_STATE_DIR
paul23bd12c2003-04-07 06:11:09 +00001616else
paule8f29842003-08-12 13:08:31 +00001617 quagga_statedir=${localstatedir}
paul23bd12c2003-04-07 06:11:09 +00001618fi
paule8f29842003-08-12 13:08:31 +00001619if test $quagga_statedir = "/dev/null"; then
paula159ed92003-06-04 11:01:45 +00001620 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1621fi
Jeremy Jacksone84999d2009-01-21 20:29:39 -05001622AC_MSG_RESULT(${quagga_statedir})
1623AC_SUBST(quagga_statedir)
paula159ed92003-06-04 11:01:45 +00001624
paule8f29842003-08-12 13:08:31 +00001625AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1626AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1627AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1628AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1629AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1630AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
Paul Jakma57345092011-12-25 17:52:09 +01001631AC_DEFINE_UNQUOTED(PATH_BABELD_PID, "$quagga_statedir/babeld.pid",babeld PID)
jardin9e867fe2003-12-23 08:56:18 +00001632AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
ajsd0199432004-12-22 14:03:52 +00001633AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
paule8f29842003-08-12 13:08:31 +00001634AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1635AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1636AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1637AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1638AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1639AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1640AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
Paul Jakma57345092011-12-25 17:52:09 +01001641AC_DEFINE_UNQUOTED(BABEL_VTYSH_PATH, "$quagga_statedir/babeld.vty",babeld vty socket)
jardin9e867fe2003-12-23 08:56:18 +00001642AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
ajs515210b2004-12-22 15:35:12 +00001643AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
paul7ea487b2003-03-17 02:05:07 +00001644
paul1eb8ef22005-04-07 07:30:20 +00001645dnl -------------------------------
1646dnl Quagga sources should always be
1647dnl current wrt interfaces. Dont
1648dnl allow deprecated interfaces to
1649dnl be exposed.
1650dnl -------------------------------
1651AC_DEFINE(QUAGGA_NO_DEPRECATED_INTERFACES, 1, Hide deprecated interfaces)
1652
paul7ea487b2003-03-17 02:05:07 +00001653dnl ---------------------------
1654dnl Check htonl works correctly
1655dnl ---------------------------
1656AC_MSG_CHECKING(for working htonl)
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001657AC_CACHE_VAL(ac_cv_htonl_works,
1658 [AC_LINK_IFELSE([AC_LANG_PROGRAM([QUAGGA_INCLUDES],[htonl (0);])],
1659 [ac_cv_htonl_works=yes], [ac_cv_htonl_works=no])
1660 ]
1661)
paul7ea487b2003-03-17 02:05:07 +00001662AC_MSG_RESULT($ac_cv_htonl_works)
1663
paul14c17fd2004-11-07 22:34:23 +00001664AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile
ajsd0199432004-12-22 14:03:52 +00001665 ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
Paul Jakma57345092011-12-25 17:52:09 +01001666 ospf6d/Makefile isisd/Makefile babeld/Makefile vtysh/Makefile
1667 doc/Makefile ospfclient/Makefile tests/Makefile m4/Makefile
1668 redhat/Makefile
gdt69f1fc22004-08-27 15:57:35 +00001669 pkgsrc/Makefile
paul670bbf12004-11-12 09:05:00 +00001670 redhat/quagga.spec
gdtb7a97f82004-07-23 16:23:56 +00001671 lib/version.h
paul14c17fd2004-11-07 22:34:23 +00001672 doc/defines.texi
hassof695b012005-04-02 19:03:39 +00001673 isisd/topology/Makefile
gdtcbd04082004-08-31 18:16:36 +00001674 pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
paulf31293a2004-11-12 09:27:04 +00001675 pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
paul26275b02005-04-11 07:10:47 +00001676AC_CONFIG_FILES([solaris/Makefile])
1677
paul670bbf12004-11-12 09:05:00 +00001678AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
hasso48577192004-11-19 06:41:49 +00001679## Hack, but working solution to avoid rebuilding of quagga.info.
1680## It's already in CVS until texinfo 4.7 is more common.
paul14c17fd2004-11-07 22:34:23 +00001681AC_OUTPUT
paul7ea487b2003-03-17 02:05:07 +00001682
1683echo "
hassoc89f6492004-08-26 12:21:28 +00001684Quagga configuration
1685--------------------
1686quagga version : ${PACKAGE_VERSION}
Joachim Nilsson1080c132012-05-30 08:15:48 +02001687host operating system : ${host_os}
paul7ea487b2003-03-17 02:05:07 +00001688source code location : ${srcdir}
1689compiler : ${CC}
1690compiler flags : ${CFLAGS}
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001691make : ${MAKE-make}
Vincent Bernat08d7f652012-05-22 22:29:17 +02001692includes : ${INCLUDES}
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001693linker flags : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM}
paule8f29842003-08-12 13:08:31 +00001694state file directory : ${quagga_statedir}
pauldc7a2bf2003-10-22 00:07:44 +00001695config file directory : `eval echo \`echo ${sysconfdir}\``
gdtd6b72f72003-12-03 17:24:27 +00001696example directory : `eval echo \`echo ${exampledir}\``
paul8d4aee52003-06-06 00:30:35 +00001697user to run as : ${enable_user}
1698group to run as : ${enable_group}
1699group for vty sockets : ${enable_vty_group}
gdtaa593d52003-12-22 20:15:53 +00001700config file mask : ${enable_configfile_mask}
1701log file mask : ${enable_logfile_mask}
pauldc7a2bf2003-10-22 00:07:44 +00001702
1703The above user and group must have read/write access to the state file
Paul Jakma105b8232006-05-28 08:02:41 +00001704directory and to the config files in the config file directory."
1705
1706if test x"$quagga_cv_gnu_make" = x"no"; then echo "
1707Warning: The ${MAKE-make} programme detected, either in your path or
1708via the MAKE variable, is not GNU Make. GNU make may be installed as
1709gmake on some systems. and is required to complete a build of Quagga
1710" > /dev/stderr
1711fi