configure.ac 49 KB

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