diff options
author | Julien Cristau <jcristau@debian.org> | 2009-10-14 23:30:55 +0200 |
---|---|---|
committer | Julien Cristau <jcristau@debian.org> | 2009-10-15 01:17:56 +0200 |
commit | d2a6a395435919aff8943285f9cbfe6569a9728f (patch) | |
tree | c2b83af50946ca5db3cd9bfefbe425e9131b3b25 /configure.ac | |
parent | 55516094947dd78ad2734bb784a2fb109b64c990 (diff) |
configure: add --with-sha1={libmd,libcrypto} option
Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: RĂ©mi Cardona <remi@gentoo.org>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 58 |
1 files changed, 39 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac index 1a8f97e19..082f67de2 100644 --- a/configure.ac +++ b/configure.ac @@ -1280,25 +1280,45 @@ 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' -# 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_LIBS and SHA1_CFLAGS -if test "x$SHA1_LIB" = "x" ; then - AC_CHECK_LIB([md], [SHA1Init], [SHA1_LIBS="-lmd" - AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1], - [Use libmd SHA1 functions instead of OpenSSL libcrypto])]) -fi - -if test "x$SHA1_LIB" = "x" ; then - PKG_CHECK_EXISTS([openssl], [HAVE_OPENSSL_PKC=yes], - [HAVE_OPENSSL_PKC=no]) - if test "x$HAVE_OPENSSL_PKC" = xyes; then - PKG_CHECK_MODULES([SHA1], [openssl]) - else - AC_CHECK_LIB([crypto], [SHA1_Init], [SHA1_LIBS="-lcrypto"], - [AC_MSG_ERROR([OpenSSL must be installed in order to build the X server.])]) - fi +# SHA1 hashing +AC_ARG_WITH([sha1], + [AS_HELP_STRING([--with-sha1=libmd|libcrypto], + [choose SHA1 implementation])]) +AC_CHECK_LIB([md], [SHA1Init], [HAVE_LIBMD=yes]) +if test "x$with_sha1" = x && test "x$HAVE_LIBMD" = xyes; then + with_sha1=libmd +fi +if test "x$with_sha1" = xlibmd && test "x$HAVE_LIBMD" != xyes; then + AC_MSG_ERROR([libmd requested but not found]) +fi +if test "x$with_sha1" = xlibmd; then + AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1], + [Use libmd SHA1 functions]) + SHA1_LIBS=-lmd +fi +# We don't need all of the OpenSSL libraries, just libcrypto +AC_CHECK_LIB([crypto], [SHA1_Init], [HAVE_LIBCRYPTO=yes]) +PKG_CHECK_MODULES([OPENSSL], [openssl], [HAVE_OPENSSL_PKC=yes], + [HAVE_OPENSSL_PKC=no]) +if test "x$HAVE_LIBCRYPTO" = xyes || test "x$HAVE_OPENSSL_PKC" = xyes; then + if test "x$with_sha1" = x; then + with_sha1=libcrypto + fi +else + if test "x$with_sha1" = xlibcrypto; then + AC_MSG_ERROR([OpenSSL libcrypto requested but not found]) + fi +fi +if test "x$with_sha1" = xlibcrypto; then + if test "x$HAVE_LIBCRYPTO" = xyes; then + SHA1_LIBS=-lcrypto + else + SHA1_LIBS="$OPENSSL_LIBS" + SHA1_CFLAGS="$OPENSSL_CFLAGS" + fi +fi +if test "x$with_sha1" = x; then + AC_MSG_ERROR([No suitable SHA1 implementation found]) fi AC_SUBST(SHA1_LIBS) AC_SUBST(SHA1_CFLAGS) |