blob: 5f304db666aaf8c43ab00c286111c2eeaf8398d1 [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
hassoeb260372004-02-20 18:40:38 +000010AC_INIT(quagga, 0.96.4, [http://bugzilla.quagga.net])
paulfa1253d2003-09-24 05:09:26 +000011AC_CONFIG_SRCDIR(lib/zebra.h)
gdt1666d352004-03-30 13:45:58 +000012AM_INIT_AUTOMAKE(1.7)
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])
jardin9e867fe2003-12-23 08:56:18 +000085AC_ARG_ENABLE(isisd,
86[ --disable-isisd do not build isisd])
paul7ea487b2003-03-17 02:05:07 +000087AC_ARG_ENABLE(bgp-announce,
88[ --disable-bgp-announce, turn off BGP route announcement])
89AC_ARG_ENABLE(netlink,
90[ --enable-netlink force to use Linux netlink interface])
91AC_ARG_ENABLE(broken-aliases,
92[ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
93AC_ARG_ENABLE(snmp,
94[ --enable-snmp enable SNMP support])
95AC_ARG_WITH(libpam,
96[ --with-libpam use libpam for PAM support in vtysh])
hasso71c0fb52003-05-25 20:18:13 +000097AC_ARG_ENABLE(tcp-zebra,
paul7ea487b2003-03-17 02:05:07 +000098[ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon])
99dnl Temporary option until OSPF NSSA implementation complete
100AC_ARG_ENABLE(nssa,
101[ --enable-nssa enable OSPF NSSA option])
102AC_ARG_ENABLE(opaque-lsa,
paul1ef74ef2003-03-21 15:16:05 +0000103[ --enable-opaque-lsa enable OSPF Opaque-LSA with OSPFAPI support (RFC2370)])
104AC_ARG_ENABLE(ospfapi,
105[ --disable-ospfapi do not build OSPFAPI to access the OSPF LSA Database,
106 (this is the default if --enable-opaque-lsa is not set)])
107AC_ARG_ENABLE(ospfclient,
108[ --disable-ospfclient do not build OSPFAPI client for OSPFAPI,
109 (this is the default if --disable-ospfapi is set)])
paul7ea487b2003-03-17 02:05:07 +0000110AC_ARG_ENABLE(ospf-te,
111[ --enable-ospf-te enable Traffic Engineering Extension to OSPF])
112AC_ARG_ENABLE(multipath,
113[ --enable-multipath=ARG enable multipath function, ARG must be digit])
paule8f29842003-08-12 13:08:31 +0000114AC_ARG_ENABLE(quagga_user,
115[ --enable-user=ARG user to run Quagga suite as (default quagga)])
116AC_ARG_ENABLE(quagga_group,
117[ --enable-group=ARG group to run Quagga suite as (default quagga)])
pauledd7c242003-06-04 13:59:38 +0000118AC_ARG_ENABLE(vty_group,
119[ --enable-vty-group=ARG set vty sockets to have specified group as owner])
gdtaa593d52003-12-22 20:15:53 +0000120AC_ARG_ENABLE(configfile_mask,
121[ --enable-configfile-mask=ARG set mask for config files])
122AC_ARG_ENABLE(logfile_mask,
123[ --enable-logfile-mask=ARG set mask for log files])
pauledd7c242003-06-04 13:59:38 +0000124
hasso71c0fb52003-05-25 20:18:13 +0000125AC_ARG_ENABLE(rtadv,
gdtd2a0ccc2003-12-03 18:13:48 +0000126[ --disable-rtadv disable IPV6 router advertisement feature])
paul7ea487b2003-03-17 02:05:07 +0000127
128if test "${enable_broken_aliases}" = "yes"; then
129 if test "${enable_netlink}" = "yes"
130 then
131 echo "Sorry, you can't use netlink with broken aliases"
132 exit 1
133 fi
134 AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
135 enable_netlink=no
136fi
137
138if test "${enable_tcp_zebra}" = "yes"; then
139 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
140fi
141
142if test "${enable_nssa}" = "yes"; then
143 AC_DEFINE(HAVE_NSSA,,OSPF NSSA)
144fi
145
146if test "${enable_opaque_lsa}" = "yes"; then
147 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
148fi
149
150if test "${enable_ospf_te}" = "yes"; then
151 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
152 AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
153fi
154
gdtd2a0ccc2003-12-03 18:13:48 +0000155AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
156if test "${enable_rtadv}" != "no"; then
hasso71c0fb52003-05-25 20:18:13 +0000157 AC_MSG_RESULT(yes)
gdtd2a0ccc2003-12-03 18:13:48 +0000158 AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
paul2487bea2003-05-25 23:51:31 +0000159else
160 AC_MSG_RESULT(no)
hasso71c0fb52003-05-25 20:18:13 +0000161fi
paul7ea487b2003-03-17 02:05:07 +0000162
paul79cb2162003-06-06 12:19:53 +0000163if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
paule8f29842003-08-12 13:08:31 +0000164 enable_user="quagga"
pauledd7c242003-06-04 13:59:38 +0000165elif test "${enable_user}" = "no"; then
166 enable_user="root"
167fi
paule8f29842003-08-12 13:08:31 +0000168AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
pauledd7c242003-06-04 13:59:38 +0000169
paul79cb2162003-06-06 12:19:53 +0000170if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
paule8f29842003-08-12 13:08:31 +0000171 enable_group="quagga"
pauledd7c242003-06-04 13:59:38 +0000172elif test "${enable_group}" = "no"; then
173 enable_group="root"
174fi
paule8f29842003-08-12 13:08:31 +0000175AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
pauledd7c242003-06-04 13:59:38 +0000176
177if test x"${enable_vty_group}" = x"yes" ; then
paul8d4aee52003-06-06 00:30:35 +0000178 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
paul79cb2162003-06-06 12:19:53 +0000179elif test x"${enable_vty_group}" != x""; then
paul8d4aee52003-06-06 00:30:35 +0000180 if test x"${enable_vty_group}" != x"no"; then
pauledd7c242003-06-04 13:59:38 +0000181 AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
182 fi
183fi
184
gdtaa593d52003-12-22 20:15:53 +0000185enable_configfile_mask=${enable_configfile_mask:-0600}
186AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
187
188enable_logfile_mask=${enable_logfile_mask:-0600}
189AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
190
paul7ea487b2003-03-17 02:05:07 +0000191changequote(, )dnl
192
193MULTIPATH_NUM=1
194
195case "${enable_multipath}" in
196 [0-9]|[1-9][0-9])
197 MULTIPATH_NUM="${enable_multipath}"
198 ;;
199 "")
200 ;;
201 *)
202 echo "Please specify digit to --enable-multipath ARG."
203 exit 1
204 ;;
205esac
206
207changequote([, ])dnl
208
209AC_SUBST(MULTIPATH_NUM)
210
211dnl -------------------
212dnl Check header files.
213dnl -------------------
pauldc7a2bf2003-10-22 00:07:44 +0000214AC_HEADER_STDC
215AC_CHECK_HEADERS([string.h stropts.h sys/conf.h sys/ksym.h sys/time.h \
216 sys/times.h sys/select.h sys/sysctl.h sys/sockio.h \
217 sys/types.h linux/version.h kvm.h netdb.h asm/types.h \
218 libutil.h limits.h])
219
paul835b7f12003-10-30 21:59:57 +0000220AC_CHECK_HEADERS([sys/socket.h netinet/in_systm.h netinet/in.h \
paulf3bd1a72003-11-02 07:29:11 +0000221 net/if_dl.h net/netopt.h inet/nd.h net/route.h \
paul835b7f12003-10-30 21:59:57 +0000222 net/if.h net/if_var.h netinet/in_var.h])
pauldc7a2bf2003-10-22 00:07:44 +0000223
gdtfa3232e2003-12-03 17:52:30 +0000224dnl V6 headers are checked below, after we check for v6
paul7ea487b2003-03-17 02:05:07 +0000225
226dnl check some types
227AC_C_CONST
228dnl AC_TYPE_PID_T
229AC_TYPE_SIGNAL
230
231dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
232case "$host" in
233 *-sunos5.6* | *-solaris2.6*)
234 opsys=sol2-6
235 AC_DEFINE(SUNOS_5,,SunOS 5)
236 AC_CHECK_LIB(xnet, main)
237 CURSES=-lcurses
238 ;;
239 *-sunos5* | *-solaris2*)
240 AC_DEFINE(SUNOS_5,,SunOS 5)
241 AC_CHECK_LIB(socket, main)
242 AC_CHECK_LIB(nsl, main)
243 CURSES=-lcurses
244 ;;
245 *-linux-*)
246 opsys=gnu-linux
247 AC_DEFINE(GNU_LINUX,,GNU Linux)
248 ;;
249 *-nec-sysv4*)
250 AC_CHECK_LIB(nsl, gethostbyname)
251 AC_CHECK_LIB(socket, socket)
252 ;;
253 *-freebsd3.2)
254 AC_DEFINE(FREEBSD_32,,FreeBSD 3.2)
255 ;;
256 *-openbsd*)
257 opsys=openbsd
258 AC_DEFINE(OPEN_BSD,,OpenBSD)
259 ;;
260 *-bsdi*)
261 opsys=bsdi
262 OTHER_METHOD="mtu_kvm.o"
263 AC_CHECK_LIB(kvm, main)
264 ;;
paul49e3b3c2003-10-23 20:39:50 +0000265 *-irix6.5)
pauldc7a2bf2003-10-22 00:07:44 +0000266 opsys=irix
267 AC_DEFINE(IRIX_65,,IRIX 6.5)
268 ;;
paul7ea487b2003-03-17 02:05:07 +0000269esac
270
271dnl ---------------------
272dnl Integrated VTY option
273dnl ---------------------
274case "${enable_vtysh}" in
275 "yes") VTYSH="vtysh";
276 AC_DEFINE(VTYSH,,VTY shell)
277 AC_CHECK_LIB(tinfo, tputs, , AC_CHECK_LIB(ncurses, tputs))
278 AC_CHECK_LIB(readline, main)
279 if test $ac_cv_lib_readline_main = no; then
280 AC_MSG_ERROR([vtysh needs libreadline but was not found on your system.])
281 fi
282 AC_CHECK_HEADER(readline/history.h)
283 if test $ac_cv_header_readline_history_h = no;then
284 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
285 fi
paul3d3de8c2003-05-23 10:33:49 +0000286 AC_CHECK_LIB(readline, rl_completion_matches)
287 if test $ac_cv_lib_readline_rl_completion_matches = no; then
288 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
289 fi
290 ;;
paul7ea487b2003-03-17 02:05:07 +0000291 "no" ) VTYSH="";;
292 * ) ;;
293esac
294
295dnl ----------
296dnl PAM module
297dnl ----------
298if test "$with_libpam" = "yes"; then
paul24cd4352003-05-06 12:16:27 +0000299 AC_CHECK_HEADER(security/pam_misc.h)
300 if test "$ac_cv_header_security_pam_misc_h" = yes; then
301 AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
302 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
303 pam_conv_func="misc_conv"
paul24cd4352003-05-06 12:16:27 +0000304 fi
paul24cd4352003-05-06 12:16:27 +0000305 AC_CHECK_HEADER(security/openpam.h)
306 if test "$ac_cv_header_security_openpam_h" = yes; then
307 AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
308 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
309 pam_conv_func="openpam_ttyconv"
paul24cd4352003-05-06 12:16:27 +0000310 fi
311 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
312 AC_MSG_WARN([*** pam support will not be built ***])
313 with_libpam="no"
314 fi
315fi
316
317if test "$with_libpam" = "yes"; then
paul7ea487b2003-03-17 02:05:07 +0000318dnl took this test from proftpd's configure.in and suited to our needs
319dnl -------------------------------------------------------------------------
320dnl
321dnl This next check looks funky due to a linker problem with some versions
322dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
323dnl omitted requiring libdl linking information. PAM-0.72 or better ships
324dnl with RedHat 6.2 and Debian 2.2 or better.
325AC_CHECK_LIB(pam, pam_start,
paul24cd4352003-05-06 12:16:27 +0000326 [AC_CHECK_LIB(pam, $pam_conv_func,
paul7ea487b2003-03-17 02:05:07 +0000327 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
328 LIBPAM="-lpam"],
329 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
330 LIBPAM="-lpam -lpam_misc"]
331 )
332 ],
333
334 [AC_CHECK_LIB(pam, pam_end,
paul24cd4352003-05-06 12:16:27 +0000335 [AC_CHECK_LIB(pam, $pam_conv_func,
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"],
paula159ed92003-06-04 11:01:45 +0000338 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul7ea487b2003-03-17 02:05:07 +0000339 LIBPAM="-lpam -ldl -lpam_misc"]
340 )
341 ],AC_MSG_WARN([*** pam support will not be built ***]),
342 [-ldl])
343 ]
344)
345fi
346AC_SUBST(LIBPAM)
347
348dnl -------------------------------
349dnl Endian-ness check
350dnl -------------------------------
351AC_WORDS_BIGENDIAN
352
353dnl -------------------------------
354dnl check the size in byte of the C
355dnl -------------------------------
356dnl AC_CHECK_SIZEOF(char)
357dnl AC_CHECK_SIZEOF(int)
358dnl AC_CHECK_SIZEOF(short)
359dnl AC_CHECK_SIZEOF(long)
360
361dnl ----------------------------
362dnl check existance of functions
363dnl ----------------------------
paul49e3b3c2003-10-23 20:39:50 +0000364AC_CHECK_FUNCS(memset memcpy strerror inet_aton daemon snprintf vsnprintf \
paul04bd4842003-10-24 04:24:39 +0000365 strlcat strlcpy if_nametoindex if_indextoname getifaddrs \
366 fcntl)
paula159ed92003-06-04 11:01:45 +0000367AC_CHECK_FUNCS(setproctitle, ,
368 [AC_CHECK_LIB(util, setproctitle,
369 [LIBS="$LIBS -lutil"
370 AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
371 ]
372 )
373 ]
374)
paul7ea487b2003-03-17 02:05:07 +0000375
376dnl ------------------------------------
377dnl Determine routing get and set method
378dnl ------------------------------------
379AC_MSG_CHECKING(zebra between kernel interface method)
380if test x"$opsys" = x"gnu-linux"; then
381 if test "${enable_netlink}" = "yes";then
382 AC_MSG_RESULT(netlink)
383 RT_METHOD=rt_netlink.o
384 AC_DEFINE(HAVE_NETLINK,,netlink)
385 netlink=yes
386 elif test "${enable_netlink}" = "no"; then
387 AC_MSG_RESULT(ioctl)
388 RT_METHOD=rt_ioctl.o
389 netlink=no
390 else
391 AC_MSG_RESULT(netlink)
392 RT_METHOD=rt_netlink.o
393 AC_DEFINE(HAVE_NETLINK,,netlink)
394 netlink=yes
395 fi
396else
397 if test "$opsys" = "sol2-6";then
398 AC_MSG_RESULT(solaris)
399 KERNEL_METHOD="kernel_socket.o"
400 RT_METHOD="rt_socket.o"
paul49e3b3c2003-10-23 20:39:50 +0000401 elif test "$opsys" = "irix" ; then
402 AC_MSG_RESULT(irix)
403 KERNEL_METHOD="kernel_socket.o"
404 RT_METHOD="rt_socket.o"
paul7ea487b2003-03-17 02:05:07 +0000405 else
406 AC_TRY_RUN([#include <errno.h>
407#include <sys/types.h>
408#include <sys/socket.h>
409
410main ()
411{
412 int ac_sock;
413
414 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
415 if (ac_sock < 0 && errno == EINVAL)
416 exit (1);
417 exit (0);
418}],
419 [KERNEL_METHOD=kernel_socket.o
420 RT_METHOD=rt_socket.o
421 AC_MSG_RESULT(socket)],
422 [RT_METHOD=rt_ioctl.o
423 AC_MSG_RESULT(ioctl)],
424 [KERNEL_METHOD=kernel_socket.o
425 RT_METHOD=rt_socket.o
426 AC_MSG_RESULT(socket)])
427 fi
428fi
429AC_SUBST(RT_METHOD)
430AC_SUBST(KERNEL_METHOD)
431AC_SUBST(OTHER_METHOD)
432
433dnl ------------------------------
434dnl check kernel route read method
435dnl ------------------------------
436AC_CACHE_CHECK(route read method check, zebra_rtread,
437[if test "$netlink" = yes; then
438 RTREAD_METHOD="rtread_netlink.o"
439 zebra_rtread="netlink"
440else
441for zebra_rtread in /proc/net/route /dev/ip /dev/null;
442do
443 test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
444done
445case $zebra_rtread in
446 "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
447 zebra_rtread="proc";;
paul9c30ab62003-07-08 08:36:17 +0000448 "/dev/ip")
449 case "$host" in
450 *-freebsd*) RTREAD_METHOD=rtread_sysctl.o
451 zebra_rtread="sysctl";;
452 *) RTREAD_METHOD="rtread_getmsg.o"
453 zebra_rtread="getmsg";;
454 esac;;
paul7ea487b2003-03-17 02:05:07 +0000455 *) RTREAD_METHOD="rtread_sysctl.o"
456 zebra_rtread="sysctl";;
457esac
458fi])
459AC_SUBST(RTREAD_METHOD)
460
461dnl -----------------------------
462dnl check interface lookup method
463dnl -----------------------------
464AC_MSG_CHECKING(interface looking up method)
465if test "$netlink" = yes; then
466 AC_MSG_RESULT(netlink)
467 IF_METHOD=if_netlink.o
468else
469 if test "$opsys" = "sol2-6";then
470 AC_MSG_RESULT(solaris)
471 IF_METHOD=if_ioctl.o
paul49e3b3c2003-10-23 20:39:50 +0000472 elif test "$opsys" = "irix" ; then
473 AC_MSG_RESULT(irix)
474 IF_METHOD=if_ioctl.o
paul7ea487b2003-03-17 02:05:07 +0000475 elif test "$opsys" = "openbsd";then
476 AC_MSG_RESULT(openbsd)
477 IF_METHOD=if_ioctl.o
478 elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
479 AC_MSG_RESULT(sysctl)
480 IF_METHOD=if_sysctl.o
481 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
482 else
483 AC_MSG_RESULT(ioctl)
484 IF_METHOD=if_ioctl.o
485 fi
486fi
487AC_SUBST(IF_METHOD)
488
489dnl -----------------------
490dnl check proc file system.
491dnl -----------------------
492if test -r /proc/net/dev; then
493 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
494 IF_PROC=if_proc.o
495fi
496
497if test -r /proc/net/if_inet6; then
498 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
499 IF_PROC=if_proc.o
500fi
501AC_SUBST(IF_PROC)
502
503dnl -----------------------------
504dnl check ipforward detect method
505dnl -----------------------------
506AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
507[for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
508do
509 test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
510done
511case $zebra_ipforward_path in
512 "/proc/net/snmp") IPFORWARD=ipforward_proc.o
513 zebra_ipforward_path="proc";;
514 "/dev/ip")
515 case "$host" in
516 *-nec-sysv4*) IPFORWARD=ipforward_ews.o
517 zebra_ipforward_path="ews";;
paul9c30ab62003-07-08 08:36:17 +0000518 *-freebsd*) IPFORWARD=ipforward_sysctl.o
519 zebra_ipforward_path="sysctl";;
paul7ea487b2003-03-17 02:05:07 +0000520 *) IPFORWARD=ipforward_solaris.o
521 zebra_ipforward_path="solaris";;
522 esac;;
523 *) IPFORWARD=ipforward_sysctl.o
524 zebra_ipforward_path="sysctl";;
525esac])
526AC_SUBST(IPFORWARD)
527
528AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
529
530dnl ----------
531dnl IPv6 check
532dnl ----------
533AC_MSG_CHECKING(whether does this OS have IPv6 stack)
534if test "${enable_ipv6}" = "no"; then
535 AC_MSG_RESULT(disabled)
536else
537dnl ----------
538dnl INRIA IPv6
539dnl ----------
paula159ed92003-06-04 11:01:45 +0000540 if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
541 zebra_cv_ipv6=yes
542 AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
543 AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
544 RIPNGD="ripngd"
545 OSPF6D="ospf6d"
546 LIB_IPV6=""
547 AC_MSG_RESULT(INRIA IPv6)
paul7ea487b2003-03-17 02:05:07 +0000548dnl ---------
549dnl KAME IPv6
550dnl ---------
paula159ed92003-06-04 11:01:45 +0000551 elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
552 zebra_cv_ipv6=yes
553 AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
554 AC_DEFINE(KAME,1,KAME IPv6)
555 RIPNGD="ripngd"
556 OSPF6D="ospf6d"
557 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
paul7ea487b2003-03-17 02:05:07 +0000558 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +0000559 fi
560 AC_MSG_RESULT(KAME)
hasso71c0fb52003-05-25 20:18:13 +0000561dnl -------------------------
562dnl MUSICA IPv6
563dnl default host check
564dnl It is not used by Kheops
565dnl -------------------------
paula159ed92003-06-04 11:01:45 +0000566 elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
567 zebra_cv_ipv6=yes
568 AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
569 AC_DEFINE(MUSICA,1,Musica IPv6 stack)
570 AC_DEFINE(KAME,1,KAME IPv6 stack)
571 RIPNGD="ripngd"
572 OSPF6D="ospf6d"
573 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
hasso71c0fb52003-05-25 20:18:13 +0000574 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +0000575 fi
576 AC_MSG_RESULT(MUSICA)
paul7ea487b2003-03-17 02:05:07 +0000577dnl ---------
578dnl NRL check
579dnl ---------
paula159ed92003-06-04 11:01:45 +0000580 elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
581 zebra_cv_ipv6=yes
582 AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
583 AC_DEFINE(NRL,1,NRL)
584 RIPNGD="ripngd"
585 OSPF6D="ospf6d"
586 if test x"$opsys" = x"bsdi";then
paul7ea487b2003-03-17 02:05:07 +0000587 AC_DEFINE(BSDI_NRL,,BSDI)
588 AC_MSG_RESULT(BSDI_NRL)
paula159ed92003-06-04 11:01:45 +0000589 else
paul7ea487b2003-03-17 02:05:07 +0000590 AC_MSG_RESULT(NRL)
paula159ed92003-06-04 11:01:45 +0000591 fi
paul7ea487b2003-03-17 02:05:07 +0000592dnl ----------
593dnl Linux IPv6
594dnl ----------
paula159ed92003-06-04 11:01:45 +0000595 elif test "${enable_ipv6}" = "yes"; then
596 AC_EGREP_CPP(yes, [
597 #include <linux/version.h>
598 /* 2.1.128 or later */
599 #if LINUX_VERSION_CODE >= 0x020180
600 yes
601 #endif],
602 [zebra_cv_ipv6=yes
603 zebra_cv_linux_ipv6=yes
604 AC_MSG_RESULT(Linux IPv6)])
605 else
606 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
607 then
paul7ea487b2003-03-17 02:05:07 +0000608 zebra_cv_ipv6=yes
609 zebra_cv_linux_ipv6=yes
610 AC_MSG_RESULT(Linux IPv6)
paula159ed92003-06-04 11:01:45 +0000611 fi
612 fi
paul7ea487b2003-03-17 02:05:07 +0000613
paula159ed92003-06-04 11:01:45 +0000614 if test "$zebra_cv_linux_ipv6" = "yes";then
615 AC_MSG_CHECKING(for GNU libc >= 2.1)
616 AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
617 AC_EGREP_CPP(yes, [
paul7ea487b2003-03-17 02:05:07 +0000618#include <features.h>
619#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
620 yes
paula159ed92003-06-04 11:01:45 +0000621#endif],
622 [glibc=yes
623 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
624 AC_MSG_RESULT(yes)],
625 AC_MSG_RESULT(no)
626 )
627 RIPNGD="ripngd"
628 OSPF6D="ospf6d"
629 if test "$glibc" != "yes"; then
paul7ea487b2003-03-17 02:05:07 +0000630 INCLUDES="-I/usr/inet6/include"
631 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
632 LIB_IPV6="-L/usr/inet6/lib -linet6"
633 fi
paula159ed92003-06-04 11:01:45 +0000634 fi
635 fi
paul7ea487b2003-03-17 02:05:07 +0000636
637dnl -----------------------
638dnl Set IPv6 related values
639dnl -----------------------
paula159ed92003-06-04 11:01:45 +0000640 LIBS="$LIB_IPV6 $LIBS"
641 AC_SUBST(LIB_IPV6)
paul7ea487b2003-03-17 02:05:07 +0000642
paula159ed92003-06-04 11:01:45 +0000643 if test x"$RIPNGD" = x""; then
644 AC_MSG_RESULT(IPv4 only)
645 fi
paul7ea487b2003-03-17 02:05:07 +0000646fi
647
gdtfa3232e2003-12-03 17:52:30 +0000648dnl ------------------
649dnl IPv6 header checks
650dnl ------------------
651if test "x${zebra_cv_ipv6}" = "xyes"; then
652AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
653 netinet6/in6_var.h netinet6/nd6.h])
654fi
655
paul7ea487b2003-03-17 02:05:07 +0000656dnl --------------------
657dnl Daemon disable check
658dnl --------------------
659if test "${enable_zebra}" = "no";then
660 ZEBRA=""
661else
662 ZEBRA="zebra"
663fi
664
665if test "${enable_bgpd}" = "no";then
666 BGPD=""
667else
668 BGPD="bgpd"
669fi
670
671if test "${enable_ripd}" = "no";then
672 RIPD=""
673else
674 RIPD="ripd"
675fi
676
677if test "${enable_ospfd}" = "no";then
678 OSPFD=""
679else
680 OSPFD="ospfd"
681fi
682
paul1ef74ef2003-03-21 15:16:05 +0000683OSPFCLIENT=""
684if test "${enable_opaque_lsa}" = "yes"; then
685 if test "${enable_ospfapi}" != "no";then
paul9a569842003-03-28 01:45:13 +0000686 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
paul1ef74ef2003-03-21 15:16:05 +0000687
688 if test "${enable_ospfclient}" != "no";then
689 OSPFCLIENT="ospfclient"
690 fi
691 fi
692
paul7ea487b2003-03-17 02:05:07 +0000693fi
694
695case "${enable_ripngd}" in
696 "yes") RIPNGD="ripngd";;
697 "no" ) RIPNGD="";;
698 * ) ;;
699esac
700
701case "${enable_ospf6d}" in
702 "yes") OSPF6D="ospf6d";;
703 "no" ) OSPF6D="";;
704 * ) ;;
705esac
706
jardin9e867fe2003-12-23 08:56:18 +0000707case "${enable_isisd}" in
708 "yes") ISISD="isisd";;
709 "no" ) ISISD="";;
710 * ) ISISD="isisd";;
711esac
712
paul7ea487b2003-03-17 02:05:07 +0000713if test "${enable_bgp_announce}" = "no";then
714 AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
715fi
716
717AC_SUBST(ZEBRA)
718AC_SUBST(BGPD)
719AC_SUBST(RIPD)
720AC_SUBST(RIPNGD)
721AC_SUBST(OSPFD)
722AC_SUBST(OSPF6D)
jardin9e867fe2003-12-23 08:56:18 +0000723AC_SUBST(ISISD)
paul7ea487b2003-03-17 02:05:07 +0000724AC_SUBST(VTYSH)
725AC_SUBST(INCLUDES)
726AC_SUBST(CURSES)
727AC_SUBST(OSPFCLIENT)
paul1ef74ef2003-03-21 15:16:05 +0000728AC_SUBST(OSPFAPI)
paul7ea487b2003-03-17 02:05:07 +0000729AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
730AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
731AC_CHECK_LIB(crypt, crypt)
732AC_CHECK_LIB(resolv, res_init)
733AC_CHECK_LIB(m, main)
734
735dnl ---------------------------------------------------
736dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
737dnl ---------------------------------------------------
paula159ed92003-06-04 11:01:45 +0000738AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
739AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
740AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
paul7ea487b2003-03-17 02:05:07 +0000741
742dnl ---------------------------
743dnl check system has GNU regexp
744dnl ---------------------------
745dnl AC_MSG_CHECKING(whether system has GNU regex)
746AC_CHECK_LIB(c, regexec,
747[AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
748 LIB_REGEX=""],
749[LIB_REGEX="regex.o"])
750AC_SUBST(LIB_REGEX)
751
752dnl ------------------
753dnl check SNMP library
754dnl ------------------
755if test "${enable_snmp}" = "yes";then
756dnl AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
paul7ea487b2003-03-17 02:05:07 +0000757 if test "${HAVE_SNMP}" = ""; then
paul1ef74ef2003-03-21 15:16:05 +0000758 old_libs="${LIBS}"
759 LIBS="-L/usr/lib"
paul7ea487b2003-03-17 02:05:07 +0000760 unset ac_cv_lib_snmp_asn_parse_int
paul1ef74ef2003-03-21 15:16:05 +0000761 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
762 if test "${NEED_CRYPTO}" = ""; then
763 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes ])
764 else
765 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes; NEED_CRYPTO=yes;LIBS="$LIBS -lcrypto" ],,"-lcrypto")
766 fi
767 LIBS="${old_libs}"
paul7ea487b2003-03-17 02:05:07 +0000768 fi
paul1ef74ef2003-03-21 15:16:05 +0000769 if test "${HAVE_SNMP}" = ""; then
770 old_libs="${LIBS}"
771 LIBS="-L/usr/lib"
772 unset ac_cv_lib_snmp_asn_parse_int
773 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes, )
774 if test "${HAVE_SNMP}" = ""; then
775 unset ac_cv_lib_snmp_asn_parse_int
776 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
777 if test "${NEED_CRYPTO}" = "yes"; then
778 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
779 fi
780 fi
781 LIBS="${old_libs}"
782 fi
paul7ea487b2003-03-17 02:05:07 +0000783
784 if test "${HAVE_SNMP}" = ""; then
paul1ef74ef2003-03-21 15:16:05 +0000785 old_libs="${LIBS}"
786 LIBS="-L/usr/local/lib"
787 unset ac_cv_lib_snmp_asn_parse_int
788 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
789 if test "${HAVE_SNMP}" = ""; then
790 unset ac_cv_lib_snmp_asn_parse_int
791 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
792 if test "${NEED_CRYPTO}" = "yes"; then
793 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
794 fi
795 fi
796 LIBS="${old_libs}"
paul7ea487b2003-03-17 02:05:07 +0000797 fi
paul1ef74ef2003-03-21 15:16:05 +0000798
paul7ea487b2003-03-17 02:05:07 +0000799 if test "${HAVE_SNMP}" = "yes"; then
800 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
801 do
802 test -f "${ac_snmp}" && break
803 done
paul1ef74ef2003-03-21 15:16:05 +0000804
paul7ea487b2003-03-17 02:05:07 +0000805 case ${ac_snmp} in
806 /usr/include/net-snmp/*)
807 AC_DEFINE(HAVE_SNMP,,SNMP)
paul1ef74ef2003-03-21 15:16:05 +0000808 AC_DEFINE(HAVE_NETSNMP,,SNMP)
paul7ea487b2003-03-17 02:05:07 +0000809 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
paulac7c4bb2003-03-19 04:25:08 +0000810 CFLAGS="${CFLAGS} -I/usr/include/net-snmp -I/usr/include/net-snmp/library"
811 if test "${HAVE_NETSNMP}" = "yes"; then
paul1ef74ef2003-03-21 15:16:05 +0000812 LIBS="${LIBS} -lnetsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000813 else
paul1ef74ef2003-03-21 15:16:05 +0000814 LIBS="${LIBS} -lsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000815 fi
paul7ea487b2003-03-17 02:05:07 +0000816 ;;
817 /usr/include/ucd-snmp/*)
818 AC_DEFINE(HAVE_SNMP,,SNMP)
819 CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp"
820 LIBS="${LIBS} -lsnmp"
821 ;;
822 /usr/local/include/ucd-snmp/*)
823 AC_DEFINE(HAVE_SNMP,,SNMP)
824 CFLAGS="${CFLAGS} -I/usr/local/include/ucd-snmp"
825 LIBS="${LIBS} -L/usr/local/lib -lsnmp"
826 ;;
paulf3bd1a72003-11-02 07:29:11 +0000827 /usr/local/include/net-snmp/*)
828 AC_DEFINE(HAVE_SNMP,,SNMP)
829 AC_DEFINE(HAVE_NET_SNMP,,SNMP)
830 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
831 CFLAGS="${CFLAGS} -I/usr/local/include/net-snmp"
832 LIBS="${LIBS} -L/usr/local/lib -lnetsnmp"
833 ;;
paul7ea487b2003-03-17 02:05:07 +0000834 esac
835 if test "${NEED_CRYPTO}" = "yes"; then
836 LIBS="${LIBS} -lcrypto"
837 fi
838 fi
839fi
840
841dnl ----------------------------
842dnl check sa_len of sockaddr
843dnl ----------------------------
844AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
845AC_TRY_COMPILE([#include <sys/types.h>
846#include <sys/socket.h>
847],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
848[AC_MSG_RESULT(yes)
849 AC_DEFINE(HAVE_SA_LEN,,sa_len)],
850 AC_MSG_RESULT(no))
851
852dnl ----------------------------
853dnl check sin_len of sockaddr_in
854dnl ----------------------------
855AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
856AC_TRY_COMPILE([#include <sys/types.h>
857#include <netinet/in.h>
858],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
859[AC_MSG_RESULT(yes)
860 AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
861 AC_MSG_RESULT(no))
862
863dnl ----------------------------
864dnl check sun_len of sockaddr_un
865dnl ----------------------------
866AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
867AC_TRY_COMPILE([#include <sys/types.h>
868#include <sys/un.h>
869],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
870[AC_MSG_RESULT(yes)
871 AC_DEFINE(HAVE_SUN_LEN,,sun_len)],
872 AC_MSG_RESULT(no))
873
874dnl -----------------------------------
875dnl check sin6_scope_id of sockaddr_in6
876dnl -----------------------------------
877if test "$zebra_cv_ipv6" = yes; then
878 AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
879 AC_TRY_COMPILE([#include <sys/types.h>
880#include <netinet/in.h>
881],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
882[AC_MSG_RESULT(yes)
883 AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)],
884 AC_MSG_RESULT(no))
885fi
886
887dnl ----------------------------
888dnl check socklen_t exist or not
889dnl ----------------------------
890AC_MSG_CHECKING(whther socklen_t is defined)
891AC_TRY_COMPILE([#include <sys/types.h>
892#include <sys/socket.h>
893#include <netinet/in.h>
894],[socklen_t ac_x;],
895[AC_MSG_RESULT(yes)
896 AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)],
897 AC_MSG_RESULT(no))
898
899dnl ------------------------
900dnl check struct sockaddr_dl
901dnl ------------------------
902AC_MSG_CHECKING(whether struct sockaddr_dl exist)
903AC_EGREP_HEADER(sockaddr_dl,
904net/if_dl.h,
905[AC_MSG_RESULT(yes)
906 AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)],
907 AC_MSG_RESULT(no))
908
909dnl --------------------------
910dnl check structure ifaliasreq
911dnl --------------------------
912AC_MSG_CHECKING(whether struct ifaliasreq exist)
913AC_EGREP_HEADER(ifaliasreq,
914net/if.h,
915[AC_MSG_RESULT(yes)
916 AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)],
917 AC_MSG_RESULT(no))
918
919dnl ----------------------------
920dnl check structure in6_aliasreq
921dnl ----------------------------
hasso71c0fb52003-05-25 20:18:13 +0000922AC_MSG_CHECKING(whether struct in6_aliasreq exist)
paul7ea487b2003-03-17 02:05:07 +0000923AC_EGREP_HEADER(in6_aliasreq,
924netinet6/in6_var.h,
925[AC_MSG_RESULT(yes)
926 AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
927 AC_MSG_RESULT(no))
928
hasso71c0fb52003-05-25 20:18:13 +0000929dnl -----------------------------------
930dnl check ifra_lifetime of in6_aliasreq
931dnl -----------------------------------
932AC_MSG_CHECKING(whether in6_aliasreq.ifra_lifetime exist)
933AC_TRY_COMPILE([#include <sys/types.h>
934#include <netinet6/in6_var.h>
935],[static struct if6_aliasreq ac_i;int ac_j = sizeof (ac_i.ifra_lifetime);],
936[AC_MSG_RESULT(yes)
paula159ed92003-06-04 11:01:45 +0000937 AC_DEFINE(HAVE_IFRA_LIFETIME,,Have in6_aliasreq.ifra_lifetime)],
hasso71c0fb52003-05-25 20:18:13 +0000938 AC_MSG_RESULT(no))
939
paul7ea487b2003-03-17 02:05:07 +0000940dnl ---------------------------
941dnl check structure rt_addrinfo
942dnl ---------------------------
943AC_MSG_CHECKING(whether struct rt_addrinfo exist)
944AC_EGREP_HEADER(rt_addrinfo,
945net/route.h,
946[AC_MSG_RESULT(yes)
947 AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)],
948 AC_MSG_RESULT(no))
949
950dnl --------------------------
951dnl check structure in_pktinfo
952dnl --------------------------
953AC_MSG_CHECKING(whether struct in_pktinfo exist)
954AC_TRY_COMPILE([#include <netinet/in.h>
955],[struct in_pktinfo ac_x;],
956[AC_MSG_RESULT(yes)
957 AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
958 AC_MSG_RESULT(no))
959
960dnl --------------------------------------
961dnl checking for getrusage struct and call
962dnl --------------------------------------
963AC_MSG_CHECKING(whether getrusage is available)
964AC_TRY_COMPILE([#include <sys/resource.h>
965],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
966[AC_MSG_RESULT(yes)
967 AC_DEFINE(HAVE_RUSAGE,,rusage)],
968 AC_MSG_RESULT(no))
969
pauledd7c242003-06-04 13:59:38 +0000970dnl -------------------
971dnl capabilities checks
972dnl -------------------
973AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
974AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
975 [AC_MSG_RESULT(yes)
976 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
paule8f29842003-08-12 13:08:31 +0000977 quagga_ac_keepcaps="yes"],
pauledd7c242003-06-04 13:59:38 +0000978 AC_MSG_RESULT(no)
979)
paule8f29842003-08-12 13:08:31 +0000980if test x"${quagga_ac_keepcaps}" = x"yes"; then
pauledd7c242003-06-04 13:59:38 +0000981 AC_CHECK_HEADERS(sys/capability.h)
982fi
983if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
984 AC_CHECK_LIB(cap, cap_init,
985 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
986 LIBCAP="-lcap"
987 ]
988 )
989fi
990AC_SUBST(LIBCAP)
991
paulfb2d1502003-06-04 09:40:54 +0000992dnl ---------------------------
993dnl check for glibc 'backtrace'
994dnl ---------------------------
995if test "${glibc}" = "yes"; then
996 AC_CHECK_HEADER(execinfo.h)
997fi
998if test x"${ac_cv_header_execinfo_h}" = x"yes"; then
999 AC_CHECK_FUNC(backtrace,
1000 [AC_DEFINE(HAVE_GLIBC_BACKTRACE,,Glibc backtrace)]
1001 )
1002fi
1003
paul408ad942003-05-20 00:03:33 +00001004dnl ----------
1005dnl configure date
1006dnl ----------
1007CONFDATE=`date '+%Y%m%d'`
1008AC_SUBST(CONFDATE)
1009
paul7ea487b2003-03-17 02:05:07 +00001010dnl ------------------------------
paula159ed92003-06-04 11:01:45 +00001011dnl set paths for state directory
paul23bd12c2003-04-07 06:11:09 +00001012dnl ------------------------------
1013if test "${prefix}" = "NONE"; then
paule8f29842003-08-12 13:08:31 +00001014 quagga_statedir_prefix="";
paul23bd12c2003-04-07 06:11:09 +00001015else
paule8f29842003-08-12 13:08:31 +00001016 quagga_statedir_prefix=${prefix}
paul23bd12c2003-04-07 06:11:09 +00001017fi
1018if test "${localstatedir}" = '${prefix}/var'; then
paula159ed92003-06-04 11:01:45 +00001019 AC_CACHE_CHECK(state directory,ac_statedir,
paule8f29842003-08-12 13:08:31 +00001020 [for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
1021 ${quagga_statedir_prefix}/var/adm dnl
1022 ${quagga_statedir_prefix}/etc dnl
paula159ed92003-06-04 11:01:45 +00001023 /var/run dnl
1024 /var/adm dnl
1025 /etc dnl
1026 /dev/null;
paul23bd12c2003-04-07 06:11:09 +00001027 do
paule8f29842003-08-12 13:08:31 +00001028 test -d $QUAGGA_STATE_DIR && break
paul23bd12c2003-04-07 06:11:09 +00001029 done
paule8f29842003-08-12 13:08:31 +00001030 quagga_statedir=$QUAGGA_STATE_DIR])
paul23bd12c2003-04-07 06:11:09 +00001031else
paule8f29842003-08-12 13:08:31 +00001032 quagga_statedir=${localstatedir}
paula159ed92003-06-04 11:01:45 +00001033 AC_MSG_CHECKING(directory to use for state file)
paule8f29842003-08-12 13:08:31 +00001034 AC_MSG_RESULT(${quagga_statedir})
paul23bd12c2003-04-07 06:11:09 +00001035fi
paule8f29842003-08-12 13:08:31 +00001036if test $quagga_statedir = "/dev/null"; then
paula159ed92003-06-04 11:01:45 +00001037 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1038fi
1039
paule8f29842003-08-12 13:08:31 +00001040AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1041AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1042AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1043AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1044AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1045AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
jardin9e867fe2003-12-23 08:56:18 +00001046AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
paule8f29842003-08-12 13:08:31 +00001047AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1048AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1049AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1050AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1051AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1052AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1053AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
jardin9e867fe2003-12-23 08:56:18 +00001054AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
paul7ea487b2003-03-17 02:05:07 +00001055
1056dnl ---------------------------
1057dnl Check htonl works correctly
1058dnl ---------------------------
1059AC_MSG_CHECKING(for working htonl)
1060AC_CACHE_VAL(ac_cv_htonl_works, [
1061AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
1062#include <sys/types.h>
1063#endif
1064#ifdef HAVE_NETDB_H
1065#include <netdb.h>
1066#endif
1067#ifdef HAVE_NETINET_IN_H
1068#include <netinet/in.h>
1069#endif],
1070[htonl (0);],
1071ac_cv_htonl_works=yes,
1072ac_cv_htonl_works=no)])
1073AC_MSG_RESULT($ac_cv_htonl_works)
1074
paul6382b6f2003-05-20 00:17:45 +00001075AC_OUTPUT(Makefile lib/Makefile zebra/Makefile ripd/Makefile
1076 ripngd/Makefile bgpd/Makefile ospfd/Makefile
jardin9e867fe2003-12-23 08:56:18 +00001077 ospf6d/Makefile isisd/Makefile vtysh/Makefile doc/Makefile
paul6382b6f2003-05-20 00:17:45 +00001078 ospfclient/Makefile
jardina4d2a0d2004-01-10 20:42:35 +00001079 redhat/Makefile redhat/quagga.spec
paulfa1253d2003-09-24 05:09:26 +00001080 lib/version.h)
paul7ea487b2003-03-17 02:05:07 +00001081
1082echo "
1083zebra configuration
1084-------------------
paulfa1253d2003-09-24 05:09:26 +00001085quagga version : ${PACKAGE_VERSION}
paul7ea487b2003-03-17 02:05:07 +00001086host operationg system : ${host_os}
1087source code location : ${srcdir}
1088compiler : ${CC}
1089compiler flags : ${CFLAGS}
hasso71c0fb52003-05-25 20:18:13 +00001090linker flags : ${LDFLAGS} ${LIBS}
paule8f29842003-08-12 13:08:31 +00001091state file directory : ${quagga_statedir}
pauldc7a2bf2003-10-22 00:07:44 +00001092config file directory : `eval echo \`echo ${sysconfdir}\``
gdtd6b72f72003-12-03 17:24:27 +00001093example directory : `eval echo \`echo ${exampledir}\``
paul8d4aee52003-06-06 00:30:35 +00001094user to run as : ${enable_user}
1095group to run as : ${enable_group}
1096group for vty sockets : ${enable_vty_group}
gdtaa593d52003-12-22 20:15:53 +00001097config file mask : ${enable_configfile_mask}
1098log file mask : ${enable_logfile_mask}
pauldc7a2bf2003-10-22 00:07:44 +00001099
1100The above user and group must have read/write access to the state file
1101directory and to the config files in the config file directory.
paul7ea487b2003-03-17 02:05:07 +00001102"