blob: 7a2395475f37d70d70bf9b252d3ed80658691687 [file] [log] [blame]
David 'Digit' Turner46be4872009-06-04 16:07:01 +02001#!/bin/sh
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -08002#
3# this script is used to rebuild the Android emulator from sources
4# in the current directory. It also contains logic to speed up the
5# rebuild if it detects that you're using the Android build system
6#
7# in this case, it will use prebuilt binaries for the compiler,
8# the audio library and the SDL library. You can disable this
9# by using the --no-prebuilt-libs and --cc=<compiler> options
10#
11#
12# here's the list of environment variables you can define before
13# calling this script to control it (besides options):
14#
15#
16
17# first, let's see which system we're running this on
18cd `dirname $0`
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -080019
David 'Digit' Turner46be4872009-06-04 16:07:01 +020020# source common functions definitions
21. android/build/common.sh
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -080022
23# Parse options
24OPTION_TARGETS=""
25OPTION_DEBUG=no
26OPTION_IGNORE_AUDIO=no
27OPTION_NO_PREBUILTS=no
28OPTION_TRY_64=no
29OPTION_HELP=no
David 'Digit' Turnerd68b4872009-07-24 16:33:05 +020030OPTION_DEBUG=no
David 'Digit' Turnerab873b72010-03-08 18:33:50 -080031OPTION_STATIC=no
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -080032
33if [ -z "$CC" ] ; then
34 CC=gcc
35fi
36
37for opt do
38 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
39 case "$opt" in
40 --help|-h|-\?) OPTION_HELP=yes
41 ;;
42 --verbose)
43 if [ "$VERBOSE" = "yes" ] ; then
44 VERBOSE2=yes
45 else
46 VERBOSE=yes
47 fi
48 ;;
David 'Digit' Turnerd68b4872009-07-24 16:33:05 +020049 --debug) OPTION_DEBUG=yes
50 ;;
David 'Digit' Turner46be4872009-06-04 16:07:01 +020051 --install=*) OPTION_TARGETS="$OPTION_TARGETS $optarg";
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -080052 ;;
53 --sdl-config=*) SDL_CONFIG=$optarg
54 ;;
55 --cc=*) CC="$optarg" ; HOSTCC=$CC
56 ;;
57 --no-strip) OPTION_NO_STRIP=yes
58 ;;
59 --debug) OPTION_DEBUG=yes
60 ;;
61 --ignore-audio) OPTION_IGNORE_AUDIO=yes
62 ;;
63 --no-prebuilts) OPTION_NO_PREBUILTS=yes
64 ;;
65 --try-64) OPTION_TRY_64=yes
66 ;;
David 'Digit' Turnerab873b72010-03-08 18:33:50 -080067 --static) OPTION_STATIC=yes
68 ;;
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -080069 *)
70 echo "unknown option '$opt', use --help"
71 exit 1
72 esac
73done
74
75# Print the help message
76#
77if [ "$OPTION_HELP" = "yes" ] ; then
78 cat << EOF
79
80Usage: rebuild.sh [options]
81Options: [defaults in brackets after descriptions]
82EOF
83 echo "Standard options:"
84 echo " --help print this message"
85 echo " --install=FILEPATH copy emulator executable to FILEPATH [$TARGETS]"
86 echo " --cc=PATH specify C compiler [$CC]"
87 echo " --sdl-config=FILE use specific sdl-config script [$SDL_CONFIG]"
88 echo " --no-strip do not strip emulator executable"
89 echo " --debug enable debug (-O0 -g) build"
90 echo " --ignore-audio ignore audio messages (may build sound-less emulator)"
91 echo " --no-prebuilts do not use prebuilt libraries and compiler"
92 echo " --try-64 try to build a 64-bit executable (may crash)"
David 'Digit' Turnerab873b72010-03-08 18:33:50 -080093 echo " --static build a completely static executable"
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -080094 echo " --verbose verbose configuration"
David 'Digit' Turnerd68b4872009-07-24 16:33:05 +020095 echo " --debug build debug version of the emulator"
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -080096 echo ""
97 exit 1
98fi
99
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200100# we only support generating 32-bit binaris on 64-bit systems.
101# And we may need to add a -Wa,--32 to CFLAGS to let the assembler
102# generate 32-bit binaries on Linux x86_64.
103#
104if [ "$OPTION_TRY_64" != "yes" ] ; then
105 force_32bit_binaries
106fi
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800107
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200108# Are we running in the Android build system ?
109check_android_build
110
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800111
112# Adjust a few things when we're building within the Android build
113# system:
114# - locate prebuilt directory
115# - locate and use prebuilt libraries
116# - copy the new binary to the correct location
117#
118if [ "$OPTION_NO_PREBUILTS" = "yes" ] ; then
119 IN_ANDROID_BUILD=no
120fi
121
122if [ "$IN_ANDROID_BUILD" = "yes" ] ; then
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200123 locate_android_prebuilt
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800124
125 # use ccache if USE_CCACHE is defined and the corresponding
126 # binary is available.
127 #
128 # note: located in PREBUILT/ccache/ccache in the new tree layout
129 # located in PREBUILT/ccache in the old one
130 #
131 if [ -n "$USE_CCACHE" ] ; then
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200132 CCACHE="$ANDROID_PREBUILT/ccache/ccache$EXE"
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800133 if [ ! -f $CCACHE ] ; then
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200134 CCACHE="$ANDROID_PREBUILT/ccache$EXE"
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800135 fi
136 if [ -f $CCACHE ] ; then
137 CC="$CCACHE $CC"
138 fi
139 log "Prebuilt : CCACHE=$CCACHE"
140 fi
141
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200142 # if the user didn't specify an sdl-config script, get the prebuilt one
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800143 if [ -z "$SDL_CONFIG" -a "$OPTION_NO_PREBUILTS" = "no" ] ; then
144 # always use our own static libSDL by default
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200145 SDL_CONFIG=$ANDROID_PREBUILT/sdl/bin/sdl-config
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800146 log "Prebuilt : SDL_CONFIG=$SDL_CONFIG"
147 fi
148
149 # finally ensure that our new binary is copied to the 'out'
150 # subdirectory as 'emulator'
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200151 HOST_BIN=$(get_android_abs_build_var HOST_OUT_EXECUTABLES)
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800152 if [ -n "$HOST_BIN" ] ; then
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200153 OPTION_TARGETS="$OPTION_TARGETS $HOST_BIN/emulator$EXE"
154 log "Targets : TARGETS=$OPTION_TARGETS"
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800155 fi
David 'Digit' Turnera383d022009-12-03 13:50:00 -0800156
157 # find the Android SDK Tools revision number
158 TOOLS_PROPS=$ANDROID_TOP/sdk/files/tools_source.properties
159 if [ -f $TOOLS_PROPS ] ; then
160 ANDROID_SDK_TOOLS_REVISION=`awk -F= '/Pkg.Revision/ { print $2; }' $TOOLS_PROPS 2> /dev/null`
161 log "Tools : Found tools revision number $ANDROID_SDK_TOOLS_REVISION"
162 else
163 log "Tools : Could not locate $TOOLS_PROPS !?"
164 fi
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800165fi # IN_ANDROID_BUILD = no
166
167
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200168# we can build the emulator with Cygwin, so enable it
169enable_cygwin
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800170
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200171setup_toolchain
The Android Open Source Project92c73112009-03-05 14:34:31 -0800172
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800173###
174### SDL Probe
175###
176
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200177# if the user didn't specify a sdl-config script, get the prebuilt one
178if [ -z "$SDL_CONFIG" -a "$OPTION_NO_PREBUILTS" = "no" ] ; then
179 # try to find one from our git repository
180 SDL_CONFIG=../sdl/out/$OS/bin/sdl-config
181 if [ -f $SDL_CONFIG ] ; then
182 log "Prebuilt : SDL_CONFIG=$SDL_CONFIG"
183 else
184 echo "WARNING: YOU SHOULD USE THE --sdl-config OPTION"
185 SDL_CONFIG=
186 fi
187fi
188
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800189# For now, we require an external libSDL library, if SDL_CONFIG is not
190# defined, try to grab it from the environment
191#
192if [ -z "$SDL_CONFIG" ] ; then
193 SDL_CONFIG=`which sdl-config`
194 if [ $? != 0 ] ; then
195 echo "Please ensure that you have the emulator's patched libSDL"
196 echo "built somewhere and point to its sdl-config script either"
197 echo "with the SDL_CONFIG env. variable, or the --sdl-config=<script>"
198 echo "option."
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200199 clean_exit
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800200 fi
201fi
202
203# check that we can link statically with the library.
204#
205SDL_CFLAGS=`$SDL_CONFIG --cflags`
206SDL_LIBS=`$SDL_CONFIG --static-libs`
207
208# quick hack, remove the -D_GNU_SOURCE=1 of some SDL Cflags
209# since they break recent Mingw releases
210SDL_CFLAGS=`echo $SDL_CFLAGS | sed -e s/-D_GNU_SOURCE=1//g`
211
212log "SDL-probe : SDL_CFLAGS = $SDL_CFLAGS"
213log "SDL-probe : SDL_LIBS = $SDL_LIBS"
214
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800215
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200216EXTRA_CFLAGS="$SDL_CFLAGS"
217EXTRA_LDFLAGS="$SDL_LIBS"
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800218
Alexey Tarasov08823222009-09-01 02:07:51 +1100219case "$OS" in
220 freebsd-*)
221 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -lpthread"
222 ;;
223esac
224
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800225cat > $TMPC << EOF
226#include <SDL.h>
227#undef main
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200228int main( int argc, char** argv ) {
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800229 return SDL_Init (SDL_INIT_VIDEO);
230}
231EOF
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200232feature_check_link SDL_LINKING
233
234if [ $SDL_LINKING != "yes" ] ; then
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800235 echo "You provided an explicit sdl-config script, but the corresponding library"
236 echo "cannot be statically linked with the Android emulator directly."
237 echo "Error message:"
238 cat $TMPL
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200239 clean_exit
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800240fi
241log "SDL-probe : static linking ok"
242
243# now, let's check that the SDL library has the special functions
244# we added to our own sources
245#
246cat > $TMPC << EOF
247#include <SDL.h>
248#undef main
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200249int main( int argc, char** argv ) {
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800250 int x, y;
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200251 SDL_Rect r;
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800252 SDL_WM_GetPos(&x, &y);
253 SDL_WM_SetPos(x, y);
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200254 SDL_WM_GetMonitorDPI(&x, &y);
255 SDL_WM_GetMonitorRect(&r);
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800256 return SDL_Init (SDL_INIT_VIDEO);
257}
258EOF
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200259feature_check_link SDL_LINKING
260
261if [ $SDL_LINKING != "yes" ] ; then
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800262 echo "You provided an explicit sdl-config script in SDL_CONFIG, but the"
263 echo "corresponding library doesn't have the patches required to link"
264 echo "with the Android emulator. Unsetting SDL_CONFIG will use the"
265 echo "sources bundled with the emulator instead"
266 echo "Error:"
267 cat $TMPL
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200268 clean_exit
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800269fi
270
271log "SDL-probe : extra features ok"
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200272clean_temp
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800273
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200274EXTRA_CFLAGS=
275EXTRA_LDFLAGS=
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800276
277###
278### Audio subsystems probes
279###
280PROBE_COREAUDIO=no
281PROBE_ALSA=no
282PROBE_OSS=no
283PROBE_ESD=no
284PROBE_WINAUDIO=no
285
286case "$OS" in
287 darwin*) PROBE_COREAUDIO=yes;
288 ;;
289 linux-*) PROBE_ALSA=yes; PROBE_OSS=yes; PROBE_ESD=yes;
290 ;;
Alexey Tarasov08823222009-09-01 02:07:51 +1100291 freebsd-*) PROBE_OSS=yes;
292 ;;
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800293 windows) PROBE_WINAUDIO=yes
294 ;;
295esac
296
297ORG_CFLAGS=$CFLAGS
298ORG_LDFLAGS=$LDFLAGS
299
300if [ "$PROBE_ESD" = yes ] ; then
301 CFLAGS="$ORG_CFLAGS"
302 LDFLAGS="$ORG_LDFLAGS -ldl"
303 cp -f android/config/check-esd.c $TMPC
304 compile && link && $TMPE
305 if [ $? = 0 ] ; then
306 log "AudioProbe : ESD seems to be usable on this system"
307 else
308 if [ "$OPTION_IGNORE_AUDIO" = no ] ; then
309 echo "the EsounD development files do not seem to be installed on this system"
310 echo "Are you missing the libesd-dev package ?"
311 echo "Correct the errors below and try again:"
312 cat $TMPL
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200313 clean_exit
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800314 fi
315 PROBE_ESD=no
316 log "AudioProbe : ESD seems to be UNUSABLE on this system !!"
317 fi
318fi
319
320if [ "$PROBE_ALSA" = yes ] ; then
321 CFLAGS="$ORG_CFLAGS"
322 LDFLAGS="$ORG_CFLAGS -ldl"
323 cp -f android/config/check-alsa.c $TMPC
324 compile && link && $TMPE
325 if [ $? = 0 ] ; then
326 log "AudioProbe : ALSA seems to be usable on this system"
327 else
328 if [ "$OPTION_IGNORE_AUDIO" = no ] ; then
329 echo "the ALSA development files do not seem to be installed on this system"
330 echo "Are you missing the libasound-dev package ?"
331 echo "Correct the erros below and try again"
332 cat $TMPL
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200333 clean_exit
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800334 fi
335 PROBE_ALSA=no
336 log "AudioProbe : ALSA seems to be UNUSABLE on this system !!"
337 fi
338fi
339
340CFLAGS=$ORG_CFLAGS
341LDFLAGS=$ORG_LDFLAGS
342
343# create the objs directory that is going to contain all generated files
344# including the configuration ones
345#
346mkdir -p objs
347
348###
349### Compiler probe
350###
351
352####
353#### Host system probe
354####
355
356# because the previous version could be read-only
357rm -f $TMPC
358
359# check host endianess
360#
361HOST_BIGENDIAN=no
362cat > $TMPC << EOF
363#include <inttypes.h>
364int main(int argc, char ** argv){
365 volatile uint32_t i=0x01234567;
366 return (*((uint8_t*)(&i))) == 0x67;
367}
368EOF
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200369feature_run_exec HOST_BIGENDIAN
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800370
371# check size of host long bits
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800372cat > $TMPC << EOF
373int main(void) {
374 return sizeof(void*)*8;
375}
376EOF
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200377feature_run_exec HOST_LONGBITS
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800378
379# check whether we have <byteswap.h>
380#
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200381feature_check_header HAVE_BYTESWAP_H "<byteswap.h>"
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800382
383# Build the config.make file
384#
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200385
386create_config_mk
387
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800388PWD=`pwd`
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200389echo "TARGET_ARCH := arm" >> $config_mk
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800390echo "SRC_PATH := $PWD" >> $config_mk
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800391echo "SDL_CONFIG := $SDL_CONFIG" >> $config_mk
392echo "CONFIG_COREAUDIO := $PROBE_COREAUDIO" >> $config_mk
393echo "CONFIG_WINAUDIO := $PROBE_WINAUDIO" >> $config_mk
394echo "CONFIG_ESD := $PROBE_ESD" >> $config_mk
395echo "CONFIG_ALSA := $PROBE_ALSA" >> $config_mk
396echo "CONFIG_OSS := $PROBE_OSS" >> $config_mk
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800397echo "BUILD_STANDALONE_EMULATOR := true" >> $config_mk
David 'Digit' Turnerd68b4872009-07-24 16:33:05 +0200398if [ $OPTION_DEBUG = yes ] ; then
399 echo "BUILD_DEBUG_EMULATOR := true" >> $config_mk
400fi
David 'Digit' Turnerab873b72010-03-08 18:33:50 -0800401if [ $OPTION_STATIC = yes ] ; then
402 echo "CONFIG_STATIC_EXECUTABLE := true" >> $config_mk
403fi
404
David 'Digit' Turnera383d022009-12-03 13:50:00 -0800405if [ -n "$ANDROID_SDK_TOOLS_REVISION" ] ; then
406 echo "ANDROID_SDK_TOOLS_REVISION := $ANDROID_SDK_TOOLS_REVISION" >> $config_mk
407fi
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800408
409# Build the config-host.h file
410#
411config_h=objs/config-host.h
412echo "/* This file was autogenerated by '$PROGNAME' */" > $config_h
413echo "#define CONFIG_QEMU_SHAREDIR \"/usr/local/share/qemu\"" >> $config_h
414echo "#define HOST_LONG_BITS $HOST_LONGBITS" >> $config_h
415if [ "$HAVE_BYTESWAP_H" = "yes" ] ; then
416 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
417fi
418echo "#define CONFIG_GDBSTUB 1" >> $config_h
419echo "#define CONFIG_SLIRP 1" >> $config_h
420echo "#define CONFIG_SKINS 1" >> $config_h
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200421echo "#define CONFIG_TRACE 1" >> $config_h
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800422# the -nand-limits options can only work on non-windows systems
423if [ "$OS" != "windows" ] ; then
424 echo "#define CONFIG_NAND_LIMITS 1" >> $config_h
425fi
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700426echo "#define QEMU_VERSION \"0.10.50\"" >> $config_h
427echo "#define QEMU_PKGVERSION \"Android\"" >> $config_h
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800428case "$CPU" in
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200429 x86) CONFIG_CPU=I386
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800430 ;;
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200431 ppc) CONFIG_CPU=PPC
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800432 ;;
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200433 x86_64) CONFIG_CPU=X86_64
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800434 ;;
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200435 *) CONFIG_CPU=$CPU
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800436 ;;
437esac
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200438echo "#define HOST_$CONFIG_CPU 1" >> $config_h
439BSD=0
440case "$OS" in
441 linux-*) CONFIG_OS=LINUX
442 ;;
443 darwin-*) CONFIG_OS=DARWIN
444 BSD=1
445 ;;
Alexey Tarasov08823222009-09-01 02:07:51 +1100446 freebsd-*) CONFIG_OS=FREEBSD
447 BSD=1
448 ;;
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200449 windows*) CONFIG_OS=WIN32
450 ;;
451 *) CONFIG_OS=$OS
452esac
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700453
David 'Digit' Turnerab873b72010-03-08 18:33:50 -0800454if [ "$OPTION_STATIC" = "yes" ] ; then
455 echo "CONFIG_STATIC_EXECUTABLE := true" >> $config_mk
456 echo "#define CONFIG_STATIC_EXECUTABLE 1" >> $config_h
457fi
458
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700459case $OS in
460 linux-*|darwin-*)
David 'Digit' Turner3d66dc72010-01-27 18:18:41 -0800461 echo "#define CONFIG_IOVEC 1" >> $config_h
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700462 ;;
463esac
464
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200465echo "#define CONFIG_$CONFIG_OS 1" >> $config_h
466if [ $BSD = 1 ] ; then
David 'Digit' Turner2c538c82010-05-10 16:48:20 -0700467 echo "#define CONFIG_BSD 1" >> $config_h
David 'Digit' Turner46be4872009-06-04 16:07:01 +0200468 echo "#define O_LARGEFILE 0" >> $config_h
469 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
470fi
David 'Digit' Turner5d8f37a2009-09-14 14:32:27 -0700471
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -0800472log "Generate : $config_h"
473
474echo "Ready to go. Type 'make' to build emulator"