diff options
author | Keith Packard <keithp@keithp.com> | 2009-10-28 10:54:13 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-10-28 10:54:13 -0700 |
commit | deb72fc61464250af8185dab2da8ee09f13c55d8 (patch) | |
tree | 476702f62c8b69bd5a52f4ba0f3df1897bbd65db /configure.ac | |
parent | 55f4c80a4c891b355a99e6a05978ca945397c5cc (diff) | |
parent | a60e676f1fd243c78859440b87652f523d3f2ec1 (diff) |
Merge remote branch 'jcristau/sha1'
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 73 |
1 files changed, 52 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac index d85b8ebec..e7d8a4bb8 100644 --- a/configure.ac +++ b/configure.ac @@ -1284,26 +1284,57 @@ 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_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], - [Use libmd SHA1 functions instead of OpenSSL libcrypto])]) -fi - -if test "x$SHA1_LIB" = "x" ; then - 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 +# SHA1 hashing +AC_ARG_WITH([sha1], + [AS_HELP_STRING([--with-sha1=libmd|libgcrypt|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 +AC_CHECK_LIB([gcrypt], [gcry_md_open], [HAVE_LIBGCRYPT=yes]) +if test "x$with_sha1" = x && test "x$HAVE_LIBGCRYPT" = xyes; then + with_sha1=libgcrypt +fi +if test "x$with_sha1" = xlibgcrypt; then + AC_DEFINE([HAVE_SHA1_IN_LIBGCRYPT], [1], + [Use libgcrypt SHA1 functions]) + SHA1_LIBS=-lgcrypt +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) PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS]) PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS]) @@ -1323,9 +1354,9 @@ PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS]) # XSERVER_SYS_LIBS is the set of out-of-tree libraries which all servers # require. # -XSERVER_CFLAGS="${XSERVER_CFLAGS} ${XSERVERCFLAGS_CFLAGS} ${SHA1_CFLAGS}" +XSERVER_CFLAGS="${XSERVER_CFLAGS} ${XSERVERCFLAGS_CFLAGS}" XSERVER_LIBS="$DIX_LIB $CONFIG_LIB $MI_LIB $OS_LIB" -XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS} ${SHA1_LIB}" +XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS}" AC_SUBST([XSERVER_LIBS]) AC_SUBST([XSERVER_SYS_LIBS]) |