1 |
# |
2 |
# File: configure.in |
3 |
# Author: James Couzens <jcouzens@codeshare.ca> |
4 |
# Date: June 15, 2004 |
5 |
# |
6 |
# Info: 'AutoTools' framework for building a configure script |
7 |
# for libSPF |
8 |
# |
9 |
# |
10 |
# oooo o8o .o8 .oooooo..o ooooooooo. oooooooooooo |
11 |
# `888 `"' "888 d8P' `Y8 `888 `Y88. `888' `8 |
12 |
# 888 oooo 888oooo. Y88bo. 888 .d88' 888 |
13 |
# 888 `888 d88' `88b `"Y8888o. 888ooo88P' 888oooo8 |
14 |
# 888 888 888 888 `"Y88b 888 888 " |
15 |
# 888 888 888 888 oo .d8P 888 888 |
16 |
# o888o o888o `Y8bod8P' 8""88888P' o888o o888o |
17 |
# |
18 |
#------------------------------------------------------------------------------- |
19 |
# An ANSI C Implementation of the Sender Policy Framework |
20 |
#------------------------------------------------------------------------------- |
21 |
|
22 |
AC_PREREQ(2.52) |
23 |
AC_INIT(libspf,1.0.0-p5,jcouzens@codeshare.ca) |
24 |
AC_CONFIG_AUX_DIR([build_tools]) |
25 |
AM_INIT_AUTOMAKE(libspf,1.0.0-p5,jcouzens@codeshare.ca) |
26 |
PACKAGE=$PACKAGE_NAME |
27 |
VERSION=$PACKAGE_VERSION |
28 |
|
29 |
|
30 |
#------------------------------------------------------------------------------- |
31 |
# Required programs |
32 |
#------------------------------------------------------------------------------- |
33 |
|
34 |
AM_CONFIG_HEADER([config.h]) |
35 |
#AC_CONFIG_SRCDIR([src/libspf/main.c]) |
36 |
|
37 |
AC_PROG_CC |
38 |
AC_PROG_LN_S |
39 |
AC_PROG_RANLIB |
40 |
#AC_ARG_PROGRAM |
41 |
AC_PROG_MAKE_SET |
42 |
AC_PROG_CPP |
43 |
AC_PROG_INSTALL |
44 |
AM_CONDITIONAL(GCC, test x$GCC = xyes) |
45 |
|
46 |
# Auto Make |
47 |
#AM_MAINTAINER_MODE |
48 |
|
49 |
|
50 |
#------------------------------------------------------------------------------- |
51 |
# LIBTOOL |
52 |
#------------------------------------------------------------------------------- |
53 |
|
54 |
AC_PROG_LIBTOOL |
55 |
AC_SUBST(enable_shared) |
56 |
AC_SUBST(enable_static) |
57 |
AC_SUBST(LIBTOOL_DEPS) |
58 |
|
59 |
# |
60 |
# Making releases: |
61 |
# LIBSPF_MICRO_VERSION += 1; |
62 |
# LIBSPF_INTERFACE_AGE += 1; |
63 |
# LIBSPF_BINARY_AGE += 1; |
64 |
# if any functions have been added, set LIBSPF_INTERFACE_AGE to 0. |
65 |
# if backwards compatibility has been broken, |
66 |
# set LIBSPF_BINARY_AGE _and_ LIBSPF_INTERFACE_AGE to 0. |
67 |
# |
68 |
|
69 |
LIBSPF_MAJOR_VERSION=1 |
70 |
LIBSPF_MINOR_VERSION=0 |
71 |
LIBSPF_MICRO_VERSION=0 |
72 |
LIBSPF_INTERFACE_AGE=1 |
73 |
LIBSPF_BINARY_AGE=1 |
74 |
LIBSPF_VERSION=$LIBSPF_MAJOR_VERSION.$LIBSPF_MINOR_VERSION.$LIBSPF_MICRO_VERSION |
75 |
|
76 |
AC_SUBST(LIBSPF_MAJOR_VERSION) |
77 |
AC_SUBST(LIBSPF_MINOR_VERSION) |
78 |
AC_SUBST(LIBSPF_MICRO_VERSION) |
79 |
AC_SUBST(LIBSPF_VERSION) |
80 |
AC_SUBST(LIBSPF_INTERFACE_AGE) |
81 |
AC_SUBST(LIBSPF_BINARY_AGE) |
82 |
|
83 |
# -version-info "$(LT_CURRENT):$(LT_REVISION):$(LT_AGE)" \ |
84 |
# -release $(LT_RELEASE) |
85 |
# libtool versioning |
86 |
|
87 |
LT_CURRENT="0" |
88 |
LT_REVISION="26" |
89 |
LT_AGE="0" |
90 |
LT_RELEASE="1.0" |
91 |
|
92 |
echo "" |
93 |
echo "--------------------------------------------------------------------------------" |
94 |
echo "" |
95 |
echo "LIBTOOL Version ........ ${LIBSPF_MAJOR_VERSION}.${LIBSPF_MINOR_VERSION}.${LIBSPF_MICRO_VERSION}" |
96 |
echo "LIBTOOL Interface Age .. $LIBSPF_INTERFACE_AGE" |
97 |
echo "LIBTOOL Binary Age ..... $LIBSPF_BINARY_AGE" |
98 |
echo "LIBTOOL Current ........ $LT_CURRENT" |
99 |
echo "LIBTOOL Revision ....... $LT_REVISION" |
100 |
echo "LIBTOOL Age ............ $LT_AGE" |
101 |
echo "LIBTOOL Release ........ $LT_RELEASE" |
102 |
echo "" |
103 |
echo "--------------------------------------------------------------------------------" |
104 |
echo "" |
105 |
|
106 |
|
107 |
#------------------------------------------------------------------------------- |
108 |
# LIBTOOL relating substitutionssn |
109 |
#------------------------------------------------------------------------------- |
110 |
|
111 |
AC_SUBST(LT_RELEASE) |
112 |
AC_SUBST(LT_CURRENT) |
113 |
AC_SUBST(LT_REVISION) |
114 |
AC_SUBST(LT_AGE) |
115 |
|
116 |
|
117 |
#------------------------------------------------------------------------------- |
118 |
# Check for some library functions |
119 |
#------------------------------------------------------------------------------- |
120 |
|
121 |
AC_CHECK_LIB([c], [exit]) |
122 |
AC_CHECK_LIB([nsl], [inet_pton]) |
123 |
AC_CHECK_LIB([socket], [socket]) |
124 |
|
125 |
AC_CHECK_LIB([spf2], [SPF_sanitize], LIBSPF2_POOPOO="true") |
126 |
if test "$LIBSPF2_POOPOO" ; then |
127 |
AC_MSG_WARN(["My word, what is that awful stench!? Oh its libspf2"]) |
128 |
AC_MSG_WARN(["Thanks to these trolls I have no second versioning"]) |
129 |
AC_MSG_WARN(["number... http://moscow.6o4.ca/ for more info"]) |
130 |
fi |
131 |
|
132 |
|
133 |
#------------------------------------------------------------------------------- |
134 |
# Check up on GCC |
135 |
#------------------------------------------------------------------------------- |
136 |
|
137 |
# We don't want gcc 2.7 |
138 |
AC_MSG_CHECKING([for a supported version of gcc]) |
139 |
|
140 |
gcc_version=`${CC} --version | head -n 1` |
141 |
gcc_special_cflags="" |
142 |
case "${gcc_version}" in |
143 |
2.7.*) |
144 |
AC_MSG_RESULT([no (${gcc_version})]) |
145 |
AC_MSG_ERROR([please use a recent (>= gcc-2.95) version of gcc]) |
146 |
;; |
147 |
2.95.*) |
148 |
AC_MSG_RESULT([yes (${gcc_version}) using %d instead of %zu]) |
149 |
AC_SUBST(UNSIGNED_INT_ARG, "%d") |
150 |
gcc_special_cflags="-mcpu=pentium -malign-loops=5 -malign-jumps=5 -malign-functions=5" |
151 |
;; |
152 |
3.*) |
153 |
AC_MSG_RESULT([yes (${gcc_version}) using -falign instead of -malign]) |
154 |
AC_SUBST(UNSIGNED_INT_ARG, "%zu") |
155 |
gcc_special_cflags="-mcpu=pentium -falign-loops=5 -falign-jumps=5 -falign-functions=5" |
156 |
;; |
157 |
4.*) |
158 |
AC_MSG_RESULT([yes (${gcc_version}) using -falign instead of -malign]) |
159 |
AC_SUBST(UNSIGNED_INT_ARG, "%zu") |
160 |
gcc_special_cflags="-mcpu=pentium -falign-loops=5 -falign-jumps=5 -falign-functions=5" |
161 |
;; |
162 |
*) |
163 |
AC_MSG_RESULT([ok (${gcc_version})]) |
164 |
AC_SUBST(UNSIGNED_INT_ARG, "%zu") |
165 |
;; |
166 |
esac |
167 |
|
168 |
|
169 |
#------------------------------------------------------------------------------- |
170 |
# Define special resolver flags for various operating systems |
171 |
#------------------------------------------------------------------------------- |
172 |
|
173 |
case "$host" in |
174 |
*-*-darwin*) |
175 |
AC_DEFINE([_WITH_DARWINPPC],[],["Darwin/OSX"]) |
176 |
;; |
177 |
*-*-sunos4.1.1*) |
178 |
LIBSPF_RESOLV_LIB="-lnsl -lsocket" |
179 |
;; |
180 |
*-*-solaris*) |
181 |
extralibflags="-R$libdir" |
182 |
AC_MSG_WARN(Solaris install detected. Using extralibflags for linking: $extralibflags) |
183 |
LIBSPF_RESOLV_LIB="-lnsl -lsocket" |
184 |
;; |
185 |
*-*-sunos*) |
186 |
LIBSPF_RESOLV_LIB="-lnsl -lsocket" |
187 |
;; |
188 |
*-*-freebsd*) |
189 |
AC_DEFINE([_WITH_FREEBSD],[],["FreeBSD"]) |
190 |
LIBSPF_RESOLV_LIB="-lc" |
191 |
;; |
192 |
*-*-netbsd*) |
193 |
;; |
194 |
*-*-openbsd*) |
195 |
AC_DEFINE([_WITH_OPENBSD],[],["OpenBSD"]) |
196 |
;; |
197 |
*) |
198 |
extralibflags="" |
199 |
LIBSPF_RESOLV_LIB="-lresolv" |
200 |
;; |
201 |
esac |
202 |
#AC_DEFINE_UNQUOTED(LIBSPF_RESOLV_LIB,"$LIBSPF_RESOLV_LIB","") |
203 |
|
204 |
#------------------------------------------------------------------------------- |
205 |
# Checks for header files. |
206 |
#------------------------------------------------------------------------------- |
207 |
|
208 |
AC_HEADER_STDC |
209 |
AC_CHECK_HEADERS([arpa/inet.h, netdb.h, netinet/in.h, stdlib.h, \ |
210 |
string.h, strings.h, sys/socket.h unistd.h, error.h, inttypes.h]) |
211 |
|
212 |
|
213 |
#------------------------------------------------------------------------------- |
214 |
# Required Types, structures and other compiler requirements |
215 |
#------------------------------------------------------------------------------- |
216 |
|
217 |
AC_C_CONST |
218 |
AC_C_INLINE |
219 |
AC_TYPE_SIZE_T |
220 |
AC_STRUCT_TM |
221 |
AC_C_CHAR_UNSIGNED |
222 |
AC_CHECK_TYPES([u_char, time_t]) |
223 |
|
224 |
|
225 |
#------------------------------------------------------------------------------- |
226 |
# Required functions |
227 |
#------------------------------------------------------------------------------- |
228 |
|
229 |
AC_FUNC_MALLOC |
230 |
AC_FUNC_REALLOC |
231 |
AC_FUNC_STRFTIME |
232 |
AC_CHECK_FUNCS([gethostbyname, inet_ntoa, memset, strcasecmp, \ |
233 |
localtime_r, strchr, strdup, strrchr, strstr, mkdir]) |
234 |
|
235 |
|
236 |
#------------------------------------------------------------------------------- |
237 |
# __BEGIN_DECLS / __END_DECLS defined ? |
238 |
#------------------------------------------------------------------------------- |
239 |
|
240 |
AC_MSG_CHECKING([__BEGIN_DECLS]) |
241 |
AC_COMPILE_IFELSE([ |
242 |
#include <features.h> |
243 |
__BEGIN_DECLS |
244 |
extern int x; |
245 |
__END_DECLS], |
246 |
[AC_MSG_RESULT(yes) |
247 |
AC_DEFINE(HAVE__BEGIN_DECLS,1, |
248 |
[Define to 1 if declarations in headers are surrounded by __{BEGIN,END}_DECLS]) |
249 |
AC_SUBST(__BEGIN_DECLS,__BEGIN_DECLS) |
250 |
AC_SUBST(__END_DECLS,__END_DECLS)], |
251 |
[AC_MSG_RESULT(no) |
252 |
AC_SUBST_FILE(__BEGIN_DECLS_INCL) |
253 |
__BEGIN_DECLS_INCL=$srcdir/conf/begin_decls |
254 |
AC_SUBST_FILE(__END_DECLS_INCL) |
255 |
__END_DECLS_INCL=$srcdir/conf/end_decls] |
256 |
) |
257 |
|
258 |
|
259 |
#------------------------------------------------------------------------------- |
260 |
# Unsigned int types |
261 |
#------------------------------------------------------------------------------- |
262 |
|
263 |
dnl AC_COMPILE_CHECK_SIZEOF (TYPE SUPPOSED-SIZE) |
264 |
dnl abort if the given type does not have the supposed size |
265 |
AC_DEFUN([AC_COMPILE_CHECK_SIZEOF], |
266 |
[AC_MSG_CHECKING(that size of $1 is $2) |
267 |
AC_TRY_COMPILE([],[switch (0) case 0: case (sizeof ($1) == $2):;],[], |
268 |
[AC_MSG_ERROR([can not build a default inttypes.h])]) |
269 |
AC_MSG_RESULT([yes])]) |
270 |
|
271 |
dnl Our own version of AC_CHECK_SIZEOF(int); fixes a bug when sizeof() can't |
272 |
dnl be printed with "%d", and avoids a warning for cross-compiling. |
273 |
|
274 |
AC_MSG_CHECKING(size of int) |
275 |
AC_CACHE_VAL(ac_cv_sizeof_int, |
276 |
[AC_TRY_RUN([#include <stdio.h> |
277 |
main() |
278 |
{ |
279 |
FILE *f=fopen("conftestval", "w"); |
280 |
if (!f) exit(1); |
281 |
fprintf(f, "%d\n", (int)sizeof(int)); |
282 |
exit(0); |
283 |
}], |
284 |
ac_cv_sizeof_int=`cat conftestval`, |
285 |
ac_cv_sizeof_int=0, |
286 |
AC_MSG_ERROR(failed to compile test program))]) |
287 |
AC_MSG_RESULT($ac_cv_sizeof_int) |
288 |
AC_DEFINE_UNQUOTED(SIZEOF_INT, [$ac_cv_sizeof_int], [Check to fix sizeof bug that can't print %d]) |
289 |
#AC_DEFINE([SIZEOF_INT], [$ac_cv_sizeof_int], [Check to fix sizeof bug that can't print %d]) |
290 |
|
291 |
AC_DEFUN([AC_CREATE_STDINT_H], |
292 |
[# ------ AC CREATE STDINT H ------------------------------------- |
293 |
AC_MSG_CHECKING([for stdint-types....]) |
294 |
ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)` |
295 |
if test "$ac_stdint_h" = "stdint.h" ; then |
296 |
AC_MSG_RESULT("(are you sure you want them in ./stdint.h?)") |
297 |
elif test "$ac_stdint_h" = "inttypes.h" ; then |
298 |
AC_MSG_RESULT("(are you sure you want them in ./inttypes.h?)") |
299 |
else |
300 |
AC_MSG_RESULT("(putting them into $ac_stdint_h)") |
301 |
fi |
302 |
|
303 |
inttype_headers=`echo inttypes.h sys/inttypes.h sys/inttypes.h $2 \ |
304 |
| sed -e 's/,/ /g'` |
305 |
|
306 |
ac_cv_header_stdint_x="no-file" |
307 |
ac_cv_header_stdint_o="no-file" |
308 |
ac_cv_header_stdint_u="no-file" |
309 |
for i in stdint.h $inttype_headers ; do |
310 |
unset ac_cv_type_uintptr_t |
311 |
unset ac_cv_type_uint64_t |
312 |
_AC_CHECK_TYPE_NEW(uintptr_t,[ac_cv_header_stdint_x=$i],dnl |
313 |
continue,[#include <$i>]) |
314 |
AC_CHECK_TYPE(uint64_t,[and64="(uint64_t too)"],[and64=""],[#include<$i>]) |
315 |
AC_MSG_RESULT(... seen our uintptr_t in $i $and64) |
316 |
break; |
317 |
done |
318 |
if test "$ac_cv_header_stdint_x" = "no-file" ; then |
319 |
for i in stdint.h $inttype_headers ; do |
320 |
unset ac_cv_type_uint32_t |
321 |
unset ac_cv_type_uint64_t |
322 |
AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],dnl |
323 |
continue,[#include <$i>]) |
324 |
AC_CHECK_TYPE(uint64_t,[and64="(uint64_t too)"],[and64=""],[#include<$i>]) |
325 |
AC_MSG_RESULT(... seen our uint32_t in $i $and64) |
326 |
break; |
327 |
done |
328 |
if test "$ac_cv_header_stdint_o" = "no-file" ; then |
329 |
for i in sys/types.h $inttype_headers ; do |
330 |
unset ac_cv_type_u_int32_t |
331 |
unset ac_cv_type_u_int64_t |
332 |
AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],dnl |
333 |
continue,[#include <$i>]) |
334 |
AC_CHECK_TYPE(uint64_t,[and64="(u_int64_t too)"],[and64=""],[#include<$i>]) |
335 |
AC_MSG_RESULT(... seen our u_int32_t in $i $and64) |
336 |
break; |
337 |
done |
338 |
fi |
339 |
fi |
340 |
|
341 |
# ----------------- DONE inttypes.h checks MAYBE C basic types -------- |
342 |
|
343 |
if test "$ac_cv_header_stdint_x" = "no-file" ; then |
344 |
AC_COMPILE_CHECK_SIZEOF(char) |
345 |
AC_COMPILE_CHECK_SIZEOF(short) |
346 |
AC_COMPILE_CHECK_SIZEOF(int) |
347 |
AC_COMPILE_CHECK_SIZEOF(long) |
348 |
AC_COMPILE_CHECK_SIZEOF(void*) |
349 |
ac_cv_header_stdint_test="yes" |
350 |
else |
351 |
ac_cv_header_stdint_test="no" |
352 |
fi |
353 |
|
354 |
# ----------------- DONE inttypes.h checks START header ------------- |
355 |
_ac_stdint_h=AS_TR_CPP(_$ac_stdint_h) |
356 |
AC_MSG_RESULT(creating $ac_stdint_h : $_ac_stdint_h) |
357 |
echo "#ifndef" $_ac_stdint_h >$ac_stdint_h |
358 |
echo "#define" $_ac_stdint_h "1" >>$ac_stdint_h |
359 |
echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint_h |
360 |
echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint_h |
361 |
if test "$GCC" = "yes" ; then |
362 |
echo "/* generated using a gnu compiler version" `$CC --version` "*/" \ |
363 |
>>$ac_stdint_h |
364 |
else |
365 |
echo "/* generated using $CC */" >>$ac_stdint_h |
366 |
fi |
367 |
echo "" >>$ac_stdint_h |
368 |
|
369 |
if test "$ac_cv_header_stdint_x" != "no-file" ; then |
370 |
ac_cv_header_stdint="$ac_cv_header_stdint_x" |
371 |
elif test "$ac_cv_header_stdint_o" != "no-file" ; then |
372 |
ac_cv_header_stdint="$ac_cv_header_stdint_o" |
373 |
elif test "$ac_cv_header_stdint_u" != "no-file" ; then |
374 |
ac_cv_header_stdint="$ac_cv_header_stdint_u" |
375 |
else |
376 |
ac_cv_header_stdint="stddef.h" |
377 |
fi |
378 |
|
379 |
# ----------------- See if int_least and int_fast types are present |
380 |
unset ac_cv_type_int_least32_t |
381 |
unset ac_cv_type_int_fast32_t |
382 |
AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>]) |
383 |
AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>]) |
384 |
|
385 |
if test "$ac_cv_header_stdint" != "stddef.h" ; then |
386 |
if test "$ac_cv_header_stdint" != "stdint.h" ; then |
387 |
AC_MSG_RESULT(..adding include stddef.h) |
388 |
echo "#include <stddef.h>" >>$ac_stdint_h |
389 |
fi ; fi |
390 |
AC_MSG_RESULT(..adding include $ac_cv_header_stdint) |
391 |
echo "#include <$ac_cv_header_stdint>" >>$ac_stdint_h |
392 |
echo "" >>$ac_stdint_h |
393 |
|
394 |
# ----------------- DONE header START basic int types ------------- |
395 |
if test "$ac_cv_header_stdint_x" = "no-file" ; then |
396 |
AC_MSG_RESULT(... need to look at C basic types) |
397 |
dnl ac_cv_header_stdint_test="yes" # moved up before creating the file |
398 |
else |
399 |
AC_MSG_RESULT(... seen good stdint.h inttypes) |
400 |
dnl ac_cv_header_stdint_test="no" # moved up before creating the file |
401 |
fi |
402 |
|
403 |
if test "$ac_cv_header_stdint_u" != "no-file" ; then |
404 |
AC_MSG_RESULT(... seen bsd/sysv typedefs) |
405 |
cat >>$ac_stdint_h <<EOF |
406 |
|
407 |
/* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */ |
408 |
typedef u_int8_t uint8_t; |
409 |
typedef u_int16_t uint16_t; |
410 |
typedef u_int32_t uint32_t; |
411 |
EOF |
412 |
cat >>$ac_stdint_h <<EOF |
413 |
|
414 |
/* glibc compatibility */ |
415 |
#ifndef __int8_t_defined |
416 |
#define __int8_t_defined |
417 |
#endif |
418 |
EOF |
419 |
fi |
420 |
|
421 |
ac_cv_sizeof_x="$ac_cv_sizeof_char:$ac_cv_sizeof_short" |
422 |
ac_cv_sizeof_X="$ac_cv_sizeof_x:$ac_cv_sizeof_int" |
423 |
ac_cv_sizeof_X="$ac_cv_sizeof_X:$ac_cv_sizeof_voidp:$ac_cv_sizeof_long" |
424 |
if test "$ac_cv_header_stdint" = "stddef.h" ; then |
425 |
# we must guess all the basic types. Apart from byte-adressable system, |
426 |
# there a few 32-bit-only dsp-systems. nibble-addressable systems are way off. |
427 |
cat >>$ac_stdint_h <<EOF |
428 |
/* ------------ BITSPECIFIC INTTYPES SECTION --------------- */ |
429 |
EOF |
430 |
t="typedefs for a" |
431 |
case "$ac_cv_sizeof_X" in |
432 |
1:2:2:2:4) AC_MSG_RESULT(..adding $t normal 16-bit system) |
433 |
cat >>$ac_stdint_h <<EOF |
434 |
/* a normal 16-bit system */ |
435 |
typedef unsigned char uint8_t; |
436 |
typedef unsigned short uint16_t; |
437 |
typedef unsigned long uint32_t; |
438 |
#ifndef __int8_t_defined |
439 |
#define __int8_t_defined |
440 |
typedef char int8_t; |
441 |
typedef short int16_t; |
442 |
typedef long int32_t; |
443 |
#endif |
444 |
EOF |
445 |
;; |
446 |
1:2:2:4:4) AC_MSG_RESULT(..adding $t 32-bit system derived from a 16-bit) |
447 |
cat >>$ac_stdint_h <<EOF |
448 |
/* a 32-bit system derived from a 16-bit */ |
449 |
typedef unsigned char uint8_t; |
450 |
typedef unsigned short uint16_t; |
451 |
typedef unsigned int uint32_t; |
452 |
#ifndef __int8_t_defined |
453 |
#define __int8_t_defined |
454 |
typedef char int8_t; |
455 |
typedef short int16_t; |
456 |
typedef int int32_t; |
457 |
#endif |
458 |
EOF |
459 |
;; |
460 |
1:2:4:4:4) AC_MSG_RESULT(..adding $t normal 32-bit system) |
461 |
cat >>$ac_stdint_h <<EOF |
462 |
/* a normal 32-bit system */ |
463 |
typedef unsigned char uint8_t; |
464 |
typedef unsigned short uint16_t; |
465 |
typedef unsigned int uint32_t; |
466 |
#ifndef __int8_t_defined |
467 |
#define __int8_t_defined |
468 |
typedef char int8_t; |
469 |
typedef short int16_t; |
470 |
typedef int int32_t; |
471 |
#endif |
472 |
EOF |
473 |
;; |
474 |
1:2:4:4:8) AC_MSG_RESULT(..adding $t 32-bit system prepared for 64-bit) |
475 |
cat >>$ac_stdint_h <<EOF |
476 |
|
477 |
/* a 32-bit system prepared for 64-bit */ |
478 |
typedef unsigned char uint8_t; |
479 |
typedef unsigned short uint16_t; |
480 |
typedef unsigned int uint32_t; |
481 |
#ifndef __int8_t_defined |
482 |
#define __int8_t_defined |
483 |
typedef char int8_t; |
484 |
typedef short int16_t; |
485 |
typedef int int32_t; |
486 |
#endif |
487 |
EOF |
488 |
;; |
489 |
1:2:4:8:8) AC_MSG_RESULT(..adding $t normal 64-bit system) |
490 |
cat >>$ac_stdint_h <<EOF |
491 |
|
492 |
/* a normal 64-bit system */ |
493 |
typedef unsigned char uint8_t; |
494 |
typedef unsigned short uint16_t; |
495 |
typedef unsigned int uint32_t; |
496 |
#ifndef __int8_t_defined |
497 |
#define __int8_t_defined |
498 |
typedef char int8_t; |
499 |
typedef short int16_t; |
500 |
typedef int int32_t; |
501 |
#endif |
502 |
EOF |
503 |
;; |
504 |
1:2:4:8:4) AC_MSG_RESULT(..adding $t 64-bit system derived from a 32-bit) |
505 |
cat >>$ac_stdint_h <<EOF |
506 |
|
507 |
/* a 64-bit system derived from a 32-bit system */ |
508 |
typedef unsigned char uint8_t; |
509 |
typedef unsigned short uint16_t; |
510 |
typedef unsigned int uint32_t; |
511 |
#ifndef __int8_t_defined |
512 |
#define __int8_t_defined |
513 |
typedef char int8_t; |
514 |
typedef short int16_t; |
515 |
typedef int int32_t; |
516 |
#endif |
517 |
EOF |
518 |
;; |
519 |
*) |
520 |
AC_MSG_ERROR([ $ac_cv_sizeof_X dnl |
521 |
what is that a system? contact the author, quick! http://ac-archive.sf.net]) |
522 |
exit 1 |
523 |
;; |
524 |
esac |
525 |
fi |
526 |
|
527 |
# ------------- DONE basic int types START int64_t types ------------ |
528 |
if test "$ac_cv_type_uint64_t" = "yes" |
529 |
then AC_MSG_RESULT(... seen good uint64_t) |
530 |
cat >>$ac_stdint_h <<EOF |
531 |
|
532 |
/* system headers have good uint64_t */ |
533 |
#ifndef _HAVE_UINT64_T |
534 |
#define _HAVE_UINT64_T |
535 |
#endif |
536 |
EOF |
537 |
|
538 |
elif test "$ac_cv_type_u_int64_t" = "yes" |
539 |
then AC_MSG_RESULT(..adding typedef u_int64_t uint64_t) |
540 |
cat >>$ac_stdint_h <<EOF |
541 |
|
542 |
/* system headers have an u_int64_t */ |
543 |
#ifndef _HAVE_UINT64_T |
544 |
#define _HAVE_UINT64_T |
545 |
typedef u_int64_t uint64_t; |
546 |
#endif |
547 |
EOF |
548 |
else AC_MSG_RESULT(..adding generic uint64_t runtime checks) |
549 |
cat >>$ac_stdint_h <<EOF |
550 |
|
551 |
/* -------------------- 64 BIT GENERIC SECTION -------------------- */ |
552 |
/* here are some common heuristics using compiler runtime specifics */ |
553 |
#if defined __STDC_VERSION__ && defined __STDC_VERSION__ > 199901L |
554 |
|
555 |
#ifndef _HAVE_UINT64_T |
556 |
#define _HAVE_UINT64_T |
557 |
typedef long long int64_t; |
558 |
typedef unsigned long long uint64_t; |
559 |
#endif |
560 |
|
561 |
#elif !defined __STRICT_ANSI__ |
562 |
#if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__ |
563 |
|
564 |
#ifndef _HAVE_UINT64_T |
565 |
#define _HAVE_UINT64_T |
566 |
typedef __int64 int64_t; |
567 |
typedef unsigned __int64 uint64_t; |
568 |
#endif |
569 |
|
570 |
#elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__ |
571 |
dnl /* note: all ELF-systems seem to have loff-support which needs 64-bit */ |
572 |
|
573 |
#if !defined _NO_LONGLONG |
574 |
#ifndef _HAVE_UINT64_T |
575 |
#define _HAVE_UINT64_T |
576 |
typedef long long int64_t; |
577 |
typedef unsigned long long uint64_t; |
578 |
#endif |
579 |
#endif |
580 |
|
581 |
#elif defined __alpha || (defined __mips && defined _ABIN32) |
582 |
|
583 |
#if !defined _NO_LONGLONG |
584 |
#ifndef _HAVE_UINT64_T |
585 |
#define _HAVE_UINT64_T |
586 |
typedef long int64_t; |
587 |
typedef unsigned long uint64_t; |
588 |
#endif |
589 |
#endif |
590 |
/* compiler/cpu type ... or just ISO C99 */ |
591 |
#endif |
592 |
#endif |
593 |
EOF |
594 |
|
595 |
# plus a default 64-bit for systems that are likely to be 64-bit ready |
596 |
case "$ac_cv_sizeof_x:$ac_cv_sizeof_voidp:$ac_cv_sizeof_long" in |
597 |
1:2:8:8) AC_MSG_RESULT(..adding uint64_t default, normal 64-bit system) |
598 |
cat >>$ac_stdint_h <<EOF |
599 |
/* DEFAULT: */ |
600 |
/* seen normal 64-bit system, CC has sizeof(long and void*) == 8 bytes */ |
601 |
#ifndef _HAVE_UINT64_T |
602 |
#define _HAVE_UINT64_T |
603 |
typedef long int64_t; |
604 |
typedef unsigned long uint64_t; |
605 |
#endif |
606 |
EOF |
607 |
;; |
608 |
1:2:4:8) AC_MSG_RESULT(..adding uint64_t default, typedef to long) |
609 |
cat >>$ac_stdint_h <<EOF |
610 |
/* DEFAULT: */ |
611 |
/* seen 32-bit system prepared for 64-bit, CC has sizeof(long) == 8 bytes */ |
612 |
#ifndef _HAVE_UINT64_T |
613 |
#define _HAVE_UINT64_T |
614 |
typedef long int64_t; |
615 |
typedef unsigned long uint64_t; |
616 |
#endif |
617 |
EOF |
618 |
;; |
619 |
1:2:8:4) AC_MSG_RESULT(..adding uint64_t default, typedef long long) |
620 |
cat >>$ac_stdint_h <<EOF |
621 |
/* DEFAULT: */ |
622 |
/* seen 64-bit derived from a 32-bit, CC has sizeof(long) == 4 bytes */ |
623 |
#ifndef _HAVE_UINT64_T |
624 |
#define _HAVE_UINT64_T |
625 |
typedef long long int64_t; |
626 |
typedef unsigned long long uint64_t; |
627 |
#endif |
628 |
EOF |
629 |
;; |
630 |
*) |
631 |
cat >>$ac_stdint_h <<EOF |
632 |
/* NOTE: */ |
633 |
/* the configure-checks for the basic types did not make us believe */ |
634 |
/* that we could add a fallback to a 'long long' typedef to int64_t */ |
635 |
EOF |
636 |
esac |
637 |
fi |
638 |
|
639 |
# ------------- DONE int64_t types START intptr types ------------ |
640 |
if test "$ac_cv_header_stdint_x" = "no-file" ; then |
641 |
cat >>$ac_stdint_h <<EOF |
642 |
|
643 |
/* -------------------------- INPTR SECTION --------------------------- */ |
644 |
EOF |
645 |
case "$ac_cv_sizeof_x:$ac_cv_sizeof_voidp" in |
646 |
1:2:2) |
647 |
a="int16_t" ; cat >>$ac_stdint_h <<EOF |
648 |
/* we tested sizeof(void*) to be of 2 chars, hence we declare it 16-bit */ |
649 |
|
650 |
typedef uint16_t uintptr_t; |
651 |
typedef int16_t intptr_t; |
652 |
EOF |
653 |
;; |
654 |
1:2:4) |
655 |
a="int32_t" ; cat >>$ac_stdint_h <<EOF |
656 |
/* we tested sizeof(void*) to be of 4 chars, hence we declare it 32-bit */ |
657 |
|
658 |
typedef uint32_t uintptr_t; |
659 |
typedef int32_t intptr_t; |
660 |
EOF |
661 |
;; |
662 |
1:2:8) |
663 |
a="int64_t" ; cat >>$ac_stdint_h <<EOF |
664 |
/* we tested sizeof(void*) to be of 8 chars, hence we declare it 64-bit */ |
665 |
|
666 |
typedef uint64_t uintptr_t; |
667 |
typedef int64_t intptr_t; |
668 |
EOF |
669 |
;; |
670 |
*) |
671 |
a="long" ; cat >>$ac_stdint_h <<EOF |
672 |
/* we tested sizeof(void*) but got no guess, hence we declare it as if long */ |
673 |
|
674 |
typedef unsigned long uintptr_t; |
675 |
typedef long intptr_t; |
676 |
EOF |
677 |
;; |
678 |
esac |
679 |
AC_MSG_RESULT(..adding typedef $a intptr_t) |
680 |
fi |
681 |
|
682 |
# ------------- DONE intptr types START int_least types ------------ |
683 |
if test "$ac_cv_type_int_least32_t" = "no"; then |
684 |
AC_MSG_RESULT(..adding generic int_least-types) |
685 |
cat >>$ac_stdint_h <<EOF |
686 |
|
687 |
/* --------------GENERIC INT_LEAST ------------------ */ |
688 |
|
689 |
typedef int8_t int_least8_t; |
690 |
typedef int16_t int_least16_t; |
691 |
typedef int32_t int_least32_t; |
692 |
#ifdef _HAVE_UINT64_T |
693 |
typedef int64_t int_least64_t; |
694 |
#endif |
695 |
|
696 |
typedef uint8_t uint_least8_t; |
697 |
typedef uint16_t uint_least16_t; |
698 |
typedef uint32_t uint_least32_t; |
699 |
#ifdef _HAVE_UINT64_T |
700 |
typedef uint64_t uint_least64_t; |
701 |
#endif |
702 |
EOF |
703 |
fi |
704 |
|
705 |
# ------------- DONE intptr types START int_least types ------------ |
706 |
if test "$ac_cv_type_int_fast32_t" = "no"; then |
707 |
AC_MSG_RESULT(..adding generic int_fast-types) |
708 |
cat >>$ac_stdint_h <<EOF |
709 |
|
710 |
/* --------------GENERIC INT_FAST ------------------ */ |
711 |
|
712 |
typedef int8_t int_fast8_t; |
713 |
typedef int32_t int_fast16_t; |
714 |
typedef int32_t int_fast32_t; |
715 |
#ifdef _HAVE_UINT64_T |
716 |
typedef int64_t int_fast64_t; |
717 |
#endif |
718 |
|
719 |
typedef uint8_t uint_fast8_t; |
720 |
typedef uint32_t uint_fast16_t; |
721 |
typedef uint32_t uint_fast32_t; |
722 |
#ifdef _HAVE_UINT64_T |
723 |
typedef uint64_t uint_fast64_t; |
724 |
#endif |
725 |
EOF |
726 |
fi |
727 |
|
728 |
if test "$ac_cv_header_stdint_x" = "no-file" ; then |
729 |
cat >>$ac_stdint_h <<EOF |
730 |
|
731 |
#ifdef _HAVE_UINT64_T |
732 |
typedef int64_t intmax_t; |
733 |
typedef uint64_t uintmax_t; |
734 |
#else |
735 |
typedef long int intmax_t; |
736 |
typedef unsigned long uintmax_t; |
737 |
#endif |
738 |
EOF |
739 |
fi |
740 |
|
741 |
AC_MSG_RESULT(... DONE $ac_stdint_h) |
742 |
cat >>$ac_stdint_h <<EOF |
743 |
|
744 |
/* once */ |
745 |
#endif |
746 |
#endif |
747 |
EOF |
748 |
]) |
749 |
|
750 |
AC_CREATE_STDINT_H(src/libspf/_stdint.h) |
751 |
|
752 |
dnl quote from SunOS-5.8 sys/inttypes.h: |
753 |
dnl Use at your own risk. As of February 1996, the committee is squarely |
754 |
dnl behind the fixed sized types; the "least" and "fast" types are still being |
755 |
dnl discussed. The probability that the "fast" types may be removed before |
756 |
dnl the standard is finalized is high enough that they are not currently |
757 |
dnl implemented. |
758 |
|
759 |
#AC_CHECK_TYPE(u_int8_t, [uint="u_int8_t" |
760 |
# AC_DEFINE(HAVE_U_INT8_T,1,[Define to 1 if type `u_int8_t' is defined])], |
761 |
# AC_CHECK_TYPE(uint8_t, [uint="uint8_t" |
762 |
# AC_DEFINE(HAVE_UINT8_T,1,[Define to 1 if type `uint8_t' is defined])], |
763 |
# [uint="unsigned char"])) |
764 |
#AC_SUBST(U_INT8_T,[$uint]) |
765 |
|
766 |
#AC_CHECK_TYPE(u_int16_t, [uint="u_int16_t" |
767 |
# AC_DEFINE(HAVE_U_INT16_T,1,[Define to 1 if type `u_int16_t' is defined])], |
768 |
# AC_CHECK_TYPE(uint16_t, [uint="uint16_t" |
769 |
# AC_DEFINE(HAVE_UINT16_T,1,[Define to 1 if type `uint16_t' is defined])], |
770 |
# [uint="unsigned short"])) |
771 |
#AC_SUBST(U_INT16_T,[$uint]) |
772 |
|
773 |
#AC_CHECK_TYPE(u_int32_t, [uint="u_int32_t" |
774 |
# AC_DEFINE(HAVE_U_INT32_T,1,[Define to 1 if type `u_int32_t' is defined])], |
775 |
# AC_CHECK_TYPE(uint32_t, [uint="uint32_t" |
776 |
# AC_DEFINE(HAVE_UINT32_T,1,[Define to 1 if type `uint32_t' is defined])], |
777 |
# [uint="unsigned int"])) |
778 |
#AC_SUBST(U_INT32_T,[$uint]) |
779 |
|
780 |
#AC_CHECK_TYPE(uintptr_t, [uint="uintptr_t" |
781 |
# AC_DEFINE(HAVE_UINTPTR_T,1,[Define to 1 if type `uintptr_t' is defined])]) |
782 |
#AC_SUBST(UINTPTR_T,[$uint]) |
783 |
|
784 |
|
785 |
#------------------------------------------------------------------------------- |
786 |
# __FUNCTION__ |
787 |
#------------------------------------------------------------------------------- |
788 |
|
789 |
AC_MSG_CHECKING([__FUNCTION__]) |
790 |
func=none |
791 |
AC_COMPILE_IFELSE( |
792 |
[int x() { f(__FUNCTION__); }], |
793 |
AC_MSG_RESULT([__FUNCTION__]) |
794 |
AC_DEFINE(HAVE___FUNCTION__, [], ["Define to 1 if __FUNCTION__ is defined"]), |
795 |
AC_COMPILE_IFELSE( |
796 |
[int x() { f(__func__); }], |
797 |
AC_MSG_RESULT([__func__]) |
798 |
AC_DEFINE(HAVE___FUNC__, [], ["Define to 1 if __func__ is defined"]))) |
799 |
|
800 |
|
801 |
#------------------------------------------------------------------------------- |
802 |
# Setup build directories |
803 |
#------------------------------------------------------------------------------- |
804 |
|
805 |
LIBSPF_BUILD_DIRS="libspf spfqtool" |
806 |
|
807 |
|
808 |
#------------------------------------------------------------------------------- |
809 |
# Warn people configuring as root.... |
810 |
#------------------------------------------------------------------------------- |
811 |
|
812 |
idcommand="id -u" |
813 |
if test `$idcommand` == "0" |
814 |
then |
815 |
AC_MSG_WARN(=== DO NOT EVER CONFIGURE AS ROOT ===) |
816 |
AC_MSG_WARN(=== UNLESS EXPLICITLY EXPRESSED BY ===) |
817 |
AC_MSG_WARN(=== SUPPLIED DOCUMENTATION FROM A ===) |
818 |
AC_MSG_WARN(=== REPUTABLE AUTHOR! Baka! ===) |
819 |
fi |
820 |
|
821 |
|
822 |
#------------------------------------------------------------------------------- |
823 |
# Check to see if we want to link libbind |
824 |
#------------------------------------------------------------------------------- |
825 |
|
826 |
AC_MSG_CHECKING(whether to link libbind is eanbled) |
827 |
AC_ARG_ENABLE(libbind, |
828 |
[ --enable-libbind Link libbind instead of libresolv (default=no)], |
829 |
[case "${enableval}" in |
830 |
yes) |
831 |
libbind=true |
832 |
AC_MSG_RESULT(yes) |
833 |
;; |
834 |
no) |
835 |
libbind=false |
836 |
AC_MSG_RESULT(no) |
837 |
;; |
838 |
*) |
839 |
AC_MSG_ERROR(bad value ${enableval} for --enable-libbind) |
840 |
;; |
841 |
esac], |
842 |
[libbind=false |
843 |
AC_MSG_RESULT(no)]) |
844 |
|
845 |
if test "$libbind" = "true"; then |
846 |
LIBSPF_RESOLV_LIB="-lbind" |
847 |
fi |
848 |
|
849 |
if test "$libresolv" = "false"; then |
850 |
LIBSPF_RESOLV_LIB="" |
851 |
else |
852 |
|
853 |
#---------------------------------------------------------------------------- |
854 |
# Check to see if we want to link libresolv (default is yes) |
855 |
#------------------------------------------------------------------ |
856 |
|
857 |
dnl res_query has been seen in libc, libbind and libresolv |
858 |
AC_CHECK_FUNCS(res_query, res_search) |
859 |
|
860 |
if test "x-$ac_cv_func_res_query" = "x-yes" ; then |
861 |
have_res_query=yes |
862 |
fi |
863 |
|
864 |
if test "x-$ac_cv_func_res_search" = "x-yes" ; then |
865 |
have_res_search=yes |
866 |
fi |
867 |
|
868 |
if test "x-$have_res_query" = "x-no" || test "x-$have_res_search" = "no" ; then |
869 |
AC_CHECK_LIB(resolv, res_query) |
870 |
if test "x-$ac_cv_lib_resolv_res_query" = "x-yes" ; then |
871 |
have_res_query=yes |
872 |
else |
873 |
AC_CHECK_LIB(bind, res_query) |
874 |
if test "x-$ac_cv_lib_bind_res_query" = "x-yes" ; then |
875 |
have_res_query=yes |
876 |
else |
877 |
dnl some glibcs have res_query as a macro, so work around it |
878 |
AC_MSG_CHECKING([for res_query in -lresolv (alternate version)]) |
879 |
save_libs="$LIBS" |
880 |
libresolv=true |
881 |
LIBS="-lresolv $LIBS" |
882 |
LIBSPF_RESOLV_LIB="-lresolv" |
883 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <resolv.h>]], |
884 |
[[res_query(0,0,0,0,0)]])], |
885 |
[AC_MSG_RESULT(yes) |
886 |
have_res_query=yes], |
887 |
[AC_MSG_RESULT(no) |
888 |
libresolv=false |
889 |
LIBS="$save_libs"]) |
890 |
fi |
891 |
fi |
892 |
fi |
893 |
|
894 |
if test "x-$have_res_query" = "x-yes" ; then |
895 |
AC_DEFINE(HAVE_RES_QUERY) |
896 |
libresolv=true |
897 |
dnl no res_query, do windows compat checks |
898 |
else |
899 |
dnl !!! implement these checks |
900 |
AC_MSG_WARN([required function res_query not found]) |
901 |
libresolv=false |
902 |
fi |
903 |
|
904 |
fi |
905 |
|
906 |
# Checks for libraries. |
907 |
AC_CHECK_LIB([resolv], [res_search]) |
908 |
AC_SUBST(LIBSPF_RESOLV_LIB) |
909 |
|
910 |
|
911 |
#------------------------------------------------------------------------------- |
912 |
# Check to see if we want to enable debugging |
913 |
#------------------------------------------------------------------------------- |
914 |
|
915 |
AC_MSG_CHECKING(whether DEBUG is eanbled) |
916 |
AC_ARG_ENABLE(debug, |
917 |
[ --enable-debug Enables debug option (default=no)], |
918 |
[case "${enableval}" in |
919 |
yes) |
920 |
debug=true |
921 |
AC_MSG_RESULT(yes) |
922 |
;; |
923 |
no) |
924 |
debug=false |
925 |
AC_MSG_RESULT(no) |
926 |
;; |
927 |
*) |
928 |
AC_MSG_ERROR(bad value ${enableval} for --enable-debug) |
929 |
;; |
930 |
esac], |
931 |
[debug=false |
932 |
AC_MSG_RESULT(no)]) |
933 |
|
934 |
CFLAGS="" |
935 |
if test "$debug" = "true"; then |
936 |
CFLAGS="-ggdb -O -D_SPF_DEBUG" |
937 |
else |
938 |
AC_MSG_RESULT(Enabling GCC optimisations) |
939 |
CFLAGS="$CFLAGS -O3 -ffast-math -fomit-frame-pointer" |
940 |
|
941 |
if [[ "x$GCC_VERSION" = "x3" ]]; then |
942 |
AC_MSG_RESULT(Enabling GCC v3 optimizations) |
943 |
CFLAGS="$CFLAGS -minline-all-stringops -fno-math-errno" |
944 |
fi |
945 |
fi |
946 |
|
947 |
case "${host_cpu}" in |
948 |
i?86) |
949 |
AC_MSG_RESULT([CPU: ${host_cpu}; Enabling pentium optimisations]) |
950 |
# cannot do malign-double as we link to other libraries and it |
951 |
# would break binary compatibility |
952 |
CFLAGS="$CFLAGS ${gcc_special_cflags}" |
953 |
;; |
954 |
*) |
955 |
AC_MSG_RESULT(Please e-mail author optimizations for this cpu) |
956 |
;; |
957 |
esac |
958 |
|
959 |
|
960 |
#------------------------------------------------------------------------------- |
961 |
# Check to see if we want to enable debugging output to logfile |
962 |
#------------------------------------------------------------------------------- |
963 |
|
964 |
if test "$debug" = "true"; then |
965 |
AC_MSG_CHECKING(whether you want debug output to a logfile) |
966 |
AC_ARG_ENABLE(debug_logfile, |
967 |
[ --enable-debug-logfile Enables logging debug output (default=yes)], |
968 |
[case "${enableval}" in |
969 |
yes) |
970 |
debug_logfile=true |
971 |
AC_MSG_RESULT(yes) |
972 |
;; |
973 |
no) |
974 |
debug_logfile=false |
975 |
AC_MSG_RESULT(no) |
976 |
;; |
977 |
*) |
978 |
AC_MSG_ERROR(bad value ${enableval} for --enable-debug-logfile) |
979 |
;; |
980 |
esac], |
981 |
[debug_logfile=true |
982 |
AC_MSG_RESULT(no)]) |
983 |
|
984 |
if test "$debug_logfile" = "true"; then |
985 |
CFLAGS="-D_SPF_DEBUG_LOGFILE $CFLAGS" |
986 |
fi |
987 |
fi |
988 |
|
989 |
|
990 |
#------------------------------------------------------------------------------- |
991 |
# Check to see if we want to enable logfile statistics |
992 |
#------------------------------------------------------------------------------- |
993 |
|
994 |
logfile_stats=false |
995 |
AC_MSG_CHECKING(whether you want logfile statistics) |
996 |
AC_ARG_ENABLE(logfile_stats, |
997 |
[ --enable-logfile-stats Enables logfile stats (default=no)], |
998 |
[case "${enableval}" in |
999 |
yes) |
1000 |
logfile_stats=true |
1001 |
AC_MSG_RESULT(yes) |
1002 |
;; |
1003 |
no) |
1004 |
logfile_stats=false |
1005 |
AC_MSG_RESULT(no) |
1006 |
;; |
1007 |
*) |
1008 |
AC_MSG_ERROR(bad value ${enableval} for --enable-logfile-stats) |
1009 |
;; |
1010 |
esac], |
1011 |
[logfile_stats=false |
1012 |
AC_MSG_RESULT(no)]) |
1013 |
|
1014 |
if test "$logfile_stats" = "true"; then |
1015 |
CFLAGS="-D_SPF_LOGFILE_STATS $CFLAGS" |
1016 |
fi |
1017 |
|
1018 |
|
1019 |
#------------------------------------------------------------------------------- |
1020 |
# Check whether to enable a memset after each malloc |
1021 |
#------------------------------------------------------------------------------- |
1022 |
|
1023 |
rfc_recursion=false |
1024 |
AC_MSG_CHECKING(whether to abide by the RFC as regards recursiveness) |
1025 |
AC_ARG_ENABLE(rfc_recursion, |
1026 |
[ --enable-rfc-recursion Change SPF recursion to 20 (as per RFC) (default=no)], |
1027 |
[case "${enableval}" in |
1028 |
yes) |
1029 |
rfc_recursion=true |
1030 |
AC_MSG_RESULT(yes) |
1031 |
;; |
1032 |
no) |
1033 |
rfc_recursion=false |
1034 |
AC_MSG_RESULT(no) |
1035 |
;; |
1036 |
*) |
1037 |
AC_MSG_ERROR(bad value ${enableval} for --enable-rfc-recursion) |
1038 |
;; |
1039 |
esac], |
1040 |
[rfc_recursion=false |
1041 |
AC_MSG_RESULT(no)]) |
1042 |
|
1043 |
if test "$rfc_recursion" = "true"; then |
1044 |
CFLAGS="-D_RFC_RECURSION $CFLAGS" |
1045 |
AC_MSG_WARN(=== THE INTERNET IS FULL OF ILLITERATE AND LAZY PEOPLE ===) |
1046 |
sleep 1 |
1047 |
AC_MSG_WARN(=== MANY OF WHOM CAN NOT PUBLISH A VALID SPF RECORD TO ===) |
1048 |
sleep 1 |
1049 |
AC_MSG_WARN(=== SAVE THEIR LIFE. MANY OF SUCH INDIVIDUALS OFTEN ===) |
1050 |
sleep 1 |
1051 |
AC_MSG_WARN(=== LINK RECORDS TOGETHER FORMING A RECURSIVE PARSING ===) |
1052 |
sleep 1 |
1053 |
AC_MSG_WARN(=== LOOP. YOU HAVE BEEN WARNED. THE RFC STATES THAT ===) |
1054 |
sleep 1 |
1055 |
AC_MSG_WARN(=== SPF PARSERS MUST SUPPORT AT LEAST TWENTY LEVELS OF ===) |
1056 |
sleep 1 |
1057 |
AC_MSG_WARN(=== RECURSION. THIS HAS PROVEN TO BE POINTLESS GIVEN ===) |
1058 |
sleep 1 |
1059 |
AC_MSG_WARN(=== GIVEN THE ABUNDANCE OF STUPIDITY PREVALENT ON THE ===) |
1060 |
sleep 1 |
1061 |
AC_MSG_WARN(=== INTERNET. YOU HAVE BEEN WARNED!! ===) |
1062 |
sleep 5 |
1063 |
fi |
1064 |
|
1065 |
|
1066 |
#------------------------------------------------------------------------------- |
1067 |
# Check whether to enable a memset after each malloc |
1068 |
#------------------------------------------------------------------------------- |
1069 |
|
1070 |
paranoid_malloc=true |
1071 |
AC_MSG_CHECKING(whether to memset after every malloc (paranoid malloc)?) |
1072 |
AC_ARG_ENABLE(paranoid_malloc, |
1073 |
[ --enable-paranoid-malloc Enables a memset of every malloc to NULL (default=yes)], |
1074 |
[case "${enableval}" in |
1075 |
yes) |
1076 |
paranoid_malloc=true |
1077 |
AC_MSG_RESULT(yes) |
1078 |
;; |
1079 |
no) |
1080 |
paranoid_malloc=false |
1081 |
AC_MSG_RESULT(no) |
1082 |
;; |
1083 |
*) |
1084 |
AC_MSG_ERROR(bad value ${enableval} for --enable-paranoid-malloc) |
1085 |
;; |
1086 |
esac], |
1087 |
[paranoid_malloc=true |
1088 |
AC_MSG_RESULT(yes)]) |
1089 |
|
1090 |
if test "$paranoid_malloc" = "true"; then |
1091 |
CFLAGS="-D_WITH_PARANOID_MALLOC $CFLAGS" |
1092 |
fi |
1093 |
|
1094 |
|
1095 |
#------------------------------------------------------------------------------- |
1096 |
# Check whether to enable res_search behaviour instead of RFC821/2821 required |
1097 |
# res_query behaviour. See Debian bug tracking list thread: |
1098 |
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=297060 for more information. |
1099 |
#------------------------------------------------------------------------------- |
1100 |
|
1101 |
res_search=false |
1102 |
AC_MSG_CHECKING(whether to use res_search instead of res_query?) |
1103 |
AC_ARG_ENABLE(res_search, |
1104 |
[ --enable-res_search Enables DNS queries to follow default and search rules (default=no)], |
1105 |
[case "${enableval}" in |
1106 |
yes) |
1107 |
res_search=true |
1108 |
AC_MSG_RESULT(yes) |
1109 |
;; |
1110 |
no) |
1111 |
res_search=false |
1112 |
AC_MSG_RESULT(no) |
1113 |
;; |
1114 |
*) |
1115 |
AC_MSG_ERROR(bad value ${enableval} for --enable-res_search) |
1116 |
;; |
1117 |
esac], |
1118 |
[res_search=false |
1119 |
AC_MSG_RESULT(no)]) |
1120 |
|
1121 |
if test "$res_search" = "true"; then |
1122 |
CFLAGS="-D_WITH_RES_SEARCH $CFLAGS" |
1123 |
fi |
1124 |
|
1125 |
|
1126 |
#------------------------------------------------------------------------------- |
1127 |
# Check to see if we should build libSPF Query Tool |
1128 |
#------------------------------------------------------------------------------- |
1129 |
|
1130 |
AC_MSG_CHECKING(whether to disable build the libSPF Query Tool?) |
1131 |
AC_ARG_ENABLE(spfqtool, |
1132 |
[ --disable-spfqtool Disables compilation of the libSPF Query Tool (default=no)], |
1133 |
[case "${enableval}" in |
1134 |
yes) |
1135 |
spfqtool=true |
1136 |
AC_MSG_RESULT(yes) |
1137 |
;; |
1138 |
no) |
1139 |
spfqtool=false |
1140 |
AC_MSG_RESULT(no) |
1141 |
;; |
1142 |
*) |
1143 |
AC_MSG_ERROR(bad value ${enableval} for --disable-spfqtool) |
1144 |
;; |
1145 |
esac], |
1146 |
[spfqtool=false |
1147 |
AC_MSG_RESULT(no)]) |
1148 |
|
1149 |
if test "$spfqtool" = "true"; then |
1150 |
LIBSPF_BUILD_DIRS="libspf" |
1151 |
fi |
1152 |
#AC_SUBST(LIBSPF_BUILD_DIRS) |
1153 |
|
1154 |
|
1155 |
#------------------------------------------------------------------------------- |
1156 |
# Check to see if we want to enable pthreads (gethostbyname_r) |
1157 |
# For now, --enable-pthreads just happens to activate our internal |
1158 |
# _DNS_gethostbyname_r reentrant wrapper to gethostbyname unless |
1159 |
# gethostbyname_r is available (GNU extention) then the wrapper will |
1160 |
# be around that instead and won't use the mutex |
1161 |
#------------------------------------------------------------------------------- |
1162 |
|
1163 |
AC_MSG_CHECKING(whether to compile with reentrant capabilities) |
1164 |
AC_ARG_ENABLE(pthreads, |
1165 |
[ --enable-pthreads Enables reentrant (thread-safe) library (default=no)], |
1166 |
[case "${enableval}" in |
1167 |
yes) |
1168 |
pthreads=true |
1169 |
AC_MSG_RESULT(yes) |
1170 |
;; |
1171 |
no) |
1172 |
pthreads=false |
1173 |
AC_MSG_RESULT(no) |
1174 |
;; |
1175 |
*) |
1176 |
AC_MSG_ERROR(bad value ${enableval} for --enable-pthreads) |
1177 |
;; |
1178 |
esac], |
1179 |
[pthreads=false |
1180 |
AC_MSG_RESULT(no)]) |
1181 |
|
1182 |
if test "$pthreads" = "true"; then |
1183 |
|
1184 |
AC_CHECK_HEADERS(pthread.h) |
1185 |
if test "x-$ac_cv_header_pthread_h" = "x-yes"; then |
1186 |
AC_DEFINE(HAVE_PTHREAD_H) |
1187 |
CFLAGS="-D_WITH_PTHREADS -D_REENTRANT $CFLAGS" |
1188 |
|
1189 |
case "$host" in |
1190 |
*-*-freebsd*) |
1191 |
AC_MSG_WARN([Hey we are FreeBSD we can be all HOMO and DIFFERENT!]) |
1192 |
LIBSPF_PTHREADS_LIB="-pthread" |
1193 |
;; |
1194 |
*) |
1195 |
LIBSPF_PTHREADS_LIB="-lpthread" |
1196 |
;; |
1197 |
esac |
1198 |
fi |
1199 |
|
1200 |
AC_CHECK_FUNCS(gethostbyname_r) |
1201 |
if test "x-$ac_cv_func_gethostbyname_r" = "x-yes"; then |
1202 |
AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
1203 |
else |
1204 |
AC_MSG_WARN([GNU gethostbyname_r not found, using internal wrapper]) |
1205 |
fi |
1206 |
|
1207 |
else |
1208 |
|
1209 |
LIBSPF_PTHREADS_LIB="" |
1210 |
pthreads=false |
1211 |
|
1212 |
fi |
1213 |
AC_SUBST(LIBSPF_PTHREADS_LIB) |
1214 |
|
1215 |
|
1216 |
#------------------------------------------------------------------------------- |
1217 |
# Check to see if we should build Sendmail SPF milter and perform the pthreads |
1218 |
# check again and in the event it wasn't specified (its required) or it failed, |
1219 |
# we will catch it (and enable it if successful) here. |
1220 |
#------------------------------------------------------------------------------- |
1221 |
|
1222 |
AC_MSG_CHECKING(whether to build the Sendmail SPF milter?) |
1223 |
AC_ARG_ENABLE(spfmilter, |
1224 |
[ --enable-spfmilter Enables compilation of the Sendmail SPF milter (default=no)], |
1225 |
[case "${enableval}" in |
1226 |
yes) |
1227 |
spfmilter=true |
1228 |
AC_MSG_RESULT(yes) |
1229 |
;; |
1230 |
no) |
1231 |
spfmilter=false |
1232 |
AC_MSG_RESULT(no) |
1233 |
;; |
1234 |
*) |
1235 |
AC_MSG_ERROR(bad value ${enableval} for --enable-spfmilter) |
1236 |
;; |
1237 |
esac], |
1238 |
[spfmilter=false |
1239 |
AC_MSG_RESULT(no)]) |
1240 |
|
1241 |
if test "$pthreads" = "false"; then |
1242 |
if test "$spfmilter" = "true"; then |
1243 |
AC_MSG_ERROR([pthreads is required, please re-configure with --enable-pthreads]) |
1244 |
fi |
1245 |
fi |
1246 |
|
1247 |
if test "$spfmilter" = "true"; then |
1248 |
LIBSPF_BUILD_DIRS="$LIBSPF_BUILD_DIRS spfmilter" |
1249 |
echo "--------------------------------------------------------------------------------" |
1250 |
sleep 1 |
1251 |
echo " spfmilter - SPF mail filter module" |
1252 |
echo "" |
1253 |
echo " Originally by Jef Poskanzer <jef@acme.com>" |
1254 |
echo "" |
1255 |
echo " Sendmail includes a facility for plugging in custom mail filters," |
1256 |
echo " called milters. It's documented here: http://www.milter.org/milter_api/" |
1257 |
echo "" |
1258 |
echo " See the manual entry (man spfmilter) or the README for more details." |
1259 |
echo "" |
1260 |
echo " Jef Poskanzer is the original author of this spfmilter." |
1261 |
echo "" |
1262 |
echo " This version and future versions of this spfmilter as bundled within libSPF" |
1263 |
echo " will be supported by the libSPF development team." |
1264 |
echo "" |
1265 |
echo " DO NOT REPORT PROBLEMS WITH THIS SPFMILTER TO JEF AS IT IS NOT FAIR TO ASK" |
1266 |
echo " HIM TO SUPPORT MULTIPLE VERSIONS OF HIS MILTER AFTER WE HAVE MODIFIED IT" |
1267 |
echo "" |
1268 |
echo " Send bugs to: James Couzens <jcouzens@codeshare.ca>" |
1269 |
echo "" |
1270 |
echo "--------------------------------------------------------------------------------" |
1271 |
sleep 3 |
1272 |
echo "" |
1273 |
|
1274 |
|
1275 |
#------------------------------------------------------------------------------- |
1276 |
# getpwuid (pwd.h) |
1277 |
#------------------------------------------------------------------------------- |
1278 |
|
1279 |
AC_MSG_CHECKING([getpwuid]) |
1280 |
use_getpwuid=no |
1281 |
AC_CHECK_FUNC(getpwuid,use_getpwuid=yes,[AC_CHECK_FUNC(getpwuid)]) |
1282 |
if test "x$use_getpwuid" = "xyes"; then |
1283 |
AC_DEFINE([HAVE_PWD_H], [], [Have pwd.h]) |
1284 |
else |
1285 |
AC_MSG_ERROR(Can not continue without pwd.h do you really have it?) |
1286 |
fi |
1287 |
|
1288 |
|
1289 |
#------------------------------------------------------------------------------- |
1290 |
# setgroups (grp.h) |
1291 |
#------------------------------------------------------------------------------- |
1292 |
|
1293 |
AC_MSG_CHECKING([setgroups]) |
1294 |
use_setgroups=no |
1295 |
AC_CHECK_FUNC(setgroups,use_setgroups=yes,[AC_CHECK_FUNC(setgroups)]) |
1296 |
if test "x$use_setgroups" = "xyes"; then |
1297 |
AC_DEFINE([HAVE_GRP_H], [], [Have pwd.h]) |
1298 |
else |
1299 |
AC_MSG_ERROR(Can not continue without grp.h do you really have it?) |
1300 |
fi |
1301 |
fi |
1302 |
AC_SUBST(LIBSPF_BUILD_DIRS) |
1303 |
|
1304 |
|
1305 |
#------------------------------------------------------------------------------- |
1306 |
# Enable compiler full-optimizations which lead to greater performance |
1307 |
#------------------------------------------------------------------------------- |
1308 |
|
1309 |
if test "$debug" = "false"; then |
1310 |
|
1311 |
AC_MSG_CHECKING(whether I should enable full optimizations) |
1312 |
AC_ARG_ENABLE(full_optimizations, |
1313 |
[ --enable-full-optimizations Enables building of an optimized library (default=no)], |
1314 |
[case "${enableval}" in |
1315 |
yes) |
1316 |
full_optimizations=true |
1317 |
AC_MSG_RESULT(yes) |
1318 |
;; |
1319 |
no) |
1320 |
full_optimizations=false |
1321 |
AC_MSG_RESULT(no) |
1322 |
;; |
1323 |
*) |
1324 |
AC_MSG_ERROR(bad value ${enableval} for --enable-full-optimizations) |
1325 |
;; |
1326 |
esac], |
1327 |
[full_optimizations=false |
1328 |
AC_MSG_RESULT(no)]) |
1329 |
|
1330 |
if test "$full_optimizations" = "true"; then |
1331 |
if [[ "x$GCCVER" != "xno" ]]; then |
1332 |
AC_MSG_RESULT(yes, however this option is deprecated!) |
1333 |
#CFLAGS="$CFLAGS -O2 -pipe -funroll-loops -ffast-math -ftracer -fweb" |
1334 |
#CFLAGS="$CFLAGS -O3 -ffast-math -fomit-frame-pointer" |
1335 |
fi |
1336 |
fi |
1337 |
fi |
1338 |
|
1339 |
|
1340 |
#------------------------------------------------------------------------------- |
1341 |
# Generate Makefiles |
1342 |
#------------------------------------------------------------------------------- |
1343 |
|
1344 |
AC_OUTPUT( \ |
1345 |
Makefile \ |
1346 |
src/Makefile \ |
1347 |
src/libspf/Makefile \ |
1348 |
src/spfqtool/Makefile \ |
1349 |
src/libspf/spf.h \ |
1350 |
src/libspf/util.c \ |
1351 |
dnl src/spfmilter/Makefile \ |
1352 |
) |
1353 |
#AC_OUTPUT(src/Makefile) |
1354 |
#AC_OUTPUT(src/libspf/Makefile) |
1355 |
#AC_OUTPUT(src/spfqtool/Makefile) |
1356 |
#AC_OUTPUT(src/libspf/spf.h) |
1357 |
#AC_OUTPUT(src/libspf/util.c) |
1358 |
#AC_OUTPUT(src/spfmilter/Makefile) |
1359 |
|
1360 |
echo "" |
1361 |
echo "" |
1362 |
echo " oooo o8o .o8 .oooooo..o ooooooooo. oooooooooooo " |
1363 |
echo " \`888 \`\"' \"888 d8P' \`Y8 \`888 \`Y88. \`888' \`8 " |
1364 |
echo " 888 oooo 888oooo. Y88bo. 888 .d88' 888 " |
1365 |
echo " 888 \`888 d88' \`88b \`\"Y8888o. 888ooo88P' 888oooo8 " |
1366 |
echo " 888 888 888 888 \`\"Y88b 888 888 \" " |
1367 |
echo " 888 888 888 888 oo .d8P 888 888 " |
1368 |
echo " o888o o888o \`Y8bod8P' 8\"\"88888P' o888o o888o " |
1369 |
echo "--------------------------------------------------------------------------------" |
1370 |
echo " $PACKAGE $VERSION " |
1371 |
echo " An ANSI C Implementation of the Sender Policy Framework " |
1372 |
echo "--------------------------------------------------------------------------------" |
1373 |
echo "" |
1374 |
echo " ./CHANGELOG ............ List of documented changed between versions" |
1375 |
echo " ./docs ................. Excellent API and integration Documentation" |
1376 |
echo " ./examples ............. Examples of how to implement" |
1377 |
echo " ./FAQ .................. Frequently Asked Questions (and Answers :-) )" |
1378 |
echo " ./LICENSE .............. Terms under which libSPF is licensed" |
1379 |
echo " ./README ............... A Quick and Excellent rundown of basic information" |
1380 |
echo " ./TODO ................. Things planned for future releases that are 'To Do'" |
1381 |
echo " ./VERSION .............. Version of thie release" |
1382 |
echo " ./bin .................. Static & Dyn. versions of the libSPF Query Tool" |
1383 |
echo " ./libspf.kateproject ... KDE's excellent IDE 'kate' Project File" |
1384 |
echo " ./patches .............. MTA Patches" |
1385 |
echo " ./src .................. Its not the Swartz, but it will have to do ;)" |
1386 |
echo "" |
1387 |
echo "--------------------------------------------------------------------------------" |
1388 |
sleep 2 |
1389 |
echo "" |
1390 |
echo " There are complete HOWTOs (or walkthru) documents within the 'Docs' dir for" |
1391 |
echo " the MTA's this library supports." |
1392 |
echo "" |
1393 |
echo " Commercial developers looking to integrate libSPF, there is no cost! If you" |
1394 |
echo " require assistance (free) please contact <developers@codeshare.ca>" |
1395 |
echo "" |
1396 |
echo " Website ................................ http://libSPF.org" |
1397 |
echo " Forums ................................. http://forums.6o4.ca" |
1398 |
echo " Contact ................................ jcouzens@codeshare.ca" |
1399 |
echo "" |
1400 |
echo "--------------------------------------------------------------------------------" |
1401 |
sleep 1 |
1402 |
echo "" |
1403 |
|
1404 |
|
1405 |
if test "$debug" = "true"; then |
1406 |
tmp="ON" |
1407 |
else |
1408 |
tmp="OFF" |
1409 |
fi |
1410 |
echo " Enable Debugging ........................................... "$tmp"" |
1411 |
|
1412 |
|
1413 |
if test "$debug_logfile" = "true"; then |
1414 |
tmp="ON" |
1415 |
else |
1416 |
tmp="OFF" |
1417 |
fi |
1418 |
echo " Enable Debugging output to logfile (/var/log/spf.log) ...... "$tmp"" |
1419 |
|
1420 |
|
1421 |
if test "$logfile_stats" = "true"; then |
1422 |
tmp="ON" |
1423 |
else |
1424 |
tmp="OFF" |
1425 |
fi |
1426 |
echo " Enable SPF logging statistics to /var/log/spflog.txt ....... "$tmp"" |
1427 |
|
1428 |
|
1429 |
if test "$full_optimizations" = "true"; then |
1430 |
tmp="ON" |
1431 |
else |
1432 |
tmp="OFF" |
1433 |
fi |
1434 |
echo " Enable compilation of an optimized library ................. "$tmp"" |
1435 |
|
1436 |
|
1437 |
if test "$rfc_recursion" = "true"; then |
1438 |
tmp="ON" |
1439 |
else |
1440 |
tmp="OFF" |
1441 |
fi |
1442 |
echo " Enable RFC recursion during SPF checks ..................... "$tmp"" |
1443 |
|
1444 |
|
1445 |
if test "$res_search" = "true"; then |
1446 |
tmp="ON" |
1447 |
else |
1448 |
tmp="OFF" |
1449 |
fi |
1450 |
echo " Enable DNS queries to follow 'default' and 'search' rules .. "$tmp"" |
1451 |
|
1452 |
|
1453 |
if test "$paranoid_malloc" = "true"; then |
1454 |
tmp="ON" |
1455 |
else |
1456 |
tmp="OFF" |
1457 |
fi |
1458 |
echo " Enable memset to NULL after each malloc .................... "$tmp"" |
1459 |
|
1460 |
|
1461 |
if test "$spfqtool" = "true"; then |
1462 |
tmp="ON" |
1463 |
else |
1464 |
tmp="OFF" |
1465 |
fi |
1466 |
echo " Disable build of SPF Query Tool ............................ "$tmp"" |
1467 |
|
1468 |
|
1469 |
if test "$libresolv" = "true"; then |
1470 |
tmp="ON" |
1471 |
else |
1472 |
tmp="OFF" |
1473 |
fi |
1474 |
echo " Enable use of libresolv resolver ........................... "$tmp"" |
1475 |
|
1476 |
|
1477 |
if test "$spfmilter" = "true"; then |
1478 |
tmp="ON" |
1479 |
else |
1480 |
tmp="OFF" |
1481 |
fi |
1482 |
echo " Enable use of Sendmail spfmilter ........................... "$tmp"" |
1483 |
|
1484 |
|
1485 |
if test "$libbind" = "true"; then |
1486 |
tmp="ON" |
1487 |
else |
1488 |
tmp="OFF" |
1489 |
fi |
1490 |
echo " Enable use of libbind resolver ............................. "$tmp"" |
1491 |
|
1492 |
|
1493 |
if test "$pthreads" = "true"; then |
1494 |
tmp="ON" |
1495 |
else |
1496 |
tmp="OFF" |
1497 |
fi |
1498 |
echo " Enable use of pthreads (gethostbyname_r) ................... "$tmp"" |
1499 |
|
1500 |
|
1501 |
echo "" |
1502 |
echo " libSPF Query tool binaries are in the new 'bin' dir in the libSPF root" |
1503 |
echo " libSPF Milter binaries are in the new 'bin; dir also" |
1504 |
echo "" |
1505 |
echo " libSPF libraries are in the new 'lib' dir in the libSPF root" |
1506 |
echo "" |
1507 |
echo " libSPF Milter rc scripts and docs are in 'src/spfmilter/rc_scripts'" |
1508 |
echo "--------------------------------------------------------------------------------" |
1509 |
echo "" |
1510 |
|
1511 |
# end of configure.in |