configure.ac 49 KB

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