From c3c587eb1d340319cecf345528200cf4d26cbfb4 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 6 Sep 2002 19:46:00 +0000 Subject: [PATCH] Added preliminary support for cross-compiling tests using mingw on Linux if available. --- Make.rules.in | 11 +++- Makefile.in | 2 + configure | 94 ++++++++++++++++++++++++++++++++++- configure.ac | 11 +++- dlls/Makedll.rules.in | 2 + dlls/Makefile.in | 2 + dlls/Maketest.rules.in | 16 +++++- dlls/make_dlls | 2 + programs/winetest/Makefile.in | 4 +- 9 files changed, 138 insertions(+), 6 deletions(-) diff --git a/Make.rules.in b/Make.rules.in index 40c840d1c07..0b780a8b762 100644 --- a/Make.rules.in +++ b/Make.rules.in @@ -39,6 +39,7 @@ EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ LIBEXT = @LIBEXT@ DLLEXT = @DLLEXT@ +CROSSCC = @CROSSCC@ LDSHARED = @LDSHARED@ DLLWRAP = @DLLWRAP@ DLLWRAPFLAGS = --add-stdcall-alias @@ -110,11 +111,14 @@ LINTS = $(C_SRCS:.c=.ln) # Implicit rules -.SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.c .spec.def .pl .ok +.SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.c .spec.def .pl .ok .cross.o .c.o: $(CC) -c $(ALLCFLAGS) -o $@ $< +.c.cross.o: + $(CROSSCC) -c $(ALLCFLAGS) -o $@ $< + .s.o: $(AS) -o $@ $< @@ -265,7 +269,10 @@ $(SUBDIRS:%=%/__checklink__): dummy $(SUBDIRS:%=%/__test__): dummy @cd `dirname $@` && $(MAKE) test -.PHONY: check test $(SUBDIRS:%=%/__test__) +$(SUBDIRS:%=%/__crosstest__): dummy + @cd `dirname $@` && $(MAKE) crosstest + +.PHONY: check test crosstest $(SUBDIRS:%=%/__test__) $(SUBDIRS:%=%/__crosstest__) # Misc. rules diff --git a/Makefile.in b/Makefile.in index d4594849105..f3171e747f7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -138,6 +138,8 @@ $(TESTSUBDIRS:%=%/__test__): test_environment check test:: $(TESTSUBDIRS:%=%/__test__) +crosstest:: $(TESTSUBDIRS:%=%/__crosstest__) + .PHONY: test_environment # Misc rules diff --git a/configure b/configure index 9ca09a28f28..d37b8239511 100755 --- a/configure +++ b/configure @@ -10757,6 +10757,95 @@ echo "${ECHO_T}$ac_cv_c_dll_unixware" >&6 fi fi fi + + CROSSTEST="" + + if test "$cross_compiling" = "no" + then + for ac_prog in i586-mingw32msvc-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 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CROSSCC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CROSSCC"; then + ac_cv_prog_CROSSCC="$CROSSCC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CROSSCC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CROSSCC=$ac_cv_prog_CROSSCC +if test -n "$CROSSCC"; then + echo "$as_me:$LINENO: result: $CROSSCC" >&5 +echo "${ECHO_T}$CROSSCC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CROSSCC" && break +done +test -n "$CROSSCC" || CROSSCC="false" + + for ac_prog in i586-mingw32msvc-dlltool +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_DLLTOOL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + echo "$as_me:$LINENO: result: $DLLTOOL" >&5 +echo "${ECHO_T}$DLLTOOL" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$DLLTOOL" && break +done +test -n "$DLLTOOL" || DLLTOOL="false" + + if test "$CROSSCC" != "false"; then CROSSTEST="\$(CROSSTEST)"; fi + fi ;; esac @@ -14924,6 +15013,9 @@ s,@LDDLLFLAGS@,$LDDLLFLAGS,;t t s,@LDSHARED@,$LDSHARED,;t t s,@DLLWRAP@,$DLLWRAP,;t t s,@ac_ct_DLLWRAP@,$ac_ct_DLLWRAP,;t t +s,@CROSSTEST@,$CROSSTEST,;t t +s,@CROSSCC@,$CROSSCC,;t t +s,@DLLTOOL@,$DLLTOOL,;t t s,@LDPATH@,$LDPATH,;t t s,@CRTLIBS@,$CRTLIBS,;t t s,@LDD@,$LDD,;t t @@ -15552,7 +15644,7 @@ if test "$wine_cv_opengl_version_threadsafe" = "yes" -a "x$enable_opengl" = "x" then echo echo "*** Warning: the OpenGL version you have installed relies on libpthread for" - echo "*** thread-safety. To prevent crashes, OpenGL support has been removed." + echo "*** thread-safety. To prevent crashes, OpenGL support has been disabled." echo "*** A fix for glibc 2.1.3 that seems to work is included in this version of Wine," echo "*** start configure with '--enable-opengl' to force OpenGL support." fi diff --git a/configure.ac b/configure.ac index 139403eee37..b6734e33ceb 100644 --- a/configure.ac +++ b/configure.ac @@ -799,6 +799,15 @@ case $host_os in fi fi fi + + dnl Check for cross compiler to build test programs + AC_SUBST(CROSSTEST,"") + if test "$cross_compiling" = "no" + then + AC_CHECK_PROGS(CROSSCC,i586-mingw32msvc-gcc,false) + AC_CHECK_PROGS(DLLTOOL,i586-mingw32msvc-dlltool,false) + if test "$CROSSCC" != "false"; then CROSSTEST="\$(CROSSTEST)"; fi + fi ;; esac @@ -1547,7 +1556,7 @@ if test "$wine_cv_opengl_version_threadsafe" = "yes" -a "x$enable_opengl" = "x" then echo echo "*** Warning: the OpenGL version you have installed relies on libpthread for" - echo "*** thread-safety. To prevent crashes, OpenGL support has been removed." + echo "*** thread-safety. To prevent crashes, OpenGL support has been disabled." echo "*** A fix for glibc 2.1.3 that seems to work is included in this version of Wine," echo "*** start configure with '--enable-opengl' to force OpenGL support." fi diff --git a/dlls/Makedll.rules.in b/dlls/Makedll.rules.in index cfb5726da37..971f0b1b577 100644 --- a/dlls/Makedll.rules.in +++ b/dlls/Makedll.rules.in @@ -51,6 +51,8 @@ checklink:: $(MODULE)$(DLLEXT) $(SUBDIRS:%=%/__checklink__) check test:: $(SUBDIRS:%=%/__test__) +crosstest:: $(SUBDIRS:%=%/__crosstest__) + $(TESTRESULTS): $(MODULE)$(DLLEXT) # Sanity check diff --git a/dlls/Makefile.in b/dlls/Makefile.in index d31fe6b154f..a85d78e93cb 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -892,6 +892,8 @@ uninstall:: check test:: $(BUILDSUBDIRS:%=%/__test__) +crosstest:: $(BUILDSUBDIRS:%=%/__crosstest__) + checklink:: $(BUILDSUBDIRS:%=%/__checklink__) ### Dependencies: diff --git a/dlls/Maketest.rules.in b/dlls/Maketest.rules.in index 6bbacd8eba4..ab059f0c9bb 100644 --- a/dlls/Maketest.rules.in +++ b/dlls/Maketest.rules.in @@ -24,6 +24,10 @@ GEN_C_SRCS = $(TESTLIST) EXTRA_OBJS = $(TESTMAIN) ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS) +CROSSTEST = $(TESTDLL:%.dll=%)_crosstest.exe +CROSSTESTMAIN= $(TOPOBJDIR)/programs/winetest/wtmain.cross.o +CROSSOBJS = $(C_SRCS:.c=.cross.o) $(GEN_C_SRCS:.c=.cross.o) $(CROSSTESTMAIN) + @MAKE_RULES@ # Rule for main module spec file @@ -62,10 +66,20 @@ $(TESTRESULTS): $(MODULE)$(DLLEXT) $(TOPOBJDIR)/dlls/$(TESTDLL)$(DLLEXT) $(TESTMAIN): cd $(TOPOBJDIR)/programs/winetest && $(MAKE) wtmain.o +# Rules for cross-compiling tests + +crosstest:: @CROSSTEST@ + +$(CROSSTEST): $(CROSSOBJS) Makefile.in + $(CROSSCC) $(CROSSOBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(LIBS) + +$(CROSSTESTMAIN): + cd $(TOPOBJDIR)/programs/winetest && $(MAKE) wtmain.cross.o + # Rules for cleaning testclean:: $(RM) $(TESTRESULTS) clean:: - $(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS) + $(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS) $(CROSSTEST) diff --git a/dlls/make_dlls b/dlls/make_dlls index 559a7900ffc..90f3ebd6fe2 100755 --- a/dlls/make_dlls +++ b/dlls/make_dlls @@ -290,6 +290,8 @@ uninstall:: check test:: \$(BUILDSUBDIRS:%=%/__test__) +crosstest:: \$(BUILDSUBDIRS:%=%/__crosstest__) + checklink:: \$(BUILDSUBDIRS:%=%/__checklink__) ### Dependencies: diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in index 9abfcdc994c..ee1cc8f02f7 100644 --- a/programs/winetest/Makefile.in +++ b/programs/winetest/Makefile.in @@ -24,8 +24,10 @@ PLTESTPROGRAM = $(MODULE)$(DLLEXT) PLTESTS = \ tests/wine.pl +CROSSTEST = wtmain.cross.o + # override all: target so that we don't build the Perl stuff by default -test_environment: wtmain.o +test_environment: wtmain.o @CROSSTEST@ @MAKE_PROG_RULES@