[PATCH 07/11] Detect and use MinGW compilers for testsuite wrappers
Jon Turney
jon.turney@dronecode.org.uk
Thu Nov 5 19:47:44 GMT 2020
Drop MINGW_FE, which I can't find any trace of, and instead detect and
use MinGW compilers.
This requires adding AC_CANONICAL_TARGET, to set $target_cpu.
---
winsup/testsuite/Makefile.in | 8 +++++---
winsup/testsuite/configure.ac | 5 +++++
winsup/testsuite/winsup.api/cygload.exp | 2 +-
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/winsup/testsuite/Makefile.in b/winsup/testsuite/Makefile.in
index 2a44fec07..53eb67308 100644
--- a/winsup/testsuite/Makefile.in
+++ b/winsup/testsuite/Makefile.in
@@ -56,7 +56,8 @@ endif
AR:=@AR@
AR_FLAGS:=qv
-MINGW_FE:=$(dir ${srcdir})/utils/mingw
+MINGW_CC:= @MINGW_CC@
+MINGW_CXX:= @MINGW_CXX@
#
# Include common definitions for winsup directory
@@ -140,6 +141,7 @@ site.exp: ./config.status Makefile
@echo "set CC \"$(CC)\"" >> ./tmp0
# CFLAGS is set even though it's empty to show we reserve the right to set it.
@echo "set CFLAGS \"$(ALL_CFLAGS)\"" >> ./tmp0
+ @echo "set MINGW_CXX \"$(MINGW_CXX)\"" >> ./tmp0
echo "set tmpdir $(objdir)/testsuite" >> ./tmp0
@echo "set ltp_includes \"$(libltp_srcdir)/include\"" >> ./tmp0
@echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
@@ -163,10 +165,10 @@ check: $(TESTSUP_LIB_NAME) $(RUNTIME) cygrun.exe testsuite/site.exp
cd testsuite; runtest --tool winsup $(RUNTESTFLAGS)
cygrun.o: cygrun.c
- ${MINGW_FE} $(CC) $(MINGW_CFLAGS) -o $@ -c $<
+ $(MINGW_CC) $(MINGW_CFLAGS) -o $@ -c $<
cygrun.exe : cygrun.o
- ${MINGW_FE} $(CC) ${MINGW_LDFLAGS} -o $@ $<
+ $(MINGW_CC) $(MINGW_LDFLAGS) -o $@ $<
Makefile: Makefile.in $(srcdir)/configure config.status
$(SHELL) config.status
diff --git a/winsup/testsuite/configure.ac b/winsup/testsuite/configure.ac
index effea48c9..b82ec7f60 100755
--- a/winsup/testsuite/configure.ac
+++ b/winsup/testsuite/configure.ac
@@ -14,10 +14,15 @@ AC_CONFIG_SRCDIR(Makefile.in)
. ${srcdir}/../configure.cygwin
+AC_CANONICAL_TARGET
+
AC_PROG_CC
AC_PROG_CPP
AC_CHECK_TOOL(AR,ar)
AC_SUBST(target_builddir)
+AC_CHECK_PROGS(MINGW_CXX, ${target_cpu}-w64-mingw32-g++)
+AC_CHECK_PROGS(MINGW_CC, ${target_cpu}-w64-mingw32-gcc)
+
AC_OUTPUT(Makefile)
diff --git a/winsup/testsuite/winsup.api/cygload.exp b/winsup/testsuite/winsup.api/cygload.exp
index a07a549f9..e7b439512 100644
--- a/winsup/testsuite/winsup.api/cygload.exp
+++ b/winsup/testsuite/winsup.api/cygload.exp
@@ -14,7 +14,7 @@ proc ws_spawn {cmd args} {
verbose send "catchCode = $rv\n"
}
-ws_spawn "gcc -mno-cygwin $srcdir/$subdir/cygload.cc -o mingw-cygload.exe -lstdc++ -Wl,-e,_cygloadCRTStartup@0"
+ws_spawn "$MINGW_CXX $srcdir/$subdir/cygload.cc -o mingw-cygload.exe -lstdc++ -Wl,-e,_cygloadCRTStartup@0"
if { $rv != {0 {}} } {
verbose -log "$rv"
--
2.29.0
More information about the Cygwin-patches
mailing list