]> git.proxmox.com Git - mirror_frr.git/blob - configure.ac
Add json output support for a few BGP show commands
[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 AC_PREREQ(2.53)
9
10 AC_INIT(Quagga, 0.99.23, [https://bugzilla.quagga.net])
11 AC_CONFIG_SRCDIR(lib/zebra.h)
12 AC_CONFIG_MACRO_DIR([m4])
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 AC_CONFIG_HEADERS(config.h)
23
24 AC_PATH_PROG(PERL, perl)
25 AC_CHECK_PROG([GAWK],[gawk],[gawk],[not-in-PATH])
26 if test "x$GAWK" = "xnot-in-PATH" ; then
27 AC_MSG_ERROR([GNU awk is required for lib/memtype.h made by memtypes.awk.
28 BSD awk complains: awk: gensub doesn't support backreferences (subst "\1") ])
29 fi
30 AC_ARG_VAR([GAWK],[GNU AWK])
31
32 dnl default is to match previous behavior
33 exampledir=${sysconfdir}
34 AC_ARG_ENABLE([exampledir],
35 AC_HELP_STRING([--enable-exampledir],
36 [specify alternate directory for examples]),
37 exampledir="$enableval",)
38 dnl XXX add --exampledir to autoconf standard directory list somehow
39 AC_SUBST(exampledir)
40
41 dnl default is to match previous behavior
42 pkgsrcrcdir=""
43 pkgsrcdir=""
44 AC_ARG_ENABLE([pkgsrcrcdir],
45 AC_HELP_STRING([--enable-pkgsrcrcdir],
46 [specify directory for rc.d scripts]),
47 pkgsrcrcdir="$enableval"; pkgsrcdir="pkgsrc",)
48 dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
49 AC_SUBST(pkgsrcdir)
50 AC_SUBST(pkgsrcrcdir)
51
52 LIBS="$LIBS -L/usr/include/json/ -ljson"
53
54 dnl ------------
55 dnl Check CFLAGS
56 dnl ------------
57 AC_ARG_WITH(cflags,
58 [ --with-cflags Set CFLAGS for use in compilation.])
59 if test "x$with_cflags" != "x" ; then
60 CFLAGS="$with_cflags" ; cflags_specified=yes ;
61 elif test -n "$CFLAGS" ; then
62 cflags_specified=yes ;
63 fi
64
65 AC_ARG_ENABLE(tcmalloc,
66 [ --enable-tcmalloc Turn on tcmalloc],
67 [case "${enableval}" in
68 yes) tcmalloc_enabled=true
69 LIBS="$LIBS -ltcmalloc_minimal"
70 ;;
71 no) tcmalloc_enabled=false ;;
72 *) AC_MSG_ERROR(bad value ${enableval} for --enable-tcmalloc) ;;
73 esac],[tcmalloc_enabled=false])
74
75
76 dnl --------------------
77 dnl Check CC and friends
78 dnl --------------------
79 AC_LANG([C])
80 AC_PROG_CC
81 AC_PROG_CPP
82 AM_PROG_CC_C_O
83 AC_PROG_EGREP
84
85 dnl autoconf 2.59 appears not to support AC_PROG_SED
86 dnl AC_PROG_SED
87 AC_CHECK_PROG([SED],[sed],[sed],[/bin/false])
88
89 dnl pdflatex and latexmk are needed to build HACKING.pdf
90 AC_CHECK_PROG([PDFLATEX],[pdflatex],[pdflatex],[/bin/false])
91 AC_CHECK_PROG([LATEXMK],[latexmk],[latexmk],[/bin/false])
92 if test "x$PDFLATEX" = "x/bin/false" -o "x$LATEXMK" = "x/bin/false"; then
93 AC_MSG_WARN([Will not be able to make PDF versions of TeX documents])
94 else
95 HAVE_LATEX=true
96 fi
97 AM_CONDITIONAL([HAVE_LATEX], [test "x$HAVE_LATEX" = "xtrue"])
98
99 dnl ------------------------------------------------------------------
100 dnl Intel compiler check. Although Intel tries really hard to make icc
101 dnl look like gcc, there are some differences. It's very verbose with
102 dnl -Wall and it doesn't support the individual -W options.
103 dnl ------------------------------------------------------------------
104 if test "x${GCC}" = "xyes" ; then
105 COMPILER="GCC"
106 AC_MSG_CHECKING([whether we are using the Intel compiler])
107 AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
108 [AC_MSG_RESULT([no])],
109 [COMPILER="ICC"
110 AC_MSG_RESULT([yes])]
111 )
112 else
113 AC_MSG_CHECKING([whether we are using SunPro compiler])
114 AC_EGREP_CPP([^__SUNPRO_C.*0x5(7|8|9)], ["__SUNPRO_C" __SUNPRO_C],
115 [AC_MSG_RESULT([no])],
116 [COMPILER="SUNPRO"
117 AC_MSG_RESULT([yes])]
118 )
119 fi
120
121 dnl ---------------------------------------------
122 dnl If CLFAGS doesn\'t exist set default value
123 dnl AC_PROG_CC will have set minimal default
124 dnl already, eg "-O2 -g" for gcc, "-g" for others
125 dnl (Wall is gcc specific... have to make sure
126 dnl gcc is being used before setting it)
127 dnl
128 dnl Intel icc 8.0 also sets __GNUC__,
129 dnl but doesn't support all these fancy -W options.
130 dnl Intel compiler warnings we ignore:
131 dnl 279: controlling expression is constant.
132 dnl 869: parameter "xxx" was never referenced - to avoid massive warnings
133 dnl about "self", "vty", "argc" and "argv" never referenced in DEFUN
134 dnl macro.
135 dnl 981: operands are evaluated in unspecified order.
136 dnl
137 dnl Sun Studio 10 / SunPro 5.7 is also supported,
138 dnl so lets set some sane CFLAGS for it.
139 dnl ---------------------------------------------
140
141 AC_MSG_CHECKING([whether to set a default CFLAGS])
142 if test "x${cflags_specified}" = "x" ; then
143 case ${COMPILER} in
144 "ICC")
145 CFLAGS="-Os -g -Wall"
146 AC_MSG_RESULT([Intel default])
147 ;;
148 "GCC")
149 CFLAGS="-Os -fno-omit-frame-pointer -g -std=gnu99 -Wall"
150 CFLAGS="${CFLAGS} -Wsign-compare -Wpointer-arith"
151 CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
152 CFLAGS="${CFLAGS} -Wmissing-prototypes -Wmissing-declarations"
153 CFLAGS="${CFLAGS} -Wchar-subscripts -Wcast-qual"
154 # TODO: conditionally addd -Wpacked if handled
155 AC_MSG_RESULT([gcc default])
156 ;;
157 "SUNPRO")
158 CFLAGS="-xO4 -v -g -xspace -xcode=pic32 -xstrconst -xc99"
159 AC_MSG_RESULT([SunPro default])
160 ;;
161 *)
162 AC_MSG_RESULT([unknown compiler])
163 ;;
164 esac
165 else
166 AC_MSG_RESULT([CFLAGS supplied by user])
167 fi
168
169 dnl --------------
170 dnl Check programs
171 dnl --------------
172 AC_PROG_INSTALL
173 AC_PROG_LN_S
174 AC_PROG_MAKE_SET
175 AC_CHECK_TOOL(AR, ar)
176
177 dnl ---------------------------
178 dnl We, perhaps unfortunately,
179 dnl depend on GNU Make specific
180 dnl constructs.
181 dnl Give the user a warning if
182 dnl not GNU Make.
183 dnl ---------------------------
184 AC_CACHE_CHECK([if ${MAKE-make} is GNU make], [quagga_cv_gnu_make],
185 [quagga_cv_gnu_make=no
186 if ${MAKE-make} --version 2>/dev/null | \
187 grep '^GNU Make ' >/dev/null ; then
188 quagga_cv_gnu_make=yes;
189 fi
190 ]
191 )
192
193 dnl -----------------
194 dnl System extensions
195 dnl -----------------
196 AC_GNU_SOURCE
197
198 dnl -------
199 dnl libtool
200 dnl -------
201 AC_PROG_LIBTOOL
202
203 dnl ----------------------
204 dnl Packages configuration
205 dnl ----------------------
206 AC_ARG_WITH(pkg-extra-version,
207 AS_HELP_STRING([--with-pkg-extra-version=VER], [add extra version field, for packagers/distributions]),
208 [EXTRAVERSION=$withval],)
209 AC_ARG_WITH(pkg-git-version,
210 AS_HELP_STRING([--with-pkg-git-version], [add git information to MOTD and build version string]),
211 [ test "x$withval" != "xno" && with_pkg_git_version="yes" ])
212 AC_ARG_ENABLE(vtysh,
213 [ --enable-vtysh include integrated vty shell for Quagga])
214 AC_ARG_ENABLE(ipv6,
215 [ --disable-ipv6 turn off IPv6 related features and daemons])
216 AC_ARG_ENABLE(doc,
217 [ --disable-doc do not build docs])
218 AC_ARG_ENABLE(zebra,
219 [ --disable-zebra do not build zebra daemon])
220 AC_ARG_ENABLE(bgpd,
221 [ --disable-bgpd do not build bgpd])
222 AC_ARG_ENABLE(ripd,
223 [ --disable-ripd do not build ripd])
224 AC_ARG_ENABLE(ripngd,
225 [ --disable-ripngd do not build ripngd])
226 AC_ARG_ENABLE(ospfd,
227 [ --disable-ospfd do not build ospfd])
228 AC_ARG_ENABLE(ospf6d,
229 [ --disable-ospf6d do not build ospf6d])
230 AC_ARG_ENABLE(babeld,
231 [ --disable-babeld do not build babeld])
232 AC_ARG_ENABLE(watchquagga,
233 [ --disable-watchquagga do not build watchquagga])
234 AC_ARG_ENABLE(isisd,
235 [ --enable-isisd build isisd])
236 AC_ARG_ENABLE(solaris,
237 [ --enable-solaris build solaris])
238 AC_ARG_ENABLE(bgp-announce,
239 [ --disable-bgp-announce, turn off BGP route announcement])
240 AC_ARG_ENABLE(netlink,
241 [ --enable-netlink force to use Linux netlink interface])
242 AC_ARG_ENABLE(broken-aliases,
243 [ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
244 AC_ARG_ENABLE(snmp,
245 [ --enable-snmp=ARG enable SNMP support (smux or agentx)])
246 AC_ARG_WITH(libpam,
247 [ --with-libpam use libpam for PAM support in vtysh])
248 AC_ARG_ENABLE(tcp-zebra,
249 [ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon])
250 AC_ARG_ENABLE(opaque-lsa,
251 AC_HELP_STRING([--disable-opaque-lsa],[do not build OSPF Opaque-LSA with OSPFAPI support (RFC2370)]))
252 AC_ARG_ENABLE(ospfapi,
253 [ --disable-ospfapi do not build OSPFAPI to access the OSPF LSA Database])
254 AC_ARG_ENABLE(ospfclient,
255 [ --disable-ospfclient do not build OSPFAPI client for OSPFAPI,
256 (this is the default if --disable-ospfapi is set)])
257 AC_ARG_ENABLE(ospf-te,
258 AC_HELP_STRING([--disable-ospf-te],[disable Traffic Engineering Extension to OSPF]))
259 AC_ARG_ENABLE(multipath,
260 [ --enable-multipath=ARG enable multipath function, ARG must be digit])
261 AC_ARG_ENABLE(user,
262 AC_HELP_STRING([--enable-user=user], [user to run Quagga suite as (default quagga)]))
263 AC_ARG_ENABLE(group,
264 AC_HELP_STRING([--enable-group=group], [group to run Quagga suite as (default quagga)]))
265 AC_ARG_ENABLE(vty_group,
266 [ --enable-vty-group=ARG set vty sockets to have specified group as owner])
267 AC_ARG_ENABLE(configfile_mask,
268 [ --enable-configfile-mask=ARG set mask for config files])
269 AC_ARG_ENABLE(logfile_mask,
270 [ --enable-logfile-mask=ARG set mask for log files])
271
272 AC_ARG_ENABLE(rtadv,
273 [ --disable-rtadv disable IPV6 router advertisement feature])
274 AC_ARG_ENABLE(irdp,
275 [ --enable-irdp enable IRDP server support in zebra])
276 AC_ARG_ENABLE(isis_topology,
277 [ --enable-isis-topology enable IS-IS topology generator])
278 AC_ARG_ENABLE(capabilities,
279 [ --disable-capabilities disable using POSIX capabilities])
280 AC_ARG_ENABLE(rusage,
281 [ --disable-rusage disable using getrusage])
282 AC_ARG_ENABLE(gcc_ultra_verbose,
283 [ --enable-gcc-ultra-verbose enable ultra verbose GCC warnings])
284 AC_ARG_ENABLE(linux24_tcp_md5,
285 [ --enable-linux24-tcp-md5 enable support for old, Linux-2.4 RFC2385 patch])
286 AC_ARG_ENABLE(gcc-rdynamic,
287 [ --enable-gcc-rdynamic enable linking with -rdynamic for better backtraces (default if gcc)])
288 AC_ARG_ENABLE(backtrace,
289 [ --disable-backtrace, disable crash backtraces (default autodetect)])
290 AC_ARG_ENABLE(time-check,
291 [ --disable-time-check disable slow thread warning messages])
292 AC_ARG_ENABLE(pcreposix,
293 [ --enable-pcreposix enable using PCRE Posix libs for regex functions])
294 AC_ARG_ENABLE(fpm,
295 [ --enable-fpm enable Forwarding Plane Manager support])
296
297 if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
298 CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
299 CFLAGS="${CFLAGS} -Wmissing-declarations -Wmissing-noreturn"
300 CFLAGS="${CFLAGS} -Wmissing-format-attribute -Wunreachable-code"
301 CFLAGS="${CFLAGS} -Wpacked -Wpadded"
302 fi
303
304 if test x"${enable_gcc_rdynamic}" != x"no" ; then
305 if test x"${enable_gcc_rdynamic}" = x"yes" -o x"$COMPILER" = x"GCC"; then
306 LDFLAGS="${LDFLAGS} -rdynamic"
307 fi
308 fi
309
310 if test x"${enable_time_check}" != x"no" ; then
311 if test x"${enable_time_check}" = x"yes" -o x"${enable_time_check}" = x ; then
312 AC_DEFINE(CONSUMED_TIME_CHECK,5000000,Consumed Time Check)
313 else
314 AC_DEFINE_UNQUOTED(CONSUMED_TIME_CHECK,$enable_time_check,Consumed Time Check)
315 fi
316 fi
317
318 if test "${enable_fpm}" = "yes"; then
319 AC_DEFINE(HAVE_FPM,,Forwarding Plane Manager support)
320 fi
321
322 if test "${enable_broken_aliases}" = "yes"; then
323 if test "${enable_netlink}" = "yes"
324 then
325 AC_MSG_FAILURE([Sorry you can not use netlink with broken aliases])
326 fi
327 AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
328 enable_netlink=no
329 fi
330
331 if test "${enable_tcp_zebra}" = "yes"; then
332 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
333 fi
334
335 if test "${enable_opaque_lsa}" != "no"; then
336 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
337 fi
338
339 if test "${enable_ospf_te}" != "no"; then
340 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
341 AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
342 fi
343
344 if test "${enable_linux24_tcp_md5}" = "yes"; then
345 AC_DEFINE(HAVE_TCP_MD5_LINUX24,,Old Linux 2.4 TCP MD5 Signature Patch)
346 fi
347
348 AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
349 if test "${enable_rtadv}" != "no"; then
350 AC_MSG_RESULT(yes)
351 AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
352 else
353 AC_MSG_RESULT(no)
354 fi
355
356 if test "${enable_irdp}" = "yes"; then
357 AC_DEFINE(HAVE_IRDP,, IRDP )
358 fi
359
360 if test "${enable_isisd}" = "yes" && test "${enable_isis_topology}" = yes; then
361 AC_DEFINE(TOPOLOGY_GENERATE,,Enable IS-IS topology generator code)
362 ISIS_TOPOLOGY_INCLUDES="-I\$(srcdir)/topology"
363 ISIS_TOPOLOGY_DIR="topology"
364 ISIS_TOPOLOGY_LIB="./topology/libtopology.a"
365 fi
366
367 AC_SUBST(ISIS_TOPOLOGY_INCLUDES)
368 AC_SUBST(ISIS_TOPOLOGY_DIR)
369 AC_SUBST(ISIS_TOPOLOGY_LIB)
370
371 if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
372 enable_user="quagga"
373 elif test "${enable_user}" = "no"; then
374 enable_user="root"
375 fi
376
377 if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
378 enable_group="quagga"
379 elif test "${enable_group}" = "no"; then
380 enable_group="root"
381 fi
382
383 if test x"${enable_vty_group}" = x"yes" ; then
384 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
385 elif test x"${enable_vty_group}" != x""; then
386 if test x"${enable_vty_group}" != x"no"; then
387 AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
388 fi
389 fi
390 AC_SUBST([enable_user])
391 AC_SUBST([enable_group])
392 AC_SUBST([enable_vty_group])
393 AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
394 AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
395
396 enable_configfile_mask=${enable_configfile_mask:-0600}
397 AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
398
399 enable_logfile_mask=${enable_logfile_mask:-0600}
400 AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
401
402 MULTIPATH_NUM=1
403
404 case "${enable_multipath}" in
405 [[0-9]|[1-9][0-9]])
406 MULTIPATH_NUM="${enable_multipath}"
407 ;;
408 "")
409 ;;
410 *)
411 AC_MSG_FAILURE([Please specify digit to enable multipath ARG])
412 ;;
413 esac
414
415 AC_SUBST(MULTIPATH_NUM)
416
417 dnl -----------------------------------
418 dnl Add extra version string to package
419 dnl name, string and version fields.
420 dnl -----------------------------------
421 if test "x${EXTRAVERSION}" != "x" ; then
422 VERSION="${VERSION}${EXTRAVERSION}"
423 PACKAGE_VERSION="${PACKAGE_VERSION}${EXTRAVERSION}"
424 PACKAGE_STRING="${PACKAGE_STRING}${EXTRAVERSION}"
425 fi
426
427 if test "x$with_pkg_git_version" = "xyes"; then
428 if test -d "${srcdir}/.git"; then
429 AC_DEFINE(GIT_VERSION, [1], [include git version info])
430 else with_pkg_git_version="no"
431 AC_MSG_WARN([--with-pkg-git-version given, but this is not a git checkout])
432 fi
433 fi
434 AM_CONDITIONAL([GIT_VERSION], [test "x$with_pkg_git_version" = "xyes"])
435
436 dnl ------------------------------------
437 dnl Check C keywords and standard types
438 dnl ------------------------------------
439 AC_C_CONST
440 AC_C_INLINE
441 AC_C_RESTRICT
442 AC_C_VOLATILE
443 AC_HEADER_STDC
444 AC_HEADER_TIME
445 AC_HEADER_SYS_WAIT
446 dnl AC_TYPE_PID_T
447 AC_TYPE_UID_T
448 AC_TYPE_MODE_T
449 AC_TYPE_SIZE_T
450 AC_TYPE_SIGNAL
451 AC_STRUCT_TM
452
453 dnl -------------------------
454 dnl Check other header files.
455 dnl -------------------------
456 AC_CHECK_HEADERS([stropts.h sys/ksym.h sys/times.h sys/select.h \
457 sys/types.h linux/version.h netdb.h asm/types.h \
458 sys/cdefs.h sys/param.h limits.h signal.h \
459 sys/socket.h netinet/in.h time.h sys/time.h])
460
461 dnl Utility macro to avoid retyping includes all the time
462 m4_define([QUAGGA_INCLUDES],
463 [#ifdef SUNOS_5
464 #define _XPG4_2
465 #define __EXTENSIONS__
466 #endif
467 #include <stdio.h>
468 #if STDC_HEADERS
469 # include <stdlib.h>
470 # include <stddef.h>
471 #else
472 # if HAVE_STDLIB_H
473 # include <stdlib.h>
474 # endif
475 #endif
476 #if HAVE_SYS_TYPES_H
477 # include <sys/types.h>
478 #endif
479 /* sys/conf.h depends on param.h on FBSD at least */
480 #if HAVE_SYS_PARAM_H
481 # include <sys/param.h>
482 #endif
483 /* Required for MAXSIG */
484 #if HAVE_SIGNAL_H
485 # include <signal.h>
486 #endif
487 #if HAVE_SYS_SOCKET_H
488 # include <sys/socket.h>
489 #endif
490 #ifdef __APPLE__
491 # define __APPLE_USE_RFC_3542
492 #endif
493 #if HAVE_NETINET_IN_H
494 # include <netinet/in.h>
495 #endif
496 #ifdef TIME_WITH_SYS_TIME
497 # include <sys/time.h>
498 # include <time.h>
499 #else
500 # ifdef HAVE_SYS_TIME_H
501 # include <sys/time.h>
502 # else
503 # include <time.h>
504 # endif
505 #endif /* TIME_WITH_SYS_TIME */
506 ])dnl
507
508 dnl HAVE_NET_IF_H must be discovered by the time the longer AC_CHECK_HEADERS
509 dnl round below execution begins, otherwise it doesn't properly detect
510 dnl HAVE_NETINET6_IN6_VAR_H, HAVE_NET_IF_VAR_H and HAVE_STRUCT_IN6_ALIASREQ
511 dnl on FreeBSD (BZ#408).
512
513 AC_CHECK_HEADERS([net/if.h], [], [], QUAGGA_INCLUDES)
514
515 m4_define([QUAGGA_INCLUDES],
516 QUAGGA_INCLUDES
517 [#if HAVE_NET_IF_H
518 # include <net/if.h>
519 #endif
520 ])dnl
521
522 dnl Same applies for HAVE_NET_IF_VAR_H, which HAVE_NETINET6_ND6_H and
523 dnl HAVE_NETINET_IN_VAR_H depend upon. But if_var.h depends on if.h, hence
524 dnl an additional round for it.
525
526 AC_CHECK_HEADERS([net/if_var.h], [], [], QUAGGA_INCLUDES)
527
528 m4_define([QUAGGA_INCLUDES],
529 QUAGGA_INCLUDES
530 [#if HAVE_NET_IF_VAR_H
531 # include <net/if_var.h>
532 #endif
533 ])dnl
534
535 AC_CHECK_HEADERS([sys/un.h netinet/in_systm.h netinet/in_var.h \
536 net/if_dl.h net/netopt.h net/route.h \
537 inet/nd.h arpa/inet.h netinet/ip_icmp.h \
538 fcntl.h stddef.h sys/ioctl.h syslog.h wchar.h wctype.h \
539 sys/sysctl.h sys/sockio.h kvm.h sys/conf.h],
540 [], [], QUAGGA_INCLUDES)
541
542 AC_CHECK_HEADERS([ucontext.h], [], [],
543 [#ifndef __USE_GNU
544 #define __USE_GNU
545 #endif /* __USE_GNU */
546 QUAGGA_INCLUDES
547 ])
548
549 m4_define([QUAGGA_INCLUDES],
550 QUAGGA_INCLUDES
551 [#if HAVE_SYS_UN_H
552 # include <sys/un.h>
553 #endif
554 #if HAVE_NETINET_IN_SYSTM_H
555 # include <netinet/in_systm.h>
556 #endif
557 #if HAVE_NETINET_IN_VAR_H
558 # include <netinet/in_var.h>
559 #endif
560 #if HAVE_NET_IF_DL_H
561 # include <net/if_dl.h>
562 #endif
563 #if HAVE_NET_NETOPT_H
564 # include <net/netopt.h>
565 #endif
566 #if HAVE_NET_ROUTE_H
567 # include <net/route.h>
568 #endif
569 #if HAVE_INET_ND_H
570 # include <inet/nd.h>
571 #endif
572 #if HAVE_ARPA_INET_H
573 # include <arpa/inet.h>
574 #endif
575 /* Required for IDRP */
576 #if HAVE_NETINET_IP_ICMP_H
577 # include <netinet/ip_icmp.h>
578 #endif
579 ])dnl
580
581 dnl V6 headers are checked below, after we check for v6
582
583 dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
584 case "$host" in
585 [*-sunos5.[6-7]*] | [*-solaris2.[6-7]*])
586 opsys=sol2-6
587 AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.7)
588 AC_DEFINE(SUNOS_5, 1, SunOS 5)
589 AC_CHECK_LIB(xnet, main)
590 CURSES=-lcurses
591 ;;
592 [*-sunos5.[8-9]] \
593 | [*-sunos5.1[0-9]] \
594 | [*-sunos5.1[0-9].[0-9]] \
595 | [*-solaris2.[8-9]] \
596 | [*-solaris2.1[0-9]] \
597 | [*-solaris2.1[0-9].[0-9]])
598 opsys=sol8
599 AC_DEFINE(SUNOS_59, 1, [SunOS 5.8 up])
600 AC_DEFINE(SUNOS_5, 1, [SunOS 5])
601 AC_CHECK_LIB(socket, main)
602 AC_CHECK_LIB(nsl, main)
603 AC_CHECK_LIB(umem, main)
604 AC_CHECK_FUNCS([printstack],
605 [AC_DEFINE([HAVE_PRINTSTACK],1,[Solaris printstack])
606 AC_DEFINE([HAVE_STACK_TRACE],1,[Stack symbols decode functionality])
607 ])
608 CURSES=-lcurses
609 ;;
610 *-sunos5* | *-solaris2*)
611 AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
612 AC_CHECK_LIB(socket, main)
613 AC_CHECK_LIB(nsl, main)
614 CURSES=-lcurses
615 ;;
616 *-linux*)
617 opsys=gnu-linux
618 AC_DEFINE(GNU_LINUX,,GNU Linux)
619 ;;
620 *-nec-sysv4*)
621 AC_CHECK_LIB(nsl, gethostbyname)
622 AC_CHECK_LIB(socket, socket)
623 ;;
624 *-openbsd*)
625 opsys=openbsd
626 AC_DEFINE(OPEN_BSD,,OpenBSD)
627 ;;
628 *-bsdi*)
629 opsys=bsdi
630 OTHER_METHOD="mtu_kvm.o"
631 AC_CHECK_LIB(kvm, main)
632 ;;
633 *-irix6.5)
634 opsys=irix
635 AC_DEFINE(IRIX_65,,IRIX 6.5)
636 ;;
637 esac
638
639 AC_SYS_LARGEFILE
640
641 dnl ---------------------
642 dnl Integrated VTY option
643 dnl ---------------------
644 case "${enable_vtysh}" in
645 "yes") VTYSH="vtysh";
646 AC_DEFINE(VTYSH,,VTY shell)
647 dnl Vtysh uses libreadline, which looks for termcap functions at
648 dnl configure time. We follow readlines search order.
649 dnl The required procedures are in libtermcap on NetBSD, in
650 dnl [TODO] on Linux, and in [TODO] on Solaris.
651 AC_CHECK_LIB(termcap, tputs, LIBREADLINE="$LIBREADLINE -ltermcap",
652 [AC_CHECK_LIB(tinfo, tputs, LIBREADLINE="$LIBREADLINE -ltinfo",
653 [AC_CHECK_LIB(curses, tputs, LIBREADLINE="$LIBREADLINE -lcurses",
654 [AC_CHECK_LIB(ncurses, tputs,
655 LIBREADLINE="$LIBREADLINE -lncurses")]
656 )]
657 )]
658 )
659 AC_CHECK_LIB(readline, main, LIBREADLINE="$LIBREADLINE -lreadline",,
660 "$LIBREADLINE")
661 if test $ac_cv_lib_readline_main = no; then
662 AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
663 fi
664 AC_CHECK_HEADER(readline/history.h)
665 if test $ac_cv_header_readline_history_h = no;then
666 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
667 fi
668 AC_CHECK_LIB(readline, rl_completion_matches,
669 LIBREADLINE="$LIBREADLINE",, "$LIBREADLINE")
670 if test $ac_cv_lib_readline_rl_completion_matches = no; then
671 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
672 fi
673 ;;
674 "no" ) VTYSH="";;
675 * ) ;;
676 esac
677 AC_SUBST(LIBREADLINE)
678 AM_CONDITIONAL(VTYSH, test "x$VTYSH" = "xvtysh")
679
680 dnl ----------
681 dnl PAM module
682 dnl
683 dnl Quagga detects the PAM library it is built against by checking for a
684 dnl functional pam_misc.h (Linux-PAM) or openpam.h (OpenPAM) header. pam_misc.h
685 dnl is known to #include pam_appl.h, the standard header of a PAM library, and
686 dnl openpam.h doesn't do that, although depends on the header too. Hence a
687 dnl little assistance to AC_CHECK_HEADER is necessary for the proper detection
688 dnl of OpenPAM.
689 dnl ----------
690 if test "$with_libpam" = "yes"; then
691 AC_CHECK_HEADER([security/pam_misc.h],
692 [AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
693 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
694 pam_conv_func="misc_conv"
695 ],
696 [], QUAGGA_INCLUDES)
697 AC_CHECK_HEADER([security/openpam.h],
698 [AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
699 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
700 pam_conv_func="openpam_ttyconv"
701 ],
702 [], QUAGGA_INCLUDES[#include <security/pam_appl.h>])
703 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
704 AC_MSG_WARN([*** pam support will not be built ***])
705 with_libpam="no"
706 fi
707 fi
708
709 if test "$with_libpam" = "yes"; then
710 dnl took this test from proftpds configure.in and suited to our needs
711 dnl -------------------------------------------------------------------------
712 dnl
713 dnl This next check looks funky due to a linker problem with some versions
714 dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
715 dnl omitted requiring libdl linking information. PAM-0.72 or better ships
716 dnl with RedHat 6.2 and Debian 2.2 or better.
717 AC_CHECK_LIB(pam, pam_start,
718 [AC_CHECK_LIB(pam, $pam_conv_func,
719 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
720 LIBPAM="-lpam"],
721 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
722 LIBPAM="-lpam -lpam_misc"]
723 )
724 ],
725
726 [AC_CHECK_LIB(pam, pam_end,
727 [AC_CHECK_LIB(pam, $pam_conv_func,
728 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
729 LIBPAM="-lpam -ldl"],
730 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
731 LIBPAM="-lpam -ldl -lpam_misc"]
732 )
733 ],AC_MSG_WARN([*** pam support will not be built ***]),
734 [-ldl])
735 ]
736 )
737 fi
738 AC_SUBST(LIBPAM)
739
740 dnl -------------------------------
741 dnl Endian-ness check
742 dnl -------------------------------
743 AC_WORDS_BIGENDIAN
744
745 dnl -------------------------------
746 dnl check the size in byte of the C
747 dnl -------------------------------
748 dnl AC_CHECK_SIZEOF(char)
749 dnl AC_CHECK_SIZEOF(int)
750 dnl AC_CHECK_SIZEOF(short)
751 dnl AC_CHECK_SIZEOF(long)
752
753 dnl ----------------------------
754 dnl check existance of functions
755 dnl ----------------------------
756 AC_FUNC_CHOWN
757 AC_FUNC_FNMATCH
758 AC_FUNC_FORK
759 AC_FUNC_MEMCMP
760 AC_FUNC_MKTIME
761 AC_FUNC_STRFTIME
762 AC_FUNC_STAT
763 AC_FUNC_SELECT_ARGTYPES
764 AC_FUNC_STRFTIME
765 dnl Avoid AC_FUNC_STRNLEN because it pulls in AC_SYSTEM_EXTENSIONS which
766 dnl can lead to strange side effects. So we just check for strnlen
767 dnl directly, see below.
768 dnl AC_FUNC_STRNLENdnl
769 AC_FUNC_VPRINTF
770
771 dnl -------------------------------
772 dnl bgpd needs pow() and hence libm
773 dnl -------------------------------
774 TMPLIBS="$LIBS"
775 AC_CHECK_HEADER([math.h],
776 [AC_CHECK_LIB([m], [pow],
777 [LIBM="-lm"
778 LIBS="$LIBS $LIBM"
779 AC_DEFINE(HAVE_LIBM,, Have libm)
780 AC_CHECK_FUNCS(pow,[],[LIBM=""])
781 ])
782 ])
783 if test x"$LIBM" = x ; then
784 AC_MSG_WARN([Unable to find working pow function - bgpd may not link])
785 fi
786 LIBS="$TMPLIBS"
787 AC_SUBST(LIBM)
788
789 dnl ---------------
790 dnl other functions
791 dnl ---------------
792 AC_CHECK_FUNCS([dup2 ftruncate getcwd gethostbyname getpagesize gettimeofday \
793 inet_ntoa inet_aton strnlen \
794 memchr memmove memset select socket \
795 strcasecmp strchr strcspn strdup strerror \
796 strncasecmp strndup strrchr strspn strstr \
797 strtol strtoul strlcat strlcpy \
798 daemon snprintf vsnprintf \
799 if_nametoindex if_indextoname getifaddrs \
800 uname fcntl])
801
802 AC_CHECK_FUNCS(setproctitle, ,
803 [AC_CHECK_LIB(util, setproctitle,
804 [LIBS="$LIBS -lutil"
805 AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
806 ]
807 )
808 ]
809 )
810
811 dnl ------------------------------------
812 dnl Determine routing get and set method
813 dnl ------------------------------------
814 AC_MSG_CHECKING(zebra between kernel interface method)
815 if test x"$opsys" = x"gnu-linux"; then
816 if test "${enable_netlink}" = "yes";then
817 AC_MSG_RESULT(netlink)
818 RT_METHOD=rt_netlink.o
819 AC_DEFINE(HAVE_NETLINK,,netlink)
820 netlink=yes
821 elif test "${enable_netlink}" = "no"; then
822 AC_MSG_RESULT(ioctl)
823 RT_METHOD=rt_ioctl.o
824 netlink=no
825 else
826 AC_MSG_RESULT(netlink)
827 RT_METHOD=rt_netlink.o
828 AC_DEFINE(HAVE_NETLINK,,netlink)
829 netlink=yes
830 fi
831 elif test x"$opsys" = x"sol2-6";then
832 AC_MSG_RESULT(Route socket)
833 KERNEL_METHOD="kernel_socket.o"
834 RT_METHOD="rt_socket.o"
835 elif test x"$opsys" = x"sol8";then
836 AC_MSG_RESULT(Route socket)
837 KERNEL_METHOD="kernel_socket.o"
838 RT_METHOD="rt_socket.o"
839 elif test "$opsys" = "irix" ; then
840 AC_MSG_RESULT(Route socket)
841 KERNEL_METHOD="kernel_socket.o"
842 RT_METHOD="rt_socket.o"
843 else
844 AC_TRY_RUN([#include <errno.h>
845 #include <sys/types.h>
846 #include <sys/socket.h>
847
848 main ()
849 {
850 int ac_sock;
851
852 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
853 if (ac_sock < 0 && errno == EINVAL)
854 exit (1);
855 exit (0);
856 }],
857 [KERNEL_METHOD=kernel_socket.o
858 RT_METHOD=rt_socket.o
859 AC_MSG_RESULT(socket)],
860 [RT_METHOD=rt_ioctl.o
861 AC_MSG_RESULT(ioctl)],
862 [KERNEL_METHOD=kernel_socket.o
863 RT_METHOD=rt_socket.o
864 AC_MSG_RESULT(socket)])
865 fi
866 AC_SUBST(RT_METHOD)
867 AC_SUBST(KERNEL_METHOD)
868 AC_SUBST(OTHER_METHOD)
869 AM_CONDITIONAL([HAVE_NETLINK], [test "x$netlink" = "xyes"])
870
871 dnl --------------------------
872 dnl Determine IS-IS I/O method
873 dnl --------------------------
874 AC_DEFINE(ISIS_METHOD_PFPACKET, 1, [ constant value for isis method pfpacket ])
875 AC_DEFINE(ISIS_METHOD_DLPI, 2, [ constant value for isis method dlpi ])
876 AC_DEFINE(ISIS_METHOD_BPF, 3, [ constant value for isis method bpf ])
877 AC_CHECK_HEADER(net/bpf.h)
878 AC_CHECK_HEADER(sys/dlpi.h)
879 AC_MSG_CHECKING(zebra IS-IS I/O method)
880 if test x"$opsys" = x"gnu-linux"; then
881 AC_MSG_RESULT(pfpacket)
882 ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET"
883 elif test x"$opsys" = x"sol2-6" -o x"$opsys" = x"sol8"; then
884 AC_MSG_RESULT(DLPI)
885 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
886 else
887 if test $ac_cv_header_net_bpf_h = no; then
888 if test $ac_cv_header_sys_dlpi_h = no; then
889 AC_MSG_RESULT(none)
890 AC_MSG_WARN([*** IS-IS support will not be built ***])
891 ISISD=""
892 else
893 AC_MSG_RESULT(DLPI)
894 fi
895 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
896 else
897 AC_MSG_RESULT(BPF)
898 ISIS_METHOD_MACRO="ISIS_METHOD_BPF"
899 fi
900 fi
901 AC_DEFINE_UNQUOTED(ISIS_METHOD, $ISIS_METHOD_MACRO, [ selected method for isis, == one of the constants ])
902
903 dnl ------------------------------------
904 dnl check for broken CMSG_FIRSTHDR macro
905 dnl ------------------------------------
906 AC_MSG_CHECKING(for broken CMSG_FIRSTHDR)
907 AC_RUN_IFELSE([AC_LANG_SOURCE([[
908 #ifdef SUNOS_5
909 #define _XPG4_2
910 #define __EXTENSIONS__
911 #endif
912 #ifdef HAVE_STDLIB_H
913 # include <stdlib.h>
914 #endif
915 #ifdef HAVE_SYS_TYPES_H
916 #include <sys/types.h>
917 #endif
918 #ifdef HAVE_SYS_SOCKET_H
919 #include <sys/socket.h>
920 #endif
921
922 main()
923 {
924 struct msghdr msg;
925 char buf[4];
926
927 msg.msg_control = buf;
928 msg.msg_controllen = 0;
929
930 if (CMSG_FIRSTHDR(&msg) != NULL)
931 exit(0);
932 exit (1);
933 }]])],[AC_MSG_RESULT(yes - using workaround) AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)],
934 [AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
935
936 dnl ------------------------------
937 dnl check kernel route read method
938 dnl ------------------------------
939 AC_CACHE_CHECK([route read method], [quagga_cv_rtread_method],
940 [if test "x$netlink" = xyes; then
941 quagga_cv_rtread_method="netlink"
942 else
943 for quagga_cv_rtread_method in /proc/net/route /dev/ip /dev/null;
944 do
945 test x`ls $quagga_cv_rtread_method 2>/dev/null` = x"$quagga_cv_rtread_method" && break
946 done
947 case $quagga_cv_rtread_method in
948 "/proc/net/route") quagga_cv_rtread_method="proc";;
949 "/dev/ip")
950 case "$host" in
951 *-freebsd*) quagga_cv_rtread_method="sysctl";;
952 *) quagga_cv_rtread_method="getmsg";;
953 esac;;
954 *)
955 quagga_cv_rtread_method="sysctl";;
956 esac
957 fi])
958 RTREAD_METHOD=rtread_${quagga_cv_rtread_method}.o
959 AC_SUBST(RTREAD_METHOD)
960
961 dnl -----------------------------
962 dnl check interface lookup method
963 dnl -----------------------------
964 IOCTL_METHOD=ioctl.o
965 AC_MSG_CHECKING(interface looking up method)
966 if test "$netlink" = yes; then
967 AC_MSG_RESULT(netlink)
968 IF_METHOD=if_netlink.o
969 elif test "$opsys" = "sol2-6";then
970 AC_MSG_RESULT(Solaris GIF)
971 IF_METHOD=if_ioctl.o
972 elif test "$opsys" = "sol8";then
973 AC_MSG_RESULT(Solaris GLIF)
974 IF_METHOD=if_ioctl_solaris.o
975 IOCTL_METHOD=ioctl_solaris.o
976 elif test "$opsys" = "irix" ; then
977 AC_MSG_RESULT(IRIX)
978 IF_METHOD=if_ioctl.o
979 elif test "$opsys" = "openbsd";then
980 AC_MSG_RESULT(openbsd)
981 IF_METHOD=if_ioctl.o
982 elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
983 AC_MSG_RESULT(sysctl)
984 IF_METHOD=if_sysctl.o
985 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
986 else
987 AC_MSG_RESULT(ioctl)
988 IF_METHOD=if_ioctl.o
989 fi
990 AC_SUBST(IF_METHOD)
991 AC_SUBST(IOCTL_METHOD)
992
993 dnl ---------------------------------------------------------------
994 dnl figure out how to specify an interface in multicast sockets API
995 dnl ---------------------------------------------------------------
996 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], [], QUAGGA_INCLUDES)
997
998 AC_MSG_CHECKING([for BSD struct ip_mreq hack])
999 AC_TRY_COMPILE([#ifdef HAVE_SYS_PARAM_H
1000 #include <sys/param.h>
1001 #endif],[#if (defined(__FreeBSD__) && ((__FreeBSD_version >= 500022 && __FreeBSD_version < 700000) || (__FreeBSD_version < 500000 && __FreeBSD_version >= 440000))) || (defined(__NetBSD__) && defined(__NetBSD_Version__) && __NetBSD_Version__ >= 106010000) || defined(__OpenBSD__) || defined(__APPLE__)
1002 return (0);
1003 #else
1004 #error No support for BSD struct ip_mreq hack detected
1005 #endif],[AC_MSG_RESULT(yes)
1006 AC_DEFINE(HAVE_BSD_STRUCT_IP_MREQ_HACK,,[Can pass ifindex in struct ip_mreq])],
1007 AC_MSG_RESULT(no))
1008
1009 AC_MSG_CHECKING([for RFC3678 protocol-independed API])
1010 AC_TRY_COMPILE([
1011 #include <sys/types.h>
1012 #include <netinet/in.h>
1013 ], [struct group_req gr; int sock; setsockopt(sock, IPPROTO_IP, MCAST_JOIN_GROUP, (void*)&gr, sizeof(gr));
1014 ], [AC_MSG_RESULT(yes)
1015 AC_DEFINE(HAVE_RFC3678,1,[Have RFC3678 protocol-independed API])],
1016 AC_MSG_RESULT(no))
1017
1018 dnl ---------------------------------------------------------------
1019 dnl figure out how to check link-state
1020 dnl ---------------------------------------------------------------
1021 AC_CHECK_HEADER([net/if.h],
1022 [AC_CHECK_HEADER( [net/if_media.h],
1023 [m4_define([LINK_DETECT_INCLUDES],
1024 QUAGGA_INCLUDES
1025 [#include <net/if_media.h>
1026 ])
1027 AC_CHECK_MEMBERS( [struct ifmediareq.ifm_status],
1028 AC_DEFINE(HAVE_BSD_LINK_DETECT,,[BSD link-detect]),
1029 [], LINK_DETECT_INCLUDES)],
1030 [],
1031 QUAGGA_INCLUDES)],
1032 [], QUAGGA_INCLUDES )
1033
1034 dnl ---------------------------------------------------------------
1035 dnl Additional, newer way to check link-state using ifi_link_state.
1036 dnl Not available in all BSD's when ifmediareq available
1037 dnl ---------------------------------------------------------------
1038 AC_CHECK_HEADER([net/if.h],
1039 AC_CHECK_MEMBERS([struct if_data.ifi_link_state],
1040 AC_DEFINE(HAVE_BSD_IFI_LINK_STATE,,[BSD ifi_link_state available]),
1041 [], QUAGGA_INCLUDES),
1042 ,)
1043
1044 dnl ------------------------
1045 dnl TCP_MD5SIG socket option
1046 dnl ------------------------
1047
1048 AC_CHECK_HEADER([netinet/tcp.h],
1049 [m4_define([MD5_INCLUDES],
1050 QUAGGA_INCLUDES
1051 [#include <netinet/tcp.h>
1052 ])
1053 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)],
1054 [],
1055 QUAGGA_INCLUDES)
1056 if test $ac_cv_have_decl_TCP_MD5SIG = no; then
1057 AC_CHECK_HEADER([linux/tcp.h],
1058 [m4_define([MD5_INCLUDES],
1059 QUAGGA_INCLUDES
1060 [#include <linux/tcp.h>
1061 ])
1062 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)])
1063 fi
1064
1065 dnl -----------------------
1066 dnl check proc file system.
1067 dnl -----------------------
1068 if test "$netlink" != yes; then
1069 if test -r /proc/net/dev; then
1070 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
1071 IF_PROC=if_proc.o
1072 fi
1073 if test -r /proc/net/if_inet6; then
1074 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
1075 IF_PROC=if_proc.o
1076 fi
1077 fi
1078 AC_SUBST(IF_PROC)
1079
1080 dnl -----------------------------
1081 dnl check ipforward detect method
1082 dnl -----------------------------
1083 AC_CACHE_CHECK([ipforward method], [quagga_cv_ipforward_method],
1084 [if test x$cross_compiling = xyes; then
1085 if test x"$opsys" = x"gnu-linux"; then
1086 quagga_cv_ipforward_method=/proc/net/snmp
1087 else
1088 quagga_cv_ipforward_method=/dev/ip
1089 fi
1090 else
1091 for quagga_cv_ipforward_method in /proc/net/snmp /dev/ip /dev/null;
1092 do
1093 test x`ls $quagga_cv_ipforward_method 2>/dev/null` = x"$quagga_cv_ipforward_method" && break
1094 done
1095 fi
1096 case $quagga_cv_ipforward_method in
1097 "/proc/net/snmp") quagga_cv_ipforward_method="proc";;
1098 "/dev/ip")
1099 case "$host" in
1100 *-nec-sysv4*) quagga_cv_ipforward_method="ews";;
1101 *-freebsd*) quagga_cv_ipforward_method="sysctl";;
1102 *) quagga_cv_ipforward_method="solaris";;
1103 esac;;
1104 *) quagga_cv_ipforward_method="sysctl";;
1105 esac])
1106 IPFORWARD=ipforward_${quagga_cv_ipforward_method}.o
1107 AC_SUBST(IPFORWARD)
1108
1109 AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
1110
1111 dnl ----------
1112 dnl IPv6 check
1113 dnl ----------
1114 AC_MSG_CHECKING(whether does this OS have IPv6 stack)
1115 if test "${enable_ipv6}" = "no"; then
1116 AC_MSG_RESULT(disabled)
1117 else
1118 dnl ----------
1119 dnl INRIA IPv6
1120 dnl ----------
1121 if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
1122 zebra_cv_ipv6=yes
1123 AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
1124 AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
1125 RIPNGD="ripngd"
1126 OSPF6D="ospf6d"
1127 LIB_IPV6=""
1128 AC_MSG_RESULT(INRIA IPv6)
1129 dnl ---------
1130 dnl KAME IPv6
1131 dnl ---------
1132 elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
1133 zebra_cv_ipv6=yes
1134 AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
1135 AC_DEFINE(KAME,1,KAME IPv6)
1136 RIPNGD="ripngd"
1137 OSPF6D="ospf6d"
1138 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
1139 LIB_IPV6="-L/usr/local/v6/lib -linet6"
1140 fi
1141 AC_MSG_RESULT(KAME)
1142 dnl -------------------------
1143 dnl MUSICA IPv6
1144 dnl default host check
1145 dnl It is not used by Kheops
1146 dnl -------------------------
1147 elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
1148 zebra_cv_ipv6=yes
1149 AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
1150 AC_DEFINE(MUSICA,1,Musica IPv6 stack)
1151 AC_DEFINE(KAME,1,KAME IPv6 stack)
1152 RIPNGD="ripngd"
1153 OSPF6D="ospf6d"
1154 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
1155 LIB_IPV6="-L/usr/local/v6/lib -linet6"
1156 fi
1157 AC_MSG_RESULT(MUSICA)
1158 dnl ---------
1159 dnl NRL check
1160 dnl ---------
1161 elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
1162 zebra_cv_ipv6=yes
1163 AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
1164 AC_DEFINE(NRL,1,NRL)
1165 RIPNGD="ripngd"
1166 OSPF6D="ospf6d"
1167 if test x"$opsys" = x"bsdi";then
1168 AC_DEFINE(BSDI_NRL,,BSDI)
1169 AC_MSG_RESULT(BSDI_NRL)
1170 else
1171 AC_MSG_RESULT(NRL)
1172 fi
1173 dnl ------------------------------------
1174 dnl Solaris 9, 10 and potentially higher
1175 dnl ------------------------------------
1176 elif test x"$opsys" = x"sol8"; then
1177 zebra_cv_ipv6=yes;
1178 AC_DEFINE(HAVE_IPV6, 1, IPv6)
1179 AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
1180 RIPNGD="ripngd"
1181 OSPF6D="ospf6d"
1182 AC_MSG_RESULT(Solaris IPv6)
1183 dnl ----------
1184 dnl Linux IPv6
1185 dnl ----------
1186 elif test "${enable_ipv6}" = "yes"; then
1187 AC_EGREP_CPP(yes, [
1188 #include <linux/version.h>
1189 /* 2.1.128 or later */
1190 #if LINUX_VERSION_CODE >= 0x020180
1191 yes
1192 #endif],
1193 [zebra_cv_ipv6=yes
1194 zebra_cv_linux_ipv6=yes
1195 AC_MSG_RESULT(Linux IPv6)])
1196 else
1197 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
1198 then
1199 zebra_cv_ipv6=yes
1200 zebra_cv_linux_ipv6=yes
1201 AC_MSG_RESULT(Linux IPv6)
1202 fi
1203 fi
1204
1205 if test "$zebra_cv_linux_ipv6" = "yes";then
1206 AC_MSG_CHECKING(whether libc has IPv6 support)
1207 AC_TRY_LINK([#include <netinet/in.h>
1208 ],[ int a; a = (int) in6addr_any.s6_addr[0]; if (a != 12345) return a; ],
1209 [AC_MSG_RESULT(yes)
1210 zebra_cv_ipv6=yes
1211 zebra_cv_linux_ipv6=yes],
1212 [AC_MSG_RESULT(no)
1213 zebra_cv_ipv6=no
1214 zebra_cv_linux_ipv6=no])
1215 fi
1216
1217 if test "$zebra_cv_linux_ipv6" = "yes";then
1218 AC_MSG_CHECKING(for GNU libc >= 2.1)
1219 AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
1220 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
1221
1222 AC_EGREP_CPP(yes, [
1223 #include <features.h>
1224 #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
1225 yes
1226 #endif],
1227 [glibc=yes
1228 AC_MSG_RESULT(yes)],
1229 AC_MSG_RESULT(no)
1230 )
1231 RIPNGD="ripngd"
1232 OSPF6D="ospf6d"
1233 if test "$glibc" != "yes"; then
1234 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
1235 INCLUDES="-I/usr/inet6/include"
1236 LIB_IPV6="-L/usr/inet6/lib -linet6"
1237 fi
1238 fi
1239 fi
1240
1241 dnl -----------------------
1242 dnl Set IPv6 related values
1243 dnl -----------------------
1244 LIBS="$LIB_IPV6 $LIBS"
1245 AC_SUBST(LIB_IPV6)
1246
1247 if test x"$RIPNGD" = x""; then
1248 AC_MSG_RESULT(IPv4 only)
1249 fi
1250 fi
1251
1252 dnl ------------------
1253 dnl IPv6 header checks
1254 dnl ------------------
1255 if test "x${zebra_cv_ipv6}" = "xyes"; then
1256 AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
1257 netinet6/in6_var.h netinet6/nd6.h], [], [],
1258 QUAGGA_INCLUDES)
1259 fi
1260
1261 m4_define([QUAGGA_INCLUDES],dnl
1262 QUAGGA_INCLUDES
1263 [#if HAVE_NETINET6_IN6_H
1264 #include <netinet6/in6.h>
1265 #endif
1266 #if HAVE_NETINET_IN6_VAR_H
1267 #include <netinet/in6_var.h>
1268 #endif
1269 #if HAVE_NETINET_ICMP6_H
1270 # include <netinet/icmp6.h>
1271 #endif
1272 #if HAVE_NETINET6_IN6_VAR_H
1273 # include <netinet6/in6_var.h>
1274 #endif
1275 #if HAVE_NETINET6_ND6_H
1276 # include <netinet6/nd6.h>
1277 #endif
1278 ])dnl
1279
1280 dnl disable doc check
1281 if test "${enable_doc}" = "no";then
1282 DOC=""
1283 else
1284 DOC="doc"
1285 fi
1286
1287 dnl --------------------
1288 dnl Daemon disable check
1289 dnl --------------------
1290 if test "${enable_zebra}" = "no";then
1291 ZEBRA=""
1292 else
1293 ZEBRA="zebra"
1294 fi
1295 AM_CONDITIONAL(ZEBRA, test "x$ZEBRA" = "xzebra")
1296
1297 if test "${enable_bgpd}" = "no";then
1298 BGPD=""
1299 else
1300 BGPD="bgpd"
1301 fi
1302 AM_CONDITIONAL(BGPD, test "x$BGPD" = "xbgpd")
1303
1304 if test "${enable_ripd}" = "no";then
1305 RIPD=""
1306 else
1307 RIPD="ripd"
1308 fi
1309 AM_CONDITIONAL(RIPD, test "x$RIPD" = "xripd")
1310
1311 if test "${enable_ospfd}" = "no";then
1312 OSPFD=""
1313 else
1314 OSPFD="ospfd"
1315 fi
1316 AM_CONDITIONAL(OSPFD, test "x$OSPFD" = "xospfd")
1317
1318 if test "${enable_babeld}" = "no";then
1319 BABELD=""
1320 else
1321 BABELD="babeld"
1322 fi
1323 AM_CONDITIONAL(BABELD, test "x$BABELD" = "xbabeld")
1324
1325 if test "${enable_watchquagga}" = "no";then
1326 WATCHQUAGGA=""
1327 else
1328 WATCHQUAGGA="watchquagga"
1329 fi
1330 AM_CONDITIONAL(WATCHQUAGGA, test "x$WATCHQUAGGA" = "xwatchquagga")
1331
1332 OSPFCLIENT=""
1333 if test "${enable_opaque_lsa}" != "no"; then
1334 if test "${enable_ospfapi}" != "no";then
1335 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
1336
1337 if test "${enable_ospfclient}" != "no";then
1338 OSPFCLIENT="ospfclient"
1339 fi
1340 fi
1341
1342 fi
1343 AM_CONDITIONAL(OSPFCLIENT, test "x$OSPFCLIENT" = "xospfclient")
1344
1345 case "${enable_ripngd}" in
1346 "yes") RIPNGD="ripngd";;
1347 "no" ) RIPNGD="";;
1348 * ) ;;
1349 esac
1350 AM_CONDITIONAL(RIPNGD, test "x$RIPNGD" = "xripngd")
1351
1352 case "${enable_ospf6d}" in
1353 "yes") OSPF6D="ospf6d";;
1354 "no" ) OSPF6D="";;
1355 * ) ;;
1356 esac
1357 AM_CONDITIONAL(OSPF6D, test "x$OSPF6D" = "xospf6d")
1358
1359 case "${enable_isisd}" in
1360 "yes") ISISD="isisd";;
1361 "no" ) ISISD="";;
1362 * ) ;;
1363 esac
1364 AM_CONDITIONAL(ISISD, test "x$ISISD" = "xisisd")
1365
1366 # XXX Perhaps auto-enable on Solaris, but that's messy for cross builds.
1367 case "${enable_solaris}" in
1368 "yes") SOLARIS="solaris";;
1369 "no" ) SOLARIS="";;
1370 * ) ;;
1371 esac
1372
1373 if test "${enable_bgp_announce}" = "no";then
1374 AC_DEFINE(DISABLE_BGP_ANNOUNCE,1,Disable BGP installation to zebra)
1375 else
1376 AC_DEFINE(DISABLE_BGP_ANNOUNCE,0,Disable BGP installation to zebra)
1377 fi
1378
1379 AC_SUBST(DOC)
1380 AC_SUBST(ZEBRA)
1381 AC_SUBST(BGPD)
1382 AC_SUBST(RIPD)
1383 AC_SUBST(RIPNGD)
1384 AC_SUBST(OSPFD)
1385 AC_SUBST(OSPF6D)
1386 AC_SUBST(BABELD)
1387 AC_SUBST(WATCHQUAGGA)
1388 AC_SUBST(ISISD)
1389 AC_SUBST(SOLARIS)
1390 AC_SUBST(VTYSH)
1391 AC_SUBST(INCLUDES)
1392 AC_SUBST(CURSES)
1393 AC_SUBST(OSPFCLIENT)
1394 AC_SUBST(OSPFAPI)
1395 AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
1396 AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
1397 AC_CHECK_LIB(crypt, crypt)
1398 AC_CHECK_LIB(resolv, res_init)
1399
1400 dnl ---------------------------------------------------
1401 dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
1402 dnl ---------------------------------------------------
1403 AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
1404 AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
1405 AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
1406
1407 dnl ---------------------------
1408 dnl check system has PCRE regexp
1409 dnl ---------------------------
1410 if test "x$enable_pcreposix" = "xyes"; then
1411 AC_CHECK_LIB(pcreposix, pcreposix_regexec, ,[enable_pcreposix=no
1412 AC_MSG_WARN([*** falling back to other regex library ***]) ])
1413 fi
1414
1415 if test "x$enable_pcreposix" != "xyes"; then
1416 dnl ---------------------------
1417 dnl check system has GNU regexp
1418 dnl ---------------------------
1419 AC_MSG_CHECKING(whether system has GNU regex)
1420 AC_CHECK_LIB(c, regexec,
1421 [AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
1422 LIB_REGEX=""],
1423 [LIB_REGEX="regex.o"])
1424 fi
1425 AC_SUBST(HAVE_LIBPCREPOSIX)
1426 AC_SUBST(LIB_REGEX)
1427
1428 dnl ------------------
1429 dnl check Net-SNMP library
1430 dnl ------------------
1431 if test "${enable_snmp}" != ""; then
1432 AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], [no])
1433 if test x"$NETSNMP_CONFIG" = x"no"; then
1434 AC_MSG_ERROR([--enable-snmp given but unable to find net-snmp-config])
1435 fi
1436 LIBS="$LIBS `${NETSNMP_CONFIG} --agent-libs`"
1437 CFLAGS="`${NETSNMP_CONFIG} --base-cflags` $CFLAGS"
1438 AC_MSG_CHECKING([whether we can link to Net-SNMP])
1439 AC_LINK_IFELSE([AC_LANG_PROGRAM([
1440 int main(void);
1441 ],
1442 [
1443 {
1444 return 0;
1445 }
1446 ])],[AC_MSG_RESULT(yes)],[
1447 AC_MSG_RESULT(no)
1448 AC_MSG_ERROR([--enable-snmp given but not usable])])
1449 AC_DEFINE(HAVE_SNMP,,SNMP)
1450 case "${enable_snmp}" in
1451 yes)
1452 SNMP_METHOD=agentx
1453 ;;
1454 smux|agentx)
1455 SNMP_METHOD="${enable_snmp}"
1456 ;;
1457 *)
1458 AC_MSG_ERROR([--enable-snmp given with an unknown method (${enable_snmp}). Use smux or agentx])
1459 ;;
1460 esac
1461 AH_TEMPLATE([SNMP_SMUX], [Use SNMP SMUX to interface with snmpd])
1462 AH_TEMPLATE([SNMP_AGENTX], [Use SNMP AgentX to interface with snmpd])
1463 AC_DEFINE_UNQUOTED(AS_TR_CPP(SNMP_${SNMP_METHOD}),,SNMP method to interface with snmpd)
1464 fi
1465
1466 dnl ---------------------------
1467 dnl sockaddr and netinet checks
1468 dnl ---------------------------
1469 AC_CHECK_TYPES([struct sockaddr, struct sockaddr_in,
1470 struct sockaddr_in6, struct sockaddr_un, struct sockaddr_dl,
1471 socklen_t,
1472 struct ifaliasreq, struct if6_aliasreq, struct in6_aliasreq,
1473 struct nd_opt_adv_interval, struct rt_addrinfo,
1474 struct nd_opt_homeagent_info, struct nd_opt_adv_interval],
1475 [], [], QUAGGA_INCLUDES)
1476
1477 AC_CHECK_MEMBERS([struct sockaddr.sa_len,
1478 struct sockaddr_in.sin_len, struct sockaddr_un.sun_len,
1479 struct sockaddr_in6.sin6_scope_id,
1480 struct sockaddr_dl.sdl_len,
1481 struct if6_aliasreq.ifra_lifetime,
1482 struct nd_opt_adv_interval.nd_opt_ai_type],
1483 [], [], QUAGGA_INCLUDES)
1484
1485 dnl ---------------------------
1486 dnl IRDP/pktinfo/icmphdr checks
1487 dnl ---------------------------
1488 AC_CHECK_TYPES([struct in_pktinfo],
1489 [AC_CHECK_TYPES([struct icmphdr],
1490 [if test "${enable_irdp}" != "no"; then
1491 AC_DEFINE(HAVE_IRDP,, IRDP)
1492 fi],
1493 [if test "${enable_irdp}" = "yes"; then
1494 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1495 fi], [QUAGGA_INCLUDES])],
1496 [if test "${enable_irdp}" = "yes"; then
1497 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1498 fi], [QUAGGA_INCLUDES])
1499
1500 dnl --------------------------------------
1501 dnl checking for getrusage struct and call
1502 dnl --------------------------------------
1503 if test "${enable_rusage}" != "no"; then
1504 AC_MSG_CHECKING(whether getrusage is available)
1505 AC_TRY_COMPILE([#include <sys/resource.h>],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
1506 [AC_MSG_RESULT(yes)
1507 AC_DEFINE(HAVE_RUSAGE,,rusage)],
1508 AC_MSG_RESULT(no))
1509 fi
1510
1511 dnl --------------------------------------
1512 dnl checking for clock_time monotonic struct and call
1513 dnl --------------------------------------
1514 AC_CHECK_DECL(CLOCK_MONOTONIC,
1515 [AC_CHECK_LIB(rt, clock_gettime, [LIBS="$LIBS -lrt"])
1516 AC_DEFINE(HAVE_CLOCK_MONOTONIC,, Have monotonic clock)
1517 ], [AC_MSG_RESULT(no)], [QUAGGA_INCLUDES])
1518
1519 dnl -------------------
1520 dnl capabilities checks
1521 dnl -------------------
1522 if test "${enable_capabilities}" != "no"; then
1523 AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1524 AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1525 [AC_MSG_RESULT(yes)
1526 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1527 quagga_ac_keepcaps="yes"],
1528 AC_MSG_RESULT(no)
1529 )
1530 if test x"${quagga_ac_keepcaps}" = x"yes"; then
1531 AC_CHECK_HEADERS(sys/capability.h)
1532 fi
1533 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1534 AC_CHECK_LIB(cap, cap_init,
1535 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1536 LIBCAP="-lcap"
1537 quagga_ac_lcaps="yes"]
1538 )
1539 else
1540 AC_CHECK_HEADERS(priv.h,
1541 [AC_MSG_CHECKING(Solaris style privileges are available)
1542 AC_TRY_COMPILE([#include <priv.h>],[getpflags(PRIV_AWARE);],
1543 [AC_MSG_RESULT(yes)
1544 AC_DEFINE(HAVE_SOLARIS_CAPABILITIES,1,getpflags)
1545 quagga_ac_scaps="yes"],
1546 AC_MSG_RESULT(no)
1547 )
1548 ]
1549 )
1550 fi
1551 if test x"${quagga_ac_scaps}" = x"yes" \
1552 -o x"${quagga_ac_lcaps}" = x"yes"; then
1553 AC_DEFINE(HAVE_CAPABILITIES,1,capabilities)
1554 fi
1555 fi
1556 AC_SUBST(LIBCAP)
1557
1558 dnl ---------------------------------------------------------------------------
1559 dnl http://www.gnu.org/software/autoconf-archive/ax_sys_weak_alias.html
1560 dnl Check for and set one of the following = 1
1561 dnl HAVE_SYS_WEAK_ALIAS_ATTRIBUTE
1562 dnl HAVE_SYS_WEAK_ALIAS_PRAGMA
1563 dnl HAVE_SYS_WEAK_ALIAS_HPSECONDARY
1564 dnl HAVE_SYS_WEAK_ALIAS_CRIDUPLICATE
1565 dnl If any scheme is found, set
1566 dnl HAVE_SYS_WEAK_ALIAS=1
1567 dnl The following variable is set to text value
1568 dnl WEAK_ALIAS = "attribute" || "pragma" || "hpsecondary" || "criduplicate" || "no"
1569 dnl If weak alias can cross object file boundaries
1570 dnl WEAK_ALIAS_CROSSFILE = "yes" || "no"
1571 dnl ---------------------------------------------------------------------------
1572 AX_SYS_WEAK_ALIAS
1573
1574 dnl ---------------------------
1575 dnl check for glibc 'backtrace'
1576 dnl ---------------------------
1577 if test x"${enable_backtrace}" != x"no" ; then
1578 backtrace_ok=no
1579 AC_CHECK_HEADER([execinfo.h], [
1580 AC_SEARCH_LIBS([backtrace], [execinfo], [
1581 AC_DEFINE(HAVE_GLIBC_BACKTRACE,,[Glibc backtrace])
1582 AC_DEFINE(HAVE_STACK_TRACE,,[Stack symbol decoding])
1583 backtrace_ok=yes
1584 ],, [-lm])
1585 ])
1586
1587 if test x"${enable_backtrace}" = x"yes" -a x"${backtrace_ok}" = x"no"; then
1588 dnl user explicitly requested backtrace but we failed to find support
1589 AC_MSG_FAILURE([failed to find backtrace support])
1590 fi
1591 fi
1592
1593 dnl -----------------------------------------
1594 dnl check for malloc mallinfo struct and call
1595 dnl this must try and link using LIBS, in
1596 dnl order to check no alternative allocator
1597 dnl has been specified, which might not provide
1598 dnl mallinfo, e.g. such as Umem on Solaris.
1599 dnl -----------------------------------------
1600 AC_CHECK_HEADER([malloc.h],
1601 [AC_MSG_CHECKING(whether mallinfo is available)
1602 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
1603 [[struct mallinfo ac_x; ac_x = mallinfo ();]])],
1604 [AC_MSG_RESULT(yes)
1605 AC_DEFINE(HAVE_MALLINFO,,mallinfo)],
1606 AC_MSG_RESULT(no)
1607 )
1608 ], [], QUAGGA_INCLUDES)
1609
1610 dnl ----------
1611 dnl configure date
1612 dnl ----------
1613 CONFDATE=`date '+%Y%m%d'`
1614 AC_SUBST(CONFDATE)
1615
1616 dnl Conditionally enable PIE support for GNU toolchains.
1617 AC_ARG_ENABLE(pie, AS_HELP_STRING([--disable-pie], [Do not build tools as a Position Independent Executables]))
1618 if test "$enable_pie" != "no"; then
1619 AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [
1620 save_CFLAGS=$CFLAGS
1621 save_LDFLAGS=$LDFLAGS
1622 CFLAGS="$CFLAGS -fPIE"
1623 LDFLAGS="$LDFLAGS -pie"
1624 AC_LINK_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
1625 [ap_cv_cc_pie=yes], [ap_cv_cc_pie=no]
1626 )
1627 CFLAGS=$save_CFLAGS
1628 LDFLAGS=$save_LDFLAGS
1629 ])
1630 if test "$ap_cv_cc_pie" = "yes"; then
1631 PICFLAGS="-fPIE"
1632 PILDFLAGS="-pie"
1633 fi
1634 fi
1635
1636 AC_SUBST(PICFLAGS)
1637 AC_SUBST(PILDFLAGS)
1638
1639 dnl -------
1640 dnl DejaGNU
1641 dnl -------
1642 if test x"$DEJAGNU" = x
1643 then
1644 DEJAGNU="\$(top_srcdir)/tests/global-conf.exp"
1645 fi
1646 RUNTESTDEFAULTFLAGS="-x --tool \$\$tool"
1647
1648 AC_SUBST(DEJAGNU)
1649 AC_SUBST(RUNTESTDEFAULTFLAGS)
1650
1651 dnl ------------------------------
1652 dnl set paths for state directory
1653 dnl ------------------------------
1654 AC_MSG_CHECKING(directory to use for state file)
1655 if test "${prefix}" = "NONE"; then
1656 quagga_statedir_prefix="";
1657 else
1658 quagga_statedir_prefix=${prefix}
1659 fi
1660 if test "${localstatedir}" = '${prefix}/var'; then
1661 for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
1662 ${quagga_statedir_prefix}/var/adm dnl
1663 ${quagga_statedir_prefix}/etc dnl
1664 /var/run dnl
1665 /var/adm dnl
1666 /etc dnl
1667 /dev/null;
1668 do
1669 test -d $QUAGGA_STATE_DIR && break
1670 done
1671 quagga_statedir=$QUAGGA_STATE_DIR
1672 else
1673 quagga_statedir=${localstatedir}
1674 fi
1675 if test $quagga_statedir = "/dev/null"; then
1676 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1677 fi
1678 AC_MSG_RESULT(${quagga_statedir})
1679 AC_SUBST(quagga_statedir)
1680
1681 AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1682 AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1683 AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1684 AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1685 AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1686 AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
1687 AC_DEFINE_UNQUOTED(PATH_BABELD_PID, "$quagga_statedir/babeld.pid",babeld PID)
1688 AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
1689 AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
1690 AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1691 AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1692 AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1693 AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1694 AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1695 AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1696 AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
1697 AC_DEFINE_UNQUOTED(BABEL_VTYSH_PATH, "$quagga_statedir/babeld.vty",babeld vty socket)
1698 AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
1699 AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
1700
1701 dnl -------------------------------
1702 dnl Quagga sources should always be
1703 dnl current wrt interfaces. Dont
1704 dnl allow deprecated interfaces to
1705 dnl be exposed.
1706 dnl -------------------------------
1707 AC_DEFINE(QUAGGA_NO_DEPRECATED_INTERFACES, 1, Hide deprecated interfaces)
1708
1709 dnl ---------------------------
1710 dnl Check htonl works correctly
1711 dnl ---------------------------
1712 AC_MSG_CHECKING(for working htonl)
1713 AC_CACHE_VAL(ac_cv_htonl_works,
1714 [AC_LINK_IFELSE([AC_LANG_PROGRAM([QUAGGA_INCLUDES],[htonl (0);])],
1715 [ac_cv_htonl_works=yes], [ac_cv_htonl_works=no])
1716 ]
1717 )
1718 AC_MSG_RESULT($ac_cv_htonl_works)
1719
1720 AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile
1721 ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
1722 ospf6d/Makefile isisd/Makefile babeld/Makefile vtysh/Makefile
1723 doc/Makefile ospfclient/Makefile tests/Makefile m4/Makefile
1724 tests/bgpd.tests/Makefile
1725 tests/libzebra.tests/Makefile
1726 redhat/Makefile
1727 pkgsrc/Makefile
1728 redhat/quagga.spec
1729 lib/version.h
1730 doc/defines.texi
1731 isisd/topology/Makefile
1732 pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
1733 pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
1734 AC_CONFIG_FILES([solaris/Makefile])
1735
1736 AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
1737 ## Hack, but working solution to avoid rebuilding of quagga.info.
1738 ## It's already in CVS until texinfo 4.7 is more common.
1739 AC_OUTPUT
1740
1741 echo "
1742 Quagga configuration
1743 --------------------
1744 quagga version : ${PACKAGE_VERSION}
1745 host operating system : ${host_os}
1746 source code location : ${srcdir}
1747 compiler : ${CC}
1748 compiler flags : ${CFLAGS}
1749 make : ${MAKE-make}
1750 includes : ${INCLUDES}
1751 linker flags : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM}
1752 state file directory : ${quagga_statedir}
1753 config file directory : `eval echo \`echo ${sysconfdir}\``
1754 example directory : `eval echo \`echo ${exampledir}\``
1755 user to run as : ${enable_user}
1756 group to run as : ${enable_group}
1757 group for vty sockets : ${enable_vty_group}
1758 config file mask : ${enable_configfile_mask}
1759 log file mask : ${enable_logfile_mask}
1760
1761 The above user and group must have read/write access to the state file
1762 directory and to the config files in the config file directory."
1763
1764 if test x"$quagga_cv_gnu_make" = x"no"; then echo "
1765 Warning: The ${MAKE-make} programme detected, either in your path or
1766 via the MAKE variable, is not GNU Make. GNU make may be installed as
1767 gmake on some systems. and is required to complete a build of Quagga
1768 " > /dev/stderr
1769 fi