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