0e767601f7c40bc327d7699d551db3564d297524
[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.62 2003/07/06 17:15:24 guus Exp $
4
5 AC_PREREQ(2.53)
6 AC_INIT(src/tincd.c)
7 AM_INIT_AUTOMAKE(tinc, 1.0-cvs)
8 AM_CONFIG_HEADER(config.h)
9 AM_MAINTAINER_MODE
10
11 dnl Include the macros from the m4/ directory
12 AM_ACLOCAL_INCLUDE(m4)
13
14 AM_GNU_GETTEXT([external])
15 AM_GNU_GETTEXT_VERSION(0.11.5)
16
17 # Enable GNU extensions.
18 # Define this here, not in acconfig's @TOP@ section, since definitions
19 # in the latter don't make it into the configure-time tests.
20 AC_DEFINE([_GNU_SOURCE], 1, [Enable GNU extenstions])
21 AC_DEFINE([__USE_BSD], 1, [Enable BSD extensions])
22
23 ALL_LINGUAS="nl"
24
25 dnl Checks for programs.
26 AC_PROG_CC
27 AC_PROG_CPP
28 AC_PROG_GCC_TRADITIONAL
29 AC_PROG_AWK
30 AC_PROG_INSTALL
31 AC_PROG_LN_S
32 AC_PROG_MAKE_SET
33 AC_PROG_RANLIB
34
35 AC_ISC_POSIX
36
37 dnl Check and set OS
38
39 #AC_CANONICAL_HOST
40
41 case $host_os in
42   *linux*)
43     AC_DEFINE(HAVE_LINUX, 1, [Linux])
44     [ rm -f src/device.c; ln -sf linux/device.c src/device.c ]
45   ;;
46   *freebsd*)
47     AC_DEFINE(HAVE_FREEBSD, 1, [FreeBSD])
48     [ rm -f src/device.c; ln -sf freebsd/device.c src/device.c ]
49   ;;
50   *darwin*)
51     AC_DEFINE(HAVE_DARWIN, 1, [Darwin (MacOS/X)])
52     [ rm -f src/device.c; ln -sf darwin/device.c src/device.c ]
53   ;;
54   *solaris*)
55     AC_DEFINE(HAVE_SOLARIS, 1, [Solaris/SunOS])
56     [ rm -f src/device.c; ln -sf solaris/device.c src/device.c ]
57   ;;
58   *openbsd*)
59     AC_DEFINE(HAVE_OPENBSD, 1, [OpenBSD])
60     [ rm -f src/device.c; ln -sf openbsd/device.c src/device.c ]
61   ;;
62   *netbsd*)
63     AC_DEFINE(HAVE_NETBSD, 1, [NetBSD])
64     [ rm -f src/device.c; ln -sf netbsd/device.c src/device.c ]
65   ;;
66   *cygwin*)
67     AC_DEFINE(HAVE_CYGWIN, 1, [Cygwin])
68     [ rm -f src/device.c; ln -sf cygwin/device.c src/device.c ]
69   ;;
70   *)
71     AC_MSG_ERROR("Unknown operating system.")
72   ;;
73 esac
74
75 AC_CACHE_SAVE
76
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
84 dnl Checks for libraries.
85
86 dnl Checks for header files.
87 AC_HEADER_STDC
88 AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h malloc.h stdint.h strings.h syslog.h unistd.h \
89         sys/file.h sys/ioctl.h sys/param.h sys/time.h netinet/in_systm.h])
90 AC_CHECK_HEADERS([net/ethernet.h net/if.h netinet/ip.h netinet/tcp.h], [], [],
91         [#include <sys/types.h>
92          #include <sys/socket.h>
93          #ifdef HAVE_NETINET_IN_SYSTM_H
94      #include <netinet/in_systm.h>
95          #endif])
96
97 dnl Checks for typedefs, structures, and compiler characteristics.
98 AC_C_CONST
99 AC_TYPE_PID_T
100 AC_TYPE_SIZE_T
101 AC_HEADER_TIME
102 AC_STRUCT_TM
103
104 AC_CHECK_TYPES([socklen_t, struct addrinfo, struct sockaddr_in6], , ,
105   [#include <sys/types.h>
106    #include <sys/socket.h>
107    #include <netdb.h>
108    #include <netinet/in.h>
109   ]
110 )
111
112 dnl Checks for library functions.
113 AC_FUNC_MEMCMP
114 AC_FUNC_ALLOCA
115 AC_TYPE_SIGNAL
116 AC_CHECK_FUNCS([asprintf daemon fcloseall flock ftime get_current_dir_name \
117 putenv select strdup strerror strsignal strtol unsetenv mlockall])
118 jm_FUNC_MALLOC
119 jm_FUNC_REALLOC
120
121 dnl Support for SunOS
122
123 AC_CHECK_FUNC(socket, [], [
124   AC_CHECK_LIB(socket, connect)
125 ])
126 AC_CHECK_FUNC(gethostbyname, [], [
127   AC_CHECK_LIB(nsl, gethostbyname)
128 ])
129
130 AC_CHECK_FUNCS([freeaddrinfo gai_strerror getaddrinfo getnameinfo])
131
132 AC_CACHE_SAVE
133
134 dnl These are defined in files in m4/
135 tinc_TUNTAP
136 tinc_OPENSSL
137 tinc_ZLIB
138 tinc_LZO
139
140 dnl Check if support for jumbograms is requested 
141 AC_ARG_ENABLE(jumbograms,
142   [  --enable-jumbograms     enable support for jumbograms (packets up to 9000 bytes)],
143   [ AC_DEFINE(ENABLE_JUMBOGRAMS, 1, [Support for jumbograms (packets up to 9000 bytes)]) ]
144 )
145
146 dnl Check if checkpoint tracing has to be enabled
147 AC_ARG_ENABLE(tracing,
148   [  --enable-tracing        enable checkpoint tracing (debugging only)],
149   [ AC_DEFINE(ENABLE_TRACING, 1, [Checkpoint tracing]) ]
150 )
151
152 AC_SUBST(INCLUDES)
153
154 AC_OUTPUT(Makefile 
155 src/Makefile
156 doc/Makefile
157 doc/es/Makefile
158 lib/Makefile
159 po/Makefile.in
160 m4/Makefile
161 )