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