Support for MaxOS/X.
[tinc] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2
3 dnl $Id: configure.in,v 1.13.2.44 2002/04/19 14:06:40 guus Exp $
4
5 AC_INIT(src/tincd.c)
6 AM_INIT_AUTOMAKE(tinc, 1.0-cvs)
7 AM_CONFIG_HEADER(config.h)
8
9 dnl Include the macros from the m4/ directory
10 AM_ACLOCAL_INCLUDE(m4)
11
12 # Enable GNU extensions.
13 # Define this here, not in acconfig's @TOP@ section, since definitions
14 # in the latter don't make it into the configure-time tests.
15 AC_DEFINE([_GNU_SOURCE], [__USE_BSD])
16
17 ALL_LINGUAS="nl"
18
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 jm_PERL
28
29
30 AC_ISC_POSIX
31
32 dnl Check and set OS
33
34 AC_CANONICAL_HOST
35
36 case $host_os in
37   *linux*)
38     AC_DEFINE(HAVE_LINUX)
39     [ rm -f src/device.c; ln -sf linux/device.c src/device.c ]
40   ;;
41   *freebsd*)
42     AC_DEFINE(HAVE_FREEBSD)
43     [ rm -f src/device.c; ln -sf freebsd/device.c src/device.c ]
44   ;;
45   *darwin*)
46     AC_DEFINE(HAVE_FREEBSD)
47     [ rm -f src/device.c; ln -sf freebsd/device.c src/device.c ]
48   ;;
49   *solaris*)
50     AC_DEFINE(HAVE_SOLARIS)
51     [ rm -f src/device.c; ln -sf solaris/device.c src/device.c ]
52   ;;
53   *openbsd*)
54     AC_DEFINE(HAVE_OPENBSD)
55     [ rm -f src/device.c; ln -sf openbsd/device.c src/device.c ]
56   ;;
57   *netbsd*)
58     AC_DEFINE(HAVE_NETBSD)
59     [ rm -f src/device.c; ln -sf netbsd/device.c src/device.c ]
60   ;;
61   *)
62     AC_MSG_ERROR("Unknown operating system.")
63   ;;
64 esac
65
66 AC_CACHE_SAVE
67
68 dnl Checks for libraries.
69
70 dnl Checks for header files.
71 AC_HEADER_STDC
72 AC_CHECK_HEADERS([fcntl.h limits.h sys/ioctl.h syslog.h unistd.h \
73 sys/time.h malloc.h strings.h sys/file.h])
74
75 dnl Checks for typedefs, structures, and compiler characteristics.
76 AC_C_CONST
77 AC_TYPE_PID_T
78 AC_TYPE_SIZE_T
79 AC_HEADER_TIME
80 AC_STRUCT_TM
81
82 AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
83 [
84   AC_TRY_COMPILE(
85   [#include <sys/socket.h>],
86   [socklen_t len = 42; return len;],
87   ac_cv_type_socklen_t=yes,
88   ac_cv_type_socklen_t=no)
89 ])
90 if test $ac_cv_type_socklen_t == yes; then
91   AC_DEFINE(HAVE_SOCKLEN_T)
92 fi
93
94 dnl Checks for library functions.
95 AC_FUNC_MEMCMP
96 AC_FUNC_ALLOCA
97 AC_TYPE_SIGNAL
98 AC_CHECK_FUNCS([ftime socket select strtol strerror flock unsetenv \
99 asprintf putenv strdup fcloseall daemon strsignal get_current_dir_name])
100 jm_FUNC_MALLOC
101 jm_FUNC_REALLOC
102
103 AM_GNU_GETTEXT
104
105 dnl Support for SunOS
106
107 AC_CHECK_FUNC(socket, [], [
108   AC_CHECK_LIB(socket, connect)
109 ])
110 AC_CHECK_FUNC(gethostbyname, [], [
111   AC_CHECK_LIB(nsl, gethostbyname)
112 ])
113
114 AC_CACHE_SAVE
115
116 dnl These are defined in files in m4/
117 tinc_TUNTAP
118 tinc_OPENSSL
119 tinc_ZLIB
120
121 dnl Check if support for jumbograms is requested 
122 AC_ARG_ENABLE(jumbograms,
123   [  --enable-jumbograms     enable support for jumbograms (packets up to 9000 bytes)],
124   [ AC_DEFINE(ENABLE_JUMBOGRAMS) ]
125 )
126
127 dnl Check if checkpoint tracing has to be enabled
128 AC_ARG_ENABLE(tracing,
129   [  --enable-tracing        enable checkpoint tracing (debugging only)],
130   [ AC_DEFINE(ENABLE_TRACING) ]
131 )
132
133 AC_SUBST(INCLUDES)
134
135 AC_OUTPUT(Makefile
136 src/Makefile
137 doc/Makefile
138 doc/es/Makefile
139 intl/Makefile
140 lib/Makefile
141 m4/Makefile
142 po/Makefile.in
143 )