configure.ac 49 KB

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