public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygiwn: Detect and use MinGW compilers for testsuite wrappers
@ 2020-11-08 15:21 Jon TURNEY
  0 siblings, 0 replies; only message in thread
From: Jon TURNEY @ 2020-11-08 15:21 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=e6248c2fd0d7fc633d1e76e1fd7bb5e0d1cc9ae8

commit e6248c2fd0d7fc633d1e76e1fd7bb5e0d1cc9ae8
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Oct 28 19:22:56 2020 +0000

    Cygiwn: Detect and use MinGW compilers for testsuite wrappers
    
    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.

Diff:
---
 winsup/testsuite/Makefile.in            |   8 +-
 winsup/testsuite/configure              | 244 ++++++++++++++++++++++++++++++++
 winsup/testsuite/configure.ac           |   5 +
 winsup/testsuite/winsup.api/cygload.exp |   2 +-
 4 files changed, 255 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 b/winsup/testsuite/configure
index eab9fbbc7..be4a83f08 100755
--- a/winsup/testsuite/configure
+++ b/winsup/testsuite/configure
@@ -587,6 +587,8 @@ PACKAGE_URL='https://cygwin.com'
 ac_unique_file="Makefile.in"
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+MINGW_CC
+MINGW_CXX
 target_builddir
 AR
 CPP
@@ -597,6 +599,18 @@ CPPFLAGS
 LDFLAGS
 CFLAGS
 CC
+target_os
+target_vendor
+target_cpu
+target
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
 target_alias
 host_alias
 build_alias
@@ -1244,6 +1258,11 @@ Fine tuning of the installation directories:
 _ACEOF
 
   cat <<\_ACEOF
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+  --target=TARGET   configure for building compilers for TARGET [HOST]
 _ACEOF
 fi
 
@@ -1774,6 +1793,146 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 . ${srcdir}/../configure.cygwin
 
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
+if ${ac_cv_target+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$target_alias" = x; then
+  ac_cv_target=$ac_cv_host
+else
+  ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2795,6 +2954,91 @@ fi
 
 
 
+for ac_prog in ${target_cpu}-w64-mingw32-g++
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MINGW_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$MINGW_CXX"; then
+  ac_cv_prog_MINGW_CXX="$MINGW_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_MINGW_CXX="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+MINGW_CXX=$ac_cv_prog_MINGW_CXX
+if test -n "$MINGW_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MINGW_CXX" >&5
+$as_echo "$MINGW_CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$MINGW_CXX" && break
+done
+
+for ac_prog in ${target_cpu}-w64-mingw32-gcc
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MINGW_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$MINGW_CC"; then
+  ac_cv_prog_MINGW_CC="$MINGW_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_MINGW_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+MINGW_CC=$ac_cv_prog_MINGW_CC
+if test -n "$MINGW_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MINGW_CC" >&5
+$as_echo "$MINGW_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$MINGW_CC" && break
+done
+
+
 ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF
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"


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-08 15:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-08 15:21 [newlib-cygwin] Cygiwn: Detect and use MinGW compilers for testsuite wrappers Jon TURNEY

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).