~ubuntu-branches/debian/sid/stella/sid

« back to all changes in this revision

Viewing changes to .pc/build-with-gcc-4.6.patch/configure

  • Committer: Package Import Robot
  • Author(s): Stephen Kitt
  • Date: 2011-10-26 23:04:32 UTC
  • Revision ID: package-import@ubuntu.com-20111026230432-cxcy9i2k9ylcschw
Tags: 3.4.1-2
* Make Stella available in the "Open With Other Applications..." menu
  in Gnome (and presumably similar entries in other desktop
  environments; LP: #880114).
* Build with gcc 4.6.1 (which identifies itself as gcc 4.6).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# Some things this script could/should do when finished
 
4
#
 
5
# * detect whether it's a GNU compiler or not (for compiler settings)
 
6
# * command line options to...
 
7
#   - override the host settings (for cross compiles
 
8
#   - whether to do a debug build (with -g) or an optimized build (-O3 etc.)
 
9
# * detect whether the chosen backend is available (e.g. call sdl-config)
 
10
# * ....
 
11
 
 
12
 
 
13
# use environment vars if set
 
14
CXXFLAGS="$CXXFLAGS $CPPFLAGS"
 
15
 
 
16
# default lib behaviour yes/no/auto
 
17
_opengl=auto
 
18
_libpng=auto
 
19
_zlib=auto
 
20
 
 
21
# default option behaviour yes/no
 
22
_build_gl=yes
 
23
_build_windowed=yes
 
24
_build_sound=yes
 
25
_build_debugger=yes
 
26
_build_snapshot=yes
 
27
_build_joystick=yes
 
28
_build_cheats=yes
 
29
_build_thumb=yes
 
30
_build_static=no
 
31
_build_profile=no
 
32
 
 
33
# more defaults
 
34
_ranlib=ranlib
 
35
_install=install
 
36
_ar="ar cru"
 
37
_strip=strip
 
38
_mkdir="mkdir -p"
 
39
_echo=printf
 
40
_cat=cat
 
41
_rm="rm -f"
 
42
_rm_rec="$_rm -r"
 
43
_zip="zip -q"
 
44
_cp=cp
 
45
_win32path=""
 
46
_windres=windres
 
47
_sdlconfig=sdl-config
 
48
_sdlpath="$PATH"
 
49
_prefix=/usr/local
 
50
X_LIBS="/usr/X11R6/lib"
 
51
 
 
52
_srcdir=`dirname $0`
 
53
 
 
54
# TODO: We should really use mktemp(1) to determine a random tmp file name.
 
55
# However, that tool might not be available everywhere.
 
56
TMPO=${_srcdir}/stella-conf
 
57
TMPC=${TMPO}.cxx
 
58
TMPLOG=${_srcdir}/config.log
 
59
 
 
60
# For cross compiling
 
61
_host=""
 
62
_host_cpu=""
 
63
_host_vendor=""
 
64
_host_os=""
 
65
_host_prefix=""
 
66
 
 
67
cc_check() {
 
68
        echo >> "$TMPLOG"
 
69
        cat "$TMPC" >> "$TMPLOG"
 
70
        echo >> "$TMPLOG"
 
71
        echo "$CXX $TMPC -o $TMPO$EXEEXT $@" >> "$TMPLOG"
 
72
        rm -f "$TMPO$EXEEXT"
 
73
        ( $CXX "$TMPC" -o "$TMPO$EXEEXT" "$@" ) >> "$TMPLOG" 2>&1
 
74
        TMP="$?"
 
75
        echo >> "$TMPLOG"
 
76
        return "$TMP"
 
77
}
 
78
 
 
79
echocheck () {
 
80
        echo_n "Checking for $@... "
 
81
}
 
82
 
 
83
#
 
84
# Check whether the given command is a working C++ compiler
 
85
#
 
86
test_compiler ()
 
87
{
 
88
cat <<EOF >tmp_cxx_compiler.cpp
 
89
class Foo {
 
90
        int a;
 
91
};
 
92
int main(int argc, char **argv)
 
93
{
 
94
        Foo *a = new Foo();
 
95
        delete a;
 
96
        return 0;
 
97
}
 
98
EOF
 
99
 
 
100
if test -n "$_host"; then
 
101
        # In cross-compiling mode, we cannot run the result
 
102
        eval "$1 -o tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp 2> /dev/null" && rm -f tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp
 
103
else
 
104
        eval "$1 -o tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp 2> /dev/null" && eval "./tmp_cxx_compiler 2> /dev/null" && rm -f tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp
 
105
fi
 
106
}
 
107
 
 
108
#
 
109
# Determine sdl-config
 
110
#
 
111
# TODO: small bit of code to test sdl useability
 
112
find_sdlconfig()
 
113
{
 
114
        echo_n "Looking for sdl-config... "
 
115
        sdlconfigs="$_sdlconfig:sdl-config:sdl11-config:sdl12-config"
 
116
        _sdlconfig=
 
117
        
 
118
        IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="$SEPARATOR"
 
119
        done=0
 
120
        for path_dir in $_sdlpath; do
 
121
                #reset separator to parse sdlconfigs
 
122
                IFS=":"
 
123
                for sdlconfig in $sdlconfigs; do
 
124
                        if test -x "$path_dir/$sdlconfig" ; then
 
125
                                _sdlconfig="$path_dir/$sdlconfig"
 
126
                                done=1
 
127
                                break
 
128
                        fi
 
129
                done
 
130
                if test $done -eq 1 ; then
 
131
                        echo $_sdlconfig
 
132
                        break
 
133
                fi
 
134
        done
 
135
        
 
136
        IFS="$ac_save_ifs"
 
137
        
 
138
        if test -z "$_sdlconfig"; then
 
139
                echo "none found!"
 
140
                exit 1
 
141
        fi
 
142
}
 
143
 
 
144
#
 
145
# Function to provide echo -n for bourne shells that don't have it
 
146
#
 
147
echo_n() 
 
148
 
149
        printf "$@"
 
150
}
 
151
 
 
152
#
 
153
# Greet user
 
154
#
 
155
 
 
156
echo "Running Stella configure..."
 
157
echo "Configure run on" `date` > $TMPLOG
 
158
 
 
159
#
 
160
# Check any parameters we received
 
161
#
 
162
# TODO:
 
163
# * Change --disable-mad / --enable-mad to the way it's done in autoconf:
 
164
#  That is, --without-mad / --with-mad=/prefix/to/mad. Useful for people
 
165
#  who have Mad/Vorbis/ALSA installed in a non-standard locations.
 
166
#
 
167
 
 
168
for parm in "$@" ; do
 
169
  if test "$parm" = "--help" || test "$parm" = "-help" || test "$parm" = "-h" ; then
 
170
    cat << EOF
 
171
 
 
172
Usage: $0 [OPTIONS]...
 
173
 
 
174
Configuration:
 
175
  -h, --help             display this help and exit
 
176
 
 
177
Installation directories:
 
178
  --prefix=DIR           use this prefix for installing stella  [/usr/local]
 
179
  --bindir=DIR           directory to install the stella binary [PREFIX/bin]
 
180
  --docdir=DIR           directory to install documentation     [PREFIX/share/doc/stella]
 
181
  --datadir=DIR          directory to install icons/data files  [PREFIX/share]
 
182
 
 
183
Optional Features:
 
184
  --enable-gl            enable/disable OpenGL rendering support [enabled]
 
185
  --disable-gl
 
186
  --enable-windowed      enable/disable windowed rendering modes [enabled]
 
187
  --disable-windowed
 
188
  --enable-sound         enable/disable sound support [enabled]
 
189
  --disable-sound
 
190
  --enable-debugger      enable/disable all debugger options [enabled]
 
191
  --disable-debugger
 
192
  --enable-joystick      enable/disable joystick support [enabled]
 
193
  --disable-joystick
 
194
  --enable-cheats        enable/disable cheatcode support [enabled]
 
195
  --disable-cheats
 
196
  --enable-shared        build shared binary [enabled]
 
197
  --enable-static        build static binary (if possible) [disabled]
 
198
  --disable-static
 
199
  --enable-profile       build binary with profiling info [disabled]
 
200
  --disable-profile
 
201
  --force-builtin-libpng force use of built-in libpng library [auto]
 
202
  --force-builtin-zlib   force use of built-in zlib library [auto]
 
203
 
 
204
Optional Libraries:
 
205
  --with-sdl-prefix=DIR    Prefix where the sdl-config script is installed (optional)
 
206
  --with-libpng-prefix=DIR Prefix where libpng is installed (optional)
 
207
  --with-zlib-prefix=DIR   Prefix where zlib is installed (optional)
 
208
  --x-libraries            Path to X11 libraries [${X_LIBS}]
 
209
 
 
210
Some influential environment variables:
 
211
  LDFLAGS       linker flags, e.g. -L<lib dir> if you have libraries in a
 
212
                nonstandard directory <lib dir>
 
213
  CXX           C++ compiler command
 
214
  CXXFLAGS      C++ compiler flags
 
215
  CPPFLAGS      C++ preprocessor flags, e.g. -I<include dir> if you have
 
216
                headers in a nonstandard directory <include dir>
 
217
 
 
218
EOF
 
219
    exit 0
 
220
  fi
 
221
done # for parm in ...
 
222
 
 
223
for ac_option in $@; do
 
224
    case "$ac_option" in
 
225
      --enable-gl)              _build_gl=yes        ;;
 
226
      --disable-gl)             _build_gl=no         ;;
 
227
      --enable-windowed)        _build_windowed=yes  ;;
 
228
      --disable-windowed)       _build_windowed=no   ;;
 
229
      --enable-sound)           _build_sound=yes     ;;
 
230
      --disable-sound)          _build_sound=no      ;;
 
231
      --enable-debugger)        _build_debugger=yes  ;;
 
232
      --disable-debugger)       _build_debugger=no   ;;
 
233
      --enable-joystick)        _build_joystick=yes  ;;
 
234
      --disable-joystick)       _build_joystick=no   ;;
 
235
      --enable-cheats)          _build_cheats=yes    ;;
 
236
      --disable-cheats)         _build_cheats=no     ;;
 
237
      --enable-thumb)           _build_thumb=yes     ;;
 
238
      --disable-thumb)          _build_thumb=no      ;;
 
239
      --enable-shared)          _build_static=no     ;;
 
240
      --enable-static)          _build_static=yes    ;;
 
241
      --disable-static)         _build_static=no     ;;
 
242
      --enable-profile)         _build_profile=yes   ;;
 
243
      --disable-profile)        _build_profile=no    ;;
 
244
      --force-builtin-libpng)   _libpng=no           ;;
 
245
      --force-builtin-zlib)     _zlib=no             ;;
 
246
      --with-sdl-prefix=*)
 
247
        arg=`echo $ac_option | cut -d '=' -f 2`
 
248
        _sdlpath="$arg:$arg/bin"
 
249
        ;;
 
250
      --with-libpng-prefix=*)
 
251
        _prefix=`echo $ac_option | cut -d '=' -f 2`
 
252
        LIBPNG_CFLAGS="-I$_prefix/include"
 
253
        LIBPNG_LIBS="-L$_prefix/lib"
 
254
        ;;
 
255
      --with-zlib-prefix=*)
 
256
        _prefix=`echo $ac_option | cut -d '=' -f 2`
 
257
        ZLIB_CFLAGS="-I$_prefix/include"
 
258
        ZLIB_LIBS="-L$_prefix/lib"
 
259
        ;;
 
260
      --x-libraries=*)
 
261
        arg=`echo $ac_option | cut -d '=' -f 2`
 
262
        X_LIBS="$arg"
 
263
        ;;
 
264
      --host=*)
 
265
        _host=`echo $ac_option | cut -d '=' -f 2`
 
266
        ;;
 
267
      --prefix=*)
 
268
        _prefix=`echo $ac_option | cut -d '=' -f 2`
 
269
        ;;
 
270
      --bindir=*)
 
271
        _bindir=`echo $ac_option | cut -d '=' -f 2`
 
272
        ;;
 
273
      --docdir=*)
 
274
        _docdir=`echo $ac_option | cut -d '=' -f 2`
 
275
        ;;
 
276
      --datadir=*)
 
277
        _datadir=`echo $ac_option | cut -d '=' -f 2`
 
278
        ;;
 
279
      *)
 
280
        echo "warning: unrecognised option: $ac_option"
 
281
        ;;
 
282
    esac;
 
283
done;
 
284
 
 
285
CXXFLAGS="$CXXFLAGS $DEBFLAGS"
 
286
 
 
287
case $_host in
 
288
#linupy)
 
289
#       _host_os=linux
 
290
#       _host_cpu=arm
 
291
#       ;;
 
292
#arm-riscos-aof)
 
293
#       _host_os=riscos
 
294
#       _host_cpu=arm
 
295
#       ;;
 
296
#ppc-amigaos)
 
297
#       _host_os=amigaos
 
298
#       _host_cpu=ppc
 
299
#       ;;
 
300
gp2x)
 
301
        _host_os=gp2x
 
302
        _host_cpu=arm
 
303
        _host_prefix=arm-open2x-linux
 
304
        ;;
 
305
mingw32-cross)
 
306
        _host_os=mingw32msvc
 
307
        _host_cpu=i386
 
308
        _host_prefix=i386-mingw32msvc
 
309
        ;;
 
310
*)
 
311
        guessed_host=`$_srcdir/config.guess`
 
312
        _host_cpu=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 
313
        _host_os=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 
314
        _host_vendor=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
 
315
        ;;
 
316
esac
 
317
 
 
318
#
 
319
# Determine extension used for executables
 
320
#
 
321
case $_host_os in
 
322
mingw* | cygwin* |os2-emx*)
 
323
        EXEEXT=".exe"
 
324
        ;;
 
325
arm-riscos-aof)
 
326
        EXEEXT=",ff8"
 
327
        ;;
 
328
psp)
 
329
        EXEEXT=".elf"
 
330
        ;;
 
331
gp2x)
 
332
        EXEEXT=""
 
333
        ;;
 
334
*)
 
335
        EXEEXT=""
 
336
        ;;
 
337
esac
 
338
 
 
339
#
 
340
# Determine separator used for $PATH
 
341
#
 
342
case $_host_os in
 
343
os2-emx* )
 
344
        SEPARATOR=";"
 
345
        ;;
 
346
* )
 
347
        SEPARATOR=":"
 
348
        ;;
 
349
esac
 
350
 
 
351
 
 
352
#
 
353
# Determine the C++ compiler
 
354
#
 
355
echo_n "Looking for C++ compiler... "
 
356
if test -n "$_host"; then
 
357
        compilers="$CXX $_host_prefix-g++ $_host_prefix-c++ $_host_cpu-$_host_os-g++ $_host_cpu-$_host_os-c++"
 
358
else
 
359
        compilers="$CXX g++ c++"
 
360
fi
 
361
 
 
362
for compiler in $compilers; do
 
363
        if test_compiler $compiler; then
 
364
                CXX=$compiler
 
365
                echo $CXX
 
366
                break
 
367
        fi
 
368
done
 
369
if test -z $CXX; then
 
370
        echo "none found!"
 
371
        exit 1
 
372
fi
 
373
 
 
374
#
 
375
# Determine the compiler version
 
376
 
 
377
echocheck "compiler version"
 
378
 
 
379
cxx_name=`( $cc -v ) 2>&1 | tail -n 1 | cut -d ' ' -f 1`
 
380
cxx_version=`( $CXX -dumpversion ) 2>&1`
 
381
if test "$?" -gt 0; then
 
382
        cxx_version="not found"
 
383
fi
 
384
 
 
385
case $cxx_version in
 
386
        2.95.[2-9]|2.95.[2-9][-.]*|3.[0-9]|3.[0-9].[0-9]|3.[0-9].[0-9][-.]*|4.[0-9].[0-9]|4.[0-9].[0-9][-.]*)
 
387
                _cxx_major=`echo $cxx_version | cut -d '.' -f 1`
 
388
                _cxx_minor=`echo $cxx_version | cut -d '.' -f 2`
 
389
                cxx_version="$cxx_version, ok"
 
390
                cxx_verc_fail=no
 
391
                ;;
 
392
        # whacky beos version strings
 
393
        2.9-beos-991026*|2.9-beos-000224*)      
 
394
                _cxx_major=2
 
395
                _cxx_minor=95
 
396
                cxx_version="$cxx_version, ok"
 
397
                cxx_verc_fail=no
 
398
                ;;
 
399
        3_4)
 
400
                _cxx_major=3
 
401
                _mxx_minor=4
 
402
                ;;
 
403
        'not found')
 
404
                cxx_verc_fail=yes
 
405
                ;;
 
406
        *)
 
407
                cxx_version="$cxx_version, bad"
 
408
                cxx_verc_fail=yes
 
409
                ;;
 
410
esac
 
411
 
 
412
echo "$cxx_version"
 
413
 
 
414
if test "$cxx_verc_fail" = yes ; then
 
415
        echo
 
416
        echo "The version of your compiler is not supported at this time"
 
417
        echo "Please ensure you are using GCC 2.95.x or GCC 3.x"
 
418
        exit 1  
 
419
fi
 
420
 
 
421
#
 
422
# Do CXXFLAGS now we know the compiler version
 
423
#
 
424
 
 
425
if test "$_cxx_major" -ge "3" ; then
 
426
        CXXFLAGS="$CXXFLAGS"
 
427
        _make_def_HAVE_GCC3='HAVE_GCC3 = 1'
 
428
fi;
 
429
 
 
430
if test -n "$_host"; then
 
431
        # Cross-compiling mode - add your target here if needed
 
432
        case "$_host" in
 
433
#               linupy|arm-riscos-aof)
 
434
#                       echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
 
435
#                       DEFINES="$DEFINES -DUNIX"
 
436
#                       _def_endianness='#define SCUMM_LITTLE_ENDIAN'
 
437
#                       _def_align='#define SCUMM_NEED_ALIGNMENT'
 
438
#                       _def_linupy="#define DLINUPY"
 
439
#                       type_1_byte='char'
 
440
#                       type_2_byte='short'
 
441
#                       type_4_byte='int'
 
442
#                       ;;
 
443
#               ppc-amigaos)
 
444
#                       echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
 
445
#                       _def_endianness='#define SCUMM_BIG_ENDIAN'
 
446
#                       _def_align='#define     SCUMM_NEED_ALIGNMENT'
 
447
#                       type_1_byte='char'
 
448
#                       type_2_byte='short'
 
449
#                       type_4_byte='long'
 
450
#                       CXXFLAGS="$CFLAGS -newlib -mstrict-align -mcpu=750 -mtune=7400"
 
451
#                       LDFLAGS="$LDFLAGS -newlib"
 
452
#                       ;;
 
453
                gp2x)
 
454
                        echo "Cross-compiling to $_host, forcing static build, and disabling OpenGL."
 
455
                        _build_static=yes
 
456
                        _build_gl=no
 
457
                        _build_windowed=no
 
458
                        ;;
 
459
                mingw32-cross)
 
460
                        echo "Cross-compiling for Win32 using MinGW."
 
461
                        DEFINES="$DEFINES -DWIN32"
 
462
                        _host_os=win32
 
463
                        ;;
 
464
                *)
 
465
                        echo "Cross-compiling to unknown target, please add your target to configure."
 
466
                        exit 1
 
467
                        ;;
 
468
        esac
 
469
        
 
470
else
 
471
        #
 
472
        # Determine build settings
 
473
        #
 
474
        # TODO - also add an command line option to override this?!?
 
475
        echo_n "Checking hosttype... "
 
476
        echo $_host_os
 
477
        case $_host_os in
 
478
                linux* | openbsd* | freebsd* | kfreebsd* | netbsd* | bsd* | gnu0.3 | sunos* | hpux* | beos*)
 
479
                        DEFINES="$DEFINES -DUNIX"
 
480
                        _host_os=unix
 
481
                        ;;
 
482
                irix*)
 
483
                        DEFINES="$DEFINES -DUNIX"
 
484
                        _ranlib=:
 
485
                        _host_os=unix
 
486
                        ;;
 
487
                mingw*)
 
488
                        DEFINES="$DEFINES -DWIN32"
 
489
                        _host_os=win32
 
490
                        ;;
 
491
                cygwin*)
 
492
                        DEFINES="$DEFINES -mno-cygwin -DWIN32"
 
493
                        LIBS="$LIBS -mno-cygwin -lmingw32 -lwinmm"
 
494
                        _host_os=win32
 
495
                        ;;
 
496
                os2*)
 
497
                        DEFINES="$DEFINES -DUNIX -DOS2"
 
498
                        _host_os=unix
 
499
                        ;;
 
500
                # given this is a shell script assume some type of unix
 
501
                *)
 
502
                        echo "WARNING: could not establish system type, assuming unix like"
 
503
                        DEFINES="$DEFINES -DUNIX"
 
504
                        ;;
 
505
        esac
 
506
fi
 
507
 
 
508
# Cross-compilers use their own commands for the following functions
 
509
if test -n "$_host_prefix"; then
 
510
        _strip="$_host_prefix-$_strip"
 
511
        _windres="$_host_prefix-$_windres"
 
512
fi
 
513
 
 
514
#
 
515
# Check for libpng
 
516
#
 
517
echocheck "libpng"
 
518
if test "$_libpng" = auto ; then
 
519
        _libpng=no
 
520
        cat > $TMPC << EOF
 
521
#include <stdio.h>
 
522
#include <png.h>
 
523
int main(void) { return printf("%s\n", PNG_HEADER_VERSION_STRING); }
 
524
EOF
 
525
        cc_check $LDFLAGS $CXXFLAGS $LIBPNG_CFLAGS $LIBPNG_LIBS -lpng && _libpng=yes
 
526
fi
 
527
if test "$_libpng" = yes ; then
 
528
        echo "$_libpng"
 
529
else
 
530
        echo "none found, using built-in version"
 
531
fi
 
532
 
 
533
#
 
534
# Check for ZLib
 
535
#
 
536
echocheck "zlib"
 
537
if test "$_zlib" = auto ; then
 
538
        _zlib=no
 
539
        cat > $TMPC << EOF
 
540
#include <string.h>
 
541
#include <zlib.h>
 
542
int main(void) { return strcmp(ZLIB_VERSION, zlibVersion()); }
 
543
EOF
 
544
        cc_check $LDFLAGS $CXXFLAGS $ZLIB_CFLAGS $ZLIB_LIBS -lz && _zlib=yes
 
545
fi
 
546
if test "$_zlib" = yes ; then
 
547
        echo "$_zlib"
 
548
else
 
549
        echo "none found, using built-in version"
 
550
fi
 
551
 
 
552
#
 
553
# Check for GL
 
554
#
 
555
echocheck "opengl"
 
556
if test "$_opengl" = auto ; then
 
557
        _opengl=no
 
558
        cat > $TMPC << EOF
 
559
#include <string.h>
 
560
#include <GL/gl.h>
 
561
#include <GL/glu.h>
 
562
int main(void) { return 0; }
 
563
EOF
 
564
        cc_check $LDFLAGS $CXXFLAGS && _opengl=yes
 
565
fi
 
566
echo "$_opengl"
 
567
 
 
568
#
 
569
# figure out installation directories
 
570
#
 
571
test -z "$_bindir" && _bindir="$_prefix/bin"
 
572
test -z "$_docdir" && _docdir="$_prefix/share/doc/stella"
 
573
test -z "$_datadir" && _datadir="$_prefix/share"
 
574
 
 
575
echo
 
576
echo_n "Summary:"
 
577
echo
 
578
 
 
579
if test "$_build_gl" = "yes" ; then
 
580
        if test "$_opengl" = "yes" ; then
 
581
                echo_n "   OpenGL rendering enabled"
 
582
                echo
 
583
        else
 
584
                echo_n "   OpenGL rendering disabled (missing OpenGL headers)"
 
585
                echo
 
586
                _build_gl=no
 
587
        fi
 
588
else
 
589
        echo_n "   OpenGL rendering disabled"
 
590
        echo
 
591
fi
 
592
 
 
593
if test "$_build_windowed" = "yes" ; then
 
594
        echo_n "   Windowed rendering modes enabled"
 
595
        echo
 
596
else
 
597
        echo_n "   Windowed rendering modes disabled"
 
598
        echo
 
599
fi
 
600
 
 
601
if test "$_build_sound" = "yes" ; then
 
602
        echo_n "   Sound support enabled"
 
603
        echo
 
604
else
 
605
        echo_n "   Sound support disabled"
 
606
        echo
 
607
fi
 
608
 
 
609
if test "$_build_debugger" = "yes" ; then
 
610
        echo_n "   Debugger support enabled"
 
611
        echo
 
612
else
 
613
        echo_n "   Debugger support disabled"
 
614
        echo
 
615
fi
 
616
 
 
617
if test "$_build_snapshot" = "yes" ; then
 
618
        echo_n "   Snapshot support enabled"
 
619
        echo
 
620
else
 
621
        echo_n "   Snapshot support disabled"
 
622
        echo
 
623
fi
 
624
 
 
625
if test "$_build_joystick" = yes ; then
 
626
        echo_n "   Joystick support enabled"
 
627
        echo
 
628
else
 
629
        echo_n "   Joystick support disabled"
 
630
        echo
 
631
fi
 
632
 
 
633
if test "$_build_cheats" = yes ; then
 
634
        echo_n "   Cheatcode support enabled"
 
635
        echo
 
636
else
 
637
        echo_n "   Cheatcode support disabled"
 
638
        echo
 
639
fi
 
640
 
 
641
if test "$_build_thumb" = yes ; then
 
642
        echo_n "   Thumb ARM emulation support enabled"
 
643
        echo
 
644
else
 
645
        echo_n "   Thumb ARM emulation support disabled"
 
646
        echo
 
647
fi
 
648
 
 
649
if test "$_build_static" = yes ; then
 
650
        echo_n "   Static binary enabled"
 
651
        echo
 
652
else
 
653
        echo_n "   Static binary disabled"
 
654
        echo
 
655
fi
 
656
 
 
657
if test "$_build_profile" = yes ; then
 
658
        echo_n "   Profiling enabled"
 
659
        echo
 
660
else
 
661
        echo_n "   Profiling disabled"
 
662
        echo
 
663
fi
 
664
 
 
665
 
 
666
#
 
667
# Now, add the appropriate defines/libraries/headers
 
668
#
 
669
echo
 
670
find_sdlconfig
 
671
 
 
672
SRC="src"
 
673
CORE="$SRC/emucore"
 
674
COMMON="$SRC/common"
 
675
GUI="$SRC/gui"
 
676
DBG="$SRC/debugger"
 
677
DBGGUI="$SRC/debugger/gui"
 
678
YACC="$SRC/yacc"
 
679
CHEAT="$SRC/cheat"
 
680
LIBPNG="$SRC/libpng"
 
681
ZLIB="$SRC/zlib"
 
682
 
 
683
INCLUDES="-I$CORE -I$COMMON -I$GUI"
 
684
 
 
685
INCLUDES="$INCLUDES `$_sdlconfig --cflags`"
 
686
if test "$_build_static" = yes ; then
 
687
        _sdl_conf_libs="--static-libs"
 
688
        LDFLAGS="-static $LDFLAGS"
 
689
else
 
690
        _sdl_conf_libs="--libs"
 
691
fi
 
692
 
 
693
LIBS="$LIBS `$_sdlconfig $_sdl_conf_libs`"
 
694
LD=$CXX 
 
695
case $_host_os in
 
696
                unix)
 
697
                        DEFINES="$DEFINES -DBSPF_UNIX -DHAVE_GETTIMEOFDAY -DHAVE_INTTYPES"
 
698
                        MODULES="$MODULES $SRC/unix"
 
699
                        INCLUDES="$INCLUDES -I$SRC/unix"
 
700
 
 
701
                        #
 
702
                        # Check for X11
 
703
                        #
 
704
                        _x11=no
 
705
                        cat > $TMPC << EOF
 
706
                        #include <X11/Xutil.h>
 
707
                        int main(void) { return 0; }
 
708
EOF
 
709
                        cc_check $LDFLAGS $CXXFLAGS -lX11 && _x11=yes
 
710
                        if test "$_x11" = yes ; then
 
711
                                DEFINES="$DEFINES -DHAVE_X11"
 
712
                                LIBS="$LIBS -lX11"
 
713
                        fi
 
714
                        ;;
 
715
                win32)
 
716
                        DEFINES="$DEFINES -DBSPF_WIN32 -DHAVE_GETTIMEOFDAY -DHAVE_INTTYPES"
 
717
                        MODULES="$MODULES $SRC/win32"
 
718
                        INCLUDES="$INCLUDES -I$SRC/win32"
 
719
                        LIBS="$LIBS -lmingw32 -lwinmm"
 
720
                        ;;
 
721
                gp2x)
 
722
                        # -O3 hangs the GP2X, do not use.
 
723
                        CXXFLAGS="-O2 -finline-functions -mtune=arm920t"
 
724
                        DEFINES="$DEFINES -DBSPF_GP2X -DGP2X -DHAVE_GETTIMEOFDAY -DHAVE_INTTYPES"
 
725
                        MODULES="$MODULES $SRC/gp2x"
 
726
                        INCLUDES="$INCLUDES -I$SRC/gp2x $ZLIB_CFLAGS"
 
727
                        
 
728
                        _ranlib="arm-linux-ranlib"
 
729
                        _ar="arm-linux-ar cru"
 
730
                        ;;
 
731
                *)
 
732
                        echo "WARNING: host system not currenty supported"
 
733
                        exit
 
734
                        ;;
 
735
esac
 
736
 
 
737
if test "$_libpng" = yes ; then
 
738
  LIBS="$LIBS -lpng"
 
739
else
 
740
        MODULES="$MODULES $LIBPNG"
 
741
        INCLUDES="$INCLUDES -I$LIBPNG"
 
742
fi
 
743
 
 
744
if test "$_zlib" = yes ; then
 
745
  LIBS="$LIBS -lz"
 
746
else
 
747
        MODULES="$MODULES $ZLIB"
 
748
        INCLUDES="$INCLUDES -I$ZLIB"
 
749
fi
 
750
 
 
751
if test "$_build_gl" = yes ; then
 
752
        DEFINES="$DEFINES -DDISPLAY_OPENGL"
 
753
fi
 
754
 
 
755
if test "$_build_windowed" = yes ; then
 
756
        DEFINES="$DEFINES -DWINDOWED_SUPPORT"
 
757
fi
 
758
 
 
759
if test "$_build_sound" = yes ; then
 
760
        DEFINES="$DEFINES -DSOUND_SUPPORT"
 
761
fi
 
762
 
 
763
if test "$_build_debugger" = yes ; then
 
764
        DEFINES="$DEFINES -DDEBUGGER_SUPPORT"
 
765
        MODULES="$MODULES $DBG $DBGGUI $YACC"
 
766
        INCLUDES="$INCLUDES -I$DBG -I$DBGGUI -I$YACC"
 
767
fi
 
768
 
 
769
if test "$_build_snapshot" = yes ; then
 
770
        DEFINES="$DEFINES -DSNAPSHOT_SUPPORT"
 
771
fi
 
772
 
 
773
if test "$_build_joystick" = yes ; then
 
774
        DEFINES="$DEFINES -DJOYSTICK_SUPPORT"
 
775
fi
 
776
 
 
777
if test "$_build_cheats" = yes ; then
 
778
        DEFINES="$DEFINES -DCHEATCODE_SUPPORT"
 
779
        MODULES="$MODULES $CHEAT"
 
780
        INCLUDES="$INCLUDES -I$CHEAT"
 
781
fi
 
782
 
 
783
if test "$_build_thumb" = yes ; then
 
784
        DEFINES="$DEFINES -DTHUMB_SUPPORT"
 
785
fi
 
786
 
 
787
if test "$_build_profile" = no ; then
 
788
        _build_profile=
 
789
fi
 
790
 
 
791
 
 
792
echo "Creating config.mak"
 
793
cat > config.mak << EOF
 
794
# -------- Generated by configure -----------
 
795
 
 
796
CXX := $CXX
 
797
CXXFLAGS := $CXXFLAGS
 
798
LD := $LD
 
799
LIBS += $LIBS
 
800
RANLIB := $_ranlib
 
801
INSTALL := $_install
 
802
AR := $_ar
 
803
MKDIR := $_mkdir
 
804
ECHO := $_echo
 
805
CAT := $_cat
 
806
RM := $_rm
 
807
RM_REC := $_rm_rec
 
808
ZIP := $_zip
 
809
CP := $_cp
 
810
WIN32PATH=$_win32path
 
811
STRIP := $_strip
 
812
WINDRES := $_windres
 
813
 
 
814
MODULES += $MODULES
 
815
MODULE_DIRS += $MODULE_DIRS
 
816
EXEEXT := $EXEEXT
 
817
 
 
818
PREFIX := $_prefix
 
819
BINDIR := $_bindir
 
820
DOCDIR := $_docdir
 
821
DATADIR := $_datadir
 
822
PROFILE := $_build_profile
 
823
 
 
824
$_make_def_HAVE_GCC3
 
825
 
 
826
INCLUDES += $INCLUDES
 
827
OBJS += $OBJS
 
828
DEFINES += $DEFINES
 
829
LDFLAGS += $LDFLAGS
 
830
EOF
 
831
 
 
832
# This should be taken care of elsewhere, but I'm not sure where
 
833
rm -f stella-conf*