configure.ac 55 KB

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