]> git.proxmox.com Git - qemu.git/blame - configure
added translation cache
[qemu.git] / configure
CommitLineData
7d13299d
FB
1#!/bin/sh
2#
3# gemu configure script (c) 2003 Fabrice Bellard
4#
5# set temporary file name
6if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10else
11 TMPDIR1="/tmp"
12fi
13
14TMPC="${TMPDIR1}/qemacs-conf-${RANDOM}-$$-${RANDOM}.c"
15TMPO="${TMPDIR1}/qemacs-conf-${RANDOM}-$$-${RANDOM}.o"
16TMPS="${TMPDIR1}/qemacs-conf-${RANDOM}-$$-${RANDOM}.S"
17TMPH="${TMPDIR1}/qemacs-conf-${RANDOM}-$$-${RANDOM}.h"
18
19# default parameters
20prefix="/usr/local"
21cross_prefix=""
22cc="gcc"
23host_cc="gcc"
24ar="ar"
25make="make"
26strip="strip"
27cpu=`uname -m`
28case "$cpu" in
29 i386|i486|i586|i686|i86pc|BePC)
30 cpu="x86"
31 ;;
32 armv4l)
33 cpu="armv4l"
34 ;;
35 alpha)
36 cpu="alpha"
37 ;;
38 "Power Macintosh"|ppc)
39 cpu="powerpc"
40 ;;
41 mips)
42 cpu="mips"
43 ;;
44 *)
45 cpu="unknown"
46 ;;
47esac
48gprof="no"
49bigendian="no"
50
51# OS specific
52targetos=`uname -s`
53case $targetos in
54BeOS)
55prefix="/boot/home/config"
56# helps building libavcodec
57CFLAGS="-O2 -DPIC"
58# no need for libm, but the inet stuff
59# Check for BONE
60if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
61extralibs="-lbind -lsocket"
62else
63echo "Not sure building for net_server will succeed... good luck."
64extralibs="-lsocket"
65fi ;;
66BSD/OS)
67extralibs="-lpoll -lgnugetopt -lm"
68make="gmake"
69;;
70*) ;;
71esac
72
73# find source path
74# XXX: we assume an absolute path is given when launching configure,
75# except in './configure' case.
76source_path=${0%configure}
77source_path=${source_path%/}
78source_path_used="yes"
79if test -z "$source_path" -o "$source_path" = "." ; then
80 source_path=`pwd`
81 source_path_used="no"
82fi
83
84for opt do
85 case "$opt" in
86 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
87 ;;
88 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
89 ;;
90 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
91 ;;
92 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
93 ;;
94 --make=*) make=`echo $opt | cut -d '=' -f 2`
95 ;;
96 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
97 ;;
98 --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}"
99 ;;
100 --extra-libs=*) extralibs=${opt#--extra-libs=}
101 ;;
102 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
103 ;;
104 --enable-gprof) gprof="yes"
105 ;;
106 esac
107done
108
109# Checking for CFLAGS
110if test -z "$CFLAGS"; then
111 CFLAGS="-O2"
112fi
113
114cc="${cross_prefix}${cc}"
115ar="${cross_prefix}${ar}"
116strip="${cross_prefix}${strip}"
117
118if test -z "$cross_prefix" ; then
119
120# ---
121# big/little endian test
122cat > $TMPC << EOF
123#include <inttypes.h>
124int main(int argc, char ** argv){
125 volatile uint32_t i=0x01234567;
126 return (*((uint8_t*)(&i))) == 0x67;
127}
128EOF
129
130if $cc -o $TMPE $TMPC 2>/dev/null ; then
131$TMPE && bigendian="yes"
132else
133echo big/little test failed
134fi
135
136else
137
138# if cross compiling, cannot launch a program, so make a static guess
139if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
140 bigendian="yes"
141fi
142
143fi
144
145if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
146cat << EOF
147
148Usage: configure [options]
149Options: [defaults in brackets after descriptions]
150
151EOF
152echo "Standard options:"
153echo " --help print this message"
154echo " --prefix=PREFIX install in PREFIX [$prefix]"
155echo " for audio/video/image support"
156echo ""
157echo "Advanced options (experts only):"
158echo " --source-path=PATH path of source code [$source_path]"
159echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
160echo " --cc=CC use C compiler CC [$cc]"
161echo " --make=MAKE use specified make [$make]"
162echo ""
163echo "NOTE: The object files are build at the place where configure is launched"
164exit 1
165fi
166
167echo "Install prefix $prefix"
168echo "Source path $source_path"
169echo "C compiler $cc"
170echo "make $make"
171echo "CPU $cpu"
172echo "Big Endian $bigendian"
173echo "gprof enabled $gprof"
174
175echo "Creating config.mak and config.h"
176
177echo "# Automatically generated by configure - do not modify" > config.mak
178echo "/* Automatically generated by configure - do not modify */" > $TMPH
179
180echo "prefix=$prefix" >> config.mak
181echo "#define CONFIG_GEMU_PREFIX \"$prefix\"" >> $TMPH
182echo "MAKE=$make" >> config.mak
183echo "CC=$cc" >> config.mak
184echo "HOST_CC=$host_cc" >> config.mak
185echo "AR=$ar" >> config.mak
186echo "STRIP=$strip -s -R .comment -R .note" >> config.mak
187echo "CFLAGS=$CFLAGS" >> config.mak
188echo "LDFLAGS=$LDFLAGS" >> config.mak
189if test "$cpu" = "x86" ; then
190 echo "ARCH=i386" >> config.mak
191elif test "$cpu" = "armv4l" ; then
192 echo "ARCH=arm" >> config.mak
193elif test "$cpu" = "powerpc" ; then
194 echo "ARCH=ppc" > config.mak
195elif test "$cpu" = "mips" ; then
196 echo "ARCH=mips" > config.mak
197else
198 echo "Unsupported CPU"
199 exit 1
200fi
201if test "$bigendian" = "yes" ; then
202 echo "WORDS_BIGENDIAN=yes" >> config.mak
203 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
204fi
205if test "$gprof" = "yes" ; then
206 echo "TARGET_GPROF=yes" >> config.mak
207 echo "#define HAVE_GPROF 1" >> $TMPH
208fi
209echo -n "VERSION=" >>config.mak
210head $source_path/VERSION >>config.mak
211echo "" >>config.mak
212echo -n "#define GEMU_VERSION \"" >> $TMPH
213head $source_path/VERSION >> $TMPH
214echo "\"" >> $TMPH
215if test "$network" = "yes" ; then
216 echo "#define CONFIG_NETWORK 1" >> $TMPH
217 echo "CONFIG_NETWORK=yes" >> config.mak
218fi
219
220# build tree in object directory if source path is different from current one
221if test "$source_path_used" = "yes" ; then
222 DIRS="tests"
223 FILES="Makefile tests/Makefile"
224 for dir in $DIRS ; do
225 mkdir -p $dir
226 done
227 for f in $FILES ; do
228 ln -sf $source_path/$f $f
229 done
230fi
231echo "SRC_PATH=$source_path" >> config.mak
232
233diff $TMPH config.h >/dev/null 2>&1
234if test $? -ne 0 ; then
235 mv -f $TMPH config.h
236else
237 echo "config.h is unchanged"
238fi
239
240rm -f $TMPH