This set of changes is to enable the capability of setting a fragment's visibility...
[qt:ganesh-qt.git] / configure
1 #!/bin/sh
2 #############################################################################
3 ##
4 ## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
5 ## All rights reserved.
6 ## Contact: Nokia Corporation (qt-info@nokia.com)
7 ##
8 ## This file is the build configuration utility of the Qt Toolkit.
9 ##
10 ## $QT_BEGIN_LICENSE:LGPL$
11 ## No Commercial Usage
12 ## This file contains pre-release code and may not be distributed.
13 ## You may use this file in accordance with the terms and conditions
14 ## contained in the Technology Preview License Agreement accompanying
15 ## this package.
16 ##
17 ## GNU Lesser General Public License Usage
18 ## Alternatively, this file may be used under the terms of the GNU Lesser
19 ## General Public License version 2.1 as published by the Free Software
20 ## Foundation and appearing in the file LICENSE.LGPL included in the
21 ## packaging of this file.  Please review the following information to
22 ## ensure the GNU Lesser General Public License version 2.1 requirements
23 ## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ##
25 ## In addition, as a special exception, Nokia gives you certain additional
26 ## rights.  These rights are described in the Nokia Qt LGPL Exception
27 ## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 ##
29 ## If you have questions regarding the use of this file, please contact
30 ## Nokia at qt-info@nokia.com.
31 ##
32 ##
33 ##
34 ##
35 ##
36 ##
37 ##
38 ##
39 ## $QT_END_LICENSE$
40 ##
41 #############################################################################
42
43 #-------------------------------------------------------------------------------
44 # script initialization
45 #-------------------------------------------------------------------------------
46
47 # the name of this script
48 relconf=`basename $0`
49 # the directory of this script is the "source tree"
50 relpath=`dirname $0`
51 relpath=`(cd "$relpath"; /bin/pwd)`
52 # the current directory is the "build tree" or "object tree"
53 outpath=`/bin/pwd`
54
55 #license file location
56 LICENSE_FILE="$QT_LICENSE_FILE"
57 [ -z "$LICENSE_FILE" ] && LICENSE_FILE="$HOME/.qt-license"
58 if [ -f "$LICENSE_FILE" ]; then
59     tr -d '\r' <"$LICENSE_FILE" >"${LICENSE_FILE}.tmp"
60     diff "${LICENSE_FILE}.tmp" "${LICENSE_FILE}" >/dev/null 2>&1 || LICENSE_FILE="${LICENSE_FILE}.tmp"
61 fi
62
63 # later cache the command line in config.status
64 OPT_CMDLINE=`echo $@ | sed "s,-v ,,g; s,-v$,,g"`
65
66 # initialize global variables
67 QMAKE_SWITCHES=
68 QMAKE_VARS=
69 QMAKE_CONFIG=
70 QTCONFIG_CONFIG=
71 QT_CONFIG=
72 SUPPORTED=
73 QMAKE_VARS_FILE=.qmake.vars
74
75 :> "$QMAKE_VARS_FILE"
76
77 #-------------------------------------------------------------------------------
78 # utility functions
79 #-------------------------------------------------------------------------------
80
81 shellEscape()
82 {
83     echo "$@" | sed 's/ /\ /g'
84 }
85
86 # Adds a new qmake variable to the cache
87 # Usage: QMakeVar mode varname contents
88 #   where mode is one of: set, add, del
89 QMakeVar()
90 {
91     case "$1" in
92         set)
93             eq="="
94             ;;
95         add)
96             eq="+="
97             ;;
98         del)
99             eq="-="
100             ;;
101         *)
102             echo >&2 "BUG: wrong command to QMakeVar: $1"
103             ;;
104     esac
105
106     echo "$2" "$eq" "$3" >> "$QMAKE_VARS_FILE"
107 }
108
109 # relies on $QMAKESPEC being set correctly. parses include statements in
110 # qmake.conf and prints out the expanded file
111 getQMakeConf()
112 {
113     tmpSPEC="$QMAKESPEC"
114     if [ -n "$1" ]; then
115         tmpSPEC="$1"
116     fi
117     $AWK -v "QMAKESPEC=$tmpSPEC" '
118 /^include\(.+\)$/{
119     fname = QMAKESPEC "/" substr($0, 9, length($0) - 9)
120     while ((getline line < fname) > 0)
121         print line
122     close(fname)
123     next
124 }
125 { print }' "$tmpSPEC/qmake.conf"
126 }
127
128 # relies on $TEST_COMPILER being set correctly
129 compilerSupportsFlag()
130 {
131     cat >conftest.cpp <<EOF
132 int main() { return 0; }
133 EOF
134     "$TEST_COMPILER" "$@" -o /dev/null conftest.cpp
135     ret=$?
136     rm -f conftest.cpp conftest.o
137     return $ret
138 }
139
140 # relies on $TEST_COMPILER being set correctly
141 linkerSupportsFlag()
142 {
143     lflags=-Wl
144     for flag
145     do
146         safe_flag=`shellEscape "$flag"`
147         lflags=$lflags,$safe_flag
148     done
149     compilerSupportsFlag "$lflags" >/dev/null 2>&1
150 }
151
152 #-------------------------------------------------------------------------------
153 # operating system detection
154 #-------------------------------------------------------------------------------
155
156 # need that throughout the script
157 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
158 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
159 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
160 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
161
162
163 #-------------------------------------------------------------------------------
164 # window system detection
165 #-------------------------------------------------------------------------------
166
167 PLATFORM_X11=no
168 PLATFORM_MAC=no
169 PLATFORM_QWS=no
170
171 if [ -f "$relpath"/src/gui/kernel/qapplication_mac.mm ] && [ -d /System/Library/Frameworks/Carbon.framework ]; then
172     # Qt/Mac
173     # ~ the Carbon SDK exists
174     # ~ src/gui/base/qapplication_mac.cpp is present
175     # ~ this is the internal edition and Qt/Mac sources exist
176     PLATFORM_MAC=maybe
177 elif [ -f "$relpath"/src/gui/kernel/qapplication_qws.cpp ]; then
178     # Qt Embedded
179     # ~ src/gui/base/qapplication_qws.cpp is present
180     # ~ this is the free or commercial edition
181     # ~ this is the internal edition and Qt Embedded is explicitly enabled
182     if [ -f "$relpath"/src/gui/kernel/qapplication_mac.mm ]; then
183         # This is a depot build, or an all-platforms package
184         PLATFORM_QWS=maybe
185     else
186         # This must be the embedded package, since the Qt/Mac source files are not present
187         PLATFORM_QWS=yes
188     fi
189 fi
190
191 #-----------------------------------------------------------------------------
192 # Qt version detection
193 #-----------------------------------------------------------------------------
194 QT_VERSION=`grep '^# *define *QT_VERSION_STR' "$relpath"/src/corelib/global/qglobal.h`
195 QT_MAJOR_VERSION=
196 QT_MINOR_VERSION=0
197 QT_PATCH_VERSION=0
198 if [ -n "$QT_VERSION" ]; then
199    QT_VERSION=`echo $QT_VERSION | sed 's,^# *define *QT_VERSION_STR *"*\([^ ]*\)"$,\1,'`
200    MAJOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'`
201    if [ -n "$MAJOR" ]; then
202      MINOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'`
203       PATCH=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'`
204       QT_MAJOR_VERSION="$MAJOR"
205       [ -z "$MINOR" ] || QT_MINOR_VERSION="$MINOR"
206       [ -z "$PATCH" ] || QT_PATCH_VERSION="$PATCH"
207    fi
208 fi
209 if [ -z "$QT_MAJOR_VERSION" ]; then
210    echo "Cannot process version from qglobal.h: $QT_VERSION"
211    echo "Cannot proceed."
212    exit 1
213 fi
214
215 QT_PACKAGEDATE=`grep '^# *define *QT_PACKAGEDATE_STR' "$relpath"/src/corelib/global/qglobal.h | sed -e 's,^# *define *QT_PACKAGEDATE_STR *"\([^ ]*\)"$,\1,' -e s,-,,g`
216 if [ -z "$QT_PACKAGEDATE" ]; then
217    echo "Unable to determine package date from qglobal.h: '$QT_PACKAGEDATE'"
218    echo "Cannot proceed"
219    exit 1
220 fi
221
222 #-------------------------------------------------------------------------------
223 # check the license
224 #-------------------------------------------------------------------------------
225 COMMERCIAL_USER=ask
226 CFG_DEV=no
227 CFG_NOKIA=no
228 CFG_EMBEDDED=no
229 CFG_RTOS_ENABLED=yes
230 EditionString=Commercial
231
232 earlyArgParse()
233 {
234     # parse the arguments, setting things to "yes" or "no"
235     while [ "$#" -gt 0 ]; do
236         CURRENT_OPT="$1"
237         UNKNOWN_ARG=no
238         case "$1" in
239         #Autoconf style options
240         --enable-*)
241             VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"`
242             VAL=yes
243             ;;
244         --disable-*)
245             VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"`
246             VAL=no
247             ;;
248         --*=*)
249             VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"`
250             VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"`
251             ;;
252         --no-*)
253             VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
254             VAL=no
255             ;;
256         -embedded)
257             VAR=embedded
258             # this option may or may not be followed by an argument
259             if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
260                 VAL=auto
261             else
262                 shift;
263                 VAL=$1
264             fi
265             ;;
266         -h|help|--help|-help)
267             if [ "$VAL" = "yes" ]; then
268                 OPT_HELP="$VAL"
269                 COMMERCIAL_USER="no" #doesn't matter we will display the help
270             else
271                 UNKNOWN_OPT=yes
272                 COMMERCIAL_USER="no" #doesn't matter we will display the help
273             fi
274             ;;
275         --*)
276             VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
277             VAL=yes
278             ;;
279         -*)
280             VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
281             VAL="unknown"
282             ;;
283         *)
284             UNKNOWN_ARG=yes
285             ;;
286         esac
287         if [ "$UNKNOWN_ARG" = "yes" ]; then
288             shift
289             continue
290         fi
291         shift
292
293         UNKNOWN_OPT=no
294         case "$VAR" in
295         embedded)
296             CFG_EMBEDDED="$VAL"
297             if [ "$PLATFORM_QWS" != "no" ]; then
298                 if [ "$PLATFORM_QWS" = "maybe" ]; then
299                     PLATFORM_X11=no
300                     PLATFORM_MAC=no
301                     PLATFORM_QWS=yes
302                 fi
303             else
304                 echo "No license exists to enable Qt for Embedded Linux. Disabling."
305                 CFG_EMBEDDED=no
306             fi
307             ;;
308         developer-build)
309             CFG_DEV="yes"
310             ;;
311         nokia-developer)
312             CFG_DEV="yes"
313             CFG_NOKIA="yes"
314             COMMERCIAL_USER="no"
315             ;;
316         commercial)
317             COMMERCIAL_USER="yes"
318             ;;
319         opensource)
320             COMMERCIAL_USER="no"
321             ;;
322         *)
323             UNKNOWN_OPT=yes
324             ;;
325         esac
326     done
327 }
328
329 earlyArgParse "$@"
330
331 if [ "$COMMERCIAL_USER" = "ask" ]; then
332     while true; do
333         echo "Which edition of Qt do you want to use ?"
334         echo
335         echo "Type 'c' if you want to use the Commercial Edition."
336         echo "Type 'o' if you want to use the Open Source Edition."
337         echo
338         read commercial
339         echo
340         if [ "$commercial" = "c" ]; then
341             COMMERCIAL_USER="yes"
342             break
343         elif [ "$commercial" = "o" ]; then
344             COMMERCIAL_USER="no"
345             break
346         fi
347     done
348 fi
349
350 if [ "$CFG_NOKIA" = "yes" ]; then
351     Licensee="Nokia"
352     Edition="NokiaInternalBuild"
353     EditionString="Nokia Internal Build"
354     QT_EDITION="QT_EDITION_OPENSOURCE"
355     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
356 elif [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ]; then
357     # Commercial preview release
358     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
359     Licensee="Preview"
360     Edition="Preview"
361     QT_EDITION="QT_EDITION_DESKTOP"
362     LicenseType="Technology Preview"
363 elif [ $COMMERCIAL_USER = "yes" ]; then
364     # one of commercial editions
365     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
366     [ "$PLATFORM_QWS" = "maybe" ] && PLATFORM_QWS=no
367
368     # read in the license file
369     if [ -f "$LICENSE_FILE" ]; then
370         . "$LICENSE_FILE" >/dev/null 2>&1
371         if [ -z "$LicenseKeyExt" ]; then
372             echo
373             echo "You are using an old license file."
374             echo
375             echo "Please install the license file supplied by Nokia,"
376             echo "or install the Qt Open Source Edition if you intend to"
377             echo "develop free software."
378             exit 1
379         fi
380         if [ -z "$Licensee" ]; then
381             echo
382             echo "Invalid license key. Please check the license key."
383             exit 1
384         fi
385     else
386         if [ -z "$LicenseKeyExt" ]; then
387             echo
388             if echo '\c' | grep '\c' >/dev/null; then
389                 echo -n "Please enter your license key: "
390             else
391                 echo "Please enter your license key: \c"
392             fi
393             read LicenseKeyExt
394             Licensee="Unknown user"
395         fi
396     fi
397
398     # Key verification
399     echo "$LicenseKeyExt" | grep ".....*-....*-....*-....*-.....*-.....*-...." >/dev/null 2>&1 \
400         && LicenseValid="yes" \
401         || LicenseValid="no"
402     if [ "$LicenseValid" != "yes" ]; then
403         echo
404         echo "Invalid license key. Please check the license key."
405         exit 1
406     fi
407     ProductCode=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1`
408     PlatformCode=`echo $LicenseKeyExt | cut -f 2 -d -`
409     LicenseTypeCode=`echo $LicenseKeyExt | cut -f 3 -d -`
410     LicenseFeatureCode=`echo $LicenseKeyExt | cut -f 4 -d - | cut -b 1`
411
412     # determine which edition we are licensed to use
413     case "$LicenseTypeCode" in
414     F4M)
415         LicenseType="Commercial"
416         case $ProductCode in
417         F)
418             Edition="Universal"
419             QT_EDITION="QT_EDITION_UNIVERSAL"
420             ;;
421         B)
422             Edition="FullFramework"
423             EditionString="Full Framework"
424             QT_EDITION="QT_EDITION_DESKTOP"
425             ;;
426         L)
427             Edition="GUIFramework"
428             EditionString="GUI Framework"
429             QT_EDITION="QT_EDITION_DESKTOPLIGHT"
430             ;;
431         esac
432         ;;
433     Z4M|R4M|Q4M)
434         LicenseType="Evaluation"
435         QMakeVar add DEFINES QT_EVAL
436         case $ProductCode in
437          B)
438             Edition="Evaluation"
439             QT_EDITION="QT_EDITION_EVALUATION"
440             ;;
441         esac
442         ;;
443     esac
444     if [ -z "$LicenseType" -o -z "$Edition" -o -z "$QT_EDITION" ]; then
445         echo
446         echo "Invalid license key. Please check the license key."
447         exit 1
448     fi
449
450     # verify that we are licensed to use Qt on this platform
451     LICENSE_EXTENSION=
452     case "$PlatformCode" in
453         *L)
454             CFG_RTOS_ENABLED=yes
455             PlatformCode=`echo "$PlatformCode" | sed 'h;y/8NPQRTZ/UCWX9M7/;x;G;s/\(.\)....\(.\)./\1\2/'`
456             ;;
457         *)
458             CFG_RTOS_ENABLED=no
459             PlatformCode=`echo "$PlatformCode" | sed 's/.$//'`
460             ;;
461     esac
462     case "$PlatformCode,$PLATFORM_MAC,$PLATFORM_QWS" in
463         X9,* | XC,* | XU,* | XW,* | XM,*)
464             # Qt All-OS
465             LICENSE_EXTENSION="-ALLOS"
466             ;;
467         8M,* | KM,* | S9,* | SC,* | SU,* | SW,* | X9,* | XC,* | XU,* | XW,*)
468             # Qt for Embedded Linux
469             LICENSE_EXTENSION="-EMBEDDED"
470             ;;
471         6M,*,no | N7,*,no | N9,*,no | NX,*,no)
472             # Embedded no-deploy
473             LICENSE_EXTENSION="-EMBEDDED"
474             ;;
475         FM,*,no | LM,yes,* | ZM,no,no)
476             # Desktop
477             LICENSE_EXTENSION="-DESKTOP"
478             ;;
479         *)
480             Platform=Linux/X11
481             [ "$PLATFORM_MAC" = "yes" ] && Platform='Mac OS X'
482             [ "$PLATFORM_QWS" = "yes" ] && Platform='Embedded Linux'
483             echo
484             echo "You are not licensed for the $Platform platform."
485             echo
486             echo "Please contact qt-info@nokia.com to upgrade your license to"
487             echo "include the $Platform platform, or install the Qt Open Source Edition"
488             echo "if you intend to develop free software."
489             exit 1
490             ;;
491     esac
492
493     if test -r "$relpath/.LICENSE"; then
494         # Generic, non-final license
495         LICENSE_EXTENSION=""
496         line=`sed 'y/a-z/A-Z/;q' "$relpath"/.LICENSE`
497         case "$line" in
498             *BETA*)
499                 Edition=Beta
500                 ;;
501             *TECHNOLOGY?PREVIEW*)
502                 Edition=Preview
503                 ;;
504             *EVALUATION*)
505                 Edition=Evaluation
506                 ;;
507             *)
508                 echo >&2 "Invalid license files; cannot continue"
509                 exit 1
510                 ;;
511         esac
512         Licensee="$Edition"
513         EditionString="$Edition"
514         QT_EDITION="QT_EDITION_DESKTOP"
515     fi
516
517     case "$LicenseFeatureCode" in
518     B|G|L|Y)
519         # US
520         case "$LicenseType" in
521         Commercial)
522             cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}-US" "$outpath/LICENSE"
523             ;;
524         Evaluation)
525             cp -f "$relpath/.LICENSE-EVALUATION-US" "$outpath/LICENSE"
526             ;;
527         esac
528         ;;
529     2|4|5|F)
530         # non-US
531         case "$LicenseType" in
532         Commercial)
533             cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}" "$outpath/LICENSE"
534             ;;
535         Evaluation)
536             cp -f "$relpath/.LICENSE-EVALUATION" "$outpath/LICENSE"
537             ;;
538         esac
539         ;;
540     *)
541         echo
542         echo "Invalid license key. Please check the license key."
543         exit 1
544         ;;
545     esac
546     case "$LicenseFeatureCode" in
547         4|B|F|Y)
548             CFG_RTOS_ENABLED=yes
549             ;;
550         2|5|G|L)
551             CFG_RTOS_ENABLED=no
552             ;;
553     esac
554     if [ '!' -f "$outpath/LICENSE" ]; then
555         echo "The LICENSE, LICENSE.GPL3 LICENSE.LGPL file shipped with"
556         echo "this software has disappeared."
557         echo
558         echo "Sorry, you are not licensed to use this software."
559         echo "Try re-installing."
560         echo
561         exit 1
562     fi
563 elif [ $COMMERCIAL_USER = "no" ]; then
564     # Open Source edition - may only be used under the terms of the GPL or LGPL.
565     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
566     Licensee="Open Source"
567     Edition="OpenSource"
568     EditionString="Open Source"
569     QT_EDITION="QT_EDITION_OPENSOURCE"
570 fi
571
572 #-------------------------------------------------------------------------------
573 # initalize variables
574 #-------------------------------------------------------------------------------
575
576 SYSTEM_VARIABLES="CC CXX CFLAGS CXXFLAGS LDFLAGS"
577 for varname in $SYSTEM_VARIABLES; do
578     qmakevarname="${varname}"
579     # use LDFLAGS for autoconf compat, but qmake uses QMAKE_LFLAGS
580     if [ "${varname}" = "LDFLAGS" ]; then
581         qmakevarname="LFLAGS"
582     fi
583     cmd=`echo \
584 'if [ -n "\$'${varname}'" ]; then
585     QMakeVar set QMAKE_'${qmakevarname}' "\$'${varname}'"
586 fi'`
587     eval "$cmd"
588 done
589 # Use CC/CXX to run config.tests
590 mkdir -p "$outpath/config.tests"
591 rm -f "$outpath/config.tests/.qmake.cache"
592 cp "$QMAKE_VARS_FILE" "$outpath/config.tests/.qmake.cache"
593
594 QMakeVar add styles "cde mac motif plastique cleanlooks windows"
595 QMakeVar add decorations "default windows styled"
596 QMakeVar add mouse-drivers "pc"
597 if [ "$UNAME_SYSTEM" = "Linux" ] ; then
598     QMakeVar add gfx-drivers "linuxfb"
599     QMakeVar add mouse-drivers "linuxtp"
600 fi
601 QMakeVar add kbd-drivers "tty"
602
603 if [ "$CFG_DEV" = "yes" ]; then
604     QMakeVar add kbd-drivers "um"
605 fi
606
607 # QTDIR may be set and point to an old or system-wide Qt installation
608 unset QTDIR
609
610 # the minimum version of libdbus-1 that we require:
611 MIN_DBUS_1_VERSION=0.93
612
613 # initalize internal variables
614 CFG_CONFIGURE_EXIT_ON_ERROR=yes
615 CFG_PROFILE=no
616 CFG_EXCEPTIONS=unspecified
617 CFG_SCRIPT=auto # (yes|no|auto)
618 CFG_SCRIPTTOOLS=auto # (yes|no|auto)
619 CFG_XMLPATTERNS=auto # (yes|no|auto)
620 CFG_INCREMENTAL=auto
621 CFG_QCONFIG=full
622 CFG_DEBUG=auto
623 CFG_MYSQL_CONFIG=
624 CFG_DEBUG_RELEASE=no
625 CFG_SHARED=yes
626 CFG_SM=auto
627 CFG_XSHAPE=auto
628 CFG_XSYNC=auto
629 CFG_XINERAMA=runtime
630 CFG_XFIXES=runtime
631 CFG_ZLIB=auto
632 CFG_SQLITE=qt
633 CFG_GIF=auto
634 CFG_TIFF=auto
635 CFG_LIBTIFF=auto
636 CFG_PNG=yes
637 CFG_LIBPNG=auto
638 CFG_JPEG=auto
639 CFG_LIBJPEG=auto
640 CFG_MNG=auto
641 CFG_LIBMNG=auto
642 CFG_XCURSOR=runtime
643 CFG_XRANDR=runtime
644 CFG_XRENDER=auto
645 CFG_MITSHM=auto
646 CFG_OPENGL=auto
647 CFG_OPENVG=no
648 CFG_OPENVG_LC_INCLUDES=no
649 CFG_OPENVG_SHIVA=no
650 CFG_OPENVG_ON_OPENGL=no
651 CFG_EGL=no
652 CFG_EGL_GLES_INCLUDES=no
653 CFG_SSE=auto
654 CFG_FONTCONFIG=auto
655 CFG_QWS_FREETYPE=auto
656 CFG_LIBFREETYPE=auto
657 CFG_SQL_AVAILABLE=
658 QT_DEFAULT_BUILD_PARTS="libs tools examples demos docs translations"
659 CFG_BUILD_PARTS=""
660 CFG_NOBUILD_PARTS=""
661 CFG_RELEASE_QMAKE=no
662 CFG_PHONON=auto
663 CFG_PHONON_BACKEND=yes
664 CFG_MULTIMEDIA=yes
665 CFG_SVG=yes
666 CFG_DECLARATIVE=auto
667 CFG_WEBKIT=auto # (yes|no|auto)
668 CFG_JAVASCRIPTCORE_JIT=auto
669
670 CFG_GFX_AVAILABLE="linuxfb transformed qvfb vnc multiscreen directfb"
671 CFG_GFX_ON="linuxfb multiscreen"
672 CFG_GFX_PLUGIN_AVAILABLE=
673 CFG_GFX_PLUGIN=
674 CFG_GFX_OFF=
675 CFG_KBD_AVAILABLE="tty linuxinput qvfb"
676 CFG_KBD_ON="tty"    #default, see QMakeVar above
677 CFG_MOUSE_AVAILABLE="pc linuxtp linuxinput tslib qvfb"
678 CFG_MOUSE_ON="pc linuxtp"   #default, see QMakeVar above
679
680 if [ -f "$relpath/src/gui/embedded/qscreenqnx_qws.cpp" ]; then
681     CFG_KBD_AVAILABLE="${CFG_KBD_AVAILABLE} qnx"
682     CFG_MOUSE_AVAILABLE="${CFG_MOUSE_AVAILABLE} qnx"
683     CFG_GFX_AVAILABLE="${CFG_GFX_AVAILABLE} qnx"
684 fi
685
686 CFG_ARCH=
687 CFG_HOST_ARCH=
688 CFG_KBD_PLUGIN_AVAILABLE=
689 CFG_KBD_PLUGIN=
690 CFG_KBD_OFF=
691 CFG_MOUSE_PLUGIN_AVAILABLE=
692 CFG_MOUSE_PLUGIN=
693 CFG_MOUSE_OFF=
694 CFG_USE_GNUMAKE=no
695 CFG_IM=yes
696 CFG_DECORATION_AVAILABLE="styled windows default"
697 CFG_DECORATION_ON="${CFG_DECORATION_AVAILABLE}" # all on by default
698 CFG_DECORATION_PLUGIN_AVAILABLE=
699 CFG_DECORATION_PLUGIN=
700 CFG_XINPUT=runtime
701 CFG_XKB=auto
702 CFG_NIS=auto
703 CFG_CUPS=auto
704 CFG_ICONV=auto
705 CFG_DBUS=auto
706 CFG_GLIB=auto
707 CFG_GSTREAMER=auto
708 CFG_QGTKSTYLE=auto
709 CFG_LARGEFILE=auto
710 CFG_OPENSSL=auto
711 CFG_PTMALLOC=no
712 CFG_STL=auto
713 CFG_PRECOMPILE=auto
714 CFG_SEPARATE_DEBUG_INFO=auto
715 CFG_REDUCE_EXPORTS=auto
716 CFG_MMX=auto
717 CFG_3DNOW=auto
718 CFG_SSE=auto
719 CFG_SSE2=auto
720 CFG_REDUCE_RELOCATIONS=no
721 CFG_IPV6=auto
722 CFG_NAS=no
723 CFG_QWS_DEPTHS=all
724 CFG_USER_BUILD_KEY=
725 CFG_ACCESSIBILITY=auto
726 CFG_QT3SUPPORT=yes
727 CFG_ENDIAN=auto
728 CFG_HOST_ENDIAN=auto
729 CFG_DOUBLEFORMAT=auto
730 CFG_ARMFPA=auto
731 CFG_IWMMXT=no
732 CFG_CLOCK_GETTIME=auto
733 CFG_CLOCK_MONOTONIC=auto
734 CFG_MREMAP=auto
735 CFG_GETADDRINFO=auto
736 CFG_IPV6IFNAME=auto
737 CFG_GETIFADDRS=auto
738 CFG_INOTIFY=auto
739 CFG_RPATH=yes
740 CFG_FRAMEWORK=auto
741 CFG_MAC_ARCHS=
742 MAC_CONFIG_TEST_COMMANDLINE=  # used to make the configure tests run with the correct arch's and SDK settings
743 CFG_MAC_DWARF2=auto
744 CFG_MAC_XARCH=auto
745 CFG_MAC_CARBON=yes
746 CFG_MAC_COCOA=auto
747 COMMANDLINE_MAC_COCOA=no
748 CFG_SXE=no
749 CFG_PREFIX_INSTALL=yes
750 CFG_SDK=
751 D_FLAGS=
752 I_FLAGS=
753 L_FLAGS=
754 RPATH_FLAGS=
755 l_FLAGS=
756 QCONFIG_FLAGS=
757 XPLATFORM=              # This seems to be the QMAKESPEC, like "linux-g++"
758 PLATFORM=$QMAKESPEC
759 QT_CROSS_COMPILE=no
760 OPT_CONFIRM_LICENSE=no
761 OPT_SHADOW=maybe
762 OPT_FAST=auto
763 OPT_VERBOSE=no
764 OPT_HELP=
765 CFG_SILENT=no
766 CFG_GRAPHICS_SYSTEM=default
767 CFG_ALSA=auto
768
769 # initalize variables used for installation
770 QT_INSTALL_PREFIX=
771 QT_INSTALL_DOCS=
772 QT_INSTALL_HEADERS=
773 QT_INSTALL_LIBS=
774 QT_INSTALL_BINS=
775 QT_INSTALL_PLUGINS=
776 QT_INSTALL_DATA=
777 QT_INSTALL_TRANSLATIONS=
778 QT_INSTALL_SETTINGS=
779 QT_INSTALL_EXAMPLES=
780 QT_INSTALL_DEMOS=
781 QT_HOST_PREFIX=
782
783 #flags for SQL drivers
784 QT_CFLAGS_PSQL=
785 QT_LFLAGS_PSQL=
786 QT_CFLAGS_MYSQL=
787 QT_LFLAGS_MYSQL=
788 QT_LFLAGS_MYSQL_R=
789 QT_CFLAGS_SQLITE=
790 QT_LFLAGS_SQLITE=
791 QT_LFLAGS_ODBC="-lodbc"
792
793 # flags for libdbus-1
794 QT_CFLAGS_DBUS=
795 QT_LIBS_DBUS=
796
797 # flags for Glib (X11 only)
798 QT_CFLAGS_GLIB=
799 QT_LIBS_GLIB=
800
801 # flags for GStreamer (X11 only)
802 QT_CFLAGS_GSTREAMER=
803 QT_LIBS_GSTREAMER=
804
805 #-------------------------------------------------------------------------------
806 # check SQL drivers, mouse drivers and decorations available in this package
807 #-------------------------------------------------------------------------------
808
809 # opensource version removes some drivers, so force them to be off
810 CFG_SQL_tds=no
811 CFG_SQL_oci=no
812 CFG_SQL_db2=no
813
814 CFG_SQL_AVAILABLE=
815 if [ -d "$relpath/src/plugins/sqldrivers" ]; then
816   for a in "$relpath/src/plugins/sqldrivers/"*; do
817      if [ -d "$a" ]; then
818          base_a=`basename "$a"`
819          CFG_SQL_AVAILABLE="${CFG_SQL_AVAILABLE} ${base_a}"
820          eval "CFG_SQL_${base_a}=auto"
821      fi
822   done
823 fi
824
825 CFG_DECORATION_PLUGIN_AVAILABLE=
826 if [ -d "$relpath/src/plugins/decorations" ]; then
827   for a in "$relpath/src/plugins/decorations/"*; do
828      if [ -d "$a" ]; then
829          base_a=`basename "$a"`
830          CFG_DECORATION_PLUGIN_AVAILABLE="${CFG_DECORATION_PLUGIN_AVAILABLE} ${base_a}"
831      fi
832   done
833 fi
834
835 CFG_KBD_PLUGIN_AVAILABLE=
836 if [ -d "$relpath/src/plugins/kbddrivers" ]; then
837   for a in "$relpath/src/plugins/kbddrivers/"*; do
838      if [ -d "$a" ]; then
839          base_a=`basename "$a"`
840          CFG_KBD_PLUGIN_AVAILABLE="${CFG_KBD_PLUGIN_AVAILABLE} ${base_a}"
841      fi
842   done
843 fi
844
845 CFG_MOUSE_PLUGIN_AVAILABLE=
846 if [ -d "$relpath/src/plugins/mousedrivers" ]; then
847   for a in "$relpath/src/plugins/mousedrivers/"*; do
848      if [ -d "$a" ]; then
849          base_a=`basename "$a"`
850          CFG_MOUSE_PLUGIN_AVAILABLE="${CFG_MOUSE_PLUGIN_AVAILABLE} ${base_a}"
851      fi
852   done
853 fi
854
855 CFG_GFX_PLUGIN_AVAILABLE=
856 if [ -d "$relpath/src/plugins/gfxdrivers" ]; then
857   for a in "$relpath/src/plugins/gfxdrivers/"*; do
858      if [ -d "$a" ]; then
859          base_a=`basename "$a"`
860          CFG_GFX_PLUGIN_AVAILABLE="${CFG_GFX_PLUGIN_AVAILABLE} ${base_a}"
861      fi
862   done
863   CFG_GFX_OFF="$CFG_GFX_AVAILABLE" # assume all off
864 fi
865
866 #-------------------------------------------------------------------------------
867 # parse command line arguments
868 #-------------------------------------------------------------------------------
869
870 # parse the arguments, setting things to "yes" or "no"
871 while [ "$#" -gt 0 ]; do
872     CURRENT_OPT="$1"
873     UNKNOWN_ARG=no
874     case "$1" in
875     #Autoconf style options
876     --enable-*)
877         VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"`
878         VAL=yes
879         ;;
880     --disable-*)
881         VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"`
882         VAL=no
883         ;;
884     --*=*)
885         VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"`
886         VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"`
887         ;;
888     --no-*)
889         VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
890         VAL=no
891         ;;
892     --*)
893         VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
894         VAL=yes
895         ;;
896     #Qt plugin options
897     -no-*-*|-plugin-*-*|-qt-*-*)
898         VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
899         VAL=`echo $1 | sed "s,^-\([^-]*\).*,\1,"`
900         ;;
901     #Qt style no options
902     -no-*)
903         VAR=`echo $1 | sed "s,^-no-\(.*\),\1,"`
904         VAL=no
905         ;;
906     #Qt style yes options
907         -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-svg|-declarative|-webkit|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config)
908         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
909         VAL=yes
910         ;;
911     #Qt style options that pass an argument
912     -qconfig)
913         if [ "$PLATFORM_QWS" != "yes" ]; then
914             echo
915             echo "WARNING: -qconfig is only tested and supported on Qt for Embedded Linux."
916             echo
917         fi
918         CFG_QCONFIG="$VAL"
919         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
920         shift
921         VAL=$1
922         ;;
923     -prefix|-docdir|-headerdir|-plugindir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-demosdir|-depths|-make|-nomake|-platform|-xplatform|-buildkey|-sdk|-arch|-host-arch|-mysql_config)
924         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
925         shift
926         VAL="$1"
927         ;;
928     #Qt style complex options in one command
929     -enable-*|-disable-*)
930         VAR=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
931         VAL=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
932         ;;
933     #Qt Builtin/System style options
934     -no-*|-system-*|-qt-*)
935         VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
936         VAL=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
937         ;;
938     #Options that cannot be generalized
939     -k|-continue)
940         VAR=fatal_error
941         VAL=no
942         ;;
943     -embedded)
944         VAR=embedded
945         # this option may or may not be followed by an argument
946         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
947             VAL=auto
948         else
949             shift;
950             VAL=$1
951         fi
952         ;;
953     -opengl)
954         VAR=opengl
955         # this option may or may not be followed by an argument
956         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
957             VAL=yes
958         else
959             shift;
960             VAL=$1
961         fi
962         ;;
963     -openvg)
964         VAR=openvg
965         # this option may or may not be followed by an argument
966         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
967             VAL=yes
968         else
969             shift;
970             VAL=$1
971         fi
972         ;;
973     -hostprefix)
974         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
975         # this option may or may not be followed by an argument
976         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
977             VAL=$outpath
978         else
979             shift;
980             VAL=$1
981         fi
982         ;;
983     -host-*-endian)
984         VAR=host_endian
985         VAL=`echo $1 | sed "s,^-.*-\(.*\)-.*,\1,"`
986         ;;
987     -*-endian)
988         VAR=endian
989         VAL=`echo $1 | sed "s,^-\(.*\)-.*,\1,"`
990         ;;
991     -qtnamespace)
992         VAR="qtnamespace"
993         shift
994         VAL="$1"
995         ;;
996     -graphicssystem)
997         VAR="graphicssystem"
998         shift
999         VAL=$1
1000         ;;
1001     -qtlibinfix)
1002         VAR="qtlibinfix"
1003         shift
1004         VAL="$1"
1005         ;;
1006     -D?*|-D)
1007         VAR="add_define"
1008         if [ "$1" = "-D" ]; then
1009             shift
1010             VAL="$1"
1011         else
1012             VAL=`echo $1 | sed 's,-D,,'`
1013         fi
1014         ;;
1015     -I?*|-I)
1016         VAR="add_ipath"
1017         if [ "$1" = "-I" ]; then
1018             shift
1019             VAL="$1"
1020         else
1021             VAL=`echo $1 | sed 's,-I,,'`
1022         fi
1023         ;;
1024     -L?*|-L)
1025         VAR="add_lpath"
1026         if [ "$1" = "-L" ]; then
1027             shift
1028             VAL="$1"
1029         else
1030             VAL=`echo $1 | sed 's,-L,,'`
1031         fi
1032         ;;
1033     -R?*|-R)
1034         VAR="add_rpath"
1035         if [ "$1" = "-R" ]; then
1036             shift
1037             VAL="$1"
1038         else
1039             VAL=`echo $1 | sed 's,-R,,'`
1040         fi
1041         ;;
1042     -l?*)
1043         VAR="add_link"
1044         VAL=`echo $1 | sed 's,-l,,'`
1045         ;;
1046     -F?*|-F)
1047         VAR="add_fpath"
1048         if [ "$1" = "-F" ]; then
1049             shift
1050             VAL="$1"
1051         else
1052             VAL=`echo $1 | sed 's,-F,,'`
1053         fi
1054         ;;
1055     -fw?*|-fw)
1056         VAR="add_framework"
1057         if [ "$1" = "-fw" ]; then
1058             shift
1059             VAL="$1"
1060         else
1061             VAL=`echo $1 | sed 's,-fw,,'`
1062         fi
1063         ;;
1064     -*)
1065         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
1066         VAL="unknown"
1067         ;;
1068     *)
1069         UNKNOWN_ARG=yes
1070         ;;
1071     esac
1072     if [ "$UNKNOWN_ARG" = "yes" ]; then
1073         echo "$1: unknown argument"
1074         OPT_HELP=yes
1075         ERROR=yes
1076         shift
1077         continue
1078      fi
1079     shift
1080
1081     UNKNOWN_OPT=no
1082     case "$VAR" in
1083     qt3support)
1084         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1085             CFG_QT3SUPPORT="$VAL"
1086         else
1087             UNKNOWN_OPT=yes
1088         fi
1089         ;;
1090     accessibility)
1091         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1092             CFG_ACCESSIBILITY="$VAL"
1093         else
1094             UNKNOWN_OPT=yes
1095         fi
1096         ;;
1097     license)
1098         LICENSE_FILE="$VAL"
1099         ;;
1100     gnumake)
1101         CFG_USE_GNUMAKE="$VAL"
1102         ;;
1103     mysql_config)
1104         CFG_MYSQL_CONFIG="$VAL"
1105         ;;
1106     prefix)
1107         QT_INSTALL_PREFIX="$VAL"
1108         ;;
1109     hostprefix)
1110         QT_HOST_PREFIX="$VAL"
1111         ;;
1112     force-pkg-config)
1113         QT_FORCE_PKGCONFIG=yes
1114         ;;
1115     docdir)
1116         QT_INSTALL_DOCS="$VAL"
1117         ;;
1118     headerdir)
1119         QT_INSTALL_HEADERS="$VAL"
1120         ;;
1121     plugindir)
1122         QT_INSTALL_PLUGINS="$VAL"
1123         ;;
1124     datadir)
1125         QT_INSTALL_DATA="$VAL"
1126         ;;
1127     libdir)
1128         QT_INSTALL_LIBS="$VAL"
1129         ;;
1130     qtnamespace)
1131         QT_NAMESPACE="$VAL"
1132         ;;
1133     qtlibinfix)
1134         QT_LIBINFIX="$VAL"
1135         ;;
1136     translationdir)
1137         QT_INSTALL_TRANSLATIONS="$VAL"
1138         ;;
1139     sysconfdir|settingsdir)
1140         QT_INSTALL_SETTINGS="$VAL"
1141         ;;
1142     examplesdir)
1143         QT_INSTALL_EXAMPLES="$VAL"
1144         ;;
1145     demosdir)
1146         QT_INSTALL_DEMOS="$VAL"
1147         ;;
1148     qconfig)
1149         CFG_QCONFIG="$VAL"
1150         ;;
1151     bindir)
1152         QT_INSTALL_BINS="$VAL"
1153         ;;
1154     buildkey)
1155         CFG_USER_BUILD_KEY="$VAL"
1156         ;;
1157     sxe)
1158         CFG_SXE="$VAL"
1159         ;;
1160     embedded)
1161         CFG_EMBEDDED="$VAL"
1162         if [ "$PLATFORM_QWS" != "no" ]; then
1163             if [ "$PLATFORM_QWS" = "maybe" ]; then
1164                 PLATFORM_X11=no
1165                 PLATFORM_MAC=no
1166                 PLATFORM_QWS=yes
1167             fi
1168         else
1169             echo "No license exists to enable Qt for Embedded Linux. Disabling."
1170             CFG_EMBEDDED=no
1171         fi
1172         ;;
1173     sse)
1174         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1175             CFG_SSE="$VAL"
1176         else
1177             UNKNOWN_OPT=yes
1178         fi
1179         ;;
1180     endian)
1181         if [ "$VAL" = "little" ]; then
1182             CFG_ENDIAN="Q_LITTLE_ENDIAN"
1183         elif [ "$VAL" = "big" ]; then
1184             CFG_ENDIAN="Q_BIG_ENDIAN"
1185         else
1186             UNKNOWN_OPT=yes
1187         fi
1188         ;;
1189     host_endian)
1190         if [ "$VAL" = "little" ]; then
1191             CFG_HOST_ENDIAN="Q_LITTLE_ENDIAN"
1192         elif [ "$VAL" = "big" ]; then
1193             CFG_HOST_ENDIAN="Q_BIG_ENDIAN"
1194         else
1195             UNKNOWN_OPT=yes
1196         fi
1197         ;;
1198     armfpa)
1199         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1200             CFG_ARMFPA="$VAL"
1201         else
1202             UNKNOWN_OPT=yes
1203         fi
1204         ;;
1205     depths)
1206         CFG_QWS_DEPTHS="$VAL"
1207         ;;
1208     opengl)
1209         if  [ "$VAL" = "auto" ] || [ "$VAL" = "desktop" ] ||
1210             [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] ||
1211             [ "$VAL" = "es1cl" ] || [ "$VAL" = "es1" ] || [ "$VAL" = "es2" ]; then
1212             CFG_OPENGL="$VAL"
1213         else
1214             UNKNOWN_OPT=yes
1215         fi
1216         ;;
1217     openvg)
1218         if [ "$VAL" = "auto" ] || [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1219             CFG_OPENVG="$VAL"
1220         else
1221             UNKNOWN_OPT=yes
1222         fi
1223         ;;
1224     graphicssystem)
1225         if [ "$PLATFORM_QWS" = "yes" ]; then
1226             echo "Error: Graphics System plugins are not supported on QWS."
1227             echo "   On QWS, the graphics system API is part of the QScreen plugin architecture "
1228             echo "   rather than existing as a separate plugin."
1229             echo ""
1230             UNKNOWN_OPT=yes
1231         else
1232             if  [ "$VAL" = "opengl" ]; then
1233                 CFG_GRAPHICS_SYSTEM="opengl"
1234             elif [ "$VAL" = "openvg" ]; then
1235                 CFG_GRAPHICS_SYSTEM="openvg"
1236             elif [ "$VAL" = "raster" ]; then
1237                 CFG_GRAPHICS_SYSTEM="raster"
1238             else
1239                 UNKNOWN_OPT=yes
1240             fi
1241         fi
1242         ;;
1243
1244     qvfb) # left for commandline compatibility, not documented
1245         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1246             if [ "$VAL" = "yes" ]; then
1247                 QMakeVar add gfx-drivers qvfb
1248                 QMakeVar add kbd-drivers qvfb
1249                 QMakeVar add mouse-drivers qvfb
1250                 CFG_GFX_ON="$CFG_GFX_ON qvfb"
1251                 CFG_KBD_ON="$CFG_KBD_ON qvfb"
1252                 CFG_MOUSE_ON="$CFG_MOUSE_ON qvfb"
1253             fi
1254         else
1255             UNKNOWN_OPT=yes
1256         fi
1257         ;;
1258     nomake)
1259         CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS $VAL"
1260         ;;
1261     make)
1262         CFG_BUILD_PARTS="$CFG_BUILD_PARTS $VAL"
1263         ;;
1264     x11)
1265         if [ "$PLATFORM_MAC" = "yes" ]; then
1266             PLATFORM_MAC=no
1267         elif [ "$PLATFORM_QWS" = "yes" ]; then
1268             PLATFORM_QWS=no
1269         fi
1270         if [ "$CFG_FRAMEWORK" = "auto" ]; then
1271             CFG_FRAMEWORK=no
1272         fi
1273         PLATFORM_X11=yes
1274         ;;
1275     sdk)
1276         if [ "$PLATFORM_MAC" = "yes" ]; then
1277             CFG_SDK="$VAL"
1278         else
1279             UNKNOWN_OPT=yes
1280         fi
1281         ;;
1282      dwarf2)
1283         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1284             CFG_MAC_DWARF2="$VAL"
1285         else
1286             UNKNOWN_OPT=yes
1287         fi
1288         ;;
1289     arch)
1290         if [ "$PLATFORM_MAC" = "yes" ]; then
1291             CFG_MAC_ARCHS="$CFG_MAC_ARCHS $VAL"
1292         else
1293             CFG_ARCH=$VAL
1294         fi
1295         ;;
1296     host-arch)
1297         CFG_HOST_ARCH=$VAL
1298         ;;
1299     universal)
1300         if [ "$PLATFORM_MAC" = "yes" ] && [ "$VAL" = "yes" ]; then
1301             CFG_MAC_ARCHS="$CFG_MAC_ARCHS x86 ppc"
1302         else
1303             UNKNOWN_OPT=yes
1304         fi
1305         ;;
1306     cocoa)
1307         if [ "$PLATFORM_MAC" = "yes" ] && [ "$VAL" = "yes" ]; then
1308             CFG_MAC_COCOA="$VAL"
1309             COMMANDLINE_MAC_COCOA="$VAL"
1310         else
1311             UNKNOWN_OPT=yes
1312         fi
1313         ;;
1314     framework)
1315         if [ "$PLATFORM_MAC" = "yes" ]; then
1316             CFG_FRAMEWORK="$VAL"
1317         else
1318             UNKNOWN_OPT=yes
1319         fi
1320         ;;
1321     profile)
1322         if [ "$VAL" = "yes" ]; then
1323             CFG_PROFILE=yes
1324             QMakeVar add QMAKE_CFLAGS -pg
1325             QMakeVar add QMAKE_CXXFLAGS -pg
1326             QMakeVar add QMAKE_LFLAGS -pg
1327             QMAKE_VARS="$QMAKE_VARS CONFIG+=nostrip"
1328         else
1329             UNKNOWN_OPT=yes
1330         fi
1331         ;;
1332     exceptions|g++-exceptions)
1333         if [ "$VAL" = "no" ]; then
1334             CFG_EXCEPTIONS=no
1335         elif [ "$VAL" = "yes" ]; then
1336             CFG_EXCEPTIONS=yes
1337         else
1338             UNKNOWN_OPT=yes
1339         fi
1340         ;;
1341     platform)
1342         PLATFORM="$VAL"
1343         # keep compatibility with old platform names
1344         case $PLATFORM in
1345         aix-64)
1346             PLATFORM=aix-xlc-64
1347             ;;
1348         hpux-o64)
1349             PLATFORM=hpux-acc-o64
1350             ;;
1351         hpux-n64)
1352             PLATFORM=hpux-acc-64
1353             ;;
1354         hpux-acc-n64)
1355             PLATFORM=hpux-acc-64
1356             ;;
1357         irix-n32)
1358             PLATFORM=irix-cc
1359             ;;
1360         irix-64)
1361             PLATFORM=irix-cc-64
1362             ;;
1363         irix-cc-n64)
1364             PLATFORM=irix-cc-64
1365             ;;
1366         reliant-64)
1367             PLATFORM=reliant-cds-64
1368             ;;
1369         solaris-64)
1370             PLATFORM=solaris-cc-64
1371             ;;
1372         solaris-64)
1373             PLATFORM=solaris-cc-64
1374             ;;
1375         openunix-cc)
1376             PLATFORM=unixware-cc
1377             ;;
1378         openunix-g++)
1379             PLATFORM=unixware-g++
1380             ;;
1381         unixware7-cc)
1382             PLATFORM=unixware-cc
1383             ;;
1384         unixware7-g++)
1385             PLATFORM=unixware-g++
1386             ;;
1387         macx-g++-64)
1388             PLATFORM=macx-g++
1389             NATIVE_64_ARCH=
1390             case `uname -p` in
1391             i386) NATIVE_64_ARCH="x86_64" ;;
1392             powerpc) NATIVE_64_ARCH="ppc64" ;;
1393             *)   echo "WARNING: Can't detect CPU architecture for macx-g++-64" ;;
1394             esac
1395             if [ ! -z "$NATIVE_64_ARCH" ]; then
1396                 QTCONFIG_CONFIG="$QTCONFIG_CONFIG $NATIVE_64_ARCH"
1397                 CFG_MAC_ARCHS="$CFG_MAC_ARCHS $NATIVE_64_ARCH"
1398             fi
1399             ;;
1400         esac
1401         ;;
1402     xplatform)
1403         XPLATFORM="$VAL"
1404         ;;
1405     debug-and-release)
1406         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1407             CFG_DEBUG_RELEASE="$VAL"
1408         else
1409             UNKNOWN_OPT=yes
1410         fi
1411         ;;
1412     optimized-qmake)
1413         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1414             CFG_RELEASE_QMAKE="$VAL"
1415         else
1416             UNKNOWN_OPT=yes
1417         fi
1418         ;;
1419     release)
1420         if [ "$VAL" = "yes" ]; then
1421             CFG_DEBUG=no
1422         elif [ "$VAL" = "no" ]; then
1423             CFG_DEBUG=yes
1424         else
1425             UNKNOWN_OPT=yes
1426         fi
1427         ;;
1428     prefix-install)
1429         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1430             CFG_PREFIX_INSTALL="$VAL"
1431         else
1432             UNKNOWN_OPT=yes
1433         fi
1434         ;;
1435     debug)
1436         CFG_DEBUG="$VAL"
1437         ;;
1438     developer-build|commercial|opensource|nokia-developer)
1439         # These switches have been dealt with already
1440         ;;
1441     static)
1442         if [ "$VAL" = "yes" ]; then
1443             CFG_SHARED=no
1444         elif [ "$VAL" = "no" ]; then
1445             CFG_SHARED=yes
1446         else
1447             UNKNOWN_OPT=yes
1448         fi
1449         ;;
1450     incremental)
1451         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1452             CFG_INCREMENTAL="$VAL"
1453         else
1454             UNKNOWN_OPT=yes
1455         fi
1456         ;;
1457     fatal_error)
1458         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1459             CFG_CONFIGURE_EXIT_ON_ERROR="$VAL"
1460         else
1461             UNKNOWN_OPT=yes
1462         fi
1463         ;;
1464     feature-*)
1465         if [ "$PLATFORM_QWS" = "yes" ]; then
1466             FEATURE=`echo $VAR | sed "s,^[^-]*-\([^-]*\),\1," | tr 'abcdefghijklmnopqrstuvwxyz-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
1467             if [ "$VAL" = "no" ]; then
1468                 QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_$FEATURE"
1469             elif [ "$VAL" = "yes" ] || [ "$VAL" = "unknown" ]; then
1470                 QCONFIG_FLAGS="$QCONFIG_FLAGS QT_$FEATURE"
1471             else
1472                 UNKNOWN_OPT=yes
1473             fi
1474         else
1475             UNKNOWN_OPT=yes
1476         fi
1477         ;;
1478     shared)
1479         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1480             CFG_SHARED="$VAL"
1481         else
1482             UNKNOWN_OPT=yes
1483         fi
1484         ;;
1485     gif)
1486         [ "$VAL" = "qt" ] && VAL=yes
1487         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1488             CFG_GIF="$VAL"
1489         else
1490             UNKNOWN_OPT=yes
1491         fi
1492         ;;
1493     sm)
1494         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1495             CFG_SM="$VAL"
1496         else
1497             UNKNOWN_OPT=yes
1498         fi
1499
1500         ;;
1501     xinerama)
1502         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1503             CFG_XINERAMA="$VAL"
1504         else
1505             UNKNOWN_OPT=yes
1506         fi
1507         ;;
1508     xshape)
1509         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1510             CFG_XSHAPE="$VAL"
1511         else
1512             UNKNOWN_OPT=yes
1513         fi
1514         ;;
1515     xsync)
1516         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1517             CFG_XSYNC="$VAL"
1518         else
1519             UNKNOWN_OPT=yes
1520         fi
1521         ;;
1522     xinput)
1523         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1524             CFG_XINPUT="$VAL"
1525         else
1526             UNKNOWN_OPT=yes
1527         fi
1528         ;;
1529     stl)
1530         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1531             CFG_STL="$VAL"
1532         else
1533             UNKNOWN_OPT=yes
1534         fi
1535         ;;
1536     pch)
1537         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1538             CFG_PRECOMPILE="$VAL"
1539         else
1540             UNKNOWN_OPT=yes
1541         fi
1542         ;;
1543     separate-debug-info)
1544         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1545             CFG_SEPARATE_DEBUG_INFO="$VAL"
1546         else
1547             UNKNOWN_OPT=yes
1548         fi
1549         ;;
1550     reduce-exports)
1551         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1552             CFG_REDUCE_EXPORTS="$VAL"
1553         else
1554             UNKNOWN_OPT=yes
1555         fi
1556         ;;
1557     mmx)
1558         if [ "$VAL" = "no" ]; then
1559             CFG_MMX="$VAL"
1560         else
1561             UNKNOWN_OPT=yes
1562         fi
1563         ;;
1564     3dnow)
1565         if [ "$VAL" = "no" ]; then
1566             CFG_3DNOW="$VAL"
1567         else
1568             UNKNOWN_OPT=yes
1569         fi
1570         ;;
1571     sse)
1572         if [ "$VAL" = "no" ]; then
1573             CFG_SSE="$VAL"
1574         else
1575             UNKNOWN_OPT=yes
1576         fi
1577         ;;
1578     sse2)
1579         if [ "$VAL" = "no" ]; then
1580             CFG_SSE2="$VAL"
1581         else
1582             UNKNOWN_OPT=yes
1583         fi
1584         ;;
1585     iwmmxt)
1586         CFG_IWMMXT="yes"
1587         ;;
1588     reduce-relocations)
1589         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1590             CFG_REDUCE_RELOCATIONS="$VAL"
1591         else
1592             UNKNOWN_OPT=yes
1593         fi
1594         ;;
1595     freetype)
1596         [ "$VAL" = "qt" ] && VAL=yes
1597         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1598             CFG_QWS_FREETYPE="$VAL"
1599         else
1600             UNKNOWN_OPT=yes
1601         fi
1602         ;;
1603     zlib)
1604         [ "$VAL" = "qt" ] && VAL=yes
1605         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1606             CFG_ZLIB="$VAL"
1607         else
1608             UNKNOWN_OPT=yes
1609         fi
1610         # No longer supported:
1611         #[ "$VAL" = "no" ] && CFG_LIBPNG=no
1612         ;;
1613     sqlite)
1614         if [ "$VAL" = "system" ]; then
1615             CFG_SQLITE=system
1616         else
1617             UNKNOWN_OPT=yes
1618         fi
1619         ;;
1620     libpng)
1621         [ "$VAL" = "yes" ] && VAL=qt
1622         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1623             CFG_LIBPNG="$VAL"
1624         else
1625             UNKNOWN_OPT=yes
1626         fi
1627         ;;
1628     libjpeg)
1629         [ "$VAL" = "yes" ] && VAL=qt
1630         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1631             CFG_LIBJPEG="$VAL"
1632         else
1633             UNKNOWN_OPT=yes
1634         fi
1635         ;;
1636     libmng)
1637         [ "$VAL" = "yes" ] && VAL=qt
1638         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1639             CFG_LIBMNG="$VAL"
1640         else
1641             UNKNOWN_OPT=yes
1642         fi
1643         ;;
1644     libtiff)
1645         [ "$VAL" = "yes" ] && VAL=qt
1646         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1647             CFG_LIBTIFF="$VAL"
1648         else
1649             UNKNOWN_OPT=yes
1650         fi
1651         ;;
1652     nas-sound)
1653         if [ "$VAL" = "system" ] || [ "$VAL" = "no" ]; then
1654             CFG_NAS="$VAL"
1655         else
1656             UNKNOWN_OPT=yes
1657         fi
1658         ;;
1659     xcursor)
1660         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1661             CFG_XCURSOR="$VAL"
1662         else
1663             UNKNOWN_OPT=yes
1664         fi
1665         ;;
1666     xfixes)
1667         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1668             CFG_XFIXES="$VAL"
1669         else
1670             UNKNOWN_OPT=yes
1671         fi
1672         ;;
1673     xrandr)
1674         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1675             CFG_XRANDR="$VAL"
1676         else
1677             UNKNOWN_OPT=yes
1678         fi
1679         ;;
1680     xrender)
1681         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1682             CFG_XRENDER="$VAL"
1683         else
1684             UNKNOWN_OPT=yes
1685         fi
1686         ;;
1687     mitshm)
1688         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1689             CFG_MITSHM="$VAL"
1690         else
1691             UNKNOWN_OPT=yes
1692         fi
1693         ;;
1694     fontconfig)
1695         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1696             CFG_FONTCONFIG="$VAL"
1697         else
1698             UNKNOWN_OPT=yes
1699         fi
1700         ;;
1701     xkb)
1702         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1703             CFG_XKB="$VAL"
1704         else
1705             UNKNOWN_OPT=yes
1706         fi
1707         ;;
1708     cups)
1709         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1710             CFG_CUPS="$VAL"
1711         else
1712             UNKNOWN_OPT=yes
1713         fi
1714         ;;
1715     iconv)
1716         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1717             CFG_ICONV="$VAL"
1718         else
1719             UNKNOWN_OPT=yes
1720         fi
1721         ;;
1722     glib)
1723         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1724             CFG_GLIB="$VAL"
1725         else
1726             UNKNOWN_OPT=yes
1727         fi
1728         ;;
1729     gstreamer)
1730         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1731             CFG_GSTREAMER="$VAL"
1732         else
1733             UNKNOWN_OPT=yes
1734         fi
1735         ;;
1736     gtkstyle)
1737         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1738             CFG_QGTKSTYLE="$VAL"
1739         else
1740             UNKNOWN_OPT=yes
1741         fi
1742         ;;
1743     qdbus|dbus)
1744         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "linked" ]; then
1745             CFG_DBUS="$VAL"
1746         elif [ "$VAL" = "runtime" ]; then
1747             CFG_DBUS="yes"
1748         else
1749             UNKNOWN_OPT=yes
1750         fi
1751         ;;
1752     dbus-linked)
1753         if [ "$VAL" = "yes" ]; then
1754             CFG_DBUS="linked"
1755         else
1756             UNKNOWN_OPT=yes
1757         fi
1758         ;;
1759     nis)
1760         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1761             CFG_NIS="$VAL"
1762         else
1763             UNKNOWN_OPT=yes
1764         fi
1765         ;;
1766     largefile)
1767         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1768             CFG_LARGEFILE="$VAL"
1769         else
1770             UNKNOWN_OPT=yes
1771         fi
1772         ;;
1773     openssl)
1774         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1775             CFG_OPENSSL="$VAL"
1776         else
1777             UNKNOWN_OPT=yes
1778         fi
1779         ;;
1780     openssl-linked)
1781         if [ "$VAL" = "yes" ]; then
1782             CFG_OPENSSL="linked"
1783         else
1784             UNKNOWN_OPT=yes
1785         fi
1786         ;;
1787     ptmalloc)
1788         if [ "$VAL" = "yes" ]; then
1789             CFG_PTMALLOC="yes"
1790         else
1791             UNKNOWN_OPT=yes
1792         fi
1793         ;;
1794
1795     xmlpatterns)
1796         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1797             CFG_XMLPATTERNS="yes"
1798         else
1799             if [ "$VAL" = "no" ]; then
1800                 CFG_XMLPATTERNS="no"
1801             else
1802                 UNKNOWN_OPT=yes
1803             fi
1804         fi
1805         ;;
1806     script)
1807         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1808             CFG_SCRIPT="yes"
1809         else
1810             if [ "$VAL" = "no" ]; then
1811                 CFG_SCRIPT="no"
1812             else
1813                 UNKNOWN_OPT=yes
1814             fi
1815         fi
1816         ;;
1817     scripttools)
1818         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1819             CFG_SCRIPTTOOLS="yes"
1820         else
1821             if [ "$VAL" = "no" ]; then
1822                 CFG_SCRIPTTOOLS="no"
1823             else
1824                 UNKNOWN_OPT=yes
1825             fi
1826         fi
1827         ;;
1828     svg)
1829         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1830             CFG_SVG="yes"
1831         else
1832             if [ "$VAL" = "no" ]; then
1833                 CFG_SVG="no"
1834             else
1835                 UNKNOWN_OPT=yes
1836             fi
1837         fi
1838         ;;
1839     declarative)
1840         if [ "$VAL" = "yes" ]; then
1841             CFG_DECLARATIVE="yes"
1842         else
1843             if [ "$VAL" = "no" ]; then
1844                 CFG_DECLARATIVE="no"
1845             else
1846                 UNKNOWN_OPT=yes
1847             fi
1848         fi
1849         ;;
1850     webkit)
1851         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1852             CFG_WEBKIT="yes"
1853         else
1854             if [ "$VAL" = "no" ]; then
1855                 CFG_WEBKIT="no"
1856             else
1857                 UNKNOWN_OPT=yes
1858             fi
1859         fi
1860         ;;
1861     javascript-jit)
1862         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then 
1863             CFG_JAVASCRIPTCORE_JIT="$VAL"
1864         else
1865             UNKNOWN_OPT=yes
1866         fi
1867         ;;
1868     confirm-license)
1869         if [ "$VAL" = "yes" ]; then
1870             OPT_CONFIRM_LICENSE="$VAL"
1871         else
1872             UNKNOWN_OPT=yes
1873         fi
1874         ;;
1875     h|help)
1876         if [ "$VAL" = "yes" ]; then
1877             OPT_HELP="$VAL"
1878         else
1879             UNKNOWN_OPT=yes
1880         fi
1881         ;;
1882     sql-*|gfx-*|decoration-*|kbd-*|mouse-*)
1883         # if Qt style options were used, $VAL can be "no", "qt", or "plugin"
1884         # if autoconf style options were used, $VAL can be "yes" or "no"
1885         [ "$VAL" = "yes" ] && VAL=qt
1886         # now $VAL should be "no", "qt", or "plugin"... double-check
1887         if [ "$VAL" != "no" ] && [ "$VAL" != "qt" ] && [ "$VAL" != "plugin" ]; then
1888             UNKNOWN_OPT=yes
1889         fi
1890         # now $VAL is "no", "qt", or "plugin"
1891         OPT="$VAL"
1892         VAL=`echo $VAR | sed "s,^[^-]*-\([^-]*\).*,\1,"`
1893         VAR=`echo $VAR | sed "s,^\([^-]*\).*,\1,"`
1894
1895         # Grab the available values
1896         case "$VAR" in
1897         sql)
1898             avail="$CFG_SQL_AVAILABLE"
1899             ;;
1900         gfx)
1901             avail="$CFG_GFX_AVAILABLE"
1902             if [ "$OPT" = "plugin" ]; then
1903                 avail="$CFG_GFX_PLUGIN_AVAILABLE"
1904             fi
1905             ;;
1906         decoration)
1907             avail="$CFG_DECORATION_AVAILABLE"
1908             if [ "$OPT" = "plugin" ]; then
1909                 avail="$CFG_DECORATION_PLUGIN_AVAILABLE"
1910             fi
1911             ;;
1912         kbd)
1913             avail="$CFG_KBD_AVAILABLE"
1914             if [ "$OPT" = "plugin" ]; then
1915                 avail="$CFG_KBD_PLUGIN_AVAILABLE"
1916             fi
1917             ;;
1918         mouse)
1919             avail="$CFG_MOUSE_AVAILABLE"
1920             if [ "$OPT" = "plugin" ]; then
1921                 avail="$CFG_MOUSE_PLUGIN_AVAILABLE"
1922             fi
1923             ;;
1924         *)
1925             avail=""
1926             echo "BUG: Unhandled type $VAR used in $CURRENT_OPT"
1927             ;;
1928         esac
1929
1930         # Check that that user's value is available.
1931         found=no
1932         for d in $avail; do
1933             if [ "$VAL" = "$d" ]; then
1934                 found=yes
1935                 break
1936             fi
1937         done
1938         [ "$found" = yes ] || ERROR=yes
1939
1940         if [ "$VAR" = "sql" ]; then
1941             # set the CFG_SQL_driver
1942             eval "CFG_SQL_$VAL=\$OPT"
1943             continue
1944         fi
1945
1946         if [ "$OPT" = "plugin" ] || [ "$OPT" = "qt" ]; then
1947             if [ "$OPT" = "plugin" ]; then
1948                 [ "$VAR" = "decoration" ] && QMakeVar del "${VAR}s" "$VAL"
1949                 [ "$VAR" = "decoration" ] && CFG_DECORATION_ON=`echo "${CFG_DECORATION_ON} " | sed "s,${VAL} ,,g"` && CFG_DECORATION_PLUGIN="$CFG_DECORATION_PLUGIN ${VAL}"
1950                 [ "$VAR" = "kbd" ] && QMakeVar del "${VAR}s" "$VAL"
1951                 [ "$VAR" = "kbd" ] && CFG_KBD_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"` && CFG_KBD_PLUGIN="$CFG_KBD_PLUGIN ${VAL}"
1952                 [ "$VAR" = "mouse" ] && QMakeVar del "${VAR}s" "$VAL"
1953                 [ "$VAR" = "mouse" ] && CFG_MOUSE_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"` && CFG_MOUSE_PLUGIN="$CFG_MOUSE_PLUGIN ${VAL}"
1954                 [ "$VAR" = "gfx" ] && QMakeVar del "${VAR}s" "$VAL"
1955                 [ "$VAR" = "gfx" ] && CFG_GFX_ON=`echo "${CFG_GFX_ON} " | sed "s,${VAL} ,,g"` && CFG_GFX_PLUGIN="${CFG_GFX_PLUGIN} ${VAL}"
1956                 VAR="${VAR}-${OPT}"
1957             else
1958                 if [ "$VAR" = "gfx" ] || [ "$VAR" = "kbd" ] || [ "$VAR" = "decoration" ] || [ "$VAR" = "mouse" ]; then
1959                     [ "$VAR" = "gfx" ] && CFG_GFX_ON="$CFG_GFX_ON $VAL"
1960                     [ "$VAR" = "kbd" ] && CFG_KBD_ON="$CFG_KBD_ON $VAL"
1961                     [ "$VAR" = "decoration" ] && CFG_DECORATION_ON="$CFG_DECORATION_ON $VAL"
1962                     [ "$VAR" = "mouse" ] && CFG_MOUSE_ON="$CFG_MOUSE_ON $VAL"
1963                     VAR="${VAR}-driver"
1964                 fi
1965             fi
1966             QMakeVar add "${VAR}s" "${VAL}"
1967         elif [ "$OPT" = "no" ]; then
1968             PLUG_VAR="${VAR}-plugin"
1969             if [ "$VAR" = "gfx" ] || [ "$VAR" = "kbd" ] || [ "$VAR" = "mouse" ]; then
1970                 IN_VAR="${VAR}-driver"
1971             else
1972                 IN_VAR="${VAR}"
1973             fi
1974             [ "$VAR" = "decoration" ] && CFG_DECORATION_ON=`echo "${CFG_DECORATION_ON} " | sed "s,${VAL} ,,g"`
1975             [ "$VAR" = "gfx" ] && CFG_GFX_ON=`echo "${CFG_GFX_ON} " | sed "s,${VAL} ,,g"`
1976             [ "$VAR" = "kbd" ] && CFG_KBD_ON=`echo "${CFG_KBD_ON} " | sed "s,${VAL} ,,g"`
1977             [ "$VAR" = "mouse" ] && CFG_MOUSE_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"`
1978             QMakeVar del "${IN_VAR}s" "$VAL"
1979             QMakeVar del "${PLUG_VAR}s" "$VAL"
1980         fi
1981         if [ "$ERROR" = "yes" ]; then
1982            echo "$CURRENT_OPT: unknown argument"
1983            OPT_HELP=yes
1984         fi
1985         ;;
1986     v|verbose)
1987         if [ "$VAL" = "yes" ]; then
1988             if [ "$OPT_VERBOSE" = "$VAL" ]; then            # takes two verboses to turn on qmake debugs
1989                 QMAKE_SWITCHES="$QMAKE_SWITCHES -d"
1990             else
1991                 OPT_VERBOSE=yes
1992             fi
1993         elif [ "$VAL" = "no" ]; then
1994             if [ "$OPT_VERBOSE" = "$VAL" ] && echo "$QMAKE_SWITCHES" | grep ' -d' >/dev/null 2>&1; then
1995                 QMAKE_SWITCHES=`echo $QMAKE_SWITCHES | sed "s, -d,,"`
1996             else
1997                 OPT_VERBOSE=no
1998             fi
1999         else
2000             UNKNOWN_OPT=yes
2001         fi
2002         ;;
2003     fast)
2004         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2005             OPT_FAST="$VAL"
2006         else
2007             UNKNOWN_OPT=yes
2008         fi
2009         ;;
2010     rpath)
2011         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2012             CFG_RPATH="$VAL"
2013         else
2014             UNKNOWN_OPT=yes
2015         fi
2016         ;;
2017     add_define)
2018         D_FLAGS="$D_FLAGS \"$VAL\""
2019         ;;
2020     add_ipath)
2021         I_FLAGS="$I_FLAGS -I\"${VAL}\""
2022         ;;
2023     add_lpath)
2024         L_FLAGS="$L_FLAGS -L\"${VAL}\""
2025         ;;
2026     add_rpath)
2027         RPATH_FLAGS="$RPATH_FLAGS \"${VAL}\""
2028         ;;
2029     add_link)
2030         l_FLAGS="$l_FLAGS -l\"${VAL}\""
2031         ;;
2032     add_fpath)
2033         if [ "$PLATFORM_MAC" = "yes" ]; then
2034             L_FLAGS="$L_FLAGS -F\"${VAL}\""
2035             I_FLAGS="$I_FLAGS -F\"${VAL}\""
2036         else
2037             UNKNOWN_OPT=yes
2038         fi
2039         ;;
2040     add_framework)
2041         if [ "$PLATFORM_MAC" = "yes" ]; then
2042             l_FLAGS="$l_FLAGS -framework \"${VAL}\""
2043         else
2044             UNKNOWN_OPT=yes
2045         fi
2046         ;;
2047     silent)
2048         CFG_SILENT="$VAL"
2049         ;;
2050     phonon)
2051         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2052             CFG_PHONON="$VAL"
2053         else
2054             UNKNOWN_OPT=yes
2055         fi
2056         ;;
2057     phonon-backend)
2058         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2059             CFG_PHONON_BACKEND="$VAL"
2060         else
2061             UNKNOWN_OPT=yes
2062         fi
2063         ;;
2064     multimedia)
2065         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2066             CFG_MULTIMEDIA="$VAL"
2067         else
2068             UNKNOWN_OPT=yes
2069         fi
2070         ;;
2071     *)
2072         UNKNOWN_OPT=yes
2073         ;;
2074     esac
2075     if [ "$UNKNOWN_OPT" = "yes" ]; then
2076         echo "${CURRENT_OPT}: invalid command-line switch"
2077         OPT_HELP=yes
2078         ERROR=yes
2079     fi
2080 done
2081
2082 if [ "$CFG_QCONFIG" != "full" ] && [ "$CFG_QT3SUPPORT" = "yes" ]; then
2083     echo "Warning: '-qconfig $CFG_QCONFIG' will disable the qt3support library."
2084     CFG_QT3SUPPORT="no"
2085 fi
2086
2087 # update QT_CONFIG to show our current predefined configuration
2088 case "$CFG_QCONFIG" in
2089 minimal|small|medium|large|full)
2090     # these are a sequence of increasing functionality
2091     for c in minimal small medium large full; do
2092         QT_CONFIG="$QT_CONFIG $c-config"
2093         [ "$CFG_QCONFIG" = $c ] && break
2094     done
2095     ;;
2096 *)
2097     # not known to be sufficient for anything
2098     if [ '!' -f "$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h" ]; then
2099         echo >&2 "Error: configuration file not found:"
2100         echo >&2 "  $relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h"
2101         OPT_HELP=yes
2102     fi
2103 esac
2104
2105 #-------------------------------------------------------------------------------
2106 # build tree initialization
2107 #-------------------------------------------------------------------------------
2108
2109 # where to find which..
2110 unixtests="$relpath/config.tests/unix"
2111 mactests="$relpath/config.tests/mac"
2112 WHICH="$unixtests/which.test"
2113
2114 PERL=`$WHICH perl 2>/dev/null`
2115
2116 # find out which awk we want to use, prefer gawk, then nawk, then regular awk
2117 AWK=
2118 for e in gawk nawk awk; do
2119     if "$WHICH" $e >/dev/null 2>&1 && ( $e -f /dev/null /dev/null ) >/dev/null 2>&1; then
2120         AWK=$e
2121         break
2122     fi
2123 done
2124
2125 # find perl
2126 PERL="/usr/bin/perl"
2127 if "$WHICH" perl >/dev/null 2>&1 && ( perl /dev/null ) >/dev/null 2>&1; then
2128     PERL=`$WHICH perl`
2129 fi
2130
2131 ### skip this if the user just needs help...
2132 if [ "$OPT_HELP" != "yes" ]; then
2133
2134 # is this a shadow build?
2135 if [ "$OPT_SHADOW" = "maybe" ]; then
2136     OPT_SHADOW=no
2137     if [ "$relpath" != "$outpath" ] && [ '!' -f "$outpath/configure" ]; then
2138         if [ -h "$outpath" ]; then
2139             [ "$relpath" -ef "$outpath" ] || OPT_SHADOW=yes
2140         else
2141             OPT_SHADOW=yes
2142         fi
2143     fi
2144 fi
2145 if [ "$OPT_SHADOW" = "yes" ]; then
2146     if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" -o -f "$relpath/src/corelib/global/qconfig.cpp" ]; then
2147         echo >&2 "You cannot make a shadow build from a source tree containing a previous build."
2148         echo >&2 "Cannot proceed."
2149         exit 1
2150     fi
2151     [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..."
2152 fi
2153
2154 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
2155     echo
2156     echo "WARNING: -debug-and-release is not supported anymore on Qt/X11 and Qt for Embedded Linux"
2157     echo "By default, Qt is built in release mode with separate debug information, so"
2158     echo "-debug-and-release is not necessary anymore"
2159     echo
2160 fi
2161
2162 # detect build style
2163 if [ "$CFG_DEBUG" = "auto" ]; then
2164     if [ "$PLATFORM_MAC" = "yes" ]; then
2165         CFG_DEBUG_RELEASE=yes
2166         CFG_DEBUG=yes
2167     elif [ "$CFG_DEV" = "yes" ]; then
2168         CFG_DEBUG_RELEASE=no
2169         CFG_DEBUG=yes
2170     else
2171         CFG_DEBUG_RELEASE=no
2172         CFG_DEBUG=no
2173     fi
2174 fi
2175 if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
2176     QMAKE_CONFIG="$QMAKE_CONFIG build_all"
2177 fi
2178
2179 if [ "$CFG_SILENT" = "yes" ]; then
2180     QMAKE_CONFIG="$QMAKE_CONFIG silent"
2181 fi
2182
2183 # if the source tree is different from the build tree,
2184 # symlink or copy part of the sources
2185 if [ "$OPT_SHADOW" = "yes" ]; then
2186     echo "Preparing build tree..."
2187
2188     if [ -z "$PERL" ]; then
2189         echo
2190         echo "You need perl in your PATH to make a shadow build."
2191         echo "Cannot proceed."
2192         exit 1
2193     fi
2194
2195     [ -d "$outpath/bin" ] || mkdir -p "$outpath/bin"
2196
2197     # symlink the qmake directory
2198     find "$relpath/qmake" | while read a; do
2199         my_a=`echo "$a" | sed "s,^${relpath}/,${outpath}/,"`
2200         if [ '!' -f "$my_a" ]; then
2201             if [ -d "$a" ]; then
2202                 # directories are created...
2203                 mkdir -p "$my_a"
2204             else
2205                 a_dir=`dirname "$my_a"`
2206                 [ -d "$a_dir" ] || mkdir -p "$a_dir"
2207                 # ... and files are symlinked
2208                 case `basename "$a"` in
2209                 *.o|*.d|GNUmakefile*|qmake)
2210                     ;;
2211                 *)
2212                     rm -f "$my_a"
2213                     ln -s "$a" "$my_a"
2214                     ;;
2215                 esac
2216             fi
2217         fi
2218     done
2219
2220     # make a syncqt script that can be used in the shadow
2221     rm -f "$outpath/bin/syncqt"
2222     if [ -x "$relpath/bin/syncqt" ]; then
2223         mkdir -p "$outpath/bin"
2224         echo "#!/bin/sh" >"$outpath/bin/syncqt"
2225         echo "QTDIR=\"$relpath\"; export QTDIR" >>"$outpath/bin/syncqt"
2226         echo "perl \"$relpath/bin/syncqt\" -outdir \"$outpath\" $*" >>"$outpath/bin/syncqt"
2227         chmod 755 "$outpath/bin/syncqt"
2228     fi
2229
2230     # symlink the mkspecs directory
2231     mkdir -p "$outpath/mkspecs"
2232     rm -f "$outpath"/mkspecs/*
2233     ln -s "$relpath"/mkspecs/* "$outpath/mkspecs"
2234     rm -f "$outpath/mkspecs/default"
2235
2236     # symlink the doc directory
2237     rm -rf "$outpath/doc"
2238     ln -s "$relpath/doc" "$outpath/doc"
2239
2240     # make sure q3porting.xml can be found
2241     mkdir -p "$outpath/tools/porting/src"
2242     rm -f "$outpath/tools/porting/src/q3porting.xml"
2243     ln -s "$relpath/tools/porting/src/q3porting.xml" "$outpath/tools/porting/src"
2244 fi
2245
2246 # symlink fonts to be able to run application from build directory
2247 if [ "$PLATFORM_QWS" = "yes" ] && [ ! -e "${outpath}/lib/fonts" ]; then
2248     if [ "$PLATFORM" = "$XPLATFORM" ]; then
2249         mkdir -p "${outpath}/lib"
2250         ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts"
2251     fi
2252 fi
2253
2254 if [ "$OPT_FAST" = "auto" ]; then
2255    if [ '!' -z "$AWK" ] && [ "$CFG_DEV" = "yes" ]; then
2256        OPT_FAST=yes
2257    else
2258        OPT_FAST=no
2259    fi
2260 fi
2261
2262 # find a make command
2263 if [ -z "$MAKE" ]; then
2264     MAKE=
2265     for mk in gmake make; do
2266         if "$WHICH" $mk >/dev/null 2>&1; then
2267             MAKE=`"$WHICH" $mk`
2268             break
2269         fi
2270     done
2271     if [ -z "$MAKE" ]; then
2272         echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH."
2273         echo >&2 "Cannot proceed."
2274         exit 1
2275     fi
2276     # export MAKE, we need it later in the config.tests
2277     export MAKE
2278 fi
2279
2280 fi ### help
2281
2282 #-------------------------------------------------------------------------------
2283 # auto-detect all that hasn't been specified in the arguments
2284 #-------------------------------------------------------------------------------
2285
2286 [ "$PLATFORM_QWS" = "yes" -a "$CFG_EMBEDDED" = "no" ] && CFG_EMBEDDED=auto
2287 if [ "$CFG_EMBEDDED" != "no" ]; then
2288     case "$UNAME_SYSTEM:$UNAME_RELEASE" in
2289     Darwin:*)
2290         [ -z "$PLATFORM" ] && PLATFORM=qws/macx-generic-g++
2291         if [ -z "$XPLATFORM" ]; then
2292             [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2293             XPLATFORM="qws/macx-$CFG_EMBEDDED-g++"
2294         fi
2295         ;;
2296     FreeBSD:*)
2297         [ -z "$PLATFORM" ] && PLATFORM=qws/freebsd-generic-g++
2298         if [ -z "$XPLATFORM" ]; then
2299             [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2300             XPLATFORM="qws/freebsd-$CFG_EMBEDDED-g++"
2301         fi
2302         ;;
2303     SunOS:5*)
2304         [ -z "$PLATFORM" ] && PLATFORM=qws/solaris-generic-g++
2305         if [ -z "$XPLATFORM" ]; then
2306             [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2307             XPLATFORM="qws/solaris-$CFG_EMBEDDED-g++"
2308         fi
2309         ;;
2310     Linux:*)
2311         if [ -z "$PLATFORM" ]; then
2312             case "$UNAME_MACHINE" in
2313             *86)
2314                 PLATFORM=qws/linux-x86-g++
2315                 ;;
2316             *86_64)
2317                 PLATFORM=qws/linux-x86_64-g++
2318                 ;;
2319             *)
2320                 PLATFORM=qws/linux-generic-g++
2321                 ;;
2322             esac
2323         fi
2324         if [ -z "$XPLATFORM" ]; then
2325             if [ "$CFG_EMBEDDED" = "auto" ]; then
2326                 if [ -n "$CFG_ARCH" ]; then
2327                     CFG_EMBEDDED=$CFG_ARCH
2328                 else
2329                     case "$UNAME_MACHINE" in
2330                     *86)
2331                         CFG_EMBEDDED=x86
2332                         ;;
2333                     *86_64)
2334                         CFG_EMBEDDED=x86_64
2335                         ;;
2336                     *)
2337                         CFG_EMBEDDED=generic
2338                         ;;
2339                     esac
2340                 fi
2341             fi
2342             XPLATFORM="qws/linux-$CFG_EMBEDDED-g++"
2343         fi
2344         ;;
2345     QNX:*)
2346         [ -z "$PLATFORM" ] && PLATFORM=unsupported/qws/qnx-generic-g++
2347         if [ -z "$XPLATFORM" ]; then
2348             [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2349             XPLATFORM="unsupported/qws/qnx-$CFG_EMBEDDED-g++"
2350         fi
2351         ;;
2352     CYGWIN*:*)
2353         CFG_EMBEDDED=x86
2354         ;;
2355     *)
2356         echo "Qt for Embedded Linux is not supported on this platform. Disabling."
2357         CFG_EMBEDDED=no
2358         PLATFORM_QWS=no
2359         ;;
2360     esac
2361 fi
2362 if [ -z "$PLATFORM" ]; then
2363     PLATFORM_NOTES=
2364     case "$UNAME_SYSTEM:$UNAME_RELEASE" in
2365      Darwin:*)
2366         if [ "$PLATFORM_MAC" = "yes" ]; then
2367           PLATFORM=macx-g++
2368         # PLATFORM=macx-xcode
2369         else
2370           PLATFORM=darwin-g++
2371         fi
2372         ;;
2373      AIX:*)
2374         #PLATFORM=aix-g++
2375         #PLATFORM=aix-g++-64
2376         PLATFORM=aix-xlc
2377         #PLATFORM=aix-xlc-64
2378         PLATFORM_NOTES="
2379             - Also available for AIX: aix-g++ aix-g++-64 aix-xlc-64
2380         "
2381         ;;
2382      GNU:*)
2383         PLATFORM=hurd-g++
2384         ;;
2385      dgux:*)
2386         PLATFORM=dgux-g++
2387         ;;
2388 #     DYNIX/ptx:4*)
2389 #       PLATFORM=dynix-g++
2390 #       ;;
2391      ULTRIX:*)
2392         PLATFORM=ultrix-g++
2393         ;;
2394      FreeBSD:*)
2395         PLATFORM=freebsd-g++
2396         PLATFORM_NOTES="
2397             - Also available for FreeBSD: freebsd-icc
2398         "
2399         ;;
2400      OpenBSD:*)
2401         PLATFORM=openbsd-g++
2402         ;;
2403      NetBSD:*)
2404         PLATFORM=netbsd-g++
2405         ;;
2406      BSD/OS:*|BSD/386:*)
2407         PLATFORM=bsdi-g++
2408         ;;
2409      IRIX*:*)
2410         #PLATFORM=irix-g++
2411         PLATFORM=irix-cc
2412         #PLATFORM=irix-cc-64
2413         PLATFORM_NOTES="
2414             - Also available for IRIX: irix-g++ irix-cc-64
2415         "
2416         ;;
2417      HP-UX:*)
2418         case "$UNAME_MACHINE" in
2419             ia64)
2420                 #PLATFORM=hpuxi-acc-32
2421                 PLATFORM=hpuxi-acc-64
2422                 PLATFORM_NOTES="
2423                     - Also available for HP-UXi: hpuxi-acc-32
2424                 "
2425             ;;
2426             *)
2427                 #PLATFORM=hpux-g++
2428                 PLATFORM=hpux-acc
2429                 #PLATFORM=hpux-acc-64
2430                 #PLATFORM=hpux-cc
2431                 #PLATFORM=hpux-acc-o64
2432                 PLATFORM_NOTES="
2433                     - Also available for HP-UX: hpux-g++ hpux-acc-64 hpux-acc-o64
2434                 "
2435             ;;
2436         esac
2437         ;;
2438      OSF1:*)
2439         #PLATFORM=tru64-g++
2440         PLATFORM=tru64-cxx
2441         PLATFORM_NOTES="
2442             - Also available for Tru64: tru64-g++
2443         "
2444         ;;
2445      Linux:*)
2446         case "$UNAME_MACHINE" in
2447             x86_64|s390x|ppc64)
2448                 PLATFORM=linux-g++-64
2449                 ;;
2450             *)
2451                 PLATFORM=linux-g++
2452                 ;;
2453         esac
2454         PLATFORM_NOTES="
2455             - Also available for Linux: linux-kcc linux-icc linux-cxx
2456         "
2457         ;;
2458      SunOS:5*)
2459         #PLATFORM=solaris-g++
2460         PLATFORM=solaris-cc
2461         #PLATFORM=solaris-cc64
2462         PLATFORM_NOTES="
2463             - Also available for Solaris: solaris-g++ solaris-cc-64
2464         "
2465         ;;
2466      ReliantUNIX-*:*|SINIX-*:*)
2467         PLATFORM=reliant-cds
2468         #PLATFORM=reliant-cds-64
2469         PLATFORM_NOTES="
2470             - Also available for Reliant UNIX: reliant-cds-64
2471         "
2472         ;;
2473      CYGWIN*:*)
2474         PLATFORM=cygwin-g++
2475         ;;
2476      LynxOS*:*)
2477         PLATFORM=lynxos-g++
2478         ;;
2479      OpenUNIX:*)
2480         #PLATFORM=unixware-g++
2481         PLATFORM=unixware-cc
2482         PLATFORM_NOTES="
2483             - Also available for OpenUNIX: unixware-g++
2484         "
2485         ;;
2486      UnixWare:*)
2487         #PLATFORM=unixware-g++
2488         PLATFORM=unixware-cc
2489         PLATFORM_NOTES="
2490             - Also available for UnixWare: unixware-g++
2491         "
2492         ;;
2493      SCO_SV:*)
2494         #PLATFORM=sco-g++
2495         PLATFORM=sco-cc
2496         PLATFORM_NOTES="
2497             - Also available for SCO OpenServer: sco-g++
2498         "
2499         ;;
2500      UNIX_SV:*)
2501         PLATFORM=unixware-g++
2502         ;;
2503      QNX:*)
2504         PLATFORM=unsupported/qnx-g++
2505         ;;
2506      *)
2507         if [ "$OPT_HELP" != "yes" ]; then
2508             echo
2509             for p in $PLATFORMS; do
2510                 echo "    $relconf $* -platform $p"
2511             done
2512             echo >&2
2513             echo "   The build script does not currently recognize all" >&2
2514             echo "   platforms supported by Qt." >&2
2515             echo "   Rerun this script with a -platform option listed to" >&2
2516             echo "   set the system/compiler combination you use." >&2
2517             echo >&2
2518             exit 2
2519         fi
2520     esac
2521 fi
2522
2523 if [ "$PLATFORM_QWS" = "yes" ]; then
2524     CFG_SM=no
2525     PLATFORMS=`find "$relpath/mkspecs/qws" | sed "s,$relpath/mkspecs/qws/,,"`
2526 else
2527     PLATFORMS=`find "$relpath/mkspecs/" -type f | grep -v qws | sed "s,$relpath/mkspecs/qws/,,"`
2528 fi
2529
2530 [ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM"
2531 if [ -d "$PLATFORM" ]; then
2532   QMAKESPEC="$PLATFORM"
2533 else
2534   QMAKESPEC="$relpath/mkspecs/${PLATFORM}"
2535 fi
2536 if [ -d "$XPLATFORM" ]; then
2537   XQMAKESPEC="$XPLATFORM"
2538 else
2539   XQMAKESPEC="$relpath/mkspecs/${XPLATFORM}"
2540 fi
2541 if [ "$PLATFORM" != "$XPLATFORM" ]; then
2542     QT_CROSS_COMPILE=yes
2543     QMAKE_CONFIG="$QMAKE_CONFIG cross_compile"
2544 fi
2545
2546 if [ "$PLATFORM_MAC" = "yes" ]; then
2547    if [ `basename $QMAKESPEC` = "macx-xcode" ] || [ `basename $XQMAKESPEC` = "macx-xcode" ]; then
2548       echo >&2
2549       echo "   Platform 'macx-xcode' should not be used when building Qt/Mac." >&2
2550       echo "   Please build Qt/Mac with 'macx-g++', then if you would like to" >&2
2551       echo "   use mac-xcode on your application code it can link to a Qt/Mac" >&2
2552       echo "   built with 'macx-g++'" >&2
2553       echo >&2
2554       exit 2
2555     fi
2556 fi
2557
2558 # check specified platforms are supported
2559 if [ '!' -d "$QMAKESPEC" ]; then
2560     echo
2561     echo "   The specified system/compiler is not supported:"
2562     echo
2563     echo "      $QMAKESPEC"
2564     echo
2565     echo "   Please see the README file for a complete list."
2566     echo
2567     exit 2
2568 fi
2569 if [ '!' -d "$XQMAKESPEC" ]; then
2570     echo
2571     echo "   The specified system/compiler is not supported:"
2572     echo
2573     echo "      $XQMAKESPEC"
2574     echo
2575     echo "   Please see the README file for a complete list."
2576     echo
2577     exit 2
2578 fi
2579 if [ '!' -f "${XQMAKESPEC}/qplatformdefs.h" ]; then
2580     echo
2581     echo "   The specified system/compiler port is not complete:"
2582     echo
2583     echo "      $XQMAKESPEC/qplatformdefs.h"
2584     echo
2585     echo "   Please contact qt-bugs@trolltech.com."
2586     echo
2587     exit 2
2588 fi
2589
2590 # now look at the configs and figure out what platform we are config'd for
2591 [ "$CFG_EMBEDDED" = "no" ] \
2592   && [ '!' -z "`getQMakeConf \"$XQMAKESPEC\" | grep QMAKE_LIBS_X11 | awk '{print $3;}'`" ] \
2593   && PLATFORM_X11=yes
2594 ### echo "$XQMAKESPEC" | grep mkspecs/qws >/dev/null 2>&1 && PLATFORM_QWS=yes
2595
2596 if [ "$UNAME_SYSTEM" = "SunOS" ]; then
2597     # Solaris 2.5 and 2.6 have libposix4, which was renamed to librt for Solaris 7 and up
2598     if echo $UNAME_RELEASE | grep "^5\.[5|6]" >/dev/null 2>&1; then
2599         sed -e "s,-lrt,-lposix4," "$XQMAKESPEC/qmake.conf" > "$XQMAKESPEC/qmake.conf.new"
2600         mv "$XQMAKESPEC/qmake.conf.new" "$XQMAKESPEC/qmake.conf"
2601     fi
2602 fi
2603
2604 #-------------------------------------------------------------------------------
2605 # determine the system architecture
2606 #-------------------------------------------------------------------------------
2607 if [ "$OPT_VERBOSE" = "yes" ]; then
2608     echo "Determining system architecture... ($UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_MACHINE)"
2609 fi
2610
2611 if [ "$CFG_EMBEDDED" != "no" -a "$CFG_EMBEDDED" != "auto" ] && [ -n "$CFG_ARCH" ]; then
2612     if [ "$CFG_ARCH" != "$CFG_EMBEDDED" ]; then
2613         echo ""
2614         echo "You have specified a target architecture with -embedded and -arch."
2615         echo "The two architectures you have specified are different, so we can"
2616         echo "not proceed. Either set both to be the same, or only use -embedded."
2617         echo ""
2618         exit 1
2619     fi
2620 fi
2621
2622 if [ "$CFG_RTOS_ENABLED" = "no" ]; then
2623     case `basename "$XPLATFORM"` in
2624         qnx-* | vxworks-*)
2625             echo ""
2626             echo "You are not licensed for Qt for `basename $XPLATFORM`."
2627             echo ""
2628             echo "Please contact qt-info@nokia.com to upgrade your license to"
2629             echo "include this platform, or install the Qt Open Source Edition"
2630             echo "if you intend to develop free software."
2631             exit 1
2632             ;;
2633     esac
2634 fi
2635
2636 if [ -z "${CFG_HOST_ARCH}" ]; then
2637     case "$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_MACHINE" in
2638     IRIX*:*:*)
2639         CFG_HOST_ARCH=`uname -p`
2640         if [ "$OPT_VERBOSE" = "yes" ]; then
2641             echo "    SGI ($CFG_HOST_ARCH)"
2642         fi
2643         ;;
2644     SunOS:5*:*)
2645         case "$UNAME_MACHINE" in
2646         sun4u*|sun4v*)
2647             if [ "$OPT_VERBOSE" = "yes" ]; then
2648                 echo "    Sun SPARC (sparc)"
2649             fi
2650             CFG_HOST_ARCH=sparc
2651             ;;
2652         i86pc)
2653             case "$PLATFORM" in
2654             *-64)
2655                 if [ "$OPT_VERBOSE" = "yes" ]; then
2656                     echo "    64-bit AMD 80x86 (x86_64)"
2657                 fi
2658                 CFG_HOST_ARCH=x86_64
2659                 ;;
2660             *)
2661                 if [ "$OPT_VERBOSE" = "yes" ]; then
2662                     echo "    32-bit Intel 80x86 (i386)"
2663                 fi
2664                 CFG_HOST_ARCH=i386
2665                 ;;
2666             esac
2667         esac
2668         ;;
2669     Darwin:*:*)
2670         case "$UNAME_MACHINE" in
2671             Power?Macintosh)
2672                 if [ "$OPT_VERBOSE" = "yes" ]; then
2673                     echo "    32-bit Apple PowerPC (powerpc)"
2674                 fi
2675                 ;;
2676             x86)
2677                 if [ "$OPT_VERBOSE" = "yes" ]; then
2678                     echo "    32-bit Intel 80x86 (i386)"
2679                 fi
2680                 ;;
2681         esac
2682         CFG_HOST_ARCH=macosx
2683         ;;
2684     AIX:*:00????????00)
2685         if [ "$OPT_VERBOSE" = "yes" ]; then
2686         echo "    64-bit IBM PowerPC (powerpc)"
2687         fi
2688         CFG_HOST_ARCH=powerpc
2689         ;;
2690     HP-UX:*:9000*)
2691         if [ "$OPT_VERBOSE" = "yes" ]; then
2692             echo "    HP PA-RISC (parisc)"
2693         fi
2694         CFG_HOST_ARCH=parisc
2695         ;;
2696     *:*:i?86)
2697         if [ "$OPT_VERBOSE" = "yes" ]; then
2698             echo "    32-bit Intel 80x86 (i386)"
2699         fi
2700         CFG_HOST_ARCH=i386
2701         ;;
2702     *:*:x86_64|*:*:amd64)
2703         if [ "$PLATFORM" = "linux-g++-32" -o "$PLATFORM" = "linux-icc-32" ]; then
2704             if [ "$OPT_VERBOSE" = "yes" ]; then
2705                 echo "    32 bit on 64-bit AMD 80x86 (i386)"
2706             fi
2707             CFG_HOST_ARCH=i386
2708         else
2709             if [ "$OPT_VERBOSE" = "yes" ]; then
2710                 echo "    64-bit AMD 80x86 (x86_64)"
2711             fi
2712             CFG_HOST_ARCH=x86_64
2713         fi
2714         ;;
2715     *:*:ppc)
2716         if [ "$OPT_VERBOSE" = "yes" ]; then
2717             echo "    32-bit PowerPC (powerpc)"
2718         fi
2719         CFG_HOST_ARCH=powerpc
2720         ;;
2721     *:*:ppc64)
2722         if [ "$OPT_VERBOSE" = "yes" ]; then
2723             echo "    64-bit PowerPC (powerpc)"
2724         fi
2725         CFG_HOST_ARCH=powerpc
2726         ;;
2727     *:*:s390*)
2728         if [ "$OPT_VERBOSE" = "yes" ]; then
2729             echo "    IBM S/390 (s390)"
2730         fi
2731         CFG_HOST_ARCH=s390
2732         ;;
2733     *:*:arm*)
2734         if [ "$OPT_VERBOSE" = "yes" ]; then
2735             echo "    ARM (arm)"
2736         fi
2737         CFG_HOST_ARCH=arm
2738         ;;
2739     Linux:*:sparc*)
2740         if [ "$OPT_VERBOSE" = "yes" ]; then
2741             echo "    Linux on SPARC"
2742         fi
2743         CFG_HOST_ARCH=sparc
2744         ;;
2745     QNX:*:*)
2746         case "$UNAME_MACHINE" in
2747         x86pc)
2748             if [ "$OPT_VERBOSE" = "yes" ]; then
2749                 echo "    QNX on Intel 80x86 (i386)"
2750             fi
2751             CFG_HOST_ARCH=i386
2752             ;;
2753         esac
2754         ;;
2755     *:*:*)
2756         if [ "$OPT_VERBOSE" = "yes" ]; then
2757             echo "    Trying '$UNAME_MACHINE'..."
2758         fi
2759         CFG_HOST_ARCH="$UNAME_MACHINE"
2760         ;;
2761     esac
2762 fi
2763
2764 if [ "$PLATFORM" != "$XPLATFORM" -a "$CFG_EMBEDDED" != "no" ]; then
2765     if [ -n "$CFG_ARCH" ]; then
2766         CFG_EMBEDDED=$CFG_ARCH
2767     fi
2768
2769     case "$CFG_EMBEDDED" in
2770     x86)
2771         CFG_ARCH=i386
2772         ;;
2773     x86_64)
2774         CFG_ARCH=x86_64
2775         ;;
2776     ipaq|sharp)
2777         CFG_ARCH=arm
2778         ;;
2779     dm7000)
2780         CFG_ARCH=powerpc
2781         ;;
2782     dm800)
2783         CFG_ARCH=mips
2784         ;;
2785     sh4al)
2786         CFG_ARCH=sh4a
2787         ;;
2788     *)
2789         CFG_ARCH="$CFG_EMBEDDED"
2790         ;;
2791     esac
2792 elif [ "$PLATFORM_MAC" = "yes" ] || [ -z "$CFG_ARCH" ]; then
2793     CFG_ARCH=$CFG_HOST_ARCH
2794 fi
2795
2796 if [ -d "$relpath/src/corelib/arch/$CFG_ARCH" ]; then
2797     if [ "$OPT_VERBOSE" = "yes" ]; then
2798         echo "    '$CFG_ARCH' is supported"
2799     fi
2800 else
2801     if [ "$OPT_VERBOSE" = "yes" ]; then
2802         echo "    '$CFG_ARCH' is unsupported, using 'generic'"
2803     fi
2804     CFG_ARCH=generic
2805 fi
2806 if [ "$CFG_HOST_ARCH" != "$CFG_ARCH" ]; then
2807     if [ -d "$relpath/src/corelib/arch/$CFG_HOST_ARCH" ]; then
2808         if [ "$OPT_VERBOSE" = "yes" ]; then
2809             echo "    '$CFG_HOST_ARCH' is supported"
2810         fi
2811     else
2812         if [ "$OPT_VERBOSE" = "yes" ]; then
2813             echo "    '$CFG_HOST_ARCH' is unsupported, using 'generic'"
2814         fi
2815         CFG_HOST_ARCH=generic
2816     fi
2817 fi
2818
2819 if [ "$OPT_VERBOSE" = "yes" ]; then
2820     echo "System architecture: '$CFG_ARCH'"
2821     if [ "$PLATFORM_QWS" = "yes" ]; then
2822         echo "Host architecture: '$CFG_HOST_ARCH'"
2823     fi
2824 fi
2825
2826 #-------------------------------------------------------------------------------
2827 # tests that don't need qmake (must be run before displaying help)
2828 #-------------------------------------------------------------------------------
2829
2830 if [ -z "$PKG_CONFIG" ]; then
2831     # See if PKG_CONFIG is set in the mkspec:
2832     PKG_CONFIG=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%PKG_CONFIG[^_].*=%%p' | tr '\n' ' '`
2833 fi
2834 if [ -z "$PKG_CONFIG" ]; then
2835     PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null`
2836 fi
2837
2838 # Work out if we can use pkg-config
2839 if [ "$QT_CROSS_COMPILE" = "yes" ]; then
2840     if [ "$QT_FORCE_PKGCONFIG" = "yes" ]; then
2841         echo >&2 ""
2842         echo >&2 "You have asked to use pkg-config and are cross-compiling."
2843         echo >&2 "Please make sure you have a correctly set-up pkg-config"
2844         echo >&2 "environment!"
2845         echo >&2 ""
2846         if [ -z "$PKG_CONFIG_PATH" ]; then
2847             echo >&2 ""
2848             echo >&2 "Warning: PKG_CONFIG_PATH has not been set.  This could mean"
2849             echo >&2 "the host compiler's .pc files will be used. This is probably"
2850             echo >&2 "not what you want."
2851             echo >&2 ""
2852         elif [ -z "$PKG_CONFIG_SYSROOT" ] && [ -z "$PKG_CONFIG_SYSROOT_DIR" ]; then
2853             echo >&2 ""
2854             echo >&2 "Warning: PKG_CONFIG_SYSROOT/PKG_CONFIG_SYSROOT_DIR has not"
2855             echo >&2 "been set. This means your toolchain's .pc files must contain"
2856             echo >&2 "the paths to the toolchain's libraries & headers. If configure"
2857             echo >&2 "tests are failing, please check these files."
2858             echo >&2 ""
2859         fi
2860     else
2861         echo >&2 ""
2862         echo >&2 "You have not explicitly asked to use pkg-config and are cross-compiling."
2863         echo >&2 "pkg-config will not be used to automatically query cflag/lib parameters for"
2864         echo >&2 "dependencies"
2865         echo >&2 ""
2866         PKG_CONFIG=""
2867     fi
2868 fi
2869
2870 # process CFG_MAC_ARCHS
2871 if [ "$PLATFORM_MAC" = "yes" ]; then
2872 #   check -arch arguments for validity.
2873     ALLOWED="x86 ppc x86_64 ppc64 i386"
2874     # Save the list so we can re-write it using only valid values
2875     CFG_MAC_ARCHS_IN="$CFG_MAC_ARCHS"
2876     CFG_MAC_ARCHS=
2877     for i in $CFG_MAC_ARCHS_IN
2878     do 
2879         if echo "$ALLOWED" | grep -w -v "$i" > /dev/null 2>&1; then
2880             echo "Unknown architecture: \"$i\". Supported architectures: x86[i386] ppc x86_64 ppc64";
2881             exit 2;
2882         fi
2883         if [ "$i" = "i386" -o "$i" = "x86" ]; then
2884             # These are synonymous values
2885             # CFG_MAC_ARCHS requires x86 while GCC requires i386
2886             CFG_MAC_ARCHS="$CFG_MAC_ARCHS x86"
2887             MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -arch i386"
2888         else
2889             CFG_MAC_ARCHS="$CFG_MAC_ARCHS $i"
2890             MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -arch $i"
2891         fi
2892     done
2893 fi
2894
2895 # pass on $CFG_SDK to the configure tests.
2896 if [ '!' -z "$CFG_SDK" ]; then
2897     MAC_CONFIG_TEST_COMMANDLINE="-sdk $CFG_SDK"
2898 fi
2899
2900 # find the default framework value
2901 if [ "$PLATFORM_MAC" = "yes" ] && [ "$PLATFORM" != "macx-xlc" ]; then
2902     if [ "$CFG_FRAMEWORK" = "auto" ]; then
2903         CFG_FRAMEWORK="$CFG_SHARED"
2904     elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
2905         echo
2906         echo "WARNING: Using static linking will disable the use of Mac frameworks."
2907         echo
2908         CFG_FRAMEWORK="no"
2909     fi
2910 else
2911     CFG_FRAMEWORK=no
2912 fi
2913
2914 QMAKE_CONF_COMPILER=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_CXX[^_A-Z0-9]" | sed "s,.* *= *\(.*\)$,\1," | tail -1`
2915 TEST_COMPILER="$CC"
2916 [ -z "$TEST_COMPILER" ] && TEST_COMPILER=$QMAKE_CONF_COMPILER
2917
2918 # auto-detect precompiled header support
2919 if [ "$CFG_PRECOMPILE" = "auto" ]; then
2920     if [ `echo "$CFG_MAC_ARCHS" | wc -w` -gt 1 ]; then
2921        CFG_PRECOMPILE=no
2922     elif "$unixtests/precomp.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
2923        CFG_PRECOMPILE=no
2924     else
2925        CFG_PRECOMPILE=yes
2926     fi
2927 elif [ "$CFG_PRECOMPILE" = "yes" ] && [ `echo "$CFG_MAC_ARCHS" | wc -w` -gt 1 ]; then
2928     echo
2929     echo "WARNING: Using universal binaries disables precompiled headers."
2930     echo
2931     CFG_PRECOMPILE=no
2932 fi
2933
2934 #auto-detect DWARF2 on the mac
2935 if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "auto" ]; then
2936     if "$mactests/dwarf2.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
2937         CFG_MAC_DWARF2=no
2938     else
2939         CFG_MAC_DWARF2=yes
2940     fi
2941 fi
2942
2943 # auto-detect support for -Xarch on the mac
2944 if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" = "auto" ]; then
2945     if "$mactests/xarch.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
2946         CFG_MAC_XARCH=no
2947     else
2948         CFG_MAC_XARCH=yes
2949     fi
2950 fi
2951
2952 # don't autodetect support for separate debug info on objcopy when
2953 # cross-compiling as lots of toolchains seems to have problems with this
2954 if [ "$QT_CROSS_COMPILE" = "yes" ] && [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
2955     CFG_SEPARATE_DEBUG_INFO="no"
2956 fi
2957
2958 # auto-detect support for separate debug info in objcopy
2959 if [ "$CFG_SEPARATE_DEBUG_INFO" != "no" ] && [ "$CFG_SHARED" = "yes" ]; then
2960     TEST_COMPILER_CFLAGS=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%QMAKE_CFLAGS[^_].*=%%p' | tr '\n' ' '`
2961     TEST_COMPILER_CXXFLAGS=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%QMAKE_CXXFLAGS[^_].*=%%p' | tr '\n' ' '`
2962     TEST_OBJCOPY=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_OBJCOPY" | sed "s%.* *= *\(.*\)$%\1%" | tail -1`
2963     COMPILER_WITH_FLAGS="$TEST_COMPILER $TEST_COMPILER_CXXFLAGS"
2964     COMPILER_WITH_FLAGS=`echo "$COMPILER_WITH_FLAGS" | sed -e "s%\\$\\$QMAKE_CFLAGS%$TEST_COMPILER_CFLAGS%g"`
2965     if "$unixtests/objcopy.test" "$COMPILER_WITH_FLAGS" "$TEST_OBJCOPY" "$OPT_VERBOSE"; then
2966        CFG_SEPARATE_DEBUG_INFO=no
2967     else
2968        case "$PLATFORM" in
2969        hpux-*)
2970            # binutils on HP-UX is buggy; default to no.
2971            CFG_SEPARATE_DEBUG_INFO=no
2972            ;;
2973        *)
2974            CFG_SEPARATE_DEBUG_INFO=yes
2975            ;;
2976        esac
2977     fi
2978 fi
2979
2980 # auto-detect -fvisibility support
2981 if [ "$CFG_REDUCE_EXPORTS" = "auto" ]; then
2982     if "$unixtests/fvisibility.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
2983        CFG_REDUCE_EXPORTS=no
2984     else
2985        CFG_REDUCE_EXPORTS=yes
2986     fi
2987 fi
2988
2989 # detect the availability of the -Bsymbolic-functions linker optimization
2990 if [ "$CFG_REDUCE_RELOCATIONS" != "no" ]; then
2991     if "$unixtests/bsymbolic_functions.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
2992         CFG_REDUCE_RELOCATIONS=no
2993     else
2994         CFG_REDUCE_RELOCATIONS=yes
2995     fi
2996 fi
2997
2998 # auto-detect GNU make support
2999 if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2>&1; then
3000    CFG_USE_GNUMAKE=yes
3001 fi
3002
3003 # If -opengl wasn't specified, don't try to auto-detect
3004 if [ "$PLATFORM_QWS" = "yes" ] && [ "$CFG_OPENGL" = "auto" ]; then
3005         CFG_OPENGL=no
3006 fi
3007
3008 # mac
3009 if [ "$PLATFORM_MAC" = "yes" ]; then
3010     if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
3011         CFG_OPENGL=desktop
3012     fi
3013 fi
3014
3015 # find the default framework value
3016 if [ "$PLATFORM_MAC" = "yes" ] && [ "$PLATFORM" != "macx-xlc" ]; then
3017     if [ "$CFG_FRAMEWORK" = "auto" ]; then
3018         CFG_FRAMEWORK="$CFG_SHARED"
3019     elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
3020         echo
3021         echo "WARNING: Using static linking will disable the use of Mac frameworks."
3022         echo
3023         CFG_FRAMEWORK="no"
3024     fi
3025 else
3026     CFG_FRAMEWORK=no
3027 fi
3028
3029 # Print a warning if configure was called with the 10.4u SDK option on Snow Leopard
3030 # with the default mkspec. The 10.4u SDK does not support gcc 4.2.
3031 if [ "$PLATFORM_MAC" = "yes" ] && [ '!' -z "$CFG_SDK" ]; then
3032     # get the darwin version. 10.0.0 and up means snow leopard.
3033     VERSION=`uname -r | tr '.' ' ' | awk '{print $1}'`
3034     if [ "$VERSION" -gt 9 ] && [ "$CFG_SDK" == "/Developer/SDKs/MacOSX10.4u.sdk/" ] && [ "$PLATFORM" == "macx-g++" ]; then
3035         echo
3036         echo "WARNING: The 10.4u SDK does not support gcc 4.2. Configure with -platform macx-g++40. "
3037         echo
3038     fi
3039 fi
3040
3041 # x11 tests are done after qmake is built
3042
3043
3044 #setup the build parts
3045 if [ -z "$CFG_BUILD_PARTS" ]; then
3046     CFG_BUILD_PARTS="$QT_DEFAULT_BUILD_PARTS"
3047
3048     # don't build tools by default when cross-compiling
3049     if [ "$PLATFORM" != "$XPLATFORM" ]; then
3050         CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, tools,,g"`
3051     fi
3052 fi
3053 for nobuild in $CFG_NOBUILD_PARTS; do
3054     CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, $nobuild,,g"`
3055 done
3056 if echo $CFG_BUILD_PARTS | grep -v libs >/dev/null 2>&1; then
3057 #    echo
3058 #    echo "WARNING: libs is a required part of the build."
3059 #    echo
3060     CFG_BUILD_PARTS="$CFG_BUILD_PARTS libs"
3061 fi
3062
3063 #-------------------------------------------------------------------------------
3064 # post process QT_INSTALL_* variables
3065 #-------------------------------------------------------------------------------
3066
3067 #prefix
3068 if [ -z "$QT_INSTALL_PREFIX" ]; then
3069     if [ "$CFG_DEV" = "yes" ]; then
3070         QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default
3071     elif [ "$PLATFORM_QWS" = "yes" ]; then
3072         QT_INSTALL_PREFIX="/usr/local/Trolltech/QtEmbedded-${QT_VERSION}"
3073         if [ "$PLATFORM" != "$XPLATFORM" ]; then
3074             QT_INSTALL_PREFIX="${QT_INSTALL_PREFIX}-${CFG_ARCH}"
3075         fi
3076     else
3077         QT_INSTALL_PREFIX="/usr/local/Trolltech/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Trolltech/Qt-$QT_VERSION
3078     fi
3079 fi
3080 QT_INSTALL_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PREFIX"`
3081
3082 #docs
3083 if [ -z "$QT_INSTALL_DOCS" ]; then #default
3084     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3085         if [ "$PLATFORM_MAC" = "yes" ]; then
3086             QT_INSTALL_DOCS="/Developer/Documentation/Qt"
3087         fi