configure.in 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_PREREQ(2.61)
  3. AC_INIT
  4. AC_CONFIG_SRCDIR([src/tincd.c])
  5. AC_GNU_SOURCE
  6. AM_INIT_AUTOMAKE(tinc, 1.1-cvs)
  7. AC_CONFIG_HEADERS([config.h])
  8. AM_MAINTAINER_MODE
  9. # Enable GNU extensions.
  10. # Define this here, not in acconfig's @TOP@ section, since definitions
  11. # in the latter don't make it into the configure-time tests.
  12. AC_GNU_SOURCE
  13. AC_DEFINE([__USE_BSD], 1, [Enable BSD extensions])
  14. ALL_LINGUAS="nl"
  15. dnl Checks for programs.
  16. AC_PROG_CC_C99
  17. AC_PROG_CPP
  18. AC_PROG_INSTALL
  19. AC_PROG_LN_S
  20. AC_PROG_RANLIB
  21. dnl Check and set OS
  22. AC_CANONICAL_HOST
  23. case $host_os in
  24. *linux*)
  25. AC_DEFINE(HAVE_LINUX, 1, [Linux])
  26. [ rm -f src/device.c; ln -sf linux/device.c src/device.c ]
  27. ;;
  28. *freebsd*)
  29. AC_DEFINE(HAVE_FREEBSD, 1, [FreeBSD])
  30. [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ]
  31. ;;
  32. *darwin*)
  33. AC_DEFINE(HAVE_DARWIN, 1, [Darwin (MacOS/X)])
  34. [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ]
  35. ;;
  36. *solaris*)
  37. AC_DEFINE(HAVE_SOLARIS, 1, [Solaris/SunOS])
  38. [ rm -f src/device.c; ln -sf solaris/device.c src/device.c ]
  39. ;;
  40. *openbsd*)
  41. AC_DEFINE(HAVE_OPENBSD, 1, [OpenBSD])
  42. [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ]
  43. ;;
  44. *netbsd*)
  45. AC_DEFINE(HAVE_NETBSD, 1, [NetBSD])
  46. [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ]
  47. ;;
  48. *bsd*)
  49. AC_MSG_WARN("Unknown BSD variant, tinc might not compile or work!")
  50. AC_DEFINE(HAVE_BSD, 1, [Unknown BSD variant])
  51. [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ]
  52. ;;
  53. *cygwin*)
  54. AC_DEFINE(HAVE_CYGWIN, 1, [Cygwin])
  55. [ rm -f src/device.c; ln -sf cygwin/device.c src/device.c ]
  56. ;;
  57. *mingw*)
  58. AC_DEFINE(HAVE_MINGW, 1, [MinGW])
  59. [ rm -f src/device.c; cp -f src/mingw/device.c src/device.c ]
  60. LIBS="$LIBS -lws2_32"
  61. ;;
  62. *)
  63. AC_MSG_ERROR("Unknown operating system.")
  64. ;;
  65. esac
  66. case $host_os in
  67. *mingw*)
  68. ;;
  69. *)
  70. LIBS="-pthread $LIBS"
  71. CFLAGS="-pthread $CFLAGS"
  72. ;;
  73. esac
  74. AC_ARG_ENABLE(tunemu,
  75. AS_HELP_STRING([--enable-tunemu], [enable support for the tunemu driver]),
  76. [ AC_DEFINE(ENABLE_TUNEMU, 1, [Support for tunemu])
  77. tunemu=true
  78. ]
  79. )
  80. AC_ARG_WITH(windows2000,
  81. AS_HELP_STRING([--with-windows2000], [compile with support for Windows 2000. This disables support for tunneling over existing IPv6 networks.]),
  82. [AC_DEFINE(WITH_WINDOWS2000, 1, [Compile with support for Windows 2000])]
  83. )
  84. AM_CONDITIONAL(TUNEMU, test "$tunemu" = true)
  85. AC_CACHE_SAVE
  86. if test -d /sw/include ; then
  87. CPPFLAGS="$CPPFLAGS -I/sw/include"
  88. fi
  89. if test -d /sw/lib ; then
  90. LIBS="$LIBS -L/sw/lib"
  91. fi
  92. dnl Checks for header files.
  93. dnl We do this in multiple stages, because unlike Linux all the other operating systems really suck and don't include their own dependencies.
  94. AC_HEADER_STDC
  95. AC_CHECK_HEADERS([stdbool.h syslog.h sys/file.h sys/ioctl.h sys/mman.h sys/param.h sys/socket.h sys/time.h sys/uio.h sys/un.h sys/wait.h netdb.h arpa/inet.h dirent.h])
  96. AC_CHECK_HEADERS([net/if.h net/if_types.h linux/if_tun.h net/if_tun.h net/if_tap.h net/ethernet.h net/if_arp.h netinet/in_systm.h netinet/in.h netinet/in6.h time.h],
  97. [], [], [#include "have.h"]
  98. )
  99. AC_CHECK_HEADERS([netinet/if_ether.h netinet/ip.h netinet/ip6.h],
  100. [], [], [#include "have.h"]
  101. )
  102. AC_CHECK_HEADERS([netinet/tcp.h netinet/ip_icmp.h netinet/icmp6.h],
  103. [], [], [#include "have.h"]
  104. )
  105. dnl Checks for typedefs, structures, and compiler characteristics.
  106. AC_C_CONST
  107. AC_C_VOLATILE
  108. AC_TYPE_PID_T
  109. AC_TYPE_SIZE_T
  110. AC_HEADER_TIME
  111. AC_STRUCT_TM
  112. tinc_ATTRIBUTE(__malloc__)
  113. AC_CHECK_TYPES([socklen_t, struct ether_header, struct arphdr, struct ether_arp, struct in_addr, struct addrinfo, struct ip, struct icmp, struct in6_addr, struct sockaddr_in6, struct ip6_hdr, struct icmp6_hdr, struct nd_neighbor_solicit, struct nd_opt_hdr], , ,
  114. [#include "have.h"]
  115. )
  116. dnl Checks for library functions.
  117. AC_FUNC_MEMCMP
  118. AC_FUNC_ALLOCA
  119. AC_TYPE_SIGNAL
  120. AC_CHECK_FUNCS([asprintf daemon fchmod flock ftime fork get_current_dir_name gettimeofday mlockall putenv random select strdup strerror strsignal strtol system time unsetenv usleep vsyslog writev],
  121. [], [], [#include "have.h"]
  122. )
  123. AC_FUNC_MALLOC
  124. AC_FUNC_REALLOC
  125. dnl Support for SunOS
  126. AC_CHECK_FUNC(socket, [], [
  127. AC_CHECK_LIB(socket, connect)
  128. ])
  129. AC_CHECK_FUNC(gethostbyname, [], [
  130. AC_CHECK_LIB(nsl, gethostbyname)
  131. ])
  132. AC_CHECK_DECLS([freeaddrinfo, gai_strerror, getaddrinfo, getnameinfo],
  133. [], [], [#include "have.h"]
  134. )
  135. AC_CACHE_SAVE
  136. dnl These are defined in files in m4/
  137. AC_ARG_WITH(libgcrypt, AC_HELP_STRING([--with-libgcrypt], [enable use of libgcrypt instead of OpenSSL])], [])
  138. tinc_ZLIB
  139. tinc_LZO
  140. if test "$with_libgcrypt" = yes; then
  141. AM_PATH_LIBGCRYPT([1.4.0], [], [])
  142. ln -sf gcrypt/cipher.c gcrypt/cipher.h gcrypt/crypto.c gcrypt/crypto.h gcrypt/digest.c gcrypt/digest.h gcrypt/rsa.c gcrypt/rsa.h gcrypt/rsagen.c gcrypt/rsagen.h src/
  143. else
  144. tinc_OPENSSL
  145. ln -sf openssl/cipher.c openssl/cipher.h openssl/crypto.c openssl/crypto.h openssl/digest.c openssl/digest.h openssl/rsa.c openssl/rsa.h openssl/rsagen.c openssl/rsagen.h src/
  146. fi
  147. dnl Check if support for jumbograms is requested
  148. AC_ARG_ENABLE(jumbograms,
  149. AS_HELP_STRING([--enable-jumbograms], [enable support for jumbograms (packets up to 9000 bytes)]),
  150. [ AC_DEFINE(ENABLE_JUMBOGRAMS, 1, [Support for jumbograms (packets up to 9000 bytes)]) ]
  151. )
  152. AC_SUBST(INCLUDES)
  153. AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile m4/Makefile])
  154. AC_OUTPUT