]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
version.h: Add _ELFUTILS_THREAD_SAFE
authorAaron Merey <amerey@redhat.com>
Mon, 15 Jun 2026 23:58:55 +0000 (19:58 -0400)
committerAaron Merey <amerey@redhat.com>
Tue, 16 Jun 2026 12:59:44 +0000 (08:59 -0400)
Currently there is no API for applications to detect whether elfutils
libraries are built with thread safety support enabled (via the
--enable-thread-safety configure option).

Add macro _ELFUTILS_THREAD_SAFE to version.h.  This macro is set to 1
if thread safety support is enabled.  If thread safety support is not
enabled then this macro is left undefined.

Signed-off-by: Aaron Merey <amerey@redhat.com>
NEWS
config/version.h.in
configure.ac

diff --git a/NEWS b/NEWS
index 1e01e327e2e2a5bed0de8da2b9b13fbe9d493cb0..d811dbe31339e7ab5609e1acefebfa50360a7d80 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+Version 0.196
+
+version.h: New macro _ELFUTILS_THREAD_SAFE added to <elfutils/version.h>.
+           Defined to 1 when the elfutils libraries are built with thread
+           safety support enabled.  Otherwise it is left undefined.
+
 Version 0.195 "Handwritten"
 
 CONTRIBUTING: elfutils has adopted a policy on the use of Large Language
index 34e62c3b5f16571b69f3b66db949fc2b3d145482..6bf3b077f0788d69f676b8939bc5a1cf21aaf9ca 100644 (file)
 
 #define _ELFUTILS_VERSION      @eu_version@
 
+/* _ELFUTILS_THREAD_SAFE is defined to 1 when the elfutils libraries
+   are built with thread safety support enabled.  Otherwise it is left
+   undefined.  */
+@eu_thread_safe@
+
 #define _ELFUTILS_PREREQ(major, minor) \
   (_ELFUTILS_VERSION >= ((major) * 1000 + (minor)))
 
index fbe039d5b43a30ba7f385bf22f24f1faa6dce16d..9bf50d8712d913b2ae78838311a63ed22c918723 100644 (file)
@@ -82,6 +82,11 @@ AS_IF([test "$use_locks" = yes],
 
 AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
 
+AS_IF([test "$use_locks" = yes],
+      [eu_thread_safe="#define _ELFUTILS_THREAD_SAFE 1"],
+      [eu_thread_safe="/* _ELFUTILS_THREAD_SAFE is not defined.  */"])
+AC_SUBST([eu_thread_safe])
+
 # Provided by gnulib's m4/std-gnu11.m4 for autoconf pre 2.70
 AC_PROG_CC
 AS_IF([test "x$ac_cv_prog_cc_c11" = "xno"],