Fixing autoconf/autoheader usage

Enabling autoheader to actually work and adding initial check function
structure for detecting whether we're on z/OS with GSKSSL or on a system
which has OpenSSL.
master
David Lanzendörfer 2 years ago
parent 2bfcaf67c7
commit a8f01c15f9

@ -0,0 +1,88 @@
AU_ALIAS([CHECK_SSL], [AX_CHECK_GSKSSL])
AC_DEFUN([AX_CHECK_GSKSSL], [
found=false
AC_ARG_WITH(gskssl,
AS_HELP_STRING([--with-gskssl=DIR],
[root of the OpenSSL directory]),
[
case "$withval" in
"" | y | ye | yes | n | no)
AC_MSG_ERROR([Invalid --with-gskssl value])
;;
*) ssldirs="$withval"
;;
esac
], [
# if pkg-config is installed and gskssl has installed a .pc file,
# then use that information and don't search ssldirs
AC_PATH_PROG(PKG_CONFIG, pkg-config)
if test x"$PKG_CONFIG" != x""; then
GSKSSL_LDFLAGS=`$PKG_CONFIG gskssl --libs-only-L 2>/dev/null`
if test $? = 0; then
GSKSSL_LIBS=`$PKG_CONFIG gskssl --libs-only-l 2>/dev/null`
GSKSSL_INCLUDES=`$PKG_CONFIG gskssl --cflags-only-I 2>/dev/null`
found=true
fi
fi
# no such luck; use some default ssldirs
if ! $found; then
ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
fi
]
)
# note that we #include <gskssl/foo.h>, so the OpenSSL headers have to be in
# an 'gskssl' subdirectory
if ! $found; then
GSKSSL_INCLUDES=
for ssldir in $ssldirs; do
AC_MSG_CHECKING([for gskssl/ssl.h in $ssldir])
if test -f "$ssldir/include/gskssl/ssl.h"; then
GSKSSL_INCLUDES="-I$ssldir/include"
GSKSSL_LDFLAGS="-L$ssldir/lib"
GSKSSL_LIBS="-lssl -lcrypto"
found=true
AC_MSG_RESULT([yes])
break
else
AC_MSG_RESULT([no])
fi
done
# if the file wasn't found, well, go ahead and try the link anyway -- maybe
# it will just work!
fi
# try the preprocessor and linker with our new flags,
# being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
echo "Trying link with GSKSSL_LDFLAGS=$GSKSSL_LDFLAGS;" \
"GSKSSL_LIBS=$GSKSSL_LIBS; GSKSSL_INCLUDES=$GSKSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
save_LIBS="$LIBS"
save_LDFLAGS="$LDFLAGS"
save_CPPFLAGS="$CPPFLAGS"
LDFLAGS="$LDFLAGS $GSKSSL_LDFLAGS"
LIBS="$GSKSSL_LIBS $LIBS"
CPPFLAGS="$GSKSSL_INCLUDES $CPPFLAGS"
AC_LINK_IFELSE(
AC_LANG_PROGRAM([#include <gskssl/ssl.h>], [SSL_new(NULL)]),
[
AC_MSG_RESULT([yes])
$1
], [
AC_MSG_RESULT([no])
$2
])
CPPFLAGS="$save_CPPFLAGS"
LDFLAGS="$save_LDFLAGS"
LIBS="$save_LIBS"
AC_SUBST([GSKSSL_INCLUDES])
AC_SUBST([GSKSSL_LIBS])
AC_SUBST([GSKSSL_LDFLAGS])
])

@ -10,7 +10,7 @@ AS_SHELL_SANITIZE
AC_CONFIG_SRCDIR([src/netpgp.c])
AC_CONFIG_AUX_DIR([buildaux])
AC_CONFIG_HEADER([src/config.h])
AC_CONFIG_HEADER([include/netpgp/config.h])
AM_INIT_AUTOMAKE([-Wall foreign])
AM_MAINTAINER_MODE
@ -75,9 +75,10 @@ AC_TYPE_UINT8_T
# check for openssl
m4_include([ax_check_openssl.m4])
m4_include([ax_check_gskssl.m4])
AX_CHECK_OPENSSL([LIBS="$LIBS $OPENSSL_LDFLAGS $OPENSSL_LIBS" INCLUDES="$INCLUDES $OPENSSL_INCLUDES"],
[AC_MSG_ERROR([Missing OpenSSL])])
AX_CHECK_OPENSSL([LIBS="$LIBS $OPENSSL_LDFLAGS $OPENSSL_LIBS" INCLUDES="$INCLUDES $OPENSSL_INCLUDES"])
AX_CHECK_GSKSSL([LIBS="$LIBS $OPENSSL_LDFLAGS $OPENSSL_LIBS" INCLUDES="$INCLUDES $OPENSSL_INCLUDES"])
CPPFLAGS="$CPPFLAGS $INCLUDES"

@ -1,160 +1,185 @@
//
// config.h
// netpgp
#ifndef netpgp_config_h
#define netpgp_config_h
/* include/netpgp/config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <bzlib.h> header file. */
#define HAVE_BZLIB_H 1
#undef HAVE_BZLIB_H
/* Define to 1 if you have the <CommonCrypto/CommonDigest.h> header file. */
#define HAVE_COMMONCRYPTO_COMMONDIGEST_H 1
#undef HAVE_COMMONCRYPTO_COMMONDIGEST_H
/* Define to 1 if you have the <direct.h> header file. */
/* #undef HAVE_DIRECT_H */
#undef HAVE_DIRECT_H
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <dmalloc.h> header file. */
/* #undef HAVE_DMALLOC_H */
#undef HAVE_DMALLOC_H
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
#undef HAVE_ERRNO_H
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
#undef HAVE_FCNTL_H
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
#undef HAVE_LIMITS_H
/* Define to 1 if the system has the type 'long long int'. */
#define HAVE_LONG_LONG_INT 1
/* Define to 1 if the system has the type `long long int'. */
#undef HAVE_LONG_LONG_INT
/* Define to 1 if you have the <malloc.h> header file. */
/* #undef HAVE_MALLOC_H */
#undef HAVE_MALLOC_H
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <openssl/aes.h> header file. */
#define HAVE_OPENSSL_AES_H 1
#undef HAVE_OPENSSL_AES_H
/* Define to 1 if you have the <openssl/bn.h> header file. */
#define HAVE_OPENSSL_BN_H 1
#undef HAVE_OPENSSL_BN_H
/* Define to 1 if you have the <openssl/camellia.h> header file. */
/* #undef HAVE_OPENSSL_CAMELLIA_H */
#undef HAVE_OPENSSL_CAMELLIA_H
/* Define to 1 if you have the <openssl/cast.h> header file. */
#define HAVE_OPENSSL_CAST_H 1
#undef HAVE_OPENSSL_CAST_H
/* Define to 1 if you have the <openssl/des.h> header file. */
#define HAVE_OPENSSL_DES_H 1
#undef HAVE_OPENSSL_DES_H
/* Define to 1 if you have the <openssl/dsa.h> header file. */
#define HAVE_OPENSSL_DSA_H 1
#undef HAVE_OPENSSL_DSA_H
/* Define to 1 if you have the <openssl/err.h> header file. */
#define HAVE_OPENSSL_ERR_H 1
#undef HAVE_OPENSSL_ERR_H
/* Define to 1 if you have the <openssl/idea.h> header file. */
/* #undef HAVE_OPENSSL_IDEA_H */
#undef HAVE_OPENSSL_IDEA_H
/* Define to 1 if you have the <openssl/md5.h> header file. */
#define HAVE_OPENSSL_MD5_H 1
#undef HAVE_OPENSSL_MD5_H
/* Define to 1 if you have the <openssl/rand.h> header file. */
#define HAVE_OPENSSL_RAND_H 1
#undef HAVE_OPENSSL_RAND_H
/* Define to 1 if you have the <openssl/rsa.h> header file. */
#define HAVE_OPENSSL_RSA_H 1
#undef HAVE_OPENSSL_RSA_H
/* Define to 1 if you have the <openssl/sha.h> header file. */
#define HAVE_OPENSSL_SHA_H 1
#undef HAVE_OPENSSL_SHA_H
/* Define to 1 if the system has the type `SHA256_CTX'. */
#define HAVE_SHA256_CTX 1
#undef HAVE_SHA256_CTX
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/cdefs.h> header file. */
#define HAVE_SYS_CDEFS_H 1
#undef HAVE_SYS_CDEFS_H
/* Define to 1 if you have the <sys/file.h> header file. */
#define HAVE_SYS_FILE_H 1
#undef HAVE_SYS_FILE_H
/* Define to 1 if you have the <sys/mman.h> header file. */
#define HAVE_SYS_MMAN_H 1
#undef HAVE_SYS_MMAN_H
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
#undef HAVE_SYS_RESOURCE_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <sys/uio.h> header file. */
#define HAVE_SYS_UIO_H 1
#undef HAVE_SYS_UIO_H
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
#undef HAVE_UNISTD_H
/* Define to 1 if the system has the type 'unsigned long long int'. */
#define HAVE_UNSIGNED_LONG_LONG_INT 1
/* Define to 1 if the system has the type `unsigned long long int'. */
#undef HAVE_UNSIGNED_LONG_LONG_INT
/* Define to 1 if you have the <zlib.h> header file. */
#define HAVE_ZLIB_H 1
#undef HAVE_ZLIB_H
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
#undef LT_OBJDIR
/* Name of package */
#define PACKAGE "netpgp"
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT " pEp NetPGP Team <netpgp@pep-project.org> "
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#define PACKAGE_NAME "netpgp"
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "netpgp beta0"
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "netpgp"
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#define PACKAGE_URL ""
#undef PACKAGE_URL
/* Define to the version of this package. */
#define PACKAGE_VERSION "beta0"
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
#undef STDC_HEADERS
/* Version number of package */
#define VERSION "beta0"
#undef VERSION
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
#undef _UINT32_T
/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
#undef _UINT64_T
/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
#undef _UINT8_T
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* Define to the type of an unsigned integer type of width exactly 16 bits if
such a type exists and the standard includes do not define it. */
#undef uint16_t
/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
#undef uint32_t
#define OPENSSL_NO_IDEA 1
/* Define to the type of an unsigned integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
#undef uint64_t
#endif
/* Define to the type of an unsigned integer type of width exactly 8 bits if
such a type exists and the standard includes do not define it. */
#undef uint8_t
Loading…
Cancel
Save