The meson build already using it for:
https://github.com/mesonbuild/meson/issues/3047
Suggested by Jan Alexander Steffens
LT_PREREQ([2.2.6])
LT_INIT([dlopen disable-static])
+dnl Check if -Wl,--version-script is supported by the linker
+gl_LD_VERSION_SCRIPT
+
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
libp11_kit_la_LDFLAGS = \
-no-undefined \
- -version-info $(P11KIT_LT_RELEASE) \
- -export-symbols-regex '^C_GetFunctionList|^p11_kit_'
+ -version-info $(P11KIT_LT_RELEASE)
+
+if HAVE_LD_VERSION_SCRIPT
+libp11_kit_la_LDFLAGS += -Wl,--version-script=$(srcdir)/p11-kit/libp11-kit.map
+else
+libp11_kit_la_LDFLAGS += -export-symbols-regex '^C_GetFunctionList|^p11_kit_'
+endif
libp11_kit_la_SOURCES = \
p11-kit/proxy.c p11-kit/proxy.h p11-kit/proxy-init.c \