You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configure.ac 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. AC_PREREQ(2.59)
  2. AC_INIT(netsukuku, 0.0.9b)
  3. AM_INIT_AUTOMAKE(netsukuku, 0.0.9b)
  4. AC_DEFINE(VERSION, 0.0.9b)
  5. AM_CONFIG_HEADER(src/config.h)
  6. dnl -----------------------------------
  7. dnl Get hostname and other information.
  8. dnl -----------------------------------
  9. AC_CANONICAL_HOST
  10. AC_PROG_CC
  11. AC_PROG_CPP
  12. AC_PROG_CXX
  13. prefix=/usr
  14. datadir=/usr/share/netsukuku
  15. sysconfdir=/etc/netsukuku
  16. piddir=/var/run
  17. AC_ARG_WITH(gmp-include, AS_HELP_STRING([--with-gmp-include], \
  18. [gmp include dir]), [gmp="$withval"])
  19. AC_SUBST(gmp)
  20. AC_HEADER_STDC
  21. AC_CHECK_HEADERS([unistd.h])
  22. AC_CHECK_HEADERS([pthread.h], ,\
  23. [echo "============================ Unable to find pthread.h"; \
  24. echo "Do you have the libpthread library installed?" ])
  25. AC_CHECK_HEADERS([zlib.h], ,\
  26. [echo "============================ Unable to find zlib.h"; \
  27. echo "Do you have the zlib library installed?" ])
  28. AC_CHECK_HEADERS([openssl/crypto.h], ,\
  29. [echo "============================ Unable to find openssl/crypto.h";\
  30. echo "Read README first!!!!!"; \
  31. echo "Install the openssl library"])
  32. AC_CHECK_HEADERS([gmp.h], ,\
  33. [echo "============================ Unable to find gmp.h"; \
  34. echo "Read README first!!!!!"; \
  35. echo "You need to install the libgmp library."; \
  36. echo "In the debian the package is libgmp3-dev"])
  37. AC_MSG_CHECKING(OS)
  38. case "$host" in
  39. *-sunos5.6* | *-solaris2.6*)
  40. opsys=sol2-6
  41. AC_DEFINE(SUNOS,,SunOS 5)
  42. AC_CHECK_LIB(xnet, main)
  43. AC_MSG_RESULT(solaris)
  44. ;;
  45. *-sunos5* | *-solaris2*)
  46. AC_DEFINE(SUNOS,,SunOS 5)
  47. AC_CHECK_LIB(socket, main)
  48. AC_CHECK_LIB(nsl, main)
  49. AC_MSG_RESULT(solaris)
  50. ;;
  51. *-linux-*)
  52. opsys=gnu-linux
  53. AC_DEFINE(GNU_LINUX,,GNU Linux)
  54. AC_MSG_RESULT(linux)
  55. ;;
  56. *-nec-sysv4*)
  57. AC_CHECK_LIB(nsl, gethostbyname)
  58. AC_CHECK_LIB(socket, socket)
  59. AC_MSG_RESULT(net-sysv4)
  60. ;;
  61. *-freebsd*)
  62. AC_DEFINE(FREEBSD,,FreeBSD)
  63. AC_MSG_RESULT(freebsd)
  64. ;;
  65. *-openbsd*)
  66. opsys=openbsd
  67. AC_DEFINE(OPEN_BSD,,OpenBSD)
  68. AC_MSG_RESULT(openbsd)
  69. ;;
  70. *-bsdi*)
  71. opsys=bsdi
  72. OTHER_METHOD="mtu_kvm.o"
  73. AC_CHECK_LIB(kvm, main)
  74. AC_MSG_RESULT(bsdi)
  75. ;;
  76. *-irix6.5)
  77. opsys=irix
  78. AC_DEFINE(IRIX,,IRIX 6.5)
  79. AC_MSG_RESULT(irix)
  80. ;;
  81. esac
  82. dnl ------------------------------------
  83. dnl Determine routing get and set method
  84. dnl ------------------------------------
  85. AC_MSG_CHECKING(Netsukuku kernel interface method)
  86. if test x"$opsys" = x"gnu-linux"; then
  87. AC_MSG_RESULT(netlink)
  88. RT_METHOD=rt_netlink.o
  89. AC_DEFINE(HAVE_NETLINK,,netlink)
  90. netlink=yes
  91. else
  92. if test "$opsys" = "sol2-6";then
  93. AC_MSG_RESULT(solaris)
  94. KERNEL_METHOD="kernel_socket.o"
  95. RT_METHOD="rt_socket.o"
  96. elif test "$opsys" = "irix" ; then
  97. AC_MSG_RESULT(irix)
  98. KERNEL_METHOD="kernel_socket.o"
  99. RT_METHOD="rt_socket.o"
  100. else
  101. AC_TRY_RUN([#include <errno.h>
  102. #include <sys/types.h>
  103. #include <sys/socket.h>
  104. main ()
  105. {
  106. int ac_sock;
  107. ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
  108. if (ac_sock < 0 && errno == EINVAL)
  109. exit (1);
  110. exit (0);
  111. }],
  112. [KERNEL_METHOD=kernel_socket.o
  113. RT_METHOD=rt_socket.o
  114. AC_MSG_RESULT(socket)],
  115. [RT_METHOD=rt_ioctl.o
  116. AC_MSG_RESULT(ioctl)],
  117. [KERNEL_METHOD=kernel_socket.o
  118. RT_METHOD=rt_socket.o
  119. AC_MSG_RESULT(socket)])
  120. fi
  121. fi
  122. AC_SUBST(RT_METHOD)
  123. AC_SUBST(KERNEL_METHOD)
  124. AC_SUBST(OTHER_METHOD)
  125. dnl -----------------------------
  126. dnl check interface lookup method
  127. dnl -----------------------------
  128. AC_MSG_CHECKING(interface looking up method)
  129. if test "$netlink" = yes; then
  130. AC_MSG_RESULT(netlink)
  131. IF_METHOD=if_netlink.o
  132. else
  133. if test "$opsys" = "sol2-6";then
  134. AC_MSG_RESULT(solaris)
  135. IF_METHOD=if_ioctl.o
  136. elif test "$opsys" = "irix" ; then
  137. AC_MSG_RESULT(irix)
  138. IF_METHOD=if_ioctl.o
  139. elif test "$opsys" = "openbsd";then
  140. AC_MSG_RESULT(openbsd)
  141. IF_METHOD=if_ioctl.o
  142. elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
  143. AC_MSG_RESULT(sysctl)
  144. IF_METHOD=if_sysctl.o
  145. AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
  146. else
  147. AC_MSG_RESULT(ioctl)
  148. IF_METHOD=if_ioctl.o
  149. fi
  150. fi
  151. AC_SUBST(IF_METHOD)
  152. AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [Enable Netsukuku debug]),\
  153. [debug_flags="-Wall -DDEBUG"], [debug_flags=""])
  154. AC_SUBST(debug_flags)
  155. AC_DEFINE_UNQUOTED(DATA_DIR, "$datadir", "Where the Netsukuku data is saved")
  156. AC_DEFINE_UNQUOTED(CONF_DIR, "$sysconfdir", "Location of configuration files")
  157. AC_DEFINE_UNQUOTED(PID_DIR, "$piddir", "Location of ntkd.pid file")
  158. AC_ARG_WITH(pid_dir,
  159. [ --with-pid-dir=ARG Specify location of ntkd.pid file (default /var/run)],\
  160. [AC_DEFINE_UNQUOTED(PID_DIR, "$withval", ntkd.pid file location)])
  161. AC_SUBST(CONF_DIR)
  162. AC_SUBST(DATA_DIR)
  163. AC_SUBST(PID_DIR)
  164. AC_CONFIG_FILES([Makefile src/Makefile src/man/Makefile src/scripts/Makefile\
  165. src/conf/Makefile src/conf/netsukuku.conf])
  166. AC_OUTPUT