From 077b1aeae5f3adc5b206b063eec28f18122c275e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tiziano=20M=C3=BCller?= Date: Mon, 20 May 2013 15:32:02 +0200 Subject: [PATCH] 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. --- configure.ac | 56 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 24 deletions(-) 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, -- 2.47.3