ia64/xen-unstable

view tools/ioemu/configure @ 5238:f85f27fa69ff

bitkeeper revision 1.1615.1.2 (429c8826fS2FuIKb-STmuvL0Hl6awQ)

ioemu fixes: do not install into /usr/share/qemu as it conflicts with
real qemu installations. Also, do not link x86/64 with a special linker
script -- breaks on SLES9 and ought to be unnecessary.
The linker scripts and configuration/Makefile environment all need
stripping out at some point.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue May 31 15:52:06 2005 +0000 (2005-05-31)
parents b03b6f39e718
children fbb531d2ff13
line source
1 #!/bin/sh
2 #
3 # qemu configure script (c) 2003 Fabrice Bellard
4 #
5 # set temporary file name
6 if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8 elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10 else
11 TMPDIR1="/tmp"
12 fi
14 TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15 TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16 TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17 TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
19 # default parameters
20 prefix=""
21 static="no"
22 libdir="lib"
23 cross_prefix=""
24 cc="gcc"
25 host_cc="gcc"
26 ar="ar"
27 make="make"
28 strip="strip"
29 cpu=`uname -m`
30 target_list="target-i386-dm"
31 case "$cpu" in
32 i386|i486|i586|i686|i86pc|BePC)
33 cpu="i386"
34 ;;
35 armv4l)
36 cpu="armv4l"
37 ;;
38 alpha)
39 cpu="alpha"
40 ;;
41 "Power Macintosh"|ppc|ppc64)
42 cpu="powerpc"
43 ;;
44 mips)
45 cpu="mips"
46 ;;
47 s390)
48 cpu="s390"
49 ;;
50 sparc)
51 cpu="sparc"
52 ;;
53 sparc64)
54 cpu="sparc64"
55 ;;
56 ia64)
57 cpu="ia64"
58 ;;
59 m68k)
60 cpu="m68k"
61 ;;
62 x86_64|amd64)
63 cpu="amd64"
64 libdir="lib64"
65 ;;
66 *)
67 cpu="unknown"
68 ;;
69 esac
70 gprof="no"
71 bigendian="no"
72 mingw32="no"
73 EXESUF=""
74 gdbstub="no"
75 slirp="no"
76 adlib="no"
77 oss="no"
78 fmod="no"
79 fmod_lib=""
80 fmod_inc=""
82 # OS specific
83 targetos=`uname -s`
84 case $targetos in
85 MINGW32*)
86 mingw32="yes"
87 ;;
88 FreeBSD)
89 bsd="yes"
90 oss="yes"
91 ;;
92 NetBSD)
93 bsd="yes"
94 oss="yes"
95 ;;
96 OpenBSD)
97 bsd="yes"
98 oss="yes"
99 ;;
100 Darwin)
101 bsd="yes"
102 darwin="yes"
103 ;;
104 *)
105 oss="yes"
106 ;;
107 esac
109 if [ "$bsd" = "yes" ] ; then
110 if [ ! "$darwin" = "yes" ] ; then
111 make="gmake"
112 fi
113 target_list="i386-softmmu ppc-softmmu sparc-softmmu"
114 fi
116 # find source path
117 # XXX: we assume an absolute path is given when launching configure,
118 # except in './configure' case.
119 source_path=${0%configure}
120 source_path=${source_path%/}
121 source_path_used="yes"
122 if test -z "$source_path" -o "$source_path" = "." ; then
123 source_path=`pwd`
124 source_path_used="no"
125 fi
127 for opt do
128 case "$opt" in
129 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
130 ;;
131 --interp-prefix=*) interp_prefix=`echo $opt | cut -d '=' -f 2`
132 ;;
133 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
134 ;;
135 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
136 ;;
137 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
138 ;;
139 --make=*) make=`echo $opt | cut -d '=' -f 2`
140 ;;
141 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
142 ;;
143 --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}"
144 ;;
145 --extra-libs=*) extralibs=${opt#--extra-libs=}
146 ;;
147 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
148 ;;
149 --target-list=*) target_list=${opt#--target-list=}
150 ;;
151 --enable-gprof) gprof="yes"
152 ;;
153 --static) static="yes"
154 ;;
155 --disable-sdl) sdl="no"
156 ;;
157 --enable-fmod) fmod="yes"
158 ;;
159 --fmod-lib=*) fmod_lib=${opt#--fmod-lib=}
160 ;;
161 --fmod-inc=*) fmod_inc=${opt#--fmod-inc=}
162 ;;
163 --disable-vnc) vnc="no"
164 ;;
165 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
166 ;;
167 --disable-slirp) slirp="no"
168 ;;
169 --enable-adlib) adlib="yes"
170 ;;
171 esac
172 done
174 # Checking for CFLAGS
175 if test -z "$CFLAGS"; then
176 CFLAGS="-O2"
177 fi
179 cc="${cross_prefix}${cc}"
180 ar="${cross_prefix}${ar}"
181 strip="${cross_prefix}${strip}"
183 if test "$mingw32" = "yes" ; then
184 target_list="i386-softmmu ppc-softmmu sparc-softmmu"
185 EXESUF=".exe"
186 gdbstub="no"
187 oss="no"
188 fi
190 if test -z "$cross_prefix" ; then
192 # ---
193 # big/little endian test
194 cat > $TMPC << EOF
195 #include <inttypes.h>
196 int main(int argc, char ** argv){
197 volatile uint32_t i=0x01234567;
198 return (*((uint8_t*)(&i))) == 0x67;
199 }
200 EOF
202 if $cc -o $TMPE $TMPC 2>/dev/null ; then
203 $TMPE && bigendian="yes"
204 else
205 echo big/little test failed
206 fi
208 else
210 # if cross compiling, cannot launch a program, so make a static guess
211 if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k"; then
212 bigendian="yes"
213 fi
215 fi
217 # check gcc options support
218 cat > $TMPC <<EOF
219 int main(void) {
220 }
221 EOF
223 have_gcc3_options="no"
224 if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
225 have_gcc3_options="yes"
226 fi
228 ##########################################
229 # VNC probe
231 if test -z "$vnc"; then
233 if libvncserver-config --version >& /dev/null; then
234 vnc=yes
235 else
236 vnc=no
237 fi
239 fi
241 ##########################################
242 # SDL probe
244 sdl_too_old=no
246 if test -z "$sdl" ; then
248 sdl_config="sdl-config"
249 sdl=no
250 sdl_static=no
252 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
253 # win32 cross compilation case
254 sdl_config="i386-mingw32msvc-sdl-config"
255 sdl=yes
256 else
257 # normal SDL probe
258 cat > $TMPC << EOF
259 #include <SDL.h>
260 #undef main /* We don't want SDL to override our main() */
261 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
262 EOF
264 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
265 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
266 if test "$_sdlversion" -lt 121 ; then
267 sdl_too_old=yes
268 else
269 sdl=yes
270 fi
272 # static link with sdl ?
273 if test "$sdl" = "yes" ; then
274 aa="no"
275 `$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
276 sdl_static_libs=`$sdl_config --static-libs`
277 if [ "$aa" = "yes" ] ; then
278 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
279 fi
281 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
282 sdl_static=yes
283 fi
285 fi # static link
287 fi # sdl compile test
289 fi # cross compilation
290 fi # -z $sdl
292 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
293 cat << EOF
295 Usage: configure [options]
296 Options: [defaults in brackets after descriptions]
298 EOF
299 echo "Standard options:"
300 echo " --help print this message"
301 echo " --prefix=PREFIX install in PREFIX [$prefix]"
302 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
303 echo " use %M for cpu name [$interp_prefix]"
304 echo " --target-list=LIST set target list [$target_list]"
305 echo " --disable-vnc disable vnc support (else configure checks"
306 echo " for libvncserver-config in your PATH)"
307 echo ""
308 echo "Advanced options (experts only):"
309 echo " --source-path=PATH path of source code [$source_path]"
310 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
311 echo " --cc=CC use C compiler CC [$cc]"
312 echo " --make=MAKE use specified make [$make]"
313 echo " --static enable static build [$static]"
314 echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
315 echo " --enable-fmod enable FMOD audio output driver"
316 echo " --fmod-lib path to FMOD library"
317 echo " --fmod-inc path to FMOD includes"
318 echo ""
319 echo "NOTE: The object files are build at the place where configure is launched"
320 exit 1
321 fi
323 #installroot=$source_path/../../dist/install
324 installroot=
326 if test "$mingw32" = "yes" ; then
327 if test -z "$prefix" ; then
328 prefix="/c/Program Files/Qemu"
329 fi
331 mandir="$prefix"
332 datadir="$prefix"
333 docdir="$prefix"
334 bindir="$prefix"
335 configdir=""
336 else
337 if test -z "$prefix" ; then
338 prefix="usr/local"
339 fi
340 mandir="$installroot/$prefix/share/man"
341 datadir="$installroot/$prefix/share/xen/qemu"
342 docdir="$installroot/$prefix/share/doc/qemu"
343 bindir="$installroot/$prefix/bin"
344 configdir="$installroot/etc/xen"
345 fi
347 echo "Install prefix $prefix"
348 echo "BIOS directory $datadir"
349 echo "binary directory $bindir"
350 if test "$mingw32" = "no" ; then
351 echo "Manual directory $mandir"
352 fi
353 echo "Source path $source_path"
354 echo "C compiler $cc"
355 echo "make $make"
356 echo "host CPU $cpu"
357 echo "host big endian $bigendian"
358 echo "target list $target_list"
359 echo "gprof enabled $gprof"
360 echo "static build $static"
361 echo "VNC support $vnc"
362 echo "SDL support $sdl"
363 echo "SDL static link $sdl_static"
364 echo "mingw32 support $mingw32"
365 echo "Adlib support $adlib"
366 echo -n "FMOD support $fmod"
367 if test $fmod = "yes"; then
368 echo -n " (lib='$fmod_lib' include='$fmod_inc')"
369 fi
370 echo ""
372 if test $sdl_too_old = "yes"; then
373 echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
374 fi
375 if test "$sdl_static" = "no"; then
376 echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
377 fi
379 config_mak="config-host.mak"
380 config_h="config-host.h"
382 #echo "Creating $config_mak and $config_h"
384 echo "# Automatically generated by configure - do not modify" > $config_mak
385 echo "/* Automatically generated by configure - do not modify */" > $config_h
387 echo "prefix=$prefix" >> $config_mak
388 echo "bindir=$bindir" >> $config_mak
389 echo "mandir=$mandir" >> $config_mak
390 echo "datadir=$datadir" >> $config_mak
391 echo "docdir=$docdir" >> $config_mak
392 echo "configdir=$configdir" >> $config_mak
393 echo "LIBDIR=$libdir" >> $config_mak
394 echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
395 echo "MAKE=$make" >> $config_mak
396 echo "CC=$cc" >> $config_mak
397 if test "$have_gcc3_options" = "yes" ; then
398 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
399 fi
400 echo "HOST_CC=$host_cc" >> $config_mak
401 echo "AR=$ar" >> $config_mak
402 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
403 echo "CFLAGS=$CFLAGS" >> $config_mak
404 echo "LDFLAGS=$LDFLAGS" >> $config_mak
405 echo "EXESUF=$EXESUF" >> $config_mak
407 if test "$bigendian" = "yes" ; then
408 echo "WORDS_BIGENDIAN=yes" >> $config_mak
409 echo "#define WORDS_BIGENDIAN 1" >> $config_h
410 fi
411 if test "$mingw32" = "yes" ; then
412 echo "CONFIG_WIN32=yes" >> $config_mak
413 echo "#define CONFIG_WIN32 1" >> $config_h
414 elif test -f "/usr/include/byteswap.h" ; then
415 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
416 fi
417 if test "$darwin" = "yes" ; then
418 echo "CONFIG_DARWIN=yes" >> $config_mak
419 echo "#define CONFIG_DARWIN 1" >> $config_h
420 fi
421 if test "$gdbstub" = "yes" ; then
422 echo "CONFIG_GDBSTUB=yes" >> $config_mak
423 echo "#define CONFIG_GDBSTUB 1" >> $config_h
424 fi
425 if test "$gprof" = "yes" ; then
426 echo "TARGET_GPROF=yes" >> $config_mak
427 echo "#define HAVE_GPROF 1" >> $config_h
428 fi
429 if test "$static" = "yes" ; then
430 echo "CONFIG_STATIC=yes" >> $config_mak
431 echo "#define CONFIG_STATIC 1" >> $config_h
432 fi
433 if test "$slirp" = "yes" ; then
434 echo "CONFIG_SLIRP=yes" >> $config_mak
435 echo "#define CONFIG_SLIRP 1" >> $config_h
436 fi
437 if test "$adlib" = "yes" ; then
438 echo "CONFIG_ADLIB=yes" >> $config_mak
439 echo "#define CONFIG_ADLIB 1" >> $config_h
440 fi
441 if test "$oss" = "yes" ; then
442 echo "CONFIG_OSS=yes" >> $config_mak
443 echo "#define CONFIG_OSS 1" >> $config_h
444 fi
445 if test "$fmod" = "yes" ; then
446 echo "CONFIG_FMOD=yes" >> $config_mak
447 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
448 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
449 echo "#define CONFIG_FMOD 1" >> $config_h
450 fi
451 echo -n "VERSION=" >>$config_mak
452 head $source_path/VERSION >>$config_mak
453 echo "" >>$config_mak
454 echo -n "#define QEMU_VERSION \"" >> $config_h
455 head $source_path/VERSION >> $config_h
456 echo "\"" >> $config_h
458 echo "SRC_PATH=$source_path" >> $config_mak
459 echo "TARGET_DIRS=$target_list" >> $config_mak
461 # XXX: suppress that
462 if [ "$bsd" = "yes" ] ; then
463 echo "#define O_LARGEFILE 0" >> $config_h
464 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
465 echo "#define _BSD 1" >> $config_h
466 fi
468 if test "$vnc" = "yes"; then
469 echo "CONFIG_VNC=yes" >> $config_mak
470 vnc_cflags=`libvncserver-config --cflags`
471 if [ -z $vnc_cflags ]; then
472 vnc_cflags="/usr/include"
473 fi
474 echo "VNC_CFLAGS=$vnc_cflags" >> $config_mak
475 fi
477 if test "$sdl" = "yes"; then
478 echo "CONFIG_SDL=yes" >> $config_mak
479 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
480 fi
482 for target in $target_list; do
484 target_dir="$target"
485 config_mak=$target_dir/config.mak
486 config_h=$target_dir/config.h
487 target_cpu=`echo $target | cut -d '-' -f 2`
488 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
489 target_softmmu="no"
490 if expr $target : '.*-softmmu' > /dev/null ; then
491 target_softmmu="yes"
492 fi
493 target_user_only="no"
494 if expr $target : '.*-user' > /dev/null ; then
495 target_user_only="yes"
496 fi
497 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
499 mkdir -p $target_dir
500 if test "$target" = "arm-user" ; then
501 mkdir -p $target_dir/nwfpe
502 fi
503 if test "$target_user_only" = "no" ; then
504 mkdir -p $target_dir/slirp
505 fi
507 #ln -sf $source_path/Makefile.target $target_dir/Makefile
509 echo "# Automatically generated by configure - do not modify" > $config_mak
510 echo "/* Automatically generated by configure - do not modify */" > $config_h
513 echo "include ../config-host.mak" >> $config_mak
514 echo "#include \"../config-host.h\"" >> $config_h
516 echo "TARGET_ARCH=i386" >> $config_mak
517 echo "#define TARGET_ARCH \"i386\"" >> $config_h
518 echo "#define TARGET_I386 1" >> $config_h
520 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
521 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
523 if test "$target_bigendian" = "yes" ; then
524 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
525 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
526 fi
527 if test "$target_softmmu" = "yes" ; then
528 echo "CONFIG_SOFTMMU=yes" >> $config_mak
529 echo "#define CONFIG_SOFTMMU 1" >> $config_h
530 fi
531 if test "$target_user_only" = "yes" ; then
532 echo "CONFIG_USER_ONLY=yes" >> $config_mak
533 echo "#define CONFIG_USER_ONLY 1" >> $config_h
534 fi
536 if test "$target_user_only" = "no"; then
537 if test "$vnc" = "yes"; then
538 echo "#define CONFIG_VNC 1" >> $config_h
539 echo "CONFIG_VNC=yes" >> $config_mak
540 echo "VNC_CFLAGS=`libvncserver-config --cflags`" >> $config_mak
541 echo "VNC_LIBS=`libvncserver-config --libs`" >> $config_mak
542 fi
543 fi
545 # sdl defines
547 if test "$sdl" = "yes" -a "$target_user_only" = "no"; then
548 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
549 sdl1=$sdl_static
550 else
551 sdl1=$sdl
552 fi
553 if test "$sdl1" = "yes" ; then
554 echo "#define CONFIG_SDL 1" >> $config_h
555 echo "CONFIG_SDL=yes" >> $config_mak
556 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
557 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
558 else
559 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
560 fi
561 echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
562 if [ "${aa}" = "yes" ] ; then
563 echo -n " `aalib-config --cflags`" >> $config_mak ;
564 fi
565 echo "" >> $config_mak
566 fi
567 fi
569 done # for target in $targets
571 # build tree in object directory if source path is different from current one
572 if test "$source_path_used" = "yes" ; then
573 DIRS="tests"
574 FILES="Makefile tests/Makefile"
575 for dir in $DIRS ; do
576 mkdir -p $dir
577 done
578 for f in $FILES ; do
579 ln -sf $source_path/$f $f
580 done
581 fi
583 rm -f $TMPO $TMPC $TMPE $TMPS