]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ldns/drill/configure.ac
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / ldns / drill / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.56)
5 AC_INIT(ldns, 1.6.17, libdns@nlnetlabs.nl,libdns)
6 AC_CONFIG_SRCDIR([drill.c])
7 sinclude(../acx_nlnetlabs.m4)
8
9 OURCPPFLAGS=''
10 CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}}
11 OURCFLAGS='-g'
12 CFLAGS=${CFLAGS:-${OURCFLAGS}}
13 AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled])
14
15 AC_AIX
16 # Checks for programs.
17 AC_PROG_CC
18 AC_PROG_MAKE_SET
19 AC_CHECK_PROGS(libtool, [glibtool libtool15 libtool], [../libtool])
20
21 # add option to disable the evil rpath
22 dnl Check whether to use rpath or not
23 AC_ARG_ENABLE(rpath,
24         [  --disable-rpath                disable hardcoded rpath (default=enabled)],
25         enable_rpath=$enableval, enable_rpath=yes)
26
27 if test "x$enable_rpath" = xyes; then
28     RPATH_VAL="-Wl,-rpath=\${libdir}"
29 fi
30
31
32 ACX_CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"])
33 ACX_CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"])
34
35 AC_TYPE_SIZE_T
36 ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"])
37
38 ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600,
39 [
40 #include "confdefs.h"
41 #include <stdlib.h>
42 #include <ctype.h>
43 #include <sys/time.h>
44 #ifdef HAVE_TIME_H
45 #include <time.h>
46 #endif
47 #include <unistd.h>
48 #ifdef HAVE_GETOPT_H
49 #include <getopt.h>
50 #endif
51
52 int test() {
53         int a;
54         char **opts = NULL;
55         struct timeval tv;
56         char *t;
57         time_t time = 0;
58         char *buf = NULL;
59         t = ctime_r(&time, buf);
60         tv.tv_usec = 10;
61         srandom(32);
62         a = getopt(2, opts, "a");
63         a = isascii(32);
64         return a;
65 }
66 ], [CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600"])
67
68
69 ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG, [#include <stdbool.h>], [CFLAGS="$CFLAGS $C99FLAG"])
70
71 AC_C_INLINE
72 AC_CHECK_TYPE(int8_t, char)
73 AC_CHECK_TYPE(int16_t, short)
74 AC_CHECK_TYPE(int32_t, int)
75 AC_CHECK_TYPE(int64_t, long long)
76 AC_CHECK_TYPE(uint8_t, unsigned char)
77 AC_CHECK_TYPE(uint16_t, unsigned short)
78 AC_CHECK_TYPE(uint32_t, unsigned int)
79 AC_CHECK_TYPE(uint64_t, unsigned long long)
80 AC_CHECK_TYPE(ssize_t, int)
81
82 AC_CHECK_HEADERS([sys/types.h getopt.h stdlib.h stdio.h assert.h netinet/in.h ctype.h time.h arpa/inet.h sys/time.h sys/socket.h sys/select.h],,, [AC_INCLUDES_DEFAULT])
83 AC_CHECK_HEADERS([netinet/in_systm.h net/if.h netinet/ip.h netinet/udp.h netinet/if_ether.h netinet/ip6.h],,, [
84 AC_INCLUDES_DEFAULT 
85 #ifdef HAVE_NETINET_IN_SYSTM_H
86 #include <netinet/in_systm.h>
87 #endif
88 #ifdef HAVE_NETINET_IN_H
89 #include <netinet/in.h>
90 #endif
91 #ifdef HAVE_SYS_SOCKET_H
92 #include <sys/socket.h>
93 #endif
94 #ifdef HAVE_NET_IF_H
95 #include <net/if.h>
96 #endif])
97 # MinGW32 tests
98 AC_CHECK_HEADERS([winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT])
99
100 ACX_TYPE_SOCKLEN_T
101 AC_CHECK_HEADERS([sys/param.h sys/mount.h],,,
102 [AC_INCLUDES_DEFAULT]
103 [
104   [
105    #if HAVE_SYS_PARAM_H
106    # include <sys/param.h>
107    #endif
108   ]
109 ])
110 AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [
111 #if HAVE_SYS_TYPES_H
112 # include <sys/types.h>
113 #endif
114 #if HAVE_NETINET_IN_H
115 # include <netinet/in.h>
116 #endif])
117 AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [
118 #if HAVE_SYS_TYPES_H
119 # include <sys/types.h>
120 #endif
121 #if HAVE_NETINET_IN_H
122 # include <netinet/in.h>
123 #endif])
124
125 # check to see if libraries are needed for these functions.
126 AC_SEARCH_LIBS(socket, socket)
127 AC_SEARCH_LIBS([inet_pton], [nsl])
128
129 ACX_WITH_SSL_OPTIONAL
130
131 ACX_CHECK_GETADDRINFO_WITH_INCLUDES
132
133 LIBS_STC="$LIBS"
134 AC_SUBST(LIBS_STC)
135
136 # check for ldns
137 AC_ARG_WITH(ldns, 
138         AC_HELP_STRING([--with-ldns=PATH        specify prefix of path of ldns library to use])
139         ,
140         [
141                 specialldnsdir="$withval"
142                 CPPFLAGS="$CPPFLAGS -I$withval/include"
143                 LDFLAGS="-L$withval -L$withval/lib $LDFLAGS"
144                 LDNSDIR="$withval"
145                 LIBS="-lldns $LIBS"
146                 LIBS_STC="$withval/lib/libldns.a $LIBS_STC"
147         ]
148 )
149
150 #AC_CHECK_HEADER(ldns/ldns.h,,  [
151 #       AC_MSG_ERROR([Can't find ldns headers (make copy-headers in devel source.)])
152 #       ], [AC_INCLUDES_DEFAULT]
153 #)
154
155 AC_CHECK_FUNCS(isblank)
156
157 # check for ldns development source tree
158 AC_MSG_CHECKING([for ldns devel source])
159 ldns_dev_dir=..
160 if test -f $ldns_dev_dir/ldns/util.h && \
161         grep LDNS_VERSION $ldns_dev_dir/ldns/util.h >/dev/null; then
162         ldns_version=`grep LDNS_VERSION $ldns_dev_dir/ldns/util.h | sed -e 's/^.*"\(.*\)".*$/\1/'`
163         AC_MSG_RESULT([using $ldns_dev_dir with $ldns_version])
164         CPPFLAGS="$CPPFLAGS -I$ldns_dev_dir/include"
165         LDFLAGS="-L$ldns_dev_dir -L$ldns_dev_dir/lib $LDFLAGS"
166         LIBS="-lldns $LIBS"
167         AC_DEFINE(HAVE_LIBLDNS, 1, [If the ldns library is available.])
168         LDNSDIR="$ldns_dev_dir"
169         LIBS_STC="$ldns_dev_dir/lib/libldns.a $LIBS_STC"
170 else
171         AC_MSG_RESULT([no])
172         AC_CHECK_LIB(ldns, ldns_rr_new, , [
173                         AC_MSG_ERROR([Can't find ldns library])dnl '
174                 ]
175         )
176 fi
177
178 AC_SUBST(LDNSDIR)
179
180 AC_ARG_WITH(trust-anchor, AC_HELP_STRING([--with-trust-anchor=KEYFILE],
181 [Default location of the trust anchor file. [default=SYSCONFDIR/unbound/root.key]]), [
182  LDNS_TRUST_ANCHOR_FILE="$withval"
183 ],[
184  if test "x$LDNS_TRUST_ANCHOR_FILE" = "x"; then
185   if test "x$sysconfdir" = 'x${prefix}/etc' ; then
186    if test "x$prefix" = 'xNONE' ; then
187     LDNS_TRUST_ANCHOR_FILE="/etc/unbound/root.key"
188    else
189     LDNS_TRUST_ANCHOR_FILE="${prefix}/etc/unbound/root.key"
190    fi
191   else
192     LDNS_TRUST_ANCHOR_FILE="${sysconfdir}/unbound/root.key"
193   fi
194  fi
195 ])
196 AC_DEFINE_UNQUOTED([LDNS_TRUST_ANCHOR_FILE], ["$LDNS_TRUST_ANCHOR_FILE"], [Default trust anchor file])
197 AC_SUBST(LDNS_TRUST_ANCHOR_FILE)
198 AC_MSG_NOTICE([Default trust anchor: $LDNS_TRUST_ANCHOR_FILE])
199
200 AH_BOTTOM([
201
202 #include <stdio.h>
203 #include <string.h>
204 #include <unistd.h>
205 #include <assert.h>
206
207 #if STDC_HEADERS
208 #include <stdlib.h>
209 #include <stddef.h>
210 #endif
211
212 #ifdef HAVE_STDINT_H
213 #include <stdint.h>
214 #endif
215
216 #ifdef HAVE_SYS_SOCKET_H
217 #include <sys/socket.h>
218 #endif
219
220 #ifdef HAVE_NETINET_IN_H
221 #include <netinet/in.h>
222 #endif
223
224 #ifdef HAVE_ARPA_INET_H
225 #include <arpa/inet.h>
226 #endif
227
228 #ifdef HAVE_NETINET_UDP_H
229 #include <netinet/udp.h>
230 #endif
231
232 #ifdef HAVE_TIME_H
233 #include <time.h>
234 #endif
235
236 #ifdef HAVE_NETINET_IN_SYSTM_H
237 #include <netinet/in_systm.h>
238 #endif
239
240 #ifdef HAVE_NETINET_IP_H
241 #include <netinet/ip.h>
242 #endif
243
244 #ifdef HAVE_NET_IF_H
245 #include <net/if.h>
246 #endif
247
248 #ifdef HAVE_NETINET_IF_ETHER_H
249 #include <netinet/if_ether.h>
250 #endif
251
252 #ifdef HAVE_WINSOCK2_H
253 #define USE_WINSOCK 1
254 #include <winsock2.h>
255 #endif
256
257 #ifdef HAVE_WS2TCPIP_H
258 #include <ws2tcpip.h>
259 #endif
260
261 extern char *optarg;
262 extern int optind, opterr;
263
264 #ifndef EXIT_FAILURE
265 #define EXIT_FAILURE  1
266 #endif
267 #ifndef EXIT_SUCCESS
268 #define EXIT_SUCCESS  0
269 #endif
270
271 #ifdef S_SPLINT_S
272 #define FD_ZERO(a) /* a */
273 #define FD_SET(a,b) /* a, b */
274 #endif
275 ])
276
277 AC_CONFIG_FILES([Makefile drill.1])
278 AC_CONFIG_HEADER([config.h])
279 AC_OUTPUT