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