-
Notifications
You must be signed in to change notification settings - Fork 53
/
configure
executable file
·2054 lines (1863 loc) · 52.1 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
#
# configure -- custom configure script for the ScummVM tools.
#
# ScummVM Tools is the legal property of its developers, whose names
# are too numerous to list here. Please refer to the COPYRIGHT
# file distributed with this source distribution.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Save the current environment variables for next runs
SAVED_CONFIGFLAGS=$@
SAVED_LDFLAGS=$LDFLAGS
SAVED_PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-unset}
SAVED_CXX=$CXX
SAVED_CXXFLAGS=$CXXFLAGS
SAVED_CPPFLAGS=$CPPFLAGS
SAVED_ASFLAGS=$ASFLAGS
SAVED_WINDRESFLAGS=$WINDRESFLAGS
# Use environment vars if set
CXXFLAGS="$CXXFLAGS $CPPFLAGS"
# Backslashes into forward slashes:
# The following OS/2 specific code is performed to deal with handling of backslashes by ksh.
# Borrowed from the Sane configure script
if test "$ac_emxsupport" != "no" -a "$ac_emxsupport" != "NO"; then
ac_save_IFS="$IFS"
IFS="\\"
ac_TEMP_PATH=
for ac_dir in $PATH; do
IFS=$ac_save_IFS
if test -z "$ac_TEMP_PATH"; then
ac_TEMP_PATH="$ac_dir"
else
ac_TEMP_PATH="$ac_TEMP_PATH/$ac_dir"
fi
done
PATH="$ac_TEMP_PATH"
export PATH
unset ac_TEMP_PATH
fi
set_var() {
eval ${1}='${2}'
}
get_var() {
eval echo \$${1}
}
_srcdir=`dirname $0`
#
# Default settings
#
# Default lib behavior yes/no/auto
_vorbis=auto
_tremor=auto
_flac=auto
_mad=auto
_zlib=auto
_png=auto
_freetype2=auto
_wxwidgets=auto
_iconv=auto
_boost=auto
_endian=unknown
_need_memalign=no
# Default option behavior yes/no
_debug_build=auto
_release_build=auto
_verbose_build=no
_enable_prof=no
_use_cxx11=yes
# Default commands
_ranlib=ranlib
_strip=strip
_ar="ar cru"
_as="as"
_windres=windres
_pkgconfig=pkg-config
_wxconfig=wx-config
_wxpath="$PATH"
_prefix=/usr/local
_wxincludes=""
_wxlibs=""
_wxstaticlibs=""
_freetypeconfig=freetype-config
_freetype_found="false"
_freetypepath="$PATH"
_staticlibpath=""
_xcodetoolspath=""
_amigaospath="install"
_morphospath="PROGDIR:"
# For cross compiling
_host=""
_host_cpu=""
_host_vendor=""
_host_os=""
_host_alias=""
# Use temp files in the build directory
TMPO=./scummvm-tools-conf
TMPC=${TMPO}.cpp
TMPLOG=config.log
cc_check_no_clean() {
echo >> "$TMPLOG"
cat "$TMPC" >> "$TMPLOG"
echo >> "$TMPLOG"
echo "$CXX $LDFLAGS $CXXFLAGS $TMPC -o $TMPO$HOSTEXEEXT $@" >> "$TMPLOG"
rm -f "$TMPO$HOSTEXEEXT"
( $CXX $LDFLAGS $CXXFLAGS "$TMPC" -o "$TMPO$HOSTEXEEXT" "$@" ) >> "$TMPLOG" 2>&1
TMPR="$?"
echo "return code: $TMPR" >> "$TMPLOG"
echo >> "$TMPLOG"
return "$TMPR"
}
cc_check_clean() {
rm -rf $TMPC $TMPO $TMPO.o $TMPO.dSYM $TMPO$HOSTEXEEXT "$@"
}
cc_check() {
cc_check_no_clean "$@"
TMPR="$?"
cc_check_clean
return "$TMPR"
}
cc_check_define() {
cat > $TMPC << EOF
int main(void) {
#ifndef $1
syntax error
#endif
return 0;
}
EOF
cc_check -c
return $?
}
gcc_get_define() {
echo "" | $CXX -dM -E - | fgrep "$1" | head -n1 | cut -d ' ' -f 3-
}
#
# Function to provide echo -n for bourne shells that don't have it
#
echo_n() {
printf "$@"
}
echocheck() {
echo_n "Checking for $@... "
}
# Add a line of data to config.mk.
add_line_to_config_mk() {
_config_mk_data="$_config_mk_data"'
'"$1"
}
# Add a line of data to config.h.
add_line_to_config_h() {
_config_h_data="$_config_h_data"'
'"$1"
}
# Conditionally add a line of data to config.h. Takes two parameters:
# The first one can be set to 'no' to "comment out" the line, i.e.
# make it ineffective, use 'yes' otherwise.
# The second param is the line to insert.
add_to_config_h_if_yes() {
if test "$1" = yes ; then
add_line_to_config_h "$2"
else
add_line_to_config_h "/* $2 */"
fi
}
# Conditionally add a line of data to config.mk. Takes two parameters:
# The first one can be set to 'no' to "comment out" the line, i.e.
# make it ineffective, use 'yes' otherwise.
# The second param is the line to insert.
add_to_config_mk_if_yes() {
if test "$1" = yes ; then
add_line_to_config_mk "$2"
else
add_line_to_config_mk "# $2"
fi
}
# Conditionally add a '#define' line to config.h. Takes two parameters:
# The first one can be set to 'yes' or 'no'. If 'yes' is used, then
# the line "#define $2" is added to config.h, otherwise "#undef $2".
define_in_config_h_if_yes() {
if test "$1" = yes ; then
add_line_to_config_h "#define $2"
else
add_line_to_config_h "#undef $2"
fi
}
# Conditionally add definitions to config.h and config.mk. Takes two parameters:
# The first one can be set to 'yes' or 'no'. If 'yes' is used, then
# the line "#define $2" is added to config.h and "$2 = 1" to config.mk.
# Otherwise "#undef $2" is added to config.h and "# $2 = 1" to config.mk
define_in_config_if_yes() {
if test "$1" = yes ; then
add_line_to_config_h "#define $2"
add_line_to_config_mk "$2 = 1"
else
add_line_to_config_h "#undef $2"
add_line_to_config_mk "# $2 = 1"
fi
}
#
# Determine wx-config
#
# TODO: small bit of code to test wxWidgets usability
find_wxconfig() {
echo_n "Looking for wx-config... "
wxconfigs="$_wxconfig:wxgtk2-2.8-config"
_wxconfig=
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="$SEPARATOR"
for path_dir in $_wxpath; do
#reset separator to parse wxconfigs
IFS=":"
for wxconfig in $wxconfigs; do
if test -f "$path_dir/$wxconfig" ; then
_wxconfig="$path_dir/$wxconfig"
echo $_wxconfig
# Save the prefix
_wxpath=$path_dir
if test `basename $path_dir` = bin ; then
_wxpath=`dirname $path_dir`
fi
# break at first wx-config found in path
break 2
fi
done
done
IFS="$ac_save_ifs"
if test -z "$_wxconfig"; then
echo "none found!"
fi
}
#
# Determine freetype-config
#
find_freetypeconfig() {
echo_n "Looking for freetype-config... "
freetypeconfigs="$_freetypeconfig"
_freetypeconfig=
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="$SEPARATOR"
for path_dir in $_freetypepath; do
#reset separator to parse freetypeconfigs
IFS=":"
for freetypeconfig in $freetypeconfigs; do
if test -f "$path_dir/$freetypeconfig" ; then
_freetypeconfig="$path_dir/$freetypeconfig"
echo $_freetypeconfig
# Save the prefix
_freetypepath=$path_dir
if test `basename $path_dir` = bin ; then
_freetypepath=`dirname $path_dir`
fi
# break at first freetype-config found in path
break 2
fi
done
done
IFS="$ac_save_ifs"
if test -z "$_freetypeconfig"; then
echo "none found!"
fi
}
#
# Determine extension used for executables
#
get_system_exe_extension() {
case $1 in
riscos)
_exeext=",e1f"
;;
dreamcast | ds | gamecube | n64 | ps2 | psp | wii)
_exeext=".elf"
;;
gph-linux)
_exeext=".gph"
;;
mingw* | *os2-emx | wince)
_exeext=".exe"
;;
*)
_exeext=""
;;
esac
}
#
# Generic options functions
#
# Show the configure help line for an option
option_help() {
tmpopt=`echo $1 | sed 's/_/-/g'`
option=`echo "--${tmpopt} " | sed "s/\(.\{23\}\).*/\1/"`
echo " ${option} ${2}"
}
# Show an error about an unknown option
option_error() {
echo "error: unrecognized option: $ac_option
Try \`$0 --help' for more information." >&2
exit 1
}
#
# Greet user
#
echo "Running ScummVM Tools configure..."
echo "Configure run on" `date` > $TMPLOG
#
# Check any parameters we received
#
for parm in "$@" ; do
if test "$parm" = "--help" || test "$parm" = "-help" || test "$parm" = "-h" ; then
cat << EOF
Usage: $0 [OPTIONS]...
Configuration:
-h, --help display this help and exit
Installation directories:
--prefix=DIR use this prefix for installing the ScummVM Tools [/usr/local]
--bindir=DIR directory to install the tool binaries in [PREFIX/bin]
--datadir=DIR directory to install the GUI tool media files in [PREFIX/share]
--mandir=DIR directory to install the manpage in [PREFIX/share/man]
--libdir=DIR directory to install the plugins in [PREFIX/lib]
Special configuration feature:
--host=HOST cross-compile to target HOST (arm-linux, ...)
Optional Features:
--disable-c++11 disable building as C++11 when the compiler allows that
--disable-debug disable building with debugging symbols
--enable-Werror treat warnings as errors
--enable-profiling enable profiling
--enable-verbose-build enable regular echoing of commands during build
process
Optional Libraries:
--with-ogg-prefix=DIR Prefix where libogg is installed (optional)
--with-vorbis-prefix=DIR Prefix where libvorbis is installed (optional)
--disable-vorbis disable Ogg Vorbis support [autodetect]
--with-tremor-prefix=DIR Prefix where tremor is installed (optional)
--disable-tremor disable tremor support [autodetect]
--with-mad-prefix=DIR Prefix where libmad is installed (optional)
--disable-mad disable libmad (MP3) support [autodetect]
--with-flac-prefix=DIR Prefix where libFLAC is installed (optional)
--disable-flac disable FLAC support [autodetect]
--with-zlib-prefix=DIR Prefix where zlib is installed (optional)
--disable-zlib disable zlib (compression) support [autodetect]
--with-png-prefix=DIR Prefix where libpng is installed (optional)
--disable-png disable libpng (compression) support [autodetect]
--with-freetype2-prefix=DIR prefix where the freetype-config script is
installed (optional)
--disable-freetype2 disable freetype2 TTF library usage [autodetect]
--with-wx-prefix=DIR Prefix where wxwidgets is installed (optional)
--disable-wxwidgets disable wxwidgets (GUI) support [autodetect]
--disable-iconv disable iconv (Japanese font) support [autodetect]
--with-boost-prefix=DIR Prefix where Boost is installed (optional)
--disable-boost disable Boost support [autodetect]
Some influential environment variables:
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CONFIGURE_NO_HOST Ignore the cross-compile target set by the --host= option
CPPFLAGS C++ preprocessor flags, e.g. -I<include dir> if you have
headers in a nonstandard directory <include dir>
PKG_CONFIG_LIBDIR list of directories where pkg-config ‘.pc’ files are
looked up
EOF
exit 0
fi
done # for parm in ...
for ac_option in $@; do
case "$ac_option" in
# Silently ignore options valid for Autotools configure.
--build=*) ;;
--exec-prefix=*) ;;
--program-prefix=*) ;;
--sbindir=*) ;;
--sysconfdir=*) ;;
--includedir=*) ;;
--libexecdir=*) ;;
--localstatedir=*) ;;
--sharedstatedir=*) ;;
--infodir=*) ;;
--disable-dependency-tracking) ;;
--enable-dependency-tracking) ;;
# End of ignored options.
--enable-vorbis) _vorbis=yes ;;
--disable-vorbis) _vorbis=no ;;
--enable-tremor) _tremor=yes ;;
--disable-tremor) _tremor=no ;;
--enable-flac) _flac=yes ;;
--disable-flac) _flac=no ;;
--enable-mad) _mad=yes ;;
--disable-mad) _mad=no ;;
--enable-zlib) _zlib=yes ;;
--disable-zlib) _zlib=no ;;
--enable-png) _png=yes ;;
--disable-png) _png=no ;;
--enable-freetype2) _freetype2=yes ;;
--disable-freetype2) _freetype2=no ;;
--enable-wxwidgets) _wxwidgets=yes ;;
--disable-wxwidgets) _wxwidgets=no ;;
--enable-iconv) _iconv=yes ;;
--disable-iconv) _iconv=no ;;
--enable-boost) _boost=yes ;;
--disable-boost) _boost=no ;;
--enable-verbose-build) _verbose_build=yes ;;
--with-ogg-prefix=*)
arg=`echo $ac_option | cut -d '=' -f 2`
OGG_CFLAGS="-I$arg/include"
OGG_LIBS="-L$arg/lib"
;;
--with-vorbis-prefix=*)
arg=`echo $ac_option | cut -d '=' -f 2`
VORBIS_CFLAGS="-I$arg/include"
VORBIS_LIBS="-L$arg/lib"
;;
--with-tremor-prefix=*)
arg=`echo $ac_option | cut -d '=' -f 2`
TREMOR_CFLAGS="-I$arg/include"
TREMOR_LIBS="-L$arg/lib"
;;
--with-flac-prefix=*)
arg=`echo $ac_option | cut -d '=' -f 2`
FLAC_CFLAGS="-I$arg/include"
FLAC_LIBS="-L$arg/lib"
;;
--with-mad-prefix=*)
arg=`echo $ac_option | cut -d '=' -f 2`
MAD_CFLAGS="-I$arg/include"
MAD_LIBS="-L$arg/lib"
;;
--with-zlib-prefix=*)
arg=`echo $ac_option | cut -d '=' -f 2`
ZLIB_CFLAGS="-I$arg/include"
ZLIB_LIBS="-L$arg/lib"
;;
--with-png-prefix=*)
arg=`echo $ac_option | cut -d '=' -f 2`
PNG_CFLAGS="-I$arg/include"
PNG_LIBS="-L$arg/lib"
;;
--with-freetype2-prefix=*)
arg=`echo $ac_option | cut -d '=' -f 2`
_freetypepath="$arg:$arg/bin"
;;
--with-wx-prefix=*)
arg=`echo $ac_option | cut -d '=' -f 2`
_wxpath="$arg:$arg/bin"
;;
--with-boost-prefix=*)
arg=`echo $ac_option | cut -d '=' -f 2`
BOOST_CFLAGS="-I$arg/include"
BOOST_LIBS="-L$arg/lib"
;;
--with-staticlib-prefix=*)
_staticlibpath=`echo $ac_option | cut -d '=' -f 2`
;;
--with-xcodetools-path=*)
_xcodetoolspath=`echo $ac_option | cut -d '=' -f 2`
;;
--enable-debug)
_debug_build=yes
;;
--disable-debug)
_debug_build=no
;;
--enable-c++11)
_use_cxx11=yes
;;
--disable-c++11)
_use_cxx11=no
;;
--enable-Werror)
CXXFLAGS="$CXXFLAGS -Werror"
;;
--enable-release)
_release_build=yes
;;
--disable-release)
_release_build=no
;;
--enable-profiling)
_enable_prof=yes
;;
--host=*)
if test -z "$CONFIGURE_NO_HOST"; then
_host=`echo $ac_option | cut -d '=' -f 2`
else
echo "Ignoring --host option!" >&2
fi
;;
--prefix=*)
_prefix=`echo $ac_option | cut -d '=' -f 2`
;;
--bindir=*)
_bindir=`echo $ac_option | cut -d '=' -f 2`
;;
--datadir=*)
_datadir=`echo $ac_option | cut -d '=' -f 2`
;;
--mandir=*)
_mandir=`echo $ac_option | cut -d '=' -f 2`
;;
--libdir=*)
_libdir=`echo $ac_option | cut -d '=' -f 2`
;;
*)
option_error
;;
esac;
done;
guessed_host=`$_srcdir/config.guess`
get_system_exe_extension $guessed_host
NATIVEEXEEXT=$_exeext
case $_host in
android | android-v7a)
_host_os=android
_host_cpu=arm
_host_alias=arm-linux-androideabi
;;
bada)
_host_os=bada
if test "$_debug_build" = yes; then
_host_cpu=i686
_host_alias=i686-mingw32
else
_host_cpu=arm
_host_alias=arm-samsung-nucleuseabi
fi
;;
caanoo)
_host_os=gph-linux
_host_cpu=arm
_host_alias=arm-none-linux-gnueabi
;;
dingux)
_host_os=linux
_host_cpu=mipsel
_host_alias=mipsel-linux
;;
dreamcast)
_host_os=dreamcast
_host_cpu=sh
_host_alias=sh-elf
CXXFLAGS="$CXXFLAGS -ml -m4-single-only"
LDFLAGS="$LDFLAGS -ml -m4-single-only"
;;
ds)
_host_os=ds
_host_cpu=arm
_host_alias=arm-eabi
;;
gamecube)
_host_os=gamecube
_host_cpu=ppc
_host_alias=powerpc-gekko
;;
gp2x)
_host_os=gph-linux
_host_cpu=arm
_host_alias=arm-open2x-linux
;;
gp2xwiz)
_host_os=gph-linux
_host_cpu=arm
_host_alias=arm-open2x-linux
;;
i586-mingw32msvc)
_host_os=mingw32msvc
_host_cpu=i586
;;
iphone)
_host_os=iphone
_host_cpu=arm
_host_alias=arm-apple-darwin9
;;
linupy)
_host_os=linux
_host_cpu=arm
;;
maemo)
_host_os=maemo
_host_cpu=arm
_host_alias=arm-linux
# The prefix is always the same on Maemo so we hardcode the default
# here. It is still possible to define a custom prefix which is
# needed when packaging the app with a user-specific app ID.
test "x$prefix" = xNONE && prefix=/opt/scummvm
# Maemo apps are installed into app-specific directories. The
# default directory structure of ScummVM makes no sense here so we
# hardcode Maemo specific directories here.
datarootdir='${prefix}/share'
datadir=/opt/scummvm/share
docdir='${datarootdir}/doc/scummvm'
;;
motoezx)
_host_os=linux
_host_cpu=arm
_host_alias=arm-linux-gnu
;;
motomagx)
_host_os=linux
_host_cpu=arm
_host_alias=arm-linux-gnueabi
;;
n64)
_host_os=n64
_host_cpu=mips
_host_alias=mips64
;;
neuros)
_host_os=linux
_host_cpu=arm
;;
openpandora)
_host_os=linux
_host_cpu=arm
_host_alias=arm-angstrom-linux-gnueabi
;;
ppc-amigaos)
_host_os=amigaos
_host_cpu=ppc
;;
ppc-morphos)
_host_os=morphos
_host_cpu=ppc
;;
ps2)
_host_os=ps2
_host_cpu=mips64r5900el
_host_alias=ee
;;
ps3)
_host_os=ps3
_host_cpu=ppc
_host_alias=powerpc64-ps3-elf
# The prefix is always the same on PS3 so we hardcode the default
# here. It is still possible to define a custom prefix which is
# needed when packaging the app with a user-specific app ID.
test "x$prefix" = xNONE && prefix=/dev_hdd0/game/SCUM12000/USRDIR
# PS3 apps are installed into app-specific directories. The
# default directory structure of ScummVM makes no sense here so we
# hardcode PS3 specific directories here.
datarootdir='${prefix}/data'
datadir='${datarootdir}'
docdir='${prefix}/doc'
;;
psp)
_host_os=psp
_host_cpu=mipsallegrexel
_host_alias=psp
;;
raspberrypi)
_host_os=linux
_host_cpu=arm
# This tuple is the one used by the official Rpi toolchain.
# It may change in the future.
_host_alias=arm-linux-gnueabihf
;;
samsungtv)
_host_os=linux
_host_cpu=arm
_host_alias=arm-linux-gnueabi
;;
webos)
_host_os=webos
_host_cpu=arm
_host_alias=arm-none-linux-gnueabi
# The prefix is always the same on WebOS so we hardcode the default
# here. It is still possible to define a custom prefix which is
# needed when packaging the app with a user-specific app ID.
test "x$prefix" = xNONE && prefix=/media/cryptofs/apps/usr/palm/applications/org.scummvm.scummvm
# WebOS apps are installed into app-specific directories. The
# default directory structure of ScummVM makes no sense here so we
# hardcode WebOS specific directories here.
datarootdir='${prefix}/data'
datadir='${datarootdir}'
docdir='${prefix}/doc'
;;
wii)
_host_os=wii
_host_cpu=ppc
_host_alias=powerpc-gekko
;;
wince)
_host_os=wince
_host_cpu=arm
_host_alias=arm-mingw32ce
;;
*)
if test -n "$_host"; then
guessed_host=`$_srcdir/config.sub $_host`
fi
_host_cpu=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
_host_vendor=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
_host_os=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
;;
esac
if test -z "$_host_alias"; then
_host_alias="$_host_cpu-$_host_os"
else
# if _host_alias was set, default to the standard GNU tools
_ranlib=$_host_alias-ranlib
_strip=$_host_alias-strip
_ar="$_host_alias-ar cru"
_as="$_host_alias-as"
_windres=$_host_alias-windres
fi
#
# Determine extra build flags for debug and/or release builds
#
if test "$_debug_build" != no; then
# debug mode not explicitly disabled -> compile with -g
CXXFLAGS="$CXXFLAGS -g"
fi
if test "$_release_build" = yes; then
# Release mode enabled: enable optimizations. This also
# makes it possible to use -Wuninitialized, so let's do that.
CXXFLAGS="$CXXFLAGS -O2"
CXXFLAGS="$CXXFLAGS -Wuninitialized"
fi
#
# Determine extension used for executables
#
get_system_exe_extension $_host_os
HOSTEXEEXT=$_exeext
#
# Determine separator used for $PATH
#
case $_host_os in
os2-emx*)
SEPARATOR=";"
;;
*)
SEPARATOR=":"
;;
esac
#
# Determine the C++ compiler
#
echo_n "Looking for C++ compiler... "
# Check whether the given command is a working C++ compiler
test_compiler() {
cat > tmp_cxx_compiler.cpp << EOF
class Foo { int a; };
int main(int argc, char **argv) {
Foo *a = new Foo(); delete a; return 0;
}
EOF
echo "testing compiler: $1" >> "$TMPLOG"
if test -n "$_host"; then
# In cross-compiling mode, we cannot run the result
eval "$1 $CXXFLAGS $LDFLAGS -o $TMPO.o -c tmp_cxx_compiler.cpp" 2> /dev/null && cc_check_clean tmp_cxx_compiler.cpp
else
eval "$1 $CXXFLAGS $LDFLAGS -o $TMPO$HOSTEXEEXT tmp_cxx_compiler.cpp" 2> /dev/null && eval "$TMPO$HOSTEXEEXT 2> /dev/null" && cc_check_clean tmp_cxx_compiler.cpp
fi
}
# Prepare a list of candidates for the C++ compiler
if test -n "$CXX" && test_compiler "$CXX"; then
# Use the compiler specified in CXX
echo $CXX
else
if test -n "$_host"; then
compilers="$_host_alias-g++ $_host_alias-c++ $_host-g++ $_host-c++"
else
compilers="g++ c++ CC"
fi
# Iterate over all candidates, pick the first working one
CXX=
for compiler in $compilers; do
if test_compiler $compiler; then
echo "success testing compiler: $compiler" >> "$TMPLOG"
CXX=$compiler
echo $CXX
break
else
echo "failure testing compiler: $compiler" >> "$TMPLOG"
fi
done
fi
if test -z "$CXX"; then
echo "none found!"
exit 1
fi
# By default, use the C++ compiler as linker
LD=$CXX
#
# Determine the compiler version
#
echocheck "compiler version"
have_gcc=no
cc_check_define __GNUC__ && have_gcc=yes
if test "$have_gcc" = yes; then
add_line_to_config_mk 'HAVE_GCC = 1'
_cxx_major=`gcc_get_define __GNUC__`
_cxx_minor=`gcc_get_define __GNUC_MINOR__`
cxx_version="`( $CXX -dumpversion ) 2>&1`"
if test -n "`gcc_get_define __clang__`"; then
add_line_to_config_mk 'HAVE_CLANG = 1'
fi
if test "$_cxx_major" -eq 2 && test "$_cxx_minor" -ge 95 || \
test "$_cxx_major" -gt 2 ; then
cxx_version="$cxx_version, ok"
cxx_verc_fail=no
else
cxx_version="$cxx_version, bad"
cxx_verc_fail=yes
fi
else
# TODO: Big scary warning about unsupported compilers
cxx_version=`( $CXX -version ) 2>&1`
if test "$?" -eq 0; then
cxx_version="`echo "${cxx_version}" | sed -ne 's/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/gp'`"
if test -z "${cxx_version}"; then
cxx_version="not found"
cxx_verc_fail=yes
fi
else
cxx_version="not found"
cxx_verc_fail=yes
fi
case $_host_os in
irix*)
case $cxx_version in
7.4.4*)
# We just assume this is SGI MIPSpro
_cxx_major=7
_cxx_minor=4
cxx_verc_fail=no
add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MDupdate "$(*D)/$(DEPDIR)/$(*F).d"'
add_line_to_config_mk '-include Makedepend'
;;
*)
cxx_version="$cxx_version, bad"
cxx_verc_fail=yes
;;
esac
;;
solaris*)
cxx_version=`( $CXX -V ) 2>&1`
cxx_version="`echo "${cxx_version}" | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/'`"
case $cxx_version in
5.1[0-2])
cxx_verc_fail=no
;;
*)
cxx_version="$cxx_version, bad"
cxx_verc_fail=yes
;;
esac
;;
*)
cxx_version="$cxx_version, bad"
cxx_verc_fail=yes
;;
esac
fi
echo "$cxx_version"
if test "$cxx_verc_fail" = yes ; then
echo
echo "The version of your compiler is not supported at this time"
echo "Please ensure you are using GCC >= 2.95"
exit 1
else
echo found non-gcc compiler version ${cxx_version}
fi
#
# Check whether the compiler supports C++11
#
have_cxx11=no
cat > $TMPC << EOF
int main(int argc, char *argv[]) { if (argv == nullptr) return -1; else return 0; }
EOF
cc_check -std=c++11 && have_cxx11=yes
if test "$_use_cxx11" = "yes" ; then
_use_cxx11=$have_cxx11
fi
#
# Setup compiler specific CXXFLAGS now that we know the compiler version.
# Foremost, this means enabling various warnings.
# In addition, we set CXX_UPDATE_DEP_FLAG for GCC >= 3.0 and for ICC.
#
if test "$have_gcc" = yes ; then
if test "$_cxx_major" -ge "3" ; then
# Try to use ANSI mode when C++11 is disabled.
if test "$_use_cxx11" = "no" ; then
case $_host_os in
# newlib-based system include files suppress non-C89 function
# declarations under __STRICT_ANSI__
amigaos* | android | dreamcast | ds | gamecube | mingw* | morphos* |n64 | psp | ps2 | wii | wince )
;;
*)
CXXFLAGS="$CXXFLAGS -ansi"
;;
esac
fi
CXXFLAGS="$CXXFLAGS -W -Wno-unused-parameter"
add_line_to_config_mk 'HAVE_GCC3 = 1'
add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP'
fi
if test "$_cxx_major" -eq 4 && test "$_cxx_minor" -ge 3 || \
test "$_cxx_major" -gt 4 ; then
CXXFLAGS="$CXXFLAGS -Wno-empty-body"
else
CXXFLAGS="$CXXFLAGS -Wconversion"
fi
fi
echo_n "Building as C++11... "