configure.ac 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444
  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$
  9. AC_PREREQ(2.53)
  10. AC_INIT(Quagga, 0.99.8, [http://bugzilla.quagga.net])
  11. AC_CONFIG_SRCDIR(lib/zebra.h)
  12. dnl -----------------------------------
  13. dnl Get hostname and other information.
  14. dnl -----------------------------------
  15. AC_CANONICAL_BUILD()
  16. AC_CANONICAL_HOST()
  17. AC_CANONICAL_TARGET()
  18. AM_INIT_AUTOMAKE(1.6)
  19. AM_CONFIG_HEADER(config.h)
  20. dnl GNU awk is required for lib/memtype.h made by memtypes.awk.
  21. dnl BSD awk complains: awk: gensub doesn't support backreferences (subst "\1")
  22. AC_CHECK_PROG([GAWK],[gawk],[gawk],[/bin/false])
  23. AC_ARG_VAR([GAWK],[GNU AWK])
  24. dnl default is to match previous behavior
  25. exampledir=${sysconfdir}
  26. AC_ARG_ENABLE([exampledir],
  27. AC_HELP_STRING([--enable-exampledir],
  28. [specify alternate directory for examples]),
  29. exampledir="$enableval",)
  30. dnl XXX add --exampledir to autoconf standard directory list somehow
  31. AC_SUBST(exampledir)
  32. dnl default is to match previous behavior
  33. pkgsrcrcdir=""
  34. pkgsrcdir=""
  35. AC_ARG_ENABLE([pkgsrcrcdir],
  36. AC_HELP_STRING([--enable-pkgsrcrcdir],
  37. [specify directory for rc.d scripts]),
  38. pkgsrcrcdir="$enableval"; pkgsrcdir="pkgsrc",)
  39. dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
  40. AC_SUBST(pkgsrcdir)
  41. AC_SUBST(pkgsrcrcdir)
  42. dnl ------------
  43. dnl Check CFLAGS
  44. dnl ------------
  45. AC_ARG_WITH(cflags,
  46. [ --with-cflags Set CFLAGS for use in compilation.])
  47. if test "x$with_cflags" != "x" ; then
  48. CFLAGS="$with_cflags" ; cflags_specified=yes ;
  49. elif test -n "$CFLAGS" ; then
  50. cflags_specified=yes ;
  51. fi
  52. dnl --------------------
  53. dnl Check CC and friends
  54. dnl --------------------
  55. AC_PROG_CC
  56. AC_PROG_CPP
  57. AC_PROG_EGREP
  58. dnl autoconf 2.59 appears not to support AC_PROG_SED
  59. dnl AC_PROG_SED
  60. AC_CHECK_PROG([SED],[sed],[sed],[/bin/false])
  61. dnl ------------------------------------------------------------------
  62. dnl Intel compiler check. Although Intel tries really hard to make icc
  63. dnl look like gcc, there are some differences. It's very verbose with
  64. dnl -Wall and it doesn't support the individual -W options.
  65. dnl ------------------------------------------------------------------
  66. if test "x${GCC}" = "xyes" ; then
  67. COMPILER="GCC"
  68. AC_MSG_CHECKING([whether we are using the Intel compiler])
  69. AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
  70. [AC_MSG_RESULT([no])],
  71. [COMPILER="ICC"
  72. AC_MSG_RESULT([yes])]
  73. )
  74. else
  75. AC_MSG_CHECKING([whether we are using SunPro compiler])
  76. AC_EGREP_CPP([^__SUNPRO_C.*0x5(7|8|9)], ["__SUNPRO_C" __SUNPRO_C],
  77. [AC_MSG_RESULT([no])],
  78. [COMPILER="SUNPRO"
  79. AC_MSG_RESULT([yes])]
  80. )
  81. fi
  82. dnl ---------------------------------------------
  83. dnl If CLFAGS doesn\'t exist set default value
  84. dnl AC_PROG_CC will have set minimal default
  85. dnl already, eg "-O2 -g" for gcc, "-g" for others
  86. dnl (Wall is gcc specific... have to make sure
  87. dnl gcc is being used before setting it)
  88. dnl
  89. dnl Intel icc 8.0 also sets __GNUC__,
  90. dnl but doesn't support all these fancy -W options.
  91. dnl Intel compiler warnings we ignore:
  92. dnl 279: controlling expression is constant.
  93. dnl 869: parameter "xxx" was never referenced - to avoid massive warnings
  94. dnl about "self", "vty", "argc" and "argv" never referenced in DEFUN
  95. dnl macro.
  96. dnl 981: operands are evaluated in unspecified order.
  97. dnl
  98. dnl Sun Studio 10 / SunPro 5.7 is also supported,
  99. dnl so lets set some sane CFLAGS for it.
  100. dnl ---------------------------------------------
  101. AC_MSG_CHECKING([whether to set a default CFLAGS])
  102. if test "x${cflags_specified}" = "x" ; then
  103. case ${COMPILER} in
  104. "ICC")
  105. CFLAGS="-Os -g -Wall -wd 279,869,981"
  106. AC_MSG_RESULT([Intel default])
  107. ;;
  108. "GCC")
  109. CFLAGS="-Os -fno-omit-frame-pointer -g -std=gnu99 -Wall"
  110. CFLAGS="${CFLAGS} -Wsign-compare -Wpointer-arith"
  111. CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
  112. CFLAGS="${CFLAGS} -Wmissing-prototypes -Wmissing-declarations"
  113. CFLAGS="${CFLAGS} -Wchar-subscripts -Wcast-qual"
  114. # TODO: conditionally addd -Wpacked if handled
  115. AC_MSG_RESULT([gcc default])
  116. ;;
  117. "SUNPRO")
  118. CFLAGS="-xO4 -v -g -xspace -xcode=pic32 -xstrconst -xc99"
  119. AC_MSG_RESULT([SunPro default])
  120. ;;
  121. *)
  122. AC_MSG_RESULT([unknown compiler])
  123. ;;
  124. esac
  125. else
  126. AC_MSG_RESULT([CFLAGS supplied by user])
  127. fi
  128. dnl --------------
  129. dnl Check programs
  130. dnl --------------
  131. AC_PROG_INSTALL
  132. AC_PROG_LN_S
  133. AC_PROG_MAKE_SET
  134. AC_CHECK_TOOL(AR, ar)
  135. dnl ---------------------------
  136. dnl We, perhaps unfortunately,
  137. dnl depend on GNU Make specific
  138. dnl constructs.
  139. dnl Give the user a warning if
  140. dnl not GNU Make.
  141. dnl ---------------------------
  142. AC_CACHE_CHECK([if ${MAKE-make} is GNU make], [quagga_cv_gnu_make],
  143. [quagga_cv_gnu_make=no
  144. if ${MAKE-make} --version 2>/dev/null | \
  145. grep '^GNU Make ' >/dev/null ; then
  146. quagga_cv_gnu_make=yes;
  147. fi
  148. ]
  149. )
  150. dnl -----------------
  151. dnl System extensions
  152. dnl -----------------
  153. AC_AIX
  154. AC_GNU_SOURCE
  155. dnl -------
  156. dnl libtool
  157. dnl -------
  158. AC_PROG_LIBTOOL
  159. dnl ----------------------
  160. dnl Packages configuration
  161. dnl ----------------------
  162. AC_ARG_ENABLE(vtysh,
  163. [ --enable-vtysh include integrated vty shell for Quagga])
  164. AC_ARG_ENABLE(ipv6,
  165. [ --disable-ipv6 turn off IPv6 related features and daemons])
  166. AC_ARG_ENABLE(zebra,
  167. [ --disable-zebra do not build zebra daemon])
  168. AC_ARG_ENABLE(bgpd,
  169. [ --disable-bgpd do not build bgpd])
  170. AC_ARG_ENABLE(ripd,
  171. [ --disable-ripd do not build ripd])
  172. AC_ARG_ENABLE(ripngd,
  173. [ --disable-ripngd do not build ripngd])
  174. AC_ARG_ENABLE(ospfd,
  175. [ --disable-ospfd do not build ospfd])
  176. AC_ARG_ENABLE(ospf6d,
  177. [ --disable-ospf6d do not build ospf6d])
  178. AC_ARG_ENABLE(watchquagga,
  179. [ --disable-watchquagga do not build watchquagga])
  180. AC_ARG_ENABLE(isisd,
  181. [ --enable-isisd build isisd])
  182. AC_ARG_ENABLE(solaris,
  183. [ --enable-solaris build solaris])
  184. AC_ARG_ENABLE(bgp-announce,
  185. [ --disable-bgp-announce, turn off BGP route announcement])
  186. AC_ARG_ENABLE(netlink,
  187. [ --enable-netlink force to use Linux netlink interface])
  188. AC_ARG_ENABLE(broken-aliases,
  189. [ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
  190. AC_ARG_ENABLE(snmp,
  191. [ --enable-snmp enable SNMP support])
  192. AC_ARG_WITH(libpam,
  193. [ --with-libpam use libpam for PAM support in vtysh])
  194. AC_ARG_ENABLE(tcp-zebra,
  195. [ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon])
  196. AC_ARG_ENABLE(opaque-lsa,
  197. [ --enable-opaque-lsa enable OSPF Opaque-LSA with OSPFAPI support (RFC2370)])
  198. AC_ARG_ENABLE(ospfapi,
  199. [ --disable-ospfapi do not build OSPFAPI to access the OSPF LSA Database,
  200. (this is the default if --enable-opaque-lsa is not set)])
  201. AC_ARG_ENABLE(ospfclient,
  202. [ --disable-ospfclient do not build OSPFAPI client for OSPFAPI,
  203. (this is the default if --disable-ospfapi is set)])
  204. AC_ARG_ENABLE(ospf-te,
  205. [ --enable-ospf-te enable Traffic Engineering Extension to OSPF])
  206. AC_ARG_ENABLE(multipath,
  207. [ --enable-multipath=ARG enable multipath function, ARG must be digit])
  208. AC_ARG_ENABLE(quagga_user,
  209. [ --enable-user=ARG user to run Quagga suite as (default quagga)])
  210. AC_ARG_ENABLE(quagga_group,
  211. [ --enable-group=ARG group to run Quagga suite as (default quagga)])
  212. AC_ARG_ENABLE(vty_group,
  213. [ --enable-vty-group=ARG set vty sockets to have specified group as owner])
  214. AC_ARG_ENABLE(configfile_mask,
  215. [ --enable-configfile-mask=ARG set mask for config files])
  216. AC_ARG_ENABLE(logfile_mask,
  217. [ --enable-logfile-mask=ARG set mask for log files])
  218. AC_ARG_ENABLE(rtadv,
  219. [ --disable-rtadv disable IPV6 router advertisement feature])
  220. AC_ARG_ENABLE(irdp,
  221. [ --enable-irdp enable IRDP server support in zebra])
  222. AC_ARG_ENABLE(isis_topology,
  223. [ --enable-isis-topology enable IS-IS topology generator])
  224. AC_ARG_ENABLE(capabilities,
  225. [ --disable-capabilities disable using POSIX capabilities])
  226. AC_ARG_ENABLE(gcc_ultra_verbose,
  227. [ --enable-gcc-ultra-verbose enable ultra verbose GCC warnings])
  228. AC_ARG_ENABLE(gcc-rdynamic,
  229. [ --enable-gcc-rdynamic enable gcc linking with -rdynamic for better backtraces])
  230. AC_ARG_ENABLE(time-check,
  231. [ --disable-time-check disable slow thread warning messages])
  232. if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
  233. CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
  234. CFLAGS="${CFLAGS} -Wmissing-declarations -Wmissing-noreturn"
  235. CFLAGS="${CFLAGS} -Wmissing-format-attribute -Wunreachable-code"
  236. CFLAGS="${CFLAGS} -Wpacked -Wpadded"
  237. fi
  238. if test x"${enable_gcc_rdynamic}" = x"yes" ; then
  239. LDFLAGS="${LDFLAGS} -rdynamic"
  240. fi
  241. if test x"${enable_time_check}" != x"no" ; then
  242. if test x"${enable_time_check}" = x"yes" -o x"${enable_time_check}" = x ; then
  243. AC_DEFINE(CONSUMED_TIME_CHECK,5000000,Consumed Time Check)
  244. else
  245. AC_DEFINE_UNQUOTED(CONSUMED_TIME_CHECK,$enable_time_check,Consumed Time Check)
  246. fi
  247. fi
  248. if test "${enable_broken_aliases}" = "yes"; then
  249. if test "${enable_netlink}" = "yes"
  250. then
  251. AC_MSG_FAILURE([Sorry you can not use netlink with broken aliases])
  252. fi
  253. AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
  254. enable_netlink=no
  255. fi
  256. if test "${enable_tcp_zebra}" = "yes"; then
  257. AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
  258. fi
  259. if test "${enable_opaque_lsa}" = "yes"; then
  260. AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
  261. fi
  262. if test "${enable_ospf_te}" = "yes"; then
  263. AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
  264. AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
  265. fi
  266. AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
  267. if test "${enable_rtadv}" != "no"; then
  268. AC_MSG_RESULT(yes)
  269. AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
  270. else
  271. AC_MSG_RESULT(no)
  272. fi
  273. if test "${enable_irdp}" = "yes"; then
  274. AC_DEFINE(HAVE_IRDP,, IRDP )
  275. fi
  276. if test "${enable_isisd}" = "yes" && test "${enable_isis_topology}" = yes; then
  277. AC_DEFINE(TOPOLOGY_GENERATE,,Enable IS-IS topology generator code)
  278. ISIS_TOPOLOGY_INCLUDES="-I./topology"
  279. ISIS_TOPOLOGY_DIR="topology"
  280. ISIS_TOPOLOGY_LIB="./topology/libtopology.a"
  281. fi
  282. AC_SUBST(ISIS_TOPOLOGY_INCLUDES)
  283. AC_SUBST(ISIS_TOPOLOGY_DIR)
  284. AC_SUBST(ISIS_TOPOLOGY_LIB)
  285. if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
  286. enable_user="quagga"
  287. elif test "${enable_user}" = "no"; then
  288. enable_user="root"
  289. fi
  290. if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
  291. enable_group="quagga"
  292. elif test "${enable_group}" = "no"; then
  293. enable_group="root"
  294. fi
  295. if test x"${enable_vty_group}" = x"yes" ; then
  296. AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
  297. elif test x"${enable_vty_group}" != x""; then
  298. if test x"${enable_vty_group}" != x"no"; then
  299. AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
  300. fi
  301. fi
  302. AC_SUBST([enable_user])
  303. AC_SUBST([enable_group])
  304. AC_SUBST([enable_vty_group])
  305. AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
  306. AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
  307. enable_configfile_mask=${enable_configfile_mask:-0600}
  308. AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
  309. enable_logfile_mask=${enable_logfile_mask:-0600}
  310. AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
  311. MULTIPATH_NUM=1
  312. case "${enable_multipath}" in
  313. [[0-9]|[1-9][0-9]])
  314. MULTIPATH_NUM="${enable_multipath}"
  315. ;;
  316. "")
  317. ;;
  318. *)
  319. AC_MSG_FAILURE([Please specify digit to enable multipath ARG])
  320. ;;
  321. esac
  322. AC_SUBST(MULTIPATH_NUM)
  323. dnl ------------------------------------
  324. dnl Check C keywords and standard types
  325. dnl ------------------------------------
  326. AC_C_CONST
  327. AC_C_INLINE
  328. AC_C_RESTRICT
  329. AC_C_VOLATILE
  330. AC_HEADER_STDC
  331. AC_HEADER_TIME
  332. AC_HEADER_SYS_WAIT
  333. dnl AC_TYPE_PID_T
  334. AC_TYPE_UID_T
  335. AC_TYPE_MODE_T
  336. AC_TYPE_SIZE_T
  337. AC_TYPE_SIGNAL
  338. AC_STRUCT_TM
  339. dnl -------------------------
  340. dnl Check other header files.
  341. dnl -------------------------
  342. AC_CHECK_HEADERS([stropts.h sys/ksym.h sys/times.h sys/select.h \
  343. sys/types.h linux/version.h netdb.h asm/types.h \
  344. sys/param.h limits.h signal.h libutil.h \
  345. sys/socket.h netinet/in.h])
  346. dnl Utility macro to avoid retyping includes all the time
  347. m4_define([QUAGGA_INCLUDES],
  348. [#ifdef SUNOS_5
  349. #define _XPG4_2
  350. #define __EXTENSIONS__
  351. #endif
  352. #include <stdio.h>
  353. #if STDC_HEADERS
  354. # include <stdlib.h>
  355. # include <stddef.h>
  356. #else
  357. # if HAVE_STDLIB_H
  358. # include <stdlib.h>
  359. # endif
  360. #endif
  361. #if HAVE_SYS_TYPES_H
  362. # include <sys/types.h>
  363. #endif
  364. /* sys/conf.h depends on param.h on FBSD at least */
  365. #if HAVE_SYS_PARAM_H
  366. # include <sys/param.h>
  367. #endif
  368. /* Required for MAXSIG */
  369. #if HAVE_SIGNAL_H
  370. # include <signal.h>
  371. #endif
  372. #if HAVE_SYS_SOCKET_H
  373. # include <sys/socket.h>
  374. #endif
  375. #if HAVE_NETINET_IN_H
  376. # include <netinet/in.h>
  377. #endif
  378. ])dnl
  379. AC_CHECK_HEADERS([sys/un.h net/if.h netinet/in_systm.h netinet/in_var.h \
  380. net/if_dl.h net/if_var.h net/netopt.h net/route.h \
  381. inet/nd.h arpa/inet.h netinet/ip_icmp.h \
  382. fcntl.h stddef.h sys/ioctl.h syslog.h wchar.h wctype.h \
  383. sys/sysctl.h sys/sockio.h kvm.h sys/conf.h],
  384. [], [], QUAGGA_INCLUDES)
  385. AC_CHECK_HEADERS([ucontext.h], [], [],
  386. [#ifndef __USE_GNU
  387. #define __USE_GNU
  388. #endif /* __USE_GNU */
  389. QUAGGA_INCLUDES
  390. ])
  391. m4_define([QUAGGA_INCLUDES],
  392. QUAGGA_INCLUDES
  393. [#if HAVE_NET_IF_H
  394. # include <net/if.h>
  395. #endif
  396. #if HAVE_SYS_UN_H
  397. # include <sys/un.h>
  398. #endif
  399. #if HAVE_NETINET_IN_SYSTM_H
  400. # include <netinet/in_systm.h>
  401. #endif
  402. #if HAVE_NETINET_IN_VAR_H
  403. # include <netinet/in_var.h>
  404. #endif
  405. #if HAVE_NET_IF_DL_H
  406. # include <net/if_dl.h>
  407. #endif
  408. #if HAVE_NET_IF_VAR_H
  409. # include <net/if_var.h>
  410. #endif
  411. #if HAVE_NET_NETOPT_H
  412. # include <net/netopt.h>
  413. #endif
  414. #if HAVE_NET_ROUTE_H
  415. # include <net/route.h>
  416. #endif
  417. #if HAVE_INET_ND_H
  418. # include <inet/nd.h>
  419. #endif
  420. #if HAVE_ARPA_INET_H
  421. # include <arpa/inet.h>
  422. #endif
  423. /* Required for IDRP */
  424. #if HAVE_NETINET_IP_ICMP_H
  425. # include <netinet/ip_icmp.h>
  426. #endif
  427. ])dnl
  428. dnl V6 headers are checked below, after we check for v6
  429. dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
  430. case "$host" in
  431. [*-sunos5.[6-7]*] | [*-solaris2.[6-7]*])
  432. opsys=sol2-6
  433. AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.7)
  434. AC_DEFINE(SUNOS_5, 1, SunOS 5)
  435. AC_CHECK_LIB(xnet, main)
  436. CURSES=-lcurses
  437. ;;
  438. [*-sunos5.[8-9]] \
  439. | [*-sunos5.1[0-9]] \
  440. | [*-sunos5.1[0-9].[0-9]] \
  441. | [*-solaris2.[8-9]] \
  442. | [*-solaris2.1[0-9]] \
  443. | [*-solaris2.1[0-9].[0-9]])
  444. opsys=sol8
  445. AC_DEFINE(SUNOS_59, 1, [SunOS 5.8 up])
  446. AC_DEFINE(SUNOS_5, 1, [SunOS 5])
  447. AC_CHECK_LIB(socket, main)
  448. AC_CHECK_LIB(nsl, main)
  449. AC_CHECK_LIB(umem, main)
  450. AC_CHECK_FUNCS([printstack],
  451. [AC_DEFINE([HAVE_PRINTSTACK],1,[Solaris printstack])
  452. AC_DEFINE([HAVE_STACK_TRACE],1,[Stack symbols decode functionality])
  453. ])
  454. CURSES=-lcurses
  455. ;;
  456. *-sunos5* | *-solaris2*)
  457. AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
  458. AC_CHECK_LIB(socket, main)
  459. AC_CHECK_LIB(nsl, main)
  460. CURSES=-lcurses
  461. ;;
  462. *-linux*)
  463. opsys=gnu-linux
  464. AC_DEFINE(GNU_LINUX,,GNU Linux)
  465. ;;
  466. *-nec-sysv4*)
  467. AC_CHECK_LIB(nsl, gethostbyname)
  468. AC_CHECK_LIB(socket, socket)
  469. ;;
  470. *-openbsd*)
  471. opsys=openbsd
  472. AC_DEFINE(OPEN_BSD,,OpenBSD)
  473. ;;
  474. *-bsdi*)
  475. opsys=bsdi
  476. OTHER_METHOD="mtu_kvm.o"
  477. AC_CHECK_LIB(kvm, main)
  478. ;;
  479. *-irix6.5)
  480. opsys=irix
  481. AC_DEFINE(IRIX_65,,IRIX 6.5)
  482. ;;
  483. esac
  484. dnl ---------------------
  485. dnl Integrated VTY option
  486. dnl ---------------------
  487. case "${enable_vtysh}" in
  488. "yes") VTYSH="vtysh";
  489. AC_DEFINE(VTYSH,,VTY shell)
  490. AC_PATH_PROG(PERL, perl)
  491. dnl Vtysh uses libreadline, which looks for termcap functions at
  492. dnl configure time. We follow readlines search order.
  493. dnl The required procedures are in libtermcap on NetBSD, in
  494. dnl [TODO] on Linux, and in [TODO] on Solaris.
  495. AC_CHECK_LIB(termcap, tputs, LIBREADLINE="$LIBREADLINE -ltermcap",
  496. [AC_CHECK_LIB(tinfo, tputs, LIBREADLINE="$LIBREADLINE -ltinfo",
  497. [AC_CHECK_LIB(curses, tputs, LIBREADLINE="$LIBREADLINE -lcurses",
  498. [AC_CHECK_LIB(ncurses, tputs,
  499. LIBREADLINE="$LIBREADLINE -lncurses")]
  500. )]
  501. )]
  502. )
  503. AC_CHECK_LIB(readline, main, LIBREADLINE="$LIBREADLINE -lreadline",,
  504. "$LIBREADLINE")
  505. if test $ac_cv_lib_readline_main = no; then
  506. AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
  507. fi
  508. AC_CHECK_HEADER(readline/history.h)
  509. if test $ac_cv_header_readline_history_h = no;then
  510. AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
  511. fi
  512. AC_CHECK_LIB(readline, rl_completion_matches,
  513. LIBREADLINE="$LIBREADLINE",, "$LIBREADLINE")
  514. if test $ac_cv_lib_readline_rl_completion_matches = no; then
  515. AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
  516. fi
  517. ;;
  518. "no" ) VTYSH="";;
  519. * ) ;;
  520. esac
  521. AC_SUBST(LIBREADLINE)
  522. dnl ----------
  523. dnl PAM module
  524. dnl ----------
  525. if test "$with_libpam" = "yes"; then
  526. AC_CHECK_HEADER([security/pam_misc.h],
  527. [AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
  528. AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
  529. pam_conv_func="misc_conv"
  530. ],
  531. [], QUAGGA_INCLUDES)
  532. AC_CHECK_HEADER([security/openpam.h],
  533. [AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
  534. AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
  535. pam_conv_func="openpam_ttyconv"
  536. ],
  537. [], QUAGGA_INCLUDES)
  538. if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
  539. AC_MSG_WARN([*** pam support will not be built ***])
  540. with_libpam="no"
  541. fi
  542. fi
  543. if test "$with_libpam" = "yes"; then
  544. dnl took this test from proftpds configure.in and suited to our needs
  545. dnl -------------------------------------------------------------------------
  546. dnl
  547. dnl This next check looks funky due to a linker problem with some versions
  548. dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
  549. dnl omitted requiring libdl linking information. PAM-0.72 or better ships
  550. dnl with RedHat 6.2 and Debian 2.2 or better.
  551. AC_CHECK_LIB(pam, pam_start,
  552. [AC_CHECK_LIB(pam, $pam_conv_func,
  553. [AC_DEFINE(USE_PAM,,Use PAM for authentication)
  554. LIBPAM="-lpam"],
  555. [AC_DEFINE(USE_PAM,,Use PAM for authentication)
  556. LIBPAM="-lpam -lpam_misc"]
  557. )
  558. ],
  559. [AC_CHECK_LIB(pam, pam_end,
  560. [AC_CHECK_LIB(pam, $pam_conv_func,
  561. [AC_DEFINE(USE_PAM,,Use PAM for authentication)
  562. LIBPAM="-lpam -ldl"],
  563. [AC_DEFINE(USE_PAM,,Use PAM for authentication)
  564. LIBPAM="-lpam -ldl -lpam_misc"]
  565. )
  566. ],AC_MSG_WARN([*** pam support will not be built ***]),
  567. [-ldl])
  568. ]
  569. )
  570. fi
  571. AC_SUBST(LIBPAM)
  572. dnl -------------------------------
  573. dnl Endian-ness check
  574. dnl -------------------------------
  575. AC_WORDS_BIGENDIAN
  576. dnl -------------------------------
  577. dnl check the size in byte of the C
  578. dnl -------------------------------
  579. dnl AC_CHECK_SIZEOF(char)
  580. dnl AC_CHECK_SIZEOF(int)
  581. dnl AC_CHECK_SIZEOF(short)
  582. dnl AC_CHECK_SIZEOF(long)
  583. dnl ----------------------------
  584. dnl check existance of functions
  585. dnl ----------------------------
  586. AC_FUNC_CHOWN
  587. AC_FUNC_FNMATCH
  588. AC_FUNC_FORK
  589. AC_FUNC_MALLOC
  590. AC_FUNC_MEMCMP
  591. AC_FUNC_MKTIME
  592. AC_FUNC_STRFTIME
  593. AC_FUNC_REALLOC
  594. AC_FUNC_STAT
  595. AC_FUNC_SELECT_ARGTYPES
  596. AC_FUNC_STRFTIME
  597. dnl Avoid AC_FUNC_STRNLEN because it pulls in AC_SYSTEM_EXTENSIONS which
  598. dnl can lead to strange side effects. So we just check for strnlen
  599. dnl directly, see below.
  600. dnl AC_FUNC_STRNLENdnl
  601. AC_FUNC_VPRINTF
  602. dnl -------------------------------
  603. dnl bgpd needs pow() and hence libm
  604. dnl -------------------------------
  605. TMPLIBS="$LIBS"
  606. AC_CHECK_HEADER([math.h],
  607. [AC_CHECK_LIB([m], [pow],
  608. [LIBM="-lm"
  609. LIBS="$LIBS $LIBM"
  610. AC_DEFINE(HAVE_LIBM,, Have libm)
  611. AC_CHECK_FUNCS(pow,[],[LIBM=""])
  612. ])
  613. ])
  614. if test x"$LIBM" = x ; then
  615. AC_MSG_WARN([Unable to find working pow function - bgpd may not link])
  616. fi
  617. LIBS="$TMPLIBS"
  618. AC_SUBST(LIBM)
  619. dnl ---------------
  620. dnl other functions
  621. dnl ---------------
  622. AC_CHECK_FUNCS([dup2 ftruncate getcwd gethostbyname getpagesize gettimeofday \
  623. inet_ntoa inet_aton strnlen \
  624. memchr memmove memset select socket \
  625. strcasecmp strchr strcspn strdup strerror \
  626. strncasecmp strndup strrchr strspn strstr \
  627. strtol strtoul strlcat strlcpy \
  628. daemon snprintf vsnprintf \
  629. if_nametoindex if_indextoname getifaddrs \
  630. uname fcntl])
  631. AC_CHECK_FUNCS(setproctitle, ,
  632. [AC_CHECK_LIB(util, setproctitle,
  633. [LIBS="$LIBS -lutil"
  634. AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
  635. ]
  636. )
  637. ]
  638. )
  639. dnl ------------------------------------
  640. dnl Determine routing get and set method
  641. dnl ------------------------------------
  642. AC_MSG_CHECKING(zebra between kernel interface method)
  643. if test x"$opsys" = x"gnu-linux"; then
  644. if test "${enable_netlink}" = "yes";then
  645. AC_MSG_RESULT(netlink)
  646. RT_METHOD=rt_netlink.o
  647. AC_DEFINE(HAVE_NETLINK,,netlink)
  648. netlink=yes
  649. elif test "${enable_netlink}" = "no"; then
  650. AC_MSG_RESULT(ioctl)
  651. RT_METHOD=rt_ioctl.o
  652. netlink=no
  653. else
  654. AC_MSG_RESULT(netlink)
  655. RT_METHOD=rt_netlink.o
  656. AC_DEFINE(HAVE_NETLINK,,netlink)
  657. netlink=yes
  658. fi
  659. elif test x"$opsys" = x"sol2-6";then
  660. AC_MSG_RESULT(Route socket)
  661. KERNEL_METHOD="kernel_socket.o"
  662. RT_METHOD="rt_socket.o"
  663. elif test x"$opsys" = x"sol8";then
  664. AC_MSG_RESULT(Route socket)
  665. KERNEL_METHOD="kernel_socket.o"
  666. RT_METHOD="rt_socket.o"
  667. elif test "$opsys" = "irix" ; then
  668. AC_MSG_RESULT(Route socket)
  669. KERNEL_METHOD="kernel_socket.o"
  670. RT_METHOD="rt_socket.o"
  671. else
  672. AC_TRY_RUN([#include <errno.h>
  673. #include <sys/types.h>
  674. #include <sys/socket.h>
  675. main ()
  676. {
  677. int ac_sock;
  678. ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
  679. if (ac_sock < 0 && errno == EINVAL)
  680. exit (1);
  681. exit (0);
  682. }],
  683. [KERNEL_METHOD=kernel_socket.o
  684. RT_METHOD=rt_socket.o
  685. AC_MSG_RESULT(socket)],
  686. [RT_METHOD=rt_ioctl.o
  687. AC_MSG_RESULT(ioctl)],
  688. [KERNEL_METHOD=kernel_socket.o
  689. RT_METHOD=rt_socket.o
  690. AC_MSG_RESULT(socket)])
  691. fi
  692. AC_SUBST(RT_METHOD)
  693. AC_SUBST(KERNEL_METHOD)
  694. AC_SUBST(OTHER_METHOD)
  695. dnl ------------------------------------
  696. dnl check for broken CMSG_FIRSTHDR macro
  697. dnl ------------------------------------
  698. AC_MSG_CHECKING(for broken CMSG_FIRSTHDR)
  699. AC_RUN_IFELSE([AC_LANG_SOURCE([[
  700. #ifdef SUNOS_5
  701. #define _XPG4_2
  702. #define __EXTENSIONS__
  703. #endif
  704. #ifdef HAVE_STDLIB_H
  705. # include <stdlib.h>
  706. #endif
  707. #ifdef HAVE_SYS_TYPES_H
  708. #include <sys/types.h>
  709. #endif
  710. #ifdef HAVE_SYS_SOCKET_H
  711. #include <sys/socket.h>
  712. #endif
  713. main()
  714. {
  715. struct msghdr msg;
  716. char buf[4];
  717. msg.msg_control = buf;
  718. msg.msg_controllen = 0;
  719. if (CMSG_FIRSTHDR(&msg) != NULL)
  720. exit(0);
  721. exit (1);
  722. }]])],[AC_MSG_RESULT(yes - using workaround) AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)],
  723. [AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
  724. dnl ------------------------------
  725. dnl check kernel route read method
  726. dnl ------------------------------
  727. AC_CACHE_CHECK(route read method check, zebra_rtread,
  728. [if test "$netlink" = yes; then
  729. RTREAD_METHOD="rtread_netlink.o"
  730. zebra_rtread="netlink"
  731. else
  732. for zebra_rtread in /proc/net/route /dev/ip /dev/null;
  733. do
  734. test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
  735. done
  736. case $zebra_rtread in
  737. "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
  738. zebra_rtread="proc";;
  739. "/dev/ip")
  740. case "$host" in
  741. *-freebsd*) RTREAD_METHOD=rtread_sysctl.o
  742. zebra_rtread="sysctl";;
  743. *) RTREAD_METHOD="rtread_getmsg.o"
  744. zebra_rtread="getmsg";;
  745. esac;;
  746. *) RTREAD_METHOD="rtread_sysctl.o"
  747. zebra_rtread="sysctl";;
  748. esac
  749. fi])
  750. AC_SUBST(RTREAD_METHOD)
  751. dnl -----------------------------
  752. dnl check interface lookup method
  753. dnl -----------------------------
  754. IOCTL_METHOD=ioctl.o
  755. AC_MSG_CHECKING(interface looking up method)
  756. if test "$netlink" = yes; then
  757. AC_MSG_RESULT(netlink)
  758. IF_METHOD=if_netlink.o
  759. elif test "$opsys" = "sol2-6";then
  760. AC_MSG_RESULT(Solaris GIF)
  761. IF_METHOD=if_ioctl.o
  762. elif test "$opsys" = "sol8";then
  763. AC_MSG_RESULT(Solaris GLIF)
  764. IF_METHOD=if_ioctl_solaris.o
  765. IOCTL_METHOD=ioctl_solaris.o
  766. elif test "$opsys" = "irix" ; then
  767. AC_MSG_RESULT(IRIX)
  768. IF_METHOD=if_ioctl.o
  769. elif test "$opsys" = "openbsd";then
  770. AC_MSG_RESULT(openbsd)
  771. IF_METHOD=if_ioctl.o
  772. elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
  773. AC_MSG_RESULT(sysctl)
  774. IF_METHOD=if_sysctl.o
  775. AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
  776. else
  777. AC_MSG_RESULT(ioctl)
  778. IF_METHOD=if_ioctl.o
  779. fi
  780. AC_SUBST(IF_METHOD)
  781. AC_SUBST(IOCTL_METHOD)
  782. dnl ---------------------------------------------------------------
  783. dnl figure out how to specify an interface in multicast sockets API
  784. dnl ---------------------------------------------------------------
  785. AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], [], QUAGGA_INCLUDES)
  786. AC_MSG_CHECKING([for BSD struct ip_mreq hack])
  787. AC_TRY_COMPILE([#ifdef HAVE_SYS_PARAM_H
  788. #include <sys/param.h>
  789. #endif],[#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500022 || (__FreeBSD_version < 500000 && __FreeBSD_version >= 440000))) || (defined(__NetBSD__) && defined(__NetBSD_Version__) && __NetBSD_Version__ >= 106010000)
  790. return (0);
  791. #else
  792. #error No support for BSD struct ip_mreq hack detected
  793. #endif],[AC_MSG_RESULT(yes)
  794. AC_DEFINE(HAVE_BSD_STRUCT_IP_MREQ_HACK,,[Can pass ifindex in struct ip_mreq])],
  795. AC_MSG_RESULT(no))
  796. dnl -----------------------
  797. dnl check proc file system.
  798. dnl -----------------------
  799. if test -r /proc/net/dev; then
  800. AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
  801. IF_PROC=if_proc.o
  802. fi
  803. if test -r /proc/net/if_inet6; then
  804. AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
  805. IF_PROC=if_proc.o
  806. fi
  807. AC_SUBST(IF_PROC)
  808. dnl -----------------------------
  809. dnl check ipforward detect method
  810. dnl -----------------------------
  811. AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
  812. [for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
  813. do
  814. test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
  815. done
  816. case $zebra_ipforward_path in
  817. "/proc/net/snmp") IPFORWARD=ipforward_proc.o
  818. zebra_ipforward_path="proc";;
  819. "/dev/ip")
  820. case "$host" in
  821. *-nec-sysv4*) IPFORWARD=ipforward_ews.o
  822. zebra_ipforward_path="ews";;
  823. *-freebsd*) IPFORWARD=ipforward_sysctl.o
  824. zebra_ipforward_path="sysctl";;
  825. *) IPFORWARD=ipforward_solaris.o
  826. zebra_ipforward_path="solaris";;
  827. esac;;
  828. *) IPFORWARD=ipforward_sysctl.o
  829. zebra_ipforward_path="sysctl";;
  830. esac])
  831. AC_SUBST(IPFORWARD)
  832. AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
  833. dnl ----------
  834. dnl IPv6 check
  835. dnl ----------
  836. AC_MSG_CHECKING(whether does this OS have IPv6 stack)
  837. if test "${enable_ipv6}" = "no"; then
  838. AC_MSG_RESULT(disabled)
  839. else
  840. dnl ----------
  841. dnl INRIA IPv6
  842. dnl ----------
  843. if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
  844. zebra_cv_ipv6=yes
  845. AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
  846. AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
  847. RIPNGD="ripngd"
  848. OSPF6D="ospf6d"
  849. LIB_IPV6=""
  850. AC_MSG_RESULT(INRIA IPv6)
  851. dnl ---------
  852. dnl KAME IPv6
  853. dnl ---------
  854. elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
  855. zebra_cv_ipv6=yes
  856. AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
  857. AC_DEFINE(KAME,1,KAME IPv6)
  858. RIPNGD="ripngd"
  859. OSPF6D="ospf6d"
  860. if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
  861. LIB_IPV6="-L/usr/local/v6/lib -linet6"
  862. fi
  863. AC_MSG_RESULT(KAME)
  864. dnl -------------------------
  865. dnl MUSICA IPv6
  866. dnl default host check
  867. dnl It is not used by Kheops
  868. dnl -------------------------
  869. elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
  870. zebra_cv_ipv6=yes
  871. AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
  872. AC_DEFINE(MUSICA,1,Musica IPv6 stack)
  873. AC_DEFINE(KAME,1,KAME IPv6 stack)
  874. RIPNGD="ripngd"
  875. OSPF6D="ospf6d"
  876. if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
  877. LIB_IPV6="-L/usr/local/v6/lib -linet6"
  878. fi
  879. AC_MSG_RESULT(MUSICA)
  880. dnl ---------
  881. dnl NRL check
  882. dnl ---------
  883. elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
  884. zebra_cv_ipv6=yes
  885. AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
  886. AC_DEFINE(NRL,1,NRL)
  887. RIPNGD="ripngd"
  888. OSPF6D="ospf6d"
  889. if test x"$opsys" = x"bsdi";then
  890. AC_DEFINE(BSDI_NRL,,BSDI)
  891. AC_MSG_RESULT(BSDI_NRL)
  892. else
  893. AC_MSG_RESULT(NRL)
  894. fi
  895. dnl ------------------------------------
  896. dnl Solaris 9, 10 and potentially higher
  897. dnl ------------------------------------
  898. elif test x"$opsys" = x"sol8"; then
  899. zebra_cv_ipv6=yes;
  900. AC_DEFINE(HAVE_IPV6, 1, IPv6)
  901. AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
  902. RIPNGD="ripngd"
  903. OSPF6D="ospf6d"
  904. AC_MSG_RESULT(Solaris IPv6)
  905. dnl ----------
  906. dnl Linux IPv6
  907. dnl ----------
  908. elif test "${enable_ipv6}" = "yes"; then
  909. AC_EGREP_CPP(yes, [
  910. #include <linux/version.h>
  911. /* 2.1.128 or later */
  912. #if LINUX_VERSION_CODE >= 0x020180
  913. yes
  914. #endif],
  915. [zebra_cv_ipv6=yes
  916. zebra_cv_linux_ipv6=yes
  917. AC_MSG_RESULT(Linux IPv6)])
  918. else
  919. if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
  920. then
  921. zebra_cv_ipv6=yes
  922. zebra_cv_linux_ipv6=yes
  923. AC_MSG_RESULT(Linux IPv6)
  924. fi
  925. fi
  926. if test "$zebra_cv_linux_ipv6" = "yes";then
  927. AC_MSG_CHECKING(whether libc has IPv6 support)
  928. AC_TRY_LINK([#include <netinet/in.h>
  929. ],[ int a; a = (int) in6addr_any.s6_addr[0]; if (a != 12345) return a; ],
  930. [AC_MSG_RESULT(yes)
  931. zebra_cv_ipv6=yes
  932. zebra_cv_linux_ipv6=yes],
  933. [AC_MSG_RESULT(no)
  934. zebra_cv_ipv6=no
  935. zebra_cv_linux_ipv6=no])
  936. fi
  937. if test "$zebra_cv_linux_ipv6" = "yes";then
  938. AC_MSG_CHECKING(for GNU libc >= 2.1)
  939. AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
  940. AC_EGREP_CPP(yes, [
  941. #include <features.h>
  942. #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
  943. yes
  944. #endif],
  945. [glibc=yes
  946. AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
  947. AC_MSG_RESULT(yes)],
  948. AC_MSG_RESULT(no)
  949. )
  950. RIPNGD="ripngd"
  951. OSPF6D="ospf6d"
  952. if test "$glibc" != "yes"; then
  953. INCLUDES="-I/usr/inet6/include"
  954. if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
  955. LIB_IPV6="-L/usr/inet6/lib -linet6"
  956. fi
  957. fi
  958. fi
  959. dnl -----------------------
  960. dnl Set IPv6 related values
  961. dnl -----------------------
  962. LIBS="$LIB_IPV6 $LIBS"
  963. AC_SUBST(LIB_IPV6)
  964. if test x"$RIPNGD" = x""; then
  965. AC_MSG_RESULT(IPv4 only)
  966. fi
  967. fi
  968. dnl ------------------
  969. dnl IPv6 header checks
  970. dnl ------------------
  971. if test "x${zebra_cv_ipv6}" = "xyes"; then
  972. AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
  973. netinet6/in6_var.h netinet6/nd6.h], [], [],
  974. QUAGGA_INCLUDES)
  975. fi
  976. m4_define([QUAGGA_INCLUDES],dnl
  977. QUAGGA_INCLUDES
  978. [#if HAVE_NETINET6_IN6_H
  979. #include <netinet6/in6.h>
  980. #endif
  981. #if HAVE_NETINET_IN6_VAR_H
  982. #include <netinet/in6_var.h>
  983. #endif
  984. #if HAVE_NETINET_ICMP6_H
  985. # include <netinet/icmp6.h>
  986. #endif
  987. #if HAVE_NETINET6_IN6_VAR_H
  988. # include <netinet6/in6_var.h>
  989. #endif
  990. #if HAVE_NETINET6_ND6_H
  991. # include <netinet6/nd6.h>
  992. #endif
  993. ])dnl
  994. dnl --------------------
  995. dnl Daemon disable check
  996. dnl --------------------
  997. if test "${enable_zebra}" = "no";then
  998. ZEBRA=""
  999. else
  1000. ZEBRA="zebra"
  1001. fi
  1002. if test "${enable_bgpd}" = "no";then
  1003. BGPD=""
  1004. else
  1005. BGPD="bgpd"
  1006. fi
  1007. if test "${enable_ripd}" = "no";then
  1008. RIPD=""
  1009. else
  1010. RIPD="ripd"
  1011. fi
  1012. if test "${enable_ospfd}" = "no";then
  1013. OSPFD=""
  1014. else
  1015. OSPFD="ospfd"
  1016. fi
  1017. if test "${enable_watchquagga}" = "no";then
  1018. WATCHQUAGGA=""
  1019. else
  1020. WATCHQUAGGA="watchquagga"
  1021. fi
  1022. OSPFCLIENT=""
  1023. if test "${enable_opaque_lsa}" = "yes"; then
  1024. if test "${enable_ospfapi}" != "no";then
  1025. AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
  1026. if test "${enable_ospfclient}" != "no";then
  1027. OSPFCLIENT="ospfclient"
  1028. fi
  1029. fi
  1030. fi
  1031. case "${enable_ripngd}" in
  1032. "yes") RIPNGD="ripngd";;
  1033. "no" ) RIPNGD="";;
  1034. * ) ;;
  1035. esac
  1036. case "${enable_ospf6d}" in
  1037. "yes") OSPF6D="ospf6d";;
  1038. "no" ) OSPF6D="";;
  1039. * ) ;;
  1040. esac
  1041. case "${enable_isisd}" in
  1042. "yes") ISISD="isisd";;
  1043. "no" ) ISISD="";;
  1044. * ) ;;
  1045. esac
  1046. # XXX Perhaps auto-enable on Solaris, but that's messy for cross builds.
  1047. case "${enable_solaris}" in
  1048. "yes") SOLARIS="solaris";;
  1049. "no" ) SOLARIS="";;
  1050. * ) ;;
  1051. esac
  1052. if test "${enable_bgp_announce}" = "no";then
  1053. AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
  1054. fi
  1055. AC_SUBST(ZEBRA)
  1056. AC_SUBST(BGPD)
  1057. AC_SUBST(RIPD)
  1058. AC_SUBST(RIPNGD)
  1059. AC_SUBST(OSPFD)
  1060. AC_SUBST(OSPF6D)
  1061. AC_SUBST(WATCHQUAGGA)
  1062. AC_SUBST(ISISD)
  1063. AC_SUBST(SOLARIS)
  1064. AC_SUBST(VTYSH)
  1065. AC_SUBST(INCLUDES)
  1066. AC_SUBST(CURSES)
  1067. AC_SUBST(OSPFCLIENT)
  1068. AC_SUBST(OSPFAPI)
  1069. AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
  1070. AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
  1071. AC_CHECK_LIB(crypt, crypt)
  1072. AC_CHECK_LIB(resolv, res_init)
  1073. dnl ---------------------------------------------------
  1074. dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
  1075. dnl ---------------------------------------------------
  1076. AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
  1077. AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
  1078. AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
  1079. dnl ---------------------------
  1080. dnl check system has GNU regexp
  1081. dnl ---------------------------
  1082. dnl AC_MSG_CHECKING(whether system has GNU regex)
  1083. AC_CHECK_LIB(c, regexec,
  1084. [AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
  1085. LIB_REGEX=""],
  1086. [LIB_REGEX="regex.o"])
  1087. AC_SUBST(LIB_REGEX)
  1088. dnl ------------------
  1089. dnl check Net-SNMP library
  1090. dnl ------------------
  1091. if test "${enable_snmp}" = "yes"; then
  1092. LIBS="${LIBS} -lcrypto"
  1093. AC_CHECK_LIB(netsnmp, asn_parse_int,
  1094. [AC_DEFINE(HAVE_NETSNMP,,Net SNMP)
  1095. AC_DEFINE(HAVE_SNMP,,SNMP)
  1096. LIBS="${LIBS} -lnetsnmp"],
  1097. [AC_MSG_ERROR([--enable-snmp given, but cannot find support for SNMP])])
  1098. for ac_snmp in /usr/include \
  1099. /usr/local/include \
  1100. /dev/null; do
  1101. test -f "${ac_snmp}/net-snmp/library/asn1.h" && break
  1102. done
  1103. case ${ac_snmp} in
  1104. /dev/null)
  1105. AC_MSG_ERROR([--enable-snmp given, but can not find header])
  1106. ;;
  1107. *)
  1108. SNMP_INCLUDES="-I${ac_snmp}/net-snmp"
  1109. SNMP_INCLUDES="${SNMP_INCLUDES} -I${ac_snmp}/net-snmp/library"
  1110. ;;
  1111. esac
  1112. AC_SUBST(SNMP_INCLUDES)
  1113. fi
  1114. dnl ---------------------------
  1115. dnl sockaddr and netinet checks
  1116. dnl ---------------------------
  1117. AC_CHECK_TYPES([struct sockaddr, struct sockaddr_in,
  1118. struct sockaddr_in6, struct sockaddr_un, struct sockaddr_dl,
  1119. socklen_t,
  1120. struct ifaliasreq, struct if6_aliasreq, struct in6_aliasreq,
  1121. struct nd_opt_adv_interval, struct rt_addrinfo,
  1122. struct nd_opt_homeagent_info, struct nd_opt_adv_interval],
  1123. [], [], QUAGGA_INCLUDES)
  1124. AC_CHECK_MEMBERS([struct sockaddr.sa_len,
  1125. struct sockaddr_in.sin_len, struct sockaddr_un.sun_len,
  1126. struct sockaddr_in6.sin6_scope_id,
  1127. struct if6_aliasreq.ifra_lifetime,
  1128. struct nd_opt_adv_interval.nd_opt_ai_type],
  1129. [], [], QUAGGA_INCLUDES)
  1130. dnl ---------------------------
  1131. dnl IRDP/pktinfo/icmphdr checks
  1132. dnl ---------------------------
  1133. AC_CHECK_TYPES([struct in_pktinfo],
  1134. [AC_CHECK_TYPES([struct icmphdr],
  1135. [if test "${enable_irdp}" != "no"; then
  1136. AC_DEFINE(HAVE_IRDP,, IRDP)
  1137. fi],
  1138. [if test "${enable_irdp}" = "yes"; then
  1139. AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
  1140. fi], [QUAGGA_INCLUDES])],
  1141. [if test "${enable_irdp}" = "yes"; then
  1142. AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
  1143. fi], [QUAGGA_INCLUDES])
  1144. dnl --------------------------------------
  1145. dnl checking for getrusage struct and call
  1146. dnl --------------------------------------
  1147. AC_MSG_CHECKING(whether getrusage is available)
  1148. AC_TRY_COMPILE([#include <sys/resource.h>
  1149. ],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
  1150. [AC_MSG_RESULT(yes)
  1151. AC_DEFINE(HAVE_RUSAGE,,rusage)],
  1152. AC_MSG_RESULT(no))
  1153. dnl -------------------
  1154. dnl capabilities checks
  1155. dnl -------------------
  1156. if test "${enable_capabilities}" != "no"; then
  1157. AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
  1158. AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
  1159. [AC_MSG_RESULT(yes)
  1160. AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
  1161. quagga_ac_keepcaps="yes"],
  1162. AC_MSG_RESULT(no)
  1163. )
  1164. if test x"${quagga_ac_keepcaps}" = x"yes"; then
  1165. AC_CHECK_HEADERS(sys/capability.h)
  1166. fi
  1167. if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
  1168. AC_CHECK_LIB(cap, cap_init,
  1169. [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
  1170. LIBCAP="-lcap"
  1171. quagga_ac_lcaps="yes"]
  1172. )
  1173. else
  1174. AC_CHECK_HEADERS(priv.h,
  1175. [AC_MSG_CHECKING(Solaris style privileges are available)
  1176. AC_TRY_COMPILE([#include <priv.h>],[getpflags(PRIV_AWARE);],
  1177. [AC_MSG_RESULT(yes)
  1178. AC_DEFINE(HAVE_SOLARIS_CAPABILITIES,1,getpflags)
  1179. quagga_ac_scaps="yes"],
  1180. AC_MSG_RESULT(no)
  1181. )
  1182. ]
  1183. )
  1184. fi
  1185. if test x"${quagga_ac_scaps}" = x"yes" \
  1186. -o x"${quagga_ac_lcaps}" = x"yes"; then
  1187. AC_DEFINE(HAVE_CAPABILITIES,1,capabilities)
  1188. fi
  1189. fi
  1190. AC_SUBST(LIBCAP)
  1191. dnl ---------------------------
  1192. dnl check for glibc 'backtrace'
  1193. dnl ---------------------------
  1194. if test "${glibc}" = "yes"; then
  1195. AC_CHECK_HEADER([execinfo.h],
  1196. [AC_CHECK_FUNC([backtrace],
  1197. [AC_DEFINE(HAVE_GLIBC_BACKTRACE,,[Glibc backtrace])
  1198. AC_DEFINE(HAVE_STACK_TRACE,,[Stack symbol decoding])
  1199. ])
  1200. ])
  1201. fi
  1202. dnl -----------------------------------------
  1203. dnl check for malloc mallinfo struct and call
  1204. dnl this must try and link using LIBS, in
  1205. dnl order to check no alternative allocator
  1206. dnl has been specified, which might not provide
  1207. dnl mallinfo, e.g. such as Umem on Solaris.
  1208. dnl -----------------------------------------
  1209. AC_CHECK_HEADER([malloc.h],
  1210. [AC_MSG_CHECKING(whether mallinfo is available)
  1211. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
  1212. [[struct mallinfo ac_x; ac_x = mallinfo ();]])],
  1213. [AC_MSG_RESULT(yes)
  1214. AC_DEFINE(HAVE_MALLINFO,,mallinfo)],
  1215. AC_MSG_RESULT(no)
  1216. )
  1217. ], [], QUAGGA_INCLUDES)
  1218. dnl ----------
  1219. dnl configure date
  1220. dnl ----------
  1221. CONFDATE=`date '+%Y%m%d'`
  1222. AC_SUBST(CONFDATE)
  1223. dnl ------------------------------
  1224. dnl set paths for state directory
  1225. dnl ------------------------------
  1226. if test "${prefix}" = "NONE"; then
  1227. quagga_statedir_prefix="";
  1228. else
  1229. quagga_statedir_prefix=${prefix}
  1230. fi
  1231. if test "${localstatedir}" = '${prefix}/var'; then
  1232. AC_CACHE_CHECK(state directory,ac_statedir,
  1233. [for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
  1234. ${quagga_statedir_prefix}/var/adm dnl
  1235. ${quagga_statedir_prefix}/etc dnl
  1236. /var/run dnl
  1237. /var/adm dnl
  1238. /etc dnl
  1239. /dev/null;
  1240. do
  1241. test -d $QUAGGA_STATE_DIR && break
  1242. done
  1243. quagga_statedir=$QUAGGA_STATE_DIR])
  1244. else
  1245. quagga_statedir=${localstatedir}
  1246. AC_MSG_CHECKING(directory to use for state file)
  1247. AC_MSG_RESULT(${quagga_statedir})
  1248. AC_SUBST(quagga_statedir)
  1249. fi
  1250. if test $quagga_statedir = "/dev/null"; then
  1251. AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
  1252. fi
  1253. AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
  1254. AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
  1255. AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
  1256. AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
  1257. AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
  1258. AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
  1259. AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
  1260. AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
  1261. AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
  1262. AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
  1263. AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
  1264. AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
  1265. AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
  1266. AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
  1267. AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
  1268. AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
  1269. AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
  1270. dnl -------------------------------
  1271. dnl Quagga sources should always be
  1272. dnl current wrt interfaces. Dont
  1273. dnl allow deprecated interfaces to
  1274. dnl be exposed.
  1275. dnl -------------------------------
  1276. AC_DEFINE(QUAGGA_NO_DEPRECATED_INTERFACES, 1, Hide deprecated interfaces)
  1277. dnl ---------------------------
  1278. dnl Check htonl works correctly
  1279. dnl ---------------------------
  1280. AC_MSG_CHECKING(for working htonl)
  1281. AC_CACHE_VAL(ac_cv_htonl_works,
  1282. [AC_LINK_IFELSE([AC_LANG_PROGRAM([QUAGGA_INCLUDES],[htonl (0);])],
  1283. [ac_cv_htonl_works=yes], [ac_cv_htonl_works=no])
  1284. ]
  1285. )
  1286. AC_MSG_RESULT($ac_cv_htonl_works)
  1287. AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile
  1288. ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
  1289. ospf6d/Makefile isisd/Makefile vtysh/Makefile doc/Makefile
  1290. ospfclient/Makefile tests/Makefile m4/Makefile redhat/Makefile
  1291. pkgsrc/Makefile
  1292. redhat/quagga.spec
  1293. lib/version.h
  1294. doc/defines.texi
  1295. isisd/topology/Makefile
  1296. pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
  1297. pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
  1298. AC_CONFIG_FILES([solaris/Makefile])
  1299. AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
  1300. ## Hack, but working solution to avoid rebuilding of quagga.info.
  1301. ## It's already in CVS until texinfo 4.7 is more common.
  1302. AC_OUTPUT
  1303. echo "
  1304. Quagga configuration
  1305. --------------------
  1306. quagga version : ${PACKAGE_VERSION}
  1307. host operationg system : ${host_os}
  1308. source code location : ${srcdir}
  1309. compiler : ${CC}
  1310. compiler flags : ${CFLAGS}
  1311. make : ${MAKE-make}
  1312. includes : ${INCLUDES} ${SNMP_INCLUDES}
  1313. linker flags : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM}
  1314. state file directory : ${quagga_statedir}
  1315. config file directory : `eval echo \`echo ${sysconfdir}\``
  1316. example directory : `eval echo \`echo ${exampledir}\``
  1317. user to run as : ${enable_user}
  1318. group to run as : ${enable_group}
  1319. group for vty sockets : ${enable_vty_group}
  1320. config file mask : ${enable_configfile_mask}
  1321. log file mask : ${enable_logfile_mask}
  1322. The above user and group must have read/write access to the state file
  1323. directory and to the config files in the config file directory."
  1324. if test x"$quagga_cv_gnu_make" = x"no"; then echo "
  1325. Warning: The ${MAKE-make} programme detected, either in your path or
  1326. via the MAKE variable, is not GNU Make. GNU make may be installed as
  1327. gmake on some systems. and is required to complete a build of Quagga
  1328. " > /dev/stderr
  1329. fi