An improved fork of NetBSD's OpenPGP implementation; maintained by the p≡p foundation.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

192 lines
4.8 KiB

# $NetBSD$
#
# Process this file with autoconf to produce a configure script.
AC_INIT([netpgp],[beta0],[ pEp NetPGP Team <netpgp@pep-project.org> ])
AC_PREREQ(2.69)
AC_REVISION([$Revision$])
AS_SHELL_SANITIZE
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_AUX_DIR([buildaux])
AC_CONFIG_HEADER([include/netpgp/config.h])
AM_INIT_AUTOMAKE([-Wall foreign])
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
CANONICAL_HOST=$host
AC_SUBST([CANONICAL_HOST])
# Checks for programs.
#
AC_PROG_MAKE_SET
AC_PROG_AWK
AC_PROG_CC
AC_PROG_INSTALL
AM_PROG_AR
AC_PROG_LIBTOOL
AC_PROG_LN_S
dnl based on AC_PROG_RANLIB from autoconf
m4_ifndef([AC_PROG_AR],[dnl
AN_MAKEVAR([AR], [AC_PROG_AR])
AN_PROGRAM([ar], [AC_PROG_AR])
AC_DEFUN([AC_PROG_AR],
[AC_CHECK_TOOL(AR, ar, :)])
])
AC_PROG_AR
# Compiler characteristics
#
AC_MSG_CHECKING([if using gcc])
AS_IF([test "$GCC" = "yes"],
[WARNCFLAGS="-Wno-error -Wall -Wpointer-arith"
AC_MSG_RESULT([yes; adding to CFLAGS: "$WARNCFLAGS"])],
[WARNCFLAGS=""
AC_MSG_RESULT([no])])
AC_SUBST([WARNCFLAGS])
# try to see if we need to link with -ldl
AC_SEARCH_LIBS(dlopen, dl)
# Checks for header files.
#
AC_HEADER_STDC
AC_CHECK_HEADERS([CommonCrypto/CommonDigest.h])
AC_CHECK_HEADERS([dmalloc.h direct.h errno.h fcntl.h inttypes.h limits.h malloc.h zlib.h])
AC_CHECK_HEADERS([sys/cdefs.h sys/file.h sys/mman.h sys/resource.h sys/uio.h])
platform_name=$(uname)
AS_IF([test "$platform_name" == "OS/390"],[
AC_MSG_NOTICE([z/OS detected... Skipping some headers])
ZLIB_FLAG="-lzz"
NETPGP_CFLAGS="$WARNCLAGS $CFLAGS -qlanglvl=extc99 -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112L"
],[
AC_CHECK_HEADERS([sys/param.h])
AC_CHECK_HEADERS([bzlib.h], [], [
AC_MSG_FAILURE([missing <bzlib.h>; is bzip2 installed?])
])
ZLIB_FLAG="-lz"
NETPGP_CFLAGS="$WARNCLAGS $CFLAGS"
])
AC_SUBST([ZLIB_FLAG])
# Checks for typedefs, structures, and compiler characteristics.
#
AC_TYPE_LONG_LONG_INT
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
found_gskssl="no"
found_pkcs="no"
found_openssl="no"
# check for openssl
m4_include([ax_check_openssl.m4])
m4_include([ax_check_gskssl.m4])
m4_include([ax_check_pkcs.m4])
AX_CHECK_OPENSSL([found_openssl="yes"],[found_openssl="no"])
AS_IF(
[test "$found_openssl" == "yes"],
[
LIBS="$LIBS $OPENSSL_LIBS"
INCLUDES="$INCLUDES $OPENSSL_INCLUDES"
NETPGP_CFLAGS="$OPENSSL_LDFLAGS $NETPGP_CFLAGS"
],
[
AX_CHECK_GSKSSL([found_gskssl="yes"],[found_gskssl="no"])
AS_IF(
[test "$found_gskssl" == "yes"],
[
LIBS="$LIBS $GSKSSL_LIBS"
INCLUDES="$INCLUDES $GSKSSL_INCLUDES"
NETPGP_CFLAGS="$GSKSSL_LDFLAGS $NETPGP_CFLAGS"
],
[
AC_MSG_FAILURE([No suitable SSL library found])
]
)
AX_CHECK_PKCS([found_pkcs="yes"],[found_pkcs="no"])
AS_IF(
[test "$found_pkcs" == "yes"],
[
LIBS="$LIBS $PKCS_LIBS"
INCLUDES="$INCLUDES $PKCS_INCLUDES"
NETPGP_CFLAGS="$PKSC_LDFLAGS $NETPGP_CFLAGS"
],
[
AC_MSG_FAILURE([PKCS library not found])
]
)
]
)
AC_SUBST([NETPGP_CFLAGS])
LIBS="$LIBS $ZLIB_FLAG"
CPPFLAGS="$CPPFLAGS $INCLUDES"
AS_IF([test "$found_openssl" == "yes" ],[
AC_MSG_NOTICE([OpenSSL found])
AC_DEFINE([HAVE_OPENSSL], [1], [Use OpenSSL])
AC_CHECK_HEADERS([openssl/aes.h openssl/bn.h openssl/camellia.h openssl/cast.h \
openssl/des.h openssl/dsa.h openssl/err.h openssl/idea.h \
openssl/md5.h openssl/rand.h openssl/rsa.h openssl/sha.h \
openssl/err.h openssl/sha.h openssl/ossl_typ.h])
AC_CHECK_TYPES([SHA256_CTX],
[],
[AC_MSG_FAILURE([missing SHA256_CTX; is openssl 0.9.8 or newer installed?])],
[[
#if defined(HAVE_SYS_TYPES_H)
#include <sys/types.h>
#endif
#if defined(HAVE_OPENSSL_SHA_H)
#include <openssl/sha.h>
#endif
#if defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H)
#define COMMON_DIGEST_FOR_OPENSSL 1
#include <CommonCrypto/CommonDigest.h>
#endif
]])
])
AS_IF([test "$found_gskssl" == "yes" ],[
AC_MSG_NOTICE([GSK SSL found])
AC_DEFINE([HAVE_GSKSSL], [1], [Use the SSL implementation from IBM])
AC_DEFINE([OPENSSL_NO_IDEA], [1], [Explicitely disable OPENSSL IDEA])
])
# Checks for library functions.
#
AC_SEARCH_LIBS([gzopen], [z])
AC_SEARCH_LIBS([BZ2_bzDecompress], [bz2])
AC_SEARCH_LIBS([RSA_public_encrypt], [crypto])
# Generate the Makefiles
#
AC_CONFIG_FILES([
Makefile
include/Makefile
include/netpgp/Makefile
src/Makefile
])
AC_OUTPUT
# Display feature results
#
AC_MSG_NOTICE([ === Configuration results ===])
AC_MSG_NOTICE([Version: $PACKAGE_VERSION])
AC_MSG_NOTICE([C compiler: $CC])
AC_MSG_NOTICE([Warning CFLAGS: $WARNCFLAGS])
AC_MSG_NOTICE([=============================])