-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure
executable file
·1853 lines (1746 loc) · 49.7 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
#
# qemu configure script (c) 2003 Fabrice Bellard
#
# set temporary file name
if test ! -z "$TMPDIR" ; then
TMPDIR1="${TMPDIR}"
elif test ! -z "$TEMPDIR" ; then
TMPDIR1="${TEMPDIR}"
else
TMPDIR1="/tmp"
fi
TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
# default parameters
prefix=""
interp_prefix="/usr/gnemul/qemu-%M"
static="no"
cross_prefix=""
cc="gcc"
audio_drv_list=""
audio_card_list="ac97 es1370 sb16"
audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
host_cc="gcc"
ar="ar"
make="make"
install="install"
strip="strip"
# parse CC options first
for opt do
optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
case "$opt" in
--cross-prefix=*) cross_prefix="$optarg"
;;
--cc=*) cc="$optarg"
;;
esac
done
# OS specific
# Using uname is really, really broken. Once we have the right set of checks
# we can eliminate it's usage altogether
cc="${cross_prefix}${cc}"
ar="${cross_prefix}${ar}"
strip="${cross_prefix}${strip}"
# check that the C compiler works.
cat > $TMPC <<EOF
int main(void) {}
EOF
if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
: C compiler works ok
else
echo "ERROR: \"$cc\" either does not exist or does not work"
exit 1
fi
check_define() {
cat > $TMPC <<EOF
#if !defined($1)
#error Not defined
#endif
int main(void) { return 0; }
EOF
$cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
}
if check_define __i386__ ; then
cpu="i386"
elif check_define __x86_64__ ; then
cpu="x86_64"
elif check_define __sparc__ ; then
# We can't check for 64 bit (when gcc is biarch) or V8PLUSA
# They must be specified using --sparc_cpu
if check_define __arch64__ ; then
cpu="sparc64"
else
cpu="sparc"
fi
elif check_define _ARCH_PPC ; then
if check_define _ARCH_PPC64 ; then
cpu="ppc64"
else
cpu="ppc"
fi
else
cpu=`uname -m`
fi
target_list=""
case "$cpu" in
i386|i486|i586|i686|i86pc|BePC)
cpu="i386"
;;
x86_64|amd64)
cpu="x86_64"
;;
alpha)
cpu="alpha"
;;
armv*b)
cpu="armv4b"
;;
armv*l)
cpu="armv4l"
;;
cris)
cpu="cris"
;;
parisc|parisc64)
cpu="hppa"
;;
ia64)
cpu="ia64"
;;
m68k)
cpu="m68k"
;;
mips)
cpu="mips"
;;
mips64)
cpu="mips64"
;;
ppc)
cpu="ppc"
;;
ppc64)
cpu="ppc64"
;;
s390*)
cpu="s390"
;;
sparc|sun4[cdmuv])
cpu="sparc"
;;
sparc64)
cpu="sparc64"
;;
*)
cpu="unknown"
;;
esac
gprof="no"
sparse="no"
bigendian="no"
mingw32="no"
EXESUF=""
gdbstub="no"
slirp="yes"
vde="yes"
fmod_lib=""
fmod_inc=""
oss_lib=""
vnc_tls="yes"
bsd="no"
linux="no"
solaris="no"
kqemu="no"
profiler="no"
cocoa="no"
check_gfx="yes"
softmmu="yes"
linux_user="no"
darwin_user="no"
bsd_user="no"
build_docs="no"
uname_release=""
curses="yes"
aio="yes"
nptl="yes"
mixemu="no"
bluez="yes"
kvm="yes"
kerneldir=""
aix="no"
blobs="yes"
fdt="yes"
sdl_x11="no"
# OS specific
if check_define __linux__ ; then
targetos="Linux"
elif check_define _WIN32 ; then
targetos='MINGW32'
else
targetos=`uname -s`
fi
case $targetos in
CYGWIN*)
mingw32="yes"
OS_CFLAGS="-mno-cygwin"
if [ "$cpu" = "i386" ] ; then
kqemu="yes"
fi
audio_possible_drivers="sdl"
;;
MINGW32*)
mingw32="yes"
if [ "$cpu" = "i386" ] ; then
kqemu="yes"
fi
audio_possible_drivers="dsound sdl fmod"
;;
GNU/kFreeBSD)
audio_drv_list="oss"
audio_possible_drivers="oss sdl esd pa"
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
kqemu="yes"
fi
;;
FreeBSD)
bsd="yes"
audio_drv_list="oss"
audio_possible_drivers="oss sdl esd pa"
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
kqemu="yes"
fi
;;
NetBSD)
bsd="yes"
audio_drv_list="oss"
audio_possible_drivers="oss sdl esd"
oss_lib="-lossaudio"
;;
OpenBSD)
bsd="yes"
openbsd="yes"
audio_drv_list="oss"
audio_possible_drivers="oss sdl esd"
oss_lib="-lossaudio"
;;
Darwin)
bsd="yes"
darwin="yes"
# on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code
if [ "$cpu" = "i386" ] ; then
is_x86_64=`sysctl -n hw.optional.x86_64`
[ "$is_x86_64" = "1" ] && cpu=x86_64
fi
if [ "$cpu" = "x86_64" ] ; then
OS_CFLAGS="-arch x86_64"
LDFLAGS="-arch x86_64"
else
OS_CFLAGS="-mdynamic-no-pic"
fi
darwin_user="yes"
cocoa="yes"
audio_drv_list="coreaudio"
audio_possible_drivers="coreaudio sdl fmod"
OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
;;
SunOS)
solaris="yes"
make="gmake"
install="ginstall"
needs_libsunmath="no"
solarisrev=`uname -r | cut -f2 -d.`
# have to select again, because `uname -m` returns i86pc
# even on an x86_64 box.
solariscpu=`isainfo -k`
if test "${solariscpu}" = "amd64" ; then
cpu="x86_64"
fi
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
if test "$solarisrev" -le 9 ; then
if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
needs_libsunmath="yes"
else
echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
echo "Studio 11 can be downloaded from www.sun.com."
exit 1
fi
fi
if test "$solarisrev" -ge 9 ; then
kqemu="yes"
fi
fi
if test -f /usr/include/sys/soundcard.h ; then
audio_drv_list="oss"
fi
audio_possible_drivers="oss sdl"
;;
AIX)
aix="yes"
make="gmake"
;;
*)
audio_drv_list="oss"
audio_possible_drivers="oss alsa sdl esd pa"
linux="yes"
linux_user="yes"
usb="linux"
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
kqemu="yes"
audio_possible_drivers="$audio_possible_drivers fmod"
fi
;;
esac
if [ "$bsd" = "yes" ] ; then
if [ "$darwin" != "yes" ] ; then
make="gmake"
usb="bsd"
fi
bsd_user="yes"
fi
# find source path
source_path=`dirname "$0"`
source_path_used="no"
workdir=`pwd`
if [ -z "$source_path" ]; then
source_path=$workdir
else
source_path=`cd "$source_path"; pwd`
fi
[ -f "$workdir/vl.c" ] || source_path_used="yes"
werror="no"
# generate compile errors on warnings for development builds
#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
#werror="yes";
#fi
for opt do
optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
case "$opt" in
--help|-h) show_help=yes
;;
--prefix=*) prefix="$optarg"
;;
--interp-prefix=*) interp_prefix="$optarg"
;;
--source-path=*) source_path="$optarg"
source_path_used="yes"
;;
--cross-prefix=*)
;;
--cc=*)
;;
--host-cc=*) host_cc="$optarg"
;;
--make=*) make="$optarg"
;;
--install=*) install="$optarg"
;;
--extra-cflags=*) CFLAGS="$optarg"
;;
--extra-ldflags=*) LDFLAGS="$optarg"
;;
--cpu=*) cpu="$optarg"
;;
--target-list=*) target_list="$optarg"
;;
--enable-gprof) gprof="yes"
;;
--static) static="yes"
;;
--disable-sdl) sdl="no"
;;
--disable-opengl) opengl="no"
;;
--fmod-lib=*) fmod_lib="$optarg"
;;
--fmod-inc=*) fmod_inc="$optarg"
;;
--oss-lib=*) oss_lib="$optarg"
;;
--audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
;;
--audio-drv-list=*) audio_drv_list="$optarg"
;;
--enable-sparse) sparse="yes"
;;
--disable-sparse) sparse="no"
;;
--disable-vnc-tls) vnc_tls="no"
;;
--disable-slirp) slirp="no"
;;
--disable-vde) vde="no"
;;
--disable-kqemu) kqemu="no"
;;
--disable-brlapi) brlapi="no"
;;
--disable-bluez) bluez="no"
;;
--disable-kvm) kvm="no"
;;
--enable-profiler) profiler="yes"
;;
--enable-cocoa)
cocoa="yes" ;
sdl="no" ;
audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
;;
--disable-gfx-check) check_gfx="no"
;;
--disable-system) softmmu="no"
;;
--enable-system) softmmu="yes"
;;
--disable-linux-user) linux_user="no"
;;
--enable-linux-user) linux_user="yes"
;;
--disable-darwin-user) darwin_user="no"
;;
--enable-darwin-user) darwin_user="yes"
;;
--disable-bsd-user) bsd_user="no"
;;
--enable-bsd-user) bsd_user="yes"
;;
--enable-uname-release=*) uname_release="$optarg"
;;
--sparc_cpu=*)
sparc_cpu="$optarg"
case $sparc_cpu in
v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
target_cpu="sparc"; cpu="sparc" ;;
v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
target_cpu="sparc"; cpu="sparc" ;;
v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
target_cpu="sparc64"; cpu="sparc64" ;;
*) echo "undefined SPARC architecture. Exiting";exit 1;;
esac
;;
--enable-werror) werror="yes"
;;
--disable-werror) werror="no"
;;
--disable-curses) curses="no"
;;
--disable-nptl) nptl="no"
;;
--enable-mixemu) mixemu="yes"
;;
--disable-aio) aio="no"
;;
--disable-blobs) blobs="no"
;;
--kerneldir=*) kerneldir="$optarg"
;;
*) echo "ERROR: unknown option $opt"; show_help="yes"
;;
esac
done
# default flags for all hosts
CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
LDFLAGS="$LDFLAGS -g"
if test "$werror" = "yes" ; then
CFLAGS="$CFLAGS -Werror"
fi
if test "$solaris" = "no" ; then
if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
LDFLAGS="$LDFLAGS -Wl,--warn-common"
fi
fi
#
# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
#
case "$cpu" in
sparc) if test -z "$sparc_cpu" ; then
ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
ARCH_LDFLAGS="-m32"
else
ARCH_CFLAGS="${SP_CFLAGS}"
ARCH_LDFLAGS="${SP_LDFLAGS}"
fi
;;
sparc64) if test -z "$sparc_cpu" ; then
ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
ARCH_LDFLAGS="-m64"
else
ARCH_CFLAGS="${SP_CFLAGS}"
ARCH_LDFLAGS="${SP_LDFLAGS}"
fi
;;
s390)
ARCH_CFLAGS="-march=z900"
;;
i386)
ARCH_CFLAGS="-m32"
ARCH_LDFLAGS="-m32"
;;
x86_64)
ARCH_CFLAGS="-m64"
ARCH_LDFLAGS="-m64"
;;
esac
ARCH_CFLAGS+=" $CFLAGS"
if test x"$show_help" = x"yes" ; then
cat << EOF
Usage: configure [options]
Options: [defaults in brackets after descriptions]
EOF
echo "Standard options:"
echo " --help print this message"
echo " --prefix=PREFIX install in PREFIX [$prefix]"
echo " --interp-prefix=PREFIX where to find shared libraries, etc."
echo " use %M for cpu name [$interp_prefix]"
echo " --target-list=LIST set target list [$target_list]"
echo ""
echo "kqemu kernel acceleration support:"
echo " --disable-kqemu disable kqemu support"
echo ""
echo "Advanced options (experts only):"
echo " --source-path=PATH path of source code [$source_path]"
echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
echo " --cc=CC use C compiler CC [$cc]"
echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
echo " --make=MAKE use specified make [$make]"
echo " --install=INSTALL use specified install [$install]"
echo " --static enable static build [$static]"
echo " --enable-sparse enable sparse checker"
echo " --disable-sparse disable sparse checker (default)"
echo " --disable-werror disable compilation abort on warning"
echo " --disable-sdl disable SDL"
echo " --enable-cocoa enable COCOA (Mac OS X only)"
echo " --audio-drv-list=LIST set audio drivers list:"
echo " Available drivers: $audio_possible_drivers"
echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
echo " Available cards: $audio_possible_cards"
echo " --enable-mixemu enable mixer emulation"
echo " --disable-brlapi disable BrlAPI"
echo " --disable-vnc-tls disable TLS encryption for VNC server"
echo " --disable-curses disable curses output"
echo " --disable-bluez disable bluez stack connectivity"
echo " --disable-kvm disable KVM acceleration support"
echo " --disable-nptl disable usermode NPTL support"
echo " --enable-system enable all system emulation targets"
echo " --disable-system disable all system emulation targets"
echo " --enable-linux-user enable all linux usermode emulation targets"
echo " --disable-linux-user disable all linux usermode emulation targets"
echo " --enable-darwin-user enable all darwin usermode emulation targets"
echo " --disable-darwin-user disable all darwin usermode emulation targets"
echo " --enable-bsd-user enable all BSD usermode emulation targets"
echo " --disable-bsd-user disable all BSD usermode emulation targets"
echo " --fmod-lib path to FMOD library"
echo " --fmod-inc path to FMOD includes"
echo " --oss-lib path to OSS library"
echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
echo " --disable-vde disable support for vde network"
echo " --disable-aio disable AIO support"
echo " --disable-blobs disable installing provided firmware blobs"
echo " --kerneldir=PATH look for kernel includes in PATH"
echo ""
echo "NOTE: The object files are built at the place where configure is launched"
exit 1
fi
if test "$mingw32" = "yes" ; then
linux="no"
EXESUF=".exe"
oss="no"
linux_user="no"
bsd_user="no"
fi
if test ! -x "$(which cgcc 2>/dev/null)"; then
sparse="no"
fi
#
# Solaris specific configure tool chain decisions
#
if test "$solaris" = "yes" ; then
solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
if test -z "$solinst" ; then
echo "Solaris install program not found. Use --install=/usr/ucb/install or"
echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
exit 1
fi
if test "$solinst" = "/usr/sbin/install" ; then
echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
echo "try ginstall from the GNU fileutils available from www.blastwave.org"
echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
exit 1
fi
sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
if test -z "$sol_ar" ; then
echo "Error: No path includes ar"
if test -f /usr/ccs/bin/ar ; then
echo "Add /usr/ccs/bin to your path and rerun configure"
fi
exit 1
fi
fi
if test -z "$target_list" ; then
# these targets are portable
if [ "$softmmu" = "yes" ] ; then
target_list="\
i386-softmmu \
x86_64-softmmu \
arm-softmmu \
cris-softmmu \
m68k-softmmu \
mips-softmmu \
mipsel-softmmu \
mips64-softmmu \
mips64el-softmmu \
ppc-softmmu \
ppcemb-softmmu \
ppc64-softmmu \
sh4-softmmu \
sh4eb-softmmu \
sparc-softmmu \
"
fi
# the following are Linux specific
if [ "$linux_user" = "yes" ] ; then
target_list="${target_list}\
i386-linux-user \
x86_64-linux-user \
alpha-linux-user \
arm-linux-user \
armeb-linux-user \
cris-linux-user \
m68k-linux-user \
mips-linux-user \
mipsel-linux-user \
ppc-linux-user \
ppc64-linux-user \
ppc64abi32-linux-user \
sh4-linux-user \
sh4eb-linux-user \
sparc-linux-user \
sparc64-linux-user \
sparc32plus-linux-user \
"
fi
# the following are Darwin specific
if [ "$darwin_user" = "yes" ] ; then
target_list="$target_list i386-darwin-user ppc-darwin-user "
fi
# the following are BSD specific
if [ "$bsd_user" = "yes" ] ; then
target_list="${target_list}\
sparc64-bsd-user \
"
fi
else
target_list=`echo "$target_list" | sed -e 's/,/ /g'`
fi
if test -z "$target_list" ; then
echo "No targets enabled"
exit 1
fi
if test -z "$cross_prefix" ; then
# ---
# big/little endian test
cat > $TMPC << EOF
#include <inttypes.h>
int main(int argc, char ** argv){
volatile uint32_t i=0x01234567;
return (*((uint8_t*)(&i))) == 0x67;
}
EOF
if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
$TMPE && bigendian="yes"
else
echo big/little test failed
fi
else
# if cross compiling, cannot launch a program, so make a static guess
if test "$cpu" = "armv4b" \
-o "$cpu" = "hppa" \
-o "$cpu" = "m68k" \
-o "$cpu" = "mips" \
-o "$cpu" = "mips64" \
-o "$cpu" = "ppc" \
-o "$cpu" = "ppc64" \
-o "$cpu" = "s390" \
-o "$cpu" = "sparc" \
-o "$cpu" = "sparc64"; then
bigendian="yes"
fi
fi
# host long bits test
hostlongbits="32"
if test "$cpu" = "x86_64" \
-o "$cpu" = "alpha" \
-o "$cpu" = "ia64" \
-o "$cpu" = "sparc64" \
-o "$cpu" = "ppc64"; then
hostlongbits="64"
fi
# check gcc options support
cat > $TMPC <<EOF
int main(void) {
}
EOF
# Check host NPTL support
cat > $TMPC <<EOF
#include <sched.h>
#include <linux/futex.h>
void foo()
{
#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
#error bork
#endif
}
EOF
if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
:
else
nptl="no"
fi
##########################################
# zlib check
cat > $TMPC << EOF
#include <zlib.h>
int main(void) { zlibVersion(); return 0; }
EOF
if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
:
else
echo
echo "Error: zlib check failed"
echo "Make sure to have the zlib libs and headers installed."
echo
exit 1
fi
##########################################
# SDL probe
sdl_too_old=no
if test -z "$sdl" ; then
sdl_config="sdl-config"
sdl=no
sdl_static=no
cat > $TMPC << EOF
#include <SDL.h>
#undef main /* We don't want SDL to override our main() */
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
EOF
if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then
_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
if test "$_sdlversion" -lt 121 ; then
sdl_too_old=yes
else
if test "$cocoa" = "no" ; then
sdl=yes
fi
fi
# static link with sdl ?
if test "$sdl" = "yes" ; then
aa="no"
`$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
if [ "$aa" = "yes" ] ; then
sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
fi
if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
sdl_static=yes
fi
fi # static link
fi # sdl compile test
else
# Make sure to disable cocoa if sdl was set
if test "$sdl" = "yes" ; then
cocoa="no"
audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
fi
fi # -z $sdl
if test "$sdl" = "yes" ; then
cat > $TMPC <<EOF
#include <SDL.h>
#if defined(SDL_VIDEO_DRIVER_X11)
#include <X11/XKBlib.h>
#else
#error No x11 support
#endif
int main(void) { return 0; }
EOF
if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > /dev/null 2>&1 ; then
sdl_x11="yes"
fi
fi
##########################################
# VNC TLS detection
if test "$vnc_tls" = "yes" ; then
cat > $TMPC <<EOF
#include <gnutls/gnutls.h>
int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
EOF
vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
$vnc_tls_libs > /dev/null 2> /dev/null ; then
:
else
vnc_tls="no"
fi
fi
##########################################
# vde libraries probe
if test "$vde" = "yes" ; then
cat > $TMPC << EOF
#include <libvdeplug.h>
int main(void)
{
struct vde_open_args a = {0, 0, 0};
vde_open("", "", &a);
return 0;
}
EOF
if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
:
else
vde="no"
fi
fi
##########################################
# OpenGL test
if test -z "$opengl" && test "$sdl" = "yes"
then
cat > $TMPC << EOF
#include <SDL_opengl.h>
#ifndef GL_TEXTURE_RECTANGLE_ARB
#error "Opengl doesn't support GL_TEXTURE_RECTANGLE_ARB"
#endif
int main( void ) { return (int) glGetString(GL_EXTENSIONS); }
EOF
if $cc $ARCH_CFLAGS -o $TMPE `$sdl_config --cflags --libs 2> /dev/null` -I/usr/include/GL $TMPC -lXext -lGL 2> /dev/null
then
opengl="yes"
else
opengl="no"
fi
fi
# Sound support libraries probe
audio_drv_probe()
{
drv=$1
hdr=$2
lib=$3
exp=$4
cfl=$5
cat > $TMPC << EOF
#include <$hdr>
int main(void) { $exp }
EOF
if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
:
else
echo
echo "Error: $drv check failed"
echo "Make sure to have the $drv libs and headers installed."
echo
exit 1
fi
}
audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
for drv in $audio_drv_list; do
case $drv in
alsa)
audio_drv_probe $drv alsa/asoundlib.h -lasound \
"snd_pcm_t **handle; return snd_pcm_close(*handle);"
;;
fmod)
if test -z $fmod_lib || test -z $fmod_inc; then
echo
echo "Error: You must specify path to FMOD library and headers"
echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
echo
exit 1
fi
audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
;;
esd)
audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
;;
pa)
audio_drv_probe $drv pulse/simple.h -lpulse-simple \
"pa_simple *s = NULL; pa_simple_free(s); return 0;"
;;
oss|sdl|core|wav|dsound)
# XXX: Probes for CoreAudio, DirectSound, SDL(?)
;;
*)
echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
echo
echo "Error: Unknown driver '$drv' selected"
echo "Possible drivers are: $audio_possible_drivers"
echo
exit 1
}
;;
esac
done
##########################################
# BrlAPI probe
if test -z "$brlapi" ; then
brlapi=no
cat > $TMPC << EOF
#include <brlapi.h>
int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
EOF
if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
brlapi=yes
fi # brlapi compile test
fi # -z $brlapi
##########################################
# curses probe
if test "$curses" = "yes" ; then
curses=no
cat > $TMPC << EOF
#include <curses.h>
int main(void) { return curses_version(); }
EOF
if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
curses=yes
fi
fi # test "$curses"
##########################################
# bluez support probe
if test "$bluez" = "yes" ; then
`pkg-config bluez` || bluez="no"
fi
if test "$bluez" = "yes" ; then
cat > $TMPC << EOF
#include <bluetooth/bluetooth.h>
int main(void) { return bt_error(0); }
EOF
bluez_cflags=`pkg-config --cflags bluez`
bluez_libs=`pkg-config --libs bluez`
if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
$bluez_libs > /dev/null 2> /dev/null ; then
:
else
bluez="no"
fi
fi
##########################################