configure.ac 42 KB

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