From: Tiziano Müller Date: Mon, 20 May 2013 13:32:02 +0000 (+0200) Subject: Restructure system PolarSSL detection X-Git-Tag: rec-3.6.0-rc1~542^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=077b1aeae5f3adc5b206b063eec28f18122c275e;p=thirdparty%2Fpdns.git Restructure system PolarSSL detection Based on the chapter "Automatic Dependencies with AC_ARG_WITH" of the Autotools Mythbuster eBook, fix the system PolarSSL detection and recognize both --with/without-system-polarssl properly. Furthermore, set the HAVE_LIBPOLARSSL automake variable conditionally. Otherwise pdns will use the included headers but link against the system polarssl resulting in subtle breaks. --- diff --git a/configure.ac b/configure.ac index 4178905153..3ee5cf72f3 100644 --- a/configure.ac +++ b/configure.ac @@ -192,31 +192,39 @@ if test $enable_verbose_logging = yes; then AC_DEFINE(VERBOSELOG, 1, [If verbose fi AC_MSG_RESULT($enable_verbose_logging) -AC_MSG_CHECKING(whether we will try to link in system PolarSSL) AC_ARG_WITH([system-polarssl], - [AC_HELP_STRING([--without-system-polarssl], [do not use system PolarSSL])], - [system_polarssl=$withval], - [system_polarssl=yes]) -AC_MSG_RESULT($system_polarssl) -AM_CONDITIONAL(HAVE_LIBPOLARSSL, false) -if test x$system_polarssl = xyes; then - AC_MSG_CHECKING([PolarSSL version >= 1.1]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include - ]], - [[ -#if POLARSSL_VERSION_NUMBER < 0x01010000 -#error invalid version -#endif - ]] - )], [use_system_polarssl=yes], [use_system_polarssl=no]) - AC_MSG_RESULT($use_system_polarssl) -fi -if test x$use_system_polarssl = xyes; then - AC_CHECK_LIB([polarssl], [sha1_hmac]) -fi + AS_HELP_STRING([--without-system-polarssl], [do not use system PolarSSL])) + +AS_IF([test "x$with_system_polarssl" != "xno"], + [AC_CHECK_LIB([polarssl], [sha1_hmac], [ + AC_MSG_CHECKING([PolarSSL version >= 1.1]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + ]], + [[ + #if POLARSSL_VERSION_NUMBER < 0x01010000 + #error invalid version + #endif + ]] + )], + [have_system_polarssl=yes], + [have_system_polarssl=no]) + AC_MSG_RESULT($have_system_polarssl) ], + [have_system_polarssl=no])], + [have_system_polarssl=no] +) + +AS_IF([test "x$have_system_polarssl" = "xyes"], + [AC_DEFINE(HAVE_LIBPOLARSSL, 1, [If linking against system polarssl])], + [AS_IF([test "x$with_system_polarssl" = "xyes"], + [AC_MSG_ERROR([use of system polarssl requested but not found])] + )] ) + +AC_MSG_CHECKING(whether we will try to link in system PolarSSL) +AC_MSG_RESULT($have_system_polarssl) +AM_CONDITIONAL(HAVE_LIBPOLARSSL, test "x$have_system_polarssl" = "xyes") AC_MSG_CHECKING(whether we will be linking in Botan 1.10) AC_ARG_ENABLE(botan1.10,