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