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