blob: 586245569de153d666f256bb9d4f2cfd440e8a86 [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001##
2## Configure template file for Zebra.
3## autoconf will generate configure script.
4##
5## Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
6##
7AC_PREREQ(2.13)
8
9AC_INIT(lib/zebra.h)
paul1bb066b2003-03-17 01:18:55 +000010AM_INIT_AUTOMAKE(zebra, 0.94)
paul718e3742002-12-13 20:15:29 +000011AM_CONFIG_HEADER(config.h)
12
13dnl -----------------------------------
14dnl Get hostname and other information.
15dnl -----------------------------------
16AC_CANONICAL_HOST
17
18dnl ------------
19dnl Check CFLAGS
20dnl ------------
21AC_ARG_WITH(cflags,
22[ --with-cflags Set CFLAGS for use in compilation.])
23if test "x$with_cflags" != "x" ; then
24 CFLAGS="$with_cflags" ; cflags_specified=yes ;
25elif test -n "$CFLAGS" ; then
26 cflags_specified=yes ;
27fi
28
29dnl --------
30dnl Check CC
31dnl --------
32AC_PROG_CC
33
34dnl -----------------------------------------
35dnl If CLFAGS doesn\'t exist set default value
36dnl -----------------------------------------
37if test "x$cflags_specified" = "x" ; then
38 CFLAGS="$CFLAGS -Wall"
39fi
40
41dnl --------------
42dnl Check programs
43dnl --------------
44AC_PROG_CPP
45AC_PROG_INSTALL
46AC_PROG_MAKE_SET
47AC_CHECK_TOOL(AR, ar)
48AC_CHECK_TOOL(RANLIB, ranlib, :)
49
50dnl ---------
51dnl AIX check
52dnl ---------
53AC_AIX
54
55dnl ----------------------
56dnl Packages configuration
57dnl ----------------------
58AC_ARG_ENABLE(vtysh,
59[ --enable-vtysh, Make integrated VTY version of zebra])
60AC_ARG_ENABLE(ipv6,
61[ --disable-ipv6 turn off IPv6 related features and daemons])
62AC_ARG_ENABLE(zebra,
63[ --disable-zebra do not build zebra daemon])
64AC_ARG_ENABLE(bgpd,
65[ --disable-bgpd do not build bgpd])
66AC_ARG_ENABLE(ripd,
67[ --disable-ripd do not build ripd])
68AC_ARG_ENABLE(ripngd,
69[ --disable-ripngd do not build ripngd])
70AC_ARG_ENABLE(ospfd,
71[ --disable-ospfd do not build ospfd])
72AC_ARG_ENABLE(ospf6d,
73[ --disable-ospf6d do not build ospf6d])
74AC_ARG_ENABLE(bgp-announce,
75[ --disable-bgp-announce, turn off BGP route announcement])
76AC_ARG_ENABLE(netlink,
77[ --enable-netlink force to use Linux netlink interface])
78AC_ARG_ENABLE(broken-aliases,
79[ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
80AC_ARG_ENABLE(snmp,
81[ --enable-snmp enable SNMP support])
82AC_ARG_WITH(libpam,
83[ --with-libpam use libpam for PAM support in vtysh])
84AC_ARG_ENABLE(tcpsock,
85[ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon])
86dnl Temporary option until OSPF NSSA implementation complete
87AC_ARG_ENABLE(nssa,
88[ --enable-nssa enable OSPF NSSA option])
89AC_ARG_ENABLE(opaque-lsa,
paul68980082003-03-25 05:07:42 +000090[ --enable-opaque-lsa enable OSPF Opaque-LSA with OSPFAPI support (RFC2370)])
91AC_ARG_ENABLE(ospfapi,
92[ --disable-ospfapi do not build OSPFAPI to access the OSPF LSA Database,
93 (this is the default if --enable-opaque-lsa is not set)])
94AC_ARG_ENABLE(ospfclient,
95[ --disable-ospfclient do not build OSPFAPI client for OSPFAPI,
96 (this is the default if --disable-ospfapi is set)])
paul718e3742002-12-13 20:15:29 +000097AC_ARG_ENABLE(ospf-te,
98[ --enable-ospf-te enable Traffic Engineering Extension to OSPF])
99AC_ARG_ENABLE(multipath,
100[ --enable-multipath=ARG enable multipath function, ARG must be digit])
101
102dnl AC_ARG_ENABLE(rtadv,
103dnl [ --enable-rtadv enable IPV6 router advertisment option])
104
105if test "${enable_broken_aliases}" = "yes"; then
106 if test "${enable_netlink}" = "yes"
107 then
108 echo "Sorry, you can't use netlink with broken aliases"
109 exit 1
110 fi
paul1bb066b2003-03-17 01:18:55 +0000111 AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
paul718e3742002-12-13 20:15:29 +0000112 enable_netlink=no
113fi
114
115if test "${enable_tcp_zebra}" = "yes"; then
paul1bb066b2003-03-17 01:18:55 +0000116 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
paul718e3742002-12-13 20:15:29 +0000117fi
118
119if test "${enable_nssa}" = "yes"; then
paul1bb066b2003-03-17 01:18:55 +0000120 AC_DEFINE(HAVE_NSSA,,OSPF NSSA)
paul718e3742002-12-13 20:15:29 +0000121fi
122
123if test "${enable_opaque_lsa}" = "yes"; then
paul1bb066b2003-03-17 01:18:55 +0000124 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
paul718e3742002-12-13 20:15:29 +0000125fi
126
127if test "${enable_ospf_te}" = "yes"; then
paul1bb066b2003-03-17 01:18:55 +0000128 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
129 AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
paul718e3742002-12-13 20:15:29 +0000130fi
131
132dnl if test "${enable_rtadv}" = "yes"; then
133dnl AC_DEFINE(HAVE_RTADV)
134dnl fi
135
136changequote(, )dnl
137
138MULTIPATH_NUM=1
139
140case "${enable_multipath}" in
141 [0-9]|[1-9][0-9])
142 MULTIPATH_NUM="${enable_multipath}"
143 ;;
144 "")
145 ;;
146 *)
147 echo "Please specify digit to --enable-multipath ARG."
148 exit 1
149 ;;
150esac
151
152changequote([, ])dnl
153
154AC_SUBST(MULTIPATH_NUM)
155
156dnl -------------------
157dnl Check header files.
158dnl -------------------
159AC_STDC_HEADERS
160AC_CHECK_HEADERS(string.h stropts.h sys/conf.h sys/ksym.h sys/time.h sys/times.h sys/select.h sys/sysctl.h sys/sockio.h sys/types.h net/if_dl.h net/if_var.h linux/version.h kvm.h netdb.h netinet/in.h net/netopt.h netinet/in_var.h netinet/in6_var.h netinet/in6.h inet/nd.h asm/types.h netinet/icmp6.h netinet6/nd6.h libutil.h)
161
162dnl check some types
163AC_C_CONST
164dnl AC_TYPE_PID_T
165AC_TYPE_SIGNAL
166
167dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
168case "$host" in
169 *-sunos5.6* | *-solaris2.6*)
170 opsys=sol2-6
paul1bb066b2003-03-17 01:18:55 +0000171 AC_DEFINE(SUNOS_5,,SunOS 5)
paul718e3742002-12-13 20:15:29 +0000172 AC_CHECK_LIB(xnet, main)
173 CURSES=-lcurses
174 ;;
175 *-sunos5* | *-solaris2*)
paul1bb066b2003-03-17 01:18:55 +0000176 AC_DEFINE(SUNOS_5,,SunOS 5)
paul718e3742002-12-13 20:15:29 +0000177 AC_CHECK_LIB(socket, main)
178 AC_CHECK_LIB(nsl, main)
179 CURSES=-lcurses
180 ;;
181 *-linux-*)
182 opsys=gnu-linux
paul1bb066b2003-03-17 01:18:55 +0000183 AC_DEFINE(GNU_LINUX,,GNU Linux)
paul718e3742002-12-13 20:15:29 +0000184 ;;
185 *-nec-sysv4*)
186 AC_CHECK_LIB(nsl, gethostbyname)
187 AC_CHECK_LIB(socket, socket)
188 ;;
189 *-freebsd3.2)
paul1bb066b2003-03-17 01:18:55 +0000190 AC_DEFINE(FREEBSD_32,,FreeBSD 3.2)
paul718e3742002-12-13 20:15:29 +0000191 ;;
192 *-openbsd*)
193 opsys=openbsd
paul1bb066b2003-03-17 01:18:55 +0000194 AC_DEFINE(OPEN_BSD,,OpenBSD)
paul718e3742002-12-13 20:15:29 +0000195 ;;
196 *-bsdi*)
197 opsys=bsdi
198 OTHER_METHOD="mtu_kvm.o"
199 AC_CHECK_LIB(kvm, main)
200 ;;
201esac
202
paul718e3742002-12-13 20:15:29 +0000203dnl ---------------------
204dnl Integrated VTY option
205dnl ---------------------
206case "${enable_vtysh}" in
207 "yes") VTYSH="vtysh";
paul1bb066b2003-03-17 01:18:55 +0000208 AC_DEFINE(VTYSH,,VTY shell)
paul718e3742002-12-13 20:15:29 +0000209 AC_CHECK_LIB(tinfo, tputs, , AC_CHECK_LIB(ncurses, tputs))
210 AC_CHECK_LIB(readline, main)
211 if test $ac_cv_lib_readline_main = no; then
212 AC_MSG_ERROR([vtysh needs libreadline but was not found on your system.])
213 fi
214 AC_CHECK_HEADER(readline/history.h)
215 if test $ac_cv_header_readline_history_h = no;then
216 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
217 fi
218 ;;
219 "no" ) VTYSH="";;
220 * ) ;;
221esac
222
223dnl ----------
224dnl PAM module
225dnl ----------
226if test "$with_libpam" = "yes"; then
paul09f4b7a2003-05-17 15:40:21 +0000227 AC_CHECK_HEADER(security/pam_misc.h)
228 if test "$ac_cv_header_security_pam_misc_h" = yes; then
229 AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
230 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
231 pam_conv_func="misc_conv"
paul09f4b7a2003-05-17 15:40:21 +0000232 fi
paul09f4b7a2003-05-17 15:40:21 +0000233 AC_CHECK_HEADER(security/openpam.h)
234 if test "$ac_cv_header_security_openpam_h" = yes; then
235 AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
236 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
237 pam_conv_func="openpam_ttyconv"
paul09f4b7a2003-05-17 15:40:21 +0000238 fi
239 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
240 AC_MSG_WARN([*** pam support will not be built ***])
241 with_libpam="no"
242 fi
243fi
244
245if test "$with_libpam" = "yes"; then
paul718e3742002-12-13 20:15:29 +0000246dnl took this test from proftpd's configure.in and suited to our needs
247dnl -------------------------------------------------------------------------
248dnl
249dnl This next check looks funky due to a linker problem with some versions
250dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
251dnl omitted requiring libdl linking information. PAM-0.72 or better ships
252dnl with RedHat 6.2 and Debian 2.2 or better.
253AC_CHECK_LIB(pam, pam_start,
paul09f4b7a2003-05-17 15:40:21 +0000254 [AC_CHECK_LIB(pam, $pam_conv_func,
paul1bb066b2003-03-17 01:18:55 +0000255 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul718e3742002-12-13 20:15:29 +0000256 LIBPAM="-lpam"],
paul1bb066b2003-03-17 01:18:55 +0000257 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul718e3742002-12-13 20:15:29 +0000258 LIBPAM="-lpam -lpam_misc"]
259 )
260 ],
261
262 [AC_CHECK_LIB(pam, pam_end,
paul09f4b7a2003-05-17 15:40:21 +0000263 [AC_CHECK_LIB(pam, $pam_conv_func,
paul718e3742002-12-13 20:15:29 +0000264 [AC_DEFINE(USE_PAM)
265 LIBPAM="-lpam -ldl"],
266 [AC_DEFINE(USE_PAM)
267 LIBPAM="-lpam -ldl -lpam_misc"]
268 )
269 ],AC_MSG_WARN([*** pam support will not be built ***]),
270 [-ldl])
271 ]
272)
273fi
274AC_SUBST(LIBPAM)
275
276dnl -------------------------------
277dnl Endian-ness check
278dnl -------------------------------
paul1bb066b2003-03-17 01:18:55 +0000279AC_WORDS_BIGENDIAN
paul718e3742002-12-13 20:15:29 +0000280
281dnl -------------------------------
282dnl check the size in byte of the C
283dnl -------------------------------
284dnl AC_CHECK_SIZEOF(char)
285dnl AC_CHECK_SIZEOF(int)
286dnl AC_CHECK_SIZEOF(short)
287dnl AC_CHECK_SIZEOF(long)
288
289dnl ----------------------------
290dnl check existance of functions
291dnl ----------------------------
292AC_CHECK_FUNCS(bcopy bzero strerror inet_aton daemon snprintf vsnprintf strlcat strlcpy if_nametoindex if_indextoname getifaddrs)
293AC_CHECK_FUNCS(setproctitle, ,[AC_CHECK_LIB(util, setproctitle, [LIBS="$LIBS -lutil"; AC_DEFINE(HAVE_SETPROCTITLE)])])
294
295dnl ------------------------------------
296dnl Determine routing get and set method
297dnl ------------------------------------
298AC_MSG_CHECKING(zebra between kernel interface method)
299if test x"$opsys" = x"gnu-linux"; then
300 if test "${enable_netlink}" = "yes";then
301 AC_MSG_RESULT(netlink)
302 RT_METHOD=rt_netlink.o
paul1bb066b2003-03-17 01:18:55 +0000303 AC_DEFINE(HAVE_NETLINK,,netlink)
paul718e3742002-12-13 20:15:29 +0000304 netlink=yes
305 elif test "${enable_netlink}" = "no"; then
306 AC_MSG_RESULT(ioctl)
307 RT_METHOD=rt_ioctl.o
308 netlink=no
309 else
paul1bb066b2003-03-17 01:18:55 +0000310 AC_MSG_RESULT(netlink)
paul718e3742002-12-13 20:15:29 +0000311 RT_METHOD=rt_netlink.o
paul1bb066b2003-03-17 01:18:55 +0000312 AC_DEFINE(HAVE_NETLINK,,netlink)
313 netlink=yes
paul718e3742002-12-13 20:15:29 +0000314 fi
315else
316 if test "$opsys" = "sol2-6";then
317 AC_MSG_RESULT(solaris)
318 KERNEL_METHOD="kernel_socket.o"
319 RT_METHOD="rt_socket.o"
320 else
321 AC_TRY_RUN([#include <errno.h>
322#include <sys/types.h>
323#include <sys/socket.h>
324
325main ()
326{
327 int ac_sock;
328
329 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
330 if (ac_sock < 0 && errno == EINVAL)
331 exit (1);
332 exit (0);
333}],
paul1bb066b2003-03-17 01:18:55 +0000334 [KERNEL_METHOD=kernel_socket.o
paul718e3742002-12-13 20:15:29 +0000335 RT_METHOD=rt_socket.o
336 AC_MSG_RESULT(socket)],
337 [RT_METHOD=rt_ioctl.o
338 AC_MSG_RESULT(ioctl)],
339 [KERNEL_METHOD=kernel_socket.o
340 RT_METHOD=rt_socket.o
341 AC_MSG_RESULT(socket)])
342 fi
343fi
344AC_SUBST(RT_METHOD)
345AC_SUBST(KERNEL_METHOD)
346AC_SUBST(OTHER_METHOD)
347
348dnl ------------------------------
349dnl check kernel route read method
350dnl ------------------------------
351AC_CACHE_CHECK(route read method check, zebra_rtread,
352[if test "$netlink" = yes; then
353 RTREAD_METHOD="rtread_netlink.o"
354 zebra_rtread="netlink"
355else
356for zebra_rtread in /proc/net/route /dev/ip /dev/null;
357do
358 test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
359done
360case $zebra_rtread in
361 "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
362 zebra_rtread="proc";;
363 "/dev/ip") RTREAD_METHOD="rtread_getmsg.o"
364 zebra_rtread="getmsg";;
365 *) RTREAD_METHOD="rtread_sysctl.o"
366 zebra_rtread="sysctl";;
367esac
368fi])
369AC_SUBST(RTREAD_METHOD)
370
371dnl -----------------------------
372dnl check interface lookup method
373dnl -----------------------------
374AC_MSG_CHECKING(interface looking up method)
375if test "$netlink" = yes; then
376 AC_MSG_RESULT(netlink)
377 IF_METHOD=if_netlink.o
378else
379 if test "$opsys" = "sol2-6";then
380 AC_MSG_RESULT(solaris)
381 IF_METHOD=if_ioctl.o
382 elif test "$opsys" = "openbsd";then
383 AC_MSG_RESULT(openbsd)
384 IF_METHOD=if_ioctl.o
385 elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
386 AC_MSG_RESULT(sysctl)
387 IF_METHOD=if_sysctl.o
paul1bb066b2003-03-17 01:18:55 +0000388 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
paul718e3742002-12-13 20:15:29 +0000389 else
390 AC_MSG_RESULT(ioctl)
391 IF_METHOD=if_ioctl.o
392 fi
393fi
394AC_SUBST(IF_METHOD)
395
396dnl -----------------------
397dnl check proc file system.
398dnl -----------------------
399if test -r /proc/net/dev; then
paul1bb066b2003-03-17 01:18:55 +0000400 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
paul718e3742002-12-13 20:15:29 +0000401 IF_PROC=if_proc.o
402fi
403
404if test -r /proc/net/if_inet6; then
paul1bb066b2003-03-17 01:18:55 +0000405 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
paul718e3742002-12-13 20:15:29 +0000406 IF_PROC=if_proc.o
407fi
408AC_SUBST(IF_PROC)
409
410dnl -----------------------------
411dnl check ipforward detect method
412dnl -----------------------------
413AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
414[for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
415do
416 test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
417done
418case $zebra_ipforward_path in
419 "/proc/net/snmp") IPFORWARD=ipforward_proc.o
420 zebra_ipforward_path="proc";;
421 "/dev/ip")
422 case "$host" in
423 *-nec-sysv4*) IPFORWARD=ipforward_ews.o
424 zebra_ipforward_path="ews";;
425 *) IPFORWARD=ipforward_solaris.o
426 zebra_ipforward_path="solaris";;
427 esac;;
428 *) IPFORWARD=ipforward_sysctl.o
429 zebra_ipforward_path="sysctl";;
430esac])
431AC_SUBST(IPFORWARD)
432
433AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
434
435dnl ----------
436dnl IPv6 check
437dnl ----------
438AC_MSG_CHECKING(whether does this OS have IPv6 stack)
439if test "${enable_ipv6}" = "no"; then
440 AC_MSG_RESULT(disabled)
441else
442dnl ----------
443dnl INRIA IPv6
444dnl ----------
445if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
446 zebra_cv_ipv6=yes
paul1bb066b2003-03-17 01:18:55 +0000447 AC_DEFINE(HAVE_IPV6,,IPv6)
448 AC_DEFINE(INRIA_IPV6,,Inria IPv6)
paul718e3742002-12-13 20:15:29 +0000449 RIPNGD="ripngd"
450 OSPF6D="ospf6d"
451 LIB_IPV6=""
452 AC_MSG_RESULT(INRIA IPv6)
453fi
454dnl ---------
455dnl KAME IPv6
456dnl ---------
457if grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
458 zebra_cv_ipv6=yes
paul1bb066b2003-03-17 01:18:55 +0000459 AC_DEFINE(HAVE_IPV6,,IPv6)
460 AC_DEFINE(KAME,,KAME IPv6)
paul718e3742002-12-13 20:15:29 +0000461 RIPNGD="ripngd"
462 OSPF6D="ospf6d"
463 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
464 LIB_IPV6="-L/usr/local/v6/lib -linet6"
465 fi
466 AC_MSG_RESULT(KAME)
467fi
468dnl ---------
469dnl NRL check
470dnl ---------
471if grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
472 zebra_cv_ipv6=yes
paul1bb066b2003-03-17 01:18:55 +0000473 AC_DEFINE(HAVE_IPV6,,IPv6)
474 AC_DEFINE(NRL,,NRL)
paul718e3742002-12-13 20:15:29 +0000475 RIPNGD="ripngd"
476 OSPF6D="ospf6d"
477 if test x"$opsys" = x"bsdi";then
paul1bb066b2003-03-17 01:18:55 +0000478 AC_DEFINE(BSDI_NRL,,BSDI)
paul718e3742002-12-13 20:15:29 +0000479 AC_MSG_RESULT(BSDI_NRL)
480 else
481 AC_MSG_RESULT(NRL)
482 fi
483fi
484
485dnl ----------
486dnl Linux IPv6
487dnl ----------
488if test "${enable_ipv6}" = "yes"; then
489 AC_EGREP_CPP(yes, [
490 #include <linux/version.h>
491 /* 2.1.128 or later */
492 #if LINUX_VERSION_CODE >= 0x020180
493 yes
494 #endif],
495 [zebra_cv_ipv6=yes; zebra_cv_linux_ipv6=yes;AC_MSG_RESULT(Linux IPv6)])
496else
497 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
498 then
499 zebra_cv_ipv6=yes
500 zebra_cv_linux_ipv6=yes
501 AC_MSG_RESULT(Linux IPv6)
502 fi
503fi
504
505if test "$zebra_cv_linux_ipv6" = "yes";then
506 AC_DEFINE(HAVE_IPV6)
507 AC_MSG_CHECKING(for GNU libc 2.1)
508 AC_EGREP_CPP(yes, [
509#include <features.h>
510#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
511 yes
512#endif], [glibc=yes; AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))
paul1bb066b2003-03-17 01:18:55 +0000513 AC_DEFINE(LINUX_IPV6,,Linux IPv6)
paul718e3742002-12-13 20:15:29 +0000514 RIPNGD="ripngd"
515 OSPF6D="ospf6d"
516 if test "$glibc" != "yes"; then
517 INCLUDES="-I/usr/inet6/include"
518 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
519 LIB_IPV6="-L/usr/inet6/lib -linet6"
520 fi
521 fi
522fi
523
524dnl -----------------------
525dnl Set IPv6 related values
526dnl -----------------------
527LIBS="$LIB_IPV6 $LIBS"
528AC_SUBST(LIB_IPV6)
529
530if test x"$RIPNGD" = x""; then
531 AC_MSG_RESULT(IPv4 only)
532fi
533fi
534
535dnl --------------------
536dnl Daemon disable check
537dnl --------------------
538if test "${enable_zebra}" = "no";then
539 ZEBRA=""
540else
541 ZEBRA="zebra"
542fi
543
544if test "${enable_bgpd}" = "no";then
545 BGPD=""
546else
547 BGPD="bgpd"
548fi
549
550if test "${enable_ripd}" = "no";then
551 RIPD=""
552else
553 RIPD="ripd"
554fi
555
556if test "${enable_ospfd}" = "no";then
557 OSPFD=""
558else
559 OSPFD="ospfd"
560fi
561
paul68980082003-03-25 05:07:42 +0000562OSPFCLIENT=""
563if test "${enable_opaque_lsa}" = "yes"; then
564 if test "${enable_ospfapi}" != "no";then
paul9a569842003-03-28 01:45:13 +0000565 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
paul68980082003-03-25 05:07:42 +0000566
567 if test "${enable_ospfclient}" != "no";then
568 OSPFCLIENT="ospfclient"
569 fi
570 fi
571
paul1bb066b2003-03-17 01:18:55 +0000572fi
573
paul718e3742002-12-13 20:15:29 +0000574case "${enable_ripngd}" in
575 "yes") RIPNGD="ripngd";;
576 "no" ) RIPNGD="";;
577 * ) ;;
578esac
579
580case "${enable_ospf6d}" in
581 "yes") OSPF6D="ospf6d";;
582 "no" ) OSPF6D="";;
583 * ) ;;
584esac
585
586if test "${enable_bgp_announce}" = "no";then
paul1bb066b2003-03-17 01:18:55 +0000587 AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
paul718e3742002-12-13 20:15:29 +0000588fi
589
590AC_SUBST(ZEBRA)
591AC_SUBST(BGPD)
592AC_SUBST(RIPD)
593AC_SUBST(RIPNGD)
594AC_SUBST(OSPFD)
595AC_SUBST(OSPF6D)
596AC_SUBST(VTYSH)
597AC_SUBST(INCLUDES)
598AC_SUBST(CURSES)
paul1bb066b2003-03-17 01:18:55 +0000599AC_SUBST(OSPFCLIENT)
paul68980082003-03-25 05:07:42 +0000600AC_SUBST(OSPFAPI)
paul1bb066b2003-03-17 01:18:55 +0000601AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
602AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
paul718e3742002-12-13 20:15:29 +0000603AC_CHECK_LIB(crypt, crypt)
604AC_CHECK_LIB(resolv, res_init)
605AC_CHECK_LIB(m, main)
606
607dnl ---------------------------------------------------
608dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
609dnl ---------------------------------------------------
610AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP))
611AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON))
612AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON))
613
614dnl ---------------------------
615dnl check system has GNU regexp
616dnl ---------------------------
617dnl AC_MSG_CHECKING(whether system has GNU regex)
618AC_CHECK_LIB(c, regexec,
paul1bb066b2003-03-17 01:18:55 +0000619[AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
paul718e3742002-12-13 20:15:29 +0000620 LIB_REGEX=""],
621[LIB_REGEX="regex.o"])
622AC_SUBST(LIB_REGEX)
623
paul718e3742002-12-13 20:15:29 +0000624dnl ------------------
625dnl check SNMP library
626dnl ------------------
627if test "${enable_snmp}" = "yes";then
628dnl AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
paul718e3742002-12-13 20:15:29 +0000629 if test "${HAVE_SNMP}" = ""; then
paul68980082003-03-25 05:07:42 +0000630 old_libs="${LIBS}"
631 LIBS="-L/usr/lib"
paul718e3742002-12-13 20:15:29 +0000632 unset ac_cv_lib_snmp_asn_parse_int
paul68980082003-03-25 05:07:42 +0000633 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
634 if test "${NEED_CRYPTO}" = ""; then
635 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes ])
636 else
637 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes; NEED_CRYPTO=yes;LIBS="$LIBS -lcrypto" ],,"-lcrypto")
638 fi
639 LIBS="${old_libs}"
paul718e3742002-12-13 20:15:29 +0000640 fi
paul68980082003-03-25 05:07:42 +0000641 if test "${HAVE_SNMP}" = ""; then
642 old_libs="${LIBS}"
643 LIBS="-L/usr/lib"
644 unset ac_cv_lib_snmp_asn_parse_int
645 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes, )
646 if test "${HAVE_SNMP}" = ""; then
647 unset ac_cv_lib_snmp_asn_parse_int
648 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
649 if test "${NEED_CRYPTO}" = "yes"; then
650 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
651 fi
652 fi
653 LIBS="${old_libs}"
654 fi
paul718e3742002-12-13 20:15:29 +0000655
656 if test "${HAVE_SNMP}" = ""; then
paul68980082003-03-25 05:07:42 +0000657 old_libs="${LIBS}"
658 LIBS="-L/usr/local/lib"
659 unset ac_cv_lib_snmp_asn_parse_int
660 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
661 if test "${HAVE_SNMP}" = ""; then
662 unset ac_cv_lib_snmp_asn_parse_int
663 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
664 if test "${NEED_CRYPTO}" = "yes"; then
665 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
666 fi
667 fi
668 LIBS="${old_libs}"
paul718e3742002-12-13 20:15:29 +0000669 fi
paul68980082003-03-25 05:07:42 +0000670
paul718e3742002-12-13 20:15:29 +0000671 if test "${HAVE_SNMP}" = "yes"; then
paul1bb066b2003-03-17 01:18:55 +0000672 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
paul718e3742002-12-13 20:15:29 +0000673 do
674 test -f "${ac_snmp}" && break
675 done
paul68980082003-03-25 05:07:42 +0000676
paul718e3742002-12-13 20:15:29 +0000677 case ${ac_snmp} in
paul1bb066b2003-03-17 01:18:55 +0000678 /usr/include/net-snmp/*)
679 AC_DEFINE(HAVE_SNMP,,SNMP)
paul68980082003-03-25 05:07:42 +0000680 AC_DEFINE(HAVE_NETSNMP,,SNMP)
paul1bb066b2003-03-17 01:18:55 +0000681 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
paulac7c4bb2003-03-19 04:25:08 +0000682 CFLAGS="${CFLAGS} -I/usr/include/net-snmp -I/usr/include/net-snmp/library"
683 if test "${HAVE_NETSNMP}" = "yes"; then
paul68980082003-03-25 05:07:42 +0000684 LIBS="${LIBS} -lnetsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000685 else
paul68980082003-03-25 05:07:42 +0000686 LIBS="${LIBS} -lsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000687 fi
paul1bb066b2003-03-17 01:18:55 +0000688 ;;
paul718e3742002-12-13 20:15:29 +0000689 /usr/include/ucd-snmp/*)
paul1bb066b2003-03-17 01:18:55 +0000690 AC_DEFINE(HAVE_SNMP,,SNMP)
paul718e3742002-12-13 20:15:29 +0000691 CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp"
692 LIBS="${LIBS} -lsnmp"
693 ;;
694 /usr/local/include/ucd-snmp/*)
paul1bb066b2003-03-17 01:18:55 +0000695 AC_DEFINE(HAVE_SNMP,,SNMP)
paul718e3742002-12-13 20:15:29 +0000696 CFLAGS="${CFLAGS} -I/usr/local/include/ucd-snmp"
697 LIBS="${LIBS} -L/usr/local/lib -lsnmp"
698 ;;
699 esac
700 if test "${NEED_CRYPTO}" = "yes"; then
701 LIBS="${LIBS} -lcrypto"
702 fi
703 fi
704fi
705
706dnl ----------------------------
707dnl check sa_len of sockaddr
708dnl ----------------------------
709AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
710AC_TRY_COMPILE([#include <sys/types.h>
711#include <sys/socket.h>
712],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
713[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000714 AC_DEFINE(HAVE_SA_LEN,,sa_len)],
paul718e3742002-12-13 20:15:29 +0000715 AC_MSG_RESULT(no))
716
717dnl ----------------------------
718dnl check sin_len of sockaddr_in
719dnl ----------------------------
720AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
721AC_TRY_COMPILE([#include <sys/types.h>
722#include <netinet/in.h>
723],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
724[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000725 AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
paul718e3742002-12-13 20:15:29 +0000726 AC_MSG_RESULT(no))
727
728dnl ----------------------------
729dnl check sun_len of sockaddr_un
730dnl ----------------------------
731AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
732AC_TRY_COMPILE([#include <sys/types.h>
733#include <sys/un.h>
734],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
735[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000736 AC_DEFINE(HAVE_SUN_LEN,,sun_len)],
paul718e3742002-12-13 20:15:29 +0000737 AC_MSG_RESULT(no))
738
739dnl -----------------------------------
740dnl check sin6_scope_id of sockaddr_in6
741dnl -----------------------------------
742if test "$zebra_cv_ipv6" = yes; then
743 AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
744 AC_TRY_COMPILE([#include <sys/types.h>
745#include <netinet/in.h>
746],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
747[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000748 AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)],
paul718e3742002-12-13 20:15:29 +0000749 AC_MSG_RESULT(no))
750fi
751
752dnl ----------------------------
753dnl check socklen_t exist or not
754dnl ----------------------------
755AC_MSG_CHECKING(whther socklen_t is defined)
756AC_TRY_COMPILE([#include <sys/types.h>
757#include <sys/socket.h>
758#include <netinet/in.h>
759],[socklen_t ac_x;],
760[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000761 AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)],
paul718e3742002-12-13 20:15:29 +0000762 AC_MSG_RESULT(no))
763
764dnl ------------------------
765dnl check struct sockaddr_dl
766dnl ------------------------
767AC_MSG_CHECKING(whether struct sockaddr_dl exist)
768AC_EGREP_HEADER(sockaddr_dl,
769net/if_dl.h,
770[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000771 AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)],
paul718e3742002-12-13 20:15:29 +0000772 AC_MSG_RESULT(no))
773
774dnl --------------------------
775dnl check structure ifaliasreq
776dnl --------------------------
777AC_MSG_CHECKING(whether struct ifaliasreq exist)
778AC_EGREP_HEADER(ifaliasreq,
779net/if.h,
780[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000781 AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)],
paul718e3742002-12-13 20:15:29 +0000782 AC_MSG_RESULT(no))
783
784dnl ----------------------------
785dnl check structure in6_aliasreq
786dnl ----------------------------
787AC_MSG_CHECKING(whether struct if6_aliasreq exist)
788AC_EGREP_HEADER(in6_aliasreq,
789netinet6/in6_var.h,
790[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000791 AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
paul718e3742002-12-13 20:15:29 +0000792 AC_MSG_RESULT(no))
793
794dnl ---------------------------
795dnl check structure rt_addrinfo
796dnl ---------------------------
797AC_MSG_CHECKING(whether struct rt_addrinfo exist)
798AC_EGREP_HEADER(rt_addrinfo,
799net/route.h,
800[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000801 AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)],
paul718e3742002-12-13 20:15:29 +0000802 AC_MSG_RESULT(no))
803
804dnl --------------------------
805dnl check structure in_pktinfo
806dnl --------------------------
807AC_MSG_CHECKING(whether struct in_pktinfo exist)
808AC_TRY_COMPILE([#include <netinet/in.h>
809],[struct in_pktinfo ac_x;],
810[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000811 AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
paul718e3742002-12-13 20:15:29 +0000812 AC_MSG_RESULT(no))
813
814dnl --------------------------------------
815dnl checking for getrusage struct and call
816dnl --------------------------------------
817AC_MSG_CHECKING(whether getrusage is available)
818AC_TRY_COMPILE([#include <sys/resource.h>
819],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
820[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000821 AC_DEFINE(HAVE_RUSAGE,,rusage)],
paul718e3742002-12-13 20:15:29 +0000822 AC_MSG_RESULT(no))
823
824dnl -------------
825dnl check version
826dnl -------------
827file="${srcdir}/lib/version.h"
828VERSION=`sed -ne 's/^#.*ZEBRA_VERSION.*\"\([^\"]*\)\"$/\1/p' $file`
829AC_SUBST(VERSION)
830
paul408ad942003-05-20 00:03:33 +0000831dnl ----------
832dnl configure date
833dnl ----------
834CONFDATE=`date '+%Y%m%d'`
835AC_SUBST(CONFDATE)
836
paul718e3742002-12-13 20:15:29 +0000837dnl ------------------------------
838dnl set paths for process id files
839dnl ------------------------------
840AC_CACHE_CHECK(pid file directory,ac_piddir,
841[for ZEBRA_PID_DIR in /var/run dnl
842 /var/adm dnl
843 /etc dnl
844 /dev/null;
845do
846 test -d $ZEBRA_PID_DIR && break
847done
848ac_piddir=$ZEBRA_PID_DIR
849if test $ZEBRA_PID_DIR = "/dev/null"; then
850 echo "PID DIRECTORY NOT FOUND!"
851fi])
paul1bb066b2003-03-17 01:18:55 +0000852AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$ac_piddir/zebra.pid",zebra PID)
853AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$ac_piddir/ripd.pid",ripd PID)
854AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$ac_piddir/ripngd.pid",ripngd PID)
855AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$ac_piddir/bgpd.pid",bgpd PID)
856AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$ac_piddir/ospfd.pid",ospfd PID)
857AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$ac_piddir/ospf6d.pid",ospf6d PID)
paul718e3742002-12-13 20:15:29 +0000858
paul1d537c22003-04-07 06:15:02 +0000859dnl ------------------------------
860dnl set paths for socket files
861dnl ------------------------------
862if test "${prefix}" = "NONE"; then
863 ac_sock_prefix="";
864else
865 ac_sock_prefix=${prefix}
866fi
867if test "${localstatedir}" = '${prefix}/var'; then
868 AC_CACHE_CHECK(socket directory,ac_sockdir,
869 [for ZEBRA_SOCK_DIR in ${ac_sock_prefix}/var/run/zebra dnl
870 ${ac_sock_prefix}/var/run dnl
871 ${ac_sock_prefix}/var/adm dnl
paul09f4b7a2003-05-17 15:40:21 +0000872 ${ac_sock_prefix}/tmp dnl
873 /tmp /var/tmp; dnl
paul1d537c22003-04-07 06:15:02 +0000874 do
875 test -d $ZEBRA_SOCK_DIR && break
876 done
877 ac_sockdir=$ZEBRA_SOCK_DIR
878 if test ! -d $ZEBRA_SOCK_DIR ; then
879 echo "SOCKET DIRECTORY NOT FOUND!"
880 fi])
881else
882 ac_sockdir="`eval echo ${localstatedir}`"
883fi
884AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$ac_sockdir/zserv.api",zebra api socket)
885AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$ac_sockdir/zebra.vty",zebra vty socket)
886AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$ac_sockdir/ripd.vty",rip vty socket)
887AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$ac_sockdir/ripngd.vty",ripng vty socket)
888AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$ac_sockdir/bgpd.vty",bgpd vty socket)
889AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$ac_sockdir/ospfd.vty",ospfd vty socket)
890AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$ac_sockdir/ospf6d.vty",ospf6d vty socket)
paul718e3742002-12-13 20:15:29 +0000891
892dnl ---------------------------
893dnl Check htonl works correctly
894dnl ---------------------------
895AC_MSG_CHECKING(for working htonl)
896AC_CACHE_VAL(ac_cv_htonl_works, [
897AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
898#include <sys/types.h>
899#endif
900#ifdef HAVE_NETDB_H
901#include <netdb.h>
902#endif
903#ifdef HAVE_NETINET_IN_H
904#include <netinet/in.h>
905#endif],
906[htonl (0);],
907ac_cv_htonl_works=yes,
908ac_cv_htonl_works=no)])
909AC_MSG_RESULT($ac_cv_htonl_works)
910
paul6382b6f2003-05-20 00:17:45 +0000911AC_OUTPUT(Makefile lib/Makefile zebra/Makefile ripd/Makefile
912 ripngd/Makefile bgpd/Makefile ospfd/Makefile
913 ospf6d/Makefile vtysh/Makefile doc/Makefile
914 ospfclient/Makefile
915 redhat/zebra.spec)
paul718e3742002-12-13 20:15:29 +0000916
917echo "
918zebra configuration
919-------------------
920zebra version : ${VERSION}
921host operationg system : ${host_os}
922source code location : ${srcdir}
923compiler : ${CC}
924compiler flags : ${CFLAGS}
925directory for pid files : ${ac_piddir}
926"