This repository has been archived by the owner on May 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
configure
executable file
·1325 lines (1176 loc) · 52.3 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
# Autoconf is ugly and complex. This is still ugly, but at least it's
# simple, and should be good enough for most common build cases.
# ---------- Utility definitions ----------
# Moderately portable echo
case `echo 'x\c'` in
'x\c') echo_n="echo -n"; nobr= ;;
*) echo_n="echo"; nobr="\c" ;;
esac
# Portable replacement for !
not() {
if $1; then false; else true; fi
}
# ---------- Program begins here ----------
# Default options
GAME=
PREFIX=/usr/local
if [ -z "$MAKE" ]; then MAKE=make; fi
if [ -z "$AR" ]; then AR=ar; fi
if [ -z "$RANLIB" ]; then RANLIB=ranlib; fi
#WERROR="-Werror"
#CXXSTD="-std=c++98"
CXXSTD=
STRICT=
UNSUPPORTED_COMPILER=false
CROSSCOMPILE=false
USE_CPU_GFX=true
STRIPFLAG=-s
DEFAULTDOC=
MAKEDOC=
CLEANDOC=
VALIDDOC=
MAKEMAN=
INTERNAL_LIBS=false
INTERNAL_SDL=false
INTERNAL_SDL_IMAGE=false
INTERNAL_SDL_MIXER=false
INTERNAL_BZIP2=false
INTERNAL_SMPEG=false
INTERNAL_FREETYPE=false
EXTERNAL_SDL_MIXER=false
INTERNAL_LIBPNG=false
INTERNAL_LIBJPEG=false
INTERNAL_OGGLIBS=false
EXPLICIT_OGGLIBS=false
WITH_LIBNOTIFY=false
ENABLE_GAME_CONTROLLERS=true
STEAM_API=false
LOCAL_SAVEDIR=false
SDL_CONFIG=sdl2-config
SMPEG_CONFIG=smpeg2-config
FREETYPE_CONFIG=freetype-config
EXTLIB=./extlib
SRC=src
MAKEFILE=$SRC/Makefile
VERSION=`awk '/define VER_NUMBER/ {print $3}' $SRC/version.h`
DISTCLEAN_OTHER=
# Parse options
prev=
for opt
do
if test -n "$prev"; then
eval "$prev=\$opt"
prev=
continue
fi
arg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
case $opt in
--game=* | -game=*)
GAME=$arg ;;
--prefix=* | -prefix=*)
PREFIX=$arg ;;
--prefix | -prefix)
prev=PREFIX
;;
--platform=* | -platform=*)
PLATFORM=$arg ;;
--platform | -platform)
prev=PLATFORM
;;
--make=* | -make=*)
MAKE=$arg ;;
--make | -make)
prev=MAKE
;;
--std=* | -std=*)
CXXSTD=-std=$arg ;;
--strict | -strict)
STRICT="-Wall -Wextra -Wno-unused-parameter -Wvla" ;;
--pedantic | -pedantic)
STRICT+=" -pedantic" ;;
--no-werror | -no-werror)
WERROR=""
;;
--unsupported-compiler | -unsupported-compiler)
UNSUPPORTED_COMPILER=true ;;
--unsupported-compiler=* | -unsupported-compiler=*)
UNSUPPORTED_COMPILER=$arg
;;
--no-cpu-gfx | -no-cpu-gfx)
USE_CPU_GFX=false
;;
--enable-internal-libs | -enable-internal-libs | --with-internal-libs | -with-internal-libs)
INTERNAL_LIBS=true ;;
--disable-internal-libs | -disable-internal-libs | --without-internal-libs | -without-internal-libs | --no-internal-libs | -no-internal-libs)
INTERNAL_LIBS=false ;;
--internal-libs=* | -internal-libs=*)
INTERNAL_LIBS=$arg ;;
--internal-libs | -internal-libs)
prev=INTERNAL_LIBS
;;
--enable-internal-sdl | -enable-internal-sdl | --with-internal-sdl | -with-internal-sdl)
INTERNAL_SDL=true ;;
--disable-internal-sdl | -disable-internal-sdl | --without-internal-sdl | -without-internal-sdl | --no-internal-sdl | -no-internal-sdl)
INTERNAL_SDL=false ;;
--internal-sdl=* | -internal-sdl=*)
INTERNAL_SDL=$arg ;;
--internal-sdl | -internal-sdl)
prev=INTERNAL_SDL
;;
--enable-internal-sdl?image | -enable-internal-sdl?image | --with-internal-sdl?image | -with-internal-sdl?image | --enable-internal-sdlimage | -enable-internal-sdlimage | --with-internal-sdlimage | -with-internal-sdlimage)
INTERNAL_SDL_IMAGE=true ;;
--disable-internal-sdl?image | -disable-internal-sdl?image | --without-internal-sdl?image | -without-internal-sdl?image | --no-internal-sdl?image | -no-internal-sdl?image | --disable-internal-sdlimage | -disable-internal-sdlimage | --without-internal-sdlimage | -without-internal-sdlimage | --no-internal-sdlimage | -no-internal-sdlimage)
INTERNAL_SDL_IMAGE=false ;;
--internal-sdl?image=* | -internal-sdl?image=* | --internal-sdlimage=* | -internal-sdlimage=*)
INTERNAL_SDL_IMAGE=$arg ;;
--internal-sdl?image | -internal-sdl?image | --internal-sdlimage | -internal-sdlimage)
prev=INTERNAL_SDL_IMAGE
;;
--internal-all-images)
INTERNAL_SDL_IMAGE=true
INTERNAL_LIBPNG=true
INTERNAL_LIBJPEG=true
;;
--enable-internal-sdl?mixer | -enable-internal-sdl?mixer | --with-internal-sdl?mixer | -with-internal-sdl?mixer | --enable-internal-sdlmixer | -enable-internal-sdlmixer | --with-internal-sdlmixer | -with-internal-sdlmixer)
INTERNAL_SDL_MIXER=true ;;
--disable-internal-sdl?mixer | -disable-internal-sdl?mixer | --without-internal-sdl?mixer | -without-internal-sdl?mixer | --no-internal-sdl?mixer | -no-internal-sdl?mixer | --disable-internal-sdlmixer | -disable-internal-sdlmixer | --without-internal-sdlmixer | -without-internal-sdlmixer | --no-internal-sdlmixer | -no-internal-sdlmixer)
INTERNAL_SDL_MIXER=false ;;
--internal-sdl?mixer=* | -internal-sdl?mixer=* | --internal-sdlmixer=* | -internal-sdlmixer=*)
INTERNAL_SDL_MIXER=$arg ;;
--internal-sdl?mixer | -internal-sdl?mixer | --internal-sdlmixer | -internal-sdlmixer)
prev=INTERNAL_SDL_MIXER
;;
--internal-all-mixers)
INTERNAL_SDL_MIXER=true
INTERNAL_OGGLIBS=true
;;
--enable-internal-bz* | -enable-internal-bz* | --with-internal-bz* | -with-internal-bz*)
INTERNAL_BZIP2=true ;;
--disable-internal-bz* | -disable-internal-bz* | --without-internal-bz* | -without-internal-bz* | --no-internal-bz* | -no-internal-bz*)
INTERNAL_BZIP2=false ;;
--internal-bz*=* | -internal-bz*=*)
INTERNAL_BZIP2=$arg ;;
--internal-bz* | -internal-bz*)
prev=INTERNAL_BZIP2
;;
--enable-internal-smpeg | -enable-internal-smpeg | --with-internal-smpeg | -with-internal-smpeg)
INTERNAL_SMPEG=true ;;
--disable-internal-smpeg | -disable-internal-smpeg | --without-internal-smpeg | -without-internal-smpeg | --no-internal-smpeg | -no-internal-smpeg)
INTERNAL_SMPEG=false ;;
--internal-smpeg=* | -internal-smpeg=*)
INTERNAL_SMPEG=$arg ;;
--internal-smpeg | -internal-smpeg)
prev=INTERNAL_SMPEG
;;
--enable-internal-freetype | -enable-internal-freetype | --with-internal-freetype | -with-internal-freetype)
INTERNAL_FREETYPE=true ;;
--disable-internal-freetype | -disable-internal-freetype | --without-internal-freetype | -without-internal-freetype | --no-internal-freetype | -no-internal-freetype)
INTERNAL_FREETYPE=false ;;
--internal-freetype=* | -internal-freetype=*)
INTERNAL_FREETYPE=$arg ;;
--internal-freetype | -internal-freetype)
prev=INTERNAL_FREETYPE
;;
--force-external-sdl-mixer | -force-external-sdl-mixer | -with-external-sdl-mixer | --with-external-sdl-mixer)
EXTERNAL_SDL_MIXER=true;;
--with-libnotify | -with-libnotify)
WITH_LIBNOTIFY=true;;
--game-controllers | --enable-game-controllers | --with-game-controllers | --joysticks | --enable-joysticks | --with-joysticks)
ENABLE_GAME_CONTROLLERS=true ;;
--no-game-controllers | --disable-game-controllers | --without-game-controllers | --no-joysticks | --disable-joysticks | --without-joysticks)
ENABLE_GAME_CONTROLLERS=true ;;
--steam | -steam | --enable-steam | --with-steam | -with-steam | --extra-gaben)
STEAM_API=true ;;
--no-steam | --disable-steam | --without-steam)
STEAM_API=false ;;
--local-savedir | -local-savedir | --enable-local-savedir | --with-local-savedir)
LOCAL_SAVEDIR=true ;;
-\? | -h | -help | --help)
cat <<-__ENDHELP
Usage: $0 <options>
Options:
--help display this message
--prefix=DIR install in prefix DIR (default is /usr/local)
--make=NAME use GNU make executable with the given name
--game=NAME build game NAME by default
--std=STD c++ compiles with -std=STD (unused by default)
--strict compile with -Wall -Wextra -Wvla
(note: g++ already uses -Wall)
--pedantic compile with -pedantic
--unsupported-compiler don't check for known compilers
--no-werror don't compile with -Werror
--no-cpu-gfx don't compile with custom intrinsic graphics
routines (normally compiled for x86/PPC if GCC 4.3+)
Library options (force compilation of included dependencies):
--with-internal-libs don't check for any system libraries
--with-internal-sdl skip check for system libSDL2
--with-internal-sdl-image skip check for system libSDL2_image
--with-internal-sdl-mixer skip check for system libSDL2_mixer
--with-internal-bzip2 skip check for system libbz2
--with-internal-smpeg skip check for system libsmpeg
--with-internal-freetype skip check for system libfreetype
--with-external-sdl-mixer force usage of system libSDL2_mixer
--with-libnotify use system libnotify for messages
--with-steam link against steam and include steam features
--with-local-savedir create saves folder in game directory instead of appdata
--without-game-controllers disable game controller and joystick support
__ENDHELP
exit 0
;;
*)
echo "Ignoring unknown option $opt"
;;
esac
done
if test -n "$prev"; then
opt=--`echo $prev | tr '[A-Z]_' '[a-z]-'`
echo "Error: missing argument to $opt" >&2
exit 2
fi
internalise_SDL() {
INTERNAL_SDL=true
INTERNAL_SDL_IMAGE=true
INTERNAL_SDL_MIXER=true
INTERNAL_SMPEG=true
SDL_CONFIG=$EXTLIB/bin/sdl2-config
SMPEG_CONFIG=$EXTLIB/bin/smpeg2-config
}
if $INTERNAL_LIBS
then
internalise_SDL
INTERNAL_BZIP2=true
INTERNAL_FREETYPE=true
INTERNAL_LIBPNG=true
INTERNAL_LIBJPEG=true
INTERNAL_OGGLIBS=true
elif $INTERNAL_SDL
then
# If the main SDL is internal, the subsidiary libraries must be
# too.
internalise_SDL
fi
echo "Configuring Ponscripter $VERSION"
# Platform
$echo_n "Checking platform type... ${nobr}"
BUILDPLATFORM=`util/config.guess`
if [ -n "$PLATFORM" ]
then
PLATFORM=`$echo_n "$PLATFORM${nobr}" | tr '[:upper:]' '[:lower:]'`
if util/config.sub $PLATFORM >/dev/null 2>&1
then PLATFORM=`util/config.sub $PLATFORM`
fi
else
PLATFORM=$BUILDPLATFORM
fi
SYS=Posix
POSIX=Vanilla
case $PLATFORM in
*mingw*) echo "MinGW"; SYS=MinGW; WINDRES=windres ;;
*darwin*) echo "Mac OS X"; SYS=MacOSX ;;
*linux*) echo "Linux"; POSIX=Linux ;;
*solaris*) echo "Solaris"; POSIX=Solaris ;;
*freebsd*) echo "FreeBSD"; POSIX=FreeBSD ;;
*netbsd*) echo "NetBSD"; POSIX=NetBSD ;;
*openbsd*) echo "OpenBSD"; POSIX=OpenBSD ;;
*cygwin*) echo "Cygwin (building for MinGW)"
internalise_SDL
INTERNAL_BZIP2=true
INTERNAL_FREETYPE=true
INTERNAL_LIBPNG=true
INTERNAL_LIBJPEG=true
INTERNAL_OGGLIBS=true
CC="gcc -mno-cygwin"
CXX="g++ -mno-cygwin"
WINDRES=windres
SYS=MinGW ;;
*) echo "$PLATFORM (unsupported; using vanilla Posix build instructions)" ;;
esac
ARCH=
if [ $PLATFORM != $BUILDPLATFORM ]
then
case $PLATFORM in
*mingw*)
echo "Trying to cross-compile from $BUILDPLATFORM; this is fragile"
internalise_SDL
INTERNAL_BZIP2=true
INTERNAL_FREETYPE=true
INTERNAL_LIBPNG=true
INTERNAL_LIBJPEG=true
INTERNAL_OGGLIBS=true
CC=i586-mingw32msvc-gcc
CXX=i586-mingw32msvc-g++
WINDRES=i586-mingw32msvc-windres
RANLIB=i586-mingw32msvc-ranlib
CROSSCOMPILE=true
;;
*)
echo "Note: detected platform is $BUILDPLATFORM; expect trouble"
;;
esac
else
$echo_n " cpu type... ${nobr}"
case "$PLATFORM" in
*86_64*) echo "x86_64"; ARCH=x86_64;;
*86*) ARCH=`expr "x$PLATFORM" : 'x\(.*86\).*'`; \
echo "$ARCH";;
*powerpc*) echo "PowerPC"; ARCH=ppc;;
*) echo "unknown";;
esac
fi
# Compiler (gcc, g++, icpc)
if [ -z "$CC" ]; then CC=gcc; fi
if $UNSUPPORTED_COMPILER
then
echo "Unsupported compiler requested; please don't complain if anything doesn't work!"
else
$echo_n "Checking C compiler... ${nobr}"
CC_TMP=`($CC --version) 2>/dev/null | head -1`
case "$CC_TMP" in
gcc* | *apple*gcc* | *-*-gcc\ * | *-gcc??GCC*) CC_VER=`expr "x$CC_TMP" : 'x.* \(.*\)$'`; echo "gcc $CC_VER" ;;
icc*) echo icc ;;
*) echo "error"
cat <<-_ERR
Compiler not recognised, or no compiler found.
Please install a supported C compiler (e.g. gcc). If you already have one installed, try setting the environment variable CC appropriately.
If you want to use an unsupported compiler, set CC appropriately and run configure with the --unsupported-compiler option; you will be on your own if anything doesn't work.
_ERR
exit 1 ;;
esac
fi
if [ -z "$CXX" ]
then case x$CC in
xgcc | x) CXX=g++ ;;
xicc) CXX=icpc ;;
*) CXX=$CC ;;
esac
fi
CXX_TMP=`($CXX --version) 2>/dev/null | head -1`
if not $UNSUPPORTED_COMPILER
then
$echo_n "Checking C++ compiler... ${nobr}"
case "$CXX_TMP" in
g++* | *apple*g++* | *-*-g++\ * | *-g++??GCC*) CXX_VER=`expr "x$CXX_TMP" : 'x.* \(.*\)$'`; echo "g++ $CXX_VER" ;;
icpc*) echo icpc ;;
*) echo "error"
cat <<-_ERR
Compiler not recognised, or no compiler found.
Please install a supported C++ compiler (e.g. g++). If you already have one installed, try setting the environment variable CXX appropriately.
If you want to use an unsupported compiler, set CXX appropriately and run configure with the --unsupported-compiler option; you will be on your own if anything doesn't work.
_ERR
exit 1 ;;
esac
fi
case "$CXX_TMP" in
g++* | *apple*g++*) CFLAGSEXTRA=-Wall ;;
esac
# Custom graphics using intrinsics (requires GCC 4.3+)
if $USE_CPU_GFX
then
case "x$CC_VER" in
x4.*)
case "x$CC_VER" in
x4.1.*|x4.2.*)
USE_CPU_GFX=false ;;
*) USE_CPU_GFX=true ;;
esac;;
*) USE_CPU_GFX=false ;;
esac
if not $USE_CPU_GFX
then
echo " Not GCC 4.3+, won't compile custom graphics routines"
fi
fi
if $USE_CPU_GFX
then
case "x$ARCH" in
xx86_64) USE_X86_GFX=true
GFX_MMX_FLAGS="-mmmx -DUSE_X86_GFX"
GFX_SSE2_FLAGS="-msse2 -DUSE_X86_GFX"
GFX_EXT_OBJS="graphics_mmx.o graphics_sse2.o"
CFLAGSEXTRA="$CFLAGSEXTRA -DUSE_X86_GFX"
echo " Compiling with x86 MMX/SSE2 custom graphics routines";;
x*86) USE_X86_GFX=true
GFX_MMX_FLAGS="-mmmx -DUSE_X86_GFX"
GFX_SSE2_FLAGS="-msse2 -DUSE_X86_GFX"
GFX_EXT_OBJS="graphics_mmx.o graphics_sse2.o"
CFLAGSEXTRA="$CFLAGSEXTRA -DUSE_X86_GFX"
echo " Compiling with x86 MMX/SSE2 custom graphics routines";;
xppc) USE_PPC_GFX=true
GFX_ALTIVEC_FLAGS="-maltivec -DUSE_PPC_GFX"
GFX_EXT_OBJS="graphics_altivec.o"
CFLAGSEXTRA="$CFLAGSEXTRA -DUSE_PPC_GFX"
echo " Compiling with PPC custom graphics routines";;
*) GFX_EXT_OBJS=
echo " No custom graphics routines available for the given architecture";;
esac
fi
# Make (must be GNU)
$echo_n "Checking for GNU make... ${nobr}"
case `($MAKE -v) 2>/dev/null | head -1` in
GNU?Make*)
echo "$MAKE" ;;
*)
case `(gmake -v) 2>/dev/null | head -1` in
GNU?Make*)
MAKE=gmake
echo "gmake" ;;
*) echo "no"
cat <<-_ERR
Unable to locate GNU make.
Please install GNU make. If it's installed, try setting the environment variable MAKE appropriately, or use the --make option to configure.
_ERR
exit 1 ;;
esac ;;
esac
# ar, ranlib (for simplicity's sake we assume that these are ar and
# ranlib if make is make)
if [ "x$MAKE" != "xmake" ]
then
$echo_n "Checking for ar... ${nobr}"
if ($AR -V >/dev/null) 2>/dev/null
then
echo $AR
else
AR=gar
if ($AR -V >/dev/null) 2>/dev/null
then echo $AR
else echo "not found"
echo "Unable to locate ar. If it's installed, try setting the environment variable AR appropriately."
exit 1
fi
fi
$echo_n "Checking for ranlib... ${nobr}"
if ($RANLIB -V >/dev/null) 2>/dev/null
then
echo $RANLIB
else
RANLIB=granlib
if ($RANLIB -V >/dev/null) 2>/dev/null
then echo $RANLIB
else echo "not found"
echo "Unable to locate ranlib. If it's installed, try setting the environment variable RANLIB appropriately. (If your platform does not need ranlib, just set RANLIB=true.)"
exit 1
fi
fi
fi
# Libraries
if $INTERNAL_SDL
then
SDL_CONFIG=$EXTLIB/bin/sdl2-config
else
$echo_n "Checking for system SDL... ${nobr}"
case "$SYS" in
MinGW) SDL_CONFIG=`pwd`/src/extlib
cd src/win_dll; make prefix=$SDL_CONFIG > /dev/null 2>&1; cd ../..
SDL_CONFIG=$SDL_CONFIG/bin/sdl2-config
DISTCLEAN_OTHER=SDL2.dll $DISTCLEAN_OTHER
cp -p ./src/win_dll/SDL2.dll `pwd`/src;;
esac
VER=`($SDL_CONFIG --version) 2>/dev/null`
if [ -n "$VER" ]
then
eval `echo $VER | awk -F. '{ print "MAJ=" $1 "; MIN=" $2 "; REL=" $3; }'`
if [ $MAJ -gt 2 -o $MAJ -eq 2 ]
then echo "yes"
else echo "too old"
internalise_SDL
fi
else
echo "no"
internalise_SDL
fi
fi
if $INTERNAL_SDL
then
case "$SYS" in
MinGW) echo "Using internal SDL - might not work with DirectX" ;;
esac
fi
rm -rf .configtest
mkdir .configtest
cd .configtest
if not $INTERNAL_SDL_IMAGE
then
$echo_n "Checking for system SDL_image... ${nobr}"
cat > test.cc <<-_EOF
#include "SDL.h"
#include "SDL_image.h"
unsigned char jpeg[]={255,216,255,224,0,16,74,70,73,70,0,1,1,1,0,72,0,72,0,0,255,225,0,22,69,120,105,102,0,0,77,77,0,42,0,0,0,8,0,0,0,0,0,0,255,219,0,67,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,255,219,0,67,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,255,192,0,17,8,0,1,0,1,3,1,34,0,2,17,1,
3,17,1,255,196,0,21,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,196,0,20,16,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,196,0,20,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,196,0,20,17,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,218,0,12,3,1,0,2,17,3,17,0,63,0,191,128,1,255,217};unsigned char png[]={137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130};
int main(int argc, char**argv){bool j=IMG_Load_RW(SDL_RWFromConstMem(jpeg,309),1),p=IMG_Load_RW(SDL_RWFromConstMem(png,69),1);return j&&p?0:(j?1:(p?2:3));}
_EOF
INTERNAL_SDL_IMAGE=true
$CXX `$SDL_CONFIG --cflags` test.cc `$SDL_CONFIG --libs` -lSDL2_image -o itest >/dev/null 2>&1
./itest 2>/dev/null
case $? in
0) echo "yes"; INTERNAL_SDL_IMAGE=false ;;
1) echo "no PNG" ;; 2) echo "no JPEG" ;; 3) echo "no PNG or JPEG" ;;
*) echo "no" ;;
esac
fi
if $INTERNAL_SDL_IMAGE && not $INTERNAL_LIBPNG
then
$echo_n "Checking for system libpng... ${nobr}"
cat > test.cc <<-_EOF
#include <png.h>
unsigned char png[]={137,80,78,71,13,10,26,10};int main(int argc, char**argv){return png_sig_cmp(png,0,8);}
_EOF
INTERNAL_LIBPNG=true
$CXX -lpng -lz test.cc -o ptest >/dev/null 2>&1
./ptest 2>/dev/null
case $? in
0) echo "yes"; INTERNAL_LIBPNG=false ;;
1) echo "broken" ;;
*) echo "no" ;;
esac
fi
if $INTERNAL_SDL_IMAGE && not $INTERNAL_LIBJPEG
then
$echo_n "Checking for system libjpeg... ${nobr}"
cat > test.cc <<-_EOF
#include <stdio.h>
#include <jpeglib.h>
int main(int argc, char**argv){struct jpeg_decompress_struct cinfo;struct jpeg_error_mgr jerr;cinfo.err=jpeg_std_error(&jerr);jpeg_create_decompress(&cinfo);return 0;}
_EOF
INTERNAL_LIBJPEG=true
$CXX -ljpeg test.cc -o jtest >/dev/null 2>&1
./jtest 2>/dev/null
case $? in
0) echo "yes"; INTERNAL_LIBJPEG=false ;;
1) echo "broken" ;;
*) echo "no" ;;
esac
fi
write_ogg() {
cat > test.cc <<-_EOF
unsigned char o[]={79,103,103,83,0,2,0,0,0,0,0,0,0,0,137,109,229,31,0,0,0,0,255,229,22,156,1,30,1,118,111,114,98,105,115,0,0,0,0,2,68,172,0,0,0,0,0,0,128,181,1,0,0,0,0,0,184,1,79,103,103,83,0,0,0,0,0,0,0,0,0,0,137,109,229,31,1,0,0,0,232,117,220,177,17,45,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,7,3,118,111,114,98,105,115,29,0,0,0,88,105,112,104,46,79,114,103,32,108,105,98,86,111,114,98,105,115,32,73,32,50,48,48,53,48,51,48,52,0,0,0,0,1,5,118,111,114,98,105,
115,37,66,67,86,1,0,64,0,0,36,115,24,42,70,165,115,22,132,16,26,66,80,25,227,28,66,206,107,236,25,66,76,17,130,28,50,76,91,203,37,115,144,33,164,160,66,136,91,40,129,208,144,85,0,0,64,0,0,135,65,120,20,132,138,65,8,33,132,37,61,88,146,131,39,61,8,33,132,136,57,120,20,132,105,65,8,33,132,16,66,8,33,132,16,66,8,33,132,69,57,104,146,131,39,65,8,29,132,227,48,56,12,131,229,56,248,28,132,69,57,88,16,131,39,65,232,32,132,15,66,184,154,131,172,57,8,33,132,36,53,72,80,131,6,57,232,
28,132,194,44,40,138,130,196,48,184,22,132,4,53,40,140,130,228,48,200,212,131,11,66,136,154,131,73,53,248,26,132,103,65,120,22,132,105,65,8,33,132,36,65,72,144,131,6,65,200,24,132,70,65,88,146,131,6,57,184,20,132,203,65,168,26,132,42,57,8,31,132,32,52,100,21,0,144,0,0,160,162,40,138,162,40,10,16,26,178,10,0,200,0,0,16,64,81,20,199,113,28,201,145,28,201,177,28,11,8,13,89,5,0,0,1,0,8,0,0,160,72,138,164,72,142,228,72,146,36,89,146,37,89,146,37,89,146,230,137,170,44,203,178,44,
203,178,44,203,50,16,26,178,10,0,72,0,0,80,81,12,69,113,20,7,8,13,89,5,0,100,0,0,8,160,56,138,165,88,138,165,104,138,231,136,142,8,132,134,172,2,0,128,0,0,4,0,0,16,52,67,83,60,71,148,68,207,84,85,215,182,109,219,182,109,219,182,109,219,182,109,219,182,109,91,150,101,25,8,13,89,5,0,64,0,0,16,210,105,102,169,6,136,48,3,25,6,66,67,86,1,0,8,0,0,128,17,138,48,196,128,208,144,85,0,0,64,0,0,128,24,74,14,162,9,173,57,223,156,227,160,89,14,154,74,177,57,29,156,72,181,121,146,155,138,185,
57,231,156,115,206,201,230,156,49,206,57,231,156,162,156,89,12,154,9,173,57,231,156,196,160,89,10,154,9,173,57,231,156,39,177,121,208,154,42,173,57,231,156,113,206,233,96,156,17,198,57,231,156,38,173,121,144,154,141,181,57,231,156,5,173,105,142,154,75,177,57,231,156,72,185,121,82,155,75,181,57,231,156,115,206,57,231,156,115,206,57,231,156,234,197,233,28,156,19,206,57,231,156,168,189,185,150,155,208,197,57,231,156,79,198,233,222,156,16,206,57,231,156,115,206,57,231,156,115,
206,57,231,156,32,52,100,21,0,0,4,0,64,16,134,141,97,220,41,8,210,231,104,32,70,17,98,26,50,233,65,247,232,48,9,26,131,156,66,234,209,232,104,164,148,58,8,37,149,113,82,74,39,8,13,89,5,0,0,2,0,64,8,33,133,20,82,72,33,133,20,82,72,33,133,20,98,136,33,134,24,114,202,41,167,160,130,74,42,169,168,162,140,50,203,44,179,204,50,203,44,179,204,58,236,172,179,14,59,12,49,196,16,67,43,173,196,82,83,109,53,214,88,107,238,57,231,154,131,180,86,90,107,173,181,82,74,41,165,148,82,10,66,
67,86,1,0,32,0,0,4,66,6,25,100,144,81,72,33,133,20,98,136,41,167,156,114,10,42,168,128,208,144,85,0,0,32,0,128,0,0,0,0,79,242,28,209,17,29,209,17,29,209,17,29,209,17,29,209,241,28,207,17,37,81,18,37,81,18,45,211,50,53,211,83,69,85,117,101,215,150,117,89,183,125,91,216,133,93,247,125,221,247,125,221,248,117,97,88,150,101,89,150,101,89,150,101,89,150,101,89,150,101,89,150,32,52,100,21,0,0,2,0,0,32,132,16,66,72,33,133,20,82,72,41,198,24,115,204,57,232,36,148,16,8,13,89,5,0,0,2,
0,8,0,0,0,112,20,71,113,28,201,145,28,73,178,36,75,210,36,205,210,44,79,243,52,79,19,61,81,20,69,211,52,85,209,21,93,81,55,109,81,54,101,211,53,93,83,54,93,85,86,109,87,150,109,91,182,117,219,151,101,219,247,125,223,247,125,223,247,125,223,247,125,223,247,125,93,7,66,67,86,1,0,18,0,0,58,146,35,41,146,34,41,146,227,56,142,36,73,64,104,200,42,0,64,6,0,64,0,0,138,226,40,142,227,56,146,36,73,146,37,105,146,103,121,150,168,153,154,233,153,158,42,170,64,104,200,42,0,0,16,0,64,0,0,
0,0,0,0,138,166,120,138,169,120,138,168,120,142,232,136,146,104,153,150,168,169,154,43,202,166,236,186,174,235,186,174,235,186,174,235,186,174,235,186,174,235,186,174,235,186,174,235,186,174,235,186,174,235,186,174,235,186,174,235,186,174,11,132,134,172,2,0,36,0,0,116,36,71,114,36,71,82,36,69,82,36,71,114,128,208,144,85,0,128,12,0,128,0,0,28,195,49,36,69,114,44,203,210,52,79,243,52,79,19,61,209,19,61,211,83,69,87,116,129,208,144,85,0,0,32,0,128,0,0,0,0,0,0,12,201,176,20,203,
209,28,77,18,37,213,82,45,85,83,45,213,82,69,213,83,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,77,211,52,77,19,8,13,89,9,0,144,1,0,144,16,83,45,45,198,154,9,139,36,98,210,106,171,160,99,12,82,236,165,177,72,42,103,181,183,202,49,133,24,181,94,26,135,148,81,16,123,169,36,99,138,65,204,45,164,208,41,38,173,214,84,66,133,20,164,152,99,42,21,82,14,82,32,52,100,133,0,16,154,1,224,112,28,64,178,44,64,178,44,0,0,0,0,0,0,0,144,
52,13,208,60,15,176,52,15,0,0,0,0,0,0,0,36,77,3,44,79,3,52,207,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,210,52,64,243,60,64,243,60,0,0,0,0,0,0,0,208,60,15,240,60,17,240,68,17,0,0,0,0,0,0,0,44,207,3,52,209,3,60,81,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,210,52,64,243,60,64,243,60,0,0,
0,0,0,0,0,176,60,15,240,68,17,208,60,17,0,0,0,0,0,0,0,44,207,3,60,81,4,60,209,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,16,224,0,0,16,96,33,20,26,178,34,0,136,19,0,112,72,18,36,9,146,4,205,3,72,150,5,77,131,166,193,52,1,146,101,65,211,160,105,48,
77,0,0,0,0,0,0,0,0,0,0,36,77,131,166,65,211,32,138,0,73,211,160,105,208,52,136,34,0,0,0,0,0,0,0,0,0,0,146,166,65,211,160,105,16,69,128,164,105,208,52,104,26,68,17,0,0,0,0,0,0,0,0,0,0,207,52,33,138,16,69,152,38,192,51,77,136,34,68,17,166,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,24,112,0,0,8,48,161,12,20,26,178,34,0,136,19,0,112,56,138,101,1,0,128,227,56,150,5,0,0,142,227,88,22,0,0,88,150,37,138,0,0,96,89,154,40,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,24,112,0,0,8,48,161,12,20,26,178,18,0,136,2,0,112,40,138,101,1,199,177,44,224,56,150,5,36,201,178,0,150,5,208,60,128,166,1,68,17,0,8,0,0,40,112,0,0,8,176,65,83,98,113,128,66,67,86,2,0,81,0,0,6,197,177,44,77,19,69,146,164,105,154,39,138,36,73,211,60,79,20,105,154,231,121,158,105,194,243,60,207,52,33,138,162,104,154,16,69,81,52,77,152,166,105,170,42,48,77,85,21,0,0,80,224,0,0,16,96,131,166,196,226,
0,133,134,172,4,0,66,2,0,28,138,98,89,154,230,121,158,39,138,166,169,154,36,73,211,60,79,20,69,209,52,77,83,85,73,146,166,121,158,40,138,162,105,154,166,170,178,44,77,243,60,81,20,69,211,84,85,85,133,166,121,158,40,138,162,105,170,170,234,194,243,60,79,20,69,209,52,85,213,117,225,121,158,39,138,162,104,154,170,234,186,16,69,81,52,77,211,84,77,85,117,93,32,138,166,105,154,170,170,170,174,11,68,79,20,77,83,85,93,215,117,129,231,137,162,105,170,170,171,186,46,16,77,211,84,85,85,
117,93,89,6,152,166,105,170,170,235,202,50,64,85,85,213,117,93,87,150,1,170,170,170,174,235,186,178,12,80,85,215,117,93,89,150,101,0,174,235,186,178,44,203,2,0,0,14,28,0,0,2,140,160,147,140,42,139,176,209,132,11,15,64,161,33,43,2,128,40,0,0,192,24,166,20,83,202,48,38,33,164,16,26,198,36,132,20,66,38,37,165,210,82,170,32,164,82,82,41,21,132,84,74,42,37,163,148,82,106,41,85,16,82,41,169,148,10,66,42,37,149,82,0,0,216,129,3,0,216,129,133,80,104,200,74,0,32,15,0,128,48,70,41,198,
24,115,78,34,164,20,99,206,57,39,17,82,138,49,231,156,147,74,49,230,156,115,206,73,41,25,115,204,57,231,164,148,206,57,231,156,115,82,74,230,156,115,206,57,41,165,115,206,57,231,156,148,82,74,231,156,115,78,74,41,37,132,206,65,39,165,148,210,57,231,156,19,0,0,84,224,0,0,16,96,163,200,230,4,35,65,133,134,172,4,0,82,1,0,12,142,99,89,154,230,121,162,104,154,150,36,105,154,231,121,158,40,154,166,38,73,154,230,121,158,39,138,170,201,243,60,79,20,69,209,52,85,149,231,121,158,40,138,
162,105,170,42,215,21,69,211,52,77,85,85,93,178,44,138,166,105,154,170,234,186,48,77,211,84,85,215,117,93,152,166,105,170,170,235,186,46,108,91,85,85,213,117,101,25,182,173,170,170,234,186,178,12,92,215,117,101,217,150,129,44,187,174,236,218,178,0,0,240,4,7,0,160,2,27,86,71,56,41,26,11,44,52,100,37,0,144,1,0,64,24,131,144,66,8,33,101,16,66,10,33,132,148,82,8,9,0,0,24,112,0,0,8,48,161,12,20,26,178,18,0,72,5,0,0,140,177,214,90,107,173,181,214,64,103,173,181,214,90,107,173,
128,204,90,107,173,181,214,90,107,173,181,214,90,107,173,181,214,82,107,173,181,214,90,107,173,181,214,90,107,173,181,214,90,107,173,181,214,90,107,173,181,214,90,107,173,181,214,90,107,173,181,214,90,107,173,181,214,90,107,173,181,214,90,107,173,181,214,90,107,45,165,148,82,74,41,165,148,82,74,41,165,148,82,74,41,165,148,82,74,5,0,250,85,56,0,248,63,216,176,58,194,73,209,88,96,161,33,43,1,128,112,0,0,192,24,165,24,115,12,66,41,165,84,8,49,230,156,116,84,90,139,177,66,136,49,
231,36,164,212,90,108,197,115,206,65,40,33,149,214,98,44,158,115,14,66,41,41,197,86,99,81,41,132,82,82,74,45,182,88,139,74,161,163,146,82,74,173,213,88,140,49,169,164,214,90,139,173,198,98,140,73,41,180,212,90,139,49,22,35,108,77,169,181,216,106,171,177,24,99,107,42,45,180,24,99,140,197,8,95,100,108,45,166,218,106,13,198,8,35,91,44,45,213,90,107,48,198,24,221,91,139,165,182,154,139,49,62,248,218,82,44,49,214,92,0,0,119,131,3,0,68,130,141,51,172,36,157,21,142,6,23,26,178,18,0,
8,9,0,32,16,82,138,49,198,24,115,206,57,231,164,82,140,57,230,156,115,14,66,8,161,84,138,49,198,156,115,14,66,8,33,148,140,49,230,156,115,16,66,8,33,132,82,74,198,156,115,16,66,8,33,132,144,82,234,156,115,16,66,8,33,132,16,74,41,157,115,14,66,8,33,132,16,66,41,165,131,16,66,8,33,132,16,74,40,165,164,20,66,8,33,132,16,66,8,169,164,148,66,8,33,132,82,66,40,33,149,148,82,8,33,132,16,66,41,37,164,148,82,10,33,132,82,66,8,161,132,148,82,74,41,133,16,66,8,165,148,146,82,74,41,165,
18,74,9,37,132,18,82,41,41,165,20,74,8,33,148,82,74,74,41,165,84,74,9,161,132,18,74,41,37,165,148,82,74,33,132,16,74,41,5,0,0,28,56,0,0,4,24,65,39,25,85,22,97,163,9,23,30,128,66,67,86,2,0,100,0,0,144,162,148,82,41,45,69,130,34,165,24,164,24,75,70,21,115,80,90,138,168,114,12,82,205,169,82,206,32,230,36,150,136,49,132,148,147,84,50,230,20,66,12,66,234,28,117,76,41,6,45,149,24,66,198,24,164,216,114,75,161,115,14,0,0,0,65,0,128,128,144,0,0,3,4,5,51,0,192,224,0,225,115,16,116,2,
4,71,27,0,128,32,68,102,136,68,195,66,112,120,80,9,16,17,83,1,64,98,130,66,46,0,84,88,92,164,93,92,64,151,1,46,232,226,174,3,33,4,33,8,65,44,14,160,128,4,28,156,112,195,19,111,120,194,13,78,208,41,42,117,32,0,0,0,0,0,13,0,240,0,0,144,92,0,17,17,209,204,97,100,104,108,112,116,120,124,128,132,136,140,144,8,0,0,0,0,0,25,0,124,0,0,36,37,64,68,68,52,115,24,25,26,27,28,29,30,31,32,33,34,35,36,1,0,128,0,2,0,0,0,0,32,128,0,4,4,4,0,0,0,0,0,2,0,0,0,4,4,79,103,103,83,0,4,0,0,0,0,0,0,0,0,
137,109,229,31,2,0,0,0,123,25,191,226,1,1,0};
_EOF
}
if $EXTERNAL_SDL_MIXER
then
echo "Checking for system SDL2_mixer... forced"
elif not $INTERNAL_SDL_MIXER
then
$echo_n "Checking for system SDL_mixer... ${nobr}"
write_ogg
cat >> test.cc <<-_EOF
#include <cstdio>
#include "SDL.h"
#include "SDL_mixer.h"
unsigned char m[]={255,251,80,196,0,3,192,0,1,164,0,0,0,32,0,0,52,128,0,0,4,76,65,77,69,51,46,57,54,46,49,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,255,251,82,196,93,131,192,0,1,164,0,0,0,32,0,0,52,128,0,0,4,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85};const int ol=4008,ml=417;
int main(int argc, char**argv){using namespace std;FILE*f=fopen("o.ogg","wb");if(!f||fwrite(o,1,ol,f)!=ol)return 127;fclose(f);f=fopen("o.mp3","wb");if(!f||fwrite(m,1,ml,f)!=ml)return 127;fclose(f);
Mix_Music*m;bool ogg=m=Mix_LoadMUS("o.ogg");if(m)Mix_FreeMusic(m);bool mp3=m=Mix_LoadMUS("o.mp3");if(m)Mix_FreeMusic(m);return ogg&&mp3?0:(ogg?1:(mp3?2:3));}
_EOF
INTERNAL_SDL_MIXER=true
$CXX `$SDL_CONFIG --cflags` test.cc `$SDL_CONFIG --libs` -lSDL2_mixer -o mtest >/dev/null 2>&1
./mtest 2>/dev/null
case $? in
0) echo "yes"; INTERNAL_SDL_MIXER=false ;;
1) echo "no MP3" ;; 2) echo "no Ogg" ;; 3) echo "no Ogg or MP3" ;;
*) echo "no" ;;
esac
fi
if $INTERNAL_SDL_MIXER && not $INTERNAL_OGGLIBS
then
$echo_n "Checking for system Ogg Vorbis libs... ${nobr}"
write_ogg
cat >> test.cc <<-_EOF
#include <cstdio>
#include <vorbis/codec.h>
#include <vorbis/vorbisfile.h>
const int ol=4008;
int main(int argc, char**argv){using namespace std;FILE*f=fopen("o.ogg","wb");if(!f||fwrite(o,1,ol,f)!=ol)return 127;fclose(f);
OggVorbis_File vf;f=fopen("o.ogg","rb");int n=ov_open(f,&vf,0,0)<0;fclose(f);return n;}
_EOF
INTERNAL_OGGLIBS=true
$CXX -logg -lvorbis -lvorbisfile test.cc -o otest >/dev/null 2>&1
./otest 2>/dev/null
case $? in
0) echo "yes"; INTERNAL_OGGLIBS=false ;;
1) echo "broken" ;;
*) echo "no" ;;
esac
elif not $INTERNAL_OGGLIBS
then
$echo_n "Checking whether Ogg libs need to be linked explicitly... ${nobr}"
write_ogg
cat >> test.cc <<-_EOF
#include <cstdio>
#include "SDL.h"
#include "SDL_mixer.h"
#include <vorbis/codec.h>
#include <vorbis/vorbisfile.h>
const int ol=4008;
int main(int argc, char**argv){using namespace std;FILE*f=fopen("o.ogg","wb");if(!f||fwrite(o,1,ol,f)!=ol)return 127;fclose(f);
OggVorbis_File vf;f=fopen("o.ogg","rb");int n=ov_open(f,&vf,0,0)<0;fclose(f);return n;}
_EOF
EXPLICIT_OGGLIBS=true
$CXX `$SDL_CONFIG --cflags` `$SDL_CONFIG --libs` -lSDL2_mixer test.cc -o mtest >/dev/null 2>&1
case $? in
0) echo "no"; EXPLICIT_OGGLIBS=false ;;
*) echo "yes" ;;
esac
fi
if not $INTERNAL_BZIP2
then
$echo_n "Checking for system libbzip2... ${nobr}"
cat > test.cc <<-_EOF
#include <bzlib.h>
unsigned char bz[]={66,90,104,57,49,65,89,38,83,89,41,212,246,171,0,0,0,16,0,64,0,32,0,33,24,70,130,238,72,167,10,18,5,58,158,213,96};
int main(int argc, char**argv){char out[2];unsigned int olen=2;out[0]='.';return(BZ2_bzBuffToBuffDecompress(out,&olen,(char*)bz,37,0,0)==BZ_OK&&olen==1&&out[0]==' ')?0:1;}
_EOF
$CXX -lbz2 test.cc -o btest >/dev/null 2>&1
if ./btest 2>/dev/null
then echo "yes"
else echo "no"
INTERNAL_BZIP2=true
fi
fi
cd ..
rm -rf .configtest
if $INTERNAL_SMPEG
then
SMPEG_CONFIG=$EXTLIB/bin/smpeg2-config
else
$echo_n "Checking for system libsmpeg... ${nobr}"
VER=`($SMPEG_CONFIG --version) 2>/dev/null`
if [ -n "$VER" ]
then echo "yes"
else echo "no"
INTERNAL_SMPEG=true
SMPEG_CONFIG=$EXTLIB/bin/smpeg2-config
fi
fi
if $INTERNAL_FREETYPE
then
FREETYPE_CONFIG=$EXTLIB/bin/freetype-config
else
$echo_n "Checking for system Freetype... ${nobr}"
VER=`($FREETYPE_CONFIG --ftversion) 2>/dev/null`
if [ -z "$VER" ]; then
FREETYPE_CONFIG=freetype2-config
VER=`($FREETYPE_CONFIG --ftversion) 2>/dev/null`
if [ -z "$VER" ]; then
FREETYPE_CONFIG="pkg-config freetype2"
VER=`($FREETYPE_CONFIG --modversion) 2>/dev/null`
if [ -n "$VER" ]; then VER=2; fi
fi
fi
case $VER in
1.*) echo "too old"
INTERNAL_FREETYPE=true ;;
[0-9]*) echo "yes" ;;
*) echo "no"
INTERNAL_FREETYPE=true ;;
esac
if $INTERNAL_FREETYPE
then FREETYPE_CONFIG=$EXTLIB/bin/freetype-config
fi
fi
$echo_n "Checking for xmlto... ${nobr}"
if xmlto --version >/dev/null 2>/dev/null; then
echo "found"
$echo_n "Checking for perl... ${nobr}"
if perl --version >/dev/null 2>/dev/null; then
echo "found"
MAKEDOC="doc man html"
CLEANDOC="cleandoc"
MAKEMAN=man
case $SYS in
MinGW | MacOSX) DEFAULTDOC=html ;;
*) DEFAULTDOC=man ;;
esac
else
echo "no: documentation will not be built"
fi
else
echo "no: documentation will not be built"
fi
if test -n "$MAKEDOC"; then
$echo_n "Checking for onvdl (optional)... ${nobr}"
case `onvdl 2>/dev/null | head -1` in
oNVDL*)
echo "found"
VALIDDOC=onvdl ;;
*)
echo "no: documentation will not be validated" ;;
esac
fi
if $WITH_LIBNOTIFY; then
$echo_n "Checking for system libnotify... ${nobr}"
if `pkg-config --exists libnotify` && `pkg-config --exists gtk+-2.0`; then
echo "yes"
WITH_LIBNOTIFY=true
else
echo "no: libnotify will not be used"
WITH_LIBNOTIFY=false
fi
fi
DEPS=
MLIB=
require() {
if $1
then
DEPS="$DEPS \$($2)"
[ -n "$MLIB" ] && MLIB="$MLIB, "
MLIB="$MLIB$3"
fi
}
require $INTERNAL_SDL internal_sdl SDL2
require $INTERNAL_LIBPNG internal_png libpng
require $INTERNAL_LIBJPEG internal_jpeg libjpeg
require $INTERNAL_SDL_IMAGE internal_sdl_image SDL2_image
require $INTERNAL_OGGLIBS internal_ogglibs "libogg, libvorbis"
require $INTERNAL_SDL_MIXER internal_sdl_mixer SDL2_mixer
require $INTERNAL_BZIP2 internal_bzip2 libbz2
require $INTERNAL_SMPEG internal_smpeg libsmpeg
require $INTERNAL_FREETYPE internal_freetype Freetype
genlink() {
if $1
then
eval "LINK$2=\"extlib/lib/lib$2\\\$(LIBSUFFIX)\""
else
eval "LINK$2=-l$2"
fi
}
genlink $INTERNAL_LIBPNG z
genlink $INTERNAL_LIBPNG png
genlink $INTERNAL_LIBJPEG jpeg
genlink $INTERNAL_SDL_IMAGE SDL2_image
genlink $INTERNAL_OGGLIBS ogg
genlink $INTERNAL_OGGLIBS vorbis
genlink $INTERNAL_OGGLIBS vorbisfile
genlink $INTERNAL_SDL_MIXER SDL2_mixer
genlink $INTERNAL_BZIP2 bz2
if [ -n "$MLIB" -a ! -d $SRC/extlib ]
then
cat <<_EOF
Unable to locate the following dependencies:
$MLIB
The simplest way to solve this problem is to download the dependencies
pack from the same place that you acquired this source code.
Alternatively, you could install the appropriate development packages
for your operating system.
_EOF
exit
fi
OURLDFLAGS=
OURINCLUDE=
OURINCS=
OURLIBS=
OURPATH=
OURDEFS=
if $INTERNAL_BZIP2 || $INTERNAL_FREETYPE || $INTERNAL_LIBJPEG || \
$INTERNAL_LIBPNG || $INTERNAL_OGGLIBS || $INTERNAL_SDL || \
$INTERNAL_SDL_IMAGE || $INTERNAL_SDL_MIXER || $INTERNAL_SMPEG
then
OURLDFLAGS="-L\$(shell pwd)/$SRC/extlib/lib"
OURINCLUDE="-I\$(shell pwd)/$SRC/extlib/include"
OURINCS="-Iextlib/include \$(shell [ -d extlib/include/SDL ] && echo -Iextlib/include/SDL)"
OURLIBS="-Lextlib/lib"
OURPATH="\$(shell pwd)/$SRC/extlib/bin:"
fi
NOTIFYLIBS=
GTKLIBS=
if $WITH_LIBNOTIFY
then
OURLIBS="$OURLIBS -lnotify"
OURLIBS="$OURLIBS `pkg-config --libs gtk+-2.0`"
OURINCS="$OURINCS `pkg-config --cflags gtk+-2.0`"
OURDEFS="$OURDEFS -DLIBNOTIFY"
fi
$echo_n "Writing Makefile... ${nobr}"
case "$SYS" in
Posix) EXE= ; OBJ=.o ; LIB=.a ; W32= ;;
MacOSX) EXE= ; OBJ=.o ; LIB=.a ; W32= ;;
MinGW) EXE=.exe ; OBJ=.o ; LIB=.a ; W32=true ;;
*) echo "error: unsupported system";
exit 1 ;;
esac
cat > $MAKEFILE <<_EOF
# -*- makefile-gmake -*-
#
# THIS IS A GENERATED FILE - changes will not be kept if configure is
# run again. If you wish to customise it, please be sure to give your
# version a different filename.
#
# Makefile for Ponscripter
WIN32=$W32
OBJSUFFIX=$OBJ
LIBSUFFIX=$LIB
EXESUFFIX=$EXE
# Extra handling for internal libraries.
EXTRADEPS=$DEPS
INTERNAL_SDL=\$(findstring true,$INTERNAL_SDL)
INTERNAL_SMPEG=\$(findstring true,$INTERNAL_SMPEG)
INTERNAL_LIBPNG=\$(findstring true,$INTERNAL_LIBPNG)
INTERNAL_LIBJPEG=\$(findstring true,$INTERNAL_LIBJPEG)
INTERNAL_OGGLIBS=\$(findstring true,$INTERNAL_OGGLIBS)
SDL_CONFIG=$SDL_CONFIG
export PKG_CONFIG_PATH := \$(shell pwd)/extlib/lib/pkgconfig:\$(PKG_CONFIG_PATH)
SHELLENV = PKG_CONFIG_PATH=\$(PKG_CONFIG_PATH)
export CC := $CC
export CXX := $CXX
export MAKE := $MAKE
export GNUMAKE := $MAKE
export AR := $AR
export RANLIB := $RANLIB
# Ponscripter variables
PSCFLAGS = $CFLAGSEXTRA
INCS = $OURINCS \$(shell \$(SHELLENV) \$(SDL_CONFIG) --cflags) \\
\$(shell \$(SHELLENV) $SMPEG_CONFIG --cflags) \\
\$(shell \$(SHELLENV) $FREETYPE_CONFIG --cflags)
_EOF
case "$SYS" in
MinGW)
if $CROSSCOMPILE
then cat >> $MAKEFILE <<_EOF
export FORCE_INT_SIZES := yes
OTHERCONFIG := --host=i586-mingw32msvc --disable-sdltest
SDLOTHERCONFIG := --host=i586-mingw32msvc
_EOF
fi
if $INTERNAL_SDL
then
MY_SDL_LIBS="\$(filter-out -lSDL2main,\$(shell \$(SHELLENV) \$(SDL_CONFIG) --static-libs))"
else
MY_SDL_LIBS="\$(shell \$(SHELLENV) \$(SDL_CONFIG) --static-libs)"
fi
cat >> $MAKEFILE <<_EOF
export WINDRES := $WINDRES
LIBS = $OURLIBS \\
$NOTIFYLIBS $GTKLIBS\\
-static -Wl,--start-group \\
$MY_SDL_LIBS \\
\$(shell \$(SHELLENV) $SMPEG_CONFIG --libs) \$(shell \$(SHELLENV) $FREETYPE_CONFIG --libs) \\
$LINKSDL2_image $LINKjpeg $LINKpng $LINKz \\
$LINKSDL2_mixer $LINKogg $LINKvorbis $LINKvorbisfile \\
$LINKbz2 -Wl,--end-group
DEFS = -DWIN32 -DUSE_OGG_VORBIS $OURDEFS
EXT_OBJS = SDL_win32_main.o win32rc.o $GFX_EXT_OBJS
_EOF
;;
MacOSX)
cat >> $MAKEFILE <<_EOF
LIBS = $OURLIBS \\
\$(shell \$(SHELLENV) $SDL_CONFIG --static-libs) \\
\$(shell \$(SHELLENV) $SMPEG_CONFIG --libs) \\
\$(shell \$(SHELLENV) $FREETYPE_CONFIG --libs) \\
$LINKSDL2_image $LINKjpeg $LINKpng \\
$LINKSDL2_mixer $LINKogg $LINKvorbis $LINKvorbisfile \\
$LINKbz2 -lm -framework CoreFoundation
export MACOSX_DEPLOYMENT_TARGET=10.7
# On 10.7 and 10.8 libc++ is available but not default
# Newer compilers no longer ship with libstdc++ so we will prefer libc++ if possible
ifeq (\$(MACOSX_DEPLOYMENT_TARGET),\$(filter \$(MACOSX_DEPLOYMENT_TARGET),10.7 10.8))
ifeq (,\$(filter --stdlib=%,\$(CXXFLAGS)))
export CXXFLAGS += --stdlib=libc++
export LDFLAGS += --stdlib=libc++
endif
endif
SDLOTHERCONFIG = --enable-video-opengl --enable-video-opengles $SDLOTHERCONFIG
DEFS = -DMACOSX -DUTF8_CAPTION -DUTF8_FILESYSTEM -DUSE_OGG_VORBIS $OURDEFS
NO_DEFAULT_ICON = true
EXT_OBJS = $GFX_EXT_OBJS
_EOF
;;
Posix)
case "$POSIX" in
Linux) INTERNAL_LDFLAGS="-ldl -lasound" ;;
FreeBSD) INTERNAL_LDFLAGS="-L/usr/X11R6/lib -lX11 -lXi -lXrandr -liconv"
EXTRA_DEPS="-DCONST_ICONV" ;;
NetBSD) INTERNAL_LDFLAGS="\$(foreach x,11 i randr ext render,/usr/X11R6/lib/libX\$(x).a) -lossaudio" ;;
OpenBSD) INTERNAL_LDFLAGS="-L/usr/X11R6/lib -lX11 -lXi -lXrandr -lossaudio" ;;
Solaris) INTERNAL_LDFLAGS="-lX11 -lXext"
# Thanks for the unnecessary and incompatible iconv library, GNU.
if $INTERNAL_SDL && test -f /usr/local/include/iconv.h; then
INTERNAL_LDFLAGS="$INTERNAL_LDFLAGS -L/usr/local/lib -liconv"
fi
EXTRA_DEPS="-DCONST_ICONV"
# Stripping binaries can break them, so we don't.
STRIPFLAG=