blob: e7df8d0605e15e5d556676a7449efe9d12dfe831 [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##
paul41c14a12004-07-26 19:27:51 +00008## $Id: configure.ac,v 1.58 2004/07/26 19:27:51 paul 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 -----------------------------------------
paul27eebb32004-07-22 18:16:59 +000049dnl (Wall is gcc specific... have to make sure
50dnl gcc is being used before setting it)
51dnl
paul7ea487b2003-03-17 02:05:07 +000052if test "x$cflags_specified" = "x" ; then
paul27eebb32004-07-22 18:16:59 +000053 CFLAGS="$CFLAGS -O"
paul7ea487b2003-03-17 02:05:07 +000054fi
55
56dnl --------------
57dnl Check programs
58dnl --------------
59AC_PROG_CPP
60AC_PROG_INSTALL
61AC_PROG_MAKE_SET
62AC_CHECK_TOOL(AR, ar)
63AC_CHECK_TOOL(RANLIB, ranlib, :)
64
65dnl ---------
66dnl AIX check
67dnl ---------
68AC_AIX
69
gdt87efd642004-06-30 17:36:11 +000070dnl -------
71dnl libtool
72dnl -------
73AM_PROG_LIBTOOL
74
paul7ea487b2003-03-17 02:05:07 +000075dnl ----------------------
76dnl Packages configuration
77dnl ----------------------
78AC_ARG_ENABLE(vtysh,
gdtfc9d0742004-06-30 14:25:12 +000079[ --enable-vtysh include integrated vty shell for Quagga])
paul7ea487b2003-03-17 02:05:07 +000080AC_ARG_ENABLE(ipv6,
81[ --disable-ipv6 turn off IPv6 related features and daemons])
82AC_ARG_ENABLE(zebra,
83[ --disable-zebra do not build zebra daemon])
84AC_ARG_ENABLE(bgpd,
85[ --disable-bgpd do not build bgpd])
86AC_ARG_ENABLE(ripd,
87[ --disable-ripd do not build ripd])
88AC_ARG_ENABLE(ripngd,
89[ --disable-ripngd do not build ripngd])
90AC_ARG_ENABLE(ospfd,
91[ --disable-ospfd do not build ospfd])
paul7ea487b2003-03-17 02:05:07 +000092AC_ARG_ENABLE(ospf6d,
93[ --disable-ospf6d do not build ospf6d])
jardin9e867fe2003-12-23 08:56:18 +000094AC_ARG_ENABLE(isisd,
95[ --disable-isisd do not build isisd])
paul7ea487b2003-03-17 02:05:07 +000096AC_ARG_ENABLE(bgp-announce,
97[ --disable-bgp-announce, turn off BGP route announcement])
98AC_ARG_ENABLE(netlink,
99[ --enable-netlink force to use Linux netlink interface])
100AC_ARG_ENABLE(broken-aliases,
101[ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
102AC_ARG_ENABLE(snmp,
103[ --enable-snmp enable SNMP support])
104AC_ARG_WITH(libpam,
105[ --with-libpam use libpam for PAM support in vtysh])
hasso71c0fb52003-05-25 20:18:13 +0000106AC_ARG_ENABLE(tcp-zebra,
paul7ea487b2003-03-17 02:05:07 +0000107[ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon])
paul7ea487b2003-03-17 02:05:07 +0000108AC_ARG_ENABLE(opaque-lsa,
paul1ef74ef2003-03-21 15:16:05 +0000109[ --enable-opaque-lsa enable OSPF Opaque-LSA with OSPFAPI support (RFC2370)])
110AC_ARG_ENABLE(ospfapi,
111[ --disable-ospfapi do not build OSPFAPI to access the OSPF LSA Database,
112 (this is the default if --enable-opaque-lsa is not set)])
113AC_ARG_ENABLE(ospfclient,
114[ --disable-ospfclient do not build OSPFAPI client for OSPFAPI,
115 (this is the default if --disable-ospfapi is set)])
paul7ea487b2003-03-17 02:05:07 +0000116AC_ARG_ENABLE(ospf-te,
117[ --enable-ospf-te enable Traffic Engineering Extension to OSPF])
118AC_ARG_ENABLE(multipath,
119[ --enable-multipath=ARG enable multipath function, ARG must be digit])
paule8f29842003-08-12 13:08:31 +0000120AC_ARG_ENABLE(quagga_user,
121[ --enable-user=ARG user to run Quagga suite as (default quagga)])
122AC_ARG_ENABLE(quagga_group,
123[ --enable-group=ARG group to run Quagga suite as (default quagga)])
pauledd7c242003-06-04 13:59:38 +0000124AC_ARG_ENABLE(vty_group,
125[ --enable-vty-group=ARG set vty sockets to have specified group as owner])
gdtaa593d52003-12-22 20:15:53 +0000126AC_ARG_ENABLE(configfile_mask,
127[ --enable-configfile-mask=ARG set mask for config files])
128AC_ARG_ENABLE(logfile_mask,
129[ --enable-logfile-mask=ARG set mask for log files])
pauledd7c242003-06-04 13:59:38 +0000130
hasso71c0fb52003-05-25 20:18:13 +0000131AC_ARG_ENABLE(rtadv,
gdtd2a0ccc2003-12-03 18:13:48 +0000132[ --disable-rtadv disable IPV6 router advertisement feature])
hassoca776982004-06-12 14:33:05 +0000133AC_ARG_ENABLE(irdp,
134[ --enable-irdp enable IRDP server support in zebra])
hasso41d3fc92004-04-06 11:59:00 +0000135AC_ARG_ENABLE(capabilities,
136[ --disable-capabilities disable using POSIX capabilities])
paul7ea487b2003-03-17 02:05:07 +0000137
138if test "${enable_broken_aliases}" = "yes"; then
139 if test "${enable_netlink}" = "yes"
140 then
141 echo "Sorry, you can't use netlink with broken aliases"
142 exit 1
143 fi
144 AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
145 enable_netlink=no
146fi
147
148if test "${enable_tcp_zebra}" = "yes"; then
149 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
150fi
151
paul7ea487b2003-03-17 02:05:07 +0000152if test "${enable_opaque_lsa}" = "yes"; then
153 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
154fi
155
156if test "${enable_ospf_te}" = "yes"; then
157 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
158 AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
159fi
160
gdtd2a0ccc2003-12-03 18:13:48 +0000161AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
162if test "${enable_rtadv}" != "no"; then
hasso71c0fb52003-05-25 20:18:13 +0000163 AC_MSG_RESULT(yes)
gdtd2a0ccc2003-12-03 18:13:48 +0000164 AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
paul2487bea2003-05-25 23:51:31 +0000165else
166 AC_MSG_RESULT(no)
hasso71c0fb52003-05-25 20:18:13 +0000167fi
paul7ea487b2003-03-17 02:05:07 +0000168
hassoca776982004-06-12 14:33:05 +0000169if test "${enable_irdp}" = "yes"; then
170 AC_DEFINE(HAVE_IRDP,, IRDP )
171fi
172
paul79cb2162003-06-06 12:19:53 +0000173if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
paule8f29842003-08-12 13:08:31 +0000174 enable_user="quagga"
pauledd7c242003-06-04 13:59:38 +0000175elif test "${enable_user}" = "no"; then
176 enable_user="root"
177fi
paule8f29842003-08-12 13:08:31 +0000178AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
pauledd7c242003-06-04 13:59:38 +0000179
paul79cb2162003-06-06 12:19:53 +0000180if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
paule8f29842003-08-12 13:08:31 +0000181 enable_group="quagga"
pauledd7c242003-06-04 13:59:38 +0000182elif test "${enable_group}" = "no"; then
183 enable_group="root"
184fi
paule8f29842003-08-12 13:08:31 +0000185AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
pauledd7c242003-06-04 13:59:38 +0000186
187if test x"${enable_vty_group}" = x"yes" ; then
paul8d4aee52003-06-06 00:30:35 +0000188 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
paul79cb2162003-06-06 12:19:53 +0000189elif test x"${enable_vty_group}" != x""; then
paul8d4aee52003-06-06 00:30:35 +0000190 if test x"${enable_vty_group}" != x"no"; then
pauledd7c242003-06-04 13:59:38 +0000191 AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
192 fi
193fi
194
gdtaa593d52003-12-22 20:15:53 +0000195enable_configfile_mask=${enable_configfile_mask:-0600}
196AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
197
198enable_logfile_mask=${enable_logfile_mask:-0600}
199AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
200
paul7ea487b2003-03-17 02:05:07 +0000201changequote(, )dnl
202
203MULTIPATH_NUM=1
204
205case "${enable_multipath}" in
206 [0-9]|[1-9][0-9])
207 MULTIPATH_NUM="${enable_multipath}"
208 ;;
209 "")
210 ;;
211 *)
212 echo "Please specify digit to --enable-multipath ARG."
213 exit 1
214 ;;
215esac
216
217changequote([, ])dnl
218
219AC_SUBST(MULTIPATH_NUM)
220
221dnl -------------------
222dnl Check header files.
223dnl -------------------
pauldc7a2bf2003-10-22 00:07:44 +0000224AC_HEADER_STDC
225AC_CHECK_HEADERS([string.h stropts.h sys/conf.h sys/ksym.h sys/time.h \
226 sys/times.h sys/select.h sys/sysctl.h sys/sockio.h \
227 sys/types.h linux/version.h kvm.h netdb.h asm/types.h \
228 libutil.h limits.h])
229
paul835b7f12003-10-30 21:59:57 +0000230AC_CHECK_HEADERS([sys/socket.h netinet/in_systm.h netinet/in.h \
paulf3bd1a72003-11-02 07:29:11 +0000231 net/if_dl.h net/netopt.h inet/nd.h net/route.h \
paul835b7f12003-10-30 21:59:57 +0000232 net/if.h net/if_var.h netinet/in_var.h])
pauldc7a2bf2003-10-22 00:07:44 +0000233
gdtfa3232e2003-12-03 17:52:30 +0000234dnl V6 headers are checked below, after we check for v6
paul7ea487b2003-03-17 02:05:07 +0000235
236dnl check some types
237AC_C_CONST
238dnl AC_TYPE_PID_T
239AC_TYPE_SIGNAL
240
241dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
242case "$host" in
paul19877dd2004-05-11 10:49:35 +0000243 [*-sunos5.[6-8]*] | [*-solaris2.[6-8]*])
paul7ea487b2003-03-17 02:05:07 +0000244 opsys=sol2-6
paul19877dd2004-05-11 10:49:35 +0000245 AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.8)
246 AC_DEFINE(SUNOS_5, 1, SunOS 5)
paul7ea487b2003-03-17 02:05:07 +0000247 AC_CHECK_LIB(xnet, main)
248 CURSES=-lcurses
249 ;;
paul19877dd2004-05-11 10:49:35 +0000250 [*-sunos5.[8-9]] | [*-sunos5.1[0-9]] \
251 | [*-solaris2.[8-9]] | [*-solaris2.1[0-9]])
252 opsys=sol9
253 AC_DEFINE(SUNOS_59,,SunOS 5.9 up)
254 AC_DEFINE(SUNOS_5, 1, SunOS 5)
255 AC_CHECK_LIB(socket, main)
256 AC_CHECK_LIB(nsl, main)
257 CURSES=-lcurses
258 ;;
paul7ea487b2003-03-17 02:05:07 +0000259 *-sunos5* | *-solaris2*)
paul19877dd2004-05-11 10:49:35 +0000260 AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
paul7ea487b2003-03-17 02:05:07 +0000261 AC_CHECK_LIB(socket, main)
262 AC_CHECK_LIB(nsl, main)
263 CURSES=-lcurses
264 ;;
265 *-linux-*)
266 opsys=gnu-linux
267 AC_DEFINE(GNU_LINUX,,GNU Linux)
268 ;;
269 *-nec-sysv4*)
270 AC_CHECK_LIB(nsl, gethostbyname)
271 AC_CHECK_LIB(socket, socket)
272 ;;
273 *-freebsd3.2)
274 AC_DEFINE(FREEBSD_32,,FreeBSD 3.2)
275 ;;
276 *-openbsd*)
277 opsys=openbsd
278 AC_DEFINE(OPEN_BSD,,OpenBSD)
279 ;;
280 *-bsdi*)
281 opsys=bsdi
282 OTHER_METHOD="mtu_kvm.o"
283 AC_CHECK_LIB(kvm, main)
284 ;;
paul49e3b3c2003-10-23 20:39:50 +0000285 *-irix6.5)
pauldc7a2bf2003-10-22 00:07:44 +0000286 opsys=irix
287 AC_DEFINE(IRIX_65,,IRIX 6.5)
288 ;;
paul7ea487b2003-03-17 02:05:07 +0000289esac
290
291dnl ---------------------
292dnl Integrated VTY option
293dnl ---------------------
294case "${enable_vtysh}" in
295 "yes") VTYSH="vtysh";
296 AC_DEFINE(VTYSH,,VTY shell)
gdtfc9d0742004-06-30 14:25:12 +0000297 AC_PATH_PROG(PERL, perl)
298dnl Vtysh uses libreadline, which looks for termcap functions at
299dnl configure time. We follow readline's search order.
300dnl The required procedures are in libtermcap on NetBSD, in
301dnl [TODO] on Linux, and in [TODO] on Solaris.
302 AC_CHECK_LIB(termcap, tputs, ,
303 AC_CHECK_LIB(tinfo, tputs, ,
304 AC_CHECK_LIB(curses, tputs, ,
305 AC_CHECK_LIB(ncurses, tputs))))
paul7ea487b2003-03-17 02:05:07 +0000306 AC_CHECK_LIB(readline, main)
307 if test $ac_cv_lib_readline_main = no; then
gdtfc9d0742004-06-30 14:25:12 +0000308 AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
paul7ea487b2003-03-17 02:05:07 +0000309 fi
310 AC_CHECK_HEADER(readline/history.h)
311 if test $ac_cv_header_readline_history_h = no;then
312 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
313 fi
paul3d3de8c2003-05-23 10:33:49 +0000314 AC_CHECK_LIB(readline, rl_completion_matches)
315 if test $ac_cv_lib_readline_rl_completion_matches = no; then
316 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
317 fi
318 ;;
paul7ea487b2003-03-17 02:05:07 +0000319 "no" ) VTYSH="";;
320 * ) ;;
321esac
322
323dnl ----------
324dnl PAM module
325dnl ----------
326if test "$with_libpam" = "yes"; then
paul24cd4352003-05-06 12:16:27 +0000327 AC_CHECK_HEADER(security/pam_misc.h)
328 if test "$ac_cv_header_security_pam_misc_h" = yes; then
329 AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
330 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
331 pam_conv_func="misc_conv"
paul24cd4352003-05-06 12:16:27 +0000332 fi
paul24cd4352003-05-06 12:16:27 +0000333 AC_CHECK_HEADER(security/openpam.h)
334 if test "$ac_cv_header_security_openpam_h" = yes; then
335 AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
336 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
337 pam_conv_func="openpam_ttyconv"
paul24cd4352003-05-06 12:16:27 +0000338 fi
339 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
340 AC_MSG_WARN([*** pam support will not be built ***])
341 with_libpam="no"
342 fi
343fi
344
345if test "$with_libpam" = "yes"; then
paul7ea487b2003-03-17 02:05:07 +0000346dnl took this test from proftpd's configure.in and suited to our needs
347dnl -------------------------------------------------------------------------
348dnl
349dnl This next check looks funky due to a linker problem with some versions
350dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
351dnl omitted requiring libdl linking information. PAM-0.72 or better ships
352dnl with RedHat 6.2 and Debian 2.2 or better.
353AC_CHECK_LIB(pam, pam_start,
paul24cd4352003-05-06 12:16:27 +0000354 [AC_CHECK_LIB(pam, $pam_conv_func,
paul7ea487b2003-03-17 02:05:07 +0000355 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
356 LIBPAM="-lpam"],
357 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
358 LIBPAM="-lpam -lpam_misc"]
359 )
360 ],
361
362 [AC_CHECK_LIB(pam, pam_end,
paul24cd4352003-05-06 12:16:27 +0000363 [AC_CHECK_LIB(pam, $pam_conv_func,
paula159ed92003-06-04 11:01:45 +0000364 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul7ea487b2003-03-17 02:05:07 +0000365 LIBPAM="-lpam -ldl"],
paula159ed92003-06-04 11:01:45 +0000366 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul7ea487b2003-03-17 02:05:07 +0000367 LIBPAM="-lpam -ldl -lpam_misc"]
368 )
369 ],AC_MSG_WARN([*** pam support will not be built ***]),
370 [-ldl])
371 ]
372)
373fi
374AC_SUBST(LIBPAM)
375
376dnl -------------------------------
377dnl Endian-ness check
378dnl -------------------------------
379AC_WORDS_BIGENDIAN
380
381dnl -------------------------------
382dnl check the size in byte of the C
383dnl -------------------------------
384dnl AC_CHECK_SIZEOF(char)
385dnl AC_CHECK_SIZEOF(int)
386dnl AC_CHECK_SIZEOF(short)
387dnl AC_CHECK_SIZEOF(long)
388
389dnl ----------------------------
390dnl check existance of functions
391dnl ----------------------------
paul49e3b3c2003-10-23 20:39:50 +0000392AC_CHECK_FUNCS(memset memcpy strerror inet_aton daemon snprintf vsnprintf \
paul04bd4842003-10-24 04:24:39 +0000393 strlcat strlcpy if_nametoindex if_indextoname getifaddrs \
394 fcntl)
paula159ed92003-06-04 11:01:45 +0000395AC_CHECK_FUNCS(setproctitle, ,
396 [AC_CHECK_LIB(util, setproctitle,
397 [LIBS="$LIBS -lutil"
398 AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
399 ]
400 )
401 ]
402)
paul7ea487b2003-03-17 02:05:07 +0000403
404dnl ------------------------------------
405dnl Determine routing get and set method
406dnl ------------------------------------
407AC_MSG_CHECKING(zebra between kernel interface method)
408if test x"$opsys" = x"gnu-linux"; then
409 if test "${enable_netlink}" = "yes";then
410 AC_MSG_RESULT(netlink)
411 RT_METHOD=rt_netlink.o
412 AC_DEFINE(HAVE_NETLINK,,netlink)
413 netlink=yes
414 elif test "${enable_netlink}" = "no"; then
415 AC_MSG_RESULT(ioctl)
416 RT_METHOD=rt_ioctl.o
417 netlink=no
418 else
419 AC_MSG_RESULT(netlink)
420 RT_METHOD=rt_netlink.o
421 AC_DEFINE(HAVE_NETLINK,,netlink)
422 netlink=yes
423 fi
paul19877dd2004-05-11 10:49:35 +0000424elif test x"$opsys" = x"sol2-6";then
425 AC_MSG_RESULT(Route socket)
426 KERNEL_METHOD="kernel_socket.o"
427 RT_METHOD="rt_socket.o"
428elif test x"$opsys" = x"sol9";then
429 AC_MSG_RESULT(Route socket)
430 KERNEL_METHOD="kernel_socket.o"
431 RT_METHOD="rt_socket.o"
432elif test "$opsys" = "irix" ; then
433 AC_MSG_RESULT(Route socket)
434 KERNEL_METHOD="kernel_socket.o"
435 RT_METHOD="rt_socket.o"
paul7ea487b2003-03-17 02:05:07 +0000436else
paul19877dd2004-05-11 10:49:35 +0000437 AC_TRY_RUN([#include <errno.h>
paul7ea487b2003-03-17 02:05:07 +0000438#include <sys/types.h>
439#include <sys/socket.h>
440
441main ()
442{
443 int ac_sock;
444
445 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
446 if (ac_sock < 0 && errno == EINVAL)
447 exit (1);
448 exit (0);
449}],
450 [KERNEL_METHOD=kernel_socket.o
451 RT_METHOD=rt_socket.o
452 AC_MSG_RESULT(socket)],
453 [RT_METHOD=rt_ioctl.o
454 AC_MSG_RESULT(ioctl)],
455 [KERNEL_METHOD=kernel_socket.o
456 RT_METHOD=rt_socket.o
457 AC_MSG_RESULT(socket)])
paul7ea487b2003-03-17 02:05:07 +0000458fi
459AC_SUBST(RT_METHOD)
460AC_SUBST(KERNEL_METHOD)
461AC_SUBST(OTHER_METHOD)
462
463dnl ------------------------------
464dnl check kernel route read method
465dnl ------------------------------
466AC_CACHE_CHECK(route read method check, zebra_rtread,
467[if test "$netlink" = yes; then
468 RTREAD_METHOD="rtread_netlink.o"
469 zebra_rtread="netlink"
470else
471for zebra_rtread in /proc/net/route /dev/ip /dev/null;
472do
473 test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
474done
475case $zebra_rtread in
476 "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
477 zebra_rtread="proc";;
paul9c30ab62003-07-08 08:36:17 +0000478 "/dev/ip")
479 case "$host" in
480 *-freebsd*) RTREAD_METHOD=rtread_sysctl.o
481 zebra_rtread="sysctl";;
482 *) RTREAD_METHOD="rtread_getmsg.o"
483 zebra_rtread="getmsg";;
484 esac;;
paul7ea487b2003-03-17 02:05:07 +0000485 *) RTREAD_METHOD="rtread_sysctl.o"
486 zebra_rtread="sysctl";;
487esac
488fi])
489AC_SUBST(RTREAD_METHOD)
490
491dnl -----------------------------
492dnl check interface lookup method
493dnl -----------------------------
paul19877dd2004-05-11 10:49:35 +0000494IOCTL_METHOD=ioctl.o
paul7ea487b2003-03-17 02:05:07 +0000495AC_MSG_CHECKING(interface looking up method)
496if test "$netlink" = yes; then
497 AC_MSG_RESULT(netlink)
498 IF_METHOD=if_netlink.o
paul19877dd2004-05-11 10:49:35 +0000499elif test "$opsys" = "sol2-6";then
500 AC_MSG_RESULT(Solaris GIF)
501 IF_METHOD=if_ioctl.o
502elif test "$opsys" = "sol9";then
503 AC_MSG_RESULT(Solaris GLIF)
504 IF_METHOD=if_ioctl_solaris.o
505 IOCTL_METHOD=ioctl_solaris.o
506elif test "$opsys" = "irix" ; then
507 AC_MSG_RESULT(IRIX)
508 IF_METHOD=if_ioctl.o
509elif test "$opsys" = "openbsd";then
510 AC_MSG_RESULT(openbsd)
511 IF_METHOD=if_ioctl.o
512elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
513 AC_MSG_RESULT(sysctl)
paul7ea487b2003-03-17 02:05:07 +0000514 IF_METHOD=if_sysctl.o
515 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
paul19877dd2004-05-11 10:49:35 +0000516else
paul7ea487b2003-03-17 02:05:07 +0000517 AC_MSG_RESULT(ioctl)
518 IF_METHOD=if_ioctl.o
paul7ea487b2003-03-17 02:05:07 +0000519fi
520AC_SUBST(IF_METHOD)
paul19877dd2004-05-11 10:49:35 +0000521AC_SUBST(IOCTL_METHOD)
paul7ea487b2003-03-17 02:05:07 +0000522
523dnl -----------------------
524dnl check proc file system.
525dnl -----------------------
526if test -r /proc/net/dev; then
527 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
528 IF_PROC=if_proc.o
529fi
530
531if test -r /proc/net/if_inet6; then
532 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
533 IF_PROC=if_proc.o
534fi
535AC_SUBST(IF_PROC)
536
537dnl -----------------------------
538dnl check ipforward detect method
539dnl -----------------------------
540AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
541[for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
542do
543 test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
544done
545case $zebra_ipforward_path in
546 "/proc/net/snmp") IPFORWARD=ipforward_proc.o
547 zebra_ipforward_path="proc";;
548 "/dev/ip")
549 case "$host" in
550 *-nec-sysv4*) IPFORWARD=ipforward_ews.o
551 zebra_ipforward_path="ews";;
paul9c30ab62003-07-08 08:36:17 +0000552 *-freebsd*) IPFORWARD=ipforward_sysctl.o
553 zebra_ipforward_path="sysctl";;
paul7ea487b2003-03-17 02:05:07 +0000554 *) IPFORWARD=ipforward_solaris.o
555 zebra_ipforward_path="solaris";;
556 esac;;
557 *) IPFORWARD=ipforward_sysctl.o
558 zebra_ipforward_path="sysctl";;
559esac])
560AC_SUBST(IPFORWARD)
561
562AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
563
564dnl ----------
565dnl IPv6 check
566dnl ----------
567AC_MSG_CHECKING(whether does this OS have IPv6 stack)
568if test "${enable_ipv6}" = "no"; then
569 AC_MSG_RESULT(disabled)
570else
571dnl ----------
572dnl INRIA IPv6
573dnl ----------
paula159ed92003-06-04 11:01:45 +0000574 if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
575 zebra_cv_ipv6=yes
576 AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
577 AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
578 RIPNGD="ripngd"
579 OSPF6D="ospf6d"
580 LIB_IPV6=""
581 AC_MSG_RESULT(INRIA IPv6)
paul7ea487b2003-03-17 02:05:07 +0000582dnl ---------
583dnl KAME IPv6
584dnl ---------
paula159ed92003-06-04 11:01:45 +0000585 elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
586 zebra_cv_ipv6=yes
587 AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
588 AC_DEFINE(KAME,1,KAME IPv6)
589 RIPNGD="ripngd"
590 OSPF6D="ospf6d"
591 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
paul7ea487b2003-03-17 02:05:07 +0000592 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +0000593 fi
594 AC_MSG_RESULT(KAME)
hasso71c0fb52003-05-25 20:18:13 +0000595dnl -------------------------
596dnl MUSICA IPv6
597dnl default host check
598dnl It is not used by Kheops
599dnl -------------------------
paula159ed92003-06-04 11:01:45 +0000600 elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
601 zebra_cv_ipv6=yes
602 AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
603 AC_DEFINE(MUSICA,1,Musica IPv6 stack)
604 AC_DEFINE(KAME,1,KAME IPv6 stack)
605 RIPNGD="ripngd"
606 OSPF6D="ospf6d"
607 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
hasso71c0fb52003-05-25 20:18:13 +0000608 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +0000609 fi
610 AC_MSG_RESULT(MUSICA)
paul7ea487b2003-03-17 02:05:07 +0000611dnl ---------
612dnl NRL check
613dnl ---------
paula159ed92003-06-04 11:01:45 +0000614 elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
615 zebra_cv_ipv6=yes
616 AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
617 AC_DEFINE(NRL,1,NRL)
618 RIPNGD="ripngd"
619 OSPF6D="ospf6d"
620 if test x"$opsys" = x"bsdi";then
paul7ea487b2003-03-17 02:05:07 +0000621 AC_DEFINE(BSDI_NRL,,BSDI)
622 AC_MSG_RESULT(BSDI_NRL)
paula159ed92003-06-04 11:01:45 +0000623 else
paul7ea487b2003-03-17 02:05:07 +0000624 AC_MSG_RESULT(NRL)
paula159ed92003-06-04 11:01:45 +0000625 fi
paul19877dd2004-05-11 10:49:35 +0000626dnl ------------------------------------
627dnl Solaris 9, 10 and potentially higher
628dnl ------------------------------------
629 elif test x"$opsys" = x"sol9"; then
630 zebra_cv_ipv6=yes;
631 AC_DEFINE(HAVE_IPV6, 1, IPv6)
632 AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
633 RIPNGD="ripngd"
634 OSPF6D="ospf6d"
635 AC_MSG_RESULT(Solaris IPv6)
paul7ea487b2003-03-17 02:05:07 +0000636dnl ----------
637dnl Linux IPv6
638dnl ----------
paula159ed92003-06-04 11:01:45 +0000639 elif test "${enable_ipv6}" = "yes"; then
640 AC_EGREP_CPP(yes, [
641 #include <linux/version.h>
642 /* 2.1.128 or later */
643 #if LINUX_VERSION_CODE >= 0x020180
644 yes
645 #endif],
646 [zebra_cv_ipv6=yes
647 zebra_cv_linux_ipv6=yes
648 AC_MSG_RESULT(Linux IPv6)])
649 else
650 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
651 then
paul7ea487b2003-03-17 02:05:07 +0000652 zebra_cv_ipv6=yes
653 zebra_cv_linux_ipv6=yes
654 AC_MSG_RESULT(Linux IPv6)
paula159ed92003-06-04 11:01:45 +0000655 fi
656 fi
paul7ea487b2003-03-17 02:05:07 +0000657
paula159ed92003-06-04 11:01:45 +0000658 if test "$zebra_cv_linux_ipv6" = "yes";then
659 AC_MSG_CHECKING(for GNU libc >= 2.1)
660 AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
661 AC_EGREP_CPP(yes, [
paul7ea487b2003-03-17 02:05:07 +0000662#include <features.h>
663#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
664 yes
paula159ed92003-06-04 11:01:45 +0000665#endif],
666 [glibc=yes
667 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
668 AC_MSG_RESULT(yes)],
669 AC_MSG_RESULT(no)
670 )
671 RIPNGD="ripngd"
672 OSPF6D="ospf6d"
673 if test "$glibc" != "yes"; then
paul7ea487b2003-03-17 02:05:07 +0000674 INCLUDES="-I/usr/inet6/include"
675 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
676 LIB_IPV6="-L/usr/inet6/lib -linet6"
677 fi
paula159ed92003-06-04 11:01:45 +0000678 fi
679 fi
paul7ea487b2003-03-17 02:05:07 +0000680
681dnl -----------------------
682dnl Set IPv6 related values
683dnl -----------------------
paula159ed92003-06-04 11:01:45 +0000684 LIBS="$LIB_IPV6 $LIBS"
685 AC_SUBST(LIB_IPV6)
paul7ea487b2003-03-17 02:05:07 +0000686
paula159ed92003-06-04 11:01:45 +0000687 if test x"$RIPNGD" = x""; then
688 AC_MSG_RESULT(IPv4 only)
689 fi
paul7ea487b2003-03-17 02:05:07 +0000690fi
691
gdtfa3232e2003-12-03 17:52:30 +0000692dnl ------------------
693dnl IPv6 header checks
694dnl ------------------
695if test "x${zebra_cv_ipv6}" = "xyes"; then
696AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
697 netinet6/in6_var.h netinet6/nd6.h])
698fi
699
paul7ea487b2003-03-17 02:05:07 +0000700dnl --------------------
701dnl Daemon disable check
702dnl --------------------
703if test "${enable_zebra}" = "no";then
704 ZEBRA=""
705else
706 ZEBRA="zebra"
707fi
708
709if test "${enable_bgpd}" = "no";then
710 BGPD=""
711else
712 BGPD="bgpd"
713fi
714
715if test "${enable_ripd}" = "no";then
716 RIPD=""
717else
718 RIPD="ripd"
719fi
720
721if test "${enable_ospfd}" = "no";then
722 OSPFD=""
723else
724 OSPFD="ospfd"
725fi
726
paul1ef74ef2003-03-21 15:16:05 +0000727OSPFCLIENT=""
728if test "${enable_opaque_lsa}" = "yes"; then
729 if test "${enable_ospfapi}" != "no";then
paul9a569842003-03-28 01:45:13 +0000730 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
paul1ef74ef2003-03-21 15:16:05 +0000731
732 if test "${enable_ospfclient}" != "no";then
733 OSPFCLIENT="ospfclient"
734 fi
735 fi
736
paul7ea487b2003-03-17 02:05:07 +0000737fi
738
739case "${enable_ripngd}" in
740 "yes") RIPNGD="ripngd";;
741 "no" ) RIPNGD="";;
742 * ) ;;
743esac
744
745case "${enable_ospf6d}" in
746 "yes") OSPF6D="ospf6d";;
747 "no" ) OSPF6D="";;
748 * ) ;;
749esac
750
jardin9e867fe2003-12-23 08:56:18 +0000751case "${enable_isisd}" in
752 "yes") ISISD="isisd";;
753 "no" ) ISISD="";;
754 * ) ISISD="isisd";;
755esac
756
paul7ea487b2003-03-17 02:05:07 +0000757if test "${enable_bgp_announce}" = "no";then
758 AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
759fi
760
761AC_SUBST(ZEBRA)
762AC_SUBST(BGPD)
763AC_SUBST(RIPD)
764AC_SUBST(RIPNGD)
765AC_SUBST(OSPFD)
766AC_SUBST(OSPF6D)
jardin9e867fe2003-12-23 08:56:18 +0000767AC_SUBST(ISISD)
paul7ea487b2003-03-17 02:05:07 +0000768AC_SUBST(VTYSH)
769AC_SUBST(INCLUDES)
770AC_SUBST(CURSES)
771AC_SUBST(OSPFCLIENT)
paul1ef74ef2003-03-21 15:16:05 +0000772AC_SUBST(OSPFAPI)
paul7ea487b2003-03-17 02:05:07 +0000773AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
774AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
775AC_CHECK_LIB(crypt, crypt)
776AC_CHECK_LIB(resolv, res_init)
777AC_CHECK_LIB(m, main)
778
779dnl ---------------------------------------------------
780dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
781dnl ---------------------------------------------------
paula159ed92003-06-04 11:01:45 +0000782AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
783AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
784AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
paul7ea487b2003-03-17 02:05:07 +0000785
786dnl ---------------------------
787dnl check system has GNU regexp
788dnl ---------------------------
789dnl AC_MSG_CHECKING(whether system has GNU regex)
790AC_CHECK_LIB(c, regexec,
791[AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
792 LIB_REGEX=""],
793[LIB_REGEX="regex.o"])
794AC_SUBST(LIB_REGEX)
795
796dnl ------------------
797dnl check SNMP library
798dnl ------------------
799if test "${enable_snmp}" = "yes";then
800dnl AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
paul7ea487b2003-03-17 02:05:07 +0000801 if test "${HAVE_SNMP}" = ""; then
paul1ef74ef2003-03-21 15:16:05 +0000802 old_libs="${LIBS}"
803 LIBS="-L/usr/lib"
paul7ea487b2003-03-17 02:05:07 +0000804 unset ac_cv_lib_snmp_asn_parse_int
paul1ef74ef2003-03-21 15:16:05 +0000805 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
806 if test "${NEED_CRYPTO}" = ""; then
807 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes ])
808 else
809 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes; NEED_CRYPTO=yes;LIBS="$LIBS -lcrypto" ],,"-lcrypto")
810 fi
811 LIBS="${old_libs}"
paul7ea487b2003-03-17 02:05:07 +0000812 fi
paul1ef74ef2003-03-21 15:16:05 +0000813 if test "${HAVE_SNMP}" = ""; then
814 old_libs="${LIBS}"
815 LIBS="-L/usr/lib"
816 unset ac_cv_lib_snmp_asn_parse_int
817 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes, )
818 if test "${HAVE_SNMP}" = ""; then
819 unset ac_cv_lib_snmp_asn_parse_int
820 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
821 if test "${NEED_CRYPTO}" = "yes"; then
822 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
823 fi
824 fi
825 LIBS="${old_libs}"
826 fi
paul7ea487b2003-03-17 02:05:07 +0000827
828 if test "${HAVE_SNMP}" = ""; then
paul1ef74ef2003-03-21 15:16:05 +0000829 old_libs="${LIBS}"
830 LIBS="-L/usr/local/lib"
831 unset ac_cv_lib_snmp_asn_parse_int
832 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
833 if test "${HAVE_SNMP}" = ""; then
834 unset ac_cv_lib_snmp_asn_parse_int
835 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
836 if test "${NEED_CRYPTO}" = "yes"; then
837 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
838 fi
839 fi
840 LIBS="${old_libs}"
paul7ea487b2003-03-17 02:05:07 +0000841 fi
paul1ef74ef2003-03-21 15:16:05 +0000842
paul7ea487b2003-03-17 02:05:07 +0000843 if test "${HAVE_SNMP}" = "yes"; then
844 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
845 do
846 test -f "${ac_snmp}" && break
847 done
paul1ef74ef2003-03-21 15:16:05 +0000848
paul7ea487b2003-03-17 02:05:07 +0000849 case ${ac_snmp} in
850 /usr/include/net-snmp/*)
851 AC_DEFINE(HAVE_SNMP,,SNMP)
paul1ef74ef2003-03-21 15:16:05 +0000852 AC_DEFINE(HAVE_NETSNMP,,SNMP)
paul7ea487b2003-03-17 02:05:07 +0000853 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
paulac7c4bb2003-03-19 04:25:08 +0000854 CFLAGS="${CFLAGS} -I/usr/include/net-snmp -I/usr/include/net-snmp/library"
855 if test "${HAVE_NETSNMP}" = "yes"; then
paul1ef74ef2003-03-21 15:16:05 +0000856 LIBS="${LIBS} -lnetsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000857 else
paul1ef74ef2003-03-21 15:16:05 +0000858 LIBS="${LIBS} -lsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000859 fi
paul7ea487b2003-03-17 02:05:07 +0000860 ;;
861 /usr/include/ucd-snmp/*)
862 AC_DEFINE(HAVE_SNMP,,SNMP)
863 CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp"
864 LIBS="${LIBS} -lsnmp"
865 ;;
866 /usr/local/include/ucd-snmp/*)
867 AC_DEFINE(HAVE_SNMP,,SNMP)
868 CFLAGS="${CFLAGS} -I/usr/local/include/ucd-snmp"
869 LIBS="${LIBS} -L/usr/local/lib -lsnmp"
870 ;;
paulf3bd1a72003-11-02 07:29:11 +0000871 /usr/local/include/net-snmp/*)
872 AC_DEFINE(HAVE_SNMP,,SNMP)
873 AC_DEFINE(HAVE_NET_SNMP,,SNMP)
874 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
875 CFLAGS="${CFLAGS} -I/usr/local/include/net-snmp"
876 LIBS="${LIBS} -L/usr/local/lib -lnetsnmp"
877 ;;
paul7ea487b2003-03-17 02:05:07 +0000878 esac
879 if test "${NEED_CRYPTO}" = "yes"; then
880 LIBS="${LIBS} -lcrypto"
881 fi
882 fi
883fi
884
885dnl ----------------------------
886dnl check sa_len of sockaddr
887dnl ----------------------------
888AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
889AC_TRY_COMPILE([#include <sys/types.h>
890#include <sys/socket.h>
891],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
892[AC_MSG_RESULT(yes)
893 AC_DEFINE(HAVE_SA_LEN,,sa_len)],
894 AC_MSG_RESULT(no))
895
896dnl ----------------------------
897dnl check sin_len of sockaddr_in
898dnl ----------------------------
899AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
900AC_TRY_COMPILE([#include <sys/types.h>
901#include <netinet/in.h>
902],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
903[AC_MSG_RESULT(yes)
904 AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
905 AC_MSG_RESULT(no))
906
907dnl ----------------------------
908dnl check sun_len of sockaddr_un
909dnl ----------------------------
910AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
911AC_TRY_COMPILE([#include <sys/types.h>
912#include <sys/un.h>
913],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
914[AC_MSG_RESULT(yes)
915 AC_DEFINE(HAVE_SUN_LEN,,sun_len)],
916 AC_MSG_RESULT(no))
917
918dnl -----------------------------------
919dnl check sin6_scope_id of sockaddr_in6
920dnl -----------------------------------
921if test "$zebra_cv_ipv6" = yes; then
922 AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
923 AC_TRY_COMPILE([#include <sys/types.h>
924#include <netinet/in.h>
925],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
926[AC_MSG_RESULT(yes)
927 AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)],
928 AC_MSG_RESULT(no))
929fi
930
931dnl ----------------------------
932dnl check socklen_t exist or not
933dnl ----------------------------
934AC_MSG_CHECKING(whther socklen_t is defined)
935AC_TRY_COMPILE([#include <sys/types.h>
936#include <sys/socket.h>
937#include <netinet/in.h>
938],[socklen_t ac_x;],
939[AC_MSG_RESULT(yes)
940 AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)],
941 AC_MSG_RESULT(no))
942
943dnl ------------------------
944dnl check struct sockaddr_dl
945dnl ------------------------
946AC_MSG_CHECKING(whether struct sockaddr_dl exist)
947AC_EGREP_HEADER(sockaddr_dl,
948net/if_dl.h,
949[AC_MSG_RESULT(yes)
950 AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)],
951 AC_MSG_RESULT(no))
952
953dnl --------------------------
954dnl check structure ifaliasreq
955dnl --------------------------
956AC_MSG_CHECKING(whether struct ifaliasreq exist)
957AC_EGREP_HEADER(ifaliasreq,
958net/if.h,
959[AC_MSG_RESULT(yes)
960 AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)],
961 AC_MSG_RESULT(no))
962
963dnl ----------------------------
964dnl check structure in6_aliasreq
965dnl ----------------------------
hasso71c0fb52003-05-25 20:18:13 +0000966AC_MSG_CHECKING(whether struct in6_aliasreq exist)
paul7ea487b2003-03-17 02:05:07 +0000967AC_EGREP_HEADER(in6_aliasreq,
968netinet6/in6_var.h,
969[AC_MSG_RESULT(yes)
970 AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
971 AC_MSG_RESULT(no))
972
hasso71c0fb52003-05-25 20:18:13 +0000973dnl -----------------------------------
974dnl check ifra_lifetime of in6_aliasreq
975dnl -----------------------------------
976AC_MSG_CHECKING(whether in6_aliasreq.ifra_lifetime exist)
977AC_TRY_COMPILE([#include <sys/types.h>
978#include <netinet6/in6_var.h>
979],[static struct if6_aliasreq ac_i;int ac_j = sizeof (ac_i.ifra_lifetime);],
980[AC_MSG_RESULT(yes)
paula159ed92003-06-04 11:01:45 +0000981 AC_DEFINE(HAVE_IFRA_LIFETIME,,Have in6_aliasreq.ifra_lifetime)],
hasso71c0fb52003-05-25 20:18:13 +0000982 AC_MSG_RESULT(no))
983
paul7ea487b2003-03-17 02:05:07 +0000984dnl ---------------------------
985dnl check structure rt_addrinfo
986dnl ---------------------------
987AC_MSG_CHECKING(whether struct rt_addrinfo exist)
988AC_EGREP_HEADER(rt_addrinfo,
989net/route.h,
990[AC_MSG_RESULT(yes)
991 AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)],
992 AC_MSG_RESULT(no))
993
994dnl --------------------------
995dnl check structure in_pktinfo
996dnl --------------------------
997AC_MSG_CHECKING(whether struct in_pktinfo exist)
998AC_TRY_COMPILE([#include <netinet/in.h>
999],[struct in_pktinfo ac_x;],
1000[AC_MSG_RESULT(yes)
1001 AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
1002 AC_MSG_RESULT(no))
1003
1004dnl --------------------------------------
1005dnl checking for getrusage struct and call
1006dnl --------------------------------------
1007AC_MSG_CHECKING(whether getrusage is available)
1008AC_TRY_COMPILE([#include <sys/resource.h>
1009],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
1010[AC_MSG_RESULT(yes)
1011 AC_DEFINE(HAVE_RUSAGE,,rusage)],
1012 AC_MSG_RESULT(no))
1013
pauledd7c242003-06-04 13:59:38 +00001014dnl -------------------
1015dnl capabilities checks
1016dnl -------------------
hasso41d3fc92004-04-06 11:59:00 +00001017if test "${enable_capabilities}" != "no"; then
1018 AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1019 AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1020 [AC_MSG_RESULT(yes)
1021 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1022 quagga_ac_keepcaps="yes"],
1023 AC_MSG_RESULT(no)
pauledd7c242003-06-04 13:59:38 +00001024 )
hasso41d3fc92004-04-06 11:59:00 +00001025 if test x"${quagga_ac_keepcaps}" = x"yes"; then
1026 AC_CHECK_HEADERS(sys/capability.h)
1027 fi
1028 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1029 AC_CHECK_LIB(cap, cap_init,
1030 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1031 LIBCAP="-lcap"
1032 ]
1033 )
1034 fi
pauledd7c242003-06-04 13:59:38 +00001035fi
1036AC_SUBST(LIBCAP)
1037
paulfb2d1502003-06-04 09:40:54 +00001038dnl ---------------------------
1039dnl check for glibc 'backtrace'
1040dnl ---------------------------
1041if test "${glibc}" = "yes"; then
1042 AC_CHECK_HEADER(execinfo.h)
1043fi
1044if test x"${ac_cv_header_execinfo_h}" = x"yes"; then
1045 AC_CHECK_FUNC(backtrace,
1046 [AC_DEFINE(HAVE_GLIBC_BACKTRACE,,Glibc backtrace)]
1047 )
1048fi
1049
paul408ad942003-05-20 00:03:33 +00001050dnl ----------
1051dnl configure date
1052dnl ----------
1053CONFDATE=`date '+%Y%m%d'`
1054AC_SUBST(CONFDATE)
1055
paul7ea487b2003-03-17 02:05:07 +00001056dnl ------------------------------
paula159ed92003-06-04 11:01:45 +00001057dnl set paths for state directory
paul23bd12c2003-04-07 06:11:09 +00001058dnl ------------------------------
1059if test "${prefix}" = "NONE"; then
paule8f29842003-08-12 13:08:31 +00001060 quagga_statedir_prefix="";
paul23bd12c2003-04-07 06:11:09 +00001061else
paule8f29842003-08-12 13:08:31 +00001062 quagga_statedir_prefix=${prefix}
paul23bd12c2003-04-07 06:11:09 +00001063fi
1064if test "${localstatedir}" = '${prefix}/var'; then
paula159ed92003-06-04 11:01:45 +00001065 AC_CACHE_CHECK(state directory,ac_statedir,
paule8f29842003-08-12 13:08:31 +00001066 [for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
1067 ${quagga_statedir_prefix}/var/adm dnl
1068 ${quagga_statedir_prefix}/etc dnl
paula159ed92003-06-04 11:01:45 +00001069 /var/run dnl
1070 /var/adm dnl
1071 /etc dnl
1072 /dev/null;
paul23bd12c2003-04-07 06:11:09 +00001073 do
paule8f29842003-08-12 13:08:31 +00001074 test -d $QUAGGA_STATE_DIR && break
paul23bd12c2003-04-07 06:11:09 +00001075 done
paule8f29842003-08-12 13:08:31 +00001076 quagga_statedir=$QUAGGA_STATE_DIR])
paul23bd12c2003-04-07 06:11:09 +00001077else
paule8f29842003-08-12 13:08:31 +00001078 quagga_statedir=${localstatedir}
paula159ed92003-06-04 11:01:45 +00001079 AC_MSG_CHECKING(directory to use for state file)
paule8f29842003-08-12 13:08:31 +00001080 AC_MSG_RESULT(${quagga_statedir})
paul23bd12c2003-04-07 06:11:09 +00001081fi
paule8f29842003-08-12 13:08:31 +00001082if test $quagga_statedir = "/dev/null"; then
paula159ed92003-06-04 11:01:45 +00001083 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1084fi
1085
paule8f29842003-08-12 13:08:31 +00001086AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1087AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1088AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1089AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1090AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1091AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
jardin9e867fe2003-12-23 08:56:18 +00001092AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
paule8f29842003-08-12 13:08:31 +00001093AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1094AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1095AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1096AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1097AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1098AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1099AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
jardin9e867fe2003-12-23 08:56:18 +00001100AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
paul7ea487b2003-03-17 02:05:07 +00001101
1102dnl ---------------------------
1103dnl Check htonl works correctly
1104dnl ---------------------------
1105AC_MSG_CHECKING(for working htonl)
1106AC_CACHE_VAL(ac_cv_htonl_works, [
1107AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
1108#include <sys/types.h>
1109#endif
1110#ifdef HAVE_NETDB_H
1111#include <netdb.h>
1112#endif
1113#ifdef HAVE_NETINET_IN_H
1114#include <netinet/in.h>
1115#endif],
1116[htonl (0);],
1117ac_cv_htonl_works=yes,
1118ac_cv_htonl_works=no)])
1119AC_MSG_RESULT($ac_cv_htonl_works)
1120
paul6382b6f2003-05-20 00:17:45 +00001121AC_OUTPUT(Makefile lib/Makefile zebra/Makefile ripd/Makefile
1122 ripngd/Makefile bgpd/Makefile ospfd/Makefile
jardin9e867fe2003-12-23 08:56:18 +00001123 ospf6d/Makefile isisd/Makefile vtysh/Makefile doc/Makefile
paul6382b6f2003-05-20 00:17:45 +00001124 ospfclient/Makefile
gdtfc9d0742004-06-30 14:25:12 +00001125 vtysh/extract.pl
jardina4d2a0d2004-01-10 20:42:35 +00001126 redhat/Makefile redhat/quagga.spec
gdtb7a97f82004-07-23 16:23:56 +00001127 lib/version.h
paul41c14a12004-07-26 19:27:51 +00001128 tests/Makefile
gdtb7a97f82004-07-23 16:23:56 +00001129 ,
gdtfc9d0742004-06-30 14:25:12 +00001130 [chmod +x vtysh/extract.pl])
paul7ea487b2003-03-17 02:05:07 +00001131
1132echo "
1133zebra configuration
1134-------------------
paulfa1253d2003-09-24 05:09:26 +00001135quagga version : ${PACKAGE_VERSION}
paul7ea487b2003-03-17 02:05:07 +00001136host operationg system : ${host_os}
1137source code location : ${srcdir}
1138compiler : ${CC}
1139compiler flags : ${CFLAGS}
hasso71c0fb52003-05-25 20:18:13 +00001140linker flags : ${LDFLAGS} ${LIBS}
paule8f29842003-08-12 13:08:31 +00001141state file directory : ${quagga_statedir}
pauldc7a2bf2003-10-22 00:07:44 +00001142config file directory : `eval echo \`echo ${sysconfdir}\``
gdtd6b72f72003-12-03 17:24:27 +00001143example directory : `eval echo \`echo ${exampledir}\``
paul8d4aee52003-06-06 00:30:35 +00001144user to run as : ${enable_user}
1145group to run as : ${enable_group}
1146group for vty sockets : ${enable_vty_group}
gdtaa593d52003-12-22 20:15:53 +00001147config file mask : ${enable_configfile_mask}
1148log file mask : ${enable_logfile_mask}
pauldc7a2bf2003-10-22 00:07:44 +00001149
1150The above user and group must have read/write access to the state file
1151directory and to the config files in the config file directory.
paul7ea487b2003-03-17 02:05:07 +00001152"