]> git.proxmox.com Git - mirror_frr.git/blob - configure.ac
Merge remote-tracking branch 'origin/cmaster' into cmaster-next
[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 [ --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 AC_PROG_CC_C99
84
85 dnl autoconf 2.59 appears not to support AC_PROG_SED
86 dnl AC_PROG_SED
87 AC_CHECK_PROG([SED],[sed],[sed],[/bin/false])
88
89 dnl pdflatex and latexmk are needed to build HACKING.pdf
90 AC_CHECK_PROG([PDFLATEX],[pdflatex],[pdflatex],[/bin/false])
91 AC_CHECK_PROG([LATEXMK],[latexmk],[latexmk],[/bin/false])
92 if test "x$PDFLATEX" = "x/bin/false" -o "x$LATEXMK" = "x/bin/false"; then
93 AC_MSG_WARN([Will not be able to make PDF versions of TeX documents])
94 else
95 HAVE_LATEX=true
96 fi
97 AM_CONDITIONAL([HAVE_LATEX], [test "x$HAVE_LATEX" = "xtrue"])
98
99 if test "x${GCC}" != "xyes" ; then
100 AC_MSG_CHECKING([whether we are using SunPro compiler])
101 AC_EGREP_CPP([^__SUNPRO_C.*0x5(7|8|9)], ["__SUNPRO_C" __SUNPRO_C],
102 [AC_MSG_RESULT([no])],
103 [COMPILER="SUNPRO"
104 AC_MSG_RESULT([yes])]
105 )
106 fi
107
108 dnl ---------------------------------------------
109 dnl If CLFAGS doesn\'t exist set default value
110 dnl AC_PROG_CC will have set minimal default
111 dnl already, eg "-O2 -g" for gcc, "-g" for others
112 dnl (Wall is gcc specific... have to make sure
113 dnl gcc is being used before setting it)
114 dnl
115 dnl Sun Studio 10 / SunPro 5.7 is also supported,
116 dnl so lets set some sane CFLAGS for it.
117 dnl ---------------------------------------------
118
119 AC_USE_SYSTEM_EXTENSIONS()
120 AC_DEFUN([AC_C_FLAG], [{
121 AC_LANG_PUSH(C)
122 ac_c_flag_save="$CFLAGS"
123 CFLAGS="$CFLAGS $1"
124 AC_MSG_CHECKING([[whether $CC supports $1]])
125 AC_COMPILE_IFELSE(
126 [AC_LANG_PROGRAM([[]])],
127 [
128 AC_MSG_RESULT([yes])
129 m4_if([$3], [], [], [
130 CFLAGS="$ac_c_flag_save"
131 $3
132 ])
133 ], [
134 CFLAGS="$ac_c_flag_save"
135 AC_MSG_RESULT([no])
136 $2
137 ])
138 AC_LANG_POP(C)
139 }])
140
141 AC_MSG_CHECKING([whether to set a default CFLAGS])
142 if test "x${cflags_specified}" = "x" ; then
143 case ${COMPILER} in
144 "SUNPRO")
145 CFLAGS="-xO4 -v -g -xspace -xcode=pic32 -xstrconst -xc99"
146 AC_MSG_RESULT([SunPro default])
147 ;;
148 *)
149 AC_MSG_RESULT([autodetecting])
150
151 AC_C_FLAG([-diag-error 10006])
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 AC_DEFINE(HAVE_LDPD, 1, ldpd)
1318 else
1319 LDPD=""
1320 fi
1321 AM_CONDITIONAL(LDPD, test "x$LDPD" = "xldpd")
1322
1323 if test "${enable_watchquagga}" = "no";then
1324 WATCHQUAGGA=""
1325 else
1326 WATCHQUAGGA="watchquagga"
1327 fi
1328 AM_CONDITIONAL(WATCHQUAGGA, test "x$WATCHQUAGGA" = "xwatchquagga")
1329
1330 OSPFCLIENT=""
1331 if test "${enable_ospfapi}" != "no";then
1332 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
1333
1334 if test "${enable_ospfclient}" != "no";then
1335 OSPFCLIENT="ospfclient"
1336 fi
1337 fi
1338
1339 AM_CONDITIONAL(OSPFCLIENT, test "x$OSPFCLIENT" = "xospfclient")
1340
1341 case "${enable_ripngd}" in
1342 "no" ) RIPNGD="";;
1343 * ) RIPNGD="ripngd";;
1344 esac
1345 AM_CONDITIONAL(RIPNGD, test "x$RIPNGD" = "xripngd")
1346
1347 case "${enable_ospf6d}" in
1348 "no" ) OSPF6D="";;
1349 * ) OSPF6D="ospf6d";;
1350 esac
1351 AM_CONDITIONAL(OSPF6D, test "x$OSPF6D" = "xospf6d")
1352
1353 case "${enable_isisd}" in
1354 "no" ) ISISD="";;
1355 * ) ISISD="isisd";;
1356 esac
1357 AM_CONDITIONAL(ISISD, test "x$ISISD" = "xisisd")
1358
1359 case "${enable_pimd}" in
1360 "no" ) PIMD="";;
1361 * ) PIMD="pimd";;
1362 esac
1363 AM_CONDITIONAL(PIMD, test "x$PIMD" = "xpimd")
1364
1365 if test "${enable_bgp_announce}" = "no";then
1366 AC_DEFINE(DISABLE_BGP_ANNOUNCE,1,Disable BGP installation to zebra)
1367 else
1368 AC_DEFINE(DISABLE_BGP_ANNOUNCE,0,Disable BGP installation to zebra)
1369 fi
1370
1371 if test "${with_rfp_path}" = "yes" || test x"${with_rfp_path}" = x""; then
1372 with_rfp_path="bgpd/rfp-example"
1373 fi
1374 if test "${with_rfp_path}" != "no"; then
1375 VNC_RFP_PATH="${with_rfp_path}"
1376 AC_SUBST(VNC_RFP_PATH)
1377 fi
1378
1379 if test "${enable_bgp_vnc}" != "no";then
1380 AC_DEFINE(ENABLE_BGP_VNC,1,Enable BGP VNC support)
1381 RFPTEST="${with_rfp_path}/rfptest"
1382 LIBRFP="${with_rfp_path}/librfp"
1383 RFPINC="${with_rfp_path}/librfp"
1384 else
1385 RFPTEST=
1386 LIBRFP=
1387 RFPINC="bgpd/rfp-example/librfp"
1388 fi
1389 # set
1390 AM_CONDITIONAL([ENABLE_BGP_VNC], [test x${enable_bgp_vnc} != xno])
1391
1392 AC_SUBST(DOC)
1393 AC_SUBST(ZEBRA)
1394 AC_SUBST(RFPTEST)
1395 AC_SUBST(LIBRFP)
1396 AC_SUBST(RFPINC)
1397 AC_SUBST(BGPD)
1398 AC_SUBST(RIPD)
1399 AC_SUBST(RIPNGD)
1400 AC_SUBST(OSPFD)
1401 AC_SUBST(OSPF6D)
1402 AC_SUBST(LDPD)
1403 AC_SUBST(WATCHQUAGGA)
1404 AC_SUBST(ISISD)
1405 AC_SUBST(PIMD)
1406 AC_SUBST(SOLARIS)
1407 AC_SUBST(VTYSH)
1408 AC_SUBST(CURSES)
1409 AC_SUBST(OSPFCLIENT)
1410 AC_SUBST(OSPFAPI)
1411 AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
1412 AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
1413 AC_CHECK_LIB(crypt, crypt)
1414 AC_CHECK_LIB(resolv, res_init)
1415
1416 dnl ---------------------------
1417 dnl check system has PCRE regexp
1418 dnl ---------------------------
1419 if test "x$enable_pcreposix" = "xyes"; then
1420 AC_CHECK_LIB(pcreposix, pcreposix_regexec, ,[enable_pcreposix=no
1421 AC_MSG_WARN([*** falling back to other regex library ***]) ])
1422 fi
1423
1424 if test "x$enable_pcreposix" != "xyes"; then
1425 dnl ---------------------------
1426 dnl check system has GNU regexp
1427 dnl ---------------------------
1428 AC_MSG_CHECKING(whether system has GNU regex)
1429 AC_CHECK_LIB(c, regexec,
1430 [AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
1431 LIB_REGEX=""],
1432 [LIB_REGEX="regex.o"])
1433 fi
1434 AC_SUBST(HAVE_LIBPCREPOSIX)
1435 AC_SUBST(LIB_REGEX)
1436
1437 dnl ------------------
1438 dnl check Net-SNMP library
1439 dnl ------------------
1440 if test "${enable_snmp}" != ""; then
1441 AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], [no])
1442 if test x"$NETSNMP_CONFIG" = x"no"; then
1443 AC_MSG_ERROR([--enable-snmp given but unable to find net-snmp-config])
1444 fi
1445 LIBS="$LIBS `${NETSNMP_CONFIG} --agent-libs`"
1446 CFLAGS="`${NETSNMP_CONFIG} --base-cflags` $CFLAGS"
1447 AC_MSG_CHECKING([whether we can link to Net-SNMP])
1448 AC_LINK_IFELSE([AC_LANG_PROGRAM([
1449 int main(void);
1450 ],
1451 [
1452 {
1453 return 0;
1454 }
1455 ])],[AC_MSG_RESULT(yes)],[
1456 AC_MSG_RESULT(no)
1457 AC_MSG_ERROR([--enable-snmp given but not usable])])
1458 AC_DEFINE(HAVE_SNMP,,SNMP)
1459 case "${enable_snmp}" in
1460 yes)
1461 SNMP_METHOD=agentx
1462 ;;
1463 smux|agentx)
1464 SNMP_METHOD="${enable_snmp}"
1465 ;;
1466 *)
1467 AC_MSG_ERROR([--enable-snmp given with an unknown method (${enable_snmp}). Use smux or agentx])
1468 ;;
1469 esac
1470 AH_TEMPLATE([SNMP_SMUX], [Use SNMP SMUX to interface with snmpd])
1471 AH_TEMPLATE([SNMP_AGENTX], [Use SNMP AgentX to interface with snmpd])
1472 AC_DEFINE_UNQUOTED(AS_TR_CPP(SNMP_${SNMP_METHOD}),,SNMP method to interface with snmpd)
1473 fi
1474
1475 dnl ---------------------------
1476 dnl sockaddr and netinet checks
1477 dnl ---------------------------
1478 AC_CHECK_TYPES([struct sockaddr, struct sockaddr_in,
1479 struct sockaddr_in6, struct sockaddr_un, struct sockaddr_dl,
1480 socklen_t, struct vifctl, struct mfcctl, struct sioc_sg_req,
1481 vifi_t, struct sioc_vif_req, struct igmpmsg,
1482 struct ifaliasreq, struct if6_aliasreq, struct in6_aliasreq,
1483 struct nd_opt_adv_interval, struct rt_addrinfo,
1484 struct nd_opt_homeagent_info, struct nd_opt_adv_interval],
1485 [], [], QUAGGA_INCLUDES)
1486
1487 AC_CHECK_MEMBERS([struct sockaddr.sa_len,
1488 struct sockaddr_in.sin_len, struct sockaddr_un.sun_len,
1489 struct sockaddr_in6.sin6_scope_id,
1490 struct sockaddr_dl.sdl_len,
1491 struct if6_aliasreq.ifra_lifetime,
1492 struct nd_opt_adv_interval.nd_opt_ai_type],
1493 [], [], QUAGGA_INCLUDES)
1494
1495 dnl ---------------------------
1496 dnl IRDP/pktinfo/icmphdr checks
1497 dnl ---------------------------
1498 AC_CHECK_TYPES([struct in_pktinfo],
1499 [AC_CHECK_TYPES([struct icmphdr],
1500 [if test "${enable_irdp}" != "no"; then
1501 AC_DEFINE(HAVE_IRDP,, IRDP)
1502 fi],
1503 [if test "${enable_irdp}" = "yes"; then
1504 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1505 fi], [QUAGGA_INCLUDES])],
1506 [if test "${enable_irdp}" = "yes"; then
1507 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1508 fi], [QUAGGA_INCLUDES])
1509
1510 dnl -----------------------
1511 dnl checking for IP_PKTINFO
1512 dnl -----------------------
1513 AC_MSG_CHECKING(for IP_PKTINFO)
1514 AC_TRY_COMPILE([#include <netdb.h>], [
1515 int opt = IP_PKTINFO;
1516 ], [
1517 AC_MSG_RESULT(yes)
1518 AC_DEFINE(HAVE_IP_PKTINFO, 1, [Have IP_PKTINFO])
1519 ], [
1520 AC_MSG_RESULT(no)
1521 ])
1522
1523 dnl ---------------------------
1524 dnl checking for IP_RECVDSTADDR
1525 dnl ---------------------------
1526 AC_MSG_CHECKING(for IP_RECVDSTADDR)
1527 AC_TRY_COMPILE([#include <netinet/in.h>], [
1528 int opt = IP_RECVDSTADDR;
1529 ], [
1530 AC_MSG_RESULT(yes)
1531 AC_DEFINE(HAVE_IP_RECVDSTADDR, 1, [Have IP_RECVDSTADDR])
1532 ], [
1533 AC_MSG_RESULT(no)
1534 ])
1535
1536 dnl ----------------------
1537 dnl checking for IP_RECVIF
1538 dnl ----------------------
1539 AC_MSG_CHECKING(for IP_RECVIF)
1540 AC_TRY_COMPILE([#include <netinet/in.h>], [
1541 int opt = IP_RECVIF;
1542 ], [
1543 AC_MSG_RESULT(yes)
1544 AC_DEFINE(HAVE_IP_RECVIF, 1, [Have IP_RECVIF])
1545 ], [
1546 AC_MSG_RESULT(no)
1547 ])
1548
1549 dnl ----------------------
1550 dnl checking for SO_BINDANY
1551 dnl ----------------------
1552 AC_MSG_CHECKING(for SO_BINDANY)
1553 AC_TRY_COMPILE([#include <sys/socket.h>], [
1554 int opt = SO_BINDANY;
1555 ], [
1556 AC_MSG_RESULT(yes)
1557 AC_DEFINE(HAVE_SO_BINDANY, 1, [Have SO_BINDANY])
1558 ], [
1559 AC_MSG_RESULT(no)
1560 ])
1561
1562 dnl ----------------------
1563 dnl checking for IP_FREEBIND
1564 dnl ----------------------
1565 AC_MSG_CHECKING(for IP_FREEBIND)
1566 AC_TRY_COMPILE([#include <netinet/in.h>], [
1567 int opt = IP_FREEBIND;
1568 ], [
1569 AC_MSG_RESULT(yes)
1570 AC_DEFINE(HAVE_IP_FREEBIND, 1, [Have IP_FREEBIND])
1571 ], [
1572 AC_MSG_RESULT(no)
1573 ])
1574
1575 dnl --------------------------------------
1576 dnl checking for getrusage struct and call
1577 dnl --------------------------------------
1578 if test "${enable_rusage}" != "no"; then
1579 AC_MSG_CHECKING(whether getrusage is available)
1580 AC_TRY_COMPILE([#include <sys/resource.h>],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
1581 [AC_MSG_RESULT(yes)
1582 AC_DEFINE(HAVE_RUSAGE,,rusage)],
1583 AC_MSG_RESULT(no))
1584 fi
1585
1586 dnl --------------------------------------
1587 dnl checking for clock_time monotonic struct and call
1588 dnl --------------------------------------
1589 AC_CHECK_DECL(CLOCK_MONOTONIC,
1590 [AC_CHECK_LIB(rt, clock_gettime, [LIBS="$LIBS -lrt"])
1591 AC_DEFINE(HAVE_CLOCK_MONOTONIC,, Have monotonic clock)
1592 ], [AC_MSG_RESULT(no)], [QUAGGA_INCLUDES])
1593
1594 dnl -------------------
1595 dnl capabilities checks
1596 dnl -------------------
1597 if test "${enable_capabilities}" != "no"; then
1598 AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1599 AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1600 [AC_MSG_RESULT(yes)
1601 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1602 quagga_ac_keepcaps="yes"],
1603 AC_MSG_RESULT(no)
1604 )
1605 if test x"${quagga_ac_keepcaps}" = x"yes"; then
1606 AC_CHECK_HEADERS(sys/capability.h)
1607 fi
1608 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1609 AC_CHECK_LIB(cap, cap_init,
1610 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1611 LIBCAP="-lcap"
1612 quagga_ac_lcaps="yes"]
1613 )
1614 else
1615 AC_CHECK_HEADERS(priv.h,
1616 [AC_MSG_CHECKING(Solaris style privileges are available)
1617 AC_TRY_COMPILE([#include <priv.h>],[getpflags(PRIV_AWARE);],
1618 [AC_MSG_RESULT(yes)
1619 AC_DEFINE(HAVE_SOLARIS_CAPABILITIES,1,getpflags)
1620 quagga_ac_scaps="yes"],
1621 AC_MSG_RESULT(no)
1622 )
1623 ]
1624 )
1625 fi
1626 if test x"${quagga_ac_scaps}" = x"yes" \
1627 -o x"${quagga_ac_lcaps}" = x"yes"; then
1628 AC_DEFINE(HAVE_CAPABILITIES,1,capabilities)
1629 fi
1630 fi
1631 AC_SUBST(LIBCAP)
1632
1633 dnl ---------------------------
1634 dnl check for glibc 'backtrace'
1635 dnl ---------------------------
1636 if test x"${enable_backtrace}" != x"no" ; then
1637 backtrace_ok=no
1638 AC_CHECK_HEADER([execinfo.h], [
1639 AC_SEARCH_LIBS([backtrace], [execinfo], [
1640 AC_DEFINE(HAVE_GLIBC_BACKTRACE,,[Glibc backtrace])
1641 AC_DEFINE(HAVE_STACK_TRACE,,[Stack symbol decoding])
1642 backtrace_ok=yes
1643 ],, [-lm])
1644 ])
1645
1646 if test x"${enable_backtrace}" = x"yes" -a x"${backtrace_ok}" = x"no"; then
1647 dnl user explicitly requested backtrace but we failed to find support
1648 AC_MSG_FAILURE([failed to find backtrace support])
1649 fi
1650 fi
1651
1652 dnl -----------------------------------------
1653 dnl check for malloc mallinfo struct and call
1654 dnl this must try and link using LIBS, in
1655 dnl order to check no alternative allocator
1656 dnl has been specified, which might not provide
1657 dnl mallinfo, e.g. such as Umem on Solaris.
1658 dnl -----------------------------------------
1659 AC_CHECK_HEADER([malloc.h],
1660 [AC_MSG_CHECKING(whether mallinfo is available)
1661 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
1662 [[struct mallinfo ac_x; ac_x = mallinfo ();]])],
1663 [AC_MSG_RESULT(yes)
1664 AC_DEFINE(HAVE_MALLINFO,,mallinfo)],
1665 AC_MSG_RESULT(no)
1666 )
1667 ], [], QUAGGA_INCLUDES)
1668
1669 dnl ----------
1670 dnl configure date
1671 dnl ----------
1672 CONFDATE=`date '+%Y%m%d'`
1673 AC_SUBST(CONFDATE)
1674
1675 dnl -------
1676 dnl DejaGNU
1677 dnl -------
1678 if test x"$DEJAGNU" = x
1679 then
1680 DEJAGNU="\$(top_srcdir)/tests/global-conf.exp"
1681 fi
1682 RUNTESTDEFAULTFLAGS="-x --tool \$\$tool"
1683
1684 AC_SUBST(DEJAGNU)
1685 AC_SUBST(RUNTESTDEFAULTFLAGS)
1686
1687 dnl ------------------------------
1688 dnl set paths for state directory
1689 dnl ------------------------------
1690 AC_MSG_CHECKING(directory to use for state file)
1691 if test "${prefix}" = "NONE"; then
1692 quagga_statedir_prefix="";
1693 else
1694 quagga_statedir_prefix=${prefix}
1695 fi
1696 if test "${localstatedir}" = '${prefix}/var'; then
1697 for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
1698 ${quagga_statedir_prefix}/var/adm dnl
1699 ${quagga_statedir_prefix}/etc dnl
1700 /var/run dnl
1701 /var/adm dnl
1702 /etc dnl
1703 /dev/null;
1704 do
1705 test -d $QUAGGA_STATE_DIR && break
1706 done
1707 quagga_statedir=$QUAGGA_STATE_DIR
1708 else
1709 quagga_statedir=${localstatedir}
1710 fi
1711 if test $quagga_statedir = "/dev/null"; then
1712 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1713 fi
1714 AC_MSG_RESULT(${quagga_statedir})
1715 AC_SUBST(quagga_statedir)
1716
1717 AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1718 AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1719 AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1720 AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1721 AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1722 AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
1723 AC_DEFINE_UNQUOTED(PATH_LDPD_PID, "$quagga_statedir/ldpd.pid",ldpd PID)
1724 AC_DEFINE_UNQUOTED(LDPD_SOCKET, "$quagga_statedir/ldpd.sock",ldpd control socket)
1725 AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
1726 AC_DEFINE_UNQUOTED(PATH_PIMD_PID, "$quagga_statedir/pimd.pid",pimd PID)
1727 AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
1728 AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1729 AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1730 AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1731 AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1732 AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1733 AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1734 AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
1735 AC_DEFINE_UNQUOTED(LDP_VTYSH_PATH, "$quagga_statedir/ldpd.vty",ldpd vty socket)
1736 AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
1737 AC_DEFINE_UNQUOTED(PIM_VTYSH_PATH, "$quagga_statedir/pimd.vty",pimd vty socket)
1738 AC_DEFINE_UNQUOTED(WATCHQUAGGA_VTYSH_PATH, "$quagga_statedir/watchquagga.vty",watchquagga vty socket)
1739 AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
1740
1741 dnl autoconf does this, but it does it too late...
1742 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1743 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
1744
1745 dnl get the full path, recursing through variables...
1746 vtysh_bin="$bindir/vtysh"
1747 for I in 1 2 3 4 5 6 7 8 9 10; do
1748 eval vtysh_bin="\"$vtysh_bin\""
1749 done
1750 AC_DEFINE_UNQUOTED(VTYSH_BIN_PATH, "$vtysh_bin",path to vtysh binary)
1751
1752 dnl -------------------------------
1753 dnl Quagga sources should always be
1754 dnl current wrt interfaces. Dont
1755 dnl allow deprecated interfaces to
1756 dnl be exposed.
1757 dnl -------------------------------
1758 AC_DEFINE(QUAGGA_NO_DEPRECATED_INTERFACES, 1, Hide deprecated interfaces)
1759
1760 dnl ---------------------------
1761 dnl Check htonl works correctly
1762 dnl ---------------------------
1763 AC_MSG_CHECKING(for working htonl)
1764 AC_CACHE_VAL(ac_cv_htonl_works,
1765 [AC_LINK_IFELSE([AC_LANG_PROGRAM([QUAGGA_INCLUDES],[htonl (0);])],
1766 [ac_cv_htonl_works=yes], [ac_cv_htonl_works=no])
1767 ]
1768 )
1769 AC_MSG_RESULT($ac_cv_htonl_works)
1770
1771 AC_CONFIG_FILES([Makefile lib/Makefile qpb/Makefile zebra/Makefile ripd/Makefile
1772 ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
1773 ospf6d/Makefile ldpd/Makefile isisd/Makefile vtysh/Makefile
1774 doc/Makefile ospfclient/Makefile tests/Makefile m4/Makefile
1775 pimd/Makefile
1776 tests/bgpd.tests/Makefile
1777 tests/libzebra.tests/Makefile
1778 redhat/Makefile
1779 tools/Makefile
1780 cumulus/Makefile
1781 pkgsrc/Makefile
1782 fpm/Makefile
1783 redhat/quagga.spec
1784 lib/version.h
1785 doc/defines.texi
1786 isisd/topology/Makefile
1787 pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
1788 pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
1789
1790 if test "${enable_bgp_vnc}" != "no"; then
1791 if test "${with_rfp_path}" = "bgpd/rfp-example" ; then
1792 AC_CONFIG_FILES([bgpd/rfp-example/rfptest/Makefile bgpd/rfp-example/librfp/Makefile])
1793 else
1794 AC_CONFIG_FILES([${with_rfp_path}/rfptest/Makefile ${with_rfp_path}/librfp/Makefile])
1795 fi
1796 fi
1797
1798 AC_CONFIG_FILES([solaris/Makefile])
1799
1800 AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
1801
1802 ## Hack, but working solution to avoid rebuilding of quagga.info.
1803 ## It's already in CVS until texinfo 4.7 is more common.
1804 AC_OUTPUT
1805
1806 echo "
1807 Quagga configuration
1808 --------------------
1809 quagga version : ${PACKAGE_VERSION}
1810 host operating system : ${host_os}
1811 source code location : ${srcdir}
1812 compiler : ${CC}
1813 compiler flags : ${CFLAGS}
1814 make : ${MAKE-make}
1815 linker flags : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM}
1816 state file directory : ${quagga_statedir}
1817 config file directory : `eval echo \`echo ${sysconfdir}\``
1818 example directory : `eval echo \`echo ${exampledir}\``
1819 user to run as : ${enable_user}
1820 group to run as : ${enable_group}
1821 group for vty sockets : ${enable_vty_group}
1822 config file mask : ${enable_configfile_mask}
1823 log file mask : ${enable_logfile_mask}
1824 zebra protobuf enabled : ${have_protobuf:-no}
1825
1826 The above user and group must have read/write access to the state file
1827 directory and to the config files in the config file directory."
1828
1829 if test x"$quagga_cv_gnu_make" = x"no"; then echo "
1830 Warning: The ${MAKE-make} programme detected, either in your path or
1831 via the MAKE variable, is not GNU Make. GNU make may be installed as
1832 gmake on some systems. and is required to complete a build of Quagga
1833 " > /dev/stderr
1834 fi