3 # gemu configure script (c) 2003 Fabrice Bellard
5 # set temporary file name
6 if test ! -z "$TMPDIR" ; then
8 elif test ! -z "$TEMPDIR" ; then
14 TMPC
="${TMPDIR1}/qemacs-conf-${RANDOM}-$$-${RANDOM}.c"
15 TMPO
="${TMPDIR1}/qemacs-conf-${RANDOM}-$$-${RANDOM}.o"
16 TMPS
="${TMPDIR1}/qemacs-conf-${RANDOM}-$$-${RANDOM}.S"
17 TMPH
="${TMPDIR1}/qemacs-conf-${RANDOM}-$$-${RANDOM}.h"
29 i386|i486|i586|i686|i86pc|BePC
)
38 "Power Macintosh"|ppc
)
55 prefix
="/boot/home/config"
56 # helps building libavcodec
58 # no need for libm, but the inet stuff
60 if (echo $BEINCLUDES|
grep 'headers/be/bone' >/dev
/null
); then
61 extralibs
="-lbind -lsocket"
63 echo "Not sure building for net_server will succeed... good luck."
67 extralibs
="-lpoll -lgnugetopt -lm"
74 # XXX: we assume an absolute path is given when launching configure,
75 # except in './configure' case.
76 source_path
=${0%configure}
77 source_path
=${source_path%/}
78 source_path_used
="yes"
79 if test -z "$source_path" -o "$source_path" = "." ; then
86 --prefix=*) prefix
=`echo $opt | cut -d '=' -f 2`
88 --source-path=*) source_path
=`echo $opt | cut -d '=' -f 2`
90 --cross-prefix=*) cross_prefix
=`echo $opt | cut -d '=' -f 2`
92 --cc=*) cc
=`echo $opt | cut -d '=' -f 2`
94 --make=*) make=`echo $opt | cut -d '=' -f 2`
96 --extra-cflags=*) CFLAGS
="${opt#--extra-cflags=}"
98 --extra-ldflags=*) LDFLAGS
="${opt#--extra-ldflags=}"
100 --extra-libs=*) extralibs
=${opt#--extra-libs=}
102 --cpu=*) cpu
=`echo $opt | cut -d '=' -f 2`
104 --enable-gprof) gprof
="yes"
109 # Checking for CFLAGS
110 if test -z "$CFLAGS"; then
114 cc
="${cross_prefix}${cc}"
115 ar="${cross_prefix}${ar}"
116 strip
="${cross_prefix}${strip}"
118 if test -z "$cross_prefix" ; then
121 # big/little endian test
123 #include <inttypes.h>
124 int main(int argc, char ** argv){
125 volatile uint32_t i=0x01234567;
126 return (*((uint8_t*)(&i))) == 0x67;
130 if $cc -o $TMPE $TMPC 2>/dev
/null
; then
131 $TMPE && bigendian
="yes"
133 echo big
/little
test failed
138 # if cross compiling, cannot launch a program, so make a static guess
139 if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
145 if test x
"$1" = x
"-h" -o x
"$1" = x
"--help" ; then
148 Usage: configure [options]
149 Options: [defaults in brackets after descriptions]
152 echo "Standard options:"
153 echo " --help print this message"
154 echo " --prefix=PREFIX install in PREFIX [$prefix]"
155 echo " for audio/video/image support"
157 echo "Advanced options (experts only):"
158 echo " --source-path=PATH path of source code [$source_path]"
159 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
160 echo " --cc=CC use C compiler CC [$cc]"
161 echo " --make=MAKE use specified make [$make]"
163 echo "NOTE: The object files are build at the place where configure is launched"
167 echo "Install prefix $prefix"
168 echo "Source path $source_path"
169 echo "C compiler $cc"
172 echo "Big Endian $bigendian"
173 echo "gprof enabled $gprof"
175 echo "Creating config.mak and config.h"
177 echo "# Automatically generated by configure - do not modify" > config.mak
178 echo "/* Automatically generated by configure - do not modify */" > $TMPH
180 echo "prefix=$prefix" >> config.mak
181 echo "#define CONFIG_GEMU_PREFIX \"$prefix\"" >> $TMPH
182 echo "MAKE=$make" >> config.mak
183 echo "CC=$cc" >> config.mak
184 echo "HOST_CC=$host_cc" >> config.mak
185 echo "AR=$ar" >> config.mak
186 echo "STRIP=$strip -s -R .comment -R .note" >> config.mak
187 echo "CFLAGS=$CFLAGS" >> config.mak
188 echo "LDFLAGS=$LDFLAGS" >> config.mak
189 if test "$cpu" = "x86" ; then
190 echo "ARCH=i386" >> config.mak
191 elif test "$cpu" = "armv4l" ; then
192 echo "ARCH=arm" >> config.mak
193 elif test "$cpu" = "powerpc" ; then
194 echo "ARCH=ppc" > config.mak
195 elif test "$cpu" = "mips" ; then
196 echo "ARCH=mips" > config.mak
198 echo "Unsupported CPU"
201 if test "$bigendian" = "yes" ; then
202 echo "WORDS_BIGENDIAN=yes" >> config.mak
203 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
205 if test "$gprof" = "yes" ; then
206 echo "TARGET_GPROF=yes" >> config.mak
207 echo "#define HAVE_GPROF 1" >> $TMPH
209 echo -n "VERSION=" >>config.mak
210 head $source_path/VERSION
>>config.mak
212 echo -n "#define GEMU_VERSION \"" >> $TMPH
213 head $source_path/VERSION
>> $TMPH
215 if test "$network" = "yes" ; then
216 echo "#define CONFIG_NETWORK 1" >> $TMPH
217 echo "CONFIG_NETWORK=yes" >> config.mak
220 # build tree in object directory if source path is different from current one
221 if test "$source_path_used" = "yes" ; then
223 FILES
="Makefile tests/Makefile"
224 for dir
in $DIRS ; do
228 ln -sf $source_path/$f $f
231 echo "SRC_PATH=$source_path" >> config.mak
233 diff $TMPH config.h
>/dev
/null
2>&1
234 if test $?
-ne 0 ; then
237 echo "config.h is unchanged"