mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-01-22 10:26:01 +01:00
build: Refactor linker script detection into a new m4 function
This commit is contained in:
parent
d0d8d0197f
commit
30b48ed9ea
23
configure.ac
23
configure.ac
@ -32,28 +32,7 @@ AC_SYS_LARGEFILE
|
|||||||
|
|
||||||
AM_PROG_AR
|
AM_PROG_AR
|
||||||
LT_INIT
|
LT_INIT
|
||||||
|
LIBBSD_LINKER_VERSION_SCRIPT
|
||||||
AC_CACHE_CHECK([if ld supports --version-script flag],
|
|
||||||
[libbsd_cv_version_script], [
|
|
||||||
echo "{ global: symbol; local: *; };" >conftest.map
|
|
||||||
save_LDFLAGS=$LDFLAGS
|
|
||||||
LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
|
|
||||||
AC_LINK_IFELSE([
|
|
||||||
AC_LANG_PROGRAM([[
|
|
||||||
extern int symbol(void);
|
|
||||||
int symbol(void) { return 0; }
|
|
||||||
]], [[
|
|
||||||
]])
|
|
||||||
], [
|
|
||||||
libbsd_cv_version_script=yes
|
|
||||||
], [
|
|
||||||
libbsd_cv_version_script=no
|
|
||||||
])
|
|
||||||
LDFLAGS="$save_LDFLAGS"
|
|
||||||
rm -f conftest.map
|
|
||||||
])
|
|
||||||
AM_CONDITIONAL([HAVE_LINKER_VERSION_SCRIPT],
|
|
||||||
[test "x$libbsd_cv_version_script" = "xyes"])
|
|
||||||
|
|
||||||
is_windows=no
|
is_windows=no
|
||||||
AS_CASE([$host_os],
|
AS_CASE([$host_os],
|
||||||
|
27
m4/libbsd-linker.m4
Normal file
27
m4/libbsd-linker.m4
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Copyright © 2019, 2022 Guillem Jover <guillem@hadrons.org>
|
||||||
|
|
||||||
|
# LIBBSD_LINKER_VERSION_SCRIPT
|
||||||
|
# ----------------------------
|
||||||
|
AC_DEFUN([LIBBSD_LINKER_VERSION_SCRIPT], [
|
||||||
|
AC_CACHE_CHECK([if ld supports --version-script flag],
|
||||||
|
[libbsd_cv_version_script], [
|
||||||
|
echo "{ global: symbol; local: *; };" >conftest.map
|
||||||
|
save_LDFLAGS=$LDFLAGS
|
||||||
|
LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
|
||||||
|
AC_LINK_IFELSE([
|
||||||
|
AC_LANG_PROGRAM([[
|
||||||
|
extern int symbol(void);
|
||||||
|
int symbol(void) { return 0; }
|
||||||
|
]], [[
|
||||||
|
]])
|
||||||
|
], [
|
||||||
|
libbsd_cv_version_script=yes
|
||||||
|
], [
|
||||||
|
libbsd_cv_version_script=no
|
||||||
|
])
|
||||||
|
LDFLAGS="$save_LDFLAGS"
|
||||||
|
rm -f conftest.map
|
||||||
|
])
|
||||||
|
AM_CONDITIONAL([HAVE_LINKER_VERSION_SCRIPT],
|
||||||
|
[test "x$libbsd_cv_version_script" = "xyes"])
|
||||||
|
])
|
Loading…
x
Reference in New Issue
Block a user