]> granicus.if.org Git - pdns/commitdiff
Move polarssl check to separate macro
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Mon, 6 Jan 2014 12:18:03 +0000 (13:18 +0100)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Mon, 6 Jan 2014 13:02:43 +0000 (14:02 +0100)
configure.ac
m4/pdns_with_system_polarssl.m4 [new file with mode: 0644]

index b65789e52da476b1f16a9e530d2d574fb63d51f3..e1279a6aeab32bbc47bce87943dd5add80b680ca 100644 (file)
@@ -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 <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,
diff --git a/m4/pdns_with_system_polarssl.m4 b/m4/pdns_with_system_polarssl.m4
new file mode 100644 (file)
index 0000000..b3da940
--- /dev/null
@@ -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 <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)
+]
+)
+