configure.ac: Fix SHA1 handling

Fix and marginally simplify the SHA1 handling.  First, we allow people
to override it.  Secondly, we try for libmd.  Then, we try for OpenSSL
with pkg-config.  In a last, desperate move, we try libcrypto on its
own.  This allows the server to, y'know, _link_ when using OpenSSL,
instead of failing because we only have -lcrypto, and not -lssl.
This commit is contained in:
Daniel Stone 2008-07-16 02:54:41 +03:00
parent 69b57dc651
commit c3c901cf44
1 changed files with 15 additions and 11 deletions

View File

@ -1101,26 +1101,30 @@ MIEXT_SHADOW_INC='-I$(top_srcdir)/miext/shadow'
MIEXT_SHADOW_LIB='$(top_builddir)/miext/shadow/libshadow.la'
CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include'
PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS])
PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
# OpenSSL used for SHA1 hashing in render/glyph.c, but we don't need all of
# the OpenSSL libraries, just libcrypto
# Some systems have matching functionality in the smaller/simpler libmd
# Builders who want to force a choice can set SHA1_LIB and SHA1_CFLAGS
if test "x$SHA1_LIB" = "x" ; then
AC_CHECK_LIB([md], [SHA1Init], [SHA1_LIB="-lmd"
AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1],
[Define to use libmd SHA1 functions instead of OpenSSL libcrypto])])
AC_CHECK_LIB([md], [SHA1Init], [SHA1_LIB="-lmd"
AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1],
[Use libmd SHA1 functions instead of OpenSSL libcrypto])])
fi
if test "x$SHA1_LIB" = "x" ; then
AC_CHECK_LIB([crypto], [SHA1_Init], [],
[PKG_CHECK_MODULES([OPENSSL], [openssl],
[OPENSSL_LIB_FLAGS=`$PKG_CONFIG --libs-only-L --libs-only-other openssl`])])
SHA1_LIB="$OPENSSL_LIB_FLAGS -lcrypto"
SHA1_CFLAGS="$OPENSSL_CFLAGS"
PKG_CHECK_EXISTS([OPENSSL], [openssl], [HAVE_OPENSSL_PKC=yes],
[HAVE_OPENSSL_PKC=no])
if test "x$HAVE_OPENSSL_PKC" = xyes; then
REQUIRED_LIBS="$REQUIRED_LIBS openssl"
else
AC_CHECK_LIB([crypto], [SHA1_Init], [SHA1_LIB="-lcrypto"],
[AC_MSG_ERROR([OpenSSL must be installed in order to build the X server.])])
fi
fi
PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS])
PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
# Autotools has some unfortunate issues with library handling. In order to
# get a server to rebuild when a dependency in the tree is changed, it must
# be listed in SERVERNAME_DEPENDENCIES. However, no system libraries may be