-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
366 lines (310 loc) · 10 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# configure.ac - for adns
# Copyright (C) 2008 g10 Code GmbH
#
# This file is part of adns, which is
# Copyright (C) 1997-2000,2003,2006 Ian Jackson
# Copyright (C) 1999-2000,2003,2006 Tony Finch
# Copyright (C) 1991 Massachusetts Institute of Technology
# (See the file INSTALL for full details.)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
min_automake_version="1.14"
# To build a release you need to create a tag with the version number
# (git tag -s gnupg-2.n.m) and run "./autogen.sh --force". Please
# bump the version number immediately *after* the release and do
# another commit and push so that the git magic is able to work.
# See below for the LT version numbers.
m4_define([mym4_version], [1.4-g10-8])
# Below is m4 magic to extract and compute the git revision number,
# the decimalized short revision number, a beta version string and a
# flag indicating a development version (mym4_isgit). Note that the
# m4 processing is done by autoconf and not during the configure run.
m4_define([mym4_revision], m4_esyscmd([git branch -v 2>/dev/null \
| awk '/^\* / {printf "%s",$3}']))
m4_define([mym4_revision_dec],
m4_esyscmd_s([echo $((0x$(echo ]mym4_revision[|head -c 4)))]))
m4_define([mym4_betastring],
m4_esyscmd_s([git describe --match 'adns-1.4-g10-*[0-9]' --long|\
awk -F- '$5!=0{print"-beta"$5}']))
m4_define([mym4_isgit],m4_if(mym4_betastring,[],[no],[yes]))
m4_define([mym4_full_version],[mym4_version[]mym4_betastring])
AC_INIT([adns], [mym4_full_version], [[email protected]])
# LT Version numbers: Remember to change them just *before* a release.
# (Interfaces removed: CURRENT++, AGE=0, REVISION=0)
# (Interfaces added: CURRENT++, AGE++, REVISION=0)
# (No interfaces changed: REVISION++)
# Please remember to document interface changes in the NEWS file.
ADNS_LT_CURRENT=5
ADNS_LT_AGE=4
ADNS_LT_REVISION=0
# If the API is changed in an incompatible way: increment this counter.
ADNS_CONFIG_API_VERSION=1
AC_CONFIG_SRCDIR([src/adns.h])
AM_INIT_AUTOMAKE([serial-tests dist-bzip2 no-dist-gzip])
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(src/config.h)
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
AC_GNU_SOURCE
AC_SUBST(ADNS_LT_CURRENT)
AC_SUBST(ADNS_LT_AGE)
AC_SUBST(ADNS_LT_REVISION)
AC_DEFINE_UNQUOTED(ADNS_VERSION_STRING, "$VERSION", [Version of this library])
# Checks for programs.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_PROG_CC
AC_PROG_CPP
AM_PROG_CC_C_O
if test "x$ac_cv_prog_cc_c89" = "xno" ; then
AC_MSG_ERROR([[No C-89 compiler found]])
fi
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_CHECK_PROGS(M4, m4)
AC_C_INLINE
AC_LANG([C])
#
# Libtool stuff
#
LT_PREREQ([2.2.6])
LT_INIT([win32-dll disable-static])
LT_LANG([Windows Resource])
# This is handy for debugging so the compiler doesn't rearrange
# things and eliminate variables.
AC_ARG_ENABLE(optimization,
AC_HELP_STRING([--disable-optimization],
[disable compiler optimization]),
[if test $enableval = no ; then
CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]]//'`
fi])
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall -Wcast-align -Wstrict-prototypes"
CLFAGS="$CLFAGS -Wmissing-prototypes -Wwrite-strings -Wcast-qual"
AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
_gcc_cflags_save=$CFLAGS
CFLAGS="-Wpointer-arith"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_psign=yes,_gcc_psign=no)
AC_MSG_RESULT($_gcc_psign)
CFLAGS=$_gcc_cflags_save;
if test x"$_gcc_psign" = xyes ; then
CFLAGS="$CFLAGS -Wpointer-arith"
fi
AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
_gcc_cflags_save=$CFLAGS
CFLAGS="-Wpointer-arith"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_psign=yes,_gcc_psign=no)
AC_MSG_RESULT($_gcc_psign)
CFLAGS=$_gcc_cflags_save;
if test x"$_gcc_psign" = xyes ; then
CFLAGS="$CFLAGS -Wno-pointer-sign"
fi
fi
# Setup some stuff depending on host.
have_w32_system=no
use_tsearch=yes
case "${host}" in
*-*-mingw32*)
have_w32_system=yes
# We need to pass HAVE_W32_SYSTEM on the command line because
# config.h is not always included first but we need to include
# some header files conditionally. Note that in the public
# header file (adns.h) we need to use the _WIN32 macro despite
# that it is very questionable whether Windows is win.
PLATFORMCPPFLAGS="-DHAVE_W32_SYSTEM"
# Newer mingw packages have tsearch but there are other problems
# when enabling it. For now disable it.
use_tsearch=no
;;
*)
PLATFORMCPPFLAGS=
;;
esac
AC_SUBST(PLATFORMCPPFLAGS)
AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
# For some systems we know that we have ld_version scripts.
# Use it then as default.
have_ld_version_script=no
case "${host}" in
*-*-linux*)
have_ld_version_script=yes
;;
*-*-gnu*)
have_ld_version_script=yes
;;
esac
AC_ARG_ENABLE([ld-version-script],
AC_HELP_STRING([--enable-ld-version-script],
[enable/disable use of linker version script.
(default is system dependent)]),
[have_ld_version_script=$enableval],
[ : ] )
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
#
# Checks for libraries.
#
#
# Checks for header files.
#
AC_HEADER_STDC
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
#
# Checks for library functions.
#
AC_CHECK_FUNCS([poll tsearch gettimeofday])
AM_CONDITIONAL(HAVE_TSEARCH, test "x$ac_cv_func_tsearch" = "xyes" \
-a "x$use_tsearch" = "xyes")
# fixme: we should check for nrand48 and use a replace function if it
# is not there. src/w32misc.c has such an replacement.
# Fixme: Use a modern autoconf macro.
if test "$have_w32_system" != yes; then
AC_MSG_CHECKING(for INADDR_LOOPBACK)
AC_CACHE_VAL(adns_cv_decl_inaddrloopback,[
AC_TRY_COMPILE([
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
],[
INADDR_LOOPBACK;
],
adns_cv_decl_inaddrloopback=yes,
adns_cv_decl_inaddrloopback=no)])
if test "$adns_cv_decl_inaddrloopback" = yes; then
AC_MSG_RESULT(found)
else
AC_MSG_RESULT([not in standard headers, urgh...])
AC_CHECK_HEADER(rpc/types.h,[
AC_DEFINE(HAVEUSE_RPCTYPES_H, 1,
[Define if we want to include rpc/types.h. Crap BSDs put INADDR_LOOPBACK there.])
],[
AC_MSG_ERROR([cannot find INADDR_LOOPBACK or rpc/types.h])
])
fi
fi
# Check for required network libraries.
if test "$have_w32_system" = yes; then
LIBS="$LIBS -lws2_32 -liphlpapi"
else
AC_SEARCH_LIBS([inet_aton], [resolv])
fi
#
# Stuff required to create adns-config
#
ADNS_CONFIG_LIBS="-ladns"
ADNS_CONFIG_CFLAGS=""
ADNS_CONFIG_HOST="$host"
AC_SUBST(ADNS_CONFIG_API_VERSION)
AC_SUBST(ADNS_CONFIG_CFLAGS)
AC_SUBST(ADNS_CONFIG_LIBS)
AC_SUBST(ADNS_CONFIG_HOST)
# The Makefiles need to know about cross compiling
AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
# Generate extended version information for W32.
if test "$have_w32_system" = yes; then
BUILD_REVISION=mym4_revision
BUILD_TIMESTAMP=`date --iso-8601=minutes`
changequote(,)dnl
BUILD_FILEVERSION=`echo "$PACKAGE_VERSION" \
| sed 's/\([0-9.]*\)-g10-\([0-9]*\).*/\1.\2./;s/\./,/g'`
changequote([,])dnl
BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
fi
AC_SUBST(BUILD_REVISION)
AC_SUBST(BUILD_TIMESTAMP)
AC_SUBST(BUILD_FILEVERSION)
#
# Stuff which goes at the bottom of config.h.
#
AH_BOTTOM([
/* Use the definitions: */
#ifdef HAVE_POLL
#include <sys/poll.h>
#else
/* kludge it up */
struct pollfd { int fd; short events; short revents; };
#define POLLIN 1
#define POLLPRI 2
#define POLLOUT 4
#endif
#ifdef __GNUC__
# define ADNS_GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
#else
# define ADNS_GCC_VERSION 0
#endif
/* GNU C attributes. */
#ifndef FUNCATTR
# if ADNS_GCC_VERSION >= 20500
# define FUNCATTR(x) __attribute__(x)
# else
# define FUNCATTR(x)
# endif
#endif
/* GNU C printf formats, or null. */
#ifndef ATTRPRINTF
# if ADNS_GCC_VERSION >= 20500
# define ATTRPRINTF(si,tc) format (printf,si,tc)
# else
# define ATTRPRINTF(si,tc)
# endif
#endif
#ifndef PRINTFFORMAT
# define PRINTFFORMAT(si,tc) FUNCATTR((ATTRPRINTF(si,tc)))
#endif
/* GNU C nonreturning functions, or null. */
#ifndef ATTRNORETURN
# if ADNS_GCC_VERSION >= 20500
# define ATTRNORETURN noreturn
# else
# define ATTRNORETURN
# endif
#endif
#ifndef NONRETURNING
#define NONRETURNING FUNCATTR((ATTRNORETURN))
#endif
/* Combination of both the above. */
#ifndef NONRETURNPRINTFFORMAT
#define NONRETURNPRINTFFORMAT(si,tc) FUNCATTR((ATTRPRINTF(si,tc),ATTRNORETURN))
#endif
#ifdef HAVEUSE_RPCTYPES_H
#include <rpc/types.h>
#endif
])
AC_CONFIG_FILES([
Makefile
m4/Makefile
src/Makefile
src/adns-config
src/versioninfo.rc
client/Makefile
regress/Makefile
])
AC_CONFIG_COMMANDS([adns-conf],[[
chmod +x src/adns-config
]])
AC_OUTPUT
echo "
adns v${PACKAGE_VERSION} has been configured as follows:
Revision: mym4_revision (mym4_revision_dec)
Platform: $host
"