Commit 11d9f695e710b406a487daf3fb83f82dea314063

Authored by bellard
1 parent 0c607d57

win32 cross compile fix


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@694 c046a42c-6fe2-441c-8c8c-71466251a162
Makefile
@@ -16,14 +16,11 @@ all: dyngen$(EXESUF) $(TOOLS) qemu-doc.html qemu.1 @@ -16,14 +16,11 @@ all: dyngen$(EXESUF) $(TOOLS) qemu-doc.html qemu.1
16 make -C $$d $@ || exit 1 ; \ 16 make -C $$d $@ || exit 1 ; \
17 done 17 done
18 18
19 -qemu-mkcow: qemu-mkcow.o  
20 - $(HOST_CC) -o $@ $^ $(LIBS) 19 +qemu-mkcow: qemu-mkcow.c
  20 + $(CC) $(CFLAGS) $(DEFINES) -o $@ $^ $(LIBS)
21 21
22 -dyngen$(EXESUF): dyngen.o  
23 - $(HOST_CC) -o $@ $^ $(LIBS)  
24 -  
25 -%.o: %.c  
26 - $(HOST_CC) $(CFLAGS) $(DEFINES) -c -o $@ $< 22 +dyngen$(EXESUF): dyngen.c
  23 + $(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^
27 24
28 clean: 25 clean:
29 # avoid old build problems by removing potentially incorrect old files 26 # avoid old build problems by removing potentially incorrect old files
@@ -41,13 +38,17 @@ distclean: clean @@ -41,13 +38,17 @@ distclean: clean
41 done 38 done
42 39
43 install: all 40 install: all
44 - mkdir -p $(prefix)/bin  
45 - install -m 755 -s $(TOOLS) $(prefix)/bin  
46 - mkdir -p $(sharedir) 41 + mkdir -p "$(bindir)"
  42 +ifndef CONFIG_WIN32
  43 + install -m 755 -s $(TOOLS) "$(bindir)"
  44 +endif
  45 + mkdir -p "$(sharedir)"
47 install -m 644 pc-bios/bios.bin pc-bios/vgabios.bin \ 46 install -m 644 pc-bios/bios.bin pc-bios/vgabios.bin \
48 - pc-bios/linux_boot.bin $(sharedir)  
49 - mkdir -p $(mandir)/man1  
50 - install qemu.1 qemu-mkcow.1 $(mandir)/man1 47 + pc-bios/linux_boot.bin "$(sharedir)"
  48 +ifndef CONFIG_WIN32
  49 + mkdir -p "$(mandir)/man1"
  50 + install qemu.1 qemu-mkcow.1 "$(mandir)/man1"
  51 +endif
51 for d in $(TARGET_DIRS); do \ 52 for d in $(TARGET_DIRS); do \
52 make -C $$d $@ || exit 1 ; \ 53 make -C $$d $@ || exit 1 ; \
53 done 54 done
Makefile.target
@@ -246,9 +246,12 @@ endif @@ -246,9 +246,12 @@ endif
246 ifndef CONFIG_SOFTMMU 246 ifndef CONFIG_SOFTMMU
247 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld 247 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
248 endif 248 endif
  249 +ifndef CONFIG_WIN32
  250 +VL_LIBS=-lutil
  251 +endif
249 252
250 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a 253 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
251 - $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) -lutil 254 + $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VL_LIBS)
252 255
253 sdl.o: sdl.c 256 sdl.o: sdl.c
254 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $< 257 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
@@ -309,7 +312,7 @@ clean: @@ -309,7 +312,7 @@ clean:
309 312
310 install: all 313 install: all
311 ifneq ($(PROGS),) 314 ifneq ($(PROGS),)
312 - install -m 755 -s $(PROGS) $(prefix)/bin 315 + install -m 755 -s $(PROGS) "$(bindir)"
313 endif 316 endif
314 317
315 ifneq ($(wildcard .depend),) 318 ifneq ($(wildcard .depend),)
configure
@@ -17,7 +17,7 @@ TMPE=&quot;${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}&quot; @@ -17,7 +17,7 @@ TMPE=&quot;${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}&quot;
17 TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S" 17 TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
18 18
19 # default parameters 19 # default parameters
20 -prefix="/usr/local" 20 +prefix=""
21 interp_prefix="/usr/gnemul/qemu-%M" 21 interp_prefix="/usr/gnemul/qemu-%M"
22 static="no" 22 static="no"
23 cross_prefix="" 23 cross_prefix=""
@@ -81,26 +81,6 @@ mingw32=&quot;yes&quot; @@ -81,26 +81,6 @@ mingw32=&quot;yes&quot;
81 *) ;; 81 *) ;;
82 esac 82 esac
83 83
84 -##########################################  
85 -# SDL probe  
86 -  
87 -cat > $TMPC << EOF  
88 -#include <SDL.h>  
89 -#undef main /* We don't want SDL to override our main() */  
90 -int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }  
91 -EOF  
92 -  
93 -sdl_too_old=no  
94 -sdl=no  
95 -if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs` 2> /dev/null ; then  
96 -_sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`  
97 -if test "$_sdlversion" -lt 121 ; then  
98 -sdl_too_old=yes  
99 -else  
100 -sdl=yes  
101 -fi  
102 -fi  
103 -  
104 # find source path 84 # find source path
105 # XXX: we assume an absolute path is given when launching configure, 85 # XXX: we assume an absolute path is given when launching configure,
106 # except in './configure' case. 86 # except in './configure' case.
@@ -157,9 +137,7 @@ ar=&quot;${cross_prefix}${ar}&quot; @@ -157,9 +137,7 @@ ar=&quot;${cross_prefix}${ar}&quot;
157 strip="${cross_prefix}${strip}" 137 strip="${cross_prefix}${strip}"
158 138
159 if test "$mingw32" = "yes" ; then 139 if test "$mingw32" = "yes" ; then
160 - host_cc="$cc"  
161 target_list="i386-softmmu" 140 target_list="i386-softmmu"
162 - prefix="/c/Program Files/Qemu"  
163 EXESUF=".exe" 141 EXESUF=".exe"
164 gdbstub="no" 142 gdbstub="no"
165 fi 143 fi
@@ -202,6 +180,31 @@ if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2&gt; /dev/nu @@ -202,6 +180,31 @@ if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2&gt; /dev/nu
202 have_gcc3_options="yes" 180 have_gcc3_options="yes"
203 fi 181 fi
204 182
  183 +##########################################
  184 +# SDL probe
  185 +
  186 +sdl_too_old=no
  187 +
  188 +if test -z "$sdl" ; then
  189 +
  190 +cat > $TMPC << EOF
  191 +#include <SDL.h>
  192 +#undef main /* We don't want SDL to override our main() */
  193 +int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
  194 +EOF
  195 +
  196 +sdl=no
  197 +if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs` 2> /dev/null ; then
  198 +_sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
  199 +if test "$_sdlversion" -lt 121 ; then
  200 +sdl_too_old=yes
  201 +else
  202 +sdl=yes
  203 +fi
  204 +fi
  205 +
  206 +fi
  207 +
205 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then 208 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
206 cat << EOF 209 cat << EOF
207 210
@@ -228,13 +231,29 @@ echo &quot;NOTE: The object files are build at the place where configure is launched&quot; @@ -228,13 +231,29 @@ echo &quot;NOTE: The object files are build at the place where configure is launched&quot;
228 exit 1 231 exit 1
229 fi 232 fi
230 233
  234 +if test "$mingw32" = "yes" ; then
  235 +if test -z "$prefix" ; then
  236 + prefix="/c/Program Files/Qemu"
  237 +fi
  238 +mandir="$prefix"
  239 +sharedir="$prefix"
  240 +bindir="$prefix"
  241 +else
  242 +if test -z "$prefix" ; then
  243 + prefix="/usr/local"
  244 +fi
231 mandir="$prefix/share/man" 245 mandir="$prefix/share/man"
232 sharedir="$prefix/share/qemu" 246 sharedir="$prefix/share/qemu"
  247 +bindir="$prefix/bin"
  248 +fi
233 249
234 echo "Install prefix $prefix" 250 echo "Install prefix $prefix"
235 -echo "Manual directory $mandir"  
236 echo "BIOS directory $sharedir" 251 echo "BIOS directory $sharedir"
  252 +echo "binary directory $bindir"
  253 +if test "$mingw32" = "no" ; then
  254 +echo "Manual directory $mandir"
237 echo "ELF interp prefix $interp_prefix" 255 echo "ELF interp prefix $interp_prefix"
  256 +fi
238 echo "Source path $source_path" 257 echo "Source path $source_path"
239 echo "C compiler $cc" 258 echo "C compiler $cc"
240 echo "make $make" 259 echo "make $make"
@@ -259,6 +278,7 @@ echo &quot;# Automatically generated by configure - do not modify&quot; &gt; $config_mak @@ -259,6 +278,7 @@ echo &quot;# Automatically generated by configure - do not modify&quot; &gt; $config_mak
259 echo "/* Automatically generated by configure - do not modify */" > $config_h 278 echo "/* Automatically generated by configure - do not modify */" > $config_h
260 279
261 echo "prefix=$prefix" >> $config_mak 280 echo "prefix=$prefix" >> $config_mak
  281 +echo "bindir=$bindir" >> $config_mak
262 echo "mandir=$mandir" >> $config_mak 282 echo "mandir=$mandir" >> $config_mak
263 echo "sharedir=$sharedir" >> $config_mak 283 echo "sharedir=$sharedir" >> $config_mak
264 echo "#define CONFIG_QEMU_SHAREDIR \"$sharedir\"" >> $config_h 284 echo "#define CONFIG_QEMU_SHAREDIR \"$sharedir\"" >> $config_h
@@ -316,6 +336,7 @@ if test &quot;$bigendian&quot; = &quot;yes&quot; ; then @@ -316,6 +336,7 @@ if test &quot;$bigendian&quot; = &quot;yes&quot; ; then
316 fi 336 fi
317 if test "$mingw32" = "yes" ; then 337 if test "$mingw32" = "yes" ; then
318 echo "CONFIG_WIN32=yes" >> $config_mak 338 echo "CONFIG_WIN32=yes" >> $config_mak
  339 + echo "#define CONFIG_WIN32 1" >> $config_h
319 else 340 else
320 echo "#define HAVE_BYTESWAP_H 1" >> $config_h 341 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
321 fi 342 fi
dyngen.c
@@ -30,7 +30,9 @@ @@ -30,7 +30,9 @@
30 30
31 #include "config-host.h" 31 #include "config-host.h"
32 32
33 -#if defined(_WIN32) 33 +/* NOTE: we test CONFIG_WIN32 instead of _WIN32 to enabled cross
  34 + compilation */
  35 +#if defined(CONFIG_WIN32)
34 #define CONFIG_FORMAT_COFF 36 #define CONFIG_FORMAT_COFF
35 #else 37 #else
36 #define CONFIG_FORMAT_ELF 38 #define CONFIG_FORMAT_ELF