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