configure.in 4.5 KB

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