]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Define platform.h ISC_PLATFORM_USEBACKTRACE with config.h USE_BACKTRACE
authorOndřej Surý <ondrej@sury.org>
Tue, 4 Sep 2018 08:09:24 +0000 (10:09 +0200)
committerOndřej Surý <ondrej@sury.org>
Fri, 7 Sep 2018 10:17:29 +0000 (12:17 +0200)
config.h.in
config.h.win32
configure
configure.in
lib/isc/backtrace.c
lib/isc/include/isc/platform.h.in
lib/isc/win32/include/isc/platform.h.in
win32utils/Configure

index 775da4c95be9f48f6bfcae8704040dfaeca8b99c..65844b472f00d4953dccd74ca311f4c4e37cab2e 100644 (file)
 /* Define to 1 if you have the <krb5/krb5.h> header file. */
 #undef HAVE_KRB5_KRB5_H
 
-/* if system have backtrace function */
+/* define if system have backtrace function */
 #undef HAVE_LIBCTRACE
 
 /* Define if libidn2 was found */
 /* Define to use large-system tuning. */
 #undef TUNE_LARGE
 
+/* define if we can use backtrace */
+#undef USE_BACKTRACE
+
 /* Enable DNS Response Policy Service API */
 #undef USE_DNSRPS
 
index 0595c543e16228afb1f8014b3e69e29caf076f92..f0be1db61875324e4027e6c62df04ca24799d5ac 100644 (file)
@@ -367,6 +367,9 @@ typedef __int64 off_t;
 /* Large system tuning */
 @TUNE_LARGE@
 
+/* define if we can use backtrace */
+@USE_BACKTRACE@
+
 /* the default value of dnssec-validation option */
 @VALIDATION_DEFAULT@
 
index 11f54d643d71f132ef2ef996aebea4dde6ff551a..af0ab2596840bbad331333bc23aa9478f96496d1 100755 (executable)
--- a/configure
+++ b/configure
@@ -734,7 +734,6 @@ A
 O
 ALWAYS_MAKE_SYMTABLE
 MKSYMTBL_PROGRAM
-ISC_PLATFORM_USEBACKTRACE
 PURIFY
 purify_path
 MKDEPPROG
@@ -17511,38 +17510,37 @@ esac
 #
 # Check whether --enable-backtrace was given.
 if test "${enable_backtrace+set}" = set; then :
-  enableval=$enable_backtrace; want_backtrace="$enableval"
+  enableval=$enable_backtrace;
 else
-  want_backtrace="yes"
+  enable_backtrace="yes"
 fi
 
-case $want_backtrace in
-yes)
-       ISC_PLATFORM_USEBACKTRACE="#define ISC_PLATFORM_USEBACKTRACE 1"
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+if test "$enable_backtrace" = "yes"; then :
+
+$as_echo "#define USE_BACKTRACE 1" >>confdefs.h
+
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <execinfo.h>
 int
 main ()
 {
 return (backtrace((void **)0, 0));
+
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
 
-$as_echo "#define HAVE_LIBCTRACE /**/" >>confdefs.h
+$as_echo "#define HAVE_LIBCTRACE 1" >>confdefs.h
+
 
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-       ;;
-*)
-       ISC_PLATFORM_USEBACKTRACE="#undef ISC_PLATFORM_USEBACKTRACE"
-       ;;
-esac
-
+fi
 
 # Check whether --enable-symtable was given.
 if test "${enable_symtable+set}" = set; then :
index 8703dfc3b5679277839a0ba32521d66169c4f819..c1594e2c786266eee83b956965f17391f172d63e 100644 (file)
@@ -1811,22 +1811,20 @@ esac
 # enable/disable dumping stack backtrace.  Also check if the system supports
 # glibc-compatible backtrace() function.
 #
-AC_ARG_ENABLE(backtrace,
-             AS_HELP_STRING([--enable-backtrace],
-                            [log stack backtrace on abort [default=yes]]),
-             want_backtrace="$enableval",  want_backtrace="yes")
-case $want_backtrace in
-yes)
-       ISC_PLATFORM_USEBACKTRACE="#define ISC_PLATFORM_USEBACKTRACE 1"
-       AC_TRY_LINK([#include <execinfo.h>],
-       [return (backtrace((void **)0, 0));],
-       [AC_DEFINE([HAVE_LIBCTRACE], [], [if system have backtrace function])],)
-       ;;
-*)
-       ISC_PLATFORM_USEBACKTRACE="#undef ISC_PLATFORM_USEBACKTRACE"
-       ;;
-esac
-AC_SUBST(ISC_PLATFORM_USEBACKTRACE)
+AC_ARG_ENABLE([backtrace],
+             [AS_HELP_STRING([--enable-backtrace],
+                             [log stack backtrace on abort [default=yes]])],
+             [], [enable_backtrace="yes"])
+
+AS_IF([test "$enable_backtrace" = "yes"],
+      [AC_DEFINE([USE_BACKTRACE], [1], [define if we can use backtrace])
+       AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <execinfo.h>]],
+           [[return (backtrace((void **)0, 0));]]
+         )],
+        [AC_DEFINE([HAVE_LIBCTRACE], [1], [define if system have backtrace function])]
+       )])
 
 AC_ARG_ENABLE(symtable,
              AS_HELP_STRING([--enable-symtable],
index 0ea145511e5cf932a610e50df67e14e918fb4f74..7c645d7d0497c846f48949033186d3b39023c58f 100644 (file)
@@ -24,7 +24,7 @@
 #include <isc/result.h>
 #include <isc/util.h>
 
-#ifdef ISC_PLATFORM_USEBACKTRACE
+#ifdef USE_BACKTRACE
 /*
  * Getting a back trace of a running process is tricky and highly platform
  * dependent.  Our current approach is as follows:
@@ -52,9 +52,9 @@
 #else
 #define BACKTRACE_DISABLED
 #endif  /* HAVE_LIBCTRACE */
-#else  /* !ISC_PLATFORM_USEBACKTRACE */
+#else  /* USE_BACKTRACE */
 #define BACKTRACE_DISABLED
-#endif /* ISC_PLATFORM_USEBACKTRACE */
+#endif /* USE_BACKTRACE */
 
 #ifdef BACKTRACE_LIBC
 isc_result_t
index ba34ed6ff810f7fc771a3749790a32fc1faf30a3..0280e438e7924fa43b4e207ae361c74b95e823f3 100644 (file)
  */
 @ISC_PLATFORM_HAVEDEVPOLL@
 
-/*! \brief
- * Define if we want to log backtrace
- */
-@ISC_PLATFORM_USEBACKTRACE@
-
 /*
  *** Printing.
  ***/
index a0fc5c644a703a461ce2c7eea656967078480f67..8c4f9dc7950237c21f3601d8277e1d16e54f50ee 100644 (file)
  */
 #undef ISC_PLATFORM_HAVESYSUNH
 
-/*
- * Define if we want to log backtrace
- */
-@ISC_PLATFORM_USEBACKTRACE@
-
 /*
  * Defines for the noreturn attribute.
  */
index b8f8ae2b7caab6585c2a3f7311aeae949b464e48..a0015ae01ad8770ec40c3a86d3a4f156541aff22 100644 (file)
@@ -207,6 +207,7 @@ my @substdefh = ("AES_CC",
                 "HAVE_DSA_GET0_PQG",
                 "HAVE_ECDSA_SIG_GET0",
                 "HAVE_RSA_SET0_KEY",
+                "USE_BACKTRACE",
                 "USE_OPENSSL",
                 "USE_PKCS11",
                  "HAVE_PKCS11_ED25519",
@@ -231,8 +232,7 @@ my @substdefp = ("ISC_PLATFORM_BUSYWAITNOP",
                  "ISC_PLATFORM_HAVECMPXCHG",
                  "ISC_PLATFORM_HAVEXADD",
                  "ISC_PLATFORM_HAVEXADDQ",
-                 "ISC_PLATFORM_NEEDSTRCASESTR",
-                 "ISC_PLATFORM_USEBACKTRACE");
+                 "ISC_PLATFORM_NEEDSTRCASESTR");
 
 # for conf.sh
 
@@ -1160,7 +1160,7 @@ if ($msc_ver < 1400) {
 # backtrace for >= VS 2012
 
 if ($msc_ver >= 1700) {
-    $configdefp{"ISC_PLATFORM_USEBACKTRACE"} = 1;
+    $configdefh{"USE_BACKTRACE"} = 1;
 }
 
 # no version of MSVS supports strcasestr() yet
@@ -1411,7 +1411,7 @@ if ($use_openssl eq "yes") {
             die "find more than one OpenSSL libcrypto-*.dll DLL candidate\n";
         }
         $openssl_dll = File::Spec->catdir($openssl_path, "@dirlist[0]");
-    }   
+    }
 
     $cryptolib = "openssl";
     $configvar{"OPENSSL_PATH"} = "$openssl_path";