configure.ac 48 KB

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