Build: Let the users override the symbol versioning variant.

There are cases when the users want to decide themselves whether
they want to have the generic (even on GNU/Linux) or the linux
(even if we do not recommend that) symbol versioning variant.
The former might be needed to circumvent compiler issues (i.e.
the compiler does not support all features that are required
for the linux versioning), the latter might help in overriding
the assumptions made in the configure script.

(cherry picked from commit f56ed6fac6)
This commit is contained in:
Sergey Kosukhin 2024-03-12 20:03:49 +01:00 committed by Lasse Collin
parent 95dcea4b5d
commit 051d6b5c85
1 changed files with 50 additions and 41 deletions

View File

@ -716,52 +716,61 @@ elif test "x$enable_shared" = xno ; then
enable_symbol_versions=no enable_symbol_versions=no
AC_MSG_RESULT([no (not building a shared library)]) AC_MSG_RESULT([no (not building a shared library)])
else else
case "$host_cpu-$host_os" in if test "x$enable_symbol_versions" = xyes ; then
microblaze*) case "$host_cpu-$host_os" in
# GCC 12 on MicroBlaze doesn't support __symver__ microblaze*)
# attribute. It's simplest and safest to use the # GCC 12 on MicroBlaze doesn't support __symver__
# generic version on that platform since then only # attribute. It's simplest and safest to use the
# the linker script is needed. The RHEL/CentOS 7 # generic version on that platform since then only
# compatibility symbols don't matter on MicroBlaze. # the linker script is needed. The RHEL/CentOS 7
enable_symbol_versions=generic # compatibility symbols don't matter on MicroBlaze.
;; enable_symbol_versions=generic
*-linux*) ;;
case "$pic_mode-$enable_static" in *-linux*)
default-*) enable_symbol_versions=linux
# Use symvers if PIC is defined. ;;
have_symbol_versions_linux=2 *)
;; enable_symbol_versions=generic
*-no) ;;
# Not building static library. esac
# Use symvers unconditionally. fi
have_symbol_versions_linux=1
;; if test "x$enable_symbol_versions" = xlinux ; then
*) case "$pic_mode-$enable_static" in
AC_MSG_RESULT([]) default-*)
AC_MSG_ERROR([ # Use symvers if PIC is defined.
have_symbol_versions_linux=2
;;
*-no)
# Not building static library.
# Use symvers unconditionally.
have_symbol_versions_linux=1
;;
*)
AC_MSG_RESULT([])
AC_MSG_ERROR([
On GNU/Linux, building both shared and static library at the same time On GNU/Linux, building both shared and static library at the same time
is not supported if --with-pic or --without-pic is used. is not supported if --with-pic or --without-pic is used.
Use either --disable-shared or --disable-static to build one type Use either --disable-shared or --disable-static to build one type
of library at a time. If both types are needed, build one at a time, of library at a time. If both types are needed, build one at a time,
possibly picking only src/liblzma/.libs/liblzma.a from the static build.]) possibly picking only src/liblzma/.libs/liblzma.a from the static build.])
;; ;;
esac esac
enable_symbol_versions=linux AC_DEFINE_UNQUOTED([HAVE_SYMBOL_VERSIONS_LINUX],
AC_DEFINE_UNQUOTED([HAVE_SYMBOL_VERSIONS_LINUX], [$have_symbol_versions_linux],
[$have_symbol_versions_linux], [Define to 1 to if GNU/Linux-specific details
[Define to 1 to if GNU/Linux-specific details are unconditionally wanted for symbol
are unconditionally wanted for symbol versioning. Define to 2 to if these are wanted
versioning. Define to 2 to if these are wanted only if also PIC is defined (allows building
only if also PIC is defined (allows building both shared and static liblzma at the same
both shared and static liblzma at the same time with Libtool if neither --with-pic nor
time with Libtool if neither --with-pic nor --without-pic is used). This define must be
--without-pic is used). This define must be used together with liblzma_linux.map.])
used together with liblzma_linux.map.]) elif test "x$enable_symbol_versions" != xgeneric ; then
;; AC_MSG_RESULT([])
*) AC_MSG_ERROR(
enable_symbol_versions=generic [unknown symbol versioning variant '$enable_symbol_versions'])
;; fi
esac
AC_MSG_RESULT([yes ($enable_symbol_versions)]) AC_MSG_RESULT([yes ($enable_symbol_versions)])
fi fi