1*0a6a1f1dSLionel Sambuc# $NetBSD: configure.ac,v 1.42 2014/03/09 00:33:50 agc Exp $
2ebfedea0SLionel Sambuc#
3ebfedea0SLionel Sambuc# Process this file with autoconf to produce a configure script.
4ebfedea0SLionel Sambuc
5*0a6a1f1dSLionel SambucAC_INIT([netpgp],[20140220],[Alistair Crooks <agc@netbsd.org> c0596823])
6*0a6a1f1dSLionel SambucAC_PREREQ(2.69)
7*0a6a1f1dSLionel SambucAC_REVISION([$Revision: 1.42 $])
8ebfedea0SLionel Sambuc
9ebfedea0SLionel SambucAS_SHELL_SANITIZE
10ebfedea0SLionel Sambuc
11ebfedea0SLionel SambucAC_CONFIG_SRCDIR([src/netpgp/netpgp.c])
12ebfedea0SLionel SambucAC_CONFIG_AUX_DIR([buildaux])
13ebfedea0SLionel SambucAC_CONFIG_HEADER([src/lib/config.h])
14ebfedea0SLionel Sambuc
15ebfedea0SLionel SambucAM_INIT_AUTOMAKE([-Wall -Werror foreign])
16ebfedea0SLionel SambucAM_MAINTAINER_MODE
17ebfedea0SLionel Sambuc
18ebfedea0SLionel SambucAC_CANONICAL_HOST
19ebfedea0SLionel SambucCANONICAL_HOST=$host
20ebfedea0SLionel SambucAC_SUBST([CANONICAL_HOST])
21ebfedea0SLionel Sambuc
22ebfedea0SLionel Sambuc# Checks for programs.
23ebfedea0SLionel Sambuc#
24ebfedea0SLionel SambucAC_PROG_MAKE_SET
25ebfedea0SLionel SambucAC_PROG_AWK
26ebfedea0SLionel SambucAC_PROG_CC
27ebfedea0SLionel SambucAC_PROG_INSTALL
28ebfedea0SLionel SambucAC_PROG_LIBTOOL
29ebfedea0SLionel SambucAC_PROG_LN_S
30ebfedea0SLionel Sambuc
31*0a6a1f1dSLionel Sambucdnl based on AC_PROG_RANLIB from autoconf
32*0a6a1f1dSLionel Sambucm4_ifndef([AC_PROG_AR],[dnl
33*0a6a1f1dSLionel SambucAN_MAKEVAR([AR], [AC_PROG_AR])
34*0a6a1f1dSLionel SambucAN_PROGRAM([ar], [AC_PROG_AR])
35*0a6a1f1dSLionel SambucAC_DEFUN([AC_PROG_AR],
36*0a6a1f1dSLionel Sambuc[AC_CHECK_TOOL(AR, ar, :)])
37*0a6a1f1dSLionel Sambuc])
38*0a6a1f1dSLionel Sambuc
39*0a6a1f1dSLionel SambucAC_PROG_AR
40*0a6a1f1dSLionel Sambuc
41ebfedea0SLionel Sambuc# Compiler characteristics
42ebfedea0SLionel Sambuc#
43ebfedea0SLionel SambucAC_MSG_CHECKING([if using gcc])
44ebfedea0SLionel SambucAS_IF([test "$GCC" = "yes"],
45ebfedea0SLionel Sambuc      [WARNCFLAGS="-Werror -Wall -Wpointer-arith"
46ebfedea0SLionel Sambuc       AC_MSG_RESULT([yes; adding to CFLAGS: "$WARNCFLAGS"])],
47ebfedea0SLionel Sambuc      [WARNCFLAGS=""
48ebfedea0SLionel Sambuc       AC_MSG_RESULT([no])])
49ebfedea0SLionel SambucAC_SUBST([WARNCFLAGS])
50ebfedea0SLionel Sambuc
51ebfedea0SLionel Sambuc# try to see if we need to link with -ldl
52ebfedea0SLionel SambucAC_SEARCH_LIBS(dlopen, dl)
53ebfedea0SLionel Sambuc
54ebfedea0SLionel Sambuc# Checks for header files.
55ebfedea0SLionel Sambuc#
56ebfedea0SLionel SambucAC_HEADER_STDC
57ebfedea0SLionel SambucAC_CHECK_HEADERS([CommonCrypto/CommonDigest.h])
58ebfedea0SLionel SambucAC_CHECK_HEADERS([dmalloc.h direct.h errno.h fcntl.h \
59ebfedea0SLionel Sambuc                 inttypes.h limits.h malloc.h zlib.h])
60ebfedea0SLionel SambucAC_CHECK_HEADERS([openssl/aes.h openssl/bn.h openssl/camellia.h openssl/cast.h \
61ebfedea0SLionel Sambuc		  openssl/des.h openssl/dsa.h openssl/err.h openssl/idea.h \
62ebfedea0SLionel Sambuc		  openssl/md5.h openssl/rand.h openssl/rsa.h openssl/sha.h \
63ebfedea0SLionel Sambuc		  openssl/err.h openssl/sha.h])
64ebfedea0SLionel SambucAC_CHECK_HEADERS([sys/cdefs.h sys/file.h sys/mman.h sys/param.h \
65ebfedea0SLionel Sambuc                  sys/resource.h sys/uio.h])
66ebfedea0SLionel Sambuc
67ebfedea0SLionel SambucAC_CHECK_HEADERS([bzlib.h],
68ebfedea0SLionel Sambuc                 [],
69ebfedea0SLionel Sambuc                 [AC_MSG_FAILURE([missing <bzlib.h>; is bzip2 installed?])])
70ebfedea0SLionel Sambuc
71ebfedea0SLionel Sambuc# Checks for typedefs, structures, and compiler characteristics.
72ebfedea0SLionel Sambuc#
73ebfedea0SLionel SambucAC_TYPE_LONG_LONG_INT
74ebfedea0SLionel SambucAC_TYPE_SIZE_T
75ebfedea0SLionel SambucAC_TYPE_UINT16_T
76ebfedea0SLionel SambucAC_TYPE_UINT32_T
77ebfedea0SLionel SambucAC_TYPE_UINT64_T
78ebfedea0SLionel SambucAC_TYPE_UINT8_T
79ebfedea0SLionel Sambuc
80ebfedea0SLionel Sambuc# check for openssl
81ebfedea0SLionel Sambucm4_include([ax_check_openssl.m4])
82ebfedea0SLionel Sambuc
83ebfedea0SLionel SambucAX_CHECK_OPENSSL([LIBS="$LIBS $OPENSSL_LIBS" INCLUDES="$INCLUDES $OPENSSL_INCLUDES"],
84ebfedea0SLionel Sambuc	[AC_MSG_ERROR([Missing OpenSSL])])
85ebfedea0SLionel Sambuc
86ebfedea0SLionel SambucAC_CHECK_TYPES([SHA256_CTX],
87ebfedea0SLionel Sambuc               [],
88ebfedea0SLionel Sambuc               [AC_MSG_FAILURE([missing SHA256_CTX; is openssl 0.9.8 or newer installed?])],
89ebfedea0SLionel Sambuc              [[
90ebfedea0SLionel Sambuc#if defined(HAVE_SYS_TYPES_H)
91ebfedea0SLionel Sambuc#include <sys/types.h>
92ebfedea0SLionel Sambuc#endif
93ebfedea0SLionel Sambuc#if defined(HAVE_OPENSSL_SHA_H)
94ebfedea0SLionel Sambuc#include <openssl/sha.h>
95ebfedea0SLionel Sambuc#endif
96ebfedea0SLionel Sambuc#if defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H)
97ebfedea0SLionel Sambuc#define COMMON_DIGEST_FOR_OPENSSL 1
98ebfedea0SLionel Sambuc#include <CommonCrypto/CommonDigest.h>
99ebfedea0SLionel Sambuc#endif
100ebfedea0SLionel Sambuc]])
101ebfedea0SLionel Sambuc
102ebfedea0SLionel Sambuc# Checks for library functions.
103ebfedea0SLionel Sambuc#
104ebfedea0SLionel SambucAC_SEARCH_LIBS([gzopen], [z])
105ebfedea0SLionel SambucAC_SEARCH_LIBS([BZ2_bzDecompress], [bz2])
106ebfedea0SLionel SambucAC_SEARCH_LIBS([RSA_public_encrypt], [crypto])
107ebfedea0SLionel Sambuc
108ebfedea0SLionel Sambuc# Initialize the testsuite
109ebfedea0SLionel Sambuc#
110ebfedea0SLionel SambucAC_CONFIG_TESTDIR([tests])
111ebfedea0SLionel SambucAM_MISSING_PROG([AUTOM4TE], [autom4te])
112ebfedea0SLionel Sambuc
113ebfedea0SLionel Sambuc# Generate the Makefiles
114ebfedea0SLionel Sambuc#
115ebfedea0SLionel SambucAC_CONFIG_FILES([
116ebfedea0SLionel Sambuc        Makefile
117ebfedea0SLionel Sambuc        include/Makefile
118ebfedea0SLionel Sambuc        src/Makefile
119ebfedea0SLionel Sambuc        src/libmj/Makefile
120ebfedea0SLionel Sambuc        src/lib/Makefile
121ebfedea0SLionel Sambuc        src/netpgp/Makefile
122ebfedea0SLionel Sambuc        src/netpgpkeys/Makefile
123ebfedea0SLionel Sambuc        tests/Makefile
124ebfedea0SLionel Sambuc        tests/atlocal
125ebfedea0SLionel Sambuc])
126ebfedea0SLionel SambucAC_OUTPUT
127ebfedea0SLionel Sambuc
128ebfedea0SLionel Sambuc# Display feature results
129ebfedea0SLionel Sambuc#
130ebfedea0SLionel SambucAC_MSG_NOTICE([ === Configuration results ===])
131ebfedea0SLionel SambucAC_MSG_NOTICE([Version:             $PACKAGE_VERSION])
132ebfedea0SLionel SambucAC_MSG_NOTICE([C compiler:          $CC])
133ebfedea0SLionel SambucAC_MSG_NOTICE([Warning CFLAGS:      $WARNCFLAGS])
134ebfedea0SLionel SambucAC_MSG_NOTICE([=============================])
135