configure.ac 42 KB

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