From 1e2ac681e5f39fc7a7e8b8deb2162a93976d4622 Mon Sep 17 00:00:00 2001 From: Violet Purcell Date: Wed, 11 Oct 2023 20:51:57 -0400 Subject: [PATCH] Port check for --default-symver to autoconf This commit ports the configure check for -Wl,--default-symver that is present in CMake to autoconf. This fixes building Jansson via autoconf with non-bfd linkers on glibc systems. Signed-off-by: Violet Purcell --- configure.ac | 10 +++++++++- jansson.sym.in | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 jansson.sym.in diff --git a/configure.ac b/configure.ac index f022eb72..a058e948 100644 --- a/configure.ac +++ b/configure.ac @@ -25,6 +25,9 @@ AC_TYPE_UINT16_T AC_TYPE_UINT8_T AC_TYPE_LONG_LONG_INT +jansson_soversion="4" +AC_SUBST([jansson_soversion]) + AC_C_INLINE case $ac_cv_c_inline in yes) json_inline=inline;; @@ -138,8 +141,12 @@ AS_IF([test "x$with_Bsymbolic" = "xyes"], [JSON_BSYMBOLIC_LDFLAGS=-Wl[,]-Bsymbol AC_SUBST(JSON_BSYMBOLIC_LDFLAGS) # Enable symbol versioning on GNU libc +m4_pattern_forbid([^AX_CHECK_LINK_FLAG$]) JSON_SYMVER_LDFLAGS= -AC_CHECK_DECL([__GLIBC__], [JSON_SYMVER_LDFLAGS=-Wl,--default-symver]) +AC_CHECK_DECL([__GLIBC__], + [AX_CHECK_LINK_FLAG([-Wl,--default-symver], + [JSON_SYMVER_LDFLAGS=-Wl,--default-symver], + [JSON_SYMVER_LDFLAGS=-Wl,--version-script,$ac_abs_confdir/jansson.sym])]) AC_SUBST([JSON_SYMVER_LDFLAGS]) AC_ARG_ENABLE([ossfuzzers], @@ -168,6 +175,7 @@ AC_SUBST([AM_CFLAGS]) AC_CONFIG_FILES([ jansson.pc + jansson.sym Makefile doc/Makefile src/Makefile diff --git a/jansson.sym.in b/jansson.sym.in new file mode 100644 index 00000000..b135bb53 --- /dev/null +++ b/jansson.sym.in @@ -0,0 +1,5 @@ +JANSSON_@jansson_soversion@ { + global: + *; +}; +