ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libspf/configure.in
Revision: 1.1
Committed: Tue Nov 13 00:51:23 2007 UTC (16 years, 6 months ago) by root
Branch: MAIN
Log Message:
initial import of libspf-1.0.0-p5 from freebsd ports

File Contents

# User Rev Content
1 root 1.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] AC_MSG_RESULT(no))
843    
844     if test "$libbind" = "true"; then
845     LIBSPF_RESOLV_LIB="-lbind"
846     fi
847    
848     if test "$libresolv" = "false"; then
849     LIBSPF_RESOLV_LIB=""
850     else
851    
852     #----------------------------------------------------------------------------
853     # Check to see if we want to link libresolv (default is yes)
854     #------------------------------------------------------------------
855    
856     dnl res_query has been seen in libc, libbind and libresolv
857     AC_CHECK_FUNCS(res_query, res_search)
858    
859     if test "x-$ac_cv_func_res_query" = "x-yes" ; then
860     have_res_query=yes
861     fi
862    
863     if test "x-$ac_cv_func_res_search" = "x-yes" ; then
864     have_res_search=yes
865     fi
866    
867     if test "x-$have_res_query" = "x-no" || test "x-$have_res_search" = "no" ; then
868     AC_CHECK_LIB(resolv, res_query)
869     if test "x-$ac_cv_lib_resolv_res_query" = "x-yes" ; then
870     have_res_query=yes
871     else
872     AC_CHECK_LIB(bind, res_query)
873     if test "x-$ac_cv_lib_bind_res_query" = "x-yes" ; then
874     have_res_query=yes
875     else
876     dnl some glibcs have res_query as a macro, so work around it
877     AC_MSG_CHECKING([for res_query in -lresolv (alternate version)])
878     save_libs="$LIBS"
879     libresolv=true
880     LIBS="-lresolv $LIBS"
881     LIBSPF_RESOLV_LIB="-lresolv"
882     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <resolv.h>]],
883     [[res_query(0,0,0,0,0)]])],
884     [AC_MSG_RESULT(yes)
885     have_res_query=yes],
886     [AC_MSG_RESULT(no)
887     libresolv=false
888     LIBS="$save_libs"])
889     fi
890     fi
891     fi
892    
893     if test "x-$have_res_query" = "x-yes" ; then
894     AC_DEFINE(HAVE_RES_QUERY)
895     libresolv=true
896     dnl no res_query, do windows compat checks
897     else
898     dnl !!! implement these checks
899     AC_MSG_WARN([required function res_query not found])
900     libresolv=false
901     fi
902    
903     fi
904    
905     # Checks for libraries.
906     AC_CHECK_LIB([resolv], [res_search])
907     AC_SUBST(LIBSPF_RESOLV_LIB)
908    
909    
910     #-------------------------------------------------------------------------------
911     # Check to see if we want to enable debugging
912     #-------------------------------------------------------------------------------
913    
914     AC_MSG_CHECKING(whether DEBUG is eanbled)
915     AC_ARG_ENABLE(debug,
916     [ --enable-debug Enables debug option (default=no)],
917     [case "${enableval}" in
918     yes)
919     debug=true
920     AC_MSG_RESULT(yes)
921     ;;
922     no)
923     debug=false
924     AC_MSG_RESULT(no)
925     ;;
926     *)
927     AC_MSG_ERROR(bad value ${enableval} for --enable-debug)
928     ;;
929     esac],
930     [debug=false] AC_MSG_RESULT(no))
931    
932     CFLAGS=""
933     if test "$debug" = "true"; then
934     CFLAGS="-ggdb -O -D_SPF_DEBUG"
935     else
936     AC_MSG_RESULT(Enabling GCC optimisations)
937     CFLAGS="$CFLAGS -O3 -ffast-math -fomit-frame-pointer"
938    
939     if [[ "x$GCC_VERSION" = "x3" ]]; then
940     AC_MSG_RESULT(Enabling GCC v3 optimizations)
941     CFLAGS="$CFLAGS -minline-all-stringops -fno-math-errno"
942     fi
943     fi
944    
945     case "${host_cpu}" in
946     i?86)
947     AC_MSG_RESULT([CPU: ${host_cpu}; Enabling pentium optimisations])
948     # cannot do malign-double as we link to other libraries and it
949     # would break binary compatibility
950     CFLAGS="$CFLAGS ${gcc_special_cflags}"
951     ;;
952     *)
953     AC_MSG_RESULT(Please e-mail author optimizations for this cpu)
954     ;;
955     esac
956    
957    
958     #-------------------------------------------------------------------------------
959     # Check to see if we want to enable debugging output to logfile
960     #-------------------------------------------------------------------------------
961    
962     if test "$debug" = "true"; then
963     AC_MSG_CHECKING(whether you want debug output to a logfile)
964     AC_ARG_ENABLE(debug_logfile,
965     [ --enable-debug-logfile Enables logging debug output (default=yes)],
966     [case "${enableval}" in
967     yes)
968     debug_logfile=true
969     AC_MSG_RESULT(yes)
970     ;;
971     no)
972     debug_logfile=false
973     AC_MSG_RESULT(no)
974     ;;
975     *)
976     AC_MSG_ERROR(bad value ${enableval} for --enable-debug-logfile)
977     ;;
978     esac],
979     [debug_logfile=true] AC_MSG_RESULT(no))
980    
981     if test "$debug_logfile" = "true"; then
982     CFLAGS="-D_SPF_DEBUG_LOGFILE $CFLAGS"
983     fi
984     fi
985    
986    
987     #-------------------------------------------------------------------------------
988     # Check to see if we want to enable logfile statistics
989     #-------------------------------------------------------------------------------
990    
991     logfile_stats=false
992     AC_MSG_CHECKING(whether you want logfile statistics)
993     AC_ARG_ENABLE(logfile_stats,
994     [ --enable-logfile-stats Enables logfile stats (default=no)],
995     [case "${enableval}" in
996     yes)
997     logfile_stats=true
998     AC_MSG_RESULT(yes)
999     ;;
1000     no)
1001     logfile_stats=false
1002     AC_MSG_RESULT(no)
1003     ;;
1004     *)
1005     AC_MSG_ERROR(bad value ${enableval} for --enable-logfile-stats)
1006     ;;
1007     esac],
1008     [logfile_stats=false] AC_MSG_RESULT(no))
1009    
1010     if test "$logfile_stats" = "true"; then
1011     CFLAGS="-D_SPF_LOGFILE_STATS $CFLAGS"
1012     fi
1013    
1014    
1015     #-------------------------------------------------------------------------------
1016     # Check whether to enable a memset after each malloc
1017     #-------------------------------------------------------------------------------
1018    
1019     rfc_recursion=false
1020     AC_MSG_CHECKING(whether to abide by the RFC as regards recursiveness)
1021     AC_ARG_ENABLE(rfc_recursion,
1022     [ --enable-rfc-recursion Change SPF recursion to 20 (as per RFC) (default=no)],
1023     [case "${enableval}" in
1024     yes)
1025     rfc_recursion=true
1026     AC_MSG_RESULT(yes)
1027     ;;
1028     no)
1029     rfc_recursion=false
1030     AC_MSG_RESULT(no)
1031     ;;
1032     *)
1033     AC_MSG_ERROR(bad value ${enableval} for --enable-rfc-recursion)
1034     ;;
1035     esac],
1036     [rfc_recursion=false] AC_MSG_RESULT(no))
1037    
1038     if test "$rfc_recursion" = "true"; then
1039     CFLAGS="-D_RFC_RECURSION $CFLAGS"
1040     AC_MSG_WARN(=== THE INTERNET IS FULL OF ILLITERATE AND LAZY PEOPLE ===)
1041     sleep 1
1042     AC_MSG_WARN(=== MANY OF WHOM CAN NOT PUBLISH A VALID SPF RECORD TO ===)
1043     sleep 1
1044     AC_MSG_WARN(=== SAVE THEIR LIFE. MANY OF SUCH INDIVIDUALS OFTEN ===)
1045     sleep 1
1046     AC_MSG_WARN(=== LINK RECORDS TOGETHER FORMING A RECURSIVE PARSING ===)
1047     sleep 1
1048     AC_MSG_WARN(=== LOOP. YOU HAVE BEEN WARNED. THE RFC STATES THAT ===)
1049     sleep 1
1050     AC_MSG_WARN(=== SPF PARSERS MUST SUPPORT AT LEAST TWENTY LEVELS OF ===)
1051     sleep 1
1052     AC_MSG_WARN(=== RECURSION. THIS HAS PROVEN TO BE POINTLESS GIVEN ===)
1053     sleep 1
1054     AC_MSG_WARN(=== GIVEN THE ABUNDANCE OF STUPIDITY PREVALENT ON THE ===)
1055     sleep 1
1056     AC_MSG_WARN(=== INTERNET. YOU HAVE BEEN WARNED!! ===)
1057     sleep 5
1058     fi
1059    
1060    
1061     #-------------------------------------------------------------------------------
1062     # Check whether to enable a memset after each malloc
1063     #-------------------------------------------------------------------------------
1064    
1065     paranoid_malloc=true
1066     AC_MSG_CHECKING(whether to memset after every malloc (paranoid malloc)?)
1067     AC_ARG_ENABLE(paranoid_malloc,
1068     [ --enable-paranoid-malloc Enables a memset of every malloc to NULL (default=yes)],
1069     [case "${enableval}" in
1070     yes)
1071     paranoid_malloc=true
1072     AC_MSG_RESULT(yes)
1073     ;;
1074     no)
1075     paranoid_malloc=false
1076     AC_MSG_RESULT(no)
1077     ;;
1078     *)
1079     AC_MSG_ERROR(bad value ${enableval} for --enable-paranoid-malloc)
1080     ;;
1081     esac],
1082     [paranoid_malloc=true] AC_MSG_RESULT(yes))
1083    
1084     if test "$paranoid_malloc" = "true"; then
1085     CFLAGS="-D_WITH_PARANOID_MALLOC $CFLAGS"
1086     fi
1087    
1088    
1089     #-------------------------------------------------------------------------------
1090     # Check whether to enable res_search behaviour instead of RFC821/2821 required
1091     # res_query behaviour. See Debian bug tracking list thread:
1092     # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=297060 for more information.
1093     #-------------------------------------------------------------------------------
1094    
1095     res_search=false
1096     AC_MSG_CHECKING(whether to use res_search instead of res_query?)
1097     AC_ARG_ENABLE(res_search,
1098     [ --enable-res_search Enables DNS queries to follow default and search rules (default=no)],
1099     [case "${enableval}" in
1100     yes)
1101     res_search=true
1102     AC_MSG_RESULT(yes)
1103     ;;
1104     no)
1105     res_search=false
1106     AC_MSG_RESULT(no)
1107     ;;
1108     *)
1109     AC_MSG_ERROR(bad value ${enableval} for --enable-res_search)
1110     ;;
1111     esac],
1112     [res_search=falsee] AC_MSG_RESULT(no))
1113    
1114     if test "$res_search" = "true"; then
1115     CFLAGS="-D_WITH_RES_SEARCH $CFLAGS"
1116     fi
1117    
1118    
1119     #-------------------------------------------------------------------------------
1120     # Check to see if we should build libSPF Query Tool
1121     #-------------------------------------------------------------------------------
1122    
1123     AC_MSG_CHECKING(whether to disable build the libSPF Query Tool?)
1124     AC_ARG_ENABLE(spfqtool,
1125     [ --disable-spfqtool Disables compilation of the libSPF Query Tool (default=no)],
1126     [case "${enableval}" in
1127     yes)
1128     spfqtool=true
1129     AC_MSG_RESULT(yes)
1130     ;;
1131     no)
1132     spfqtool=false
1133     AC_MSG_RESULT(no)
1134     ;;
1135     *)
1136     AC_MSG_ERROR(bad value ${enableval} for --disable-spfqtool)
1137     ;;
1138     esac],
1139     [spfqtool=false] AC_MSG_RESULT(no))
1140    
1141     if test "$spfqtool" = "true"; then
1142     LIBSPF_BUILD_DIRS="libspf"
1143     fi
1144     #AC_SUBST(LIBSPF_BUILD_DIRS)
1145    
1146    
1147     #-------------------------------------------------------------------------------
1148     # Check to see if we want to enable pthreads (gethostbyname_r)
1149     # For now, --enable-pthreads just happens to activate our internal
1150     # _DNS_gethostbyname_r reentrant wrapper to gethostbyname unless
1151     # gethostbyname_r is available (GNU extention) then the wrapper will
1152     # be around that instead and won't use the mutex
1153     #-------------------------------------------------------------------------------
1154    
1155     AC_MSG_CHECKING(whether to compile with reentrant capabilities)
1156     AC_ARG_ENABLE(pthreads,
1157     [ --enable-pthreads Enables reentrant (thread-safe) library (default=no)],
1158     [case "${enableval}" in
1159     yes)
1160     pthreads=true
1161     AC_MSG_RESULT(yes)
1162     ;;
1163     no)
1164     pthreads=false
1165     AC_MSG_RESULT(no)
1166     ;;
1167     *)
1168     AC_MSG_ERROR(bad value ${enableval} for --enable-pthreads)
1169     ;;
1170     esac],
1171     [pthreads=false] AC_MSG_RESULT(no))
1172    
1173     if test "$pthreads" = "true"; then
1174    
1175     AC_CHECK_HEADERS(pthread.h)
1176     if test "x-$ac_cv_header_pthread_h" = "x-yes"; then
1177     AC_DEFINE(HAVE_PTHREAD_H)
1178     CFLAGS="-D_WITH_PTHREADS -D_REENTRANT $CFLAGS"
1179    
1180     case "$host" in
1181     *-*-freebsd*)
1182     AC_MSG_WARN([Hey we are FreeBSD we can be all HOMO and DIFFERENT!])
1183     LIBSPF_PTHREADS_LIB="-pthread"
1184     ;;
1185     *)
1186     LIBSPF_PTHREADS_LIB="-lpthread"
1187     ;;
1188     esac
1189     fi
1190    
1191     AC_CHECK_FUNCS(gethostbyname_r)
1192     if test "x-$ac_cv_func_gethostbyname_r" = "x-yes"; then
1193     AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1194     else
1195     AC_MSG_WARN([GNU gethostbyname_r not found, using internal wrapper])
1196     fi
1197    
1198     else
1199    
1200     LIBSPF_PTHREADS_LIB=""
1201     pthreads=false
1202    
1203     fi
1204     AC_SUBST(LIBSPF_PTHREADS_LIB)
1205    
1206    
1207     #-------------------------------------------------------------------------------
1208     # Check to see if we should build Sendmail SPF milter and perform the pthreads
1209     # check again and in the event it wasn't specified (its required) or it failed,
1210     # we will catch it (and enable it if successful) here.
1211     #-------------------------------------------------------------------------------
1212    
1213     AC_MSG_CHECKING(whether to build the Sendmail SPF milter?)
1214     AC_ARG_ENABLE(spfmilter,
1215     [ --enable-spfmilter Enables compilation of the Sendmail SPF milter (default=no)],
1216     [case "${enableval}" in
1217     yes)
1218     spfmilter=true
1219     AC_MSG_RESULT(yes)
1220     ;;
1221     no)
1222     spfmilter=false
1223     AC_MSG_RESULT(no)
1224     ;;
1225     *)
1226     AC_MSG_ERROR(bad value ${enableval} for --enable-spfmilter)
1227     ;;
1228     esac],
1229     [spfmilter=false] AC_MSG_RESULT(no))
1230    
1231     if test "$pthreads" = "false"; then
1232     if test "$spfmilter" = "true"; then
1233     AC_MSG_ERROR([pthreads is required, please re-configure with --enable-pthreads])
1234     fi
1235     fi
1236    
1237     if test "$spfmilter" = "true"; then
1238     LIBSPF_BUILD_DIRS="$LIBSPF_BUILD_DIRS spfmilter"
1239     echo "--------------------------------------------------------------------------------"
1240     sleep 1
1241     echo " spfmilter - SPF mail filter module"
1242     echo ""
1243     echo " Originally by Jef Poskanzer <jef@acme.com>"
1244     echo ""
1245     echo " Sendmail includes a facility for plugging in custom mail filters,"
1246     echo " called milters. It's documented here: http://www.milter.org/milter_api/"
1247     echo ""
1248     echo " See the manual entry (man spfmilter) or the README for more details."
1249     echo ""
1250     echo " Jef Poskanzer is the original author of this spfmilter."
1251     echo ""
1252     echo " This version and future versions of this spfmilter as bundled within libSPF"
1253     echo " will be supported by the libSPF development team."
1254     echo ""
1255     echo " DO NOT REPORT PROBLEMS WITH THIS SPFMILTER TO JEF AS IT IS NOT FAIR TO ASK"
1256     echo " HIM TO SUPPORT MULTIPLE VERSIONS OF HIS MILTER AFTER WE HAVE MODIFIED IT"
1257     echo ""
1258     echo " Send bugs to: James Couzens <jcouzens@codeshare.ca>"
1259     echo ""
1260     echo "--------------------------------------------------------------------------------"
1261     sleep 3
1262     echo ""
1263    
1264    
1265     #-------------------------------------------------------------------------------
1266     # getpwuid (pwd.h)
1267     #-------------------------------------------------------------------------------
1268    
1269     AC_MSG_CHECKING([getpwuid])
1270     use_getpwuid=no
1271     AC_CHECK_FUNC(getpwuid,use_getpwuid=yes,[AC_CHECK_FUNC(getpwuid)])
1272     if test "x$use_getpwuid" = "xyes"; then
1273     AC_DEFINE([HAVE_PWD_H], [], [Have pwd.h])
1274     else
1275     AC_MSG_ERROR(Can not continue without pwd.h do you really have it?)
1276     fi
1277    
1278    
1279     #-------------------------------------------------------------------------------
1280     # setgroups (grp.h)
1281     #-------------------------------------------------------------------------------
1282    
1283     AC_MSG_CHECKING([setgroups])
1284     use_setgroups=no
1285     AC_CHECK_FUNC(setgroups,use_setgroups=yes,[AC_CHECK_FUNC(setgroups)])
1286     if test "x$use_setgroups" = "xyes"; then
1287     AC_DEFINE([HAVE_GRP_H], [], [Have pwd.h])
1288     else
1289     AC_MSG_ERROR(Can not continue without grp.h do you really have it?)
1290     fi
1291     fi
1292     AC_SUBST(LIBSPF_BUILD_DIRS)
1293    
1294    
1295     #-------------------------------------------------------------------------------
1296     # Enable compiler full-optimizations which lead to greater performance
1297     #-------------------------------------------------------------------------------
1298    
1299     if test "$debug" = "false"; then
1300    
1301     AC_MSG_CHECKING(whether I should enable full optimizations)
1302     AC_ARG_ENABLE(full_optimizations,
1303     [ --enable-full-optimizations Enables building of an optimized library (default=no)],
1304     [case "${enableval}" in
1305     yes)
1306     full_optimizations=true
1307     AC_MSG_RESULT(yes)
1308     ;;
1309     no)
1310     full_optimizations=false
1311     AC_MSG_RESULT(no)
1312     ;;
1313     *)
1314     AC_MSG_ERROR(bad value ${enableval} for --enable-full-optimizations)
1315     ;;
1316     esac],
1317     [full_optimizations=false] AC_MSG_RESULT(no))
1318    
1319     if test "$full_optimizations" = "true"; then
1320     if [[ "x$GCCVER" != "xno" ]]; then
1321     AC_MSG_RESULT(yes, however this option is deprecated!)
1322     #CFLAGS="$CFLAGS -O2 -pipe -funroll-loops -ffast-math -ftracer -fweb"
1323     #CFLAGS="$CFLAGS -O3 -ffast-math -fomit-frame-pointer"
1324     fi
1325     fi
1326     fi
1327    
1328    
1329     #-------------------------------------------------------------------------------
1330     # Generate Makefiles
1331     #-------------------------------------------------------------------------------
1332    
1333     AC_OUTPUT( \
1334     Makefile \
1335     src/Makefile \
1336     src/libspf/Makefile \
1337     src/spfqtool/Makefile \
1338     src/libspf/spf.h \
1339     src/libspf/util.c \
1340     src/spfmilter/Makefile \
1341     )
1342     #AC_OUTPUT(src/Makefile)
1343     #AC_OUTPUT(src/libspf/Makefile)
1344     #AC_OUTPUT(src/spfqtool/Makefile)
1345     #AC_OUTPUT(src/libspf/spf.h)
1346     #AC_OUTPUT(src/libspf/util.c)
1347     #AC_OUTPUT(src/spfmilter/Makefile)
1348    
1349     echo ""
1350     echo ""
1351     echo " oooo o8o .o8 .oooooo..o ooooooooo. oooooooooooo "
1352     echo " \`888 \`\"' \"888 d8P' \`Y8 \`888 \`Y88. \`888' \`8 "
1353     echo " 888 oooo 888oooo. Y88bo. 888 .d88' 888 "
1354     echo " 888 \`888 d88' \`88b \`\"Y8888o. 888ooo88P' 888oooo8 "
1355     echo " 888 888 888 888 \`\"Y88b 888 888 \" "
1356     echo " 888 888 888 888 oo .d8P 888 888 "
1357     echo " o888o o888o \`Y8bod8P' 8\"\"88888P' o888o o888o "
1358     echo "--------------------------------------------------------------------------------"
1359     echo " $PACKAGE $VERSION "
1360     echo " An ANSI C Implementation of the Sender Policy Framework "
1361     echo "--------------------------------------------------------------------------------"
1362     echo ""
1363     echo " ./CHANGELOG ............ List of documented changed between versions"
1364     echo " ./docs ................. Excellent API and integration Documentation"
1365     echo " ./examples ............. Examples of how to implement"
1366     echo " ./FAQ .................. Frequently Asked Questions (and Answers :-) )"
1367     echo " ./LICENSE .............. Terms under which libSPF is licensed"
1368     echo " ./README ............... A Quick and Excellent rundown of basic information"
1369     echo " ./TODO ................. Things planned for future releases that are 'To Do'"
1370     echo " ./VERSION .............. Version of thie release"
1371     echo " ./bin .................. Static & Dyn. versions of the libSPF Query Tool"
1372     echo " ./libspf.kateproject ... KDE's excellent IDE 'kate' Project File"
1373     echo " ./patches .............. MTA Patches"
1374     echo " ./src .................. Its not the Swartz, but it will have to do ;)"
1375     echo ""
1376     echo "--------------------------------------------------------------------------------"
1377     sleep 2
1378     echo ""
1379     echo " There are complete HOWTOs (or walkthru) documents within the 'Docs' dir for"
1380     echo " the MTA's this library supports."
1381     echo ""
1382     echo " Commercial developers looking to integrate libSPF, there is no cost! If you"
1383     echo " require assistance (free) please contact <developers@codeshare.ca>"
1384     echo ""
1385     echo " Website ................................ http://libSPF.org"
1386     echo " Forums ................................. http://forums.6o4.ca"
1387     echo " Contact ................................ jcouzens@codeshare.ca"
1388     echo ""
1389     echo "--------------------------------------------------------------------------------"
1390     sleep 1
1391     echo ""
1392    
1393    
1394     if test "$debug" = "true"; then
1395     tmp="ON"
1396     else
1397     tmp="OFF"
1398     fi
1399     echo " Enable Debugging ........................................... "$tmp""
1400    
1401    
1402     if test "$debug_logfile" = "true"; then
1403     tmp="ON"
1404     else
1405     tmp="OFF"
1406     fi
1407     echo " Enable Debugging output to logfile (/var/log/spf.log) ...... "$tmp""
1408    
1409    
1410     if test "$logfile_stats" = "true"; then
1411     tmp="ON"
1412     else
1413     tmp="OFF"
1414     fi
1415     echo " Enable SPF logging statistics to /var/log/spflog.txt ....... "$tmp""
1416    
1417    
1418     if test "$full_optimizations" = "true"; then
1419     tmp="ON"
1420     else
1421     tmp="OFF"
1422     fi
1423     echo " Enable compilation of an optimized library ................. "$tmp""
1424    
1425    
1426     if test "$rfc_recursion" = "true"; then
1427     tmp="ON"
1428     else
1429     tmp="OFF"
1430     fi
1431     echo " Enable RFC recursion during SPF checks ..................... "$tmp""
1432    
1433    
1434     if test "$res_search" = "true"; then
1435     tmp="ON"
1436     else
1437     tmp="OFF"
1438     fi
1439     echo " Enable DNS queries to follow 'default' and 'search' rules .. "$tmp""
1440    
1441    
1442     if test "$paranoid_malloc" = "true"; then
1443     tmp="ON"
1444     else
1445     tmp="OFF"
1446     fi
1447     echo " Enable memset to NULL after each malloc .................... "$tmp""
1448    
1449    
1450     if test "$spfqtool" = "true"; then
1451     tmp="ON"
1452     else
1453     tmp="OFF"
1454     fi
1455     echo " Disable build of SPF Query Tool ............................ "$tmp""
1456    
1457    
1458     if test "$libresolv" = "true"; then
1459     tmp="ON"
1460     else
1461     tmp="OFF"
1462     fi
1463     echo " Enable use of libresolv resolver ........................... "$tmp""
1464    
1465    
1466     if test "$spfmilter" = "true"; then
1467     tmp="ON"
1468     else
1469     tmp="OFF"
1470     fi
1471     echo " Enable use of Sendmail spfmilter ........................... "$tmp""
1472    
1473    
1474     if test "$libbind" = "true"; then
1475     tmp="ON"
1476     else
1477     tmp="OFF"
1478     fi
1479     echo " Enable use of libbind resolver ............................. "$tmp""
1480    
1481    
1482     if test "$pthreads" = "true"; then
1483     tmp="ON"
1484     else
1485     tmp="OFF"
1486     fi
1487     echo " Enable use of pthreads (gethostbyname_r) ................... "$tmp""
1488    
1489    
1490     echo ""
1491     echo " libSPF Query tool binaries are in the new 'bin' dir in the libSPF root"
1492     echo " libSPF Milter binaries are in the new 'bin; dir also"
1493     echo ""
1494     echo " libSPF libraries are in the new 'lib' dir in the libSPF root"
1495     echo ""
1496     echo " libSPF Milter rc scripts and docs are in 'src/spfmilter/rc_scripts'"
1497     echo "--------------------------------------------------------------------------------"
1498     echo ""
1499    
1500     # end of configure.in