blob: 094da52ebc2862c14fbed4fabf8c6f7c9cbbd459 [file] [log] [blame]
paul7ea487b2003-03-17 02:05:07 +00001##
paule8f29842003-08-12 13:08:31 +00002## Configure template file for Quagga.
paul7ea487b2003-03-17 02:05:07 +00003## autoconf will generate configure script.
4##
5## Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
paule8f29842003-08-12 13:08:31 +00006## Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st>
paul7ea487b2003-03-17 02:05:07 +00007##
paule8f29842003-08-12 13:08:31 +00008AC_PREREQ(2.53)
paul7ea487b2003-03-17 02:05:07 +00009
paulbf547fe2003-10-15 23:12:31 +000010AC_INIT(quagga, 0.96.4, [bug-zebra@gnu.org])
paulfa1253d2003-09-24 05:09:26 +000011AC_CONFIG_SRCDIR(lib/zebra.h)
12AM_INIT_AUTOMAKE()
paul7ea487b2003-03-17 02:05:07 +000013AM_CONFIG_HEADER(config.h)
14
gdtd6b72f72003-12-03 17:24:27 +000015dnl default is to match previous behavior
gdtc4f0efe2003-12-04 15:39:25 +000016exampledir=${sysconfdir}
gdtd6b72f72003-12-03 17:24:27 +000017AC_ARG_ENABLE([exampledir],
18 AC_HELP_STRING([--enable-exampledir],
19 [specify alternate directory for examples]),
20 exampledir="$enableval",)
gdtc4f0efe2003-12-04 15:39:25 +000021dnl XXX add --exampledir to autoconf standard directory list somehow
gdtd6b72f72003-12-03 17:24:27 +000022AC_SUBST(exampledir)
23
paul7ea487b2003-03-17 02:05:07 +000024dnl -----------------------------------
25dnl Get hostname and other information.
26dnl -----------------------------------
27AC_CANONICAL_HOST
28
29dnl ------------
30dnl Check CFLAGS
31dnl ------------
32AC_ARG_WITH(cflags,
33[ --with-cflags Set CFLAGS for use in compilation.])
34if test "x$with_cflags" != "x" ; then
35 CFLAGS="$with_cflags" ; cflags_specified=yes ;
36elif test -n "$CFLAGS" ; then
37 cflags_specified=yes ;
38fi
39
40dnl --------
41dnl Check CC
42dnl --------
43AC_PROG_CC
44
45dnl -----------------------------------------
46dnl If CLFAGS doesn\'t exist set default value
47dnl -----------------------------------------
48if test "x$cflags_specified" = "x" ; then
49 CFLAGS="$CFLAGS -Wall"
50fi
51
52dnl --------------
53dnl Check programs
54dnl --------------
55AC_PROG_CPP
56AC_PROG_INSTALL
57AC_PROG_MAKE_SET
58AC_CHECK_TOOL(AR, ar)
59AC_CHECK_TOOL(RANLIB, ranlib, :)
60
61dnl ---------
62dnl AIX check
63dnl ---------
64AC_AIX
65
66dnl ----------------------
67dnl Packages configuration
68dnl ----------------------
69AC_ARG_ENABLE(vtysh,
paule8f29842003-08-12 13:08:31 +000070[ --enable-vtysh, Make integrated vty shell for Quagga])
paul7ea487b2003-03-17 02:05:07 +000071AC_ARG_ENABLE(ipv6,
72[ --disable-ipv6 turn off IPv6 related features and daemons])
73AC_ARG_ENABLE(zebra,
74[ --disable-zebra do not build zebra daemon])
75AC_ARG_ENABLE(bgpd,
76[ --disable-bgpd do not build bgpd])
77AC_ARG_ENABLE(ripd,
78[ --disable-ripd do not build ripd])
79AC_ARG_ENABLE(ripngd,
80[ --disable-ripngd do not build ripngd])
81AC_ARG_ENABLE(ospfd,
82[ --disable-ospfd do not build ospfd])
paul7ea487b2003-03-17 02:05:07 +000083AC_ARG_ENABLE(ospf6d,
84[ --disable-ospf6d do not build ospf6d])
85AC_ARG_ENABLE(bgp-announce,
86[ --disable-bgp-announce, turn off BGP route announcement])
87AC_ARG_ENABLE(netlink,
88[ --enable-netlink force to use Linux netlink interface])
89AC_ARG_ENABLE(broken-aliases,
90[ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
91AC_ARG_ENABLE(snmp,
92[ --enable-snmp enable SNMP support])
93AC_ARG_WITH(libpam,
94[ --with-libpam use libpam for PAM support in vtysh])
hasso71c0fb52003-05-25 20:18:13 +000095AC_ARG_ENABLE(tcp-zebra,
paul7ea487b2003-03-17 02:05:07 +000096[ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon])
97dnl Temporary option until OSPF NSSA implementation complete
98AC_ARG_ENABLE(nssa,
99[ --enable-nssa enable OSPF NSSA option])
100AC_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])
paul7ea487b2003-03-17 02:05:07 +0000125
126if test "${enable_broken_aliases}" = "yes"; then
127 if test "${enable_netlink}" = "yes"
128 then
129 echo "Sorry, you can't use netlink with broken aliases"
130 exit 1
131 fi
132 AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
133 enable_netlink=no
134fi
135
136if test "${enable_tcp_zebra}" = "yes"; then
137 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
138fi
139
140if test "${enable_nssa}" = "yes"; then
141 AC_DEFINE(HAVE_NSSA,,OSPF NSSA)
142fi
143
144if 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
paul79cb2162003-06-06 12:19:53 +0000161if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
paule8f29842003-08-12 13:08:31 +0000162 enable_user="quagga"
pauledd7c242003-06-04 13:59:38 +0000163elif test "${enable_user}" = "no"; then
164 enable_user="root"
165fi
paule8f29842003-08-12 13:08:31 +0000166AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
pauledd7c242003-06-04 13:59:38 +0000167
paul79cb2162003-06-06 12:19:53 +0000168if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
paule8f29842003-08-12 13:08:31 +0000169 enable_group="quagga"
pauledd7c242003-06-04 13:59:38 +0000170elif test "${enable_group}" = "no"; then
171 enable_group="root"
172fi
paule8f29842003-08-12 13:08:31 +0000173AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
pauledd7c242003-06-04 13:59:38 +0000174
175if test x"${enable_vty_group}" = x"yes" ; then
paul8d4aee52003-06-06 00:30:35 +0000176 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
paul79cb2162003-06-06 12:19:53 +0000177elif test x"${enable_vty_group}" != x""; then
paul8d4aee52003-06-06 00:30:35 +0000178 if test x"${enable_vty_group}" != x"no"; then
pauledd7c242003-06-04 13:59:38 +0000179 AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
180 fi
181fi
182
gdtaa593d52003-12-22 20:15:53 +0000183enable_configfile_mask=${enable_configfile_mask:-0600}
184AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
185
186enable_logfile_mask=${enable_logfile_mask:-0600}
187AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
188
paul7ea487b2003-03-17 02:05:07 +0000189changequote(, )dnl
190
191MULTIPATH_NUM=1
192
193case "${enable_multipath}" in
194 [0-9]|[1-9][0-9])
195 MULTIPATH_NUM="${enable_multipath}"
196 ;;
197 "")
198 ;;
199 *)
200 echo "Please specify digit to --enable-multipath ARG."
201 exit 1
202 ;;
203esac
204
205changequote([, ])dnl
206
207AC_SUBST(MULTIPATH_NUM)
208
209dnl -------------------
210dnl Check header files.
211dnl -------------------
pauldc7a2bf2003-10-22 00:07:44 +0000212AC_HEADER_STDC
213AC_CHECK_HEADERS([string.h stropts.h sys/conf.h sys/ksym.h sys/time.h \
214 sys/times.h sys/select.h sys/sysctl.h sys/sockio.h \
215 sys/types.h linux/version.h kvm.h netdb.h asm/types.h \
216 libutil.h limits.h])
217
paul835b7f12003-10-30 21:59:57 +0000218AC_CHECK_HEADERS([sys/socket.h netinet/in_systm.h netinet/in.h \
paulf3bd1a72003-11-02 07:29:11 +0000219 net/if_dl.h net/netopt.h inet/nd.h net/route.h \
paul835b7f12003-10-30 21:59:57 +0000220 net/if.h net/if_var.h netinet/in_var.h])
pauldc7a2bf2003-10-22 00:07:44 +0000221
gdtfa3232e2003-12-03 17:52:30 +0000222dnl V6 headers are checked below, after we check for v6
paul7ea487b2003-03-17 02:05:07 +0000223
224dnl check some types
225AC_C_CONST
226dnl AC_TYPE_PID_T
227AC_TYPE_SIGNAL
228
229dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
230case "$host" in
231 *-sunos5.6* | *-solaris2.6*)
232 opsys=sol2-6
233 AC_DEFINE(SUNOS_5,,SunOS 5)
234 AC_CHECK_LIB(xnet, main)
235 CURSES=-lcurses
236 ;;
237 *-sunos5* | *-solaris2*)
238 AC_DEFINE(SUNOS_5,,SunOS 5)
239 AC_CHECK_LIB(socket, main)
240 AC_CHECK_LIB(nsl, main)
241 CURSES=-lcurses
242 ;;
243 *-linux-*)
244 opsys=gnu-linux
245 AC_DEFINE(GNU_LINUX,,GNU Linux)
246 ;;
247 *-nec-sysv4*)
248 AC_CHECK_LIB(nsl, gethostbyname)
249 AC_CHECK_LIB(socket, socket)
250 ;;
251 *-freebsd3.2)
252 AC_DEFINE(FREEBSD_32,,FreeBSD 3.2)
253 ;;
254 *-openbsd*)
255 opsys=openbsd
256 AC_DEFINE(OPEN_BSD,,OpenBSD)
257 ;;
258 *-bsdi*)
259 opsys=bsdi
260 OTHER_METHOD="mtu_kvm.o"
261 AC_CHECK_LIB(kvm, main)
262 ;;
paul49e3b3c2003-10-23 20:39:50 +0000263 *-irix6.5)
pauldc7a2bf2003-10-22 00:07:44 +0000264 opsys=irix
265 AC_DEFINE(IRIX_65,,IRIX 6.5)
266 ;;
paul7ea487b2003-03-17 02:05:07 +0000267esac
268
269dnl ---------------------
270dnl Integrated VTY option
271dnl ---------------------
272case "${enable_vtysh}" in
273 "yes") VTYSH="vtysh";
274 AC_DEFINE(VTYSH,,VTY shell)
275 AC_CHECK_LIB(tinfo, tputs, , AC_CHECK_LIB(ncurses, tputs))
276 AC_CHECK_LIB(readline, main)
277 if test $ac_cv_lib_readline_main = no; then
278 AC_MSG_ERROR([vtysh needs libreadline but was not found on your system.])
279 fi
280 AC_CHECK_HEADER(readline/history.h)
281 if test $ac_cv_header_readline_history_h = no;then
282 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
283 fi
paul3d3de8c2003-05-23 10:33:49 +0000284 AC_CHECK_LIB(readline, rl_completion_matches)
285 if test $ac_cv_lib_readline_rl_completion_matches = no; then
286 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
287 fi
288 ;;
paul7ea487b2003-03-17 02:05:07 +0000289 "no" ) VTYSH="";;
290 * ) ;;
291esac
292
293dnl ----------
294dnl PAM module
295dnl ----------
296if test "$with_libpam" = "yes"; then
paul24cd4352003-05-06 12:16:27 +0000297 AC_CHECK_HEADER(security/pam_misc.h)
298 if test "$ac_cv_header_security_pam_misc_h" = yes; then
299 AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
300 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
301 pam_conv_func="misc_conv"
paul24cd4352003-05-06 12:16:27 +0000302 fi
paul24cd4352003-05-06 12:16:27 +0000303 AC_CHECK_HEADER(security/openpam.h)
304 if test "$ac_cv_header_security_openpam_h" = yes; then
305 AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
306 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
307 pam_conv_func="openpam_ttyconv"
paul24cd4352003-05-06 12:16:27 +0000308 fi
309 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
310 AC_MSG_WARN([*** pam support will not be built ***])
311 with_libpam="no"
312 fi
313fi
314
315if test "$with_libpam" = "yes"; then
paul7ea487b2003-03-17 02:05:07 +0000316dnl took this test from proftpd's configure.in and suited to our needs
317dnl -------------------------------------------------------------------------
318dnl
319dnl This next check looks funky due to a linker problem with some versions
320dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
321dnl omitted requiring libdl linking information. PAM-0.72 or better ships
322dnl with RedHat 6.2 and Debian 2.2 or better.
323AC_CHECK_LIB(pam, pam_start,
paul24cd4352003-05-06 12:16:27 +0000324 [AC_CHECK_LIB(pam, $pam_conv_func,
paul7ea487b2003-03-17 02:05:07 +0000325 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
326 LIBPAM="-lpam"],
327 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
328 LIBPAM="-lpam -lpam_misc"]
329 )
330 ],
331
332 [AC_CHECK_LIB(pam, pam_end,
paul24cd4352003-05-06 12:16:27 +0000333 [AC_CHECK_LIB(pam, $pam_conv_func,
paula159ed92003-06-04 11:01:45 +0000334 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul7ea487b2003-03-17 02:05:07 +0000335 LIBPAM="-lpam -ldl"],
paula159ed92003-06-04 11:01:45 +0000336 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul7ea487b2003-03-17 02:05:07 +0000337 LIBPAM="-lpam -ldl -lpam_misc"]
338 )
339 ],AC_MSG_WARN([*** pam support will not be built ***]),
340 [-ldl])
341 ]
342)
343fi
344AC_SUBST(LIBPAM)
345
346dnl -------------------------------
347dnl Endian-ness check
348dnl -------------------------------
349AC_WORDS_BIGENDIAN
350
351dnl -------------------------------
352dnl check the size in byte of the C
353dnl -------------------------------
354dnl AC_CHECK_SIZEOF(char)
355dnl AC_CHECK_SIZEOF(int)
356dnl AC_CHECK_SIZEOF(short)
357dnl AC_CHECK_SIZEOF(long)
358
359dnl ----------------------------
360dnl check existance of functions
361dnl ----------------------------
paul49e3b3c2003-10-23 20:39:50 +0000362AC_CHECK_FUNCS(memset memcpy strerror inet_aton daemon snprintf vsnprintf \
paul04bd4842003-10-24 04:24:39 +0000363 strlcat strlcpy if_nametoindex if_indextoname getifaddrs \
364 fcntl)
paula159ed92003-06-04 11:01:45 +0000365AC_CHECK_FUNCS(setproctitle, ,
366 [AC_CHECK_LIB(util, setproctitle,
367 [LIBS="$LIBS -lutil"
368 AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
369 ]
370 )
371 ]
372)
paul7ea487b2003-03-17 02:05:07 +0000373
374dnl ------------------------------------
375dnl Determine routing get and set method
376dnl ------------------------------------
377AC_MSG_CHECKING(zebra between kernel interface method)
378if test x"$opsys" = x"gnu-linux"; then
379 if test "${enable_netlink}" = "yes";then
380 AC_MSG_RESULT(netlink)
381 RT_METHOD=rt_netlink.o
382 AC_DEFINE(HAVE_NETLINK,,netlink)
383 netlink=yes
384 elif test "${enable_netlink}" = "no"; then
385 AC_MSG_RESULT(ioctl)
386 RT_METHOD=rt_ioctl.o
387 netlink=no
388 else
389 AC_MSG_RESULT(netlink)
390 RT_METHOD=rt_netlink.o
391 AC_DEFINE(HAVE_NETLINK,,netlink)
392 netlink=yes
393 fi
394else
395 if test "$opsys" = "sol2-6";then
396 AC_MSG_RESULT(solaris)
397 KERNEL_METHOD="kernel_socket.o"
398 RT_METHOD="rt_socket.o"
paul49e3b3c2003-10-23 20:39:50 +0000399 elif test "$opsys" = "irix" ; then
400 AC_MSG_RESULT(irix)
401 KERNEL_METHOD="kernel_socket.o"
402 RT_METHOD="rt_socket.o"
paul7ea487b2003-03-17 02:05:07 +0000403 else
404 AC_TRY_RUN([#include <errno.h>
405#include <sys/types.h>
406#include <sys/socket.h>
407
408main ()
409{
410 int ac_sock;
411
412 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
413 if (ac_sock < 0 && errno == EINVAL)
414 exit (1);
415 exit (0);
416}],
417 [KERNEL_METHOD=kernel_socket.o
418 RT_METHOD=rt_socket.o
419 AC_MSG_RESULT(socket)],
420 [RT_METHOD=rt_ioctl.o
421 AC_MSG_RESULT(ioctl)],
422 [KERNEL_METHOD=kernel_socket.o
423 RT_METHOD=rt_socket.o
424 AC_MSG_RESULT(socket)])
425 fi
426fi
427AC_SUBST(RT_METHOD)
428AC_SUBST(KERNEL_METHOD)
429AC_SUBST(OTHER_METHOD)
430
431dnl ------------------------------
432dnl check kernel route read method
433dnl ------------------------------
434AC_CACHE_CHECK(route read method check, zebra_rtread,
435[if test "$netlink" = yes; then
436 RTREAD_METHOD="rtread_netlink.o"
437 zebra_rtread="netlink"
438else
439for zebra_rtread in /proc/net/route /dev/ip /dev/null;
440do
441 test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
442done
443case $zebra_rtread in
444 "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
445 zebra_rtread="proc";;
paul9c30ab62003-07-08 08:36:17 +0000446 "/dev/ip")
447 case "$host" in
448 *-freebsd*) RTREAD_METHOD=rtread_sysctl.o
449 zebra_rtread="sysctl";;
450 *) RTREAD_METHOD="rtread_getmsg.o"
451 zebra_rtread="getmsg";;
452 esac;;
paul7ea487b2003-03-17 02:05:07 +0000453 *) RTREAD_METHOD="rtread_sysctl.o"
454 zebra_rtread="sysctl";;
455esac
456fi])
457AC_SUBST(RTREAD_METHOD)
458
459dnl -----------------------------
460dnl check interface lookup method
461dnl -----------------------------
462AC_MSG_CHECKING(interface looking up method)
463if test "$netlink" = yes; then
464 AC_MSG_RESULT(netlink)
465 IF_METHOD=if_netlink.o
466else
467 if test "$opsys" = "sol2-6";then
468 AC_MSG_RESULT(solaris)
469 IF_METHOD=if_ioctl.o
paul49e3b3c2003-10-23 20:39:50 +0000470 elif test "$opsys" = "irix" ; then
471 AC_MSG_RESULT(irix)
472 IF_METHOD=if_ioctl.o
paul7ea487b2003-03-17 02:05:07 +0000473 elif test "$opsys" = "openbsd";then
474 AC_MSG_RESULT(openbsd)
475 IF_METHOD=if_ioctl.o
476 elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
477 AC_MSG_RESULT(sysctl)
478 IF_METHOD=if_sysctl.o
479 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
480 else
481 AC_MSG_RESULT(ioctl)
482 IF_METHOD=if_ioctl.o
483 fi
484fi
485AC_SUBST(IF_METHOD)
486
487dnl -----------------------
488dnl check proc file system.
489dnl -----------------------
490if test -r /proc/net/dev; then
491 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
492 IF_PROC=if_proc.o
493fi
494
495if test -r /proc/net/if_inet6; then
496 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
497 IF_PROC=if_proc.o
498fi
499AC_SUBST(IF_PROC)
500
501dnl -----------------------------
502dnl check ipforward detect method
503dnl -----------------------------
504AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
505[for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
506do
507 test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
508done
509case $zebra_ipforward_path in
510 "/proc/net/snmp") IPFORWARD=ipforward_proc.o
511 zebra_ipforward_path="proc";;
512 "/dev/ip")
513 case "$host" in
514 *-nec-sysv4*) IPFORWARD=ipforward_ews.o
515 zebra_ipforward_path="ews";;
paul9c30ab62003-07-08 08:36:17 +0000516 *-freebsd*) IPFORWARD=ipforward_sysctl.o
517 zebra_ipforward_path="sysctl";;
paul7ea487b2003-03-17 02:05:07 +0000518 *) IPFORWARD=ipforward_solaris.o
519 zebra_ipforward_path="solaris";;
520 esac;;
521 *) IPFORWARD=ipforward_sysctl.o
522 zebra_ipforward_path="sysctl";;
523esac])
524AC_SUBST(IPFORWARD)
525
526AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
527
528dnl ----------
529dnl IPv6 check
530dnl ----------
531AC_MSG_CHECKING(whether does this OS have IPv6 stack)
532if test "${enable_ipv6}" = "no"; then
533 AC_MSG_RESULT(disabled)
534else
535dnl ----------
536dnl INRIA IPv6
537dnl ----------
paula159ed92003-06-04 11:01:45 +0000538 if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
539 zebra_cv_ipv6=yes
540 AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
541 AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
542 RIPNGD="ripngd"
543 OSPF6D="ospf6d"
544 LIB_IPV6=""
545 AC_MSG_RESULT(INRIA IPv6)
paul7ea487b2003-03-17 02:05:07 +0000546dnl ---------
547dnl KAME IPv6
548dnl ---------
paula159ed92003-06-04 11:01:45 +0000549 elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
550 zebra_cv_ipv6=yes
551 AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
552 AC_DEFINE(KAME,1,KAME IPv6)
553 RIPNGD="ripngd"
554 OSPF6D="ospf6d"
555 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
paul7ea487b2003-03-17 02:05:07 +0000556 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +0000557 fi
558 AC_MSG_RESULT(KAME)
hasso71c0fb52003-05-25 20:18:13 +0000559dnl -------------------------
560dnl MUSICA IPv6
561dnl default host check
562dnl It is not used by Kheops
563dnl -------------------------
paula159ed92003-06-04 11:01:45 +0000564 elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
565 zebra_cv_ipv6=yes
566 AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
567 AC_DEFINE(MUSICA,1,Musica IPv6 stack)
568 AC_DEFINE(KAME,1,KAME IPv6 stack)
569 RIPNGD="ripngd"
570 OSPF6D="ospf6d"
571 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
hasso71c0fb52003-05-25 20:18:13 +0000572 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +0000573 fi
574 AC_MSG_RESULT(MUSICA)
paul7ea487b2003-03-17 02:05:07 +0000575dnl ---------
576dnl NRL check
577dnl ---------
paula159ed92003-06-04 11:01:45 +0000578 elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
579 zebra_cv_ipv6=yes
580 AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
581 AC_DEFINE(NRL,1,NRL)
582 RIPNGD="ripngd"
583 OSPF6D="ospf6d"
584 if test x"$opsys" = x"bsdi";then
paul7ea487b2003-03-17 02:05:07 +0000585 AC_DEFINE(BSDI_NRL,,BSDI)
586 AC_MSG_RESULT(BSDI_NRL)
paula159ed92003-06-04 11:01:45 +0000587 else
paul7ea487b2003-03-17 02:05:07 +0000588 AC_MSG_RESULT(NRL)
paula159ed92003-06-04 11:01:45 +0000589 fi
paul7ea487b2003-03-17 02:05:07 +0000590dnl ----------
591dnl Linux IPv6
592dnl ----------
paula159ed92003-06-04 11:01:45 +0000593 elif test "${enable_ipv6}" = "yes"; then
594 AC_EGREP_CPP(yes, [
595 #include <linux/version.h>
596 /* 2.1.128 or later */
597 #if LINUX_VERSION_CODE >= 0x020180
598 yes
599 #endif],
600 [zebra_cv_ipv6=yes
601 zebra_cv_linux_ipv6=yes
602 AC_MSG_RESULT(Linux IPv6)])
603 else
604 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
605 then
paul7ea487b2003-03-17 02:05:07 +0000606 zebra_cv_ipv6=yes
607 zebra_cv_linux_ipv6=yes
608 AC_MSG_RESULT(Linux IPv6)
paula159ed92003-06-04 11:01:45 +0000609 fi
610 fi
paul7ea487b2003-03-17 02:05:07 +0000611
paula159ed92003-06-04 11:01:45 +0000612 if test "$zebra_cv_linux_ipv6" = "yes";then
613 AC_MSG_CHECKING(for GNU libc >= 2.1)
614 AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
615 AC_EGREP_CPP(yes, [
paul7ea487b2003-03-17 02:05:07 +0000616#include <features.h>
617#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
618 yes
paula159ed92003-06-04 11:01:45 +0000619#endif],
620 [glibc=yes
621 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
622 AC_MSG_RESULT(yes)],
623 AC_MSG_RESULT(no)
624 )
625 RIPNGD="ripngd"
626 OSPF6D="ospf6d"
627 if test "$glibc" != "yes"; then
paul7ea487b2003-03-17 02:05:07 +0000628 INCLUDES="-I/usr/inet6/include"
629 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
630 LIB_IPV6="-L/usr/inet6/lib -linet6"
631 fi
paula159ed92003-06-04 11:01:45 +0000632 fi
633 fi
paul7ea487b2003-03-17 02:05:07 +0000634
635dnl -----------------------
636dnl Set IPv6 related values
637dnl -----------------------
paula159ed92003-06-04 11:01:45 +0000638 LIBS="$LIB_IPV6 $LIBS"
639 AC_SUBST(LIB_IPV6)
paul7ea487b2003-03-17 02:05:07 +0000640
paula159ed92003-06-04 11:01:45 +0000641 if test x"$RIPNGD" = x""; then
642 AC_MSG_RESULT(IPv4 only)
643 fi
paul7ea487b2003-03-17 02:05:07 +0000644fi
645
gdtfa3232e2003-12-03 17:52:30 +0000646dnl ------------------
647dnl IPv6 header checks
648dnl ------------------
649if test "x${zebra_cv_ipv6}" = "xyes"; then
650AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
651 netinet6/in6_var.h netinet6/nd6.h])
652fi
653
paul7ea487b2003-03-17 02:05:07 +0000654dnl --------------------
655dnl Daemon disable check
656dnl --------------------
657if test "${enable_zebra}" = "no";then
658 ZEBRA=""
659else
660 ZEBRA="zebra"
661fi
662
663if test "${enable_bgpd}" = "no";then
664 BGPD=""
665else
666 BGPD="bgpd"
667fi
668
669if test "${enable_ripd}" = "no";then
670 RIPD=""
671else
672 RIPD="ripd"
673fi
674
675if test "${enable_ospfd}" = "no";then
676 OSPFD=""
677else
678 OSPFD="ospfd"
679fi
680
paul1ef74ef2003-03-21 15:16:05 +0000681OSPFCLIENT=""
682if test "${enable_opaque_lsa}" = "yes"; then
683 if test "${enable_ospfapi}" != "no";then
paul9a569842003-03-28 01:45:13 +0000684 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
paul1ef74ef2003-03-21 15:16:05 +0000685
686 if test "${enable_ospfclient}" != "no";then
687 OSPFCLIENT="ospfclient"
688 fi
689 fi
690
paul7ea487b2003-03-17 02:05:07 +0000691fi
692
693case "${enable_ripngd}" in
694 "yes") RIPNGD="ripngd";;
695 "no" ) RIPNGD="";;
696 * ) ;;
697esac
698
699case "${enable_ospf6d}" in
700 "yes") OSPF6D="ospf6d";;
701 "no" ) OSPF6D="";;
702 * ) ;;
703esac
704
705if test "${enable_bgp_announce}" = "no";then
706 AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
707fi
708
709AC_SUBST(ZEBRA)
710AC_SUBST(BGPD)
711AC_SUBST(RIPD)
712AC_SUBST(RIPNGD)
713AC_SUBST(OSPFD)
714AC_SUBST(OSPF6D)
715AC_SUBST(VTYSH)
716AC_SUBST(INCLUDES)
717AC_SUBST(CURSES)
718AC_SUBST(OSPFCLIENT)
paul1ef74ef2003-03-21 15:16:05 +0000719AC_SUBST(OSPFAPI)
paul7ea487b2003-03-17 02:05:07 +0000720AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
721AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
722AC_CHECK_LIB(crypt, crypt)
723AC_CHECK_LIB(resolv, res_init)
724AC_CHECK_LIB(m, main)
725
726dnl ---------------------------------------------------
727dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
728dnl ---------------------------------------------------
paula159ed92003-06-04 11:01:45 +0000729AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
730AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
731AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
paul7ea487b2003-03-17 02:05:07 +0000732
733dnl ---------------------------
734dnl check system has GNU regexp
735dnl ---------------------------
736dnl AC_MSG_CHECKING(whether system has GNU regex)
737AC_CHECK_LIB(c, regexec,
738[AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
739 LIB_REGEX=""],
740[LIB_REGEX="regex.o"])
741AC_SUBST(LIB_REGEX)
742
743dnl ------------------
744dnl check SNMP library
745dnl ------------------
746if test "${enable_snmp}" = "yes";then
747dnl AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
paul7ea487b2003-03-17 02:05:07 +0000748 if test "${HAVE_SNMP}" = ""; then
paul1ef74ef2003-03-21 15:16:05 +0000749 old_libs="${LIBS}"
750 LIBS="-L/usr/lib"
paul7ea487b2003-03-17 02:05:07 +0000751 unset ac_cv_lib_snmp_asn_parse_int
paul1ef74ef2003-03-21 15:16:05 +0000752 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
753 if test "${NEED_CRYPTO}" = ""; then
754 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes ])
755 else
756 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes; NEED_CRYPTO=yes;LIBS="$LIBS -lcrypto" ],,"-lcrypto")
757 fi
758 LIBS="${old_libs}"
paul7ea487b2003-03-17 02:05:07 +0000759 fi
paul1ef74ef2003-03-21 15:16:05 +0000760 if test "${HAVE_SNMP}" = ""; then
761 old_libs="${LIBS}"
762 LIBS="-L/usr/lib"
763 unset ac_cv_lib_snmp_asn_parse_int
764 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes, )
765 if test "${HAVE_SNMP}" = ""; then
766 unset ac_cv_lib_snmp_asn_parse_int
767 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
768 if test "${NEED_CRYPTO}" = "yes"; then
769 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
770 fi
771 fi
772 LIBS="${old_libs}"
773 fi
paul7ea487b2003-03-17 02:05:07 +0000774
775 if test "${HAVE_SNMP}" = ""; then
paul1ef74ef2003-03-21 15:16:05 +0000776 old_libs="${LIBS}"
777 LIBS="-L/usr/local/lib"
778 unset ac_cv_lib_snmp_asn_parse_int
779 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
780 if test "${HAVE_SNMP}" = ""; then
781 unset ac_cv_lib_snmp_asn_parse_int
782 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
783 if test "${NEED_CRYPTO}" = "yes"; then
784 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
785 fi
786 fi
787 LIBS="${old_libs}"
paul7ea487b2003-03-17 02:05:07 +0000788 fi
paul1ef74ef2003-03-21 15:16:05 +0000789
paul7ea487b2003-03-17 02:05:07 +0000790 if test "${HAVE_SNMP}" = "yes"; then
791 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
792 do
793 test -f "${ac_snmp}" && break
794 done
paul1ef74ef2003-03-21 15:16:05 +0000795
paul7ea487b2003-03-17 02:05:07 +0000796 case ${ac_snmp} in
797 /usr/include/net-snmp/*)
798 AC_DEFINE(HAVE_SNMP,,SNMP)
paul1ef74ef2003-03-21 15:16:05 +0000799 AC_DEFINE(HAVE_NETSNMP,,SNMP)
paul7ea487b2003-03-17 02:05:07 +0000800 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
paulac7c4bb2003-03-19 04:25:08 +0000801 CFLAGS="${CFLAGS} -I/usr/include/net-snmp -I/usr/include/net-snmp/library"
802 if test "${HAVE_NETSNMP}" = "yes"; then
paul1ef74ef2003-03-21 15:16:05 +0000803 LIBS="${LIBS} -lnetsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000804 else
paul1ef74ef2003-03-21 15:16:05 +0000805 LIBS="${LIBS} -lsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000806 fi
paul7ea487b2003-03-17 02:05:07 +0000807 ;;
808 /usr/include/ucd-snmp/*)
809 AC_DEFINE(HAVE_SNMP,,SNMP)
810 CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp"
811 LIBS="${LIBS} -lsnmp"
812 ;;
813 /usr/local/include/ucd-snmp/*)
814 AC_DEFINE(HAVE_SNMP,,SNMP)
815 CFLAGS="${CFLAGS} -I/usr/local/include/ucd-snmp"
816 LIBS="${LIBS} -L/usr/local/lib -lsnmp"
817 ;;
paulf3bd1a72003-11-02 07:29:11 +0000818 /usr/local/include/net-snmp/*)
819 AC_DEFINE(HAVE_SNMP,,SNMP)
820 AC_DEFINE(HAVE_NET_SNMP,,SNMP)
821 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
822 CFLAGS="${CFLAGS} -I/usr/local/include/net-snmp"
823 LIBS="${LIBS} -L/usr/local/lib -lnetsnmp"
824 ;;
paul7ea487b2003-03-17 02:05:07 +0000825 esac
826 if test "${NEED_CRYPTO}" = "yes"; then
827 LIBS="${LIBS} -lcrypto"
828 fi
829 fi
830fi
831
832dnl ----------------------------
833dnl check sa_len of sockaddr
834dnl ----------------------------
835AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
836AC_TRY_COMPILE([#include <sys/types.h>
837#include <sys/socket.h>
838],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
839[AC_MSG_RESULT(yes)
840 AC_DEFINE(HAVE_SA_LEN,,sa_len)],
841 AC_MSG_RESULT(no))
842
843dnl ----------------------------
844dnl check sin_len of sockaddr_in
845dnl ----------------------------
846AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
847AC_TRY_COMPILE([#include <sys/types.h>
848#include <netinet/in.h>
849],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
850[AC_MSG_RESULT(yes)
851 AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
852 AC_MSG_RESULT(no))
853
854dnl ----------------------------
855dnl check sun_len of sockaddr_un
856dnl ----------------------------
857AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
858AC_TRY_COMPILE([#include <sys/types.h>
859#include <sys/un.h>
860],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
861[AC_MSG_RESULT(yes)
862 AC_DEFINE(HAVE_SUN_LEN,,sun_len)],
863 AC_MSG_RESULT(no))
864
865dnl -----------------------------------
866dnl check sin6_scope_id of sockaddr_in6
867dnl -----------------------------------
868if test "$zebra_cv_ipv6" = yes; then
869 AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
870 AC_TRY_COMPILE([#include <sys/types.h>
871#include <netinet/in.h>
872],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
873[AC_MSG_RESULT(yes)
874 AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)],
875 AC_MSG_RESULT(no))
876fi
877
878dnl ----------------------------
879dnl check socklen_t exist or not
880dnl ----------------------------
881AC_MSG_CHECKING(whther socklen_t is defined)
882AC_TRY_COMPILE([#include <sys/types.h>
883#include <sys/socket.h>
884#include <netinet/in.h>
885],[socklen_t ac_x;],
886[AC_MSG_RESULT(yes)
887 AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)],
888 AC_MSG_RESULT(no))
889
890dnl ------------------------
891dnl check struct sockaddr_dl
892dnl ------------------------
893AC_MSG_CHECKING(whether struct sockaddr_dl exist)
894AC_EGREP_HEADER(sockaddr_dl,
895net/if_dl.h,
896[AC_MSG_RESULT(yes)
897 AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)],
898 AC_MSG_RESULT(no))
899
900dnl --------------------------
901dnl check structure ifaliasreq
902dnl --------------------------
903AC_MSG_CHECKING(whether struct ifaliasreq exist)
904AC_EGREP_HEADER(ifaliasreq,
905net/if.h,
906[AC_MSG_RESULT(yes)
907 AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)],
908 AC_MSG_RESULT(no))
909
910dnl ----------------------------
911dnl check structure in6_aliasreq
912dnl ----------------------------
hasso71c0fb52003-05-25 20:18:13 +0000913AC_MSG_CHECKING(whether struct in6_aliasreq exist)
paul7ea487b2003-03-17 02:05:07 +0000914AC_EGREP_HEADER(in6_aliasreq,
915netinet6/in6_var.h,
916[AC_MSG_RESULT(yes)
917 AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
918 AC_MSG_RESULT(no))
919
hasso71c0fb52003-05-25 20:18:13 +0000920dnl -----------------------------------
921dnl check ifra_lifetime of in6_aliasreq
922dnl -----------------------------------
923AC_MSG_CHECKING(whether in6_aliasreq.ifra_lifetime exist)
924AC_TRY_COMPILE([#include <sys/types.h>
925#include <netinet6/in6_var.h>
926],[static struct if6_aliasreq ac_i;int ac_j = sizeof (ac_i.ifra_lifetime);],
927[AC_MSG_RESULT(yes)
paula159ed92003-06-04 11:01:45 +0000928 AC_DEFINE(HAVE_IFRA_LIFETIME,,Have in6_aliasreq.ifra_lifetime)],
hasso71c0fb52003-05-25 20:18:13 +0000929 AC_MSG_RESULT(no))
930
paul7ea487b2003-03-17 02:05:07 +0000931dnl ---------------------------
932dnl check structure rt_addrinfo
933dnl ---------------------------
934AC_MSG_CHECKING(whether struct rt_addrinfo exist)
935AC_EGREP_HEADER(rt_addrinfo,
936net/route.h,
937[AC_MSG_RESULT(yes)
938 AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)],
939 AC_MSG_RESULT(no))
940
941dnl --------------------------
942dnl check structure in_pktinfo
943dnl --------------------------
944AC_MSG_CHECKING(whether struct in_pktinfo exist)
945AC_TRY_COMPILE([#include <netinet/in.h>
946],[struct in_pktinfo ac_x;],
947[AC_MSG_RESULT(yes)
948 AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
949 AC_MSG_RESULT(no))
950
951dnl --------------------------------------
952dnl checking for getrusage struct and call
953dnl --------------------------------------
954AC_MSG_CHECKING(whether getrusage is available)
955AC_TRY_COMPILE([#include <sys/resource.h>
956],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
957[AC_MSG_RESULT(yes)
958 AC_DEFINE(HAVE_RUSAGE,,rusage)],
959 AC_MSG_RESULT(no))
960
pauledd7c242003-06-04 13:59:38 +0000961dnl -------------------
962dnl capabilities checks
963dnl -------------------
964AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
965AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
966 [AC_MSG_RESULT(yes)
967 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
paule8f29842003-08-12 13:08:31 +0000968 quagga_ac_keepcaps="yes"],
pauledd7c242003-06-04 13:59:38 +0000969 AC_MSG_RESULT(no)
970)
paule8f29842003-08-12 13:08:31 +0000971if test x"${quagga_ac_keepcaps}" = x"yes"; then
pauledd7c242003-06-04 13:59:38 +0000972 AC_CHECK_HEADERS(sys/capability.h)
973fi
974if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
975 AC_CHECK_LIB(cap, cap_init,
976 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
977 LIBCAP="-lcap"
978 ]
979 )
980fi
981AC_SUBST(LIBCAP)
982
paulfb2d1502003-06-04 09:40:54 +0000983dnl ---------------------------
984dnl check for glibc 'backtrace'
985dnl ---------------------------
986if test "${glibc}" = "yes"; then
987 AC_CHECK_HEADER(execinfo.h)
988fi
989if test x"${ac_cv_header_execinfo_h}" = x"yes"; then
990 AC_CHECK_FUNC(backtrace,
991 [AC_DEFINE(HAVE_GLIBC_BACKTRACE,,Glibc backtrace)]
992 )
993fi
994
paul408ad942003-05-20 00:03:33 +0000995dnl ----------
996dnl configure date
997dnl ----------
998CONFDATE=`date '+%Y%m%d'`
999AC_SUBST(CONFDATE)
1000
paul7ea487b2003-03-17 02:05:07 +00001001dnl ------------------------------
paula159ed92003-06-04 11:01:45 +00001002dnl set paths for state directory
paul23bd12c2003-04-07 06:11:09 +00001003dnl ------------------------------
1004if test "${prefix}" = "NONE"; then
paule8f29842003-08-12 13:08:31 +00001005 quagga_statedir_prefix="";
paul23bd12c2003-04-07 06:11:09 +00001006else
paule8f29842003-08-12 13:08:31 +00001007 quagga_statedir_prefix=${prefix}
paul23bd12c2003-04-07 06:11:09 +00001008fi
1009if test "${localstatedir}" = '${prefix}/var'; then
paula159ed92003-06-04 11:01:45 +00001010 AC_CACHE_CHECK(state directory,ac_statedir,
paule8f29842003-08-12 13:08:31 +00001011 [for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
1012 ${quagga_statedir_prefix}/var/adm dnl
1013 ${quagga_statedir_prefix}/etc dnl
paula159ed92003-06-04 11:01:45 +00001014 /var/run dnl
1015 /var/adm dnl
1016 /etc dnl
1017 /dev/null;
paul23bd12c2003-04-07 06:11:09 +00001018 do
paule8f29842003-08-12 13:08:31 +00001019 test -d $QUAGGA_STATE_DIR && break
paul23bd12c2003-04-07 06:11:09 +00001020 done
paule8f29842003-08-12 13:08:31 +00001021 quagga_statedir=$QUAGGA_STATE_DIR])
paul23bd12c2003-04-07 06:11:09 +00001022else
paule8f29842003-08-12 13:08:31 +00001023 quagga_statedir=${localstatedir}
paula159ed92003-06-04 11:01:45 +00001024 AC_MSG_CHECKING(directory to use for state file)
paule8f29842003-08-12 13:08:31 +00001025 AC_MSG_RESULT(${quagga_statedir})
paul23bd12c2003-04-07 06:11:09 +00001026fi
paule8f29842003-08-12 13:08:31 +00001027if test $quagga_statedir = "/dev/null"; then
paula159ed92003-06-04 11:01:45 +00001028 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1029fi
1030
paule8f29842003-08-12 13:08:31 +00001031AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1032AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1033AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1034AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1035AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1036AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
1037AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1038AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1039AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1040AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1041AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1042AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1043AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
paul7ea487b2003-03-17 02:05:07 +00001044
1045dnl ---------------------------
1046dnl Check htonl works correctly
1047dnl ---------------------------
1048AC_MSG_CHECKING(for working htonl)
1049AC_CACHE_VAL(ac_cv_htonl_works, [
1050AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
1051#include <sys/types.h>
1052#endif
1053#ifdef HAVE_NETDB_H
1054#include <netdb.h>
1055#endif
1056#ifdef HAVE_NETINET_IN_H
1057#include <netinet/in.h>
1058#endif],
1059[htonl (0);],
1060ac_cv_htonl_works=yes,
1061ac_cv_htonl_works=no)])
1062AC_MSG_RESULT($ac_cv_htonl_works)
1063
paul6382b6f2003-05-20 00:17:45 +00001064AC_OUTPUT(Makefile lib/Makefile zebra/Makefile ripd/Makefile
1065 ripngd/Makefile bgpd/Makefile ospfd/Makefile
1066 ospf6d/Makefile vtysh/Makefile doc/Makefile
1067 ospfclient/Makefile
paulfa1253d2003-09-24 05:09:26 +00001068 redhat/quagga.spec
1069 lib/version.h)
paul7ea487b2003-03-17 02:05:07 +00001070
1071echo "
1072zebra configuration
1073-------------------
paulfa1253d2003-09-24 05:09:26 +00001074quagga version : ${PACKAGE_VERSION}
paul7ea487b2003-03-17 02:05:07 +00001075host operationg system : ${host_os}
1076source code location : ${srcdir}
1077compiler : ${CC}
1078compiler flags : ${CFLAGS}
hasso71c0fb52003-05-25 20:18:13 +00001079linker flags : ${LDFLAGS} ${LIBS}
paule8f29842003-08-12 13:08:31 +00001080state file directory : ${quagga_statedir}
pauldc7a2bf2003-10-22 00:07:44 +00001081config file directory : `eval echo \`echo ${sysconfdir}\``
gdtd6b72f72003-12-03 17:24:27 +00001082example directory : `eval echo \`echo ${exampledir}\``
paul8d4aee52003-06-06 00:30:35 +00001083user to run as : ${enable_user}
1084group to run as : ${enable_group}
1085group for vty sockets : ${enable_vty_group}
gdtaa593d52003-12-22 20:15:53 +00001086config file mask : ${enable_configfile_mask}
1087log file mask : ${enable_logfile_mask}
pauldc7a2bf2003-10-22 00:07:44 +00001088
1089The above user and group must have read/write access to the state file
1090directory and to the config files in the config file directory.
paul7ea487b2003-03-17 02:05:07 +00001091"