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