|
Packit |
6b81fa |
dnl -*- mode: m4; -*-
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
AC_PREREQ(2.60)
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
# When bumping versions see also the LT vesion numbers below.
|
|
Packit |
6b81fa |
define([PACKAGE_VERSION_MAJOR], [0])
|
|
Packit |
6b81fa |
define([PACKAGE_VERSION_MINOR], [4])
|
|
Packit |
6b81fa |
define([PACKAGE_VERSION_FIX], [10])
|
|
Packit |
6b81fa |
define([PACKAGE_SUFFIX], [])
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
AC_INIT([libp11],[PACKAGE_VERSION_MAJOR.PACKAGE_VERSION_MINOR.PACKAGE_VERSION_FIX[]PACKAGE_SUFFIX])
|
|
Packit |
6b81fa |
AC_CONFIG_AUX_DIR([.])
|
|
Packit |
6b81fa |
AC_CONFIG_HEADERS([src/config.h])
|
|
Packit |
6b81fa |
AC_CONFIG_MACRO_DIR([m4])
|
|
Packit |
6b81fa |
AM_INIT_AUTOMAKE([subdir-objects])
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
LIBP11_VERSION_MAJOR="PACKAGE_VERSION_MAJOR"
|
|
Packit |
6b81fa |
LIBP11_VERSION_MINOR="PACKAGE_VERSION_MINOR"
|
|
Packit |
6b81fa |
LIBP11_VERSION_FIX="PACKAGE_VERSION_FIX"
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
AC_CONFIG_SRCDIR([src/libp11.h])
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
# silent build by default
|
|
Packit |
6b81fa |
ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
AC_CANONICAL_HOST
|
|
Packit |
6b81fa |
AC_PROG_CC
|
|
Packit |
6b81fa |
PKG_PROG_PKG_CONFIG
|
|
Packit |
6b81fa |
AC_C_BIGENDIAN
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
# we need to set our soversion based on openssl's soversion to avoid
|
|
Packit |
6b81fa |
# issues with applications linking to new openssl, old libp11, and vice versa
|
|
Packit |
6b81fa |
case "`$PKG_CONFIG --modversion --silence-errors libcrypto || \
|
|
Packit |
6b81fa |
$PKG_CONFIG --modversion openssl`" in
|
|
Packit |
6b81fa |
1.1.*) # Predicted engines directory prefix for OpenSSL 1.1.x
|
|
Packit |
6b81fa |
LIBP11_LT_OLDEST="3"
|
|
Packit |
6b81fa |
debian_ssl_prefix="openssl-1.1.0";;
|
|
Packit |
6b81fa |
1.0.*) # Engines directory prefix for OpenSSL 1.0.x
|
|
Packit |
6b81fa |
LIBP11_LT_OLDEST="2"
|
|
Packit |
6b81fa |
debian_ssl_prefix="openssl-1.0.0";;
|
|
Packit |
6b81fa |
*) # Engines directory prefix for OpenSSL 0.9.x
|
|
Packit |
6b81fa |
LIBP11_LT_OLDEST="2"
|
|
Packit |
6b81fa |
debian_ssl_prefix="ssl";;
|
|
Packit |
6b81fa |
esac
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
# LT Version numbers, remember to change them just *before* a release.
|
|
Packit |
6b81fa |
# (Code changed: REVISION++)
|
|
Packit |
6b81fa |
# (Oldest interface removed: OLDEST++)
|
|
Packit |
6b81fa |
# (Interfaces added: CURRENT++, REVISION=0)
|
|
Packit |
6b81fa |
#
|
|
Packit |
6b81fa |
# Note that at this moment we tie the oldest (soname) version to
|
|
Packit |
6b81fa |
# the openssl version we link to. If the ABI is broken on a later
|
|
Packit |
6b81fa |
# release, we should either stick to supporting a single openssl ABI
|
|
Packit |
6b81fa |
# or bump the LT_OLDEST version sufficiently to avoid clashes.
|
|
Packit |
6b81fa |
LIBP11_LT_REVISION="2"
|
|
Packit |
6b81fa |
LIBP11_LT_CURRENT="7"
|
|
Packit |
6b81fa |
LIBP11_LT_AGE="$((${LIBP11_LT_CURRENT}-${LIBP11_LT_OLDEST}))"
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
gl_LD_VERSION_SCRIPT
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
AC_ARG_WITH(
|
|
Packit |
6b81fa |
[cygwin-native],
|
|
Packit |
6b81fa |
[AS_HELP_STRING([--with-cygwin-native],[compile native win32])],
|
|
Packit |
6b81fa |
,
|
|
Packit |
6b81fa |
[with_cygwin_native="no"]
|
|
Packit |
6b81fa |
)
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
dnl Check for some target-specific stuff
|
|
Packit |
6b81fa |
test -z "${WIN32}" && WIN32="no"
|
|
Packit |
6b81fa |
test -z "${CYGWIN}" && CYGWIN="no"
|
|
Packit |
6b81fa |
case "${host}" in
|
|
Packit |
6b81fa |
*-mingw*|*-winnt*)
|
|
Packit |
6b81fa |
WIN32="yes"
|
|
Packit |
6b81fa |
CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
|
|
Packit |
6b81fa |
WIN_LIBPREFIX="lib"
|
|
Packit |
6b81fa |
;;
|
|
Packit |
6b81fa |
*-cygwin*)
|
|
Packit |
6b81fa |
AC_MSG_CHECKING([cygwin mode to use])
|
|
Packit |
6b81fa |
CYGWIN="yes"
|
|
Packit |
6b81fa |
if test "${with_cygwin_native}" = "yes"; then
|
|
Packit |
6b81fa |
AC_MSG_RESULT([Using native win32])
|
|
Packit |
6b81fa |
CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
|
|
Packit |
6b81fa |
CFLAGS="${CFLAGS} -mno-cygwin"
|
|
Packit |
6b81fa |
WIN32="yes"
|
|
Packit |
6b81fa |
else
|
|
Packit |
6b81fa |
AC_MSG_RESULT([Using cygwin])
|
|
Packit |
6b81fa |
CPPFLAGS="${CPPFLAGS} -DCRYPTOKI_FORCE_WIN32"
|
|
Packit |
6b81fa |
WIN_LIBPREFIX="cyg"
|
|
Packit |
6b81fa |
AC_DEFINE([USE_CYGWIN], [1], [Define if you are on Cygwin])
|
|
Packit |
6b81fa |
fi
|
|
Packit |
6b81fa |
;;
|
|
Packit |
6b81fa |
esac
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
AC_ARG_ENABLE(
|
|
Packit |
6b81fa |
[strict],
|
|
Packit |
6b81fa |
[AS_HELP_STRING([--enable-strict],[enable strict compile mode @<:@disabled@:>@])],
|
|
Packit |
6b81fa |
,
|
|
Packit |
6b81fa |
[enable_strict="no"]
|
|
Packit |
6b81fa |
)
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
AC_ARG_ENABLE(
|
|
Packit |
6b81fa |
[pedantic],
|
|
Packit |
6b81fa |
[AS_HELP_STRING([--enable-pedantic],[enable pedantic compile mode @<:@disabled@:>@])],
|
|
Packit |
6b81fa |
,
|
|
Packit |
6b81fa |
[enable_pedantic="no"]
|
|
Packit |
6b81fa |
)
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
AC_ARG_ENABLE(
|
|
Packit |
6b81fa |
[api-doc],
|
|
Packit |
6b81fa |
[AS_HELP_STRING([--enable-api-doc],[enable generation and installation of API documents @<:@disabled@:>@])],
|
|
Packit |
6b81fa |
,
|
|
Packit |
6b81fa |
[enable_api_doc="no"]
|
|
Packit |
6b81fa |
)
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
AC_ARG_WITH(
|
|
Packit |
6b81fa |
[apidocdir],
|
|
Packit |
6b81fa |
[AS_HELP_STRING([--with-apidocdir],[put API documents at this directory @<:@HTMLDIR/api@:>@])],
|
|
Packit |
6b81fa |
[apidocdir="${with_apidocdir}"],
|
|
Packit |
6b81fa |
[apidocdir="\$(htmldir)/api"]
|
|
Packit |
6b81fa |
)
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
AC_ARG_WITH(
|
|
Packit |
6b81fa |
[enginesdir],
|
|
Packit |
6b81fa |
[AS_HELP_STRING([--with-enginesdir], [OpenSSL engines directory])],
|
|
Packit |
6b81fa |
[enginesexecdir="${withval}"],
|
|
Packit |
6b81fa |
[
|
|
Packit |
6b81fa |
enginesexecdir="`$PKG_CONFIG --variable=enginesdir --silence-errors libcrypto`"
|
|
Packit |
6b81fa |
if test "${enginesexecdir}" = ""; then
|
|
Packit |
6b81fa |
libcryptodir="`$PKG_CONFIG --variable=libdir --silence-errors libcrypto || \
|
|
Packit |
6b81fa |
$PKG_CONFIG --variable=libdir openssl`"
|
|
Packit |
6b81fa |
if test -d "$libcryptodir/$debian_ssl_prefix/engines"; then
|
|
Packit |
6b81fa |
# Debian-based OpenSSL package (for example Ubuntu)
|
|
Packit |
6b81fa |
enginesexecdir="$libcryptodir/$debian_ssl_prefix/engines"
|
|
Packit |
6b81fa |
else # Default OpenSSL engines directory
|
|
Packit |
6b81fa |
enginesexecdir="$libcryptodir/engines"
|
|
Packit |
6b81fa |
fi
|
|
Packit |
6b81fa |
if test "${prefix}" != "NONE" -o "${exec_prefix}" != "NONE"; then
|
|
Packit |
6b81fa |
# Override the autodetected value with the default
|
|
Packit |
6b81fa |
enginesexecdir="\$(libdir)"
|
|
Packit |
6b81fa |
fi
|
|
Packit |
6b81fa |
fi
|
|
Packit |
6b81fa |
]
|
|
Packit |
6b81fa |
)
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
AC_ARG_WITH(
|
|
Packit |
6b81fa |
[pkcs11-module],
|
|
Packit |
6b81fa |
[AS_HELP_STRING([--with-pkcs11-module], [default PKCS11 module])],
|
|
Packit |
6b81fa |
[pkcs11_module="${withval}"],
|
|
Packit |
6b81fa |
[pkcs11_module="`$PKG_CONFIG --variable=proxy_module --silence-errors p11-kit-1`"])
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
dnl Checks for programs.
|
|
Packit |
6b81fa |
AC_PROG_CPP
|
|
Packit |
6b81fa |
AC_PROG_INSTALL
|
|
Packit |
6b81fa |
AC_PROG_LN_S
|
|
Packit |
6b81fa |
AC_PROG_MKDIR_P
|
|
Packit |
6b81fa |
AC_PROG_SED
|
|
Packit |
6b81fa |
AC_PROG_MAKE_SET
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
dnl Add libtool support.
|
|
Packit |
6b81fa |
ifdef(
|
|
Packit |
6b81fa |
[LT_INIT],
|
|
Packit |
6b81fa |
[
|
|
Packit |
6b81fa |
LT_INIT([win32-dll])
|
|
Packit |
6b81fa |
LT_LANG([Windows Resource])
|
|
Packit |
6b81fa |
],
|
|
Packit |
6b81fa |
[
|
|
Packit |
6b81fa |
AC_LIBTOOL_WIN32_DLL
|
|
Packit |
6b81fa |
AC_LIBTOOL_RC
|
|
Packit |
6b81fa |
AC_PROG_LIBTOOL
|
|
Packit |
6b81fa |
]
|
|
Packit |
6b81fa |
)
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
dnl Checks for header files.
|
|
Packit |
6b81fa |
AC_HEADER_STDC
|
|
Packit |
6b81fa |
AC_HEADER_SYS_WAIT
|
|
Packit |
6b81fa |
AC_CHECK_HEADERS([ \
|
|
Packit |
6b81fa |
errno.h fcntl.h malloc.h stdlib.h \
|
|
Packit |
6b81fa |
inttypes.h string.h strings.h sys/time.h \
|
|
Packit |
6b81fa |
unistd.h locale.h getopt.h dlfcn.h utmp.h \
|
|
Packit |
6b81fa |
])
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
AC_ARG_VAR([DOXYGEN], [doxygen utility])
|
|
Packit |
6b81fa |
AC_CHECK_PROGS([DOXYGEN],[doxygen])
|
|
Packit |
6b81fa |
test "${enable_api_doc}" = "yes" -a -z "${DOXYGEN}" && AC_MSG_ERROR([doxygen is required for API doc])
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
if test "${WIN32}" != "yes"; then
|
|
Packit |
6b81fa |
AC_SEARCH_LIBS(
|
|
Packit |
6b81fa |
[dlopen],
|
|
Packit |
6b81fa |
[dl],
|
|
Packit |
6b81fa |
,
|
|
Packit |
6b81fa |
[AC_MSG_ERROR([dlopen required])]
|
|
Packit |
6b81fa |
)
|
|
Packit |
6b81fa |
AC_CHECK_FUNCS([__register_atfork],,)
|
|
Packit |
6b81fa |
fi
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
PKG_CHECK_MODULES(
|
|
Packit |
6b81fa |
[OPENSSL],
|
|
Packit |
6b81fa |
[libcrypto >= 0.9.8],
|
|
Packit |
6b81fa |
,
|
|
Packit |
6b81fa |
[AC_MSG_ERROR([libcrypto >= 0.9.8 is required])]
|
|
Packit |
6b81fa |
)
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
if test -n "${pkcs11_module}"; then
|
|
Packit |
6b81fa |
AC_DEFINE_UNQUOTED(
|
|
Packit |
6b81fa |
[DEFAULT_PKCS11_MODULE],
|
|
Packit |
6b81fa |
"${pkcs11_module}",
|
|
Packit |
6b81fa |
[Default PKCS#11 module.])
|
|
Packit |
6b81fa |
fi
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
pkgconfigdir="\$(libdir)/pkgconfig"
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
AC_SUBST([pkgconfigdir])
|
|
Packit |
6b81fa |
AC_SUBST([apidocdir])
|
|
Packit |
6b81fa |
AC_SUBST([enginesexecdir])
|
|
Packit |
6b81fa |
AC_SUBST([LIBP11_VERSION_MAJOR])
|
|
Packit |
6b81fa |
AC_SUBST([LIBP11_VERSION_MINOR])
|
|
Packit |
6b81fa |
AC_SUBST([LIBP11_VERSION_FIX])
|
|
Packit |
6b81fa |
AC_SUBST([LIBP11_LT_CURRENT])
|
|
Packit |
6b81fa |
AC_SUBST([LIBP11_LT_REVISION])
|
|
Packit |
6b81fa |
AC_SUBST([LIBP11_LT_AGE])
|
|
Packit |
6b81fa |
AC_SUBST([LIBP11_LT_OLDEST])
|
|
Packit |
6b81fa |
AC_SUBST([WIN_LIBPREFIX])
|
|
Packit |
6b81fa |
AC_SUBST([SHARED_EXT], $(eval echo "${shrext_cmds}"))
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
|
|
Packit |
6b81fa |
AM_CONDITIONAL([CYGWIN], [test "${CYGWIN}" = "yes"])
|
|
Packit |
6b81fa |
AM_CONDITIONAL([ENABLE_API_DOC], [test "${enable_api_doc}" = "yes"])
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
if test "${enable_pedantic}" = "yes"; then
|
|
Packit |
6b81fa |
enable_strict="yes";
|
|
Packit |
6b81fa |
CFLAGS="${CFLAGS} -pedantic"
|
|
Packit |
6b81fa |
fi
|
|
Packit |
6b81fa |
if test "${enable_strict}" = "yes"; then
|
|
Packit |
6b81fa |
CFLAGS="${CFLAGS} -Wall -Wextra"
|
|
Packit |
6b81fa |
fi
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
AC_MSG_CHECKING([if libtool needs -no-undefined flag to build shared libraries])
|
|
Packit |
6b81fa |
case "$host_os" in
|
|
Packit |
6b81fa |
cygwin*|msys*|mingw*)
|
|
Packit |
6b81fa |
## Add in the -no-undefined flag to LDFLAGS for libtool.
|
|
Packit |
6b81fa |
AC_MSG_RESULT([yes])
|
|
Packit |
6b81fa |
LDFLAGS="$LDFLAGS -no-undefined"
|
|
Packit |
6b81fa |
;;
|
|
Packit |
6b81fa |
*)
|
|
Packit |
6b81fa |
## Don't add in anything.
|
|
Packit |
6b81fa |
AC_MSG_RESULT([no])
|
|
Packit |
6b81fa |
;;
|
|
Packit |
6b81fa |
esac
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
AC_CONFIG_FILES([
|
|
Packit |
6b81fa |
Makefile
|
|
Packit |
6b81fa |
src/Makefile
|
|
Packit |
6b81fa |
src/libp11.pc
|
|
Packit |
6b81fa |
src/libp11.rc
|
|
Packit |
6b81fa |
src/pkcs11.rc
|
|
Packit |
6b81fa |
doc/Makefile
|
|
Packit |
6b81fa |
doc/doxygen.conf
|
|
Packit |
6b81fa |
examples/Makefile
|
|
Packit |
6b81fa |
tests/Makefile
|
|
Packit |
6b81fa |
])
|
|
Packit |
6b81fa |
AC_OUTPUT
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
AC_MSG_NOTICE([creating src/libp11.map])
|
|
Packit |
6b81fa |
# We do it *after* the src directory is created
|
|
Packit |
6b81fa |
rm -f src/libp11.map
|
|
Packit |
6b81fa |
echo "LIBP11_${LIBP11_LT_OLDEST}" >src/libp11.map
|
|
Packit |
6b81fa |
echo "{" >>src/libp11.map
|
|
Packit |
6b81fa |
echo "global:" >>src/libp11.map
|
|
Packit |
6b81fa |
tr '\n' ';' <$srcdir/src/libp11.exports >>src/libp11.map
|
|
Packit |
6b81fa |
echo "" >>src/libp11.map
|
|
Packit |
6b81fa |
echo "local:" >>src/libp11.map
|
|
Packit |
6b81fa |
echo '*;' >>src/libp11.map
|
|
Packit |
6b81fa |
echo "};" >>src/libp11.map
|
|
Packit |
6b81fa |
chmod ugo-w src/libp11.map
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
cat <
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
libp11 has been configured with the following options:
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
Version: ${PACKAGE_VERSION}
|
|
Packit |
6b81fa |
libp11 directory: $(eval eval eval echo "${libdir}")
|
|
Packit |
6b81fa |
Engine directory: ${enginesexecdir}
|
|
Packit |
6b81fa |
Default PKCS11 module: ${pkcs11_module}
|
|
Packit |
6b81fa |
API doc support: ${enable_api_doc}
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
Host: ${host}
|
|
Packit |
6b81fa |
Compiler: ${CC}
|
|
Packit |
6b81fa |
Preprocessor flags: ${CPPFLAGS}
|
|
Packit |
6b81fa |
Compiler flags: ${CFLAGS}
|
|
Packit |
6b81fa |
Linker flags: ${LDFLAGS}
|
|
Packit |
6b81fa |
Libraries: ${LIBS}
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
OPENSSL_CFLAGS: ${OPENSSL_CFLAGS}
|
|
Packit |
6b81fa |
OPENSSL_LIBS: ${OPENSSL_LIBS}
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
EOF
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
# vim: set noexpandtab:
|