1 # $NetBSD: configure.ac,v 1.42 2014/03/09 00:33:50 agc Exp $
3 # Process this file with autoconf to produce a configure script.
5 AC_INIT([netpgp],[20140220],[Alistair Crooks <agc@netbsd.org> c0596823])
7 AC_REVISION([$Revision: 1.42 $])
11 AC_CONFIG_SRCDIR([src/netpgp/netpgp.c])
12 AC_CONFIG_AUX_DIR([buildaux])
13 AC_CONFIG_HEADER([src/lib/config.h])
15 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
20 AC_SUBST([CANONICAL_HOST])
22 # Checks for programs.
31 dnl based on AC_PROG_RANLIB from autoconf
32 m4_ifndef([AC_PROG_AR],[dnl
33 AN_MAKEVAR([AR], [AC_PROG_AR])
34 AN_PROGRAM([ar], [AC_PROG_AR])
35 AC_DEFUN([AC_PROG_AR],
36 [AC_CHECK_TOOL(AR, ar, :)])
41 # Compiler characteristics
43 AC_MSG_CHECKING([if using gcc])
44 AS_IF([test "$GCC" = "yes"],
45 [WARNCFLAGS="-Werror -Wall -Wpointer-arith"
46 AC_MSG_RESULT([yes; adding to CFLAGS: "$WARNCFLAGS"])],
49 AC_SUBST([WARNCFLAGS])
51 # try to see if we need to link with -ldl
52 AC_SEARCH_LIBS(dlopen, dl)
54 # Checks for header files.
57 AC_CHECK_HEADERS([CommonCrypto/CommonDigest.h])
58 AC_CHECK_HEADERS([dmalloc.h direct.h errno.h fcntl.h \
59 inttypes.h limits.h malloc.h zlib.h])
60 AC_CHECK_HEADERS([openssl/aes.h openssl/bn.h openssl/camellia.h openssl/cast.h \
61 openssl/des.h openssl/dsa.h openssl/err.h openssl/idea.h \
62 openssl/md5.h openssl/rand.h openssl/rsa.h openssl/sha.h \
63 openssl/err.h openssl/sha.h])
64 AC_CHECK_HEADERS([sys/cdefs.h sys/file.h sys/mman.h sys/param.h \
65 sys/resource.h sys/uio.h])
67 AC_CHECK_HEADERS([bzlib.h],
69 [AC_MSG_FAILURE([missing <bzlib.h>; is bzip2 installed?])])
71 # Checks for typedefs, structures, and compiler characteristics.
81 m4_include([ax_check_openssl.m4])
83 AX_CHECK_OPENSSL([LIBS="$LIBS $OPENSSL_LIBS" INCLUDES="$INCLUDES $OPENSSL_INCLUDES"],
84 [AC_MSG_ERROR([Missing OpenSSL])])
86 AC_CHECK_TYPES([SHA256_CTX],
88 [AC_MSG_FAILURE([missing SHA256_CTX; is openssl 0.9.8 or newer installed?])],
90 #if defined(HAVE_SYS_TYPES_H)
91 #include <sys/types.h>
93 #if defined(HAVE_OPENSSL_SHA_H)
94 #include <openssl/sha.h>
96 #if defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H)
97 #define COMMON_DIGEST_FOR_OPENSSL 1
98 #include <CommonCrypto/CommonDigest.h>
102 # Checks for library functions.
104 AC_SEARCH_LIBS([gzopen], [z])
105 AC_SEARCH_LIBS([BZ2_bzDecompress], [bz2])
106 AC_SEARCH_LIBS([RSA_public_encrypt], [crypto])
108 # Initialize the testsuite
110 AC_CONFIG_TESTDIR([tests])
111 AM_MISSING_PROG([AUTOM4TE], [autom4te])
113 # Generate the Makefiles
122 src/netpgpkeys/Makefile
128 # Display feature results
130 AC_MSG_NOTICE([ === Configuration results ===])
131 AC_MSG_NOTICE([Version: $PACKAGE_VERSION])
132 AC_MSG_NOTICE([C compiler: $CC])
133 AC_MSG_NOTICE([Warning CFLAGS: $WARNCFLAGS])
134 AC_MSG_NOTICE([=============================])