]> git.proxmox.com Git - mirror_frr.git/blob - configure.ac
add AC_PROC_SED
[mirror_frr.git] / configure.ac
1 ##
2 ## Configure template file for Quagga.
3 ## autoconf will generate configure script.
4 ##
5 ## Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
6 ## Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st>
7 ##
8 ## $Id$
9 AC_PREREQ(2.53)
10
11 AC_INIT(Quagga, 0.99.6, [http://bugzilla.quagga.net])
12 AC_CONFIG_SRCDIR(lib/zebra.h)
13
14 dnl -----------------------------------
15 dnl Get hostname and other information.
16 dnl -----------------------------------
17 AC_CANONICAL_BUILD()
18 AC_CANONICAL_HOST()
19 AC_CANONICAL_TARGET()
20
21 AM_INIT_AUTOMAKE(1.6)
22 AM_CONFIG_HEADER(config.h)
23
24 dnl we need gawk for memtypes.awk
25 AC_CHECK_PROG([GAWK],[gawk],[gawk],[/bin/false])
26 AC_ARG_VAR([GAWK],[GNU AWK])
27
28 dnl default is to match previous behavior
29 exampledir=${sysconfdir}
30 AC_ARG_ENABLE([exampledir],
31 AC_HELP_STRING([--enable-exampledir],
32 [specify alternate directory for examples]),
33 exampledir="$enableval",)
34 dnl XXX add --exampledir to autoconf standard directory list somehow
35 AC_SUBST(exampledir)
36
37 dnl default is to match previous behavior
38 pkgsrcrcdir=""
39 pkgsrcdir=""
40 AC_ARG_ENABLE([pkgsrcrcdir],
41 AC_HELP_STRING([--enable-pkgsrcrcdir],
42 [specify directory for rc.d scripts]),
43 pkgsrcrcdir="$enableval"; pkgsrcdir="pkgsrc",)
44 dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
45 AC_SUBST(pkgsrcdir)
46 AC_SUBST(pkgsrcrcdir)
47
48 dnl ------------
49 dnl Check CFLAGS
50 dnl ------------
51 AC_ARG_WITH(cflags,
52 [ --with-cflags Set CFLAGS for use in compilation.])
53 if test "x$with_cflags" != "x" ; then
54 CFLAGS="$with_cflags" ; cflags_specified=yes ;
55 elif test -n "$CFLAGS" ; then
56 cflags_specified=yes ;
57 fi
58
59 dnl --------------------
60 dnl Check CC and friends
61 dnl --------------------
62 AC_PROG_CC
63 AC_PROG_CPP
64
65 AC_PROG_EGREP
66 AC_PROG_SED
67
68 dnl ------------------------------------------------------------------
69 dnl Intel compiler check. Although Intel tries really hard to make icc
70 dnl look like gcc, there are some differences. It's very verbose with
71 dnl -Wall and it doesn't support the individual -W options.
72 dnl ------------------------------------------------------------------
73 if test "x${GCC}" = "xyes" ; then
74 COMPILER="GCC"
75 AC_MSG_CHECKING([whether we are using the Intel compiler])
76 AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
77 [AC_MSG_RESULT([no])],
78 [COMPILER="ICC"
79 AC_MSG_RESULT([yes])]
80 )
81 else
82 AC_MSG_CHECKING([whether we are using SunPro compiler])
83 AC_EGREP_CPP([^__SUNPRO_C.*0x5(7|8|9)], ["__SUNPRO_C" __SUNPRO_C],
84 [AC_MSG_RESULT([no])],
85 [COMPILER="SUNPRO"
86 AC_MSG_RESULT([yes])]
87 )
88 fi
89
90 dnl ---------------------------------------------
91 dnl If CLFAGS doesn\'t exist set default value
92 dnl AC_PROG_CC will have set minimal default
93 dnl already, eg "-O2 -g" for gcc, "-g" for others
94 dnl (Wall is gcc specific... have to make sure
95 dnl gcc is being used before setting it)
96 dnl
97 dnl Intel icc 8.0 also sets __GNUC__,
98 dnl but doesn't support all these fancy -W options.
99 dnl Intel compiler warnings we ignore:
100 dnl 279: controlling expression is constant.
101 dnl 869: parameter "xxx" was never referenced - to avoid massive warnings
102 dnl about "self", "vty", "argc" and "argv" never referenced in DEFUN
103 dnl macro.
104 dnl 981: operands are evaluated in unspecified order.
105 dnl
106 dnl Sun Studio 10 / SunPro 5.7 is also supported,
107 dnl so lets set some sane CFLAGS for it.
108 dnl ---------------------------------------------
109
110 AC_MSG_CHECKING([whether to set a default CFLAGS])
111 if test "x${cflags_specified}" = "x" ; then
112 case ${COMPILER} in
113 "ICC")
114 CFLAGS="-Os -g -Wall -wd 279,869,981"
115 AC_MSG_RESULT([Intel default])
116 ;;
117 "GCC")
118 CFLAGS="-Os -fno-omit-frame-pointer -g -std=c99 -Wall"
119 CFLAGS="${CFLAGS} -Wsign-compare -Wpointer-arith"
120 CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
121 CFLAGS="${CFLAGS} -Wmissing-prototypes -Wmissing-declarations"
122 CFLAGS="${CFLAGS} -Wchar-subscripts -Wcast-qual"
123 # TODO: conditionally addd -Wpacked if handled
124 AC_MSG_RESULT([gcc default])
125 ;;
126 "SUNPRO")
127 CFLAGS="-xO4 -v -g -xspace -xcode=pic32 -xstrconst -xc99"
128 AC_MSG_RESULT([SunPro default])
129 ;;
130 *)
131 AC_MSG_RESULT([unknown compiler])
132 ;;
133 esac
134 else
135 AC_MSG_RESULT([CFLAGS supplied by user])
136 fi
137
138 dnl --------------
139 dnl Check programs
140 dnl --------------
141 AC_PROG_INSTALL
142 AC_PROG_MAKE_SET
143 AC_CHECK_TOOL(AR, ar)
144 AC_CHECK_TOOL(RANLIB, ranlib, :)
145
146 dnl ---------------------------
147 dnl We, perhaps unfortunately,
148 dnl depend on GNU Make specific
149 dnl constructs.
150 dnl Give the user a warning if
151 dnl not GNU Make.
152 dnl ---------------------------
153 AC_CACHE_CHECK([if ${MAKE-make} is GNU make], [quagga_cv_gnu_make],
154 [quagga_cv_gnu_make=no
155 if ${MAKE-make} --version 2>/dev/null | \
156 grep '^GNU Make ' >/dev/null ; then
157 quagga_cv_gnu_make=yes;
158 fi
159 ]
160 )
161
162 dnl ---------
163 dnl AIX check
164 dnl ---------
165 AC_AIX
166
167 dnl -------
168 dnl libtool
169 dnl -------
170 AC_PROG_LIBTOOL
171
172 dnl ----------------------
173 dnl Packages configuration
174 dnl ----------------------
175 AC_ARG_ENABLE(vtysh,
176 [ --enable-vtysh include integrated vty shell for Quagga])
177 AC_ARG_ENABLE(ipv6,
178 [ --disable-ipv6 turn off IPv6 related features and daemons])
179 AC_ARG_ENABLE(zebra,
180 [ --disable-zebra do not build zebra daemon])
181 AC_ARG_ENABLE(bgpd,
182 [ --disable-bgpd do not build bgpd])
183 AC_ARG_ENABLE(ripd,
184 [ --disable-ripd do not build ripd])
185 AC_ARG_ENABLE(ripngd,
186 [ --disable-ripngd do not build ripngd])
187 AC_ARG_ENABLE(ospfd,
188 [ --disable-ospfd do not build ospfd])
189 AC_ARG_ENABLE(ospf6d,
190 [ --disable-ospf6d do not build ospf6d])
191 AC_ARG_ENABLE(watchquagga,
192 [ --disable-watchquagga do not build watchquagga])
193 AC_ARG_ENABLE(isisd,
194 [ --enable-isisd build isisd])
195 AC_ARG_ENABLE(bgp-announce,
196 [ --disable-bgp-announce, turn off BGP route announcement])
197 AC_ARG_ENABLE(netlink,
198 [ --enable-netlink force to use Linux netlink interface])
199 AC_ARG_ENABLE(broken-aliases,
200 [ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
201 AC_ARG_ENABLE(snmp,
202 [ --enable-snmp enable SNMP support])
203 AC_ARG_WITH(libpam,
204 [ --with-libpam use libpam for PAM support in vtysh])
205 AC_ARG_ENABLE(tcp-zebra,
206 [ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon])
207 AC_ARG_ENABLE(opaque-lsa,
208 [ --enable-opaque-lsa enable OSPF Opaque-LSA with OSPFAPI support (RFC2370)])
209 AC_ARG_ENABLE(ospfapi,
210 [ --disable-ospfapi do not build OSPFAPI to access the OSPF LSA Database,
211 (this is the default if --enable-opaque-lsa is not set)])
212 AC_ARG_ENABLE(ospfclient,
213 [ --disable-ospfclient do not build OSPFAPI client for OSPFAPI,
214 (this is the default if --disable-ospfapi is set)])
215 AC_ARG_ENABLE(ospf-te,
216 [ --enable-ospf-te enable Traffic Engineering Extension to OSPF])
217 AC_ARG_ENABLE(multipath,
218 [ --enable-multipath=ARG enable multipath function, ARG must be digit])
219 AC_ARG_ENABLE(quagga_user,
220 [ --enable-user=ARG user to run Quagga suite as (default quagga)])
221 AC_ARG_ENABLE(quagga_group,
222 [ --enable-group=ARG group to run Quagga suite as (default quagga)])
223 AC_ARG_ENABLE(vty_group,
224 [ --enable-vty-group=ARG set vty sockets to have specified group as owner])
225 AC_ARG_ENABLE(configfile_mask,
226 [ --enable-configfile-mask=ARG set mask for config files])
227 AC_ARG_ENABLE(logfile_mask,
228 [ --enable-logfile-mask=ARG set mask for log files])
229
230 AC_ARG_ENABLE(rtadv,
231 [ --disable-rtadv disable IPV6 router advertisement feature])
232 AC_ARG_ENABLE(irdp,
233 [ --enable-irdp enable IRDP server support in zebra])
234 AC_ARG_ENABLE(isis_topology,
235 [ --enable-isis-topology enable IS-IS topology generator])
236 AC_ARG_ENABLE(capabilities,
237 [ --disable-capabilities disable using POSIX capabilities])
238 AC_ARG_ENABLE(gcc_ultra_verbose,
239 [ --enable-gcc-ultra-verbose enable ultra verbose GCC warnings])
240 AC_ARG_ENABLE(gcc-rdynamic,
241 [ --enable-gcc-rdynamic enable gcc linking with -rdynamic for better backtraces])
242 AC_ARG_ENABLE(time-check,
243 [ --disable-time-check disable slow thread warning messages])
244
245 if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
246 CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
247 CFLAGS="${CFLAGS} -Wmissing-declarations -Wmissing-noreturn"
248 CFLAGS="${CFLAGS} -Wmissing-format-attribute -Wunreachable-code"
249 CFLAGS="${CFLAGS} -Wpacked -Wpadded"
250 fi
251
252 if test x"${enable_gcc_rdynamic}" = x"yes" ; then
253 LDFLAGS="${LDFLAGS} -rdynamic"
254 fi
255
256 if test x"${enable_time_check}" != x"no" ; then
257 if test x"${enable_time_check}" = x"yes" -o x"${enable_time_check}" = x ; then
258 AC_DEFINE(CONSUMED_TIME_CHECK,5000000,Consumed Time Check)
259 else
260 AC_DEFINE_UNQUOTED(CONSUMED_TIME_CHECK,$enable_time_check,Consumed Time Check)
261 fi
262 fi
263
264 if test "${enable_broken_aliases}" = "yes"; then
265 if test "${enable_netlink}" = "yes"
266 then
267 echo "Sorry, you can't use netlink with broken aliases"
268 exit 1
269 fi
270 AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
271 enable_netlink=no
272 fi
273
274 if test "${enable_tcp_zebra}" = "yes"; then
275 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
276 fi
277
278 if test "${enable_opaque_lsa}" = "yes"; then
279 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
280 fi
281
282 if test "${enable_ospf_te}" = "yes"; then
283 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
284 AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
285 fi
286
287 AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
288 if test "${enable_rtadv}" != "no"; then
289 AC_MSG_RESULT(yes)
290 AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
291 else
292 AC_MSG_RESULT(no)
293 fi
294
295 if test "${enable_irdp}" = "yes"; then
296 AC_DEFINE(HAVE_IRDP,, IRDP )
297 fi
298
299 if test "${enable_isisd}" = "yes" && test "${enable_isis_topology}" = yes; then
300 AC_DEFINE(TOPOLOGY_GENERATE,,Enable IS-IS topology generator code)
301 ISIS_TOPOLOGY_INCLUDES="-I./topology"
302 ISIS_TOPOLOGY_DIR="topology"
303 ISIS_TOPOLOGY_LIB="./topology/libtopology.a"
304 fi
305
306 AC_SUBST(ISIS_TOPOLOGY_INCLUDES)
307 AC_SUBST(ISIS_TOPOLOGY_DIR)
308 AC_SUBST(ISIS_TOPOLOGY_LIB)
309
310 if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
311 enable_user="quagga"
312 elif test "${enable_user}" = "no"; then
313 enable_user="root"
314 fi
315
316 if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
317 enable_group="quagga"
318 elif test "${enable_group}" = "no"; then
319 enable_group="root"
320 fi
321
322 if test x"${enable_vty_group}" = x"yes" ; then
323 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
324 elif test x"${enable_vty_group}" != x""; then
325 if test x"${enable_vty_group}" != x"no"; then
326 AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
327 fi
328 fi
329 AC_SUBST([enable_user])
330 AC_SUBST([enable_group])
331 AC_SUBST([enable_vty_group])
332 AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
333 AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
334
335 enable_configfile_mask=${enable_configfile_mask:-0600}
336 AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
337
338 enable_logfile_mask=${enable_logfile_mask:-0600}
339 AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
340
341 changequote(, )dnl
342
343 MULTIPATH_NUM=1
344
345 case "${enable_multipath}" in
346 [0-9]|[1-9][0-9])
347 MULTIPATH_NUM="${enable_multipath}"
348 ;;
349 "")
350 ;;
351 *)
352 echo "Please specify digit to --enable-multipath ARG."
353 exit 1
354 ;;
355 esac
356
357 changequote([, ])dnl
358
359 AC_SUBST(MULTIPATH_NUM)
360
361 dnl -------------------
362 dnl Check header files.
363 dnl -------------------
364 AC_HEADER_STDC
365 AC_CHECK_HEADERS([string.h stropts.h sys/conf.h sys/ksym.h sys/time.h \
366 sys/times.h sys/select.h sys/sysctl.h sys/sockio.h \
367 sys/types.h linux/version.h kvm.h netdb.h asm/types.h \
368 sys/param.h libutil.h limits.h stdint.h])
369
370 AC_CHECK_HEADERS([sys/socket.h netinet/in_systm.h netinet/in.h \
371 net/if_dl.h net/netopt.h inet/nd.h net/route.h \
372 net/if.h net/if_var.h netinet/in_var.h])
373
374 dnl V6 headers are checked below, after we check for v6
375
376 dnl check some types
377 AC_C_CONST
378 dnl AC_TYPE_PID_T
379 AC_TYPE_SIGNAL
380
381 dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
382 case "$host" in
383 [*-sunos5.[6-7]*] | [*-solaris2.[6-7]*])
384 opsys=sol2-6
385 AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.7)
386 AC_DEFINE(SUNOS_5, 1, SunOS 5)
387 AC_CHECK_LIB(xnet, main)
388 CURSES=-lcurses
389 ;;
390 [*-sunos5.[8-9]] \
391 | [*-sunos5.1[0-9]] \
392 | [*-sunos5.1[0-9].[0-9]] \
393 | [*-solaris2.[8-9]] \
394 | [*-solaris2.1[0-9]] \
395 | [*-solaris2.1[0-9].[0-9]])
396 opsys=sol8
397 AC_DEFINE(SUNOS_59, 1, [SunOS 5.8 up])
398 AC_DEFINE(SUNOS_5, 1, [SunOS 5])
399 AC_CHECK_LIB(socket, main)
400 AC_CHECK_LIB(nsl, main)
401 AC_CHECK_LIB(umem, main)
402 AC_CHECK_FUNCS([printstack],
403 [AC_DEFINE([HAVE_PRINTSTACK],1,[Solaris printstack])
404 AC_DEFINE([HAVE_STACK_TRACE],1,[Stack symbols decode functionality])
405 ])
406 CURSES=-lcurses
407 ;;
408 *-sunos5* | *-solaris2*)
409 AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
410 AC_CHECK_LIB(socket, main)
411 AC_CHECK_LIB(nsl, main)
412 CURSES=-lcurses
413 ;;
414 *-linux*)
415 opsys=gnu-linux
416 AC_DEFINE(GNU_LINUX,,GNU Linux)
417 ;;
418 *-nec-sysv4*)
419 AC_CHECK_LIB(nsl, gethostbyname)
420 AC_CHECK_LIB(socket, socket)
421 ;;
422 *-openbsd*)
423 opsys=openbsd
424 AC_DEFINE(OPEN_BSD,,OpenBSD)
425 ;;
426 *-bsdi*)
427 opsys=bsdi
428 OTHER_METHOD="mtu_kvm.o"
429 AC_CHECK_LIB(kvm, main)
430 ;;
431 *-irix6.5)
432 opsys=irix
433 AC_DEFINE(IRIX_65,,IRIX 6.5)
434 ;;
435 esac
436
437 dnl ---------------------
438 dnl Integrated VTY option
439 dnl ---------------------
440 case "${enable_vtysh}" in
441 "yes") VTYSH="vtysh";
442 AC_DEFINE(VTYSH,,VTY shell)
443 AC_PATH_PROG(PERL, perl)
444 dnl Vtysh uses libreadline, which looks for termcap functions at
445 dnl configure time. We follow readline's search order.
446 dnl The required procedures are in libtermcap on NetBSD, in
447 dnl [TODO] on Linux, and in [TODO] on Solaris.
448 AC_CHECK_LIB(termcap, tputs, LIBREADLINE="$LIBREADLINE -ltermcap",
449 [AC_CHECK_LIB(tinfo, tputs, LIBREADLINE="$LIBREADLINE -ltinfo",
450 [AC_CHECK_LIB(curses, tputs, LIBREADLINE="$LIBREADLINE -lcurses",
451 [AC_CHECK_LIB(ncurses, tputs,
452 LIBREADLINE="$LIBREADLINE -lncurses")]
453 )]
454 )]
455 )
456 AC_CHECK_LIB(readline, main, LIBREADLINE="$LIBREADLINE -lreadline",,
457 "$LIBREADLINE")
458 if test $ac_cv_lib_readline_main = no; then
459 AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
460 fi
461 AC_CHECK_HEADER(readline/history.h)
462 if test $ac_cv_header_readline_history_h = no;then
463 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
464 fi
465 AC_CHECK_LIB(readline, rl_completion_matches,
466 LIBREADLINE="$LIBREADLINE",, "$LIBREADLINE")
467 if test $ac_cv_lib_readline_rl_completion_matches = no; then
468 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
469 fi
470 ;;
471 "no" ) VTYSH="";;
472 * ) ;;
473 esac
474 AC_SUBST(LIBREADLINE)
475
476 dnl ----------
477 dnl PAM module
478 dnl ----------
479 if test "$with_libpam" = "yes"; then
480 AC_CHECK_HEADER(security/pam_misc.h)
481 if test "$ac_cv_header_security_pam_misc_h" = yes; then
482 AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
483 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
484 pam_conv_func="misc_conv"
485 fi
486 AC_CHECK_HEADER(security/openpam.h)
487 if test "$ac_cv_header_security_openpam_h" = yes; then
488 AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
489 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
490 pam_conv_func="openpam_ttyconv"
491 fi
492 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
493 AC_MSG_WARN([*** pam support will not be built ***])
494 with_libpam="no"
495 fi
496 fi
497
498 if test "$with_libpam" = "yes"; then
499 dnl took this test from proftpd's configure.in and suited to our needs
500 dnl -------------------------------------------------------------------------
501 dnl
502 dnl This next check looks funky due to a linker problem with some versions
503 dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
504 dnl omitted requiring libdl linking information. PAM-0.72 or better ships
505 dnl with RedHat 6.2 and Debian 2.2 or better.
506 AC_CHECK_LIB(pam, pam_start,
507 [AC_CHECK_LIB(pam, $pam_conv_func,
508 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
509 LIBPAM="-lpam"],
510 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
511 LIBPAM="-lpam -lpam_misc"]
512 )
513 ],
514
515 [AC_CHECK_LIB(pam, pam_end,
516 [AC_CHECK_LIB(pam, $pam_conv_func,
517 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
518 LIBPAM="-lpam -ldl"],
519 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
520 LIBPAM="-lpam -ldl -lpam_misc"]
521 )
522 ],AC_MSG_WARN([*** pam support will not be built ***]),
523 [-ldl])
524 ]
525 )
526 fi
527 AC_SUBST(LIBPAM)
528
529 dnl -------------------------------
530 dnl Endian-ness check
531 dnl -------------------------------
532 AC_WORDS_BIGENDIAN
533
534 dnl -------------------------------
535 dnl check the size in byte of the C
536 dnl -------------------------------
537 dnl AC_CHECK_SIZEOF(char)
538 dnl AC_CHECK_SIZEOF(int)
539 dnl AC_CHECK_SIZEOF(short)
540 dnl AC_CHECK_SIZEOF(long)
541
542 dnl ----------------------------
543 dnl check existance of functions
544 dnl ----------------------------
545 AC_CHECK_FUNCS(memset memcpy strerror inet_aton daemon snprintf vsnprintf \
546 strlcat strlcpy if_nametoindex if_indextoname getifaddrs \
547 fcntl strnlen strndup)
548 AC_CHECK_FUNCS(setproctitle, ,
549 [AC_CHECK_LIB(util, setproctitle,
550 [LIBS="$LIBS -lutil"
551 AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
552 ]
553 )
554 ]
555 )
556
557 dnl ------------------------------------
558 dnl Determine routing get and set method
559 dnl ------------------------------------
560 AC_MSG_CHECKING(zebra between kernel interface method)
561 if test x"$opsys" = x"gnu-linux"; then
562 if test "${enable_netlink}" = "yes";then
563 AC_MSG_RESULT(netlink)
564 RT_METHOD=rt_netlink.o
565 AC_DEFINE(HAVE_NETLINK,,netlink)
566 netlink=yes
567 elif test "${enable_netlink}" = "no"; then
568 AC_MSG_RESULT(ioctl)
569 RT_METHOD=rt_ioctl.o
570 netlink=no
571 else
572 AC_MSG_RESULT(netlink)
573 RT_METHOD=rt_netlink.o
574 AC_DEFINE(HAVE_NETLINK,,netlink)
575 netlink=yes
576 fi
577 elif test x"$opsys" = x"sol2-6";then
578 AC_MSG_RESULT(Route socket)
579 KERNEL_METHOD="kernel_socket.o"
580 RT_METHOD="rt_socket.o"
581 elif test x"$opsys" = x"sol8";then
582 AC_MSG_RESULT(Route socket)
583 KERNEL_METHOD="kernel_socket.o"
584 RT_METHOD="rt_socket.o"
585 elif test "$opsys" = "irix" ; then
586 AC_MSG_RESULT(Route socket)
587 KERNEL_METHOD="kernel_socket.o"
588 RT_METHOD="rt_socket.o"
589 else
590 AC_TRY_RUN([#include <errno.h>
591 #include <sys/types.h>
592 #include <sys/socket.h>
593
594 main ()
595 {
596 int ac_sock;
597
598 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
599 if (ac_sock < 0 && errno == EINVAL)
600 exit (1);
601 exit (0);
602 }],
603 [KERNEL_METHOD=kernel_socket.o
604 RT_METHOD=rt_socket.o
605 AC_MSG_RESULT(socket)],
606 [RT_METHOD=rt_ioctl.o
607 AC_MSG_RESULT(ioctl)],
608 [KERNEL_METHOD=kernel_socket.o
609 RT_METHOD=rt_socket.o
610 AC_MSG_RESULT(socket)])
611 fi
612 AC_SUBST(RT_METHOD)
613 AC_SUBST(KERNEL_METHOD)
614 AC_SUBST(OTHER_METHOD)
615
616 dnl ------------------------------------
617 dnl check for broken CMSG_FIRSTHDR macro
618 dnl ------------------------------------
619 AC_MSG_CHECKING(for broken CMSG_FIRSTHDR)
620 AC_RUN_IFELSE([AC_LANG_SOURCE([[
621 #ifdef SUNOS_5
622 #define _XPG4_2
623 #define __EXTENSIONS__
624 #endif
625 #include <stdlib.h>
626 #include <sys/types.h>
627 #include <sys/socket.h>
628
629 main()
630 {
631 struct msghdr msg;
632 char buf[4];
633
634 msg.msg_control = buf;
635 msg.msg_controllen = 0;
636
637 if (CMSG_FIRSTHDR(&msg) != NULL)
638 exit(0);
639 exit (1);
640 }]])],[AC_MSG_RESULT(yes - using workaround) AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)],
641 [AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
642
643 dnl ------------------------------
644 dnl check kernel route read method
645 dnl ------------------------------
646 AC_CACHE_CHECK(route read method check, zebra_rtread,
647 [if test "$netlink" = yes; then
648 RTREAD_METHOD="rtread_netlink.o"
649 zebra_rtread="netlink"
650 else
651 for zebra_rtread in /proc/net/route /dev/ip /dev/null;
652 do
653 test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
654 done
655 case $zebra_rtread in
656 "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
657 zebra_rtread="proc";;
658 "/dev/ip")
659 case "$host" in
660 *-freebsd*) RTREAD_METHOD=rtread_sysctl.o
661 zebra_rtread="sysctl";;
662 *) RTREAD_METHOD="rtread_getmsg.o"
663 zebra_rtread="getmsg";;
664 esac;;
665 *) RTREAD_METHOD="rtread_sysctl.o"
666 zebra_rtread="sysctl";;
667 esac
668 fi])
669 AC_SUBST(RTREAD_METHOD)
670
671 dnl -----------------------------
672 dnl check interface lookup method
673 dnl -----------------------------
674 IOCTL_METHOD=ioctl.o
675 AC_MSG_CHECKING(interface looking up method)
676 if test "$netlink" = yes; then
677 AC_MSG_RESULT(netlink)
678 IF_METHOD=if_netlink.o
679 elif test "$opsys" = "sol2-6";then
680 AC_MSG_RESULT(Solaris GIF)
681 IF_METHOD=if_ioctl.o
682 elif test "$opsys" = "sol8";then
683 AC_MSG_RESULT(Solaris GLIF)
684 IF_METHOD=if_ioctl_solaris.o
685 IOCTL_METHOD=ioctl_solaris.o
686 elif test "$opsys" = "irix" ; then
687 AC_MSG_RESULT(IRIX)
688 IF_METHOD=if_ioctl.o
689 elif test "$opsys" = "openbsd";then
690 AC_MSG_RESULT(openbsd)
691 IF_METHOD=if_ioctl.o
692 elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
693 AC_MSG_RESULT(sysctl)
694 IF_METHOD=if_sysctl.o
695 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
696 else
697 AC_MSG_RESULT(ioctl)
698 IF_METHOD=if_ioctl.o
699 fi
700 AC_SUBST(IF_METHOD)
701 AC_SUBST(IOCTL_METHOD)
702
703 dnl ---------------------------------------------------------------
704 dnl figure out how to specify an interface in multicast sockets API
705 dnl ---------------------------------------------------------------
706 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex],,,[#ifdef HAVE_SYS_TYPES_H
707 #include <sys/types.h>
708 #endif
709 #ifdef HAVE_NETINET_IN_H
710 #include <netinet/in.h>
711 #endif])
712
713 AC_MSG_CHECKING([for BSD struct ip_mreq hack])
714 AC_TRY_COMPILE([#ifdef HAVE_SYS_PARAM_H
715 #include <sys/param.h>
716 #endif],[#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500022 || (__FreeBSD_version < 500000 && __FreeBSD_version >= 440000))) || (defined(__NetBSD__) && defined(__NetBSD_Version__) && __NetBSD_Version__ >= 106010000)
717 return (0);
718 #else
719 #error No support for BSD struct ip_mreq hack detected
720 #endif],[AC_MSG_RESULT(yes)
721 AC_DEFINE(HAVE_BSD_STRUCT_IP_MREQ_HACK,,[Can pass ifindex in struct ip_mreq])],
722 AC_MSG_RESULT(no))
723
724 dnl -----------------------
725 dnl check proc file system.
726 dnl -----------------------
727 if test -r /proc/net/dev; then
728 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
729 IF_PROC=if_proc.o
730 fi
731
732 if test -r /proc/net/if_inet6; then
733 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
734 IF_PROC=if_proc.o
735 fi
736 AC_SUBST(IF_PROC)
737
738 dnl -----------------------------
739 dnl check ipforward detect method
740 dnl -----------------------------
741 AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
742 [for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
743 do
744 test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
745 done
746 case $zebra_ipforward_path in
747 "/proc/net/snmp") IPFORWARD=ipforward_proc.o
748 zebra_ipforward_path="proc";;
749 "/dev/ip")
750 case "$host" in
751 *-nec-sysv4*) IPFORWARD=ipforward_ews.o
752 zebra_ipforward_path="ews";;
753 *-freebsd*) IPFORWARD=ipforward_sysctl.o
754 zebra_ipforward_path="sysctl";;
755 *) IPFORWARD=ipforward_solaris.o
756 zebra_ipforward_path="solaris";;
757 esac;;
758 *) IPFORWARD=ipforward_sysctl.o
759 zebra_ipforward_path="sysctl";;
760 esac])
761 AC_SUBST(IPFORWARD)
762
763 AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
764
765 dnl ----------
766 dnl IPv6 check
767 dnl ----------
768 AC_MSG_CHECKING(whether does this OS have IPv6 stack)
769 if test "${enable_ipv6}" = "no"; then
770 AC_MSG_RESULT(disabled)
771 else
772 dnl ----------
773 dnl INRIA IPv6
774 dnl ----------
775 if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
776 zebra_cv_ipv6=yes
777 AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
778 AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
779 RIPNGD="ripngd"
780 OSPF6D="ospf6d"
781 LIB_IPV6=""
782 AC_MSG_RESULT(INRIA IPv6)
783 dnl ---------
784 dnl KAME IPv6
785 dnl ---------
786 elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
787 zebra_cv_ipv6=yes
788 AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
789 AC_DEFINE(KAME,1,KAME IPv6)
790 RIPNGD="ripngd"
791 OSPF6D="ospf6d"
792 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
793 LIB_IPV6="-L/usr/local/v6/lib -linet6"
794 fi
795 AC_MSG_RESULT(KAME)
796 dnl -------------------------
797 dnl MUSICA IPv6
798 dnl default host check
799 dnl It is not used by Kheops
800 dnl -------------------------
801 elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
802 zebra_cv_ipv6=yes
803 AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
804 AC_DEFINE(MUSICA,1,Musica IPv6 stack)
805 AC_DEFINE(KAME,1,KAME IPv6 stack)
806 RIPNGD="ripngd"
807 OSPF6D="ospf6d"
808 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
809 LIB_IPV6="-L/usr/local/v6/lib -linet6"
810 fi
811 AC_MSG_RESULT(MUSICA)
812 dnl ---------
813 dnl NRL check
814 dnl ---------
815 elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
816 zebra_cv_ipv6=yes
817 AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
818 AC_DEFINE(NRL,1,NRL)
819 RIPNGD="ripngd"
820 OSPF6D="ospf6d"
821 if test x"$opsys" = x"bsdi";then
822 AC_DEFINE(BSDI_NRL,,BSDI)
823 AC_MSG_RESULT(BSDI_NRL)
824 else
825 AC_MSG_RESULT(NRL)
826 fi
827 dnl ------------------------------------
828 dnl Solaris 9, 10 and potentially higher
829 dnl ------------------------------------
830 elif test x"$opsys" = x"sol8"; then
831 zebra_cv_ipv6=yes;
832 AC_DEFINE(HAVE_IPV6, 1, IPv6)
833 AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
834 RIPNGD="ripngd"
835 OSPF6D="ospf6d"
836 AC_MSG_RESULT(Solaris IPv6)
837 dnl ----------
838 dnl Linux IPv6
839 dnl ----------
840 elif test "${enable_ipv6}" = "yes"; then
841 AC_EGREP_CPP(yes, [
842 #include <linux/version.h>
843 /* 2.1.128 or later */
844 #if LINUX_VERSION_CODE >= 0x020180
845 yes
846 #endif],
847 [zebra_cv_ipv6=yes
848 zebra_cv_linux_ipv6=yes
849 AC_MSG_RESULT(Linux IPv6)])
850 else
851 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
852 then
853 zebra_cv_ipv6=yes
854 zebra_cv_linux_ipv6=yes
855 AC_MSG_RESULT(Linux IPv6)
856 fi
857 fi
858
859 if test "$zebra_cv_linux_ipv6" = "yes";then
860 AC_MSG_CHECKING(whether libc has IPv6 support)
861 AC_TRY_LINK([#include <netinet/in.h>
862 ],[ int a; a = (int) in6addr_any.s6_addr[0]; if (a != 12345) return a; ],
863 [AC_MSG_RESULT(yes)
864 zebra_cv_ipv6=yes
865 zebra_cv_linux_ipv6=yes],
866 [AC_MSG_RESULT(no)
867 zebra_cv_ipv6=no
868 zebra_cv_linux_ipv6=no])
869 fi
870
871 if test "$zebra_cv_linux_ipv6" = "yes";then
872 AC_MSG_CHECKING(for GNU libc >= 2.1)
873 AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
874 AC_EGREP_CPP(yes, [
875 #include <features.h>
876 #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
877 yes
878 #endif],
879 [glibc=yes
880 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
881 AC_MSG_RESULT(yes)],
882 AC_MSG_RESULT(no)
883 )
884 RIPNGD="ripngd"
885 OSPF6D="ospf6d"
886 if test "$glibc" != "yes"; then
887 INCLUDES="-I/usr/inet6/include"
888 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
889 LIB_IPV6="-L/usr/inet6/lib -linet6"
890 fi
891 fi
892 fi
893
894 dnl -----------------------
895 dnl Set IPv6 related values
896 dnl -----------------------
897 LIBS="$LIB_IPV6 $LIBS"
898 AC_SUBST(LIB_IPV6)
899
900 if test x"$RIPNGD" = x""; then
901 AC_MSG_RESULT(IPv4 only)
902 fi
903 fi
904
905 dnl ------------------
906 dnl IPv6 header checks
907 dnl ------------------
908 if test "x${zebra_cv_ipv6}" = "xyes"; then
909 AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
910 netinet6/in6_var.h netinet6/nd6.h])
911 fi
912
913 dnl --------------------
914 dnl Daemon disable check
915 dnl --------------------
916 if test "${enable_zebra}" = "no";then
917 ZEBRA=""
918 else
919 ZEBRA="zebra"
920 fi
921
922 if test "${enable_bgpd}" = "no";then
923 BGPD=""
924 else
925 BGPD="bgpd"
926 fi
927
928 if test "${enable_ripd}" = "no";then
929 RIPD=""
930 else
931 RIPD="ripd"
932 fi
933
934 if test "${enable_ospfd}" = "no";then
935 OSPFD=""
936 else
937 OSPFD="ospfd"
938 fi
939
940 if test "${enable_watchquagga}" = "no";then
941 WATCHQUAGGA=""
942 else
943 WATCHQUAGGA="watchquagga"
944 fi
945
946 OSPFCLIENT=""
947 if test "${enable_opaque_lsa}" = "yes"; then
948 if test "${enable_ospfapi}" != "no";then
949 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
950
951 if test "${enable_ospfclient}" != "no";then
952 OSPFCLIENT="ospfclient"
953 fi
954 fi
955
956 fi
957
958 case "${enable_ripngd}" in
959 "yes") RIPNGD="ripngd";;
960 "no" ) RIPNGD="";;
961 * ) ;;
962 esac
963
964 case "${enable_ospf6d}" in
965 "yes") OSPF6D="ospf6d";;
966 "no" ) OSPF6D="";;
967 * ) ;;
968 esac
969
970 case "${enable_isisd}" in
971 "yes") ISISD="isisd";;
972 "no" ) ISISD="";;
973 * ) ;;
974 esac
975
976 if test "${enable_bgp_announce}" = "no";then
977 AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
978 fi
979
980 AC_SUBST(ZEBRA)
981 AC_SUBST(BGPD)
982 AC_SUBST(RIPD)
983 AC_SUBST(RIPNGD)
984 AC_SUBST(OSPFD)
985 AC_SUBST(OSPF6D)
986 AC_SUBST(WATCHQUAGGA)
987 AC_SUBST(ISISD)
988 AC_SUBST(VTYSH)
989 AC_SUBST(INCLUDES)
990 AC_SUBST(CURSES)
991 AC_SUBST(OSPFCLIENT)
992 AC_SUBST(OSPFAPI)
993 AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
994 AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
995 AC_CHECK_LIB(crypt, crypt)
996 AC_CHECK_LIB(resolv, res_init)
997 AC_CHECK_LIB(m, main)
998
999 dnl ---------------------------------------------------
1000 dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
1001 dnl ---------------------------------------------------
1002 AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
1003 AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
1004 AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
1005
1006 dnl ---------------------------
1007 dnl check system has GNU regexp
1008 dnl ---------------------------
1009 dnl AC_MSG_CHECKING(whether system has GNU regex)
1010 AC_CHECK_LIB(c, regexec,
1011 [AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
1012 LIB_REGEX=""],
1013 [LIB_REGEX="regex.o"])
1014 AC_SUBST(LIB_REGEX)
1015
1016 dnl ------------------
1017 dnl check Net-SNMP library
1018 dnl ------------------
1019 if test "${enable_snmp}" = "yes"; then
1020 LIBS="${LIBS} -lcrypto"
1021 AC_CHECK_LIB(netsnmp, asn_parse_int,
1022 [AC_DEFINE(HAVE_NETSNMP,,Net SNMP)
1023 AC_DEFINE(HAVE_SNMP,,SNMP)
1024 LIBS="${LIBS} -lnetsnmp"],
1025 [AC_MSG_ERROR([--enable-snmp given, but cannot find support for SNMP])])
1026
1027 for ac_snmp in /usr/include \
1028 /usr/local/include \
1029 /dev/null; do
1030 test -f "${ac_snmp}/net-snmp/library/asn1.h" && break
1031 done
1032
1033 case ${ac_snmp} in
1034 /dev/null)
1035 AC_MSG_ERROR([--enable-snmp given, but can not find header])
1036 ;;
1037 *)
1038 SNMP_INCLUDES="-I${ac_snmp}/net-snmp"
1039 SNMP_INCLUDES="${SNMP_INCLUDES} -I${ac_snmp}/net-snmp/library"
1040 ;;
1041 esac
1042
1043 AC_SUBST(SNMP_INCLUDES)
1044 fi
1045
1046 dnl ----------------------------
1047 dnl check sa_len of sockaddr
1048 dnl ----------------------------
1049 AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
1050 AC_TRY_COMPILE([#include <sys/types.h>
1051 #include <sys/socket.h>
1052 ],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
1053 [AC_MSG_RESULT(yes)
1054 AC_DEFINE(HAVE_SA_LEN,,sa_len)],
1055 AC_MSG_RESULT(no))
1056
1057 dnl ----------------------------
1058 dnl check sin_len of sockaddr_in
1059 dnl ----------------------------
1060 AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
1061 AC_TRY_COMPILE([#include <sys/types.h>
1062 #include <netinet/in.h>
1063 ],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
1064 [AC_MSG_RESULT(yes)
1065 AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
1066 AC_MSG_RESULT(no))
1067
1068 dnl ----------------------------
1069 dnl check sun_len of sockaddr_un
1070 dnl ----------------------------
1071 AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
1072 AC_TRY_COMPILE([#include <sys/types.h>
1073 #include <sys/un.h>
1074 ],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
1075 [AC_MSG_RESULT(yes)
1076 AC_DEFINE(HAVE_SUN_LEN,,sun_len)],
1077 AC_MSG_RESULT(no))
1078
1079 dnl -----------------------------------
1080 dnl check sin6_scope_id of sockaddr_in6
1081 dnl -----------------------------------
1082 if test "$zebra_cv_ipv6" = yes; then
1083 AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
1084 AC_TRY_COMPILE([#include <sys/types.h>
1085 #include <netinet/in.h>
1086 ],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
1087 [AC_MSG_RESULT(yes)
1088 AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)],
1089 AC_MSG_RESULT(no))
1090 fi
1091
1092 dnl ----------------------------
1093 dnl check socklen_t exist or not
1094 dnl ----------------------------
1095 AC_MSG_CHECKING(whther socklen_t is defined)
1096 AC_TRY_COMPILE([#include <sys/types.h>
1097 #include <sys/socket.h>
1098 #include <netinet/in.h>
1099 ],[socklen_t ac_x;],
1100 [AC_MSG_RESULT(yes)
1101 AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)],
1102 AC_MSG_RESULT(no))
1103
1104 dnl ------------------------
1105 dnl check struct sockaddr_dl
1106 dnl ------------------------
1107 AC_MSG_CHECKING(whether struct sockaddr_dl exist)
1108 AC_EGREP_HEADER(sockaddr_dl,
1109 net/if_dl.h,
1110 [AC_MSG_RESULT(yes)
1111 AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)],
1112 AC_MSG_RESULT(no))
1113
1114 dnl --------------------------
1115 dnl check structure ifaliasreq
1116 dnl --------------------------
1117 AC_MSG_CHECKING(whether struct ifaliasreq exist)
1118 AC_EGREP_HEADER(ifaliasreq,
1119 net/if.h,
1120 [AC_MSG_RESULT(yes)
1121 AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)],
1122 AC_MSG_RESULT(no))
1123
1124 dnl ----------------------------
1125 dnl check structure in6_aliasreq
1126 dnl ----------------------------
1127 AC_MSG_CHECKING(whether struct in6_aliasreq exist)
1128 AC_EGREP_HEADER(in6_aliasreq,
1129 netinet6/in6_var.h,
1130 [AC_MSG_RESULT(yes)
1131 AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
1132 AC_MSG_RESULT(no))
1133
1134 dnl -----------------------------------
1135 dnl check ifra_lifetime of in6_aliasreq
1136 dnl -----------------------------------
1137 AC_MSG_CHECKING(whether in6_aliasreq.ifra_lifetime exist)
1138 AC_TRY_COMPILE([#include <sys/types.h>
1139 #include <netinet6/in6_var.h>
1140 ],[static struct if6_aliasreq ac_i;int ac_j = sizeof (ac_i.ifra_lifetime);],
1141 [AC_MSG_RESULT(yes)
1142 AC_DEFINE(HAVE_IFRA_LIFETIME,,Have in6_aliasreq.ifra_lifetime)],
1143 AC_MSG_RESULT(no))
1144
1145 dnl ---------------------------
1146 dnl check structure rt_addrinfo
1147 dnl ---------------------------
1148 AC_MSG_CHECKING(whether struct rt_addrinfo exist)
1149 AC_EGREP_HEADER(rt_addrinfo,
1150 net/route.h,
1151 [AC_MSG_RESULT(yes)
1152 AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)],
1153 AC_MSG_RESULT(no))
1154
1155 dnl --------------------------
1156 dnl check structure in_pktinfo
1157 dnl --------------------------
1158 AC_MSG_CHECKING(whether struct in_pktinfo exist)
1159 AC_TRY_COMPILE([#include <netinet/in.h>
1160 ],[struct in_pktinfo ac_x;],
1161 [AC_MSG_RESULT(yes)
1162 AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
1163 AC_MSG_RESULT(no))
1164
1165 dnl ----------------------------------
1166 dnl check struct nd_opt_homeagent_info
1167 dnl ----------------------------------
1168 AC_MSG_CHECKING(whether struct nd_opt_homeagent_info exist)
1169 AC_EGREP_HEADER(nd_opt_homeagent_info,
1170 netinet/icmp6.h,
1171 [AC_MSG_RESULT(yes)
1172 AC_DEFINE(HAVE_ND_OPT_HOMEAGENT_INFO,,nd_opt_homeagent_info)],
1173 AC_MSG_RESULT(no))
1174
1175 dnl --------------------------------
1176 dnl check struct nd_opt_adv_interval
1177 dnl --------------------------------
1178 AC_MSG_CHECKING(whether struct nd_opt_adv_interval exist)
1179 AC_EGREP_HEADER(nd_opt_adv_interval,
1180 netinet/icmp6.h,
1181 [AC_MSG_RESULT(yes)
1182 AC_DEFINE(HAVE_ND_OPT_ADV_INTERVAL,,nd_opt_adv_interval)],
1183 AC_MSG_RESULT(no))
1184
1185 dnl ------------------------------------
1186 dnl check fields in nd_opt_adv_interval
1187 dnl ------------------------------------
1188 AC_MSG_CHECKING(whether nd_opt_ai_type field exist)
1189 AC_EGREP_HEADER(nd_opt_ai_type,
1190 netinet/icmp6.h,
1191 [AC_MSG_RESULT(yes)
1192 AC_DEFINE(HAVE_ND_OPT_ADV_INTERVAL_AI_FIELDS,,nd_opt_ai_type)],
1193 AC_MSG_RESULT(no))
1194
1195 dnl --------------------------------------
1196 dnl checking for getrusage struct and call
1197 dnl --------------------------------------
1198 AC_MSG_CHECKING(whether getrusage is available)
1199 AC_TRY_COMPILE([#include <sys/resource.h>
1200 ],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
1201 [AC_MSG_RESULT(yes)
1202 AC_DEFINE(HAVE_RUSAGE,,rusage)],
1203 AC_MSG_RESULT(no))
1204
1205 dnl -------------------
1206 dnl capabilities checks
1207 dnl -------------------
1208 if test "${enable_capabilities}" != "no"; then
1209 AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1210 AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1211 [AC_MSG_RESULT(yes)
1212 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1213 quagga_ac_keepcaps="yes"],
1214 AC_MSG_RESULT(no)
1215 )
1216 if test x"${quagga_ac_keepcaps}" = x"yes"; then
1217 AC_CHECK_HEADERS(sys/capability.h)
1218 fi
1219 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1220 AC_CHECK_LIB(cap, cap_init,
1221 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1222 LIBCAP="-lcap"
1223 quagga_ac_lcaps="yes"]
1224 )
1225 else
1226 AC_CHECK_HEADERS(priv.h,
1227 [AC_MSG_CHECKING(Solaris style privileges are available)
1228 AC_TRY_COMPILE([#include <priv.h>],[getpflags(PRIV_AWARE);],
1229 [AC_MSG_RESULT(yes)
1230 AC_DEFINE(HAVE_SOLARIS_CAPABILITIES,1,getpflags)
1231 quagga_ac_scaps="yes"],
1232 AC_MSG_RESULT(no)
1233 )
1234 ]
1235 )
1236 fi
1237 if test x"${quagga_ac_scaps}" = x"yes" \
1238 -o x"${quagga_ac_lcaps}" = x"yes"; then
1239 AC_DEFINE(HAVE_CAPABILITIES,1,capabilities)
1240 fi
1241 fi
1242 AC_SUBST(LIBCAP)
1243
1244 dnl -------------------
1245 dnl test for ucontext.h
1246 dnl -------------------
1247 AC_CHECK_HEADERS(ucontext.h)
1248
1249 dnl ---------------------------
1250 dnl check for glibc 'backtrace'
1251 dnl ---------------------------
1252 if test "${glibc}" = "yes"; then
1253 AC_CHECK_HEADER([execinfo.h],
1254 [AC_CHECK_FUNC([backtrace],
1255 [AC_DEFINE(HAVE_GLIBC_BACKTRACE,,[Glibc backtrace])
1256 AC_DEFINE(HAVE_STACK_TRACE,,[Stack symbol decoding])
1257 ])
1258 ])
1259 fi
1260
1261 dnl -----------------------------------------
1262 dnl check for malloc mallinfo struct and call
1263 dnl this must try and link using LIBS, in
1264 dnl order to check no alternative allocator
1265 dnl has been specified, which might not provide
1266 dnl mallinfo, e.g. such as Umem on Solaris.
1267 dnl -----------------------------------------
1268 AC_CHECK_HEADERS(malloc.h,
1269 [AC_MSG_CHECKING(whether mallinfo is available)
1270 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
1271 [[struct mallinfo ac_x; ac_x = mallinfo ();]])],
1272 [AC_MSG_RESULT(yes)
1273 AC_DEFINE(HAVE_MALLINFO,,mallinfo)],
1274 AC_MSG_RESULT(no)
1275 )
1276 ]
1277 )
1278
1279 dnl ----------
1280 dnl configure date
1281 dnl ----------
1282 CONFDATE=`date '+%Y%m%d'`
1283 AC_SUBST(CONFDATE)
1284
1285 dnl ------------------------------
1286 dnl set paths for state directory
1287 dnl ------------------------------
1288 if test "${prefix}" = "NONE"; then
1289 quagga_statedir_prefix="";
1290 else
1291 quagga_statedir_prefix=${prefix}
1292 fi
1293 if test "${localstatedir}" = '${prefix}/var'; then
1294 AC_CACHE_CHECK(state directory,ac_statedir,
1295 [for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
1296 ${quagga_statedir_prefix}/var/adm dnl
1297 ${quagga_statedir_prefix}/etc dnl
1298 /var/run dnl
1299 /var/adm dnl
1300 /etc dnl
1301 /dev/null;
1302 do
1303 test -d $QUAGGA_STATE_DIR && break
1304 done
1305 quagga_statedir=$QUAGGA_STATE_DIR])
1306 else
1307 quagga_statedir=${localstatedir}
1308 AC_MSG_CHECKING(directory to use for state file)
1309 AC_MSG_RESULT(${quagga_statedir})
1310 AC_SUBST(quagga_statedir)
1311 fi
1312 if test $quagga_statedir = "/dev/null"; then
1313 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1314 fi
1315
1316 AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1317 AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1318 AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1319 AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1320 AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1321 AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
1322 AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
1323 AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
1324 AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1325 AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1326 AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1327 AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1328 AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1329 AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1330 AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
1331 AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
1332 AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
1333
1334 dnl -------------------------------
1335 dnl Quagga sources should always be
1336 dnl current wrt interfaces. Dont
1337 dnl allow deprecated interfaces to
1338 dnl be exposed.
1339 dnl -------------------------------
1340 AC_DEFINE(QUAGGA_NO_DEPRECATED_INTERFACES, 1, Hide deprecated interfaces)
1341
1342 dnl ---------------------------
1343 dnl Check htonl works correctly
1344 dnl ---------------------------
1345 AC_MSG_CHECKING(for working htonl)
1346 AC_CACHE_VAL(ac_cv_htonl_works, [
1347 AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
1348 #include <sys/types.h>
1349 #endif
1350 #ifdef HAVE_NETDB_H
1351 #include <netdb.h>
1352 #endif
1353 #ifdef HAVE_NETINET_IN_H
1354 #include <netinet/in.h>
1355 #endif],
1356 [htonl (0);],
1357 ac_cv_htonl_works=yes,
1358 ac_cv_htonl_works=no)])
1359 AC_MSG_RESULT($ac_cv_htonl_works)
1360
1361 AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile
1362 ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
1363 ospf6d/Makefile isisd/Makefile vtysh/Makefile doc/Makefile
1364 ospfclient/Makefile tests/Makefile m4/Makefile redhat/Makefile
1365 pkgsrc/Makefile
1366 redhat/quagga.spec
1367 lib/version.h
1368 doc/defines.texi
1369 isisd/topology/Makefile
1370 pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
1371 pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
1372 AC_CONFIG_FILES([solaris/Makefile])
1373
1374 AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
1375 ## Hack, but working solution to avoid rebuilding of quagga.info.
1376 ## It's already in CVS until texinfo 4.7 is more common.
1377 AC_CONFIG_COMMANDS([info-time],[touch doc/quagga.info])
1378 AC_OUTPUT
1379
1380 echo "
1381 Quagga configuration
1382 --------------------
1383 quagga version : ${PACKAGE_VERSION}
1384 host operationg system : ${host_os}
1385 source code location : ${srcdir}
1386 compiler : ${CC}
1387 compiler flags : ${CFLAGS}
1388 includes : ${INCLUDES} ${SNMP_INCLUDES}
1389 linker flags : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE}
1390 state file directory : ${quagga_statedir}
1391 config file directory : `eval echo \`echo ${sysconfdir}\``
1392 example directory : `eval echo \`echo ${exampledir}\``
1393 user to run as : ${enable_user}
1394 group to run as : ${enable_group}
1395 group for vty sockets : ${enable_vty_group}
1396 config file mask : ${enable_configfile_mask}
1397 log file mask : ${enable_logfile_mask}
1398
1399 The above user and group must have read/write access to the state file
1400 directory and to the config files in the config file directory."
1401
1402 if test x"$quagga_cv_gnu_make" = x"no"; then echo "
1403 Warning: The ${MAKE-make} programme detected, either in your path or
1404 via the MAKE variable, is not GNU Make. GNU make may be installed as
1405 gmake on some systems. and is required to complete a build of Quagga
1406 " > /dev/stderr
1407 fi