blob: f66691c1131a48dde86ef453c5c4d36ae6a10a4a [file] [log] [blame]
paul7ea487b2003-03-17 02:05:07 +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)
10AM_INIT_AUTOMAKE(zebra, 0.94)
11AM_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])
paul7ea487b2003-03-17 02:05:07 +000072AC_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,
paul1ef74ef2003-03-21 15:16:05 +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)])
paul7ea487b2003-03-17 02:05:07 +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
111 AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
112 enable_netlink=no
113fi
114
115if test "${enable_tcp_zebra}" = "yes"; then
116 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
117fi
118
119if test "${enable_nssa}" = "yes"; then
120 AC_DEFINE(HAVE_NSSA,,OSPF NSSA)
121fi
122
123if test "${enable_opaque_lsa}" = "yes"; then
124 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
125fi
126
127if test "${enable_ospf_te}" = "yes"; then
128 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
129 AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
130fi
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
171 AC_DEFINE(SUNOS_5,,SunOS 5)
172 AC_CHECK_LIB(xnet, main)
173 CURSES=-lcurses
174 ;;
175 *-sunos5* | *-solaris2*)
176 AC_DEFINE(SUNOS_5,,SunOS 5)
177 AC_CHECK_LIB(socket, main)
178 AC_CHECK_LIB(nsl, main)
179 CURSES=-lcurses
180 ;;
181 *-linux-*)
182 opsys=gnu-linux
183 AC_DEFINE(GNU_LINUX,,GNU Linux)
184 ;;
185 *-nec-sysv4*)
186 AC_CHECK_LIB(nsl, gethostbyname)
187 AC_CHECK_LIB(socket, socket)
188 ;;
189 *-freebsd3.2)
190 AC_DEFINE(FREEBSD_32,,FreeBSD 3.2)
191 ;;
192 *-openbsd*)
193 opsys=openbsd
194 AC_DEFINE(OPEN_BSD,,OpenBSD)
195 ;;
196 *-bsdi*)
197 opsys=bsdi
198 OTHER_METHOD="mtu_kvm.o"
199 AC_CHECK_LIB(kvm, main)
200 ;;
201esac
202
203dnl ---------------------
204dnl Integrated VTY option
205dnl ---------------------
206case "${enable_vtysh}" in
207 "yes") VTYSH="vtysh";
208 AC_DEFINE(VTYSH,,VTY shell)
209 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
227dnl took this test from proftpd's configure.in and suited to our needs
228dnl -------------------------------------------------------------------------
229dnl
230dnl This next check looks funky due to a linker problem with some versions
231dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
232dnl omitted requiring libdl linking information. PAM-0.72 or better ships
233dnl with RedHat 6.2 and Debian 2.2 or better.
234AC_CHECK_LIB(pam, pam_start,
235 [AC_CHECK_LIB(pam, misc_conv,
236 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
237 LIBPAM="-lpam"],
238 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
239 LIBPAM="-lpam -lpam_misc"]
240 )
241 ],
242
243 [AC_CHECK_LIB(pam, pam_end,
244 [AC_CHECK_LIB(pam, misc_conv,
245 [AC_DEFINE(USE_PAM)
246 LIBPAM="-lpam -ldl"],
247 [AC_DEFINE(USE_PAM)
248 LIBPAM="-lpam -ldl -lpam_misc"]
249 )
250 ],AC_MSG_WARN([*** pam support will not be built ***]),
251 [-ldl])
252 ]
253)
254fi
255AC_SUBST(LIBPAM)
256
257dnl -------------------------------
258dnl Endian-ness check
259dnl -------------------------------
260AC_WORDS_BIGENDIAN
261
262dnl -------------------------------
263dnl check the size in byte of the C
264dnl -------------------------------
265dnl AC_CHECK_SIZEOF(char)
266dnl AC_CHECK_SIZEOF(int)
267dnl AC_CHECK_SIZEOF(short)
268dnl AC_CHECK_SIZEOF(long)
269
270dnl ----------------------------
271dnl check existance of functions
272dnl ----------------------------
273AC_CHECK_FUNCS(bcopy bzero strerror inet_aton daemon snprintf vsnprintf strlcat strlcpy if_nametoindex if_indextoname getifaddrs)
274AC_CHECK_FUNCS(setproctitle, ,[AC_CHECK_LIB(util, setproctitle, [LIBS="$LIBS -lutil"; AC_DEFINE(HAVE_SETPROCTITLE)])])
275
276dnl ------------------------------------
277dnl Determine routing get and set method
278dnl ------------------------------------
279AC_MSG_CHECKING(zebra between kernel interface method)
280if test x"$opsys" = x"gnu-linux"; then
281 if test "${enable_netlink}" = "yes";then
282 AC_MSG_RESULT(netlink)
283 RT_METHOD=rt_netlink.o
284 AC_DEFINE(HAVE_NETLINK,,netlink)
285 netlink=yes
286 elif test "${enable_netlink}" = "no"; then
287 AC_MSG_RESULT(ioctl)
288 RT_METHOD=rt_ioctl.o
289 netlink=no
290 else
291 AC_MSG_RESULT(netlink)
292 RT_METHOD=rt_netlink.o
293 AC_DEFINE(HAVE_NETLINK,,netlink)
294 netlink=yes
295 fi
296else
297 if test "$opsys" = "sol2-6";then
298 AC_MSG_RESULT(solaris)
299 KERNEL_METHOD="kernel_socket.o"
300 RT_METHOD="rt_socket.o"
301 else
302 AC_TRY_RUN([#include <errno.h>
303#include <sys/types.h>
304#include <sys/socket.h>
305
306main ()
307{
308 int ac_sock;
309
310 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
311 if (ac_sock < 0 && errno == EINVAL)
312 exit (1);
313 exit (0);
314}],
315 [KERNEL_METHOD=kernel_socket.o
316 RT_METHOD=rt_socket.o
317 AC_MSG_RESULT(socket)],
318 [RT_METHOD=rt_ioctl.o
319 AC_MSG_RESULT(ioctl)],
320 [KERNEL_METHOD=kernel_socket.o
321 RT_METHOD=rt_socket.o
322 AC_MSG_RESULT(socket)])
323 fi
324fi
325AC_SUBST(RT_METHOD)
326AC_SUBST(KERNEL_METHOD)
327AC_SUBST(OTHER_METHOD)
328
329dnl ------------------------------
330dnl check kernel route read method
331dnl ------------------------------
332AC_CACHE_CHECK(route read method check, zebra_rtread,
333[if test "$netlink" = yes; then
334 RTREAD_METHOD="rtread_netlink.o"
335 zebra_rtread="netlink"
336else
337for zebra_rtread in /proc/net/route /dev/ip /dev/null;
338do
339 test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
340done
341case $zebra_rtread in
342 "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
343 zebra_rtread="proc";;
344 "/dev/ip") RTREAD_METHOD="rtread_getmsg.o"
345 zebra_rtread="getmsg";;
346 *) RTREAD_METHOD="rtread_sysctl.o"
347 zebra_rtread="sysctl";;
348esac
349fi])
350AC_SUBST(RTREAD_METHOD)
351
352dnl -----------------------------
353dnl check interface lookup method
354dnl -----------------------------
355AC_MSG_CHECKING(interface looking up method)
356if test "$netlink" = yes; then
357 AC_MSG_RESULT(netlink)
358 IF_METHOD=if_netlink.o
359else
360 if test "$opsys" = "sol2-6";then
361 AC_MSG_RESULT(solaris)
362 IF_METHOD=if_ioctl.o
363 elif test "$opsys" = "openbsd";then
364 AC_MSG_RESULT(openbsd)
365 IF_METHOD=if_ioctl.o
366 elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
367 AC_MSG_RESULT(sysctl)
368 IF_METHOD=if_sysctl.o
369 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
370 else
371 AC_MSG_RESULT(ioctl)
372 IF_METHOD=if_ioctl.o
373 fi
374fi
375AC_SUBST(IF_METHOD)
376
377dnl -----------------------
378dnl check proc file system.
379dnl -----------------------
380if test -r /proc/net/dev; then
381 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
382 IF_PROC=if_proc.o
383fi
384
385if test -r /proc/net/if_inet6; then
386 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
387 IF_PROC=if_proc.o
388fi
389AC_SUBST(IF_PROC)
390
391dnl -----------------------------
392dnl check ipforward detect method
393dnl -----------------------------
394AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
395[for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
396do
397 test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
398done
399case $zebra_ipforward_path in
400 "/proc/net/snmp") IPFORWARD=ipforward_proc.o
401 zebra_ipforward_path="proc";;
402 "/dev/ip")
403 case "$host" in
404 *-nec-sysv4*) IPFORWARD=ipforward_ews.o
405 zebra_ipforward_path="ews";;
406 *) IPFORWARD=ipforward_solaris.o
407 zebra_ipforward_path="solaris";;
408 esac;;
409 *) IPFORWARD=ipforward_sysctl.o
410 zebra_ipforward_path="sysctl";;
411esac])
412AC_SUBST(IPFORWARD)
413
414AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
415
416dnl ----------
417dnl IPv6 check
418dnl ----------
419AC_MSG_CHECKING(whether does this OS have IPv6 stack)
420if test "${enable_ipv6}" = "no"; then
421 AC_MSG_RESULT(disabled)
422else
423dnl ----------
424dnl INRIA IPv6
425dnl ----------
426if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
427 zebra_cv_ipv6=yes
428 AC_DEFINE(HAVE_IPV6,,IPv6)
429 AC_DEFINE(INRIA_IPV6,,Inria IPv6)
430 RIPNGD="ripngd"
431 OSPF6D="ospf6d"
432 LIB_IPV6=""
433 AC_MSG_RESULT(INRIA IPv6)
434fi
435dnl ---------
436dnl KAME IPv6
437dnl ---------
438if grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
439 zebra_cv_ipv6=yes
440 AC_DEFINE(HAVE_IPV6,,IPv6)
441 AC_DEFINE(KAME,,KAME IPv6)
442 RIPNGD="ripngd"
443 OSPF6D="ospf6d"
444 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
445 LIB_IPV6="-L/usr/local/v6/lib -linet6"
446 fi
447 AC_MSG_RESULT(KAME)
448fi
449dnl ---------
450dnl NRL check
451dnl ---------
452if grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
453 zebra_cv_ipv6=yes
454 AC_DEFINE(HAVE_IPV6,,IPv6)
455 AC_DEFINE(NRL,,NRL)
456 RIPNGD="ripngd"
457 OSPF6D="ospf6d"
458 if test x"$opsys" = x"bsdi";then
459 AC_DEFINE(BSDI_NRL,,BSDI)
460 AC_MSG_RESULT(BSDI_NRL)
461 else
462 AC_MSG_RESULT(NRL)
463 fi
464fi
465
466dnl ----------
467dnl Linux IPv6
468dnl ----------
469if test "${enable_ipv6}" = "yes"; then
470 AC_EGREP_CPP(yes, [
471 #include <linux/version.h>
472 /* 2.1.128 or later */
473 #if LINUX_VERSION_CODE >= 0x020180
474 yes
475 #endif],
476 [zebra_cv_ipv6=yes; zebra_cv_linux_ipv6=yes;AC_MSG_RESULT(Linux IPv6)])
477else
478 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
479 then
480 zebra_cv_ipv6=yes
481 zebra_cv_linux_ipv6=yes
482 AC_MSG_RESULT(Linux IPv6)
483 fi
484fi
485
486if test "$zebra_cv_linux_ipv6" = "yes";then
487 AC_DEFINE(HAVE_IPV6)
488 AC_MSG_CHECKING(for GNU libc 2.1)
489 AC_EGREP_CPP(yes, [
490#include <features.h>
491#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
492 yes
493#endif], [glibc=yes; AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))
494 AC_DEFINE(LINUX_IPV6,,Linux IPv6)
495 RIPNGD="ripngd"
496 OSPF6D="ospf6d"
497 if test "$glibc" != "yes"; then
498 INCLUDES="-I/usr/inet6/include"
499 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
500 LIB_IPV6="-L/usr/inet6/lib -linet6"
501 fi
502 fi
503fi
504
505dnl -----------------------
506dnl Set IPv6 related values
507dnl -----------------------
508LIBS="$LIB_IPV6 $LIBS"
509AC_SUBST(LIB_IPV6)
510
511if test x"$RIPNGD" = x""; then
512 AC_MSG_RESULT(IPv4 only)
513fi
514fi
515
516dnl --------------------
517dnl Daemon disable check
518dnl --------------------
519if test "${enable_zebra}" = "no";then
520 ZEBRA=""
521else
522 ZEBRA="zebra"
523fi
524
525if test "${enable_bgpd}" = "no";then
526 BGPD=""
527else
528 BGPD="bgpd"
529fi
530
531if test "${enable_ripd}" = "no";then
532 RIPD=""
533else
534 RIPD="ripd"
535fi
536
537if test "${enable_ospfd}" = "no";then
538 OSPFD=""
539else
540 OSPFD="ospfd"
541fi
542
paul1ef74ef2003-03-21 15:16:05 +0000543OSPFCLIENT=""
544if test "${enable_opaque_lsa}" = "yes"; then
545 if test "${enable_ospfapi}" != "no";then
paul9a569842003-03-28 01:45:13 +0000546 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
paul1ef74ef2003-03-21 15:16:05 +0000547
548 if test "${enable_ospfclient}" != "no";then
549 OSPFCLIENT="ospfclient"
550 fi
551 fi
552
paul7ea487b2003-03-17 02:05:07 +0000553fi
554
555case "${enable_ripngd}" in
556 "yes") RIPNGD="ripngd";;
557 "no" ) RIPNGD="";;
558 * ) ;;
559esac
560
561case "${enable_ospf6d}" in
562 "yes") OSPF6D="ospf6d";;
563 "no" ) OSPF6D="";;
564 * ) ;;
565esac
566
567if test "${enable_bgp_announce}" = "no";then
568 AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
569fi
570
571AC_SUBST(ZEBRA)
572AC_SUBST(BGPD)
573AC_SUBST(RIPD)
574AC_SUBST(RIPNGD)
575AC_SUBST(OSPFD)
576AC_SUBST(OSPF6D)
577AC_SUBST(VTYSH)
578AC_SUBST(INCLUDES)
579AC_SUBST(CURSES)
580AC_SUBST(OSPFCLIENT)
paul1ef74ef2003-03-21 15:16:05 +0000581AC_SUBST(OSPFAPI)
paul7ea487b2003-03-17 02:05:07 +0000582AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
583AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
584AC_CHECK_LIB(crypt, crypt)
585AC_CHECK_LIB(resolv, res_init)
586AC_CHECK_LIB(m, main)
587
588dnl ---------------------------------------------------
589dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
590dnl ---------------------------------------------------
591AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP))
592AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON))
593AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON))
594
595dnl ---------------------------
596dnl check system has GNU regexp
597dnl ---------------------------
598dnl AC_MSG_CHECKING(whether system has GNU regex)
599AC_CHECK_LIB(c, regexec,
600[AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
601 LIB_REGEX=""],
602[LIB_REGEX="regex.o"])
603AC_SUBST(LIB_REGEX)
604
605dnl ------------------
606dnl check SNMP library
607dnl ------------------
608if test "${enable_snmp}" = "yes";then
609dnl AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
paul7ea487b2003-03-17 02:05:07 +0000610 if test "${HAVE_SNMP}" = ""; then
paul1ef74ef2003-03-21 15:16:05 +0000611 old_libs="${LIBS}"
612 LIBS="-L/usr/lib"
paul7ea487b2003-03-17 02:05:07 +0000613 unset ac_cv_lib_snmp_asn_parse_int
paul1ef74ef2003-03-21 15:16:05 +0000614 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
615 if test "${NEED_CRYPTO}" = ""; then
616 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes ])
617 else
618 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes; NEED_CRYPTO=yes;LIBS="$LIBS -lcrypto" ],,"-lcrypto")
619 fi
620 LIBS="${old_libs}"
paul7ea487b2003-03-17 02:05:07 +0000621 fi
paul1ef74ef2003-03-21 15:16:05 +0000622 if test "${HAVE_SNMP}" = ""; then
623 old_libs="${LIBS}"
624 LIBS="-L/usr/lib"
625 unset ac_cv_lib_snmp_asn_parse_int
626 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes, )
627 if test "${HAVE_SNMP}" = ""; then
628 unset ac_cv_lib_snmp_asn_parse_int
629 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
630 if test "${NEED_CRYPTO}" = "yes"; then
631 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
632 fi
633 fi
634 LIBS="${old_libs}"
635 fi
paul7ea487b2003-03-17 02:05:07 +0000636
637 if test "${HAVE_SNMP}" = ""; then
paul1ef74ef2003-03-21 15:16:05 +0000638 old_libs="${LIBS}"
639 LIBS="-L/usr/local/lib"
640 unset ac_cv_lib_snmp_asn_parse_int
641 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
642 if test "${HAVE_SNMP}" = ""; then
643 unset ac_cv_lib_snmp_asn_parse_int
644 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
645 if test "${NEED_CRYPTO}" = "yes"; then
646 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
647 fi
648 fi
649 LIBS="${old_libs}"
paul7ea487b2003-03-17 02:05:07 +0000650 fi
paul1ef74ef2003-03-21 15:16:05 +0000651
paul7ea487b2003-03-17 02:05:07 +0000652 if test "${HAVE_SNMP}" = "yes"; then
653 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
654 do
655 test -f "${ac_snmp}" && break
656 done
paul1ef74ef2003-03-21 15:16:05 +0000657
paul7ea487b2003-03-17 02:05:07 +0000658 case ${ac_snmp} in
659 /usr/include/net-snmp/*)
660 AC_DEFINE(HAVE_SNMP,,SNMP)
paul1ef74ef2003-03-21 15:16:05 +0000661 AC_DEFINE(HAVE_NETSNMP,,SNMP)
paul7ea487b2003-03-17 02:05:07 +0000662 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
paulac7c4bb2003-03-19 04:25:08 +0000663 CFLAGS="${CFLAGS} -I/usr/include/net-snmp -I/usr/include/net-snmp/library"
664 if test "${HAVE_NETSNMP}" = "yes"; then
paul1ef74ef2003-03-21 15:16:05 +0000665 LIBS="${LIBS} -lnetsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000666 else
paul1ef74ef2003-03-21 15:16:05 +0000667 LIBS="${LIBS} -lsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000668 fi
paul7ea487b2003-03-17 02:05:07 +0000669 ;;
670 /usr/include/ucd-snmp/*)
671 AC_DEFINE(HAVE_SNMP,,SNMP)
672 CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp"
673 LIBS="${LIBS} -lsnmp"
674 ;;
675 /usr/local/include/ucd-snmp/*)
676 AC_DEFINE(HAVE_SNMP,,SNMP)
677 CFLAGS="${CFLAGS} -I/usr/local/include/ucd-snmp"
678 LIBS="${LIBS} -L/usr/local/lib -lsnmp"
679 ;;
680 esac
681 if test "${NEED_CRYPTO}" = "yes"; then
682 LIBS="${LIBS} -lcrypto"
683 fi
684 fi
685fi
686
687dnl ----------------------------
688dnl check sa_len of sockaddr
689dnl ----------------------------
690AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
691AC_TRY_COMPILE([#include <sys/types.h>
692#include <sys/socket.h>
693],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
694[AC_MSG_RESULT(yes)
695 AC_DEFINE(HAVE_SA_LEN,,sa_len)],
696 AC_MSG_RESULT(no))
697
698dnl ----------------------------
699dnl check sin_len of sockaddr_in
700dnl ----------------------------
701AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
702AC_TRY_COMPILE([#include <sys/types.h>
703#include <netinet/in.h>
704],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
705[AC_MSG_RESULT(yes)
706 AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
707 AC_MSG_RESULT(no))
708
709dnl ----------------------------
710dnl check sun_len of sockaddr_un
711dnl ----------------------------
712AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
713AC_TRY_COMPILE([#include <sys/types.h>
714#include <sys/un.h>
715],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
716[AC_MSG_RESULT(yes)
717 AC_DEFINE(HAVE_SUN_LEN,,sun_len)],
718 AC_MSG_RESULT(no))
719
720dnl -----------------------------------
721dnl check sin6_scope_id of sockaddr_in6
722dnl -----------------------------------
723if test "$zebra_cv_ipv6" = yes; then
724 AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
725 AC_TRY_COMPILE([#include <sys/types.h>
726#include <netinet/in.h>
727],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
728[AC_MSG_RESULT(yes)
729 AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)],
730 AC_MSG_RESULT(no))
731fi
732
733dnl ----------------------------
734dnl check socklen_t exist or not
735dnl ----------------------------
736AC_MSG_CHECKING(whther socklen_t is defined)
737AC_TRY_COMPILE([#include <sys/types.h>
738#include <sys/socket.h>
739#include <netinet/in.h>
740],[socklen_t ac_x;],
741[AC_MSG_RESULT(yes)
742 AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)],
743 AC_MSG_RESULT(no))
744
745dnl ------------------------
746dnl check struct sockaddr_dl
747dnl ------------------------
748AC_MSG_CHECKING(whether struct sockaddr_dl exist)
749AC_EGREP_HEADER(sockaddr_dl,
750net/if_dl.h,
751[AC_MSG_RESULT(yes)
752 AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)],
753 AC_MSG_RESULT(no))
754
755dnl --------------------------
756dnl check structure ifaliasreq
757dnl --------------------------
758AC_MSG_CHECKING(whether struct ifaliasreq exist)
759AC_EGREP_HEADER(ifaliasreq,
760net/if.h,
761[AC_MSG_RESULT(yes)
762 AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)],
763 AC_MSG_RESULT(no))
764
765dnl ----------------------------
766dnl check structure in6_aliasreq
767dnl ----------------------------
768AC_MSG_CHECKING(whether struct if6_aliasreq exist)
769AC_EGREP_HEADER(in6_aliasreq,
770netinet6/in6_var.h,
771[AC_MSG_RESULT(yes)
772 AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
773 AC_MSG_RESULT(no))
774
775dnl ---------------------------
776dnl check structure rt_addrinfo
777dnl ---------------------------
778AC_MSG_CHECKING(whether struct rt_addrinfo exist)
779AC_EGREP_HEADER(rt_addrinfo,
780net/route.h,
781[AC_MSG_RESULT(yes)
782 AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)],
783 AC_MSG_RESULT(no))
784
785dnl --------------------------
786dnl check structure in_pktinfo
787dnl --------------------------
788AC_MSG_CHECKING(whether struct in_pktinfo exist)
789AC_TRY_COMPILE([#include <netinet/in.h>
790],[struct in_pktinfo ac_x;],
791[AC_MSG_RESULT(yes)
792 AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
793 AC_MSG_RESULT(no))
794
795dnl --------------------------------------
796dnl checking for getrusage struct and call
797dnl --------------------------------------
798AC_MSG_CHECKING(whether getrusage is available)
799AC_TRY_COMPILE([#include <sys/resource.h>
800],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
801[AC_MSG_RESULT(yes)
802 AC_DEFINE(HAVE_RUSAGE,,rusage)],
803 AC_MSG_RESULT(no))
804
805dnl -------------
806dnl check version
807dnl -------------
808file="${srcdir}/lib/version.h"
809VERSION=`sed -ne 's/^#.*ZEBRA_VERSION.*\"\([^\"]*\)\"$/\1/p' $file`
810AC_SUBST(VERSION)
811
812dnl ------------------------------
813dnl set paths for process id files
814dnl ------------------------------
815AC_CACHE_CHECK(pid file directory,ac_piddir,
816[for ZEBRA_PID_DIR in /var/run dnl
817 /var/adm dnl
818 /etc dnl
819 /dev/null;
820do
821 test -d $ZEBRA_PID_DIR && break
822done
823ac_piddir=$ZEBRA_PID_DIR
824if test $ZEBRA_PID_DIR = "/dev/null"; then
825 echo "PID DIRECTORY NOT FOUND!"
826fi])
827AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$ac_piddir/zebra.pid",zebra PID)
828AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$ac_piddir/ripd.pid",ripd PID)
829AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$ac_piddir/ripngd.pid",ripngd PID)
830AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$ac_piddir/bgpd.pid",bgpd PID)
831AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$ac_piddir/ospfd.pid",ospfd PID)
832AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$ac_piddir/ospf6d.pid",ospf6d PID)
833
834
835dnl ---------------------------
836dnl Check htonl works correctly
837dnl ---------------------------
838AC_MSG_CHECKING(for working htonl)
839AC_CACHE_VAL(ac_cv_htonl_works, [
840AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
841#include <sys/types.h>
842#endif
843#ifdef HAVE_NETDB_H
844#include <netdb.h>
845#endif
846#ifdef HAVE_NETINET_IN_H
847#include <netinet/in.h>
848#endif],
849[htonl (0);],
850ac_cv_htonl_works=yes,
851ac_cv_htonl_works=no)])
852AC_MSG_RESULT($ac_cv_htonl_works)
853
854AC_OUTPUT(Makefile lib/Makefile zebra/Makefile ripd/Makefile ripngd/Makefile bgpd/Makefile ospfd/Makefile ospf6d/Makefile vtysh/Makefile doc/Makefile ospfclient/Makefile)
855
856echo "
857zebra configuration
858-------------------
859zebra version : ${VERSION}
860host operationg system : ${host_os}
861source code location : ${srcdir}
862compiler : ${CC}
863compiler flags : ${CFLAGS}
864directory for pid files : ${ac_piddir}
865"