configure.ac 50 KB

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