blob: c274a0df855fdf78786fc3a9ff1b056157ac5c43 [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])
72AC_ARG_ENABLE(ospfclient,
73[ --disable-ospfclient do not build ospfclient])
74AC_ARG_ENABLE(ospf6d,
75[ --disable-ospf6d do not build ospf6d])
76AC_ARG_ENABLE(bgp-announce,
77[ --disable-bgp-announce, turn off BGP route announcement])
78AC_ARG_ENABLE(netlink,
79[ --enable-netlink force to use Linux netlink interface])
80AC_ARG_ENABLE(broken-aliases,
81[ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
82AC_ARG_ENABLE(snmp,
83[ --enable-snmp enable SNMP support])
84AC_ARG_WITH(libpam,
85[ --with-libpam use libpam for PAM support in vtysh])
86AC_ARG_ENABLE(tcpsock,
87[ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon])
88dnl Temporary option until OSPF NSSA implementation complete
89AC_ARG_ENABLE(nssa,
90[ --enable-nssa enable OSPF NSSA option])
91AC_ARG_ENABLE(opaque-lsa,
92[ --enable-opaque-lsa enable OSPF Opaque-LSA support (RFC2370)])
93AC_ARG_ENABLE(ospf-te,
94[ --enable-ospf-te enable Traffic Engineering Extension to OSPF])
95AC_ARG_ENABLE(multipath,
96[ --enable-multipath=ARG enable multipath function, ARG must be digit])
97
98dnl AC_ARG_ENABLE(rtadv,
99dnl [ --enable-rtadv enable IPV6 router advertisment option])
100
101if test "${enable_broken_aliases}" = "yes"; then
102 if test "${enable_netlink}" = "yes"
103 then
104 echo "Sorry, you can't use netlink with broken aliases"
105 exit 1
106 fi
107 AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
108 enable_netlink=no
109fi
110
111if test "${enable_tcp_zebra}" = "yes"; then
112 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
113fi
114
115if test "${enable_nssa}" = "yes"; then
116 AC_DEFINE(HAVE_NSSA,,OSPF NSSA)
117fi
118
119if test "${enable_opaque_lsa}" = "yes"; then
120 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
121fi
122
123if test "${enable_ospf_te}" = "yes"; then
124 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
125 AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
126fi
127
128dnl if test "${enable_rtadv}" = "yes"; then
129dnl AC_DEFINE(HAVE_RTADV)
130dnl fi
131
132changequote(, )dnl
133
134MULTIPATH_NUM=1
135
136case "${enable_multipath}" in
137 [0-9]|[1-9][0-9])
138 MULTIPATH_NUM="${enable_multipath}"
139 ;;
140 "")
141 ;;
142 *)
143 echo "Please specify digit to --enable-multipath ARG."
144 exit 1
145 ;;
146esac
147
148changequote([, ])dnl
149
150AC_SUBST(MULTIPATH_NUM)
151
152dnl -------------------
153dnl Check header files.
154dnl -------------------
155AC_STDC_HEADERS
156AC_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)
157
158dnl check some types
159AC_C_CONST
160dnl AC_TYPE_PID_T
161AC_TYPE_SIGNAL
162
163dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
164case "$host" in
165 *-sunos5.6* | *-solaris2.6*)
166 opsys=sol2-6
167 AC_DEFINE(SUNOS_5,,SunOS 5)
168 AC_CHECK_LIB(xnet, main)
169 CURSES=-lcurses
170 ;;
171 *-sunos5* | *-solaris2*)
172 AC_DEFINE(SUNOS_5,,SunOS 5)
173 AC_CHECK_LIB(socket, main)
174 AC_CHECK_LIB(nsl, main)
175 CURSES=-lcurses
176 ;;
177 *-linux-*)
178 opsys=gnu-linux
179 AC_DEFINE(GNU_LINUX,,GNU Linux)
180 ;;
181 *-nec-sysv4*)
182 AC_CHECK_LIB(nsl, gethostbyname)
183 AC_CHECK_LIB(socket, socket)
184 ;;
185 *-freebsd3.2)
186 AC_DEFINE(FREEBSD_32,,FreeBSD 3.2)
187 ;;
188 *-openbsd*)
189 opsys=openbsd
190 AC_DEFINE(OPEN_BSD,,OpenBSD)
191 ;;
192 *-bsdi*)
193 opsys=bsdi
194 OTHER_METHOD="mtu_kvm.o"
195 AC_CHECK_LIB(kvm, main)
196 ;;
197esac
198
199dnl ---------------------
200dnl Integrated VTY option
201dnl ---------------------
202case "${enable_vtysh}" in
203 "yes") VTYSH="vtysh";
204 AC_DEFINE(VTYSH,,VTY shell)
205 AC_CHECK_LIB(tinfo, tputs, , AC_CHECK_LIB(ncurses, tputs))
206 AC_CHECK_LIB(readline, main)
207 if test $ac_cv_lib_readline_main = no; then
208 AC_MSG_ERROR([vtysh needs libreadline but was not found on your system.])
209 fi
210 AC_CHECK_HEADER(readline/history.h)
211 if test $ac_cv_header_readline_history_h = no;then
212 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
213 fi
214 ;;
215 "no" ) VTYSH="";;
216 * ) ;;
217esac
218
219dnl ----------
220dnl PAM module
221dnl ----------
222if test "$with_libpam" = "yes"; then
223dnl took this test from proftpd's configure.in and suited to our needs
224dnl -------------------------------------------------------------------------
225dnl
226dnl This next check looks funky due to a linker problem with some versions
227dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
228dnl omitted requiring libdl linking information. PAM-0.72 or better ships
229dnl with RedHat 6.2 and Debian 2.2 or better.
230AC_CHECK_LIB(pam, pam_start,
231 [AC_CHECK_LIB(pam, misc_conv,
232 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
233 LIBPAM="-lpam"],
234 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
235 LIBPAM="-lpam -lpam_misc"]
236 )
237 ],
238
239 [AC_CHECK_LIB(pam, pam_end,
240 [AC_CHECK_LIB(pam, misc_conv,
241 [AC_DEFINE(USE_PAM)
242 LIBPAM="-lpam -ldl"],
243 [AC_DEFINE(USE_PAM)
244 LIBPAM="-lpam -ldl -lpam_misc"]
245 )
246 ],AC_MSG_WARN([*** pam support will not be built ***]),
247 [-ldl])
248 ]
249)
250fi
251AC_SUBST(LIBPAM)
252
253dnl -------------------------------
254dnl Endian-ness check
255dnl -------------------------------
256AC_WORDS_BIGENDIAN
257
258dnl -------------------------------
259dnl check the size in byte of the C
260dnl -------------------------------
261dnl AC_CHECK_SIZEOF(char)
262dnl AC_CHECK_SIZEOF(int)
263dnl AC_CHECK_SIZEOF(short)
264dnl AC_CHECK_SIZEOF(long)
265
266dnl ----------------------------
267dnl check existance of functions
268dnl ----------------------------
269AC_CHECK_FUNCS(bcopy bzero strerror inet_aton daemon snprintf vsnprintf strlcat strlcpy if_nametoindex if_indextoname getifaddrs)
270AC_CHECK_FUNCS(setproctitle, ,[AC_CHECK_LIB(util, setproctitle, [LIBS="$LIBS -lutil"; AC_DEFINE(HAVE_SETPROCTITLE)])])
271
272dnl ------------------------------------
273dnl Determine routing get and set method
274dnl ------------------------------------
275AC_MSG_CHECKING(zebra between kernel interface method)
276if test x"$opsys" = x"gnu-linux"; then
277 if test "${enable_netlink}" = "yes";then
278 AC_MSG_RESULT(netlink)
279 RT_METHOD=rt_netlink.o
280 AC_DEFINE(HAVE_NETLINK,,netlink)
281 netlink=yes
282 elif test "${enable_netlink}" = "no"; then
283 AC_MSG_RESULT(ioctl)
284 RT_METHOD=rt_ioctl.o
285 netlink=no
286 else
287 AC_MSG_RESULT(netlink)
288 RT_METHOD=rt_netlink.o
289 AC_DEFINE(HAVE_NETLINK,,netlink)
290 netlink=yes
291 fi
292else
293 if test "$opsys" = "sol2-6";then
294 AC_MSG_RESULT(solaris)
295 KERNEL_METHOD="kernel_socket.o"
296 RT_METHOD="rt_socket.o"
297 else
298 AC_TRY_RUN([#include <errno.h>
299#include <sys/types.h>
300#include <sys/socket.h>
301
302main ()
303{
304 int ac_sock;
305
306 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
307 if (ac_sock < 0 && errno == EINVAL)
308 exit (1);
309 exit (0);
310}],
311 [KERNEL_METHOD=kernel_socket.o
312 RT_METHOD=rt_socket.o
313 AC_MSG_RESULT(socket)],
314 [RT_METHOD=rt_ioctl.o
315 AC_MSG_RESULT(ioctl)],
316 [KERNEL_METHOD=kernel_socket.o
317 RT_METHOD=rt_socket.o
318 AC_MSG_RESULT(socket)])
319 fi
320fi
321AC_SUBST(RT_METHOD)
322AC_SUBST(KERNEL_METHOD)
323AC_SUBST(OTHER_METHOD)
324
325dnl ------------------------------
326dnl check kernel route read method
327dnl ------------------------------
328AC_CACHE_CHECK(route read method check, zebra_rtread,
329[if test "$netlink" = yes; then
330 RTREAD_METHOD="rtread_netlink.o"
331 zebra_rtread="netlink"
332else
333for zebra_rtread in /proc/net/route /dev/ip /dev/null;
334do
335 test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
336done
337case $zebra_rtread in
338 "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
339 zebra_rtread="proc";;
340 "/dev/ip") RTREAD_METHOD="rtread_getmsg.o"
341 zebra_rtread="getmsg";;
342 *) RTREAD_METHOD="rtread_sysctl.o"
343 zebra_rtread="sysctl";;
344esac
345fi])
346AC_SUBST(RTREAD_METHOD)
347
348dnl -----------------------------
349dnl check interface lookup method
350dnl -----------------------------
351AC_MSG_CHECKING(interface looking up method)
352if test "$netlink" = yes; then
353 AC_MSG_RESULT(netlink)
354 IF_METHOD=if_netlink.o
355else
356 if test "$opsys" = "sol2-6";then
357 AC_MSG_RESULT(solaris)
358 IF_METHOD=if_ioctl.o
359 elif test "$opsys" = "openbsd";then
360 AC_MSG_RESULT(openbsd)
361 IF_METHOD=if_ioctl.o
362 elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
363 AC_MSG_RESULT(sysctl)
364 IF_METHOD=if_sysctl.o
365 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
366 else
367 AC_MSG_RESULT(ioctl)
368 IF_METHOD=if_ioctl.o
369 fi
370fi
371AC_SUBST(IF_METHOD)
372
373dnl -----------------------
374dnl check proc file system.
375dnl -----------------------
376if test -r /proc/net/dev; then
377 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
378 IF_PROC=if_proc.o
379fi
380
381if test -r /proc/net/if_inet6; then
382 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
383 IF_PROC=if_proc.o
384fi
385AC_SUBST(IF_PROC)
386
387dnl -----------------------------
388dnl check ipforward detect method
389dnl -----------------------------
390AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
391[for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
392do
393 test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
394done
395case $zebra_ipforward_path in
396 "/proc/net/snmp") IPFORWARD=ipforward_proc.o
397 zebra_ipforward_path="proc";;
398 "/dev/ip")
399 case "$host" in
400 *-nec-sysv4*) IPFORWARD=ipforward_ews.o
401 zebra_ipforward_path="ews";;
402 *) IPFORWARD=ipforward_solaris.o
403 zebra_ipforward_path="solaris";;
404 esac;;
405 *) IPFORWARD=ipforward_sysctl.o
406 zebra_ipforward_path="sysctl";;
407esac])
408AC_SUBST(IPFORWARD)
409
410AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
411
412dnl ----------
413dnl IPv6 check
414dnl ----------
415AC_MSG_CHECKING(whether does this OS have IPv6 stack)
416if test "${enable_ipv6}" = "no"; then
417 AC_MSG_RESULT(disabled)
418else
419dnl ----------
420dnl INRIA IPv6
421dnl ----------
422if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
423 zebra_cv_ipv6=yes
424 AC_DEFINE(HAVE_IPV6,,IPv6)
425 AC_DEFINE(INRIA_IPV6,,Inria IPv6)
426 RIPNGD="ripngd"
427 OSPF6D="ospf6d"
428 LIB_IPV6=""
429 AC_MSG_RESULT(INRIA IPv6)
430fi
431dnl ---------
432dnl KAME IPv6
433dnl ---------
434if grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
435 zebra_cv_ipv6=yes
436 AC_DEFINE(HAVE_IPV6,,IPv6)
437 AC_DEFINE(KAME,,KAME IPv6)
438 RIPNGD="ripngd"
439 OSPF6D="ospf6d"
440 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
441 LIB_IPV6="-L/usr/local/v6/lib -linet6"
442 fi
443 AC_MSG_RESULT(KAME)
444fi
445dnl ---------
446dnl NRL check
447dnl ---------
448if grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
449 zebra_cv_ipv6=yes
450 AC_DEFINE(HAVE_IPV6,,IPv6)
451 AC_DEFINE(NRL,,NRL)
452 RIPNGD="ripngd"
453 OSPF6D="ospf6d"
454 if test x"$opsys" = x"bsdi";then
455 AC_DEFINE(BSDI_NRL,,BSDI)
456 AC_MSG_RESULT(BSDI_NRL)
457 else
458 AC_MSG_RESULT(NRL)
459 fi
460fi
461
462dnl ----------
463dnl Linux IPv6
464dnl ----------
465if test "${enable_ipv6}" = "yes"; then
466 AC_EGREP_CPP(yes, [
467 #include <linux/version.h>
468 /* 2.1.128 or later */
469 #if LINUX_VERSION_CODE >= 0x020180
470 yes
471 #endif],
472 [zebra_cv_ipv6=yes; zebra_cv_linux_ipv6=yes;AC_MSG_RESULT(Linux IPv6)])
473else
474 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
475 then
476 zebra_cv_ipv6=yes
477 zebra_cv_linux_ipv6=yes
478 AC_MSG_RESULT(Linux IPv6)
479 fi
480fi
481
482if test "$zebra_cv_linux_ipv6" = "yes";then
483 AC_DEFINE(HAVE_IPV6)
484 AC_MSG_CHECKING(for GNU libc 2.1)
485 AC_EGREP_CPP(yes, [
486#include <features.h>
487#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
488 yes
489#endif], [glibc=yes; AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))
490 AC_DEFINE(LINUX_IPV6,,Linux IPv6)
491 RIPNGD="ripngd"
492 OSPF6D="ospf6d"
493 if test "$glibc" != "yes"; then
494 INCLUDES="-I/usr/inet6/include"
495 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
496 LIB_IPV6="-L/usr/inet6/lib -linet6"
497 fi
498 fi
499fi
500
501dnl -----------------------
502dnl Set IPv6 related values
503dnl -----------------------
504LIBS="$LIB_IPV6 $LIBS"
505AC_SUBST(LIB_IPV6)
506
507if test x"$RIPNGD" = x""; then
508 AC_MSG_RESULT(IPv4 only)
509fi
510fi
511
512dnl --------------------
513dnl Daemon disable check
514dnl --------------------
515if test "${enable_zebra}" = "no";then
516 ZEBRA=""
517else
518 ZEBRA="zebra"
519fi
520
521if test "${enable_bgpd}" = "no";then
522 BGPD=""
523else
524 BGPD="bgpd"
525fi
526
527if test "${enable_ripd}" = "no";then
528 RIPD=""
529else
530 RIPD="ripd"
531fi
532
533if test "${enable_ospfd}" = "no";then
534 OSPFD=""
535else
536 OSPFD="ospfd"
537fi
538
539if test "${enable_ospfclient}" = "no";then
540 OSPFCLIENT=""
541else
542 OSPFCLIENT="ospfclient"
543fi
544
545case "${enable_ripngd}" in
546 "yes") RIPNGD="ripngd";;
547 "no" ) RIPNGD="";;
548 * ) ;;
549esac
550
551case "${enable_ospf6d}" in
552 "yes") OSPF6D="ospf6d";;
553 "no" ) OSPF6D="";;
554 * ) ;;
555esac
556
557if test "${enable_bgp_announce}" = "no";then
558 AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
559fi
560
561AC_SUBST(ZEBRA)
562AC_SUBST(BGPD)
563AC_SUBST(RIPD)
564AC_SUBST(RIPNGD)
565AC_SUBST(OSPFD)
566AC_SUBST(OSPF6D)
567AC_SUBST(VTYSH)
568AC_SUBST(INCLUDES)
569AC_SUBST(CURSES)
570AC_SUBST(OSPFCLIENT)
571AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
572AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
573AC_CHECK_LIB(crypt, crypt)
574AC_CHECK_LIB(resolv, res_init)
575AC_CHECK_LIB(m, main)
576
577dnl ---------------------------------------------------
578dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
579dnl ---------------------------------------------------
580AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP))
581AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON))
582AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON))
583
584dnl ---------------------------
585dnl check system has GNU regexp
586dnl ---------------------------
587dnl AC_MSG_CHECKING(whether system has GNU regex)
588AC_CHECK_LIB(c, regexec,
589[AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
590 LIB_REGEX=""],
591[LIB_REGEX="regex.o"])
592AC_SUBST(LIB_REGEX)
593
594dnl ------------------
595dnl check SNMP library
596dnl ------------------
597if test "${enable_snmp}" = "yes";then
598dnl AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
599 old_libs="${LIBS}"
600 LIBS="-L/usr/local/lib"
601 unset ac_cv_lib_snmp_asn_parse_int
602 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes, )
603 if test "${HAVE_SNMP}" = ""; then
604 unset ac_cv_lib_snmp_asn_parse_int
605 AC_CHECK_LIB(crypto, main, [NEED_CRYPTO=yes ], )
606 if test "${NEED_CRYPTO}" = ""; then
607 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes ],)
608 else
609 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes;LIBS="$LIBS -lcrypto" ],,"-lcrypto")
610 fi
611 fi
612 LIBS="${old_libs}"
613
614 if test "${HAVE_SNMP}" = ""; then
615 old_libs="${LIBS}"
616 LIBS="-L/usr/local/lib"
617 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
618 LIBS="${old_libs}"
619 fi
620 if test "${HAVE_SNMP}" = "yes"; then
621 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
622 do
623 test -f "${ac_snmp}" && break
624 done
625 case ${ac_snmp} in
626 /usr/include/net-snmp/*)
627 AC_DEFINE(HAVE_SNMP,,SNMP)
628 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
629 CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp"
630 LIBS="${LIBS} -lsnmp"
631 ;;
632 /usr/include/ucd-snmp/*)
633 AC_DEFINE(HAVE_SNMP,,SNMP)
634 CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp"
635 LIBS="${LIBS} -lsnmp"
636 ;;
637 /usr/local/include/ucd-snmp/*)
638 AC_DEFINE(HAVE_SNMP,,SNMP)
639 CFLAGS="${CFLAGS} -I/usr/local/include/ucd-snmp"
640 LIBS="${LIBS} -L/usr/local/lib -lsnmp"
641 ;;
642 esac
643 if test "${NEED_CRYPTO}" = "yes"; then
644 LIBS="${LIBS} -lcrypto"
645 fi
646 fi
647fi
648
649dnl ----------------------------
650dnl check sa_len of sockaddr
651dnl ----------------------------
652AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
653AC_TRY_COMPILE([#include <sys/types.h>
654#include <sys/socket.h>
655],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
656[AC_MSG_RESULT(yes)
657 AC_DEFINE(HAVE_SA_LEN,,sa_len)],
658 AC_MSG_RESULT(no))
659
660dnl ----------------------------
661dnl check sin_len of sockaddr_in
662dnl ----------------------------
663AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
664AC_TRY_COMPILE([#include <sys/types.h>
665#include <netinet/in.h>
666],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
667[AC_MSG_RESULT(yes)
668 AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
669 AC_MSG_RESULT(no))
670
671dnl ----------------------------
672dnl check sun_len of sockaddr_un
673dnl ----------------------------
674AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
675AC_TRY_COMPILE([#include <sys/types.h>
676#include <sys/un.h>
677],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
678[AC_MSG_RESULT(yes)
679 AC_DEFINE(HAVE_SUN_LEN,,sun_len)],
680 AC_MSG_RESULT(no))
681
682dnl -----------------------------------
683dnl check sin6_scope_id of sockaddr_in6
684dnl -----------------------------------
685if test "$zebra_cv_ipv6" = yes; then
686 AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
687 AC_TRY_COMPILE([#include <sys/types.h>
688#include <netinet/in.h>
689],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
690[AC_MSG_RESULT(yes)
691 AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)],
692 AC_MSG_RESULT(no))
693fi
694
695dnl ----------------------------
696dnl check socklen_t exist or not
697dnl ----------------------------
698AC_MSG_CHECKING(whther socklen_t is defined)
699AC_TRY_COMPILE([#include <sys/types.h>
700#include <sys/socket.h>
701#include <netinet/in.h>
702],[socklen_t ac_x;],
703[AC_MSG_RESULT(yes)
704 AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)],
705 AC_MSG_RESULT(no))
706
707dnl ------------------------
708dnl check struct sockaddr_dl
709dnl ------------------------
710AC_MSG_CHECKING(whether struct sockaddr_dl exist)
711AC_EGREP_HEADER(sockaddr_dl,
712net/if_dl.h,
713[AC_MSG_RESULT(yes)
714 AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)],
715 AC_MSG_RESULT(no))
716
717dnl --------------------------
718dnl check structure ifaliasreq
719dnl --------------------------
720AC_MSG_CHECKING(whether struct ifaliasreq exist)
721AC_EGREP_HEADER(ifaliasreq,
722net/if.h,
723[AC_MSG_RESULT(yes)
724 AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)],
725 AC_MSG_RESULT(no))
726
727dnl ----------------------------
728dnl check structure in6_aliasreq
729dnl ----------------------------
730AC_MSG_CHECKING(whether struct if6_aliasreq exist)
731AC_EGREP_HEADER(in6_aliasreq,
732netinet6/in6_var.h,
733[AC_MSG_RESULT(yes)
734 AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
735 AC_MSG_RESULT(no))
736
737dnl ---------------------------
738dnl check structure rt_addrinfo
739dnl ---------------------------
740AC_MSG_CHECKING(whether struct rt_addrinfo exist)
741AC_EGREP_HEADER(rt_addrinfo,
742net/route.h,
743[AC_MSG_RESULT(yes)
744 AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)],
745 AC_MSG_RESULT(no))
746
747dnl --------------------------
748dnl check structure in_pktinfo
749dnl --------------------------
750AC_MSG_CHECKING(whether struct in_pktinfo exist)
751AC_TRY_COMPILE([#include <netinet/in.h>
752],[struct in_pktinfo ac_x;],
753[AC_MSG_RESULT(yes)
754 AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
755 AC_MSG_RESULT(no))
756
757dnl --------------------------------------
758dnl checking for getrusage struct and call
759dnl --------------------------------------
760AC_MSG_CHECKING(whether getrusage is available)
761AC_TRY_COMPILE([#include <sys/resource.h>
762],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
763[AC_MSG_RESULT(yes)
764 AC_DEFINE(HAVE_RUSAGE,,rusage)],
765 AC_MSG_RESULT(no))
766
767dnl -------------
768dnl check version
769dnl -------------
770file="${srcdir}/lib/version.h"
771VERSION=`sed -ne 's/^#.*ZEBRA_VERSION.*\"\([^\"]*\)\"$/\1/p' $file`
772AC_SUBST(VERSION)
773
774dnl ------------------------------
775dnl set paths for process id files
776dnl ------------------------------
777AC_CACHE_CHECK(pid file directory,ac_piddir,
778[for ZEBRA_PID_DIR in /var/run dnl
779 /var/adm dnl
780 /etc dnl
781 /dev/null;
782do
783 test -d $ZEBRA_PID_DIR && break
784done
785ac_piddir=$ZEBRA_PID_DIR
786if test $ZEBRA_PID_DIR = "/dev/null"; then
787 echo "PID DIRECTORY NOT FOUND!"
788fi])
789AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$ac_piddir/zebra.pid",zebra PID)
790AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$ac_piddir/ripd.pid",ripd PID)
791AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$ac_piddir/ripngd.pid",ripngd PID)
792AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$ac_piddir/bgpd.pid",bgpd PID)
793AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$ac_piddir/ospfd.pid",ospfd PID)
794AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$ac_piddir/ospf6d.pid",ospf6d PID)
795
796
797dnl ---------------------------
798dnl Check htonl works correctly
799dnl ---------------------------
800AC_MSG_CHECKING(for working htonl)
801AC_CACHE_VAL(ac_cv_htonl_works, [
802AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
803#include <sys/types.h>
804#endif
805#ifdef HAVE_NETDB_H
806#include <netdb.h>
807#endif
808#ifdef HAVE_NETINET_IN_H
809#include <netinet/in.h>
810#endif],
811[htonl (0);],
812ac_cv_htonl_works=yes,
813ac_cv_htonl_works=no)])
814AC_MSG_RESULT($ac_cv_htonl_works)
815
816AC_OUTPUT(Makefile lib/Makefile zebra/Makefile ripd/Makefile ripngd/Makefile bgpd/Makefile ospfd/Makefile ospf6d/Makefile vtysh/Makefile doc/Makefile ospfclient/Makefile)
817
818echo "
819zebra configuration
820-------------------
821zebra version : ${VERSION}
822host operationg system : ${host_os}
823source code location : ${srcdir}
824compiler : ${CC}
825compiler flags : ${CFLAGS}
826directory for pid files : ${ac_piddir}
827"