configure.ac 52 KB

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