This patch adds support for using -isystem to allow putting an include
[qt:kde-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 ## Commercial Usage
12 ## Licensees holding valid Qt Commercial licenses may use this file in
13 ## accordance with the Qt Commercial License Agreement provided with the
14 ## Software or, alternatively, in accordance with the terms contained in
15 ## a written agreement between you and Nokia.
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 ## GNU General Public License Usage
30 ## Alternatively, this file may be used under the terms of the GNU
31 ## General Public License version 3.0 as published by the Free Software
32 ## Foundation and appearing in the file LICENSE.GPL included in the
33 ## packaging of this file.  Please review the following information to
34 ## ensure the GNU General Public License version 3.0 requirements will be
35 ## met: http://www.gnu.org/copyleft/gpl.html.
36 ##
37 ## If you have questions regarding the use of this file, please contact
38 ## Nokia at qt-info@nokia.com.
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     -isystem)
1016         VAR="add_isystempath"
1017         shift
1018         VAL="$1"
1019         ;;
1020     -I?*|-I)
1021         VAR="add_ipath"
1022         if [ "$1" = "-I" ]; then
1023             shift
1024             VAL="$1"
1025         else
1026             VAL=`echo $1 | sed 's,-I,,'`
1027         fi
1028         ;;
1029     -L?*|-L)
1030         VAR="add_lpath"
1031         if [ "$1" = "-L" ]; then
1032             shift
1033             VAL="$1"
1034         else
1035             VAL=`echo $1 | sed 's,-L,,'`
1036         fi
1037         ;;
1038     -R?*|-R)
1039         VAR="add_rpath"
1040         if [ "$1" = "-R" ]; then
1041             shift
1042             VAL="$1"
1043         else
1044             VAL=`echo $1 | sed 's,-R,,'`
1045         fi
1046         ;;
1047     -l?*)
1048         VAR="add_link"
1049         VAL=`echo $1 | sed 's,-l,,'`
1050         ;;
1051     -F?*|-F)
1052         VAR="add_fpath"
1053         if [ "$1" = "-F" ]; then
1054             shift
1055             VAL="$1"
1056         else
1057             VAL=`echo $1 | sed 's,-F,,'`
1058         fi
1059         ;;
1060     -fw?*|-fw)
1061         VAR="add_framework"
1062         if [ "$1" = "-fw" ]; then
1063             shift
1064             VAL="$1"
1065         else
1066             VAL=`echo $1 | sed 's,-fw,,'`
1067         fi
1068         ;;
1069     -*)
1070         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
1071         VAL="unknown"
1072         ;;
1073     *)
1074         UNKNOWN_ARG=yes
1075         ;;
1076     esac
1077     if [ "$UNKNOWN_ARG" = "yes" ]; then
1078         echo "$1: unknown argument"
1079         OPT_HELP=yes
1080         ERROR=yes
1081         shift
1082         continue
1083      fi
1084     shift
1085
1086     UNKNOWN_OPT=no
1087     case "$VAR" in
1088     qt3support)
1089         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1090             CFG_QT3SUPPORT="$VAL"
1091         else
1092             UNKNOWN_OPT=yes
1093         fi
1094         ;;
1095     accessibility)
1096         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1097             CFG_ACCESSIBILITY="$VAL"
1098         else
1099             UNKNOWN_OPT=yes
1100         fi
1101         ;;
1102     license)
1103         LICENSE_FILE="$VAL"
1104         ;;
1105     gnumake)
1106         CFG_USE_GNUMAKE="$VAL"
1107         ;;
1108     mysql_config)
1109         CFG_MYSQL_CONFIG="$VAL"
1110         ;;
1111     prefix)
1112         QT_INSTALL_PREFIX="$VAL"
1113         ;;
1114     hostprefix)
1115         QT_HOST_PREFIX="$VAL"
1116         ;;
1117     force-pkg-config)
1118         QT_FORCE_PKGCONFIG=yes
1119         ;;
1120     docdir)
1121         QT_INSTALL_DOCS="$VAL"
1122         ;;
1123     headerdir)
1124         QT_INSTALL_HEADERS="$VAL"
1125         ;;
1126     plugindir)
1127         QT_INSTALL_PLUGINS="$VAL"
1128         ;;
1129     datadir)
1130         QT_INSTALL_DATA="$VAL"
1131         ;;
1132     libdir)
1133         QT_INSTALL_LIBS="$VAL"
1134         ;;
1135     qtnamespace)
1136         QT_NAMESPACE="$VAL"
1137         ;;
1138     qtlibinfix)
1139         QT_LIBINFIX="$VAL"
1140         ;;
1141     translationdir)
1142         QT_INSTALL_TRANSLATIONS="$VAL"
1143         ;;
1144     sysconfdir|settingsdir)
1145         QT_INSTALL_SETTINGS="$VAL"
1146         ;;
1147     examplesdir)
1148         QT_INSTALL_EXAMPLES="$VAL"
1149         ;;
1150     demosdir)
1151         QT_INSTALL_DEMOS="$VAL"
1152         ;;
1153     qconfig)
1154         CFG_QCONFIG="$VAL"
1155         ;;
1156     bindir)
1157         QT_INSTALL_BINS="$VAL"
1158         ;;
1159     buildkey)
1160         CFG_USER_BUILD_KEY="$VAL"
1161         ;;
1162     sxe)
1163         CFG_SXE="$VAL"
1164         ;;
1165     embedded)
1166         CFG_EMBEDDED="$VAL"
1167         if [ "$PLATFORM_QWS" != "no" ]; then
1168             if [ "$PLATFORM_QWS" = "maybe" ]; then
1169                 PLATFORM_X11=no
1170                 PLATFORM_MAC=no
1171                 PLATFORM_QWS=yes
1172             fi
1173         else
1174             echo "No license exists to enable Qt for Embedded Linux. Disabling."
1175             CFG_EMBEDDED=no
1176         fi
1177         ;;
1178     sse)
1179         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1180             CFG_SSE="$VAL"
1181         else
1182             UNKNOWN_OPT=yes
1183         fi
1184         ;;
1185     endian)
1186         if [ "$VAL" = "little" ]; then
1187             CFG_ENDIAN="Q_LITTLE_ENDIAN"
1188         elif [ "$VAL" = "big" ]; then
1189             CFG_ENDIAN="Q_BIG_ENDIAN"
1190         else
1191             UNKNOWN_OPT=yes
1192         fi
1193         ;;
1194     host_endian)
1195         if [ "$VAL" = "little" ]; then
1196             CFG_HOST_ENDIAN="Q_LITTLE_ENDIAN"
1197         elif [ "$VAL" = "big" ]; then
1198             CFG_HOST_ENDIAN="Q_BIG_ENDIAN"
1199         else
1200             UNKNOWN_OPT=yes
1201         fi
1202         ;;
1203     armfpa)
1204         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1205             CFG_ARMFPA="$VAL"
1206         else
1207             UNKNOWN_OPT=yes
1208         fi
1209         ;;
1210     depths)
1211         CFG_QWS_DEPTHS="$VAL"
1212         ;;
1213     opengl)
1214         if  [ "$VAL" = "auto" ] || [ "$VAL" = "desktop" ] ||
1215             [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] ||
1216             [ "$VAL" = "es1cl" ] || [ "$VAL" = "es1" ] || [ "$VAL" = "es2" ]; then
1217             CFG_OPENGL="$VAL"
1218         else
1219             UNKNOWN_OPT=yes
1220         fi
1221         ;;
1222     openvg)
1223         if [ "$VAL" = "auto" ] || [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1224             CFG_OPENVG="$VAL"
1225         else
1226             UNKNOWN_OPT=yes
1227         fi
1228         ;;
1229     graphicssystem)
1230         if [ "$PLATFORM_QWS" = "yes" ]; then
1231             echo "Error: Graphics System plugins are not supported on QWS."
1232             echo "   On QWS, the graphics system API is part of the QScreen plugin architecture "
1233             echo "   rather than existing as a separate plugin."
1234             echo ""
1235             UNKNOWN_OPT=yes
1236         else
1237             if  [ "$VAL" = "opengl" ]; then
1238                 CFG_GRAPHICS_SYSTEM="opengl"
1239             elif [ "$VAL" = "openvg" ]; then
1240                 CFG_GRAPHICS_SYSTEM="openvg"
1241             elif [ "$VAL" = "raster" ]; then
1242                 CFG_GRAPHICS_SYSTEM="raster"
1243             else
1244                 UNKNOWN_OPT=yes
1245             fi
1246         fi
1247         ;;
1248
1249     qvfb) # left for commandline compatibility, not documented
1250         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1251             if [ "$VAL" = "yes" ]; then
1252                 QMakeVar add gfx-drivers qvfb
1253                 QMakeVar add kbd-drivers qvfb
1254                 QMakeVar add mouse-drivers qvfb
1255                 CFG_GFX_ON="$CFG_GFX_ON qvfb"
1256                 CFG_KBD_ON="$CFG_KBD_ON qvfb"
1257                 CFG_MOUSE_ON="$CFG_MOUSE_ON qvfb"
1258             fi
1259         else
1260             UNKNOWN_OPT=yes
1261         fi
1262         ;;
1263     nomake)
1264         CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS $VAL"
1265         ;;
1266     make)
1267         CFG_BUILD_PARTS="$CFG_BUILD_PARTS $VAL"
1268         ;;
1269     x11)
1270         if [ "$PLATFORM_MAC" = "yes" ]; then
1271             PLATFORM_MAC=no
1272         elif [ "$PLATFORM_QWS" = "yes" ]; then
1273             PLATFORM_QWS=no
1274         fi
1275         if [ "$CFG_FRAMEWORK" = "auto" ]; then
1276             CFG_FRAMEWORK=no
1277         fi
1278         PLATFORM_X11=yes
1279         ;;
1280     sdk)
1281         if [ "$PLATFORM_MAC" = "yes" ]; then
1282             CFG_SDK="$VAL"
1283         else
1284             UNKNOWN_OPT=yes
1285         fi
1286         ;;
1287      dwarf2)
1288         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1289             CFG_MAC_DWARF2="$VAL"
1290         else
1291             UNKNOWN_OPT=yes
1292         fi
1293         ;;
1294     arch)
1295         if [ "$PLATFORM_MAC" = "yes" ]; then
1296             CFG_MAC_ARCHS="$CFG_MAC_ARCHS $VAL"
1297         else
1298             CFG_ARCH=$VAL
1299         fi
1300         ;;
1301     host-arch)
1302         CFG_HOST_ARCH=$VAL
1303         ;;
1304     universal)
1305         if [ "$PLATFORM_MAC" = "yes" ] && [ "$VAL" = "yes" ]; then
1306             CFG_MAC_ARCHS="$CFG_MAC_ARCHS x86 ppc"
1307         else
1308             UNKNOWN_OPT=yes
1309         fi
1310         ;;
1311     cocoa)
1312         if [ "$PLATFORM_MAC" = "yes" ] && [ "$VAL" = "yes" ]; then
1313             CFG_MAC_COCOA="$VAL"
1314             COMMANDLINE_MAC_COCOA="$VAL"
1315         else
1316             UNKNOWN_OPT=yes
1317         fi
1318         ;;
1319     framework)
1320         if [ "$PLATFORM_MAC" = "yes" ]; then
1321             CFG_FRAMEWORK="$VAL"
1322         else
1323             UNKNOWN_OPT=yes
1324         fi
1325         ;;
1326     profile)
1327         if [ "$VAL" = "yes" ]; then
1328             CFG_PROFILE=yes
1329             QMakeVar add QMAKE_CFLAGS -pg
1330             QMakeVar add QMAKE_CXXFLAGS -pg
1331             QMakeVar add QMAKE_LFLAGS -pg
1332             QMAKE_VARS="$QMAKE_VARS CONFIG+=nostrip"
1333         else
1334             UNKNOWN_OPT=yes
1335         fi
1336         ;;
1337     exceptions|g++-exceptions)
1338         if [ "$VAL" = "no" ]; then
1339             CFG_EXCEPTIONS=no
1340         elif [ "$VAL" = "yes" ]; then
1341             CFG_EXCEPTIONS=yes
1342         else
1343             UNKNOWN_OPT=yes
1344         fi
1345         ;;
1346     platform)
1347         PLATFORM="$VAL"
1348         # keep compatibility with old platform names
1349         case $PLATFORM in
1350         aix-64)
1351             PLATFORM=aix-xlc-64
1352             ;;
1353         hpux-o64)
1354             PLATFORM=hpux-acc-o64
1355             ;;
1356         hpux-n64)
1357             PLATFORM=hpux-acc-64
1358             ;;
1359         hpux-acc-n64)
1360             PLATFORM=hpux-acc-64
1361             ;;
1362         irix-n32)
1363             PLATFORM=irix-cc
1364             ;;
1365         irix-64)
1366             PLATFORM=irix-cc-64
1367             ;;
1368         irix-cc-n64)
1369             PLATFORM=irix-cc-64
1370             ;;
1371         reliant-64)
1372             PLATFORM=reliant-cds-64
1373             ;;
1374         solaris-64)
1375             PLATFORM=solaris-cc-64
1376             ;;
1377         solaris-64)
1378             PLATFORM=solaris-cc-64
1379             ;;
1380         openunix-cc)
1381             PLATFORM=unixware-cc
1382             ;;
1383         openunix-g++)
1384             PLATFORM=unixware-g++
1385             ;;
1386         unixware7-cc)
1387             PLATFORM=unixware-cc
1388             ;;
1389         unixware7-g++)
1390             PLATFORM=unixware-g++
1391             ;;
1392         macx-g++-64)
1393             PLATFORM=macx-g++
1394             NATIVE_64_ARCH=
1395             case `uname -p` in
1396             i386) NATIVE_64_ARCH="x86_64" ;;
1397             powerpc) NATIVE_64_ARCH="ppc64" ;;
1398             *)   echo "WARNING: Can't detect CPU architecture for macx-g++-64" ;;
1399             esac
1400             if [ ! -z "$NATIVE_64_ARCH" ]; then
1401                 QTCONFIG_CONFIG="$QTCONFIG_CONFIG $NATIVE_64_ARCH"
1402                 CFG_MAC_ARCHS="$CFG_MAC_ARCHS $NATIVE_64_ARCH"
1403             fi
1404             ;;
1405         esac
1406         ;;
1407     xplatform)
1408         XPLATFORM="$VAL"
1409         ;;
1410     debug-and-release)
1411         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1412             CFG_DEBUG_RELEASE="$VAL"
1413         else
1414             UNKNOWN_OPT=yes
1415         fi
1416         ;;
1417     optimized-qmake)
1418         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1419             CFG_RELEASE_QMAKE="$VAL"
1420         else
1421             UNKNOWN_OPT=yes
1422         fi
1423         ;;
1424     release)
1425         if [ "$VAL" = "yes" ]; then
1426             CFG_DEBUG=no
1427         elif [ "$VAL" = "no" ]; then
1428             CFG_DEBUG=yes
1429         else
1430             UNKNOWN_OPT=yes
1431         fi
1432         ;;
1433     prefix-install)
1434         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1435             CFG_PREFIX_INSTALL="$VAL"
1436         else
1437             UNKNOWN_OPT=yes
1438         fi
1439         ;;
1440     debug)
1441         CFG_DEBUG="$VAL"
1442         ;;
1443     developer-build|commercial|opensource|nokia-developer)
1444         # These switches have been dealt with already
1445         ;;
1446     static)
1447         if [ "$VAL" = "yes" ]; then
1448             CFG_SHARED=no
1449         elif [ "$VAL" = "no" ]; then
1450             CFG_SHARED=yes
1451         else
1452             UNKNOWN_OPT=yes
1453         fi
1454         ;;
1455     incremental)
1456         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1457             CFG_INCREMENTAL="$VAL"
1458         else
1459             UNKNOWN_OPT=yes
1460         fi
1461         ;;
1462     fatal_error)
1463         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1464             CFG_CONFIGURE_EXIT_ON_ERROR="$VAL"
1465         else
1466             UNKNOWN_OPT=yes
1467         fi
1468         ;;
1469     feature-*)
1470         if [ "$PLATFORM_QWS" = "yes" ]; then
1471             FEATURE=`echo $VAR | sed "s,^[^-]*-\([^-]*\),\1," | tr 'abcdefghijklmnopqrstuvwxyz-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
1472             if [ "$VAL" = "no" ]; then
1473                 QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_$FEATURE"
1474             elif [ "$VAL" = "yes" ] || [ "$VAL" = "unknown" ]; then
1475                 QCONFIG_FLAGS="$QCONFIG_FLAGS QT_$FEATURE"
1476             else
1477                 UNKNOWN_OPT=yes
1478             fi
1479         else
1480             UNKNOWN_OPT=yes
1481         fi
1482         ;;
1483     shared)
1484         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1485             CFG_SHARED="$VAL"
1486         else
1487             UNKNOWN_OPT=yes
1488         fi
1489         ;;
1490     gif)
1491         [ "$VAL" = "qt" ] && VAL=yes
1492         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1493             CFG_GIF="$VAL"
1494         else
1495             UNKNOWN_OPT=yes
1496         fi
1497         ;;
1498     sm)
1499         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1500             CFG_SM="$VAL"
1501         else
1502             UNKNOWN_OPT=yes
1503         fi
1504
1505         ;;
1506     xinerama)
1507         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1508             CFG_XINERAMA="$VAL"
1509         else
1510             UNKNOWN_OPT=yes
1511         fi
1512         ;;
1513     xshape)
1514         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1515             CFG_XSHAPE="$VAL"
1516         else
1517             UNKNOWN_OPT=yes
1518         fi
1519         ;;
1520     xsync)
1521         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1522             CFG_XSYNC="$VAL"
1523         else
1524             UNKNOWN_OPT=yes
1525         fi
1526         ;;
1527     xinput)
1528         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1529             CFG_XINPUT="$VAL"
1530         else
1531             UNKNOWN_OPT=yes
1532         fi
1533         ;;
1534     stl)
1535         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1536             CFG_STL="$VAL"
1537         else
1538             UNKNOWN_OPT=yes
1539         fi
1540         ;;
1541     pch)
1542         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1543             CFG_PRECOMPILE="$VAL"
1544         else
1545             UNKNOWN_OPT=yes
1546         fi
1547         ;;
1548     separate-debug-info)
1549         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1550             CFG_SEPARATE_DEBUG_INFO="$VAL"
1551         else
1552             UNKNOWN_OPT=yes
1553         fi
1554         ;;
1555     reduce-exports)
1556         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1557             CFG_REDUCE_EXPORTS="$VAL"
1558         else
1559             UNKNOWN_OPT=yes
1560         fi
1561         ;;
1562     mmx)
1563         if [ "$VAL" = "no" ]; then
1564             CFG_MMX="$VAL"
1565         else
1566             UNKNOWN_OPT=yes
1567         fi
1568         ;;
1569     3dnow)
1570         if [ "$VAL" = "no" ]; then
1571             CFG_3DNOW="$VAL"
1572         else
1573             UNKNOWN_OPT=yes
1574         fi
1575         ;;
1576     sse)
1577         if [ "$VAL" = "no" ]; then
1578             CFG_SSE="$VAL"
1579         else
1580             UNKNOWN_OPT=yes
1581         fi
1582         ;;
1583     sse2)
1584         if [ "$VAL" = "no" ]; then
1585             CFG_SSE2="$VAL"
1586         else
1587             UNKNOWN_OPT=yes
1588         fi
1589         ;;
1590     iwmmxt)
1591         CFG_IWMMXT="yes"
1592         ;;
1593     reduce-relocations)
1594         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1595             CFG_REDUCE_RELOCATIONS="$VAL"
1596         else
1597             UNKNOWN_OPT=yes
1598         fi
1599         ;;
1600     freetype)
1601         [ "$VAL" = "qt" ] && VAL=yes
1602         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1603             CFG_QWS_FREETYPE="$VAL"
1604         else
1605             UNKNOWN_OPT=yes
1606         fi
1607         ;;
1608     zlib)
1609         [ "$VAL" = "qt" ] && VAL=yes
1610         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1611             CFG_ZLIB="$VAL"
1612         else
1613             UNKNOWN_OPT=yes
1614         fi
1615         # No longer supported:
1616         #[ "$VAL" = "no" ] && CFG_LIBPNG=no
1617         ;;
1618     sqlite)
1619         if [ "$VAL" = "system" ]; then
1620             CFG_SQLITE=system
1621         else
1622             UNKNOWN_OPT=yes
1623         fi
1624         ;;
1625     libpng)
1626         [ "$VAL" = "yes" ] && VAL=qt
1627         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1628             CFG_LIBPNG="$VAL"
1629         else
1630             UNKNOWN_OPT=yes
1631         fi
1632         ;;
1633     libjpeg)
1634         [ "$VAL" = "yes" ] && VAL=qt
1635         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1636             CFG_LIBJPEG="$VAL"
1637         else
1638             UNKNOWN_OPT=yes
1639         fi
1640         ;;
1641     libmng)
1642         [ "$VAL" = "yes" ] && VAL=qt
1643         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1644             CFG_LIBMNG="$VAL"
1645         else
1646             UNKNOWN_OPT=yes
1647         fi
1648         ;;
1649     libtiff)
1650         [ "$VAL" = "yes" ] && VAL=qt
1651         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1652             CFG_LIBTIFF="$VAL"
1653         else
1654             UNKNOWN_OPT=yes
1655         fi
1656         ;;
1657     nas-sound)
1658         if [ "$VAL" = "system" ] || [ "$VAL" = "no" ]; then
1659             CFG_NAS="$VAL"
1660         else
1661             UNKNOWN_OPT=yes
1662         fi
1663         ;;
1664     xcursor)
1665         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1666             CFG_XCURSOR="$VAL"
1667         else
1668             UNKNOWN_OPT=yes
1669         fi
1670         ;;
1671     xfixes)
1672         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1673             CFG_XFIXES="$VAL"
1674         else
1675             UNKNOWN_OPT=yes
1676         fi
1677         ;;
1678     xrandr)
1679         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1680             CFG_XRANDR="$VAL"
1681         else
1682             UNKNOWN_OPT=yes
1683         fi
1684         ;;
1685     xrender)
1686         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1687             CFG_XRENDER="$VAL"
1688         else
1689             UNKNOWN_OPT=yes
1690         fi
1691         ;;
1692     mitshm)
1693         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1694             CFG_MITSHM="$VAL"
1695         else
1696             UNKNOWN_OPT=yes
1697         fi
1698         ;;
1699     fontconfig)
1700         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1701             CFG_FONTCONFIG="$VAL"
1702         else
1703             UNKNOWN_OPT=yes
1704         fi
1705         ;;
1706     xkb)
1707         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1708             CFG_XKB="$VAL"
1709         else
1710             UNKNOWN_OPT=yes
1711         fi
1712         ;;
1713     cups)
1714         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1715             CFG_CUPS="$VAL"
1716         else
1717             UNKNOWN_OPT=yes
1718         fi
1719         ;;
1720     iconv)
1721         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1722             CFG_ICONV="$VAL"
1723         else
1724             UNKNOWN_OPT=yes
1725         fi
1726         ;;
1727     glib)
1728         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1729             CFG_GLIB="$VAL"
1730         else
1731             UNKNOWN_OPT=yes
1732         fi
1733         ;;
1734     gstreamer)
1735         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1736             CFG_GSTREAMER="$VAL"
1737         else
1738             UNKNOWN_OPT=yes
1739         fi
1740         ;;
1741     gtkstyle)
1742         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1743             CFG_QGTKSTYLE="$VAL"
1744         else
1745             UNKNOWN_OPT=yes
1746         fi
1747         ;;
1748     qdbus|dbus)
1749         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "linked" ]; then
1750             CFG_DBUS="$VAL"
1751         elif [ "$VAL" = "runtime" ]; then
1752             CFG_DBUS="yes"
1753         else
1754             UNKNOWN_OPT=yes
1755         fi
1756         ;;
1757     dbus-linked)
1758         if [ "$VAL" = "yes" ]; then
1759             CFG_DBUS="linked"
1760         else
1761             UNKNOWN_OPT=yes
1762         fi
1763         ;;
1764     nis)
1765         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1766             CFG_NIS="$VAL"
1767         else
1768             UNKNOWN_OPT=yes
1769         fi
1770         ;;
1771     largefile)
1772         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1773             CFG_LARGEFILE="$VAL"
1774         else
1775             UNKNOWN_OPT=yes
1776         fi
1777         ;;
1778     openssl)
1779         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1780             CFG_OPENSSL="$VAL"
1781         else
1782             UNKNOWN_OPT=yes
1783         fi
1784         ;;
1785     openssl-linked)
1786         if [ "$VAL" = "yes" ]; then
1787             CFG_OPENSSL="linked"
1788         else
1789             UNKNOWN_OPT=yes
1790         fi
1791         ;;
1792     ptmalloc)
1793         if [ "$VAL" = "yes" ]; then
1794             CFG_PTMALLOC="yes"
1795         else
1796             UNKNOWN_OPT=yes
1797         fi
1798         ;;
1799
1800     xmlpatterns)
1801         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1802             CFG_XMLPATTERNS="yes"
1803         else
1804             if [ "$VAL" = "no" ]; then
1805                 CFG_XMLPATTERNS="no"
1806             else
1807                 UNKNOWN_OPT=yes
1808             fi
1809         fi
1810         ;;
1811     script)
1812         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1813             CFG_SCRIPT="yes"
1814         else
1815             if [ "$VAL" = "no" ]; then
1816                 CFG_SCRIPT="no"
1817             else
1818                 UNKNOWN_OPT=yes
1819             fi
1820         fi
1821         ;;
1822     scripttools)
1823         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1824             CFG_SCRIPTTOOLS="yes"
1825         else
1826             if [ "$VAL" = "no" ]; then
1827                 CFG_SCRIPTTOOLS="no"
1828             else
1829                 UNKNOWN_OPT=yes
1830             fi
1831         fi
1832         ;;
1833     svg)
1834         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1835             CFG_SVG="yes"
1836         else
1837             if [ "$VAL" = "no" ]; then
1838                 CFG_SVG="no"
1839             else
1840                 UNKNOWN_OPT=yes
1841             fi
1842         fi
1843         ;;
1844     declarative)
1845         if [ "$VAL" = "yes" ]; then
1846             CFG_DECLARATIVE="yes"
1847         else
1848             if [ "$VAL" = "no" ]; then
1849                 CFG_DECLARATIVE="no"
1850             else
1851                 UNKNOWN_OPT=yes
1852             fi
1853         fi
1854         ;;
1855     webkit)
1856         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1857             CFG_WEBKIT="yes"
1858         else
1859             if [ "$VAL" = "no" ]; then
1860                 CFG_WEBKIT="no"
1861             else
1862                 UNKNOWN_OPT=yes
1863             fi
1864         fi
1865         ;;
1866     javascript-jit)
1867         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then 
1868             CFG_JAVASCRIPTCORE_JIT="$VAL"
1869         else
1870             UNKNOWN_OPT=yes
1871         fi
1872         ;;
1873     confirm-license)
1874         if [ "$VAL" = "yes" ]; then
1875             OPT_CONFIRM_LICENSE="$VAL"
1876         else
1877             UNKNOWN_OPT=yes
1878         fi
1879         ;;
1880     h|help)
1881         if [ "$VAL" = "yes" ]; then
1882             OPT_HELP="$VAL"
1883         else
1884             UNKNOWN_OPT=yes
1885         fi
1886         ;;
1887     sql-*|gfx-*|decoration-*|kbd-*|mouse-*)
1888         # if Qt style options were used, $VAL can be "no", "qt", or "plugin"
1889         # if autoconf style options were used, $VAL can be "yes" or "no"
1890         [ "$VAL" = "yes" ] && VAL=qt
1891         # now $VAL should be "no", "qt", or "plugin"... double-check
1892         if [ "$VAL" != "no" ] && [ "$VAL" != "qt" ] && [ "$VAL" != "plugin" ]; then
1893             UNKNOWN_OPT=yes
1894         fi
1895         # now $VAL is "no", "qt", or "plugin"
1896         OPT="$VAL"
1897         VAL=`echo $VAR | sed "s,^[^-]*-\([^-]*\).*,\1,"`
1898         VAR=`echo $VAR | sed "s,^\([^-]*\).*,\1,"`
1899
1900         # Grab the available values
1901         case "$VAR" in
1902         sql)
1903             avail="$CFG_SQL_AVAILABLE"
1904             ;;
1905         gfx)
1906             avail="$CFG_GFX_AVAILABLE"
1907             if [ "$OPT" = "plugin" ]; then
1908                 avail="$CFG_GFX_PLUGIN_AVAILABLE"
1909             fi
1910             ;;
1911         decoration)
1912             avail="$CFG_DECORATION_AVAILABLE"
1913             if [ "$OPT" = "plugin" ]; then
1914                 avail="$CFG_DECORATION_PLUGIN_AVAILABLE"
1915             fi
1916             ;;
1917         kbd)
1918             avail="$CFG_KBD_AVAILABLE"
1919             if [ "$OPT" = "plugin" ]; then
1920                 avail="$CFG_KBD_PLUGIN_AVAILABLE"
1921             fi
1922             ;;
1923         mouse)
1924             avail="$CFG_MOUSE_AVAILABLE"
1925             if [ "$OPT" = "plugin" ]; then
1926                 avail="$CFG_MOUSE_PLUGIN_AVAILABLE"
1927             fi
1928             ;;
1929         *)
1930             avail=""
1931             echo "BUG: Unhandled type $VAR used in $CURRENT_OPT"
1932             ;;
1933         esac
1934
1935         # Check that that user's value is available.
1936         found=no
1937         for d in $avail; do
1938             if [ "$VAL" = "$d" ]; then
1939                 found=yes
1940                 break
1941             fi
1942         done
1943         [ "$found" = yes ] || ERROR=yes
1944
1945         if [ "$VAR" = "sql" ]; then
1946             # set the CFG_SQL_driver
1947             eval "CFG_SQL_$VAL=\$OPT"
1948             continue
1949         fi
1950
1951         if [ "$OPT" = "plugin" ] || [ "$OPT" = "qt" ]; then
1952             if [ "$OPT" = "plugin" ]; then
1953                 [ "$VAR" = "decoration" ] && QMakeVar del "${VAR}s" "$VAL"
1954                 [ "$VAR" = "decoration" ] && CFG_DECORATION_ON=`echo "${CFG_DECORATION_ON} " | sed "s,${VAL} ,,g"` && CFG_DECORATION_PLUGIN="$CFG_DECORATION_PLUGIN ${VAL}"
1955                 [ "$VAR" = "kbd" ] && QMakeVar del "${VAR}s" "$VAL"
1956                 [ "$VAR" = "kbd" ] && CFG_KBD_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"` && CFG_KBD_PLUGIN="$CFG_KBD_PLUGIN ${VAL}"
1957                 [ "$VAR" = "mouse" ] && QMakeVar del "${VAR}s" "$VAL"
1958                 [ "$VAR" = "mouse" ] && CFG_MOUSE_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"` && CFG_MOUSE_PLUGIN="$CFG_MOUSE_PLUGIN ${VAL}"
1959                 [ "$VAR" = "gfx" ] && QMakeVar del "${VAR}s" "$VAL"
1960                 [ "$VAR" = "gfx" ] && CFG_GFX_ON=`echo "${CFG_GFX_ON} " | sed "s,${VAL} ,,g"` && CFG_GFX_PLUGIN="${CFG_GFX_PLUGIN} ${VAL}"
1961                 VAR="${VAR}-${OPT}"
1962             else
1963                 if [ "$VAR" = "gfx" ] || [ "$VAR" = "kbd" ] || [ "$VAR" = "decoration" ] || [ "$VAR" = "mouse" ]; then
1964                     [ "$VAR" = "gfx" ] && CFG_GFX_ON="$CFG_GFX_ON $VAL"
1965                     [ "$VAR" = "kbd" ] && CFG_KBD_ON="$CFG_KBD_ON $VAL"
1966                     [ "$VAR" = "decoration" ] && CFG_DECORATION_ON="$CFG_DECORATION_ON $VAL"
1967                     [ "$VAR" = "mouse" ] && CFG_MOUSE_ON="$CFG_MOUSE_ON $VAL"
1968                     VAR="${VAR}-driver"
1969                 fi
1970             fi
1971             QMakeVar add "${VAR}s" "${VAL}"
1972         elif [ "$OPT" = "no" ]; then
1973             PLUG_VAR="${VAR}-plugin"
1974             if [ "$VAR" = "gfx" ] || [ "$VAR" = "kbd" ] || [ "$VAR" = "mouse" ]; then
1975                 IN_VAR="${VAR}-driver"
1976             else
1977                 IN_VAR="${VAR}"
1978             fi
1979             [ "$VAR" = "decoration" ] && CFG_DECORATION_ON=`echo "${CFG_DECORATION_ON} " | sed "s,${VAL} ,,g"`
1980             [ "$VAR" = "gfx" ] && CFG_GFX_ON=`echo "${CFG_GFX_ON} " | sed "s,${VAL} ,,g"`
1981             [ "$VAR" = "kbd" ] && CFG_KBD_ON=`echo "${CFG_KBD_ON} " | sed "s,${VAL} ,,g"`
1982             [ "$VAR" = "mouse" ] && CFG_MOUSE_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"`
1983             QMakeVar del "${IN_VAR}s" "$VAL"
1984             QMakeVar del "${PLUG_VAR}s" "$VAL"
1985         fi
1986         if [ "$ERROR" = "yes" ]; then
1987            echo "$CURRENT_OPT: unknown argument"
1988            OPT_HELP=yes
1989         fi
1990         ;;
1991     v|verbose)
1992         if [ "$VAL" = "yes" ]; then
1993             if [ "$OPT_VERBOSE" = "$VAL" ]; then            # takes two verboses to turn on qmake debugs
1994                 QMAKE_SWITCHES="$QMAKE_SWITCHES -d"
1995             else
1996                 OPT_VERBOSE=yes
1997             fi
1998         elif [ "$VAL" = "no" ]; then
1999             if [ "$OPT_VERBOSE" = "$VAL" ] && echo "$QMAKE_SWITCHES" | grep ' -d' >/dev/null 2>&1; then
2000                 QMAKE_SWITCHES=`echo $QMAKE_SWITCHES | sed "s, -d,,"`
2001             else
2002                 OPT_VERBOSE=no
2003             fi
2004         else
2005             UNKNOWN_OPT=yes
2006         fi
2007         ;;
2008     fast)
2009         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2010             OPT_FAST="$VAL"
2011         else
2012             UNKNOWN_OPT=yes
2013         fi
2014         ;;
2015     rpath)
2016         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2017             CFG_RPATH="$VAL"
2018         else
2019             UNKNOWN_OPT=yes
2020         fi
2021         ;;
2022     add_define)
2023         D_FLAGS="$D_FLAGS \"$VAL\""
2024         ;;
2025     add_ipath)
2026         I_FLAGS="$I_FLAGS -I\"${VAL}\""
2027         ;;
2028     add_isystempath)
2029         I_FLAGS="$I_FLAGS -isystem \"${VAL}\""
2030         ;;
2031     add_lpath)
2032         L_FLAGS="$L_FLAGS -L\"${VAL}\""
2033         ;;
2034     add_rpath)
2035         RPATH_FLAGS="$RPATH_FLAGS \"${VAL}\""
2036         ;;
2037     add_link)
2038         l_FLAGS="$l_FLAGS -l\"${VAL}\""
2039         ;;
2040     add_fpath)
2041         if [ "$PLATFORM_MAC" = "yes" ]; then
2042             L_FLAGS="$L_FLAGS -F\"${VAL}\""
2043             I_FLAGS="$I_FLAGS -F\"${VAL}\""
2044         else
2045             UNKNOWN_OPT=yes
2046         fi
2047         ;;
2048     add_framework)
2049         if [ "$PLATFORM_MAC" = "yes" ]; then
2050             l_FLAGS="$l_FLAGS -framework \"${VAL}\""
2051         else
2052             UNKNOWN_OPT=yes
2053         fi
2054         ;;
2055     silent)
2056         CFG_SILENT="$VAL"
2057         ;;
2058     phonon)
2059         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2060             CFG_PHONON="$VAL"
2061         else
2062             UNKNOWN_OPT=yes
2063         fi
2064         ;;
2065     phonon-backend)
2066         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2067             CFG_PHONON_BACKEND="$VAL"
2068         else
2069             UNKNOWN_OPT=yes
2070         fi
2071         ;;
2072     multimedia)
2073         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2074             CFG_MULTIMEDIA="$VAL"
2075         else
2076             UNKNOWN_OPT=yes
2077         fi
2078         ;;
2079     *)
2080         UNKNOWN_OPT=yes
2081         ;;
2082     esac
2083     if [ "$UNKNOWN_OPT" = "yes" ]; then
2084         echo "${CURRENT_OPT}: invalid command-line switch"
2085         OPT_HELP=yes
2086         ERROR=yes
2087     fi
2088 done
2089
2090 if [ "$CFG_QCONFIG" != "full" ] && [ "$CFG_QT3SUPPORT" = "yes" ]; then
2091     echo "Warning: '-qconfig $CFG_QCONFIG' will disable the qt3support library."
2092     CFG_QT3SUPPORT="no"
2093 fi
2094
2095 # update QT_CONFIG to show our current predefined configuration
2096 case "$CFG_QCONFIG" in
2097 minimal|small|medium|large|full)
2098     # these are a sequence of increasing functionality
2099     for c in minimal small medium large full; do
2100         QT_CONFIG="$QT_CONFIG $c-config"
2101         [ "$CFG_QCONFIG" = $c ] && break
2102     done
2103     ;;
2104 *)
2105     # not known to be sufficient for anything
2106     if [ '!' -f "$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h" ]; then
2107         echo >&2 "Error: configuration file not found:"
2108         echo >&2 "  $relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h"
2109         OPT_HELP=yes
2110     fi
2111 esac
2112
2113 #-------------------------------------------------------------------------------
2114 # build tree initialization
2115 #-------------------------------------------------------------------------------
2116
2117 # where to find which..
2118 unixtests="$relpath/config.tests/unix"
2119 mactests="$relpath/config.tests/mac"
2120 WHICH="$unixtests/which.test"
2121
2122 PERL=`$WHICH perl 2>/dev/null`
2123
2124 # find out which awk we want to use, prefer gawk, then nawk, then regular awk
2125 AWK=
2126 for e in gawk nawk awk; do
2127     if "$WHICH" $e >/dev/null 2>&1 && ( $e -f /dev/null /dev/null ) >/dev/null 2>&1; then
2128         AWK=$e
2129         break
2130     fi
2131 done
2132
2133 # find perl
2134 PERL="/usr/bin/perl"
2135 if "$WHICH" perl >/dev/null 2>&1 && ( perl /dev/null ) >/dev/null 2>&1; then
2136     PERL=`$WHICH perl`
2137 fi
2138
2139 ### skip this if the user just needs help...
2140 if [ "$OPT_HELP" != "yes" ]; then
2141
2142 # is this a shadow build?
2143 if [ "$OPT_SHADOW" = "maybe" ]; then
2144     OPT_SHADOW=no
2145     if [ "$relpath" != "$outpath" ] && [ '!' -f "$outpath/configure" ]; then
2146         if [ -h "$outpath" ]; then
2147             [ "$relpath" -ef "$outpath" ] || OPT_SHADOW=yes
2148         else
2149             OPT_SHADOW=yes
2150         fi
2151     fi
2152 fi
2153 if [ "$OPT_SHADOW" = "yes" ]; then
2154     if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" -o -f "$relpath/src/corelib/global/qconfig.cpp" ]; then
2155         echo >&2 "You cannot make a shadow build from a source tree containing a previous build."
2156         echo >&2 "Cannot proceed."
2157         exit 1
2158     fi
2159     [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..."
2160 fi
2161
2162 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
2163     echo
2164     echo "WARNING: -debug-and-release is not supported anymore on Qt/X11 and Qt for Embedded Linux"
2165     echo "By default, Qt is built in release mode with separate debug information, so"
2166     echo "-debug-and-release is not necessary anymore"
2167     echo
2168 fi
2169
2170 # detect build style
2171 if [ "$CFG_DEBUG" = "auto" ]; then
2172     if [ "$PLATFORM_MAC" = "yes" ]; then
2173         CFG_DEBUG_RELEASE=yes
2174         CFG_DEBUG=yes
2175     elif [ "$CFG_DEV" = "yes" ]; then
2176         CFG_DEBUG_RELEASE=no
2177         CFG_DEBUG=yes
2178     else
2179         CFG_DEBUG_RELEASE=no
2180         CFG_DEBUG=no
2181     fi
2182 fi
2183 if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
2184     QMAKE_CONFIG="$QMAKE_CONFIG build_all"
2185 fi
2186
2187 if [ "$CFG_SILENT" = "yes" ]; then
2188     QMAKE_CONFIG="$QMAKE_CONFIG silent"
2189 fi
2190
2191 # if the source tree is different from the build tree,
2192 # symlink or copy part of the sources
2193 if [ "$OPT_SHADOW" = "yes" ]; then
2194     echo "Preparing build tree..."
2195
2196     if [ -z "$PERL" ]; then
2197         echo
2198         echo "You need perl in your PATH to make a shadow build."
2199         echo "Cannot proceed."
2200         exit 1
2201     fi
2202
2203     [ -d "$outpath/bin" ] || mkdir -p "$outpath/bin"
2204
2205     # symlink the qmake directory
2206     find "$relpath/qmake" | while read a; do
2207         my_a=`echo "$a" | sed "s,^${relpath}/,${outpath}/,"`
2208         if [ '!' -f "$my_a" ]; then
2209             if [ -d "$a" ]; then
2210                 # directories are created...
2211                 mkdir -p "$my_a"
2212             else
2213                 a_dir=`dirname "$my_a"`
2214                 [ -d "$a_dir" ] || mkdir -p "$a_dir"
2215                 # ... and files are symlinked
2216                 case `basename "$a"` in
2217                 *.o|*.d|GNUmakefile*|qmake)
2218                     ;;
2219                 *)
2220                     rm -f "$my_a"
2221                     ln -s "$a" "$my_a"
2222                     ;;
2223                 esac
2224             fi
2225         fi
2226     done
2227
2228     # make a syncqt script that can be used in the shadow
2229     rm -f "$outpath/bin/syncqt"
2230     if [ -x "$relpath/bin/syncqt" ]; then
2231         mkdir -p "$outpath/bin"
2232         echo "#!/bin/sh" >"$outpath/bin/syncqt"
2233         echo "QTDIR=\"$relpath\"; export QTDIR" >>"$outpath/bin/syncqt"
2234         echo "perl \"$relpath/bin/syncqt\" -outdir \"$outpath\" $*" >>"$outpath/bin/syncqt"
2235         chmod 755 "$outpath/bin/syncqt"
2236     fi
2237
2238     # symlink the mkspecs directory
2239     mkdir -p "$outpath/mkspecs"
2240     rm -f "$outpath"/mkspecs/*
2241     ln -s "$relpath"/mkspecs/* "$outpath/mkspecs"
2242     rm -f "$outpath/mkspecs/default"
2243
2244     # symlink the doc directory
2245     rm -rf "$outpath/doc"
2246     ln -s "$relpath/doc" "$outpath/doc"
2247
2248     # make sure q3porting.xml can be found
2249     mkdir -p "$outpath/tools/porting/src"
2250     rm -f "$outpath/tools/porting/src/q3porting.xml"
2251     ln -s "$relpath/tools/porting/src/q3porting.xml" "$outpath/tools/porting/src"
2252 fi
2253
2254 # symlink fonts to be able to run application from build directory
2255 if [ "$PLATFORM_QWS" = "yes" ] && [ ! -e "${outpath}/lib/fonts" ]; then
2256     if [ "$PLATFORM" = "$XPLATFORM" ]; then
2257         mkdir -p "${outpath}/lib"
2258         ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts"
2259     fi
2260 fi
2261
2262 if [ "$OPT_FAST" = "auto" ]; then
2263    if [ '!' -z "$AWK" ] && [ "$CFG_DEV" = "yes" ]; then
2264        OPT_FAST=yes
2265    else
2266        OPT_FAST=no
2267    fi
2268 fi
2269
2270 # find a make command
2271 if [ -z "$MAKE" ]; then
2272     MAKE=
2273     for mk in gmake make; do
2274         if "$WHICH" $mk >/dev/null 2>&1; then
2275             MAKE=`"$WHICH" $mk`
2276             break
2277         fi
2278     done
2279     if [ -z "$MAKE" ]; then
2280         echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH."
2281         echo >&2 "Cannot proceed."
2282         exit 1
2283     fi
2284     # export MAKE, we need it later in the config.tests
2285     export MAKE
2286 fi
2287
2288 fi ### help
2289
2290 #-------------------------------------------------------------------------------
2291 # auto-detect all that hasn't been specified in the arguments
2292 #-------------------------------------------------------------------------------
2293
2294 [ "$PLATFORM_QWS" = "yes" -a "$CFG_EMBEDDED" = "no" ] && CFG_EMBEDDED=auto
2295 if [ "$CFG_EMBEDDED" != "no" ]; then
2296     case "$UNAME_SYSTEM:$UNAME_RELEASE" in
2297     Darwin:*)
2298         [ -z "$PLATFORM" ] && PLATFORM=qws/macx-generic-g++
2299         if [ -z "$XPLATFORM" ]; then
2300             [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2301             XPLATFORM="qws/macx-$CFG_EMBEDDED-g++"
2302         fi
2303         ;;
2304     FreeBSD:*)
2305         [ -z "$PLATFORM" ] && PLATFORM=qws/freebsd-generic-g++
2306         if [ -z "$XPLATFORM" ]; then
2307             [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2308             XPLATFORM="qws/freebsd-$CFG_EMBEDDED-g++"
2309         fi
2310         ;;
2311     SunOS:5*)
2312         [ -z "$PLATFORM" ] && PLATFORM=qws/solaris-generic-g++
2313         if [ -z "$XPLATFORM" ]; then
2314             [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2315             XPLATFORM="qws/solaris-$CFG_EMBEDDED-g++"
2316         fi
2317         ;;
2318     Linux:*)
2319         if [ -z "$PLATFORM" ]; then
2320             case "$UNAME_MACHINE" in
2321             *86)
2322                 PLATFORM=qws/linux-x86-g++
2323                 ;;
2324             *86_64)
2325                 PLATFORM=qws/linux-x86_64-g++
2326                 ;;
2327             *)
2328                 PLATFORM=qws/linux-generic-g++
2329                 ;;
2330             esac
2331         fi
2332         if [ -z "$XPLATFORM" ]; then
2333             if [ "$CFG_EMBEDDED" = "auto" ]; then
2334                 if [ -n "$CFG_ARCH" ]; then
2335                     CFG_EMBEDDED=$CFG_ARCH
2336                 else
2337                     case "$UNAME_MACHINE" in
2338                     *86)
2339                         CFG_EMBEDDED=x86
2340                         ;;
2341                     *86_64)
2342                         CFG_EMBEDDED=x86_64
2343                         ;;
2344                     *)
2345                         CFG_EMBEDDED=generic
2346                         ;;
2347                     esac
2348                 fi
2349             fi
2350             XPLATFORM="qws/linux-$CFG_EMBEDDED-g++"
2351         fi
2352         ;;
2353     QNX:*)
2354         [ -z "$PLATFORM" ] && PLATFORM=unsupported/qws/qnx-generic-g++
2355         if [ -z "$XPLATFORM" ]; then
2356             [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2357             XPLATFORM="unsupported/qws/qnx-$CFG_EMBEDDED-g++"
2358         fi
2359         ;;
2360     CYGWIN*:*)
2361         CFG_EMBEDDED=x86
2362         ;;
2363     *)
2364         echo "Qt for Embedded Linux is not supported on this platform. Disabling."
2365         CFG_EMBEDDED=no
2366         PLATFORM_QWS=no
2367         ;;
2368     esac
2369 fi
2370 if [ -z "$PLATFORM" ]; then
2371     PLATFORM_NOTES=
2372     case "$UNAME_SYSTEM:$UNAME_RELEASE" in
2373      Darwin:*)
2374         if [ "$PLATFORM_MAC" = "yes" ]; then
2375           PLATFORM=macx-g++
2376         # PLATFORM=macx-xcode
2377         else
2378           PLATFORM=darwin-g++
2379         fi
2380         ;;
2381      AIX:*)
2382         #PLATFORM=aix-g++
2383         #PLATFORM=aix-g++-64
2384         PLATFORM=aix-xlc
2385         #PLATFORM=aix-xlc-64
2386         PLATFORM_NOTES="
2387             - Also available for AIX: aix-g++ aix-g++-64 aix-xlc-64
2388         "
2389         ;;
2390      GNU:*)
2391         PLATFORM=hurd-g++
2392         ;;
2393      dgux:*)
2394         PLATFORM=dgux-g++
2395         ;;
2396 #     DYNIX/ptx:4*)
2397 #       PLATFORM=dynix-g++
2398 #       ;;
2399      ULTRIX:*)
2400         PLATFORM=ultrix-g++
2401         ;;
2402      FreeBSD:*)
2403         PLATFORM=freebsd-g++
2404         PLATFORM_NOTES="
2405             - Also available for FreeBSD: freebsd-icc
2406         "
2407         ;;
2408      OpenBSD:*)
2409         PLATFORM=openbsd-g++
2410         ;;
2411      NetBSD:*)
2412         PLATFORM=netbsd-g++
2413         ;;
2414      BSD/OS:*|BSD/386:*)
2415         PLATFORM=bsdi-g++
2416         ;;
2417      IRIX*:*)
2418         #PLATFORM=irix-g++
2419         PLATFORM=irix-cc
2420         #PLATFORM=irix-cc-64
2421         PLATFORM_NOTES="
2422             - Also available for IRIX: irix-g++ irix-cc-64
2423         "
2424         ;;
2425      HP-UX:*)
2426         case "$UNAME_MACHINE" in
2427             ia64)
2428                 #PLATFORM=hpuxi-acc-32
2429                 PLATFORM=hpuxi-acc-64
2430                 PLATFORM_NOTES="
2431                     - Also available for HP-UXi: hpuxi-acc-32
2432                 "
2433             ;;
2434             *)
2435                 #PLATFORM=hpux-g++
2436                 PLATFORM=hpux-acc
2437                 #PLATFORM=hpux-acc-64
2438                 #PLATFORM=hpux-cc
2439                 #PLATFORM=hpux-acc-o64
2440                 PLATFORM_NOTES="
2441                     - Also available for HP-UX: hpux-g++ hpux-acc-64 hpux-acc-o64
2442                 "
2443             ;;
2444         esac
2445         ;;
2446      OSF1:*)
2447         #PLATFORM=tru64-g++
2448         PLATFORM=tru64-cxx
2449         PLATFORM_NOTES="
2450             - Also available for Tru64: tru64-g++
2451         "
2452         ;;
2453      Linux:*)
2454         case "$UNAME_MACHINE" in
2455             x86_64|s390x|ppc64)
2456                 PLATFORM=linux-g++-64
2457                 ;;
2458             *)
2459                 PLATFORM=linux-g++
2460                 ;;
2461         esac
2462         PLATFORM_NOTES="
2463             - Also available for Linux: linux-kcc linux-icc linux-cxx
2464         "
2465         ;;
2466      SunOS:5*)
2467         #PLATFORM=solaris-g++
2468         PLATFORM=solaris-cc
2469         #PLATFORM=solaris-cc64
2470         PLATFORM_NOTES="
2471             - Also available for Solaris: solaris-g++ solaris-cc-64
2472         "
2473         ;;
2474      ReliantUNIX-*:*|SINIX-*:*)
2475         PLATFORM=reliant-cds
2476         #PLATFORM=reliant-cds-64
2477         PLATFORM_NOTES="
2478             - Also available for Reliant UNIX: reliant-cds-64
2479         "
2480         ;;
2481      CYGWIN*:*)
2482         PLATFORM=cygwin-g++
2483         ;;
2484      LynxOS*:*)
2485         PLATFORM=lynxos-g++
2486         ;;
2487      OpenUNIX:*)
2488         #PLATFORM=unixware-g++
2489         PLATFORM=unixware-cc
2490         PLATFORM_NOTES="
2491             - Also available for OpenUNIX: unixware-g++
2492         "
2493         ;;
2494      UnixWare:*)
2495         #PLATFORM=unixware-g++
2496         PLATFORM=unixware-cc
2497         PLATFORM_NOTES="
2498             - Also available for UnixWare: unixware-g++
2499         "
2500         ;;
2501      SCO_SV:*)
2502         #PLATFORM=sco-g++
2503         PLATFORM=sco-cc
2504         PLATFORM_NOTES="
2505             - Also available for SCO OpenServer: sco-g++
2506         "
2507         ;;
2508      UNIX_SV:*)
2509         PLATFORM=unixware-g++
2510         ;;
2511      QNX:*)
2512         PLATFORM=unsupported/qnx-g++
2513         ;;
2514      *)
2515         if [ "$OPT_HELP" != "yes" ]; then
2516             echo
2517             for p in $PLATFORMS; do
2518                 echo "    $relconf $* -platform $p"
2519             done
2520             echo >&2
2521             echo "   The build script does not currently recognize all" >&2
2522             echo "   platforms supported by Qt." >&2
2523             echo "   Rerun this script with a -platform option listed to" >&2
2524             echo "   set the system/compiler combination you use." >&2
2525             echo >&2
2526             exit 2
2527         fi
2528     esac
2529 fi
2530
2531 if [ "$PLATFORM_QWS" = "yes" ]; then
2532     CFG_SM=no
2533     PLATFORMS=`find "$relpath/mkspecs/qws" | sed "s,$relpath/mkspecs/qws/,,"`
2534 else
2535     PLATFORMS=`find "$relpath/mkspecs/" -type f | grep -v qws | sed "s,$relpath/mkspecs/qws/,,"`
2536 fi
2537
2538 [ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM"
2539 if [ -d "$PLATFORM" ]; then
2540   QMAKESPEC="$PLATFORM"
2541 else
2542   QMAKESPEC="$relpath/mkspecs/${PLATFORM}"
2543 fi
2544 if [ -d "$XPLATFORM" ]; then
2545   XQMAKESPEC="$XPLATFORM"
2546 else
2547   XQMAKESPEC="$relpath/mkspecs/${XPLATFORM}"
2548 fi
2549 if [ "$PLATFORM" != "$XPLATFORM" ]; then
2550     QT_CROSS_COMPILE=yes
2551     QMAKE_CONFIG="$QMAKE_CONFIG cross_compile"
2552 fi
2553
2554 if [ "$PLATFORM_MAC" = "yes" ]; then
2555    if [ `basename $QMAKESPEC` = "macx-xcode" ] || [ `basename $XQMAKESPEC` = "macx-xcode" ]; then
2556       echo >&2
2557       echo "   Platform 'macx-xcode' should not be used when building Qt/Mac." >&2
2558       echo "   Please build Qt/Mac with 'macx-g++', then if you would like to" >&2
2559       echo "   use mac-xcode on your application code it can link to a Qt/Mac" >&2
2560       echo "   built with 'macx-g++'" >&2
2561       echo >&2
2562       exit 2
2563     fi
2564 fi
2565
2566 # check specified platforms are supported
2567 if [ '!' -d "$QMAKESPEC" ]; then
2568     echo
2569     echo "   The specified system/compiler is not supported:"
2570     echo
2571     echo "      $QMAKESPEC"
2572     echo
2573     echo "   Please see the README file for a complete list."
2574     echo
2575     exit 2
2576 fi
2577 if [ '!' -d "$XQMAKESPEC" ]; then
2578     echo
2579     echo "   The specified system/compiler is not supported:"
2580     echo
2581     echo "      $XQMAKESPEC"
2582     echo
2583     echo "   Please see the README file for a complete list."
2584     echo
2585     exit 2
2586 fi
2587 if [ '!' -f "${XQMAKESPEC}/qplatformdefs.h" ]; then
2588     echo
2589     echo "   The specified system/compiler port is not complete:"
2590     echo
2591     echo "      $XQMAKESPEC/qplatformdefs.h"
2592     echo
2593     echo "   Please contact qt-bugs@trolltech.com."
2594     echo
2595     exit 2
2596 fi
2597
2598 # now look at the configs and figure out what platform we are config'd for
2599 [ "$CFG_EMBEDDED" = "no" ] \
2600   && [ '!' -z "`getQMakeConf \"$XQMAKESPEC\" | grep QMAKE_LIBS_X11 | awk '{print $3;}'`" ] \
2601   && PLATFORM_X11=yes
2602 ### echo "$XQMAKESPEC" | grep mkspecs/qws >/dev/null 2>&1 && PLATFORM_QWS=yes
2603
2604 if [ "$UNAME_SYSTEM" = "SunOS" ]; then
2605     # Solaris 2.5 and 2.6 have libposix4, which was renamed to librt for Solaris 7 and up
2606     if echo $UNAME_RELEASE | grep "^5\.[5|6]" >/dev/null 2>&1; then
2607         sed -e "s,-lrt,-lposix4," "$XQMAKESPEC/qmake.conf" > "$XQMAKESPEC/qmake.conf.new"
2608         mv "$XQMAKESPEC/qmake.conf.new" "$XQMAKESPEC/qmake.conf"
2609     fi
2610 fi
2611
2612 #-------------------------------------------------------------------------------
2613 # determine the system architecture
2614 #-------------------------------------------------------------------------------
2615 if [ "$OPT_VERBOSE" = "yes" ]; then
2616     echo "Determining system architecture... ($UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_MACHINE)"
2617 fi
2618
2619 if [ "$CFG_EMBEDDED" != "no" -a "$CFG_EMBEDDED" != "auto" ] && [ -n "$CFG_ARCH" ]; then
2620     if [ "$CFG_ARCH" != "$CFG_EMBEDDED" ]; then
2621         echo ""
2622         echo "You have specified a target architecture with -embedded and -arch."
2623         echo "The two architectures you have specified are different, so we can"
2624         echo "not proceed. Either set both to be the same, or only use -embedded."
2625         echo ""
2626         exit 1
2627     fi
2628 fi
2629
2630 if [ "$CFG_RTOS_ENABLED" = "no" ]; then
2631     case `basename "$XPLATFORM"` in
2632         qnx-* | vxworks-*)
2633             echo ""
2634             echo "You are not licensed for Qt for `basename $XPLATFORM`."
2635             echo ""
2636             echo "Please contact qt-info@nokia.com to upgrade your license to"
2637             echo "include this platform, or install the Qt Open Source Edition"
2638             echo "if you intend to develop free software."
2639             exit 1
2640             ;;
2641     esac
2642 fi
2643
2644 if [ -z "${CFG_HOST_ARCH}" ]; then
2645     case "$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_MACHINE" in
2646     IRIX*:*:*)
2647         CFG_HOST_ARCH=`uname -p`
2648         if [ "$OPT_VERBOSE" = "yes" ]; then
2649             echo "    SGI ($CFG_HOST_ARCH)"
2650         fi
2651         ;;
2652     SunOS:5*:*)
2653         case "$UNAME_MACHINE" in
2654         sun4u*|sun4v*)
2655             if [ "$OPT_VERBOSE" = "yes" ]; then
2656                 echo "    Sun SPARC (sparc)"
2657             fi
2658             CFG_HOST_ARCH=sparc
2659             ;;
2660         i86pc)
2661             case "$PLATFORM" in
2662             *-64)
2663                 if [ "$OPT_VERBOSE" = "yes" ]; then
2664                     echo "    64-bit AMD 80x86 (x86_64)"
2665                 fi
2666                 CFG_HOST_ARCH=x86_64
2667                 ;;
2668             *)
2669                 if [ "$OPT_VERBOSE" = "yes" ]; then
2670                     echo "    32-bit Intel 80x86 (i386)"
2671                 fi
2672                 CFG_HOST_ARCH=i386
2673                 ;;
2674             esac
2675         esac
2676         ;;
2677     Darwin:*:*)
2678         case "$UNAME_MACHINE" in
2679             Power?Macintosh)
2680                 if [ "$OPT_VERBOSE" = "yes" ]; then
2681                     echo "    32-bit Apple PowerPC (powerpc)"
2682                 fi
2683                 ;;
2684             x86)
2685                 if [ "$OPT_VERBOSE" = "yes" ]; then
2686                     echo "    32-bit Intel 80x86 (i386)"
2687                 fi
2688                 ;;
2689         esac
2690         CFG_HOST_ARCH=macosx
2691         ;;
2692     AIX:*:00????????00)
2693         if [ "$OPT_VERBOSE" = "yes" ]; then
2694         echo "    64-bit IBM PowerPC (powerpc)"
2695         fi
2696         CFG_HOST_ARCH=powerpc
2697         ;;
2698     HP-UX:*:9000*)
2699         if [ "$OPT_VERBOSE" = "yes" ]; then
2700             echo "    HP PA-RISC (parisc)"
2701         fi
2702         CFG_HOST_ARCH=parisc
2703         ;;
2704     *:*:i?86)
2705         if [ "$OPT_VERBOSE" = "yes" ]; then
2706             echo "    32-bit Intel 80x86 (i386)"
2707         fi
2708         CFG_HOST_ARCH=i386
2709         ;;
2710     *:*:x86_64|*:*:amd64)
2711         if [ "$PLATFORM" = "linux-g++-32" -o "$PLATFORM" = "linux-icc-32" ]; then
2712             if [ "$OPT_VERBOSE" = "yes" ]; then
2713                 echo "    32 bit on 64-bit AMD 80x86 (i386)"
2714             fi
2715             CFG_HOST_ARCH=i386
2716         else
2717             if [ "$OPT_VERBOSE" = "yes" ]; then
2718                 echo "    64-bit AMD 80x86 (x86_64)"
2719             fi
2720             CFG_HOST_ARCH=x86_64
2721         fi
2722         ;;
2723     *:*:ppc)
2724         if [ "$OPT_VERBOSE" = "yes" ]; then
2725             echo "    32-bit PowerPC (powerpc)"
2726         fi
2727         CFG_HOST_ARCH=powerpc
2728         ;;
2729     *:*:ppc64)
2730         if [ "$OPT_VERBOSE" = "yes" ]; then
2731             echo "    64-bit PowerPC (powerpc)"
2732         fi
2733         CFG_HOST_ARCH=powerpc
2734         ;;
2735     *:*:s390*)
2736         if [ "$OPT_VERBOSE" = "yes" ]; then
2737             echo "    IBM S/390 (s390)"
2738         fi
2739         CFG_HOST_ARCH=s390
2740         ;;
2741     *:*:arm*)
2742         if [ "$OPT_VERBOSE" = "yes" ]; then
2743             echo "    ARM (arm)"
2744         fi
2745         CFG_HOST_ARCH=arm
2746         ;;
2747     Linux:*:sparc*)
2748         if [ "$OPT_VERBOSE" = "yes" ]; then
2749             echo "    Linux on SPARC"
2750         fi
2751         CFG_HOST_ARCH=sparc
2752         ;;
2753     QNX:*:*)
2754         case "$UNAME_MACHINE" in
2755         x86pc)
2756             if [ "$OPT_VERBOSE" = "yes" ]; then
2757                 echo "    QNX on Intel 80x86 (i386)"
2758             fi
2759             CFG_HOST_ARCH=i386
2760             ;;
2761         esac
2762         ;;
2763     *:*:*)
2764         if [ "$OPT_VERBOSE" = "yes" ]; then
2765             echo "    Trying '$UNAME_MACHINE'..."
2766         fi
2767         CFG_HOST_ARCH="$UNAME_MACHINE"
2768         ;;
2769     esac
2770 fi
2771
2772 if [ "$PLATFORM" != "$XPLATFORM" -a "$CFG_EMBEDDED" != "no" ]; then
2773     if [ -n "$CFG_ARCH" ]; then
2774         CFG_EMBEDDED=$CFG_ARCH
2775     fi
2776
2777     case "$CFG_EMBEDDED" in
2778     x86)
2779         CFG_ARCH=i386
2780         ;;
2781     x86_64)
2782         CFG_ARCH=x86_64
2783         ;;
2784     ipaq|sharp)
2785         CFG_ARCH=arm
2786         ;;
2787     dm7000)
2788         CFG_ARCH=powerpc
2789         ;;
2790     dm800)
2791         CFG_ARCH=mips
2792         ;;
2793     sh4al)
2794         CFG_ARCH=sh4a
2795         ;;
2796     *)
2797         CFG_ARCH="$CFG_EMBEDDED"
2798         ;;
2799     esac
2800 elif [ "$PLATFORM_MAC" = "yes" ] || [ -z "$CFG_ARCH" ]; then
2801     CFG_ARCH=$CFG_HOST_ARCH
2802 fi
2803
2804 if [ -d "$relpath/src/corelib/arch/$CFG_ARCH" ]; then
2805     if [ "$OPT_VERBOSE" = "yes" ]; then
2806         echo "    '$CFG_ARCH' is supported"
2807     fi
2808 else
2809     if [ "$OPT_VERBOSE" = "yes" ]; then
2810         echo "    '$CFG_ARCH' is unsupported, using 'generic'"
2811     fi
2812     CFG_ARCH=generic
2813 fi
2814 if [ "$CFG_HOST_ARCH" != "$CFG_ARCH" ]; then
2815     if [ -d "$relpath/src/corelib/arch/$CFG_HOST_ARCH" ]; then
2816         if [ "$OPT_VERBOSE" = "yes" ]; then
2817             echo "    '$CFG_HOST_ARCH' is supported"
2818         fi
2819     else
2820         if [ "$OPT_VERBOSE" = "yes" ]; then
2821             echo "    '$CFG_HOST_ARCH' is unsupported, using 'generic'"
2822         fi
2823         CFG_HOST_ARCH=generic
2824     fi
2825 fi
2826
2827 if [ "$OPT_VERBOSE" = "yes" ]; then
2828     echo "System architecture: '$CFG_ARCH'"
2829     if [ "$PLATFORM_QWS" = "yes" ]; then
2830         echo "Host architecture: '$CFG_HOST_ARCH'"
2831     fi
2832 fi
2833
2834 #-------------------------------------------------------------------------------
2835 # tests that don't need qmake (must be run before displaying help)
2836 #-------------------------------------------------------------------------------
2837
2838 if [ -z "$PKG_CONFIG" ]; then
2839     # See if PKG_CONFIG is set in the mkspec:
2840     PKG_CONFIG=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%PKG_CONFIG[^_].*=%%p' | tr '\n' ' '`
2841 fi
2842 if [ -z "$PKG_CONFIG" ]; then
2843     PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null`
2844 fi
2845
2846 # Work out if we can use pkg-config
2847 if [ "$QT_CROSS_COMPILE" = "yes" ]; then
2848     if [ "$QT_FORCE_PKGCONFIG" = "yes" ]; then
2849         echo >&2 ""
2850         echo >&2 "You have asked to use pkg-config and are cross-compiling."
2851         echo >&2 "Please make sure you have a correctly set-up pkg-config"
2852         echo >&2 "environment!"
2853         echo >&2 ""
2854         if [ -z "$PKG_CONFIG_PATH" ]; then
2855             echo >&2 ""
2856             echo >&2 "Warning: PKG_CONFIG_PATH has not been set.  This could mean"
2857             echo >&2 "the host compiler's .pc files will be used. This is probably"
2858             echo >&2 "not what you want."
2859             echo >&2 ""
2860         elif [ -z "$PKG_CONFIG_SYSROOT" ] && [ -z "$PKG_CONFIG_SYSROOT_DIR" ]; then
2861             echo >&2 ""
2862             echo >&2 "Warning: PKG_CONFIG_SYSROOT/PKG_CONFIG_SYSROOT_DIR has not"
2863             echo >&2 "been set. This means your toolchain's .pc files must contain"
2864             echo >&2 "the paths to the toolchain's libraries & headers. If configure"
2865             echo >&2 "tests are failing, please check these files."
2866             echo >&2 ""
2867         fi
2868     else
2869         echo >&2 ""
2870         echo >&2 "You have not explicitly asked to use pkg-config and are cross-compiling."
2871         echo >&2 "pkg-config will not be used to automatically query cflag/lib parameters for"
2872         echo >&2 "dependencies"
2873         echo >&2 ""
2874         PKG_CONFIG=""
2875     fi
2876 fi
2877
2878 # process CFG_MAC_ARCHS
2879 if [ "$PLATFORM_MAC" = "yes" ]; then
2880 #   check -arch arguments for validity.
2881     ALLOWED="x86 ppc x86_64 ppc64 i386"
2882     # Save the list so we can re-write it using only valid values
2883     CFG_MAC_ARCHS_IN="$CFG_MAC_ARCHS"
2884     CFG_MAC_ARCHS=
2885     for i in $CFG_MAC_ARCHS_IN
2886     do 
2887         if echo "$ALLOWED" | grep -w -v "$i" > /dev/null 2>&1; then
2888             echo "Unknown architecture: \"$i\". Supported architectures: x86[i386] ppc x86_64 ppc64";
2889             exit 2;
2890         fi
2891         if [ "$i" = "i386" -o "$i" = "x86" ]; then
2892             # These are synonymous values
2893             # CFG_MAC_ARCHS requires x86 while GCC requires i386
2894             CFG_MAC_ARCHS="$CFG_MAC_ARCHS x86"
2895             MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -arch i386"
2896         else
2897             CFG_MAC_ARCHS="$CFG_MAC_ARCHS $i"
2898             MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -arch $i"
2899         fi
2900     done
2901 fi
2902
2903 # pass on $CFG_SDK to the configure tests.
2904 if [ '!' -z "$CFG_SDK" ]; then
2905     MAC_CONFIG_TEST_COMMANDLINE="-sdk $CFG_SDK"
2906 fi
2907
2908 # find the default framework value
2909 if [ "$PLATFORM_MAC" = "yes" ] && [ "$PLATFORM" != "macx-xlc" ]; then
2910     if [ "$CFG_FRAMEWORK" = "auto" ]; then
2911         CFG_FRAMEWORK="$CFG_SHARED"
2912     elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
2913         echo
2914         echo "WARNING: Using static linking will disable the use of Mac frameworks."
2915         echo
2916         CFG_FRAMEWORK="no"
2917     fi
2918 else
2919     CFG_FRAMEWORK=no
2920 fi
2921
2922 QMAKE_CONF_COMPILER=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_CXX[^_A-Z0-9]" | sed "s,.* *= *\(.*\)$,\1," | tail -1`
2923 TEST_COMPILER="$CC"
2924 [ -z "$TEST_COMPILER" ] && TEST_COMPILER=$QMAKE_CONF_COMPILER
2925
2926 # auto-detect precompiled header support
2927 if [ "$CFG_PRECOMPILE" = "auto" ]; then
2928     if [ `echo "$CFG_MAC_ARCHS" | wc -w` -gt 1 ]; then
2929        CFG_PRECOMPILE=no
2930     elif "$unixtests/precomp.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
2931        CFG_PRECOMPILE=no
2932     else
2933        CFG_PRECOMPILE=yes
2934     fi
2935 elif [ "$CFG_PRECOMPILE" = "yes" ] && [ `echo "$CFG_MAC_ARCHS" | wc -w` -gt 1 ]; then
2936     echo
2937     echo "WARNING: Using universal binaries disables precompiled headers."
2938     echo
2939     CFG_PRECOMPILE=no
2940 fi
2941
2942 #auto-detect DWARF2 on the mac
2943 if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "auto" ]; then
2944     if "$mactests/dwarf2.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
2945         CFG_MAC_DWARF2=no
2946     else
2947         CFG_MAC_DWARF2=yes
2948     fi
2949 fi
2950
2951 # auto-detect support for -Xarch on the mac
2952 if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" = "auto" ]; then
2953     if "$mactests/xarch.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
2954         CFG_MAC_XARCH=no
2955     else
2956         CFG_MAC_XARCH=yes
2957     fi
2958 fi
2959
2960 # don't autodetect support for separate debug info on objcopy when
2961 # cross-compiling as lots of toolchains seems to have problems with this
2962 if [ "$QT_CROSS_COMPILE" = "yes" ] && [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
2963     CFG_SEPARATE_DEBUG_INFO="no"
2964 fi
2965
2966 # auto-detect support for separate debug info in objcopy
2967 if [ "$CFG_SEPARATE_DEBUG_INFO" != "no" ] && [ "$CFG_SHARED" = "yes" ]; then
2968     TEST_COMPILER_CFLAGS=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%QMAKE_CFLAGS[^_].*=%%p' | tr '\n' ' '`
2969     TEST_COMPILER_CXXFLAGS=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%QMAKE_CXXFLAGS[^_].*=%%p' | tr '\n' ' '`
2970     TEST_OBJCOPY=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_OBJCOPY" | sed "s%.* *= *\(.*\)$%\1%" | tail -1`
2971     COMPILER_WITH_FLAGS="$TEST_COMPILER $TEST_COMPILER_CXXFLAGS"
2972     COMPILER_WITH_FLAGS=`echo "$COMPILER_WITH_FLAGS" | sed -e "s%\\$\\$QMAKE_CFLAGS%$TEST_COMPILER_CFLAGS%g"`
2973     if "$unixtests/objcopy.test" "$COMPILER_WITH_FLAGS" "$TEST_OBJCOPY" "$OPT_VERBOSE"; then
2974        CFG_SEPARATE_DEBUG_INFO=no
2975     else
2976        case "$PLATFORM" in
2977        hpux-*)
2978            # binutils on HP-UX is buggy; default to no.
2979            CFG_SEPARATE_DEBUG_INFO=no
2980            ;;
2981        *)
2982            CFG_SEPARATE_DEBUG_INFO=yes
2983            ;;
2984        esac
2985     fi
2986 fi
2987
2988 # auto-detect -fvisibility support
2989 if [ "$CFG_REDUCE_EXPORTS" = "auto" ]; then
2990     if "$unixtests/fvisibility.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
2991        CFG_REDUCE_EXPORTS=no
2992     else
2993        CFG_REDUCE_EXPORTS=yes
2994     fi
2995 fi
2996
2997 # detect the availability of the -Bsymbolic-functions linker optimization
2998 if [ "$CFG_REDUCE_RELOCATIONS" != "no" ]; then
2999     if "$unixtests/bsymbolic_functions.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
3000         CFG_REDUCE_RELOCATIONS=no
3001     else
3002         CFG_REDUCE_RELOCATIONS=yes
3003     fi
3004 fi
3005
3006 # auto-detect GNU make support
3007 if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2>&1; then
3008    CFG_USE_GNUMAKE=yes
3009 fi
3010
3011 # If -opengl wasn't specified, don't try to auto-detect
3012 if [ "$PLATFORM_QWS" = "yes" ] && [ "$CFG_OPENGL" = "auto" ]; then
3013         CFG_OPENGL=no
3014 fi
3015
3016 # mac
3017 if [ "$PLATFORM_MAC" = "yes" ]; then
3018     if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
3019         CFG_OPENGL=desktop
3020     fi
3021 fi
3022
3023 # find the default framework value
3024 if [ "$PLATFORM_MAC" = "yes" ] && [ "$PLATFORM" != "macx-xlc" ]; then
3025     if [ "$CFG_FRAMEWORK" = "auto" ]; then
3026         CFG_FRAMEWORK="$CFG_SHARED"
3027     elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
3028         echo
3029         echo "WARNING: Using static linking will disable the use of Mac frameworks."
3030         echo
3031         CFG_FRAMEWORK="no"
3032     fi
3033 else
3034     CFG_FRAMEWORK=no
3035 fi
3036
3037 # Print a warning if configure was called with the 10.4u SDK option on Snow Leopard
3038 # with the default mkspec. The 10.4u SDK does not support gcc 4.2.
3039 if [ "$PLATFORM_MAC" = "yes" ] && [ '!' -z "$CFG_SDK" ]; then
3040     # get the darwin version. 10.0.0 and up means snow leopard.
3041     VERSION=`uname -r | tr '.' ' ' | awk '{print $1}'`
3042     if [ "$VERSION" -gt 9 ] && [ "$CFG_SDK" == "/Developer/SDKs/MacOSX10.4u.sdk/" ] && [ "$PLATFORM" == "macx-g++" ]; then
3043         echo
3044         echo "WARNING: The 10.4u SDK does not support gcc 4.2. Configure with -platform macx-g++40. "
3045         echo
3046     fi
3047 fi
3048
3049 # x11 tests are done after qmake is built
3050
3051
3052 #setup the build parts
3053 if [ -z "$CFG_BUILD_PARTS" ]; then
3054     CFG_BUILD_PARTS="$QT_DEFAULT_BUILD_PARTS"
3055
3056     # don't build tools by default when cross-compiling
3057     if [ "$PLATFORM" != "$XPLATFORM" ]; then
3058         CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, tools,,g"`
3059     fi
3060 fi
3061 for nobuild in $CFG_NOBUILD_PARTS; do
3062     CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, $nobuild,,g"`
3063 done
3064 if echo $CFG_BUILD_PARTS | grep -v libs >/dev/null 2>&1; then
3065 #    echo
3066 #    echo "WARNING: libs is a required part of the build."
3067 #    echo
3068     CFG_BUILD_PARTS="$CFG_BUILD_PARTS libs"
3069 fi
3070
3071 #-------------------------------------------------------------------------------
3072 # post process QT_INSTALL_* variables
3073 #-------------------------------------------------------------------------------
3074
3075 #prefix
3076 if [ -z "$QT_INSTALL_PREFIX" ]; then
3077     if [ "$CFG_DEV" = "yes" ]; then
3078         QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default
3079     elif [ "$PLATFORM_QWS" = "yes" ]; then
3080         QT_INSTALL_PREFIX="/usr/local/Trolltech/QtEmbedded-${QT_VERSION}"
3081         if [ "$PLATFORM" != "$XPLATFORM" ]; then
3082             QT_INSTALL_PREFIX="${QT_INSTALL_PREFIX}-${CFG_ARCH}"
3083         fi
3084     else
3085         QT_INSTALL_PREFIX="/usr/local/Trolltech/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Trolltech/Qt-$QT_VERSION
3086     fi
3087 fi
3088 QT_INSTALL_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PREFIX"`
3089
3090 #docs
3091 if [ -z "$QT_INSTALL_DOCS" ]; then #default
3092     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3093         if [ "$PLATFORM_MAC" = "yes" ]; then
3094             QT_INSTALL_DOCS="/Developer/Documentation/Qt"
3095         fi
3096     fi
3097     [ -z "$QT_INSTALL_DOCS" ] && QT_INSTALL_DOCS="$QT_INSTALL_PREFIX/doc" #fallback
3098
3099 fi
3100 QT_INSTALL_DOCS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DOCS"`
3101
3102 #headers
3103 if [ -z "$QT_INSTALL_HEADERS" ]; then #default
3104     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3105         if [ "$PLATFORM_MAC" = "yes" ]; then
3106             if [ "$CFG_FRAMEWORK" = "yes" ]; then
3107                 QT_INSTALL_HEADERS=
3108             fi
3109         fi
3110     fi
3111     [ -z "$QT_INSTALL_HEADERS" ] && QT_INSTALL_HEADERS="$QT_INSTALL_PREFIX/include"
3112
3113 fi
3114 QT_INSTALL_HEADERS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_HEADERS"`
3115
3116 #libs
3117 if [ -z "$QT_INSTALL_LIBS" ]; then #default
3118     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3119         if [ "$PLATFORM_MAC" = "yes" ]; then
3120             if [ "$CFG_FRAMEWORK" = "yes" ]; then
3121                 QT_INSTALL_LIBS="/Libraries/Frameworks"
3122             fi
3123         fi
3124     fi
3125     [ -z "$QT_INSTALL_LIBS" ] && QT_INSTALL_LIBS="$QT_INSTALL_PREFIX/lib" #fallback
3126 fi
3127 QT_INSTALL_LIBS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_LIBS"`
3128
3129 #bins
3130 if [ -z "$QT_INSTALL_BINS" ]; then #default
3131     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3132         if [ "$PLATFORM_MAC" = "yes" ]; then
3133             QT_INSTALL_BINS="/Developer/Applications/Qt"
3134         fi
3135     fi
3136     [ -z "$QT_INSTALL_BINS" ] && QT_INSTALL_BINS="$QT_INSTALL_PREFIX/bin" #fallback
3137
3138 fi
3139 QT_INSTALL_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_BINS"`
3140
3141 #plugins
3142 if [ -z "$QT_INSTALL_PLUGINS" ]; then #default
3143     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3144         if [ "$PLATFORM_MAC" = "yes" ]; then
3145             QT_INSTALL_PLUGINS="/Developer/Applications/Qt/plugins"
3146         fi
3147     fi
3148     [ -z "$QT_INSTALL_PLUGINS" ] && QT_INSTALL_PLUGINS="$QT_INSTALL_PREFIX/plugins" #fallback
3149 fi
3150 QT_INSTALL_PLUGINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PLUGINS"`
3151
3152 #data
3153 if [ -z "$QT_INSTALL_DATA" ]; then #default
3154     QT_INSTALL_DATA="$QT_INSTALL_PREFIX"
3155 fi
3156 QT_INSTALL_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DATA"`
3157
3158 #translations
3159 if [ -z "$QT_INSTALL_TRANSLATIONS" ]; then #default
3160     QT_INSTALL_TRANSLATIONS="$QT_INSTALL_PREFIX/translations"
3161 fi
3162 QT_INSTALL_TRANSLATIONS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TRANSLATIONS"`
3163
3164 #settings
3165 if [ -z "$QT_INSTALL_SETTINGS" ]; then #default
3166     if [ "$PLATFORM_MAC" = "yes" ]; then
3167         QT_INSTALL_SETTINGS=/Library/Preferences/Qt
3168     else
3169         QT_INSTALL_SETTINGS=/etc/xdg
3170     fi
3171 fi
3172 QT_INSTALL_SETTINGS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_SETTINGS"`
3173
3174 #examples
3175 if [ -z "$QT_INSTALL_EXAMPLES" ]; then #default
3176     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3177         if [ "$PLATFORM_MAC" = "yes" ]; then
3178             QT_INSTALL_EXAMPLES="/Developer/Examples/Qt"
3179         fi
3180     fi
3181     [ -z "$QT_INSTALL_EXAMPLES" ] && QT_INSTALL_EXAMPLES="$QT_INSTALL_PREFIX/examples" #fallback
3182 fi
3183 QT_INSTALL_EXAMPLES=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_EXAMPLES"`
3184
3185 #demos
3186 if [ -z "$QT_INSTALL_DEMOS" ]; then #default
3187     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3188         if [ "$PLATFORM_MAC" = "yes" ]; then
3189             QT_INSTALL_DEMOS="/Developer/Examples/Qt/Demos"
3190         fi
3191     fi
3192     [ -z "$QT_INSTALL_DEMOS" ] && QT_INSTALL_DEMOS="$QT_INSTALL_PREFIX/demos"
3193 fi
3194 QT_INSTALL_DEMOS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DEMOS"`
3195
3196 #-------------------------------------------------------------------------------
3197 # help - interactive parts of the script _after_ this section please
3198 #-------------------------------------------------------------------------------
3199
3200 # next, emit a usage message if something failed.
3201 if [ "$OPT_HELP" = "yes" ]; then
3202     [ "x$ERROR" = "xyes" ] && echo
3203     if [ "$CFG_NIS" = "no" ]; then
3204         NSY=" "
3205         NSN="*"
3206     else
3207         NSY="*"
3208         NSN=" "
3209     fi
3210     if [ "$CFG_CUPS" = "no" ]; then
3211         CUY=" "
3212         CUN="*"
3213     else
3214         CUY="*"
3215         CUN=" "
3216     fi
3217     if [ "$CFG_ICONV" = "no" ]; then
3218         CIY=" "
3219         CIN="*"
3220     else
3221         CIY="*"
3222         CIN=" "
3223     fi
3224     if [ "$CFG_LARGEFILE" = "no" ]; then
3225         LFSY=" "
3226         LFSN="*"
3227     else
3228         LFSY="*"
3229         LFSN=" "
3230     fi
3231     if [ "$CFG_STL" = "auto" ] || [ "$CFG_STL" = "yes" ]; then
3232         SHY="*"
3233         SHN=" "
3234     else
3235         SHY=" "
3236         SHN="*"
3237     fi
3238     if [ "$CFG_IPV6" = "auto" ]; then
3239         I6Y="*"
3240         I6N=" "
3241     fi
3242     if [ "$CFG_PRECOMPILE" = "auto" ] || [ "$CFG_PRECOMPILE" = "no" ]; then
3243         PHY=" "
3244         PHN="*"
3245     else
3246         PHY="*"
3247         PHN=" "
3248     fi
3249
3250     cat <<EOF
3251 Usage:  $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>]
3252         [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-datadir <dir>]
3253         [-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>]
3254         [-demosdir <dir>] [-buildkey <key>] [-release] [-debug]
3255         [-debug-and-release] [-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile]
3256         [-largefile] [-no-exceptions] [-exceptions] [-no-accessibility]
3257         [-accessibility] [-no-stl] [-stl] [-no-sql-<driver>] [-sql-<driver>]
3258         [-plugin-sql-<driver>] [-system-sqlite] [-no-qt3support] [-qt3support]
3259         [-platform] [-D <string>] [-I <string>] [-L <string>] [-help]
3260         [-qt-zlib] [-system-zlib] [-no-gif] [-qt-gif] [-no-libtiff] [-qt-libtiff] [-system-libtiff]
3261         [-no-libpng] [-qt-libpng] [-system-libpng] [-no-libmng] [-qt-libmng]
3262         [-system-libmng] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>]
3263         [-nomake <part>] [-R <string>]  [-l <string>] [-no-rpath]  [-rpath] [-continue]
3264         [-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [-no-iconv]
3265         [-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked]
3266         [-no-separate-debug-info] [-no-mmx] [-no-3dnow] [-no-sse] [-no-sse2]
3267         [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info] [-armfpa]
3268         [-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns]
3269         [-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend]
3270         [-no-openssl] [-openssl] [-openssl-linked]
3271         [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-no-javascript-jit] [-javascript-jit]
3272         [-no-script] [-script] [-no-scripttools] [-scripttools] [-no-declarative] [-declarative]
3273
3274         [additional platform specific options (see below)]
3275
3276
3277 Installation options:
3278
3279  These are optional, but you may specify install directories.
3280
3281     -prefix <dir> ...... This will install everything relative to <dir>
3282                          (default $QT_INSTALL_PREFIX)
3283 EOF
3284 if [ "$PLATFORM_QWS" = "yes" ]; then
3285 cat <<EOF
3286
3287     -hostprefix [dir] .. Tools and libraries needed when developing
3288                          applications are installed in [dir]. If [dir] is
3289                          not given, the current build directory will be used.
3290 EOF
3291 fi
3292 cat <<EOF
3293
3294   * -prefix-install .... Force a sandboxed "local" installation of
3295                          Qt. This will install into
3296                          $QT_INSTALL_PREFIX, if this option is
3297                          disabled then some platforms will attempt a
3298                          "system" install by placing default values to
3299                          be placed in a system location other than
3300                          PREFIX.
3301
3302  You may use these to separate different parts of the install:
3303
3304     -bindir <dir> ......... Executables will be installed to <dir>
3305                             (default PREFIX/bin)
3306     -libdir <dir> ......... Libraries will be installed to <dir>
3307                             (default PREFIX/lib)
3308     -docdir <dir> ......... Documentation will be installed to <dir>
3309                             (default PREFIX/doc)
3310     -headerdir <dir> ...... Headers will be installed to <dir>
3311                             (default PREFIX/include)
3312     -plugindir <dir> ...... Plugins will be installed to <dir>
3313                             (default PREFIX/plugins)
3314     -datadir <dir> ........ Data used by Qt programs will be installed to <dir>
3315                             (default PREFIX)
3316     -translationdir <dir> . Translations of Qt programs will be installed to <dir>
3317                             (default PREFIX/translations)
3318     -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir>
3319                             (default PREFIX/etc/settings)
3320     -examplesdir <dir> .... Examples will be installed to <dir>
3321                             (default PREFIX/examples)
3322     -demosdir <dir> ....... Demos will be installed to <dir>
3323                             (default PREFIX/demos)
3324
3325  You may use these options to turn on strict plugin loading.
3326
3327     -buildkey <key> .... Build the Qt library and plugins using the specified
3328                          <key>.  When the library loads plugins, it will only
3329                          load those that have a matching key.
3330
3331 Configure options:
3332
3333  The defaults (*) are usually acceptable. A plus (+) denotes a default value
3334  that needs to be evaluated. If the evaluation succeeds, the feature is
3335  included. Here is a short explanation of each option:
3336
3337  *  -release ........... Compile and link Qt with debugging turned off.
3338     -debug ............. Compile and link Qt with debugging turned on.
3339     -debug-and-release . Compile and link two versions of Qt, with and without
3340                          debugging turned on (Mac only).
3341
3342     -developer-build.... Compile and link Qt with Qt developer options (including auto-tests exporting)
3343
3344     -opensource......... Compile and link the Open-Source Edition of Qt.
3345     -commercial......... Compile and link the Commercial Edition of Qt.
3346
3347
3348  *  -shared ............ Create and use shared Qt libraries.
3349     -static ............ Create and use static Qt libraries.
3350
3351  *  -no-fast ........... Configure Qt normally by generating Makefiles for all
3352                          project files.
3353     -fast .............. Configure Qt quickly by generating Makefiles only for
3354                          library and subdirectory targets.  All other Makefiles
3355                          are created as wrappers, which will in turn run qmake.
3356
3357     -no-largefile ...... Disables large file support.
3358  +  -largefile ......... Enables Qt to access files larger than 4 GB.
3359
3360 EOF
3361 if [ "$PLATFORM_QWS" = "yes" ]; then
3362     EXCN="*"
3363     EXCY=" "
3364 else
3365     EXCN=" "
3366     EXCY="*"
3367 fi
3368 if [ "$CFG_DBUS" = "no" ]; then
3369     DBY=" "
3370     DBN="+"
3371 else
3372     DBY="+"
3373     DBN=" "
3374 fi
3375
3376     cat << EOF
3377  $EXCN  -no-exceptions ..... Disable exceptions on compilers that support it.