~ubuntu-branches/ubuntu/quantal/virtualbox/quantal

« back to all changes in this revision

Viewing changes to .pc/33-link-static-libgsoap.patch/configure

  • Committer: Package Import Robot
  • Author(s): Felix Geyer
  • Date: 2012-04-05 12:41:55 UTC
  • mfrom: (3.1.12 sid)
  • Revision ID: package-import@ubuntu.com-20120405124155-i7b39tv5ddwhubbe
Tags: 4.1.12-dfsg-2
* Upstream has replaced the 4.1.12 tarball with a new one that fixes a
  crash when creating host only interfaces. (Closes: #667460)
  - Add 36-tarball-respin.patch which contains the diff between the old
    and the new tarball.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
# The purpose of this script is to check for all external tools, headers, and
3
 
# libraries VBox OSE depends on.
4
 
 
5
 
#
6
 
# Copyright (C) 2006-2011 Oracle Corporation
7
 
#
8
 
# This file is part of VirtualBox Open Source Edition (OSE), as
9
 
# available from http://www.virtualbox.org. This file is free software;
10
 
# you can redistribute it and/or modify it under the terms of the GNU
11
 
# General Public License (GPL) as published by the Free Software
12
 
# Foundation, in version 2 as it comes in the "COPYING" file of the
13
 
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14
 
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15
 
#
16
 
 
17
 
LC_ALL=C
18
 
export LC_ALL
19
 
 
20
 
# append some extra paths
21
 
PATH="$PATH:/opt/gnome/bin"
22
 
# Solaris (order of paths important for tr, echo, grep, sed to work)
23
 
PATH="/usr/xpg4/bin:/usr/ucb:$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin"
24
 
ORGPATH=$PATH
25
 
 
26
 
# Wrapper for ancient /usr/bin/which on darwin that always returns 0
27
 
which_wrapper()
28
 
{
29
 
  if [ -z "$have_ancient_which" ]; then
30
 
    if which /bin/___cErTaINly_a_nOn_eXisTing_fIle___ 2> /dev/null > /dev/null; then
31
 
      have_ancient_which="yes"
32
 
    else
33
 
      have_ancient_which="no"
34
 
    fi
35
 
  fi
36
 
  if [ "$have_ancient_which" = "yes" ]; then
37
 
    retval=`which $* 2>/dev/null`
38
 
    echo "$retval"
39
 
    test -n "$retval" -a -x "$retval"
40
 
    unset retval
41
 
  else
42
 
    which $* 2> /dev/null
43
 
  fi
44
 
}
45
 
 
46
 
OS=`uname -s | sed -e 's/GNU\/Linux/Linux/g' | tr [:upper:] [:lower:]`
47
 
case "$OS" in
48
 
  linux)
49
 
    ;;
50
 
  darwin)
51
 
    ;;
52
 
  freebsd)
53
 
    ;;
54
 
  sunos)
55
 
    OS='solaris'
56
 
    ;;
57
 
  *)
58
 
    echo "Cannot determine OS!"
59
 
    exit 1
60
 
    ;;
61
 
esac
62
 
 
63
 
#
64
 
# Defaults
65
 
#
66
 
OSE=1
67
 
ODIR="`pwd`/"
68
 
ODIR_OVERRIDE=0
69
 
OUT_PATH=""
70
 
OUT_PATH_OVERRIDE=0
71
 
SETUP_WINE=
72
 
TARGET_MACHINE=""
73
 
TARGET_CPU=""
74
 
WITH_XPCOM=1
75
 
WITH_PYTHON=1
76
 
WITH_JAVA=1
77
 
WITH_VMMRAW=1
78
 
WITH_LIBIDL=1
79
 
WITH_GSOAP=0
80
 
WITH_QT4=1
81
 
WITH_SDL=1
82
 
WITH_SDL_TTF=1
83
 
WITH_X11=1
84
 
WITH_ALSA=1
85
 
WITH_PULSE=1
86
 
WITH_DBUS=1
87
 
WITH_KMODS=1
88
 
WITH_OPENGL=1
89
 
WITH_HARDENING=1
90
 
WITH_UDPTUNNEL=1
91
 
WITH_VDE=0
92
 
WITH_VNC=0
93
 
WITH_EXTPACK=1
94
 
WITH_DOCS=1
95
 
BUILD_LIBXML2=
96
 
BUILD_LIBCURL=
97
 
BUILD_LIBSSL=
98
 
PASSIVE_MESA=0
99
 
CC="gcc"
100
 
CC32=""
101
 
CC64=""
102
 
CXX="g++"
103
 
CXX32=""
104
 
CXX64=""
105
 
BCC="bcc"
106
 
YASM="yasm"
107
 
IASL="iasl"
108
 
AS86="as86"
109
 
XSLTPROC="xsltproc"
110
 
GENISOIMAGE="genisoimage"
111
 
MKISOFS="mkisofs"
112
 
INCCRYPTO=""
113
 
LIBCRYPTO="-lssl -lcrypto"
114
 
LIBPTHREAD="-lpthread"
115
 
LIBCAP="-lcap"
116
 
GSOAP=""
117
 
GSOAP_IMPORT=""
118
 
INCX11="/usr/local/include"
119
 
LIBX11="-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib -lXext -lX11"
120
 
LIBXCURSOR="-lXcursor"
121
 
LIBXMU="-lXmu"
122
 
LIBXINERAMA="-lXinerama"
123
 
LIBXRANDR="-lXrandr"
124
 
MAKESELF="makeself"
125
 
MESA="-lGL"
126
 
INCZ=""
127
 
LIBZ="-lz"
128
 
INCVNCSERVER=""
129
 
LIBVNCSERVER="-lvncserver"
130
 
CXX_FLAGS=""
131
 
if [ "$OS" = "freebsd" ]; then
132
 
  INCCURL="-I/usr/local/include"
133
 
  LIBCURL="-L/usr/local/lib -lcurl"
134
 
  INCPULSE="-I/usr/local/include"
135
 
  LIBPULSE="-L/usr/local/lib"
136
 
  INCPNG="-I/usr/local/include"
137
 
  LIBPNG="-L/usr/local/lib -lpng"
138
 
else
139
 
  INCCURL=""
140
 
  LIBCURL="-lcurl"
141
 
  INCPNG=""
142
 
  LIBPNG="-lpng"
143
 
fi
144
 
PKGCONFIG="`which_wrapper pkg-config`"
145
 
PYTHONDIR="/usr /usr/local"
146
 
QT4DIR="/usr/lib/qt4 /usr/share/qt4 /usr/lib64/qt4 /usr /usr/local"
147
 
QT4DIR_PKGCONFIG=1
148
 
QT4UIC3DIR="/usr/bin"
149
 
KBUILDDIR="`cd \`dirname $0\`; pwd`/kBuild"
150
 
DEVDIR="`cd \`dirname $0\`; pwd`/tools"
151
 
if [ -d "/lib/modules/`uname -r`/build" ]; then
152
 
 LINUX="/lib/modules/`uname -r`/build"
153
 
else
154
 
 LINUX="/usr/src/linux"
155
 
fi
156
 
KCHMVIEWER="kchmviewer"
157
 
LOG="configure.log"
158
 
CNF="AutoConfig.kmk"
159
 
ENV="env.sh"
160
 
BUILD_TYPE="release"
161
 
# the restricting tool is ar (mri mode).
162
 
INVALID_CHARS="[^A-Za-z0-9/\\$:._-]"
163
 
 
164
 
# darwin /bin/sh has a builtin echo that doesn't grok -n. gotta love it.
165
 
if [ "$OS" = "darwin" ]; then
166
 
  ECHO_N="/bin/echo -n"
167
 
else
168
 
  ECHO_N="echo -n"
169
 
fi
170
 
 
171
 
 
172
 
cleanup()
173
 
{
174
 
  rm -f $ODIR.tmp_src.cc $ODIR.tmp_src.c $ODIR.tmp_out $ODIR.test_execute.log
175
 
}
176
 
 
177
 
fail()
178
 
{
179
 
  if [ -z "$nofatal" -o "x$1" != "x" ]; then
180
 
    cleanup
181
 
    rm -f $ENV
182
 
    echo "Check $LOG for details"
183
 
    exit 1
184
 
  fi
185
 
}
186
 
 
187
 
log()
188
 
{
189
 
  echo "$1"
190
 
  echo "$1" >> $LOG
191
 
}
192
 
 
193
 
log_success()
194
 
{
195
 
  if [ -n "$1" ]; then $ECHO_N "$1, "; fi
196
 
  echo "OK."
197
 
  echo "$1" >> $LOG
198
 
  echo >> $LOG
199
 
  echo >> $LOG
200
 
}
201
 
 
202
 
log_failure()
203
 
{
204
 
  echo
205
 
  echo "  ** $1!"
206
 
  echo "** $1!" >> $LOG
207
 
  echo >> $LOG
208
 
}
209
 
 
210
 
cnf_append()
211
 
{
212
 
  printf "%-30s := %s\n" "$1" "$2" >> $CNF
213
 
}
214
 
 
215
 
strip_l()
216
 
{
217
 
  echo "$1"|$KBUILD_SED 's|-l\([^ ]\+\)|\1|g; s|^-[^l][^ ]*||g; s| -[^l][^ ]*||g; s|^ ||; s| *$||g'
218
 
}
219
 
 
220
 
strip_L()
221
 
{
222
 
  echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g'
223
 
}
224
 
 
225
 
strip_I()
226
 
{
227
 
  echo "$1"|$KBUILD_SED 's|-I\([^ ]\+\)|\1|g; s|^-[^I][^ ]*||g; s| -[^I][^ ]*||g; s|^ ||; s| *$||g'
228
 
}
229
 
 
230
 
prefix_I()
231
 
{
232
 
  echo "$1"|$KBUILD_SED 's|^\/|-I/|g; s| \/| -I/|g'
233
 
}
234
 
 
235
 
check_avail()
236
 
{
237
 
   if [ -z "$1" ]; then
238
 
     log_failure "$2 is empty"
239
 
     fail $3
240
 
     return 1
241
 
   elif which_wrapper $1 > /dev/null; then
242
 
     return 0
243
 
   else
244
 
     log_failure "$1 (variable $2) not found"
245
 
     fail $3
246
 
     return 1
247
 
   fi
248
 
}
249
 
 
250
 
 
251
 
# Prepare a test
252
 
test_header()
253
 
{
254
 
  echo "***** Checking $1 *****" >> $LOG
255
 
  $ECHO_N "Checking for $1: "
256
 
}
257
 
 
258
 
 
259
 
# Compile a test
260
 
#  $1   compile flags/libs
261
 
#  $2   library name
262
 
#  $3   package name
263
 
#  $4   if this argument is 'nofatal', don't abort
264
 
test_compile()
265
 
{
266
 
  echo "compiling the following source file:" >> $LOG
267
 
  cat $ODIR.tmp_src.cc >> $LOG
268
 
  echo "using the following command line:" >> $LOG
269
 
  echo "$CXX $CXX_FLAGS -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc \"$1\"" >> $LOG
270
 
  $CXX $CXX_FLAGS -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc $1 >> $LOG 2>&1
271
 
  if [ $? -ne 0 ]; then
272
 
    if [ -z "$4" ]; then
273
 
      echo
274
 
      echo "  $2 not found at $1 or $3 headers not found"
275
 
      echo "  Check the file $LOG for detailed error information."
276
 
      fail
277
 
    else
278
 
      echo >> $LOG
279
 
      echo >> $LOG
280
 
    fi
281
 
    return 1
282
 
  fi
283
 
  return 0
284
 
}
285
 
 
286
 
 
287
 
# Execute a compiled test binary
288
 
test_execute()
289
 
{
290
 
  echo "executing the binary" >> $LOG
291
 
  $ODIR.tmp_out > $ODIR.test_execute.log
292
 
  rc=$?
293
 
  cat $ODIR.test_execute.log | tee -a $LOG
294
 
  if [ $rc -ne 0 ]; then
295
 
    fail $1
296
 
    return 1
297
 
  fi
298
 
  echo >> $LOG
299
 
  echo >> $LOG
300
 
  return 0
301
 
}
302
 
 
303
 
 
304
 
# Execute a compiled test binary
305
 
test_execute_path()
306
 
{
307
 
  echo "executing the binary (LD_LIBRARY_PATH=$1)" >> $LOG
308
 
  LD_LIBRARY_PATH=$1 $ODIR.tmp_out > $ODIR.test_execute.log
309
 
  rc=$?
310
 
  cat $ODIR.test_execute.log | tee -a $LOG
311
 
  if [ $rc -ne 0 ]; then
312
 
    fail
313
 
    return 1
314
 
  fi
315
 
  echo >> $LOG
316
 
  echo >> $LOG
317
 
  return 0
318
 
}
319
 
 
320
 
 
321
 
#
322
 
# Check for OS, MACHINE, CPU
323
 
#
324
 
check_environment()
325
 
{
326
 
  test_header environment
327
 
  BUILD_CPU=`dpkg-architecture -qDEB_HOST_GNU_CPU`
328
 
  [ "$OS" = "solaris" ] && BUILD_CPU=`isainfo | cut -f 1 -d ' '`
329
 
  case "$BUILD_CPU" in
330
 
    i[3456789]86|x86|i86pc)
331
 
      BUILD_MACHINE='x86'
332
 
      LIB='lib'
333
 
      ;;
334
 
    x86_64|amd64)
335
 
      BUILD_MACHINE='amd64'
336
 
      BUILD_CPU='k8'
337
 
      if [ "$OS" != "solaris" ]; then
338
 
        # on AMD64 systems, 64bit libs are usually located in /usr/lib64
339
 
        # see http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64
340
 
        LIB='lib64'
341
 
      else
342
 
        # Solaris doesn't seem to subscribe to fhs, libs are usually in
343
 
        # a '64' subdirectory of the standard 'lib' dirs while some 64-bit
344
 
        # alternative binaries can be found in 'amd64' subdirs of the 'bin'
345
 
        # ones. So, in order to find the right stuff (esp. sdl-config) we'll
346
 
        # have to make sure the */bin/amd64 dirs are searched before the */bin
347
 
        # ones. (The sed has some sideeffects, but they shouldn't harm us...)
348
 
        echo "64-bit Solaris detected, hacking the PATH" >> $LOG
349
 
        echo "old PATH: $PATH" >> $LOG
350
 
        PATH=`echo ":$PATH:" | sed -e 's,\(:[^:]*/bin\):,\1/amd64:\1:,g' \
351
 
                                   -e 's/^:*//' -e 's/:*$//g' -e 's/::*/:/g' `
352
 
        export PATH
353
 
        echo "new PATH: $PATH" >> $LOG
354
 
        LIB='lib/64'
355
 
      fi
356
 
      ;;
357
 
    *)
358
 
      log_failure "Cannot determine system"
359
 
      exit 1
360
 
      ;;
361
 
  esac
362
 
  [ -z "$TARGET_MACHINE" ] && TARGET_MACHINE=$BUILD_MACHINE
363
 
  [ -z "$TARGET_CPU"     ] && TARGET_CPU=$BUILD_CPU
364
 
  DEVDIR_BIN="$DEVDIR/$OS.$BUILD_MACHINE/bin"
365
 
  log_success "Determined build machine: $OS.$BUILD_MACHINE, target machine: $OS.$TARGET_MACHINE"
366
 
 
367
 
  echo "BUILD_PLATFORM=\"$OS\"" >> $ENV
368
 
  echo "export BUILD_PLATFORM" >> $ENV
369
 
  echo "BUILD_PLATFORM_ARCH=\"$BUILD_MACHINE\"" >> $ENV
370
 
  echo "export BUILD_PLATFORM_ARCH" >> $ENV
371
 
  echo "BUILD_TARGET=\"$OS\"" >> $ENV
372
 
  echo "export BUILD_TARGET" >> $ENV
373
 
  echo "BUILD_TARGET_ARCH=\"$TARGET_MACHINE\"" >> $ENV
374
 
  echo "export BUILD_TARGET_ARCH" >> $ENV
375
 
  echo "BUILD_TARGET_CPU=\"$TARGET_CPU\"" >> $ENV
376
 
  echo "export BUILD_TARGET_CPU" >> $ENV
377
 
  echo "BUILD_TYPE=\"$BUILD_TYPE\"" >> $ENV
378
 
  echo "export BUILD_TYPE" >> $ENV
379
 
}
380
 
 
381
 
#
382
 
# Check for gcc with version >= 3.2.
383
 
# We depend on a working gcc, if we fail terminate in every case.
384
 
#
385
 
check_gcc()
386
 
{
387
 
  test_header gcc
388
 
  if check_avail "$CC" CC really; then
389
 
    cc_ver=`$CC -dumpversion` 2>/dev/null
390
 
    if [ $? -ne 0 ]; then
391
 
      log_failure "cannot execute '$CC -dumpversion'"
392
 
      fail really
393
 
    fi
394
 
    if check_avail "$CXX" CXX really; then
395
 
      cxx_ver=`$CXX -dumpversion` 2>/dev/null
396
 
      if [ $? -ne 0 ]; then
397
 
        log_failure "cannot execute '$CXX -dumpversion'"
398
 
        fail really
399
 
      fi
400
 
      cc_maj=`echo $cc_ver|cut -d. -f1`
401
 
      cc_min=`echo $cc_ver|cut -d. -f2`
402
 
      if [ "x$cc_ver" != "x$cxx_ver" ]; then
403
 
        log_failure "gcc version $cc_ver does not match g++ version $cxx_ver"
404
 
        fail really
405
 
      elif [ $cc_maj -eq 4 -a $cc_min -eq 0 -a "$OS" = "darwin" ]; then
406
 
        log_success "found version $cc_ver"
407
 
      # gcc-4.0 is allowed for Darwin only
408
 
      elif [ $cc_maj -lt 3 \
409
 
             -o \( $cc_maj -eq 3 -a $cc_min -lt 2 \) \
410
 
             -o \( $cc_maj -eq 4 -a $cc_min -lt 1 -a "$OS" != "darwin" \) \
411
 
             -o \( $cc_maj -eq 4 -a $cc_min -gt 7 \) \
412
 
             -o $cc_maj -gt 4 ]; then
413
 
        log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<8"
414
 
        fail really
415
 
      else
416
 
        log_success "found version $cc_ver"
417
 
      fi
418
 
      if [ "$BUILD_MACHINE" = "amd64" ]; then
419
 
        [ -z "$CC32"  ] && CC32="$CC -m32"
420
 
        [ -z "$CXX32" ] && CXX32="$CXX -m32"
421
 
      else
422
 
        [ -z "$CC32"  ] && CC32="$CC"
423
 
        [ -z "$CXX32" ] && CXX32="$CXX"
424
 
      fi
425
 
      if [ "$BUILD_MACHINE" = "x86" -a "$TARGET_MACHINE" = "amd64" ]; then
426
 
        [ -z "$CC64"  ] && CC64="$CC -m64"
427
 
        [ -z "$CXX64" ] && CXX64="$CXX -m64"
428
 
      fi
429
 
      if [ "$TARGET_MACHINE" = "amd64" -a $WITH_VMMRAW -eq 0 ]; then
430
 
        CC32="undefined"
431
 
        CXX32="undefined"
432
 
      fi
433
 
      if [ "$CC" != "gcc" ]; then
434
 
        cnf_append "TOOL_GCC3_CC"   "$CC"
435
 
        cnf_append "TOOL_GCC3_AS"   "$CC"
436
 
        cnf_append "TOOL_GCC3_LD"   "$CC"
437
 
        cnf_append "TOOL_GXX3_CC"   "$CC"
438
 
        cnf_append "TOOL_GXX3_AS"   "$CC"
439
 
      fi
440
 
      if [ "$CXX" != "g++" ]; then
441
 
        cnf_append "TOOL_GCC3_CXX"  "$CXX"
442
 
        cnf_append "TOOL_GXX3_CXX"  "$CXX"
443
 
        cnf_append "TOOL_GXX3_LD"   "$CXX"
444
 
      fi
445
 
      if [ "$CC32" != "gcc -m32" -a "$CC32" != "undefined" ]; then
446
 
        cnf_append "TOOL_GCC32_CC"  "$CC32"
447
 
        cnf_append "TOOL_GCC32_AS"  "$CC32"
448
 
        cnf_append "TOOL_GCC32_LD"  "$CC32"
449
 
        cnf_append "TOOL_GXX32_CC"  "$CC32"
450
 
        cnf_append "TOOL_GXX32_AS"  "$CC32"
451
 
      fi
452
 
      if [ "$CXX32" != "g++ -m32" -a "$CXX32" != "undefined" ]; then
453
 
        cnf_append "TOOL_GCC32_CXX" "$CXX32"
454
 
        cnf_append "TOOL_GXX32_CXX" "$CXX32"
455
 
        cnf_append "TOOL_GXX32_LD"  "$CXX32"
456
 
      fi
457
 
      # this isn't not necessary, there is not such tool.
458
 
      if [ -n "$CC64" ]; then
459
 
        cnf_append "TOOL_GCC64_CC"  "$CC64"
460
 
        cnf_append "TOOL_GCC64_AS"  "$CC64"
461
 
        cnf_append "TOOL_GCC64_LD"  "$CC64"
462
 
        cnf_append "TOOL_GXX64_CC"  "$CC64"
463
 
        cnf_append "TOOL_GXX64_AS"  "$CC64"
464
 
      fi
465
 
      if [ -n "$CXX64" ]; then
466
 
        cnf_append "TOOL_GCC64_CXX" "$CXX64"
467
 
        cnf_append "TOOL_GXX64_CXX" "$CXX64"
468
 
        cnf_append "TOOL_GXX64_LD"  "$CXX64"
469
 
      fi
470
 
      # Solaris sports a 32-bit gcc/g++.
471
 
      if [ "$OS" = "solaris" -a "$BUILD_MACHINE" = "amd64" ]; then
472
 
        [ "$CC" = "gcc" ] && CC="gcc -m64"
473
 
        [ "$CXX" = "g++" ] && CXX="g++ -m64"
474
 
      fi
475
 
    fi
476
 
  fi
477
 
}
478
 
 
479
 
 
480
 
#
481
 
# Check for the bcc compiler, needed for compiling the BIOS
482
 
#
483
 
check_bcc()
484
 
{
485
 
  test_header bcc
486
 
  if check_avail "$BCC" BCC; then
487
 
    bcc_ver=`$BCC -v 2>&1|grep version|sed 's+^bcc: version \(.*\)+\1+'`
488
 
    if [ $? -ne 0 ]; then
489
 
      log_failure "BCC not found"
490
 
      fail
491
 
    else
492
 
      echo "compiling the following source file:" >> $LOG
493
 
      cat > $ODIR.tmp_src.c << EOF
494
 
int foo(a)
495
 
  int a;
496
 
{
497
 
  return 0;
498
 
}
499
 
EOF
500
 
      cat $ODIR.tmp_src.c >> $LOG
501
 
      bcc_path=`which_wrapper $BCC`
502
 
      bcc_dir="`dirname $bcc_path`/"
503
 
      echo "using the following command line:" >> $LOG
504
 
      echo "$BCC -B $bcc_dir -C-c -3 -S -o $ODIR.tmp_out $ODIR.tmp_src.c" >> $LOG
505
 
      $BCC -B $bcc_dir -C-c -3 -S -o $ODIR.tmp_out $ODIR.tmp_src.c >> $LOG 2>&1
506
 
      if [ $? -ne 0 ]; then
507
 
        log_failure "BCC not working"
508
 
        fail
509
 
      else
510
 
        log_success "found version $bcc_ver"
511
 
        cnf_append "VBOX_BCC" "$bcc_path -B $bcc_dir"
512
 
      fi
513
 
      unset bcc_path
514
 
      unset bcc_dir
515
 
    fi
516
 
  fi
517
 
}
518
 
 
519
 
 
520
 
#
521
 
# Check for the as86 assembler, needed for compiling the BIOS
522
 
#
523
 
check_as86()
524
 
{
525
 
  test_header as86
526
 
  if check_avail "$AS86" AS86; then
527
 
    as86_ver=`$AS86 -v 2>&1|grep version|sed 's+^as86 version: \(.*\)+\1+'`
528
 
    if [ $? -ne 0 ]; then
529
 
      log_failure "as86 not found"
530
 
      fail
531
 
    else
532
 
      log_success "found version $as86_ver"
533
 
      cnf_append "VBOX_AS86" "`which_wrapper $AS86`"
534
 
    fi
535
 
  fi
536
 
}
537
 
 
538
 
 
539
 
#
540
 
# Check for yasm, needed to compile assembler files
541
 
#
542
 
check_yasm()
543
 
{
544
 
  test_header yasm
545
 
  if check_avail "$YASM" YASM; then
546
 
    yasm_ver=`$YASM --version|grep "^yasm"|sed 's+^yasm \(.*\)+\1+'`
547
 
    if [ $? -ne 0 ]; then
548
 
      log_failure "yasm not found"
549
 
      fail
550
 
    else
551
 
      yasm_maj=`echo $yasm_ver|cut -d. -f1`
552
 
      yasm_min=`echo $yasm_ver|cut -d. -f2`
553
 
      yasm_rev=`echo $yasm_ver|cut -d. -f3`
554
 
      yasm_ver_mul=`expr $yasm_maj \* 10000 + $yasm_min \* 100 + $yasm_rev`
555
 
      if [ $yasm_ver_mul -lt 501 ]; then
556
 
        log_failure "found version $yasm_ver, expected at least 0.5.1"
557
 
        fail
558
 
      else
559
 
        log_success "found version $yasm_ver"
560
 
      fi
561
 
    fi
562
 
  fi
563
 
}
564
 
 
565
 
 
566
 
#
567
 
# Check for the iasl ACPI compiler, needed to compile vbox.dsl
568
 
#
569
 
check_iasl()
570
 
{
571
 
  test_header iasl
572
 
  if check_avail "$IASL" IASL; then
573
 
    iasl_ver=`$IASL|grep version|sed 's+^ASL.*version \([0-9]*\).*+\1+'`
574
 
    if [ $? -ne 0 ]; then
575
 
      log_failure "iasl not found"
576
 
      fail
577
 
    else
578
 
      log_success "found version $iasl_ver"
579
 
      cnf_append "VBOX_IASLCMD" "`which_wrapper $IASL`"
580
 
    fi
581
 
  fi
582
 
}
583
 
 
584
 
 
585
 
#
586
 
# Check for xsltproc, needed by Main
587
 
#
588
 
check_xsltproc()
589
 
{
590
 
  test_header xslt
591
 
  if check_avail "$XSLTPROC" XSLTPROC; then
592
 
    xsltproc_ver=`$XSLTPROC --version`
593
 
    if [ $? -ne 0 ]; then
594
 
      log_failure "xsltproc not found"
595
 
      fail
596
 
    else
597
 
      log_success "found"
598
 
      cnf_append "VBOX_XSLTPROC" "`which_wrapper $XSLTPROC`"
599
 
    fi
600
 
  fi
601
 
}
602
 
 
603
 
 
604
 
#
605
 
# Check for mkisofs, needed to build the CDROM image containing the additions
606
 
#
607
 
check_mkisofs()
608
 
{
609
 
  test_header mkisofs
610
 
  if which_wrapper $GENISOIMAGE > /dev/null; then
611
 
    mkisofs_ver=`$GENISOIMAGE --version`
612
 
    if [ $? -ne 0 ]; then
613
 
      log_failure "mkisofs not found"
614
 
      fail
615
 
    else
616
 
      log_success "found $mkisofs_ver"
617
 
      cnf_append "VBOX_MKISOFS" "`which_wrapper $GENISOIMAGE`"
618
 
    fi
619
 
  elif check_avail "$MKISOFS" MKISOFS; then
620
 
    mkisofs_ver=`$MKISOFS --version`
621
 
    if [ $? -ne 0 ]; then
622
 
      log_failure "mkisofs not working"
623
 
      fail
624
 
    else
625
 
      log_success "found $mkisofs_ver"
626
 
      cnf_append "VBOX_MKISOFS" "`which_wrapper $MKISOFS`"
627
 
    fi
628
 
  fi
629
 
}
630
 
 
631
 
 
632
 
#
633
 
# Check for libxml2, needed by VBoxSettings and Runtime.
634
 
# 2.6.24 is known to NOT work, 2.6.26 is known to work (there is no 2.6.25 release)
635
 
#
636
 
check_libxml2()
637
 
{
638
 
  if [ -z "$BUILD_LIBXML2" ]; then
639
 
    test_header libxml2
640
 
    if which_wrapper pkg-config > /dev/null; then
641
 
      libxml2_ver=`pkg-config libxml-2.0 --modversion 2>> $LOG`
642
 
      if [ $? -ne 0 ]; then
643
 
        log_failure "libxml2 not found"
644
 
        fail
645
 
      else
646
 
        FLGXML2=`pkg-config libxml-2.0 --cflags`
647
 
        INCXML2=`strip_I "$FLGXML2"`
648
 
        LIBXML2=`pkg-config libxml-2.0 --libs`
649
 
        cat > $ODIR.tmp_src.cc << EOF
650
 
#include <cstdio>
651
 
#include <libxml/xmlversion.h>
652
 
extern "C" int main(void)
653
 
{
654
 
  printf("found version %s", LIBXML_DOTTED_VERSION);
655
 
#if LIBXML_VERSION >= 20626
656
 
  printf(", OK.\n");
657
 
  return 0;
658
 
#else
659
 
  printf(", expected version 2.6.26 or higher\n");
660
 
  return 1;
661
 
#endif
662
 
}
663
 
EOF
664
 
        [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
665
 
        if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
666
 
          if test_execute; then
667
 
            cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
668
 
            cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
669
 
          fi
670
 
        fi
671
 
      fi
672
 
    elif which_wrapper xml2-config; then
673
 
      libxml2_ver=`xml2-config --version`
674
 
      if [ $? -ne 0 ]; then
675
 
        log_failure "xml2-config not found"
676
 
        fail
677
 
      else
678
 
        log_success "found version $libxml2_ver"
679
 
        FLGXML2=`xml2-config --cflags`
680
 
        INCXML2=`strip_I "$FLGXML2"`
681
 
        LIBXML2=`xml2-config --libs`
682
 
        cat > $ODIR.tmp_src.cc << EOF
683
 
#include <cstdio>
684
 
#include <libxml/xmlversion.h>
685
 
extern "C" int main(void)
686
 
{
687
 
  printf("found version %s", LIBXML_DOTTED_VERSION);
688
 
#if LIBXML_VERSION >= 20626
689
 
  printf(", OK.\n");
690
 
  return 0;
691
 
#else
692
 
  printf(", expected version 2.6.26 or higher\n");
693
 
  return 1;
694
 
#endif
695
 
}
696
 
EOF
697
 
        [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
698
 
        if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
699
 
          if test_execute; then
700
 
            cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
701
 
            cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
702
 
          fi
703
 
        fi
704
 
      fi
705
 
    else
706
 
      log_failure "neither pkg-config nor xml2-config found"
707
 
      fail
708
 
    fi
709
 
  fi
710
 
}
711
 
 
712
 
 
713
 
#
714
 
# Check for libIDL, needed by xpcom
715
 
#
716
 
check_libidl()
717
 
{
718
 
  test_header libIDL
719
 
 
720
 
  if which_wrapper libIDL-config-2 > /dev/null; then
721
 
    libidl_ver=`libIDL-config-2 --version`
722
 
    if [ $? -ne 0 ]; then
723
 
      log_failure "libIDL-config-2 not working"
724
 
      fail
725
 
    else
726
 
      log_success "found version $libidl_ver"
727
 
      cnf_append "VBOX_LIBIDL_CONFIG" \
728
 
        "PKG_CONFIG_PATH=`libIDL-config-2 --prefix`/$LIB/pkgconfig `which_wrapper libIDL-config-2`"
729
 
    fi
730
 
  elif check_avail "libIDL-config" libIDL-config; then
731
 
    libidl_ver=`libIDL-config --version`
732
 
    if [ $? -ne 0 ]; then
733
 
      log_failure "libIDL-config not working"
734
 
      fail
735
 
    else
736
 
      log_success "found version $libidl_ver"
737
 
      cnf_append "VBOX_LIBIDL_CONFIG" "`which_wrapper libIDL-config`"
738
 
    fi
739
 
  fi
740
 
}
741
 
 
742
 
 
743
 
#
744
 
# Check for openssl, needed for RDP and S3
745
 
#
746
 
check_ssl()
747
 
{
748
 
  if [ -z "$BUILD_LIBSSL" ]; then
749
 
    test_header ssl
750
 
    cat > $ODIR.tmp_src.cc << EOF
751
 
#include <cstdio>
752
 
#include <openssl/opensslv.h>
753
 
#include <openssl/ssl.h>
754
 
extern "C" int main(void)
755
 
{
756
 
  printf("found version %s", OPENSSL_VERSION_TEXT);
757
 
  SSL_library_init();
758
 
#if OPENSSL_VERSION_NUMBER >= 0x00908000
759
 
  printf(", OK.\n");
760
 
  return 0;
761
 
#else
762
 
  printf(", expected version 0.9.8 or higher\n");
763
 
  return 1;
764
 
#endif
765
 
}
766
 
EOF
767
 
    if test_compile "$INCCRYPTO $LIBCRYPTO" libcrypto openssl; then
768
 
      if test_execute nofatal; then
769
 
        cnf_append "SDK_VBOX_OPENSSL_INCS" "`strip_I "$INCCRYPTO"`"
770
 
        cnf_append "SDK_VBOX_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
771
 
        cnf_append "SDK_VBOX_BLD_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
772
 
      fi
773
 
    fi
774
 
  fi
775
 
}
776
 
 
777
 
 
778
 
#
779
 
# Check for pthread, needed by VBoxSVC, frontends, ...
780
 
#
781
 
check_pthread()
782
 
{
783
 
  test_header pthread
784
 
  cat > $ODIR.tmp_src.cc << EOF
785
 
#include <cstdio>
786
 
#include <pthread.h>
787
 
extern "C" int main(void)
788
 
{
789
 
  pthread_mutex_t mutex;
790
 
  if (pthread_mutex_init(&mutex, NULL)) {
791
 
    printf("pthread_mutex_init() failed\n");
792
 
    return 1;
793
 
  }
794
 
  if (pthread_mutex_lock(&mutex)) {
795
 
    printf("pthread_mutex_lock() failed\n");
796
 
    return 1;
797
 
  }
798
 
  if (pthread_mutex_unlock(&mutex)) {
799
 
    printf("pthread_mutex_unlock() failed\n");
800
 
    return 1;
801
 
  }
802
 
  printf("found, OK.\n");
803
 
}
804
 
EOF
805
 
  if test_compile $LIBPTHREAD pthread pthread; then
806
 
    if test_execute; then
807
 
      cnf_append "LIB_PTHREAD" "`strip_l "$LIBPTHREAD"`"
808
 
    fi
809
 
  fi
810
 
}
811
 
 
812
 
 
813
 
#
814
 
# Check for zlib, needed by VBoxSVC, Runtime, ...
815
 
#
816
 
check_z()
817
 
{
818
 
  test_header zlib
819
 
  cat > $ODIR.tmp_src.cc << EOF
820
 
#include <cstdio>
821
 
#include <zlib.h>
822
 
extern "C" int main(void)
823
 
{
824
 
  printf("found version %s", ZLIB_VERSION);
825
 
#if ZLIB_VERNUM >= 0x1210
826
 
  printf(", OK.\n");
827
 
  return 0;
828
 
#else
829
 
  printf(", expected version 1.2.1 or higher\n");
830
 
  return 1;
831
 
#endif
832
 
}
833
 
EOF
834
 
  [ -n "$INCZ" ] && I_INCZ=`prefix_I "$INCZ"`
835
 
  if test_compile "$LIBZ $I_INCZ" zlib zlib; then
836
 
    if test_execute; then
837
 
      echo "if1of (\$(KBUILD_TARGET),darwin freebsd linux solaris)" >> $CNF
838
 
      cnf_append " SDK_VBOX_ZLIB_LIBS" "`strip_l "$LIBZ"`"
839
 
      cnf_append " SDK_VBOX_ZLIB_INCS" "$INCZ"
840
 
      echo "endif" >> $CNF
841
 
    fi
842
 
  fi
843
 
}
844
 
 
845
 
 
846
 
#
847
 
# Check for libpng, needed by kchmviewer
848
 
#
849
 
check_png()
850
 
{
851
 
  test_header libpng
852
 
  cat > $ODIR.tmp_src.cc << EOF
853
 
#include <cstdio>
854
 
#include <png.h>
855
 
extern "C" int main(void)
856
 
{
857
 
  printf("found version %s", PNG_LIBPNG_VER_STRING);
858
 
#if PNG_LIBPNG_VER >= 10205
859
 
  printf(", OK.\n");
860
 
  return 0;
861
 
#else
862
 
  printf(", expected version 1.2.5 or higher\n");
863
 
  return 1;
864
 
#endif
865
 
}
866
 
EOF
867
 
  [ -n "$INCPNG" ] && I_INCPNG=`prefix_I "$INCPNG"`
868
 
  if test_compile "$LIBPNG $I_INCPNG" libpng libpng; then
869
 
    if test_execute; then
870
 
      cnf_append "SDK_VBOX_LIBPNG_LIBS" "`strip_l "$LIBPNG"`"
871
 
      cnf_append "SDK_VBOX_LIBPNG_INCS" "$INCPNG"
872
 
    fi
873
 
  fi
874
 
}
875
 
 
876
 
#
877
 
# Check for libvncserver, needed for VNC in OSE
878
 
#
879
 
check_vncserver()
880
 
{
881
 
  test_header libvncserver
882
 
  cat > $ODIR.tmp_src.cc <<EOF
883
 
#include <cstdio>
884
 
#include <rfb/rfbconfig.h>
885
 
 
886
 
extern "C" int main()
887
 
{
888
 
  const char* v=LIBVNCSERVER_VERSION;
889
 
  unsigned int major = 0, minor = 0, micro = 0;
890
 
 
891
 
  for (; *v !='.' && *v != '\0'; v++) major = major*10 + *v-'0';
892
 
  if (*v == '.') v++;
893
 
  for (; *v !='.' && *v != '\0'; v++) minor = minor*10 + *v-'0';
894
 
  if (*v == '.') v++;
895
 
  for (; *v !='.' && *v != '\0'; v++) micro = micro*10 + *v-'0';
896
 
 
897
 
  printf("found version %s", LIBVNCSERVER_PACKAGE_VERSION);
898
 
  if (major*10000 + minor*100 + micro >= 907)
899
 
  {
900
 
    printf(", OK.\n");
901
 
    return 0;
902
 
  }
903
 
  else
904
 
  {
905
 
    printf(", expected version 0.9.7 or higher\n");
906
 
    return 1;
907
 
  }
908
 
}
909
 
EOF
910
 
  if test_compile "$LIBVNCSERVER $INCVNCSERVER" libvncserver libvncserver; then
911
 
    if test_execute; then
912
 
      cnf_append "VBOX_WITH_VNC" "1"
913
 
    fi
914
 
  fi
915
 
}
916
 
 
917
 
#
918
 
# Check for libcurl, needed by S3
919
 
#
920
 
check_curl()
921
 
{
922
 
  if [ -z "$BUILD_LIBCURL" ]; then
923
 
    test_header libcurl
924
 
    cat > $ODIR.tmp_src.cc << EOF
925
 
#include <cstdio>
926
 
#include <curl/curl.h>
927
 
extern "C" int main(void)
928
 
{
929
 
  printf("found version %s", LIBCURL_VERSION);
930
 
#if 10000*LIBCURL_VERSION_MAJOR + 100*LIBCURL_VERSION_MINOR + LIBCURL_VERSION_PATCH >= 71601
931
 
  printf(", OK.\n");
932
 
  return 0;
933
 
#else
934
 
  printf(", expected version 7.16.1 or higher\n");
935
 
  return 1;
936
 
#endif
937
 
}
938
 
EOF
939
 
    [ -n "$INCCURL" ] && I_INCCURL=`prefix_I "$INCCURL"`
940
 
    if test_compile "$LIBCURL $I_INCCURL" libcurl libcurl; then
941
 
      if test_execute; then
942
 
        cnf_append "SDK_VBOX_LIBCURL_LIBS" "`strip_l "$LIBCURL"`"
943
 
        cnf_append "SDK_VBOX_LIBCURL_INCS" "$INCCURL"
944
 
      fi
945
 
    fi
946
 
  fi
947
 
}
948
 
 
949
 
 
950
 
#
951
 
# Check for pam, needed by VRDPAuth
952
 
# Version 79 was introduced in 9/2005, do we support older versions?
953
 
# Debian/sarge uses 76
954
 
# OpenSUSE comes with 0.99.xxx where they changed the versioning scheme.
955
 
#
956
 
check_pam()
957
 
{
958
 
  test_header pam
959
 
  cat > $ODIR.tmp_src.cc << EOF
960
 
#include <cstdio>
961
 
#include <security/pam_appl.h>
962
 
extern "C" int main(void)
963
 
{
964
 
  printf("found version %d", __LIBPAM_VERSION);
965
 
  if (__LIBPAM_VERSION >= 76)
966
 
  {
967
 
    printf(", OK.\n");
968
 
    return 0;
969
 
  }
970
 
  else
971
 
  {
972
 
    printf(", expected version 76 or higher\n");
973
 
    return 1;
974
 
  }
975
 
}
976
 
EOF
977
 
  if test_compile "-lpam" pam pam nofatal; then
978
 
    if test_execute nofatal; then
979
 
      return 0;
980
 
    fi
981
 
  fi
982
 
  echo "pam0.x not found"
983
 
  test_header linux_pam
984
 
  cat > $ODIR.tmp_src.cc << EOF
985
 
#include <cstdio>
986
 
#include <security/pam_appl.h>
987
 
extern "C" int main(void)
988
 
{
989
 
  printf("found version %d.%d", __LINUX_PAM__, __LINUX_PAM_MINOR__);
990
 
  if (__LINUX_PAM__ >= 1)
991
 
  {
992
 
    printf(", OK.\n");
993
 
    return 0;
994
 
  }
995
 
  else
996
 
  {
997
 
    printf(", expected version 1.0 or higher\n");
998
 
    return 1;
999
 
  }
1000
 
}
1001
 
EOF
1002
 
  if test_compile "-lpam" pam pam; then
1003
 
    test_execute
1004
 
  fi
1005
 
}
1006
 
 
1007
 
 
1008
 
#
1009
 
# Check for the SDL library, needed by VBoxSDL and VirtualBox
1010
 
# We depend at least on version 1.2.7
1011
 
#
1012
 
check_sdl()
1013
 
{
1014
 
  test_header SDL
1015
 
  if [ "$OS" = "darwin" ]; then
1016
 
    if [ -f "/System/Library/Frameworks/SDL.framework/SDL" ]; then
1017
 
      PATH_SDK_LIBSDL="/System/Library/Frameworks/SDL.framework"
1018
 
    elif [ -f "/Library/Frameworks/SDL.framework/SDL" ]; then
1019
 
      PATH_SDK_LIBSDL="/Library/Frameworks/SDL.framework"
1020
 
    fi
1021
 
    if [ -n "$PATH_SDK_LIBSDL" ]; then
1022
 
      foundsdl=1
1023
 
      INCSDL="$PATH_SDK_LIBSDL/Headers"
1024
 
      FLDSDL="-framework SDL"
1025
 
    else
1026
 
      log_failure "SDL framework not found"
1027
 
      fail
1028
 
    fi
1029
 
  else
1030
 
    if which_wrapper sdl-config > /dev/null; then
1031
 
      FLGSDL=`sdl-config --cflags`
1032
 
      INCSDL=`strip_I "$FLGSDL"`
1033
 
      LIBSDL=`sdl-config --libs`
1034
 
      LIBSDLMAIN="-lSDLmain"
1035
 
      FLDSDL=
1036
 
      foundsdl=1
1037
 
    fi
1038
 
  fi
1039
 
  [ "$OS" = "linux" -o "$OS" = "darwin" -o "$OS" = "solaris" ] && LIBSDLMAIN=""
1040
 
  if [ -n "$foundsdl" ]; then
1041
 
    cat > $ODIR.tmp_src.cc << EOF
1042
 
#include <cstdio>
1043
 
#include <SDL.h>
1044
 
#include <SDL_main.h>
1045
 
#undef main
1046
 
extern "C" int main(int argc, char** argv)
1047
 
{
1048
 
  printf("found version %d.%d.%d",
1049
 
         SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
1050
 
#if SDL_VERSION_ATLEAST(1,2,7)
1051
 
  printf(", OK.\n");
1052
 
  return 0;
1053
 
#else
1054
 
  printf(", expected version 1.2.7 or higher\n");
1055
 
  return 1;
1056
 
#endif
1057
 
}
1058
 
EOF
1059
 
    [ -n "$INCSDL" ] && I_INCSDL=`prefix_I "$INCSDL"`
1060
 
    if test_compile "$LIBSDL $LIBSDLMAIN $I_INCSDL $FLDSDL" SDL SDL; then
1061
 
      if test_execute; then
1062
 
        cnf_append "LIB_SDK_LIBSDL_SDL"     "`strip_l "$LIBSDL"`"
1063
 
        cnf_append "SDK_LIBSDL_LIBPATH"     "`strip_L "$LIBSDL"`"
1064
 
        cnf_append "LIB_SDK_LIBSDL_SDLMAIN" "`strip_l "$LIBSDLMAIN"`"
1065
 
        [ -n "$INCSDL" ] && cnf_append "SDK_LIBSDL_INCS"    "$INCSDL"
1066
 
        [ -n "$FLDSDL" ] && cnf_append "SDK_LIBSDL_LDFLAGS" "$FLDSDL"
1067
 
      fi
1068
 
    fi
1069
 
  else
1070
 
    log_failure "SDL not found"
1071
 
    fail
1072
 
  fi
1073
 
}
1074
 
 
1075
 
 
1076
 
#
1077
 
# Check for the SDL_ttf library, needed by VBoxSDL (secure label)
1078
 
#
1079
 
check_sdl_ttf()
1080
 
{
1081
 
  test_header SDL_ttf
1082
 
  cat > $ODIR.tmp_src.cc << EOF
1083
 
#include <cstdio>
1084
 
#include <SDL_ttf.h>
1085
 
#ifndef SDL_TTF_MAJOR_VERSION
1086
 
#define SDL_TTF_MAJOR_VERSION TTF_MAJOR_VERSION
1087
 
#define SDL_TTF_MINOR_VERSION TTF_MINOR_VERSION
1088
 
#define SDL_TTF_PATCHLEVEL    TTF_PATCHLEVEL
1089
 
#endif
1090
 
extern "C" int main(void)
1091
 
{
1092
 
  printf("found version %d.%d.%d",
1093
 
         SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL);
1094
 
#if 10000*SDL_TTF_MAJOR_VERSION + 100*SDL_TTF_MINOR_VERSION + SDL_TTF_PATCHLEVEL >= 20006
1095
 
  printf(", OK.\n");
1096
 
  return 0;
1097
 
#else
1098
 
  printf(", expected version 2.0.6 or higher\n");
1099
 
  return 1;
1100
 
#endif
1101
 
}
1102
 
EOF
1103
 
  if test_compile "-lSDL_ttf $I_INCSDL" SDL_ttf SDL_ttf nofatal; then
1104
 
    if ! test_execute nofatal; then
1105
 
      cnf_append "VBOX_WITH_SECURELABEL" ""
1106
 
    fi
1107
 
  else
1108
 
    echo "not found -- disabling VBoxSDL secure label."
1109
 
    cnf_append "VBOX_WITH_SECURELABEL" ""
1110
 
  fi
1111
 
}
1112
 
 
1113
 
 
1114
 
#
1115
 
# Check for libasound, needed by the ALSA audio backend
1116
 
#
1117
 
check_alsa()
1118
 
{
1119
 
  test_header ALSA
1120
 
  cat > $ODIR.tmp_src.cc << EOF
1121
 
#include <cstdio>
1122
 
#include <alsa/asoundlib.h>
1123
 
extern "C" int main(void)
1124
 
{
1125
 
  printf("found version %d.%d.%d",
1126
 
         SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR);
1127
 
#if 10000*SND_LIB_MAJOR + 100*SND_LIB_MINOR + SND_LIB_SUBMINOR >= 10006
1128
 
  printf(", OK.\n");
1129
 
  return 0;
1130
 
#else
1131
 
  printf(", expected version 1.0.6 or higher\n");
1132
 
  return 1;
1133
 
#endif
1134
 
}
1135
 
EOF
1136
 
  if test_compile "-lasound" asound asound; then
1137
 
    test_execute
1138
 
  fi
1139
 
}
1140
 
 
1141
 
 
1142
 
#
1143
 
# Check for PulseAudio
1144
 
#
1145
 
check_pulse()
1146
 
{
1147
 
  test_header "PulseAudio"
1148
 
  cat > $ODIR.tmp_src.cc << EOF
1149
 
#include <cstdio>
1150
 
#include <pulse/version.h>
1151
 
extern "C" int main(void)
1152
 
{
1153
 
  printf("found version %s API version %d", pa_get_headers_version(), PA_API_VERSION);
1154
 
#if PA_API_VERSION >= 9
1155
 
  printf(", OK.\n");
1156
 
  return 0;
1157
 
#else
1158
 
  printf(", expected version 0.9.0 (API version 9) or higher\n");
1159
 
  return 1;
1160
 
#endif
1161
 
}
1162
 
EOF
1163
 
  if test_compile "$INCPULSE $LIBPULSE -lpulse" pulse pulse; then
1164
 
    test_execute
1165
 
  fi
1166
 
}
1167
 
 
1168
 
 
1169
 
#
1170
 
# Check for the X libraries (Xext, X11)
1171
 
#
1172
 
check_x()
1173
 
{
1174
 
  test_header "X libraries"
1175
 
  cat > $ODIR.tmp_src.cc << EOF
1176
 
#include <cstdio>
1177
 
#include <X11/Xlib.h>
1178
 
extern "C" int main(void)
1179
 
{
1180
 
  Display *dpy;
1181
 
  int scrn_num;
1182
 
  Screen *scrn;
1183
 
  Window win;
1184
 
 
1185
 
  dpy      = XOpenDisplay(NULL);
1186
 
  scrn_num = DefaultScreen(dpy);
1187
 
  scrn     = ScreenOfDisplay(dpy, scrn_num);
1188
 
  win      = XCreateWindow(dpy, RootWindowOfScreen(scrn), 0, 0, 100, 100,
1189
 
                           0, 16, InputOutput, CopyFromParent, 0, NULL);
1190
 
  XDestroyWindow(dpy, win);
1191
 
  XCloseDisplay(dpy);
1192
 
}
1193
 
EOF
1194
 
  [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1195
 
  if test_compile "$LIBX11 $I_INCX11" Xlibs Xlibs; then
1196
 
    log_success "found"
1197
 
  fi
1198
 
}
1199
 
 
1200
 
 
1201
 
#
1202
 
# Check for the Xcursor library, needed by VBoxSDL and VBoxBFE
1203
 
#
1204
 
check_xcursor()
1205
 
{
1206
 
  test_header Xcursor
1207
 
  cat > $ODIR.tmp_src.cc << EOF
1208
 
#include <cstdio>
1209
 
#include <X11/Xlib.h>
1210
 
#include <X11/Xcursor/Xcursor.h>
1211
 
extern "C" int main(void)
1212
 
{
1213
 
  XcursorImage *cursor = XcursorImageCreate (10, 10);
1214
 
  XcursorImageDestroy(cursor);
1215
 
  return 0;
1216
 
}
1217
 
EOF
1218
 
  [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1219
 
  if test_compile "$LIBX11 $LIBXCURSOR $I_INCX11" Xcursor Xcursor; then
1220
 
    log_success "found"
1221
 
    cnf_append "VBOX_XCURSOR_LIBS" "`strip_l "$LIBXCURSOR"`"
1222
 
  fi
1223
 
}
1224
 
 
1225
 
 
1226
 
#
1227
 
# Check for the Xinerama library, needed by the Qt GUI
1228
 
#
1229
 
check_xinerama()
1230
 
{
1231
 
  test_header Xinerama
1232
 
  cat > $ODIR.tmp_src.cc << EOF
1233
 
#include <X11/Xlib.h>
1234
 
#include <X11/extensions/Xinerama.h>
1235
 
extern "C" int main(void)
1236
 
{
1237
 
  Display *dpy;
1238
 
  Bool flag;
1239
 
  dpy = XOpenDisplay(NULL);
1240
 
  if (dpy)
1241
 
  {
1242
 
    flag = XineramaIsActive(dpy);
1243
 
    XCloseDisplay(dpy);
1244
 
  }
1245
 
}
1246
 
EOF
1247
 
  [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1248
 
  if test_compile "$LIBX11 $LIBXINERAMA $I_INCX11" Xinerama Xinerama; then
1249
 
    log_success "found"
1250
 
  fi
1251
 
}
1252
 
 
1253
 
 
1254
 
#
1255
 
# Check for the Xinerama library, needed by the Qt GUI
1256
 
#
1257
 
check_xrandr()
1258
 
{
1259
 
  test_header Xrandr
1260
 
  cat > $ODIR.tmp_src.cc << EOF
1261
 
#include <X11/Xlib.h>
1262
 
#include <X11/extensions/Xrandr.h>
1263
 
extern "C" int main(void)
1264
 
{
1265
 
  Display *dpy;
1266
 
  Bool flag;
1267
 
  int major, minor;
1268
 
  dpy = XOpenDisplay(NULL);
1269
 
  if (dpy)
1270
 
  {
1271
 
    flag = XRRQueryVersion(dpy, &major, &minor);
1272
 
    XCloseDisplay(dpy);
1273
 
  }
1274
 
}
1275
 
EOF
1276
 
  [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1277
 
  if test_compile "$LIBX11 $LIBXRANDR $I_INCX11" Xrandr Xrandr; then
1278
 
    log_success "found"
1279
 
  fi
1280
 
}
1281
 
 
1282
 
 
1283
 
#
1284
 
# Check for OpenGL
1285
 
#
1286
 
check_opengl()
1287
 
{
1288
 
  # On darwin this is a on/off decision only
1289
 
  if [ "$OS" = "darwin" ]; then
1290
 
    test_header "OpenGL support"
1291
 
    echo "enabled"
1292
 
    cnf_append "VBOX_WITH_CROGL"     "1"
1293
 
  else
1294
 
    check_xmu
1295
 
    check_mesa
1296
 
  fi
1297
 
}
1298
 
 
1299
 
 
1300
 
#
1301
 
# Check for the Xmu library, needed by OpenGL
1302
 
#
1303
 
check_xmu()
1304
 
{
1305
 
  test_header Xmu
1306
 
  cat > $ODIR.tmp_src.cc << EOF
1307
 
#include <cstdio>
1308
 
#include <X11/Xatom.h>
1309
 
#include <X11/Xlib.h>
1310
 
#include <X11/Xutil.h>
1311
 
#include <X11/Xmu/StdCmap.h>
1312
 
extern "C" int main(void)
1313
 
{
1314
 
  Display *dpy;
1315
 
  int scrn_num;
1316
 
  Screen *scrn;
1317
 
 
1318
 
  dpy = XOpenDisplay(NULL);
1319
 
  if (dpy)
1320
 
  {
1321
 
    scrn_num = DefaultScreen(dpy);
1322
 
    scrn     = ScreenOfDisplay(dpy, scrn_num);
1323
 
    Status status = XmuLookupStandardColormap(dpy, RootWindowOfScreen(scrn), 0,
1324
 
                    24, XA_RGB_DEFAULT_MAP, False, True);
1325
 
    printf("Status = %x\n", status);
1326
 
    XCloseDisplay(dpy);
1327
 
  }
1328
 
  return 0;
1329
 
}
1330
 
EOF
1331
 
  [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1332
 
  if test_compile "$LIBX11 $LIBXMU $I_INCX11" Xmu Xmu; then
1333
 
    log_success "found"
1334
 
    cnf_append "VBOX_XMU_LIBS" "`strip_l "$LIBXMU"`"
1335
 
  fi
1336
 
}
1337
 
 
1338
 
#
1339
 
# Check for Mesa, needed by OpenGL
1340
 
#
1341
 
check_mesa()
1342
 
{
1343
 
  test_header "Mesa / GLU"
1344
 
  cat > $ODIR.tmp_src.cc << EOF
1345
 
#include <cstdio>
1346
 
#include <X11/Xlib.h>
1347
 
#include <GL/glx.h>
1348
 
#include <GL/glu.h>
1349
 
extern "C" int main(void)
1350
 
{
1351
 
  Display *dpy;
1352
 
  int major, minor;
1353
 
 
1354
 
  dpy = XOpenDisplay(NULL);
1355
 
  if (dpy)
1356
 
  {
1357
 
    Bool glx_version = glXQueryVersion(dpy, &major, &minor);
1358
 
    XCloseDisplay(dpy);
1359
 
    if (glx_version)
1360
 
    {
1361
 
      printf("found version %u.%u, OK.\n", major, minor);
1362
 
      return 0;
1363
 
    }
1364
 
  }
1365
 
  printf("found (inactive), OK.\n");
1366
 
  return 0;
1367
 
}
1368
 
EOF
1369
 
  [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1370
 
  if test_compile "$LIBX11 $MESA $I_INCX11" Mesa Mesa; then
1371
 
    [ $PASSIVE_MESA -eq 1 ] && unset DISPLAY
1372
 
    test_execute
1373
 
  fi
1374
 
}
1375
 
 
1376
 
 
1377
 
#
1378
 
# Check for the Qt4 library, needed by the VirtualBox frontend
1379
 
#
1380
 
# Currently not fatal.
1381
 
#
1382
 
check_qt4()
1383
 
{
1384
 
  foundqt4=
1385
 
  test_header Qt4
1386
 
  if [ "$OS" = "darwin" ]; then
1387
 
    # First check if there is the internal version of Qt. If yes nothing else
1388
 
    # has to be done.
1389
 
    QT_INTERNAL=`/bin/ls -rd1 $PWD/tools/$BUILD_TARGET.$BUILD_PLATFORM_ARCH/qt/* 2> /dev/null`
1390
 
    for t in $QT_INTERNAL; do
1391
 
        if [ -f "$t/Frameworks/QtCoreVBox.framework/QtCoreVBox" ]; then
1392
 
          cnf_append "VBOX_WITH_QT4_SUN" "1"
1393
 
          log_success "use internal version"
1394
 
          return
1395
 
        fi
1396
 
    done
1397
 
    # Now try the user provided directory and some of the standard directories.
1398
 
    QT_TRIES="$QT4DIR /System/Library /Library"
1399
 
    for t in $QT_TRIES; do
1400
 
        if [ -f "$t/Frameworks/QtCore.framework/QtCore" ]; then
1401
 
          PATH_SDK_QT4="$t"
1402
 
          break
1403
 
        fi
1404
 
    done
1405
 
    # Add the necessary params for building the test application
1406
 
    if [ -n "$PATH_SDK_QT4" ]; then
1407
 
      foundqt4=1
1408
 
      INCQT4=-I$PATH_SDK_QT4/Frameworks/QtCore.framework/Headers
1409
 
      LIBQT4=-F$PATH_SDK_QT4/Frameworks
1410
 
      FLGQT4="-framework QtCore"
1411
 
    else
1412
 
      log_failure "Qt4 framework not found (can be disabled using --disable-qt4)"
1413
 
      fail
1414
 
    fi
1415
 
  else
1416
 
    if [ $QT4DIR_PKGCONFIG -eq 1 ]; then
1417
 
      # default is to use pkg-config
1418
 
      if which_wrapper pkg-config > /dev/null; then
1419
 
        # this braindead path is necessary for mdv2008.1
1420
 
        qt4_ver=`\
1421
 
            PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
1422
 
            pkg-config QtCore --modversion 2>> $LOG`
1423
 
        if [ $? -ne 0 ]; then
1424
 
          log_failure "QtCore not found"
1425
 
          fail
1426
 
        else
1427
 
          FLGQT4=`\
1428
 
              PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
1429
 
              pkg-config QtCore --cflags`
1430
 
          INCQT4=`strip_I "$FLGQT4"`
1431
 
          LIBQT4=`\
1432
 
              PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
1433
 
              PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
1434
 
              pkg-config QtCore --libs`
1435
 
          foundqt4=1
1436
 
        fi
1437
 
      else
1438
 
        log_failure "pkg-config not found"
1439
 
        fail
1440
 
      fi
1441
 
    else
1442
 
      # do it the old way (e.g. user has specified QT4DIR)
1443
 
      cat > $ODIR.tmp_src.cc << EOF
1444
 
#include <cstdio>
1445
 
#include <QtGlobal>
1446
 
extern "C" int main(void)
1447
 
{
1448
 
  printf("found version %s", QT_VERSION_STR);
1449
 
#if QT_VERSION >= 0x040400
1450
 
  printf(", OK.\n");
1451
 
  return 0;
1452
 
#else
1453
 
  printf(", expected version 4.4.0 or higher\n");
1454
 
  return 1;
1455
 
#endif
1456
 
}
1457
 
EOF
1458
 
      for q in $QT4DIR; do
1459
 
        INCQT4="$q/include $q/include/QtCore"
1460
 
        FLGQT4="-DQT_SHARED"
1461
 
        I_INCQT4=`prefix_I "$INCQT4"`
1462
 
        LIBQT4="-L$q/lib -lQtCoreVBox"
1463
 
        if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1464
 
          foundqt4=2
1465
 
          break;
1466
 
        fi
1467
 
        LIBQT4="-L$q/lib -lQtCore"
1468
 
        if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1469
 
          foundqt4=1
1470
 
          break;
1471
 
        fi
1472
 
      done
1473
 
    fi
1474
 
  fi
1475
 
  if [ -n "$foundqt4" ]; then
1476
 
    cat > $ODIR.tmp_src.cc << EOF
1477
 
#include <cstdio>
1478
 
#include <QtGlobal>
1479
 
extern "C" int main(void)
1480
 
{
1481
 
  printf("found version %s", QT_VERSION_STR);
1482
 
#if QT_VERSION >= 0x040400
1483
 
  printf(", OK.\n");
1484
 
  return 0;
1485
 
#else
1486
 
  printf(", expected version 4.4.0 or higher\n");
1487
 
  return 1;
1488
 
#endif
1489
 
}
1490
 
EOF
1491
 
    [ -n "$INCQT4" ] && I_INCQT4=`prefix_I "$INCQT4"`
1492
 
    if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1493
 
      if test_execute_path "`strip_L "$LIBQT4"`"; then
1494
 
        if [ "$OS" = "darwin" ]; then
1495
 
          # Successful build & run the test application so add the necessary
1496
 
          # params to AutoConfig.kmk
1497
 
          cnf_append "PATH_SDK_QT4_INC" "$PATH_SDK_QT4/Frameworks"
1498
 
          cnf_append "PATH_SDK_QT4_LIB" "$PATH_SDK_QT4/Frameworks"
1499
 
          cnf_append "PATH_SDK_QT4" "$PATH_SDK_QT4/Frameworks"
1500
 
          # Check for the moc tool in the Qt directory found & some standard
1501
 
          # directories.
1502
 
          for q in $PATH_SDK_QT4 /usr /Developer/Tools/Qt; do
1503
 
            if which_wrapper "$q/bin/moc" > /dev/null; then
1504
 
              cnf_append "PATH_TOOL_QT4" "$q"
1505
 
              cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
1506
 
            fi
1507
 
          done
1508
 
        else
1509
 
          # strip .../QtCore as we add components ourself
1510
 
          INCQT4=`echo "$INCQT4"|$KBUILD_SED 's|\([^ ]*\)/QtCore|\1|g; s| $||g'`
1511
 
          # store only the first path, remove all other pathes
1512
 
          # most likely pkg-config gave us -I/usr/include/qt4 -I/usr/include/qt4/QtCore
1513
 
          INCQT4=`echo "$INCQT4"|$KBUILD_SED 's|\([^ ]*\) .*|\1|'`
1514
 
          cnf_append "VBOX_PATH_QT4_LIB" "`strip_L "$LIBQT4"`"
1515
 
          cnf_append "SDK_QT4_LIBPATH" "`strip_L "$LIBQT4"`"
1516
 
          cnf_append "PATH_SDK_QT4_INC" "$INCQT4"
1517
 
          # this is not quite right since the qt libpath does not have to be first...
1518
 
          cnf_append "PATH_SDK_QT4_LIB" '$'"(firstword `strip_L "$LIBQT4"`)"
1519
 
          if [ "$foundqt4" = "2" ]; then
1520
 
            cnf_append "VBOX_WITH_QT4_SUN" "1"
1521
 
          fi
1522
 
          test_header "Qt4 devtools"
1523
 
          for q in $QT4DIR; do
1524
 
            # first try it with a suffix, some platforms use that
1525
 
            if which_wrapper "$q/bin/moc-qt4" > /dev/null; then
1526
 
              moc_ver=`$q/bin/moc-qt4 -v 2>&1|sed 's+^.*(Qt \(.*\))+\1+'`
1527
 
              if [ $? -ne 0 ]; then
1528
 
                log_failure "moc-qt4 not working"
1529
 
                fail
1530
 
              else
1531
 
                log_success "found version $moc_ver"
1532
 
                cnf_append "VBOX_PATH_QT4" "$q"
1533
 
                cnf_append "PATH_SDK_QT4" "$q"
1534
 
                cnf_append "PATH_TOOL_QT4" "$q"
1535
 
                cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
1536
 
                cnf_append "TOOL_QT4_BIN_SUFF" "-qt4"
1537
 
                return
1538
 
              fi
1539
 
            elif which_wrapper "$q/bin/moc" > /dev/null; then
1540
 
              moc_ver=`$q/bin/moc -v 2>&1|sed 's+^.*(Qt \(.*\))+\1+'`
1541
 
              if [ $? -ne 0 ]; then
1542
 
                log_failure "moc not working"
1543
 
                fail
1544
 
              else
1545
 
                log_success "found version $moc_ver"
1546
 
                cnf_append "VBOX_PATH_QT4" "$q"
1547
 
                cnf_append "PATH_SDK_QT4" "$q"
1548
 
                cnf_append "PATH_TOOL_QT4" "$q"
1549
 
                cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
1550
 
                return
1551
 
              fi
1552
 
            fi
1553
 
          done
1554
 
        fi
1555
 
      fi
1556
 
    else
1557
 
      log_failure "qt4 not working"
1558
 
      fail
1559
 
    fi
1560
 
  else
1561
 
    log_failure "qt4 not found"
1562
 
    fail
1563
 
  fi
1564
 
}
1565
 
 
1566
 
 
1567
 
#
1568
 
# Check whether static libstdc++ is installed. This library is required
1569
 
# for the Linux guest additions.
1570
 
#
1571
 
check_staticlibstdcxx()
1572
 
{
1573
 
  test_header "static stc++ library"
1574
 
  libstdcxx=`$CXX -print-file-name=libstdc++.a`
1575
 
  cat > $ODIR.tmp_src.cc << EOF
1576
 
#include <string>
1577
 
 
1578
 
extern "C" int main(void)
1579
 
{
1580
 
  std::string s = "test";
1581
 
  return 0;
1582
 
}
1583
 
EOF
1584
 
  if test_compile "$libstdcxx" libstdc++ libstdc++; then
1585
 
    log_success "found"
1586
 
  fi
1587
 
}
1588
 
 
1589
 
 
1590
 
#
1591
 
# Check for Linux sources
1592
 
#
1593
 
check_linux()
1594
 
{
1595
 
  test_header "Linux kernel sources"
1596
 
  cat > $ODIR.tmp_src.c << EOF
1597
 
#include <linux/version.h>
1598
 
int printf(const char *format, ...);
1599
 
int main(void)
1600
 
{
1601
 
  printf("found version %d.%d.%d",  LINUX_VERSION_CODE / 65536,
1602
 
                                   (LINUX_VERSION_CODE % 65536) / 256,
1603
 
                                    LINUX_VERSION_CODE          % 256);
1604
 
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
1605
 
  printf(", OK.\n");
1606
 
  return 0;
1607
 
#else
1608
 
  printf(", expected version 2.4.0 or higher\n");
1609
 
  return 1;
1610
 
#endif
1611
 
}
1612
 
EOF
1613
 
  echo "compiling the following source file:" >> $LOG
1614
 
  cat $ODIR.tmp_src.c >> $LOG
1615
 
  echo "using the following command line:" >> $LOG
1616
 
  echo "$CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include" >> $LOG
1617
 
  $CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include >> $LOG 2>&1
1618
 
  if [ $? -ne 0 ]; then
1619
 
    echo
1620
 
    echo "  Linux kernel headers not found at $LINUX"
1621
 
    echo "  Check the file $LOG for detailed error information."
1622
 
    fail
1623
 
  else
1624
 
    if test_execute; then
1625
 
      cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
1626
 
    fi
1627
 
  fi
1628
 
}
1629
 
 
1630
 
 
1631
 
#
1632
 
# Check for kchmviewer, needed to display the online help
1633
 
# (unused as we ship kchmviewer)
1634
 
#
1635
 
check_kchmviewer()
1636
 
{
1637
 
  test_header kchmviewer
1638
 
  if check_avail "$KCHMVIEWER" KCHMVIEWER; then
1639
 
    kchmviewer_ver=`$KCHMVIEWER --version|grep "^KchmViewer:"|sed 's+^KchmViewer: \(.*\)+\1+'`
1640
 
    if [ $? -ne 0 ]; then
1641
 
      log_failure "kchmviewer not working"
1642
 
      fail
1643
 
    else
1644
 
      log_success "found version $kchmviewer_ver"
1645
 
    fi
1646
 
  fi
1647
 
}
1648
 
 
1649
 
 
1650
 
#
1651
 
# Check for the kBuild tools, we don't support GNU make
1652
 
#
1653
 
check_kbuild()
1654
 
{
1655
 
  test_header kBuild
1656
 
  if which_wrapper "$KBUILDDIR/bin/$OS.$BUILD_MACHINE/kmk" > /dev/null; then
1657
 
    KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.$BUILD_MACHINE"
1658
 
    echo "PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1659
 
    echo "export PATH_KBUILD" >> $ENV
1660
 
    echo "PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1661
 
    echo "export PATH_DEVTOOLS" >> $ENV
1662
 
    echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"" >> $ENV
1663
 
    echo "export PATH_KBUILD_BIN" >> $ENV
1664
 
    echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
1665
 
    if [ "$OS" = "solaris" ]; then
1666
 
      # Because of sh being non-default shell in Solaris we need to export PATH again when
1667
 
      # sourcing env.sh. Simply exporting from ./configure does not export PATH correctly.
1668
 
      echo "PATH=\"$ORGPATH\"" >> $ENV
1669
 
      echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1670
 
      echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1671
 
    else
1672
 
      echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1673
 
      echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1674
 
    fi
1675
 
    echo "export PATH" >> $ENV
1676
 
    echo "unset path_kbuild_bin path_dev_bin" >> $ENV
1677
 
    KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1678
 
  elif [ "$OS.$BUILD_MACHINE" = "darwin.amd64" ]; then
1679
 
    # Currently there are no amd64 kBuild bins. So use the x86 variant in any case.
1680
 
    KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.x86"
1681
 
    echo "PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1682
 
    echo "export PATH_KBUILD" >> $ENV
1683
 
    echo "PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1684
 
    echo "export PATH_DEVTOOLS" >> $ENV
1685
 
    echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.x86\"" >> $ENV
1686
 
    echo "PATH_KBUILD_BIN=\"\$path_kbuild_bin\"" >> $ENV
1687
 
    echo "export PATH_KBUILD_BIN" >> $ENV
1688
 
    echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
1689
 
    echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1690
 
    echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1691
 
    echo "export PATH" >> $ENV
1692
 
    echo "unset path_kbuild_bin path_dev_bin" >> $ENV
1693
 
    KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1694
 
  elif check_avail "kmk" KBUILDDIR really; then
1695
 
    # check for installed kBuild
1696
 
    KBUILD_SED="`which_wrapper kmk_sed`"
1697
 
  else
1698
 
    fail
1699
 
  fi
1700
 
  log_success "found"
1701
 
}
1702
 
 
1703
 
 
1704
 
#
1705
 
# Check for compiler.h
1706
 
# Some Linux distributions include "compiler.h" in their libc linux
1707
 
# headers package, some don't.  Most don't need it, building might (!)
1708
 
# not succeed on openSUSE without it.
1709
 
#
1710
 
# See http://www.mail-archive.com/qemu-devel%40nongnu.org/msg07980.html
1711
 
#
1712
 
check_compiler_h()
1713
 
{
1714
 
  test_header compiler.h
1715
 
  if ! test -f "/usr/include/linux/compiler.h"; then
1716
 
    log_success "compiler.h not found"
1717
 
  else
1718
 
    cnf_append "VBOX_WITH_LINUX_COMPILER_H" "1"
1719
 
    log_success "compiler.h found"
1720
 
  fi
1721
 
}
1722
 
 
1723
 
#
1724
 
# Check for libcap.
1725
 
# Required to pass CAP_NET_RAW to our binaries to allow to open SOCK_RAW
1726
 
# sockets for doing ICMP requests.
1727
 
#
1728
 
check_libcap()
1729
 
{
1730
 
  test_header "libcap library"
1731
 
  cat > $ODIR.tmp_src.cc << EOF
1732
 
#include <cstdio>
1733
 
#include <sys/types.h>
1734
 
#include <sys/capability.h>
1735
 
 
1736
 
extern "C" int main(void)
1737
 
{
1738
 
  char buf[1024];
1739
 
  cap_t caps = cap_get_proc();
1740
 
  snprintf(buf, sizeof(buf), "Current caps are '%s'\n", cap_to_text(caps, NULL));
1741
 
  return 0;
1742
 
}
1743
 
EOF
1744
 
  if test_compile $LIBCAP libcap libcap; then
1745
 
    if test_execute; then
1746
 
      log_success "found"
1747
 
    fi
1748
 
  fi
1749
 
}
1750
 
 
1751
 
#
1752
 
# Check if we are able to build 32-bit applications (needed for the guest additions)
1753
 
#
1754
 
check_32bit()
1755
 
{
1756
 
  test_header "32-bit support"
1757
 
  cat > $ODIR.tmp_src.c << EOF
1758
 
#include <stdint.h>
1759
 
int main(void)
1760
 
{
1761
 
  return 0;
1762
 
}
1763
 
EOF
1764
 
  echo "compiling the following source file:" >> $LOG
1765
 
  cat $ODIR.tmp_src.c >> $LOG
1766
 
  echo "using the following command line:" >> $LOG
1767
 
  echo "$CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c" >> $LOG
1768
 
  $CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c >> $LOG 2>&1
1769
 
  if [ $? -ne 0 ]; then
1770
 
    echo
1771
 
    echo "  Cannot compile 32-bit applications (missing headers and/or libraries)!"
1772
 
    echo "  Check the file $LOG for detailed error information."
1773
 
    fail
1774
 
  else
1775
 
    echo "executing the binary" >> $LOG
1776
 
    $ODIR.tmp_out 2> $ODIR.test_execute.log
1777
 
    rc=$?
1778
 
    cat $ODIR.test_execute.log >> $LOG
1779
 
    if [ $rc -ne 0 ]; then
1780
 
      echo
1781
 
      echo "  Cannot execute 32-bit applications! Either enable 32-bit support in the"
1782
 
      echo "  kernel configuration or use --disable-vmmraw to disable 32-bit guests."
1783
 
      fail
1784
 
      return 1
1785
 
    fi
1786
 
  fi
1787
 
  log_success ""
1788
 
}
1789
 
 
1790
 
 
1791
 
#
1792
 
# Check for Python
1793
 
#
1794
 
check_python()
1795
 
{
1796
 
  test_header "Python support"
1797
 
 
1798
 
  # On darwin this is a on/off decision only
1799
 
  if [ "$OS" = "darwin" ]; then
1800
 
    echo "enabled"
1801
 
    cnf_append "VBOX_WITH_PYTHON"     "1"
1802
 
    return
1803
 
  fi
1804
 
 
1805
 
  cat > $ODIR.tmp_src.cc << EOF
1806
 
#include <cstdio>
1807
 
#include <Python.h>
1808
 
extern "C" int main(void)
1809
 
{
1810
 
  Py_Initialize();
1811
 
  printf("found version %s", PY_VERSION);
1812
 
#if PY_VERSION_HEX >= 0x02030000
1813
 
  printf(", OK.\n");
1814
 
  return 0;
1815
 
#else
1816
 
  printf(", expected version 2.3 or higher\n");
1817
 
  return 1;
1818
 
#endif
1819
 
}
1820
 
EOF
1821
 
  found=
1822
 
# For Solaris we use libpython2.4 for compatibility with Solaris 10 and passing IPS pkg audit
1823
 
  if [ "$OS" != "solaris" ]; then
1824
 
    SUPPYTHONLIBS="python2.7 python2.6 python2.5 python2.4 python2.3"
1825
 
  else
1826
 
    SUPPYTHONLIBS="python2.4"
1827
 
  fi
1828
 
  for p in $PYTHONDIR; do
1829
 
    for d in $SUPPYTHONLIBS; do
1830
 
      for b in lib64 lib/64 lib; do
1831
 
        echo "compiling the following source file:" >> $LOG
1832
 
        cat $ODIR.tmp_src.cc >> $LOG
1833
 
        echo "using the following command line:" >> $LOG
1834
 
        echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so" >> $LOG
1835
 
        $CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so >> $LOG 2>&1
1836
 
        if [ $? -eq 0 ]; then
1837
 
          found=1
1838
 
          break
1839
 
        fi
1840
 
      done
1841
 
      if [ -n "$found" ]; then break; fi
1842
 
    done
1843
 
    if [ -n "$found" ]; then break; fi
1844
 
  done
1845
 
  if [ -n "$found" ]; then
1846
 
    if test_execute; then
1847
 
      cnf_append "VBOX_WITH_PYTHON"     "1"
1848
 
      cnf_append "VBOX_PATH_PYTHON_INC" "$p/include/$d"
1849
 
      cnf_append "VBOX_LIB_PYTHON"      "$p/$b/lib$d.so"
1850
 
    else
1851
 
      log_failure "Python not working"
1852
 
      fail
1853
 
    fi
1854
 
  else
1855
 
    log_failure "Python not found"
1856
 
    fail
1857
 
  fi
1858
 
}
1859
 
 
1860
 
 
1861
 
#
1862
 
# Check for Java
1863
 
#
1864
 
check_java()
1865
 
{
1866
 
  test_header "Java support"
1867
 
  log_success
1868
 
}
1869
 
 
1870
 
 
1871
 
#
1872
 
# Setup wine
1873
 
#
1874
 
setup_wine()
1875
 
{
1876
 
  test_header "Wine support"
1877
 
  if ! which_wrapper wine > /dev/null; then
1878
 
    echo "  wine binary not found"
1879
 
    fail
1880
 
  fi
1881
 
  if ! which_wrapper wine > /dev/null; then
1882
 
    echo "  wine not found"
1883
 
    fail
1884
 
  fi
1885
 
  wine_version="`wine --version`"
1886
 
  case "`expr "$wine_version" : 'wine-\([0-9.]*\)' '>' 1.1.43`" in
1887
 
    "0")
1888
 
      if ! which_wrapper wineprefixcreate > /dev/null; then
1889
 
        echo "  wineprefixcreate not found"
1890
 
        fail
1891
 
      fi
1892
 
    ;;
1893
 
    *) eval "wineprefixcreate() { true ; }" ;; # now created automatically
1894
 
  esac
1895
 
  export WINEPREFIX="${ODIR}wine.$BUILD_MACHINE"
1896
 
  echo "WINEPREFIX=\"${ODIR}wine.$BUILD_MACHINE\"" >> $ENV
1897
 
  echo "export WINEPREFIX" >> $ENV
1898
 
  rm -rf $WINEPREFIX
1899
 
  mkdir -p $WINEPREFIX
1900
 
  touch $WINEPREFIX/.no_prelaunch_window_flag
1901
 
  if ! wineprefixcreate -q > /dev/null 2>&1; then
1902
 
    echo "  wineprefixcreate failed"
1903
 
    fail
1904
 
  fi
1905
 
  tmp=.tmp.wine.reg
1906
 
  rm -f $tmp
1907
 
  echo 'REGEDIT4' > $tmp
1908
 
  echo '' >> $tmp
1909
 
  echo '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]' >> $tmp
1910
 
  echo "\"PATH\"=\"c:\\\\\\\\windows\\\\\\\\system32;c:\\\\\\\\windows;z:$DEVDIR/win.x86/vcc/v8/bin/Microsoft.VC80.CRT;z:$DEVDIR/win.x86/HTML_Help_Workshop/v1.3\"" >> $tmp
1911
 
  echo '' >> $tmp
1912
 
  echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhc.exe\DllOverrides]' >> $tmp
1913
 
  echo '"itss"="native"' >> $tmp
1914
 
  echo '' >> $tmp
1915
 
  echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhw.exe\DllOverrides]' >> $tmp
1916
 
  echo '"itss"="native"' >> $tmp
1917
 
  echo '' >> $tmp
1918
 
  if ! wine regedit $tmp > /dev/null 2>&1; then
1919
 
    rm -f $tmp
1920
 
    echo "  failed to load registry changes (path)."
1921
 
    fail
1922
 
  fi
1923
 
  rm -f $tmp
1924
 
  log_success "found"
1925
 
}
1926
 
 
1927
 
 
1928
 
#
1929
 
# Check for gSOAP.
1930
 
#
1931
 
check_gsoap()
1932
 
{
1933
 
  test_header "GSOAP compiler"
1934
 
  if [ -z "$GSOAP" ]; then
1935
 
    GSOAP="/usr"
1936
 
  fi
1937
 
  if which_wrapper "$GSOAP/bin/soapcpp2" > /dev/null; then
1938
 
    if which_wrapper "$GSOAP/bin/wsdl2h" > /dev/null; then
1939
 
      if [ -f "$GSOAP/include/stdsoap2.h" ]; then
1940
 
        # TODO: Check for libgsoap++.a/so
1941
 
 
1942
 
        if [ -z "$GSOAP_IMPORT" ]; then
1943
 
          GSOAP_IMPORT="$GSOAP/share/gsoap/import"
1944
 
          if [ ! -d "$GSOAP_IMPORT"  -a  -d "$GSOAP/include/gsoap" ]; then
1945
 
            GSOAP_IMPORT="$GSOAP/include/gsoap"
1946
 
          fi
1947
 
        fi
1948
 
        if [ -f "$GSOAP_IMPORT/stlvector.h" ]; then
1949
 
          cnf_append "VBOX_GSOAP_INSTALLED"   "1"
1950
 
          cnf_append "VBOX_PATH_GSOAP"        "$GSOAP"
1951
 
          cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
1952
 
          if [ -f "$GSOAP/share/gsoap/stdsoap2.cpp" ]; then
1953
 
            cnf_append "VBOX_GSOAP_CXX_SOURCES" "$GSOAP/share/gsoap/stdsoap2.cpp"
1954
 
          else
1955
 
            cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
1956
 
          fi
1957
 
          cnf_append "VBOX_GSOAP_CXX_LIBS"    "libgsoap++"
1958
 
          log_success "found"
1959
 
        else
1960
 
          log_failure "stlvector.h not found -- disabling webservice"
1961
 
          cnf_append "VBOX_WITH_WEBSERVICES" ""
1962
 
        fi
1963
 
      else
1964
 
        log_failure "stdsoap2.h not found -- disabling webservice"
1965
 
        cnf_append "VBOX_WITH_WEBSERVICES" ""
1966
 
      fi
1967
 
    else
1968
 
      log_failure "wsdl2h not found -- disabling webservice"
1969
 
      cnf_append "VBOX_WITH_WEBSERVICES" ""
1970
 
    fi
1971
 
  else
1972
 
    log_failure "soapcpp2 not found -- disabling webservice"
1973
 
    cnf_append "VBOX_WITH_WEBSERVICES" ""
1974
 
  fi
1975
 
}
1976
 
 
1977
 
 
1978
 
#
1979
 
# Determines the Darwin version.
1980
 
# @todo This should really check the Xcode/SDK version.
1981
 
#
1982
 
check_darwinversion()
1983
 
{
1984
 
  test_header "Darwin version"
1985
 
  darwin_ver=`uname -r`
1986
 
  case "$darwin_ver" in
1987
 
    11\.*)
1988
 
      darwin_ver="10.7" # Lion
1989
 
      sdk=/Developer/SDKs/MacOSX10.6.sdk
1990
 
      CXX_FLAGS="-mmacosx-version-min=10.6 -isysroot $sdk -Wl,-syslibroot,$sdk"
1991
 
      ;;
1992
 
    10\.*)
1993
 
      darwin_ver="10.6" # Snow Leopard
1994
 
      if [ "$BUILD_MACHINE" = "x86" ]; then
1995
 
          sdk=/Developer/SDKs/MacOSX10.5.sdk
1996
 
          CXX_FLAGS="-mmacosx-version-min=10.5 -isysroot $sdk -Wl,-syslibroot,$sdk"
1997
 
          cnf_append "VBOX_MACOS_10_5_WORKAROUND" "1"
1998
 
      else
1999
 
          sdk=/Developer/SDKs/MacOSX10.6.sdk
2000
 
          CXX_FLAGS="-mmacosx-version-min=10.6 -isysroot $sdk -Wl,-syslibroot,$sdk"
2001
 
      fi
2002
 
#      test "$CC" = "gcc" && CC="gcc-4.0"
2003
 
#      test "$CXX" = "g++" && CXX="g++-4.0"
2004
 
      cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7" "1"
2005
 
      ;;
2006
 
    9\.*)
2007
 
      darwin_ver="10.5" # Leopard
2008
 
      sdk=/Developer/SDKs/MacOSX10.5.sdk
2009
 
      CXX_FLAGS="-mmacosx-version-min=10.5 -isysroot $sdk -Wl,-syslibroot,$sdk"
2010
 
#      test "$CC" = "gcc" && CC="gcc-4.0"
2011
 
#      test "$CXX" = "g++" && CXX="g++-4.0"
2012
 
      cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6" "1"
2013
 
      cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7" "1"
2014
 
      ;;
2015
 
    8\.*)
2016
 
      darwin_ver="10.4" # Tiger
2017
 
      sdk=/Developer/SDKs/MacOSX10.4u.sdk
2018
 
      CXX_FLAGS="-mmacosx-version-min=10.4 -isysroot $sdk -Wl,-syslibroot,$sdk"
2019
 
#      test "$CC" = "gcc" && CC="gcc-4.0"
2020
 
#      test "$CXX" = "g++" && CXX="g++-4.0"
2021
 
      cnf_append "VBOX_WITH_COCOA_QT" ""
2022
 
      cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6" "1"
2023
 
      cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7" "1"
2024
 
      ;;
2025
 
    *)
2026
 
      echo "  failed to determine Darwin version. (uname -r: $darwin_ver)"
2027
 
      fail
2028
 
      darwin_ver="unknown"
2029
 
      ;;
2030
 
  esac
2031
 
  log_success "found version $darwin_ver (SDK: $sdk)"
2032
 
}
2033
 
 
2034
 
 
2035
 
check_makeself()
2036
 
{
2037
 
  test_header "makeself"
2038
 
  if check_avail "$MAKESELF" makeself; then
2039
 
    makeself_ver=`$MAKESELF --version|grep version|sed 's+^Makeself.*version \([0-9\.]*\).*+\1+'`
2040
 
    if [ $? -ne 0 ]; then
2041
 
      log_failure "makeself not working"
2042
 
      fail
2043
 
    else
2044
 
      log_success "found version $makeself_ver"
2045
 
      cnf_append "VBOX_MAKESELF" "`which_wrapper $MAKESELF`"
2046
 
    fi
2047
 
  fi
2048
 
}
2049
 
 
2050
 
 
2051
 
#
2052
 
# Checks that i386-elf-gcc-3.4.6, i386-elf-gcc-3.4.3, i386-elf-gcc-3.4 or i386-elf-gcc
2053
 
# is around to prevent confusion when the build fails in src/recompiler.
2054
 
# Note. Keep the which order in sync with the $(which ) in src/recompiler/Makefile.kmk.
2055
 
#
2056
 
check_i386elfgcc()
2057
 
{
2058
 
  test_header "i386-elf-gcc"
2059
 
  i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.6`
2060
 
  test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.3`
2061
 
  test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4`
2062
 
  test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc`
2063
 
  if test -z "$i386_elf_gcc"; then
2064
 
    echo "  failed to find i386-elf-gcc"
2065
 
    fail
2066
 
  fi
2067
 
  log_success "found $i386_elf_gcc"
2068
 
}
2069
 
 
2070
 
 
2071
 
#
2072
 
# Show help
2073
 
#
2074
 
show_help()
2075
 
{
2076
 
cat << EOF
2077
 
Usage: ./configure [OPTIONS]...
2078
 
 
2079
 
Configuration:
2080
 
  -h, --help               display this help and exit
2081
 
  --nofatal                don't abort on errors
2082
 
EOF
2083
 
[ $WITH_XPCOM   -eq 1 ] && echo "  --disable-xpcom          disable XPCOM and related stuff"
2084
 
[ $WITH_PYTHON  -eq 1 ] && echo "  --disable-python         disable python bindings"
2085
 
[ $WITH_JAVA    -eq 1 ] && echo "  --disable-java           disable java bindings"
2086
 
[ $WITH_VMMRAW  -eq 1 ] && echo "  --disable-vmmraw         disable VMM raw mode (VT-x/AMD-V mandatory!)"
2087
 
[ $WITH_SDL_TTF -eq 1 ] && echo "  --disable-sdl-ttf        disable SDL_ttf detection"
2088
 
[ $WITH_ALSA    -eq 1 ] && echo "  --disable-alsa           disable the ALSA sound backend"
2089
 
[ $WITH_PULSE   -eq 1 ] && echo "  --disable-pulse          disable the PulseAudio backend"
2090
 
[ $WITH_DBUS    -eq 1 ] && echo "  --disable-dbus           don't use DBus and hal for hardware detection"
2091
 
[ $WITH_KMODS   -eq 1 ] && echo "  --disable-kmods          don't build Linux kernel modules (host and guest)"
2092
 
[ $WITH_OPENGL  -eq 1 ] && echo "  --disable-opengl         disable OpenGL support (2D & 3D)"
2093
 
[ $WITH_GSOAP   -eq 0 ] && echo "  --enable-webservice      enable the webservice stuff"
2094
 
[ $OSE          -eq 1 ] && echo "  --enable-vnc             enable the VNC server"
2095
 
[ $OSE          -eq 0 ] && echo "  --disable-extpack        don't build the extpack"
2096
 
[ $WITH_DOCS    -eq 1 ] && echo "  --disable-docs           don't build the documentation"
2097
 
[ "$OS" = "linux" -o "$OS" = "freebsd" ] && echo "  --enable-vde             enable VDE networking"
2098
 
cat << EOF
2099
 
  --disable-udptunnel      disable UDP tunnel networking
2100
 
  --disable-hardening      don't be strict about /dev/vboxdrv access
2101
 
  --build-libxml2          build libxml2 from sources
2102
 
EOF
2103
 
[ $OSE -eq 0 ] && cat << EOF
2104
 
  --build-libssl           build openssl from sources
2105
 
  --build-libcurl          build libcurl from sources
2106
 
EOF
2107
 
[ "$OS"   != "darwin" ] && echo "  --setup-wine             setup a Wine directory and register the hhc hack"
2108
 
cat << EOF
2109
 
 
2110
 
Paths:
2111
 
  --with-gcc=PATH          location of the gcc compiler [$CC]
2112
 
  --with-g++=PATH          location of the g++ compiler [$CXX]
2113
 
  --with-kbuild=DIR        kbuild directory [$KBUILDDIR]
2114
 
  --with-iasl=PATH         location of the iasl compiler [$IASL]
2115
 
  --with-mkisofs=PATH      location of mkisofs [$MKISOFS]
2116
 
  --with-makeself=PATH     location of makeself [$MAKESELF]
2117
 
EOF
2118
 
[ "$OS"    = "linux" ] && echo "  --with-linux=DIR         Linux kernel source directory [$LINUX]"
2119
 
[ $WITH_QT4    -eq 1 ] && echo "  --with-qt-dir=DIR        directory for Qt4 headers/libraries [pkgconfig]"
2120
 
[ $WITH_GSOAP  -eq 1 ] && echo "  --with-gsoap-dir=PATH    directory for gSOAP compiler/headers/libraries"
2121
 
[ $WITH_GSOAP  -eq 1 ] && echo "                           (soapcpp2 and wsdl2h, soapstd2.h, libgsoap++.a/so)"
2122
 
[ $WITH_GSOAP  -eq 1 ] && echo "  --with-gsoap-import=PATH directory for gSOAP import files (stlvector.h)"
2123
 
cat << EOF
2124
 
  --with-openssl-dir=DIR   directory for OpenSSL headers/libraries
2125
 
  --out-path=PATH          the folder to which configuration and build output
2126
 
                           should go
2127
 
 
2128
 
Build type:
2129
 
  -d, --build-debug        build with debugging symbols and assertions
2130
 
  --build-profile          build with profiling support
2131
 
  --build-headless         build headless (without any GUI frontend)
2132
 
EOF
2133
 
  exit 0
2134
 
}
2135
 
 
2136
 
 
2137
 
#
2138
 
# The body.
2139
 
#
2140
 
 
2141
 
# test if we are OSE
2142
 
if [ $OSE -eq 1 -a -r "`cd \`dirname $0\`; pwd`/src/VBox/RDP/server/server.cpp" ]; then
2143
 
  OSE=0
2144
 
  # Set this as a reminder to print a log message once we know the path of the
2145
 
  # log file
2146
 
  NOT_OSE=1
2147
 
fi
2148
 
 
2149
 
# Change OS specific defaults; must be before all other stuff
2150
 
if [ "$OS" = "darwin" ]; then
2151
 
  WITH_SDL=0
2152
 
  WITH_SDL_TTF=0
2153
 
  WITH_X11=0
2154
 
  WITH_ALSA=0
2155
 
  WITH_PULSE=0
2156
 
  WITH_DBUS=0
2157
 
  WITH_KMODS=0
2158
 
  BUILD_LIBXML2=1
2159
 
  [ $OSE -eq 1 ] || BUILD_LIBCURL=1
2160
 
fi
2161
 
 
2162
 
# scan command line options
2163
 
for option in $*; do
2164
 
  case "$option" in
2165
 
    --help|-help|-h)
2166
 
      show_help
2167
 
      ;;
2168
 
    --nofatal)
2169
 
      nofatal=1
2170
 
      ;;
2171
 
    --env-only)
2172
 
      ENV_ONLY=1
2173
 
      ;;
2174
 
    --with-gcc=*)
2175
 
      CC=`echo $option | cut -d'=' -f2`
2176
 
      ;;
2177
 
    --with-g++=*)
2178
 
      CXX=`echo $option | cut -d'=' -f2`
2179
 
      ;;
2180
 
    --with-kbuild=*)
2181
 
      KBUILDDIR=`echo $option | cut -d'=' -f2`
2182
 
      if echo $KBUILDDIR|grep -q "$INVALID_CHARS"; then
2183
 
        echo "Error: KBUILDDIR contains invalid characters!"
2184
 
        exit 1
2185
 
      fi
2186
 
      ;;
2187
 
    --with-qt-dir=*|--with-qt4-dir=*)
2188
 
      QT4DIR=`echo $option | cut -d'=' -f2`
2189
 
      QT4DIR_PKGCONFIG=0
2190
 
      ;;
2191
 
    --with-openssl-dir=*)
2192
 
      OPENSSLDIR=`echo $option | cut -d'=' -f2`
2193
 
      INCCRYPTO="-I${OPENSSLDIR}/include"
2194
 
      LIBCRYPTO="${OPENSSLDIR}/lib/libcrypto.a ${OPENSSLDIR}/lib/libssl.a"
2195
 
      ;;
2196
 
    --with-gsoap-dir=*)
2197
 
      GSOAP=`echo $option | cut -d'=' -f2`
2198
 
      ;;
2199
 
    --with-gsoap-import=*)
2200
 
      GSOAP_IMPORT=`echo $option | cut -d'=' -f2`
2201
 
      ;;
2202
 
    --with-iasl=*)
2203
 
      IASL=`echo $option | cut -d'=' -f2`
2204
 
      ;;
2205
 
    --with-linux=*)
2206
 
      LINUX=`echo $option | cut -d'=' -f2`
2207
 
      ;;
2208
 
    --with-mkisofs=*)
2209
 
      MKISOFS=`echo $option | cut -d'=' -f2`
2210
 
      ;;
2211
 
    --with-makeself=*)
2212
 
      MAKESELF=`echo $option | cut -d'=' -f2`
2213
 
      ;;
2214
 
    --target-arch=*)
2215
 
      TARGET_MACHINE=`echo $option | cut -d'=' -f2`
2216
 
      ;;
2217
 
    --disable-xpcom)
2218
 
      [ $WITH_XPCOM -eq 1 ] && WITH_XPCOM=0
2219
 
      ;;
2220
 
    --disable-python)
2221
 
      [ $WITH_PYTHON -eq 1 ] && WITH_PYTHON=0
2222
 
      ;;
2223
 
    --disable-java)
2224
 
      [ $WITH_JAVA -eq 1 ] && WITH_JAVA=0
2225
 
      ;;
2226
 
    --disable-vmmraw)
2227
 
      [ $WITH_VMMRAW -eq 1 ] && WITH_VMMRAW=0
2228
 
      ;;
2229
 
    --disable-sdl-ttf)
2230
 
      [ $WITH_SDL_TTF -eq 1 ] && WITH_SDL_TTF=0
2231
 
      ;;
2232
 
    --disable-qt)
2233
 
      [ $WITH_QT4 -eq 1 ] && WITH_QT4=0
2234
 
      ;;
2235
 
    --disable-qt4)
2236
 
      [ $WITH_QT4 -eq 1 ] && WITH_QT4=0
2237
 
      ;;
2238
 
    --passive-mesa)
2239
 
      PASSIVE_MESA=1
2240
 
      ;;
2241
 
    --disable-alsa)
2242
 
      [ $WITH_ALSA -eq 1 ] && WITH_ALSA=0
2243
 
      ;;
2244
 
    --disable-pulse)
2245
 
      [ $WITH_PULSE -eq 1 ] && WITH_PULSE=0
2246
 
      ;;
2247
 
    --enable-pulse)
2248
 
      WITH_PULSE=2
2249
 
      ;;
2250
 
    --disable-dbus)
2251
 
      [ $WITH_DBUS -eq 1 ] && WITH_DBUS=0
2252
 
      ;;
2253
 
    --disable-kmods)
2254
 
      [ $WITH_KMODS -eq 1 ] && WITH_KMODS=0
2255
 
      ;;
2256
 
    --disable-opengl)
2257
 
      [ $WITH_OPENGL -eq 1 ] && WITH_OPENGL=0
2258
 
      ;;
2259
 
    --enable-webservice)
2260
 
      [ $WITH_GSOAP -eq 0 ] && WITH_GSOAP=1
2261
 
      ;;
2262
 
    --enable-vnc)
2263
 
      WITH_VNC=1
2264
 
      ;;
2265
 
    --disable-hardening)
2266
 
      WITH_HARDENING=0
2267
 
      ;;
2268
 
    --disable-extpack)
2269
 
      WITH_EXTPACK=0
2270
 
      ;;
2271
 
    --disable-docs)
2272
 
      WITH_DOCS=0
2273
 
      ;;
2274
 
    --enable-hardening)
2275
 
      WITH_HARDENING=2
2276
 
      ;;
2277
 
    --disable-udptunnel)
2278
 
      WITH_UDPTUNNEL=0
2279
 
      ;;
2280
 
    --enable-vde)
2281
 
      WITH_VDE=1
2282
 
      ;;
2283
 
    --build-debug|-d)
2284
 
      BUILD_TYPE=debug
2285
 
      ;;
2286
 
    --build-profile)
2287
 
      BUILD_TYPE=profile
2288
 
      ;;
2289
 
    --build-libxml2)
2290
 
      BUILD_LIBXML2=1
2291
 
      ;;
2292
 
    --build-libssl)
2293
 
      BUILD_LIBSSL=1
2294
 
      ;;
2295
 
    --build-libcurl)
2296
 
      BUILD_LIBCURL=1
2297
 
      ;;
2298
 
    --build-headless)
2299
 
      HEADLESS=1
2300
 
      WITH_SDL=0
2301
 
      WITH_SDL_TTF=0
2302
 
      WITH_X11=0
2303
 
      WITH_OPENGL=0
2304
 
      WITH_QT4=0
2305
 
      ;;
2306
 
    --ose)
2307
 
      OSE=2
2308
 
      ;;
2309
 
    --odir=*)
2310
 
      ODIR="`echo $option | cut -d'=' -f2`/"
2311
 
      ODIR_OVERRIDE=1
2312
 
      ;;
2313
 
    --out-path=*)
2314
 
      out_path="`echo $option | cut -d'=' -f2`/"
2315
 
      if [ -d $out_path ]; then
2316
 
        saved_path="`pwd`"
2317
 
        cd $out_path
2318
 
        OUT_PATH="`pwd`"
2319
 
        cd $saved_path
2320
 
        OUT_PATH_OVERRIDE=1
2321
 
        if [ $ODIR_OVERRIDE -eq 0 ]; then
2322
 
          # This variable has not *yet* been overridden.  That can still happen.
2323
 
          ODIR=$OUT_PATH/
2324
 
        fi
2325
 
      else
2326
 
        echo "Error: invalid folder \"$out_path\" in option \"$option\""
2327
 
        exit 1
2328
 
      fi
2329
 
      ;;
2330
 
    --setup-wine)
2331
 
      [ "$OS" != "darwin" ] && SETUP_WINE=1
2332
 
      ;;
2333
 
    *)
2334
 
      echo
2335
 
      echo "Unrecognized option \"$option\""
2336
 
      echo
2337
 
      show_help
2338
 
      ;;
2339
 
  esac
2340
 
done
2341
 
 
2342
 
LOG="$ODIR$LOG"
2343
 
ENV="$ODIR$ENV"
2344
 
CNF="$ODIR$CNF"
2345
 
 
2346
 
# initialize output files
2347
 
cat > $LOG << EOF
2348
 
# Log file generated by
2349
 
#
2350
 
#   '$0 $*'
2351
 
#
2352
 
 
2353
 
EOF
2354
 
cat > $CNF << EOF
2355
 
# -*- Makefile -*-
2356
 
#
2357
 
# automatically generated by
2358
 
#
2359
 
#   '$0 $*'
2360
 
#
2361
 
# It will be completely overwritten if configure is executed again.
2362
 
#
2363
 
 
2364
 
EOF
2365
 
cat > $ENV << EOF
2366
 
#!/bin/bash
2367
 
#
2368
 
# automatically generated by
2369
 
#
2370
 
#   '$0 $*'
2371
 
#
2372
 
# It will be completely overwritten if configure is executed again.
2373
 
# Make sure you source this file once before you start to build VBox.
2374
 
#
2375
 
 
2376
 
EOF
2377
 
 
2378
 
# Print log warning about OSE if necessary
2379
 
if [ -n "$NOT_OSE" ]; then
2380
 
  echo "Found RDP server, assuming VBOX_OSE = FALSE" >> $LOG
2381
 
  echo >> $LOG
2382
 
fi
2383
 
 
2384
 
 
2385
 
if [ "$BUILD_TYPE" = "debug" ]; then
2386
 
  echo "Creating DEBUG build!" >> $LOG
2387
 
elif [ "$BUILD_TYPE" = "profile" ]; then
2388
 
  echo "Creating PROFILE build!" >> $LOG
2389
 
fi
2390
 
 
2391
 
# first determine our environment
2392
 
check_environment
2393
 
check_kbuild
2394
 
 
2395
 
[ -n "$ENV_ONLY" ] && exit 0
2396
 
 
2397
 
# append the tools directory to the default search path
2398
 
echo "$PATH" | grep -q "$DEVDIR_BIN" || PATH="$PATH:$DEVDIR_BIN"
2399
 
export PATH
2400
 
 
2401
 
# if we will be writing to a different out directory then set this up now
2402
 
if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2403
 
  echo "AUTOCFG=$OUT_PATH/AutoConfig.kmk" >> $ENV
2404
 
  echo "export AUTOCFG" >> $ENV
2405
 
  echo "LOCALCFG=$OUT_PATH/LocalConfig.kmk" >> $ENV
2406
 
  echo "export LOCALCFG" >> $ENV
2407
 
  echo "PATH_OUT_BASE=$OUT_PATH" >> $ENV
2408
 
  echo "export PATH_OUT_BASE" >> $ENV
2409
 
fi
2410
 
 
2411
 
# some things are not available in for OSE
2412
 
if [ $OSE -ge 1 ]; then
2413
 
  cnf_append "VBOX_OSE" "1"
2414
 
  cnf_append "VBOX_WITH_TESTSUITE" ""
2415
 
  cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
2416
 
 
2417
 
  if [ "$OS" = "linux" ]; then
2418
 
    cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
2419
 
  else
2420
 
    cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
2421
 
  fi
2422
 
  echo >> $CNF
2423
 
fi
2424
 
 
2425
 
# extpack
2426
 
if [ $OSE -eq 0 ]; then
2427
 
  if [ $WITH_EXTPACK -eq 1 ]; then
2428
 
    BUILD_LIBSSL=1
2429
 
  else
2430
 
    cnf_append "VBOX_WITH_EXTPACK_PUEL_BUILD" ""
2431
 
  fi
2432
 
fi
2433
 
 
2434
 
# headless
2435
 
if [ -n "$HEADLESS" ]; then
2436
 
  cnf_append "VBOX_HEADLESS" "1"
2437
 
fi
2438
 
 
2439
 
# emit disable directives corresponding to any --disable-xxx options.
2440
 
if [ $WITH_OPENGL -eq 0 ]; then
2441
 
  cnf_append "VBOX_WITH_CROGL" ""
2442
 
  cnf_append "VBOX_WITH_VIDEOHWACCEL" ""
2443
 
  cnf_append "VBOX_GUI_USE_QGL" ""
2444
 
fi
2445
 
[ $WITH_XPCOM     -eq 0 ] && cnf_append "VBOX_WITH_MAIN" ""
2446
 
[ $WITH_QT4       -eq 0 ] && cnf_append "VBOX_WITH_QTGUI" ""
2447
 
[ $WITH_SDL_TTF   -eq 0 ] && cnf_append "VBOX_WITH_SECURELABEL" ""
2448
 
[ $WITH_PYTHON    -eq 0 ] && cnf_append "VBOX_WITH_PYTHON" ""
2449
 
[ $WITH_JAVA      -eq 0 ] && cnf_append "VBOX_WITH_JXPCOM" ""
2450
 
[ $WITH_HARDENING -eq 0 ] && cnf_append "VBOX_WITHOUT_HARDENING" "1"
2451
 
[ $WITH_HARDENING -eq 2 ] && cnf_append "VBOX_WITH_HARDENING" "2"
2452
 
[ $WITH_VMMRAW    -eq 0 ] && cnf_append "VBOX_WITH_RAW_MODE" ""
2453
 
 
2454
 
# Darwin-specific
2455
 
if [ "$OS" = "darwin" ]; then
2456
 
  check_darwinversion
2457
 
fi
2458
 
# the tools
2459
 
check_gcc
2460
 
[ "$OS" != "darwin"  ] && check_as86
2461
 
[ "$OS" != "darwin"  ] && check_bcc
2462
 
[ "$OS" != "darwin"  ] && check_iasl
2463
 
# don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
2464
 
# [ "$OS" != "darwin" ] && check_yasm
2465
 
[ "$OS" != "darwin"  ] && check_xsltproc
2466
 
[ "$OS" != "darwin"  ] && check_mkisofs
2467
 
 
2468
 
# the libraries
2469
 
[ "$OS" != "darwin"  ] && check_pthread
2470
 
check_libxml2
2471
 
[ $WITH_LIBIDL -eq 1 ] && check_libidl
2472
 
check_ssl
2473
 
check_curl
2474
 
[ "$OS" != "darwin"  ] && check_z
2475
 
[ "$OS" != "darwin"  ] && check_png
2476
 
[ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
2477
 
[ $WITH_SDL -eq 1 ]    && check_sdl
2478
 
[ $WITH_SDL_TTF -eq 1 -a $OSE -eq 0 ] && check_sdl_ttf
2479
 
[ $WITH_X11    -eq 1 ] && check_x
2480
 
# TODO check for xcomposite-dev (X11/extensions/Xcomposite.h, additions only)
2481
 
# TODO check for libxdamange-dev (X11/extensions/Xdamage.h, additions only)
2482
 
[ $WITH_X11    -eq 1 ] && check_xcursor
2483
 
[ $WITH_X11    -eq 1 ] && check_xinerama
2484
 
[ $WITH_X11    -eq 1 ] && check_xrandr
2485
 
[ $WITH_OPENGL -eq 1 ] && check_opengl
2486
 
[ $WITH_QT4    -eq 1 ] && check_qt4
2487
 
[ $WITH_PYTHON -eq 1 ] && check_python
2488
 
[ $WITH_JAVA   -eq 1 ] && check_java
2489
 
 
2490
 
# PulseAudio
2491
 
if [ "$OS" = "linux" -o "$OS" = "freebsd" ]; then
2492
 
  if [ $WITH_PULSE -eq 1 ]; then
2493
 
    check_pulse
2494
 
  elif [ $WITH_PULSE -eq 0 ]; then
2495
 
    cnf_append "VBOX_WITH_PULSE" ""
2496
 
  fi
2497
 
fi
2498
 
 
2499
 
# Linux-specific
2500
 
if [ "$OS" = "linux" ]; then
2501
 
  # don't check for the static libstdc++ in the PUEL version as we build the
2502
 
  # additions at a dedicated box
2503
 
  [ $OSE -ge 1 ] && check_staticlibstdcxx
2504
 
  if [ $WITH_KMODS -eq 1 ]; then
2505
 
    check_linux
2506
 
  else
2507
 
    cnf_append "VBOX_LINUX_SRC" ""
2508
 
    cnf_append "VBOX_WITH_VBOXDRV" ""
2509
 
    cnf_append "VBOX_WITH_ADDITION_DRIVERS" ""
2510
 
  fi
2511
 
  if [ $WITH_ALSA -eq 1 ]; then
2512
 
    check_alsa
2513
 
  else
2514
 
    cnf_append "VBOX_WITH_ALSA" ""
2515
 
  fi
2516
 
  if [ $WITH_DBUS -eq 0 ]; then
2517
 
    cnf_append "VBOX_WITH_DBUS" ""
2518
 
  fi
2519
 
  check_libcap
2520
 
  check_compiler_h
2521
 
  [ "$BUILD_MACHINE" = "amd64" -a $WITH_VMMRAW -eq 1 ] && check_32bit
2522
 
  # tools/common/makeself*
2523
 
  [ $OSE -ge 1 ] && check_makeself
2524
 
fi
2525
 
 
2526
 
[ -n "$SETUP_WINE" ] && setup_wine
2527
 
 
2528
 
if [ $OSE -ge 1 ]; then
2529
 
  if [ $WITH_GSOAP -eq 1 ]; then
2530
 
    check_gsoap
2531
 
  else
2532
 
    cnf_append "VBOX_WITH_WEBSERVICES" ""
2533
 
  fi
2534
 
fi
2535
 
 
2536
 
# UDPTUNNEL
2537
 
if [ $WITH_UDPTUNNEL -eq 0 ]; then
2538
 
  cnf_append "VBOX_WITH_UDPTUNNEL" ""
2539
 
fi
2540
 
 
2541
 
# VDE
2542
 
if [ "$OS" = "linux" -o "$OS" = "freebsd" ]; then
2543
 
  if [ $WITH_VDE -eq 1 ]; then
2544
 
    cnf_append "VBOX_WITH_VDE" "1"
2545
 
  fi
2546
 
fi
2547
 
 
2548
 
# DOCS
2549
 
if [ $WITH_DOCS -eq 0 ]; then
2550
 
  cnf_append "VBOX_WITH_DOCS" ""
2551
 
  cnf_append "VBOX_WITH_DOCS_PACKING" ""
2552
 
fi
2553
 
 
2554
 
# VNC server support
2555
 
if [ $OSE -ge 1 ]; then
2556
 
  if [ $WITH_VNC = 1 ]; then
2557
 
    check_vncserver
2558
 
  else
2559
 
    cnf_append "VBOX_WITH_VNC" ""
2560
 
  fi
2561
 
fi
2562
 
 
2563
 
# success!
2564
 
echo
2565
 
echo "Successfully generated '$CNF' and '$ENV'."
2566
 
echo "Source '$ENV' once before you start to build VBox:"
2567
 
echo ""
2568
 
echo "  source $ENV"
2569
 
echo "  kmk"
2570
 
echo ""
2571
 
if [ "$OS" = "linux" ]; then
2572
 
    if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2573
 
      vbox_out_path=$OUT_PATH
2574
 
    else
2575
 
      vbox_out_path=./out
2576
 
    fi
2577
 
    echo "To compile the kernel modules, do:"
2578
 
    echo ""
2579
 
    echo "  cd $vbox_out_path/$OS.$TARGET_MACHINE/$BUILD_TYPE/bin/src"
2580
 
    echo "  make"
2581
 
    echo ""
2582
 
fi
2583
 
if [ $WITH_HARDENING -gt 0 ]; then
2584
 
    echo ""
2585
 
    echo "  +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2586
 
    echo "  Hardening is enabled which means that the VBox binaries will not run from"
2587
 
    echo "  the binary directory. The binaries have to be installed suid root and some"
2588
 
    echo "  more prerequisites have to be fulfilled which is normally done by installing"
2589
 
    echo "  the final package. For development, the hardening feature can be disabled"
2590
 
    echo "  by specifying the --disable-hardening parameter. Please never disable that"
2591
 
    echo "  feature for the final distribution!"
2592
 
    echo "  +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2593
 
    echo ""
2594
 
else
2595
 
    echo ""
2596
 
    echo "  +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2597
 
    echo "  Hardening is disabled. Please do NOT build packages for distribution with"
2598
 
    echo "  disabled hardening!"
2599
 
    echo "  +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2600
 
    echo ""
2601
 
fi
2602
 
echo "Enjoy!"
2603
 
cleanup