-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·2788 lines (2619 loc) · 72.4 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
# The purpose of this script is to check for all external tools, headers, and
# libraries VBox OSE depends on.
#
# Copyright (C) 2006-2013 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# you can redistribute it and/or modify it under the terms of the GNU
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
LC_ALL=C
export LC_ALL
# append some extra paths
PATH="$PATH:/opt/gnome/bin"
# Solaris (order of paths important for tr, echo, grep, sed to work)
PATH="/usr/xpg4/bin:/usr/ucb:$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin"
ORGPATH=$PATH
# Wrapper for ancient /usr/bin/which on darwin that always returns 0
which_wrapper()
{
if [ -z "$have_ancient_which" ]; then
if which /bin/___cErTaINly_a_nOn_eXisTing_fIle___ 2> /dev/null > /dev/null; then
have_ancient_which="yes"
else
have_ancient_which="no"
fi
fi
if [ "$have_ancient_which" = "yes" ]; then
retval=`which $* 2>/dev/null`
echo "$retval"
test -n "$retval" -a -x "$retval"
unset retval
else
which $* 2> /dev/null
fi
}
OS=`uname -s | sed -e 's/GNU\/Linux/Linux/g' | tr '[:upper:]' '[:lower:]'`
case "$OS" in
linux)
;;
darwin)
;;
freebsd)
;;
sunos)
OS='solaris'
;;
haiku)
;;
*)
echo "Cannot determine OS!"
exit 1
;;
esac
#
# Defaults
#
OSE=1
ODIR="`pwd`/"
ODIR_OVERRIDE=0
OUT_PATH=""
OUT_PATH_OVERRIDE=0
SETUP_WINE=
TARGET_MACHINE=""
TARGET_CPU=""
WITH_XPCOM=1
WITH_PYTHON=1
WITH_JAVA=1
WITH_VMMRAW=1
WITH_LIBIDL=1
WITH_GSOAP=0
WITH_QT4=1
WITH_SDL=1
WITH_SDL_TTF=1
WITH_X11=1
WITH_ALSA=1
WITH_PULSE=1
WITH_DBUS=1
WITH_DEVMAPPER=1
WITH_KMODS=1
WITH_OPENGL=1
WITH_HARDENING=1
WITH_UDPTUNNEL=1
WITH_VDE=0
WITH_VNC=0
WITH_EXTPACK=1
WITH_DOCS=1
WITH_LIBVPX=1
BUILD_LIBXML2=
BUILD_LIBCURL=
BUILD_LIBSSL=
BUILD_LIBVPX=
PASSIVE_MESA=0
CC="gcc"
CC32=""
CC64=""
CXX="g++"
CXX32=""
CXX64=""
YASM="yasm"
IASL="iasl"
XSLTPROC="xsltproc"
GENISOIMAGE="genisoimage"
MKISOFS="mkisofs"
INCCRYPTO=""
LIBCRYPTO="-lssl -lcrypto"
LIBPTHREAD="-lpthread"
LIBCAP="-lcap"
GSOAP=""
GSOAP_IMPORT=""
INCX11="/usr/local/include"
LIBX11="-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib -lXext -lX11"
LIBXCURSOR="-lXcursor"
LIBXMU="-lXmu"
LIBXINERAMA="-lXinerama"
LIBXRANDR="-lXrandr"
MAKESELF="makeself"
MESA="-lGL"
INCZ=""
LIBZ="-lz"
INCVNCSERVER=""
LIBVNCSERVER="-lvncserver"
INCDEVMAPPER=""
LIBDEVMAPPER="-ldevmapper"
CXX_FLAGS=""
if [ "$OS" = "freebsd" ]; then
INCCURL="-I/usr/local/include"
LIBCURL="-L/usr/local/lib -lcurl"
INCPULSE="-I/usr/local/include"
LIBPULSE="-L/usr/local/lib"
INCPNG="-I/usr/local/include"
LIBPNG="-L/usr/local/lib -lpng"
else
INCCURL=""
LIBCURL="-lcurl"
INCPNG=""
LIBPNG="-lpng"
fi
INCVPX=""
LIBVPX="-lvpx"
PKGCONFIG="`which_wrapper pkg-config`"
PYTHONDIR="/usr /usr/local"
QT4DIR="/usr/lib/qt4 /usr/share/qt4 /usr/lib64/qt4 /usr /usr/local"
QT4DIR_PKGCONFIG=1
QT4UIC3DIR="/usr/bin"
KBUILDDIR="`cd \`dirname $0\`; pwd`/kBuild"
DEVDIR="`cd \`dirname $0\`; pwd`/tools"
if [ -d "/lib/modules/`uname -r`/build" ]; then
LINUX="/lib/modules/`uname -r`/build"
else
LINUX="/usr/src/linux"
fi
KCHMVIEWER="kchmviewer"
LOG="configure.log"
CNF="AutoConfig.kmk"
ENV="env.sh"
BUILD_TYPE="release"
# the restricting tool is ar (mri mode).
INVALID_CHARS="[^A-Za-z0-9/\\$:._-]"
if (cd `dirname $0`; pwd)|grep -q "$INVALID_CHARS"; then
echo "Error: VBox base path contains invalid characters!"
exit 1
fi
# darwin /bin/sh has a builtin echo that doesn't grok -n. gotta love it.
if [ "$OS" = "darwin" ]; then
ECHO_N="/bin/echo -n"
else
ECHO_N="echo -n"
fi
cleanup()
{
rm -f $ODIR.tmp_src.cc $ODIR.tmp_src.c $ODIR.tmp_out $ODIR.test_execute.log
}
fail()
{
if [ -z "$nofatal" -o "x$1" != "x" ]; then
cleanup
rm -f $ENV
echo "Check $LOG for details"
exit 1
fi
}
log()
{
echo "$1"
echo "$1" >> $LOG
}
log_success()
{
if [ -n "$1" ]; then $ECHO_N "$1, "; fi
echo "OK."
echo "$1" >> $LOG
echo >> $LOG
echo >> $LOG
}
log_failure()
{
echo
echo " ** $1!"
echo "** $1!" >> $LOG
echo >> $LOG
}
cnf_append()
{
printf "%-30s := %s\n" "$1" "$2" >> $CNF
}
strip_l()
{
echo "$1"|$KBUILD_SED 's|-l\([^ ]\+\)|\1|g; s|^-[^l][^ ]*||g; s| -[^l][^ ]*||g; s|^ ||; s| *$||g'
}
strip_L()
{
echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g'
}
strip_I()
{
echo "$1"|$KBUILD_SED 's|-I\([^ ]\+\)|\1|g; s|^-[^I][^ ]*||g; s| -[^I][^ ]*||g; s|^ ||; s| *$||g'
}
prefix_I()
{
echo "$1"|$KBUILD_SED 's|^\/|-I/|g; s| \/| -I/|g'
}
check_avail()
{
if [ -z "$1" ]; then
log_failure "$2 is empty"
fail $3
return 1
elif which_wrapper $1 > /dev/null; then
return 0
else
log_failure "$1 (variable $2) not found"
fail $3
return 1
fi
}
# Prepare a test
test_header()
{
echo "***** Checking $1 *****" >> $LOG
$ECHO_N "Checking for $1: "
}
# Compile a test
# $1 compile flags/libs
# $2 library name
# $3 package name
# $4 if this argument is 'nofatal', don't abort
test_compile()
{
echo "compiling the following source file:" >> $LOG
cat $ODIR.tmp_src.cc >> $LOG
echo "using the following command line:" >> $LOG
echo "$CXX $CXX_FLAGS -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc \"$1\"" >> $LOG
$CXX $CXX_FLAGS -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc $1 >> $LOG 2>&1
if [ $? -ne 0 ]; then
if [ -z "$4" ]; then
echo
echo " $2 not found at $1 or $3 headers not found"
echo " Check the file $LOG for detailed error information."
fail
else
echo >> $LOG
echo >> $LOG
fi
return 1
fi
return 0
}
# Execute a compiled test binary
test_execute()
{
echo "executing the binary" >> $LOG
$ODIR.tmp_out > $ODIR.test_execute.log
rc=$?
cat $ODIR.test_execute.log | tee -a $LOG
if [ $rc -ne 0 ]; then
fail $1
return 1
fi
echo >> $LOG
echo >> $LOG
return 0
}
# Execute a compiled test binary
test_execute_path()
{
echo "executing the binary (LD_LIBRARY_PATH=$1)" >> $LOG
LD_LIBRARY_PATH=$1 $ODIR.tmp_out > $ODIR.test_execute.log
rc=$?
cat $ODIR.test_execute.log | tee -a $LOG
if [ $rc -ne 0 ]; then
fail
return 1
fi
echo >> $LOG
echo >> $LOG
return 0
}
#
# Check for OS, MACHINE, CPU
#
check_environment()
{
test_header environment
BUILD_CPU=`uname -m`
[ "$OS" = "solaris" ] && BUILD_CPU=`isainfo | cut -f 1 -d ' '`
case "$BUILD_CPU" in
i[3456789]86|x86|i86pc|BePC)
BUILD_MACHINE='x86'
LIB='lib'
;;
x86_64|amd64)
BUILD_MACHINE='amd64'
BUILD_CPU='k8'
if [ "$OS" != "solaris" ]; then
# on AMD64 systems, 64bit libs are usually located in /usr/lib64
# see http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64
LIB='lib64'
else
# Solaris doesn't seem to subscribe to fhs, libs are usually in
# a '64' subdirectory of the standard 'lib' dirs while some 64-bit
# alternative binaries can be found in 'amd64' subdirs of the 'bin'
# ones. So, in order to find the right stuff (esp. sdl-config) we'll
# have to make sure the */bin/amd64 dirs are searched before the */bin
# ones. (The sed has some sideeffects, but they shouldn't harm us...)
echo "64-bit Solaris detected, hacking the PATH" >> $LOG
echo "old PATH: $PATH" >> $LOG
PATH=`echo ":$PATH:" | sed -e 's,\(:[^:]*/bin\):,\1/amd64:\1:,g' \
-e 's/^:*//' -e 's/:*$//g' -e 's/::*/:/g' `
export PATH
echo "new PATH: $PATH" >> $LOG
LIB='lib/64'
fi
;;
*)
log_failure "Cannot determine system"
exit 1
;;
esac
[ -z "$TARGET_MACHINE" ] && TARGET_MACHINE=$BUILD_MACHINE
[ -z "$TARGET_CPU" ] && TARGET_CPU=$BUILD_CPU
DEVDIR_BIN="$DEVDIR/$OS.$BUILD_MACHINE/bin"
log_success "Determined build machine: $OS.$BUILD_MACHINE, target machine: $OS.$TARGET_MACHINE"
echo "BUILD_PLATFORM=\"$OS\"" >> $ENV
echo "export BUILD_PLATFORM" >> $ENV
echo "BUILD_PLATFORM_ARCH=\"$BUILD_MACHINE\"" >> $ENV
echo "export BUILD_PLATFORM_ARCH" >> $ENV
echo "BUILD_TARGET=\"$OS\"" >> $ENV
echo "export BUILD_TARGET" >> $ENV
echo "BUILD_TARGET_ARCH=\"$TARGET_MACHINE\"" >> $ENV
echo "export BUILD_TARGET_ARCH" >> $ENV
echo "BUILD_TARGET_CPU=\"$TARGET_CPU\"" >> $ENV
echo "export BUILD_TARGET_CPU" >> $ENV
echo "BUILD_TYPE=\"$BUILD_TYPE\"" >> $ENV
echo "export BUILD_TYPE" >> $ENV
}
#
# Check for gcc with version >= 3.2.
# We depend on a working gcc, if we fail terminate in every case.
#
check_gcc()
{
test_header gcc
if check_avail "$CC" CC really; then
cc_ver=`$CC -dumpversion` 2>/dev/null
if [ $? -ne 0 ]; then
log_failure "cannot execute '$CC -dumpversion'"
fail really
fi
if check_avail "$CXX" CXX really; then
cxx_ver=`$CXX -dumpversion` 2>/dev/null
if [ $? -ne 0 ]; then
log_failure "cannot execute '$CXX -dumpversion'"
fail really
fi
cc_maj=`echo $cc_ver|cut -d. -f1`
cc_min=`echo $cc_ver|cut -d. -f2`
if [ "x$cc_ver" != "x$cxx_ver" ]; then
log_failure "gcc version $cc_ver does not match g++ version $cxx_ver"
fail really
elif [ $cc_maj -eq 4 -a $cc_min -eq 0 -a "$OS" = "darwin" ]; then
log_success "found version $cc_ver"
# gcc-4.0 is allowed for Darwin only
elif [ $cc_maj -lt 3 \
-o \( $cc_maj -eq 3 -a $cc_min -lt 2 \) \
-o \( $cc_maj -eq 4 -a $cc_min -lt 1 -a "$OS" != "darwin" \) \
-o \( $cc_maj -eq 4 -a $cc_min -gt 8 \) \
-o $cc_maj -gt 4 ]; then
log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<8"
fail really
else
log_success "found version $cc_ver"
fi
if [ "$BUILD_MACHINE" = "amd64" ]; then
[ -z "$CC32" ] && CC32="$CC -m32"
[ -z "$CXX32" ] && CXX32="$CXX -m32"
else
[ -z "$CC32" ] && CC32="$CC"
[ -z "$CXX32" ] && CXX32="$CXX"
fi
if [ "$BUILD_MACHINE" = "x86" -a "$TARGET_MACHINE" = "amd64" ]; then
[ -z "$CC64" ] && CC64="$CC -m64"
[ -z "$CXX64" ] && CXX64="$CXX -m64"
fi
if [ "$TARGET_MACHINE" = "amd64" -a $WITH_VMMRAW -eq 0 ]; then
CC32="undefined"
CXX32="undefined"
fi
if [ "$CC" != "gcc" ]; then
cnf_append "TOOL_GCC3_CC" "$CC"
cnf_append "TOOL_GCC3_AS" "$CC"
cnf_append "TOOL_GCC3_LD" "$CC"
cnf_append "TOOL_GXX3_CC" "$CC"
cnf_append "TOOL_GXX3_AS" "$CC"
fi
if [ "$CXX" != "g++" ]; then
cnf_append "TOOL_GCC3_CXX" "$CXX"
cnf_append "TOOL_GXX3_CXX" "$CXX"
cnf_append "TOOL_GXX3_LD" "$CXX"
fi
if [ "$CC32" != "gcc -m32" -a "$CC32" != "undefined" ]; then
cnf_append "TOOL_GCC32_CC" "$CC32"
cnf_append "TOOL_GCC32_AS" "$CC32"
cnf_append "TOOL_GCC32_LD" "$CC32"
cnf_append "TOOL_GXX32_CC" "$CC32"
cnf_append "TOOL_GXX32_AS" "$CC32"
fi
if [ "$CXX32" != "g++ -m32" -a "$CXX32" != "undefined" ]; then
cnf_append "TOOL_GCC32_CXX" "$CXX32"
cnf_append "TOOL_GXX32_CXX" "$CXX32"
cnf_append "TOOL_GXX32_LD" "$CXX32"
fi
# this isn't not necessary, there is not such tool.
if [ -n "$CC64" ]; then
cnf_append "TOOL_GCC64_CC" "$CC64"
cnf_append "TOOL_GCC64_AS" "$CC64"
cnf_append "TOOL_GCC64_LD" "$CC64"
cnf_append "TOOL_GXX64_CC" "$CC64"
cnf_append "TOOL_GXX64_AS" "$CC64"
fi
if [ -n "$CXX64" ]; then
cnf_append "TOOL_GCC64_CXX" "$CXX64"
cnf_append "TOOL_GXX64_CXX" "$CXX64"
cnf_append "TOOL_GXX64_LD" "$CXX64"
fi
# Solaris sports a 32-bit gcc/g++.
if [ "$OS" = "solaris" -a "$BUILD_MACHINE" = "amd64" ]; then
[ "$CC" = "gcc" ] && CC="gcc -m64"
[ "$CXX" = "g++" ] && CXX="g++ -m64"
fi
fi
fi
}
#
# Check for the OpenWatcom compiler, needed for compiling the BIOS
#
# If the system has Open Watcom installed, WATCOM will be set in the
# environment. If the user has her/his own Open Watcom install it will be
# pointed to by on the command line, which will set the WATCOM variable.
# The only exception is detecting OpenWatcom in tools/common/openwatcom.
#
check_open_watcom()
{
test_header "Open Watcom"
if [ -z "$WATCOM" ]; then
WATCOM=`/bin/ls -rd1 $PWD/tools/common/openwatcom/* 2> /dev/null | head -1`
if [ -z "$WATCOM" ]; then
log_failure "Open Watcom was not found"
cnf_append "VBOX_WITH_OPEN_WATCOM" ""
return 0;
fi
fi
case "$OS" in
"darwin") wc_bin="binosx";; # ??
"dos") wc_bin="binw";;
"freebsd") wc_bin="binfbsd";; # ??
"linux") wc_bin="binl";;
"solaris") wc_bin="binsol";; # ??
"os2") wc_bin="binp";;
"win") wc_bin="binnt";;
*) wc_bin="binl";;
esac
# Check that the tools we use are there.
for prog in wasm wcc wlink;
do
if [ ! -f "$WATCOM/$wc_bin/$prog" ]; then
log_failure "$WATCOM/$wc_bin/$prog does not exist or is not a regular file."
fail
fi
done
# Use WASM to get the version.
wasm_ver=`$WATCOM/$wc_bin/wasm -? 2>&1 | sed -e '1!d' -e 's/Open Watcom Assembler Version *//'`
if [ -z "$wasm_ver" ]; then
log_failure "$WATCOM/$wc_bin/wasm -? did not produce the expected response"
fail
fi
log_success "found version $wasm_ver"
cnf_append "PATH_TOOL_OPENWATCOM" "$WATCOM"
cnf_append "VBOX_WITH_OPEN_WATCOM" "1"
unset wasm_ver
unset wc_wasm
unset wc_bin
}
#
# Check for yasm, needed to compile assembler files
#
check_yasm()
{
test_header yasm
if check_avail "$YASM" YASM; then
yasm_ver=`$YASM --version|grep "^yasm"|sed 's+^yasm \(.*\)+\1+'`
if [ $? -ne 0 ]; then
log_failure "yasm not found"
fail
else
yasm_maj=`echo $yasm_ver|cut -d. -f1`
yasm_min=`echo $yasm_ver|cut -d. -f2`
yasm_rev=`echo $yasm_ver|cut -d. -f3`
yasm_ver_mul=`expr $yasm_maj \* 10000 + $yasm_min \* 100 + $yasm_rev`
if [ $yasm_ver_mul -lt 501 ]; then
log_failure "found version $yasm_ver, expected at least 0.5.1"
fail
else
log_success "found version $yasm_ver"
fi
fi
fi
}
#
# Check for the iasl ACPI compiler, needed to compile vbox.dsl
#
check_iasl()
{
test_header iasl
if check_avail "$IASL" IASL; then
iasl_ver=`$IASL|grep "ASL.*version"|sed 's+^ASL.*version \([0-9]*\).*+\1+'`
if [ $? -ne 0 ]; then
log_failure "iasl not found"
fail
else
log_success "found version $iasl_ver"
cnf_append "VBOX_IASLCMD" "`which_wrapper $IASL`"
fi
fi
}
#
# Check for xsltproc, needed by Main
#
check_xsltproc()
{
if [ -n "$BUILD_LIBXSLT" ]; then
return 0;
fi
test_header xslt
if check_avail "$XSLTPROC" XSLTPROC; then
xsltproc_ver=`$XSLTPROC --version`
if [ $? -ne 0 ]; then
log_failure "xsltproc not found"
fail
else
log_success "found"
cnf_append "VBOX_XSLTPROC" "`which_wrapper $XSLTPROC`"
fi
fi
}
#
# Check for mkisofs, needed to build the CDROM image containing the additions
#
check_mkisofs()
{
test_header mkisofs
if which_wrapper $GENISOIMAGE > /dev/null; then
mkisofs_ver=`$GENISOIMAGE --version`
if [ $? -ne 0 ]; then
log_failure "mkisofs not found"
fail
else
log_success "found $mkisofs_ver"
cnf_append "VBOX_MKISOFS" "`which_wrapper $GENISOIMAGE`"
fi
elif check_avail "$MKISOFS" MKISOFS; then
mkisofs_ver=`$MKISOFS --version`
if [ $? -ne 0 ]; then
log_failure "mkisofs not working"
fail
else
log_success "found $mkisofs_ver"
cnf_append "VBOX_MKISOFS" "`which_wrapper $MKISOFS`"
fi
fi
}
#
# Check for libxml2, needed by VBoxSettings and Runtime.
# 2.6.24 is known to NOT work, 2.6.26 is known to work (there is no 2.6.25 release)
#
check_libxml2()
{
if [ -z "$BUILD_LIBXML2" ]; then
test_header libxml2
if which_wrapper pkg-config > /dev/null; then
libxml2_ver=`pkg-config libxml-2.0 --modversion 2>> $LOG`
if [ $? -ne 0 ]; then
log_failure "libxml2 not found"
fail
else
FLGXML2=`pkg-config libxml-2.0 --cflags`
INCXML2=`strip_I "$FLGXML2"`
LIBXML2=`pkg-config libxml-2.0 --libs`
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <libxml/xmlversion.h>
extern "C" int main(void)
{
printf("found version %s", LIBXML_DOTTED_VERSION);
#if LIBXML_VERSION >= 20626
printf(", OK.\n");
return 0;
#else
printf(", expected version 2.6.26 or higher\n");
return 1;
#endif
}
EOF
[ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
if test_execute; then
cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
fi
fi
fi
elif which_wrapper xml2-config; then
libxml2_ver=`xml2-config --version`
if [ $? -ne 0 ]; then
log_failure "xml2-config not found"
fail
else
log_success "found version $libxml2_ver"
FLGXML2=`xml2-config --cflags`
INCXML2=`strip_I "$FLGXML2"`
LIBXML2=`xml2-config --libs`
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <libxml/xmlversion.h>
extern "C" int main(void)
{
printf("found version %s", LIBXML_DOTTED_VERSION);
#if LIBXML_VERSION >= 20626
printf(", OK.\n");
return 0;
#else
printf(", expected version 2.6.26 or higher\n");
return 1;
#endif
}
EOF
[ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
if test_execute; then
cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
fi
fi
fi
else
log_failure "neither pkg-config nor xml2-config found"
fail
fi
fi
}
#
# Check for libIDL, needed by xpcom
#
check_libidl()
{
test_header libIDL
if which_wrapper libIDL-config-2 > /dev/null; then
libidl_ver=`libIDL-config-2 --version`
if [ $? -ne 0 ]; then
log_failure "libIDL-config-2 not working"
fail
else
log_success "found version $libidl_ver"
cnf_append "VBOX_LIBIDL_CONFIG" \
"PKG_CONFIG_PATH=`libIDL-config-2 --prefix`/$LIB/pkgconfig `which_wrapper libIDL-config-2`"
fi
elif check_avail "libIDL-config" libIDL-config; then
libidl_ver=`libIDL-config --version`
if [ $? -ne 0 ]; then
log_failure "libIDL-config not working"
fail
else
log_success "found version $libidl_ver"
cnf_append "VBOX_LIBIDL_CONFIG" "`which_wrapper libIDL-config`"
fi
fi
}
#
# Check for libdevmapper, needed by the VBoxVolInfo
#
check_libdevmapper()
{
test_header libdevmapper
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
extern "C" {
#define private
#include <libdevmapper.h>
int main()
{
char version[80];
if (!dm_get_library_version(version, sizeof(version)))
{
printf("dm_get_library_version() failed.\n");
return 1;
}
const char* v=version;
unsigned int major = 0, minor = 0, micro = 0;
for (; *v !='.' && *v != '\0'; v++) major = major*10 + *v-'0';
if (*v == '.') v++;
for (; *v !='.' && *v != '\0'; v++) minor = minor*10 + *v-'0';
if (*v == '.') v++;
for (; *v !='.' && *v != '\0'; v++) micro = micro*10 + *v-'0';
printf("found version %s", version);
if (major*10000 + minor*100 + micro >= 10200)
{
printf(", OK.\n");
return 0;
}
else
{
printf(", expected version 1.02 or higher\n");
return 1;
}
}
}
EOF
if test_compile "$LIBDEVMAPPER $INCDEVMAPPER" libdevmapper libdevmapper; then
if test_execute; then
cnf_append "VBOX_WITH_DEVMAPPER" "1"
fi
fi
}
#
# Check for openssl, needed for RDP and S3
#
check_ssl()
{
if [ -z "$BUILD_LIBSSL" ]; then
test_header ssl
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <openssl/opensslv.h>
#include <openssl/ssl.h>
extern "C" int main(void)
{
printf("found version %s", OPENSSL_VERSION_TEXT);
SSL_library_init();
#if OPENSSL_VERSION_NUMBER >= 0x00908000
printf(", OK.\n");
return 0;
#else
printf(", expected version 0.9.8 or higher\n");
return 1;
#endif
}
EOF
if test_compile "$INCCRYPTO $LIBCRYPTO" libcrypto openssl; then
if test_execute nofatal; then
cnf_append "SDK_VBOX_OPENSSL_INCS" "`strip_I "$INCCRYPTO"`"
cnf_append "SDK_VBOX_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
cnf_append "SDK_VBOX_BLD_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
fi
fi
fi
}
#
# Check for pthread, needed by VBoxSVC, frontends, ...
#
check_pthread()
{
test_header pthread
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <pthread.h>
extern "C" int main(void)
{
pthread_mutex_t mutex;
if (pthread_mutex_init(&mutex, NULL)) {
printf("pthread_mutex_init() failed\n");
return 1;
}
if (pthread_mutex_lock(&mutex)) {
printf("pthread_mutex_lock() failed\n");
return 1;
}
if (pthread_mutex_unlock(&mutex)) {
printf("pthread_mutex_unlock() failed\n");
return 1;
}
printf("found, OK.\n");
}
EOF
if test_compile $LIBPTHREAD pthread pthread; then
if test_execute; then
cnf_append "LIB_PTHREAD" "`strip_l "$LIBPTHREAD"`"
fi
fi
}
#
# Check for zlib, needed by VBoxSVC, Runtime, ...
#
check_z()
{
test_header zlib
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <zlib.h>
extern "C" int main(void)
{
printf("found version %s", ZLIB_VERSION);
#if ZLIB_VERNUM >= 0x1210
printf(", OK.\n");
return 0;
#else
printf(", expected version 1.2.1 or higher\n");
return 1;
#endif
}
EOF
[ -n "$INCZ" ] && I_INCZ=`prefix_I "$INCZ"`
if test_compile "$LIBZ $I_INCZ" zlib zlib; then
if test_execute; then
echo "if1of (\$(KBUILD_TARGET),darwin freebsd haiku linux)" >> $CNF
cnf_append " SDK_VBOX_ZLIB_LIBS" "`strip_l "$LIBZ"`"
cnf_append " SDK_VBOX_ZLIB_INCS" "$INCZ"
echo "endif" >> $CNF
fi
fi
}
#
# Check for libpng, needed by kchmviewer
#
check_png()
{
test_header libpng
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <png.h>
extern "C" int main(void)
{
printf("found version %s", PNG_LIBPNG_VER_STRING);
#if PNG_LIBPNG_VER >= 10205
printf(", OK.\n");
return 0;
#else
printf(", expected version 1.2.5 or higher\n");
return 1;
#endif
}
EOF
[ -n "$INCPNG" ] && I_INCPNG=`prefix_I "$INCPNG"`
if test_compile "$LIBPNG $I_INCPNG" libpng libpng; then
if test_execute; then
cnf_append "SDK_VBOX_LIBPNG_LIBS" "`strip_l "$LIBPNG"`"
cnf_append "SDK_VBOX_LIBPNG_INCS" "$INCPNG"
fi
fi
}
#
# Check for libvncserver, needed for VNC in OSE
#
check_vncserver()
{
test_header libvncserver
cat > $ODIR.tmp_src.cc <<EOF
#include <cstdio>
#include <rfb/rfbconfig.h>
extern "C" int main()
{
const char* v=LIBVNCSERVER_VERSION;
unsigned int major = 0, minor = 0, micro = 0;
for (; *v !='.' && *v != '\0'; v++) major = major*10 + *v-'0';
if (*v == '.') v++;
for (; *v !='.' && *v != '\0'; v++) minor = minor*10 + *v-'0';
if (*v == '.') v++;
for (; *v !='.' && *v != '\0'; v++) micro = micro*10 + *v-'0';
printf("found version %s", LIBVNCSERVER_PACKAGE_VERSION);
if (major*10000 + minor*100 + micro >= 900)
{
printf(", OK.\n");
return 0;
}
else
{
printf(", expected version 0.9 or higher\n");
return 1;
}
}
EOF
if test_compile "$LIBVNCSERVER $INCVNCSERVER" libvncserver libvncserver; then
if test_execute; then
cnf_append "VBOX_WITH_EXTPACK_VNC" "1"
fi
fi
}
#
# Check for libcurl, needed by S3
#
check_curl()
{
if [ -z "$BUILD_LIBCURL" ]; then
test_header libcurl
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <curl/curl.h>
extern "C" int main(void)
{
printf("found version %s", LIBCURL_VERSION);
#if 10000*LIBCURL_VERSION_MAJOR + 100*LIBCURL_VERSION_MINOR + LIBCURL_VERSION_PATCH >= 71901
printf(", OK.\n");
return 0;
#else
printf(", expected version 7.19.1 or higher\n");
return 1;