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