blob: 95056e7eab39e3e6467179262555d5ccec2fb180 [file] [log] [blame]
paul7ea487b2003-03-17 02:05:07 +00001##
paule8f29842003-08-12 13:08:31 +00002## Configure template file for Quagga.
paul7ea487b2003-03-17 02:05:07 +00003## autoconf will generate configure script.
4##
5## Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
paule8f29842003-08-12 13:08:31 +00006## Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st>
paul7ea487b2003-03-17 02:05:07 +00007##
ajsb99760a2005-01-04 16:24:43 +00008## $Id: configure.ac,v 1.82 2005/01/04 16:24:43 ajs Exp $
paule8f29842003-08-12 13:08:31 +00009AC_PREREQ(2.53)
paul7ea487b2003-03-17 02:05:07 +000010
paul2b702002004-12-23 20:09:44 +000011AC_INIT(Quagga, 0.97.4, [http://bugzilla.quagga.net])
paulfa1253d2003-09-24 05:09:26 +000012AC_CONFIG_SRCDIR(lib/zebra.h)
gdt81b81822004-04-07 22:48:47 +000013AM_INIT_AUTOMAKE(1.6)
paul7ea487b2003-03-17 02:05:07 +000014AM_CONFIG_HEADER(config.h)
15
gdtd6b72f72003-12-03 17:24:27 +000016dnl default is to match previous behavior
gdtc4f0efe2003-12-04 15:39:25 +000017exampledir=${sysconfdir}
gdtd6b72f72003-12-03 17:24:27 +000018AC_ARG_ENABLE([exampledir],
19 AC_HELP_STRING([--enable-exampledir],
20 [specify alternate directory for examples]),
21 exampledir="$enableval",)
gdtc4f0efe2003-12-04 15:39:25 +000022dnl XXX add --exampledir to autoconf standard directory list somehow
gdtd6b72f72003-12-03 17:24:27 +000023AC_SUBST(exampledir)
24
gdtcbd04082004-08-31 18:16:36 +000025dnl default is to match previous behavior
26pkgsrcrcdir=""
27pkgsrcdir=""
28AC_ARG_ENABLE([pkgsrcrcdir],
29 AC_HELP_STRING([--enable-pkgsrcrcdir],
30 [specify directory for rc.d scripts]),
31 pkgsrcrcdir="$enableval"; pkgsrcdir="pkgsrc",)
32dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
33AC_SUBST(pkgsrcdir)
34AC_SUBST(pkgsrcrcdir)
35
paul7ea487b2003-03-17 02:05:07 +000036dnl -----------------------------------
37dnl Get hostname and other information.
38dnl -----------------------------------
39AC_CANONICAL_HOST
40
41dnl ------------
42dnl Check CFLAGS
43dnl ------------
44AC_ARG_WITH(cflags,
45[ --with-cflags Set CFLAGS for use in compilation.])
46if test "x$with_cflags" != "x" ; then
47 CFLAGS="$with_cflags" ; cflags_specified=yes ;
48elif test -n "$CFLAGS" ; then
49 cflags_specified=yes ;
50fi
51
52dnl --------
53dnl Check CC
54dnl --------
55AC_PROG_CC
56
paula49c0ff2004-09-30 06:08:58 +000057dnl ---------------------------------------------
paul7ea487b2003-03-17 02:05:07 +000058dnl If CLFAGS doesn\'t exist set default value
paula49c0ff2004-09-30 06:08:58 +000059dnl AC_PROG_CC will have set minimal default
60dnl already, eg "-O2 -g" for gcc, "-g" for others
paul27eebb32004-07-22 18:16:59 +000061dnl (Wall is gcc specific... have to make sure
62dnl gcc is being used before setting it)
paula49c0ff2004-09-30 06:08:58 +000063dnl ---------------------------------------------
paul27eebb32004-07-22 18:16:59 +000064dnl
paul7ea487b2003-03-17 02:05:07 +000065if test "x$cflags_specified" = "x" ; then
paula49c0ff2004-09-30 06:08:58 +000066 if test "x${GCC}" = "xyes"; then
gdt7fd63b32004-10-07 13:53:29 +000067 CFLAGS="-Os -g -Wall -Wsign-compare -Wpointer-arith"
hasso7347a2a2004-10-05 14:15:17 +000068 CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
paula49c0ff2004-09-30 06:08:58 +000069 fi
gdt7fd63b32004-10-07 13:53:29 +000070 # TODO: conditionally addd -Wpacked if handled
paul7ea487b2003-03-17 02:05:07 +000071fi
72
73dnl --------------
74dnl Check programs
75dnl --------------
76AC_PROG_CPP
77AC_PROG_INSTALL
78AC_PROG_MAKE_SET
79AC_CHECK_TOOL(AR, ar)
80AC_CHECK_TOOL(RANLIB, ranlib, :)
81
82dnl ---------
83dnl AIX check
84dnl ---------
85AC_AIX
86
gdt87efd642004-06-30 17:36:11 +000087dnl -------
88dnl libtool
89dnl -------
paul0fc42942004-08-19 04:41:21 +000090AC_PROG_LIBTOOL
gdt87efd642004-06-30 17:36:11 +000091
paul7ea487b2003-03-17 02:05:07 +000092dnl ----------------------
93dnl Packages configuration
94dnl ----------------------
95AC_ARG_ENABLE(vtysh,
gdtfc9d0742004-06-30 14:25:12 +000096[ --enable-vtysh include integrated vty shell for Quagga])
paul7ea487b2003-03-17 02:05:07 +000097AC_ARG_ENABLE(ipv6,
98[ --disable-ipv6 turn off IPv6 related features and daemons])
99AC_ARG_ENABLE(zebra,
100[ --disable-zebra do not build zebra daemon])
101AC_ARG_ENABLE(bgpd,
102[ --disable-bgpd do not build bgpd])
103AC_ARG_ENABLE(ripd,
104[ --disable-ripd do not build ripd])
105AC_ARG_ENABLE(ripngd,
106[ --disable-ripngd do not build ripngd])
107AC_ARG_ENABLE(ospfd,
108[ --disable-ospfd do not build ospfd])
paul7ea487b2003-03-17 02:05:07 +0000109AC_ARG_ENABLE(ospf6d,
110[ --disable-ospf6d do not build ospf6d])
ajsd0199432004-12-22 14:03:52 +0000111AC_ARG_ENABLE(watchquagga,
112[ --disable-watchquagga do not build watchquagga])
jardin9e867fe2003-12-23 08:56:18 +0000113AC_ARG_ENABLE(isisd,
hassoae399ab2004-09-13 20:22:18 +0000114[ --enable-isisd build isisd])
paul7ea487b2003-03-17 02:05:07 +0000115AC_ARG_ENABLE(bgp-announce,
116[ --disable-bgp-announce, turn off BGP route announcement])
117AC_ARG_ENABLE(netlink,
118[ --enable-netlink force to use Linux netlink interface])
119AC_ARG_ENABLE(broken-aliases,
120[ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
121AC_ARG_ENABLE(snmp,
122[ --enable-snmp enable SNMP support])
123AC_ARG_WITH(libpam,
124[ --with-libpam use libpam for PAM support in vtysh])
hasso71c0fb52003-05-25 20:18:13 +0000125AC_ARG_ENABLE(tcp-zebra,
paul7ea487b2003-03-17 02:05:07 +0000126[ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon])
paul7ea487b2003-03-17 02:05:07 +0000127AC_ARG_ENABLE(opaque-lsa,
paul1ef74ef2003-03-21 15:16:05 +0000128[ --enable-opaque-lsa enable OSPF Opaque-LSA with OSPFAPI support (RFC2370)])
129AC_ARG_ENABLE(ospfapi,
130[ --disable-ospfapi do not build OSPFAPI to access the OSPF LSA Database,
131 (this is the default if --enable-opaque-lsa is not set)])
132AC_ARG_ENABLE(ospfclient,
133[ --disable-ospfclient do not build OSPFAPI client for OSPFAPI,
134 (this is the default if --disable-ospfapi is set)])
paul7ea487b2003-03-17 02:05:07 +0000135AC_ARG_ENABLE(ospf-te,
136[ --enable-ospf-te enable Traffic Engineering Extension to OSPF])
137AC_ARG_ENABLE(multipath,
138[ --enable-multipath=ARG enable multipath function, ARG must be digit])
paule8f29842003-08-12 13:08:31 +0000139AC_ARG_ENABLE(quagga_user,
140[ --enable-user=ARG user to run Quagga suite as (default quagga)])
141AC_ARG_ENABLE(quagga_group,
142[ --enable-group=ARG group to run Quagga suite as (default quagga)])
pauledd7c242003-06-04 13:59:38 +0000143AC_ARG_ENABLE(vty_group,
paul6b6942f2004-10-22 04:55:05 +0000144[ --enable-vty-group=ARG set vty sockets to have specified group as owner])
gdtaa593d52003-12-22 20:15:53 +0000145AC_ARG_ENABLE(configfile_mask,
146[ --enable-configfile-mask=ARG set mask for config files])
147AC_ARG_ENABLE(logfile_mask,
148[ --enable-logfile-mask=ARG set mask for log files])
pauledd7c242003-06-04 13:59:38 +0000149
hasso71c0fb52003-05-25 20:18:13 +0000150AC_ARG_ENABLE(rtadv,
paul6b6942f2004-10-22 04:55:05 +0000151[ --disable-rtadv disable IPV6 router advertisement feature])
hassoca776982004-06-12 14:33:05 +0000152AC_ARG_ENABLE(irdp,
paul6b6942f2004-10-22 04:55:05 +0000153[ --enable-irdp enable IRDP server support in zebra])
hasso41d3fc92004-04-06 11:59:00 +0000154AC_ARG_ENABLE(capabilities,
155[ --disable-capabilities disable using POSIX capabilities])
paul6b6942f2004-10-22 04:55:05 +0000156AC_ARG_ENABLE(gcc_ultra_verbose,
157[ --enable-gcc-ultra-verbose enable ultra verbose GCC warnings])
ajs3cade262004-12-29 17:50:22 +0000158AC_ARG_ENABLE(gcc-rdynamic,
159[ --enable-gcc-rdynamic enable gcc linking with -rdynamic for better backtraces])
paul6b6942f2004-10-22 04:55:05 +0000160
161if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
162 CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
163 CFLAGS="${CFLAGS} -Wmissing-declarations -Wmissing-noreturn"
164 CFLAGS="${CFLAGS} -Wmissing-format-attribute -Wunreachable-code"
165 CFLAGS="${CFLAGS} -Wpacked -Wpadded"
166fi
paul7ea487b2003-03-17 02:05:07 +0000167
ajs3cade262004-12-29 17:50:22 +0000168if test x"${enable_gcc_rdynamic}" = x"yes" ; then
169 LDFLAGS="${LDFLAGS} -rdynamic"
170fi
171
paul7ea487b2003-03-17 02:05:07 +0000172if test "${enable_broken_aliases}" = "yes"; then
173 if test "${enable_netlink}" = "yes"
174 then
175 echo "Sorry, you can't use netlink with broken aliases"
176 exit 1
177 fi
178 AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
179 enable_netlink=no
180fi
181
182if test "${enable_tcp_zebra}" = "yes"; then
183 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
184fi
185
paul7ea487b2003-03-17 02:05:07 +0000186if test "${enable_opaque_lsa}" = "yes"; then
187 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
188fi
189
190if test "${enable_ospf_te}" = "yes"; then
191 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
192 AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
193fi
194
gdtd2a0ccc2003-12-03 18:13:48 +0000195AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
196if test "${enable_rtadv}" != "no"; then
hasso71c0fb52003-05-25 20:18:13 +0000197 AC_MSG_RESULT(yes)
gdtd2a0ccc2003-12-03 18:13:48 +0000198 AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
paul2487bea2003-05-25 23:51:31 +0000199else
200 AC_MSG_RESULT(no)
hasso71c0fb52003-05-25 20:18:13 +0000201fi
paul7ea487b2003-03-17 02:05:07 +0000202
hassoca776982004-06-12 14:33:05 +0000203if test "${enable_irdp}" = "yes"; then
204 AC_DEFINE(HAVE_IRDP,, IRDP )
205fi
206
paul79cb2162003-06-06 12:19:53 +0000207if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
paule8f29842003-08-12 13:08:31 +0000208 enable_user="quagga"
pauledd7c242003-06-04 13:59:38 +0000209elif test "${enable_user}" = "no"; then
210 enable_user="root"
211fi
paule8f29842003-08-12 13:08:31 +0000212AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
pauledd7c242003-06-04 13:59:38 +0000213
paul79cb2162003-06-06 12:19:53 +0000214if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
paule8f29842003-08-12 13:08:31 +0000215 enable_group="quagga"
pauledd7c242003-06-04 13:59:38 +0000216elif test "${enable_group}" = "no"; then
217 enable_group="root"
218fi
paule8f29842003-08-12 13:08:31 +0000219AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
pauledd7c242003-06-04 13:59:38 +0000220
221if test x"${enable_vty_group}" = x"yes" ; then
paul8d4aee52003-06-06 00:30:35 +0000222 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
paul79cb2162003-06-06 12:19:53 +0000223elif test x"${enable_vty_group}" != x""; then
paul8d4aee52003-06-06 00:30:35 +0000224 if test x"${enable_vty_group}" != x"no"; then
pauledd7c242003-06-04 13:59:38 +0000225 AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
226 fi
227fi
228
gdtaa593d52003-12-22 20:15:53 +0000229enable_configfile_mask=${enable_configfile_mask:-0600}
230AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
231
232enable_logfile_mask=${enable_logfile_mask:-0600}
233AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
234
paul7ea487b2003-03-17 02:05:07 +0000235changequote(, )dnl
236
237MULTIPATH_NUM=1
238
239case "${enable_multipath}" in
240 [0-9]|[1-9][0-9])
241 MULTIPATH_NUM="${enable_multipath}"
242 ;;
243 "")
244 ;;
245 *)
246 echo "Please specify digit to --enable-multipath ARG."
247 exit 1
248 ;;
249esac
250
251changequote([, ])dnl
252
253AC_SUBST(MULTIPATH_NUM)
254
255dnl -------------------
256dnl Check header files.
257dnl -------------------
pauldc7a2bf2003-10-22 00:07:44 +0000258AC_HEADER_STDC
259AC_CHECK_HEADERS([string.h stropts.h sys/conf.h sys/ksym.h sys/time.h \
260 sys/times.h sys/select.h sys/sysctl.h sys/sockio.h \
261 sys/types.h linux/version.h kvm.h netdb.h asm/types.h \
262 libutil.h limits.h])
263
paul835b7f12003-10-30 21:59:57 +0000264AC_CHECK_HEADERS([sys/socket.h netinet/in_systm.h netinet/in.h \
paulf3bd1a72003-11-02 07:29:11 +0000265 net/if_dl.h net/netopt.h inet/nd.h net/route.h \
paul835b7f12003-10-30 21:59:57 +0000266 net/if.h net/if_var.h netinet/in_var.h])
pauldc7a2bf2003-10-22 00:07:44 +0000267
gdtfa3232e2003-12-03 17:52:30 +0000268dnl V6 headers are checked below, after we check for v6
paul7ea487b2003-03-17 02:05:07 +0000269
270dnl check some types
271AC_C_CONST
272dnl AC_TYPE_PID_T
273AC_TYPE_SIGNAL
274
275dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
276case "$host" in
paul19877dd2004-05-11 10:49:35 +0000277 [*-sunos5.[6-8]*] | [*-solaris2.[6-8]*])
paul7ea487b2003-03-17 02:05:07 +0000278 opsys=sol2-6
paul19877dd2004-05-11 10:49:35 +0000279 AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.8)
280 AC_DEFINE(SUNOS_5, 1, SunOS 5)
paul7ea487b2003-03-17 02:05:07 +0000281 AC_CHECK_LIB(xnet, main)
282 CURSES=-lcurses
283 ;;
paul19877dd2004-05-11 10:49:35 +0000284 [*-sunos5.[8-9]] | [*-sunos5.1[0-9]] \
285 | [*-solaris2.[8-9]] | [*-solaris2.1[0-9]])
286 opsys=sol9
287 AC_DEFINE(SUNOS_59,,SunOS 5.9 up)
288 AC_DEFINE(SUNOS_5, 1, SunOS 5)
289 AC_CHECK_LIB(socket, main)
290 AC_CHECK_LIB(nsl, main)
291 CURSES=-lcurses
292 ;;
paul7ea487b2003-03-17 02:05:07 +0000293 *-sunos5* | *-solaris2*)
paul19877dd2004-05-11 10:49:35 +0000294 AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
paul7ea487b2003-03-17 02:05:07 +0000295 AC_CHECK_LIB(socket, main)
296 AC_CHECK_LIB(nsl, main)
297 CURSES=-lcurses
298 ;;
299 *-linux-*)
300 opsys=gnu-linux
301 AC_DEFINE(GNU_LINUX,,GNU Linux)
302 ;;
303 *-nec-sysv4*)
304 AC_CHECK_LIB(nsl, gethostbyname)
305 AC_CHECK_LIB(socket, socket)
306 ;;
307 *-freebsd3.2)
308 AC_DEFINE(FREEBSD_32,,FreeBSD 3.2)
309 ;;
310 *-openbsd*)
311 opsys=openbsd
312 AC_DEFINE(OPEN_BSD,,OpenBSD)
313 ;;
314 *-bsdi*)
315 opsys=bsdi
316 OTHER_METHOD="mtu_kvm.o"
317 AC_CHECK_LIB(kvm, main)
318 ;;
paul49e3b3c2003-10-23 20:39:50 +0000319 *-irix6.5)
pauldc7a2bf2003-10-22 00:07:44 +0000320 opsys=irix
321 AC_DEFINE(IRIX_65,,IRIX 6.5)
322 ;;
paul7ea487b2003-03-17 02:05:07 +0000323esac
324
325dnl ---------------------
326dnl Integrated VTY option
327dnl ---------------------
328case "${enable_vtysh}" in
329 "yes") VTYSH="vtysh";
330 AC_DEFINE(VTYSH,,VTY shell)
gdtfc9d0742004-06-30 14:25:12 +0000331 AC_PATH_PROG(PERL, perl)
332dnl Vtysh uses libreadline, which looks for termcap functions at
333dnl configure time. We follow readline's search order.
334dnl The required procedures are in libtermcap on NetBSD, in
335dnl [TODO] on Linux, and in [TODO] on Solaris.
336 AC_CHECK_LIB(termcap, tputs, ,
337 AC_CHECK_LIB(tinfo, tputs, ,
338 AC_CHECK_LIB(curses, tputs, ,
339 AC_CHECK_LIB(ncurses, tputs))))
paul7ea487b2003-03-17 02:05:07 +0000340 AC_CHECK_LIB(readline, main)
341 if test $ac_cv_lib_readline_main = no; then
gdtfc9d0742004-06-30 14:25:12 +0000342 AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
paul7ea487b2003-03-17 02:05:07 +0000343 fi
344 AC_CHECK_HEADER(readline/history.h)
345 if test $ac_cv_header_readline_history_h = no;then
346 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
347 fi
paul3d3de8c2003-05-23 10:33:49 +0000348 AC_CHECK_LIB(readline, rl_completion_matches)
349 if test $ac_cv_lib_readline_rl_completion_matches = no; then
350 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
351 fi
352 ;;
paul7ea487b2003-03-17 02:05:07 +0000353 "no" ) VTYSH="";;
354 * ) ;;
355esac
356
357dnl ----------
358dnl PAM module
359dnl ----------
360if test "$with_libpam" = "yes"; then
paul24cd4352003-05-06 12:16:27 +0000361 AC_CHECK_HEADER(security/pam_misc.h)
362 if test "$ac_cv_header_security_pam_misc_h" = yes; then
363 AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
364 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
365 pam_conv_func="misc_conv"
paul24cd4352003-05-06 12:16:27 +0000366 fi
paul24cd4352003-05-06 12:16:27 +0000367 AC_CHECK_HEADER(security/openpam.h)
368 if test "$ac_cv_header_security_openpam_h" = yes; then
369 AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
370 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
371 pam_conv_func="openpam_ttyconv"
paul24cd4352003-05-06 12:16:27 +0000372 fi
373 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
374 AC_MSG_WARN([*** pam support will not be built ***])
375 with_libpam="no"
376 fi
377fi
378
379if test "$with_libpam" = "yes"; then
paul7ea487b2003-03-17 02:05:07 +0000380dnl took this test from proftpd's configure.in and suited to our needs
381dnl -------------------------------------------------------------------------
382dnl
383dnl This next check looks funky due to a linker problem with some versions
384dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
385dnl omitted requiring libdl linking information. PAM-0.72 or better ships
386dnl with RedHat 6.2 and Debian 2.2 or better.
387AC_CHECK_LIB(pam, pam_start,
paul24cd4352003-05-06 12:16:27 +0000388 [AC_CHECK_LIB(pam, $pam_conv_func,
paul7ea487b2003-03-17 02:05:07 +0000389 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
390 LIBPAM="-lpam"],
391 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
392 LIBPAM="-lpam -lpam_misc"]
393 )
394 ],
395
396 [AC_CHECK_LIB(pam, pam_end,
paul24cd4352003-05-06 12:16:27 +0000397 [AC_CHECK_LIB(pam, $pam_conv_func,
paula159ed92003-06-04 11:01:45 +0000398 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul7ea487b2003-03-17 02:05:07 +0000399 LIBPAM="-lpam -ldl"],
paula159ed92003-06-04 11:01:45 +0000400 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul7ea487b2003-03-17 02:05:07 +0000401 LIBPAM="-lpam -ldl -lpam_misc"]
402 )
403 ],AC_MSG_WARN([*** pam support will not be built ***]),
404 [-ldl])
405 ]
406)
407fi
408AC_SUBST(LIBPAM)
409
410dnl -------------------------------
411dnl Endian-ness check
412dnl -------------------------------
413AC_WORDS_BIGENDIAN
414
415dnl -------------------------------
416dnl check the size in byte of the C
417dnl -------------------------------
418dnl AC_CHECK_SIZEOF(char)
419dnl AC_CHECK_SIZEOF(int)
420dnl AC_CHECK_SIZEOF(short)
421dnl AC_CHECK_SIZEOF(long)
422
423dnl ----------------------------
424dnl check existance of functions
425dnl ----------------------------
paul49e3b3c2003-10-23 20:39:50 +0000426AC_CHECK_FUNCS(memset memcpy strerror inet_aton daemon snprintf vsnprintf \
paul04bd4842003-10-24 04:24:39 +0000427 strlcat strlcpy if_nametoindex if_indextoname getifaddrs \
428 fcntl)
paula159ed92003-06-04 11:01:45 +0000429AC_CHECK_FUNCS(setproctitle, ,
430 [AC_CHECK_LIB(util, setproctitle,
431 [LIBS="$LIBS -lutil"
432 AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
433 ]
434 )
435 ]
436)
paul7ea487b2003-03-17 02:05:07 +0000437
438dnl ------------------------------------
439dnl Determine routing get and set method
440dnl ------------------------------------
441AC_MSG_CHECKING(zebra between kernel interface method)
442if test x"$opsys" = x"gnu-linux"; then
443 if test "${enable_netlink}" = "yes";then
444 AC_MSG_RESULT(netlink)
445 RT_METHOD=rt_netlink.o
446 AC_DEFINE(HAVE_NETLINK,,netlink)
447 netlink=yes
448 elif test "${enable_netlink}" = "no"; then
449 AC_MSG_RESULT(ioctl)
450 RT_METHOD=rt_ioctl.o
451 netlink=no
452 else
453 AC_MSG_RESULT(netlink)
454 RT_METHOD=rt_netlink.o
455 AC_DEFINE(HAVE_NETLINK,,netlink)
456 netlink=yes
457 fi
paul19877dd2004-05-11 10:49:35 +0000458elif test x"$opsys" = x"sol2-6";then
459 AC_MSG_RESULT(Route socket)
460 KERNEL_METHOD="kernel_socket.o"
461 RT_METHOD="rt_socket.o"
462elif test x"$opsys" = x"sol9";then
463 AC_MSG_RESULT(Route socket)
464 KERNEL_METHOD="kernel_socket.o"
465 RT_METHOD="rt_socket.o"
466elif test "$opsys" = "irix" ; then
467 AC_MSG_RESULT(Route socket)
468 KERNEL_METHOD="kernel_socket.o"
469 RT_METHOD="rt_socket.o"
paul7ea487b2003-03-17 02:05:07 +0000470else
paul19877dd2004-05-11 10:49:35 +0000471 AC_TRY_RUN([#include <errno.h>
paul7ea487b2003-03-17 02:05:07 +0000472#include <sys/types.h>
473#include <sys/socket.h>
474
475main ()
476{
477 int ac_sock;
478
479 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
480 if (ac_sock < 0 && errno == EINVAL)
481 exit (1);
482 exit (0);
483}],
484 [KERNEL_METHOD=kernel_socket.o
485 RT_METHOD=rt_socket.o
486 AC_MSG_RESULT(socket)],
487 [RT_METHOD=rt_ioctl.o
488 AC_MSG_RESULT(ioctl)],
489 [KERNEL_METHOD=kernel_socket.o
490 RT_METHOD=rt_socket.o
491 AC_MSG_RESULT(socket)])
paul7ea487b2003-03-17 02:05:07 +0000492fi
493AC_SUBST(RT_METHOD)
494AC_SUBST(KERNEL_METHOD)
495AC_SUBST(OTHER_METHOD)
496
ajsb99760a2005-01-04 16:24:43 +0000497dnl ------------------------------------
498dnl check for broken CMSG_FIRSTHDR macro
499dnl ------------------------------------
500AC_TRY_RUN([
501#ifdef SUNOS_5
502#define _XPG4_2
503#define __EXTENSIONS__
504#endif
505#include <stdlib.h>
506#include <sys/types.h>
507#include <sys/socket.h>
508
509main()
510{
511 struct msghdr msg;
512 char buf[4];
513
514 msg.msg_control = buf;
515 msg.msg_controllen = 0;
516
517 if (CMSG_FIRSTHDR(&msg) != NULL)
518 exit(0);
519 exit (1);
520}],[AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)])
521
paul7ea487b2003-03-17 02:05:07 +0000522dnl ------------------------------
523dnl check kernel route read method
524dnl ------------------------------
525AC_CACHE_CHECK(route read method check, zebra_rtread,
526[if test "$netlink" = yes; then
527 RTREAD_METHOD="rtread_netlink.o"
528 zebra_rtread="netlink"
529else
530for zebra_rtread in /proc/net/route /dev/ip /dev/null;
531do
532 test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
533done
534case $zebra_rtread in
535 "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
536 zebra_rtread="proc";;
paul9c30ab62003-07-08 08:36:17 +0000537 "/dev/ip")
538 case "$host" in
539 *-freebsd*) RTREAD_METHOD=rtread_sysctl.o
540 zebra_rtread="sysctl";;
541 *) RTREAD_METHOD="rtread_getmsg.o"
542 zebra_rtread="getmsg";;
543 esac;;
paul7ea487b2003-03-17 02:05:07 +0000544 *) RTREAD_METHOD="rtread_sysctl.o"
545 zebra_rtread="sysctl";;
546esac
547fi])
548AC_SUBST(RTREAD_METHOD)
549
550dnl -----------------------------
551dnl check interface lookup method
552dnl -----------------------------
paul19877dd2004-05-11 10:49:35 +0000553IOCTL_METHOD=ioctl.o
paul7ea487b2003-03-17 02:05:07 +0000554AC_MSG_CHECKING(interface looking up method)
555if test "$netlink" = yes; then
556 AC_MSG_RESULT(netlink)
557 IF_METHOD=if_netlink.o
paul19877dd2004-05-11 10:49:35 +0000558elif test "$opsys" = "sol2-6";then
559 AC_MSG_RESULT(Solaris GIF)
560 IF_METHOD=if_ioctl.o
561elif test "$opsys" = "sol9";then
562 AC_MSG_RESULT(Solaris GLIF)
563 IF_METHOD=if_ioctl_solaris.o
564 IOCTL_METHOD=ioctl_solaris.o
565elif test "$opsys" = "irix" ; then
566 AC_MSG_RESULT(IRIX)
567 IF_METHOD=if_ioctl.o
568elif test "$opsys" = "openbsd";then
569 AC_MSG_RESULT(openbsd)
570 IF_METHOD=if_ioctl.o
571elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
572 AC_MSG_RESULT(sysctl)
paul7ea487b2003-03-17 02:05:07 +0000573 IF_METHOD=if_sysctl.o
574 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
paul19877dd2004-05-11 10:49:35 +0000575else
paul7ea487b2003-03-17 02:05:07 +0000576 AC_MSG_RESULT(ioctl)
577 IF_METHOD=if_ioctl.o
paul7ea487b2003-03-17 02:05:07 +0000578fi
579AC_SUBST(IF_METHOD)
paul19877dd2004-05-11 10:49:35 +0000580AC_SUBST(IOCTL_METHOD)
paul7ea487b2003-03-17 02:05:07 +0000581
582dnl -----------------------
583dnl check proc file system.
584dnl -----------------------
585if test -r /proc/net/dev; then
586 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
587 IF_PROC=if_proc.o
588fi
589
590if test -r /proc/net/if_inet6; then
591 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
592 IF_PROC=if_proc.o
593fi
594AC_SUBST(IF_PROC)
595
596dnl -----------------------------
597dnl check ipforward detect method
598dnl -----------------------------
599AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
600[for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
601do
602 test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
603done
604case $zebra_ipforward_path in
605 "/proc/net/snmp") IPFORWARD=ipforward_proc.o
606 zebra_ipforward_path="proc";;
607 "/dev/ip")
608 case "$host" in
609 *-nec-sysv4*) IPFORWARD=ipforward_ews.o
610 zebra_ipforward_path="ews";;
paul9c30ab62003-07-08 08:36:17 +0000611 *-freebsd*) IPFORWARD=ipforward_sysctl.o
612 zebra_ipforward_path="sysctl";;
paul7ea487b2003-03-17 02:05:07 +0000613 *) IPFORWARD=ipforward_solaris.o
614 zebra_ipforward_path="solaris";;
615 esac;;
616 *) IPFORWARD=ipforward_sysctl.o
617 zebra_ipforward_path="sysctl";;
618esac])
619AC_SUBST(IPFORWARD)
620
621AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
622
623dnl ----------
624dnl IPv6 check
625dnl ----------
626AC_MSG_CHECKING(whether does this OS have IPv6 stack)
627if test "${enable_ipv6}" = "no"; then
628 AC_MSG_RESULT(disabled)
629else
630dnl ----------
631dnl INRIA IPv6
632dnl ----------
paula159ed92003-06-04 11:01:45 +0000633 if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
634 zebra_cv_ipv6=yes
635 AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
636 AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
637 RIPNGD="ripngd"
638 OSPF6D="ospf6d"
639 LIB_IPV6=""
640 AC_MSG_RESULT(INRIA IPv6)
paul7ea487b2003-03-17 02:05:07 +0000641dnl ---------
642dnl KAME IPv6
643dnl ---------
paula159ed92003-06-04 11:01:45 +0000644 elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
645 zebra_cv_ipv6=yes
646 AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
647 AC_DEFINE(KAME,1,KAME IPv6)
648 RIPNGD="ripngd"
649 OSPF6D="ospf6d"
650 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
paul7ea487b2003-03-17 02:05:07 +0000651 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +0000652 fi
653 AC_MSG_RESULT(KAME)
hasso71c0fb52003-05-25 20:18:13 +0000654dnl -------------------------
655dnl MUSICA IPv6
656dnl default host check
657dnl It is not used by Kheops
658dnl -------------------------
paula159ed92003-06-04 11:01:45 +0000659 elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
660 zebra_cv_ipv6=yes
661 AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
662 AC_DEFINE(MUSICA,1,Musica IPv6 stack)
663 AC_DEFINE(KAME,1,KAME IPv6 stack)
664 RIPNGD="ripngd"
665 OSPF6D="ospf6d"
666 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
hasso71c0fb52003-05-25 20:18:13 +0000667 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +0000668 fi
669 AC_MSG_RESULT(MUSICA)
paul7ea487b2003-03-17 02:05:07 +0000670dnl ---------
671dnl NRL check
672dnl ---------
paula159ed92003-06-04 11:01:45 +0000673 elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
674 zebra_cv_ipv6=yes
675 AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
676 AC_DEFINE(NRL,1,NRL)
677 RIPNGD="ripngd"
678 OSPF6D="ospf6d"
679 if test x"$opsys" = x"bsdi";then
paul7ea487b2003-03-17 02:05:07 +0000680 AC_DEFINE(BSDI_NRL,,BSDI)
681 AC_MSG_RESULT(BSDI_NRL)
paula159ed92003-06-04 11:01:45 +0000682 else
paul7ea487b2003-03-17 02:05:07 +0000683 AC_MSG_RESULT(NRL)
paula159ed92003-06-04 11:01:45 +0000684 fi
paul19877dd2004-05-11 10:49:35 +0000685dnl ------------------------------------
686dnl Solaris 9, 10 and potentially higher
687dnl ------------------------------------
688 elif test x"$opsys" = x"sol9"; then
689 zebra_cv_ipv6=yes;
690 AC_DEFINE(HAVE_IPV6, 1, IPv6)
691 AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
692 RIPNGD="ripngd"
693 OSPF6D="ospf6d"
694 AC_MSG_RESULT(Solaris IPv6)
paul7ea487b2003-03-17 02:05:07 +0000695dnl ----------
696dnl Linux IPv6
697dnl ----------
paula159ed92003-06-04 11:01:45 +0000698 elif test "${enable_ipv6}" = "yes"; then
699 AC_EGREP_CPP(yes, [
700 #include <linux/version.h>
701 /* 2.1.128 or later */
702 #if LINUX_VERSION_CODE >= 0x020180
703 yes
704 #endif],
705 [zebra_cv_ipv6=yes
706 zebra_cv_linux_ipv6=yes
707 AC_MSG_RESULT(Linux IPv6)])
708 else
709 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
710 then
paul7ea487b2003-03-17 02:05:07 +0000711 zebra_cv_ipv6=yes
712 zebra_cv_linux_ipv6=yes
713 AC_MSG_RESULT(Linux IPv6)
paula159ed92003-06-04 11:01:45 +0000714 fi
715 fi
paul7ea487b2003-03-17 02:05:07 +0000716
paula159ed92003-06-04 11:01:45 +0000717 if test "$zebra_cv_linux_ipv6" = "yes";then
718 AC_MSG_CHECKING(for GNU libc >= 2.1)
719 AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
720 AC_EGREP_CPP(yes, [
paul7ea487b2003-03-17 02:05:07 +0000721#include <features.h>
722#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
723 yes
paula159ed92003-06-04 11:01:45 +0000724#endif],
725 [glibc=yes
726 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
727 AC_MSG_RESULT(yes)],
728 AC_MSG_RESULT(no)
729 )
730 RIPNGD="ripngd"
731 OSPF6D="ospf6d"
732 if test "$glibc" != "yes"; then
paul7ea487b2003-03-17 02:05:07 +0000733 INCLUDES="-I/usr/inet6/include"
734 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
735 LIB_IPV6="-L/usr/inet6/lib -linet6"
736 fi
paula159ed92003-06-04 11:01:45 +0000737 fi
738 fi
paul7ea487b2003-03-17 02:05:07 +0000739
740dnl -----------------------
741dnl Set IPv6 related values
742dnl -----------------------
paula159ed92003-06-04 11:01:45 +0000743 LIBS="$LIB_IPV6 $LIBS"
744 AC_SUBST(LIB_IPV6)
paul7ea487b2003-03-17 02:05:07 +0000745
paula159ed92003-06-04 11:01:45 +0000746 if test x"$RIPNGD" = x""; then
747 AC_MSG_RESULT(IPv4 only)
748 fi
paul7ea487b2003-03-17 02:05:07 +0000749fi
750
gdtfa3232e2003-12-03 17:52:30 +0000751dnl ------------------
752dnl IPv6 header checks
753dnl ------------------
754if test "x${zebra_cv_ipv6}" = "xyes"; then
755AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
756 netinet6/in6_var.h netinet6/nd6.h])
757fi
758
paul7ea487b2003-03-17 02:05:07 +0000759dnl --------------------
760dnl Daemon disable check
761dnl --------------------
762if test "${enable_zebra}" = "no";then
763 ZEBRA=""
764else
765 ZEBRA="zebra"
766fi
767
768if test "${enable_bgpd}" = "no";then
769 BGPD=""
770else
771 BGPD="bgpd"
772fi
773
774if test "${enable_ripd}" = "no";then
775 RIPD=""
776else
777 RIPD="ripd"
778fi
779
780if test "${enable_ospfd}" = "no";then
781 OSPFD=""
782else
783 OSPFD="ospfd"
784fi
785
ajsd0199432004-12-22 14:03:52 +0000786if test "${enable_watchquagga}" = "no";then
787 WATCHQUAGGA=""
788else
789 WATCHQUAGGA="watchquagga"
790fi
791
paul1ef74ef2003-03-21 15:16:05 +0000792OSPFCLIENT=""
793if test "${enable_opaque_lsa}" = "yes"; then
794 if test "${enable_ospfapi}" != "no";then
paul9a569842003-03-28 01:45:13 +0000795 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
paul1ef74ef2003-03-21 15:16:05 +0000796
797 if test "${enable_ospfclient}" != "no";then
798 OSPFCLIENT="ospfclient"
799 fi
800 fi
801
paul7ea487b2003-03-17 02:05:07 +0000802fi
803
804case "${enable_ripngd}" in
805 "yes") RIPNGD="ripngd";;
806 "no" ) RIPNGD="";;
807 * ) ;;
808esac
809
810case "${enable_ospf6d}" in
811 "yes") OSPF6D="ospf6d";;
812 "no" ) OSPF6D="";;
813 * ) ;;
814esac
815
jardin9e867fe2003-12-23 08:56:18 +0000816case "${enable_isisd}" in
817 "yes") ISISD="isisd";;
818 "no" ) ISISD="";;
hassoae399ab2004-09-13 20:22:18 +0000819 * ) ;;
jardin9e867fe2003-12-23 08:56:18 +0000820esac
821
paul7ea487b2003-03-17 02:05:07 +0000822if test "${enable_bgp_announce}" = "no";then
823 AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
824fi
825
826AC_SUBST(ZEBRA)
827AC_SUBST(BGPD)
828AC_SUBST(RIPD)
829AC_SUBST(RIPNGD)
830AC_SUBST(OSPFD)
831AC_SUBST(OSPF6D)
ajsd0199432004-12-22 14:03:52 +0000832AC_SUBST(WATCHQUAGGA)
jardin9e867fe2003-12-23 08:56:18 +0000833AC_SUBST(ISISD)
paul7ea487b2003-03-17 02:05:07 +0000834AC_SUBST(VTYSH)
835AC_SUBST(INCLUDES)
836AC_SUBST(CURSES)
837AC_SUBST(OSPFCLIENT)
paul1ef74ef2003-03-21 15:16:05 +0000838AC_SUBST(OSPFAPI)
paul7ea487b2003-03-17 02:05:07 +0000839AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
840AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
841AC_CHECK_LIB(crypt, crypt)
842AC_CHECK_LIB(resolv, res_init)
843AC_CHECK_LIB(m, main)
844
845dnl ---------------------------------------------------
846dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
847dnl ---------------------------------------------------
paula159ed92003-06-04 11:01:45 +0000848AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
849AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
850AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
paul7ea487b2003-03-17 02:05:07 +0000851
852dnl ---------------------------
853dnl check system has GNU regexp
854dnl ---------------------------
855dnl AC_MSG_CHECKING(whether system has GNU regex)
856AC_CHECK_LIB(c, regexec,
857[AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
858 LIB_REGEX=""],
859[LIB_REGEX="regex.o"])
860AC_SUBST(LIB_REGEX)
861
862dnl ------------------
863dnl check SNMP library
864dnl ------------------
865if test "${enable_snmp}" = "yes";then
866dnl AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
paul7ea487b2003-03-17 02:05:07 +0000867 if test "${HAVE_SNMP}" = ""; then
paul1ef74ef2003-03-21 15:16:05 +0000868 old_libs="${LIBS}"
869 LIBS="-L/usr/lib"
paul7ea487b2003-03-17 02:05:07 +0000870 unset ac_cv_lib_snmp_asn_parse_int
paul1ef74ef2003-03-21 15:16:05 +0000871 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
872 if test "${NEED_CRYPTO}" = ""; then
873 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes ])
874 else
875 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes; NEED_CRYPTO=yes;LIBS="$LIBS -lcrypto" ],,"-lcrypto")
876 fi
877 LIBS="${old_libs}"
paul7ea487b2003-03-17 02:05:07 +0000878 fi
paul1ef74ef2003-03-21 15:16:05 +0000879 if test "${HAVE_SNMP}" = ""; then
880 old_libs="${LIBS}"
881 LIBS="-L/usr/lib"
882 unset ac_cv_lib_snmp_asn_parse_int
883 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes, )
884 if test "${HAVE_SNMP}" = ""; then
885 unset ac_cv_lib_snmp_asn_parse_int
886 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
887 if test "${NEED_CRYPTO}" = "yes"; then
888 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
889 fi
890 fi
891 LIBS="${old_libs}"
892 fi
paul7ea487b2003-03-17 02:05:07 +0000893
894 if test "${HAVE_SNMP}" = ""; then
paul1ef74ef2003-03-21 15:16:05 +0000895 old_libs="${LIBS}"
896 LIBS="-L/usr/local/lib"
897 unset ac_cv_lib_snmp_asn_parse_int
898 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
899 if test "${HAVE_SNMP}" = ""; then
900 unset ac_cv_lib_snmp_asn_parse_int
901 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
902 if test "${NEED_CRYPTO}" = "yes"; then
903 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
904 fi
905 fi
906 LIBS="${old_libs}"
paul7ea487b2003-03-17 02:05:07 +0000907 fi
paul1ef74ef2003-03-21 15:16:05 +0000908
paul7ea487b2003-03-17 02:05:07 +0000909 if test "${HAVE_SNMP}" = "yes"; then
910 for ac_snmp in /usr/include/net-snmp/library/asn1.h /usr/include/ucd-snmp/asn1.h /usr/local/include/ucd-snmp/asn1.h /dev/null
911 do
912 test -f "${ac_snmp}" && break
913 done
paul1ef74ef2003-03-21 15:16:05 +0000914
paul7ea487b2003-03-17 02:05:07 +0000915 case ${ac_snmp} in
916 /usr/include/net-snmp/*)
917 AC_DEFINE(HAVE_SNMP,,SNMP)
paul1ef74ef2003-03-21 15:16:05 +0000918 AC_DEFINE(HAVE_NETSNMP,,SNMP)
paul7ea487b2003-03-17 02:05:07 +0000919 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
paulac7c4bb2003-03-19 04:25:08 +0000920 CFLAGS="${CFLAGS} -I/usr/include/net-snmp -I/usr/include/net-snmp/library"
921 if test "${HAVE_NETSNMP}" = "yes"; then
paul1ef74ef2003-03-21 15:16:05 +0000922 LIBS="${LIBS} -lnetsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000923 else
paul1ef74ef2003-03-21 15:16:05 +0000924 LIBS="${LIBS} -lsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000925 fi
paul7ea487b2003-03-17 02:05:07 +0000926 ;;
927 /usr/include/ucd-snmp/*)
928 AC_DEFINE(HAVE_SNMP,,SNMP)
929 CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp"
930 LIBS="${LIBS} -lsnmp"
931 ;;
932 /usr/local/include/ucd-snmp/*)
933 AC_DEFINE(HAVE_SNMP,,SNMP)
934 CFLAGS="${CFLAGS} -I/usr/local/include/ucd-snmp"
935 LIBS="${LIBS} -L/usr/local/lib -lsnmp"
936 ;;
paulf3bd1a72003-11-02 07:29:11 +0000937 /usr/local/include/net-snmp/*)
938 AC_DEFINE(HAVE_SNMP,,SNMP)
939 AC_DEFINE(HAVE_NET_SNMP,,SNMP)
940 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
941 CFLAGS="${CFLAGS} -I/usr/local/include/net-snmp"
942 LIBS="${LIBS} -L/usr/local/lib -lnetsnmp"
943 ;;
paul7ea487b2003-03-17 02:05:07 +0000944 esac
945 if test "${NEED_CRYPTO}" = "yes"; then
946 LIBS="${LIBS} -lcrypto"
947 fi
948 fi
949fi
950
951dnl ----------------------------
952dnl check sa_len of sockaddr
953dnl ----------------------------
954AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
955AC_TRY_COMPILE([#include <sys/types.h>
956#include <sys/socket.h>
957],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
958[AC_MSG_RESULT(yes)
959 AC_DEFINE(HAVE_SA_LEN,,sa_len)],
960 AC_MSG_RESULT(no))
961
962dnl ----------------------------
963dnl check sin_len of sockaddr_in
964dnl ----------------------------
965AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
966AC_TRY_COMPILE([#include <sys/types.h>
967#include <netinet/in.h>
968],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
969[AC_MSG_RESULT(yes)
970 AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
971 AC_MSG_RESULT(no))
972
973dnl ----------------------------
974dnl check sun_len of sockaddr_un
975dnl ----------------------------
976AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
977AC_TRY_COMPILE([#include <sys/types.h>
978#include <sys/un.h>
979],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
980[AC_MSG_RESULT(yes)
981 AC_DEFINE(HAVE_SUN_LEN,,sun_len)],
982 AC_MSG_RESULT(no))
983
984dnl -----------------------------------
985dnl check sin6_scope_id of sockaddr_in6
986dnl -----------------------------------
987if test "$zebra_cv_ipv6" = yes; then
988 AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
989 AC_TRY_COMPILE([#include <sys/types.h>
990#include <netinet/in.h>
991],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
992[AC_MSG_RESULT(yes)
993 AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)],
994 AC_MSG_RESULT(no))
995fi
996
997dnl ----------------------------
998dnl check socklen_t exist or not
999dnl ----------------------------
1000AC_MSG_CHECKING(whther socklen_t is defined)
1001AC_TRY_COMPILE([#include <sys/types.h>
1002#include <sys/socket.h>
1003#include <netinet/in.h>
1004],[socklen_t ac_x;],
1005[AC_MSG_RESULT(yes)
1006 AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)],
1007 AC_MSG_RESULT(no))
1008
1009dnl ------------------------
1010dnl check struct sockaddr_dl
1011dnl ------------------------
1012AC_MSG_CHECKING(whether struct sockaddr_dl exist)
1013AC_EGREP_HEADER(sockaddr_dl,
1014net/if_dl.h,
1015[AC_MSG_RESULT(yes)
1016 AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)],
1017 AC_MSG_RESULT(no))
1018
1019dnl --------------------------
1020dnl check structure ifaliasreq
1021dnl --------------------------
1022AC_MSG_CHECKING(whether struct ifaliasreq exist)
1023AC_EGREP_HEADER(ifaliasreq,
1024net/if.h,
1025[AC_MSG_RESULT(yes)
1026 AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)],
1027 AC_MSG_RESULT(no))
1028
1029dnl ----------------------------
1030dnl check structure in6_aliasreq
1031dnl ----------------------------
hasso71c0fb52003-05-25 20:18:13 +00001032AC_MSG_CHECKING(whether struct in6_aliasreq exist)
paul7ea487b2003-03-17 02:05:07 +00001033AC_EGREP_HEADER(in6_aliasreq,
1034netinet6/in6_var.h,
1035[AC_MSG_RESULT(yes)
1036 AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
1037 AC_MSG_RESULT(no))
1038
hasso71c0fb52003-05-25 20:18:13 +00001039dnl -----------------------------------
1040dnl check ifra_lifetime of in6_aliasreq
1041dnl -----------------------------------
1042AC_MSG_CHECKING(whether in6_aliasreq.ifra_lifetime exist)
1043AC_TRY_COMPILE([#include <sys/types.h>
1044#include <netinet6/in6_var.h>
1045],[static struct if6_aliasreq ac_i;int ac_j = sizeof (ac_i.ifra_lifetime);],
1046[AC_MSG_RESULT(yes)
paula159ed92003-06-04 11:01:45 +00001047 AC_DEFINE(HAVE_IFRA_LIFETIME,,Have in6_aliasreq.ifra_lifetime)],
hasso71c0fb52003-05-25 20:18:13 +00001048 AC_MSG_RESULT(no))
1049
paul7ea487b2003-03-17 02:05:07 +00001050dnl ---------------------------
1051dnl check structure rt_addrinfo
1052dnl ---------------------------
1053AC_MSG_CHECKING(whether struct rt_addrinfo exist)
1054AC_EGREP_HEADER(rt_addrinfo,
1055net/route.h,
1056[AC_MSG_RESULT(yes)
1057 AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)],
1058 AC_MSG_RESULT(no))
1059
1060dnl --------------------------
1061dnl check structure in_pktinfo
1062dnl --------------------------
1063AC_MSG_CHECKING(whether struct in_pktinfo exist)
1064AC_TRY_COMPILE([#include <netinet/in.h>
1065],[struct in_pktinfo ac_x;],
1066[AC_MSG_RESULT(yes)
1067 AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
1068 AC_MSG_RESULT(no))
1069
1070dnl --------------------------------------
1071dnl checking for getrusage struct and call
1072dnl --------------------------------------
1073AC_MSG_CHECKING(whether getrusage is available)
1074AC_TRY_COMPILE([#include <sys/resource.h>
1075],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
1076[AC_MSG_RESULT(yes)
1077 AC_DEFINE(HAVE_RUSAGE,,rusage)],
1078 AC_MSG_RESULT(no))
1079
pauledd7c242003-06-04 13:59:38 +00001080dnl -------------------
1081dnl capabilities checks
1082dnl -------------------
hasso41d3fc92004-04-06 11:59:00 +00001083if test "${enable_capabilities}" != "no"; then
1084 AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1085 AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1086 [AC_MSG_RESULT(yes)
1087 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1088 quagga_ac_keepcaps="yes"],
1089 AC_MSG_RESULT(no)
pauledd7c242003-06-04 13:59:38 +00001090 )
hasso41d3fc92004-04-06 11:59:00 +00001091 if test x"${quagga_ac_keepcaps}" = x"yes"; then
1092 AC_CHECK_HEADERS(sys/capability.h)
1093 fi
1094 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1095 AC_CHECK_LIB(cap, cap_init,
1096 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1097 LIBCAP="-lcap"
1098 ]
1099 )
1100 fi
pauledd7c242003-06-04 13:59:38 +00001101fi
1102AC_SUBST(LIBCAP)
1103
paulfb2d1502003-06-04 09:40:54 +00001104dnl ---------------------------
1105dnl check for glibc 'backtrace'
1106dnl ---------------------------
1107if test "${glibc}" = "yes"; then
1108 AC_CHECK_HEADER(execinfo.h)
1109fi
1110if test x"${ac_cv_header_execinfo_h}" = x"yes"; then
1111 AC_CHECK_FUNC(backtrace,
1112 [AC_DEFINE(HAVE_GLIBC_BACKTRACE,,Glibc backtrace)]
1113 )
1114fi
1115
paul408ad942003-05-20 00:03:33 +00001116dnl ----------
1117dnl configure date
1118dnl ----------
1119CONFDATE=`date '+%Y%m%d'`
1120AC_SUBST(CONFDATE)
1121
paul7ea487b2003-03-17 02:05:07 +00001122dnl ------------------------------
paula159ed92003-06-04 11:01:45 +00001123dnl set paths for state directory
paul23bd12c2003-04-07 06:11:09 +00001124dnl ------------------------------
1125if test "${prefix}" = "NONE"; then
paule8f29842003-08-12 13:08:31 +00001126 quagga_statedir_prefix="";
paul23bd12c2003-04-07 06:11:09 +00001127else
paule8f29842003-08-12 13:08:31 +00001128 quagga_statedir_prefix=${prefix}
paul23bd12c2003-04-07 06:11:09 +00001129fi
1130if test "${localstatedir}" = '${prefix}/var'; then
paula159ed92003-06-04 11:01:45 +00001131 AC_CACHE_CHECK(state directory,ac_statedir,
paule8f29842003-08-12 13:08:31 +00001132 [for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
1133 ${quagga_statedir_prefix}/var/adm dnl
1134 ${quagga_statedir_prefix}/etc dnl
paula159ed92003-06-04 11:01:45 +00001135 /var/run dnl
1136 /var/adm dnl
1137 /etc dnl
1138 /dev/null;
paul23bd12c2003-04-07 06:11:09 +00001139 do
paule8f29842003-08-12 13:08:31 +00001140 test -d $QUAGGA_STATE_DIR && break
paul23bd12c2003-04-07 06:11:09 +00001141 done
paule8f29842003-08-12 13:08:31 +00001142 quagga_statedir=$QUAGGA_STATE_DIR])
paul23bd12c2003-04-07 06:11:09 +00001143else
paule8f29842003-08-12 13:08:31 +00001144 quagga_statedir=${localstatedir}
paula159ed92003-06-04 11:01:45 +00001145 AC_MSG_CHECKING(directory to use for state file)
paule8f29842003-08-12 13:08:31 +00001146 AC_MSG_RESULT(${quagga_statedir})
paul23bd12c2003-04-07 06:11:09 +00001147fi
paule8f29842003-08-12 13:08:31 +00001148if test $quagga_statedir = "/dev/null"; then
paula159ed92003-06-04 11:01:45 +00001149 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1150fi
1151
paule8f29842003-08-12 13:08:31 +00001152AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1153AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1154AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1155AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1156AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1157AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
jardin9e867fe2003-12-23 08:56:18 +00001158AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
ajsd0199432004-12-22 14:03:52 +00001159AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
paule8f29842003-08-12 13:08:31 +00001160AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1161AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1162AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1163AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1164AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1165AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1166AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
jardin9e867fe2003-12-23 08:56:18 +00001167AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
ajs515210b2004-12-22 15:35:12 +00001168AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
paul7ea487b2003-03-17 02:05:07 +00001169
1170dnl ---------------------------
1171dnl Check htonl works correctly
1172dnl ---------------------------
1173AC_MSG_CHECKING(for working htonl)
1174AC_CACHE_VAL(ac_cv_htonl_works, [
1175AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
1176#include <sys/types.h>
1177#endif
1178#ifdef HAVE_NETDB_H
1179#include <netdb.h>
1180#endif
1181#ifdef HAVE_NETINET_IN_H
1182#include <netinet/in.h>
1183#endif],
1184[htonl (0);],
1185ac_cv_htonl_works=yes,
1186ac_cv_htonl_works=no)])
1187AC_MSG_RESULT($ac_cv_htonl_works)
1188
paul14c17fd2004-11-07 22:34:23 +00001189AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile
ajsd0199432004-12-22 14:03:52 +00001190 ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
jardin9e867fe2003-12-23 08:56:18 +00001191 ospf6d/Makefile isisd/Makefile vtysh/Makefile doc/Makefile
paul14c17fd2004-11-07 22:34:23 +00001192 ospfclient/Makefile tests/Makefile m4/Makefile redhat/Makefile
gdt69f1fc22004-08-27 15:57:35 +00001193 pkgsrc/Makefile
paul670bbf12004-11-12 09:05:00 +00001194 redhat/quagga.spec
gdtb7a97f82004-07-23 16:23:56 +00001195 lib/version.h
paul14c17fd2004-11-07 22:34:23 +00001196 doc/defines.texi
gdtcbd04082004-08-31 18:16:36 +00001197 pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
paulf31293a2004-11-12 09:27:04 +00001198 pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
paul670bbf12004-11-12 09:05:00 +00001199AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
hasso48577192004-11-19 06:41:49 +00001200## Hack, but working solution to avoid rebuilding of quagga.info.
1201## It's already in CVS until texinfo 4.7 is more common.
1202AC_CONFIG_COMMANDS([info-time],[touch doc/quagga.info])
paul14c17fd2004-11-07 22:34:23 +00001203AC_OUTPUT
paul7ea487b2003-03-17 02:05:07 +00001204
1205echo "
hassoc89f6492004-08-26 12:21:28 +00001206Quagga configuration
1207--------------------
1208quagga version : ${PACKAGE_VERSION}
paul7ea487b2003-03-17 02:05:07 +00001209host operationg system : ${host_os}
1210source code location : ${srcdir}
1211compiler : ${CC}
1212compiler flags : ${CFLAGS}
hasso71c0fb52003-05-25 20:18:13 +00001213linker flags : ${LDFLAGS} ${LIBS}
paule8f29842003-08-12 13:08:31 +00001214state file directory : ${quagga_statedir}
pauldc7a2bf2003-10-22 00:07:44 +00001215config file directory : `eval echo \`echo ${sysconfdir}\``
gdtd6b72f72003-12-03 17:24:27 +00001216example directory : `eval echo \`echo ${exampledir}\``
paul8d4aee52003-06-06 00:30:35 +00001217user to run as : ${enable_user}
1218group to run as : ${enable_group}
1219group for vty sockets : ${enable_vty_group}
gdtaa593d52003-12-22 20:15:53 +00001220config file mask : ${enable_configfile_mask}
1221log file mask : ${enable_logfile_mask}
pauldc7a2bf2003-10-22 00:07:44 +00001222
1223The above user and group must have read/write access to the state file
1224directory and to the config files in the config file directory.
paul7ea487b2003-03-17 02:05:07 +00001225"