blob: 1f489474644f127b4fa170d9d305660792d0b0a9 [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##
paul2b702002004-12-23 20:09:44 +00008## $Id: configure.ac,v 1.80 2004/12/23 20:09:44 paul 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])
158
159if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
160 CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
161 CFLAGS="${CFLAGS} -Wmissing-declarations -Wmissing-noreturn"
162 CFLAGS="${CFLAGS} -Wmissing-format-attribute -Wunreachable-code"
163 CFLAGS="${CFLAGS} -Wpacked -Wpadded"
164fi
paul7ea487b2003-03-17 02:05:07 +0000165
166if test "${enable_broken_aliases}" = "yes"; then
167 if test "${enable_netlink}" = "yes"
168 then
169 echo "Sorry, you can't use netlink with broken aliases"
170 exit 1
171 fi
172 AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
173 enable_netlink=no
174fi
175
176if test "${enable_tcp_zebra}" = "yes"; then
177 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
178fi
179
paul7ea487b2003-03-17 02:05:07 +0000180if test "${enable_opaque_lsa}" = "yes"; then
181 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
182fi
183
184if test "${enable_ospf_te}" = "yes"; then
185 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
186 AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
187fi
188
gdtd2a0ccc2003-12-03 18:13:48 +0000189AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
190if test "${enable_rtadv}" != "no"; then
hasso71c0fb52003-05-25 20:18:13 +0000191 AC_MSG_RESULT(yes)
gdtd2a0ccc2003-12-03 18:13:48 +0000192 AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
paul2487bea2003-05-25 23:51:31 +0000193else
194 AC_MSG_RESULT(no)
hasso71c0fb52003-05-25 20:18:13 +0000195fi
paul7ea487b2003-03-17 02:05:07 +0000196
hassoca776982004-06-12 14:33:05 +0000197if test "${enable_irdp}" = "yes"; then
198 AC_DEFINE(HAVE_IRDP,, IRDP )
199fi
200
paul79cb2162003-06-06 12:19:53 +0000201if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
paule8f29842003-08-12 13:08:31 +0000202 enable_user="quagga"
pauledd7c242003-06-04 13:59:38 +0000203elif test "${enable_user}" = "no"; then
204 enable_user="root"
205fi
paule8f29842003-08-12 13:08:31 +0000206AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
pauledd7c242003-06-04 13:59:38 +0000207
paul79cb2162003-06-06 12:19:53 +0000208if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
paule8f29842003-08-12 13:08:31 +0000209 enable_group="quagga"
pauledd7c242003-06-04 13:59:38 +0000210elif test "${enable_group}" = "no"; then
211 enable_group="root"
212fi
paule8f29842003-08-12 13:08:31 +0000213AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
pauledd7c242003-06-04 13:59:38 +0000214
215if test x"${enable_vty_group}" = x"yes" ; then
paul8d4aee52003-06-06 00:30:35 +0000216 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
paul79cb2162003-06-06 12:19:53 +0000217elif test x"${enable_vty_group}" != x""; then
paul8d4aee52003-06-06 00:30:35 +0000218 if test x"${enable_vty_group}" != x"no"; then
pauledd7c242003-06-04 13:59:38 +0000219 AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
220 fi
221fi
222
gdtaa593d52003-12-22 20:15:53 +0000223enable_configfile_mask=${enable_configfile_mask:-0600}
224AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
225
226enable_logfile_mask=${enable_logfile_mask:-0600}
227AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
228
paul7ea487b2003-03-17 02:05:07 +0000229changequote(, )dnl
230
231MULTIPATH_NUM=1
232
233case "${enable_multipath}" in
234 [0-9]|[1-9][0-9])
235 MULTIPATH_NUM="${enable_multipath}"
236 ;;
237 "")
238 ;;
239 *)
240 echo "Please specify digit to --enable-multipath ARG."
241 exit 1
242 ;;
243esac
244
245changequote([, ])dnl
246
247AC_SUBST(MULTIPATH_NUM)
248
249dnl -------------------
250dnl Check header files.
251dnl -------------------
pauldc7a2bf2003-10-22 00:07:44 +0000252AC_HEADER_STDC
253AC_CHECK_HEADERS([string.h stropts.h sys/conf.h sys/ksym.h sys/time.h \
254 sys/times.h sys/select.h sys/sysctl.h sys/sockio.h \
255 sys/types.h linux/version.h kvm.h netdb.h asm/types.h \
256 libutil.h limits.h])
257
paul835b7f12003-10-30 21:59:57 +0000258AC_CHECK_HEADERS([sys/socket.h netinet/in_systm.h netinet/in.h \
paulf3bd1a72003-11-02 07:29:11 +0000259 net/if_dl.h net/netopt.h inet/nd.h net/route.h \
paul835b7f12003-10-30 21:59:57 +0000260 net/if.h net/if_var.h netinet/in_var.h])
pauldc7a2bf2003-10-22 00:07:44 +0000261
gdtfa3232e2003-12-03 17:52:30 +0000262dnl V6 headers are checked below, after we check for v6
paul7ea487b2003-03-17 02:05:07 +0000263
264dnl check some types
265AC_C_CONST
266dnl AC_TYPE_PID_T
267AC_TYPE_SIGNAL
268
269dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
270case "$host" in
paul19877dd2004-05-11 10:49:35 +0000271 [*-sunos5.[6-8]*] | [*-solaris2.[6-8]*])
paul7ea487b2003-03-17 02:05:07 +0000272 opsys=sol2-6
paul19877dd2004-05-11 10:49:35 +0000273 AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.8)
274 AC_DEFINE(SUNOS_5, 1, SunOS 5)
paul7ea487b2003-03-17 02:05:07 +0000275 AC_CHECK_LIB(xnet, main)
276 CURSES=-lcurses
277 ;;
paul19877dd2004-05-11 10:49:35 +0000278 [*-sunos5.[8-9]] | [*-sunos5.1[0-9]] \
279 | [*-solaris2.[8-9]] | [*-solaris2.1[0-9]])
280 opsys=sol9
281 AC_DEFINE(SUNOS_59,,SunOS 5.9 up)
282 AC_DEFINE(SUNOS_5, 1, SunOS 5)
283 AC_CHECK_LIB(socket, main)
284 AC_CHECK_LIB(nsl, main)
285 CURSES=-lcurses
286 ;;
paul7ea487b2003-03-17 02:05:07 +0000287 *-sunos5* | *-solaris2*)
paul19877dd2004-05-11 10:49:35 +0000288 AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
paul7ea487b2003-03-17 02:05:07 +0000289 AC_CHECK_LIB(socket, main)
290 AC_CHECK_LIB(nsl, main)
291 CURSES=-lcurses
292 ;;
293 *-linux-*)
294 opsys=gnu-linux
295 AC_DEFINE(GNU_LINUX,,GNU Linux)
296 ;;
297 *-nec-sysv4*)
298 AC_CHECK_LIB(nsl, gethostbyname)
299 AC_CHECK_LIB(socket, socket)
300 ;;
301 *-freebsd3.2)
302 AC_DEFINE(FREEBSD_32,,FreeBSD 3.2)
303 ;;
304 *-openbsd*)
305 opsys=openbsd
306 AC_DEFINE(OPEN_BSD,,OpenBSD)
307 ;;
308 *-bsdi*)
309 opsys=bsdi
310 OTHER_METHOD="mtu_kvm.o"
311 AC_CHECK_LIB(kvm, main)
312 ;;
paul49e3b3c2003-10-23 20:39:50 +0000313 *-irix6.5)
pauldc7a2bf2003-10-22 00:07:44 +0000314 opsys=irix
315 AC_DEFINE(IRIX_65,,IRIX 6.5)
316 ;;
paul7ea487b2003-03-17 02:05:07 +0000317esac
318
319dnl ---------------------
320dnl Integrated VTY option
321dnl ---------------------
322case "${enable_vtysh}" in
323 "yes") VTYSH="vtysh";
324 AC_DEFINE(VTYSH,,VTY shell)
gdtfc9d0742004-06-30 14:25:12 +0000325 AC_PATH_PROG(PERL, perl)
326dnl Vtysh uses libreadline, which looks for termcap functions at
327dnl configure time. We follow readline's search order.
328dnl The required procedures are in libtermcap on NetBSD, in
329dnl [TODO] on Linux, and in [TODO] on Solaris.
330 AC_CHECK_LIB(termcap, tputs, ,
331 AC_CHECK_LIB(tinfo, tputs, ,
332 AC_CHECK_LIB(curses, tputs, ,
333 AC_CHECK_LIB(ncurses, tputs))))
paul7ea487b2003-03-17 02:05:07 +0000334 AC_CHECK_LIB(readline, main)
335 if test $ac_cv_lib_readline_main = no; then
gdtfc9d0742004-06-30 14:25:12 +0000336 AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
paul7ea487b2003-03-17 02:05:07 +0000337 fi
338 AC_CHECK_HEADER(readline/history.h)
339 if test $ac_cv_header_readline_history_h = no;then
340 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
341 fi
paul3d3de8c2003-05-23 10:33:49 +0000342 AC_CHECK_LIB(readline, rl_completion_matches)
343 if test $ac_cv_lib_readline_rl_completion_matches = no; then
344 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
345 fi
346 ;;
paul7ea487b2003-03-17 02:05:07 +0000347 "no" ) VTYSH="";;
348 * ) ;;
349esac
350
351dnl ----------
352dnl PAM module
353dnl ----------
354if test "$with_libpam" = "yes"; then
paul24cd4352003-05-06 12:16:27 +0000355 AC_CHECK_HEADER(security/pam_misc.h)
356 if test "$ac_cv_header_security_pam_misc_h" = yes; then
357 AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
358 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
359 pam_conv_func="misc_conv"
paul24cd4352003-05-06 12:16:27 +0000360 fi
paul24cd4352003-05-06 12:16:27 +0000361 AC_CHECK_HEADER(security/openpam.h)
362 if test "$ac_cv_header_security_openpam_h" = yes; then
363 AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
364 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
365 pam_conv_func="openpam_ttyconv"
paul24cd4352003-05-06 12:16:27 +0000366 fi
367 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
368 AC_MSG_WARN([*** pam support will not be built ***])
369 with_libpam="no"
370 fi
371fi
372
373if test "$with_libpam" = "yes"; then
paul7ea487b2003-03-17 02:05:07 +0000374dnl took this test from proftpd's configure.in and suited to our needs
375dnl -------------------------------------------------------------------------
376dnl
377dnl This next check looks funky due to a linker problem with some versions
378dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
379dnl omitted requiring libdl linking information. PAM-0.72 or better ships
380dnl with RedHat 6.2 and Debian 2.2 or better.
381AC_CHECK_LIB(pam, pam_start,
paul24cd4352003-05-06 12:16:27 +0000382 [AC_CHECK_LIB(pam, $pam_conv_func,
paul7ea487b2003-03-17 02:05:07 +0000383 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
384 LIBPAM="-lpam"],
385 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
386 LIBPAM="-lpam -lpam_misc"]
387 )
388 ],
389
390 [AC_CHECK_LIB(pam, pam_end,
paul24cd4352003-05-06 12:16:27 +0000391 [AC_CHECK_LIB(pam, $pam_conv_func,
paula159ed92003-06-04 11:01:45 +0000392 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul7ea487b2003-03-17 02:05:07 +0000393 LIBPAM="-lpam -ldl"],
paula159ed92003-06-04 11:01:45 +0000394 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
paul7ea487b2003-03-17 02:05:07 +0000395 LIBPAM="-lpam -ldl -lpam_misc"]
396 )
397 ],AC_MSG_WARN([*** pam support will not be built ***]),
398 [-ldl])
399 ]
400)
401fi
402AC_SUBST(LIBPAM)
403
404dnl -------------------------------
405dnl Endian-ness check
406dnl -------------------------------
407AC_WORDS_BIGENDIAN
408
409dnl -------------------------------
410dnl check the size in byte of the C
411dnl -------------------------------
412dnl AC_CHECK_SIZEOF(char)
413dnl AC_CHECK_SIZEOF(int)
414dnl AC_CHECK_SIZEOF(short)
415dnl AC_CHECK_SIZEOF(long)
416
417dnl ----------------------------
418dnl check existance of functions
419dnl ----------------------------
paul49e3b3c2003-10-23 20:39:50 +0000420AC_CHECK_FUNCS(memset memcpy strerror inet_aton daemon snprintf vsnprintf \
paul04bd4842003-10-24 04:24:39 +0000421 strlcat strlcpy if_nametoindex if_indextoname getifaddrs \
422 fcntl)
paula159ed92003-06-04 11:01:45 +0000423AC_CHECK_FUNCS(setproctitle, ,
424 [AC_CHECK_LIB(util, setproctitle,
425 [LIBS="$LIBS -lutil"
426 AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
427 ]
428 )
429 ]
430)
paul7ea487b2003-03-17 02:05:07 +0000431
432dnl ------------------------------------
433dnl Determine routing get and set method
434dnl ------------------------------------
435AC_MSG_CHECKING(zebra between kernel interface method)
436if test x"$opsys" = x"gnu-linux"; then
437 if test "${enable_netlink}" = "yes";then
438 AC_MSG_RESULT(netlink)
439 RT_METHOD=rt_netlink.o
440 AC_DEFINE(HAVE_NETLINK,,netlink)
441 netlink=yes
442 elif test "${enable_netlink}" = "no"; then
443 AC_MSG_RESULT(ioctl)
444 RT_METHOD=rt_ioctl.o
445 netlink=no
446 else
447 AC_MSG_RESULT(netlink)
448 RT_METHOD=rt_netlink.o
449 AC_DEFINE(HAVE_NETLINK,,netlink)
450 netlink=yes
451 fi
paul19877dd2004-05-11 10:49:35 +0000452elif test x"$opsys" = x"sol2-6";then
453 AC_MSG_RESULT(Route socket)
454 KERNEL_METHOD="kernel_socket.o"
455 RT_METHOD="rt_socket.o"
456elif test x"$opsys" = x"sol9";then
457 AC_MSG_RESULT(Route socket)
458 KERNEL_METHOD="kernel_socket.o"
459 RT_METHOD="rt_socket.o"
460elif test "$opsys" = "irix" ; then
461 AC_MSG_RESULT(Route socket)
462 KERNEL_METHOD="kernel_socket.o"
463 RT_METHOD="rt_socket.o"
paul7ea487b2003-03-17 02:05:07 +0000464else
paul19877dd2004-05-11 10:49:35 +0000465 AC_TRY_RUN([#include <errno.h>
paul7ea487b2003-03-17 02:05:07 +0000466#include <sys/types.h>
467#include <sys/socket.h>
468
469main ()
470{
471 int ac_sock;
472
473 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
474 if (ac_sock < 0 && errno == EINVAL)
475 exit (1);
476 exit (0);
477}],
478 [KERNEL_METHOD=kernel_socket.o
479 RT_METHOD=rt_socket.o
480 AC_MSG_RESULT(socket)],
481 [RT_METHOD=rt_ioctl.o
482 AC_MSG_RESULT(ioctl)],
483 [KERNEL_METHOD=kernel_socket.o
484 RT_METHOD=rt_socket.o
485 AC_MSG_RESULT(socket)])
paul7ea487b2003-03-17 02:05:07 +0000486fi
487AC_SUBST(RT_METHOD)
488AC_SUBST(KERNEL_METHOD)
489AC_SUBST(OTHER_METHOD)
490
491dnl ------------------------------
492dnl check kernel route read method
493dnl ------------------------------
494AC_CACHE_CHECK(route read method check, zebra_rtread,
495[if test "$netlink" = yes; then
496 RTREAD_METHOD="rtread_netlink.o"
497 zebra_rtread="netlink"
498else
499for zebra_rtread in /proc/net/route /dev/ip /dev/null;
500do
501 test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
502done
503case $zebra_rtread in
504 "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
505 zebra_rtread="proc";;
paul9c30ab62003-07-08 08:36:17 +0000506 "/dev/ip")
507 case "$host" in
508 *-freebsd*) RTREAD_METHOD=rtread_sysctl.o
509 zebra_rtread="sysctl";;
510 *) RTREAD_METHOD="rtread_getmsg.o"
511 zebra_rtread="getmsg";;
512 esac;;
paul7ea487b2003-03-17 02:05:07 +0000513 *) RTREAD_METHOD="rtread_sysctl.o"
514 zebra_rtread="sysctl";;
515esac
516fi])
517AC_SUBST(RTREAD_METHOD)
518
519dnl -----------------------------
520dnl check interface lookup method
521dnl -----------------------------
paul19877dd2004-05-11 10:49:35 +0000522IOCTL_METHOD=ioctl.o
paul7ea487b2003-03-17 02:05:07 +0000523AC_MSG_CHECKING(interface looking up method)
524if test "$netlink" = yes; then
525 AC_MSG_RESULT(netlink)
526 IF_METHOD=if_netlink.o
paul19877dd2004-05-11 10:49:35 +0000527elif test "$opsys" = "sol2-6";then
528 AC_MSG_RESULT(Solaris GIF)
529 IF_METHOD=if_ioctl.o
530elif test "$opsys" = "sol9";then
531 AC_MSG_RESULT(Solaris GLIF)
532 IF_METHOD=if_ioctl_solaris.o
533 IOCTL_METHOD=ioctl_solaris.o
534elif test "$opsys" = "irix" ; then
535 AC_MSG_RESULT(IRIX)
536 IF_METHOD=if_ioctl.o
537elif test "$opsys" = "openbsd";then
538 AC_MSG_RESULT(openbsd)
539 IF_METHOD=if_ioctl.o
540elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
541 AC_MSG_RESULT(sysctl)
paul7ea487b2003-03-17 02:05:07 +0000542 IF_METHOD=if_sysctl.o
543 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
paul19877dd2004-05-11 10:49:35 +0000544else
paul7ea487b2003-03-17 02:05:07 +0000545 AC_MSG_RESULT(ioctl)
546 IF_METHOD=if_ioctl.o
paul7ea487b2003-03-17 02:05:07 +0000547fi
548AC_SUBST(IF_METHOD)
paul19877dd2004-05-11 10:49:35 +0000549AC_SUBST(IOCTL_METHOD)
paul7ea487b2003-03-17 02:05:07 +0000550
551dnl -----------------------
552dnl check proc file system.
553dnl -----------------------
554if test -r /proc/net/dev; then
555 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
556 IF_PROC=if_proc.o
557fi
558
559if test -r /proc/net/if_inet6; then
560 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
561 IF_PROC=if_proc.o
562fi
563AC_SUBST(IF_PROC)
564
565dnl -----------------------------
566dnl check ipforward detect method
567dnl -----------------------------
568AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
569[for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
570do
571 test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
572done
573case $zebra_ipforward_path in
574 "/proc/net/snmp") IPFORWARD=ipforward_proc.o
575 zebra_ipforward_path="proc";;
576 "/dev/ip")
577 case "$host" in
578 *-nec-sysv4*) IPFORWARD=ipforward_ews.o
579 zebra_ipforward_path="ews";;
paul9c30ab62003-07-08 08:36:17 +0000580 *-freebsd*) IPFORWARD=ipforward_sysctl.o
581 zebra_ipforward_path="sysctl";;
paul7ea487b2003-03-17 02:05:07 +0000582 *) IPFORWARD=ipforward_solaris.o
583 zebra_ipforward_path="solaris";;
584 esac;;
585 *) IPFORWARD=ipforward_sysctl.o
586 zebra_ipforward_path="sysctl";;
587esac])
588AC_SUBST(IPFORWARD)
589
590AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
591
592dnl ----------
593dnl IPv6 check
594dnl ----------
595AC_MSG_CHECKING(whether does this OS have IPv6 stack)
596if test "${enable_ipv6}" = "no"; then
597 AC_MSG_RESULT(disabled)
598else
599dnl ----------
600dnl INRIA IPv6
601dnl ----------
paula159ed92003-06-04 11:01:45 +0000602 if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
603 zebra_cv_ipv6=yes
604 AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
605 AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
606 RIPNGD="ripngd"
607 OSPF6D="ospf6d"
608 LIB_IPV6=""
609 AC_MSG_RESULT(INRIA IPv6)
paul7ea487b2003-03-17 02:05:07 +0000610dnl ---------
611dnl KAME IPv6
612dnl ---------
paula159ed92003-06-04 11:01:45 +0000613 elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
614 zebra_cv_ipv6=yes
615 AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
616 AC_DEFINE(KAME,1,KAME IPv6)
617 RIPNGD="ripngd"
618 OSPF6D="ospf6d"
619 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
paul7ea487b2003-03-17 02:05:07 +0000620 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +0000621 fi
622 AC_MSG_RESULT(KAME)
hasso71c0fb52003-05-25 20:18:13 +0000623dnl -------------------------
624dnl MUSICA IPv6
625dnl default host check
626dnl It is not used by Kheops
627dnl -------------------------
paula159ed92003-06-04 11:01:45 +0000628 elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
629 zebra_cv_ipv6=yes
630 AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
631 AC_DEFINE(MUSICA,1,Musica IPv6 stack)
632 AC_DEFINE(KAME,1,KAME IPv6 stack)
633 RIPNGD="ripngd"
634 OSPF6D="ospf6d"
635 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
hasso71c0fb52003-05-25 20:18:13 +0000636 LIB_IPV6="-L/usr/local/v6/lib -linet6"
paula159ed92003-06-04 11:01:45 +0000637 fi
638 AC_MSG_RESULT(MUSICA)
paul7ea487b2003-03-17 02:05:07 +0000639dnl ---------
640dnl NRL check
641dnl ---------
paula159ed92003-06-04 11:01:45 +0000642 elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
643 zebra_cv_ipv6=yes
644 AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
645 AC_DEFINE(NRL,1,NRL)
646 RIPNGD="ripngd"
647 OSPF6D="ospf6d"
648 if test x"$opsys" = x"bsdi";then
paul7ea487b2003-03-17 02:05:07 +0000649 AC_DEFINE(BSDI_NRL,,BSDI)
650 AC_MSG_RESULT(BSDI_NRL)
paula159ed92003-06-04 11:01:45 +0000651 else
paul7ea487b2003-03-17 02:05:07 +0000652 AC_MSG_RESULT(NRL)
paula159ed92003-06-04 11:01:45 +0000653 fi
paul19877dd2004-05-11 10:49:35 +0000654dnl ------------------------------------
655dnl Solaris 9, 10 and potentially higher
656dnl ------------------------------------
657 elif test x"$opsys" = x"sol9"; then
658 zebra_cv_ipv6=yes;
659 AC_DEFINE(HAVE_IPV6, 1, IPv6)
660 AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
661 RIPNGD="ripngd"
662 OSPF6D="ospf6d"
663 AC_MSG_RESULT(Solaris IPv6)
paul7ea487b2003-03-17 02:05:07 +0000664dnl ----------
665dnl Linux IPv6
666dnl ----------
paula159ed92003-06-04 11:01:45 +0000667 elif test "${enable_ipv6}" = "yes"; then
668 AC_EGREP_CPP(yes, [
669 #include <linux/version.h>
670 /* 2.1.128 or later */
671 #if LINUX_VERSION_CODE >= 0x020180
672 yes
673 #endif],
674 [zebra_cv_ipv6=yes
675 zebra_cv_linux_ipv6=yes
676 AC_MSG_RESULT(Linux IPv6)])
677 else
678 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
679 then
paul7ea487b2003-03-17 02:05:07 +0000680 zebra_cv_ipv6=yes
681 zebra_cv_linux_ipv6=yes
682 AC_MSG_RESULT(Linux IPv6)
paula159ed92003-06-04 11:01:45 +0000683 fi
684 fi
paul7ea487b2003-03-17 02:05:07 +0000685
paula159ed92003-06-04 11:01:45 +0000686 if test "$zebra_cv_linux_ipv6" = "yes";then
687 AC_MSG_CHECKING(for GNU libc >= 2.1)
688 AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
689 AC_EGREP_CPP(yes, [
paul7ea487b2003-03-17 02:05:07 +0000690#include <features.h>
691#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
692 yes
paula159ed92003-06-04 11:01:45 +0000693#endif],
694 [glibc=yes
695 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
696 AC_MSG_RESULT(yes)],
697 AC_MSG_RESULT(no)
698 )
699 RIPNGD="ripngd"
700 OSPF6D="ospf6d"
701 if test "$glibc" != "yes"; then
paul7ea487b2003-03-17 02:05:07 +0000702 INCLUDES="-I/usr/inet6/include"
703 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
704 LIB_IPV6="-L/usr/inet6/lib -linet6"
705 fi
paula159ed92003-06-04 11:01:45 +0000706 fi
707 fi
paul7ea487b2003-03-17 02:05:07 +0000708
709dnl -----------------------
710dnl Set IPv6 related values
711dnl -----------------------
paula159ed92003-06-04 11:01:45 +0000712 LIBS="$LIB_IPV6 $LIBS"
713 AC_SUBST(LIB_IPV6)
paul7ea487b2003-03-17 02:05:07 +0000714
paula159ed92003-06-04 11:01:45 +0000715 if test x"$RIPNGD" = x""; then
716 AC_MSG_RESULT(IPv4 only)
717 fi
paul7ea487b2003-03-17 02:05:07 +0000718fi
719
gdtfa3232e2003-12-03 17:52:30 +0000720dnl ------------------
721dnl IPv6 header checks
722dnl ------------------
723if test "x${zebra_cv_ipv6}" = "xyes"; then
724AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
725 netinet6/in6_var.h netinet6/nd6.h])
726fi
727
paul7ea487b2003-03-17 02:05:07 +0000728dnl --------------------
729dnl Daemon disable check
730dnl --------------------
731if test "${enable_zebra}" = "no";then
732 ZEBRA=""
733else
734 ZEBRA="zebra"
735fi
736
737if test "${enable_bgpd}" = "no";then
738 BGPD=""
739else
740 BGPD="bgpd"
741fi
742
743if test "${enable_ripd}" = "no";then
744 RIPD=""
745else
746 RIPD="ripd"
747fi
748
749if test "${enable_ospfd}" = "no";then
750 OSPFD=""
751else
752 OSPFD="ospfd"
753fi
754
ajsd0199432004-12-22 14:03:52 +0000755if test "${enable_watchquagga}" = "no";then
756 WATCHQUAGGA=""
757else
758 WATCHQUAGGA="watchquagga"
759fi
760
paul1ef74ef2003-03-21 15:16:05 +0000761OSPFCLIENT=""
762if test "${enable_opaque_lsa}" = "yes"; then
763 if test "${enable_ospfapi}" != "no";then
paul9a569842003-03-28 01:45:13 +0000764 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
paul1ef74ef2003-03-21 15:16:05 +0000765
766 if test "${enable_ospfclient}" != "no";then
767 OSPFCLIENT="ospfclient"
768 fi
769 fi
770
paul7ea487b2003-03-17 02:05:07 +0000771fi
772
773case "${enable_ripngd}" in
774 "yes") RIPNGD="ripngd";;
775 "no" ) RIPNGD="";;
776 * ) ;;
777esac
778
779case "${enable_ospf6d}" in
780 "yes") OSPF6D="ospf6d";;
781 "no" ) OSPF6D="";;
782 * ) ;;
783esac
784
jardin9e867fe2003-12-23 08:56:18 +0000785case "${enable_isisd}" in
786 "yes") ISISD="isisd";;
787 "no" ) ISISD="";;
hassoae399ab2004-09-13 20:22:18 +0000788 * ) ;;
jardin9e867fe2003-12-23 08:56:18 +0000789esac
790
paul7ea487b2003-03-17 02:05:07 +0000791if test "${enable_bgp_announce}" = "no";then
792 AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
793fi
794
795AC_SUBST(ZEBRA)
796AC_SUBST(BGPD)
797AC_SUBST(RIPD)
798AC_SUBST(RIPNGD)
799AC_SUBST(OSPFD)
800AC_SUBST(OSPF6D)
ajsd0199432004-12-22 14:03:52 +0000801AC_SUBST(WATCHQUAGGA)
jardin9e867fe2003-12-23 08:56:18 +0000802AC_SUBST(ISISD)
paul7ea487b2003-03-17 02:05:07 +0000803AC_SUBST(VTYSH)
804AC_SUBST(INCLUDES)
805AC_SUBST(CURSES)
806AC_SUBST(OSPFCLIENT)
paul1ef74ef2003-03-21 15:16:05 +0000807AC_SUBST(OSPFAPI)
paul7ea487b2003-03-17 02:05:07 +0000808AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
809AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
810AC_CHECK_LIB(crypt, crypt)
811AC_CHECK_LIB(resolv, res_init)
812AC_CHECK_LIB(m, main)
813
814dnl ---------------------------------------------------
815dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
816dnl ---------------------------------------------------
paula159ed92003-06-04 11:01:45 +0000817AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
818AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
819AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
paul7ea487b2003-03-17 02:05:07 +0000820
821dnl ---------------------------
822dnl check system has GNU regexp
823dnl ---------------------------
824dnl AC_MSG_CHECKING(whether system has GNU regex)
825AC_CHECK_LIB(c, regexec,
826[AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
827 LIB_REGEX=""],
828[LIB_REGEX="regex.o"])
829AC_SUBST(LIB_REGEX)
830
831dnl ------------------
832dnl check SNMP library
833dnl ------------------
834if test "${enable_snmp}" = "yes";then
835dnl AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
paul7ea487b2003-03-17 02:05:07 +0000836 if test "${HAVE_SNMP}" = ""; then
paul1ef74ef2003-03-21 15:16:05 +0000837 old_libs="${LIBS}"
838 LIBS="-L/usr/lib"
paul7ea487b2003-03-17 02:05:07 +0000839 unset ac_cv_lib_snmp_asn_parse_int
paul1ef74ef2003-03-21 15:16:05 +0000840 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
841 if test "${NEED_CRYPTO}" = ""; then
842 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes ])
843 else
844 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes; NEED_CRYPTO=yes;LIBS="$LIBS -lcrypto" ],,"-lcrypto")
845 fi
846 LIBS="${old_libs}"
paul7ea487b2003-03-17 02:05:07 +0000847 fi
paul1ef74ef2003-03-21 15:16:05 +0000848 if test "${HAVE_SNMP}" = ""; then
849 old_libs="${LIBS}"
850 LIBS="-L/usr/lib"
851 unset ac_cv_lib_snmp_asn_parse_int
852 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes, )
853 if test "${HAVE_SNMP}" = ""; then
854 unset ac_cv_lib_snmp_asn_parse_int
855 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
856 if test "${NEED_CRYPTO}" = "yes"; then
857 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
858 fi
859 fi
860 LIBS="${old_libs}"
861 fi
paul7ea487b2003-03-17 02:05:07 +0000862
863 if test "${HAVE_SNMP}" = ""; then
paul1ef74ef2003-03-21 15:16:05 +0000864 old_libs="${LIBS}"
865 LIBS="-L/usr/local/lib"
866 unset ac_cv_lib_snmp_asn_parse_int
867 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
868 if test "${HAVE_SNMP}" = ""; then
869 unset ac_cv_lib_snmp_asn_parse_int
870 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
871 if test "${NEED_CRYPTO}" = "yes"; then
872 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
873 fi
874 fi
875 LIBS="${old_libs}"
paul7ea487b2003-03-17 02:05:07 +0000876 fi
paul1ef74ef2003-03-21 15:16:05 +0000877
paul7ea487b2003-03-17 02:05:07 +0000878 if test "${HAVE_SNMP}" = "yes"; then
879 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
880 do
881 test -f "${ac_snmp}" && break
882 done
paul1ef74ef2003-03-21 15:16:05 +0000883
paul7ea487b2003-03-17 02:05:07 +0000884 case ${ac_snmp} in
885 /usr/include/net-snmp/*)
886 AC_DEFINE(HAVE_SNMP,,SNMP)
paul1ef74ef2003-03-21 15:16:05 +0000887 AC_DEFINE(HAVE_NETSNMP,,SNMP)
paul7ea487b2003-03-17 02:05:07 +0000888 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
paulac7c4bb2003-03-19 04:25:08 +0000889 CFLAGS="${CFLAGS} -I/usr/include/net-snmp -I/usr/include/net-snmp/library"
890 if test "${HAVE_NETSNMP}" = "yes"; then
paul1ef74ef2003-03-21 15:16:05 +0000891 LIBS="${LIBS} -lnetsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000892 else
paul1ef74ef2003-03-21 15:16:05 +0000893 LIBS="${LIBS} -lsnmp"
paulac7c4bb2003-03-19 04:25:08 +0000894 fi
paul7ea487b2003-03-17 02:05:07 +0000895 ;;
896 /usr/include/ucd-snmp/*)
897 AC_DEFINE(HAVE_SNMP,,SNMP)
898 CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp"
899 LIBS="${LIBS} -lsnmp"
900 ;;
901 /usr/local/include/ucd-snmp/*)
902 AC_DEFINE(HAVE_SNMP,,SNMP)
903 CFLAGS="${CFLAGS} -I/usr/local/include/ucd-snmp"
904 LIBS="${LIBS} -L/usr/local/lib -lsnmp"
905 ;;
paulf3bd1a72003-11-02 07:29:11 +0000906 /usr/local/include/net-snmp/*)
907 AC_DEFINE(HAVE_SNMP,,SNMP)
908 AC_DEFINE(HAVE_NET_SNMP,,SNMP)
909 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
910 CFLAGS="${CFLAGS} -I/usr/local/include/net-snmp"
911 LIBS="${LIBS} -L/usr/local/lib -lnetsnmp"
912 ;;
paul7ea487b2003-03-17 02:05:07 +0000913 esac
914 if test "${NEED_CRYPTO}" = "yes"; then
915 LIBS="${LIBS} -lcrypto"
916 fi
917 fi
918fi
919
920dnl ----------------------------
921dnl check sa_len of sockaddr
922dnl ----------------------------
923AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
924AC_TRY_COMPILE([#include <sys/types.h>
925#include <sys/socket.h>
926],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
927[AC_MSG_RESULT(yes)
928 AC_DEFINE(HAVE_SA_LEN,,sa_len)],
929 AC_MSG_RESULT(no))
930
931dnl ----------------------------
932dnl check sin_len of sockaddr_in
933dnl ----------------------------
934AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
935AC_TRY_COMPILE([#include <sys/types.h>
936#include <netinet/in.h>
937],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
938[AC_MSG_RESULT(yes)
939 AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
940 AC_MSG_RESULT(no))
941
942dnl ----------------------------
943dnl check sun_len of sockaddr_un
944dnl ----------------------------
945AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
946AC_TRY_COMPILE([#include <sys/types.h>
947#include <sys/un.h>
948],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
949[AC_MSG_RESULT(yes)
950 AC_DEFINE(HAVE_SUN_LEN,,sun_len)],
951 AC_MSG_RESULT(no))
952
953dnl -----------------------------------
954dnl check sin6_scope_id of sockaddr_in6
955dnl -----------------------------------
956if test "$zebra_cv_ipv6" = yes; then
957 AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
958 AC_TRY_COMPILE([#include <sys/types.h>
959#include <netinet/in.h>
960],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
961[AC_MSG_RESULT(yes)
962 AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)],
963 AC_MSG_RESULT(no))
964fi
965
966dnl ----------------------------
967dnl check socklen_t exist or not
968dnl ----------------------------
969AC_MSG_CHECKING(whther socklen_t is defined)
970AC_TRY_COMPILE([#include <sys/types.h>
971#include <sys/socket.h>
972#include <netinet/in.h>
973],[socklen_t ac_x;],
974[AC_MSG_RESULT(yes)
975 AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)],
976 AC_MSG_RESULT(no))
977
978dnl ------------------------
979dnl check struct sockaddr_dl
980dnl ------------------------
981AC_MSG_CHECKING(whether struct sockaddr_dl exist)
982AC_EGREP_HEADER(sockaddr_dl,
983net/if_dl.h,
984[AC_MSG_RESULT(yes)
985 AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)],
986 AC_MSG_RESULT(no))
987
988dnl --------------------------
989dnl check structure ifaliasreq
990dnl --------------------------
991AC_MSG_CHECKING(whether struct ifaliasreq exist)
992AC_EGREP_HEADER(ifaliasreq,
993net/if.h,
994[AC_MSG_RESULT(yes)
995 AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)],
996 AC_MSG_RESULT(no))
997
998dnl ----------------------------
999dnl check structure in6_aliasreq
1000dnl ----------------------------
hasso71c0fb52003-05-25 20:18:13 +00001001AC_MSG_CHECKING(whether struct in6_aliasreq exist)
paul7ea487b2003-03-17 02:05:07 +00001002AC_EGREP_HEADER(in6_aliasreq,
1003netinet6/in6_var.h,
1004[AC_MSG_RESULT(yes)
1005 AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
1006 AC_MSG_RESULT(no))
1007
hasso71c0fb52003-05-25 20:18:13 +00001008dnl -----------------------------------
1009dnl check ifra_lifetime of in6_aliasreq
1010dnl -----------------------------------
1011AC_MSG_CHECKING(whether in6_aliasreq.ifra_lifetime exist)
1012AC_TRY_COMPILE([#include <sys/types.h>
1013#include <netinet6/in6_var.h>
1014],[static struct if6_aliasreq ac_i;int ac_j = sizeof (ac_i.ifra_lifetime);],
1015[AC_MSG_RESULT(yes)
paula159ed92003-06-04 11:01:45 +00001016 AC_DEFINE(HAVE_IFRA_LIFETIME,,Have in6_aliasreq.ifra_lifetime)],
hasso71c0fb52003-05-25 20:18:13 +00001017 AC_MSG_RESULT(no))
1018
paul7ea487b2003-03-17 02:05:07 +00001019dnl ---------------------------
1020dnl check structure rt_addrinfo
1021dnl ---------------------------
1022AC_MSG_CHECKING(whether struct rt_addrinfo exist)
1023AC_EGREP_HEADER(rt_addrinfo,
1024net/route.h,
1025[AC_MSG_RESULT(yes)
1026 AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)],
1027 AC_MSG_RESULT(no))
1028
1029dnl --------------------------
1030dnl check structure in_pktinfo
1031dnl --------------------------
1032AC_MSG_CHECKING(whether struct in_pktinfo exist)
1033AC_TRY_COMPILE([#include <netinet/in.h>
1034],[struct in_pktinfo ac_x;],
1035[AC_MSG_RESULT(yes)
1036 AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
1037 AC_MSG_RESULT(no))
1038
1039dnl --------------------------------------
1040dnl checking for getrusage struct and call
1041dnl --------------------------------------
1042AC_MSG_CHECKING(whether getrusage is available)
1043AC_TRY_COMPILE([#include <sys/resource.h>
1044],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
1045[AC_MSG_RESULT(yes)
1046 AC_DEFINE(HAVE_RUSAGE,,rusage)],
1047 AC_MSG_RESULT(no))
1048
pauledd7c242003-06-04 13:59:38 +00001049dnl -------------------
1050dnl capabilities checks
1051dnl -------------------
hasso41d3fc92004-04-06 11:59:00 +00001052if test "${enable_capabilities}" != "no"; then
1053 AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1054 AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1055 [AC_MSG_RESULT(yes)
1056 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1057 quagga_ac_keepcaps="yes"],
1058 AC_MSG_RESULT(no)
pauledd7c242003-06-04 13:59:38 +00001059 )
hasso41d3fc92004-04-06 11:59:00 +00001060 if test x"${quagga_ac_keepcaps}" = x"yes"; then
1061 AC_CHECK_HEADERS(sys/capability.h)
1062 fi
1063 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1064 AC_CHECK_LIB(cap, cap_init,
1065 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1066 LIBCAP="-lcap"
1067 ]
1068 )
1069 fi
pauledd7c242003-06-04 13:59:38 +00001070fi
1071AC_SUBST(LIBCAP)
1072
paulfb2d1502003-06-04 09:40:54 +00001073dnl ---------------------------
1074dnl check for glibc 'backtrace'
1075dnl ---------------------------
1076if test "${glibc}" = "yes"; then
1077 AC_CHECK_HEADER(execinfo.h)
1078fi
1079if test x"${ac_cv_header_execinfo_h}" = x"yes"; then
1080 AC_CHECK_FUNC(backtrace,
1081 [AC_DEFINE(HAVE_GLIBC_BACKTRACE,,Glibc backtrace)]
1082 )
1083fi
1084
paul408ad942003-05-20 00:03:33 +00001085dnl ----------
1086dnl configure date
1087dnl ----------
1088CONFDATE=`date '+%Y%m%d'`
1089AC_SUBST(CONFDATE)
1090
paul7ea487b2003-03-17 02:05:07 +00001091dnl ------------------------------
paula159ed92003-06-04 11:01:45 +00001092dnl set paths for state directory
paul23bd12c2003-04-07 06:11:09 +00001093dnl ------------------------------
1094if test "${prefix}" = "NONE"; then
paule8f29842003-08-12 13:08:31 +00001095 quagga_statedir_prefix="";
paul23bd12c2003-04-07 06:11:09 +00001096else
paule8f29842003-08-12 13:08:31 +00001097 quagga_statedir_prefix=${prefix}
paul23bd12c2003-04-07 06:11:09 +00001098fi
1099if test "${localstatedir}" = '${prefix}/var'; then
paula159ed92003-06-04 11:01:45 +00001100 AC_CACHE_CHECK(state directory,ac_statedir,
paule8f29842003-08-12 13:08:31 +00001101 [for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
1102 ${quagga_statedir_prefix}/var/adm dnl
1103 ${quagga_statedir_prefix}/etc dnl
paula159ed92003-06-04 11:01:45 +00001104 /var/run dnl
1105 /var/adm dnl
1106 /etc dnl
1107 /dev/null;
paul23bd12c2003-04-07 06:11:09 +00001108 do
paule8f29842003-08-12 13:08:31 +00001109 test -d $QUAGGA_STATE_DIR && break
paul23bd12c2003-04-07 06:11:09 +00001110 done
paule8f29842003-08-12 13:08:31 +00001111 quagga_statedir=$QUAGGA_STATE_DIR])
paul23bd12c2003-04-07 06:11:09 +00001112else
paule8f29842003-08-12 13:08:31 +00001113 quagga_statedir=${localstatedir}
paula159ed92003-06-04 11:01:45 +00001114 AC_MSG_CHECKING(directory to use for state file)
paule8f29842003-08-12 13:08:31 +00001115 AC_MSG_RESULT(${quagga_statedir})
paul23bd12c2003-04-07 06:11:09 +00001116fi
paule8f29842003-08-12 13:08:31 +00001117if test $quagga_statedir = "/dev/null"; then
paula159ed92003-06-04 11:01:45 +00001118 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1119fi
1120
paule8f29842003-08-12 13:08:31 +00001121AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1122AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1123AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1124AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1125AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1126AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
jardin9e867fe2003-12-23 08:56:18 +00001127AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
ajsd0199432004-12-22 14:03:52 +00001128AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
paule8f29842003-08-12 13:08:31 +00001129AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1130AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1131AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1132AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1133AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1134AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1135AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
jardin9e867fe2003-12-23 08:56:18 +00001136AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
ajs515210b2004-12-22 15:35:12 +00001137AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
paul7ea487b2003-03-17 02:05:07 +00001138
1139dnl ---------------------------
1140dnl Check htonl works correctly
1141dnl ---------------------------
1142AC_MSG_CHECKING(for working htonl)
1143AC_CACHE_VAL(ac_cv_htonl_works, [
1144AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
1145#include <sys/types.h>
1146#endif
1147#ifdef HAVE_NETDB_H
1148#include <netdb.h>
1149#endif
1150#ifdef HAVE_NETINET_IN_H
1151#include <netinet/in.h>
1152#endif],
1153[htonl (0);],
1154ac_cv_htonl_works=yes,
1155ac_cv_htonl_works=no)])
1156AC_MSG_RESULT($ac_cv_htonl_works)
1157
paul14c17fd2004-11-07 22:34:23 +00001158AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile
ajsd0199432004-12-22 14:03:52 +00001159 ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
jardin9e867fe2003-12-23 08:56:18 +00001160 ospf6d/Makefile isisd/Makefile vtysh/Makefile doc/Makefile
paul14c17fd2004-11-07 22:34:23 +00001161 ospfclient/Makefile tests/Makefile m4/Makefile redhat/Makefile
gdt69f1fc22004-08-27 15:57:35 +00001162 pkgsrc/Makefile
paul670bbf12004-11-12 09:05:00 +00001163 redhat/quagga.spec
gdtb7a97f82004-07-23 16:23:56 +00001164 lib/version.h
paul14c17fd2004-11-07 22:34:23 +00001165 doc/defines.texi
gdtcbd04082004-08-31 18:16:36 +00001166 pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
paulf31293a2004-11-12 09:27:04 +00001167 pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
paul670bbf12004-11-12 09:05:00 +00001168AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
hasso48577192004-11-19 06:41:49 +00001169## Hack, but working solution to avoid rebuilding of quagga.info.
1170## It's already in CVS until texinfo 4.7 is more common.
1171AC_CONFIG_COMMANDS([info-time],[touch doc/quagga.info])
paul14c17fd2004-11-07 22:34:23 +00001172AC_OUTPUT
paul7ea487b2003-03-17 02:05:07 +00001173
1174echo "
hassoc89f6492004-08-26 12:21:28 +00001175Quagga configuration
1176--------------------
1177quagga version : ${PACKAGE_VERSION}
paul7ea487b2003-03-17 02:05:07 +00001178host operationg system : ${host_os}
1179source code location : ${srcdir}
1180compiler : ${CC}
1181compiler flags : ${CFLAGS}
hasso71c0fb52003-05-25 20:18:13 +00001182linker flags : ${LDFLAGS} ${LIBS}
paule8f29842003-08-12 13:08:31 +00001183state file directory : ${quagga_statedir}
pauldc7a2bf2003-10-22 00:07:44 +00001184config file directory : `eval echo \`echo ${sysconfdir}\``
gdtd6b72f72003-12-03 17:24:27 +00001185example directory : `eval echo \`echo ${exampledir}\``
paul8d4aee52003-06-06 00:30:35 +00001186user to run as : ${enable_user}
1187group to run as : ${enable_group}
1188group for vty sockets : ${enable_vty_group}
gdtaa593d52003-12-22 20:15:53 +00001189config file mask : ${enable_configfile_mask}
1190log file mask : ${enable_logfile_mask}
pauldc7a2bf2003-10-22 00:07:44 +00001191
1192The above user and group must have read/write access to the state file
1193directory and to the config files in the config file directory.
paul7ea487b2003-03-17 02:05:07 +00001194"