blob: 61940f239114c3a9c7d3a7fd2ed3e666abda0cf9 [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##
hasso7347a2a2004-10-05 14:15:17 +00008## $Id: configure.ac,v 1.67 2004/10/05 14:15:17 hasso Exp $
paule8f29842003-08-12 13:08:31 +00009AC_PREREQ(2.53)
paul7ea487b2003-03-17 02:05:07 +000010
paul33394762004-09-13 11:27:57 +000011AC_INIT(Quagga, 0.96.5, [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
hasso7347a2a2004-10-05 14:15:17 +000067 CFLAGS="-Os -g -Wall -Wpacked -Wsign-compare -Wpointer-arith"
68 CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
paula49c0ff2004-09-30 06:08:58 +000069 fi
paul7ea487b2003-03-17 02:05:07 +000070fi
71
72dnl --------------
73dnl Check programs
74dnl --------------
75AC_PROG_CPP
76AC_PROG_INSTALL
77AC_PROG_MAKE_SET
78AC_CHECK_TOOL(AR, ar)
79AC_CHECK_TOOL(RANLIB, ranlib, :)
80
81dnl ---------
82dnl AIX check
83dnl ---------
84AC_AIX
85
gdt87efd642004-06-30 17:36:11 +000086dnl -------
87dnl libtool
88dnl -------
paul0fc42942004-08-19 04:41:21 +000089AC_PROG_LIBTOOL
gdt87efd642004-06-30 17:36:11 +000090
paul7ea487b2003-03-17 02:05:07 +000091dnl ----------------------
92dnl Packages configuration
93dnl ----------------------
94AC_ARG_ENABLE(vtysh,
gdtfc9d0742004-06-30 14:25:12 +000095[ --enable-vtysh include integrated vty shell for Quagga])
paul7ea487b2003-03-17 02:05:07 +000096AC_ARG_ENABLE(ipv6,
97[ --disable-ipv6 turn off IPv6 related features and daemons])
98AC_ARG_ENABLE(zebra,
99[ --disable-zebra do not build zebra daemon])
100AC_ARG_ENABLE(bgpd,
101[ --disable-bgpd do not build bgpd])
102AC_ARG_ENABLE(ripd,
103[ --disable-ripd do not build ripd])
104AC_ARG_ENABLE(ripngd,
105[ --disable-ripngd do not build ripngd])
106AC_ARG_ENABLE(ospfd,
107[ --disable-ospfd do not build ospfd])
paul7ea487b2003-03-17 02:05:07 +0000108AC_ARG_ENABLE(ospf6d,
109[ --disable-ospf6d do not build ospf6d])
jardin9e867fe2003-12-23 08:56:18 +0000110AC_ARG_ENABLE(isisd,
hassoae399ab2004-09-13 20:22:18 +0000111[ --enable-isisd build isisd])
paul7ea487b2003-03-17 02:05:07 +0000112AC_ARG_ENABLE(bgp-announce,
113[ --disable-bgp-announce, turn off BGP route announcement])
114AC_ARG_ENABLE(netlink,
115[ --enable-netlink force to use Linux netlink interface])
116AC_ARG_ENABLE(broken-aliases,
117[ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
118AC_ARG_ENABLE(snmp,
119[ --enable-snmp enable SNMP support])
120AC_ARG_WITH(libpam,
121[ --with-libpam use libpam for PAM support in vtysh])
hasso71c0fb52003-05-25 20:18:13 +0000122AC_ARG_ENABLE(tcp-zebra,
paul7ea487b2003-03-17 02:05:07 +0000123[ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon])
paul7ea487b2003-03-17 02:05:07 +0000124AC_ARG_ENABLE(opaque-lsa,
paul1ef74ef2003-03-21 15:16:05 +0000125[ --enable-opaque-lsa enable OSPF Opaque-LSA with OSPFAPI support (RFC2370)])
126AC_ARG_ENABLE(ospfapi,
127[ --disable-ospfapi do not build OSPFAPI to access the OSPF LSA Database,
128 (this is the default if --enable-opaque-lsa is not set)])
129AC_ARG_ENABLE(ospfclient,
130[ --disable-ospfclient do not build OSPFAPI client for OSPFAPI,
131 (this is the default if --disable-ospfapi is set)])
paul7ea487b2003-03-17 02:05:07 +0000132AC_ARG_ENABLE(ospf-te,
133[ --enable-ospf-te enable Traffic Engineering Extension to OSPF])
134AC_ARG_ENABLE(multipath,
135[ --enable-multipath=ARG enable multipath function, ARG must be digit])
paule8f29842003-08-12 13:08:31 +0000136AC_ARG_ENABLE(quagga_user,
137[ --enable-user=ARG user to run Quagga suite as (default quagga)])
138AC_ARG_ENABLE(quagga_group,
139[ --enable-group=ARG group to run Quagga suite as (default quagga)])
pauledd7c242003-06-04 13:59:38 +0000140AC_ARG_ENABLE(vty_group,
141[ --enable-vty-group=ARG set vty sockets to have specified group as owner])
gdtaa593d52003-12-22 20:15:53 +0000142AC_ARG_ENABLE(configfile_mask,
143[ --enable-configfile-mask=ARG set mask for config files])
144AC_ARG_ENABLE(logfile_mask,
145[ --enable-logfile-mask=ARG set mask for log files])
pauledd7c242003-06-04 13:59:38 +0000146
hasso71c0fb52003-05-25 20:18:13 +0000147AC_ARG_ENABLE(rtadv,
gdtd2a0ccc2003-12-03 18:13:48 +0000148[ --disable-rtadv disable IPV6 router advertisement feature])
hassoca776982004-06-12 14:33:05 +0000149AC_ARG_ENABLE(irdp,
150[ --enable-irdp enable IRDP server support in zebra])
hasso41d3fc92004-04-06 11:59:00 +0000151AC_ARG_ENABLE(capabilities,
152[ --disable-capabilities disable using POSIX capabilities])
paul7ea487b2003-03-17 02:05:07 +0000153
154if test "${enable_broken_aliases}" = "yes"; then
155 if test "${enable_netlink}" = "yes"
156 then
157 echo "Sorry, you can't use netlink with broken aliases"
158 exit 1
159 fi
160 AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
161 enable_netlink=no
162fi
163
164if test "${enable_tcp_zebra}" = "yes"; then
165 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
166fi
167
paul7ea487b2003-03-17 02:05:07 +0000168if test "${enable_opaque_lsa}" = "yes"; then
169 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
170fi
171
172if test "${enable_ospf_te}" = "yes"; then
173 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
174 AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
175fi
176
gdtd2a0ccc2003-12-03 18:13:48 +0000177AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
178if test "${enable_rtadv}" != "no"; then
hasso71c0fb52003-05-25 20:18:13 +0000179 AC_MSG_RESULT(yes)
gdtd2a0ccc2003-12-03 18:13:48 +0000180 AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
paul2487bea2003-05-25 23:51:31 +0000181else
182 AC_MSG_RESULT(no)
hasso71c0fb52003-05-25 20:18:13 +0000183fi
paul7ea487b2003-03-17 02:05:07 +0000184
hassoca776982004-06-12 14:33:05 +0000185if test "${enable_irdp}" = "yes"; then
186 AC_DEFINE(HAVE_IRDP,, IRDP )
187fi
188
paul79cb2162003-06-06 12:19:53 +0000189if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
paule8f29842003-08-12 13:08:31 +0000190 enable_user="quagga"
pauledd7c242003-06-04 13:59:38 +0000191elif test "${enable_user}" = "no"; then
192 enable_user="root"
193fi
paule8f29842003-08-12 13:08:31 +0000194AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
pauledd7c242003-06-04 13:59:38 +0000195
paul79cb2162003-06-06 12:19:53 +0000196if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
paule8f29842003-08-12 13:08:31 +0000197 enable_group="quagga"
pauledd7c242003-06-04 13:59:38 +0000198elif test "${enable_group}" = "no"; then
199 enable_group="root"
200fi
paule8f29842003-08-12 13:08:31 +0000201AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
pauledd7c242003-06-04 13:59:38 +0000202
203if test x"${enable_vty_group}" = x"yes" ; then
paul8d4aee52003-06-06 00:30:35 +0000204 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
paul79cb2162003-06-06 12:19:53 +0000205elif test x"${enable_vty_group}" != x""; then
paul8d4aee52003-06-06 00:30:35 +0000206 if test x"${enable_vty_group}" != x"no"; then
pauledd7c242003-06-04 13:59:38 +0000207 AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
208 fi
209fi
210
gdtaa593d52003-12-22 20:15:53 +0000211enable_configfile_mask=${enable_configfile_mask:-0600}
212AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
213
214enable_logfile_mask=${enable_logfile_mask:-0600}
215AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
216
paul7ea487b2003-03-17 02:05:07 +0000217changequote(, )dnl
218
219MULTIPATH_NUM=1
220
221case "${enable_multipath}" in
222 [0-9]|[1-9][0-9])
223 MULTIPATH_NUM="${enable_multipath}"
224 ;;
225 "")
226 ;;
227 *)
228 echo "Please specify digit to --enable-multipath ARG."
229 exit 1
230 ;;
231esac
232
233changequote([, ])dnl
234
235AC_SUBST(MULTIPATH_NUM)
236
237dnl -------------------
238dnl Check header files.
239dnl -------------------
pauldc7a2bf2003-10-22 00:07:44 +0000240AC_HEADER_STDC
241AC_CHECK_HEADERS([string.h stropts.h sys/conf.h sys/ksym.h sys/time.h \
242 sys/times.h sys/select.h sys/sysctl.h sys/sockio.h \
243 sys/types.h linux/version.h kvm.h netdb.h asm/types.h \
244 libutil.h limits.h])
245
paul835b7f12003-10-30 21:59:57 +0000246AC_CHECK_HEADERS([sys/socket.h netinet/in_systm.h netinet/in.h \
paulf3bd1a72003-11-02 07:29:11 +0000247 net/if_dl.h net/netopt.h inet/nd.h net/route.h \
paul835b7f12003-10-30 21:59:57 +0000248 net/if.h net/if_var.h netinet/in_var.h])
pauldc7a2bf2003-10-22 00:07:44 +0000249
gdtfa3232e2003-12-03 17:52:30 +0000250dnl V6 headers are checked below, after we check for v6
paul7ea487b2003-03-17 02:05:07 +0000251
252dnl check some types
253AC_C_CONST
254dnl AC_TYPE_PID_T
255AC_TYPE_SIGNAL
256
257dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
258case "$host" in
paul19877dd2004-05-11 10:49:35 +0000259 [*-sunos5.[6-8]*] | [*-solaris2.[6-8]*])
paul7ea487b2003-03-17 02:05:07 +0000260 opsys=sol2-6
paul19877dd2004-05-11 10:49:35 +0000261 AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.8)
262 AC_DEFINE(SUNOS_5, 1, SunOS 5)
paul7ea487b2003-03-17 02:05:07 +0000263 AC_CHECK_LIB(xnet, main)
264 CURSES=-lcurses
265 ;;
paul19877dd2004-05-11 10:49:35 +0000266 [*-sunos5.[8-9]] | [*-sunos5.1[0-9]] \
267 | [*-solaris2.[8-9]] | [*-solaris2.1[0-9]])
268 opsys=sol9
269 AC_DEFINE(SUNOS_59,,SunOS 5.9 up)
270 AC_DEFINE(SUNOS_5, 1, SunOS 5)
271 AC_CHECK_LIB(socket, main)
272 AC_CHECK_LIB(nsl, main)
273 CURSES=-lcurses
274 ;;
paul7ea487b2003-03-17 02:05:07 +0000275 *-sunos5* | *-solaris2*)
paul19877dd2004-05-11 10:49:35 +0000276 AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
paul7ea487b2003-03-17 02:05:07 +0000277 AC_CHECK_LIB(socket, main)
278 AC_CHECK_LIB(nsl, main)
279 CURSES=-lcurses
280 ;;
281 *-linux-*)
282 opsys=gnu-linux
283 AC_DEFINE(GNU_LINUX,,GNU Linux)
284 ;;
285 *-nec-sysv4*)
286 AC_CHECK_LIB(nsl, gethostbyname)
287 AC_CHECK_LIB(socket, socket)
288 ;;
289 *-freebsd3.2)
290 AC_DEFINE(FREEBSD_32,,FreeBSD 3.2)
291 ;;
292 *-openbsd*)
293 opsys=openbsd
294 AC_DEFINE(OPEN_BSD,,OpenBSD)
295 ;;
296 *-bsdi*)
297 opsys=bsdi
298 OTHER_METHOD="mtu_kvm.o"
299 AC_CHECK_LIB(kvm, main)
300 ;;
paul49e3b3c2003-10-23 20:39:50 +0000301 *-irix6.5)
pauldc7a2bf2003-10-22 00:07:44 +0000302 opsys=irix
303 AC_DEFINE(IRIX_65,,IRIX 6.5)
304 ;;
paul7ea487b2003-03-17 02:05:07 +0000305esac
306
307dnl ---------------------
308dnl Integrated VTY option
309dnl ---------------------
310case "${enable_vtysh}" in
311 "yes") VTYSH="vtysh";
312 AC_DEFINE(VTYSH,,VTY shell)
gdtfc9d0742004-06-30 14:25:12 +0000313 AC_PATH_PROG(PERL, perl)
314dnl Vtysh uses libreadline, which looks for termcap functions at
315dnl configure time. We follow readline's search order.
316dnl The required procedures are in libtermcap on NetBSD, in
317dnl [TODO] on Linux, and in [TODO] on Solaris.
318 AC_CHECK_LIB(termcap, tputs, ,
319 AC_CHECK_LIB(tinfo, tputs, ,
320 AC_CHECK_LIB(curses, tputs, ,
321 AC_CHECK_LIB(ncurses, tputs))))
paul7ea487b2003-03-17 02:05:07 +0000322 AC_CHECK_LIB(readline, main)
323 if test $ac_cv_lib_readline_main = no; then
gdtfc9d0742004-06-30 14:25:12 +0000324 AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
paul7ea487b2003-03-17 02:05:07 +0000325 fi
326 AC_CHECK_HEADER(readline/history.h)
327 if test $ac_cv_header_readline_history_h = no;then
328 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
329 fi
paul3d3de8c2003-05-23 10:33:49 +0000330 AC_CHECK_LIB(readline, rl_completion_matches)
331 if test $ac_cv_lib_readline_rl_completion_matches = no; then
332 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
333 fi
334 ;;
paul7ea487b2003-03-17 02:05:07 +0000335 "no" ) VTYSH="";;
336 * ) ;;
337esac
338
339dnl ----------
340dnl PAM module
341dnl ----------
342if test "$with_libpam" = "yes"; then
paul24cd4352003-05-06 12:16:27 +0000343 AC_CHECK_HEADER(security/pam_misc.h)
344 if test "$ac_cv_header_security_pam_misc_h" = yes; then
345 AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
346 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
347 pam_conv_func="misc_conv"
paul24cd4352003-05-06 12:16:27 +0000348 fi
paul24cd4352003-05-06 12:16:27 +0000349 AC_CHECK_HEADER(security/openpam.h)
350 if test "$ac_cv_header_security_openpam_h" = yes; then
351 AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
352 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
353 pam_conv_func="openpam_ttyconv"
paul24cd4352003-05-06 12:16:27 +0000354 fi
355 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
356 AC_MSG_WARN([*** pam support will not be built ***])
357 with_libpam="no"
358 fi
359fi
360
361if test "$with_libpam" = "yes"; then
paul7ea487b2003-03-17 02:05:07 +0000362dnl took this test from proftpd's configure.in and suited to our needs
363dnl -------------------------------------------------------------------------
364dnl
365dnl This next check looks funky due to a linker problem with some versions
366dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
367dnl omitted requiring libdl linking information. PAM-0.72 or better ships
368dnl with RedHat 6.2 and Debian 2.2 or better.
369AC_CHECK_LIB(pam, pam_start,
paul24cd4352003-05-06 12:16:27 +0000370 [AC_CHECK_LIB(pam, $pam_conv_func,
paul7ea487b2003-03-17 02:05:07 +0000371 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
372 LIBPAM="-lpam"],
373 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
374 LIBPAM="-lpam -lpam_misc"]
375 )
376 ],
377
378 [AC_CHECK_LIB(pam, pam_end,
paul24cd4352003-05-06 12:16:27 +0000379 [AC_CHECK_LIB(pam, $pam_conv_func,
paula159ed92003-06-04 11:01:45 +0000380 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul7ea487b2003-03-17 02:05:07 +0000381 LIBPAM="-lpam -ldl"],
paula159ed92003-06-04 11:01:45 +0000382 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul7ea487b2003-03-17 02:05:07 +0000383 LIBPAM="-lpam -ldl -lpam_misc"]
384 )
385 ],AC_MSG_WARN([*** pam support will not be built ***]),
386 [-ldl])
387 ]
388)
389fi
390AC_SUBST(LIBPAM)
391
392dnl -------------------------------
393dnl Endian-ness check
394dnl -------------------------------
395AC_WORDS_BIGENDIAN
396
397dnl -------------------------------
398dnl check the size in byte of the C
399dnl -------------------------------
400dnl AC_CHECK_SIZEOF(char)
401dnl AC_CHECK_SIZEOF(int)
402dnl AC_CHECK_SIZEOF(short)
403dnl AC_CHECK_SIZEOF(long)
404
405dnl ----------------------------
406dnl check existance of functions
407dnl ----------------------------
paul49e3b3c2003-10-23 20:39:50 +0000408AC_CHECK_FUNCS(memset memcpy strerror inet_aton daemon snprintf vsnprintf \
paul04bd4842003-10-24 04:24:39 +0000409 strlcat strlcpy if_nametoindex if_indextoname getifaddrs \
410 fcntl)
paula159ed92003-06-04 11:01:45 +0000411AC_CHECK_FUNCS(setproctitle, ,
412 [AC_CHECK_LIB(util, setproctitle,
413 [LIBS="$LIBS -lutil"
414 AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
415 ]
416 )
417 ]
418)
paul7ea487b2003-03-17 02:05:07 +0000419
420dnl ------------------------------------
421dnl Determine routing get and set method
422dnl ------------------------------------
423AC_MSG_CHECKING(zebra between kernel interface method)
424if test x"$opsys" = x"gnu-linux"; then
425 if test "${enable_netlink}" = "yes";then
426 AC_MSG_RESULT(netlink)
427 RT_METHOD=rt_netlink.o
428 AC_DEFINE(HAVE_NETLINK,,netlink)
429 netlink=yes
430 elif test "${enable_netlink}" = "no"; then
431 AC_MSG_RESULT(ioctl)
432 RT_METHOD=rt_ioctl.o
433 netlink=no
434 else
435 AC_MSG_RESULT(netlink)
436 RT_METHOD=rt_netlink.o
437 AC_DEFINE(HAVE_NETLINK,,netlink)
438 netlink=yes
439 fi
paul19877dd2004-05-11 10:49:35 +0000440elif test x"$opsys" = x"sol2-6";then
441 AC_MSG_RESULT(Route socket)
442 KERNEL_METHOD="kernel_socket.o"
443 RT_METHOD="rt_socket.o"
444elif test x"$opsys" = x"sol9";then
445 AC_MSG_RESULT(Route socket)
446 KERNEL_METHOD="kernel_socket.o"
447 RT_METHOD="rt_socket.o"
448elif test "$opsys" = "irix" ; then
449 AC_MSG_RESULT(Route socket)
450 KERNEL_METHOD="kernel_socket.o"
451 RT_METHOD="rt_socket.o"
paul7ea487b2003-03-17 02:05:07 +0000452else
paul19877dd2004-05-11 10:49:35 +0000453 AC_TRY_RUN([#include <errno.h>
paul7ea487b2003-03-17 02:05:07 +0000454#include <sys/types.h>
455#include <sys/socket.h>
456
457main ()
458{
459 int ac_sock;
460
461 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
462 if (ac_sock < 0 && errno == EINVAL)
463 exit (1);
464 exit (0);
465}],
466 [KERNEL_METHOD=kernel_socket.o
467 RT_METHOD=rt_socket.o
468 AC_MSG_RESULT(socket)],
469 [RT_METHOD=rt_ioctl.o
470 AC_MSG_RESULT(ioctl)],
471 [KERNEL_METHOD=kernel_socket.o
472 RT_METHOD=rt_socket.o
473 AC_MSG_RESULT(socket)])
paul7ea487b2003-03-17 02:05:07 +0000474fi
475AC_SUBST(RT_METHOD)
476AC_SUBST(KERNEL_METHOD)
477AC_SUBST(OTHER_METHOD)
478
479dnl ------------------------------
480dnl check kernel route read method
481dnl ------------------------------
482AC_CACHE_CHECK(route read method check, zebra_rtread,
483[if test "$netlink" = yes; then
484 RTREAD_METHOD="rtread_netlink.o"
485 zebra_rtread="netlink"
486else
487for zebra_rtread in /proc/net/route /dev/ip /dev/null;
488do
489 test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
490done
491case $zebra_rtread in
492 "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
493 zebra_rtread="proc";;
paul9c30ab62003-07-08 08:36:17 +0000494 "/dev/ip")
495 case "$host" in
496 *-freebsd*) RTREAD_METHOD=rtread_sysctl.o
497 zebra_rtread="sysctl";;
498 *) RTREAD_METHOD="rtread_getmsg.o"
499 zebra_rtread="getmsg";;
500 esac;;
paul7ea487b2003-03-17 02:05:07 +0000501 *) RTREAD_METHOD="rtread_sysctl.o"
502 zebra_rtread="sysctl";;
503esac
504fi])
505AC_SUBST(RTREAD_METHOD)
506
507dnl -----------------------------
508dnl check interface lookup method
509dnl -----------------------------
paul19877dd2004-05-11 10:49:35 +0000510IOCTL_METHOD=ioctl.o
paul7ea487b2003-03-17 02:05:07 +0000511AC_MSG_CHECKING(interface looking up method)
512if test "$netlink" = yes; then
513 AC_MSG_RESULT(netlink)
514 IF_METHOD=if_netlink.o
paul19877dd2004-05-11 10:49:35 +0000515elif test "$opsys" = "sol2-6";then
516 AC_MSG_RESULT(Solaris GIF)
517 IF_METHOD=if_ioctl.o
518elif test "$opsys" = "sol9";then
519 AC_MSG_RESULT(Solaris GLIF)
520 IF_METHOD=if_ioctl_solaris.o
521 IOCTL_METHOD=ioctl_solaris.o
522elif test "$opsys" = "irix" ; then
523 AC_MSG_RESULT(IRIX)
524 IF_METHOD=if_ioctl.o
525elif test "$opsys" = "openbsd";then
526 AC_MSG_RESULT(openbsd)
527 IF_METHOD=if_ioctl.o
528elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
529 AC_MSG_RESULT(sysctl)
paul7ea487b2003-03-17 02:05:07 +0000530 IF_METHOD=if_sysctl.o
531 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
paul19877dd2004-05-11 10:49:35 +0000532else
paul7ea487b2003-03-17 02:05:07 +0000533 AC_MSG_RESULT(ioctl)
534 IF_METHOD=if_ioctl.o
paul7ea487b2003-03-17 02:05:07 +0000535fi
536AC_SUBST(IF_METHOD)
paul19877dd2004-05-11 10:49:35 +0000537AC_SUBST(IOCTL_METHOD)
paul7ea487b2003-03-17 02:05:07 +0000538
539dnl -----------------------
540dnl check proc file system.
541dnl -----------------------
542if test -r /proc/net/dev; then
543 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
544 IF_PROC=if_proc.o
545fi
546
547if test -r /proc/net/if_inet6; then
548 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
549 IF_PROC=if_proc.o
550fi
551AC_SUBST(IF_PROC)
552
553dnl -----------------------------
554dnl check ipforward detect method
555dnl -----------------------------
556AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
557[for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
558do
559 test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
560done
561case $zebra_ipforward_path in
562 "/proc/net/snmp") IPFORWARD=ipforward_proc.o
563 zebra_ipforward_path="proc";;
564 "/dev/ip")
565 case "$host" in
566 *-nec-sysv4*) IPFORWARD=ipforward_ews.o
567 zebra_ipforward_path="ews";;
paul9c30ab62003-07-08 08:36:17 +0000568 *-freebsd*) IPFORWARD=ipforward_sysctl.o
569 zebra_ipforward_path="sysctl";;
paul7ea487b2003-03-17 02:05:07 +0000570 *) IPFORWARD=ipforward_solaris.o
571 zebra_ipforward_path="solaris";;
572 esac;;
573 *) IPFORWARD=ipforward_sysctl.o
574 zebra_ipforward_path="sysctl";;
575esac])
576AC_SUBST(IPFORWARD)
577
578AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
579
580dnl ----------
581dnl IPv6 check
582dnl ----------
583AC_MSG_CHECKING(whether does this OS have IPv6 stack)
584if test "${enable_ipv6}" = "no"; then
585 AC_MSG_RESULT(disabled)
586else
587dnl ----------
588dnl INRIA IPv6
589dnl ----------
paula159ed92003-06-04 11:01:45 +0000590 if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
591 zebra_cv_ipv6=yes
592 AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
593 AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
594 RIPNGD="ripngd"
595 OSPF6D="ospf6d"
596 LIB_IPV6=""
597 AC_MSG_RESULT(INRIA IPv6)
paul7ea487b2003-03-17 02:05:07 +0000598dnl ---------
599dnl KAME IPv6
600dnl ---------
paula159ed92003-06-04 11:01:45 +0000601 elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
602 zebra_cv_ipv6=yes
603 AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
604 AC_DEFINE(KAME,1,KAME IPv6)
605 RIPNGD="ripngd"
606 OSPF6D="ospf6d"
607 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
paul7ea487b2003-03-17 02:05:07 +0000608 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +0000609 fi
610 AC_MSG_RESULT(KAME)
hasso71c0fb52003-05-25 20:18:13 +0000611dnl -------------------------
612dnl MUSICA IPv6
613dnl default host check
614dnl It is not used by Kheops
615dnl -------------------------
paula159ed92003-06-04 11:01:45 +0000616 elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
617 zebra_cv_ipv6=yes
618 AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
619 AC_DEFINE(MUSICA,1,Musica IPv6 stack)
620 AC_DEFINE(KAME,1,KAME IPv6 stack)
621 RIPNGD="ripngd"
622 OSPF6D="ospf6d"
623 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
hasso71c0fb52003-05-25 20:18:13 +0000624 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +0000625 fi
626 AC_MSG_RESULT(MUSICA)
paul7ea487b2003-03-17 02:05:07 +0000627dnl ---------
628dnl NRL check
629dnl ---------
paula159ed92003-06-04 11:01:45 +0000630 elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
631 zebra_cv_ipv6=yes
632 AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
633 AC_DEFINE(NRL,1,NRL)
634 RIPNGD="ripngd"
635 OSPF6D="ospf6d"
636 if test x"$opsys" = x"bsdi";then
paul7ea487b2003-03-17 02:05:07 +0000637 AC_DEFINE(BSDI_NRL,,BSDI)
638 AC_MSG_RESULT(BSDI_NRL)
paula159ed92003-06-04 11:01:45 +0000639 else
paul7ea487b2003-03-17 02:05:07 +0000640 AC_MSG_RESULT(NRL)
paula159ed92003-06-04 11:01:45 +0000641 fi
paul19877dd2004-05-11 10:49:35 +0000642dnl ------------------------------------
643dnl Solaris 9, 10 and potentially higher
644dnl ------------------------------------
645 elif test x"$opsys" = x"sol9"; then
646 zebra_cv_ipv6=yes;
647 AC_DEFINE(HAVE_IPV6, 1, IPv6)
648 AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
649 RIPNGD="ripngd"
650 OSPF6D="ospf6d"
651 AC_MSG_RESULT(Solaris IPv6)
paul7ea487b2003-03-17 02:05:07 +0000652dnl ----------
653dnl Linux IPv6
654dnl ----------
paula159ed92003-06-04 11:01:45 +0000655 elif test "${enable_ipv6}" = "yes"; then
656 AC_EGREP_CPP(yes, [
657 #include <linux/version.h>
658 /* 2.1.128 or later */
659 #if LINUX_VERSION_CODE >= 0x020180
660 yes
661 #endif],
662 [zebra_cv_ipv6=yes
663 zebra_cv_linux_ipv6=yes
664 AC_MSG_RESULT(Linux IPv6)])
665 else
666 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
667 then
paul7ea487b2003-03-17 02:05:07 +0000668 zebra_cv_ipv6=yes
669 zebra_cv_linux_ipv6=yes
670 AC_MSG_RESULT(Linux IPv6)
paula159ed92003-06-04 11:01:45 +0000671 fi
672 fi
paul7ea487b2003-03-17 02:05:07 +0000673
paula159ed92003-06-04 11:01:45 +0000674 if test "$zebra_cv_linux_ipv6" = "yes";then
675 AC_MSG_CHECKING(for GNU libc >= 2.1)
676 AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
677 AC_EGREP_CPP(yes, [
paul7ea487b2003-03-17 02:05:07 +0000678#include <features.h>
679#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
680 yes
paula159ed92003-06-04 11:01:45 +0000681#endif],
682 [glibc=yes
683 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
684 AC_MSG_RESULT(yes)],
685 AC_MSG_RESULT(no)
686 )
687 RIPNGD="ripngd"
688 OSPF6D="ospf6d"
689 if test "$glibc" != "yes"; then
paul7ea487b2003-03-17 02:05:07 +0000690 INCLUDES="-I/usr/inet6/include"
691 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
692 LIB_IPV6="-L/usr/inet6/lib -linet6"
693 fi
paula159ed92003-06-04 11:01:45 +0000694 fi
695 fi
paul7ea487b2003-03-17 02:05:07 +0000696
697dnl -----------------------
698dnl Set IPv6 related values
699dnl -----------------------
paula159ed92003-06-04 11:01:45 +0000700 LIBS="$LIB_IPV6 $LIBS"
701 AC_SUBST(LIB_IPV6)
paul7ea487b2003-03-17 02:05:07 +0000702
paula159ed92003-06-04 11:01:45 +0000703 if test x"$RIPNGD" = x""; then
704 AC_MSG_RESULT(IPv4 only)
705 fi
paul7ea487b2003-03-17 02:05:07 +0000706fi
707
gdtfa3232e2003-12-03 17:52:30 +0000708dnl ------------------
709dnl IPv6 header checks
710dnl ------------------
711if test "x${zebra_cv_ipv6}" = "xyes"; then
712AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
713 netinet6/in6_var.h netinet6/nd6.h])
714fi
715
paul7ea487b2003-03-17 02:05:07 +0000716dnl --------------------
717dnl Daemon disable check
718dnl --------------------
719if test "${enable_zebra}" = "no";then
720 ZEBRA=""
721else
722 ZEBRA="zebra"
723fi
724
725if test "${enable_bgpd}" = "no";then
726 BGPD=""
727else
728 BGPD="bgpd"
729fi
730
731if test "${enable_ripd}" = "no";then
732 RIPD=""
733else
734 RIPD="ripd"
735fi
736
737if test "${enable_ospfd}" = "no";then
738 OSPFD=""
739else
740 OSPFD="ospfd"
741fi
742
paul1ef74ef2003-03-21 15:16:05 +0000743OSPFCLIENT=""
744if test "${enable_opaque_lsa}" = "yes"; then
745 if test "${enable_ospfapi}" != "no";then
paul9a569842003-03-28 01:45:13 +0000746 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
paul1ef74ef2003-03-21 15:16:05 +0000747
748 if test "${enable_ospfclient}" != "no";then
749 OSPFCLIENT="ospfclient"
750 fi
751 fi
752
paul7ea487b2003-03-17 02:05:07 +0000753fi
754
755case "${enable_ripngd}" in
756 "yes") RIPNGD="ripngd";;
757 "no" ) RIPNGD="";;
758 * ) ;;
759esac
760
761case "${enable_ospf6d}" in
762 "yes") OSPF6D="ospf6d";;
763 "no" ) OSPF6D="";;
764 * ) ;;
765esac
766
jardin9e867fe2003-12-23 08:56:18 +0000767case "${enable_isisd}" in
768 "yes") ISISD="isisd";;
769 "no" ) ISISD="";;
hassoae399ab2004-09-13 20:22:18 +0000770 * ) ;;
jardin9e867fe2003-12-23 08:56:18 +0000771esac
772
paul7ea487b2003-03-17 02:05:07 +0000773if test "${enable_bgp_announce}" = "no";then
774 AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
775fi
776
777AC_SUBST(ZEBRA)
778AC_SUBST(BGPD)
779AC_SUBST(RIPD)
780AC_SUBST(RIPNGD)
781AC_SUBST(OSPFD)
782AC_SUBST(OSPF6D)
jardin9e867fe2003-12-23 08:56:18 +0000783AC_SUBST(ISISD)
paul7ea487b2003-03-17 02:05:07 +0000784AC_SUBST(VTYSH)
785AC_SUBST(INCLUDES)
786AC_SUBST(CURSES)
787AC_SUBST(OSPFCLIENT)
paul1ef74ef2003-03-21 15:16:05 +0000788AC_SUBST(OSPFAPI)
paul7ea487b2003-03-17 02:05:07 +0000789AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
790AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
791AC_CHECK_LIB(crypt, crypt)
792AC_CHECK_LIB(resolv, res_init)
793AC_CHECK_LIB(m, main)
794
795dnl ---------------------------------------------------
796dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
797dnl ---------------------------------------------------
paula159ed92003-06-04 11:01:45 +0000798AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
799AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
800AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
paul7ea487b2003-03-17 02:05:07 +0000801
802dnl ---------------------------
803dnl check system has GNU regexp
804dnl ---------------------------
805dnl AC_MSG_CHECKING(whether system has GNU regex)
806AC_CHECK_LIB(c, regexec,
807[AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
808 LIB_REGEX=""],
809[LIB_REGEX="regex.o"])
810AC_SUBST(LIB_REGEX)
811
812dnl ------------------
813dnl check SNMP library
814dnl ------------------
815if test "${enable_snmp}" = "yes";then
816dnl AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
paul7ea487b2003-03-17 02:05:07 +0000817 if test "${HAVE_SNMP}" = ""; then
paul1ef74ef2003-03-21 15:16:05 +0000818 old_libs="${LIBS}"
819 LIBS="-L/usr/lib"
paul7ea487b2003-03-17 02:05:07 +0000820 unset ac_cv_lib_snmp_asn_parse_int
paul1ef74ef2003-03-21 15:16:05 +0000821 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
822 if test "${NEED_CRYPTO}" = ""; then
823 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes ])
824 else
825 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes; NEED_CRYPTO=yes;LIBS="$LIBS -lcrypto" ],,"-lcrypto")
826 fi
827 LIBS="${old_libs}"
paul7ea487b2003-03-17 02:05:07 +0000828 fi
paul1ef74ef2003-03-21 15:16:05 +0000829 if test "${HAVE_SNMP}" = ""; then
830 old_libs="${LIBS}"
831 LIBS="-L/usr/lib"
832 unset ac_cv_lib_snmp_asn_parse_int
833 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes, )
834 if test "${HAVE_SNMP}" = ""; then
835 unset ac_cv_lib_snmp_asn_parse_int
836 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
837 if test "${NEED_CRYPTO}" = "yes"; then
838 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
839 fi
840 fi
841 LIBS="${old_libs}"
842 fi
paul7ea487b2003-03-17 02:05:07 +0000843
844 if test "${HAVE_SNMP}" = ""; then
paul1ef74ef2003-03-21 15:16:05 +0000845 old_libs="${LIBS}"
846 LIBS="-L/usr/local/lib"
847 unset ac_cv_lib_snmp_asn_parse_int
848 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
849 if test "${HAVE_SNMP}" = ""; then
850 unset ac_cv_lib_snmp_asn_parse_int
851 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
852 if test "${NEED_CRYPTO}" = "yes"; then
853 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
854 fi
855 fi
856 LIBS="${old_libs}"
paul7ea487b2003-03-17 02:05:07 +0000857 fi
paul1ef74ef2003-03-21 15:16:05 +0000858
paul7ea487b2003-03-17 02:05:07 +0000859 if test "${HAVE_SNMP}" = "yes"; then
860 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
861 do
862 test -f "${ac_snmp}" && break
863 done
paul1ef74ef2003-03-21 15:16:05 +0000864
paul7ea487b2003-03-17 02:05:07 +0000865 case ${ac_snmp} in
866 /usr/include/net-snmp/*)
867 AC_DEFINE(HAVE_SNMP,,SNMP)
paul1ef74ef2003-03-21 15:16:05 +0000868 AC_DEFINE(HAVE_NETSNMP,,SNMP)
paul7ea487b2003-03-17 02:05:07 +0000869 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
paulac7c4bb2003-03-19 04:25:08 +0000870 CFLAGS="${CFLAGS} -I/usr/include/net-snmp -I/usr/include/net-snmp/library"
871 if test "${HAVE_NETSNMP}" = "yes"; then
paul1ef74ef2003-03-21 15:16:05 +0000872 LIBS="${LIBS} -lnetsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000873 else
paul1ef74ef2003-03-21 15:16:05 +0000874 LIBS="${LIBS} -lsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000875 fi
paul7ea487b2003-03-17 02:05:07 +0000876 ;;
877 /usr/include/ucd-snmp/*)
878 AC_DEFINE(HAVE_SNMP,,SNMP)
879 CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp"
880 LIBS="${LIBS} -lsnmp"
881 ;;
882 /usr/local/include/ucd-snmp/*)
883 AC_DEFINE(HAVE_SNMP,,SNMP)
884 CFLAGS="${CFLAGS} -I/usr/local/include/ucd-snmp"
885 LIBS="${LIBS} -L/usr/local/lib -lsnmp"
886 ;;
paulf3bd1a72003-11-02 07:29:11 +0000887 /usr/local/include/net-snmp/*)
888 AC_DEFINE(HAVE_SNMP,,SNMP)
889 AC_DEFINE(HAVE_NET_SNMP,,SNMP)
890 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
891 CFLAGS="${CFLAGS} -I/usr/local/include/net-snmp"
892 LIBS="${LIBS} -L/usr/local/lib -lnetsnmp"
893 ;;
paul7ea487b2003-03-17 02:05:07 +0000894 esac
895 if test "${NEED_CRYPTO}" = "yes"; then
896 LIBS="${LIBS} -lcrypto"
897 fi
898 fi
899fi
900
901dnl ----------------------------
902dnl check sa_len of sockaddr
903dnl ----------------------------
904AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
905AC_TRY_COMPILE([#include <sys/types.h>
906#include <sys/socket.h>
907],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
908[AC_MSG_RESULT(yes)
909 AC_DEFINE(HAVE_SA_LEN,,sa_len)],
910 AC_MSG_RESULT(no))
911
912dnl ----------------------------
913dnl check sin_len of sockaddr_in
914dnl ----------------------------
915AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
916AC_TRY_COMPILE([#include <sys/types.h>
917#include <netinet/in.h>
918],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
919[AC_MSG_RESULT(yes)
920 AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
921 AC_MSG_RESULT(no))
922
923dnl ----------------------------
924dnl check sun_len of sockaddr_un
925dnl ----------------------------
926AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
927AC_TRY_COMPILE([#include <sys/types.h>
928#include <sys/un.h>
929],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
930[AC_MSG_RESULT(yes)
931 AC_DEFINE(HAVE_SUN_LEN,,sun_len)],
932 AC_MSG_RESULT(no))
933
934dnl -----------------------------------
935dnl check sin6_scope_id of sockaddr_in6
936dnl -----------------------------------
937if test "$zebra_cv_ipv6" = yes; then
938 AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
939 AC_TRY_COMPILE([#include <sys/types.h>
940#include <netinet/in.h>
941],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
942[AC_MSG_RESULT(yes)
943 AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)],
944 AC_MSG_RESULT(no))
945fi
946
947dnl ----------------------------
948dnl check socklen_t exist or not
949dnl ----------------------------
950AC_MSG_CHECKING(whther socklen_t is defined)
951AC_TRY_COMPILE([#include <sys/types.h>
952#include <sys/socket.h>
953#include <netinet/in.h>
954],[socklen_t ac_x;],
955[AC_MSG_RESULT(yes)
956 AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)],
957 AC_MSG_RESULT(no))
958
959dnl ------------------------
960dnl check struct sockaddr_dl
961dnl ------------------------
962AC_MSG_CHECKING(whether struct sockaddr_dl exist)
963AC_EGREP_HEADER(sockaddr_dl,
964net/if_dl.h,
965[AC_MSG_RESULT(yes)
966 AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)],
967 AC_MSG_RESULT(no))
968
969dnl --------------------------
970dnl check structure ifaliasreq
971dnl --------------------------
972AC_MSG_CHECKING(whether struct ifaliasreq exist)
973AC_EGREP_HEADER(ifaliasreq,
974net/if.h,
975[AC_MSG_RESULT(yes)
976 AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)],
977 AC_MSG_RESULT(no))
978
979dnl ----------------------------
980dnl check structure in6_aliasreq
981dnl ----------------------------
hasso71c0fb52003-05-25 20:18:13 +0000982AC_MSG_CHECKING(whether struct in6_aliasreq exist)
paul7ea487b2003-03-17 02:05:07 +0000983AC_EGREP_HEADER(in6_aliasreq,
984netinet6/in6_var.h,
985[AC_MSG_RESULT(yes)
986 AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
987 AC_MSG_RESULT(no))
988
hasso71c0fb52003-05-25 20:18:13 +0000989dnl -----------------------------------
990dnl check ifra_lifetime of in6_aliasreq
991dnl -----------------------------------
992AC_MSG_CHECKING(whether in6_aliasreq.ifra_lifetime exist)
993AC_TRY_COMPILE([#include <sys/types.h>
994#include <netinet6/in6_var.h>
995],[static struct if6_aliasreq ac_i;int ac_j = sizeof (ac_i.ifra_lifetime);],
996[AC_MSG_RESULT(yes)
paula159ed92003-06-04 11:01:45 +0000997 AC_DEFINE(HAVE_IFRA_LIFETIME,,Have in6_aliasreq.ifra_lifetime)],
hasso71c0fb52003-05-25 20:18:13 +0000998 AC_MSG_RESULT(no))
999
paul7ea487b2003-03-17 02:05:07 +00001000dnl ---------------------------
1001dnl check structure rt_addrinfo
1002dnl ---------------------------
1003AC_MSG_CHECKING(whether struct rt_addrinfo exist)
1004AC_EGREP_HEADER(rt_addrinfo,
1005net/route.h,
1006[AC_MSG_RESULT(yes)
1007 AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)],
1008 AC_MSG_RESULT(no))
1009
1010dnl --------------------------
1011dnl check structure in_pktinfo
1012dnl --------------------------
1013AC_MSG_CHECKING(whether struct in_pktinfo exist)
1014AC_TRY_COMPILE([#include <netinet/in.h>
1015],[struct in_pktinfo ac_x;],
1016[AC_MSG_RESULT(yes)
1017 AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
1018 AC_MSG_RESULT(no))
1019
1020dnl --------------------------------------
1021dnl checking for getrusage struct and call
1022dnl --------------------------------------
1023AC_MSG_CHECKING(whether getrusage is available)
1024AC_TRY_COMPILE([#include <sys/resource.h>
1025],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
1026[AC_MSG_RESULT(yes)
1027 AC_DEFINE(HAVE_RUSAGE,,rusage)],
1028 AC_MSG_RESULT(no))
1029
pauledd7c242003-06-04 13:59:38 +00001030dnl -------------------
1031dnl capabilities checks
1032dnl -------------------
hasso41d3fc92004-04-06 11:59:00 +00001033if test "${enable_capabilities}" != "no"; then
1034 AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1035 AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1036 [AC_MSG_RESULT(yes)
1037 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1038 quagga_ac_keepcaps="yes"],
1039 AC_MSG_RESULT(no)
pauledd7c242003-06-04 13:59:38 +00001040 )
hasso41d3fc92004-04-06 11:59:00 +00001041 if test x"${quagga_ac_keepcaps}" = x"yes"; then
1042 AC_CHECK_HEADERS(sys/capability.h)
1043 fi
1044 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1045 AC_CHECK_LIB(cap, cap_init,
1046 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1047 LIBCAP="-lcap"
1048 ]
1049 )
1050 fi
pauledd7c242003-06-04 13:59:38 +00001051fi
1052AC_SUBST(LIBCAP)
1053
paulfb2d1502003-06-04 09:40:54 +00001054dnl ---------------------------
1055dnl check for glibc 'backtrace'
1056dnl ---------------------------
1057if test "${glibc}" = "yes"; then
1058 AC_CHECK_HEADER(execinfo.h)
1059fi
1060if test x"${ac_cv_header_execinfo_h}" = x"yes"; then
1061 AC_CHECK_FUNC(backtrace,
1062 [AC_DEFINE(HAVE_GLIBC_BACKTRACE,,Glibc backtrace)]
1063 )
1064fi
1065
paul408ad942003-05-20 00:03:33 +00001066dnl ----------
1067dnl configure date
1068dnl ----------
1069CONFDATE=`date '+%Y%m%d'`
1070AC_SUBST(CONFDATE)
1071
paul7ea487b2003-03-17 02:05:07 +00001072dnl ------------------------------
paula159ed92003-06-04 11:01:45 +00001073dnl set paths for state directory
paul23bd12c2003-04-07 06:11:09 +00001074dnl ------------------------------
1075if test "${prefix}" = "NONE"; then
paule8f29842003-08-12 13:08:31 +00001076 quagga_statedir_prefix="";
paul23bd12c2003-04-07 06:11:09 +00001077else
paule8f29842003-08-12 13:08:31 +00001078 quagga_statedir_prefix=${prefix}
paul23bd12c2003-04-07 06:11:09 +00001079fi
1080if test "${localstatedir}" = '${prefix}/var'; then
paula159ed92003-06-04 11:01:45 +00001081 AC_CACHE_CHECK(state directory,ac_statedir,
paule8f29842003-08-12 13:08:31 +00001082 [for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
1083 ${quagga_statedir_prefix}/var/adm dnl
1084 ${quagga_statedir_prefix}/etc dnl
paula159ed92003-06-04 11:01:45 +00001085 /var/run dnl
1086 /var/adm dnl
1087 /etc dnl
1088 /dev/null;
paul23bd12c2003-04-07 06:11:09 +00001089 do
paule8f29842003-08-12 13:08:31 +00001090 test -d $QUAGGA_STATE_DIR && break
paul23bd12c2003-04-07 06:11:09 +00001091 done
paule8f29842003-08-12 13:08:31 +00001092 quagga_statedir=$QUAGGA_STATE_DIR])
paul23bd12c2003-04-07 06:11:09 +00001093else
paule8f29842003-08-12 13:08:31 +00001094 quagga_statedir=${localstatedir}
paula159ed92003-06-04 11:01:45 +00001095 AC_MSG_CHECKING(directory to use for state file)
paule8f29842003-08-12 13:08:31 +00001096 AC_MSG_RESULT(${quagga_statedir})
paul23bd12c2003-04-07 06:11:09 +00001097fi
paule8f29842003-08-12 13:08:31 +00001098if test $quagga_statedir = "/dev/null"; then
paula159ed92003-06-04 11:01:45 +00001099 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1100fi
1101
paule8f29842003-08-12 13:08:31 +00001102AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1103AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1104AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1105AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1106AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1107AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
jardin9e867fe2003-12-23 08:56:18 +00001108AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
paule8f29842003-08-12 13:08:31 +00001109AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1110AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1111AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1112AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1113AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1114AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1115AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
jardin9e867fe2003-12-23 08:56:18 +00001116AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
paul7ea487b2003-03-17 02:05:07 +00001117
1118dnl ---------------------------
1119dnl Check htonl works correctly
1120dnl ---------------------------
1121AC_MSG_CHECKING(for working htonl)
1122AC_CACHE_VAL(ac_cv_htonl_works, [
1123AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
1124#include <sys/types.h>
1125#endif
1126#ifdef HAVE_NETDB_H
1127#include <netdb.h>
1128#endif
1129#ifdef HAVE_NETINET_IN_H
1130#include <netinet/in.h>
1131#endif],
1132[htonl (0);],
1133ac_cv_htonl_works=yes,
1134ac_cv_htonl_works=no)])
1135AC_MSG_RESULT($ac_cv_htonl_works)
1136
paul6382b6f2003-05-20 00:17:45 +00001137AC_OUTPUT(Makefile lib/Makefile zebra/Makefile ripd/Makefile
1138 ripngd/Makefile bgpd/Makefile ospfd/Makefile
jardin9e867fe2003-12-23 08:56:18 +00001139 ospf6d/Makefile isisd/Makefile vtysh/Makefile doc/Makefile
paul6382b6f2003-05-20 00:17:45 +00001140 ospfclient/Makefile
gdtfc9d0742004-06-30 14:25:12 +00001141 vtysh/extract.pl
gdtb85dca32004-08-31 18:44:42 +00001142 m4/Makefile
gdt69f1fc22004-08-27 15:57:35 +00001143 pkgsrc/Makefile
jardina4d2a0d2004-01-10 20:42:35 +00001144 redhat/Makefile redhat/quagga.spec
gdtb7a97f82004-07-23 16:23:56 +00001145 lib/version.h
paul41c14a12004-07-26 19:27:51 +00001146 tests/Makefile
gdtcbd04082004-08-31 18:16:36 +00001147 pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
1148 pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh
gdtb7a97f82004-07-23 16:23:56 +00001149 ,
gdtfc9d0742004-06-30 14:25:12 +00001150 [chmod +x vtysh/extract.pl])
paul7ea487b2003-03-17 02:05:07 +00001151
1152echo "
hassoc89f6492004-08-26 12:21:28 +00001153Quagga configuration
1154--------------------
1155quagga version : ${PACKAGE_VERSION}
paul7ea487b2003-03-17 02:05:07 +00001156host operationg system : ${host_os}
1157source code location : ${srcdir}
1158compiler : ${CC}
1159compiler flags : ${CFLAGS}
hasso71c0fb52003-05-25 20:18:13 +00001160linker flags : ${LDFLAGS} ${LIBS}
paule8f29842003-08-12 13:08:31 +00001161state file directory : ${quagga_statedir}
pauldc7a2bf2003-10-22 00:07:44 +00001162config file directory : `eval echo \`echo ${sysconfdir}\``
gdtd6b72f72003-12-03 17:24:27 +00001163example directory : `eval echo \`echo ${exampledir}\``
paul8d4aee52003-06-06 00:30:35 +00001164user to run as : ${enable_user}
1165group to run as : ${enable_group}
1166group for vty sockets : ${enable_vty_group}
gdtaa593d52003-12-22 20:15:53 +00001167config file mask : ${enable_configfile_mask}
1168log file mask : ${enable_logfile_mask}
pauldc7a2bf2003-10-22 00:07:44 +00001169
1170The above user and group must have read/write access to the state file
1171directory and to the config files in the config file directory.
paul7ea487b2003-03-17 02:05:07 +00001172"