configure.ac 51 KB

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