configure.ac 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225
  1. ##
  2. ## Configure template file for Quagga.
  3. ## autoconf will generate configure script.
  4. ##
  5. ## Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
  6. ## Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st>
  7. ##
  8. ## $Id: configure.ac,v 1.82 2005/01/04 16:24:43 ajs Exp $
  9. AC_PREREQ(2.53)
  10. AC_INIT(Quagga, 0.97.4, [http://bugzilla.quagga.net])
  11. AC_CONFIG_SRCDIR(lib/zebra.h)
  12. AM_INIT_AUTOMAKE(1.6)
  13. AM_CONFIG_HEADER(config.h)
  14. dnl default is to match previous behavior
  15. exampledir=${sysconfdir}
  16. AC_ARG_ENABLE([exampledir],
  17. AC_HELP_STRING([--enable-exampledir],
  18. [specify alternate directory for examples]),
  19. exampledir="$enableval",)
  20. dnl XXX add --exampledir to autoconf standard directory list somehow
  21. AC_SUBST(exampledir)
  22. dnl default is to match previous behavior
  23. pkgsrcrcdir=""
  24. pkgsrcdir=""
  25. AC_ARG_ENABLE([pkgsrcrcdir],
  26. AC_HELP_STRING([--enable-pkgsrcrcdir],
  27. [specify directory for rc.d scripts]),
  28. pkgsrcrcdir="$enableval"; pkgsrcdir="pkgsrc",)
  29. dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
  30. AC_SUBST(pkgsrcdir)
  31. AC_SUBST(pkgsrcrcdir)
  32. dnl -----------------------------------
  33. dnl Get hostname and other information.
  34. dnl -----------------------------------
  35. AC_CANONICAL_HOST
  36. dnl ------------
  37. dnl Check CFLAGS
  38. dnl ------------
  39. AC_ARG_WITH(cflags,
  40. [ --with-cflags Set CFLAGS for use in compilation.])
  41. if test "x$with_cflags" != "x" ; then
  42. CFLAGS="$with_cflags" ; cflags_specified=yes ;
  43. elif test -n "$CFLAGS" ; then
  44. cflags_specified=yes ;
  45. fi
  46. dnl --------
  47. dnl Check CC
  48. dnl --------
  49. AC_PROG_CC
  50. dnl ---------------------------------------------
  51. dnl If CLFAGS doesn\'t exist set default value
  52. dnl AC_PROG_CC will have set minimal default
  53. dnl already, eg "-O2 -g" for gcc, "-g" for others
  54. dnl (Wall is gcc specific... have to make sure
  55. dnl gcc is being used before setting it)
  56. dnl ---------------------------------------------
  57. dnl
  58. if test "x$cflags_specified" = "x" ; then
  59. if test "x${GCC}" = "xyes"; then
  60. CFLAGS="-Os -g -Wall -Wsign-compare -Wpointer-arith"
  61. CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
  62. fi
  63. # TODO: conditionally addd -Wpacked if handled
  64. fi
  65. dnl --------------
  66. dnl Check programs
  67. dnl --------------
  68. AC_PROG_CPP
  69. AC_PROG_INSTALL
  70. AC_PROG_MAKE_SET
  71. AC_CHECK_TOOL(AR, ar)
  72. AC_CHECK_TOOL(RANLIB, ranlib, :)
  73. dnl ---------
  74. dnl AIX check
  75. dnl ---------
  76. AC_AIX
  77. dnl -------
  78. dnl libtool
  79. dnl -------
  80. AC_PROG_LIBTOOL
  81. dnl ----------------------
  82. dnl Packages configuration
  83. dnl ----------------------
  84. AC_ARG_ENABLE(vtysh,
  85. [ --enable-vtysh include integrated vty shell for Quagga])
  86. AC_ARG_ENABLE(ipv6,
  87. [ --disable-ipv6 turn off IPv6 related features and daemons])
  88. AC_ARG_ENABLE(zebra,
  89. [ --disable-zebra do not build zebra daemon])
  90. AC_ARG_ENABLE(bgpd,
  91. [ --disable-bgpd do not build bgpd])
  92. AC_ARG_ENABLE(ripd,
  93. [ --disable-ripd do not build ripd])
  94. AC_ARG_ENABLE(ripngd,
  95. [ --disable-ripngd do not build ripngd])
  96. AC_ARG_ENABLE(ospfd,
  97. [ --disable-ospfd do not build ospfd])
  98. AC_ARG_ENABLE(ospf6d,
  99. [ --disable-ospf6d do not build ospf6d])
  100. AC_ARG_ENABLE(watchquagga,
  101. [ --disable-watchquagga do not build watchquagga])
  102. AC_ARG_ENABLE(isisd,
  103. [ --enable-isisd build isisd])
  104. AC_ARG_ENABLE(bgp-announce,
  105. [ --disable-bgp-announce, turn off BGP route announcement])
  106. AC_ARG_ENABLE(netlink,
  107. [ --enable-netlink force to use Linux netlink interface])
  108. AC_ARG_ENABLE(broken-aliases,
  109. [ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
  110. AC_ARG_ENABLE(snmp,
  111. [ --enable-snmp enable SNMP support])
  112. AC_ARG_WITH(libpam,
  113. [ --with-libpam use libpam for PAM support in vtysh])
  114. AC_ARG_ENABLE(tcp-zebra,
  115. [ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon])
  116. AC_ARG_ENABLE(opaque-lsa,
  117. [ --enable-opaque-lsa enable OSPF Opaque-LSA with OSPFAPI support (RFC2370)])
  118. AC_ARG_ENABLE(ospfapi,
  119. [ --disable-ospfapi do not build OSPFAPI to access the OSPF LSA Database,
  120. (this is the default if --enable-opaque-lsa is not set)])
  121. AC_ARG_ENABLE(ospfclient,
  122. [ --disable-ospfclient do not build OSPFAPI client for OSPFAPI,
  123. (this is the default if --disable-ospfapi is set)])
  124. AC_ARG_ENABLE(ospf-te,
  125. [ --enable-ospf-te enable Traffic Engineering Extension to OSPF])
  126. AC_ARG_ENABLE(multipath,
  127. [ --enable-multipath=ARG enable multipath function, ARG must be digit])
  128. AC_ARG_ENABLE(quagga_user,
  129. [ --enable-user=ARG user to run Quagga suite as (default quagga)])
  130. AC_ARG_ENABLE(quagga_group,
  131. [ --enable-group=ARG group to run Quagga suite as (default quagga)])
  132. AC_ARG_ENABLE(vty_group,
  133. [ --enable-vty-group=ARG set vty sockets to have specified group as owner])
  134. AC_ARG_ENABLE(configfile_mask,
  135. [ --enable-configfile-mask=ARG set mask for config files])
  136. AC_ARG_ENABLE(logfile_mask,
  137. [ --enable-logfile-mask=ARG set mask for log files])
  138. AC_ARG_ENABLE(rtadv,
  139. [ --disable-rtadv disable IPV6 router advertisement feature])
  140. AC_ARG_ENABLE(irdp,
  141. [ --enable-irdp enable IRDP server support in zebra])
  142. AC_ARG_ENABLE(capabilities,
  143. [ --disable-capabilities disable using POSIX capabilities])
  144. AC_ARG_ENABLE(gcc_ultra_verbose,
  145. [ --enable-gcc-ultra-verbose enable ultra verbose GCC warnings])
  146. AC_ARG_ENABLE(gcc-rdynamic,
  147. [ --enable-gcc-rdynamic enable gcc linking with -rdynamic for better backtraces])
  148. if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
  149. CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
  150. CFLAGS="${CFLAGS} -Wmissing-declarations -Wmissing-noreturn"
  151. CFLAGS="${CFLAGS} -Wmissing-format-attribute -Wunreachable-code"
  152. CFLAGS="${CFLAGS} -Wpacked -Wpadded"
  153. fi
  154. if test x"${enable_gcc_rdynamic}" = x"yes" ; then
  155. LDFLAGS="${LDFLAGS} -rdynamic"
  156. fi
  157. if test "${enable_broken_aliases}" = "yes"; then
  158. if test "${enable_netlink}" = "yes"
  159. then
  160. echo "Sorry, you can't use netlink with broken aliases"
  161. exit 1
  162. fi
  163. AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
  164. enable_netlink=no
  165. fi
  166. if test "${enable_tcp_zebra}" = "yes"; then
  167. AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
  168. fi
  169. if test "${enable_opaque_lsa}" = "yes"; then
  170. AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
  171. fi
  172. if test "${enable_ospf_te}" = "yes"; then
  173. AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
  174. AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
  175. fi
  176. AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
  177. if test "${enable_rtadv}" != "no"; then
  178. AC_MSG_RESULT(yes)
  179. AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
  180. else
  181. AC_MSG_RESULT(no)
  182. fi
  183. if test "${enable_irdp}" = "yes"; then
  184. AC_DEFINE(HAVE_IRDP,, IRDP )
  185. fi
  186. if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
  187. enable_user="quagga"
  188. elif test "${enable_user}" = "no"; then
  189. enable_user="root"
  190. fi
  191. AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
  192. if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
  193. enable_group="quagga"
  194. elif test "${enable_group}" = "no"; then
  195. enable_group="root"
  196. fi
  197. AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
  198. if test x"${enable_vty_group}" = x"yes" ; then
  199. AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
  200. elif test x"${enable_vty_group}" != x""; then
  201. if test x"${enable_vty_group}" != x"no"; then
  202. AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
  203. fi
  204. fi
  205. enable_configfile_mask=${enable_configfile_mask:-0600}
  206. AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
  207. enable_logfile_mask=${enable_logfile_mask:-0600}
  208. AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
  209. changequote(, )dnl
  210. MULTIPATH_NUM=1
  211. case "${enable_multipath}" in
  212. [0-9]|[1-9][0-9])
  213. MULTIPATH_NUM="${enable_multipath}"
  214. ;;
  215. "")
  216. ;;
  217. *)
  218. echo "Please specify digit to --enable-multipath ARG."
  219. exit 1
  220. ;;
  221. esac
  222. changequote([, ])dnl
  223. AC_SUBST(MULTIPATH_NUM)
  224. dnl -------------------
  225. dnl Check header files.
  226. dnl -------------------
  227. AC_HEADER_STDC
  228. AC_CHECK_HEADERS([string.h stropts.h sys/conf.h sys/ksym.h sys/time.h \
  229. sys/times.h sys/select.h sys/sysctl.h sys/sockio.h \
  230. sys/types.h linux/version.h kvm.h netdb.h asm/types.h \
  231. libutil.h limits.h])
  232. AC_CHECK_HEADERS([sys/socket.h netinet/in_systm.h netinet/in.h \
  233. net/if_dl.h net/netopt.h inet/nd.h net/route.h \
  234. net/if.h net/if_var.h netinet/in_var.h])
  235. dnl V6 headers are checked below, after we check for v6
  236. dnl check some types
  237. AC_C_CONST
  238. dnl AC_TYPE_PID_T
  239. AC_TYPE_SIGNAL
  240. dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
  241. case "$host" in
  242. [*-sunos5.[6-8]*] | [*-solaris2.[6-8]*])
  243. opsys=sol2-6
  244. AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.8)
  245. AC_DEFINE(SUNOS_5, 1, SunOS 5)
  246. AC_CHECK_LIB(xnet, main)
  247. CURSES=-lcurses
  248. ;;
  249. [*-sunos5.[8-9]] | [*-sunos5.1[0-9]] \
  250. | [*-solaris2.[8-9]] | [*-solaris2.1[0-9]])
  251. opsys=sol9
  252. AC_DEFINE(SUNOS_59,,SunOS 5.9 up)
  253. AC_DEFINE(SUNOS_5, 1, SunOS 5)
  254. AC_CHECK_LIB(socket, main)
  255. AC_CHECK_LIB(nsl, main)
  256. CURSES=-lcurses
  257. ;;
  258. *-sunos5* | *-solaris2*)
  259. AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
  260. AC_CHECK_LIB(socket, main)
  261. AC_CHECK_LIB(nsl, main)
  262. CURSES=-lcurses
  263. ;;
  264. *-linux-*)
  265. opsys=gnu-linux
  266. AC_DEFINE(GNU_LINUX,,GNU Linux)
  267. ;;
  268. *-nec-sysv4*)
  269. AC_CHECK_LIB(nsl, gethostbyname)
  270. AC_CHECK_LIB(socket, socket)
  271. ;;
  272. *-freebsd3.2)
  273. AC_DEFINE(FREEBSD_32,,FreeBSD 3.2)
  274. ;;
  275. *-openbsd*)
  276. opsys=openbsd
  277. AC_DEFINE(OPEN_BSD,,OpenBSD)
  278. ;;
  279. *-bsdi*)
  280. opsys=bsdi
  281. OTHER_METHOD="mtu_kvm.o"
  282. AC_CHECK_LIB(kvm, main)
  283. ;;
  284. *-irix6.5)
  285. opsys=irix
  286. AC_DEFINE(IRIX_65,,IRIX 6.5)
  287. ;;
  288. esac
  289. dnl ---------------------
  290. dnl Integrated VTY option
  291. dnl ---------------------
  292. case "${enable_vtysh}" in
  293. "yes") VTYSH="vtysh";
  294. AC_DEFINE(VTYSH,,VTY shell)
  295. AC_PATH_PROG(PERL, perl)
  296. dnl Vtysh uses libreadline, which looks for termcap functions at
  297. dnl configure time. We follow readline's search order.
  298. dnl The required procedures are in libtermcap on NetBSD, in
  299. dnl [TODO] on Linux, and in [TODO] on Solaris.
  300. AC_CHECK_LIB(termcap, tputs, ,
  301. AC_CHECK_LIB(tinfo, tputs, ,
  302. AC_CHECK_LIB(curses, tputs, ,
  303. AC_CHECK_LIB(ncurses, tputs))))
  304. AC_CHECK_LIB(readline, main)
  305. if test $ac_cv_lib_readline_main = no; then
  306. AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
  307. fi
  308. AC_CHECK_HEADER(readline/history.h)
  309. if test $ac_cv_header_readline_history_h = no;then
  310. AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
  311. fi
  312. AC_CHECK_LIB(readline, rl_completion_matches)
  313. if test $ac_cv_lib_readline_rl_completion_matches = no; then
  314. AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
  315. fi
  316. ;;
  317. "no" ) VTYSH="";;
  318. * ) ;;
  319. esac
  320. dnl ----------
  321. dnl PAM module
  322. dnl ----------
  323. if test "$with_libpam" = "yes"; then
  324. AC_CHECK_HEADER(security/pam_misc.h)
  325. if test "$ac_cv_header_security_pam_misc_h" = yes; then
  326. AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
  327. AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
  328. pam_conv_func="misc_conv"
  329. fi
  330. AC_CHECK_HEADER(security/openpam.h)
  331. if test "$ac_cv_header_security_openpam_h" = yes; then
  332. AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
  333. AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
  334. pam_conv_func="openpam_ttyconv"
  335. fi
  336. if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
  337. AC_MSG_WARN([*** pam support will not be built ***])
  338. with_libpam="no"
  339. fi
  340. fi
  341. if test "$with_libpam" = "yes"; then
  342. dnl took this test from proftpd's configure.in and suited to our needs
  343. dnl -------------------------------------------------------------------------
  344. dnl
  345. dnl This next check looks funky due to a linker problem with some versions
  346. dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
  347. dnl omitted requiring libdl linking information. PAM-0.72 or better ships
  348. dnl with RedHat 6.2 and Debian 2.2 or better.
  349. AC_CHECK_LIB(pam, pam_start,
  350. [AC_CHECK_LIB(pam, $pam_conv_func,
  351. [AC_DEFINE(USE_PAM,,Use PAM for authentication)
  352. LIBPAM="-lpam"],
  353. [AC_DEFINE(USE_PAM,,Use PAM for authentication)
  354. LIBPAM="-lpam -lpam_misc"]
  355. )
  356. ],
  357. [AC_CHECK_LIB(pam, pam_end,
  358. [AC_CHECK_LIB(pam, $pam_conv_func,
  359. [AC_DEFINE(USE_PAM,,Use PAM for authentication)
  360. LIBPAM="-lpam -ldl"],
  361. [AC_DEFINE(USE_PAM,,Use PAM for authentication)
  362. LIBPAM="-lpam -ldl -lpam_misc"]
  363. )
  364. ],AC_MSG_WARN([*** pam support will not be built ***]),
  365. [-ldl])
  366. ]
  367. )
  368. fi
  369. AC_SUBST(LIBPAM)
  370. dnl -------------------------------
  371. dnl Endian-ness check
  372. dnl -------------------------------
  373. AC_WORDS_BIGENDIAN
  374. dnl -------------------------------
  375. dnl check the size in byte of the C
  376. dnl -------------------------------
  377. dnl AC_CHECK_SIZEOF(char)
  378. dnl AC_CHECK_SIZEOF(int)
  379. dnl AC_CHECK_SIZEOF(short)
  380. dnl AC_CHECK_SIZEOF(long)
  381. dnl ----------------------------
  382. dnl check existance of functions
  383. dnl ----------------------------
  384. AC_CHECK_FUNCS(memset memcpy strerror inet_aton daemon snprintf vsnprintf \
  385. strlcat strlcpy if_nametoindex if_indextoname getifaddrs \
  386. fcntl)
  387. AC_CHECK_FUNCS(setproctitle, ,
  388. [AC_CHECK_LIB(util, setproctitle,
  389. [LIBS="$LIBS -lutil"
  390. AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
  391. ]
  392. )
  393. ]
  394. )
  395. dnl ------------------------------------
  396. dnl Determine routing get and set method
  397. dnl ------------------------------------
  398. AC_MSG_CHECKING(zebra between kernel interface method)
  399. if test x"$opsys" = x"gnu-linux"; then
  400. if test "${enable_netlink}" = "yes";then
  401. AC_MSG_RESULT(netlink)
  402. RT_METHOD=rt_netlink.o
  403. AC_DEFINE(HAVE_NETLINK,,netlink)
  404. netlink=yes
  405. elif test "${enable_netlink}" = "no"; then
  406. AC_MSG_RESULT(ioctl)
  407. RT_METHOD=rt_ioctl.o
  408. netlink=no
  409. else
  410. AC_MSG_RESULT(netlink)
  411. RT_METHOD=rt_netlink.o
  412. AC_DEFINE(HAVE_NETLINK,,netlink)
  413. netlink=yes
  414. fi
  415. elif test x"$opsys" = x"sol2-6";then
  416. AC_MSG_RESULT(Route socket)
  417. KERNEL_METHOD="kernel_socket.o"
  418. RT_METHOD="rt_socket.o"
  419. elif test x"$opsys" = x"sol9";then
  420. AC_MSG_RESULT(Route socket)
  421. KERNEL_METHOD="kernel_socket.o"
  422. RT_METHOD="rt_socket.o"
  423. elif test "$opsys" = "irix" ; then
  424. AC_MSG_RESULT(Route socket)
  425. KERNEL_METHOD="kernel_socket.o"
  426. RT_METHOD="rt_socket.o"
  427. else
  428. AC_TRY_RUN([#include <errno.h>
  429. #include <sys/types.h>
  430. #include <sys/socket.h>
  431. main ()
  432. {
  433. int ac_sock;
  434. ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
  435. if (ac_sock < 0 && errno == EINVAL)
  436. exit (1);
  437. exit (0);
  438. }],
  439. [KERNEL_METHOD=kernel_socket.o
  440. RT_METHOD=rt_socket.o
  441. AC_MSG_RESULT(socket)],
  442. [RT_METHOD=rt_ioctl.o
  443. AC_MSG_RESULT(ioctl)],
  444. [KERNEL_METHOD=kernel_socket.o
  445. RT_METHOD=rt_socket.o
  446. AC_MSG_RESULT(socket)])
  447. fi
  448. AC_SUBST(RT_METHOD)
  449. AC_SUBST(KERNEL_METHOD)
  450. AC_SUBST(OTHER_METHOD)
  451. dnl ------------------------------------
  452. dnl check for broken CMSG_FIRSTHDR macro
  453. dnl ------------------------------------
  454. AC_TRY_RUN([
  455. #ifdef SUNOS_5
  456. #define _XPG4_2
  457. #define __EXTENSIONS__
  458. #endif
  459. #include <stdlib.h>
  460. #include <sys/types.h>
  461. #include <sys/socket.h>
  462. main()
  463. {
  464. struct msghdr msg;
  465. char buf[4];
  466. msg.msg_control = buf;
  467. msg.msg_controllen = 0;
  468. if (CMSG_FIRSTHDR(&msg) != NULL)
  469. exit(0);
  470. exit (1);
  471. }],[AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)])
  472. dnl ------------------------------
  473. dnl check kernel route read method
  474. dnl ------------------------------
  475. AC_CACHE_CHECK(route read method check, zebra_rtread,
  476. [if test "$netlink" = yes; then
  477. RTREAD_METHOD="rtread_netlink.o"
  478. zebra_rtread="netlink"
  479. else
  480. for zebra_rtread in /proc/net/route /dev/ip /dev/null;
  481. do
  482. test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
  483. done
  484. case $zebra_rtread in
  485. "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
  486. zebra_rtread="proc";;
  487. "/dev/ip")
  488. case "$host" in
  489. *-freebsd*) RTREAD_METHOD=rtread_sysctl.o
  490. zebra_rtread="sysctl";;
  491. *) RTREAD_METHOD="rtread_getmsg.o"
  492. zebra_rtread="getmsg";;
  493. esac;;
  494. *) RTREAD_METHOD="rtread_sysctl.o"
  495. zebra_rtread="sysctl";;
  496. esac
  497. fi])
  498. AC_SUBST(RTREAD_METHOD)
  499. dnl -----------------------------
  500. dnl check interface lookup method
  501. dnl -----------------------------
  502. IOCTL_METHOD=ioctl.o
  503. AC_MSG_CHECKING(interface looking up method)
  504. if test "$netlink" = yes; then
  505. AC_MSG_RESULT(netlink)
  506. IF_METHOD=if_netlink.o
  507. elif test "$opsys" = "sol2-6";then
  508. AC_MSG_RESULT(Solaris GIF)
  509. IF_METHOD=if_ioctl.o
  510. elif test "$opsys" = "sol9";then
  511. AC_MSG_RESULT(Solaris GLIF)
  512. IF_METHOD=if_ioctl_solaris.o
  513. IOCTL_METHOD=ioctl_solaris.o
  514. elif test "$opsys" = "irix" ; then
  515. AC_MSG_RESULT(IRIX)
  516. IF_METHOD=if_ioctl.o
  517. elif test "$opsys" = "openbsd";then
  518. AC_MSG_RESULT(openbsd)
  519. IF_METHOD=if_ioctl.o
  520. elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
  521. AC_MSG_RESULT(sysctl)
  522. IF_METHOD=if_sysctl.o
  523. AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
  524. else
  525. AC_MSG_RESULT(ioctl)
  526. IF_METHOD=if_ioctl.o
  527. fi
  528. AC_SUBST(IF_METHOD)
  529. AC_SUBST(IOCTL_METHOD)
  530. dnl -----------------------
  531. dnl check proc file system.
  532. dnl -----------------------
  533. if test -r /proc/net/dev; then
  534. AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
  535. IF_PROC=if_proc.o
  536. fi
  537. if test -r /proc/net/if_inet6; then
  538. AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
  539. IF_PROC=if_proc.o
  540. fi
  541. AC_SUBST(IF_PROC)
  542. dnl -----------------------------
  543. dnl check ipforward detect method
  544. dnl -----------------------------
  545. AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
  546. [for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
  547. do
  548. test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
  549. done
  550. case $zebra_ipforward_path in
  551. "/proc/net/snmp") IPFORWARD=ipforward_proc.o
  552. zebra_ipforward_path="proc";;
  553. "/dev/ip")
  554. case "$host" in
  555. *-nec-sysv4*) IPFORWARD=ipforward_ews.o
  556. zebra_ipforward_path="ews";;
  557. *-freebsd*) IPFORWARD=ipforward_sysctl.o
  558. zebra_ipforward_path="sysctl";;
  559. *) IPFORWARD=ipforward_solaris.o
  560. zebra_ipforward_path="solaris";;
  561. esac;;
  562. *) IPFORWARD=ipforward_sysctl.o
  563. zebra_ipforward_path="sysctl";;
  564. esac])
  565. AC_SUBST(IPFORWARD)
  566. AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
  567. dnl ----------
  568. dnl IPv6 check
  569. dnl ----------
  570. AC_MSG_CHECKING(whether does this OS have IPv6 stack)
  571. if test "${enable_ipv6}" = "no"; then
  572. AC_MSG_RESULT(disabled)
  573. else
  574. dnl ----------
  575. dnl INRIA IPv6
  576. dnl ----------
  577. if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
  578. zebra_cv_ipv6=yes
  579. AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
  580. AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
  581. RIPNGD="ripngd"
  582. OSPF6D="ospf6d"
  583. LIB_IPV6=""
  584. AC_MSG_RESULT(INRIA IPv6)
  585. dnl ---------
  586. dnl KAME IPv6
  587. dnl ---------
  588. elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
  589. zebra_cv_ipv6=yes
  590. AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
  591. AC_DEFINE(KAME,1,KAME IPv6)
  592. RIPNGD="ripngd"
  593. OSPF6D="ospf6d"
  594. if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
  595. LIB_IPV6="-L/usr/local/v6/lib -linet6"
  596. fi
  597. AC_MSG_RESULT(KAME)
  598. dnl -------------------------
  599. dnl MUSICA IPv6
  600. dnl default host check
  601. dnl It is not used by Kheops
  602. dnl -------------------------
  603. elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
  604. zebra_cv_ipv6=yes
  605. AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
  606. AC_DEFINE(MUSICA,1,Musica IPv6 stack)
  607. AC_DEFINE(KAME,1,KAME IPv6 stack)
  608. RIPNGD="ripngd"
  609. OSPF6D="ospf6d"
  610. if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
  611. LIB_IPV6="-L/usr/local/v6/lib -linet6"
  612. fi
  613. AC_MSG_RESULT(MUSICA)
  614. dnl ---------
  615. dnl NRL check
  616. dnl ---------
  617. elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
  618. zebra_cv_ipv6=yes
  619. AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
  620. AC_DEFINE(NRL,1,NRL)
  621. RIPNGD="ripngd"
  622. OSPF6D="ospf6d"
  623. if test x"$opsys" = x"bsdi";then
  624. AC_DEFINE(BSDI_NRL,,BSDI)
  625. AC_MSG_RESULT(BSDI_NRL)
  626. else
  627. AC_MSG_RESULT(NRL)
  628. fi
  629. dnl ------------------------------------
  630. dnl Solaris 9, 10 and potentially higher
  631. dnl ------------------------------------
  632. elif test x"$opsys" = x"sol9"; then
  633. zebra_cv_ipv6=yes;
  634. AC_DEFINE(HAVE_IPV6, 1, IPv6)
  635. AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
  636. RIPNGD="ripngd"
  637. OSPF6D="ospf6d"
  638. AC_MSG_RESULT(Solaris IPv6)
  639. dnl ----------
  640. dnl Linux IPv6
  641. dnl ----------
  642. elif test "${enable_ipv6}" = "yes"; then
  643. AC_EGREP_CPP(yes, [
  644. #include <linux/version.h>
  645. /* 2.1.128 or later */
  646. #if LINUX_VERSION_CODE >= 0x020180
  647. yes
  648. #endif],
  649. [zebra_cv_ipv6=yes
  650. zebra_cv_linux_ipv6=yes
  651. AC_MSG_RESULT(Linux IPv6)])
  652. else
  653. if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
  654. then
  655. zebra_cv_ipv6=yes
  656. zebra_cv_linux_ipv6=yes
  657. AC_MSG_RESULT(Linux IPv6)
  658. fi
  659. fi
  660. if test "$zebra_cv_linux_ipv6" = "yes";then
  661. AC_MSG_CHECKING(for GNU libc >= 2.1)
  662. AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
  663. AC_EGREP_CPP(yes, [
  664. #include <features.h>
  665. #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
  666. yes
  667. #endif],
  668. [glibc=yes
  669. AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
  670. AC_MSG_RESULT(yes)],
  671. AC_MSG_RESULT(no)
  672. )
  673. RIPNGD="ripngd"
  674. OSPF6D="ospf6d"
  675. if test "$glibc" != "yes"; then
  676. INCLUDES="-I/usr/inet6/include"
  677. if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
  678. LIB_IPV6="-L/usr/inet6/lib -linet6"
  679. fi
  680. fi
  681. fi
  682. dnl -----------------------
  683. dnl Set IPv6 related values
  684. dnl -----------------------
  685. LIBS="$LIB_IPV6 $LIBS"
  686. AC_SUBST(LIB_IPV6)
  687. if test x"$RIPNGD" = x""; then
  688. AC_MSG_RESULT(IPv4 only)
  689. fi
  690. fi
  691. dnl ------------------
  692. dnl IPv6 header checks
  693. dnl ------------------
  694. if test "x${zebra_cv_ipv6}" = "xyes"; then
  695. AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
  696. netinet6/in6_var.h netinet6/nd6.h])
  697. fi
  698. dnl --------------------
  699. dnl Daemon disable check
  700. dnl --------------------
  701. if test "${enable_zebra}" = "no";then
  702. ZEBRA=""
  703. else
  704. ZEBRA="zebra"
  705. fi
  706. if test "${enable_bgpd}" = "no";then
  707. BGPD=""
  708. else
  709. BGPD="bgpd"
  710. fi
  711. if test "${enable_ripd}" = "no";then
  712. RIPD=""
  713. else
  714. RIPD="ripd"
  715. fi
  716. if test "${enable_ospfd}" = "no";then
  717. OSPFD=""
  718. else
  719. OSPFD="ospfd"
  720. fi
  721. if test "${enable_watchquagga}" = "no";then
  722. WATCHQUAGGA=""
  723. else
  724. WATCHQUAGGA="watchquagga"
  725. fi
  726. OSPFCLIENT=""
  727. if test "${enable_opaque_lsa}" = "yes"; then
  728. if test "${enable_ospfapi}" != "no";then
  729. AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
  730. if test "${enable_ospfclient}" != "no";then
  731. OSPFCLIENT="ospfclient"
  732. fi
  733. fi
  734. fi
  735. case "${enable_ripngd}" in
  736. "yes") RIPNGD="ripngd";;
  737. "no" ) RIPNGD="";;
  738. * ) ;;
  739. esac
  740. case "${enable_ospf6d}" in
  741. "yes") OSPF6D="ospf6d";;
  742. "no" ) OSPF6D="";;
  743. * ) ;;
  744. esac
  745. case "${enable_isisd}" in
  746. "yes") ISISD="isisd";;
  747. "no" ) ISISD="";;
  748. * ) ;;
  749. esac
  750. if test "${enable_bgp_announce}" = "no";then
  751. AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
  752. fi
  753. AC_SUBST(ZEBRA)
  754. AC_SUBST(BGPD)
  755. AC_SUBST(RIPD)
  756. AC_SUBST(RIPNGD)
  757. AC_SUBST(OSPFD)
  758. AC_SUBST(OSPF6D)
  759. AC_SUBST(WATCHQUAGGA)
  760. AC_SUBST(ISISD)
  761. AC_SUBST(VTYSH)
  762. AC_SUBST(INCLUDES)
  763. AC_SUBST(CURSES)
  764. AC_SUBST(OSPFCLIENT)
  765. AC_SUBST(OSPFAPI)
  766. AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
  767. AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
  768. AC_CHECK_LIB(crypt, crypt)
  769. AC_CHECK_LIB(resolv, res_init)
  770. AC_CHECK_LIB(m, main)
  771. dnl ---------------------------------------------------
  772. dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
  773. dnl ---------------------------------------------------
  774. AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
  775. AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
  776. AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
  777. dnl ---------------------------
  778. dnl check system has GNU regexp
  779. dnl ---------------------------
  780. dnl AC_MSG_CHECKING(whether system has GNU regex)
  781. AC_CHECK_LIB(c, regexec,
  782. [AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
  783. LIB_REGEX=""],
  784. [LIB_REGEX="regex.o"])
  785. AC_SUBST(LIB_REGEX)
  786. dnl ------------------
  787. dnl check SNMP library
  788. dnl ------------------
  789. if test "${enable_snmp}" = "yes";then
  790. dnl AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
  791. if test "${HAVE_SNMP}" = ""; then
  792. old_libs="${LIBS}"
  793. LIBS="-L/usr/lib"
  794. unset ac_cv_lib_snmp_asn_parse_int
  795. AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
  796. if test "${NEED_CRYPTO}" = ""; then
  797. AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes ])
  798. else
  799. AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes; NEED_CRYPTO=yes;LIBS="$LIBS -lcrypto" ],,"-lcrypto")
  800. fi
  801. LIBS="${old_libs}"
  802. fi
  803. if test "${HAVE_SNMP}" = ""; then
  804. old_libs="${LIBS}"
  805. LIBS="-L/usr/lib"
  806. unset ac_cv_lib_snmp_asn_parse_int
  807. AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes, )
  808. if test "${HAVE_SNMP}" = ""; then
  809. unset ac_cv_lib_snmp_asn_parse_int
  810. AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
  811. if test "${NEED_CRYPTO}" = "yes"; then
  812. AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
  813. fi
  814. fi
  815. LIBS="${old_libs}"
  816. fi
  817. if test "${HAVE_SNMP}" = ""; then
  818. old_libs="${LIBS}"
  819. LIBS="-L/usr/local/lib"
  820. unset ac_cv_lib_snmp_asn_parse_int
  821. AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
  822. if test "${HAVE_SNMP}" = ""; then
  823. unset ac_cv_lib_snmp_asn_parse_int
  824. AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
  825. if test "${NEED_CRYPTO}" = "yes"; then
  826. AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
  827. fi
  828. fi
  829. LIBS="${old_libs}"
  830. fi
  831. if test "${HAVE_SNMP}" = "yes"; then
  832. 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
  833. do
  834. test -f "${ac_snmp}" && break
  835. done
  836. case ${ac_snmp} in
  837. /usr/include/net-snmp/*)
  838. AC_DEFINE(HAVE_SNMP,,SNMP)
  839. AC_DEFINE(HAVE_NETSNMP,,SNMP)
  840. AC_DEFINE(UCD_COMPATIBLE,,SNMP)
  841. CFLAGS="${CFLAGS} -I/usr/include/net-snmp -I/usr/include/net-snmp/library"
  842. if test "${HAVE_NETSNMP}" = "yes"; then
  843. LIBS="${LIBS} -lnetsnmp"
  844. else
  845. LIBS="${LIBS} -lsnmp"
  846. fi
  847. ;;
  848. /usr/include/ucd-snmp/*)
  849. AC_DEFINE(HAVE_SNMP,,SNMP)
  850. CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp"
  851. LIBS="${LIBS} -lsnmp"
  852. ;;
  853. /usr/local/include/ucd-snmp/*)
  854. AC_DEFINE(HAVE_SNMP,,SNMP)
  855. CFLAGS="${CFLAGS} -I/usr/local/include/ucd-snmp"
  856. LIBS="${LIBS} -L/usr/local/lib -lsnmp"
  857. ;;
  858. /usr/local/include/net-snmp/*)
  859. AC_DEFINE(HAVE_SNMP,,SNMP)
  860. AC_DEFINE(HAVE_NET_SNMP,,SNMP)
  861. AC_DEFINE(UCD_COMPATIBLE,,SNMP)
  862. CFLAGS="${CFLAGS} -I/usr/local/include/net-snmp"
  863. LIBS="${LIBS} -L/usr/local/lib -lnetsnmp"
  864. ;;
  865. esac
  866. if test "${NEED_CRYPTO}" = "yes"; then
  867. LIBS="${LIBS} -lcrypto"
  868. fi
  869. fi
  870. fi
  871. dnl ----------------------------
  872. dnl check sa_len of sockaddr
  873. dnl ----------------------------
  874. AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
  875. AC_TRY_COMPILE([#include <sys/types.h>
  876. #include <sys/socket.h>
  877. ],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
  878. [AC_MSG_RESULT(yes)
  879. AC_DEFINE(HAVE_SA_LEN,,sa_len)],
  880. AC_MSG_RESULT(no))
  881. dnl ----------------------------
  882. dnl check sin_len of sockaddr_in
  883. dnl ----------------------------
  884. AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
  885. AC_TRY_COMPILE([#include <sys/types.h>
  886. #include <netinet/in.h>
  887. ],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
  888. [AC_MSG_RESULT(yes)
  889. AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
  890. AC_MSG_RESULT(no))
  891. dnl ----------------------------
  892. dnl check sun_len of sockaddr_un
  893. dnl ----------------------------
  894. AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
  895. AC_TRY_COMPILE([#include <sys/types.h>
  896. #include <sys/un.h>
  897. ],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
  898. [AC_MSG_RESULT(yes)
  899. AC_DEFINE(HAVE_SUN_LEN,,sun_len)],
  900. AC_MSG_RESULT(no))
  901. dnl -----------------------------------
  902. dnl check sin6_scope_id of sockaddr_in6
  903. dnl -----------------------------------
  904. if test "$zebra_cv_ipv6" = yes; then
  905. AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
  906. AC_TRY_COMPILE([#include <sys/types.h>
  907. #include <netinet/in.h>
  908. ],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
  909. [AC_MSG_RESULT(yes)
  910. AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)],
  911. AC_MSG_RESULT(no))
  912. fi
  913. dnl ----------------------------
  914. dnl check socklen_t exist or not
  915. dnl ----------------------------
  916. AC_MSG_CHECKING(whther socklen_t is defined)
  917. AC_TRY_COMPILE([#include <sys/types.h>
  918. #include <sys/socket.h>
  919. #include <netinet/in.h>
  920. ],[socklen_t ac_x;],
  921. [AC_MSG_RESULT(yes)
  922. AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)],
  923. AC_MSG_RESULT(no))
  924. dnl ------------------------
  925. dnl check struct sockaddr_dl
  926. dnl ------------------------
  927. AC_MSG_CHECKING(whether struct sockaddr_dl exist)
  928. AC_EGREP_HEADER(sockaddr_dl,
  929. net/if_dl.h,
  930. [AC_MSG_RESULT(yes)
  931. AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)],
  932. AC_MSG_RESULT(no))
  933. dnl --------------------------
  934. dnl check structure ifaliasreq
  935. dnl --------------------------
  936. AC_MSG_CHECKING(whether struct ifaliasreq exist)
  937. AC_EGREP_HEADER(ifaliasreq,
  938. net/if.h,
  939. [AC_MSG_RESULT(yes)
  940. AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)],
  941. AC_MSG_RESULT(no))
  942. dnl ----------------------------
  943. dnl check structure in6_aliasreq
  944. dnl ----------------------------
  945. AC_MSG_CHECKING(whether struct in6_aliasreq exist)
  946. AC_EGREP_HEADER(in6_aliasreq,
  947. netinet6/in6_var.h,
  948. [AC_MSG_RESULT(yes)
  949. AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
  950. AC_MSG_RESULT(no))
  951. dnl -----------------------------------
  952. dnl check ifra_lifetime of in6_aliasreq
  953. dnl -----------------------------------
  954. AC_MSG_CHECKING(whether in6_aliasreq.ifra_lifetime exist)
  955. AC_TRY_COMPILE([#include <sys/types.h>
  956. #include <netinet6/in6_var.h>
  957. ],[static struct if6_aliasreq ac_i;int ac_j = sizeof (ac_i.ifra_lifetime);],
  958. [AC_MSG_RESULT(yes)
  959. AC_DEFINE(HAVE_IFRA_LIFETIME,,Have in6_aliasreq.ifra_lifetime)],
  960. AC_MSG_RESULT(no))
  961. dnl ---------------------------
  962. dnl check structure rt_addrinfo
  963. dnl ---------------------------
  964. AC_MSG_CHECKING(whether struct rt_addrinfo exist)
  965. AC_EGREP_HEADER(rt_addrinfo,
  966. net/route.h,
  967. [AC_MSG_RESULT(yes)
  968. AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)],
  969. AC_MSG_RESULT(no))
  970. dnl --------------------------
  971. dnl check structure in_pktinfo
  972. dnl --------------------------
  973. AC_MSG_CHECKING(whether struct in_pktinfo exist)
  974. AC_TRY_COMPILE([#include <netinet/in.h>
  975. ],[struct in_pktinfo ac_x;],
  976. [AC_MSG_RESULT(yes)
  977. AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
  978. AC_MSG_RESULT(no))
  979. dnl --------------------------------------
  980. dnl checking for getrusage struct and call
  981. dnl --------------------------------------
  982. AC_MSG_CHECKING(whether getrusage is available)
  983. AC_TRY_COMPILE([#include <sys/resource.h>
  984. ],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
  985. [AC_MSG_RESULT(yes)
  986. AC_DEFINE(HAVE_RUSAGE,,rusage)],
  987. AC_MSG_RESULT(no))
  988. dnl -------------------
  989. dnl capabilities checks
  990. dnl -------------------
  991. if test "${enable_capabilities}" != "no"; then
  992. AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
  993. AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
  994. [AC_MSG_RESULT(yes)
  995. AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
  996. quagga_ac_keepcaps="yes"],
  997. AC_MSG_RESULT(no)
  998. )
  999. if test x"${quagga_ac_keepcaps}" = x"yes"; then
  1000. AC_CHECK_HEADERS(sys/capability.h)
  1001. fi
  1002. if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
  1003. AC_CHECK_LIB(cap, cap_init,
  1004. [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
  1005. LIBCAP="-lcap"
  1006. ]
  1007. )
  1008. fi
  1009. fi
  1010. AC_SUBST(LIBCAP)
  1011. dnl ---------------------------
  1012. dnl check for glibc 'backtrace'
  1013. dnl ---------------------------
  1014. if test "${glibc}" = "yes"; then
  1015. AC_CHECK_HEADER(execinfo.h)
  1016. fi
  1017. if test x"${ac_cv_header_execinfo_h}" = x"yes"; then
  1018. AC_CHECK_FUNC(backtrace,
  1019. [AC_DEFINE(HAVE_GLIBC_BACKTRACE,,Glibc backtrace)]
  1020. )
  1021. fi
  1022. dnl ----------
  1023. dnl configure date
  1024. dnl ----------
  1025. CONFDATE=`date '+%Y%m%d'`
  1026. AC_SUBST(CONFDATE)
  1027. dnl ------------------------------
  1028. dnl set paths for state directory
  1029. dnl ------------------------------
  1030. if test "${prefix}" = "NONE"; then
  1031. quagga_statedir_prefix="";
  1032. else
  1033. quagga_statedir_prefix=${prefix}
  1034. fi
  1035. if test "${localstatedir}" = '${prefix}/var'; then
  1036. AC_CACHE_CHECK(state directory,ac_statedir,
  1037. [for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
  1038. ${quagga_statedir_prefix}/var/adm dnl
  1039. ${quagga_statedir_prefix}/etc dnl
  1040. /var/run dnl
  1041. /var/adm dnl
  1042. /etc dnl
  1043. /dev/null;
  1044. do
  1045. test -d $QUAGGA_STATE_DIR && break
  1046. done
  1047. quagga_statedir=$QUAGGA_STATE_DIR])
  1048. else
  1049. quagga_statedir=${localstatedir}
  1050. AC_MSG_CHECKING(directory to use for state file)
  1051. AC_MSG_RESULT(${quagga_statedir})
  1052. fi
  1053. if test $quagga_statedir = "/dev/null"; then
  1054. AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
  1055. fi
  1056. AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
  1057. AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
  1058. AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
  1059. AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
  1060. AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
  1061. AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
  1062. AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
  1063. AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
  1064. AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
  1065. AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
  1066. AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
  1067. AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
  1068. AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
  1069. AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
  1070. AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
  1071. AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
  1072. AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
  1073. dnl ---------------------------
  1074. dnl Check htonl works correctly
  1075. dnl ---------------------------
  1076. AC_MSG_CHECKING(for working htonl)
  1077. AC_CACHE_VAL(ac_cv_htonl_works, [
  1078. AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
  1079. #include <sys/types.h>
  1080. #endif
  1081. #ifdef HAVE_NETDB_H
  1082. #include <netdb.h>
  1083. #endif
  1084. #ifdef HAVE_NETINET_IN_H
  1085. #include <netinet/in.h>
  1086. #endif],
  1087. [htonl (0);],
  1088. ac_cv_htonl_works=yes,
  1089. ac_cv_htonl_works=no)])
  1090. AC_MSG_RESULT($ac_cv_htonl_works)
  1091. AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile
  1092. ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
  1093. ospf6d/Makefile isisd/Makefile vtysh/Makefile doc/Makefile
  1094. ospfclient/Makefile tests/Makefile m4/Makefile redhat/Makefile
  1095. pkgsrc/Makefile
  1096. redhat/quagga.spec
  1097. lib/version.h
  1098. doc/defines.texi
  1099. pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
  1100. pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
  1101. AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
  1102. ## Hack, but working solution to avoid rebuilding of quagga.info.
  1103. ## It's already in CVS until texinfo 4.7 is more common.
  1104. AC_CONFIG_COMMANDS([info-time],[touch doc/quagga.info])
  1105. AC_OUTPUT
  1106. echo "
  1107. Quagga configuration
  1108. --------------------
  1109. quagga version : ${PACKAGE_VERSION}
  1110. host operationg system : ${host_os}
  1111. source code location : ${srcdir}
  1112. compiler : ${CC}
  1113. compiler flags : ${CFLAGS}
  1114. linker flags : ${LDFLAGS} ${LIBS}
  1115. state file directory : ${quagga_statedir}
  1116. config file directory : `eval echo \`echo ${sysconfdir}\``
  1117. example directory : `eval echo \`echo ${exampledir}\``
  1118. user to run as : ${enable_user}
  1119. group to run as : ${enable_group}
  1120. group for vty sockets : ${enable_vty_group}
  1121. config file mask : ${enable_configfile_mask}
  1122. log file mask : ${enable_logfile_mask}
  1123. The above user and group must have read/write access to the state file
  1124. directory and to the config files in the config file directory.
  1125. "