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 <polarssl/version.h>
- ]],
- [[
- #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,
--- /dev/null
+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 <polarssl/version.h>]],
+ [[
+ #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)
+]
+)
+