Add --enable-openssl-pkgconfig-template option.

This can be used to find the correct openssl pkg-config file
if it is not named "openssl" (also libcrypto).
This commit is contained in:
Todd C. Miller
2021-09-13 09:33:09 -06:00
parent ecc3aeffc6
commit 052391da9c
3 changed files with 38 additions and 12 deletions

View File

@@ -636,6 +636,13 @@ Authentication options:
not be used as they do not support TLS 1.2. If specified,
DIR should contain the OpenSSL include and lib directories.
--enable-openssl-pkgconfig-template=template
A printf-style template used to construct the name of the
openssl and libcrypto pkg-config files. For example, a
template of "e%s30" would cause "eopenssl30" and "libecrypto30"
to be used instead. This makes it possible to link with
the OpenSSL 3.0 package on OpenBSD. Defaults to "%s".
Development options:
--enable-env-debug
Enable debugging of the environment setting functions. This

26
configure vendored
View File

@@ -1043,6 +1043,7 @@ enable_pvs_studio
enable_log_server
enable_log_client
enable_openssl
enable_openssl_pkgconfig_template
enable_gcrypt
enable_python
enable_shared
@@ -1758,6 +1759,9 @@ Optional Features:
--disable-log-client Disable sudoers support for using the sudo_logsrvd
log server.
--enable-openssl Use OpenSSL's TLS and sha2 functions
--enable-openssl-pkgconfig-template
A printf format string used to contruct the OpenSSL
pkg-config name
--enable-gcrypt Use GNU crypt's sha2 functions
--enable-python Compile python plugin support
--enable-shared[=PKGS] build shared libraries [default=yes]
@@ -6970,6 +6974,14 @@ else $as_nop
fi
# Check whether --enable-openssl-pkgconfig-template was given.
if test ${enable_openssl_pkgconfig_template+y}
then :
enableval=$enable_openssl_pkgconfig_template;
else $as_nop
enable_openssl_pkgconfig_template="%s"
fi
# Check whether --enable-gcrypt was given.
if test ${enable_gcrypt+y}
@@ -23286,7 +23298,8 @@ if test "${enable_openssl-no}" != no; then
PKG_CONFIG=false
fi
: ${PKG_CONFIG='pkg-config'}
if $PKG_CONFIG --exists "openssl >= 1.0.1" >/dev/null 2>&1; then
pkg_openssl=`printf $enable_openssl_pkgconfig_template "openssl"`
if $PKG_CONFIG --exists "$pkg_openssl >= 1.0.1" >/dev/null 2>&1; then
printf "%s\n" "#define HAVE_OPENSSL 1" >>confdefs.h
if test "$enable_openssl" = "maybe"; then
@@ -23294,7 +23307,7 @@ if test "${enable_openssl-no}" != no; then
fi
O_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs-only-L openssl`"
LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs-only-L $pkg_openssl`"
# Check whether --static is needed
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SSL_new in -lssl" >&5
printf %s "checking for SSL_new in -lssl... " >&6; }
@@ -23383,16 +23396,17 @@ fi
LDFLAGS="$O_LDFLAGS"
# Use pkg-config to determine OpenSSL libs and cflags
LIBTLS=`$PKG_CONFIG $STATIC --libs openssl`
LIBTLS=`$PKG_CONFIG $STATIC --libs $pkg_openssl`
if test "$DIGEST" = "digest_openssl.lo"; then
if $PKG_CONFIG --exists libcrypto >/dev/null 2>&1; then
LIBMD=`$PKG_CONFIG $STATIC --libs libcrypto`
pkg_libcrypto=lib`printf $enable_openssl_pkgconfig_template "crypto"`
if $PKG_CONFIG --exists $pkg_libcrypto >/dev/null 2>&1; then
LIBMD=`$PKG_CONFIG $STATIC --libs $pkg_libcrypto`
else
# No separate pkg config for libcrypto
LIBMD="$LIBTLS"
fi
fi
for f in `$PKG_CONFIG --cflags-only-I openssl`; do
for f in `$PKG_CONFIG --cflags-only-I $pkg_openssl`; do
if test ${CPPFLAGS+y}
then :

View File

@@ -1570,6 +1570,9 @@ AC_ARG_ENABLE(openssl,
enable_openssl=maybe
fi
])
AC_ARG_ENABLE(openssl-pkgconfig-template,
[AS_HELP_STRING([--enable-openssl-pkgconfig-template], [A printf format string used to contruct the OpenSSL pkg-config name])],
[], [enable_openssl_pkgconfig_template="%s"])
AC_ARG_ENABLE(gcrypt,
[AS_HELP_STRING([--enable-gcrypt], [Use GNU crypt's sha2 functions])], [
@@ -2941,14 +2944,15 @@ if test "${enable_openssl-no}" != no; then
PKG_CONFIG=false
fi
: ${PKG_CONFIG='pkg-config'}
if $PKG_CONFIG --exists "openssl >= 1.0.1" >/dev/null 2>&1; then
pkg_openssl=`printf $enable_openssl_pkgconfig_template "openssl"`
if $PKG_CONFIG --exists "$pkg_openssl >= 1.0.1" >/dev/null 2>&1; then
AC_DEFINE(HAVE_OPENSSL)
if test "$enable_openssl" = "maybe"; then
enable_openssl=yes
fi
O_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs-only-L openssl`"
LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs-only-L $pkg_openssl`"
# Check whether --static is needed
AC_CHECK_LIB(ssl, SSL_new, [STATIC=""], [STATIC="--static"], [-lcrypto])
@@ -2957,16 +2961,17 @@ if test "${enable_openssl-no}" != no; then
LDFLAGS="$O_LDFLAGS"
# Use pkg-config to determine OpenSSL libs and cflags
LIBTLS=`$PKG_CONFIG $STATIC --libs openssl`
LIBTLS=`$PKG_CONFIG $STATIC --libs $pkg_openssl`
if test "$DIGEST" = "digest_openssl.lo"; then
if $PKG_CONFIG --exists libcrypto >/dev/null 2>&1; then
LIBMD=`$PKG_CONFIG $STATIC --libs libcrypto`
pkg_libcrypto=lib`printf $enable_openssl_pkgconfig_template "crypto"`
if $PKG_CONFIG --exists $pkg_libcrypto >/dev/null 2>&1; then
LIBMD=`$PKG_CONFIG $STATIC --libs $pkg_libcrypto`
else
# No separate pkg config for libcrypto
LIBMD="$LIBTLS"
fi
fi
for f in `$PKG_CONFIG --cflags-only-I openssl`; do
for f in `$PKG_CONFIG --cflags-only-I $pkg_openssl`; do
AX_APPEND_FLAG([$f], [CPPFLAGS])
done
else