configure.ac 51 KB

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