blob: bee8296a90727dae46810b818fae6edee32e4deb [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)
10AM_INIT_AUTOMAKE(zebra, 0.93)
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)
106 enable_netlink=no
107fi
108
109if test "${enable_tcp_zebra}" = "yes"; then
110 AC_DEFINE(HAVE_TCP_ZEBRA)
111fi
112
113if test "${enable_nssa}" = "yes"; then
114 AC_DEFINE(HAVE_NSSA)
115fi
116
117if test "${enable_opaque_lsa}" = "yes"; then
118 AC_DEFINE(HAVE_OPAQUE_LSA)
119fi
120
121if test "${enable_ospf_te}" = "yes"; then
122 AC_DEFINE(HAVE_OPAQUE_LSA)
123 AC_DEFINE(HAVE_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)
166 AC_CHECK_LIB(xnet, main)
167 CURSES=-lcurses
168 ;;
169 *-sunos5* | *-solaris2*)
170 AC_DEFINE(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)
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)
185 ;;
186 *-openbsd*)
187 opsys=openbsd
188 AC_DEFINE(OPEN_BSD)
189 ;;
190 *-bsdi*)
191 opsys=bsdi
192 OTHER_METHOD="mtu_kvm.o"
193 AC_CHECK_LIB(kvm, main)
194 ;;
195esac
196
197case "${host_cpu}-${host_os}" in
198 i?86-solaris*)
199 AC_DEFINE(SOLARIS_X86)
200 ;;
201esac
202
203dnl ---------------------
204dnl Integrated VTY option
205dnl ---------------------
206case "${enable_vtysh}" in
207 "yes") VTYSH="vtysh";
208 AC_DEFINE(VTYSH)
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)
237 LIBPAM="-lpam"],
238 [AC_DEFINE(USE_PAM)
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_DEFUN(ZEBRA_AC_C_BIGENDIAN,
261[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian,
262[ac_cv_c_bigendian=unknown
263# See if sys/param.h defines the BYTE_ORDER macro.
264AC_TRY_COMPILE([#include <sys/types.h>
265#include <sys/param.h>], [
266#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
267 bogus endian macros
268#endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
269AC_TRY_COMPILE([#include <sys/types.h>
270#include <sys/param.h>], [
271#if BYTE_ORDER != BIG_ENDIAN
272 not big endian
273#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
274if test $ac_cv_c_bigendian = unknown; then
275AC_TRY_RUN([main () {
276 /* Are we little or big endian? From Harbison&Steele. */
277 union
278 {
279 long l;
280 char c[sizeof (long)];
281 } u;
282 u.l = 1;
283 exit (u.c[sizeof (long) - 1] == 1);
284}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)
285fi])
286if test $ac_cv_c_bigendian = yes; then
287 AC_DEFINE(WORDS_BIGENDIAN,1,Big endian words)
288fi
289])
290
291dnl -------------------------------
292dnl check the size in byte of the C
293dnl -------------------------------
294dnl AC_CHECK_SIZEOF(char)
295dnl AC_CHECK_SIZEOF(int)
296dnl AC_CHECK_SIZEOF(short)
297dnl AC_CHECK_SIZEOF(long)
298
299dnl ----------------------------
300dnl check existance of functions
301dnl ----------------------------
302AC_CHECK_FUNCS(bcopy bzero strerror inet_aton daemon snprintf vsnprintf strlcat strlcpy if_nametoindex if_indextoname getifaddrs)
303AC_CHECK_FUNCS(setproctitle, ,[AC_CHECK_LIB(util, setproctitle, [LIBS="$LIBS -lutil"; AC_DEFINE(HAVE_SETPROCTITLE)])])
304
305dnl ------------------------------------
306dnl Determine routing get and set method
307dnl ------------------------------------
308AC_MSG_CHECKING(zebra between kernel interface method)
309if test x"$opsys" = x"gnu-linux"; then
310 if test "${enable_netlink}" = "yes";then
311 AC_MSG_RESULT(netlink)
312 RT_METHOD=rt_netlink.o
313 AC_DEFINE(HAVE_NETLINK)
314 netlink=yes
315 elif test "${enable_netlink}" = "no"; then
316 AC_MSG_RESULT(ioctl)
317 RT_METHOD=rt_ioctl.o
318 netlink=no
319 else
320 AC_EGREP_CPP(yes,
321 [#include <linux/autoconf.h>
322#include <linux/version.h>
323#if LINUX_VERSION_CODE > 131328 /* 2.1.0 or later */
324#ifdef CONFIG_RTNETLINK
325 yes
326#endif
327#endif
328#if LINUX_VERSION_CODE > 132112 /* 2.4.17 or later */
329 yes
330#endif
331 ],
332 [AC_MSG_RESULT(netlink)
333 RT_METHOD=rt_netlink.o
334 AC_DEFINE(HAVE_NETLINK)
335 netlink=yes],
336 [AC_MSG_RESULT(ioctl)
337 RT_METHOD=rt_ioctl.o])
338 fi
339else
340 if test "$opsys" = "sol2-6";then
341 AC_MSG_RESULT(solaris)
342 KERNEL_METHOD="kernel_socket.o"
343 RT_METHOD="rt_socket.o"
344 else
345 AC_TRY_RUN([#include <errno.h>
346#include <sys/types.h>
347#include <sys/socket.h>
348
349main ()
350{
351 int ac_sock;
352
353 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
354 if (ac_sock < 0 && errno == EINVAL)
355 exit (1);
356 exit (0);
357}],
358 [AC_DEFINE(HAVE_AF_ROUTE)
359 KERNEL_METHOD=kernel_socket.o
360 RT_METHOD=rt_socket.o
361 AC_MSG_RESULT(socket)],
362 [RT_METHOD=rt_ioctl.o
363 AC_MSG_RESULT(ioctl)],
364 [KERNEL_METHOD=kernel_socket.o
365 RT_METHOD=rt_socket.o
366 AC_MSG_RESULT(socket)])
367 fi
368fi
369AC_SUBST(RT_METHOD)
370AC_SUBST(KERNEL_METHOD)
371AC_SUBST(OTHER_METHOD)
372
373dnl ------------------------------
374dnl check kernel route read method
375dnl ------------------------------
376AC_CACHE_CHECK(route read method check, zebra_rtread,
377[if test "$netlink" = yes; then
378 RTREAD_METHOD="rtread_netlink.o"
379 zebra_rtread="netlink"
380else
381for zebra_rtread in /proc/net/route /dev/ip /dev/null;
382do
383 test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
384done
385case $zebra_rtread in
386 "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
387 zebra_rtread="proc";;
388 "/dev/ip") RTREAD_METHOD="rtread_getmsg.o"
389 zebra_rtread="getmsg";;
390 *) RTREAD_METHOD="rtread_sysctl.o"
391 zebra_rtread="sysctl";;
392esac
393fi])
394AC_SUBST(RTREAD_METHOD)
395
396dnl -----------------------------
397dnl check interface lookup method
398dnl -----------------------------
399AC_MSG_CHECKING(interface looking up method)
400if test "$netlink" = yes; then
401 AC_MSG_RESULT(netlink)
402 IF_METHOD=if_netlink.o
403else
404 if test "$opsys" = "sol2-6";then
405 AC_MSG_RESULT(solaris)
406 IF_METHOD=if_ioctl.o
407 elif test "$opsys" = "openbsd";then
408 AC_MSG_RESULT(openbsd)
409 IF_METHOD=if_ioctl.o
410 elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
411 AC_MSG_RESULT(sysctl)
412 IF_METHOD=if_sysctl.o
413 AC_DEFINE(HAVE_NET_RT_IFLIST)
414 else
415 AC_MSG_RESULT(ioctl)
416 IF_METHOD=if_ioctl.o
417 fi
418fi
419AC_SUBST(IF_METHOD)
420
421dnl -----------------------
422dnl check proc file system.
423dnl -----------------------
424if test -r /proc/net/dev; then
425 AC_DEFINE(HAVE_PROC_NET_DEV)
426 IF_PROC=if_proc.o
427fi
428
429if test -r /proc/net/if_inet6; then
430 AC_DEFINE(HAVE_PROC_NET_IF_INET6)
431 IF_PROC=if_proc.o
432fi
433AC_SUBST(IF_PROC)
434
435dnl -----------------------------
436dnl check ipforward detect method
437dnl -----------------------------
438AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
439[for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
440do
441 test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
442done
443case $zebra_ipforward_path in
444 "/proc/net/snmp") IPFORWARD=ipforward_proc.o
445 zebra_ipforward_path="proc";;
446 "/dev/ip")
447 case "$host" in
448 *-nec-sysv4*) IPFORWARD=ipforward_ews.o
449 zebra_ipforward_path="ews";;
450 *) IPFORWARD=ipforward_solaris.o
451 zebra_ipforward_path="solaris";;
452 esac;;
453 *) IPFORWARD=ipforward_sysctl.o
454 zebra_ipforward_path="sysctl";;
455esac])
456AC_SUBST(IPFORWARD)
457
458AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
459
460dnl ----------
461dnl IPv6 check
462dnl ----------
463AC_MSG_CHECKING(whether does this OS have IPv6 stack)
464if test "${enable_ipv6}" = "no"; then
465 AC_MSG_RESULT(disabled)
466else
467dnl ----------
468dnl INRIA IPv6
469dnl ----------
470if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
471 zebra_cv_ipv6=yes
472 AC_DEFINE(HAVE_IPV6)
473 AC_DEFINE(INRIA_IPV6)
474 RIPNGD="ripngd"
475 OSPF6D="ospf6d"
476 LIB_IPV6=""
477 AC_MSG_RESULT(INRIA IPv6)
478fi
479dnl ---------
480dnl KAME IPv6
481dnl ---------
482if grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
483 zebra_cv_ipv6=yes
484 AC_DEFINE(HAVE_IPV6)
485 AC_DEFINE(KAME)
486 RIPNGD="ripngd"
487 OSPF6D="ospf6d"
488 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
489 LIB_IPV6="-L/usr/local/v6/lib -linet6"
490 fi
491 AC_MSG_RESULT(KAME)
492fi
493dnl ---------
494dnl NRL check
495dnl ---------
496if grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
497 zebra_cv_ipv6=yes
498 AC_DEFINE(HAVE_IPV6)
499 AC_DEFINE(NRL)
500 RIPNGD="ripngd"
501 OSPF6D="ospf6d"
502 if test x"$opsys" = x"bsdi";then
503 AC_DEFINE(BSDI_NRL)
504 AC_MSG_RESULT(BSDI_NRL)
505 else
506 AC_MSG_RESULT(NRL)
507 fi
508fi
509
510dnl ----------
511dnl Linux IPv6
512dnl ----------
513if test "${enable_ipv6}" = "yes"; then
514 AC_EGREP_CPP(yes, [
515 #include <linux/version.h>
516 /* 2.1.128 or later */
517 #if LINUX_VERSION_CODE >= 0x020180
518 yes
519 #endif],
520 [zebra_cv_ipv6=yes; zebra_cv_linux_ipv6=yes;AC_MSG_RESULT(Linux IPv6)])
521else
522 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
523 then
524 zebra_cv_ipv6=yes
525 zebra_cv_linux_ipv6=yes
526 AC_MSG_RESULT(Linux IPv6)
527 fi
528fi
529
530if test "$zebra_cv_linux_ipv6" = "yes";then
531 AC_DEFINE(HAVE_IPV6)
532 AC_MSG_CHECKING(for GNU libc 2.1)
533 AC_EGREP_CPP(yes, [
534#include <features.h>
535#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
536 yes
537#endif], [glibc=yes; AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))
538 AC_DEFINE(LINUX_IPV6)
539 RIPNGD="ripngd"
540 OSPF6D="ospf6d"
541 if test "$glibc" != "yes"; then
542 INCLUDES="-I/usr/inet6/include"
543 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
544 LIB_IPV6="-L/usr/inet6/lib -linet6"
545 fi
546 fi
547fi
548
549dnl -----------------------
550dnl Set IPv6 related values
551dnl -----------------------
552LIBS="$LIB_IPV6 $LIBS"
553AC_SUBST(LIB_IPV6)
554
555if test x"$RIPNGD" = x""; then
556 AC_MSG_RESULT(IPv4 only)
557fi
558fi
559
560dnl --------------------
561dnl Daemon disable check
562dnl --------------------
563if test "${enable_zebra}" = "no";then
564 ZEBRA=""
565else
566 ZEBRA="zebra"
567fi
568
569if test "${enable_bgpd}" = "no";then
570 BGPD=""
571else
572 BGPD="bgpd"
573fi
574
575if test "${enable_ripd}" = "no";then
576 RIPD=""
577else
578 RIPD="ripd"
579fi
580
581if test "${enable_ospfd}" = "no";then
582 OSPFD=""
583else
584 OSPFD="ospfd"
585fi
586
587case "${enable_ripngd}" in
588 "yes") RIPNGD="ripngd";;
589 "no" ) RIPNGD="";;
590 * ) ;;
591esac
592
593case "${enable_ospf6d}" in
594 "yes") OSPF6D="ospf6d";;
595 "no" ) OSPF6D="";;
596 * ) ;;
597esac
598
599if test "${enable_bgp_announce}" = "no";then
600 AC_DEFINE(DISABLE_BGP_ANNOUNCE)
601fi
602
603AC_SUBST(ZEBRA)
604AC_SUBST(BGPD)
605AC_SUBST(RIPD)
606AC_SUBST(RIPNGD)
607AC_SUBST(OSPFD)
608AC_SUBST(OSPF6D)
609AC_SUBST(VTYSH)
610AC_SUBST(INCLUDES)
611AC_SUBST(CURSES)
612AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP)])
613AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
614AC_CHECK_LIB(crypt, crypt)
615AC_CHECK_LIB(resolv, res_init)
616AC_CHECK_LIB(m, main)
617
618dnl ---------------------------------------------------
619dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
620dnl ---------------------------------------------------
621AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP))
622AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON))
623AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON))
624
625dnl ---------------------------
626dnl check system has GNU regexp
627dnl ---------------------------
628dnl AC_MSG_CHECKING(whether system has GNU regex)
629AC_CHECK_LIB(c, regexec,
630[AC_DEFINE(HAVE_GNU_REGEX)
631 LIB_REGEX=""],
632[LIB_REGEX="regex.o"])
633AC_SUBST(LIB_REGEX)
634
635dnl AC_MSG_CHECKING(whether system has GNU regex)
636dnl if grep RE_NO_GNU_OPS /usr/include/regex.h >/dev/null 2>&1; then
637dnl AC_MSG_RESULT(yes)
638dnl AC_DEFINE(HAVE_GNU_REGEX)
639dnl LIB_REGEX=""
640dnl else
641dnl AC_MSG_RESULT(no)
642dnl LIB_REGEX="regex.o"
643dnl fi
644dnl AC_SUBST(LIB_REGEX)
645
646dnl ------------------
647dnl check SNMP library
648dnl ------------------
649if test "${enable_snmp}" = "yes";then
650dnl AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
651 old_libs="${LIBS}"
652 LIBS="-L/usr/local/lib"
653 unset ac_cv_lib_snmp_asn_parse_int
654 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes, )
655 if test "${HAVE_SNMP}" = ""; then
656 unset ac_cv_lib_snmp_asn_parse_int
657 AC_CHECK_LIB(crypto, main, [NEED_CRYPTO=yes ], )
658 if test "${NEED_CRYPTO}" = ""; then
659 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes ],)
660 else
661 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes;LIBS="$LIBS -lcrypto" ],,"-lcrypto")
662 fi
663 fi
664 LIBS="${old_libs}"
665
666 if test "${HAVE_SNMP}" = ""; then
667 old_libs="${LIBS}"
668 LIBS="-L/usr/local/lib"
669 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
670 LIBS="${old_libs}"
671 fi
672 if test "${HAVE_SNMP}" = "yes"; then
673 for ac_snmp in /usr/include/ucd-snmp/asn1.h /usr/local/include/ucd-snmp/asn1.h /dev/null
674 do
675 test -f "${ac_snmp}" && break
676 done
677 case ${ac_snmp} in
678 /usr/include/ucd-snmp/*)
679 AC_DEFINE(HAVE_SNMP)
680 CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp"
681 LIBS="${LIBS} -lsnmp"
682 ;;
683 /usr/local/include/ucd-snmp/*)
684 AC_DEFINE(HAVE_SNMP)
685 CFLAGS="${CFLAGS} -I/usr/local/include/ucd-snmp"
686 LIBS="${LIBS} -L/usr/local/lib -lsnmp"
687 ;;
688 esac
689 if test "${NEED_CRYPTO}" = "yes"; then
690 LIBS="${LIBS} -lcrypto"
691 fi
692 fi
693fi
694
695dnl ----------------------------
696dnl check sa_len of sockaddr
697dnl ----------------------------
698AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
699AC_TRY_COMPILE([#include <sys/types.h>
700#include <sys/socket.h>
701],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
702[AC_MSG_RESULT(yes)
703 AC_DEFINE(HAVE_SA_LEN)],
704 AC_MSG_RESULT(no))
705
706dnl ----------------------------
707dnl check sin_len of sockaddr_in
708dnl ----------------------------
709AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
710AC_TRY_COMPILE([#include <sys/types.h>
711#include <netinet/in.h>
712],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
713[AC_MSG_RESULT(yes)
714 AC_DEFINE(HAVE_SIN_LEN)],
715 AC_MSG_RESULT(no))
716
717dnl ----------------------------
718dnl check sun_len of sockaddr_un
719dnl ----------------------------
720AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
721AC_TRY_COMPILE([#include <sys/types.h>
722#include <sys/un.h>
723],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
724[AC_MSG_RESULT(yes)
725 AC_DEFINE(HAVE_SUN_LEN)],
726 AC_MSG_RESULT(no))
727
728dnl -----------------------------------
729dnl check sin6_scope_id of sockaddr_in6
730dnl -----------------------------------
731if test "$zebra_cv_ipv6" = yes; then
732 AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
733 AC_TRY_COMPILE([#include <sys/types.h>
734#include <netinet/in.h>
735],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
736[AC_MSG_RESULT(yes)
737 AC_DEFINE(HAVE_SIN6_SCOPE_ID)],
738 AC_MSG_RESULT(no))
739fi
740
741dnl ----------------------------
742dnl check socklen_t exist or not
743dnl ----------------------------
744AC_MSG_CHECKING(whther socklen_t is defined)
745AC_TRY_COMPILE([#include <sys/types.h>
746#include <sys/socket.h>
747#include <netinet/in.h>
748],[socklen_t ac_x;],
749[AC_MSG_RESULT(yes)
750 AC_DEFINE(HAVE_SOCKLEN_T)],
751 AC_MSG_RESULT(no))
752
753dnl ------------------------
754dnl check struct sockaddr_dl
755dnl ------------------------
756AC_MSG_CHECKING(whether struct sockaddr_dl exist)
757AC_EGREP_HEADER(sockaddr_dl,
758net/if_dl.h,
759[AC_MSG_RESULT(yes)
760 AC_DEFINE(HAVE_SOCKADDR_DL)],
761 AC_MSG_RESULT(no))
762
763dnl --------------------------
764dnl check structure ifaliasreq
765dnl --------------------------
766AC_MSG_CHECKING(whether struct ifaliasreq exist)
767AC_EGREP_HEADER(ifaliasreq,
768net/if.h,
769[AC_MSG_RESULT(yes)
770 AC_DEFINE(HAVE_IFALIASREQ)],
771 AC_MSG_RESULT(no))
772
773dnl ----------------------------
774dnl check structure in6_aliasreq
775dnl ----------------------------
776AC_MSG_CHECKING(whether struct if6_aliasreq exist)
777AC_EGREP_HEADER(in6_aliasreq,
778netinet6/in6_var.h,
779[AC_MSG_RESULT(yes)
780 AC_DEFINE(HAVE_IN6_ALIASREQ)],
781 AC_MSG_RESULT(no))
782
783dnl ---------------------------
784dnl check structure rt_addrinfo
785dnl ---------------------------
786AC_MSG_CHECKING(whether struct rt_addrinfo exist)
787AC_EGREP_HEADER(rt_addrinfo,
788net/route.h,
789[AC_MSG_RESULT(yes)
790 AC_DEFINE(HAVE_RT_ADDRINFO)],
791 AC_MSG_RESULT(no))
792
793dnl --------------------------
794dnl check structure in_pktinfo
795dnl --------------------------
796AC_MSG_CHECKING(whether struct in_pktinfo exist)
797AC_TRY_COMPILE([#include <netinet/in.h>
798],[struct in_pktinfo ac_x;],
799[AC_MSG_RESULT(yes)
800 AC_DEFINE(HAVE_INPKTINFO)],
801 AC_MSG_RESULT(no))
802
803dnl --------------------------------------
804dnl checking for getrusage struct and call
805dnl --------------------------------------
806AC_MSG_CHECKING(whether getrusage is available)
807AC_TRY_COMPILE([#include <sys/resource.h>
808],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
809[AC_MSG_RESULT(yes)
810 AC_DEFINE(HAVE_RUSAGE)],
811 AC_MSG_RESULT(no))
812
813dnl -------------
814dnl check version
815dnl -------------
816file="${srcdir}/lib/version.h"
817VERSION=`sed -ne 's/^#.*ZEBRA_VERSION.*\"\([^\"]*\)\"$/\1/p' $file`
818AC_SUBST(VERSION)
819
820dnl ------------------------------
821dnl set paths for process id files
822dnl ------------------------------
823AC_CACHE_CHECK(pid file directory,ac_piddir,
824[for ZEBRA_PID_DIR in /var/run dnl
825 /var/adm dnl
826 /etc dnl
827 /dev/null;
828do
829 test -d $ZEBRA_PID_DIR && break
830done
831ac_piddir=$ZEBRA_PID_DIR
832if test $ZEBRA_PID_DIR = "/dev/null"; then
833 echo "PID DIRECTORY NOT FOUND!"
834fi])
835AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$ac_piddir/zebra.pid")
836AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$ac_piddir/ripd.pid")
837AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$ac_piddir/ripngd.pid")
838AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$ac_piddir/bgpd.pid")
839AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$ac_piddir/ospfd.pid")
840AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$ac_piddir/ospf6d.pid")
841
842
843dnl ---------------------------
844dnl Check htonl works correctly
845dnl ---------------------------
846AC_MSG_CHECKING(for working htonl)
847AC_CACHE_VAL(ac_cv_htonl_works, [
848AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
849#include <sys/types.h>
850#endif
851#ifdef HAVE_NETDB_H
852#include <netdb.h>
853#endif
854#ifdef HAVE_NETINET_IN_H
855#include <netinet/in.h>
856#endif],
857[htonl (0);],
858ac_cv_htonl_works=yes,
859ac_cv_htonl_works=no)])
860AC_MSG_RESULT($ac_cv_htonl_works)
861
862AC_OUTPUT(Makefile lib/Makefile zebra/Makefile ripd/Makefile ripngd/Makefile bgpd/Makefile ospfd/Makefile ospf6d/Makefile vtysh/Makefile doc/Makefile)
863
864echo "
865zebra configuration
866-------------------
867zebra version : ${VERSION}
868host operationg system : ${host_os}
869source code location : ${srcdir}
870compiler : ${CC}
871compiler flags : ${CFLAGS}
872directory for pid files : ${ac_piddir}
873"