blob: fc854ad76822e89a703c4e1d0e59c6bc37fd4920 [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 ;;
paul3d3de8c2003-05-23 10:33:49 +0000219 AC_CHECK_LIB(readline, rl_completion_matches)
220 if test $ac_cv_lib_readline_rl_completion_matches = no; then
221 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
222 fi
223 ;;
paul718e3742002-12-13 20:15:29 +0000224 "no" ) VTYSH="";;
225 * ) ;;
226esac
227
228dnl ----------
229dnl PAM module
230dnl ----------
231if test "$with_libpam" = "yes"; then
paul09f4b7a2003-05-17 15:40:21 +0000232 AC_CHECK_HEADER(security/pam_misc.h)
233 if test "$ac_cv_header_security_pam_misc_h" = yes; then
234 AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
235 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
236 pam_conv_func="misc_conv"
paul09f4b7a2003-05-17 15:40:21 +0000237 fi
paul09f4b7a2003-05-17 15:40:21 +0000238 AC_CHECK_HEADER(security/openpam.h)
239 if test "$ac_cv_header_security_openpam_h" = yes; then
240 AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
241 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
242 pam_conv_func="openpam_ttyconv"
paul09f4b7a2003-05-17 15:40:21 +0000243 fi
244 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
245 AC_MSG_WARN([*** pam support will not be built ***])
246 with_libpam="no"
247 fi
248fi
249
250if test "$with_libpam" = "yes"; then
paul718e3742002-12-13 20:15:29 +0000251dnl took this test from proftpd's configure.in and suited to our needs
252dnl -------------------------------------------------------------------------
253dnl
254dnl This next check looks funky due to a linker problem with some versions
255dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
256dnl omitted requiring libdl linking information. PAM-0.72 or better ships
257dnl with RedHat 6.2 and Debian 2.2 or better.
258AC_CHECK_LIB(pam, pam_start,
paul09f4b7a2003-05-17 15:40:21 +0000259 [AC_CHECK_LIB(pam, $pam_conv_func,
paul1bb066b2003-03-17 01:18:55 +0000260 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul718e3742002-12-13 20:15:29 +0000261 LIBPAM="-lpam"],
paul1bb066b2003-03-17 01:18:55 +0000262 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul718e3742002-12-13 20:15:29 +0000263 LIBPAM="-lpam -lpam_misc"]
264 )
265 ],
266
267 [AC_CHECK_LIB(pam, pam_end,
paul09f4b7a2003-05-17 15:40:21 +0000268 [AC_CHECK_LIB(pam, $pam_conv_func,
paul718e3742002-12-13 20:15:29 +0000269 [AC_DEFINE(USE_PAM)
270 LIBPAM="-lpam -ldl"],
271 [AC_DEFINE(USE_PAM)
272 LIBPAM="-lpam -ldl -lpam_misc"]
273 )
274 ],AC_MSG_WARN([*** pam support will not be built ***]),
275 [-ldl])
276 ]
277)
278fi
279AC_SUBST(LIBPAM)
280
281dnl -------------------------------
282dnl Endian-ness check
283dnl -------------------------------
paul1bb066b2003-03-17 01:18:55 +0000284AC_WORDS_BIGENDIAN
paul718e3742002-12-13 20:15:29 +0000285
286dnl -------------------------------
287dnl check the size in byte of the C
288dnl -------------------------------
289dnl AC_CHECK_SIZEOF(char)
290dnl AC_CHECK_SIZEOF(int)
291dnl AC_CHECK_SIZEOF(short)
292dnl AC_CHECK_SIZEOF(long)
293
294dnl ----------------------------
295dnl check existance of functions
296dnl ----------------------------
297AC_CHECK_FUNCS(bcopy bzero strerror inet_aton daemon snprintf vsnprintf strlcat strlcpy if_nametoindex if_indextoname getifaddrs)
298AC_CHECK_FUNCS(setproctitle, ,[AC_CHECK_LIB(util, setproctitle, [LIBS="$LIBS -lutil"; AC_DEFINE(HAVE_SETPROCTITLE)])])
299
300dnl ------------------------------------
301dnl Determine routing get and set method
302dnl ------------------------------------
303AC_MSG_CHECKING(zebra between kernel interface method)
304if test x"$opsys" = x"gnu-linux"; then
305 if test "${enable_netlink}" = "yes";then
306 AC_MSG_RESULT(netlink)
307 RT_METHOD=rt_netlink.o
paul1bb066b2003-03-17 01:18:55 +0000308 AC_DEFINE(HAVE_NETLINK,,netlink)
paul718e3742002-12-13 20:15:29 +0000309 netlink=yes
310 elif test "${enable_netlink}" = "no"; then
311 AC_MSG_RESULT(ioctl)
312 RT_METHOD=rt_ioctl.o
313 netlink=no
314 else
paul1bb066b2003-03-17 01:18:55 +0000315 AC_MSG_RESULT(netlink)
paul718e3742002-12-13 20:15:29 +0000316 RT_METHOD=rt_netlink.o
paul1bb066b2003-03-17 01:18:55 +0000317 AC_DEFINE(HAVE_NETLINK,,netlink)
318 netlink=yes
paul718e3742002-12-13 20:15:29 +0000319 fi
320else
321 if test "$opsys" = "sol2-6";then
322 AC_MSG_RESULT(solaris)
323 KERNEL_METHOD="kernel_socket.o"
324 RT_METHOD="rt_socket.o"
325 else
326 AC_TRY_RUN([#include <errno.h>
327#include <sys/types.h>
328#include <sys/socket.h>
329
330main ()
331{
332 int ac_sock;
333
334 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
335 if (ac_sock < 0 && errno == EINVAL)
336 exit (1);
337 exit (0);
338}],
paul1bb066b2003-03-17 01:18:55 +0000339 [KERNEL_METHOD=kernel_socket.o
paul718e3742002-12-13 20:15:29 +0000340 RT_METHOD=rt_socket.o
341 AC_MSG_RESULT(socket)],
342 [RT_METHOD=rt_ioctl.o
343 AC_MSG_RESULT(ioctl)],
344 [KERNEL_METHOD=kernel_socket.o
345 RT_METHOD=rt_socket.o
346 AC_MSG_RESULT(socket)])
347 fi
348fi
349AC_SUBST(RT_METHOD)
350AC_SUBST(KERNEL_METHOD)
351AC_SUBST(OTHER_METHOD)
352
353dnl ------------------------------
354dnl check kernel route read method
355dnl ------------------------------
356AC_CACHE_CHECK(route read method check, zebra_rtread,
357[if test "$netlink" = yes; then
358 RTREAD_METHOD="rtread_netlink.o"
359 zebra_rtread="netlink"
360else
361for zebra_rtread in /proc/net/route /dev/ip /dev/null;
362do
363 test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
364done
365case $zebra_rtread in
366 "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
367 zebra_rtread="proc";;
368 "/dev/ip") RTREAD_METHOD="rtread_getmsg.o"
369 zebra_rtread="getmsg";;
370 *) RTREAD_METHOD="rtread_sysctl.o"
371 zebra_rtread="sysctl";;
372esac
373fi])
374AC_SUBST(RTREAD_METHOD)
375
376dnl -----------------------------
377dnl check interface lookup method
378dnl -----------------------------
379AC_MSG_CHECKING(interface looking up method)
380if test "$netlink" = yes; then
381 AC_MSG_RESULT(netlink)
382 IF_METHOD=if_netlink.o
383else
384 if test "$opsys" = "sol2-6";then
385 AC_MSG_RESULT(solaris)
386 IF_METHOD=if_ioctl.o
387 elif test "$opsys" = "openbsd";then
388 AC_MSG_RESULT(openbsd)
389 IF_METHOD=if_ioctl.o
390 elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
391 AC_MSG_RESULT(sysctl)
392 IF_METHOD=if_sysctl.o
paul1bb066b2003-03-17 01:18:55 +0000393 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
paul718e3742002-12-13 20:15:29 +0000394 else
395 AC_MSG_RESULT(ioctl)
396 IF_METHOD=if_ioctl.o
397 fi
398fi
399AC_SUBST(IF_METHOD)
400
401dnl -----------------------
402dnl check proc file system.
403dnl -----------------------
404if test -r /proc/net/dev; then
paul1bb066b2003-03-17 01:18:55 +0000405 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
paul718e3742002-12-13 20:15:29 +0000406 IF_PROC=if_proc.o
407fi
408
409if test -r /proc/net/if_inet6; then
paul1bb066b2003-03-17 01:18:55 +0000410 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
paul718e3742002-12-13 20:15:29 +0000411 IF_PROC=if_proc.o
412fi
413AC_SUBST(IF_PROC)
414
415dnl -----------------------------
416dnl check ipforward detect method
417dnl -----------------------------
418AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
419[for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
420do
421 test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
422done
423case $zebra_ipforward_path in
424 "/proc/net/snmp") IPFORWARD=ipforward_proc.o
425 zebra_ipforward_path="proc";;
426 "/dev/ip")
427 case "$host" in
428 *-nec-sysv4*) IPFORWARD=ipforward_ews.o
429 zebra_ipforward_path="ews";;
430 *) IPFORWARD=ipforward_solaris.o
431 zebra_ipforward_path="solaris";;
432 esac;;
433 *) IPFORWARD=ipforward_sysctl.o
434 zebra_ipforward_path="sysctl";;
435esac])
436AC_SUBST(IPFORWARD)
437
438AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
439
440dnl ----------
441dnl IPv6 check
442dnl ----------
443AC_MSG_CHECKING(whether does this OS have IPv6 stack)
444if test "${enable_ipv6}" = "no"; then
445 AC_MSG_RESULT(disabled)
446else
447dnl ----------
448dnl INRIA IPv6
449dnl ----------
450if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
451 zebra_cv_ipv6=yes
paul1bb066b2003-03-17 01:18:55 +0000452 AC_DEFINE(HAVE_IPV6,,IPv6)
453 AC_DEFINE(INRIA_IPV6,,Inria IPv6)
paul718e3742002-12-13 20:15:29 +0000454 RIPNGD="ripngd"
455 OSPF6D="ospf6d"
456 LIB_IPV6=""
457 AC_MSG_RESULT(INRIA IPv6)
458fi
459dnl ---------
460dnl KAME IPv6
461dnl ---------
462if grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
463 zebra_cv_ipv6=yes
paul1bb066b2003-03-17 01:18:55 +0000464 AC_DEFINE(HAVE_IPV6,,IPv6)
465 AC_DEFINE(KAME,,KAME IPv6)
paul718e3742002-12-13 20:15:29 +0000466 RIPNGD="ripngd"
467 OSPF6D="ospf6d"
468 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
469 LIB_IPV6="-L/usr/local/v6/lib -linet6"
470 fi
471 AC_MSG_RESULT(KAME)
472fi
473dnl ---------
474dnl NRL check
475dnl ---------
476if grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
477 zebra_cv_ipv6=yes
paul1bb066b2003-03-17 01:18:55 +0000478 AC_DEFINE(HAVE_IPV6,,IPv6)
479 AC_DEFINE(NRL,,NRL)
paul718e3742002-12-13 20:15:29 +0000480 RIPNGD="ripngd"
481 OSPF6D="ospf6d"
482 if test x"$opsys" = x"bsdi";then
paul1bb066b2003-03-17 01:18:55 +0000483 AC_DEFINE(BSDI_NRL,,BSDI)
paul718e3742002-12-13 20:15:29 +0000484 AC_MSG_RESULT(BSDI_NRL)
485 else
486 AC_MSG_RESULT(NRL)
487 fi
488fi
489
490dnl ----------
491dnl Linux IPv6
492dnl ----------
493if test "${enable_ipv6}" = "yes"; then
494 AC_EGREP_CPP(yes, [
495 #include <linux/version.h>
496 /* 2.1.128 or later */
497 #if LINUX_VERSION_CODE >= 0x020180
498 yes
499 #endif],
500 [zebra_cv_ipv6=yes; zebra_cv_linux_ipv6=yes;AC_MSG_RESULT(Linux IPv6)])
501else
502 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
503 then
504 zebra_cv_ipv6=yes
505 zebra_cv_linux_ipv6=yes
506 AC_MSG_RESULT(Linux IPv6)
507 fi
508fi
509
510if test "$zebra_cv_linux_ipv6" = "yes";then
511 AC_DEFINE(HAVE_IPV6)
512 AC_MSG_CHECKING(for GNU libc 2.1)
513 AC_EGREP_CPP(yes, [
514#include <features.h>
515#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
516 yes
517#endif], [glibc=yes; AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))
paul1bb066b2003-03-17 01:18:55 +0000518 AC_DEFINE(LINUX_IPV6,,Linux IPv6)
paul718e3742002-12-13 20:15:29 +0000519 RIPNGD="ripngd"
520 OSPF6D="ospf6d"
521 if test "$glibc" != "yes"; then
522 INCLUDES="-I/usr/inet6/include"
523 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
524 LIB_IPV6="-L/usr/inet6/lib -linet6"
525 fi
526 fi
527fi
528
529dnl -----------------------
530dnl Set IPv6 related values
531dnl -----------------------
532LIBS="$LIB_IPV6 $LIBS"
533AC_SUBST(LIB_IPV6)
534
535if test x"$RIPNGD" = x""; then
536 AC_MSG_RESULT(IPv4 only)
537fi
538fi
539
540dnl --------------------
541dnl Daemon disable check
542dnl --------------------
543if test "${enable_zebra}" = "no";then
544 ZEBRA=""
545else
546 ZEBRA="zebra"
547fi
548
549if test "${enable_bgpd}" = "no";then
550 BGPD=""
551else
552 BGPD="bgpd"
553fi
554
555if test "${enable_ripd}" = "no";then
556 RIPD=""
557else
558 RIPD="ripd"
559fi
560
561if test "${enable_ospfd}" = "no";then
562 OSPFD=""
563else
564 OSPFD="ospfd"
565fi
566
paul68980082003-03-25 05:07:42 +0000567OSPFCLIENT=""
568if test "${enable_opaque_lsa}" = "yes"; then
569 if test "${enable_ospfapi}" != "no";then
paul9a569842003-03-28 01:45:13 +0000570 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
paul68980082003-03-25 05:07:42 +0000571
572 if test "${enable_ospfclient}" != "no";then
573 OSPFCLIENT="ospfclient"
574 fi
575 fi
576
paul1bb066b2003-03-17 01:18:55 +0000577fi
578
paul718e3742002-12-13 20:15:29 +0000579case "${enable_ripngd}" in
580 "yes") RIPNGD="ripngd";;
581 "no" ) RIPNGD="";;
582 * ) ;;
583esac
584
585case "${enable_ospf6d}" in
586 "yes") OSPF6D="ospf6d";;
587 "no" ) OSPF6D="";;
588 * ) ;;
589esac
590
591if test "${enable_bgp_announce}" = "no";then
paul1bb066b2003-03-17 01:18:55 +0000592 AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
paul718e3742002-12-13 20:15:29 +0000593fi
594
595AC_SUBST(ZEBRA)
596AC_SUBST(BGPD)
597AC_SUBST(RIPD)
598AC_SUBST(RIPNGD)
599AC_SUBST(OSPFD)
600AC_SUBST(OSPF6D)
601AC_SUBST(VTYSH)
602AC_SUBST(INCLUDES)
603AC_SUBST(CURSES)
paul1bb066b2003-03-17 01:18:55 +0000604AC_SUBST(OSPFCLIENT)
paul68980082003-03-25 05:07:42 +0000605AC_SUBST(OSPFAPI)
paul1bb066b2003-03-17 01:18:55 +0000606AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
607AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
paul718e3742002-12-13 20:15:29 +0000608AC_CHECK_LIB(crypt, crypt)
609AC_CHECK_LIB(resolv, res_init)
610AC_CHECK_LIB(m, main)
611
612dnl ---------------------------------------------------
613dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
614dnl ---------------------------------------------------
615AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP))
616AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON))
617AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON))
618
619dnl ---------------------------
620dnl check system has GNU regexp
621dnl ---------------------------
622dnl AC_MSG_CHECKING(whether system has GNU regex)
623AC_CHECK_LIB(c, regexec,
paul1bb066b2003-03-17 01:18:55 +0000624[AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
paul718e3742002-12-13 20:15:29 +0000625 LIB_REGEX=""],
626[LIB_REGEX="regex.o"])
627AC_SUBST(LIB_REGEX)
628
paul718e3742002-12-13 20:15:29 +0000629dnl ------------------
630dnl check SNMP library
631dnl ------------------
632if test "${enable_snmp}" = "yes";then
633dnl AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
paul718e3742002-12-13 20:15:29 +0000634 if test "${HAVE_SNMP}" = ""; then
paul68980082003-03-25 05:07:42 +0000635 old_libs="${LIBS}"
636 LIBS="-L/usr/lib"
paul718e3742002-12-13 20:15:29 +0000637 unset ac_cv_lib_snmp_asn_parse_int
paul68980082003-03-25 05:07:42 +0000638 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
639 if test "${NEED_CRYPTO}" = ""; then
640 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes ])
641 else
642 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes; NEED_CRYPTO=yes;LIBS="$LIBS -lcrypto" ],,"-lcrypto")
643 fi
644 LIBS="${old_libs}"
paul718e3742002-12-13 20:15:29 +0000645 fi
paul68980082003-03-25 05:07:42 +0000646 if test "${HAVE_SNMP}" = ""; then
647 old_libs="${LIBS}"
648 LIBS="-L/usr/lib"
649 unset ac_cv_lib_snmp_asn_parse_int
650 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes, )
651 if test "${HAVE_SNMP}" = ""; then
652 unset ac_cv_lib_snmp_asn_parse_int
653 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
654 if test "${NEED_CRYPTO}" = "yes"; then
655 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
656 fi
657 fi
658 LIBS="${old_libs}"
659 fi
paul718e3742002-12-13 20:15:29 +0000660
661 if test "${HAVE_SNMP}" = ""; then
paul68980082003-03-25 05:07:42 +0000662 old_libs="${LIBS}"
663 LIBS="-L/usr/local/lib"
664 unset ac_cv_lib_snmp_asn_parse_int
665 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
666 if test "${HAVE_SNMP}" = ""; then
667 unset ac_cv_lib_snmp_asn_parse_int
668 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
669 if test "${NEED_CRYPTO}" = "yes"; then
670 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
671 fi
672 fi
673 LIBS="${old_libs}"
paul718e3742002-12-13 20:15:29 +0000674 fi
paul68980082003-03-25 05:07:42 +0000675
paul718e3742002-12-13 20:15:29 +0000676 if test "${HAVE_SNMP}" = "yes"; then
paul1bb066b2003-03-17 01:18:55 +0000677 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 +0000678 do
679 test -f "${ac_snmp}" && break
680 done
paul68980082003-03-25 05:07:42 +0000681
paul718e3742002-12-13 20:15:29 +0000682 case ${ac_snmp} in
paul1bb066b2003-03-17 01:18:55 +0000683 /usr/include/net-snmp/*)
684 AC_DEFINE(HAVE_SNMP,,SNMP)
paul68980082003-03-25 05:07:42 +0000685 AC_DEFINE(HAVE_NETSNMP,,SNMP)
paul1bb066b2003-03-17 01:18:55 +0000686 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
paulac7c4bb2003-03-19 04:25:08 +0000687 CFLAGS="${CFLAGS} -I/usr/include/net-snmp -I/usr/include/net-snmp/library"
688 if test "${HAVE_NETSNMP}" = "yes"; then
paul68980082003-03-25 05:07:42 +0000689 LIBS="${LIBS} -lnetsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000690 else
paul68980082003-03-25 05:07:42 +0000691 LIBS="${LIBS} -lsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000692 fi
paul1bb066b2003-03-17 01:18:55 +0000693 ;;
paul718e3742002-12-13 20:15:29 +0000694 /usr/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/include/ucd-snmp"
697 LIBS="${LIBS} -lsnmp"
698 ;;
699 /usr/local/include/ucd-snmp/*)
paul1bb066b2003-03-17 01:18:55 +0000700 AC_DEFINE(HAVE_SNMP,,SNMP)
paul718e3742002-12-13 20:15:29 +0000701 CFLAGS="${CFLAGS} -I/usr/local/include/ucd-snmp"
702 LIBS="${LIBS} -L/usr/local/lib -lsnmp"
703 ;;
704 esac
705 if test "${NEED_CRYPTO}" = "yes"; then
706 LIBS="${LIBS} -lcrypto"
707 fi
708 fi
709fi
710
711dnl ----------------------------
712dnl check sa_len of sockaddr
713dnl ----------------------------
714AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
715AC_TRY_COMPILE([#include <sys/types.h>
716#include <sys/socket.h>
717],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
718[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000719 AC_DEFINE(HAVE_SA_LEN,,sa_len)],
paul718e3742002-12-13 20:15:29 +0000720 AC_MSG_RESULT(no))
721
722dnl ----------------------------
723dnl check sin_len of sockaddr_in
724dnl ----------------------------
725AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
726AC_TRY_COMPILE([#include <sys/types.h>
727#include <netinet/in.h>
728],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
729[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000730 AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
paul718e3742002-12-13 20:15:29 +0000731 AC_MSG_RESULT(no))
732
733dnl ----------------------------
734dnl check sun_len of sockaddr_un
735dnl ----------------------------
736AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
737AC_TRY_COMPILE([#include <sys/types.h>
738#include <sys/un.h>
739],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
740[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000741 AC_DEFINE(HAVE_SUN_LEN,,sun_len)],
paul718e3742002-12-13 20:15:29 +0000742 AC_MSG_RESULT(no))
743
744dnl -----------------------------------
745dnl check sin6_scope_id of sockaddr_in6
746dnl -----------------------------------
747if test "$zebra_cv_ipv6" = yes; then
748 AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
749 AC_TRY_COMPILE([#include <sys/types.h>
750#include <netinet/in.h>
751],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
752[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000753 AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)],
paul718e3742002-12-13 20:15:29 +0000754 AC_MSG_RESULT(no))
755fi
756
757dnl ----------------------------
758dnl check socklen_t exist or not
759dnl ----------------------------
760AC_MSG_CHECKING(whther socklen_t is defined)
761AC_TRY_COMPILE([#include <sys/types.h>
762#include <sys/socket.h>
763#include <netinet/in.h>
764],[socklen_t ac_x;],
765[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000766 AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)],
paul718e3742002-12-13 20:15:29 +0000767 AC_MSG_RESULT(no))
768
769dnl ------------------------
770dnl check struct sockaddr_dl
771dnl ------------------------
772AC_MSG_CHECKING(whether struct sockaddr_dl exist)
773AC_EGREP_HEADER(sockaddr_dl,
774net/if_dl.h,
775[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000776 AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)],
paul718e3742002-12-13 20:15:29 +0000777 AC_MSG_RESULT(no))
778
779dnl --------------------------
780dnl check structure ifaliasreq
781dnl --------------------------
782AC_MSG_CHECKING(whether struct ifaliasreq exist)
783AC_EGREP_HEADER(ifaliasreq,
784net/if.h,
785[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000786 AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)],
paul718e3742002-12-13 20:15:29 +0000787 AC_MSG_RESULT(no))
788
789dnl ----------------------------
790dnl check structure in6_aliasreq
791dnl ----------------------------
792AC_MSG_CHECKING(whether struct if6_aliasreq exist)
793AC_EGREP_HEADER(in6_aliasreq,
794netinet6/in6_var.h,
795[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000796 AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
paul718e3742002-12-13 20:15:29 +0000797 AC_MSG_RESULT(no))
798
799dnl ---------------------------
800dnl check structure rt_addrinfo
801dnl ---------------------------
802AC_MSG_CHECKING(whether struct rt_addrinfo exist)
803AC_EGREP_HEADER(rt_addrinfo,
804net/route.h,
805[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000806 AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)],
paul718e3742002-12-13 20:15:29 +0000807 AC_MSG_RESULT(no))
808
809dnl --------------------------
810dnl check structure in_pktinfo
811dnl --------------------------
812AC_MSG_CHECKING(whether struct in_pktinfo exist)
813AC_TRY_COMPILE([#include <netinet/in.h>
814],[struct in_pktinfo ac_x;],
815[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000816 AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
paul718e3742002-12-13 20:15:29 +0000817 AC_MSG_RESULT(no))
818
819dnl --------------------------------------
820dnl checking for getrusage struct and call
821dnl --------------------------------------
822AC_MSG_CHECKING(whether getrusage is available)
823AC_TRY_COMPILE([#include <sys/resource.h>
824],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
825[AC_MSG_RESULT(yes)
paul1bb066b2003-03-17 01:18:55 +0000826 AC_DEFINE(HAVE_RUSAGE,,rusage)],
paul718e3742002-12-13 20:15:29 +0000827 AC_MSG_RESULT(no))
828
829dnl -------------
830dnl check version
831dnl -------------
832file="${srcdir}/lib/version.h"
833VERSION=`sed -ne 's/^#.*ZEBRA_VERSION.*\"\([^\"]*\)\"$/\1/p' $file`
834AC_SUBST(VERSION)
835
paul408ad942003-05-20 00:03:33 +0000836dnl ----------
837dnl configure date
838dnl ----------
839CONFDATE=`date '+%Y%m%d'`
840AC_SUBST(CONFDATE)
841
paul718e3742002-12-13 20:15:29 +0000842dnl ------------------------------
843dnl set paths for process id files
844dnl ------------------------------
845AC_CACHE_CHECK(pid file directory,ac_piddir,
846[for ZEBRA_PID_DIR in /var/run dnl
847 /var/adm dnl
848 /etc dnl
849 /dev/null;
850do
851 test -d $ZEBRA_PID_DIR && break
852done
853ac_piddir=$ZEBRA_PID_DIR
854if test $ZEBRA_PID_DIR = "/dev/null"; then
855 echo "PID DIRECTORY NOT FOUND!"
856fi])
paul1bb066b2003-03-17 01:18:55 +0000857AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$ac_piddir/zebra.pid",zebra PID)
858AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$ac_piddir/ripd.pid",ripd PID)
859AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$ac_piddir/ripngd.pid",ripngd PID)
860AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$ac_piddir/bgpd.pid",bgpd PID)
861AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$ac_piddir/ospfd.pid",ospfd PID)
862AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$ac_piddir/ospf6d.pid",ospf6d PID)
paul718e3742002-12-13 20:15:29 +0000863
paul1d537c22003-04-07 06:15:02 +0000864dnl ------------------------------
865dnl set paths for socket files
866dnl ------------------------------
867if test "${prefix}" = "NONE"; then
868 ac_sock_prefix="";
869else
870 ac_sock_prefix=${prefix}
871fi
872if test "${localstatedir}" = '${prefix}/var'; then
873 AC_CACHE_CHECK(socket directory,ac_sockdir,
874 [for ZEBRA_SOCK_DIR in ${ac_sock_prefix}/var/run/zebra dnl
875 ${ac_sock_prefix}/var/run dnl
876 ${ac_sock_prefix}/var/adm dnl
paul09f4b7a2003-05-17 15:40:21 +0000877 ${ac_sock_prefix}/tmp dnl
878 /tmp /var/tmp; dnl
paul1d537c22003-04-07 06:15:02 +0000879 do
880 test -d $ZEBRA_SOCK_DIR && break
881 done
882 ac_sockdir=$ZEBRA_SOCK_DIR
883 if test ! -d $ZEBRA_SOCK_DIR ; then
884 echo "SOCKET DIRECTORY NOT FOUND!"
885 fi])
886else
887 ac_sockdir="`eval echo ${localstatedir}`"
888fi
889AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$ac_sockdir/zserv.api",zebra api socket)
890AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$ac_sockdir/zebra.vty",zebra vty socket)
891AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$ac_sockdir/ripd.vty",rip vty socket)
892AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$ac_sockdir/ripngd.vty",ripng vty socket)
893AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$ac_sockdir/bgpd.vty",bgpd vty socket)
894AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$ac_sockdir/ospfd.vty",ospfd vty socket)
895AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$ac_sockdir/ospf6d.vty",ospf6d vty socket)
paul718e3742002-12-13 20:15:29 +0000896
897dnl ---------------------------
898dnl Check htonl works correctly
899dnl ---------------------------
900AC_MSG_CHECKING(for working htonl)
901AC_CACHE_VAL(ac_cv_htonl_works, [
902AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
903#include <sys/types.h>
904#endif
905#ifdef HAVE_NETDB_H
906#include <netdb.h>
907#endif
908#ifdef HAVE_NETINET_IN_H
909#include <netinet/in.h>
910#endif],
911[htonl (0);],
912ac_cv_htonl_works=yes,
913ac_cv_htonl_works=no)])
914AC_MSG_RESULT($ac_cv_htonl_works)
915
paul6382b6f2003-05-20 00:17:45 +0000916AC_OUTPUT(Makefile lib/Makefile zebra/Makefile ripd/Makefile
917 ripngd/Makefile bgpd/Makefile ospfd/Makefile
918 ospf6d/Makefile vtysh/Makefile doc/Makefile
919 ospfclient/Makefile
920 redhat/zebra.spec)
paul718e3742002-12-13 20:15:29 +0000921
922echo "
923zebra configuration
924-------------------
925zebra version : ${VERSION}
926host operationg system : ${host_os}
927source code location : ${srcdir}
928compiler : ${CC}
929compiler flags : ${CFLAGS}
930directory for pid files : ${ac_piddir}
931"