configure.ac 53 KB

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