blob: 3ac8384f555f92397279e826ca820674a22266ee [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##
Paul Jakma105b8232006-05-28 08:02:41 +00008## $Id$
paule8f29842003-08-12 13:08:31 +00009AC_PREREQ(2.53)
paul7ea487b2003-03-17 02:05:07 +000010
Paul Jakma5012bc32009-05-08 23:20:19 +010011AC_INIT(Quagga, 0.99.12, [http://bugzilla.quagga.net])
paulfa1253d2003-09-24 05:09:26 +000012AC_CONFIG_SRCDIR(lib/zebra.h)
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
Greg Troxel1bbaa8c2007-02-06 19:36:47 +000024dnl GNU awk is required for lib/memtype.h made by memtypes.awk.
25dnl BSD awk complains: awk: gensub doesn't support backreferences (subst "\1")
paul03ecfb62005-04-16 15:38:23 +000026AC_CHECK_PROG([GAWK],[gawk],[gawk],[/bin/false])
27AC_ARG_VAR([GAWK],[GNU AWK])
28
gdtd6b72f72003-12-03 17:24:27 +000029dnl default is to match previous behavior
gdtc4f0efe2003-12-04 15:39:25 +000030exampledir=${sysconfdir}
gdtd6b72f72003-12-03 17:24:27 +000031AC_ARG_ENABLE([exampledir],
32 AC_HELP_STRING([--enable-exampledir],
33 [specify alternate directory for examples]),
34 exampledir="$enableval",)
gdtc4f0efe2003-12-04 15:39:25 +000035dnl XXX add --exampledir to autoconf standard directory list somehow
gdtd6b72f72003-12-03 17:24:27 +000036AC_SUBST(exampledir)
37
gdtcbd04082004-08-31 18:16:36 +000038dnl default is to match previous behavior
39pkgsrcrcdir=""
40pkgsrcdir=""
41AC_ARG_ENABLE([pkgsrcrcdir],
42 AC_HELP_STRING([--enable-pkgsrcrcdir],
43 [specify directory for rc.d scripts]),
44 pkgsrcrcdir="$enableval"; pkgsrcdir="pkgsrc",)
45dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
46AC_SUBST(pkgsrcdir)
47AC_SUBST(pkgsrcrcdir)
48
paul7ea487b2003-03-17 02:05:07 +000049dnl ------------
50dnl Check CFLAGS
51dnl ------------
52AC_ARG_WITH(cflags,
53[ --with-cflags Set CFLAGS for use in compilation.])
54if test "x$with_cflags" != "x" ; then
55 CFLAGS="$with_cflags" ; cflags_specified=yes ;
56elif test -n "$CFLAGS" ; then
57 cflags_specified=yes ;
58fi
59
hasso1969e4b2005-03-27 13:07:23 +000060dnl --------------------
61dnl Check CC and friends
62dnl --------------------
Paul P Komkoff Jr46bc0e42008-08-13 16:17:04 +010063AC_LANG([C])
paul7ea487b2003-03-17 02:05:07 +000064AC_PROG_CC
hasso1969e4b2005-03-27 13:07:23 +000065AC_PROG_CPP
Paul P Komkoff Jr46bc0e42008-08-13 16:17:04 +010066AM_PROG_CC_C_O
hasso1969e4b2005-03-27 13:07:23 +000067AC_PROG_EGREP
Greg Troxel553bdfe2007-02-06 20:10:35 +000068
69dnl autoconf 2.59 appears not to support AC_PROG_SED
70dnl AC_PROG_SED
71AC_CHECK_PROG([SED],[sed],[sed],[/bin/false])
hasso1969e4b2005-03-27 13:07:23 +000072
73dnl ------------------------------------------------------------------
74dnl Intel compiler check. Although Intel tries really hard to make icc
75dnl look like gcc, there are some differences. It's very verbose with
76dnl -Wall and it doesn't support the individual -W options.
77dnl ------------------------------------------------------------------
paul6a4b8832005-11-26 08:28:00 +000078if test "x${GCC}" = "xyes" ; then
79 COMPILER="GCC"
80 AC_MSG_CHECKING([whether we are using the Intel compiler])
81 AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
82 [AC_MSG_RESULT([no])],
83 [COMPILER="ICC"
84 AC_MSG_RESULT([yes])]
85 )
86else
87 AC_MSG_CHECKING([whether we are using SunPro compiler])
88 AC_EGREP_CPP([^__SUNPRO_C.*0x5(7|8|9)], ["__SUNPRO_C" __SUNPRO_C],
89 [AC_MSG_RESULT([no])],
90 [COMPILER="SUNPRO"
91 AC_MSG_RESULT([yes])]
92 )
93fi
paul7ea487b2003-03-17 02:05:07 +000094
paula49c0ff2004-09-30 06:08:58 +000095dnl ---------------------------------------------
paul7ea487b2003-03-17 02:05:07 +000096dnl If CLFAGS doesn\'t exist set default value
paula49c0ff2004-09-30 06:08:58 +000097dnl AC_PROG_CC will have set minimal default
98dnl already, eg "-O2 -g" for gcc, "-g" for others
paul27eebb32004-07-22 18:16:59 +000099dnl (Wall is gcc specific... have to make sure
100dnl gcc is being used before setting it)
101dnl
paul6a4b8832005-11-26 08:28:00 +0000102dnl Intel icc 8.0 also sets __GNUC__,
103dnl but doesn't support all these fancy -W options.
hasso1969e4b2005-03-27 13:07:23 +0000104dnl Intel compiler warnings we ignore:
105dnl 279: controlling expression is constant.
106dnl 869: parameter "xxx" was never referenced - to avoid massive warnings
107dnl about "self", "vty", "argc" and "argv" never referenced in DEFUN
108dnl macro.
109dnl 981: operands are evaluated in unspecified order.
paul6a4b8832005-11-26 08:28:00 +0000110dnl
111dnl Sun Studio 10 / SunPro 5.7 is also supported,
112dnl so lets set some sane CFLAGS for it.
113dnl ---------------------------------------------
hasso1969e4b2005-03-27 13:07:23 +0000114
paul6a4b8832005-11-26 08:28:00 +0000115AC_MSG_CHECKING([whether to set a default CFLAGS])
116if test "x${cflags_specified}" = "x" ; then
117 case ${COMPILER} in
118 "ICC")
119 CFLAGS="-Os -g -Wall -wd 279,869,981"
120 AC_MSG_RESULT([Intel default])
121 ;;
122 "GCC")
Andrew J. Schorr5fa05092007-04-30 19:14:08 +0000123 CFLAGS="-Os -fno-omit-frame-pointer -g -std=gnu99 -Wall"
paul6a4b8832005-11-26 08:28:00 +0000124 CFLAGS="${CFLAGS} -Wsign-compare -Wpointer-arith"
125 CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
126 CFLAGS="${CFLAGS} -Wmissing-prototypes -Wmissing-declarations"
127 CFLAGS="${CFLAGS} -Wchar-subscripts -Wcast-qual"
128 # TODO: conditionally addd -Wpacked if handled
129 AC_MSG_RESULT([gcc default])
130 ;;
131 "SUNPRO")
Paul Jakma105b8232006-05-28 08:02:41 +0000132 CFLAGS="-xO4 -v -g -xspace -xcode=pic32 -xstrconst -xc99"
paul6a4b8832005-11-26 08:28:00 +0000133 AC_MSG_RESULT([SunPro default])
134 ;;
135 *)
136 AC_MSG_RESULT([unknown compiler])
137 ;;
138 esac
139else
140 AC_MSG_RESULT([CFLAGS supplied by user])
hasso1969e4b2005-03-27 13:07:23 +0000141fi
142
paul7ea487b2003-03-17 02:05:07 +0000143dnl --------------
144dnl Check programs
145dnl --------------
paul7ea487b2003-03-17 02:05:07 +0000146AC_PROG_INSTALL
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000147AC_PROG_LN_S
paul7ea487b2003-03-17 02:05:07 +0000148AC_PROG_MAKE_SET
149AC_CHECK_TOOL(AR, ar)
paul7ea487b2003-03-17 02:05:07 +0000150
Paul Jakma105b8232006-05-28 08:02:41 +0000151dnl ---------------------------
152dnl We, perhaps unfortunately,
153dnl depend on GNU Make specific
154dnl constructs.
155dnl Give the user a warning if
156dnl not GNU Make.
157dnl ---------------------------
158AC_CACHE_CHECK([if ${MAKE-make} is GNU make], [quagga_cv_gnu_make],
159 [quagga_cv_gnu_make=no
160 if ${MAKE-make} --version 2>/dev/null | \
161 grep '^GNU Make ' >/dev/null ; then
162 quagga_cv_gnu_make=yes;
163 fi
164 ]
165)
166
Paul Jakmad46d2a22007-05-10 16:53:04 +0000167dnl -----------------
168dnl System extensions
169dnl -----------------
paul7ea487b2003-03-17 02:05:07 +0000170AC_AIX
Paul Jakmad46d2a22007-05-10 16:53:04 +0000171AC_GNU_SOURCE
paul7ea487b2003-03-17 02:05:07 +0000172
gdt87efd642004-06-30 17:36:11 +0000173dnl -------
174dnl libtool
175dnl -------
paul0fc42942004-08-19 04:41:21 +0000176AC_PROG_LIBTOOL
gdt87efd642004-06-30 17:36:11 +0000177
paul7ea487b2003-03-17 02:05:07 +0000178dnl ----------------------
179dnl Packages configuration
180dnl ----------------------
181AC_ARG_ENABLE(vtysh,
gdtfc9d0742004-06-30 14:25:12 +0000182[ --enable-vtysh include integrated vty shell for Quagga])
paul7ea487b2003-03-17 02:05:07 +0000183AC_ARG_ENABLE(ipv6,
184[ --disable-ipv6 turn off IPv6 related features and daemons])
185AC_ARG_ENABLE(zebra,
186[ --disable-zebra do not build zebra daemon])
187AC_ARG_ENABLE(bgpd,
188[ --disable-bgpd do not build bgpd])
189AC_ARG_ENABLE(ripd,
190[ --disable-ripd do not build ripd])
191AC_ARG_ENABLE(ripngd,
192[ --disable-ripngd do not build ripngd])
193AC_ARG_ENABLE(ospfd,
194[ --disable-ospfd do not build ospfd])
paul7ea487b2003-03-17 02:05:07 +0000195AC_ARG_ENABLE(ospf6d,
196[ --disable-ospf6d do not build ospf6d])
ajsd0199432004-12-22 14:03:52 +0000197AC_ARG_ENABLE(watchquagga,
198[ --disable-watchquagga do not build watchquagga])
jardin9e867fe2003-12-23 08:56:18 +0000199AC_ARG_ENABLE(isisd,
hassoae399ab2004-09-13 20:22:18 +0000200[ --enable-isisd build isisd])
Greg Troxel97cee872007-08-02 13:36:56 +0000201AC_ARG_ENABLE(solaris,
202[ --enable-solaris build solaris])
paul7ea487b2003-03-17 02:05:07 +0000203AC_ARG_ENABLE(bgp-announce,
204[ --disable-bgp-announce, turn off BGP route announcement])
205AC_ARG_ENABLE(netlink,
206[ --enable-netlink force to use Linux netlink interface])
207AC_ARG_ENABLE(broken-aliases,
208[ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
Joakim Tjernlundfb62a3c2008-05-13 20:03:32 +0200209AC_ARG_WITH(crypto,
210[ --without-crypto do not use libcrypto in SNMP])
paul7ea487b2003-03-17 02:05:07 +0000211AC_ARG_ENABLE(snmp,
212[ --enable-snmp enable SNMP support])
213AC_ARG_WITH(libpam,
214[ --with-libpam use libpam for PAM support in vtysh])
hasso71c0fb52003-05-25 20:18:13 +0000215AC_ARG_ENABLE(tcp-zebra,
paul7ea487b2003-03-17 02:05:07 +0000216[ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon])
paul7ea487b2003-03-17 02:05:07 +0000217AC_ARG_ENABLE(opaque-lsa,
paul1ef74ef2003-03-21 15:16:05 +0000218[ --enable-opaque-lsa enable OSPF Opaque-LSA with OSPFAPI support (RFC2370)])
219AC_ARG_ENABLE(ospfapi,
220[ --disable-ospfapi do not build OSPFAPI to access the OSPF LSA Database,
221 (this is the default if --enable-opaque-lsa is not set)])
222AC_ARG_ENABLE(ospfclient,
223[ --disable-ospfclient do not build OSPFAPI client for OSPFAPI,
224 (this is the default if --disable-ospfapi is set)])
paul7ea487b2003-03-17 02:05:07 +0000225AC_ARG_ENABLE(ospf-te,
226[ --enable-ospf-te enable Traffic Engineering Extension to OSPF])
227AC_ARG_ENABLE(multipath,
228[ --enable-multipath=ARG enable multipath function, ARG must be digit])
Paul P Komkoff Jrfe86b482008-08-13 16:56:05 +0100229AC_ARG_ENABLE(user,
230 AC_HELP_STRING([--enable-user=user], [user to run Quagga suite as (default quagga)]))
231AC_ARG_ENABLE(group,
232 AC_HELP_STRING([--enable-group=group], [group to run Quagga suite as (default quagga)]))
pauledd7c242003-06-04 13:59:38 +0000233AC_ARG_ENABLE(vty_group,
paul6b6942f2004-10-22 04:55:05 +0000234[ --enable-vty-group=ARG set vty sockets to have specified group as owner])
gdtaa593d52003-12-22 20:15:53 +0000235AC_ARG_ENABLE(configfile_mask,
236[ --enable-configfile-mask=ARG set mask for config files])
237AC_ARG_ENABLE(logfile_mask,
238[ --enable-logfile-mask=ARG set mask for log files])
pauledd7c242003-06-04 13:59:38 +0000239
hasso71c0fb52003-05-25 20:18:13 +0000240AC_ARG_ENABLE(rtadv,
paul6b6942f2004-10-22 04:55:05 +0000241[ --disable-rtadv disable IPV6 router advertisement feature])
hassoca776982004-06-12 14:33:05 +0000242AC_ARG_ENABLE(irdp,
paul6b6942f2004-10-22 04:55:05 +0000243[ --enable-irdp enable IRDP server support in zebra])
hassof695b012005-04-02 19:03:39 +0000244AC_ARG_ENABLE(isis_topology,
245[ --enable-isis-topology enable IS-IS topology generator])
hasso41d3fc92004-04-06 11:59:00 +0000246AC_ARG_ENABLE(capabilities,
247[ --disable-capabilities disable using POSIX capabilities])
paul6b6942f2004-10-22 04:55:05 +0000248AC_ARG_ENABLE(gcc_ultra_verbose,
249[ --enable-gcc-ultra-verbose enable ultra verbose GCC warnings])
Paul Jakma3453a712009-06-12 14:21:02 +0100250AC_ARG_ENABLE(linux24_tcp_md5,
251[ --enable-linux24-tcp-md5 enable support for old, Linux-2.4 RFC2385 patch])
ajs3cade262004-12-29 17:50:22 +0000252AC_ARG_ENABLE(gcc-rdynamic,
253[ --enable-gcc-rdynamic enable gcc linking with -rdynamic for better backtraces])
ajs924b9222005-04-16 17:11:24 +0000254AC_ARG_ENABLE(time-check,
255[ --disable-time-check disable slow thread warning messages])
paul6b6942f2004-10-22 04:55:05 +0000256
257if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
258 CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
259 CFLAGS="${CFLAGS} -Wmissing-declarations -Wmissing-noreturn"
260 CFLAGS="${CFLAGS} -Wmissing-format-attribute -Wunreachable-code"
261 CFLAGS="${CFLAGS} -Wpacked -Wpadded"
262fi
paul7ea487b2003-03-17 02:05:07 +0000263
ajs3cade262004-12-29 17:50:22 +0000264if test x"${enable_gcc_rdynamic}" = x"yes" ; then
265 LDFLAGS="${LDFLAGS} -rdynamic"
266fi
267
ajs924b9222005-04-16 17:11:24 +0000268if test x"${enable_time_check}" != x"no" ; then
269 if test x"${enable_time_check}" = x"yes" -o x"${enable_time_check}" = x ; then
270 AC_DEFINE(CONSUMED_TIME_CHECK,5000000,Consumed Time Check)
271 else
272 AC_DEFINE_UNQUOTED(CONSUMED_TIME_CHECK,$enable_time_check,Consumed Time Check)
273 fi
274fi
275
paul7ea487b2003-03-17 02:05:07 +0000276if test "${enable_broken_aliases}" = "yes"; then
277 if test "${enable_netlink}" = "yes"
278 then
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000279 AC_MSG_FAILURE([Sorry you can not use netlink with broken aliases])
paul7ea487b2003-03-17 02:05:07 +0000280 fi
281 AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
282 enable_netlink=no
283fi
284
285if test "${enable_tcp_zebra}" = "yes"; then
286 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
287fi
288
paul7ea487b2003-03-17 02:05:07 +0000289if test "${enable_opaque_lsa}" = "yes"; then
290 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
291fi
292
293if test "${enable_ospf_te}" = "yes"; then
294 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
295 AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
296fi
297
Paul Jakma3453a712009-06-12 14:21:02 +0100298if test "${enable_linux24_tcp_md5}" = "yes"; then
299 AC_DEFINE(HAVE_TCP_MD5_LINUX24,,Old Linux 2.4 TCP MD5 Signature Patch)
300fi
301
gdtd2a0ccc2003-12-03 18:13:48 +0000302AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
303if test "${enable_rtadv}" != "no"; then
hasso71c0fb52003-05-25 20:18:13 +0000304 AC_MSG_RESULT(yes)
gdtd2a0ccc2003-12-03 18:13:48 +0000305 AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
paul2487bea2003-05-25 23:51:31 +0000306else
307 AC_MSG_RESULT(no)
hasso71c0fb52003-05-25 20:18:13 +0000308fi
paul7ea487b2003-03-17 02:05:07 +0000309
hassoca776982004-06-12 14:33:05 +0000310if test "${enable_irdp}" = "yes"; then
311 AC_DEFINE(HAVE_IRDP,, IRDP )
312fi
313
hassof695b012005-04-02 19:03:39 +0000314if test "${enable_isisd}" = "yes" && test "${enable_isis_topology}" = yes; then
315 AC_DEFINE(TOPOLOGY_GENERATE,,Enable IS-IS topology generator code)
316 ISIS_TOPOLOGY_INCLUDES="-I./topology"
317 ISIS_TOPOLOGY_DIR="topology"
318 ISIS_TOPOLOGY_LIB="./topology/libtopology.a"
319fi
320
321AC_SUBST(ISIS_TOPOLOGY_INCLUDES)
322AC_SUBST(ISIS_TOPOLOGY_DIR)
323AC_SUBST(ISIS_TOPOLOGY_LIB)
324
paul79cb2162003-06-06 12:19:53 +0000325if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
paule8f29842003-08-12 13:08:31 +0000326 enable_user="quagga"
pauledd7c242003-06-04 13:59:38 +0000327elif test "${enable_user}" = "no"; then
328 enable_user="root"
329fi
pauledd7c242003-06-04 13:59:38 +0000330
paul79cb2162003-06-06 12:19:53 +0000331if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
paule8f29842003-08-12 13:08:31 +0000332 enable_group="quagga"
pauledd7c242003-06-04 13:59:38 +0000333elif test "${enable_group}" = "no"; then
334 enable_group="root"
335fi
pauledd7c242003-06-04 13:59:38 +0000336
337if test x"${enable_vty_group}" = x"yes" ; then
paul8d4aee52003-06-06 00:30:35 +0000338 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
paul79cb2162003-06-06 12:19:53 +0000339elif test x"${enable_vty_group}" != x""; then
paul8d4aee52003-06-06 00:30:35 +0000340 if test x"${enable_vty_group}" != x"no"; then
pauledd7c242003-06-04 13:59:38 +0000341 AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
342 fi
343fi
paul26275b02005-04-11 07:10:47 +0000344AC_SUBST([enable_user])
345AC_SUBST([enable_group])
346AC_SUBST([enable_vty_group])
347AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
348AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
pauledd7c242003-06-04 13:59:38 +0000349
gdtaa593d52003-12-22 20:15:53 +0000350enable_configfile_mask=${enable_configfile_mask:-0600}
351AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
352
353enable_logfile_mask=${enable_logfile_mask:-0600}
354AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
355
paul7ea487b2003-03-17 02:05:07 +0000356MULTIPATH_NUM=1
357
358case "${enable_multipath}" in
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000359 [[0-9]|[1-9][0-9]])
paul7ea487b2003-03-17 02:05:07 +0000360 MULTIPATH_NUM="${enable_multipath}"
361 ;;
362 "")
363 ;;
364 *)
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000365 AC_MSG_FAILURE([Please specify digit to enable multipath ARG])
paul7ea487b2003-03-17 02:05:07 +0000366 ;;
367esac
368
paul7ea487b2003-03-17 02:05:07 +0000369AC_SUBST(MULTIPATH_NUM)
370
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000371dnl ------------------------------------
372dnl Check C keywords and standard types
373dnl ------------------------------------
374AC_C_CONST
375AC_C_INLINE
376AC_C_RESTRICT
377AC_C_VOLATILE
pauldc7a2bf2003-10-22 00:07:44 +0000378AC_HEADER_STDC
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000379AC_HEADER_TIME
380AC_HEADER_SYS_WAIT
381dnl AC_TYPE_PID_T
382AC_TYPE_UID_T
383AC_TYPE_MODE_T
384AC_TYPE_SIZE_T
385AC_TYPE_SIGNAL
386AC_STRUCT_TM
pauldc7a2bf2003-10-22 00:07:44 +0000387
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000388dnl -------------------------
389dnl Check other header files.
390dnl -------------------------
391AC_CHECK_HEADERS([stropts.h sys/ksym.h sys/times.h sys/select.h \
392 sys/types.h linux/version.h netdb.h asm/types.h \
393 sys/param.h limits.h signal.h libutil.h \
Paul Jakma6511cab2009-06-18 17:38:01 +0100394 sys/socket.h netinet/in.h time.h sys/time.h])
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000395
396dnl Utility macro to avoid retyping includes all the time
397m4_define([QUAGGA_INCLUDES],
398[#ifdef SUNOS_5
399#define _XPG4_2
400#define __EXTENSIONS__
401#endif
402#include <stdio.h>
403#if STDC_HEADERS
404# include <stdlib.h>
405# include <stddef.h>
406#else
407# if HAVE_STDLIB_H
408# include <stdlib.h>
409# endif
410#endif
411#if HAVE_SYS_TYPES_H
412# include <sys/types.h>
413#endif
414/* sys/conf.h depends on param.h on FBSD at least */
415#if HAVE_SYS_PARAM_H
416# include <sys/param.h>
417#endif
418/* Required for MAXSIG */
419#if HAVE_SIGNAL_H
420# include <signal.h>
421#endif
422#if HAVE_SYS_SOCKET_H
423# include <sys/socket.h>
424#endif
425#if HAVE_NETINET_IN_H
426# include <netinet/in.h>
427#endif
Paul Jakma6511cab2009-06-18 17:38:01 +0100428#ifdef TIME_WITH_SYS_TIME
429# include <sys/time.h>
430# include <time.h>
431#else
432# ifdef HAVE_SYS_TIME_H
433# include <sys/time.h>
434# else
435# include <time.h>
436# endif
437#endif /* TIME_WITH_SYS_TIME */
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000438])dnl
439
440AC_CHECK_HEADERS([sys/un.h net/if.h netinet/in_systm.h netinet/in_var.h \
441 net/if_dl.h net/if_var.h net/netopt.h net/route.h \
Paul Jakma11770e12007-06-22 16:14:42 +0000442 inet/nd.h arpa/inet.h netinet/ip_icmp.h \
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000443 fcntl.h stddef.h sys/ioctl.h syslog.h wchar.h wctype.h \
444 sys/sysctl.h sys/sockio.h kvm.h sys/conf.h],
445 [], [], QUAGGA_INCLUDES)
446
447AC_CHECK_HEADERS([ucontext.h], [], [],
448[#ifndef __USE_GNU
449#define __USE_GNU
450#endif /* __USE_GNU */
451QUAGGA_INCLUDES
452])
453
454m4_define([QUAGGA_INCLUDES],
455QUAGGA_INCLUDES
456[#if HAVE_NET_IF_H
457# include <net/if.h>
458#endif
459#if HAVE_SYS_UN_H
460# include <sys/un.h>
461#endif
462#if HAVE_NETINET_IN_SYSTM_H
463# include <netinet/in_systm.h>
464#endif
465#if HAVE_NETINET_IN_VAR_H
466# include <netinet/in_var.h>
467#endif
468#if HAVE_NET_IF_DL_H
469# include <net/if_dl.h>
470#endif
471#if HAVE_NET_IF_VAR_H
472# include <net/if_var.h>
473#endif
474#if HAVE_NET_NETOPT_H
475# include <net/netopt.h>
476#endif
477#if HAVE_NET_ROUTE_H
478# include <net/route.h>
479#endif
480#if HAVE_INET_ND_H
481# include <inet/nd.h>
482#endif
483#if HAVE_ARPA_INET_H
484# include <arpa/inet.h>
485#endif
Paul Jakma11770e12007-06-22 16:14:42 +0000486/* Required for IDRP */
487#if HAVE_NETINET_IP_ICMP_H
488# include <netinet/ip_icmp.h>
489#endif
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000490])dnl
pauldc7a2bf2003-10-22 00:07:44 +0000491
gdtfa3232e2003-12-03 17:52:30 +0000492dnl V6 headers are checked below, after we check for v6
paul7ea487b2003-03-17 02:05:07 +0000493
paul7ea487b2003-03-17 02:05:07 +0000494dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
495case "$host" in
paulafd8a122005-03-12 06:36:10 +0000496 [*-sunos5.[6-7]*] | [*-solaris2.[6-7]*])
paul7ea487b2003-03-17 02:05:07 +0000497 opsys=sol2-6
paulafd8a122005-03-12 06:36:10 +0000498 AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.7)
paul19877dd2004-05-11 10:49:35 +0000499 AC_DEFINE(SUNOS_5, 1, SunOS 5)
paul7ea487b2003-03-17 02:05:07 +0000500 AC_CHECK_LIB(xnet, main)
501 CURSES=-lcurses
502 ;;
paul1b73de82005-04-10 16:31:51 +0000503 [*-sunos5.[8-9]] \
504 | [*-sunos5.1[0-9]] \
505 | [*-sunos5.1[0-9].[0-9]] \
506 | [*-solaris2.[8-9]] \
507 | [*-solaris2.1[0-9]] \
508 | [*-solaris2.1[0-9].[0-9]])
paulafd8a122005-03-12 06:36:10 +0000509 opsys=sol8
Paul Jakmafb66b292006-05-28 08:26:15 +0000510 AC_DEFINE(SUNOS_59, 1, [SunOS 5.8 up])
511 AC_DEFINE(SUNOS_5, 1, [SunOS 5])
paul19877dd2004-05-11 10:49:35 +0000512 AC_CHECK_LIB(socket, main)
513 AC_CHECK_LIB(nsl, main)
paul1b73de82005-04-10 16:31:51 +0000514 AC_CHECK_LIB(umem, main)
Paul Jakmafb66b292006-05-28 08:26:15 +0000515 AC_CHECK_FUNCS([printstack],
516 [AC_DEFINE([HAVE_PRINTSTACK],1,[Solaris printstack])
517 AC_DEFINE([HAVE_STACK_TRACE],1,[Stack symbols decode functionality])
518 ])
paul19877dd2004-05-11 10:49:35 +0000519 CURSES=-lcurses
520 ;;
paul7ea487b2003-03-17 02:05:07 +0000521 *-sunos5* | *-solaris2*)
paul19877dd2004-05-11 10:49:35 +0000522 AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
paul7ea487b2003-03-17 02:05:07 +0000523 AC_CHECK_LIB(socket, main)
524 AC_CHECK_LIB(nsl, main)
525 CURSES=-lcurses
526 ;;
hassoc45eb832005-02-19 13:58:06 +0000527 *-linux*)
paul7ea487b2003-03-17 02:05:07 +0000528 opsys=gnu-linux
529 AC_DEFINE(GNU_LINUX,,GNU Linux)
530 ;;
531 *-nec-sysv4*)
532 AC_CHECK_LIB(nsl, gethostbyname)
533 AC_CHECK_LIB(socket, socket)
534 ;;
paul7ea487b2003-03-17 02:05:07 +0000535 *-openbsd*)
536 opsys=openbsd
537 AC_DEFINE(OPEN_BSD,,OpenBSD)
538 ;;
539 *-bsdi*)
540 opsys=bsdi
541 OTHER_METHOD="mtu_kvm.o"
542 AC_CHECK_LIB(kvm, main)
543 ;;
paul49e3b3c2003-10-23 20:39:50 +0000544 *-irix6.5)
pauldc7a2bf2003-10-22 00:07:44 +0000545 opsys=irix
546 AC_DEFINE(IRIX_65,,IRIX 6.5)
547 ;;
paul7ea487b2003-03-17 02:05:07 +0000548esac
549
550dnl ---------------------
551dnl Integrated VTY option
552dnl ---------------------
553case "${enable_vtysh}" in
554 "yes") VTYSH="vtysh";
555 AC_DEFINE(VTYSH,,VTY shell)
gdtfc9d0742004-06-30 14:25:12 +0000556 AC_PATH_PROG(PERL, perl)
557dnl Vtysh uses libreadline, which looks for termcap functions at
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000558dnl configure time. We follow readlines search order.
gdtfc9d0742004-06-30 14:25:12 +0000559dnl The required procedures are in libtermcap on NetBSD, in
560dnl [TODO] on Linux, and in [TODO] on Solaris.
hassoc0689392005-08-25 12:00:58 +0000561 AC_CHECK_LIB(termcap, tputs, LIBREADLINE="$LIBREADLINE -ltermcap",
paula9694592005-08-25 14:50:05 +0000562 [AC_CHECK_LIB(tinfo, tputs, LIBREADLINE="$LIBREADLINE -ltinfo",
563 [AC_CHECK_LIB(curses, tputs, LIBREADLINE="$LIBREADLINE -lcurses",
564 [AC_CHECK_LIB(ncurses, tputs,
565 LIBREADLINE="$LIBREADLINE -lncurses")]
566 )]
567 )]
568 )
569 AC_CHECK_LIB(readline, main, LIBREADLINE="$LIBREADLINE -lreadline",,
570 "$LIBREADLINE")
paul7ea487b2003-03-17 02:05:07 +0000571 if test $ac_cv_lib_readline_main = no; then
gdtfc9d0742004-06-30 14:25:12 +0000572 AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
paul7ea487b2003-03-17 02:05:07 +0000573 fi
574 AC_CHECK_HEADER(readline/history.h)
575 if test $ac_cv_header_readline_history_h = no;then
576 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
577 fi
paula9694592005-08-25 14:50:05 +0000578 AC_CHECK_LIB(readline, rl_completion_matches,
579 LIBREADLINE="$LIBREADLINE",, "$LIBREADLINE")
paul3d3de8c2003-05-23 10:33:49 +0000580 if test $ac_cv_lib_readline_rl_completion_matches = no; then
581 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
582 fi
583 ;;
paul7ea487b2003-03-17 02:05:07 +0000584 "no" ) VTYSH="";;
585 * ) ;;
586esac
hassoc0689392005-08-25 12:00:58 +0000587AC_SUBST(LIBREADLINE)
paul7ea487b2003-03-17 02:05:07 +0000588
589dnl ----------
590dnl PAM module
591dnl ----------
592if test "$with_libpam" = "yes"; then
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000593 AC_CHECK_HEADER([security/pam_misc.h],
594 [AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
595 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
596 pam_conv_func="misc_conv"
597 ],
598 [], QUAGGA_INCLUDES)
599 AC_CHECK_HEADER([security/openpam.h],
600 [AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
601 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
602 pam_conv_func="openpam_ttyconv"
603 ],
604 [], QUAGGA_INCLUDES)
paul24cd4352003-05-06 12:16:27 +0000605 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
606 AC_MSG_WARN([*** pam support will not be built ***])
607 with_libpam="no"
608 fi
609fi
610
611if test "$with_libpam" = "yes"; then
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000612dnl took this test from proftpds configure.in and suited to our needs
paul7ea487b2003-03-17 02:05:07 +0000613dnl -------------------------------------------------------------------------
614dnl
615dnl This next check looks funky due to a linker problem with some versions
616dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
617dnl omitted requiring libdl linking information. PAM-0.72 or better ships
618dnl with RedHat 6.2 and Debian 2.2 or better.
619AC_CHECK_LIB(pam, pam_start,
paul24cd4352003-05-06 12:16:27 +0000620 [AC_CHECK_LIB(pam, $pam_conv_func,
paul7ea487b2003-03-17 02:05:07 +0000621 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
622 LIBPAM="-lpam"],
623 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
624 LIBPAM="-lpam -lpam_misc"]
625 )
626 ],
627
628 [AC_CHECK_LIB(pam, pam_end,
paul24cd4352003-05-06 12:16:27 +0000629 [AC_CHECK_LIB(pam, $pam_conv_func,
paula159ed92003-06-04 11:01:45 +0000630 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul7ea487b2003-03-17 02:05:07 +0000631 LIBPAM="-lpam -ldl"],
paula159ed92003-06-04 11:01:45 +0000632 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul7ea487b2003-03-17 02:05:07 +0000633 LIBPAM="-lpam -ldl -lpam_misc"]
634 )
635 ],AC_MSG_WARN([*** pam support will not be built ***]),
636 [-ldl])
637 ]
638)
639fi
640AC_SUBST(LIBPAM)
641
642dnl -------------------------------
643dnl Endian-ness check
644dnl -------------------------------
645AC_WORDS_BIGENDIAN
646
647dnl -------------------------------
648dnl check the size in byte of the C
649dnl -------------------------------
650dnl AC_CHECK_SIZEOF(char)
651dnl AC_CHECK_SIZEOF(int)
652dnl AC_CHECK_SIZEOF(short)
653dnl AC_CHECK_SIZEOF(long)
654
655dnl ----------------------------
656dnl check existance of functions
657dnl ----------------------------
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000658AC_FUNC_CHOWN
659AC_FUNC_FNMATCH
660AC_FUNC_FORK
661AC_FUNC_MALLOC
662AC_FUNC_MEMCMP
663AC_FUNC_MKTIME
664AC_FUNC_STRFTIME
665AC_FUNC_REALLOC
666AC_FUNC_STAT
667AC_FUNC_SELECT_ARGTYPES
668AC_FUNC_STRFTIME
Paul Jakmad46d2a22007-05-10 16:53:04 +0000669dnl Avoid AC_FUNC_STRNLEN because it pulls in AC_SYSTEM_EXTENSIONS which
670dnl can lead to strange side effects. So we just check for strnlen
671dnl directly, see below.
Paul Jakma2b5cb412007-05-10 17:05:16 +0000672dnl AC_FUNC_STRNLENdnl
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000673AC_FUNC_VPRINTF
674
675dnl -------------------------------
676dnl bgpd needs pow() and hence libm
677dnl -------------------------------
678TMPLIBS="$LIBS"
679AC_CHECK_HEADER([math.h],
680 [AC_CHECK_LIB([m], [pow],
681 [LIBM="-lm"
682 LIBS="$LIBS $LIBM"
683 AC_DEFINE(HAVE_LIBM,, Have libm)
684 AC_CHECK_FUNCS(pow,[],[LIBM=""])
685 ])
686])
687if test x"$LIBM" = x ; then
688 AC_MSG_WARN([Unable to find working pow function - bgpd may not link])
689fi
690LIBS="$TMPLIBS"
691AC_SUBST(LIBM)
692
693dnl ---------------
694dnl other functions
695dnl ---------------
696AC_CHECK_FUNCS([dup2 ftruncate getcwd gethostbyname getpagesize gettimeofday \
Paul Jakmad46d2a22007-05-10 16:53:04 +0000697 inet_ntoa inet_aton strnlen \
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000698 memchr memmove memset select socket \
699 strcasecmp strchr strcspn strdup strerror \
700 strncasecmp strndup strrchr strspn strstr \
701 strtol strtoul strlcat strlcpy \
702 daemon snprintf vsnprintf \
703 if_nametoindex if_indextoname getifaddrs \
704 uname fcntl])
705
paula159ed92003-06-04 11:01:45 +0000706AC_CHECK_FUNCS(setproctitle, ,
707 [AC_CHECK_LIB(util, setproctitle,
708 [LIBS="$LIBS -lutil"
709 AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
710 ]
711 )
712 ]
713)
paul7ea487b2003-03-17 02:05:07 +0000714
715dnl ------------------------------------
716dnl Determine routing get and set method
717dnl ------------------------------------
718AC_MSG_CHECKING(zebra between kernel interface method)
719if test x"$opsys" = x"gnu-linux"; then
720 if test "${enable_netlink}" = "yes";then
721 AC_MSG_RESULT(netlink)
722 RT_METHOD=rt_netlink.o
723 AC_DEFINE(HAVE_NETLINK,,netlink)
724 netlink=yes
725 elif test "${enable_netlink}" = "no"; then
726 AC_MSG_RESULT(ioctl)
727 RT_METHOD=rt_ioctl.o
728 netlink=no
729 else
730 AC_MSG_RESULT(netlink)
731 RT_METHOD=rt_netlink.o
732 AC_DEFINE(HAVE_NETLINK,,netlink)
733 netlink=yes
734 fi
paul19877dd2004-05-11 10:49:35 +0000735elif test x"$opsys" = x"sol2-6";then
736 AC_MSG_RESULT(Route socket)
737 KERNEL_METHOD="kernel_socket.o"
738 RT_METHOD="rt_socket.o"
paulafd8a122005-03-12 06:36:10 +0000739elif test x"$opsys" = x"sol8";then
paul19877dd2004-05-11 10:49:35 +0000740 AC_MSG_RESULT(Route socket)
741 KERNEL_METHOD="kernel_socket.o"
742 RT_METHOD="rt_socket.o"
743elif test "$opsys" = "irix" ; then
744 AC_MSG_RESULT(Route socket)
745 KERNEL_METHOD="kernel_socket.o"
746 RT_METHOD="rt_socket.o"
paul7ea487b2003-03-17 02:05:07 +0000747else
paul19877dd2004-05-11 10:49:35 +0000748 AC_TRY_RUN([#include <errno.h>
paul7ea487b2003-03-17 02:05:07 +0000749#include <sys/types.h>
750#include <sys/socket.h>
751
752main ()
753{
754 int ac_sock;
755
756 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
757 if (ac_sock < 0 && errno == EINVAL)
758 exit (1);
759 exit (0);
760}],
761 [KERNEL_METHOD=kernel_socket.o
762 RT_METHOD=rt_socket.o
763 AC_MSG_RESULT(socket)],
764 [RT_METHOD=rt_ioctl.o
765 AC_MSG_RESULT(ioctl)],
766 [KERNEL_METHOD=kernel_socket.o
767 RT_METHOD=rt_socket.o
768 AC_MSG_RESULT(socket)])
paul7ea487b2003-03-17 02:05:07 +0000769fi
770AC_SUBST(RT_METHOD)
771AC_SUBST(KERNEL_METHOD)
772AC_SUBST(OTHER_METHOD)
773
Paul Jakma238497f2007-08-07 18:49:18 +0000774dnl --------------------------
775dnl Determine IS-IS I/O method
776dnl --------------------------
777AC_CHECK_HEADER(net/bpf.h)
778AC_CHECK_HEADER(sys/dlpi.h)
779AC_MSG_CHECKING(zebra IS-IS I/O method)
780if test x"$opsys" = x"gnu-linux"; then
781 AC_MSG_RESULT(pfpacket)
782 ISIS_METHOD=isis_pfpacket.o
783elif test x"$opsys" = x"sol2-6" -o x"$opsys" = x"sol8"; then
784 AC_MSG_RESULT(DLPI)
785 ISIS_METHOD="isis_dlpi.o"
786else
787 if test $ac_cv_header_net_bpf_h = no; then
788 if test $ac_cv_header_sys_dlpi_h = no; then
789 AC_MSG_RESULT(none)
790 AC_MSG_WARN([*** IS-IS support will not be built ***])
791 ISISD=""
792 else
793 AC_MSG_RESULT(DLPI)
794 fi
795 ISIS_METHOD="isis_dlpi.o"
796 else
797 AC_MSG_RESULT(BPF)
798 ISIS_METHOD="isis_bpf.o"
799 fi
800fi
801AC_SUBST(ISIS_METHOD)
802
ajsb99760a2005-01-04 16:24:43 +0000803dnl ------------------------------------
804dnl check for broken CMSG_FIRSTHDR macro
805dnl ------------------------------------
gdt6c200462005-01-04 17:02:48 +0000806AC_MSG_CHECKING(for broken CMSG_FIRSTHDR)
hasso5b087522005-04-03 23:46:37 +0000807AC_RUN_IFELSE([AC_LANG_SOURCE([[
ajsb99760a2005-01-04 16:24:43 +0000808#ifdef SUNOS_5
809#define _XPG4_2
810#define __EXTENSIONS__
811#endif
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000812#ifdef HAVE_STDLIB_H
813# include <stdlib.h>
814#endif
815#ifdef HAVE_SYS_TYPES_H
ajsb99760a2005-01-04 16:24:43 +0000816#include <sys/types.h>
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000817#endif
818#ifdef HAVE_SYS_SOCKET_H
ajsb99760a2005-01-04 16:24:43 +0000819#include <sys/socket.h>
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000820#endif
ajsb99760a2005-01-04 16:24:43 +0000821
822main()
823{
824 struct msghdr msg;
825 char buf[4];
826
827 msg.msg_control = buf;
828 msg.msg_controllen = 0;
829
830 if (CMSG_FIRSTHDR(&msg) != NULL)
831 exit(0);
832 exit (1);
hasso5b087522005-04-03 23:46:37 +0000833}]])],[AC_MSG_RESULT(yes - using workaround) AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)],
hassod33e8d72005-04-03 13:07:21 +0000834[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
ajsb99760a2005-01-04 16:24:43 +0000835
paul7ea487b2003-03-17 02:05:07 +0000836dnl ------------------------------
837dnl check kernel route read method
838dnl ------------------------------
839AC_CACHE_CHECK(route read method check, zebra_rtread,
840[if test "$netlink" = yes; then
841 RTREAD_METHOD="rtread_netlink.o"
842 zebra_rtread="netlink"
843else
844for zebra_rtread in /proc/net/route /dev/ip /dev/null;
845do
846 test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
847done
848case $zebra_rtread in
849 "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
850 zebra_rtread="proc";;
paul9c30ab62003-07-08 08:36:17 +0000851 "/dev/ip")
852 case "$host" in
853 *-freebsd*) RTREAD_METHOD=rtread_sysctl.o
854 zebra_rtread="sysctl";;
855 *) RTREAD_METHOD="rtread_getmsg.o"
856 zebra_rtread="getmsg";;
857 esac;;
paul7ea487b2003-03-17 02:05:07 +0000858 *) RTREAD_METHOD="rtread_sysctl.o"
859 zebra_rtread="sysctl";;
860esac
861fi])
862AC_SUBST(RTREAD_METHOD)
863
864dnl -----------------------------
865dnl check interface lookup method
866dnl -----------------------------
paul19877dd2004-05-11 10:49:35 +0000867IOCTL_METHOD=ioctl.o
paul7ea487b2003-03-17 02:05:07 +0000868AC_MSG_CHECKING(interface looking up method)
869if test "$netlink" = yes; then
870 AC_MSG_RESULT(netlink)
871 IF_METHOD=if_netlink.o
paul19877dd2004-05-11 10:49:35 +0000872elif test "$opsys" = "sol2-6";then
873 AC_MSG_RESULT(Solaris GIF)
874 IF_METHOD=if_ioctl.o
paulafd8a122005-03-12 06:36:10 +0000875elif test "$opsys" = "sol8";then
paul19877dd2004-05-11 10:49:35 +0000876 AC_MSG_RESULT(Solaris GLIF)
877 IF_METHOD=if_ioctl_solaris.o
878 IOCTL_METHOD=ioctl_solaris.o
879elif test "$opsys" = "irix" ; then
880 AC_MSG_RESULT(IRIX)
881 IF_METHOD=if_ioctl.o
882elif test "$opsys" = "openbsd";then
883 AC_MSG_RESULT(openbsd)
884 IF_METHOD=if_ioctl.o
885elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
886 AC_MSG_RESULT(sysctl)
paul7ea487b2003-03-17 02:05:07 +0000887 IF_METHOD=if_sysctl.o
888 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
paul19877dd2004-05-11 10:49:35 +0000889else
paul7ea487b2003-03-17 02:05:07 +0000890 AC_MSG_RESULT(ioctl)
891 IF_METHOD=if_ioctl.o
paul7ea487b2003-03-17 02:05:07 +0000892fi
893AC_SUBST(IF_METHOD)
paul19877dd2004-05-11 10:49:35 +0000894AC_SUBST(IOCTL_METHOD)
paul7ea487b2003-03-17 02:05:07 +0000895
paul42c98192005-05-07 02:22:51 +0000896dnl ---------------------------------------------------------------
897dnl figure out how to specify an interface in multicast sockets API
898dnl ---------------------------------------------------------------
Paul Jakma6f0e3f62007-05-10 02:38:51 +0000899AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], [], QUAGGA_INCLUDES)
paul42c98192005-05-07 02:22:51 +0000900
901AC_MSG_CHECKING([for BSD struct ip_mreq hack])
902AC_TRY_COMPILE([#ifdef HAVE_SYS_PARAM_H
903#include <sys/param.h>
Denis Ovsienkoc5408352009-04-13 20:11:44 +0400904#endif],[#if (defined(__FreeBSD__) && ((__FreeBSD_version >= 500022 && __FreeBSD_version < 700000) || (__FreeBSD_version < 500000 && __FreeBSD_version >= 440000))) || (defined(__NetBSD__) && defined(__NetBSD_Version__) && __NetBSD_Version__ >= 106010000)
paul42c98192005-05-07 02:22:51 +0000905 return (0);
906#else
907 #error No support for BSD struct ip_mreq hack detected
908#endif],[AC_MSG_RESULT(yes)
909AC_DEFINE(HAVE_BSD_STRUCT_IP_MREQ_HACK,,[Can pass ifindex in struct ip_mreq])],
910AC_MSG_RESULT(no))
911
Andrew J. Schorrc543a172008-01-10 15:24:32 +0000912dnl ---------------------------------------------------------------
913dnl figure out how to check link-state
914dnl ---------------------------------------------------------------
Andrew J. Schorr6418bed2008-01-11 16:33:59 +0000915AC_CHECK_HEADER([net/if.h],
916 [AC_CHECK_HEADER( [net/if_media.h],
917 [m4_define([LINK_DETECT_INCLUDES],
918 QUAGGA_INCLUDES
919 [#include <net/if_media.h>
920 ])
921 AC_CHECK_MEMBERS( [struct ifmediareq.ifm_status],
922 AC_DEFINE(HAVE_BSD_LINK_DETECT,,[BSD link-detect]),
923 [], LINK_DETECT_INCLUDES)],
924 [],
925 QUAGGA_INCLUDES)],
926 [], QUAGGA_INCLUDES )
Andrew J. Schorrc543a172008-01-10 15:24:32 +0000927
Paul Jakma0df7c912008-07-21 21:02:49 +0000928dnl ------------------------
929dnl TCP_MD5SIG socket option
930dnl ------------------------
931
932AC_CHECK_HEADER([netinet/tcp.h],
933 [m4_define([MD5_INCLUDES],
934 QUAGGA_INCLUDES
935 [#include <netinet/tcp.h>
936 ])
937 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)],
938 [],
939 QUAGGA_INCLUDES)
940if test $ac_cv_have_decl_TCP_MD5SIG = no; then
941 AC_CHECK_HEADER([linux/tcp.h],
942 [m4_define([MD5_INCLUDES],
943 QUAGGA_INCLUDES
944 [#include <linux/tcp.h>
945 ])
946 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)])
947fi
948
paul7ea487b2003-03-17 02:05:07 +0000949dnl -----------------------
950dnl check proc file system.
951dnl -----------------------
Stephen Hemmingercadfb2c2008-08-16 18:03:44 +0100952if test "$netlink" != yes; then
953 if test -r /proc/net/dev; then
954 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
955 IF_PROC=if_proc.o
956 fi
957 if test -r /proc/net/if_inet6; then
958 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
959 IF_PROC=if_proc.o
960 fi
paul7ea487b2003-03-17 02:05:07 +0000961fi
962AC_SUBST(IF_PROC)
963
964dnl -----------------------------
965dnl check ipforward detect method
966dnl -----------------------------
967AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
968[for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
969do
970 test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
971done
972case $zebra_ipforward_path in
973 "/proc/net/snmp") IPFORWARD=ipforward_proc.o
974 zebra_ipforward_path="proc";;
975 "/dev/ip")
976 case "$host" in
977 *-nec-sysv4*) IPFORWARD=ipforward_ews.o
978 zebra_ipforward_path="ews";;
paul9c30ab62003-07-08 08:36:17 +0000979 *-freebsd*) IPFORWARD=ipforward_sysctl.o
980 zebra_ipforward_path="sysctl";;
paul7ea487b2003-03-17 02:05:07 +0000981 *) IPFORWARD=ipforward_solaris.o
982 zebra_ipforward_path="solaris";;
983 esac;;
984 *) IPFORWARD=ipforward_sysctl.o
985 zebra_ipforward_path="sysctl";;
986esac])
987AC_SUBST(IPFORWARD)
988
989AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
990
991dnl ----------
992dnl IPv6 check
993dnl ----------
994AC_MSG_CHECKING(whether does this OS have IPv6 stack)
995if test "${enable_ipv6}" = "no"; then
996 AC_MSG_RESULT(disabled)
997else
998dnl ----------
999dnl INRIA IPv6
1000dnl ----------
paula159ed92003-06-04 11:01:45 +00001001 if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
1002 zebra_cv_ipv6=yes
1003 AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
1004 AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
1005 RIPNGD="ripngd"
1006 OSPF6D="ospf6d"
1007 LIB_IPV6=""
1008 AC_MSG_RESULT(INRIA IPv6)
paul7ea487b2003-03-17 02:05:07 +00001009dnl ---------
1010dnl KAME IPv6
1011dnl ---------
paula159ed92003-06-04 11:01:45 +00001012 elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
1013 zebra_cv_ipv6=yes
1014 AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
1015 AC_DEFINE(KAME,1,KAME IPv6)
1016 RIPNGD="ripngd"
1017 OSPF6D="ospf6d"
1018 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
paul7ea487b2003-03-17 02:05:07 +00001019 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +00001020 fi
1021 AC_MSG_RESULT(KAME)
hasso71c0fb52003-05-25 20:18:13 +00001022dnl -------------------------
1023dnl MUSICA IPv6
1024dnl default host check
1025dnl It is not used by Kheops
1026dnl -------------------------
paula159ed92003-06-04 11:01:45 +00001027 elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
1028 zebra_cv_ipv6=yes
1029 AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
1030 AC_DEFINE(MUSICA,1,Musica IPv6 stack)
1031 AC_DEFINE(KAME,1,KAME IPv6 stack)
1032 RIPNGD="ripngd"
1033 OSPF6D="ospf6d"
1034 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
hasso71c0fb52003-05-25 20:18:13 +00001035 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +00001036 fi
1037 AC_MSG_RESULT(MUSICA)
paul7ea487b2003-03-17 02:05:07 +00001038dnl ---------
1039dnl NRL check
1040dnl ---------
paula159ed92003-06-04 11:01:45 +00001041 elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
1042 zebra_cv_ipv6=yes
1043 AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
1044 AC_DEFINE(NRL,1,NRL)
1045 RIPNGD="ripngd"
1046 OSPF6D="ospf6d"
1047 if test x"$opsys" = x"bsdi";then
paul7ea487b2003-03-17 02:05:07 +00001048 AC_DEFINE(BSDI_NRL,,BSDI)
1049 AC_MSG_RESULT(BSDI_NRL)
paula159ed92003-06-04 11:01:45 +00001050 else
paul7ea487b2003-03-17 02:05:07 +00001051 AC_MSG_RESULT(NRL)
paula159ed92003-06-04 11:01:45 +00001052 fi
paul19877dd2004-05-11 10:49:35 +00001053dnl ------------------------------------
1054dnl Solaris 9, 10 and potentially higher
1055dnl ------------------------------------
paulafd8a122005-03-12 06:36:10 +00001056 elif test x"$opsys" = x"sol8"; then
paul19877dd2004-05-11 10:49:35 +00001057 zebra_cv_ipv6=yes;
1058 AC_DEFINE(HAVE_IPV6, 1, IPv6)
1059 AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
1060 RIPNGD="ripngd"
1061 OSPF6D="ospf6d"
1062 AC_MSG_RESULT(Solaris IPv6)
paul7ea487b2003-03-17 02:05:07 +00001063dnl ----------
1064dnl Linux IPv6
1065dnl ----------
paula159ed92003-06-04 11:01:45 +00001066 elif test "${enable_ipv6}" = "yes"; then
1067 AC_EGREP_CPP(yes, [
1068 #include <linux/version.h>
1069 /* 2.1.128 or later */
1070 #if LINUX_VERSION_CODE >= 0x020180
1071 yes
1072 #endif],
1073 [zebra_cv_ipv6=yes
1074 zebra_cv_linux_ipv6=yes
1075 AC_MSG_RESULT(Linux IPv6)])
1076 else
1077 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
1078 then
paul7ea487b2003-03-17 02:05:07 +00001079 zebra_cv_ipv6=yes
1080 zebra_cv_linux_ipv6=yes
1081 AC_MSG_RESULT(Linux IPv6)
paula159ed92003-06-04 11:01:45 +00001082 fi
1083 fi
paul7ea487b2003-03-17 02:05:07 +00001084
paula159ed92003-06-04 11:01:45 +00001085 if test "$zebra_cv_linux_ipv6" = "yes";then
hasso850d39f2005-06-30 13:52:20 +00001086 AC_MSG_CHECKING(whether libc has IPv6 support)
1087 AC_TRY_LINK([#include <netinet/in.h>
1088 ],[ int a; a = (int) in6addr_any.s6_addr[0]; if (a != 12345) return a; ],
1089 [AC_MSG_RESULT(yes)
1090 zebra_cv_ipv6=yes
1091 zebra_cv_linux_ipv6=yes],
1092 [AC_MSG_RESULT(no)
1093 zebra_cv_ipv6=no
1094 zebra_cv_linux_ipv6=no])
1095 fi
1096
1097 if test "$zebra_cv_linux_ipv6" = "yes";then
paula159ed92003-06-04 11:01:45 +00001098 AC_MSG_CHECKING(for GNU libc >= 2.1)
1099 AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
1100 AC_EGREP_CPP(yes, [
paul7ea487b2003-03-17 02:05:07 +00001101#include <features.h>
1102#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
1103 yes
paula159ed92003-06-04 11:01:45 +00001104#endif],
1105 [glibc=yes
1106 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
1107 AC_MSG_RESULT(yes)],
1108 AC_MSG_RESULT(no)
1109 )
1110 RIPNGD="ripngd"
1111 OSPF6D="ospf6d"
1112 if test "$glibc" != "yes"; then
paul7ea487b2003-03-17 02:05:07 +00001113 INCLUDES="-I/usr/inet6/include"
1114 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
1115 LIB_IPV6="-L/usr/inet6/lib -linet6"
1116 fi
paula159ed92003-06-04 11:01:45 +00001117 fi
1118 fi
paul7ea487b2003-03-17 02:05:07 +00001119
1120dnl -----------------------
1121dnl Set IPv6 related values
1122dnl -----------------------
paula159ed92003-06-04 11:01:45 +00001123 LIBS="$LIB_IPV6 $LIBS"
1124 AC_SUBST(LIB_IPV6)
paul7ea487b2003-03-17 02:05:07 +00001125
paula159ed92003-06-04 11:01:45 +00001126 if test x"$RIPNGD" = x""; then
1127 AC_MSG_RESULT(IPv4 only)
1128 fi
paul7ea487b2003-03-17 02:05:07 +00001129fi
1130
gdtfa3232e2003-12-03 17:52:30 +00001131dnl ------------------
1132dnl IPv6 header checks
1133dnl ------------------
1134if test "x${zebra_cv_ipv6}" = "xyes"; then
1135AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001136 netinet6/in6_var.h netinet6/nd6.h], [], [],
1137 QUAGGA_INCLUDES)
gdtfa3232e2003-12-03 17:52:30 +00001138fi
1139
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001140m4_define([QUAGGA_INCLUDES],dnl
1141QUAGGA_INCLUDES
1142[#if HAVE_NETINET6_IN6_H
1143#include <netinet6/in6.h>
1144#endif
1145#if HAVE_NETINET_IN6_VAR_H
1146#include <netinet/in6_var.h>
1147#endif
1148#if HAVE_NETINET_ICMP6_H
1149# include <netinet/icmp6.h>
1150#endif
1151#if HAVE_NETINET6_IN6_VAR_H
1152# include <netinet6/in6_var.h>
1153#endif
1154#if HAVE_NETINET6_ND6_H
Hasso Tepperfbf24542007-06-25 19:30:59 +00001155# include <netinet6/nd6.h>
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001156#endif
1157])dnl
1158
paul7ea487b2003-03-17 02:05:07 +00001159dnl --------------------
1160dnl Daemon disable check
1161dnl --------------------
1162if test "${enable_zebra}" = "no";then
1163 ZEBRA=""
1164else
1165 ZEBRA="zebra"
1166fi
1167
1168if test "${enable_bgpd}" = "no";then
1169 BGPD=""
1170else
1171 BGPD="bgpd"
1172fi
1173
1174if test "${enable_ripd}" = "no";then
1175 RIPD=""
1176else
1177 RIPD="ripd"
1178fi
1179
1180if test "${enable_ospfd}" = "no";then
1181 OSPFD=""
1182else
1183 OSPFD="ospfd"
1184fi
1185
ajsd0199432004-12-22 14:03:52 +00001186if test "${enable_watchquagga}" = "no";then
1187 WATCHQUAGGA=""
1188else
1189 WATCHQUAGGA="watchquagga"
1190fi
1191
paul1ef74ef2003-03-21 15:16:05 +00001192OSPFCLIENT=""
1193if test "${enable_opaque_lsa}" = "yes"; then
1194 if test "${enable_ospfapi}" != "no";then
paul9a569842003-03-28 01:45:13 +00001195 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
paul1ef74ef2003-03-21 15:16:05 +00001196
1197 if test "${enable_ospfclient}" != "no";then
1198 OSPFCLIENT="ospfclient"
1199 fi
1200 fi
1201
paul7ea487b2003-03-17 02:05:07 +00001202fi
1203
1204case "${enable_ripngd}" in
1205 "yes") RIPNGD="ripngd";;
1206 "no" ) RIPNGD="";;
1207 * ) ;;
1208esac
1209
1210case "${enable_ospf6d}" in
1211 "yes") OSPF6D="ospf6d";;
1212 "no" ) OSPF6D="";;
1213 * ) ;;
1214esac
1215
jardin9e867fe2003-12-23 08:56:18 +00001216case "${enable_isisd}" in
1217 "yes") ISISD="isisd";;
1218 "no" ) ISISD="";;
hassoae399ab2004-09-13 20:22:18 +00001219 * ) ;;
jardin9e867fe2003-12-23 08:56:18 +00001220esac
1221
Greg Troxel97cee872007-08-02 13:36:56 +00001222# XXX Perhaps auto-enable on Solaris, but that's messy for cross builds.
1223case "${enable_solaris}" in
1224 "yes") SOLARIS="solaris";;
1225 "no" ) SOLARIS="";;
1226 * ) ;;
1227esac
1228
paul7ea487b2003-03-17 02:05:07 +00001229if test "${enable_bgp_announce}" = "no";then
Paul Jakma750e8142008-07-22 21:11:48 +00001230 AC_DEFINE(DISABLE_BGP_ANNOUNCE,1,Disable BGP installation to zebra)
1231else
1232 AC_DEFINE(DISABLE_BGP_ANNOUNCE,0,Disable BGP installation to zebra)
paul7ea487b2003-03-17 02:05:07 +00001233fi
1234
1235AC_SUBST(ZEBRA)
1236AC_SUBST(BGPD)
1237AC_SUBST(RIPD)
1238AC_SUBST(RIPNGD)
1239AC_SUBST(OSPFD)
1240AC_SUBST(OSPF6D)
ajsd0199432004-12-22 14:03:52 +00001241AC_SUBST(WATCHQUAGGA)
jardin9e867fe2003-12-23 08:56:18 +00001242AC_SUBST(ISISD)
Greg Troxel97cee872007-08-02 13:36:56 +00001243AC_SUBST(SOLARIS)
paul7ea487b2003-03-17 02:05:07 +00001244AC_SUBST(VTYSH)
1245AC_SUBST(INCLUDES)
1246AC_SUBST(CURSES)
1247AC_SUBST(OSPFCLIENT)
paul1ef74ef2003-03-21 15:16:05 +00001248AC_SUBST(OSPFAPI)
paul7ea487b2003-03-17 02:05:07 +00001249AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
1250AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
1251AC_CHECK_LIB(crypt, crypt)
1252AC_CHECK_LIB(resolv, res_init)
paul7ea487b2003-03-17 02:05:07 +00001253
1254dnl ---------------------------------------------------
1255dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
1256dnl ---------------------------------------------------
paula159ed92003-06-04 11:01:45 +00001257AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
1258AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
1259AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
paul7ea487b2003-03-17 02:05:07 +00001260
1261dnl ---------------------------
1262dnl check system has GNU regexp
1263dnl ---------------------------
1264dnl AC_MSG_CHECKING(whether system has GNU regex)
1265AC_CHECK_LIB(c, regexec,
1266[AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
1267 LIB_REGEX=""],
1268[LIB_REGEX="regex.o"])
1269AC_SUBST(LIB_REGEX)
1270
1271dnl ------------------
paulb1fc9ac2006-01-31 10:09:27 +00001272dnl check Net-SNMP library
paul7ea487b2003-03-17 02:05:07 +00001273dnl ------------------
paulb1fc9ac2006-01-31 10:09:27 +00001274if test "${enable_snmp}" = "yes"; then
Joakim Tjernlundfb62a3c2008-05-13 20:03:32 +02001275 if test "$with_crypto" != "no"; then
1276 LIBS="${LIBS} -lcrypto";
1277 fi
paulb1fc9ac2006-01-31 10:09:27 +00001278 AC_CHECK_LIB(netsnmp, asn_parse_int,
1279 [AC_DEFINE(HAVE_NETSNMP,,Net SNMP)
1280 AC_DEFINE(HAVE_SNMP,,SNMP)
1281 LIBS="${LIBS} -lnetsnmp"],
1282 [AC_MSG_ERROR([--enable-snmp given, but cannot find support for SNMP])])
Joakim Tjernlundfb62a3c2008-05-13 20:03:32 +02001283
1284 AC_CHECK_HEADER([net-snmp/net-snmp-config.h],
1285 [],
1286 [AC_MSG_ERROR([--enable-snmp given, but cannot find net-snmp-config.h])],
1287 QUAGGA_INCLUDES)
paulb1fc9ac2006-01-31 10:09:27 +00001288 AC_SUBST(SNMP_INCLUDES)
paul7ea487b2003-03-17 02:05:07 +00001289fi
1290
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001291dnl ---------------------------
1292dnl sockaddr and netinet checks
1293dnl ---------------------------
1294AC_CHECK_TYPES([struct sockaddr, struct sockaddr_in,
1295 struct sockaddr_in6, struct sockaddr_un, struct sockaddr_dl,
1296 socklen_t,
1297 struct ifaliasreq, struct if6_aliasreq, struct in6_aliasreq,
1298 struct nd_opt_adv_interval, struct rt_addrinfo,
Paul Jakma11770e12007-06-22 16:14:42 +00001299 struct nd_opt_homeagent_info, struct nd_opt_adv_interval],
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001300 [], [], QUAGGA_INCLUDES)
paul7ea487b2003-03-17 02:05:07 +00001301
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001302AC_CHECK_MEMBERS([struct sockaddr.sa_len,
1303 struct sockaddr_in.sin_len, struct sockaddr_un.sun_len,
1304 struct sockaddr_in6.sin6_scope_id,
1305 struct if6_aliasreq.ifra_lifetime,
1306 struct nd_opt_adv_interval.nd_opt_ai_type],
1307 [], [], QUAGGA_INCLUDES)
hasso71c0fb52003-05-25 20:18:13 +00001308
paul7ea487b2003-03-17 02:05:07 +00001309dnl ---------------------------
Paul Jakma11770e12007-06-22 16:14:42 +00001310dnl IRDP/pktinfo/icmphdr checks
paul7ea487b2003-03-17 02:05:07 +00001311dnl ---------------------------
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001312AC_CHECK_TYPES([struct in_pktinfo],
Paul Jakma11770e12007-06-22 16:14:42 +00001313 [AC_CHECK_TYPES([struct icmphdr],
1314 [if test "${enable_irdp}" != "no"; then
1315 AC_DEFINE(HAVE_IRDP,, IRDP)
1316 fi],
1317 [if test "${enable_irdp}" = "yes"; then
1318 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1319 fi], [QUAGGA_INCLUDES])],
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001320 [if test "${enable_irdp}" = "yes"; then
1321 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1322 fi], [QUAGGA_INCLUDES])
vincent29c4c9b2005-03-25 13:05:47 +00001323
paul7ea487b2003-03-17 02:05:07 +00001324dnl --------------------------------------
1325dnl checking for getrusage struct and call
1326dnl --------------------------------------
1327AC_MSG_CHECKING(whether getrusage is available)
1328AC_TRY_COMPILE([#include <sys/resource.h>
1329],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
1330[AC_MSG_RESULT(yes)
1331 AC_DEFINE(HAVE_RUSAGE,,rusage)],
1332 AC_MSG_RESULT(no))
1333
Stephen Hemmingerc4376c92009-05-28 15:29:10 -07001334dnl --------------------------------------
1335dnl checking for clock_time monotonic struct and call
1336dnl --------------------------------------
Paul Jakma6511cab2009-06-18 17:38:01 +01001337AC_CHECK_DECL(CLOCK_MONOTONIC,
1338 [AC_CHECK_LIB(rt, clock_gettime, [LIBS="$LIBS -lrt"])
1339 AC_DEFINE(HAVE_MONOTONIC_CLOCK,, Have monotonic clock)
1340], [AC_MSG_RESULT(no)], [QUAGGA_INCLUDES])
Stephen Hemmingerc4376c92009-05-28 15:29:10 -07001341
pauledd7c242003-06-04 13:59:38 +00001342dnl -------------------
1343dnl capabilities checks
1344dnl -------------------
hasso41d3fc92004-04-06 11:59:00 +00001345if test "${enable_capabilities}" != "no"; then
1346 AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1347 AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1348 [AC_MSG_RESULT(yes)
1349 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1350 quagga_ac_keepcaps="yes"],
1351 AC_MSG_RESULT(no)
pauledd7c242003-06-04 13:59:38 +00001352 )
hasso41d3fc92004-04-06 11:59:00 +00001353 if test x"${quagga_ac_keepcaps}" = x"yes"; then
1354 AC_CHECK_HEADERS(sys/capability.h)
1355 fi
1356 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1357 AC_CHECK_LIB(cap, cap_init,
1358 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1359 LIBCAP="-lcap"
paulceacedb2005-09-29 14:39:32 +00001360 quagga_ac_lcaps="yes"]
hasso41d3fc92004-04-06 11:59:00 +00001361 )
paulceacedb2005-09-29 14:39:32 +00001362 else
1363 AC_CHECK_HEADERS(priv.h,
1364 [AC_MSG_CHECKING(Solaris style privileges are available)
1365 AC_TRY_COMPILE([#include <priv.h>],[getpflags(PRIV_AWARE);],
1366 [AC_MSG_RESULT(yes)
1367 AC_DEFINE(HAVE_SOLARIS_CAPABILITIES,1,getpflags)
1368 quagga_ac_scaps="yes"],
1369 AC_MSG_RESULT(no)
1370 )
1371 ]
1372 )
1373 fi
1374 if test x"${quagga_ac_scaps}" = x"yes" \
1375 -o x"${quagga_ac_lcaps}" = x"yes"; then
1376 AC_DEFINE(HAVE_CAPABILITIES,1,capabilities)
hasso41d3fc92004-04-06 11:59:00 +00001377 fi
pauledd7c242003-06-04 13:59:38 +00001378fi
1379AC_SUBST(LIBCAP)
1380
paulfb2d1502003-06-04 09:40:54 +00001381dnl ---------------------------
1382dnl check for glibc 'backtrace'
1383dnl ---------------------------
1384if test "${glibc}" = "yes"; then
Paul Jakmafb66b292006-05-28 08:26:15 +00001385 AC_CHECK_HEADER([execinfo.h],
1386 [AC_CHECK_FUNC([backtrace],
1387 [AC_DEFINE(HAVE_GLIBC_BACKTRACE,,[Glibc backtrace])
1388 AC_DEFINE(HAVE_STACK_TRACE,,[Stack symbol decoding])
1389 ])
1390 ])
paulfb2d1502003-06-04 09:40:54 +00001391fi
1392
Paul Jakma41be32b2006-03-30 13:53:59 +00001393dnl -----------------------------------------
1394dnl check for malloc mallinfo struct and call
1395dnl this must try and link using LIBS, in
1396dnl order to check no alternative allocator
1397dnl has been specified, which might not provide
1398dnl mallinfo, e.g. such as Umem on Solaris.
1399dnl -----------------------------------------
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001400AC_CHECK_HEADER([malloc.h],
Paul Jakma41be32b2006-03-30 13:53:59 +00001401 [AC_MSG_CHECKING(whether mallinfo is available)
1402 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
1403 [[struct mallinfo ac_x; ac_x = mallinfo ();]])],
1404 [AC_MSG_RESULT(yes)
1405 AC_DEFINE(HAVE_MALLINFO,,mallinfo)],
1406 AC_MSG_RESULT(no)
1407 )
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001408 ], [], QUAGGA_INCLUDES)
Paul Jakma41be32b2006-03-30 13:53:59 +00001409
paul408ad942003-05-20 00:03:33 +00001410dnl ----------
1411dnl configure date
1412dnl ----------
1413CONFDATE=`date '+%Y%m%d'`
1414AC_SUBST(CONFDATE)
1415
Paul P Komkoff Jr46bc0e42008-08-13 16:17:04 +01001416dnl Conditionally enable PIE support for GNU toolchains.
Paul P Komkoff Jr46bc0e42008-08-13 16:17:04 +01001417AC_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 +01001418if test "$enable_pie" != "no"; then
Paul P Komkoff Jr46bc0e42008-08-13 16:17:04 +01001419 AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [
1420 save_CFLAGS=$CFLAGS
1421 save_LDFLAGS=$LDFLAGS
1422 CFLAGS="$CFLAGS -fPIE"
1423 LDFLAGS="$LDFLAGS -pie"
1424 AC_LINK_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
1425 [ap_cv_cc_pie=yes], [ap_cv_cc_pie=no]
1426 )
1427 CFLAGS=$save_CFLAGS
1428 LDFLAGS=$save_LDFLAGS
1429 ])
1430 if test "$ap_cv_cc_pie" = "yes"; then
1431 PICFLAGS="-fPIE"
1432 PILDFLAGS="-pie"
1433 fi
1434fi
1435
1436AC_SUBST(PICFLAGS)
1437AC_SUBST(PILDFLAGS)
1438
paul7ea487b2003-03-17 02:05:07 +00001439dnl ------------------------------
paula159ed92003-06-04 11:01:45 +00001440dnl set paths for state directory
paul23bd12c2003-04-07 06:11:09 +00001441dnl ------------------------------
1442if test "${prefix}" = "NONE"; then
paule8f29842003-08-12 13:08:31 +00001443 quagga_statedir_prefix="";
paul23bd12c2003-04-07 06:11:09 +00001444else
paule8f29842003-08-12 13:08:31 +00001445 quagga_statedir_prefix=${prefix}
paul23bd12c2003-04-07 06:11:09 +00001446fi
1447if test "${localstatedir}" = '${prefix}/var'; then
paula159ed92003-06-04 11:01:45 +00001448 AC_CACHE_CHECK(state directory,ac_statedir,
paule8f29842003-08-12 13:08:31 +00001449 [for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
1450 ${quagga_statedir_prefix}/var/adm dnl
1451 ${quagga_statedir_prefix}/etc dnl
paula159ed92003-06-04 11:01:45 +00001452 /var/run dnl
1453 /var/adm dnl
1454 /etc dnl
1455 /dev/null;
paul23bd12c2003-04-07 06:11:09 +00001456 do
paule8f29842003-08-12 13:08:31 +00001457 test -d $QUAGGA_STATE_DIR && break
paul23bd12c2003-04-07 06:11:09 +00001458 done
paule8f29842003-08-12 13:08:31 +00001459 quagga_statedir=$QUAGGA_STATE_DIR])
paul23bd12c2003-04-07 06:11:09 +00001460else
paule8f29842003-08-12 13:08:31 +00001461 quagga_statedir=${localstatedir}
paula159ed92003-06-04 11:01:45 +00001462 AC_MSG_CHECKING(directory to use for state file)
paule8f29842003-08-12 13:08:31 +00001463 AC_MSG_RESULT(${quagga_statedir})
paul26275b02005-04-11 07:10:47 +00001464 AC_SUBST(quagga_statedir)
paul23bd12c2003-04-07 06:11:09 +00001465fi
paule8f29842003-08-12 13:08:31 +00001466if test $quagga_statedir = "/dev/null"; then
paula159ed92003-06-04 11:01:45 +00001467 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1468fi
1469
paule8f29842003-08-12 13:08:31 +00001470AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1471AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1472AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1473AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1474AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1475AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
jardin9e867fe2003-12-23 08:56:18 +00001476AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
ajsd0199432004-12-22 14:03:52 +00001477AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
paule8f29842003-08-12 13:08:31 +00001478AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1479AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1480AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1481AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1482AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1483AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1484AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
jardin9e867fe2003-12-23 08:56:18 +00001485AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
ajs515210b2004-12-22 15:35:12 +00001486AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
paul7ea487b2003-03-17 02:05:07 +00001487
paul1eb8ef22005-04-07 07:30:20 +00001488dnl -------------------------------
1489dnl Quagga sources should always be
1490dnl current wrt interfaces. Dont
1491dnl allow deprecated interfaces to
1492dnl be exposed.
1493dnl -------------------------------
1494AC_DEFINE(QUAGGA_NO_DEPRECATED_INTERFACES, 1, Hide deprecated interfaces)
1495
paul7ea487b2003-03-17 02:05:07 +00001496dnl ---------------------------
1497dnl Check htonl works correctly
1498dnl ---------------------------
1499AC_MSG_CHECKING(for working htonl)
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001500AC_CACHE_VAL(ac_cv_htonl_works,
1501 [AC_LINK_IFELSE([AC_LANG_PROGRAM([QUAGGA_INCLUDES],[htonl (0);])],
1502 [ac_cv_htonl_works=yes], [ac_cv_htonl_works=no])
1503 ]
1504)
paul7ea487b2003-03-17 02:05:07 +00001505AC_MSG_RESULT($ac_cv_htonl_works)
1506
paul14c17fd2004-11-07 22:34:23 +00001507AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile
ajsd0199432004-12-22 14:03:52 +00001508 ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
jardin9e867fe2003-12-23 08:56:18 +00001509 ospf6d/Makefile isisd/Makefile vtysh/Makefile doc/Makefile
paul14c17fd2004-11-07 22:34:23 +00001510 ospfclient/Makefile tests/Makefile m4/Makefile redhat/Makefile
gdt69f1fc22004-08-27 15:57:35 +00001511 pkgsrc/Makefile
paul670bbf12004-11-12 09:05:00 +00001512 redhat/quagga.spec
gdtb7a97f82004-07-23 16:23:56 +00001513 lib/version.h
paul14c17fd2004-11-07 22:34:23 +00001514 doc/defines.texi
hassof695b012005-04-02 19:03:39 +00001515 isisd/topology/Makefile
gdtcbd04082004-08-31 18:16:36 +00001516 pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
paulf31293a2004-11-12 09:27:04 +00001517 pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
paul26275b02005-04-11 07:10:47 +00001518AC_CONFIG_FILES([solaris/Makefile])
1519
paul670bbf12004-11-12 09:05:00 +00001520AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
hasso48577192004-11-19 06:41:49 +00001521## Hack, but working solution to avoid rebuilding of quagga.info.
1522## It's already in CVS until texinfo 4.7 is more common.
paul14c17fd2004-11-07 22:34:23 +00001523AC_OUTPUT
paul7ea487b2003-03-17 02:05:07 +00001524
1525echo "
hassoc89f6492004-08-26 12:21:28 +00001526Quagga configuration
1527--------------------
1528quagga version : ${PACKAGE_VERSION}
paul7ea487b2003-03-17 02:05:07 +00001529host operationg system : ${host_os}
1530source code location : ${srcdir}
1531compiler : ${CC}
1532compiler flags : ${CFLAGS}
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001533make : ${MAKE-make}
hasso2d582282005-03-28 15:29:07 +00001534includes : ${INCLUDES} ${SNMP_INCLUDES}
Paul Jakma6f0e3f62007-05-10 02:38:51 +00001535linker flags : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM}
paule8f29842003-08-12 13:08:31 +00001536state file directory : ${quagga_statedir}
pauldc7a2bf2003-10-22 00:07:44 +00001537config file directory : `eval echo \`echo ${sysconfdir}\``
gdtd6b72f72003-12-03 17:24:27 +00001538example directory : `eval echo \`echo ${exampledir}\``
paul8d4aee52003-06-06 00:30:35 +00001539user to run as : ${enable_user}
1540group to run as : ${enable_group}
1541group for vty sockets : ${enable_vty_group}
gdtaa593d52003-12-22 20:15:53 +00001542config file mask : ${enable_configfile_mask}
1543log file mask : ${enable_logfile_mask}
pauldc7a2bf2003-10-22 00:07:44 +00001544
1545The above user and group must have read/write access to the state file
Paul Jakma105b8232006-05-28 08:02:41 +00001546directory and to the config files in the config file directory."
1547
1548if test x"$quagga_cv_gnu_make" = x"no"; then echo "
1549Warning: The ${MAKE-make} programme detected, either in your path or
1550via the MAKE variable, is not GNU Make. GNU make may be installed as
1551gmake on some systems. and is required to complete a build of Quagga
1552" > /dev/stderr
1553fi