From: Ruben Kerkhof Date: Mon, 6 Jan 2014 12:18:03 +0000 (+0100) Subject: Move polarssl check to separate macro X-Git-Tag: rec-3.6.0-rc1~264^2~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=08bc56f4a86eb842b6ed656123a9c31f2fd47e72;p=pdns Move polarssl check to separate macro --- diff --git a/configure.ac b/configure.ac index b65789e52..e1279a6ae 100644 --- a/configure.ac +++ b/configure.ac @@ -158,49 +158,7 @@ if test $enable_verbose_logging = yes; then AC_DEFINE(VERBOSELOG, 1, [If verbose fi AC_MSG_RESULT($enable_verbose_logging) -AC_ARG_WITH([system-polarssl], - 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] -) - -POLARSSL_SUBDIR=ext/polarssl-1.3.2 -POLARSSL_CFLAGS=-I\$\(top_srcdir\)/pdns/$POLARSSL_SUBDIR/include/ -POLARSSL_LIBS=\$\(top_builddir\)/pdns/$POLARSSL_SUBDIR/library/libpolarssl.a - -AS_IF([test "x$have_system_polarssl" = "xyes"], - [ - POLARSSL_CFLAGS= - POLARSSL_LIBS=-lpolarssl - POLARSSL_SUBDIR= - ], - [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) -AC_SUBST(POLARSSL_CFLAGS) -AC_SUBST(POLARSSL_LIBS) -AC_SUBST(POLARSSL_SUBDIR) +PDNS_WITH_SYSTEM_POLARSSL AC_MSG_CHECKING(whether we will be linking in Botan 1.10) AC_ARG_ENABLE(botan1.10, diff --git a/m4/pdns_with_system_polarssl.m4 b/m4/pdns_with_system_polarssl.m4 new file mode 100644 index 000000000..b3da9400f --- /dev/null +++ b/m4/pdns_with_system_polarssl.m4 @@ -0,0 +1,50 @@ +AC_DEFUN([PDNS_WITH_SYSTEM_POLARSSL],[ + AC_ARG_WITH([system-polarssl],[ + AS_HELP_STRING([--with-system-polarssl], + [use system PolarSSL @<:@default=no@:>@])], + [], + [with_system_polarssl=no], + ) + + AS_IF([test "x$with_system_polarssl" = "xyes"],[ + AC_CHECK_LIB([polarssl], [sha1_hmac],[ + AC_MSG_CHECKING([for 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] + ) + + POLARSSL_SUBDIR=ext/polarssl-1.3.2 + POLARSSL_CFLAGS=-I\$\(top_srcdir\)/pdns/$POLARSSL_SUBDIR/include/ + POLARSSL_LIBS=\$\(top_builddir\)/pdns/$POLARSSL_SUBDIR/library/libpolarssl.a + + AS_IF([test "x$have_system_polarssl" = "xyes"],[ + POLARSSL_CFLAGS= + POLARSSL_LIBS=-lpolarssl + POLARSSL_SUBDIR= + ],[ + AS_IF([test "x$with_system_polarssl" = "xyes"],[ + AC_MSG_ERROR([use of system polarssl requested but not found])] + )] + ) + + AC_SUBST(POLARSSL_CFLAGS) + AC_SUBST(POLARSSL_LIBS) + AC_SUBST(POLARSSL_SUBDIR) +] +) +