blob: 2129421225853169ebdfaeb7b49769cbf0f79f54 [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##
hassobeebba72004-06-20 21:00:27 +00008## $Id: configure.ac,v 1.53 2004/06/20 21:00:27 hasso Exp $
paule8f29842003-08-12 13:08:31 +00009AC_PREREQ(2.53)
paul7ea487b2003-03-17 02:05:07 +000010
paul8b338fe2004-05-03 12:50:39 +000011AC_INIT(quagga, 0.96.5, [http://bugzilla.quagga.net])
paulfa1253d2003-09-24 05:09:26 +000012AC_CONFIG_SRCDIR(lib/zebra.h)
gdt81b81822004-04-07 22:48:47 +000013AM_INIT_AUTOMAKE(1.6)
paul7ea487b2003-03-17 02:05:07 +000014AM_CONFIG_HEADER(config.h)
15
gdtd6b72f72003-12-03 17:24:27 +000016dnl default is to match previous behavior
gdtc4f0efe2003-12-04 15:39:25 +000017exampledir=${sysconfdir}
gdtd6b72f72003-12-03 17:24:27 +000018AC_ARG_ENABLE([exampledir],
19 AC_HELP_STRING([--enable-exampledir],
20 [specify alternate directory for examples]),
21 exampledir="$enableval",)
gdtc4f0efe2003-12-04 15:39:25 +000022dnl XXX add --exampledir to autoconf standard directory list somehow
gdtd6b72f72003-12-03 17:24:27 +000023AC_SUBST(exampledir)
24
paul7ea487b2003-03-17 02:05:07 +000025dnl -----------------------------------
26dnl Get hostname and other information.
27dnl -----------------------------------
28AC_CANONICAL_HOST
29
30dnl ------------
31dnl Check CFLAGS
32dnl ------------
33AC_ARG_WITH(cflags,
34[ --with-cflags Set CFLAGS for use in compilation.])
35if test "x$with_cflags" != "x" ; then
36 CFLAGS="$with_cflags" ; cflags_specified=yes ;
37elif test -n "$CFLAGS" ; then
38 cflags_specified=yes ;
39fi
40
41dnl --------
42dnl Check CC
43dnl --------
44AC_PROG_CC
45
46dnl -----------------------------------------
47dnl If CLFAGS doesn\'t exist set default value
48dnl -----------------------------------------
49if test "x$cflags_specified" = "x" ; then
50 CFLAGS="$CFLAGS -Wall"
51fi
52
53dnl --------------
54dnl Check programs
55dnl --------------
56AC_PROG_CPP
57AC_PROG_INSTALL
58AC_PROG_MAKE_SET
59AC_CHECK_TOOL(AR, ar)
60AC_CHECK_TOOL(RANLIB, ranlib, :)
61
62dnl ---------
63dnl AIX check
64dnl ---------
65AC_AIX
66
67dnl ----------------------
68dnl Packages configuration
69dnl ----------------------
70AC_ARG_ENABLE(vtysh,
paule8f29842003-08-12 13:08:31 +000071[ --enable-vtysh, Make integrated vty shell for Quagga])
paul7ea487b2003-03-17 02:05:07 +000072AC_ARG_ENABLE(ipv6,
73[ --disable-ipv6 turn off IPv6 related features and daemons])
74AC_ARG_ENABLE(zebra,
75[ --disable-zebra do not build zebra daemon])
76AC_ARG_ENABLE(bgpd,
77[ --disable-bgpd do not build bgpd])
78AC_ARG_ENABLE(ripd,
79[ --disable-ripd do not build ripd])
80AC_ARG_ENABLE(ripngd,
81[ --disable-ripngd do not build ripngd])
82AC_ARG_ENABLE(ospfd,
83[ --disable-ospfd do not build ospfd])
paul7ea487b2003-03-17 02:05:07 +000084AC_ARG_ENABLE(ospf6d,
85[ --disable-ospf6d do not build ospf6d])
jardin9e867fe2003-12-23 08:56:18 +000086AC_ARG_ENABLE(isisd,
87[ --disable-isisd do not build isisd])
paul7ea487b2003-03-17 02:05:07 +000088AC_ARG_ENABLE(bgp-announce,
89[ --disable-bgp-announce, turn off BGP route announcement])
90AC_ARG_ENABLE(netlink,
91[ --enable-netlink force to use Linux netlink interface])
92AC_ARG_ENABLE(broken-aliases,
93[ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
94AC_ARG_ENABLE(snmp,
95[ --enable-snmp enable SNMP support])
96AC_ARG_WITH(libpam,
97[ --with-libpam use libpam for PAM support in vtysh])
hasso71c0fb52003-05-25 20:18:13 +000098AC_ARG_ENABLE(tcp-zebra,
paul7ea487b2003-03-17 02:05:07 +000099[ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon])
paul7ea487b2003-03-17 02:05:07 +0000100AC_ARG_ENABLE(opaque-lsa,
paul1ef74ef2003-03-21 15:16:05 +0000101[ --enable-opaque-lsa enable OSPF Opaque-LSA with OSPFAPI support (RFC2370)])
102AC_ARG_ENABLE(ospfapi,
103[ --disable-ospfapi do not build OSPFAPI to access the OSPF LSA Database,
104 (this is the default if --enable-opaque-lsa is not set)])
105AC_ARG_ENABLE(ospfclient,
106[ --disable-ospfclient do not build OSPFAPI client for OSPFAPI,
107 (this is the default if --disable-ospfapi is set)])
paul7ea487b2003-03-17 02:05:07 +0000108AC_ARG_ENABLE(ospf-te,
109[ --enable-ospf-te enable Traffic Engineering Extension to OSPF])
110AC_ARG_ENABLE(multipath,
111[ --enable-multipath=ARG enable multipath function, ARG must be digit])
paule8f29842003-08-12 13:08:31 +0000112AC_ARG_ENABLE(quagga_user,
113[ --enable-user=ARG user to run Quagga suite as (default quagga)])
114AC_ARG_ENABLE(quagga_group,
115[ --enable-group=ARG group to run Quagga suite as (default quagga)])
pauledd7c242003-06-04 13:59:38 +0000116AC_ARG_ENABLE(vty_group,
117[ --enable-vty-group=ARG set vty sockets to have specified group as owner])
gdtaa593d52003-12-22 20:15:53 +0000118AC_ARG_ENABLE(configfile_mask,
119[ --enable-configfile-mask=ARG set mask for config files])
120AC_ARG_ENABLE(logfile_mask,
121[ --enable-logfile-mask=ARG set mask for log files])
pauledd7c242003-06-04 13:59:38 +0000122
hasso71c0fb52003-05-25 20:18:13 +0000123AC_ARG_ENABLE(rtadv,
gdtd2a0ccc2003-12-03 18:13:48 +0000124[ --disable-rtadv disable IPV6 router advertisement feature])
hassoca776982004-06-12 14:33:05 +0000125AC_ARG_ENABLE(irdp,
126[ --enable-irdp enable IRDP server support in zebra])
hasso41d3fc92004-04-06 11:59:00 +0000127AC_ARG_ENABLE(capabilities,
128[ --disable-capabilities disable using POSIX capabilities])
paul7ea487b2003-03-17 02:05:07 +0000129
130if test "${enable_broken_aliases}" = "yes"; then
131 if test "${enable_netlink}" = "yes"
132 then
133 echo "Sorry, you can't use netlink with broken aliases"
134 exit 1
135 fi
136 AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
137 enable_netlink=no
138fi
139
140if test "${enable_tcp_zebra}" = "yes"; then
141 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
142fi
143
paul7ea487b2003-03-17 02:05:07 +0000144if test "${enable_opaque_lsa}" = "yes"; then
145 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
146fi
147
148if test "${enable_ospf_te}" = "yes"; then
149 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
150 AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
151fi
152
gdtd2a0ccc2003-12-03 18:13:48 +0000153AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
154if test "${enable_rtadv}" != "no"; then
hasso71c0fb52003-05-25 20:18:13 +0000155 AC_MSG_RESULT(yes)
gdtd2a0ccc2003-12-03 18:13:48 +0000156 AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
paul2487bea2003-05-25 23:51:31 +0000157else
158 AC_MSG_RESULT(no)
hasso71c0fb52003-05-25 20:18:13 +0000159fi
paul7ea487b2003-03-17 02:05:07 +0000160
hassoca776982004-06-12 14:33:05 +0000161if test "${enable_irdp}" = "yes"; then
162 AC_DEFINE(HAVE_IRDP,, IRDP )
163fi
164
paul79cb2162003-06-06 12:19:53 +0000165if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
paule8f29842003-08-12 13:08:31 +0000166 enable_user="quagga"
pauledd7c242003-06-04 13:59:38 +0000167elif test "${enable_user}" = "no"; then
168 enable_user="root"
169fi
paule8f29842003-08-12 13:08:31 +0000170AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
pauledd7c242003-06-04 13:59:38 +0000171
paul79cb2162003-06-06 12:19:53 +0000172if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
paule8f29842003-08-12 13:08:31 +0000173 enable_group="quagga"
pauledd7c242003-06-04 13:59:38 +0000174elif test "${enable_group}" = "no"; then
175 enable_group="root"
176fi
paule8f29842003-08-12 13:08:31 +0000177AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
pauledd7c242003-06-04 13:59:38 +0000178
179if test x"${enable_vty_group}" = x"yes" ; then
paul8d4aee52003-06-06 00:30:35 +0000180 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
paul79cb2162003-06-06 12:19:53 +0000181elif test x"${enable_vty_group}" != x""; then
paul8d4aee52003-06-06 00:30:35 +0000182 if test x"${enable_vty_group}" != x"no"; then
pauledd7c242003-06-04 13:59:38 +0000183 AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
184 fi
185fi
186
gdtaa593d52003-12-22 20:15:53 +0000187enable_configfile_mask=${enable_configfile_mask:-0600}
188AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
189
190enable_logfile_mask=${enable_logfile_mask:-0600}
191AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
192
paul7ea487b2003-03-17 02:05:07 +0000193changequote(, )dnl
194
195MULTIPATH_NUM=1
196
197case "${enable_multipath}" in
198 [0-9]|[1-9][0-9])
199 MULTIPATH_NUM="${enable_multipath}"
200 ;;
201 "")
202 ;;
203 *)
204 echo "Please specify digit to --enable-multipath ARG."
205 exit 1
206 ;;
207esac
208
209changequote([, ])dnl
210
211AC_SUBST(MULTIPATH_NUM)
212
213dnl -------------------
214dnl Check header files.
215dnl -------------------
pauldc7a2bf2003-10-22 00:07:44 +0000216AC_HEADER_STDC
217AC_CHECK_HEADERS([string.h stropts.h sys/conf.h sys/ksym.h sys/time.h \
218 sys/times.h sys/select.h sys/sysctl.h sys/sockio.h \
219 sys/types.h linux/version.h kvm.h netdb.h asm/types.h \
220 libutil.h limits.h])
221
paul835b7f12003-10-30 21:59:57 +0000222AC_CHECK_HEADERS([sys/socket.h netinet/in_systm.h netinet/in.h \
paulf3bd1a72003-11-02 07:29:11 +0000223 net/if_dl.h net/netopt.h inet/nd.h net/route.h \
paul835b7f12003-10-30 21:59:57 +0000224 net/if.h net/if_var.h netinet/in_var.h])
pauldc7a2bf2003-10-22 00:07:44 +0000225
gdtfa3232e2003-12-03 17:52:30 +0000226dnl V6 headers are checked below, after we check for v6
paul7ea487b2003-03-17 02:05:07 +0000227
228dnl check some types
229AC_C_CONST
230dnl AC_TYPE_PID_T
231AC_TYPE_SIGNAL
232
233dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
234case "$host" in
paul19877dd2004-05-11 10:49:35 +0000235 [*-sunos5.[6-8]*] | [*-solaris2.[6-8]*])
paul7ea487b2003-03-17 02:05:07 +0000236 opsys=sol2-6
paul19877dd2004-05-11 10:49:35 +0000237 AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.8)
238 AC_DEFINE(SUNOS_5, 1, SunOS 5)
paul7ea487b2003-03-17 02:05:07 +0000239 AC_CHECK_LIB(xnet, main)
240 CURSES=-lcurses
241 ;;
paul19877dd2004-05-11 10:49:35 +0000242 [*-sunos5.[8-9]] | [*-sunos5.1[0-9]] \
243 | [*-solaris2.[8-9]] | [*-solaris2.1[0-9]])
244 opsys=sol9
245 AC_DEFINE(SUNOS_59,,SunOS 5.9 up)
246 AC_DEFINE(SUNOS_5, 1, SunOS 5)
247 AC_CHECK_LIB(socket, main)
248 AC_CHECK_LIB(nsl, main)
249 CURSES=-lcurses
250 ;;
paul7ea487b2003-03-17 02:05:07 +0000251 *-sunos5* | *-solaris2*)
paul19877dd2004-05-11 10:49:35 +0000252 AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
paul7ea487b2003-03-17 02:05:07 +0000253 AC_CHECK_LIB(socket, main)
254 AC_CHECK_LIB(nsl, main)
255 CURSES=-lcurses
256 ;;
257 *-linux-*)
258 opsys=gnu-linux
259 AC_DEFINE(GNU_LINUX,,GNU Linux)
260 ;;
261 *-nec-sysv4*)
262 AC_CHECK_LIB(nsl, gethostbyname)
263 AC_CHECK_LIB(socket, socket)
264 ;;
265 *-freebsd3.2)
266 AC_DEFINE(FREEBSD_32,,FreeBSD 3.2)
267 ;;
268 *-openbsd*)
269 opsys=openbsd
270 AC_DEFINE(OPEN_BSD,,OpenBSD)
271 ;;
272 *-bsdi*)
273 opsys=bsdi
274 OTHER_METHOD="mtu_kvm.o"
275 AC_CHECK_LIB(kvm, main)
276 ;;
paul49e3b3c2003-10-23 20:39:50 +0000277 *-irix6.5)
pauldc7a2bf2003-10-22 00:07:44 +0000278 opsys=irix
279 AC_DEFINE(IRIX_65,,IRIX 6.5)
280 ;;
paul7ea487b2003-03-17 02:05:07 +0000281esac
282
283dnl ---------------------
284dnl Integrated VTY option
285dnl ---------------------
286case "${enable_vtysh}" in
287 "yes") VTYSH="vtysh";
288 AC_DEFINE(VTYSH,,VTY shell)
289 AC_CHECK_LIB(tinfo, tputs, , AC_CHECK_LIB(ncurses, tputs))
290 AC_CHECK_LIB(readline, main)
291 if test $ac_cv_lib_readline_main = no; then
292 AC_MSG_ERROR([vtysh needs libreadline but was not found on your system.])
293 fi
294 AC_CHECK_HEADER(readline/history.h)
295 if test $ac_cv_header_readline_history_h = no;then
296 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
297 fi
paul3d3de8c2003-05-23 10:33:49 +0000298 AC_CHECK_LIB(readline, rl_completion_matches)
299 if test $ac_cv_lib_readline_rl_completion_matches = no; then
300 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
301 fi
302 ;;
paul7ea487b2003-03-17 02:05:07 +0000303 "no" ) VTYSH="";;
304 * ) ;;
305esac
306
307dnl ----------
308dnl PAM module
309dnl ----------
310if test "$with_libpam" = "yes"; then
paul24cd4352003-05-06 12:16:27 +0000311 AC_CHECK_HEADER(security/pam_misc.h)
312 if test "$ac_cv_header_security_pam_misc_h" = yes; then
313 AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
314 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
315 pam_conv_func="misc_conv"
paul24cd4352003-05-06 12:16:27 +0000316 fi
paul24cd4352003-05-06 12:16:27 +0000317 AC_CHECK_HEADER(security/openpam.h)
318 if test "$ac_cv_header_security_openpam_h" = yes; then
319 AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
320 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
321 pam_conv_func="openpam_ttyconv"
paul24cd4352003-05-06 12:16:27 +0000322 fi
323 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
324 AC_MSG_WARN([*** pam support will not be built ***])
325 with_libpam="no"
326 fi
327fi
328
329if test "$with_libpam" = "yes"; then
paul7ea487b2003-03-17 02:05:07 +0000330dnl took this test from proftpd's configure.in and suited to our needs
331dnl -------------------------------------------------------------------------
332dnl
333dnl This next check looks funky due to a linker problem with some versions
334dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
335dnl omitted requiring libdl linking information. PAM-0.72 or better ships
336dnl with RedHat 6.2 and Debian 2.2 or better.
337AC_CHECK_LIB(pam, pam_start,
paul24cd4352003-05-06 12:16:27 +0000338 [AC_CHECK_LIB(pam, $pam_conv_func,
paul7ea487b2003-03-17 02:05:07 +0000339 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
340 LIBPAM="-lpam"],
341 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
342 LIBPAM="-lpam -lpam_misc"]
343 )
344 ],
345
346 [AC_CHECK_LIB(pam, pam_end,
paul24cd4352003-05-06 12:16:27 +0000347 [AC_CHECK_LIB(pam, $pam_conv_func,
paula159ed92003-06-04 11:01:45 +0000348 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul7ea487b2003-03-17 02:05:07 +0000349 LIBPAM="-lpam -ldl"],
paula159ed92003-06-04 11:01:45 +0000350 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul7ea487b2003-03-17 02:05:07 +0000351 LIBPAM="-lpam -ldl -lpam_misc"]
352 )
353 ],AC_MSG_WARN([*** pam support will not be built ***]),
354 [-ldl])
355 ]
356)
357fi
358AC_SUBST(LIBPAM)
359
360dnl -------------------------------
361dnl Endian-ness check
362dnl -------------------------------
363AC_WORDS_BIGENDIAN
364
365dnl -------------------------------
366dnl check the size in byte of the C
367dnl -------------------------------
368dnl AC_CHECK_SIZEOF(char)
369dnl AC_CHECK_SIZEOF(int)
370dnl AC_CHECK_SIZEOF(short)
371dnl AC_CHECK_SIZEOF(long)
372
373dnl ----------------------------
374dnl check existance of functions
375dnl ----------------------------
paul49e3b3c2003-10-23 20:39:50 +0000376AC_CHECK_FUNCS(memset memcpy strerror inet_aton daemon snprintf vsnprintf \
paul04bd4842003-10-24 04:24:39 +0000377 strlcat strlcpy if_nametoindex if_indextoname getifaddrs \
378 fcntl)
paula159ed92003-06-04 11:01:45 +0000379AC_CHECK_FUNCS(setproctitle, ,
380 [AC_CHECK_LIB(util, setproctitle,
381 [LIBS="$LIBS -lutil"
382 AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
383 ]
384 )
385 ]
386)
paul7ea487b2003-03-17 02:05:07 +0000387
388dnl ------------------------------------
389dnl Determine routing get and set method
390dnl ------------------------------------
391AC_MSG_CHECKING(zebra between kernel interface method)
392if test x"$opsys" = x"gnu-linux"; then
393 if test "${enable_netlink}" = "yes";then
394 AC_MSG_RESULT(netlink)
395 RT_METHOD=rt_netlink.o
396 AC_DEFINE(HAVE_NETLINK,,netlink)
397 netlink=yes
398 elif test "${enable_netlink}" = "no"; then
399 AC_MSG_RESULT(ioctl)
400 RT_METHOD=rt_ioctl.o
401 netlink=no
402 else
403 AC_MSG_RESULT(netlink)
404 RT_METHOD=rt_netlink.o
405 AC_DEFINE(HAVE_NETLINK,,netlink)
406 netlink=yes
407 fi
paul19877dd2004-05-11 10:49:35 +0000408elif test x"$opsys" = x"sol2-6";then
409 AC_MSG_RESULT(Route socket)
410 KERNEL_METHOD="kernel_socket.o"
411 RT_METHOD="rt_socket.o"
412elif test x"$opsys" = x"sol9";then
413 AC_MSG_RESULT(Route socket)
414 KERNEL_METHOD="kernel_socket.o"
415 RT_METHOD="rt_socket.o"
416elif test "$opsys" = "irix" ; then
417 AC_MSG_RESULT(Route socket)
418 KERNEL_METHOD="kernel_socket.o"
419 RT_METHOD="rt_socket.o"
paul7ea487b2003-03-17 02:05:07 +0000420else
paul19877dd2004-05-11 10:49:35 +0000421 AC_TRY_RUN([#include <errno.h>
paul7ea487b2003-03-17 02:05:07 +0000422#include <sys/types.h>
423#include <sys/socket.h>
424
425main ()
426{
427 int ac_sock;
428
429 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
430 if (ac_sock < 0 && errno == EINVAL)
431 exit (1);
432 exit (0);
433}],
434 [KERNEL_METHOD=kernel_socket.o
435 RT_METHOD=rt_socket.o
436 AC_MSG_RESULT(socket)],
437 [RT_METHOD=rt_ioctl.o
438 AC_MSG_RESULT(ioctl)],
439 [KERNEL_METHOD=kernel_socket.o
440 RT_METHOD=rt_socket.o
441 AC_MSG_RESULT(socket)])
paul7ea487b2003-03-17 02:05:07 +0000442fi
443AC_SUBST(RT_METHOD)
444AC_SUBST(KERNEL_METHOD)
445AC_SUBST(OTHER_METHOD)
446
447dnl ------------------------------
448dnl check kernel route read method
449dnl ------------------------------
450AC_CACHE_CHECK(route read method check, zebra_rtread,
451[if test "$netlink" = yes; then
452 RTREAD_METHOD="rtread_netlink.o"
453 zebra_rtread="netlink"
454else
455for zebra_rtread in /proc/net/route /dev/ip /dev/null;
456do
457 test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
458done
459case $zebra_rtread in
460 "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
461 zebra_rtread="proc";;
paul9c30ab62003-07-08 08:36:17 +0000462 "/dev/ip")
463 case "$host" in
464 *-freebsd*) RTREAD_METHOD=rtread_sysctl.o
465 zebra_rtread="sysctl";;
466 *) RTREAD_METHOD="rtread_getmsg.o"
467 zebra_rtread="getmsg";;
468 esac;;
paul7ea487b2003-03-17 02:05:07 +0000469 *) RTREAD_METHOD="rtread_sysctl.o"
470 zebra_rtread="sysctl";;
471esac
472fi])
473AC_SUBST(RTREAD_METHOD)
474
475dnl -----------------------------
476dnl check interface lookup method
477dnl -----------------------------
paul19877dd2004-05-11 10:49:35 +0000478IOCTL_METHOD=ioctl.o
paul7ea487b2003-03-17 02:05:07 +0000479AC_MSG_CHECKING(interface looking up method)
480if test "$netlink" = yes; then
481 AC_MSG_RESULT(netlink)
482 IF_METHOD=if_netlink.o
paul19877dd2004-05-11 10:49:35 +0000483elif test "$opsys" = "sol2-6";then
484 AC_MSG_RESULT(Solaris GIF)
485 IF_METHOD=if_ioctl.o
486elif test "$opsys" = "sol9";then
487 AC_MSG_RESULT(Solaris GLIF)
488 IF_METHOD=if_ioctl_solaris.o
489 IOCTL_METHOD=ioctl_solaris.o
490elif test "$opsys" = "irix" ; then
491 AC_MSG_RESULT(IRIX)
492 IF_METHOD=if_ioctl.o
493elif test "$opsys" = "openbsd";then
494 AC_MSG_RESULT(openbsd)
495 IF_METHOD=if_ioctl.o
496elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
497 AC_MSG_RESULT(sysctl)
paul7ea487b2003-03-17 02:05:07 +0000498 IF_METHOD=if_sysctl.o
499 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
paul19877dd2004-05-11 10:49:35 +0000500else
paul7ea487b2003-03-17 02:05:07 +0000501 AC_MSG_RESULT(ioctl)
502 IF_METHOD=if_ioctl.o
paul7ea487b2003-03-17 02:05:07 +0000503fi
504AC_SUBST(IF_METHOD)
paul19877dd2004-05-11 10:49:35 +0000505AC_SUBST(IOCTL_METHOD)
paul7ea487b2003-03-17 02:05:07 +0000506
507dnl -----------------------
508dnl check proc file system.
509dnl -----------------------
510if test -r /proc/net/dev; then
511 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
512 IF_PROC=if_proc.o
513fi
514
515if test -r /proc/net/if_inet6; then
516 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
517 IF_PROC=if_proc.o
518fi
519AC_SUBST(IF_PROC)
520
521dnl -----------------------------
522dnl check ipforward detect method
523dnl -----------------------------
524AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
525[for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
526do
527 test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
528done
529case $zebra_ipforward_path in
530 "/proc/net/snmp") IPFORWARD=ipforward_proc.o
531 zebra_ipforward_path="proc";;
532 "/dev/ip")
533 case "$host" in
534 *-nec-sysv4*) IPFORWARD=ipforward_ews.o
535 zebra_ipforward_path="ews";;
paul9c30ab62003-07-08 08:36:17 +0000536 *-freebsd*) IPFORWARD=ipforward_sysctl.o
537 zebra_ipforward_path="sysctl";;
paul7ea487b2003-03-17 02:05:07 +0000538 *) IPFORWARD=ipforward_solaris.o
539 zebra_ipforward_path="solaris";;
540 esac;;
541 *) IPFORWARD=ipforward_sysctl.o
542 zebra_ipforward_path="sysctl";;
543esac])
544AC_SUBST(IPFORWARD)
545
546AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
547
548dnl ----------
549dnl IPv6 check
550dnl ----------
551AC_MSG_CHECKING(whether does this OS have IPv6 stack)
552if test "${enable_ipv6}" = "no"; then
553 AC_MSG_RESULT(disabled)
554else
555dnl ----------
556dnl INRIA IPv6
557dnl ----------
paula159ed92003-06-04 11:01:45 +0000558 if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
559 zebra_cv_ipv6=yes
560 AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
561 AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
562 RIPNGD="ripngd"
563 OSPF6D="ospf6d"
564 LIB_IPV6=""
565 AC_MSG_RESULT(INRIA IPv6)
paul7ea487b2003-03-17 02:05:07 +0000566dnl ---------
567dnl KAME IPv6
568dnl ---------
paula159ed92003-06-04 11:01:45 +0000569 elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
570 zebra_cv_ipv6=yes
571 AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
572 AC_DEFINE(KAME,1,KAME IPv6)
573 RIPNGD="ripngd"
574 OSPF6D="ospf6d"
575 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
paul7ea487b2003-03-17 02:05:07 +0000576 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +0000577 fi
578 AC_MSG_RESULT(KAME)
hasso71c0fb52003-05-25 20:18:13 +0000579dnl -------------------------
580dnl MUSICA IPv6
581dnl default host check
582dnl It is not used by Kheops
583dnl -------------------------
paula159ed92003-06-04 11:01:45 +0000584 elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
585 zebra_cv_ipv6=yes
586 AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
587 AC_DEFINE(MUSICA,1,Musica IPv6 stack)
588 AC_DEFINE(KAME,1,KAME IPv6 stack)
589 RIPNGD="ripngd"
590 OSPF6D="ospf6d"
591 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
hasso71c0fb52003-05-25 20:18:13 +0000592 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +0000593 fi
594 AC_MSG_RESULT(MUSICA)
paul7ea487b2003-03-17 02:05:07 +0000595dnl ---------
596dnl NRL check
597dnl ---------
paula159ed92003-06-04 11:01:45 +0000598 elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
599 zebra_cv_ipv6=yes
600 AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
601 AC_DEFINE(NRL,1,NRL)
602 RIPNGD="ripngd"
603 OSPF6D="ospf6d"
604 if test x"$opsys" = x"bsdi";then
paul7ea487b2003-03-17 02:05:07 +0000605 AC_DEFINE(BSDI_NRL,,BSDI)
606 AC_MSG_RESULT(BSDI_NRL)
paula159ed92003-06-04 11:01:45 +0000607 else
paul7ea487b2003-03-17 02:05:07 +0000608 AC_MSG_RESULT(NRL)
paula159ed92003-06-04 11:01:45 +0000609 fi
paul19877dd2004-05-11 10:49:35 +0000610dnl ------------------------------------
611dnl Solaris 9, 10 and potentially higher
612dnl ------------------------------------
613 elif test x"$opsys" = x"sol9"; then
614 zebra_cv_ipv6=yes;
615 AC_DEFINE(HAVE_IPV6, 1, IPv6)
616 AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
617 RIPNGD="ripngd"
618 OSPF6D="ospf6d"
619 AC_MSG_RESULT(Solaris IPv6)
paul7ea487b2003-03-17 02:05:07 +0000620dnl ----------
621dnl Linux IPv6
622dnl ----------
paula159ed92003-06-04 11:01:45 +0000623 elif test "${enable_ipv6}" = "yes"; then
624 AC_EGREP_CPP(yes, [
625 #include <linux/version.h>
626 /* 2.1.128 or later */
627 #if LINUX_VERSION_CODE >= 0x020180
628 yes
629 #endif],
630 [zebra_cv_ipv6=yes
631 zebra_cv_linux_ipv6=yes
632 AC_MSG_RESULT(Linux IPv6)])
633 else
634 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
635 then
paul7ea487b2003-03-17 02:05:07 +0000636 zebra_cv_ipv6=yes
637 zebra_cv_linux_ipv6=yes
638 AC_MSG_RESULT(Linux IPv6)
paula159ed92003-06-04 11:01:45 +0000639 fi
640 fi
paul7ea487b2003-03-17 02:05:07 +0000641
paula159ed92003-06-04 11:01:45 +0000642 if test "$zebra_cv_linux_ipv6" = "yes";then
643 AC_MSG_CHECKING(for GNU libc >= 2.1)
644 AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
645 AC_EGREP_CPP(yes, [
paul7ea487b2003-03-17 02:05:07 +0000646#include <features.h>
647#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
648 yes
paula159ed92003-06-04 11:01:45 +0000649#endif],
650 [glibc=yes
651 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
652 AC_MSG_RESULT(yes)],
653 AC_MSG_RESULT(no)
654 )
655 RIPNGD="ripngd"
656 OSPF6D="ospf6d"
657 if test "$glibc" != "yes"; then
paul7ea487b2003-03-17 02:05:07 +0000658 INCLUDES="-I/usr/inet6/include"
659 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
660 LIB_IPV6="-L/usr/inet6/lib -linet6"
661 fi
paula159ed92003-06-04 11:01:45 +0000662 fi
663 fi
paul7ea487b2003-03-17 02:05:07 +0000664
665dnl -----------------------
666dnl Set IPv6 related values
667dnl -----------------------
paula159ed92003-06-04 11:01:45 +0000668 LIBS="$LIB_IPV6 $LIBS"
669 AC_SUBST(LIB_IPV6)
paul7ea487b2003-03-17 02:05:07 +0000670
paula159ed92003-06-04 11:01:45 +0000671 if test x"$RIPNGD" = x""; then
672 AC_MSG_RESULT(IPv4 only)
673 fi
paul7ea487b2003-03-17 02:05:07 +0000674fi
675
gdtfa3232e2003-12-03 17:52:30 +0000676dnl ------------------
677dnl IPv6 header checks
678dnl ------------------
679if test "x${zebra_cv_ipv6}" = "xyes"; then
680AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
681 netinet6/in6_var.h netinet6/nd6.h])
682fi
683
paul7ea487b2003-03-17 02:05:07 +0000684dnl --------------------
685dnl Daemon disable check
686dnl --------------------
687if test "${enable_zebra}" = "no";then
688 ZEBRA=""
689else
690 ZEBRA="zebra"
691fi
692
693if test "${enable_bgpd}" = "no";then
694 BGPD=""
695else
696 BGPD="bgpd"
697fi
698
699if test "${enable_ripd}" = "no";then
700 RIPD=""
701else
702 RIPD="ripd"
703fi
704
705if test "${enable_ospfd}" = "no";then
706 OSPFD=""
707else
708 OSPFD="ospfd"
709fi
710
paul1ef74ef2003-03-21 15:16:05 +0000711OSPFCLIENT=""
712if test "${enable_opaque_lsa}" = "yes"; then
713 if test "${enable_ospfapi}" != "no";then
paul9a569842003-03-28 01:45:13 +0000714 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
paul1ef74ef2003-03-21 15:16:05 +0000715
716 if test "${enable_ospfclient}" != "no";then
717 OSPFCLIENT="ospfclient"
718 fi
719 fi
720
paul7ea487b2003-03-17 02:05:07 +0000721fi
722
723case "${enable_ripngd}" in
724 "yes") RIPNGD="ripngd";;
725 "no" ) RIPNGD="";;
726 * ) ;;
727esac
728
729case "${enable_ospf6d}" in
730 "yes") OSPF6D="ospf6d";;
731 "no" ) OSPF6D="";;
732 * ) ;;
733esac
734
jardin9e867fe2003-12-23 08:56:18 +0000735case "${enable_isisd}" in
736 "yes") ISISD="isisd";;
737 "no" ) ISISD="";;
738 * ) ISISD="isisd";;
739esac
740
paul7ea487b2003-03-17 02:05:07 +0000741if test "${enable_bgp_announce}" = "no";then
742 AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
743fi
744
745AC_SUBST(ZEBRA)
746AC_SUBST(BGPD)
747AC_SUBST(RIPD)
748AC_SUBST(RIPNGD)
749AC_SUBST(OSPFD)
750AC_SUBST(OSPF6D)
jardin9e867fe2003-12-23 08:56:18 +0000751AC_SUBST(ISISD)
paul7ea487b2003-03-17 02:05:07 +0000752AC_SUBST(VTYSH)
753AC_SUBST(INCLUDES)
754AC_SUBST(CURSES)
755AC_SUBST(OSPFCLIENT)
paul1ef74ef2003-03-21 15:16:05 +0000756AC_SUBST(OSPFAPI)
paul7ea487b2003-03-17 02:05:07 +0000757AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
758AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
759AC_CHECK_LIB(crypt, crypt)
760AC_CHECK_LIB(resolv, res_init)
761AC_CHECK_LIB(m, main)
762
763dnl ---------------------------------------------------
764dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
765dnl ---------------------------------------------------
paula159ed92003-06-04 11:01:45 +0000766AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
767AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
768AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
paul7ea487b2003-03-17 02:05:07 +0000769
770dnl ---------------------------
771dnl check system has GNU regexp
772dnl ---------------------------
773dnl AC_MSG_CHECKING(whether system has GNU regex)
774AC_CHECK_LIB(c, regexec,
775[AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
776 LIB_REGEX=""],
777[LIB_REGEX="regex.o"])
778AC_SUBST(LIB_REGEX)
779
780dnl ------------------
781dnl check SNMP library
782dnl ------------------
783if test "${enable_snmp}" = "yes";then
784dnl AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
paul7ea487b2003-03-17 02:05:07 +0000785 if test "${HAVE_SNMP}" = ""; then
paul1ef74ef2003-03-21 15:16:05 +0000786 old_libs="${LIBS}"
787 LIBS="-L/usr/lib"
paul7ea487b2003-03-17 02:05:07 +0000788 unset ac_cv_lib_snmp_asn_parse_int
paul1ef74ef2003-03-21 15:16:05 +0000789 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
790 if test "${NEED_CRYPTO}" = ""; then
791 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes ])
792 else
793 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes; NEED_CRYPTO=yes;LIBS="$LIBS -lcrypto" ],,"-lcrypto")
794 fi
795 LIBS="${old_libs}"
paul7ea487b2003-03-17 02:05:07 +0000796 fi
paul1ef74ef2003-03-21 15:16:05 +0000797 if test "${HAVE_SNMP}" = ""; then
798 old_libs="${LIBS}"
799 LIBS="-L/usr/lib"
800 unset ac_cv_lib_snmp_asn_parse_int
801 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes, )
802 if test "${HAVE_SNMP}" = ""; then
803 unset ac_cv_lib_snmp_asn_parse_int
804 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
805 if test "${NEED_CRYPTO}" = "yes"; then
806 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
807 fi
808 fi
809 LIBS="${old_libs}"
810 fi
paul7ea487b2003-03-17 02:05:07 +0000811
812 if test "${HAVE_SNMP}" = ""; then
paul1ef74ef2003-03-21 15:16:05 +0000813 old_libs="${LIBS}"
814 LIBS="-L/usr/local/lib"
815 unset ac_cv_lib_snmp_asn_parse_int
816 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
817 if test "${HAVE_SNMP}" = ""; then
818 unset ac_cv_lib_snmp_asn_parse_int
819 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
820 if test "${NEED_CRYPTO}" = "yes"; then
821 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
822 fi
823 fi
824 LIBS="${old_libs}"
paul7ea487b2003-03-17 02:05:07 +0000825 fi
paul1ef74ef2003-03-21 15:16:05 +0000826
paul7ea487b2003-03-17 02:05:07 +0000827 if test "${HAVE_SNMP}" = "yes"; then
828 for ac_snmp in /usr/include/net-snmp/library/asn1.h /usr/include/ucd-snmp/asn1.h /usr/local/include/ucd-snmp/asn1.h /dev/null
829 do
830 test -f "${ac_snmp}" && break
831 done
paul1ef74ef2003-03-21 15:16:05 +0000832
paul7ea487b2003-03-17 02:05:07 +0000833 case ${ac_snmp} in
834 /usr/include/net-snmp/*)
835 AC_DEFINE(HAVE_SNMP,,SNMP)
paul1ef74ef2003-03-21 15:16:05 +0000836 AC_DEFINE(HAVE_NETSNMP,,SNMP)
paul7ea487b2003-03-17 02:05:07 +0000837 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
paulac7c4bb2003-03-19 04:25:08 +0000838 CFLAGS="${CFLAGS} -I/usr/include/net-snmp -I/usr/include/net-snmp/library"
839 if test "${HAVE_NETSNMP}" = "yes"; then
paul1ef74ef2003-03-21 15:16:05 +0000840 LIBS="${LIBS} -lnetsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000841 else
paul1ef74ef2003-03-21 15:16:05 +0000842 LIBS="${LIBS} -lsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000843 fi
paul7ea487b2003-03-17 02:05:07 +0000844 ;;
845 /usr/include/ucd-snmp/*)
846 AC_DEFINE(HAVE_SNMP,,SNMP)
847 CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp"
848 LIBS="${LIBS} -lsnmp"
849 ;;
850 /usr/local/include/ucd-snmp/*)
851 AC_DEFINE(HAVE_SNMP,,SNMP)
852 CFLAGS="${CFLAGS} -I/usr/local/include/ucd-snmp"
853 LIBS="${LIBS} -L/usr/local/lib -lsnmp"
854 ;;
paulf3bd1a72003-11-02 07:29:11 +0000855 /usr/local/include/net-snmp/*)
856 AC_DEFINE(HAVE_SNMP,,SNMP)
857 AC_DEFINE(HAVE_NET_SNMP,,SNMP)
858 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
859 CFLAGS="${CFLAGS} -I/usr/local/include/net-snmp"
860 LIBS="${LIBS} -L/usr/local/lib -lnetsnmp"
861 ;;
paul7ea487b2003-03-17 02:05:07 +0000862 esac
863 if test "${NEED_CRYPTO}" = "yes"; then
864 LIBS="${LIBS} -lcrypto"
865 fi
866 fi
867fi
868
869dnl ----------------------------
870dnl check sa_len of sockaddr
871dnl ----------------------------
872AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
873AC_TRY_COMPILE([#include <sys/types.h>
874#include <sys/socket.h>
875],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
876[AC_MSG_RESULT(yes)
877 AC_DEFINE(HAVE_SA_LEN,,sa_len)],
878 AC_MSG_RESULT(no))
879
880dnl ----------------------------
881dnl check sin_len of sockaddr_in
882dnl ----------------------------
883AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
884AC_TRY_COMPILE([#include <sys/types.h>
885#include <netinet/in.h>
886],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
887[AC_MSG_RESULT(yes)
888 AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
889 AC_MSG_RESULT(no))
890
891dnl ----------------------------
892dnl check sun_len of sockaddr_un
893dnl ----------------------------
894AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
895AC_TRY_COMPILE([#include <sys/types.h>
896#include <sys/un.h>
897],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
898[AC_MSG_RESULT(yes)
899 AC_DEFINE(HAVE_SUN_LEN,,sun_len)],
900 AC_MSG_RESULT(no))
901
902dnl -----------------------------------
903dnl check sin6_scope_id of sockaddr_in6
904dnl -----------------------------------
905if test "$zebra_cv_ipv6" = yes; then
906 AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
907 AC_TRY_COMPILE([#include <sys/types.h>
908#include <netinet/in.h>
909],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
910[AC_MSG_RESULT(yes)
911 AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)],
912 AC_MSG_RESULT(no))
913fi
914
915dnl ----------------------------
916dnl check socklen_t exist or not
917dnl ----------------------------
918AC_MSG_CHECKING(whther socklen_t is defined)
919AC_TRY_COMPILE([#include <sys/types.h>
920#include <sys/socket.h>
921#include <netinet/in.h>
922],[socklen_t ac_x;],
923[AC_MSG_RESULT(yes)
924 AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)],
925 AC_MSG_RESULT(no))
926
927dnl ------------------------
928dnl check struct sockaddr_dl
929dnl ------------------------
930AC_MSG_CHECKING(whether struct sockaddr_dl exist)
931AC_EGREP_HEADER(sockaddr_dl,
932net/if_dl.h,
933[AC_MSG_RESULT(yes)
934 AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)],
935 AC_MSG_RESULT(no))
936
937dnl --------------------------
938dnl check structure ifaliasreq
939dnl --------------------------
940AC_MSG_CHECKING(whether struct ifaliasreq exist)
941AC_EGREP_HEADER(ifaliasreq,
942net/if.h,
943[AC_MSG_RESULT(yes)
944 AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)],
945 AC_MSG_RESULT(no))
946
947dnl ----------------------------
948dnl check structure in6_aliasreq
949dnl ----------------------------
hasso71c0fb52003-05-25 20:18:13 +0000950AC_MSG_CHECKING(whether struct in6_aliasreq exist)
paul7ea487b2003-03-17 02:05:07 +0000951AC_EGREP_HEADER(in6_aliasreq,
952netinet6/in6_var.h,
953[AC_MSG_RESULT(yes)
954 AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
955 AC_MSG_RESULT(no))
956
hasso71c0fb52003-05-25 20:18:13 +0000957dnl -----------------------------------
958dnl check ifra_lifetime of in6_aliasreq
959dnl -----------------------------------
960AC_MSG_CHECKING(whether in6_aliasreq.ifra_lifetime exist)
961AC_TRY_COMPILE([#include <sys/types.h>
962#include <netinet6/in6_var.h>
963],[static struct if6_aliasreq ac_i;int ac_j = sizeof (ac_i.ifra_lifetime);],
964[AC_MSG_RESULT(yes)
paula159ed92003-06-04 11:01:45 +0000965 AC_DEFINE(HAVE_IFRA_LIFETIME,,Have in6_aliasreq.ifra_lifetime)],
hasso71c0fb52003-05-25 20:18:13 +0000966 AC_MSG_RESULT(no))
967
paul7ea487b2003-03-17 02:05:07 +0000968dnl ---------------------------
969dnl check structure rt_addrinfo
970dnl ---------------------------
971AC_MSG_CHECKING(whether struct rt_addrinfo exist)
972AC_EGREP_HEADER(rt_addrinfo,
973net/route.h,
974[AC_MSG_RESULT(yes)
975 AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)],
976 AC_MSG_RESULT(no))
977
978dnl --------------------------
979dnl check structure in_pktinfo
980dnl --------------------------
981AC_MSG_CHECKING(whether struct in_pktinfo exist)
982AC_TRY_COMPILE([#include <netinet/in.h>
983],[struct in_pktinfo ac_x;],
984[AC_MSG_RESULT(yes)
985 AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
986 AC_MSG_RESULT(no))
987
988dnl --------------------------------------
989dnl checking for getrusage struct and call
990dnl --------------------------------------
991AC_MSG_CHECKING(whether getrusage is available)
992AC_TRY_COMPILE([#include <sys/resource.h>
993],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
994[AC_MSG_RESULT(yes)
995 AC_DEFINE(HAVE_RUSAGE,,rusage)],
996 AC_MSG_RESULT(no))
997
pauledd7c242003-06-04 13:59:38 +0000998dnl -------------------
999dnl capabilities checks
1000dnl -------------------
hasso41d3fc92004-04-06 11:59:00 +00001001if test "${enable_capabilities}" != "no"; then
1002 AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1003 AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1004 [AC_MSG_RESULT(yes)
1005 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1006 quagga_ac_keepcaps="yes"],
1007 AC_MSG_RESULT(no)
pauledd7c242003-06-04 13:59:38 +00001008 )
hasso41d3fc92004-04-06 11:59:00 +00001009 if test x"${quagga_ac_keepcaps}" = x"yes"; then
1010 AC_CHECK_HEADERS(sys/capability.h)
1011 fi
1012 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1013 AC_CHECK_LIB(cap, cap_init,
1014 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1015 LIBCAP="-lcap"
1016 ]
1017 )
1018 fi
pauledd7c242003-06-04 13:59:38 +00001019fi
1020AC_SUBST(LIBCAP)
1021
paulfb2d1502003-06-04 09:40:54 +00001022dnl ---------------------------
1023dnl check for glibc 'backtrace'
1024dnl ---------------------------
1025if test "${glibc}" = "yes"; then
1026 AC_CHECK_HEADER(execinfo.h)
1027fi
1028if test x"${ac_cv_header_execinfo_h}" = x"yes"; then
1029 AC_CHECK_FUNC(backtrace,
1030 [AC_DEFINE(HAVE_GLIBC_BACKTRACE,,Glibc backtrace)]
1031 )
1032fi
1033
paul408ad942003-05-20 00:03:33 +00001034dnl ----------
1035dnl configure date
1036dnl ----------
1037CONFDATE=`date '+%Y%m%d'`
1038AC_SUBST(CONFDATE)
1039
paul7ea487b2003-03-17 02:05:07 +00001040dnl ------------------------------
paula159ed92003-06-04 11:01:45 +00001041dnl set paths for state directory
paul23bd12c2003-04-07 06:11:09 +00001042dnl ------------------------------
1043if test "${prefix}" = "NONE"; then
paule8f29842003-08-12 13:08:31 +00001044 quagga_statedir_prefix="";
paul23bd12c2003-04-07 06:11:09 +00001045else
paule8f29842003-08-12 13:08:31 +00001046 quagga_statedir_prefix=${prefix}
paul23bd12c2003-04-07 06:11:09 +00001047fi
1048if test "${localstatedir}" = '${prefix}/var'; then
paula159ed92003-06-04 11:01:45 +00001049 AC_CACHE_CHECK(state directory,ac_statedir,
paule8f29842003-08-12 13:08:31 +00001050 [for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
1051 ${quagga_statedir_prefix}/var/adm dnl
1052 ${quagga_statedir_prefix}/etc dnl
paula159ed92003-06-04 11:01:45 +00001053 /var/run dnl
1054 /var/adm dnl
1055 /etc dnl
1056 /dev/null;
paul23bd12c2003-04-07 06:11:09 +00001057 do
paule8f29842003-08-12 13:08:31 +00001058 test -d $QUAGGA_STATE_DIR && break
paul23bd12c2003-04-07 06:11:09 +00001059 done
paule8f29842003-08-12 13:08:31 +00001060 quagga_statedir=$QUAGGA_STATE_DIR])
paul23bd12c2003-04-07 06:11:09 +00001061else
paule8f29842003-08-12 13:08:31 +00001062 quagga_statedir=${localstatedir}
paula159ed92003-06-04 11:01:45 +00001063 AC_MSG_CHECKING(directory to use for state file)
paule8f29842003-08-12 13:08:31 +00001064 AC_MSG_RESULT(${quagga_statedir})
paul23bd12c2003-04-07 06:11:09 +00001065fi
paule8f29842003-08-12 13:08:31 +00001066if test $quagga_statedir = "/dev/null"; then
paula159ed92003-06-04 11:01:45 +00001067 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1068fi
1069
paule8f29842003-08-12 13:08:31 +00001070AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1071AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1072AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1073AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1074AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1075AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
jardin9e867fe2003-12-23 08:56:18 +00001076AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
paule8f29842003-08-12 13:08:31 +00001077AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1078AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1079AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1080AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1081AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1082AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1083AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
jardin9e867fe2003-12-23 08:56:18 +00001084AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
paul7ea487b2003-03-17 02:05:07 +00001085
1086dnl ---------------------------
1087dnl Check htonl works correctly
1088dnl ---------------------------
1089AC_MSG_CHECKING(for working htonl)
1090AC_CACHE_VAL(ac_cv_htonl_works, [
1091AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
1092#include <sys/types.h>
1093#endif
1094#ifdef HAVE_NETDB_H
1095#include <netdb.h>
1096#endif
1097#ifdef HAVE_NETINET_IN_H
1098#include <netinet/in.h>
1099#endif],
1100[htonl (0);],
1101ac_cv_htonl_works=yes,
1102ac_cv_htonl_works=no)])
1103AC_MSG_RESULT($ac_cv_htonl_works)
1104
paul6382b6f2003-05-20 00:17:45 +00001105AC_OUTPUT(Makefile lib/Makefile zebra/Makefile ripd/Makefile
1106 ripngd/Makefile bgpd/Makefile ospfd/Makefile
jardin9e867fe2003-12-23 08:56:18 +00001107 ospf6d/Makefile isisd/Makefile vtysh/Makefile doc/Makefile
paul6382b6f2003-05-20 00:17:45 +00001108 ospfclient/Makefile
jardina4d2a0d2004-01-10 20:42:35 +00001109 redhat/Makefile redhat/quagga.spec
paulfa1253d2003-09-24 05:09:26 +00001110 lib/version.h)
paul7ea487b2003-03-17 02:05:07 +00001111
1112echo "
1113zebra configuration
1114-------------------
paulfa1253d2003-09-24 05:09:26 +00001115quagga version : ${PACKAGE_VERSION}
paul7ea487b2003-03-17 02:05:07 +00001116host operationg system : ${host_os}
1117source code location : ${srcdir}
1118compiler : ${CC}
1119compiler flags : ${CFLAGS}
hasso71c0fb52003-05-25 20:18:13 +00001120linker flags : ${LDFLAGS} ${LIBS}
paule8f29842003-08-12 13:08:31 +00001121state file directory : ${quagga_statedir}
pauldc7a2bf2003-10-22 00:07:44 +00001122config file directory : `eval echo \`echo ${sysconfdir}\``
gdtd6b72f72003-12-03 17:24:27 +00001123example directory : `eval echo \`echo ${exampledir}\``
paul8d4aee52003-06-06 00:30:35 +00001124user to run as : ${enable_user}
1125group to run as : ${enable_group}
1126group for vty sockets : ${enable_vty_group}
gdtaa593d52003-12-22 20:15:53 +00001127config file mask : ${enable_configfile_mask}
1128log file mask : ${enable_logfile_mask}
pauldc7a2bf2003-10-22 00:07:44 +00001129
1130The above user and group must have read/write access to the state file
1131directory and to the config files in the config file directory.
paul7ea487b2003-03-17 02:05:07 +00001132"