configure.ac 52 KB

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