configure.in 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. dnl Process this file with autoconf to produce a configure script.
  2. dnl $Id$
  3. AC_PREREQ(2.59)
  4. AC_INIT
  5. AC_CONFIG_SRCDIR([src/tincd.c])
  6. AM_INIT_AUTOMAKE(tinc, 1.0-cvs)
  7. AC_CONFIG_HEADERS([config.h])
  8. AM_MAINTAINER_MODE
  9. dnl Include the macros from the m4/ directory
  10. AM_ACLOCAL_INCLUDE(m4)
  11. AM_GNU_GETTEXT([external])
  12. AM_GNU_GETTEXT_VERSION(0.12.1)
  13. # Enable GNU extensions.
  14. # Define this here, not in acconfig's @TOP@ section, since definitions
  15. # in the latter don't make it into the configure-time tests.
  16. AC_DEFINE([_GNU_SOURCE], 1, [Enable GNU extenstions])
  17. AC_DEFINE([__USE_BSD], 1, [Enable BSD extensions])
  18. ALL_LINGUAS="nl"
  19. dnl Checks for programs.
  20. AC_PROG_CC
  21. AC_PROG_CPP
  22. AC_PROG_GCC_TRADITIONAL
  23. AC_PROG_AWK
  24. AC_PROG_INSTALL
  25. AC_PROG_LN_S
  26. AC_PROG_MAKE_SET
  27. AC_PROG_RANLIB
  28. AC_ISC_POSIX
  29. dnl Check and set OS
  30. #AC_CANONICAL_HOST
  31. case $host_os in
  32. *linux*)
  33. AC_DEFINE(HAVE_LINUX, 1, [Linux])
  34. [ rm -f src/device.c; ln -sf linux/device.c src/device.c ]
  35. ;;
  36. *freebsd*)
  37. AC_DEFINE(HAVE_FREEBSD, 1, [FreeBSD])
  38. [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ]
  39. ;;
  40. *darwin*)
  41. AC_DEFINE(HAVE_DARWIN, 1, [Darwin (MacOS/X)])
  42. [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ]
  43. ;;
  44. *solaris*)
  45. AC_DEFINE(HAVE_SOLARIS, 1, [Solaris/SunOS])
  46. [ rm -f src/device.c; ln -sf solaris/device.c src/device.c ]
  47. ;;
  48. *openbsd*)
  49. AC_DEFINE(HAVE_OPENBSD, 1, [OpenBSD])
  50. [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ]
  51. ;;
  52. *netbsd*)
  53. AC_DEFINE(HAVE_NETBSD, 1, [NetBSD])
  54. [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ]
  55. ;;
  56. *bsd*)
  57. AC_MSG_WARN("Unknown BSD variant, tinc might not compile or work!")
  58. AC_DEFINE(HAVE_BSD, 1, [Unknown BSD variant])
  59. [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ]
  60. ;;
  61. *cygwin*)
  62. AC_DEFINE(HAVE_CYGWIN, 1, [Cygwin])
  63. [ rm -f src/device.c; ln -sf cygwin/device.c src/device.c ]
  64. ;;
  65. *mingw*)
  66. AC_DEFINE(HAVE_MINGW, 1, [MinGW])
  67. [ rm -f src/device.c; cp -f src/mingw/device.c src/device.c ]
  68. LIBS="$LIBS -lws2_32"
  69. ;;
  70. *)
  71. AC_MSG_ERROR("Unknown operating system.")
  72. ;;
  73. esac
  74. AC_CACHE_SAVE
  75. if test -d /sw/include ; then
  76. CPPFLAGS="$CPPFLAGS -I/sw/include"
  77. fi
  78. if test -d /sw/lib ; then
  79. LIBS="$LIBS -L/sw/lib"
  80. fi
  81. dnl Checks for libraries.
  82. dnl Checks for header files.
  83. dnl We do this in multiple stages, because unlike Linux all the other operating systems really suck and don't include their own dependencies.
  84. AC_HEADER_STDC
  85. 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])
  86. AC_CHECK_HEADERS([net/if.h net/if_types.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],
  87. [], [], [#include "have.h"]
  88. )
  89. AC_CHECK_HEADERS([netinet/if_ether.h netinet/ip.h netinet/ip6.h],
  90. [], [], [#include "have.h"]
  91. )
  92. AC_CHECK_HEADERS([netinet/tcp.h netinet/ip_icmp.h netinet/icmp6.h],
  93. [], [], [#include "have.h"]
  94. )
  95. dnl Checks for typedefs, structures, and compiler characteristics.
  96. AC_C_CONST
  97. AC_C_VOLATILE
  98. AC_TYPE_PID_T
  99. AC_TYPE_SIZE_T
  100. AC_HEADER_TIME
  101. AC_STRUCT_TM
  102. tinc_ATTRIBUTE(__malloc__)
  103. 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], , ,
  104. [#include "have.h"]
  105. )
  106. dnl Checks for library functions.
  107. AC_FUNC_MEMCMP
  108. AC_FUNC_ALLOCA
  109. AC_TYPE_SIGNAL
  110. 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],
  111. [], [], [#include "have.h"]
  112. )
  113. jm_FUNC_MALLOC
  114. jm_FUNC_REALLOC
  115. dnl Support for SunOS
  116. AC_CHECK_FUNC(socket, [], [
  117. AC_CHECK_LIB(socket, connect)
  118. ])
  119. AC_CHECK_FUNC(gethostbyname, [], [
  120. AC_CHECK_LIB(nsl, gethostbyname)
  121. ])
  122. AC_CHECK_FUNCS([freeaddrinfo gai_strerror getaddrinfo getnameinfo inet_aton],
  123. [], [], [#include "have.h"]
  124. )
  125. AC_CACHE_SAVE
  126. dnl These are defined in files in m4/
  127. case $host_os in
  128. *linux*)
  129. tinc_TUNTAP
  130. ;;
  131. esac
  132. tinc_OPENSSL
  133. tinc_ZLIB
  134. tinc_LZO
  135. dnl Check if support for jumbograms is requested
  136. AC_ARG_ENABLE(jumbograms,
  137. AS_HELP_STRING([--enable-jumbograms], [enable support for jumbograms (packets up to 9000 bytes)]),
  138. [ AC_DEFINE(ENABLE_JUMBOGRAMS, 1, [Support for jumbograms (packets up to 9000 bytes)]) ]
  139. )
  140. dnl Check if checkpoint tracing has to be enabled
  141. AC_ARG_ENABLE(tracing,
  142. AS_HELP_STRING([--enable-tracing], [enable checkpoint tracing (debugging only)]),
  143. [ AC_DEFINE(ENABLE_TRACING, 1, [Checkpoint tracing]) ]
  144. )
  145. AC_SUBST(INCLUDES)
  146. AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile lib/Makefile po/Makefile.in m4/Makefile])
  147. AC_OUTPUT