libffi: Consider '--with-build-sysroot=[...]' for target libraries' build-tree testing (instead of build-time 'CC' etc.) [PR109951]

Similar to commit fb5d27be27
"libgomp: Consider '--with-build-sysroot=[...]' for target libraries' build-tree testing (instead of build-time 'CC' etc.) [PR91884, PR109951]",
this is commit a0b48358cb
"libffi/test: Fix compilation for build sysroot" done differently,
avoiding build-tree testing use of any random gunk that may appear in
build-time 'CC', 'CXX'.

	PR testsuite/109951
	libffi/
	* configure.ac: 'AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)'.
	<local.exp>: Don't set 'CC_FOR_TARGET', 'CXX_FOR_TARGET', instead
	set 'SYSROOT_CFLAGS_FOR_TARGET'.
	* Makefile.in: Regenerate.
	* configure: Likewise.
	* include/Makefile.in: Likewise.
	* man/Makefile.in: Likewise.
	* testsuite/Makefile.in: Likewise.
	* testsuite/lib/libffi.exp (libffi_target_compile): If
	'--with-build-sysroot=[...]' was specified, use it for build-tree
	testing.
This commit is contained in:
Thomas Schwinge 2023-09-11 10:50:00 +02:00
parent 8a0fceee46
commit 967d4171b2
7 changed files with 20 additions and 6 deletions

View File

@ -383,6 +383,7 @@ SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
TARGET = @TARGET@
TARGETDIR = @TARGETDIR@
TARGET_OBJ = @TARGET_OBJ@

10
libffi/configure vendored
View File

@ -666,6 +666,7 @@ TESTSUBDIR_TRUE
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
SYSROOT_CFLAGS_FOR_TARGET
READELF
ENABLE_DARWIN_AT_RPATH_FALSE
ENABLE_DARWIN_AT_RPATH_TRUE
@ -11687,7 +11688,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11690 "configure"
#line 11691 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11793,7 +11794,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11796 "configure"
#line 11797 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -15249,9 +15250,10 @@ _ACEOF
cat > local.exp <<EOF
set CC_FOR_TARGET "$CC"
set CXX_FOR_TARGET "$CXX"
set SYSROOT_CFLAGS_FOR_TARGET "$SYSROOT_CFLAGS_FOR_TARGET"
set compiler_vendor "$ax_cv_c_compiler_vendor"
EOF

View File

@ -62,9 +62,10 @@ AC_CHECK_TOOL(READELF, readelf)
# Test for 64-bit build.
AC_CHECK_SIZEOF([size_t])
AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
cat > local.exp <<EOF
set CC_FOR_TARGET "$CC"
set CXX_FOR_TARGET "$CXX"
set SYSROOT_CFLAGS_FOR_TARGET "$SYSROOT_CFLAGS_FOR_TARGET"
set compiler_vendor "$ax_cv_c_compiler_vendor"
EOF

View File

@ -255,6 +255,7 @@ SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
TARGET = @TARGET@
TARGETDIR = @TARGETDIR@
TARGET_OBJ = @TARGET_OBJ@

View File

@ -237,6 +237,7 @@ SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
TARGET = @TARGET@
TARGETDIR = @TARGETDIR@
TARGET_OBJ = @TARGET_OBJ@

View File

@ -210,6 +210,7 @@ SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
TARGET = @TARGET@
TARGETDIR = @TARGETDIR@
TARGET_OBJ = @TARGET_OBJ@

View File

@ -374,6 +374,13 @@ proc libffi_target_compile { source dest type options } {
lappend options "ldflags=$wrap_flags"
}
if { $blddirffi != "" } {
# If '--with-build-sysroot=[...]' was specified, use it for build-tree
# testing.
global SYSROOT_CFLAGS_FOR_TARGET
lappend options "additional_flags=${SYSROOT_CFLAGS_FOR_TARGET}"
}
# TOOL_OPTIONS must come first, so that it doesn't override testcase
# specific options.
if [info exists TOOL_OPTIONS] {