configure.ac 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166
  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.62 2004/08/31 18:16:36 gdt Exp $
  9. AC_PREREQ(2.53)
  10. AC_INIT(quagga, 0.96.5, [http://bugzilla.quagga.net])
  11. AC_CONFIG_SRCDIR(lib/zebra.h)
  12. AM_INIT_AUTOMAKE(1.6)
  13. AM_CONFIG_HEADER(config.h)
  14. dnl default is to match previous behavior
  15. exampledir=${sysconfdir}
  16. AC_ARG_ENABLE([exampledir],
  17. AC_HELP_STRING([--enable-exampledir],
  18. [specify alternate directory for examples]),
  19. exampledir="$enableval",)
  20. dnl XXX add --exampledir to autoconf standard directory list somehow
  21. AC_SUBST(exampledir)
  22. dnl default is to match previous behavior
  23. pkgsrcrcdir=""
  24. pkgsrcdir=""
  25. AC_ARG_ENABLE([pkgsrcrcdir],
  26. AC_HELP_STRING([--enable-pkgsrcrcdir],
  27. [specify directory for rc.d scripts]),
  28. pkgsrcrcdir="$enableval"; pkgsrcdir="pkgsrc",)
  29. dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
  30. AC_SUBST(pkgsrcdir)
  31. AC_SUBST(pkgsrcrcdir)
  32. dnl -----------------------------------
  33. dnl Get hostname and other information.
  34. dnl -----------------------------------
  35. AC_CANONICAL_HOST
  36. dnl ------------
  37. dnl Check CFLAGS
  38. dnl ------------
  39. AC_ARG_WITH(cflags,
  40. [ --with-cflags Set CFLAGS for use in compilation.])
  41. if test "x$with_cflags" != "x" ; then
  42. CFLAGS="$with_cflags" ; cflags_specified=yes ;
  43. elif test -n "$CFLAGS" ; then
  44. cflags_specified=yes ;
  45. fi
  46. dnl --------
  47. dnl Check CC
  48. dnl --------
  49. AC_PROG_CC
  50. dnl -----------------------------------------
  51. dnl If CLFAGS doesn\'t exist set default value
  52. dnl -----------------------------------------
  53. dnl (Wall is gcc specific... have to make sure
  54. dnl gcc is being used before setting it)
  55. dnl
  56. if test "x$cflags_specified" = "x" ; then
  57. CFLAGS="$CFLAGS -O"
  58. fi
  59. dnl --------------
  60. dnl Check programs
  61. dnl --------------
  62. AC_PROG_CPP
  63. AC_PROG_INSTALL
  64. AC_PROG_MAKE_SET
  65. AC_CHECK_TOOL(AR, ar)
  66. AC_CHECK_TOOL(RANLIB, ranlib, :)
  67. dnl ---------
  68. dnl AIX check
  69. dnl ---------
  70. AC_AIX
  71. dnl -------
  72. dnl libtool
  73. dnl -------
  74. AC_PROG_LIBTOOL
  75. dnl ----------------------
  76. dnl Packages configuration
  77. dnl ----------------------
  78. AC_ARG_ENABLE(vtysh,
  79. [ --enable-vtysh include integrated vty shell for Quagga])
  80. AC_ARG_ENABLE(ipv6,
  81. [ --disable-ipv6 turn off IPv6 related features and daemons])
  82. AC_ARG_ENABLE(zebra,
  83. [ --disable-zebra do not build zebra daemon])
  84. AC_ARG_ENABLE(bgpd,
  85. [ --disable-bgpd do not build bgpd])
  86. AC_ARG_ENABLE(ripd,
  87. [ --disable-ripd do not build ripd])
  88. AC_ARG_ENABLE(ripngd,
  89. [ --disable-ripngd do not build ripngd])
  90. AC_ARG_ENABLE(ospfd,
  91. [ --disable-ospfd do not build ospfd])
  92. AC_ARG_ENABLE(ospf6d,
  93. [ --disable-ospf6d do not build ospf6d])
  94. AC_ARG_ENABLE(isisd,
  95. [ --disable-isisd do not build isisd])
  96. AC_ARG_ENABLE(bgp-announce,
  97. [ --disable-bgp-announce, turn off BGP route announcement])
  98. AC_ARG_ENABLE(netlink,
  99. [ --enable-netlink force to use Linux netlink interface])
  100. AC_ARG_ENABLE(broken-aliases,
  101. [ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
  102. AC_ARG_ENABLE(snmp,
  103. [ --enable-snmp enable SNMP support])
  104. AC_ARG_WITH(libpam,
  105. [ --with-libpam use libpam for PAM support in vtysh])
  106. AC_ARG_ENABLE(tcp-zebra,
  107. [ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon])
  108. AC_ARG_ENABLE(opaque-lsa,
  109. [ --enable-opaque-lsa enable OSPF Opaque-LSA with OSPFAPI support (RFC2370)])
  110. AC_ARG_ENABLE(ospfapi,
  111. [ --disable-ospfapi do not build OSPFAPI to access the OSPF LSA Database,
  112. (this is the default if --enable-opaque-lsa is not set)])
  113. AC_ARG_ENABLE(ospfclient,
  114. [ --disable-ospfclient do not build OSPFAPI client for OSPFAPI,
  115. (this is the default if --disable-ospfapi is set)])
  116. AC_ARG_ENABLE(ospf-te,
  117. [ --enable-ospf-te enable Traffic Engineering Extension to OSPF])
  118. AC_ARG_ENABLE(multipath,
  119. [ --enable-multipath=ARG enable multipath function, ARG must be digit])
  120. AC_ARG_ENABLE(quagga_user,
  121. [ --enable-user=ARG user to run Quagga suite as (default quagga)])
  122. AC_ARG_ENABLE(quagga_group,
  123. [ --enable-group=ARG group to run Quagga suite as (default quagga)])
  124. AC_ARG_ENABLE(vty_group,
  125. [ --enable-vty-group=ARG set vty sockets to have specified group as owner])
  126. AC_ARG_ENABLE(configfile_mask,
  127. [ --enable-configfile-mask=ARG set mask for config files])
  128. AC_ARG_ENABLE(logfile_mask,
  129. [ --enable-logfile-mask=ARG set mask for log files])
  130. AC_ARG_ENABLE(rtadv,
  131. [ --disable-rtadv disable IPV6 router advertisement feature])
  132. AC_ARG_ENABLE(irdp,
  133. [ --enable-irdp enable IRDP server support in zebra])
  134. AC_ARG_ENABLE(capabilities,
  135. [ --disable-capabilities disable using POSIX capabilities])
  136. if test "${enable_broken_aliases}" = "yes"; then
  137. if test "${enable_netlink}" = "yes"
  138. then
  139. echo "Sorry, you can't use netlink with broken aliases"
  140. exit 1
  141. fi
  142. AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
  143. enable_netlink=no
  144. fi
  145. if test "${enable_tcp_zebra}" = "yes"; then
  146. AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
  147. fi
  148. if test "${enable_opaque_lsa}" = "yes"; then
  149. AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
  150. fi
  151. if test "${enable_ospf_te}" = "yes"; then
  152. AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
  153. AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
  154. fi
  155. AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
  156. if test "${enable_rtadv}" != "no"; then
  157. AC_MSG_RESULT(yes)
  158. AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
  159. else
  160. AC_MSG_RESULT(no)
  161. fi
  162. if test "${enable_irdp}" = "yes"; then
  163. AC_DEFINE(HAVE_IRDP,, IRDP )
  164. fi
  165. if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
  166. enable_user="quagga"
  167. elif test "${enable_user}" = "no"; then
  168. enable_user="root"
  169. fi
  170. AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
  171. if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
  172. enable_group="quagga"
  173. elif test "${enable_group}" = "no"; then
  174. enable_group="root"
  175. fi
  176. AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
  177. if test x"${enable_vty_group}" = x"yes" ; then
  178. AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
  179. elif test x"${enable_vty_group}" != x""; then
  180. if test x"${enable_vty_group}" != x"no"; then
  181. AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
  182. fi
  183. fi
  184. enable_configfile_mask=${enable_configfile_mask:-0600}
  185. AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
  186. enable_logfile_mask=${enable_logfile_mask:-0600}
  187. AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
  188. changequote(, )dnl
  189. MULTIPATH_NUM=1
  190. case "${enable_multipath}" in
  191. [0-9]|[1-9][0-9])
  192. MULTIPATH_NUM="${enable_multipath}"
  193. ;;
  194. "")
  195. ;;
  196. *)
  197. echo "Please specify digit to --enable-multipath ARG."
  198. exit 1
  199. ;;
  200. esac
  201. changequote([, ])dnl
  202. AC_SUBST(MULTIPATH_NUM)
  203. dnl -------------------
  204. dnl Check header files.
  205. dnl -------------------
  206. AC_HEADER_STDC
  207. AC_CHECK_HEADERS([string.h stropts.h sys/conf.h sys/ksym.h sys/time.h \
  208. sys/times.h sys/select.h sys/sysctl.h sys/sockio.h \
  209. sys/types.h linux/version.h kvm.h netdb.h asm/types.h \
  210. libutil.h limits.h])
  211. AC_CHECK_HEADERS([sys/socket.h netinet/in_systm.h netinet/in.h \
  212. net/if_dl.h net/netopt.h inet/nd.h net/route.h \
  213. net/if.h net/if_var.h netinet/in_var.h])
  214. dnl V6 headers are checked below, after we check for v6
  215. dnl check some types
  216. AC_C_CONST
  217. dnl AC_TYPE_PID_T
  218. AC_TYPE_SIGNAL
  219. dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
  220. case "$host" in
  221. [*-sunos5.[6-8]*] | [*-solaris2.[6-8]*])
  222. opsys=sol2-6
  223. AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.8)
  224. AC_DEFINE(SUNOS_5, 1, SunOS 5)
  225. AC_CHECK_LIB(xnet, main)
  226. CURSES=-lcurses
  227. ;;
  228. [*-sunos5.[8-9]] | [*-sunos5.1[0-9]] \
  229. | [*-solaris2.[8-9]] | [*-solaris2.1[0-9]])
  230. opsys=sol9
  231. AC_DEFINE(SUNOS_59,,SunOS 5.9 up)
  232. AC_DEFINE(SUNOS_5, 1, SunOS 5)
  233. AC_CHECK_LIB(socket, main)
  234. AC_CHECK_LIB(nsl, main)
  235. CURSES=-lcurses
  236. ;;
  237. *-sunos5* | *-solaris2*)
  238. AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
  239. AC_CHECK_LIB(socket, main)
  240. AC_CHECK_LIB(nsl, main)
  241. CURSES=-lcurses
  242. ;;
  243. *-linux-*)
  244. opsys=gnu-linux
  245. AC_DEFINE(GNU_LINUX,,GNU Linux)
  246. ;;
  247. *-nec-sysv4*)
  248. AC_CHECK_LIB(nsl, gethostbyname)
  249. AC_CHECK_LIB(socket, socket)
  250. ;;
  251. *-freebsd3.2)
  252. AC_DEFINE(FREEBSD_32,,FreeBSD 3.2)
  253. ;;
  254. *-openbsd*)
  255. opsys=openbsd
  256. AC_DEFINE(OPEN_BSD,,OpenBSD)
  257. ;;
  258. *-bsdi*)
  259. opsys=bsdi
  260. OTHER_METHOD="mtu_kvm.o"
  261. AC_CHECK_LIB(kvm, main)
  262. ;;
  263. *-irix6.5)
  264. opsys=irix
  265. AC_DEFINE(IRIX_65,,IRIX 6.5)
  266. ;;
  267. esac
  268. dnl ---------------------
  269. dnl Integrated VTY option
  270. dnl ---------------------
  271. case "${enable_vtysh}" in
  272. "yes") VTYSH="vtysh";
  273. AC_DEFINE(VTYSH,,VTY shell)
  274. AC_PATH_PROG(PERL, perl)
  275. dnl Vtysh uses libreadline, which looks for termcap functions at
  276. dnl configure time. We follow readline's search order.
  277. dnl The required procedures are in libtermcap on NetBSD, in
  278. dnl [TODO] on Linux, and in [TODO] on Solaris.
  279. AC_CHECK_LIB(termcap, tputs, ,
  280. AC_CHECK_LIB(tinfo, tputs, ,
  281. AC_CHECK_LIB(curses, tputs, ,
  282. AC_CHECK_LIB(ncurses, tputs))))
  283. AC_CHECK_LIB(readline, main)
  284. if test $ac_cv_lib_readline_main = no; then
  285. AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
  286. fi
  287. AC_CHECK_HEADER(readline/history.h)
  288. if test $ac_cv_header_readline_history_h = no;then
  289. AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
  290. fi
  291. AC_CHECK_LIB(readline, rl_completion_matches)
  292. if test $ac_cv_lib_readline_rl_completion_matches = no; then
  293. AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
  294. fi
  295. ;;
  296. "no" ) VTYSH="";;
  297. * ) ;;
  298. esac
  299. dnl ----------
  300. dnl PAM module
  301. dnl ----------
  302. if test "$with_libpam" = "yes"; then
  303. AC_CHECK_HEADER(security/pam_misc.h)
  304. if test "$ac_cv_header_security_pam_misc_h" = yes; then
  305. AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
  306. AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
  307. pam_conv_func="misc_conv"
  308. fi
  309. AC_CHECK_HEADER(security/openpam.h)
  310. if test "$ac_cv_header_security_openpam_h" = yes; then
  311. AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
  312. AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
  313. pam_conv_func="openpam_ttyconv"
  314. fi
  315. if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
  316. AC_MSG_WARN([*** pam support will not be built ***])
  317. with_libpam="no"
  318. fi
  319. fi
  320. if test "$with_libpam" = "yes"; then
  321. dnl took this test from proftpd's configure.in and suited to our needs
  322. dnl -------------------------------------------------------------------------
  323. dnl
  324. dnl This next check looks funky due to a linker problem with some versions
  325. dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
  326. dnl omitted requiring libdl linking information. PAM-0.72 or better ships
  327. dnl with RedHat 6.2 and Debian 2.2 or better.
  328. AC_CHECK_LIB(pam, pam_start,
  329. [AC_CHECK_LIB(pam, $pam_conv_func,
  330. [AC_DEFINE(USE_PAM,,Use PAM for authentication)
  331. LIBPAM="-lpam"],
  332. [AC_DEFINE(USE_PAM,,Use PAM for authentication)
  333. LIBPAM="-lpam -lpam_misc"]
  334. )
  335. ],
  336. [AC_CHECK_LIB(pam, pam_end,
  337. [AC_CHECK_LIB(pam, $pam_conv_func,
  338. [AC_DEFINE(USE_PAM,,Use PAM for authentication)
  339. LIBPAM="-lpam -ldl"],
  340. [AC_DEFINE(USE_PAM,,Use PAM for authentication)
  341. LIBPAM="-lpam -ldl -lpam_misc"]
  342. )
  343. ],AC_MSG_WARN([*** pam support will not be built ***]),
  344. [-ldl])
  345. ]
  346. )
  347. fi
  348. AC_SUBST(LIBPAM)
  349. dnl -------------------------------
  350. dnl Endian-ness check
  351. dnl -------------------------------
  352. AC_WORDS_BIGENDIAN
  353. dnl -------------------------------
  354. dnl check the size in byte of the C
  355. dnl -------------------------------
  356. dnl AC_CHECK_SIZEOF(char)
  357. dnl AC_CHECK_SIZEOF(int)
  358. dnl AC_CHECK_SIZEOF(short)
  359. dnl AC_CHECK_SIZEOF(long)
  360. dnl ----------------------------
  361. dnl check existance of functions
  362. dnl ----------------------------
  363. AC_CHECK_FUNCS(memset memcpy strerror inet_aton daemon snprintf vsnprintf \
  364. strlcat strlcpy if_nametoindex if_indextoname getifaddrs \
  365. fcntl)
  366. AC_CHECK_FUNCS(setproctitle, ,
  367. [AC_CHECK_LIB(util, setproctitle,
  368. [LIBS="$LIBS -lutil"
  369. AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
  370. ]
  371. )
  372. ]
  373. )
  374. dnl ------------------------------------
  375. dnl Determine routing get and set method
  376. dnl ------------------------------------
  377. AC_MSG_CHECKING(zebra between kernel interface method)
  378. if test x"$opsys" = x"gnu-linux"; then
  379. if test "${enable_netlink}" = "yes";then
  380. AC_MSG_RESULT(netlink)
  381. RT_METHOD=rt_netlink.o
  382. AC_DEFINE(HAVE_NETLINK,,netlink)
  383. netlink=yes
  384. elif test "${enable_netlink}" = "no"; then
  385. AC_MSG_RESULT(ioctl)
  386. RT_METHOD=rt_ioctl.o
  387. netlink=no
  388. else
  389. AC_MSG_RESULT(netlink)
  390. RT_METHOD=rt_netlink.o
  391. AC_DEFINE(HAVE_NETLINK,,netlink)
  392. netlink=yes
  393. fi
  394. elif test x"$opsys" = x"sol2-6";then
  395. AC_MSG_RESULT(Route socket)
  396. KERNEL_METHOD="kernel_socket.o"
  397. RT_METHOD="rt_socket.o"
  398. elif test x"$opsys" = x"sol9";then
  399. AC_MSG_RESULT(Route socket)
  400. KERNEL_METHOD="kernel_socket.o"
  401. RT_METHOD="rt_socket.o"
  402. elif test "$opsys" = "irix" ; then
  403. AC_MSG_RESULT(Route socket)
  404. KERNEL_METHOD="kernel_socket.o"
  405. RT_METHOD="rt_socket.o"
  406. else
  407. AC_TRY_RUN([#include <errno.h>
  408. #include <sys/types.h>
  409. #include <sys/socket.h>
  410. main ()
  411. {
  412. int ac_sock;
  413. ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
  414. if (ac_sock < 0 && errno == EINVAL)
  415. exit (1);
  416. exit (0);
  417. }],
  418. [KERNEL_METHOD=kernel_socket.o
  419. RT_METHOD=rt_socket.o
  420. AC_MSG_RESULT(socket)],
  421. [RT_METHOD=rt_ioctl.o
  422. AC_MSG_RESULT(ioctl)],
  423. [KERNEL_METHOD=kernel_socket.o
  424. RT_METHOD=rt_socket.o
  425. AC_MSG_RESULT(socket)])
  426. fi
  427. AC_SUBST(RT_METHOD)
  428. AC_SUBST(KERNEL_METHOD)
  429. AC_SUBST(OTHER_METHOD)
  430. dnl ------------------------------
  431. dnl check kernel route read method
  432. dnl ------------------------------
  433. AC_CACHE_CHECK(route read method check, zebra_rtread,
  434. [if test "$netlink" = yes; then
  435. RTREAD_METHOD="rtread_netlink.o"
  436. zebra_rtread="netlink"
  437. else
  438. for zebra_rtread in /proc/net/route /dev/ip /dev/null;
  439. do
  440. test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
  441. done
  442. case $zebra_rtread in
  443. "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
  444. zebra_rtread="proc";;
  445. "/dev/ip")
  446. case "$host" in
  447. *-freebsd*) RTREAD_METHOD=rtread_sysctl.o
  448. zebra_rtread="sysctl";;
  449. *) RTREAD_METHOD="rtread_getmsg.o"
  450. zebra_rtread="getmsg";;
  451. esac;;
  452. *) RTREAD_METHOD="rtread_sysctl.o"
  453. zebra_rtread="sysctl";;
  454. esac
  455. fi])
  456. AC_SUBST(RTREAD_METHOD)
  457. dnl -----------------------------
  458. dnl check interface lookup method
  459. dnl -----------------------------
  460. IOCTL_METHOD=ioctl.o
  461. AC_MSG_CHECKING(interface looking up method)
  462. if test "$netlink" = yes; then
  463. AC_MSG_RESULT(netlink)
  464. IF_METHOD=if_netlink.o
  465. elif test "$opsys" = "sol2-6";then
  466. AC_MSG_RESULT(Solaris GIF)
  467. IF_METHOD=if_ioctl.o
  468. elif test "$opsys" = "sol9";then
  469. AC_MSG_RESULT(Solaris GLIF)
  470. IF_METHOD=if_ioctl_solaris.o
  471. IOCTL_METHOD=ioctl_solaris.o
  472. elif test "$opsys" = "irix" ; then
  473. AC_MSG_RESULT(IRIX)
  474. IF_METHOD=if_ioctl.o
  475. elif test "$opsys" = "openbsd";then
  476. AC_MSG_RESULT(openbsd)
  477. IF_METHOD=if_ioctl.o
  478. elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
  479. AC_MSG_RESULT(sysctl)
  480. IF_METHOD=if_sysctl.o
  481. AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
  482. else
  483. AC_MSG_RESULT(ioctl)
  484. IF_METHOD=if_ioctl.o
  485. fi
  486. AC_SUBST(IF_METHOD)
  487. AC_SUBST(IOCTL_METHOD)
  488. dnl -----------------------
  489. dnl check proc file system.
  490. dnl -----------------------
  491. if test -r /proc/net/dev; then
  492. AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
  493. IF_PROC=if_proc.o
  494. fi
  495. if test -r /proc/net/if_inet6; then
  496. AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
  497. IF_PROC=if_proc.o
  498. fi
  499. AC_SUBST(IF_PROC)
  500. dnl -----------------------------
  501. dnl check ipforward detect method
  502. dnl -----------------------------
  503. AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
  504. [for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
  505. do
  506. test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
  507. done
  508. case $zebra_ipforward_path in
  509. "/proc/net/snmp") IPFORWARD=ipforward_proc.o
  510. zebra_ipforward_path="proc";;
  511. "/dev/ip")
  512. case "$host" in
  513. *-nec-sysv4*) IPFORWARD=ipforward_ews.o
  514. zebra_ipforward_path="ews";;
  515. *-freebsd*) IPFORWARD=ipforward_sysctl.o
  516. zebra_ipforward_path="sysctl";;
  517. *) IPFORWARD=ipforward_solaris.o
  518. zebra_ipforward_path="solaris";;
  519. esac;;
  520. *) IPFORWARD=ipforward_sysctl.o
  521. zebra_ipforward_path="sysctl";;
  522. esac])
  523. AC_SUBST(IPFORWARD)
  524. AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
  525. dnl ----------
  526. dnl IPv6 check
  527. dnl ----------
  528. AC_MSG_CHECKING(whether does this OS have IPv6 stack)
  529. if test "${enable_ipv6}" = "no"; then
  530. AC_MSG_RESULT(disabled)
  531. else
  532. dnl ----------
  533. dnl INRIA IPv6
  534. dnl ----------
  535. if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
  536. zebra_cv_ipv6=yes
  537. AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
  538. AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
  539. RIPNGD="ripngd"
  540. OSPF6D="ospf6d"
  541. LIB_IPV6=""
  542. AC_MSG_RESULT(INRIA IPv6)
  543. dnl ---------
  544. dnl KAME IPv6
  545. dnl ---------
  546. elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
  547. zebra_cv_ipv6=yes
  548. AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
  549. AC_DEFINE(KAME,1,KAME IPv6)
  550. RIPNGD="ripngd"
  551. OSPF6D="ospf6d"
  552. if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
  553. LIB_IPV6="-L/usr/local/v6/lib -linet6"
  554. fi
  555. AC_MSG_RESULT(KAME)
  556. dnl -------------------------
  557. dnl MUSICA IPv6
  558. dnl default host check
  559. dnl It is not used by Kheops
  560. dnl -------------------------
  561. elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
  562. zebra_cv_ipv6=yes
  563. AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
  564. AC_DEFINE(MUSICA,1,Musica IPv6 stack)
  565. AC_DEFINE(KAME,1,KAME IPv6 stack)
  566. RIPNGD="ripngd"
  567. OSPF6D="ospf6d"
  568. if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
  569. LIB_IPV6="-L/usr/local/v6/lib -linet6"
  570. fi
  571. AC_MSG_RESULT(MUSICA)
  572. dnl ---------
  573. dnl NRL check
  574. dnl ---------
  575. elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
  576. zebra_cv_ipv6=yes
  577. AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
  578. AC_DEFINE(NRL,1,NRL)
  579. RIPNGD="ripngd"
  580. OSPF6D="ospf6d"
  581. if test x"$opsys" = x"bsdi";then
  582. AC_DEFINE(BSDI_NRL,,BSDI)
  583. AC_MSG_RESULT(BSDI_NRL)
  584. else
  585. AC_MSG_RESULT(NRL)
  586. fi
  587. dnl ------------------------------------
  588. dnl Solaris 9, 10 and potentially higher
  589. dnl ------------------------------------
  590. elif test x"$opsys" = x"sol9"; then
  591. zebra_cv_ipv6=yes;
  592. AC_DEFINE(HAVE_IPV6, 1, IPv6)
  593. AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
  594. RIPNGD="ripngd"
  595. OSPF6D="ospf6d"
  596. AC_MSG_RESULT(Solaris IPv6)
  597. dnl ----------
  598. dnl Linux IPv6
  599. dnl ----------
  600. elif test "${enable_ipv6}" = "yes"; then
  601. AC_EGREP_CPP(yes, [
  602. #include <linux/version.h>
  603. /* 2.1.128 or later */
  604. #if LINUX_VERSION_CODE >= 0x020180
  605. yes
  606. #endif],
  607. [zebra_cv_ipv6=yes
  608. zebra_cv_linux_ipv6=yes
  609. AC_MSG_RESULT(Linux IPv6)])
  610. else
  611. if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
  612. then
  613. zebra_cv_ipv6=yes
  614. zebra_cv_linux_ipv6=yes
  615. AC_MSG_RESULT(Linux IPv6)
  616. fi
  617. fi
  618. if test "$zebra_cv_linux_ipv6" = "yes";then
  619. AC_MSG_CHECKING(for GNU libc >= 2.1)
  620. AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
  621. AC_EGREP_CPP(yes, [
  622. #include <features.h>
  623. #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
  624. yes
  625. #endif],
  626. [glibc=yes
  627. AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
  628. AC_MSG_RESULT(yes)],
  629. AC_MSG_RESULT(no)
  630. )
  631. RIPNGD="ripngd"
  632. OSPF6D="ospf6d"
  633. if test "$glibc" != "yes"; then
  634. INCLUDES="-I/usr/inet6/include"
  635. if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
  636. LIB_IPV6="-L/usr/inet6/lib -linet6"
  637. fi
  638. fi
  639. fi
  640. dnl -----------------------
  641. dnl Set IPv6 related values
  642. dnl -----------------------
  643. LIBS="$LIB_IPV6 $LIBS"
  644. AC_SUBST(LIB_IPV6)
  645. if test x"$RIPNGD" = x""; then
  646. AC_MSG_RESULT(IPv4 only)
  647. fi
  648. fi
  649. dnl ------------------
  650. dnl IPv6 header checks
  651. dnl ------------------
  652. if test "x${zebra_cv_ipv6}" = "xyes"; then
  653. AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
  654. netinet6/in6_var.h netinet6/nd6.h])
  655. fi
  656. dnl --------------------
  657. dnl Daemon disable check
  658. dnl --------------------
  659. if test "${enable_zebra}" = "no";then
  660. ZEBRA=""
  661. else
  662. ZEBRA="zebra"
  663. fi
  664. if test "${enable_bgpd}" = "no";then
  665. BGPD=""
  666. else
  667. BGPD="bgpd"
  668. fi
  669. if test "${enable_ripd}" = "no";then
  670. RIPD=""
  671. else
  672. RIPD="ripd"
  673. fi
  674. if test "${enable_ospfd}" = "no";then
  675. OSPFD=""
  676. else
  677. OSPFD="ospfd"
  678. fi
  679. OSPFCLIENT=""
  680. if test "${enable_opaque_lsa}" = "yes"; then
  681. if test "${enable_ospfapi}" != "no";then
  682. AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
  683. if test "${enable_ospfclient}" != "no";then
  684. OSPFCLIENT="ospfclient"
  685. fi
  686. fi
  687. fi
  688. case "${enable_ripngd}" in
  689. "yes") RIPNGD="ripngd";;
  690. "no" ) RIPNGD="";;
  691. * ) ;;
  692. esac
  693. case "${enable_ospf6d}" in
  694. "yes") OSPF6D="ospf6d";;
  695. "no" ) OSPF6D="";;
  696. * ) ;;
  697. esac
  698. case "${enable_isisd}" in
  699. "yes") ISISD="isisd";;
  700. "no" ) ISISD="";;
  701. * ) ISISD="isisd";;
  702. esac
  703. if test "${enable_bgp_announce}" = "no";then
  704. AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
  705. fi
  706. AC_SUBST(ZEBRA)
  707. AC_SUBST(BGPD)
  708. AC_SUBST(RIPD)
  709. AC_SUBST(RIPNGD)
  710. AC_SUBST(OSPFD)
  711. AC_SUBST(OSPF6D)
  712. AC_SUBST(ISISD)
  713. AC_SUBST(VTYSH)
  714. AC_SUBST(INCLUDES)
  715. AC_SUBST(CURSES)
  716. AC_SUBST(OSPFCLIENT)
  717. AC_SUBST(OSPFAPI)
  718. AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
  719. AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
  720. AC_CHECK_LIB(crypt, crypt)
  721. AC_CHECK_LIB(resolv, res_init)
  722. AC_CHECK_LIB(m, main)
  723. dnl ---------------------------------------------------
  724. dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
  725. dnl ---------------------------------------------------
  726. AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
  727. AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
  728. AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
  729. dnl ---------------------------
  730. dnl check system has GNU regexp
  731. dnl ---------------------------
  732. dnl AC_MSG_CHECKING(whether system has GNU regex)
  733. AC_CHECK_LIB(c, regexec,
  734. [AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
  735. LIB_REGEX=""],
  736. [LIB_REGEX="regex.o"])
  737. AC_SUBST(LIB_REGEX)
  738. dnl ------------------
  739. dnl check SNMP library
  740. dnl ------------------
  741. if test "${enable_snmp}" = "yes";then
  742. dnl AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
  743. if test "${HAVE_SNMP}" = ""; then
  744. old_libs="${LIBS}"
  745. LIBS="-L/usr/lib"
  746. unset ac_cv_lib_snmp_asn_parse_int
  747. AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
  748. if test "${NEED_CRYPTO}" = ""; then
  749. AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes ])
  750. else
  751. AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes; NEED_CRYPTO=yes;LIBS="$LIBS -lcrypto" ],,"-lcrypto")
  752. fi
  753. LIBS="${old_libs}"
  754. fi
  755. if test "${HAVE_SNMP}" = ""; then
  756. old_libs="${LIBS}"
  757. LIBS="-L/usr/lib"
  758. unset ac_cv_lib_snmp_asn_parse_int
  759. AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes, )
  760. if test "${HAVE_SNMP}" = ""; then
  761. unset ac_cv_lib_snmp_asn_parse_int
  762. AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
  763. if test "${NEED_CRYPTO}" = "yes"; then
  764. AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
  765. fi
  766. fi
  767. LIBS="${old_libs}"
  768. fi
  769. if test "${HAVE_SNMP}" = ""; then
  770. old_libs="${LIBS}"
  771. LIBS="-L/usr/local/lib"
  772. unset ac_cv_lib_snmp_asn_parse_int
  773. AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
  774. if test "${HAVE_SNMP}" = ""; then
  775. unset ac_cv_lib_snmp_asn_parse_int
  776. AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
  777. if test "${NEED_CRYPTO}" = "yes"; then
  778. AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
  779. fi
  780. fi
  781. LIBS="${old_libs}"
  782. fi
  783. if test "${HAVE_SNMP}" = "yes"; then
  784. 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
  785. do
  786. test -f "${ac_snmp}" && break
  787. done
  788. case ${ac_snmp} in
  789. /usr/include/net-snmp/*)
  790. AC_DEFINE(HAVE_SNMP,,SNMP)
  791. AC_DEFINE(HAVE_NETSNMP,,SNMP)
  792. AC_DEFINE(UCD_COMPATIBLE,,SNMP)
  793. CFLAGS="${CFLAGS} -I/usr/include/net-snmp -I/usr/include/net-snmp/library"
  794. if test "${HAVE_NETSNMP}" = "yes"; then
  795. LIBS="${LIBS} -lnetsnmp"
  796. else
  797. LIBS="${LIBS} -lsnmp"
  798. fi
  799. ;;
  800. /usr/include/ucd-snmp/*)
  801. AC_DEFINE(HAVE_SNMP,,SNMP)
  802. CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp"
  803. LIBS="${LIBS} -lsnmp"
  804. ;;
  805. /usr/local/include/ucd-snmp/*)
  806. AC_DEFINE(HAVE_SNMP,,SNMP)
  807. CFLAGS="${CFLAGS} -I/usr/local/include/ucd-snmp"
  808. LIBS="${LIBS} -L/usr/local/lib -lsnmp"
  809. ;;
  810. /usr/local/include/net-snmp/*)
  811. AC_DEFINE(HAVE_SNMP,,SNMP)
  812. AC_DEFINE(HAVE_NET_SNMP,,SNMP)
  813. AC_DEFINE(UCD_COMPATIBLE,,SNMP)
  814. CFLAGS="${CFLAGS} -I/usr/local/include/net-snmp"
  815. LIBS="${LIBS} -L/usr/local/lib -lnetsnmp"
  816. ;;
  817. esac
  818. if test "${NEED_CRYPTO}" = "yes"; then
  819. LIBS="${LIBS} -lcrypto"
  820. fi
  821. fi
  822. fi
  823. dnl ----------------------------
  824. dnl check sa_len of sockaddr
  825. dnl ----------------------------
  826. AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
  827. AC_TRY_COMPILE([#include <sys/types.h>
  828. #include <sys/socket.h>
  829. ],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
  830. [AC_MSG_RESULT(yes)
  831. AC_DEFINE(HAVE_SA_LEN,,sa_len)],
  832. AC_MSG_RESULT(no))
  833. dnl ----------------------------
  834. dnl check sin_len of sockaddr_in
  835. dnl ----------------------------
  836. AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
  837. AC_TRY_COMPILE([#include <sys/types.h>
  838. #include <netinet/in.h>
  839. ],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
  840. [AC_MSG_RESULT(yes)
  841. AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
  842. AC_MSG_RESULT(no))
  843. dnl ----------------------------
  844. dnl check sun_len of sockaddr_un
  845. dnl ----------------------------
  846. AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
  847. AC_TRY_COMPILE([#include <sys/types.h>
  848. #include <sys/un.h>
  849. ],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
  850. [AC_MSG_RESULT(yes)
  851. AC_DEFINE(HAVE_SUN_LEN,,sun_len)],
  852. AC_MSG_RESULT(no))
  853. dnl -----------------------------------
  854. dnl check sin6_scope_id of sockaddr_in6
  855. dnl -----------------------------------
  856. if test "$zebra_cv_ipv6" = yes; then
  857. AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
  858. AC_TRY_COMPILE([#include <sys/types.h>
  859. #include <netinet/in.h>
  860. ],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
  861. [AC_MSG_RESULT(yes)
  862. AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)],
  863. AC_MSG_RESULT(no))
  864. fi
  865. dnl ----------------------------
  866. dnl check socklen_t exist or not
  867. dnl ----------------------------
  868. AC_MSG_CHECKING(whther socklen_t is defined)
  869. AC_TRY_COMPILE([#include <sys/types.h>
  870. #include <sys/socket.h>
  871. #include <netinet/in.h>
  872. ],[socklen_t ac_x;],
  873. [AC_MSG_RESULT(yes)
  874. AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)],
  875. AC_MSG_RESULT(no))
  876. dnl ------------------------
  877. dnl check struct sockaddr_dl
  878. dnl ------------------------
  879. AC_MSG_CHECKING(whether struct sockaddr_dl exist)
  880. AC_EGREP_HEADER(sockaddr_dl,
  881. net/if_dl.h,
  882. [AC_MSG_RESULT(yes)
  883. AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)],
  884. AC_MSG_RESULT(no))
  885. dnl --------------------------
  886. dnl check structure ifaliasreq
  887. dnl --------------------------
  888. AC_MSG_CHECKING(whether struct ifaliasreq exist)
  889. AC_EGREP_HEADER(ifaliasreq,
  890. net/if.h,
  891. [AC_MSG_RESULT(yes)
  892. AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)],
  893. AC_MSG_RESULT(no))
  894. dnl ----------------------------
  895. dnl check structure in6_aliasreq
  896. dnl ----------------------------
  897. AC_MSG_CHECKING(whether struct in6_aliasreq exist)
  898. AC_EGREP_HEADER(in6_aliasreq,
  899. netinet6/in6_var.h,
  900. [AC_MSG_RESULT(yes)
  901. AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
  902. AC_MSG_RESULT(no))
  903. dnl -----------------------------------
  904. dnl check ifra_lifetime of in6_aliasreq
  905. dnl -----------------------------------
  906. AC_MSG_CHECKING(whether in6_aliasreq.ifra_lifetime exist)
  907. AC_TRY_COMPILE([#include <sys/types.h>
  908. #include <netinet6/in6_var.h>
  909. ],[static struct if6_aliasreq ac_i;int ac_j = sizeof (ac_i.ifra_lifetime);],
  910. [AC_MSG_RESULT(yes)
  911. AC_DEFINE(HAVE_IFRA_LIFETIME,,Have in6_aliasreq.ifra_lifetime)],
  912. AC_MSG_RESULT(no))
  913. dnl ---------------------------
  914. dnl check structure rt_addrinfo
  915. dnl ---------------------------
  916. AC_MSG_CHECKING(whether struct rt_addrinfo exist)
  917. AC_EGREP_HEADER(rt_addrinfo,
  918. net/route.h,
  919. [AC_MSG_RESULT(yes)
  920. AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)],
  921. AC_MSG_RESULT(no))
  922. dnl --------------------------
  923. dnl check structure in_pktinfo
  924. dnl --------------------------
  925. AC_MSG_CHECKING(whether struct in_pktinfo exist)
  926. AC_TRY_COMPILE([#include <netinet/in.h>
  927. ],[struct in_pktinfo ac_x;],
  928. [AC_MSG_RESULT(yes)
  929. AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
  930. AC_MSG_RESULT(no))
  931. dnl --------------------------------------
  932. dnl checking for getrusage struct and call
  933. dnl --------------------------------------
  934. AC_MSG_CHECKING(whether getrusage is available)
  935. AC_TRY_COMPILE([#include <sys/resource.h>
  936. ],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
  937. [AC_MSG_RESULT(yes)
  938. AC_DEFINE(HAVE_RUSAGE,,rusage)],
  939. AC_MSG_RESULT(no))
  940. dnl -------------------
  941. dnl capabilities checks
  942. dnl -------------------
  943. if test "${enable_capabilities}" != "no"; then
  944. AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
  945. AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
  946. [AC_MSG_RESULT(yes)
  947. AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
  948. quagga_ac_keepcaps="yes"],
  949. AC_MSG_RESULT(no)
  950. )
  951. if test x"${quagga_ac_keepcaps}" = x"yes"; then
  952. AC_CHECK_HEADERS(sys/capability.h)
  953. fi
  954. if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
  955. AC_CHECK_LIB(cap, cap_init,
  956. [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
  957. LIBCAP="-lcap"
  958. ]
  959. )
  960. fi
  961. fi
  962. AC_SUBST(LIBCAP)
  963. dnl ---------------------------
  964. dnl check for glibc 'backtrace'
  965. dnl ---------------------------
  966. if test "${glibc}" = "yes"; then
  967. AC_CHECK_HEADER(execinfo.h)
  968. fi
  969. if test x"${ac_cv_header_execinfo_h}" = x"yes"; then
  970. AC_CHECK_FUNC(backtrace,
  971. [AC_DEFINE(HAVE_GLIBC_BACKTRACE,,Glibc backtrace)]
  972. )
  973. fi
  974. dnl ----------
  975. dnl configure date
  976. dnl ----------
  977. CONFDATE=`date '+%Y%m%d'`
  978. AC_SUBST(CONFDATE)
  979. dnl ------------------------------
  980. dnl set paths for state directory
  981. dnl ------------------------------
  982. if test "${prefix}" = "NONE"; then
  983. quagga_statedir_prefix="";
  984. else
  985. quagga_statedir_prefix=${prefix}
  986. fi
  987. if test "${localstatedir}" = '${prefix}/var'; then
  988. AC_CACHE_CHECK(state directory,ac_statedir,
  989. [for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
  990. ${quagga_statedir_prefix}/var/adm dnl
  991. ${quagga_statedir_prefix}/etc dnl
  992. /var/run dnl
  993. /var/adm dnl
  994. /etc dnl
  995. /dev/null;
  996. do
  997. test -d $QUAGGA_STATE_DIR && break
  998. done
  999. quagga_statedir=$QUAGGA_STATE_DIR])
  1000. else
  1001. quagga_statedir=${localstatedir}
  1002. AC_MSG_CHECKING(directory to use for state file)
  1003. AC_MSG_RESULT(${quagga_statedir})
  1004. fi
  1005. if test $quagga_statedir = "/dev/null"; then
  1006. AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
  1007. fi
  1008. AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
  1009. AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
  1010. AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
  1011. AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
  1012. AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
  1013. AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
  1014. AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
  1015. AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
  1016. AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
  1017. AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
  1018. AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
  1019. AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
  1020. AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
  1021. AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
  1022. AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
  1023. dnl ---------------------------
  1024. dnl Check htonl works correctly
  1025. dnl ---------------------------
  1026. AC_MSG_CHECKING(for working htonl)
  1027. AC_CACHE_VAL(ac_cv_htonl_works, [
  1028. AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
  1029. #include <sys/types.h>
  1030. #endif
  1031. #ifdef HAVE_NETDB_H
  1032. #include <netdb.h>
  1033. #endif
  1034. #ifdef HAVE_NETINET_IN_H
  1035. #include <netinet/in.h>
  1036. #endif],
  1037. [htonl (0);],
  1038. ac_cv_htonl_works=yes,
  1039. ac_cv_htonl_works=no)])
  1040. AC_MSG_RESULT($ac_cv_htonl_works)
  1041. AC_OUTPUT(Makefile lib/Makefile zebra/Makefile ripd/Makefile
  1042. ripngd/Makefile bgpd/Makefile ospfd/Makefile
  1043. ospf6d/Makefile isisd/Makefile vtysh/Makefile doc/Makefile
  1044. ospfclient/Makefile
  1045. vtysh/extract.pl
  1046. pkgsrc/Makefile
  1047. redhat/Makefile redhat/quagga.spec
  1048. lib/version.h
  1049. tests/Makefile
  1050. pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
  1051. pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh
  1052. ,
  1053. [chmod +x vtysh/extract.pl])
  1054. echo "
  1055. Quagga configuration
  1056. --------------------
  1057. quagga version : ${PACKAGE_VERSION}
  1058. host operationg system : ${host_os}
  1059. source code location : ${srcdir}
  1060. compiler : ${CC}
  1061. compiler flags : ${CFLAGS}
  1062. linker flags : ${LDFLAGS} ${LIBS}
  1063. state file directory : ${quagga_statedir}
  1064. config file directory : `eval echo \`echo ${sysconfdir}\``
  1065. example directory : `eval echo \`echo ${exampledir}\``
  1066. user to run as : ${enable_user}
  1067. group to run as : ${enable_group}
  1068. group for vty sockets : ${enable_vty_group}
  1069. config file mask : ${enable_configfile_mask}
  1070. log file mask : ${enable_logfile_mask}
  1071. The above user and group must have read/write access to the state file
  1072. directory and to the config files in the config file directory.
  1073. "