configure.ac 51 KB

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