Mirror of tinc, the VPN daemon.
vpn
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 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_PREREQ(2.61)
  3. AC_INIT([tinc], [1.0.36])
  4. AC_CONFIG_SRCDIR([src/tincd.c])
  5. AM_INIT_AUTOMAKE([1.11 check-news std-options subdir-objects nostdinc silent-rules -Wall])
  6. AC_CONFIG_HEADERS([config.h])
  7. AC_CONFIG_MACRO_DIR([m4])
  8. AM_SILENT_RULES([yes])
  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. dnl Checks for programs.
  15. AC_PROG_CC_C99
  16. AC_PROG_CPP
  17. AC_PROG_INSTALL
  18. AM_PROG_CC_C_O
  19. dnl Check and set OS
  20. AC_CANONICAL_HOST
  21. case $host_os in
  22. *linux*)
  23. linux=true
  24. AC_DEFINE(HAVE_LINUX, 1, [Linux])
  25. ;;
  26. *freebsd*)
  27. bsd=true
  28. AC_DEFINE(HAVE_FREEBSD, 1, [FreeBSD])
  29. ;;
  30. *darwin*)
  31. bsd=true
  32. AC_DEFINE(HAVE_DARWIN, 1, [Darwin (MacOS/X)])
  33. ;;
  34. *solaris*)
  35. solaris=true
  36. AC_DEFINE(HAVE_SOLARIS, 1, [Solaris/SunOS])
  37. ;;
  38. *openbsd*)
  39. bsd=true
  40. AC_DEFINE(HAVE_OPENBSD, 1, [OpenBSD])
  41. ;;
  42. *netbsd*)
  43. bsd=true
  44. AC_DEFINE(HAVE_NETBSD, 1, [NetBSD])
  45. ;;
  46. *dragonfly*)
  47. bsd=true
  48. AC_DEFINE(HAVE_DRAGONFLY, 1, [DragonFly])
  49. ;;
  50. *bsd*)
  51. bsd=true
  52. AC_MSG_WARN("Unknown BSD variant, tinc might not compile or work!")
  53. AC_DEFINE(HAVE_BSD, 1, [Unknown BSD variant])
  54. ;;
  55. *cygwin*)
  56. cygwin=true
  57. AC_DEFINE(HAVE_CYGWIN, 1, [Cygwin])
  58. ;;
  59. *mingw*)
  60. mingw=true
  61. AC_DEFINE(HAVE_MINGW, 1, [MinGW])
  62. LIBS="$LIBS -lws2_32 -lgdi32 -lcrypt32"
  63. ;;
  64. *)
  65. AC_MSG_ERROR("Unknown operating system.")
  66. ;;
  67. esac
  68. AC_ARG_ENABLE(uml,
  69. AS_HELP_STRING([--enable-uml], [enable support for User Mode Linux]),
  70. [ AS_IF([test "x$enable_uml" = "xyes"],
  71. [ AC_DEFINE(ENABLE_UML, 1, [Support for UML])
  72. uml=true
  73. ],
  74. [uml=false])
  75. ],
  76. [uml=false]
  77. )
  78. AC_ARG_ENABLE(vde,
  79. AS_HELP_STRING([--enable-vde], [enable support for Virtual Distributed Ethernet]),
  80. [ AS_IF([test "x$enable_vde" = "xyes"],
  81. [ AC_CHECK_HEADERS(libvdeplug_dyn.h, [], [AC_MSG_ERROR([VDE plug header files not found.]); break])
  82. AC_DEFINE(ENABLE_VDE, 1, [Support for VDE])
  83. vde=true
  84. ],
  85. [vde=false])
  86. ],
  87. [vde=false]
  88. )
  89. AC_ARG_ENABLE(tunemu,
  90. AS_HELP_STRING([--enable-tunemu], [enable support for the tunemu driver]),
  91. [ AS_IF([test "x$enable_tunemu" = "xyes"],
  92. [ AC_DEFINE(ENABLE_TUNEMU, 1, [Support for tunemu])
  93. tunemu=true
  94. ],
  95. [tunemu=false])
  96. ],
  97. [tunemu=false]
  98. )
  99. AC_ARG_WITH(windows2000,
  100. AS_HELP_STRING([--with-windows2000], [compile with support for Windows 2000. This disables support for tunneling over existing IPv6 networks.]),
  101. [ AS_IF([test "x$with_windows2000" = "xyes"],
  102. [AC_DEFINE(WITH_WINDOWS2000, 1, [Compile with support for Windows 2000])])
  103. ]
  104. )
  105. AC_ARG_WITH(systemd,
  106. AS_HELP_STRING([--with-systemd@<:@=DIR@:>@], [install systemd service files @<:@to DIR if specified@:>@]),
  107. [ systemd=true; systemd_path="$with_systemd" ],
  108. [ systemd=false ]
  109. )
  110. AS_IF([test "x$with_systemd" = "xyes"], [systemd_path="\${libdir}/systemd/system"],
  111. [AS_IF([test "x$with_systemd" = "xno"], [systemd=false])])
  112. AC_SUBST(systemd_path, $systemd_path)
  113. AM_CONDITIONAL(LINUX, test "$linux" = true)
  114. AM_CONDITIONAL(BSD, test "$bsd" = true)
  115. AM_CONDITIONAL(SOLARIS, test "$solaris" = true)
  116. AM_CONDITIONAL(MINGW, test "$mingw" = true)
  117. AM_CONDITIONAL(CYGWIN, test "$cygwin" = true)
  118. AM_CONDITIONAL(UML, test "$uml" = true)
  119. AM_CONDITIONAL(VDE, test "$vde" = true)
  120. AM_CONDITIONAL(TUNEMU, test "$tunemu" = true)
  121. AM_CONDITIONAL(WITH_SYSTEMD, test "$systemd" = true)
  122. AC_CACHE_SAVE
  123. if test -d /sw/include ; then
  124. CPPFLAGS="$CPPFLAGS -I/sw/include"
  125. fi
  126. if test -d /sw/lib ; then
  127. LIBS="$LIBS -L/sw/lib"
  128. fi
  129. dnl Compiler hardening flags
  130. dnl No -fstack-protector-all because it doesn't work on all platforms or architectures.
  131. AX_CFLAGS_WARN_ALL(CFLAGS)
  132. AC_ARG_ENABLE([hardening], AS_HELP_STRING([--disable-hardening], [disable compiler and linker hardening flags]))
  133. AS_IF([test "x$enable_hardening" != "xno"],
  134. [AX_CHECK_COMPILE_FLAG([-DFORTIFY_SOURCE=2], [CPPFLAGS="$CPPFLAGS -DFORTIFY_SOURCE=2"])
  135. AX_CHECK_COMPILE_FLAG([-fwrapv], [CPPFLAGS="$CPPFLAGS -fwrapv"],
  136. AX_CHECK_COMPILE_FLAG([-fno-strict-overflow], [CPPFLAGS="$CPPFLAGS -fno-strict-overflow"]))
  137. case $host_os in
  138. *mingw*)
  139. AX_CHECK_LINK_FLAG([-Wl,--dynamicbase], [LDFLAGS="$LDFLAGS -Wl,--dynamicbase"])
  140. AX_CHECK_LINK_FLAG([-Wl,--nxcompat], [LDFLAGS="$LDFLAGS -Wl,--nxcompat"])
  141. ;;
  142. *)
  143. AX_CHECK_COMPILE_FLAG([-fPIE], [CPPFLAGS="$CPPFLAGS -fPIE"])
  144. AX_CHECK_LINK_FLAG([-pie], [LDFLAGS="$LDFLAGS -pie"])
  145. ;;
  146. esac
  147. AX_CHECK_LINK_FLAG([-Wl,-z,relro], [LDFLAGS="$LDFLAGS -Wl,-z,relro"])
  148. AX_CHECK_LINK_FLAG([-Wl,-z,now], [LDFLAGS="$LDFLAGS -Wl,-z,now"])
  149. ]
  150. );
  151. dnl Checks for libraries.
  152. dnl Checks for header files.
  153. dnl We do this in multiple stages, because unlike Linux all the other operating systems really suck and don't include their own dependencies.
  154. AC_CHECK_HEADERS([syslog.h sys/file.h sys/ioctl.h sys/mman.h sys/param.h sys/resource.h sys/socket.h sys/time.h sys/uio.h sys/wait.h netdb.h arpa/inet.h arpa/nameser.h dirent.h getopt.h])
  155. AC_CHECK_HEADERS([net/if.h net/if_types.h linux/if_tun.h net/if_tun.h net/if_utun.h net/tun/if_tun.h net/if_tap.h net/tap/if_tap.h net/ethernet.h net/if_arp.h netinet/in_systm.h netinet/in.h netinet/in6.h netpacket/packet.h],
  156. [], [], [#include "$srcdir/src/have.h"]
  157. )
  158. AC_CHECK_HEADERS([netinet/if_ether.h netinet/ip.h netinet/ip6.h resolv.h],
  159. [], [], [#include "$srcdir/src/have.h"]
  160. )
  161. AC_CHECK_HEADERS([netinet/tcp.h netinet/ip_icmp.h netinet/icmp6.h],
  162. [], [], [#include "$srcdir/src/have.h"]
  163. )
  164. dnl Checks for typedefs, structures, and compiler characteristics.
  165. AC_TYPE_PID_T
  166. tinc_ATTRIBUTE(__malloc__)
  167. 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], , ,
  168. [#include "$srcdir/src/have.h"]
  169. )
  170. dnl Checks for library functions.
  171. AC_TYPE_SIGNAL
  172. AC_CHECK_FUNCS([asprintf daemon fchmod flock fork gettimeofday mlockall pselect putenv strsignal system unsetenv usleep vsyslog devname fdevname],
  173. [], [], [#include "$srcdir/src/have.h"]
  174. )
  175. AC_CHECK_FUNC(getopt_long, [getopt=true; AC_DEFINE(HAVE_GETOPT_LONG, 1, [getopt_long()])], [getopt=false])
  176. AM_CONDITIONAL(GETOPT, test "$getopt" = true)
  177. dnl Support for SunOS
  178. AC_CHECK_FUNC(socket, [], [
  179. AC_CHECK_LIB(socket, connect)
  180. ])
  181. AC_CHECK_FUNC(gethostbyname, [], [
  182. AC_CHECK_LIB(nsl, gethostbyname)
  183. ])
  184. AC_CHECK_DECLS([freeaddrinfo, gai_strerror, getaddrinfo, getnameinfo],
  185. [], [], [#include "$srcdir/src/have.h"]
  186. )
  187. AC_CHECK_DECLS([res_init], [AC_CHECK_LIB(resolv, res_init)], [], [
  188. #include <netinet/in.h>
  189. #include <resolv.h>
  190. ])
  191. AC_CACHE_SAVE
  192. dnl These are defined in files in m4/
  193. tinc_ZLIB
  194. tinc_LZO
  195. tinc_OPENSSL
  196. dnl Check if support for jumbograms is requested
  197. AC_ARG_ENABLE(jumbograms,
  198. AS_HELP_STRING([--enable-jumbograms], [enable support for jumbograms (packets up to 9000 bytes)]),
  199. [ AS_IF([test "x$enable_jumbograms" = "xyes"],
  200. [ AC_DEFINE(ENABLE_JUMBOGRAMS, 1, [Support for jumbograms (packets up to 9000 bytes)]) ])
  201. ]
  202. )
  203. dnl Ensure runstatedir is set if we are using a version of autoconf that does not support it
  204. if test "x$runstatedir" = "x"; then
  205. AC_SUBST([runstatedir], ['${localstatedir}/run'])
  206. fi
  207. AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile systemd/Makefile])
  208. AC_OUTPUT