1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-23 17:33:50 +03:00

build: Only enable linker version script in legacy mode

The version script is deprecated but required for backward
compatibility.
This commit is contained in:
Nick Wellnhofer 2024-06-15 22:27:40 +02:00
parent 7b65c90f2a
commit 7cf7a54aea
2 changed files with 21 additions and 18 deletions

View File

@ -415,7 +415,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
-Wstrict-prototypes -Wmissing-prototypes \
-Wno-long-long -Wno-format-extra-args")
if(BUILD_SHARED_LIBS AND UNIX AND NOT APPLE)
if(LIBXML2_WITH_LEGACY AND BUILD_SHARED_LIBS AND UNIX AND NOT APPLE)
check_linker_flag(C "LINKER:--undefined-version" FLAG_UNDEFINED_VERSION)
if (FLAG_UNDEFINED_VERSION)
target_link_options(LibXml2 PRIVATE "LINKER:--undefined-version")

View File

@ -428,24 +428,27 @@ dnl
dnl Linker version scripts for symbol versioning
dnl
VERSION_SCRIPT_FLAGS=
# lt_cv_prog_gnu_ld is from libtool 2.+
if test "$lt_cv_prog_gnu_ld" = yes; then
case $host in
*-*-cygwin* | *-*-mingw* | *-*-msys* )
;;
*)
dnl lld 16 defaults to --no-undefined-version but the version script
dnl can contain symbols disabled by configuration options.
AX_APPEND_LINK_FLAGS([-Wl,--undefined-version], [VERSION_SCRIPT_FLAGS])
AX_APPEND_FLAG([-Wl,--version-script=], [VERSION_SCRIPT_FLAGS])
;;
esac
else
case $host in
*-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";;
esac
if test "$with_legacy" = "yes"; then
# lt_cv_prog_gnu_ld is from libtool 2.+
if test "$lt_cv_prog_gnu_ld" = yes; then
case $host in
*-*-cygwin* | *-*-mingw* | *-*-msys* )
;;
*)
dnl lld 16 defaults to --no-undefined-version but the version
dnl script can contain symbols disabled by configuration
dnl options.
AX_APPEND_LINK_FLAGS([-Wl,--undefined-version], [VERSION_SCRIPT_FLAGS])
AX_APPEND_FLAG([-Wl,--version-script=], [VERSION_SCRIPT_FLAGS])
;;
esac
else
case $host in
*-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";;
esac
fi
AC_SUBST(VERSION_SCRIPT_FLAGS)
fi
AC_SUBST(VERSION_SCRIPT_FLAGS)
AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
dnl