configure.in 4.6 KB

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