Don't default to XCB if it is not enabled.
[profile/ivi/qtbase.git] / configure
1 #!/bin/sh
2 #############################################################################
3 ##
4 ## Copyright (C) 2011 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 ## GNU Lesser General Public License Usage
12 ## This file may be used under the terms of the GNU Lesser General Public
13 ## License version 2.1 as published by the Free Software Foundation and
14 ## appearing in the file LICENSE.LGPL included in the packaging of this
15 ## file. Please review the following information to ensure the GNU Lesser
16 ## General Public License version 2.1 requirements will be met:
17 ## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ##
19 ## In addition, as a special exception, Nokia gives you certain additional
20 ## rights. These rights are described in the Nokia Qt LGPL Exception
21 ## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ##
23 ## GNU General Public License Usage
24 ## Alternatively, this file may be used under the terms of the GNU General
25 ## Public License version 3.0 as published by the Free Software Foundation
26 ## and appearing in the file LICENSE.GPL included in the packaging of this
27 ## file. Please review the following information to ensure the GNU General
28 ## Public License version 3.0 requirements will be met:
29 ## http://www.gnu.org/copyleft/gpl.html.
30 ##
31 ## Other Usage
32 ## Alternatively, this file may be used in accordance with the terms and
33 ## conditions contained in a signed written agreement between you and Nokia.
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_QWS=no
189 PLATFORM_QPA=yes
190 BUILD_ON_MAC=no
191 PLATFORM_MAC=no
192 if [ -d /System/Library/Frameworks/Carbon.framework ]; then
193     BUILD_ON_MAC=yes
194 fi
195
196 #-----------------------------------------------------------------------------
197 # Qt version detection
198 #-----------------------------------------------------------------------------
199 QT_VERSION=`grep '^# *define *QT_VERSION_STR' "$relpath"/src/corelib/global/qglobal.h`
200 QT_MAJOR_VERSION=
201 QT_MINOR_VERSION=0
202 QT_PATCH_VERSION=0
203 if [ -n "$QT_VERSION" ]; then
204    QT_VERSION=`echo $QT_VERSION | sed 's,^# *define *QT_VERSION_STR *"*\([^ ]*\)"$,\1,'`
205    MAJOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'`
206    if [ -n "$MAJOR" ]; then
207      MINOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'`
208       PATCH=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'`
209       QT_MAJOR_VERSION="$MAJOR"
210       [ -z "$MINOR" ] || QT_MINOR_VERSION="$MINOR"
211       [ -z "$PATCH" ] || QT_PATCH_VERSION="$PATCH"
212    fi
213 fi
214 if [ -z "$QT_MAJOR_VERSION" ]; then
215    echo "Cannot process version from qglobal.h: $QT_VERSION"
216    echo "Cannot proceed."
217    exit 1
218 fi
219
220 QT_PACKAGEDATE=`grep '^# *define *QT_PACKAGEDATE_STR' "$relpath"/src/corelib/global/qglobal.h | sed -e 's,^# *define *QT_PACKAGEDATE_STR *"\([^ ]*\)"$,\1,' -e s,-,,g`
221 if [ -z "$QT_PACKAGEDATE" ]; then
222    echo "Unable to determine package date from qglobal.h: '$QT_PACKAGEDATE'"
223    echo "Cannot proceed"
224    exit 1
225 fi
226
227 #-------------------------------------------------------------------------------
228 # check the license
229 #-------------------------------------------------------------------------------
230 COMMERCIAL_USER=ask
231 CFG_DEV=no
232 CFG_NOKIA=no
233 CFG_EMBEDDED=no
234 CFG_RTOS_ENABLED=yes
235 EditionString=Commercial
236
237 earlyArgParse()
238 {
239     # parse the arguments, setting things to "yes" or "no"
240     while [ "$#" -gt 0 ]; do
241         CURRENT_OPT="$1"
242         UNKNOWN_ARG=no
243         case "$1" in
244         #Autoconf style options
245         --enable-*)
246             VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"`
247             VAL=yes
248             ;;
249         --disable-*)
250             VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"`
251             VAL=no
252             ;;
253         --*=*)
254             VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"`
255             VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"`
256             ;;
257         --no-*)
258             VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
259             VAL=no
260             ;;
261         -embedded)
262             VAR=embedded
263             # this option may or may not be followed by an argument
264             if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
265                 VAL=auto
266             else
267                 shift;
268                 VAL=$1
269             fi
270             ;;
271         -embedded-lite|-qpa)
272             VAR=qpa
273             # this option may or may not be followed by an argument
274             if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
275                 VAL=auto
276             else
277                 shift;
278                 VAL=$1
279             fi
280             ;;
281         -nacl)
282             shift;
283             VAR=nacl
284             VAL=$1
285             ;;
286
287         -h|help|--help|-help)
288             if [ "$VAL" = "yes" ]; then
289                 OPT_HELP="$VAL"
290                 COMMERCIAL_USER="no" #doesn't matter we will display the help
291             else
292                 UNKNOWN_OPT=yes
293                 COMMERCIAL_USER="no" #doesn't matter we will display the help
294             fi
295             ;;
296         --*)
297             VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
298             VAL=yes
299             ;;
300         -*)
301             VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
302             VAL="unknown"
303             ;;
304         *)
305             UNKNOWN_ARG=yes
306             ;;
307         esac
308         if [ "$UNKNOWN_ARG" = "yes" ]; then
309             shift
310             continue
311         fi
312         shift
313
314         UNKNOWN_OPT=no
315         case "$VAR" in
316         embedded)
317             CFG_EMBEDDED="$VAL"
318             PLATFORM_X11=no
319             PLATFORM_MAC=no
320             PLATFORM_QWS=yes
321             PLATFORM_QPA=no
322             ;;
323         qpa)
324             CFG_EMBEDDED="no"
325             if [ "$PLATFORM_QPA" != "no" ]; then
326                 if [ "$PLATFORM_QPA" = "maybe" ]; then
327                     PLATFORM_X11=no
328                     PLATFORM_MAC=no
329                     PLATFORM_QWS=no
330                     PLATFORM_QPA=yes
331                 fi
332             else
333                 echo "No license exists to enable Qt QPA. Disabling."
334                 CFG_EMBEDDED=no
335             fi
336             ;;
337         nacl)
338             echo "Using NaCl at $VAL."
339             PLATFORM_X11=no
340             PLATFORM_MAC=no
341             PLATFORM_QWS=no
342             CFG_NACL_PATH=$VAL
343             CFG_EMBEDDED=nacl
344             ;;
345
346         developer-build)
347             CFG_DEV="yes"
348             ;;
349         nokia-developer)
350             CFG_DEV="yes"
351             CFG_NOKIA="yes"
352             COMMERCIAL_USER="no"
353             ;;
354         commercial)
355             COMMERCIAL_USER="yes"
356             ;;
357         opensource)
358             COMMERCIAL_USER="no"
359             ;;
360         *)
361             UNKNOWN_OPT=yes
362             ;;
363         esac
364     done
365 }
366
367 earlyArgParse "$@"
368
369 if [ "$COMMERCIAL_USER" = "ask" ]; then
370     while true; do
371         echo "Which edition of Qt do you want to use ?"
372         echo
373         echo "Type 'c' if you want to use the Commercial Edition."
374         echo "Type 'o' if you want to use the Open Source Edition."
375         echo
376         read commercial
377         echo
378         if [ "$commercial" = "c" ]; then
379             COMMERCIAL_USER="yes"
380             break
381         elif [ "$commercial" = "o" ]; then
382             COMMERCIAL_USER="no"
383             break
384         fi
385     done
386 fi
387
388 if [ "$CFG_NOKIA" = "yes" ]; then
389     Licensee="Nokia"
390     Edition="NokiaInternalBuild"
391     EditionString="Nokia Internal Build"
392     QT_EDITION="QT_EDITION_OPENSOURCE"
393     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
394 elif [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ]; then
395     # Commercial preview release
396     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
397     Licensee="Preview"
398     Edition="Preview"
399     QT_EDITION="QT_EDITION_DESKTOP"
400     LicenseType="Technology Preview"
401 elif [ $COMMERCIAL_USER = "yes" ]; then
402     # one of commercial editions
403     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
404     [ "$PLATFORM_QPA" = "maybe" ] && PLATFORM_QPA=no
405     [ "$PLATFORM_QWS" = "maybe" ] && PLATFORM_QWS=no
406
407     # read in the license file
408     if [ -f "$LICENSE_FILE" ]; then
409         . "$LICENSE_FILE" >/dev/null 2>&1
410         if [ -z "$LicenseKeyExt" ]; then
411             echo
412             echo "You are using an old license file."
413             echo
414             echo "Please install the license file supplied by Nokia,"
415             echo "or install the Qt Open Source Edition if you intend to"
416             echo "develop free software."
417             exit 1
418         fi
419         if [ -z "$Licensee" ]; then
420             echo
421             echo "Invalid license key. Please check the license key."
422             exit 1
423         fi
424     else
425         if [ -z "$LicenseKeyExt" ]; then
426             echo
427             echo $ECHO_N "Please enter your license key: $ECHO_C"
428             read LicenseKeyExt
429             Licensee="Unknown user"
430         fi
431     fi
432
433     # Key verification
434     echo "$LicenseKeyExt" | grep ".....*-....*-....*-....*-.....*-.....*-...." >/dev/null 2>&1 \
435         && LicenseValid="yes" \
436         || LicenseValid="no"
437     if [ "$LicenseValid" != "yes" ]; then
438         echo
439         echo "Invalid license key. Please check the license key."
440         exit 1
441     fi
442     ProductCode=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1`
443     PlatformCode=`echo $LicenseKeyExt | cut -f 2 -d -`
444     LicenseTypeCode=`echo $LicenseKeyExt | cut -f 3 -d -`
445     LicenseFeatureCode=`echo $LicenseKeyExt | cut -f 4 -d - | cut -b 1`
446
447     # determine which edition we are licensed to use
448     case "$LicenseTypeCode" in
449     F4M)
450         LicenseType="Commercial"
451         case $ProductCode in
452         F)
453             Edition="Universal"
454             QT_EDITION="QT_EDITION_UNIVERSAL"
455             ;;
456         B)
457             Edition="FullFramework"
458             EditionString="Full Framework"
459             QT_EDITION="QT_EDITION_DESKTOP"
460             ;;
461         L)
462             Edition="GUIFramework"
463             EditionString="GUI Framework"
464             QT_EDITION="QT_EDITION_DESKTOPLIGHT"
465             ;;
466         esac
467         ;;
468     Z4M|R4M|Q4M)
469         LicenseType="Evaluation"
470         QMakeVar add DEFINES QT_EVAL
471         case $ProductCode in
472          B)
473             Edition="Evaluation"
474             QT_EDITION="QT_EDITION_EVALUATION"
475             ;;
476         esac
477         ;;
478     esac
479     if [ -z "$LicenseType" -o -z "$Edition" -o -z "$QT_EDITION" ]; then
480         echo
481         echo "Invalid license key. Please check the license key."
482         exit 1
483     fi
484
485     # verify that we are licensed to use Qt on this platform
486     LICENSE_EXTENSION=
487     case "$PlatformCode" in
488         *L)
489             CFG_RTOS_ENABLED=yes
490             PlatformCode=`echo "$PlatformCode" | sed 'h;y/8NPQRTZ/UCWX9M7/;x;G;s/\(.\)....\(.\)./\1\2/'`
491             ;;
492         *)
493             CFG_RTOS_ENABLED=no
494             PlatformCode=`echo "$PlatformCode" | sed 's/.$//'`
495             ;;
496     esac
497     ### EMBEDDED_QPA logic missing ###
498     case "$PlatformCode,$PLATFORM_MAC,$PLATFORM_QWS" in
499         X9,* | XC,* | XU,* | XW,* | XM,*)
500             # Qt All-OS
501             LICENSE_EXTENSION="-ALLOS"
502             ;;
503         8M,* | KM,* | S9,* | SC,* | SM,* | SU,* | SW,* | X9,* | XC,* | XU,* | XW,*)
504             # Qt for Embedded Linux
505             LICENSE_EXTENSION="-EMBEDDED"
506             ;;
507         6M,*,no | N7,*,no | N9,*,no | NX,*,no)
508             # Embedded no-deploy
509             LICENSE_EXTENSION="-EMBEDDED"
510             ;;
511         FM,*,no | LM,yes,* | ZM,no,no)
512             # Desktop
513             LICENSE_EXTENSION="-DESKTOP"
514             ;;
515         *)
516             Platform=Linux/X11
517             [ "$PLATFORM_MAC" = "yes" ] && Platform='Mac OS X'
518             [ "$PLATFORM_QWS" = "yes" ] && Platform='Embedded Linux'
519             echo
520             echo "You are not licensed for the $Platform platform."
521             echo
522             echo "Please contact qt-info@nokia.com to upgrade your license to"
523             echo "include the $Platform platform, or install the Qt Open Source Edition"
524             echo "if you intend to develop free software."
525             exit 1
526             ;;
527     esac
528
529     if test -r "$relpath/.LICENSE"; then
530         # Generic, non-final license
531         LICENSE_EXTENSION=""
532         line=`sed 'y/a-z/A-Z/;q' "$relpath"/.LICENSE`
533         case "$line" in
534             *BETA*)
535                 Edition=Beta
536                 ;;
537             *TECHNOLOGY?PREVIEW*)
538                 Edition=Preview
539                 ;;
540             *EVALUATION*)
541                 Edition=Evaluation
542                 ;;
543             *)
544                 echo >&2 "Invalid license files; cannot continue"
545                 exit 1
546                 ;;
547         esac
548         Licensee="$Edition"
549         EditionString="$Edition"
550         QT_EDITION="QT_EDITION_DESKTOP"
551     fi
552
553     case "$LicenseFeatureCode" in
554     B|G|L|Y)
555         # US
556         case "$LicenseType" in
557         Commercial)
558             cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}-US" "$outpath/LICENSE"
559             ;;
560         Evaluation)
561             cp -f "$relpath/.LICENSE-EVALUATION-US" "$outpath/LICENSE"
562             ;;
563         esac
564         ;;
565     2|4|5|F)
566         # non-US
567         case "$LicenseType" in
568         Commercial)
569             cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}" "$outpath/LICENSE"
570             ;;
571         Evaluation)
572             cp -f "$relpath/.LICENSE-EVALUATION" "$outpath/LICENSE"
573             ;;
574         esac
575         ;;
576     *)
577         echo
578         echo "Invalid license key. Please check the license key."
579         exit 1
580         ;;
581     esac
582     case "$LicenseFeatureCode" in
583         4|B|F|Y)
584             CFG_RTOS_ENABLED=yes
585             ;;
586         2|5|G|L)
587             CFG_RTOS_ENABLED=no
588             ;;
589     esac
590     if [ '!' -f "$outpath/LICENSE" ]; then
591         echo "The LICENSE, LICENSE.GPL3 LICENSE.LGPL file shipped with"
592         echo "this software has disappeared."
593         echo
594         echo "Sorry, you are not licensed to use this software."
595         echo "Try re-installing."
596         echo
597         exit 1
598     fi
599 elif [ $COMMERCIAL_USER = "no" ]; then
600     # Open Source edition - may only be used under the terms of the GPL or LGPL.
601     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
602     Licensee="Open Source"
603     Edition="OpenSource"
604     EditionString="Open Source"
605     QT_EDITION="QT_EDITION_OPENSOURCE"
606 fi
607
608 #-------------------------------------------------------------------------------
609 # initalize variables
610 #-------------------------------------------------------------------------------
611
612 SYSTEM_VARIABLES="RANLIB STRIP OBJDUMP LD CC CXX CFLAGS CXXFLAGS LDFLAGS"
613 for varname in $SYSTEM_VARIABLES; do
614     qmakevarname="${varname}"
615     # use LDFLAGS for autoconf compat, but qmake uses QMAKE_LFLAGS
616     if [ "${varname}" = "LDFLAGS" ]; then
617         qmakevarname="LFLAGS"
618     elif [ "${varname}" = "LD" ]; then
619         qmakevarname="LINK"
620     fi
621     cmd=`echo \
622 'if [ -n "\$'${varname}'" ]; then
623     QMakeVar set QMAKE_'${qmakevarname}' "\$'${varname}'"
624 fi'`
625     eval "$cmd"
626 done
627 # Use CC/CXX to run config.tests
628 mkdir -p "$outpath/config.tests"
629 rm -f "$outpath/config.tests/.qmake.cache"
630 cp "$QMAKE_VARS_FILE" "$outpath/config.tests/.qmake.cache"
631
632 QMakeVar add styles "cde mac motif plastique cleanlooks windows"
633 QMakeVar add decorations "default windows styled"
634 QMakeVar add mouse-drivers "pc"
635 if [ "$UNAME_SYSTEM" = "Linux" ] ; then
636     QMakeVar add gfx-drivers "linuxfb"
637     QMakeVar add mouse-drivers "linuxtp"
638 fi
639 QMakeVar add kbd-drivers "tty"
640
641 if [ "$CFG_DEV" = "yes" ]; then
642     QMakeVar add kbd-drivers "um"
643 fi
644
645 # QTDIR may be set and point to an old or system-wide Qt installation
646 unset QTDIR
647
648 # the minimum version of libdbus-1 that we require:
649 MIN_DBUS_1_VERSION=0.93
650
651 # initalize internal variables
652 CFG_CONFIGURE_EXIT_ON_ERROR=yes
653 CFG_PROFILE=no
654 CFG_EXCEPTIONS=unspecified
655 CFG_GUI=auto # (yes|no|auto)
656 CFG_SCRIPT=auto # (yes|no|auto)
657 CFG_SCRIPTTOOLS=auto # (yes|no|auto)
658 CFG_XMLPATTERNS=auto # (yes|no|auto)
659 CFG_INCREMENTAL=auto
660 CFG_QCONFIG=full
661 CFG_DEBUG=auto
662 CFG_MYSQL_CONFIG=
663 CFG_DEBUG_RELEASE=no
664 CFG_SHARED=yes
665 CFG_SM=auto
666 CFG_XSHAPE=auto
667 CFG_XSYNC=auto
668 CFG_XVIDEO=auto
669 CFG_XINERAMA=runtime
670 CFG_XFIXES=runtime
671 CFG_ZLIB=auto
672 CFG_SYMBIAN_DEFFILES=auto
673 CFG_S60=auto
674 CFG_SQLITE=qt
675 CFG_GIF=auto
676 CFG_TIFF=auto
677 CFG_LIBTIFF=auto
678 CFG_PNG=yes
679 CFG_LIBPNG=auto
680 CFG_JPEG=auto
681 CFG_LIBJPEG=auto
682 CFG_MNG=auto
683 CFG_LIBMNG=auto
684 CFG_XCURSOR=runtime
685 CFG_XRANDR=runtime
686 CFG_XRENDER=auto
687 CFG_MITSHM=auto
688 CFG_OPENGL=auto
689 CFG_OPENVG=auto
690 CFG_OPENVG_LC_INCLUDES=no
691 CFG_OPENVG_SHIVA=auto
692 CFG_OPENVG_ON_OPENGL=auto
693 CFG_EGL=no
694 CFG_EGL_GLES_INCLUDES=no
695 CFG_SSE=auto
696 CFG_FONTCONFIG=auto
697 CFG_QWS_FREETYPE=auto
698 CFG_LIBFREETYPE=auto
699 CFG_SQL_AVAILABLE=
700 QT_DEFAULT_BUILD_PARTS="libs examples tests"
701 CFG_BUILD_PARTS=""
702 CFG_NOBUILD_PARTS=""
703 CFG_RELEASE_QMAKE=no
704 CFG_PHONON=auto
705 CFG_PHONON_BACKEND=yes
706 CFG_MULTIMEDIA=auto
707 CFG_AUDIO_BACKEND=auto
708 CFG_SVG=auto
709 CFG_V8=auto
710 CFG_DECLARATIVE=auto
711 CFG_DECLARATIVE_DEBUG=yes
712 CFG_WEBKIT=auto # (yes|no|auto|debug)
713 CFG_JAVASCRIPTCORE_JIT=auto
714 CFG_LOCATION=auto
715
716 CFG_GFX_AVAILABLE="linuxfb transformed qvfb vnc multiscreen directfb"
717 CFG_GFX_ON="linuxfb multiscreen"
718 CFG_GFX_PLUGIN_AVAILABLE=
719 CFG_GFX_PLUGIN=
720 CFG_GFX_OFF=
721 CFG_KBD_AVAILABLE="tty linuxinput qvfb"
722 CFG_KBD_ON="tty"    #default, see QMakeVar above
723 CFG_MOUSE_AVAILABLE="pc linuxtp linuxinput tslib qvfb"
724 CFG_MOUSE_ON="pc linuxtp"   #default, see QMakeVar above
725
726 if [ -f "$relpath/src/gui/embedded/qscreenqnx_qws.cpp" ]; then
727     CFG_KBD_AVAILABLE="${CFG_KBD_AVAILABLE} qnx"
728     CFG_MOUSE_AVAILABLE="${CFG_MOUSE_AVAILABLE} qnx"
729     CFG_GFX_AVAILABLE="${CFG_GFX_AVAILABLE} qnx"
730 fi
731 if [ -f "$relpath/src/gui/embedded/qscreenintegrityfb_qws.cpp" ]; then
732     CFG_KBD_AVAILABLE="${CFG_KBD_AVAILABLE} integrity"
733     CFG_MOUSE_AVAILABLE="${CFG_MOUSE_AVAILABLE} integrity"
734     CFG_GFX_AVAILABLE="${CFG_GFX_AVAILABLE} integrityfb"
735 fi
736
737 CFG_ARCH=
738 CFG_HOST_ARCH=
739 CFG_KBD_PLUGIN_AVAILABLE=
740 CFG_KBD_PLUGIN=
741 CFG_KBD_OFF=
742 CFG_MOUSE_PLUGIN_AVAILABLE=
743 CFG_MOUSE_PLUGIN=
744 CFG_MOUSE_OFF=
745 CFG_USE_GNUMAKE=no
746 CFG_IM=yes
747 CFG_DECORATION_AVAILABLE="styled windows default"
748 CFG_DECORATION_ON="${CFG_DECORATION_AVAILABLE}" # all on by default
749 CFG_DECORATION_PLUGIN_AVAILABLE=
750 CFG_DECORATION_PLUGIN=
751 CFG_XINPUT=runtime
752 CFG_XKB=auto
753 CFG_XCB=auto
754 CFG_XCB_LIMITED=yes
755 CFG_WAYLAND=auto
756 CFG_NIS=auto
757 CFG_CUPS=auto
758 CFG_ICONV=auto
759 CFG_DBUS=auto
760 CFG_GLIB=auto
761 CFG_GSTREAMER=auto
762 CFG_QGTKSTYLE=auto
763 CFG_QS60STYLE=auto
764 CFG_LARGEFILE=auto
765 CFG_OPENSSL=auto
766 CFG_PTMALLOC=no
767 CFG_STL=auto
768 CFG_PRECOMPILE=auto
769 CFG_SEPARATE_DEBUG_INFO=no
770 CFG_SEPARATE_DEBUG_INFO_NOCOPY=no
771 CFG_REDUCE_EXPORTS=auto
772 CFG_MMX=auto
773 CFG_3DNOW=auto
774 CFG_SSE=auto
775 CFG_SSE2=auto
776 CFG_SSE3=auto
777 CFG_SSSE3=auto
778 CFG_SSE4_1=auto
779 CFG_SSE4_2=auto
780 CFG_AVX=auto
781 CFG_REDUCE_RELOCATIONS=no
782 CFG_NAS=no
783 CFG_QWS_DEPTHS=all
784 CFG_ACCESSIBILITY=auto
785 CFG_QT3SUPPORT=no
786 CFG_ENDIAN=auto
787 CFG_HOST_ENDIAN=auto
788 CFG_DOUBLEFORMAT=auto
789 CFG_ARMFPA=auto
790 CFG_IWMMXT=no
791 CFG_NEON=auto
792 CFG_CLOCK_GETTIME=auto
793 CFG_CLOCK_MONOTONIC=auto
794 CFG_MREMAP=auto
795 CFG_GETADDRINFO=auto
796 CFG_IPV6IFNAME=auto
797 CFG_GETIFADDRS=auto
798 CFG_INOTIFY=auto
799 CFG_RPATH=yes
800 CFG_FRAMEWORK=auto
801 CFG_MAC_ARCHS=
802 MAC_CONFIG_TEST_COMMANDLINE=  # used to make the configure tests run with the correct arch's and SDK settings
803 CFG_MAC_DWARF2=auto
804 CFG_MAC_XARCH=auto
805 CFG_MAC_CARBON=no
806 CFG_MAC_COCOA=yes
807 COMMANDLINE_MAC_CARBON=no
808 CFG_MAC_HARFBUZZ=no
809 CFG_SXE=no
810 CFG_PREFIX_INSTALL=yes
811 CFG_SDK=
812 D_FLAGS=
813 I_FLAGS=
814 L_FLAGS=
815 RPATH_FLAGS=
816 l_FLAGS=
817 QCONFIG_FLAGS=
818 XPLATFORM=              # This seems to be the QMAKESPEC, like "linux-g++" or "symbian-gcce"
819 XPLATFORM_MINGW=no      # Whether target platform is MinGW (win32-g++*)
820 XPLATFORM_SYMBIAN=no    # Whether target platform is SYMBIAN (*symbian*)
821 XPLATFORM_SYMBIAN_SBSV2=no # Whether target platform is SYMBIAN_SBSV2 (symbian-sbsv2)
822 PLATFORM=$QMAKESPEC
823 QT_CROSS_COMPILE=no
824 OPT_CONFIRM_LICENSE=no
825 OPT_SHADOW=maybe
826 OPT_FAST=auto
827 OPT_VERBOSE=no
828 OPT_HELP=
829 CFG_SILENT=no
830 CFG_GRAPHICS_SYSTEM=default
831 CFG_RUNTIME_SYSTEM=
832 CFG_ALSA=auto
833 CFG_PULSEAUDIO=auto
834 CFG_COREWLAN=auto
835 CFG_ICD=auto
836 CFG_NOPROCESS=no
837 CFG_ICU=auto
838
839 # initalize variables used for installation
840 QT_INSTALL_PREFIX=
841 QT_INSTALL_DOCS=
842 QT_INSTALL_HEADERS=
843 QT_INSTALL_LIBS=
844 QT_INSTALL_BINS=
845 QT_INSTALL_PLUGINS=
846 QT_INSTALL_IMPORTS=
847 QT_INSTALL_DATA=
848 QT_INSTALL_TRANSLATIONS=
849 QT_INSTALL_SETTINGS=
850 QT_INSTALL_EXAMPLES=
851 QT_HOST_PREFIX=
852
853 #flags for SQL drivers
854 QT_CFLAGS_PSQL=
855 QT_LFLAGS_PSQL=
856 QT_CFLAGS_MYSQL=
857 QT_LFLAGS_MYSQL=
858 QT_LFLAGS_MYSQL_R=
859 QT_CFLAGS_SQLITE=
860 QT_LFLAGS_SQLITE=
861 QT_LFLAGS_ODBC="-lodbc"
862 QT_LFLAGS_TDS=
863
864 # flags for libdbus-1
865 QT_CFLAGS_DBUS=
866 QT_LIBS_DBUS=
867
868 # flags for Glib (X11 only)
869 QT_CFLAGS_GLIB=
870 QT_LIBS_GLIB=
871
872 # flags for GStreamer (X11 only)
873 QT_CFLAGS_GSTREAMER=
874 QT_LIBS_GSTREAMER=
875
876 #flag for Symbian fpu settings
877 QT_CFLAGS_FPU=
878
879 # flags for libconnsettings0 (used for Maemo ICD bearer management plugin)
880 QT_CFLAGS_CONNSETTINGS=
881 QT_LIBS_CONNSETTINGS=
882
883 #-------------------------------------------------------------------------------
884 # check SQL drivers, mouse drivers and decorations available in this package
885 #-------------------------------------------------------------------------------
886
887 # opensource version removes some drivers, so force them to be off
888 CFG_SQL_tds=no
889 CFG_SQL_oci=no
890 CFG_SQL_db2=no
891
892 CFG_SQL_AVAILABLE=
893 if [ -d "$relpath/src/plugins/sqldrivers" ]; then
894   for a in "$relpath/src/plugins/sqldrivers/"*; do
895      if [ -d "$a" ]; then
896          base_a=`basename "$a"`
897          CFG_SQL_AVAILABLE="${CFG_SQL_AVAILABLE} ${base_a}"
898          eval "CFG_SQL_${base_a}=auto"
899      fi
900   done
901 fi
902
903 CFG_DECORATION_PLUGIN_AVAILABLE=
904 if [ -d "$relpath/src/plugins/decorations" ]; then
905   for a in "$relpath/src/plugins/decorations/"*; do
906      if [ -d "$a" ]; then
907          base_a=`basename "$a"`
908          CFG_DECORATION_PLUGIN_AVAILABLE="${CFG_DECORATION_PLUGIN_AVAILABLE} ${base_a}"
909      fi
910   done
911 fi
912
913 CFG_KBD_PLUGIN_AVAILABLE=
914 if [ -d "$relpath/src/plugins/kbddrivers" ]; then
915   for a in "$relpath/src/plugins/kbddrivers/"*; do
916      if [ -d "$a" ]; then
917          base_a=`basename "$a"`
918          CFG_KBD_PLUGIN_AVAILABLE="${CFG_KBD_PLUGIN_AVAILABLE} ${base_a}"
919      fi
920   done
921 fi
922
923 CFG_MOUSE_PLUGIN_AVAILABLE=
924 if [ -d "$relpath/src/plugins/mousedrivers" ]; then
925   for a in "$relpath/src/plugins/mousedrivers/"*; do
926      if [ -d "$a" ]; then
927          base_a=`basename "$a"`
928          CFG_MOUSE_PLUGIN_AVAILABLE="${CFG_MOUSE_PLUGIN_AVAILABLE} ${base_a}"
929      fi
930   done
931 fi
932
933 CFG_GFX_PLUGIN_AVAILABLE=
934 if [ -d "$relpath/src/plugins/gfxdrivers" ]; then
935   for a in "$relpath/src/plugins/gfxdrivers/"*; do
936      if [ -d "$a" ]; then
937          base_a=`basename "$a"`
938          CFG_GFX_PLUGIN_AVAILABLE="${CFG_GFX_PLUGIN_AVAILABLE} ${base_a}"
939      fi
940   done
941   CFG_GFX_OFF="$CFG_GFX_AVAILABLE" # assume all off
942 fi
943
944 CFG_IMAGEFORMAT_PLUGIN_AVAILABLE=
945 if [ -d "$relpath/src/plugins/imageformats" ]; then
946     for a in "$relpath/src/plugins/imageformats/"*; do
947         if [ -d "$a" ]; then
948             base_a=`basename "$a"`
949             CFG_IMAGEFORMAT_PLUGIN_AVAILABLE="${CFG_IMAGEFORMAT_PLUGIN_AVAILABLE} ${base_a}"
950         fi
951     done
952 fi
953
954 #-------------------------------------------------------------------------------
955 # Set Default NaCl options
956 #-------------------------------------------------------------------------------
957 if [ "$CFG_EMBEDDED" = "nacl" ]; then
958     echo "Setting NaCl options:"
959     echo "-static"
960     CFG_SHARED=no
961     echo "-qpa nacl"
962     PLATFORM_QPA=yes
963     echo "-fast"
964     OPT_FAST=yes
965     echo "-qconfig nacl"
966     CFG_QCONFIG=nacl
967
968     if [ `uname` = "Linux" ]; then
969         I_FLAGS="$I_FLAGS -I${CFG_NACL_PATH}/toolchain/linux_x86/sdk/nacl-sdk/include"
970         L_FLAGS="$L_FLAGS -I${CFG_NACL_PATH}/toolchain/linux_x86/sdk/nacl-sdk/lib"
971     else
972         I_FLAGS="$I_FLAGS -I${CFG_NACL_PATH}/toolchain/mac_x86/sdk/nacl-sdk/include"
973         L_FLAGS="$L_FLAGS -I${CFG_NACL_PATH}/toolchain/mac_x86/sdk/nacl-sdk/lib"
974     fi
975
976     echo "-no-multimedia -no-webkit -no-phonon -no-nultimedia -no-mediaservices -no-xmlpatterns -no-script -no-sql-sqlite -nomake tests"
977     CFG_MULTIMEDIA=no
978     CFG_WEBKIT=no
979     CFG_PHONON=no
980     CFG_MULTIMEDIA=no
981     CFG_MEDIASERVICES=no
982     CFG_XMLPATTERNS=no
983     CFG_SCRIPT=no
984     CFG_SQLITE=no
985     CFG_SQL_sqlite=no
986     CFG_LIBTIFF=no
987     CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS tests"
988     QT_CONFIG="$QT_CONFIG nacl"
989 fi
990
991 #-------------------------------------------------------------------------------
992 # parse command line arguments
993 #-------------------------------------------------------------------------------
994
995 # parse the arguments, setting things to "yes" or "no"
996 while [ "$#" -gt 0 ]; do
997     CURRENT_OPT="$1"
998     UNKNOWN_ARG=no
999     case "$1" in
1000     #Autoconf style options
1001     --enable-*)
1002         VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"`
1003         VAL=yes
1004         ;;
1005     --disable-*)
1006         VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"`
1007         VAL=no
1008         ;;
1009     --*=*)
1010         VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"`
1011         VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"`
1012         ;;
1013     --no-*)
1014         VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
1015         VAL=no
1016         ;;
1017     --*)
1018         VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
1019         VAL=yes
1020         ;;
1021     #Qt plugin options
1022     -no-*-*|-plugin-*-*|-qt-*-*)
1023         VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
1024         VAL=`echo $1 | sed "s,^-\([^-]*\).*,\1,"`
1025         ;;
1026     #WebKit options
1027     -webkit)
1028         VAR="webkit"
1029         VAL="yes"
1030         ;;
1031     -webkit-debug)
1032         VAR="webkit"
1033         VAL="debug"
1034         ;;
1035     -no-webkit)
1036         VAR="webkit"
1037         VAL="no"
1038         ;;
1039     #Qt style no options
1040     -no-*)
1041         VAR=`echo $1 | sed "s,^-no-\(.*\),\1,"`
1042         VAL=no
1043         ;;
1044     #Qt style yes options
1045     -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|-xcb|-wayland|-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|-harfbuzz|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-v8|-declarative|-declarative-debug|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles|-icu)
1046         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
1047         VAL=yes
1048         ;;
1049     #Qt style options that pass an argument
1050     -qconfig)
1051         if [ "$PLATFORM_QWS" != "yes" -a "$PLATFORM_QPA" != "yes" ]; then
1052             echo
1053             echo "WARNING: -qconfig is only tested and supported on Qt for Embedded Linux."
1054             echo
1055         fi
1056         CFG_QCONFIG="$VAL"
1057         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
1058         shift
1059         VAL=$1
1060         ;;
1061     -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-depths|-make|-nomake|-platform|-xplatform|-sdk|-arch|-host-arch|-mysql_config)
1062         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
1063         shift
1064         VAL="$1"
1065         ;;
1066     #Qt style complex options in one command
1067     -enable-*|-disable-*)
1068         VAR=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
1069         VAL=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
1070         ;;
1071     #Qt Builtin/System style options
1072     -no-*|-system-*|-qt-*)
1073         VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
1074         VAL=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
1075         ;;
1076     #Options that cannot be generalized
1077     -k|-continue)
1078         VAR=fatal_error
1079         VAL=no
1080         ;;
1081     -embedded)
1082         VAR=embedded
1083         # this option may or may not be followed by an argument
1084         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
1085             VAL=auto
1086         else
1087             shift;
1088             VAL=$1
1089         fi
1090         ;;
1091     -embedded-lite|-qpa)
1092         VAR=qpa
1093         # this option may or may not be followed by an argument
1094         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
1095             VAL=auto
1096         else
1097             shift;
1098             VAL=$1
1099         fi
1100         ;;
1101     -nacl)
1102         VAR=nacl
1103         shift;
1104     ;;
1105     -opengl)
1106         VAR=opengl
1107         # this option may or may not be followed by an argument
1108         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
1109             VAL=yes
1110         else
1111             shift;
1112             VAL=$1
1113         fi
1114         ;;
1115     -openvg)
1116         VAR=openvg
1117         # this option may or may not be followed by an argument
1118         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
1119             VAL=yes
1120         else
1121             shift;
1122             VAL=$1
1123         fi
1124         ;;
1125     -hostprefix)
1126         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
1127         # this option may or may not be followed by an argument
1128         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
1129             VAL=$outpath
1130         else
1131             shift;
1132             VAL=$1
1133         fi
1134         ;;
1135     -host-*-endian)
1136         VAR=host_endian
1137         VAL=`echo $1 | sed "s,^-.*-\(.*\)-.*,\1,"`
1138         ;;
1139     -*-endian)
1140         VAR=endian
1141         VAL=`echo $1 | sed "s,^-\(.*\)-.*,\1,"`
1142         ;;
1143     -qtnamespace)
1144         VAR="qtnamespace"
1145         shift
1146         VAL="$1"
1147         ;;
1148     -graphicssystem)
1149         VAR="graphicssystem"
1150         shift
1151         VAL=$1
1152         ;;
1153     -runtimegraphicssystem)
1154         VAR="runtimegraphicssystem"
1155         shift
1156         VAL=$1
1157         ;;
1158     -qtlibinfix)
1159         VAR="qtlibinfix"
1160         shift
1161         VAL="$1"
1162         ;;
1163     -D?*|-D)
1164         VAR="add_define"
1165         if [ "$1" = "-D" ]; then
1166             shift
1167             VAL="$1"
1168         else
1169             VAL=`echo $1 | sed 's,-D,,'`
1170         fi
1171         ;;
1172     -fpu)
1173         VAR="fpu"
1174         # this option may or may not be followed by an argument
1175         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
1176             VAL=no
1177         else
1178             shift
1179             VAL=$1
1180         fi
1181         ;;
1182     -I?*|-I)
1183         VAR="add_ipath"
1184         if [ "$1" = "-I" ]; then
1185             shift
1186             VAL="$1"
1187         else
1188             VAL=`echo $1 | sed 's,-I,,'`
1189         fi
1190         ;;
1191     -L?*|-L)
1192         VAR="add_lpath"
1193         if [ "$1" = "-L" ]; then
1194             shift
1195             VAL="$1"
1196         else
1197             VAL=`echo $1 | sed 's,-L,,'`
1198         fi
1199         ;;
1200     -R?*|-R)
1201         VAR="add_rpath"
1202         if [ "$1" = "-R" ]; then
1203             shift
1204             VAL="$1"
1205         else
1206             VAL=`echo $1 | sed 's,-R,,'`
1207         fi
1208         ;;
1209     -l?*)
1210         VAR="add_link"
1211         VAL=`echo $1 | sed 's,-l,,'`
1212         ;;
1213     -F?*|-F)
1214         VAR="add_fpath"
1215         if [ "$1" = "-F" ]; then
1216             shift
1217             VAL="$1"
1218         else
1219             VAL=`echo $1 | sed 's,-F,,'`
1220         fi
1221         ;;
1222     -fw?*|-fw)
1223         VAR="add_framework"
1224         if [ "$1" = "-fw" ]; then
1225             shift
1226             VAL="$1"
1227         else
1228             VAL=`echo $1 | sed 's,-fw,,'`
1229         fi
1230         ;;
1231     -*)
1232         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
1233         VAL="unknown"
1234         ;;
1235     *)
1236         UNKNOWN_ARG=yes
1237         ;;
1238     esac
1239     if [ "$UNKNOWN_ARG" = "yes" ]; then
1240         echo "$1: unknown argument"
1241         OPT_HELP=yes
1242         ERROR=yes
1243         shift
1244         continue
1245      fi
1246     shift
1247
1248     UNKNOWN_OPT=no
1249     case "$VAR" in
1250     qt3support)
1251         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1252             CFG_QT3SUPPORT="$VAL"
1253         else
1254             UNKNOWN_OPT=yes
1255         fi
1256         ;;
1257     accessibility)
1258         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1259             CFG_ACCESSIBILITY="$VAL"
1260         else
1261             UNKNOWN_OPT=yes
1262         fi
1263         ;;
1264     license)
1265         LICENSE_FILE="$VAL"
1266         ;;
1267     gnumake)
1268         CFG_USE_GNUMAKE="$VAL"
1269         ;;
1270     mysql_config)
1271         CFG_MYSQL_CONFIG="$VAL"
1272         ;;
1273     prefix)
1274         QT_INSTALL_PREFIX="$VAL"
1275         ;;
1276     hostprefix)
1277         QT_HOST_PREFIX="$VAL"
1278         ;;
1279     force-pkg-config)
1280         QT_FORCE_PKGCONFIG=yes
1281         ;;
1282     docdir)
1283         QT_INSTALL_DOCS="$VAL"
1284         ;;
1285     headerdir)
1286         QT_INSTALL_HEADERS="$VAL"
1287         ;;
1288     plugindir)
1289         QT_INSTALL_PLUGINS="$VAL"
1290         ;;
1291     importdir)
1292         QT_INSTALL_IMPORTS="$VAL"
1293         ;;
1294     datadir)
1295         QT_INSTALL_DATA="$VAL"
1296         ;;
1297     libdir)
1298         QT_INSTALL_LIBS="$VAL"
1299         ;;
1300     qtnamespace)
1301         QT_NAMESPACE="$VAL"
1302         ;;
1303     qtlibinfix)
1304         QT_LIBINFIX="$VAL"
1305         ;;
1306     translationdir)
1307         QT_INSTALL_TRANSLATIONS="$VAL"
1308         ;;
1309     sysconfdir|settingsdir)
1310         QT_INSTALL_SETTINGS="$VAL"
1311         ;;
1312     examplesdir)
1313         QT_INSTALL_EXAMPLES="$VAL"
1314         ;;
1315     qconfig)
1316         CFG_QCONFIG="$VAL"
1317         ;;
1318     sysroot)
1319         CFG_SYSROOT="$VAL"
1320         ;;
1321     bindir)
1322         QT_INSTALL_BINS="$VAL"
1323         ;;
1324     sxe)
1325         CFG_SXE="$VAL"
1326         ;;
1327     embedded)
1328         CFG_EMBEDDED="$VAL"
1329         PLATFORM_X11=no
1330         PLATFORM_MAC=no
1331         PLATFORM_QWS=yes
1332         PLATFORM_QPA=no
1333         ;;
1334     embedded-lite|qpa)
1335         CFG_EMBEDDED="no"
1336         PLATFORM_X11=no
1337         PLATFORM_MAC=no
1338         PLATFORM_QWS=no
1339         PLATFORM_QPA=yes
1340         ;;
1341     nacl)
1342         ;;
1343     sse)
1344         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1345             CFG_SSE="$VAL"
1346         else
1347             UNKNOWN_OPT=yes
1348         fi
1349         ;;
1350     endian)
1351         if [ "$VAL" = "little" ]; then
1352             CFG_ENDIAN="Q_LITTLE_ENDIAN"
1353         elif [ "$VAL" = "big" ]; then
1354             CFG_ENDIAN="Q_BIG_ENDIAN"
1355         else
1356             UNKNOWN_OPT=yes
1357         fi
1358         ;;
1359     host_endian)
1360         if [ "$VAL" = "little" ]; then
1361             CFG_HOST_ENDIAN="Q_LITTLE_ENDIAN"
1362         elif [ "$VAL" = "big" ]; then
1363             CFG_HOST_ENDIAN="Q_BIG_ENDIAN"
1364         else
1365             UNKNOWN_OPT=yes
1366         fi
1367         ;;
1368     armfpa)
1369         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1370             CFG_ARMFPA="$VAL"
1371         else
1372             UNKNOWN_OPT=yes
1373         fi
1374         ;;
1375     depths)
1376         CFG_QWS_DEPTHS="$VAL"
1377         ;;
1378     opengl)
1379         if  [ "$VAL" = "auto" ] || [ "$VAL" = "desktop" ] ||
1380             [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] ||
1381             [ "$VAL" = "es2" ]; then
1382             CFG_OPENGL="$VAL"
1383             if  [ "$VAL" = "es2" ]; then
1384                 CFG_EGL="yes"
1385             fi
1386         else
1387             UNKNOWN_OPT=yes
1388         fi
1389         ;;
1390     openvg)
1391         if [ "$VAL" = "auto" ] || [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1392             CFG_OPENVG="$VAL"
1393             if [ "$CFG_EGL" = "no" ] && [ "$VAL" != "no" ]; then
1394                 CFG_EGL=auto
1395             fi
1396         else
1397             UNKNOWN_OPT=yes
1398         fi
1399         ;;
1400     graphicssystem)
1401         if [ "$PLATFORM_QWS" = "yes" ]; then
1402             echo "Error: Graphics System plugins are not supported on QWS."
1403             echo "   On QWS, the graphics system API is part of the QScreen plugin architecture "
1404             echo "   rather than existing as a separate plugin."
1405             echo ""
1406             UNKNOWN_OPT=yes
1407         else
1408             if  [ "$VAL" = "opengl" ]; then
1409                 CFG_GRAPHICS_SYSTEM="opengl"
1410             elif [ "$VAL" = "openvg" ]; then
1411                 CFG_GRAPHICS_SYSTEM="openvg"
1412             elif [ "$VAL" = "raster" ]; then
1413                 CFG_GRAPHICS_SYSTEM="raster"
1414             elif [ "$VAL" = "runtime" ]; then
1415                 CFG_GRAPHICS_SYSTEM="runtime"
1416             else
1417                 UNKNOWN_OPT=yes
1418             fi
1419         fi
1420         ;;
1421     runtimegraphicssystem)
1422         if  [ "$VAL" != "runtime" ]; then
1423             CFG_RUNTIME_SYSTEM="$VAL"
1424         fi
1425         ;;
1426
1427     qvfb) # left for commandline compatibility, not documented
1428         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1429             if [ "$VAL" = "yes" ]; then
1430                 QMakeVar add gfx-drivers qvfb
1431                 QMakeVar add kbd-drivers qvfb
1432                 QMakeVar add mouse-drivers qvfb
1433                 CFG_GFX_ON="$CFG_GFX_ON qvfb"
1434                 CFG_KBD_ON="$CFG_KBD_ON qvfb"
1435                 CFG_MOUSE_ON="$CFG_MOUSE_ON qvfb"
1436             fi
1437         else
1438             UNKNOWN_OPT=yes
1439         fi
1440         ;;
1441     nomake)
1442         CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS $VAL"
1443         ;;
1444     make)
1445         CFG_BUILD_PARTS="$CFG_BUILD_PARTS $VAL"
1446         ;;
1447     x11)
1448         PLATFORM_QPA=no
1449         PLATFORM_MAC=no
1450         PLATFORM_QWS=no
1451         PLATFORM_X11=yes
1452         ;;
1453     sdk)
1454         if [ "$PLATFORM_MAC" = "yes" ]; then
1455             CFG_SDK="$VAL"
1456         else
1457             UNKNOWN_OPT=yes
1458         fi
1459         ;;
1460      dwarf2)
1461         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1462             CFG_MAC_DWARF2="$VAL"
1463         else
1464             UNKNOWN_OPT=yes
1465         fi
1466         ;;
1467     arch)
1468         # if this is a Mac then "windows" probably means
1469         # we are cross-compiling for MinGW
1470         if [ "$PLATFORM_MAC" = "yes" ] && [ "$VAL" != "windows" ]; then
1471             CFG_MAC_ARCHS="$CFG_MAC_ARCHS $VAL"
1472         else
1473             CFG_ARCH=$VAL
1474         fi
1475         ;;
1476     host-arch)
1477         CFG_HOST_ARCH=$VAL
1478         ;;
1479     universal)
1480         if [ "$PLATFORM_MAC" = "yes" ] && [ "$VAL" = "yes" ]; then
1481             CFG_MAC_ARCHS="$CFG_MAC_ARCHS x86 ppc"
1482         else
1483             UNKNOWN_OPT=yes
1484         fi
1485         ;;
1486     cocoa)
1487 #       do nothing - Cocoa is the default.
1488         ;;
1489     carbon)
1490         if [ "$PLATFORM_MAC" = "yes" ] && [ "$VAL" = "yes" ]; then
1491             CFG_MAC_CARBON="$VAL"
1492             COMMANDLINE_MAC_CARBON="$VAL"
1493         else
1494             UNKNOWN_OPT=yes
1495         fi
1496         ;;
1497     harfbuzz)
1498         if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_CARBON" != "yes" ] && [ "$VAL" = "yes" ]; then
1499             CFG_MAC_HARFBUZZ="$VAL"
1500         else
1501             UNKNOWN_OPT=yes
1502         fi
1503         ;;
1504
1505     framework)
1506         if [ "$PLATFORM_MAC" = "yes" ] || [ "$PLATFORM_QPA" = "yes" ]; then
1507             CFG_FRAMEWORK="$VAL"
1508         else
1509             UNKNOWN_OPT=yes
1510         fi
1511         ;;
1512     profile)
1513         if [ "$VAL" = "yes" ]; then
1514             CFG_PROFILE=yes
1515             QMakeVar add QMAKE_CFLAGS -pg
1516             QMakeVar add QMAKE_CXXFLAGS -pg
1517             QMakeVar add QMAKE_LFLAGS -pg
1518             QMAKE_VARS="$QMAKE_VARS CONFIG+=nostrip"
1519         else
1520             UNKNOWN_OPT=yes
1521         fi
1522         ;;
1523     exceptions|g++-exceptions)
1524         if [ "$VAL" = "no" ]; then
1525             CFG_EXCEPTIONS=no
1526         elif [ "$VAL" = "yes" ]; then
1527             CFG_EXCEPTIONS=yes
1528         else
1529             UNKNOWN_OPT=yes
1530         fi
1531         ;;
1532     platform)
1533         PLATFORM="$VAL"
1534         # keep compatibility with old platform names
1535         case $PLATFORM in
1536         aix-64)
1537             PLATFORM=aix-xlc-64
1538             ;;
1539         hpux-o64)
1540             PLATFORM=hpux-acc-o64
1541             ;;
1542         hpux-n64)
1543             PLATFORM=hpux-acc-64
1544             ;;
1545         hpux-acc-n64)
1546             PLATFORM=hpux-acc-64
1547             ;;
1548         irix-n32)
1549             PLATFORM=irix-cc
1550             ;;
1551         irix-64)
1552             PLATFORM=irix-cc-64
1553             ;;
1554         irix-cc-n64)
1555             PLATFORM=irix-cc-64
1556             ;;
1557         reliant-64)
1558             PLATFORM=reliant-cds-64
1559             ;;
1560         solaris-64)
1561             PLATFORM=solaris-cc-64
1562             ;;
1563         openunix-cc)
1564             PLATFORM=unixware-cc
1565             ;;
1566         openunix-g++)
1567             PLATFORM=unixware-g++
1568             ;;
1569         unixware7-cc)
1570             PLATFORM=unixware-cc
1571             ;;
1572         unixware7-g++)
1573             PLATFORM=unixware-g++
1574             ;;
1575         macx-g++-64)
1576             PLATFORM=macx-g++
1577             NATIVE_64_ARCH=
1578             case `uname -p` in
1579             i386) NATIVE_64_ARCH="x86_64" ;;
1580             powerpc) NATIVE_64_ARCH="ppc64" ;;
1581             *)   echo "WARNING: Can't detect CPU architecture for macx-g++-64" ;;
1582             esac
1583             if [ ! -z "$NATIVE_64_ARCH" ]; then
1584                 QTCONFIG_CONFIG="$QTCONFIG_CONFIG $NATIVE_64_ARCH"
1585                 CFG_MAC_ARCHS="$CFG_MAC_ARCHS $NATIVE_64_ARCH"
1586             fi
1587             ;;
1588         esac
1589         ;;
1590     xplatform)
1591         XPLATFORM="$VAL"
1592         case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac
1593         case "$XPLATFORM" in *symbian*) XPLATFORM_SYMBIAN=yes;; esac
1594         case "$XPLATFORM" in symbian-sbsv2) XPLATFORM_SYMBIAN_SBSV2=yes;; esac
1595         ;;
1596     debug-and-release)
1597         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1598             CFG_DEBUG_RELEASE="$VAL"
1599         else
1600             UNKNOWN_OPT=yes
1601         fi
1602         ;;
1603     optimized-qmake)
1604         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1605             CFG_RELEASE_QMAKE="$VAL"
1606         else
1607             UNKNOWN_OPT=yes
1608         fi
1609         ;;
1610     release)
1611         if [ "$VAL" = "yes" ]; then
1612             CFG_DEBUG=no
1613         elif [ "$VAL" = "no" ]; then
1614             CFG_DEBUG=yes
1615         else
1616             UNKNOWN_OPT=yes
1617         fi
1618         ;;
1619     prefix-install)
1620         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1621             CFG_PREFIX_INSTALL="$VAL"
1622         else
1623             UNKNOWN_OPT=yes
1624         fi
1625         ;;
1626     debug)
1627         CFG_DEBUG="$VAL"
1628         ;;
1629     developer-build|commercial|opensource|nokia-developer)
1630         # These switches have been dealt with already
1631         ;;
1632     static)
1633         if [ "$VAL" = "yes" ]; then
1634             CFG_SHARED=no
1635         elif [ "$VAL" = "no" ]; then
1636             CFG_SHARED=yes
1637         else
1638             UNKNOWN_OPT=yes
1639         fi
1640         ;;
1641     incremental)
1642         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1643             CFG_INCREMENTAL="$VAL"
1644         else
1645             UNKNOWN_OPT=yes
1646         fi
1647         ;;
1648     fatal_error)
1649         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1650             CFG_CONFIGURE_EXIT_ON_ERROR="$VAL"
1651         else
1652             UNKNOWN_OPT=yes
1653         fi
1654         ;;
1655     feature-*)
1656             FEATURE=`echo $VAR | sed "s,^[^-]*-\([^-]*\),\1," | tr 'abcdefghijklmnopqrstuvwxyz-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
1657             if [ "$VAL" = "no" ]; then
1658                 QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_$FEATURE"
1659             elif [ "$VAL" = "yes" ] || [ "$VAL" = "unknown" ]; then
1660                 QCONFIG_FLAGS="$QCONFIG_FLAGS QT_$FEATURE"
1661             else
1662                 UNKNOWN_OPT=yes
1663             fi
1664         ;;
1665     shared)
1666         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1667             CFG_SHARED="$VAL"
1668         else
1669             UNKNOWN_OPT=yes
1670         fi
1671         ;;
1672     gif)
1673         if [ "$VAL" = "no" ]; then
1674             CFG_GIF="$VAL"
1675         else
1676             UNKNOWN_OPT=yes
1677         fi
1678         ;;
1679     sm)
1680         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1681             CFG_SM="$VAL"
1682         else
1683             UNKNOWN_OPT=yes
1684         fi
1685
1686         ;;
1687     xinerama)
1688         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1689             CFG_XINERAMA="$VAL"
1690         else
1691             UNKNOWN_OPT=yes
1692         fi
1693         ;;
1694     xshape)
1695         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1696             CFG_XSHAPE="$VAL"
1697         else
1698             UNKNOWN_OPT=yes
1699         fi
1700         ;;
1701     xvideo)
1702         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1703             CFG_XVIDEO="$VAL"
1704         else
1705             UNKNOWN_OPT=yes
1706         fi
1707         ;;
1708     xsync)
1709         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1710             CFG_XSYNC="$VAL"
1711         else
1712             UNKNOWN_OPT=yes
1713         fi
1714         ;;
1715     xinput)
1716         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1717             CFG_XINPUT="$VAL"
1718         else
1719             UNKNOWN_OPT=yes
1720         fi
1721         ;;
1722     egl)
1723         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1724             CFG_EGL="$VAL"
1725         else
1726             UNKNOWN_OPT=yes
1727         fi
1728         ;;
1729     stl)
1730         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1731             CFG_STL="$VAL"
1732         else
1733             UNKNOWN_OPT=yes
1734         fi
1735         ;;
1736     pch)
1737         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1738             CFG_PRECOMPILE="$VAL"
1739         else
1740             UNKNOWN_OPT=yes
1741         fi
1742         ;;
1743     separate-debug-info)
1744         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1745             CFG_SEPARATE_DEBUG_INFO="$VAL"
1746         elif [ "$VAL" = "nocopy" ] ; then
1747             CFG_SEPARATE_DEBUG_INFO="yes"
1748             CFG_SEPARATE_DEBUG_INFO_NOCOPY="yes"
1749         else
1750             UNKNOWN_OPT=yes
1751         fi
1752         ;;
1753     reduce-exports)
1754         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1755             CFG_REDUCE_EXPORTS="$VAL"
1756         else
1757             UNKNOWN_OPT=yes
1758         fi
1759         ;;
1760     mmx)
1761         if [ "$VAL" = "no" ]; then
1762             CFG_MMX="$VAL"
1763         else
1764             UNKNOWN_OPT=yes
1765         fi
1766         ;;
1767     3dnow)
1768         if [ "$VAL" = "no" ]; then
1769             CFG_3DNOW="$VAL"
1770         else
1771             UNKNOWN_OPT=yes
1772         fi
1773         ;;
1774     sse)
1775         if [ "$VAL" = "no" ]; then
1776             CFG_SSE="$VAL"
1777         else
1778             UNKNOWN_OPT=yes
1779         fi
1780         ;;
1781     sse2)
1782         if [ "$VAL" = "no" ]; then
1783             CFG_SSE2="$VAL"
1784         else
1785             UNKNOWN_OPT=yes
1786         fi
1787         ;;
1788     sse3)
1789         if [ "$VAL" = "no" ]; then
1790             CFG_SSE3="$VAL"
1791         else
1792             UNKNOWN_OPT=yes
1793         fi
1794         ;;
1795     ssse3)
1796         if [ "$VAL" = "no" ]; then
1797             CFG_SSSE3="$VAL"
1798         else
1799             UNKNOWN_OPT=yes
1800         fi
1801         ;;
1802     sse4.1)
1803         if [ "$VAL" = "no" ]; then
1804             CFG_SSE4_1="$VAL"
1805         else
1806             UNKNOWN_OPT=yes
1807         fi
1808         ;;
1809     sse4.2)
1810         if [ "$VAL" = "no" ]; then
1811             CFG_SSE4_2="$VAL"
1812         else
1813             UNKNOWN_OPT=yes
1814         fi
1815         ;;
1816     avx)
1817         if [ "$VAL" = "no" ]; then
1818             CFG_AVX="$VAL"
1819         else
1820             UNKNOWN_OPT=yes
1821         fi
1822         ;;
1823     iwmmxt)
1824         CFG_IWMMXT="yes"
1825         ;;
1826     neon)
1827         if [ "$VAL" = "no" ]; then
1828             CFG_NEON="$VAL"
1829         else
1830             UNKNOWN_OPT=yes
1831         fi
1832         ;;
1833     reduce-relocations)
1834         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1835             CFG_REDUCE_RELOCATIONS="$VAL"
1836         else
1837             UNKNOWN_OPT=yes
1838         fi
1839         ;;
1840     freetype)
1841         [ "$VAL" = "qt" ] && VAL=yes
1842         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1843             CFG_QWS_FREETYPE="$VAL"
1844         else
1845             UNKNOWN_OPT=yes
1846         fi
1847         ;;
1848     zlib)
1849         [ "$VAL" = "qt" ] && VAL=yes
1850         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1851             CFG_ZLIB="$VAL"
1852         else
1853             UNKNOWN_OPT=yes
1854         fi
1855         # No longer supported:
1856         #[ "$VAL" = "no" ] && CFG_LIBPNG=no
1857         ;;
1858     s60)
1859         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1860             CFG_S60="$VAL"
1861         else
1862             UNKNOWN_OPT=yes
1863         fi
1864         ;;
1865     usedeffiles)
1866         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1867             CFG_SYMBIAN_DEFFILES="$VAL"
1868         else
1869             UNKNOWN_OPT=yes
1870         fi
1871         ;;
1872     sqlite)
1873         if [ "$VAL" = "system" ]; then
1874             CFG_SQLITE=system
1875         else
1876             UNKNOWN_OPT=yes
1877         fi
1878         ;;
1879     libpng)
1880         [ "$VAL" = "yes" ] && VAL=qt
1881         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1882             CFG_LIBPNG="$VAL"
1883         else
1884             UNKNOWN_OPT=yes
1885         fi
1886         ;;
1887     libjpeg)
1888         [ "$VAL" = "yes" ] && VAL=qt
1889         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1890             CFG_LIBJPEG="$VAL"
1891         else
1892             UNKNOWN_OPT=yes
1893         fi
1894         ;;
1895     libmng)
1896         [ "$VAL" = "yes" ] && VAL=qt
1897         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1898             CFG_LIBMNG="$VAL"
1899         else
1900             UNKNOWN_OPT=yes
1901         fi
1902         ;;
1903     libtiff)
1904         [ "$VAL" = "yes" ] && VAL=qt
1905         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1906             CFG_LIBTIFF="$VAL"
1907         else
1908             UNKNOWN_OPT=yes
1909         fi
1910         ;;
1911     nas-sound)
1912         if [ "$VAL" = "system" ] || [ "$VAL" = "no" ]; then
1913             CFG_NAS="$VAL"
1914         else
1915             UNKNOWN_OPT=yes
1916         fi
1917         ;;
1918     xcursor)
1919         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1920             CFG_XCURSOR="$VAL"
1921         else
1922             UNKNOWN_OPT=yes
1923         fi
1924         ;;
1925     xfixes)
1926         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1927             CFG_XFIXES="$VAL"
1928         else
1929             UNKNOWN_OPT=yes
1930         fi
1931         ;;
1932     xrandr)
1933         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1934             CFG_XRANDR="$VAL"
1935         else
1936             UNKNOWN_OPT=yes
1937         fi
1938         ;;
1939     xrender)
1940         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1941             CFG_XRENDER="$VAL"
1942         else
1943             UNKNOWN_OPT=yes
1944         fi
1945         ;;
1946     mitshm)
1947         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1948             CFG_MITSHM="$VAL"
1949         else
1950             UNKNOWN_OPT=yes
1951         fi
1952         ;;
1953     fontconfig)
1954         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1955             CFG_FONTCONFIG="$VAL"
1956         else
1957             UNKNOWN_OPT=yes
1958         fi
1959         ;;
1960     xkb)
1961         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1962             CFG_XKB="$VAL"
1963         else
1964             UNKNOWN_OPT=yes
1965         fi
1966         ;;
1967     xcb)
1968         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1969             CFG_XCB="$VAL"
1970         else
1971             UNKNOWN_OPT=yes
1972         fi
1973         ;;
1974     wayland)
1975         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1976             CFG_WAYLAND="$VAL"
1977         else
1978             UNKNOWN_OPT=yes
1979         fi
1980         ;;
1981     cups)
1982         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1983             CFG_CUPS="$VAL"
1984         else
1985             UNKNOWN_OPT=yes
1986         fi
1987         ;;
1988     iconv)
1989         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1990             CFG_ICONV="$VAL"
1991         else
1992             UNKNOWN_OPT=yes
1993         fi
1994         ;;
1995     glib)
1996         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1997             CFG_GLIB="$VAL"
1998         else
1999             UNKNOWN_OPT=yes
2000         fi
2001         ;;
2002     gstreamer)
2003         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2004             CFG_GSTREAMER="$VAL"
2005         else
2006             UNKNOWN_OPT=yes
2007         fi
2008         ;;
2009     gtkstyle)
2010         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2011             CFG_QGTKSTYLE="$VAL"
2012         else
2013             UNKNOWN_OPT=yes
2014         fi
2015         ;;
2016     style-s60)
2017         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ]; then
2018             CFG_QS60STYLE="$VAL"
2019         else
2020             UNKNOWN_OPT=yes
2021         fi
2022         ;;
2023     gui)
2024         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
2025             CFG_GUI="yes"
2026         else
2027             if [ "$VAL" = "no" ]; then
2028                 CFG_GUI="no"
2029             else
2030                 UNKNOWN_OPT=yes
2031             fi
2032         fi
2033         ;;
2034     qdbus|dbus)
2035         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "linked" ]; then
2036             CFG_DBUS="$VAL"
2037         elif [ "$VAL" = "runtime" ]; then
2038             CFG_DBUS="yes"
2039         else
2040             UNKNOWN_OPT=yes
2041         fi
2042         ;;
2043     dbus-linked)
2044         if [ "$VAL" = "yes" ]; then
2045             CFG_DBUS="linked"
2046         else
2047             UNKNOWN_OPT=yes
2048         fi
2049         ;;
2050     nis)
2051         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2052             CFG_NIS="$VAL"
2053         else
2054             UNKNOWN_OPT=yes
2055         fi
2056         ;;
2057     largefile)
2058         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2059             CFG_LARGEFILE="$VAL"
2060         else
2061             UNKNOWN_OPT=yes
2062         fi
2063         ;;
2064     openssl)
2065         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2066             CFG_OPENSSL="$VAL"
2067         else
2068             UNKNOWN_OPT=yes
2069         fi
2070         ;;
2071     openssl-linked)
2072         if [ "$VAL" = "yes" ]; then
2073             CFG_OPENSSL="linked"
2074         else
2075             UNKNOWN_OPT=yes
2076         fi
2077         ;;
2078     ptmalloc)
2079         if [ "$VAL" = "yes" ]; then
2080             CFG_PTMALLOC="yes"
2081         else
2082             UNKNOWN_OPT=yes
2083         fi
2084         ;;
2085
2086     xmlpatterns)
2087         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
2088             CFG_XMLPATTERNS="yes"
2089         else
2090             if [ "$VAL" = "no" ]; then
2091                 CFG_XMLPATTERNS="no"
2092             else
2093                 UNKNOWN_OPT=yes
2094             fi
2095         fi
2096         ;;
2097     script)
2098         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
2099             CFG_SCRIPT="yes"
2100         else
2101             if [ "$VAL" = "no" ]; then
2102                 CFG_SCRIPT="no"
2103             else
2104                 UNKNOWN_OPT=yes
2105             fi
2106         fi
2107         ;;
2108     scripttools)
2109         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
2110             CFG_SCRIPTTOOLS="yes"
2111         else
2112             if [ "$VAL" = "no" ]; then
2113                 CFG_SCRIPTTOOLS="no"
2114             else
2115                 UNKNOWN_OPT=yes
2116             fi
2117         fi
2118         ;;
2119     svg)
2120         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
2121             CFG_SVG="yes"
2122         else
2123             if [ "$VAL" = "no" ]; then
2124                 CFG_SVG="no"
2125             else
2126                 UNKNOWN_OPT=yes
2127             fi
2128         fi
2129         ;;
2130     v8)
2131         if [ "$VAL" = "yes" ]; then
2132             CFG_V8="yes"
2133         else
2134             if [ "$VAL" = "no" ]; then
2135                 CFG_V8="no"
2136             else
2137                 UNKNOWN_OPT=yes
2138             fi
2139         fi
2140         ;;
2141     declarative)
2142         if [ "$VAL" = "yes" ]; then
2143             CFG_DECLARATIVE="yes"
2144         else
2145             if [ "$VAL" = "no" ]; then
2146                 CFG_DECLARATIVE="no"
2147             else
2148                 UNKNOWN_OPT=yes
2149             fi
2150         fi
2151         ;;
2152     declarative-debug)
2153         if [ "$VAL" = "yes" ]; then
2154             CFG_DECLARATIVE_DEBUG="yes"
2155         else
2156             if [ "$VAL" = "no" ]; then
2157                 CFG_DECLARATIVE_DEBUG="no"
2158             else
2159                 UNKNOWN_OPT=yes
2160             fi
2161         fi
2162         ;;
2163     webkit)
2164         [ "$VAL" = "auto" ] && VAL="yes"
2165         CFG_WEBKIT="$VAL"
2166         ;;
2167     location)
2168         if [ "$VAL" = "yes" ]; then
2169             CFG_LOCATION="yes"
2170         else
2171             if [ "$VAL" = "no" ]; then
2172                 CFG_LOCATION="no"
2173             else
2174                 UNKNOWN_OPT=yes
2175             fi
2176         fi
2177         ;;
2178     javascript-jit)
2179         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then 
2180             CFG_JAVASCRIPTCORE_JIT="$VAL"
2181         else
2182             UNKNOWN_OPT=yes
2183         fi
2184         ;;
2185     confirm-license)
2186         if [ "$VAL" = "yes" ]; then
2187             OPT_CONFIRM_LICENSE="$VAL"
2188         else
2189             UNKNOWN_OPT=yes
2190         fi
2191         ;;
2192     h|help)
2193         if [ "$VAL" = "yes" ]; then
2194             OPT_HELP="$VAL"
2195         else
2196             UNKNOWN_OPT=yes
2197         fi
2198         ;;
2199     sql-*|gfx-*|decoration-*|kbd-*|mouse-*|imageformat-*)
2200         # if Qt style options were used, $VAL can be "no", "qt", or "plugin"
2201         # if autoconf style options were used, $VAL can be "yes" or "no"
2202         [ "$VAL" = "yes" ] && VAL=qt
2203         # now $VAL should be "no", "qt", or "plugin"... double-check
2204         if [ "$VAL" != "no" ] && [ "$VAL" != "qt" ] && [ "$VAL" != "plugin" ]; then
2205             UNKNOWN_OPT=yes
2206         fi
2207         # now $VAL is "no", "qt", or "plugin"
2208         OPT="$VAL"
2209         VAL=`echo $VAR | sed "s,^[^-]*-\([^-]*\).*,\1,"`
2210         VAR=`echo $VAR | sed "s,^\([^-]*\).*,\1,"`
2211
2212         # Grab the available values
2213         case "$VAR" in
2214         sql)
2215             avail="$CFG_SQL_AVAILABLE"
2216             ;;
2217         gfx)
2218             avail="$CFG_GFX_AVAILABLE"
2219             if [ "$OPT" = "plugin" ]; then
2220                 avail="$CFG_GFX_PLUGIN_AVAILABLE"
2221             fi
2222             ;;
2223         decoration)
2224             avail="$CFG_DECORATION_AVAILABLE"
2225             if [ "$OPT" = "plugin" ]; then
2226                 avail="$CFG_DECORATION_PLUGIN_AVAILABLE"
2227             fi
2228             ;;
2229         kbd)
2230             avail="$CFG_KBD_AVAILABLE"
2231             if [ "$OPT" = "plugin" ]; then
2232                 avail="$CFG_KBD_PLUGIN_AVAILABLE"
2233             fi
2234             ;;
2235         mouse)
2236             avail="$CFG_MOUSE_AVAILABLE"
2237             if [ "$OPT" = "plugin" ]; then
2238                 avail="$CFG_MOUSE_PLUGIN_AVAILABLE"
2239             fi
2240             ;;
2241         imageformat)
2242             avail="$CFG_IMAGEFORMAT_PLUGIN_AVAILABLE"
2243             if [ "$OPT" != "plugin" ]; then
2244                 # png is always built in
2245                 avail="$avail png"
2246             fi
2247             ;;
2248         *)
2249             avail=""
2250             echo "BUG: Unhandled type $VAR used in $CURRENT_OPT"
2251             ;;
2252         esac
2253
2254         # Check that that user's value is available.
2255         found=no
2256         for d in $avail; do
2257             if [ "$VAL" = "$d" ]; then
2258                 found=yes
2259                 break
2260             fi
2261         done
2262         [ "$found" = yes ] || ERROR=yes
2263
2264         if [ "$VAR" = "sql" ]; then
2265             # set the CFG_SQL_driver
2266             eval "CFG_SQL_$VAL=\$OPT"
2267             continue
2268         elif [ "$VAR" = "imageformat" ]; then
2269             [ "$OPT" = "qt" ] && OPT=yes
2270             VAL="`echo $VAL |tr a-z A-Z`"
2271             eval "CFG_$VAL=$OPT"
2272             continue
2273         fi
2274
2275         if [ "$OPT" = "plugin" ] || [ "$OPT" = "qt" ]; then
2276             if [ "$OPT" = "plugin" ]; then
2277                 [ "$VAR" = "decoration" ] && QMakeVar del "${VAR}s" "$VAL"
2278                 [ "$VAR" = "decoration" ] && CFG_DECORATION_ON=`echo "${CFG_DECORATION_ON} " | sed "s,${VAL} ,,g"` && CFG_DECORATION_PLUGIN="$CFG_DECORATION_PLUGIN ${VAL}"
2279                 [ "$VAR" = "kbd" ] && QMakeVar del "${VAR}s" "$VAL"
2280                 [ "$VAR" = "kbd" ] && CFG_KBD_ON=`echo "${CFG_KBD_ON} " | sed "s,${VAL} ,,g"` && CFG_KBD_PLUGIN="$CFG_KBD_PLUGIN ${VAL}"
2281                 [ "$VAR" = "mouse" ] && QMakeVar del "${VAR}s" "$VAL"
2282                 [ "$VAR" = "mouse" ] && CFG_MOUSE_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"` && CFG_MOUSE_PLUGIN="$CFG_MOUSE_PLUGIN ${VAL}"
2283                 [ "$VAR" = "gfx" ] && QMakeVar del "${VAR}s" "$VAL"
2284                 [ "$VAR" = "gfx" ] && CFG_GFX_ON=`echo "${CFG_GFX_ON} " | sed "s,${VAL} ,,g"` && CFG_GFX_PLUGIN="${CFG_GFX_PLUGIN} ${VAL}"
2285                 VAR="${VAR}-${OPT}"
2286             else
2287                 if [ "$VAR" = "gfx" ] || [ "$VAR" = "kbd" ] || [ "$VAR" = "decoration" ] || [ "$VAR" = "mouse" ]; then
2288                     [ "$VAR" = "gfx" ] && CFG_GFX_ON="$CFG_GFX_ON $VAL"
2289                     [ "$VAR" = "kbd" ] && CFG_KBD_ON="$CFG_KBD_ON $VAL"
2290                     [ "$VAR" = "decoration" ] && CFG_DECORATION_ON="$CFG_DECORATION_ON $VAL"
2291                     [ "$VAR" = "mouse" ] && CFG_MOUSE_ON="$CFG_MOUSE_ON $VAL"
2292                     VAR="${VAR}-driver"
2293                 fi
2294             fi
2295             QMakeVar add "${VAR}s" "${VAL}"
2296         elif [ "$OPT" = "no" ]; then
2297             PLUG_VAR="${VAR}-plugin"
2298             if [ "$VAR" = "gfx" ] || [ "$VAR" = "kbd" ] || [ "$VAR" = "mouse" ]; then
2299                 IN_VAR="${VAR}-driver"
2300             else
2301                 IN_VAR="${VAR}"
2302             fi
2303             [ "$VAR" = "decoration" ] && CFG_DECORATION_ON=`echo "${CFG_DECORATION_ON} " | sed "s,${VAL} ,,g"`
2304             [ "$VAR" = "gfx" ] && CFG_GFX_ON=`echo "${CFG_GFX_ON} " | sed "s,${VAL} ,,g"`
2305             [ "$VAR" = "kbd" ] && CFG_KBD_ON=`echo "${CFG_KBD_ON} " | sed "s,${VAL} ,,g"`
2306             [ "$VAR" = "mouse" ] && CFG_MOUSE_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"`
2307             QMakeVar del "${IN_VAR}s" "$VAL"
2308             QMakeVar del "${PLUG_VAR}s" "$VAL"
2309         fi
2310         if [ "$ERROR" = "yes" ]; then
2311            echo "$CURRENT_OPT: unknown argument"
2312            OPT_HELP=yes
2313         fi
2314         ;;
2315     v|verbose)
2316         if [ "$VAL" = "yes" ]; then
2317             if [ "$OPT_VERBOSE" = "$VAL" ]; then            # takes two verboses to turn on qmake debugs
2318                 QMAKE_SWITCHES="$QMAKE_SWITCHES -d"
2319             else
2320                 OPT_VERBOSE=yes
2321             fi
2322         elif [ "$VAL" = "no" ]; then
2323             if [ "$OPT_VERBOSE" = "$VAL" ] && echo "$QMAKE_SWITCHES" | grep ' -d' >/dev/null 2>&1; then
2324                 QMAKE_SWITCHES=`echo $QMAKE_SWITCHES | sed "s, -d,,"`
2325             else
2326                 OPT_VERBOSE=no
2327             fi
2328         else
2329             UNKNOWN_OPT=yes
2330         fi
2331         ;;
2332     fast)
2333         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2334             OPT_FAST="$VAL"
2335         else
2336             UNKNOWN_OPT=yes
2337         fi
2338         ;;
2339     rpath)
2340         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2341             CFG_RPATH="$VAL"
2342         else
2343             UNKNOWN_OPT=yes
2344         fi
2345         ;;
2346     add_define)
2347         D_FLAGS="$D_FLAGS \"$VAL\""
2348         ;;
2349     add_ipath)
2350         I_FLAGS="$I_FLAGS -I\"${VAL}\""
2351         ;;
2352     add_lpath)
2353         L_FLAGS="$L_FLAGS -L\"${VAL}\""
2354         ;;
2355     add_rpath)
2356         RPATH_FLAGS="$RPATH_FLAGS \"${VAL}\""
2357         ;;
2358     add_link)
2359         l_FLAGS="$l_FLAGS -l\"${VAL}\""
2360         ;;
2361     add_fpath)
2362         if [ "$PLATFORM_MAC" = "yes" ]; then
2363             L_FLAGS="$L_FLAGS -F\"${VAL}\""
2364             I_FLAGS="$I_FLAGS -F\"${VAL}\""
2365         else
2366             UNKNOWN_OPT=yes
2367         fi
2368         ;;
2369     add_framework)
2370         if [ "$PLATFORM_MAC" = "yes" ]; then
2371             l_FLAGS="$l_FLAGS -framework \"${VAL}\""
2372         else
2373             UNKNOWN_OPT=yes
2374         fi
2375         ;;
2376     silent)
2377         CFG_SILENT="$VAL"
2378         ;;
2379     phonon)
2380         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2381             CFG_PHONON="$VAL"
2382         else
2383             UNKNOWN_OPT=yes
2384         fi
2385         ;;
2386     phonon-backend)
2387         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2388             CFG_PHONON_BACKEND="$VAL"
2389         else
2390             UNKNOWN_OPT=yes
2391         fi
2392         ;;
2393     multimedia)
2394         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2395             CFG_MULTIMEDIA="$VAL"
2396         else
2397             UNKNOWN_OPT=yes
2398         fi
2399         ;;
2400     dont-process)
2401         CFG_NOPROCESS=yes
2402         ;;
2403     process)
2404         CFG_NOPROCESS=no
2405         ;;
2406     audio-backend)
2407         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2408             CFG_AUDIO_BACKEND="$VAL"
2409         else
2410             UNKNOWN_OPT=yes
2411         fi
2412         ;;
2413     fpu)
2414        if [ "$VAL" != "no" ]; then
2415           QT_CFLAGS_FPU=$VAL
2416        fi
2417        ;;
2418     icu)
2419         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2420             CFG_ICU="$VAL"
2421         else
2422             UNKNOWN_OPT=yes
2423         fi
2424         ;;
2425     *)
2426         UNKNOWN_OPT=yes
2427         ;;
2428     esac
2429     if [ "$UNKNOWN_OPT" = "yes" ]; then
2430         echo "${CURRENT_OPT}: invalid command-line switch"
2431         OPT_HELP=yes
2432         ERROR=yes
2433     fi
2434 done
2435
2436 if [ "$CFG_QCONFIG" != "full" ] && [ "$CFG_QT3SUPPORT" = "yes" ]; then
2437     echo "Warning: '-qconfig $CFG_QCONFIG' will disable the qt3support library."
2438     CFG_QT3SUPPORT="no"
2439 fi
2440 if [ "$CFG_GUI" = "no" ]; then
2441     echo "Warning: -no-gui will disable the qt3support library."
2442     CFG_QT3SUPPORT="no"
2443 fi
2444
2445 #disable Qt3Support for Lighthouse
2446 if [ "$PLATFORM_QPA" = "yes" ]; then
2447     CFG_QT3SUPPORT="no"
2448 fi
2449
2450 # update QT_CONFIG to show our current predefined configuration
2451 case "$CFG_QCONFIG" in
2452 minimal|small|medium|large|full)
2453     # these are a sequence of increasing functionality
2454     for c in minimal small medium large full; do
2455         QT_CONFIG="$QT_CONFIG $c-config"
2456         [ "$CFG_QCONFIG" = $c ] && break
2457     done
2458     ;;
2459 *)
2460     # not known to be sufficient for anything
2461     if [ '!' -f "$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h" ] && [ '!' -f `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` ]; then
2462         echo >&2 "Error: configuration file not found:"
2463         echo >&2 "  $relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h"
2464         echo >&2 "  or"
2465         echo >&2 "  `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"`"
2466         OPT_HELP=yes
2467     fi
2468 esac
2469
2470 #-------------------------------------------------------------------------------
2471 # build tree initialization
2472 #-------------------------------------------------------------------------------
2473
2474 # where to find which..
2475 unixtests="$relpath/config.tests/unix"
2476 mactests="$relpath/config.tests/mac"
2477 symbiantests="$relpath/config.tests/symbian"
2478 WHICH="$unixtests/which.test"
2479
2480 PERL=`$WHICH perl 2>/dev/null`
2481
2482 # find out which awk we want to use, prefer gawk, then nawk, then regular awk
2483 AWK=
2484 for e in gawk nawk awk; do
2485     if "$WHICH" $e >/dev/null 2>&1 && ( $e -f /dev/null /dev/null ) >/dev/null 2>&1; then
2486         AWK=$e
2487         break
2488     fi
2489 done
2490
2491 # find perl
2492 PERL="/usr/bin/perl"
2493 if "$WHICH" perl >/dev/null 2>&1 && ( perl /dev/null ) >/dev/null 2>&1; then
2494     PERL=`$WHICH perl`
2495 fi
2496
2497 ### skip this if the user just needs help...
2498 if [ "$OPT_HELP" != "yes" ]; then
2499
2500 # is this a shadow build?
2501 if [ "$OPT_SHADOW" = "maybe" ]; then
2502     OPT_SHADOW=no
2503     if [ "$relpath" != "$outpath" ] && [ '!' -f "$outpath/configure" ]; then
2504         if [ -h "$outpath" ]; then
2505             [ "$relpath" -ef "$outpath" ] || OPT_SHADOW=yes
2506         else
2507             OPT_SHADOW=yes
2508         fi
2509     fi
2510 fi
2511 if [ "$OPT_SHADOW" = "yes" ]; then
2512     if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" -o -f "$relpath/src/corelib/global/qconfig.cpp" ]; then
2513         echo >&2 "You cannot make a shadow build from a source tree containing a previous build."
2514         echo >&2 "Cannot proceed."
2515         exit 1
2516     fi
2517     [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..."
2518 fi
2519
2520 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
2521     echo
2522     echo "WARNING: -debug-and-release is not supported anymore on Qt/X11 and Qt for Embedded Linux"
2523     echo "Qt can be built in release mode with separate debug information, so"
2524     echo "-debug-and-release is not necessary anymore"
2525     echo
2526 fi
2527
2528 if [ "$CFG_SILENT" = "yes" ]; then
2529     QMAKE_CONFIG="$QMAKE_CONFIG silent"
2530 fi
2531
2532 # if the source tree is different from the build tree,
2533 # symlink or copy part of the sources
2534 if [ "$OPT_SHADOW" = "yes" ]; then
2535     echo "Preparing build tree..."
2536
2537     if [ -z "$PERL" ]; then
2538         echo
2539         echo "You need perl in your PATH to make a shadow build."
2540         echo "Cannot proceed."
2541         exit 1
2542     fi
2543
2544     [ -d "$outpath/bin" ] || mkdir -p "$outpath/bin"
2545
2546     # symlink the qmake directory
2547     find "$relpath/qmake" | while read a; do
2548         my_a=`echo "$a" | sed "s,^${relpath}/,${outpath}/,"`
2549         if [ '!' -f "$my_a" ]; then
2550             if [ -d "$a" ]; then
2551                 # directories are created...
2552                 mkdir -p "$my_a"
2553             else
2554                 a_dir=`dirname "$my_a"`
2555                 [ -d "$a_dir" ] || mkdir -p "$a_dir"
2556                 # ... and files are symlinked
2557                 case `basename "$a"` in
2558                 *.o|*.d|GNUmakefile*|qmake)
2559                     ;;
2560                 *)
2561                     rm -f "$my_a"
2562                     ln -s "$a" "$my_a"
2563                     ;;
2564                 esac
2565             fi
2566         fi
2567     done
2568
2569     # make a syncqt script that can be used in the shadow
2570     rm -f "$outpath/bin/syncqt"
2571     if [ -x "$relpath/bin/syncqt" ]; then
2572         mkdir -p "$outpath/bin"
2573         echo "#!/bin/sh" >"$outpath/bin/syncqt"
2574         echo "perl \"$relpath/bin/syncqt\" -outdir \"$outpath\" \"$relpath\" \"\$@\"" >>"$outpath/bin/syncqt"
2575         chmod 755 "$outpath/bin/syncqt"
2576     fi
2577
2578     for i in elf2e32_qtwrapper createpackage patch_capabilities qtmodule-configtests; do
2579         rm -f "$outpath/bin/$i"
2580         if [ -x "$relpath/bin/$i" ]; then
2581             mkdir -p "$outpath/bin"
2582             echo "#!/bin/sh" >"$outpath/bin/$i"
2583             echo "QTDIR=\"$relpath\"; export QTDIR" >>"$outpath/bin/$i"
2584             echo "\"$relpath/bin/$i\" \"\$@\"" >>"$outpath/bin/$i"
2585             chmod 755 "$outpath/bin/$i"
2586         fi
2587     done
2588
2589     # symlink the mkspecs directory
2590     mkdir -p "$outpath/mkspecs"
2591     rm -rf "$outpath"/mkspecs/*
2592     ln -s "$relpath"/mkspecs/* "$outpath/mkspecs"
2593     rm -f "$outpath/mkspecs/default"
2594
2595     ShadowMkspecs()
2596     {
2597         rm -rf "$outpath/mkspecs/$1"
2598         find "$relpath/mkspecs/$1" -type d | sed "s,^$relpath,$outpath," | xargs mkdir -p
2599         find "$relpath/mkspecs/$1" -type f | sed "s,^$relpath/,," | while read f; do ln -s "$relpath/$f" "$outpath/$f"; done
2600     }
2601
2602     # Special case for mkspecs/features directory.
2603     # To be able to place .prf files into a shadow build directory,
2604     # we're creating links for files only. The directory structure is reproduced.
2605     ShadowMkspecs features
2606
2607     # The modules dir is special, too.
2608     ShadowMkspecs modules
2609
2610     # symlink the doc directory
2611     rm -rf "$outpath/doc"
2612     ln -s "$relpath/doc" "$outpath/doc"
2613
2614     # make sure q3porting.xml can be found
2615     mkdir -p "$outpath/tools/porting/src"
2616     rm -f "$outpath/tools/porting/src/q3porting.xml"
2617     ln -s "$relpath/tools/porting/src/q3porting.xml" "$outpath/tools/porting/src"
2618 fi
2619
2620 # symlink fonts to be able to run application from build directory
2621 if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ] && [ ! -d "${outpath}/lib/fonts" ]; then
2622     if [ "$PLATFORM" = "$XPLATFORM" ]; then
2623         mkdir -p "${outpath}/lib"
2624         ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts"
2625     fi
2626 fi
2627
2628 if [ "$OPT_FAST" = "auto" ]; then
2629    if [ '!' -z "$AWK" ] && [ "$CFG_DEV" = "yes" ]; then
2630        OPT_FAST=yes
2631    else
2632        OPT_FAST=no
2633    fi
2634 fi
2635
2636 # find a make command
2637 if [ -z "$MAKE" ]; then
2638     MAKE=
2639     for mk in gmake make; do
2640         if "$WHICH" $mk >/dev/null 2>&1; then
2641             MAKE=`"$WHICH" $mk`
2642             break
2643         fi
2644     done
2645     if [ -z "$MAKE" ]; then
2646         echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH."
2647         echo >&2 "Cannot proceed."
2648         exit 1
2649     fi
2650     # export MAKE, we need it later in the config.tests
2651     export MAKE
2652 fi
2653
2654 fi ### help
2655
2656 #-------------------------------------------------------------------------------
2657 # auto-detect all that hasn't been specified in the arguments
2658 #-------------------------------------------------------------------------------
2659
2660 [ "$PLATFORM_QWS" = "yes" -a "$CFG_EMBEDDED" = "no" ] && CFG_EMBEDDED=auto
2661 if [ "$CFG_EMBEDDED" != "no" ]; then
2662     case "$UNAME_SYSTEM:$UNAME_RELEASE" in
2663     Darwin:*)
2664         [ -z "$PLATFORM" ] && PLATFORM=qws/macx-generic-g++
2665         if [ -z "$XPLATFORM" ]; then
2666             [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2667             XPLATFORM="qws/macx-$CFG_EMBEDDED-g++"
2668         fi
2669         ;;
2670     FreeBSD:*)
2671         [ -z "$PLATFORM" ] && PLATFORM=qws/freebsd-generic-g++
2672         if [ -z "$XPLATFORM" ]; then
2673             [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2674             XPLATFORM="qws/freebsd-$CFG_EMBEDDED-g++"
2675         fi
2676         ;;
2677     SunOS:5*)
2678         [ -z "$PLATFORM" ] && PLATFORM=qws/solaris-generic-g++
2679         if [ -z "$XPLATFORM" ]; then
2680             [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2681             XPLATFORM="qws/solaris-$CFG_EMBEDDED-g++"
2682         fi
2683         ;;
2684     Linux:*)
2685         if [ -z "$PLATFORM" ]; then
2686             case "$UNAME_MACHINE" in
2687             *86)
2688                 PLATFORM=qws/linux-x86-g++
2689                 ;;
2690             *86_64)
2691                 PLATFORM=qws/linux-x86_64-g++
2692                 ;;
2693             *)
2694                 PLATFORM=qws/linux-generic-g++
2695                 ;;
2696             esac
2697         fi
2698         if [ -z "$XPLATFORM" ]; then
2699             if [ "$CFG_EMBEDDED" = "auto" ]; then
2700                 if [ -n "$CFG_ARCH" ]; then
2701                     CFG_EMBEDDED=$CFG_ARCH
2702                 else
2703                     case "$UNAME_MACHINE" in
2704                     *86)
2705                         CFG_EMBEDDED=x86
2706                         ;;
2707                     *86_64)
2708                         CFG_EMBEDDED=x86_64
2709                         ;;
2710                     *)
2711                         CFG_EMBEDDED=generic
2712                         ;;
2713                     esac
2714                 fi
2715             fi
2716             XPLATFORM="qws/linux-$CFG_EMBEDDED-g++"
2717         fi
2718         ;;
2719     QNX:*)
2720         [ -z "$PLATFORM" ] && PLATFORM=unsupported/qws/qnx-generic-g++
2721         if [ -z "$XPLATFORM" ]; then
2722             [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2723             XPLATFORM="unsupported/qws/qnx-$CFG_EMBEDDED-g++"
2724         fi
2725         ;;
2726     CYGWIN*:*)
2727         if [ -z "$XPLATFORM" ]; then
2728                 CFG_EMBEDDED=x86
2729         fi
2730         ;;
2731     *)
2732         echo "Qt for Embedded Linux is not supported on this platform. Disabling."
2733         CFG_EMBEDDED=no
2734         PLATFORM_QWS=no
2735         PLATFORM_QPA=no
2736         ;;
2737     esac
2738 fi
2739 if [ -z "$PLATFORM" ]; then
2740     PLATFORM_NOTES=
2741     case "$UNAME_SYSTEM:$UNAME_RELEASE" in
2742      Darwin:*)
2743         if [ "$PLATFORM_MAC" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
2744           PLATFORM=macx-g++
2745         # PLATFORM=macx-xcode
2746         else
2747           PLATFORM=darwin-g++
2748         fi
2749         ;;
2750      AIX:*)
2751         #PLATFORM=aix-g++
2752         #PLATFORM=aix-g++-64
2753         PLATFORM=aix-xlc
2754         #PLATFORM=aix-xlc-64
2755         PLATFORM_NOTES="
2756             - Also available for AIX: aix-g++ aix-g++-64 aix-xlc-64
2757         "
2758         ;;
2759      GNU:*)
2760         PLATFORM=hurd-g++
2761         ;;
2762      dgux:*)
2763         PLATFORM=dgux-g++
2764         ;;
2765 #     DYNIX/ptx:4*)
2766 #       PLATFORM=dynix-g++
2767 #       ;;
2768      ULTRIX:*)
2769         PLATFORM=ultrix-g++
2770         ;;
2771      FreeBSD:*)
2772         PLATFORM=freebsd-g++
2773         PLATFORM_NOTES="
2774             - Also available for FreeBSD: freebsd-icc
2775         "
2776         ;;
2777      OpenBSD:*)
2778         PLATFORM=openbsd-g++
2779         ;;
2780      NetBSD:*)
2781         PLATFORM=netbsd-g++
2782         ;;
2783      BSD/OS:*|BSD/386:*)
2784         PLATFORM=bsdi-g++
2785         ;;
2786      IRIX*:*)
2787         #PLATFORM=irix-g++
2788         PLATFORM=irix-cc
2789         #PLATFORM=irix-cc-64
2790         PLATFORM_NOTES="
2791             - Also available for IRIX: irix-g++ irix-cc-64
2792         "
2793         ;;
2794      HP-UX:*)
2795         case "$UNAME_MACHINE" in
2796             ia64)
2797                 #PLATFORM=hpuxi-acc-32
2798                 PLATFORM=hpuxi-acc-64
2799                 PLATFORM_NOTES="
2800                     - Also available for HP-UXi: hpuxi-acc-32
2801                 "
2802             ;;
2803             *)
2804                 #PLATFORM=hpux-g++
2805                 PLATFORM=hpux-acc
2806                 #PLATFORM=hpux-acc-64
2807                 #PLATFORM=hpux-cc
2808                 #PLATFORM=hpux-acc-o64
2809                 PLATFORM_NOTES="
2810                     - Also available for HP-UX: hpux-g++ hpux-acc-64 hpux-acc-o64
2811                 "
2812             ;;
2813         esac
2814         ;;
2815      OSF1:*)
2816         #PLATFORM=tru64-g++
2817         PLATFORM=tru64-cxx
2818         PLATFORM_NOTES="
2819             - Also available for Tru64: tru64-g++
2820         "
2821         ;;
2822      Linux:*)
2823         case "$UNAME_MACHINE" in
2824             x86_64|s390x|ppc64)
2825                 PLATFORM=linux-g++-64
2826                 ;;
2827             *)
2828                 PLATFORM=linux-g++
2829                 ;;
2830         esac
2831         PLATFORM_NOTES="
2832             - Also available for Linux: linux-kcc linux-icc linux-cxx
2833         "
2834         ;;
2835      SunOS:5*)
2836         if [ "$XPLATFORM_MINGW" = "yes" ]; then
2837             PLATFORM="solaris-g++"
2838         else
2839             #PLATFORM=solaris-g++
2840             PLATFORM=solaris-cc
2841             #PLATFORM=solaris-cc64
2842         fi
2843         PLATFORM_NOTES="
2844             - Also available for Solaris: solaris-g++ solaris-cc-64
2845         "
2846         ;;
2847      ReliantUNIX-*:*|SINIX-*:*)
2848         PLATFORM=reliant-cds
2849         #PLATFORM=reliant-cds-64
2850         PLATFORM_NOTES="
2851             - Also available for Reliant UNIX: reliant-cds-64
2852         "
2853         ;;
2854      CYGWIN*:*)
2855         PLATFORM=cygwin-g++
2856         ;;
2857      LynxOS*:*)
2858         PLATFORM=lynxos-g++
2859         ;;
2860      OpenUNIX:*)
2861         #PLATFORM=unixware-g++
2862         PLATFORM=unixware-cc
2863         PLATFORM_NOTES="
2864             - Also available for OpenUNIX: unixware-g++
2865         "
2866         ;;
2867      UnixWare:*)
2868         #PLATFORM=unixware-g++
2869         PLATFORM=unixware-cc
2870         PLATFORM_NOTES="
2871             - Also available for UnixWare: unixware-g++
2872         "
2873         ;;
2874      SCO_SV:*)
2875         #PLATFORM=sco-g++
2876         PLATFORM=sco-cc
2877         PLATFORM_NOTES="
2878             - Also available for SCO OpenServer: sco-g++
2879         "
2880         ;;
2881      UNIX_SV:*)
2882         PLATFORM=unixware-g++
2883         ;;
2884      QNX:*)
2885         PLATFORM=unsupported/qnx-g++
2886         ;;
2887      *)
2888         if [ "$OPT_HELP" != "yes" ]; then
2889             echo
2890             for p in $PLATFORMS; do
2891                 echo "    $relconf $* -platform $p"
2892             done
2893             echo >&2
2894             echo "   The build script does not currently recognize all" >&2
2895             echo "   platforms supported by Qt." >&2
2896             echo "   Rerun this script with a -platform option listed to" >&2
2897             echo "   set the system/compiler combination you use." >&2
2898             echo >&2
2899             exit 2
2900         fi
2901     esac
2902 fi
2903
2904 if [ "$PLATFORM_QWS" = "yes" ]; then
2905     CFG_SM=no
2906     PLATFORMS=`find "$relpath/mkspecs/qws" | sed "s,$relpath/mkspecs/qws/,,"`
2907 else
2908     PLATFORMS=`find "$relpath/mkspecs/" -type f | grep -v qws | sed "s,$relpath/mkspecs/qws/,,"`
2909 fi
2910
2911 [ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM"
2912
2913 case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac
2914 case "$XPLATFORM" in *symbian*) XPLATFORM_SYMBIAN=yes;; esac
2915 case "$XPLATFORM" in symbian-sbsv2) XPLATFORM_SYMBIAN_SBSV2=yes;; esac
2916
2917 if [ -d "$PLATFORM" ]; then
2918   QMAKESPEC="$PLATFORM"
2919 else
2920   QMAKESPEC="$relpath/mkspecs/${PLATFORM}"
2921 fi
2922 if [ -d "$XPLATFORM" ]; then
2923   XQMAKESPEC="$XPLATFORM"
2924 else
2925   XQMAKESPEC="$relpath/mkspecs/${XPLATFORM}"
2926 fi
2927 if [ "$PLATFORM" != "$XPLATFORM" ]; then
2928     QT_CROSS_COMPILE=yes
2929     QMAKE_CONFIG="$QMAKE_CONFIG cross_compile"
2930 fi
2931
2932 if [ "$PLATFORM_MAC" = "yes" ]; then
2933    if [ `basename $QMAKESPEC` = "macx-xcode" ] || [ `basename $XQMAKESPEC` = "macx-xcode" ]; then
2934       echo >&2
2935       echo "   Platform 'macx-xcode' should not be used when building Qt/Mac." >&2
2936       echo "   Please build Qt/Mac with 'macx-g++', then if you would like to" >&2
2937       echo "   use mac-xcode on your application code it can link to a Qt/Mac" >&2
2938       echo "   built with 'macx-g++'" >&2
2939       echo >&2
2940       exit 2
2941     fi
2942 fi
2943
2944 # check specified platforms are supported
2945 if [ '!' -d "$QMAKESPEC" ]; then
2946     echo
2947     echo "   The specified system/compiler is not supported:"
2948     echo
2949     echo "      $QMAKESPEC"
2950     echo
2951     echo "   Please see the README file for a complete list."
2952     echo
2953     exit 2
2954 fi
2955 if [ '!' -d "$XQMAKESPEC" ]; then
2956     echo
2957     echo "   The specified system/compiler is not supported:"
2958     echo
2959     echo "      $XQMAKESPEC"
2960     echo
2961     echo "   Please see the README file for a complete list."
2962     echo
2963     exit 2
2964 fi
2965 if [ '!' -f "${XQMAKESPEC}/qplatformdefs.h" ]; then
2966     echo
2967     echo "   The specified system/compiler port is not complete:"
2968     echo
2969     echo "      $XQMAKESPEC/qplatformdefs.h"
2970     echo
2971     echo "   Please contact qt-info@nokia.com."
2972     echo
2973     exit 2
2974 fi
2975
2976 # now look at the configs and figure out what platform we are config'd for
2977 [ "$CFG_EMBEDDED" = "no" ] && [ "$PLATFORM_QPA" != "yes" ] \
2978   && [ '!' -z "`getQMakeConf \"$XQMAKESPEC\" | grep QMAKE_LIBS_X11 | awk '{print $3;}'`" ] \
2979   && PLATFORM_X11=yes
2980 ### echo "$XQMAKESPEC" | grep mkspecs/qws >/dev/null 2>&1 && PLATFORM_QWS=yes
2981
2982 if [ "$UNAME_SYSTEM" = "SunOS" ]; then
2983     # Solaris 2.5 and 2.6 have libposix4, which was renamed to librt for Solaris 7 and up
2984     if echo $UNAME_RELEASE | grep "^5\.[5|6]" >/dev/null 2>&1; then
2985         sed -e "s,-lrt,-lposix4," "$XQMAKESPEC/qmake.conf" > "$XQMAKESPEC/qmake.conf.new"
2986         mv "$XQMAKESPEC/qmake.conf.new" "$XQMAKESPEC/qmake.conf"
2987     fi
2988 fi
2989
2990 #-------------------------------------------------------------------------------
2991 # determine the system architecture
2992 #-------------------------------------------------------------------------------
2993 if [ "$OPT_VERBOSE" = "yes" ]; then
2994     echo "Determining system architecture... ($UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_MACHINE)"
2995 fi
2996
2997 if [ "$CFG_EMBEDDED" != "no" -a "$CFG_EMBEDDED" != "auto" ] && [ -n "$CFG_ARCH" ]; then
2998     if [ "$CFG_ARCH" != "$CFG_EMBEDDED" ]; then
2999         echo ""
3000         echo "You have specified a target architecture with -embedded and -arch."
3001         echo "The two architectures you have specified are different, so we can"
3002         echo "not proceed. Either set both to be the same, or only use -embedded."
3003         echo ""
3004         exit 1
3005     fi
3006 fi
3007
3008 if [ "$CFG_RTOS_ENABLED" = "no" ]; then
3009     case `basename "$XPLATFORM"` in
3010         qnx-* | vxworks-*)
3011             echo ""
3012             echo "You are not licensed for Qt for `basename $XPLATFORM`."
3013             echo ""
3014             echo "Please contact qt-info@nokia.com to upgrade your license to"
3015             echo "include this platform, or install the Qt Open Source Edition"
3016             echo "if you intend to develop free software."
3017             exit 1
3018             ;;
3019     esac
3020 fi
3021
3022 if [ -z "${CFG_HOST_ARCH}" ]; then
3023     case "$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_MACHINE" in
3024     GNU:*:*)
3025         CFG_HOST_ARCH=`echo ${UNAME_MACHINE} | sed -e 's,[-/].*$,,'`
3026         case "$CFG_HOST_ARCH" in
3027             i?86)
3028                 CFG_HOST_ARCH=i386
3029                 ;;
3030         esac
3031         if [ "$OPT_VERBOSE" = "yes" ]; then
3032             echo "    GNU/Hurd ($CFG_HOST_ARCH)"
3033         fi
3034         ;;
3035     IRIX*:*:*)
3036         CFG_HOST_ARCH=`uname -p`
3037         if [ "$OPT_VERBOSE" = "yes" ]; then
3038             echo "    SGI ($CFG_HOST_ARCH)"
3039         fi
3040         ;;
3041     SunOS:5*:*)
3042         case "$UNAME_MACHINE" in
3043         sun4u*|sun4v*)
3044             if [ "$OPT_VERBOSE" = "yes" ]; then
3045                 echo "    Sun SPARC (sparc)"
3046             fi
3047             CFG_HOST_ARCH=sparc
3048             ;;
3049         i86pc)
3050             case "$PLATFORM" in
3051             *-64*)
3052                 if [ "$OPT_VERBOSE" = "yes" ]; then
3053                     echo "    64-bit AMD 80x86 (x86_64)"
3054                 fi
3055                 CFG_HOST_ARCH=x86_64
3056                 ;;
3057             *)
3058                 if [ "$OPT_VERBOSE" = "yes" ]; then
3059                     echo "    32-bit Intel 80x86 (i386)"
3060                 fi
3061                 CFG_HOST_ARCH=i386
3062                 ;;
3063             esac
3064         esac
3065         ;;
3066     Darwin:*:*)
3067         case "$UNAME_MACHINE" in
3068             Power?Macintosh)
3069                 if [ "$OPT_VERBOSE" = "yes" ]; then
3070                     echo "    32-bit Apple PowerPC (powerpc)"
3071                 fi
3072                 ;;
3073             x86)
3074                 if [ "$OPT_VERBOSE" = "yes" ]; then
3075                     echo "    32-bit Intel 80x86 (i386)"
3076                 fi
3077                 ;;
3078         esac
3079         CFG_HOST_ARCH=macosx
3080         ;;
3081     AIX:*:00????????00)
3082         if [ "$OPT_VERBOSE" = "yes" ]; then
3083         echo "    64-bit IBM PowerPC (powerpc)"
3084         fi
3085         CFG_HOST_ARCH=powerpc
3086         ;;
3087     HP-UX:*:9000*)
3088         if [ "$OPT_VERBOSE" = "yes" ]; then
3089             echo "    HP PA-RISC (parisc)"
3090         fi
3091         CFG_HOST_ARCH=parisc
3092         ;;
3093     *:*:i?86)
3094         if [ "$OPT_VERBOSE" = "yes" ]; then
3095             echo "    32-bit Intel 80x86 (i386)"
3096         fi
3097         CFG_HOST_ARCH=i386
3098         ;;
3099     *:*:x86_64|*:*:amd64)
3100         if [ "$PLATFORM" = "linux-g++-32" -o "$PLATFORM" = "linux-icc-32" ]; then
3101             if [ "$OPT_VERBOSE" = "yes" ]; then
3102                 echo "    32 bit on 64-bit AMD 80x86 (i386)"
3103             fi
3104             CFG_HOST_ARCH=i386
3105         else
3106             if [ "$OPT_VERBOSE" = "yes" ]; then
3107                 echo "    64-bit AMD 80x86 (x86_64)"
3108             fi
3109             CFG_HOST_ARCH=x86_64
3110         fi
3111         ;;
3112     *:*:ppc)
3113         if [ "$OPT_VERBOSE" = "yes" ]; then
3114             echo "    32-bit PowerPC (powerpc)"
3115         fi
3116         CFG_HOST_ARCH=powerpc
3117         ;;
3118     *:*:ppc64)
3119         if [ "$OPT_VERBOSE" = "yes" ]; then
3120             echo "    64-bit PowerPC (powerpc)"
3121         fi
3122         CFG_HOST_ARCH=powerpc
3123         ;;
3124     *:*:s390*)
3125         if [ "$OPT_VERBOSE" = "yes" ]; then
3126             echo "    IBM S/390 (s390)"
3127         fi
3128         CFG_HOST_ARCH=s390
3129         ;;
3130     *:*:arm*)
3131         if [ "$OPT_VERBOSE" = "yes" ]; then
3132             echo "    ARM (arm)"
3133         fi
3134         CFG_HOST_ARCH=arm
3135         ;;
3136     Linux:*:sparc*)
3137         if [ "$OPT_VERBOSE" = "yes" ]; then
3138             echo "    Linux on SPARC"
3139         fi
3140         CFG_HOST_ARCH=sparc
3141         ;;
3142     QNX:*:*)
3143         case "$UNAME_MACHINE" in
3144         x86pc)
3145             if [ "$OPT_VERBOSE" = "yes" ]; then
3146                 echo "    QNX on Intel 80x86 (i386)"
3147             fi
3148             CFG_HOST_ARCH=i386
3149             ;;
3150         esac
3151         ;;
3152     *:*:*)
3153         if [ "$OPT_VERBOSE" = "yes" ]; then
3154             echo "    Trying '$UNAME_MACHINE'..."
3155         fi
3156         CFG_HOST_ARCH="$UNAME_MACHINE"
3157         ;;
3158     esac
3159 fi
3160
3161 if [ "$PLATFORM" != "$XPLATFORM" -a "$CFG_EMBEDDED" != "no" ]; then
3162     if [ -n "$CFG_ARCH" ]; then
3163         CFG_EMBEDDED=$CFG_ARCH
3164     fi
3165
3166     case "$CFG_EMBEDDED" in
3167     x86)
3168         CFG_ARCH=i386
3169         ;;
3170     x86_64)
3171         CFG_ARCH=x86_64
3172         ;;
3173     ipaq|sharp)
3174         CFG_ARCH=arm
3175         ;;
3176     dm7000)
3177         CFG_ARCH=powerpc
3178         ;;
3179     dm800)
3180         CFG_ARCH=mips
3181         ;;
3182     sh4al)
3183         CFG_ARCH=sh4a
3184         ;;
3185     arm*)
3186         CFG_ARCH=arm
3187         ;;
3188     *)
3189         CFG_ARCH="$CFG_EMBEDDED"
3190         ;;
3191     esac
3192 elif [ "$XPLATFORM_MINGW" = "yes" ]; then
3193     [ -z "$CFG_ARCH" ] && CFG_ARCH="windows"
3194 elif [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
3195     CFG_ARCH=symbian
3196 elif [ "$PLATFORM_MAC" = "yes" ] || [ -z "$CFG_ARCH" ]; then
3197     CFG_ARCH=$CFG_HOST_ARCH
3198 fi
3199
3200 # for compatibility
3201 COMPAT_ARCH=
3202 case "$CFG_ARCH" in
3203 arm*)
3204     # previously, armv6 was a different arch
3205     CFG_ARCH=arm
3206     COMPAT_ARCH=armv6
3207     ;;
3208 esac
3209
3210 if [ -d "$relpath/src/corelib/arch/$CFG_ARCH" ]; then
3211     if [ "$OPT_VERBOSE" = "yes" ]; then
3212         echo "    '$CFG_ARCH' is supported"
3213     fi
3214 else
3215     if [ "$OPT_VERBOSE" = "yes" ]; then
3216         echo "    '$CFG_ARCH' is unsupported, using 'generic'"
3217     fi
3218     CFG_ARCH=generic
3219 fi
3220 if [ "$CFG_HOST_ARCH" != "$CFG_ARCH" ]; then
3221     if [ -d "$relpath/src/corelib/arch/$CFG_HOST_ARCH" ]; then
3222         if [ "$OPT_VERBOSE" = "yes" ]; then
3223             echo "    '$CFG_HOST_ARCH' is supported"
3224         fi
3225     else
3226         if [ "$OPT_VERBOSE" = "yes" ]; then
3227             echo "    '$CFG_HOST_ARCH' is unsupported, using 'generic'"
3228         fi
3229         CFG_HOST_ARCH=generic
3230     fi
3231 fi
3232
3233 if [ "$OPT_VERBOSE" = "yes" ]; then
3234     echo "System architecture: '$CFG_ARCH'"
3235     if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
3236         echo "Host architecture: '$CFG_HOST_ARCH'"
3237     fi
3238 fi
3239
3240 #-------------------------------------------------------------------------------
3241 # tests that don't need qmake (must be run before displaying help)
3242 #-------------------------------------------------------------------------------
3243
3244 # detect build style
3245 if [ "$CFG_DEBUG" = "auto" ]; then
3246     if [ "$CFG_ARCH" = "macosx" -o "$XPLATFORM_MINGW" = "yes" ]; then
3247         CFG_DEBUG_RELEASE=yes
3248         CFG_DEBUG=yes
3249     elif [ "$CFG_DEV" = "yes" ]; then
3250         CFG_DEBUG_RELEASE=no
3251         CFG_DEBUG=yes
3252     else
3253         CFG_DEBUG_RELEASE=no
3254         CFG_DEBUG=no
3255     fi
3256 fi
3257 if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
3258     QT_CONFIG="$QT_CONFIG build_all"
3259 fi
3260
3261 if [ -z "$PKG_CONFIG" ]; then
3262     # See if PKG_CONFIG is set in the mkspec:
3263     PKG_CONFIG=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%PKG_CONFIG[^_].*=%%p' | tr '\n' ' '`
3264 fi
3265 if [ -z "$PKG_CONFIG" ]; then
3266     PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null`
3267 fi
3268
3269 # Work out if we can use pkg-config
3270 if [ "$QT_CROSS_COMPILE" = "yes" ]; then
3271     if [ "$QT_FORCE_PKGCONFIG" = "yes" ]; then
3272         echo >&2 ""
3273         echo >&2 "You have asked to use pkg-config and are cross-compiling."
3274         echo >&2 "Please make sure you have a correctly set-up pkg-config"
3275         echo >&2 "environment!"
3276         echo >&2 ""
3277         if [ -z "$PKG_CONFIG_PATH" ]; then
3278             echo >&2 ""
3279             echo >&2 "Warning: PKG_CONFIG_PATH has not been set.  This could mean"
3280             echo >&2 "the host compiler's .pc files will be used. This is probably"
3281             echo >&2 "not what you want."
3282             echo >&2 ""
3283         elif [ -z "$PKG_CONFIG_SYSROOT" ] && [ -z "$PKG_CONFIG_SYSROOT_DIR" ]; then
3284             echo >&2 ""
3285             echo >&2 "Warning: PKG_CONFIG_SYSROOT/PKG_CONFIG_SYSROOT_DIR has not"
3286             echo >&2 "been set. This means your toolchain's .pc files must contain"
3287             echo >&2 "the paths to the toolchain's libraries & headers. If configure"
3288             echo >&2 "tests are failing, please check these files."
3289             echo >&2 ""
3290         fi
3291     else
3292         echo >&2 ""
3293         echo >&2 "You have not explicitly asked to use pkg-config and are cross-compiling."
3294         echo >&2 "pkg-config will not be used to automatically query cflag/lib parameters for"
3295         echo >&2 "dependencies"
3296         echo >&2 ""
3297         PKG_CONFIG=""
3298     fi
3299 fi
3300
3301 # process CFG_MAC_ARCHS
3302 if [ "$PLATFORM_MAC" = "yes" ]; then
3303 #   check -arch arguments for validity.
3304     ALLOWED="x86 ppc x86_64 ppc64 i386"
3305     # Save the list so we can re-write it using only valid values
3306     CFG_MAC_ARCHS_IN="$CFG_MAC_ARCHS"
3307     CFG_MAC_ARCHS=
3308     for i in $CFG_MAC_ARCHS_IN
3309     do 
3310         if echo "$ALLOWED" | grep -w -v "$i" > /dev/null 2>&1; then
3311             echo "Unknown architecture: \"$i\". Supported architectures: x86[i386] ppc x86_64 ppc64";
3312             exit 2;
3313         fi
3314         if [ "$i" = "i386" -o "$i" = "x86" ]; then
3315             # These are synonymous values
3316             # CFG_MAC_ARCHS requires x86 while GCC requires i386
3317             CFG_MAC_ARCHS="$CFG_MAC_ARCHS x86"
3318             MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -arch i386"
3319         else
3320             CFG_MAC_ARCHS="$CFG_MAC_ARCHS $i"
3321             MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -arch $i"
3322         fi
3323     done
3324 fi
3325
3326 # pass on $CFG_SDK to the configure tests.
3327 if [ '!' -z "$CFG_SDK" ]; then
3328     MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -sdk $CFG_SDK"
3329 fi
3330
3331 # find the default framework value
3332 if [ "$CFG_ARCH" = "macosx" ]; then
3333     if [ "$CFG_FRAMEWORK" = "auto" ]; then
3334         CFG_FRAMEWORK="$CFG_SHARED"
3335     elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
3336         echo
3337         echo "WARNING: Using static linking will disable the use of Mac frameworks."
3338         echo
3339         CFG_FRAMEWORK="no"
3340     fi
3341 else
3342     CFG_FRAMEWORK=no
3343 fi
3344
3345 QMAKE_CONF_COMPILER=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_CXX[^_A-Z0-9]" | sed "s,.* *= *\(.*\)$,\1," | tail -1`
3346 TEST_COMPILER="$CXX"
3347
3348 [ -z "$TEST_COMPILER" ] && TEST_COMPILER=$QMAKE_CONF_COMPILER
3349 if [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then
3350     #for Symbian we don't need this checking
3351     if [ -z "$TEST_COMPILER" ]; then
3352         echo "ERROR: Cannot set the compiler for the configuration tests"
3353         exit 1
3354     fi
3355 fi
3356
3357 if [ "$CFG_EMBEDDED" = "nacl" ]; then
3358     TEST_COMPILER="nacl-gcc"
3359 fi
3360
3361 SYSROOT_FLAG=
3362 if [ -n "$CFG_SYSROOT" ]; then
3363     if compilerSupportsFlag --sysroot="$CFG_SYSROOT"; then
3364         [ "$OPT_VERBOSE" = "yes" ] && echo "Setting sysroot to: $CFG_SYSROOT"
3365         SYSROOT_FLAG="--sysroot=$CFG_SYSROOT"
3366     else
3367         echo >&2 "The compiler doesn't support the --sysroot flag, I can't set the sysroot"
3368         exit 1
3369     fi
3370 fi
3371 export SYSROOT_FLAG    # used by config.tests/unix/compile.test
3372
3373 # auto-detect precompiled header support
3374 if [ "$CFG_PRECOMPILE" = "auto" ]; then
3375     if [ `echo "$CFG_MAC_ARCHS" | wc -w` -gt 1 ]; then
3376        CFG_PRECOMPILE=no
3377     elif "$unixtests/precomp.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
3378        CFG_PRECOMPILE=no
3379     else
3380        CFG_PRECOMPILE=yes
3381     fi
3382 elif [ "$CFG_PRECOMPILE" = "yes" ] && [ `echo "$CFG_MAC_ARCHS" | wc -w` -gt 1 ]; then
3383     echo
3384     echo "WARNING: Using universal binaries disables precompiled headers."
3385     echo
3386     CFG_PRECOMPILE=no
3387 fi
3388
3389 #auto-detect DWARF2 on the mac
3390 if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "auto" ]; then
3391     if "$mactests/dwarf2.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
3392         CFG_MAC_DWARF2=no
3393     else
3394         CFG_MAC_DWARF2=yes
3395     fi
3396 fi
3397
3398 # auto-detect support for -Xarch on the mac
3399 if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" = "auto" ]; then
3400     if "$mactests/xarch.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
3401         CFG_MAC_XARCH=no
3402     else
3403         CFG_MAC_XARCH=yes
3404     fi
3405 fi
3406
3407 # don't autodetect support for separate debug info on objcopy when
3408 # cross-compiling as lots of toolchains seems to have problems with this
3409 if [ "$QT_CROSS_COMPILE" = "yes" ] && [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
3410     CFG_SEPARATE_DEBUG_INFO="no"
3411 fi
3412
3413 # auto-detect support for separate debug info in objcopy
3414 if [ "$CFG_SEPARATE_DEBUG_INFO" != "no" ] && [ "$CFG_SHARED" = "yes" ]; then
3415     TEST_COMPILER_CFLAGS=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%QMAKE_CFLAGS[^_=]*[+*]*=%%p' | tr '\n' ' '`
3416     TEST_COMPILER_CXXFLAGS=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%QMAKE_CXXFLAGS[^_=]*[+*]*=%%p' | tr '\n' ' '`
3417     TEST_OBJCOPY=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_OBJCOPY" | sed "s%.* *= *\(.*\)$%\1%" | tail -1`
3418     COMPILER_WITH_FLAGS="$TEST_COMPILER $TEST_COMPILER_CXXFLAGS"
3419     COMPILER_WITH_FLAGS=`echo "$COMPILER_WITH_FLAGS" | sed -e "s%\\$\\$QMAKE_CFLAGS%$TEST_COMPILER_CFLAGS%g"`
3420     if "$unixtests/objcopy.test" "$COMPILER_WITH_FLAGS" "$TEST_OBJCOPY" "$OPT_VERBOSE"; then
3421        CFG_SEPARATE_DEBUG_INFO=no
3422     else
3423        case "$PLATFORM" in
3424        hpux-*)
3425            # binutils on HP-UX is buggy; default to no.
3426            CFG_SEPARATE_DEBUG_INFO=no
3427            ;;
3428        *)
3429            CFG_SEPARATE_DEBUG_INFO=yes
3430            ;;
3431        esac
3432     fi
3433 fi
3434
3435 # auto-detect -fvisibility support
3436 if [ "$CFG_REDUCE_EXPORTS" = "auto" ]; then
3437     if "$unixtests/fvisibility.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
3438        CFG_REDUCE_EXPORTS=no
3439     else
3440        CFG_REDUCE_EXPORTS=yes
3441     fi
3442 fi
3443
3444 # detect the availability of the -Bsymbolic-functions linker optimization
3445 if [ "$CFG_REDUCE_RELOCATIONS" != "no" ]; then
3446     if "$unixtests/bsymbolic_functions.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
3447         CFG_REDUCE_RELOCATIONS=no
3448     else
3449         CFG_REDUCE_RELOCATIONS=yes
3450     fi
3451 fi
3452
3453 # auto-detect GNU make support
3454 if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2>&1; then
3455    CFG_USE_GNUMAKE=yes
3456 fi
3457
3458 # If -opengl wasn't specified, don't try to auto-detect
3459 if [ "$PLATFORM_QWS" = "yes" ] && [ "$CFG_OPENGL" = "auto" ]; then
3460         CFG_OPENGL=no
3461 fi
3462
3463 # mac
3464 if [ "$PLATFORM_MAC" = "yes" ] && [ "$XPLATFORM_SYMBIAN" = "no" ]; then
3465     if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
3466         CFG_OPENGL=desktop
3467     fi
3468 fi
3469
3470 # find the default framework value
3471 if [ "$CFG_ARCH" = "macosx" ]; then
3472     if [ "$CFG_FRAMEWORK" = "auto" ]; then
3473         CFG_FRAMEWORK="$CFG_SHARED"
3474     elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
3475         echo
3476         echo "WARNING: Using static linking will disable the use of Mac frameworks."
3477         echo
3478         CFG_FRAMEWORK="no"
3479     fi
3480 else
3481     CFG_FRAMEWORK=no
3482 fi
3483
3484 # Print a warning if configure was called with the 10.4u SDK option on Snow Leopard
3485 # with the default mkspec. The 10.4u SDK does not support gcc 4.2.
3486 if [ "$PLATFORM_MAC" = "yes" ] && [ '!' -z "$CFG_SDK" ]; then
3487     # get the darwin version. 10.0.0 and up means snow leopard.
3488     VERSION=`uname -r | tr '.' ' ' | awk '{print $1}'`
3489     if [ "$VERSION" -gt 9 ] && [ "$CFG_SDK" == "/Developer/SDKs/MacOSX10.4u.sdk/" ] && [ "$PLATFORM" == "macx-g++" ]; then
3490         echo
3491         echo "WARNING: The 10.4u SDK does not support gcc 4.2. Configure with -platform macx-g++40. "
3492         echo
3493     fi
3494 fi
3495
3496 # x11 tests are done after qmake is built
3497
3498
3499 #setup the build parts
3500 if [ -z "$CFG_BUILD_PARTS" ]; then
3501     CFG_BUILD_PARTS="$QT_DEFAULT_BUILD_PARTS"
3502
3503     # don't build tools by default when cross-compiling
3504     if [ "$PLATFORM" != "$XPLATFORM" ]; then
3505         CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, tools,,g"`
3506     fi
3507 fi
3508 for nobuild in $CFG_NOBUILD_PARTS; do
3509     CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, $nobuild,,g"`
3510 done
3511 if echo $CFG_BUILD_PARTS | grep -v libs >/dev/null 2>&1; then
3512 #    echo
3513 #    echo "WARNING: libs is a required part of the build."
3514 #    echo
3515     CFG_BUILD_PARTS="$CFG_BUILD_PARTS libs"
3516 fi
3517
3518 #-------------------------------------------------------------------------------
3519 # post process QT_INSTALL_* variables
3520 #-------------------------------------------------------------------------------
3521
3522 #prefix
3523 if [ -z "$QT_INSTALL_PREFIX" ]; then
3524     if [ "$CFG_DEV" = "yes" ]; then
3525         QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default
3526     elif [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
3527         if [ "$PLATFORM_QPA" = "yes" ]; then
3528         QT_INSTALL_PREFIX="/usr/local/Trolltech/QtLighthouse-${QT_VERSION}"
3529         else
3530         QT_INSTALL_PREFIX="/usr/local/Trolltech/QtEmbedded-${QT_VERSION}"
3531         fi
3532         if [ "$PLATFORM" != "$XPLATFORM" ]; then
3533             QT_INSTALL_PREFIX="${QT_INSTALL_PREFIX}-${CFG_ARCH}"
3534         fi
3535     elif [ -d "$EPOCROOT" ] && [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
3536         if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
3537             QT_INSTALL_PREFIX="$EPOCROOT/epoc32/"
3538             QT_INSTALL_LIBS="$EPOCROOT/epoc32/release/armv5/lib/"
3539         fi
3540     else
3541         QT_INSTALL_PREFIX="/usr/local/Trolltech/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Trolltech/Qt-$QT_VERSION
3542     fi
3543 fi
3544 QT_INSTALL_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PREFIX"`
3545
3546 if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
3547     [ -z "$QT_HOST_PREFIX" ] && QT_HOST_PREFIX="$QT_INSTALL_PREFIX"
3548     [ -z "$QT_INSTALL_DOCS" ] && QT_INSTALL_DOCS=
3549     [ -z "$QT_INSTALL_HEADERS" ] && QT_INSTALL_HEADERS=
3550     [ -z "$QT_INSTALL_LIBS" ] && QT_INSTALL_LIBS=
3551     [ -z "$QT_INSTALL_BINS" ] && QT_INSTALL_BINS=
3552     [ -z "$QT_INSTALL_PLUGINS" ] && QT_INSTALL_PLUGINS="\\\\resource\\\\qt$QT_LIBINFIX\\\\plugins"
3553     [ -z "$QT_INSTALL_IMPORTS" ] && QT_INSTALL_IMPORTS="\\\\resource\\\\qt$QT_LIBINFIX\\\\imports"
3554     [ -z "$QT_INSTALL_DATA" ] && QT_INSTALL_DATA=
3555     [ -z "$QT_INSTALL_TRANSLATIONS" ] && QT_INSTALL_TRANSLATIONS="\\\\resource\\\\qt$QT_LIBINFIX\\\\translations"
3556     [ -z "$QT_INSTALL_SETTINGS" ] && QT_INSTALL_SETTINGS=
3557     [ -z "$QT_INSTALL_EXAMPLES" ] && QT_INSTALL_EXAMPLES=
3558 else
3559     #docs
3560     if [ -z "$QT_INSTALL_DOCS" ]; then #default
3561         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3562             if [ "$PLATFORM_MAC" = "yes" ]; then
3563                 QT_INSTALL_DOCS="/Developer/Documentation/Qt"
3564             fi
3565         fi
3566         [ -z "$QT_INSTALL_DOCS" ] && QT_INSTALL_DOCS="$QT_INSTALL_PREFIX/doc" #fallback
3567
3568     fi
3569     QT_INSTALL_DOCS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DOCS"`
3570
3571     #headers
3572     if [ -z "$QT_INSTALL_HEADERS" ]; then #default
3573         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3574             if [ "$PLATFORM_MAC" = "yes" ]; then
3575                 if [ "$CFG_FRAMEWORK" = "yes" ]; then
3576                     QT_INSTALL_HEADERS=
3577                 fi
3578             fi
3579         fi
3580         [ -z "$QT_INSTALL_HEADERS" ] && QT_INSTALL_HEADERS="$QT_INSTALL_PREFIX/include"
3581
3582     fi
3583     QT_INSTALL_HEADERS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_HEADERS"`
3584
3585     #libs
3586     if [ -z "$QT_INSTALL_LIBS" ]; then #default
3587         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3588             if [ "$PLATFORM_MAC" = "yes" ]; then
3589                 if [ "$CFG_FRAMEWORK" = "yes" ]; then
3590                     QT_INSTALL_LIBS="/Libraries/Frameworks"
3591                 fi
3592             fi
3593         fi
3594         [ -z "$QT_INSTALL_LIBS" ] && QT_INSTALL_LIBS="$QT_INSTALL_PREFIX/lib" #fallback
3595     fi
3596     QT_INSTALL_LIBS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_LIBS"`
3597
3598     #bins
3599     if [ -z "$QT_INSTALL_BINS" ]; then #default
3600         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3601             if [ "$PLATFORM_MAC" = "yes" ]; then
3602                 QT_INSTALL_BINS="/Developer/Applications/Qt"
3603             fi
3604         fi
3605         [ -z "$QT_INSTALL_BINS" ] && QT_INSTALL_BINS="$QT_INSTALL_PREFIX/bin" #fallback
3606
3607     fi
3608     QT_INSTALL_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_BINS"`
3609
3610     #plugins
3611     if [ -z "$QT_INSTALL_PLUGINS" ]; then #default
3612         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3613             if [ "$PLATFORM_MAC" = "yes" ]; then
3614                 QT_INSTALL_PLUGINS="/Developer/Applications/Qt/plugins"
3615             fi
3616         fi
3617         [ -z "$QT_INSTALL_PLUGINS" ] && QT_INSTALL_PLUGINS="$QT_INSTALL_PREFIX/plugins" #fallback
3618     fi
3619     QT_INSTALL_PLUGINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PLUGINS"`
3620
3621     #imports
3622     if [ -z "$QT_INSTALL_IMPORTS" ]; then #default
3623         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3624             if [ "$PLATFORM_MAC" = "yes" ]; then
3625                 QT_INSTALL_IMPORTS="/Developer/Applications/Qt/imports"
3626             fi
3627         fi
3628         [ -z "$QT_INSTALL_IMPORTS" ] && QT_INSTALL_IMPORTS="$QT_INSTALL_PREFIX/imports" #fallback
3629     fi
3630     QT_INSTALL_IMPORTS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_IMPORTS"`
3631
3632     #data
3633     if [ -z "$QT_INSTALL_DATA" ]; then #default
3634         QT_INSTALL_DATA="$QT_INSTALL_PREFIX"
3635     fi
3636     QT_INSTALL_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DATA"`
3637
3638     #translations
3639     if [ -z "$QT_INSTALL_TRANSLATIONS" ]; then #default
3640         QT_INSTALL_TRANSLATIONS="$QT_INSTALL_PREFIX/translations"
3641     fi
3642     QT_INSTALL_TRANSLATIONS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TRANSLATIONS"`
3643
3644     #settings
3645     if [ -z "$QT_INSTALL_SETTINGS" ]; then #default
3646         if [ "$PLATFORM_MAC" = "yes" ]; then
3647             QT_INSTALL_SETTINGS=/Library/Preferences/Qt
3648         else
3649             QT_INSTALL_SETTINGS=/etc/xdg
3650         fi
3651     fi
3652     QT_INSTALL_SETTINGS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_SETTINGS"`
3653
3654     #examples
3655     if [ -z "$QT_INSTALL_EXAMPLES" ]; then #default
3656         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3657             if [ "$PLATFORM_MAC" = "yes" ]; then
3658                 QT_INSTALL_EXAMPLES="/Developer/Examples/Qt"
3659             fi
3660         fi
3661         [ -z "$QT_INSTALL_EXAMPLES" ] && QT_INSTALL_EXAMPLES="$QT_INSTALL_PREFIX/examples" #fallback
3662     fi
3663     QT_INSTALL_EXAMPLES=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_EXAMPLES"`
3664 fi
3665
3666 #-------------------------------------------------------------------------------
3667 # help - interactive parts of the script _after_ this section please
3668 #-------------------------------------------------------------------------------
3669
3670 # next, emit a usage message if something failed.
3671 if [ "$OPT_HELP" = "yes" ]; then
3672     [ "x$ERROR" = "xyes" ] && echo
3673     if [ "$CFG_NIS" = "no" ]; then
3674         NSY=" "
3675         NSN="*"
3676     else
3677         NSY="*"
3678         NSN=" "
3679     fi
3680     if [ "$CFG_CUPS" = "no" ]; then
3681         CUY=" "
3682         CUN="*"
3683     else
3684         CUY="*"
3685         CUN=" "
3686     fi
3687     if [ "$CFG_ICONV" = "no" ]; then
3688         CIY=" "
3689         CIN="*"
3690     else
3691         CIY="*"
3692         CIN=" "
3693     fi
3694     if [ "$CFG_LARGEFILE" = "no" ]; then
3695         LFSY=" "
3696         LFSN="*"
3697     else
3698         LFSY="*"
3699         LFSN=" "
3700     fi
3701     if [ "$CFG_STL" = "auto" ] || [ "$CFG_STL" = "yes" ]; then
3702         SHY="*"
3703         SHN=" "
3704     else
3705         SHY=" "
3706         SHN="*"
3707     fi
3708     if [ "$CFG_PRECOMPILE" = "auto" ] || [ "$CFG_PRECOMPILE" = "no" ]; then
3709         PHY=" "
3710         PHN="*"
3711     else
3712         PHY="*"
3713         PHN=" "
3714     fi
3715
3716     if [ "$CFG_XCB" = "no" ]; then
3717         XCBY=" "
3718         XCBN="*"
3719     else
3720         XCBY="*"
3721         XCBN=" "
3722     fi
3723
3724     if [ "$CFG_WAYLAND" = "no" ]; then
3725         XWY=" "
3726         XWN="*"
3727     else
3728         XWY="*"
3729         XWN=" "
3730     fi
3731
3732     cat <<EOF
3733 Usage:  $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>]
3734         [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-importdir <dir>] [-datadir <dir>]
3735         [-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>]
3736         [-release] [-debug] [-debug-and-release]
3737         [-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile]
3738         [-largefile] [-no-exceptions] [-exceptions] [-no-accessibility]
3739         [-accessibility] [-no-stl] [-stl] [-no-sql-<driver>] [-sql-<driver>]
3740         [-plugin-sql-<driver>] [-system-sqlite] [-no-qt3support] [-qt3support]
3741         [-platform] [-D <string>] [-I <string>] [-L <string>] [-help]
3742         [-qt-zlib] [-system-zlib] [-no-gif] [-no-libtiff] [-qt-libtiff] [-system-libtiff]
3743         [-no-libpng] [-qt-libpng] [-system-libpng] [-no-libmng] [-qt-libmng]
3744         [-system-libmng] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>]
3745         [-nomake <part>] [-R <string>]  [-l <string>] [-no-rpath]  [-rpath] [-continue]
3746         [-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [-no-iconv]
3747         [-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked] [-no-gui]
3748         [-no-separate-debug-info] [-no-mmx] [-no-3dnow] [-no-sse] [-no-sse2]
3749         [-no-sse3] [-no-ssse3] [-no-sse4.1] [-no-sse4.2] [-no-avx] [-no-neon]
3750         [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info] [-armfpa]
3751         [-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns]
3752         [-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend]
3753         [-no-media-backend] [-media-backend] [-no-audio-backend] [-audio-backend] 
3754         [-no-openssl] [-openssl] [-openssl-linked]
3755         [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-webkit-debug]
3756         [-no-javascript-jit] [-javascript-jit]
3757         [-no-script] [-script] [-no-scripttools] [-scripttools] 
3758         [-no-declarative] [-declarative] [-no-declarative-debug] [-declarative-debug]
3759         [-no-location] [-location]
3760         [additional platform specific options (see below)]
3761
3762
3763 Installation options:
3764
3765     -qpa ................ This will enable the QPA build.
3766                           QPA is a window system agnostic implementation of Qt.
3767
3768  These are optional, but you may specify install directories.
3769
3770     -prefix <dir> ...... This will install everything relative to <dir>
3771                          (default $QT_INSTALL_PREFIX)
3772 EOF
3773 if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
3774 cat <<EOF
3775
3776     -hostprefix [dir] .. Tools and libraries needed when developing
3777                          applications are installed in [dir]. If [dir] is
3778                          not given, the current build directory will be used.
3779 EOF
3780 fi
3781 cat <<EOF
3782
3783   * -prefix-install .... Force a sandboxed "local" installation of
3784                          Qt. This will install into
3785                          $QT_INSTALL_PREFIX, if this option is
3786                          disabled then some platforms will attempt a
3787                          "system" install by placing default values to
3788                          be placed in a system location other than
3789                          PREFIX.
3790
3791  You may use these to separate different parts of the install:
3792
3793     -bindir <dir> ......... Executables will be installed to <dir>
3794                             (default PREFIX/bin)
3795     -libdir <dir> ......... Libraries will be installed to <dir>
3796                             (default PREFIX/lib)
3797     -docdir <dir> ......... Documentation will be installed to <dir>
3798                             (default PREFIX/doc)
3799     -headerdir <dir> ...... Headers will be installed to <dir>
3800                             (default PREFIX/include)
3801     -plugindir <dir> ...... Plugins will be installed to <dir>
3802                             (default PREFIX/plugins)
3803     -importdir <dir> ...... Imports for QML will be installed to <dir>
3804                             (default PREFIX/imports)
3805     -datadir <dir> ........ Data used by Qt programs will be installed to <dir>
3806                             (default PREFIX)
3807     -translationdir <dir> . Translations of Qt programs will be installed to <dir>
3808                             (default PREFIX/translations)
3809     -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir>
3810                             (default PREFIX/etc/settings)
3811     -examplesdir <dir> .... Examples will be installed to <dir>
3812                             (default PREFIX/examples)
3813
3814 Configure options:
3815
3816  The defaults (*) are usually acceptable. A plus (+) denotes a default value
3817  that needs to be evaluated. If the evaluation succeeds, the feature is
3818  included. Here is a short explanation of each option:
3819
3820  *  -release ........... Compile and link Qt with debugging turned off.
3821     -debug ............. Compile and link Qt with debugging turned on.
3822     -debug-and-release . Compile and link two versions of Qt, with and without
3823                          debugging turned on (Mac only).
3824
3825     -developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting)
3826
3827     -opensource ........ Compile and link the Open-Source Edition of Qt.
3828     -commercial ........ Compile and link the Commercial Edition of Qt.
3829
3830
3831  *  -shared ............ Create and use shared Qt libraries.
3832     -static ............ Create and use static Qt libraries.
3833
3834  *  -no-fast ........... Configure Qt normally by generating Makefiles for all
3835                          project files.
3836     -fast .............. Configure Qt quickly by generating Makefiles only for
3837                          library and subdirectory targets.  All other Makefiles
3838                          are created as wrappers, which will in turn run qmake.
3839
3840     -no-largefile ...... Disables large file support.
3841  +  -largefile ......... Enables Qt to access files larger than 4 GB.
3842
3843 EOF
3844 if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
3845     EXCN="*"
3846     EXCY=" "
3847 else
3848     EXCN=" "
3849     EXCY="*"
3850 fi
3851 if [ "$CFG_DBUS" = "no" ]; then
3852     DBY=" "
3853     DBN="+"
3854 else
3855     DBY="+"
3856     DBN=" "
3857 fi
3858
3859     cat << EOF
3860  $EXCN  -no-exceptions ..... Disable exceptions on compilers that support it.
3861  $EXCY  -exceptions ........ Enable exceptions on compilers that support it.
3862
3863     -no-accessibility .. Do not compile Accessibility support.
3864  *  -accessibility ..... Compile Accessibility support.
3865
3866  $SHN  -no-stl ............ Do not compile STL support.
3867  $SHY  -stl ............... Compile STL support.
3868
3869     -no-sql-<driver> ... Disable SQL <driver> entirely.
3870     -qt-sql-<driver> ... Enable a SQL <driver> in the QtSql library, by default
3871                          none are turned on.
3872     -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to
3873                          at run time.
3874
3875                          Possible values for <driver>:
3876                          [ $CFG_SQL_AVAILABLE ]
3877
3878     -system-sqlite ..... Use sqlite from the operating system.
3879
3880     -no-qt3support ..... Disables the Qt 3 support functionality.
3881  *  -qt3support ........ Enables the Qt 3 support functionality.
3882
3883     -no-xmlpatterns .... Do not build the QtXmlPatterns module.
3884  +  -xmlpatterns ....... Build the QtXmlPatterns module.
3885                          QtXmlPatterns is built if a decent C++ compiler
3886                          is used and exceptions are enabled.
3887
3888     -no-multimedia ..... Do not build the QtMultimedia module.
3889  +  -multimedia ........ Build the QtMultimedia module.
3890
3891     -no-audio-backend .. Do not build the platform audio backend into QtMultimedia.
3892  +  -audio-backend ..... Build the platform audio backend into QtMultimedia if available.
3893
3894     -no-phonon ......... Do not build the Phonon module.
3895  +  -phonon ............ Build the Phonon module.
3896                          Phonon is built if a decent C++ compiler is used.
3897     -no-phonon-backend.. Do not build the platform phonon plugin.
3898  +  -phonon-backend..... Build the platform phonon plugin.
3899
3900     -no-svg ............ Do not build the SVG module.
3901  +  -svg ............... Build the SVG module.
3902
3903     -no-webkit ......... Do not build the WebKit module.
3904  +  -webkit ............ Build the WebKit module.
3905                          WebKit is built if a decent C++ compiler is used.
3906     -webkit-debug ...... Build the WebKit module with debug symbols.
3907
3908     -no-javascript-jit . Do not build the JavaScriptCore JIT compiler.
3909  +  -javascript-jit .... Build the JavaScriptCore JIT compiler.
3910
3911     -no-script ......... Do not build the QtScript module.
3912  +  -script ............ Build the QtScript module.
3913
3914     -no-scripttools .... Do not build the QtScriptTools module.
3915  +  -scripttools ....... Build the QtScriptTools module.
3916
3917     -no-v8 ............. Do not build the V8 module.
3918  +  -v8 ................ Build the V8 module.
3919
3920     -no-declarative ..... Do not build the declarative module.
3921  +  -declarative ....... Build the declarative module.
3922
3923     -no-declarative-debug ..... Do not build the declarative debugging support.
3924  +  -declarative-debug ....... Build the declarative debugging support.
3925
3926     -no-location ....... Do not build the QtLocation module.
3927  +  -location .......... Build the QtLocation module.
3928
3929     -platform target ... The operating system and compiler you are building
3930                          on ($PLATFORM).
3931
3932                          See the README file for a list of supported
3933                          operating systems and compilers.
3934 EOF
3935
3936 if [ "${PLATFORM_QWS}" != "yes" -a "${PLATFORM_QPA}" != "yes" ]; then
3937 cat << EOF
3938     -graphicssystem <sys> Sets an alternate graphics system. Available options are:
3939                            raster - Software rasterizer
3940                            opengl - Rendering via OpenGL, Experimental!
3941                            openvg - Rendering via OpenVG, Experimental!
3942
3943 EOF
3944 fi
3945
3946 cat << EOF
3947
3948     -no-mmx ............ Do not compile with use of MMX instructions.
3949     -no-3dnow .......... Do not compile with use of 3DNOW instructions.
3950     -no-sse ............ Do not compile with use of SSE instructions.
3951     -no-sse2 ........... Do not compile with use of SSE2 instructions.
3952     -no-sse3 ........... Do not compile with use of SSE3 instructions.
3953     -no-ssse3 .......... Do not compile with use of SSSE3 instructions.
3954     -no-sse4.1.......... Do not compile with use of SSE4.1 instructions.
3955     -no-sse4.2.......... Do not compile with use of SSE4.2 instructions.
3956     -no-avx ............ Do not compile with use of AVX instructions.
3957     -no-neon ........... Do not compile with use of NEON instructions.
3958
3959     -qtnamespace <name>  Wraps all Qt library code in 'namespace <name> {...}'.
3960     -qtlibinfix <infix>  Renames all libQt*.so to libQt*<infix>.so.
3961
3962     -D <string> ........ Add an explicit define to the preprocessor.
3963     -I <string> ........ Add an explicit include path.
3964     -L <string> ........ Add an explicit library path.
3965
3966     -help, -h .......... Display this information.
3967
3968 Third Party Libraries:
3969
3970     -qt-zlib ........... Use the zlib bundled with Qt.
3971  +  -system-zlib ....... Use zlib from the operating system.
3972                          See http://www.gzip.org/zlib
3973
3974     -no-gif ............ Do not compile GIF reading support.
3975
3976     -no-libtiff ........ Do not compile TIFF support.
3977     -qt-libtiff ........ Use the libtiff bundled with Qt.
3978  +  -system-libtiff .... Use libtiff from the operating system.
3979                          See http://www.libtiff.org
3980
3981     -no-libpng ......... Do not compile PNG support.
3982     -qt-libpng ......... Use the libpng bundled with Qt.
3983  +  -system-libpng ..... Use libpng from the operating system.
3984                          See http://www.libpng.org/pub/png
3985
3986     -no-libmng ......... Do not compile MNG support.
3987     -qt-libmng ......... Use the libmng bundled with Qt.
3988  +  -system-libmng ..... Use libmng from the operating system.
3989                          See http://www.libmng.com
3990
3991     -no-libjpeg ........ Do not compile JPEG support.
3992     -qt-libjpeg ........ Use the libjpeg bundled with Qt.
3993  +  -system-libjpeg .... Use libjpeg from the operating system.
3994                          See http://www.ijg.org
3995
3996     -no-openssl ........ Do not compile support for OpenSSL.
3997  +  -openssl ........... Enable run-time OpenSSL support.
3998     -openssl-linked .... Enabled linked OpenSSL support.
3999
4000     -ptmalloc .......... Override the system memory allocator with ptmalloc.
4001                          (Experimental.)
4002
4003 Additional options:
4004
4005     -make <part> ....... Add part to the list of parts to be built at make time.
4006                          ($QT_DEFAULT_BUILD_PARTS)
4007     -nomake <part> ..... Exclude part from the list of parts to be built.
4008
4009     -R <string> ........ Add an explicit runtime library path to the Qt
4010                          libraries.
4011     -l <string> ........ Add an explicit library.
4012
4013     -no-rpath .......... Do not use the library install path as a runtime
4014                          library path.
4015  +  -rpath ............. Link Qt libraries and executables using the library
4016                          install path as a runtime library path. Equivalent
4017                          to -R install_libpath
4018
4019     -continue .......... Continue as far as possible if an error occurs.
4020
4021     -verbose, -v ....... Print verbose information about each step of the
4022                          configure process.
4023
4024     -silent ............ Reduce the build output so that warnings and errors
4025                          can be seen more easily.
4026
4027  *  -no-optimized-qmake ... Do not build qmake optimized.
4028     -optimized-qmake ...... Build qmake optimized.
4029
4030     -no-gui ............ Don't build the Qt GUI library
4031
4032  $NSN  -no-nis ............ Do not compile NIS support.
4033  $NSY  -nis ............... Compile NIS support.
4034
4035  $CUN  -no-cups ........... Do not compile CUPS support.
4036  $CUY  -cups .............. Compile CUPS support.
4037                          Requires cups/cups.h and libcups.so.2.
4038
4039  $CIN  -no-iconv .......... Do not compile support for iconv(3).
4040  $CIY  -iconv ............. Compile support for iconv(3).
4041
4042  $PHN  -no-pch ............ Do not use precompiled header support.
4043  $PHY  -pch ............... Use precompiled header support.
4044
4045  $DBN  -no-dbus ........... Do not compile the QtDBus module.
4046  $DBY  -dbus .............. Compile the QtDBus module and dynamically load libdbus-1.
4047     -dbus-linked ....... Compile the QtDBus module and link to libdbus-1.
4048
4049     -reduce-relocations ..... Reduce relocations in the libraries through extra
4050                               linker optimizations (Qt/X11 and Qt for Embedded Linux only;
4051                               experimental; needs GNU ld >= 2.18).
4052 EOF
4053
4054 if [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
4055     if [ "$QT_CROSS_COMPILE" = "yes" ]; then
4056         SBY=""
4057         SBN="*"
4058     else
4059         SBY="*"
4060         SBN=" "
4061     fi
4062 elif [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
4063     SBY="*"
4064     SBN=" "
4065 else
4066     SBY=" "
4067     SBN="*"
4068 fi
4069
4070 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
4071
4072     cat << EOF
4073
4074  $SBN  -no-separate-debug-info . Do not store debug information in a separate file.
4075  $SBY  -separate-debug-info .... Strip debug information into a separate .debug file.
4076
4077  $XCBN  -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support.
4078  $XCBY  -xcb ............... Compile Xcb support.
4079
4080  $XWN  -no-wayland......... Do not compile Wayland support.
4081  $XWY  -wayland  .......... Compile Wayland support.
4082
4083 EOF
4084
4085 fi # X11/QWS
4086
4087 if [ "$PLATFORM_X11" = "yes" ]; then
4088     if [ "$CFG_SM" = "no" ]; then
4089         SMY=" "
4090         SMN="*"
4091     else
4092         SMY="*"
4093         SMN=" "
4094     fi
4095     if [ "$CFG_XSHAPE" = "no" ]; then
4096         SHY=" "
4097         SHN="*"
4098     else
4099         SHY="*"
4100         SHN=" "
4101     fi
4102     if [ "$CFG_XVIDEO" = "no" ]; then
4103         XVY=" "
4104         XVN="*"
4105     else
4106         XVY="*"
4107         XVN=" "
4108     fi
4109     if [ "$CFG_XINERAMA" = "no" ]; then
4110         XAY=" "
4111         XAN="*"
4112     else
4113         XAY="*"
4114         XAN=" "
4115     fi
4116     if [ "$CFG_FONTCONFIG" = "no" ]; then
4117         FCGY=" "
4118         FCGN="*"
4119     else
4120         FCGY="*"
4121         FCGN=" "
4122     fi
4123     if [ "$CFG_XCURSOR" = "no" ]; then
4124         XCY=" "
4125         XCN="*"
4126     else
4127         XCY="*"
4128         XCN=" "
4129     fi
4130     if [ "$CFG_XFIXES" = "no" ]; then
4131         XFY=" "
4132         XFN="*"
4133     else
4134         XFY="*"
4135         XFN=" "
4136     fi
4137     if [ "$CFG_XRANDR" = "no" ]; then
4138         XZY=" "
4139         XZN="*"
4140     else
4141         XZY="*"
4142         XZN=" "
4143     fi
4144     if [ "$CFG_XRENDER" = "no" ]; then
4145         XRY=" "
4146         XRN="*"
4147     else
4148         XRY="*"
4149         XRN=" "
4150     fi
4151     if [ "$CFG_MITSHM" = "no" ]; then
4152         XMY=" "
4153         XMN="*"
4154     else
4155         XMY="*"
4156         XMN=" "
4157     fi
4158     if [ "$CFG_XINPUT" = "no" ]; then
4159         XIY=" "
4160         XIN="*"
4161     else
4162         XIY="*"
4163         XIN=" "
4164     fi
4165     if [ "$CFG_XKB" = "no" ]; then
4166         XKY=" "
4167         XKN="*"
4168     else
4169         XKY="*"
4170         XKN=" "
4171     fi
4172     if [ "$CFG_IM" = "no" ]; then
4173         IMY=" "
4174         IMN="*"
4175     else
4176         IMY="*"
4177         IMN=" "
4178     fi
4179     cat << EOF
4180
4181 Qt/X11 only:
4182
4183     -no-gtkstyle ....... Do not build the GTK theme integration.
4184  +  -gtkstyle .......... Build the GTK theme integration.
4185
4186  *  -no-nas-sound ...... Do not compile in NAS sound support.
4187     -system-nas-sound .. Use NAS libaudio from the operating system.
4188                          See http://radscan.com/nas.html
4189
4190     -egl ............... Use EGL instead of GLX to manage contexts.
4191                          When building for desktop OpenGL, this option will
4192                          make Qt use EGL to manage contexts rather than the
4193                          GLX, which is the default. Note: For OpenGL ES, EGL
4194                          is always used.
4195
4196     -no-opengl ......... Do not support OpenGL.
4197  +  -opengl <api> ...... Enable OpenGL support.
4198                          With no parameter, this will auto-detect the "best"
4199                          OpenGL API to use. If desktop OpenGL is available, it
4200                          will be used. Use desktop or es2 for <api>
4201                          to force the use of the Desktop OpenGL or
4202                          OpenGL ES 2 APIs instead.
4203
4204      -no-openvg ........ Do not support OpenVG.
4205  +   -openvg ........... Enable OpenVG support.
4206                          Requires EGL support, typically supplied by an OpenGL
4207                          or other graphics implementation.
4208
4209  $SMN  -no-sm ............. Do not support X Session Management.
4210  $SMY  -sm ................ Support X Session Management, links in -lSM -lICE.
4211
4212  $SHN  -no-xshape ......... Do not compile XShape support.
4213  $SHY  -xshape ............ Compile XShape support.
4214                          Requires X11/extensions/shape.h.
4215
4216  $XVN  -no-xvideo ......... Do not compile XVideo support.
4217  $XVY  -xvideo ............ Compile XVideo support.
4218                          Requires X11/extensions/Xv.h & Xvlib.h.
4219
4220  $SHN  -no-xsync .......... Do not compile XSync support.
4221  $SHY  -xsync ............. Compile XSync support.
4222                          Requires X11/extensions/sync.h.
4223
4224  $XAN  -no-xinerama ....... Do not compile Xinerama (multihead) support.
4225  $XAY  -xinerama .......... Compile Xinerama support.
4226                          Requires X11/extensions/Xinerama.h and libXinerama.
4227                          By default, Xinerama support will be compiled if
4228                          available and the shared libraries are dynamically
4229                          loaded at runtime.
4230
4231  $XCN  -no-xcursor ........ Do not compile Xcursor support.
4232  $XCY  -xcursor ........... Compile Xcursor support.
4233                          Requires X11/Xcursor/Xcursor.h and libXcursor.
4234                          By default, Xcursor support will be compiled if
4235                          available and the shared libraries are dynamically
4236                          loaded at runtime.
4237
4238  $XFN  -no-xfixes ......... Do not compile Xfixes support.
4239  $XFY  -xfixes ............ Compile Xfixes support.
4240                          Requires X11/extensions/Xfixes.h and libXfixes.
4241                          By default, Xfixes support will be compiled if
4242                          available and the shared libraries are dynamically
4243                          loaded at runtime.
4244
4245  $XZN  -no-xrandr ......... Do not compile Xrandr (resize and rotate) support.
4246  $XZY  -xrandr ............ Compile Xrandr support.
4247                          Requires X11/extensions/Xrandr.h and libXrandr.
4248
4249  $XRN  -no-xrender ........ Do not compile Xrender support.
4250  $XRY  -xrender ........... Compile Xrender support.
4251                          Requires X11/extensions/Xrender.h and libXrender.
4252
4253  $XMN  -no-mitshm ......... Do not compile MIT-SHM support.
4254  $XMY  -mitshm ............ Compile MIT-SHM support.
4255                          Requires sys/ipc.h, sys/shm.h and X11/extensions/XShm.h
4256
4257  $FCGN  -no-fontconfig ..... Do not compile FontConfig (anti-aliased font) support.
4258  $FCGY  -fontconfig ........ Compile FontConfig support.
4259                          Requires fontconfig/fontconfig.h, libfontconfig,
4260                          freetype.h and libfreetype.
4261
4262  $XIN  -no-xinput ......... Do not compile Xinput support.
4263  $XIY  -xinput ............ Compile Xinput support. This also enabled tablet support
4264                          which requires IRIX with wacom.h and libXi or
4265                          XFree86 with X11/extensions/XInput.h and libXi.
4266
4267  $XKN  -no-xkb ............ Do not compile XKB (X KeyBoard extension) support.
4268  $XKY  -xkb ............... Compile XKB support.
4269
4270 EOF
4271 fi
4272
4273 if [ "$PLATFORM_MAC" = "yes" ]; then
4274     cat << EOF
4275
4276 Qt/Mac only:
4277
4278     -Fstring ........... Add an explicit framework path.
4279     -fw string ......... Add an explicit framework.
4280
4281     -cocoa ............. [Deprecated] Cocoa is now enabled by default.
4282
4283     -carbon .............Build the Carbon version of Qt. 64-bit archs
4284                          are not supported by carbon and will be built
4285                          with cocoa
4286
4287  *  -framework ......... Build Qt as a series of frameworks and
4288                          link tools against those frameworks.
4289     -no-framework ...... Do not build Qt as a series of frameworks.
4290
4291  *  -dwarf2 ............ Enable dwarf2 debugging symbols.
4292     -no-dwarf2 ......... Disable dwarf2 debugging symbols.
4293
4294     -universal ......... Equivalent to -arch "ppc x86"
4295
4296     -arch <arch> ....... Build Qt for <arch>
4297                          Example values for <arch>: x86 ppc x86_64 ppc64
4298                          Multiple -arch arguments can be specified.
4299
4300     -sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. This option requires gcc 4.
4301                          To use a different SDK with gcc 3.3, set the SDKROOT environment variable.
4302
4303     -harfbuzz .......... Use HarfBuzz to do text layout instead of Core Text when possible.
4304                          It is only available to Cocoa builds.
4305  *  -no-harfbuzz ....... Disable HarfBuzz on Mac. It can still be enabled by setting
4306                          QT_ENABLE_HARFBUZZ environment variable.
4307
4308 EOF
4309 fi
4310
4311 if [ "$PLATFORM_QWS" = "yes" ]; then
4312     cat << EOF
4313 Qt for Embedded Linux:
4314
4315     -embedded <arch> .... This will enable the embedded build, you must have a
4316                           proper license for this switch to work.
4317                           Example values for <arch>: arm mips x86 generic
4318 EOF
4319 fi
4320
4321 if [ "$PLATFORM_QPA" = "yes" ]; then
4322     cat << EOF
4323 Qt for QPA only:
4324 EOF
4325 fi
4326
4327 if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
4328     cat << EOF
4329
4330     -xplatform target ... The target platform when cross-compiling.
4331
4332     -no-feature-<feature> Do not compile in <feature>.
4333     -feature-<feature> .. Compile in <feature>. The available features
4334                           are described in src/corelib/global/qfeatures.txt
4335
4336     -armfpa ............. Target platform uses the ARM-FPA floating point format.
4337     -no-armfpa .......... Target platform does not use the ARM-FPA floating point format.
4338
4339                           The floating point format is usually autodetected by configure. Use this
4340                           to override the detected value.
4341
4342     -little-endian ...... Target platform is little endian (LSB first).
4343     -big-endian ......... Target platform is big endian (MSB first).
4344
4345     -host-little-endian . Host platform is little endian (LSB first).
4346     -host-big-endian .... Host platform is big endian (MSB first).
4347
4348                           You only need to specify the endianness when
4349                           cross-compiling, otherwise the host
4350                           endianness will be used.
4351
4352     -no-freetype ........ Do not compile in Freetype2 support.
4353     -qt-freetype ........ Use the libfreetype bundled with Qt.
4354  *  -system-freetype .... Use libfreetype from the operating system.
4355                           See http://www.freetype.org/
4356
4357     -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the
4358                           default ($CFG_QCONFIG).
4359
4360     -no-opengl .......... Do not support OpenGL.
4361     -opengl <api> ....... Enable OpenGL ES support
4362                           With no parameter, this will attempt to auto-detect
4363                           OpenGL ES 2, or regular desktop OpenGL.
4364                           Use es2 for <api> to override auto-detection.
4365 EOF
4366 fi
4367
4368 if [ "$PLATFORM_QWS" = "yes" ]; then
4369     cat << EOF
4370
4371     -depths <list> ...... Comma-separated list of supported bit-per-pixel
4372                           depths, from: 1, 4, 8, 12, 15, 16, 18, 24, 32 and 'all'.
4373
4374     -qt-decoration-<style> ....Enable a decoration <style> in the QtGui library,
4375                                by default all available decorations are on.
4376                                Possible values for <style>: [ $CFG_DECORATION_AVAILABLE ]
4377     -plugin-decoration-<style> Enable decoration <style> as a plugin to be
4378                                linked to at run time.
4379                                Possible values for <style>: [ $CFG_DECORATION_PLUGIN_AVAILABLE ]
4380     -no-decoration-<style> ....Disable decoration <style> entirely.
4381                                Possible values for <style>: [ $CFG_DECORATION_AVAILABLE ]
4382
4383     -qt-gfx-<driver> ... Enable a graphics <driver> in the QtGui library.
4384                          Possible values for <driver>: [ $CFG_GFX_AVAILABLE ]
4385     -plugin-gfx-<driver> Enable graphics <driver> as a plugin to be
4386                          linked to at run time.
4387                          Possible values for <driver>: [ $CFG_GFX_PLUGIN_AVAILABLE ]
4388     -no-gfx-<driver> ... Disable graphics <driver> entirely.
4389                          Possible values for <driver>: [ $CFG_GFX_AVAILABLE ]
4390
4391     -qt-kbd-<driver> ... Enable a keyboard <driver> in the QtGui library.
4392                          Possible values for <driver>: [ $CFG_KBD_AVAILABLE ]
4393
4394     -plugin-kbd-<driver> Enable keyboard <driver> as a plugin to be linked to
4395                          at runtime.
4396                          Possible values for <driver>: [ $CFG_KBD_PLUGIN_AVAILABLE ]
4397
4398     -no-kbd-<driver> ... Disable keyboard <driver> entirely.
4399                          Possible values for <driver>: [ $CFG_KBD_AVAILABLE ]
4400
4401     -qt-mouse-<driver> ... Enable a mouse <driver> in the QtGui library.
4402                            Possible values for <driver>: [ $CFG_MOUSE_AVAILABLE ]
4403     -plugin-mouse-<driver> Enable mouse <driver> as a plugin to be linked to
4404                            at runtime.
4405                            Possible values for <driver>: [ $CFG_MOUSE_PLUGIN_AVAILABLE ]
4406     -no-mouse-<driver> ... Disable mouse <driver> entirely.
4407                            Possible values for <driver>: [ $CFG_MOUSE_AVAILABLE ]
4408
4409     -iwmmxt ............ Compile using the iWMMXt instruction set
4410                          (available on some XScale CPUs).
4411 EOF
4412 fi
4413
4414 if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" -o "$PLATFORM_X11" = "yes" ]; then
4415     if [ "$CFG_GLIB" = "no" ]; then
4416         GBY=" "
4417         GBN="+"
4418     else
4419         GBY="+"
4420         GBN=" "
4421     fi
4422     cat << EOF
4423  $GBN  -no-glib ........... Do not compile Glib support.
4424  $GBY  -glib .............. Compile Glib support.
4425
4426 EOF
4427 fi
4428
4429 if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
4430     cat << EOF
4431
4432 Qt for Symbian only:
4433     -no-s60 ............ Do not compile in S60 support.
4434  +  -s60 ............... Compile with support for the S60 UI Framework.
4435     -no-style-s60....... Disable s60 style
4436  +  -qt-style-s60....... Enable s60 style in the Qt Library
4437
4438     -no-usedeffiles .... Disable the usage of DEF files.
4439  *  -usedeffiles ....... Enable the usage of DEF files.
4440 EOF
4441 fi
4442    [ "x$ERROR" = "xyes" ] && exit 1
4443    exit 0
4444 fi # Help
4445
4446
4447 # -----------------------------------------------------------------------------
4448 # LICENSING, INTERACTIVE PART
4449 # -----------------------------------------------------------------------------
4450
4451 if [ "$PLATFORM_QWS" = "yes" ]; then
4452     Platform="Qt for Embedded Linux"
4453 elif [ "$PLATFORM_QPA" = "yes" ]; then
4454     Platform="Qt Lighthouse"
4455 elif [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
4456     Platform="Qt for Symbian"
4457 elif [ "$PLATFORM_MAC" = "yes" ]; then
4458     Platform="Qt for Mac OS X"
4459 elif [ "$XPLATFORM_MINGW" = "yes" ]; then
4460     Platform="Qt for Windows"
4461 elif [ '!' -z "`getQMakeConf \"$XQMAKESPEC\" | grep QMAKE_LIBS_X11 | awk '{print $3;}'`" ]; then
4462     PLATFORM_X11=yes
4463     Platform="Qt for Linux/X11"
4464 fi
4465
4466 echo
4467 echo "This is the $Platform ${EditionString} Edition."
4468 echo
4469
4470 if [ "$Edition" = "NokiaInternalBuild" ]; then
4471     echo "Detected -nokia-developer option"
4472     echo "Nokia employees and agents are allowed to use this software under"
4473     echo "the authority of Nokia Corporation and/or its subsidiary(-ies)"
4474 elif [ "$Edition" = "OpenSource" ]; then
4475     while true; do
4476         echo "You are licensed to use this software under the terms of"
4477         echo "the Lesser GNU General Public License (LGPL) versions 2.1."
4478         if [ -f "$relpath/LICENSE.GPL3" ]; then
4479             echo "You are also licensed to use this software under the terms of"
4480             echo "the GNU General Public License (GPL) versions 3."
4481             affix="either"
4482         else
4483             affix="the"
4484         fi
4485         echo
4486         if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
4487             echo "You have already accepted the terms of the $LicenseType license."
4488             acceptance=yes
4489         else
4490             if [ -f "$relpath/LICENSE.GPL3" ]; then
4491                 echo "Type '3' to view the GNU General Public License version 3."
4492             fi
4493             echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
4494             echo "Type 'yes' to accept this license offer."
4495             echo "Type 'no' to decline this license offer."
4496             echo
4497             echo $ECHO_N "Do you accept the terms of $affix license? $ECHO_C"
4498             read acceptance
4499         fi
4500         echo
4501         if [ "$acceptance" = "yes" ] || [ "$acceptance" = "y" ]; then
4502             break
4503         elif [ "$acceptance" = "no" ]; then
4504             echo "You are not licensed to use this software."
4505             echo
4506             exit 1
4507         elif [ "$acceptance" = "3" ]; then
4508             more "$relpath/LICENSE.GPL3"
4509         elif [ "$acceptance" = "L" ]; then
4510             more "$relpath/LICENSE.LGPL"
4511         fi
4512     done
4513 elif [ "$Edition" = "Preview" ]; then
4514     TheLicense=`head -n 1 "$relpath/LICENSE.PREVIEW.COMMERCIAL"`
4515     while true; do
4516
4517         if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
4518             echo "You have already accepted the terms of the $LicenseType license."
4519             acceptance=yes
4520         else
4521             echo "You are licensed to use this software under the terms of"
4522             echo "the $TheLicense"
4523             echo
4524             echo "Type '?' to read the Preview License."
4525             echo "Type 'yes' to accept this license offer."
4526             echo "Type 'no' to decline this license offer."
4527             echo
4528             echo $ECHO_N "Do you accept the terms of the license? $ECHO_C"
4529             read acceptance
4530         fi
4531         echo
4532         if [ "$acceptance" = "yes" ]; then
4533             break
4534         elif [ "$acceptance" = "no" ] ;then
4535             echo "You are not licensed to use this software."
4536             echo
4537             exit 0
4538         elif [ "$acceptance" = "?" ]; then
4539             more "$relpath/LICENSE.PREVIEW.COMMERCIAL"
4540         fi
4541     done
4542 elif [ "$Edition" != "OpenSource" ]; then
4543     if [ -n "$ExpiryDate" ]; then
4544         ExpiryDate=`echo $ExpiryDate | sed -e "s,-,,g" | tr -d "\n\r"`
4545         [ -z "$ExpiryDate" ] && ExpiryDate="0"
4546         Today=`date +%Y%m%d`
4547         if [ "$Today" -gt "$ExpiryDate" ]; then
4548             case "$LicenseType" in
4549             Commercial|Academic|Educational)
4550                 if [ "$QT_PACKAGEDATE" -gt "$ExpiryDate" ]; then
4551                     echo
4552                     echo "NOTICE  NOTICE  NOTICE  NOTICE"
4553                     echo
4554                     echo "  Your support and upgrade period has expired."
4555                     echo
4556                     echo "  You are no longer licensed to use this version of Qt."
4557                     echo "  Please contact qt-info@nokia.com to renew your support"
4558                     echo "  and upgrades for this license."
4559                     echo
4560                     echo "NOTICE  NOTICE  NOTICE  NOTICE"
4561                     echo
4562                     exit 1
4563                 else
4564                     echo
4565                     echo "WARNING  WARNING  WARNING  WARNING"
4566                     echo
4567                     echo "  Your support and upgrade period has expired."
4568                     echo
4569                     echo "  You may continue to use your last licensed release"
4570                     echo "  of Qt under the terms of your existing license"
4571                     echo "  agreement. But you are not entitled to technical"
4572                     echo "  support, nor are you entitled to use any more recent"
4573                     echo "  Qt releases."
4574                     echo
4575                     echo "  Please contact qt-info@nokia.com to renew your"
4576                     echo "  support and upgrades for this license."
4577                     echo
4578                     echo "WARNING  WARNING  WARNING  WARNING"
4579                     echo
4580                     sleep 3
4581                 fi
4582                 ;;
4583             Evaluation|*)
4584                 echo
4585                 echo "NOTICE  NOTICE  NOTICE  NOTICE"
4586                 echo
4587                 echo "  Your Evaluation license has expired."
4588                 echo
4589                 echo "  You are no longer licensed to use this software. Please"
4590                 echo "  contact qt-info@nokia.com to purchase license, or install"
4591                 echo "  the Qt Open Source Edition if you intend to develop free"
4592                 echo "  software."
4593                 echo
4594                 echo "NOTICE  NOTICE  NOTICE  NOTICE"
4595                 echo
4596                 exit 1
4597                 ;;
4598             esac
4599         fi
4600     fi
4601     TheLicense=`head -n 1 "$outpath/LICENSE"`
4602     while true; do
4603         if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
4604             echo "You have already accepted the terms of the $TheLicense."
4605             acceptance=yes
4606         else
4607             echo "You are licensed to use this software under the terms of"
4608             echo "the $TheLicense."
4609             echo
4610             echo "Type '?' to view the $TheLicense."
4611             echo "Type 'yes' to accept this license offer."
4612             echo "Type 'no' to decline this license offer."
4613             echo
4614             echo $ECHO_N "Do you accept the terms of the $TheLicense? $ECHO_C"
4615             read acceptance
4616         fi
4617         echo
4618         if [ "$acceptance" = "yes" ]; then
4619             break
4620         elif [ "$acceptance" = "no" ]; then
4621             echo "You are not licensed to use this software."
4622             echo
4623             exit 1
4624         else [ "$acceptance" = "?" ]
4625             more "$outpath/LICENSE"
4626         fi
4627     done
4628 fi
4629
4630 # this should be moved somewhere else
4631 case "$PLATFORM" in
4632 aix-*)
4633     AIX_VERSION=`uname -v`
4634     if [ "$AIX_VERSION" -lt "5" ]; then
4635         QMakeVar add QMAKE_LIBS_X11 -lbind
4636     fi
4637     ;;
4638 *)
4639     ;;
4640 esac
4641
4642 #-------------------------------------------------------------------------------
4643 # generate qconfig.cpp
4644 #-------------------------------------------------------------------------------
4645 [ -d "$outpath/src/corelib/global" ] || mkdir -p "$outpath/src/corelib/global"
4646
4647 LICENSE_USER_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_lcnsuser=$Licensee"`
4648 LICENSE_PRODUCTS_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_lcnsprod=$Edition"`
4649 PREFIX_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_prfxpath=$QT_INSTALL_PREFIX"`
4650 DOCUMENTATION_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_docspath=$QT_INSTALL_DOCS"`
4651 HEADERS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_hdrspath=$QT_INSTALL_HEADERS"`
4652 LIBRARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_libspath=$QT_INSTALL_LIBS"`
4653 BINARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_binspath=$QT_INSTALL_BINS"`
4654 PLUGINS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_plugpath=$QT_INSTALL_PLUGINS"`
4655 IMPORTS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_impspath=$QT_INSTALL_IMPORTS"`
4656 DATA_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_datapath=$QT_INSTALL_DATA"`
4657 TRANSLATIONS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_trnspath=$QT_INSTALL_TRANSLATIONS"`
4658 SETTINGS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_stngpath=$QT_INSTALL_SETTINGS"`
4659 EXAMPLES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_xmplpath=$QT_INSTALL_EXAMPLES"`
4660
4661 TODAY=`date +%Y-%m-%d`
4662 cat > "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
4663 /* License Info */
4664 static const char qt_configure_licensee_str          [256 + 12] = "$LICENSE_USER_STR";
4665 static const char qt_configure_licensed_products_str [256 + 12] = "$LICENSE_PRODUCTS_STR";
4666
4667 /* Installation date */
4668 static const char qt_configure_installation          [12+11]    = "qt_instdate=$TODAY";
4669 EOF
4670
4671
4672 if [ ! -z "$QT_HOST_PREFIX" ]; then
4673     HOSTPREFIX_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_prfxpath=$QT_HOST_PREFIX"`
4674     HOSTDOCUMENTATION_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_docspath=$QT_HOST_PREFIX/doc"`
4675     HOSTHEADERS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_hdrspath=$QT_HOST_PREFIX/include"`
4676     HOSTLIBRARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_libspath=$QT_HOST_PREFIX/lib"`
4677     HOSTBINARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_binspath=$QT_HOST_PREFIX/bin"`
4678     HOSTPLUGINS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_plugpath=$QT_HOST_PREFIX/plugins"`
4679     HOSTIMPORTS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_impspath=$QT_HOST_PREFIX/IMPORTS"`
4680     HOSTDATA_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_datapath=$QT_HOST_PREFIX"`
4681     HOSTTRANSLATIONS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_trnspath=$QT_HOST_PREFIX/translations"`
4682     HOSTSETTINGS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_stngpath=$QT_INSTALL_SETTINGS"`
4683     HOSTEXAMPLES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_xmplpath=$QT_INSTALL_EXAMPLES"`
4684
4685     cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
4686
4687 #if defined(QT_BOOTSTRAPPED) || defined(QT_BUILD_QMAKE)
4688 /* Installation Info */
4689 static const char qt_configure_prefix_path_str       [256 + 12] = "$HOSTPREFIX_PATH_STR";
4690 static const char qt_configure_documentation_path_str[256 + 12] = "$HOSTDOCUMENTATION_PATH_STR";
4691 static const char qt_configure_headers_path_str      [256 + 12] = "$HOSTHEADERS_PATH_STR";
4692 static const char qt_configure_libraries_path_str    [256 + 12] = "$HOSTLIBRARIES_PATH_STR";
4693 static const char qt_configure_binaries_path_str     [256 + 12] = "$HOSTBINARIES_PATH_STR";
4694 static const char qt_configure_plugins_path_str      [256 + 12] = "$HOSTPLUGINS_PATH_STR";
4695 static const char qt_configure_imports_path_str      [256 + 12] = "$HOSTIMPORTS_PATH_STR";
4696 static const char qt_configure_data_path_str         [256 + 12] = "$HOSTDATA_PATH_STR";
4697 static const char qt_configure_translations_path_str [256 + 12] = "$HOSTTRANSLATIONS_PATH_STR";
4698 static const char qt_configure_settings_path_str     [256 + 12] = "$HOSTSETTINGS_PATH_STR";
4699 static const char qt_configure_examples_path_str     [256 + 12] = "$HOSTEXAMPLES_PATH_STR";
4700 #else // QT_BOOTSTRAPPED
4701 EOF
4702 fi
4703
4704 cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
4705 /* Installation Info */
4706 static const char qt_configure_prefix_path_str       [256 + 12] = "$PREFIX_PATH_STR";
4707 static const char qt_configure_documentation_path_str[256 + 12] = "$DOCUMENTATION_PATH_STR";
4708 static const char qt_configure_headers_path_str      [256 + 12] = "$HEADERS_PATH_STR";
4709 static const char qt_configure_libraries_path_str    [256 + 12] = "$LIBRARIES_PATH_STR";
4710 static const char qt_configure_binaries_path_str     [256 + 12] = "$BINARIES_PATH_STR";
4711 static const char qt_configure_plugins_path_str      [256 + 12] = "$PLUGINS_PATH_STR";
4712 static const char qt_configure_imports_path_str      [256 + 12] = "$IMPORTS_PATH_STR";
4713 static const char qt_configure_data_path_str         [256 + 12] = "$DATA_PATH_STR";
4714 static const char qt_configure_translations_path_str [256 + 12] = "$TRANSLATIONS_PATH_STR";
4715 static const char qt_configure_settings_path_str     [256 + 12] = "$SETTINGS_PATH_STR";
4716 static const char qt_configure_examples_path_str     [256 + 12] = "$EXAMPLES_PATH_STR";
4717 EOF
4718
4719 if [ ! -z "$QT_HOST_PREFIX" ]; then
4720     cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
4721 #endif // QT_BOOTSTRAPPED
4722
4723 EOF
4724 fi
4725
4726 cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
4727 /* strlen( "qt_lcnsxxxx" ) == 12 */
4728 #define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;
4729 #define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;
4730 #define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12;
4731 #define QT_CONFIGURE_DOCUMENTATION_PATH qt_configure_documentation_path_str + 12;
4732 #define QT_CONFIGURE_HEADERS_PATH qt_configure_headers_path_str + 12;
4733 #define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;
4734 #define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;
4735 #define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;
4736 #define QT_CONFIGURE_IMPORTS_PATH qt_configure_imports_path_str + 12;
4737 #define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;
4738 #define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;
4739 #define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;
4740 #define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;
4741 EOF
4742
4743 # avoid unecessary rebuilds by copying only if qconfig.cpp has changed
4744 if cmp -s "$outpath/src/corelib/global/qconfig.cpp" "$outpath/src/corelib/global/qconfig.cpp.new"; then
4745     rm -f "$outpath/src/corelib/global/qconfig.cpp.new"
4746 else
4747     [ -f "$outpath/src/corelib/global/qconfig.cpp" ] && chmod +w "$outpath/src/corelib/global/qconfig.cpp"
4748     mv "$outpath/src/corelib/global/qconfig.cpp.new" "$outpath/src/corelib/global/qconfig.cpp"
4749     chmod -w "$outpath/src/corelib/global/qconfig.cpp"
4750 fi
4751
4752 # -----------------------------------------------------------------------------
4753 if [ "$LicenseType" = "Evaluation" ]; then
4754     EVALKEY=`"$relpath/config.tests/unix/padstring" 524 "qt_qevalkey=$LicenseKeyExt"`
4755 elif echo "$D_FLAGS" | grep QT_EVAL >/dev/null 2>&1; then
4756     EVALKEY=`"$relpath/config.tests/unix/padstring" 524 "qt_qevalkey="`
4757 fi
4758
4759 if [ -n "$EVALKEY" ]; then
4760     rm -f "$outpath/src/corelib/global/qconfig_eval.cpp"
4761     cat > "$outpath/src/corelib/global/qconfig_eval.cpp" <<EOF
4762 /* Evaluation license key */
4763 static const volatile char qt_eval_key_data                   [512 + 12] = "$EVALKEY";
4764 EOF
4765     chmod -w "$outpath/src/corelib/global/qconfig_eval.cpp"
4766 fi
4767
4768
4769 # -----------------------------------------------------------------------------
4770 # build qmake
4771 # -----------------------------------------------------------------------------
4772
4773 # symlink includes
4774 if [ -n "$PERL" ] && [ -x "$relpath/bin/syncqt" ]; then
4775     SYNCQT_OPTS=
4776     [ "$CFG_DEV" = "yes" ] && SYNCQT_OPTS="$SYNCQT_OPTS -check-includes"
4777     if [ "$OPT_SHADOW" = "yes" ]; then
4778         "$outpath/bin/syncqt" $SYNCQT_OPTS || exit 1
4779     elif [ "$CFG_DEV" = "yes" ] || [ ! -d $relpath/include ] || [ -d $relpath/.git ]; then
4780         QTDIR="$relpath" perl "$outpath/bin/syncqt" $SYNCQT_OPTS || exit 1
4781     fi
4782 fi
4783
4784 # $1: variable name
4785 # $2: optional transformation
4786 # relies on $QMAKESPEC, $COMPILER_CONF and $mkfile being set correctly, as the latter
4787 # is where the resulting variable is written to
4788 # Assumes that the optional transformation produces the same variable name for each hit
4789 setBootstrapVariable()
4790 {
4791     getQMakeConf | $AWK '/^('"$1"')[^_A-Z0-9]/ { print $0; }' | ( [ -n "$2" ] && sed "$2" ; [ -z "$2" ] && cat ) | $AWK '
4792 BEGIN {
4793     variable = ""
4794     combinedValue = ""
4795 }
4796 {
4797     valStart = index($0, "=") + 1
4798
4799     append = 0
4800     if (substr($0, valStart - 2, 1) == "+") {
4801         append = 1
4802     }
4803
4804     variable = substr($0, 0, valStart - 2 - append)
4805     value = substr($0, valStart)
4806     gsub("[ \t]+", "", variable)
4807     gsub("^[ \t]+", "", value)
4808     gsub("[ \t]+$", "", value)
4809
4810     if (append == 1 && length(combinedValue) > 0) {
4811         combinedValue = combinedValue " " value
4812     } else {
4813         combinedValue = value
4814     }
4815 }
4816 END {
4817     if (length(combinedValue) > 0) {
4818         printf "%s = %s\n", variable, combinedValue
4819     }
4820 }' >> "$mkfile"
4821 }
4822
4823 # build qmake
4824 if true; then ###[ '!' -f "$outpath/bin/qmake" ];
4825     echo "Creating qmake. Please wait..."
4826
4827     OLD_QCONFIG_H=
4828     QCONFIG_H="$outpath/src/corelib/global/qconfig.h"
4829     QMAKE_QCONFIG_H="${QCONFIG_H}.qmake"
4830     if [ -f "$QCONFIG_H" ]; then
4831          OLD_QCONFIG_H=$QCONFIG_H
4832          mv -f "$OLD_QCONFIG_H" "${OLD_QCONFIG_H}.old"
4833     fi
4834
4835     # create temporary qconfig.h for compiling qmake, if it doesn't exist
4836     # when building qmake, we use #defines for the install paths,
4837     # however they are real functions in the library
4838     if [ '!' -f "$QMAKE_QCONFIG_H" ]; then
4839         mkdir -p "$outpath/src/corelib/global"
4840         [ -f "$QCONFIG_H" ] && chmod +w "$QCONFIG_H"
4841         echo "/* All features enabled while building qmake */" >"$QMAKE_QCONFIG_H"
4842     fi
4843
4844     mv -f "$QMAKE_QCONFIG_H" "$QCONFIG_H"
4845
4846     #mkspecs/default is used as a (gasp!) default mkspec so QMAKESPEC needn't be set once configured
4847     rm -rf mkspecs/default
4848     ln -s `echo $XQMAKESPEC | sed "s,^${relpath}/mkspecs/,,"` mkspecs/default
4849     # fix makefiles
4850     for mkfile in GNUmakefile Makefile; do
4851         EXTRA_LFLAGS=
4852         EXTRA_CFLAGS=
4853         in_mkfile="${mkfile}.in"
4854         if [ "$mkfile" = "Makefile" ]; then
4855 #           if which qmake >/dev/null 2>&1 && [ -f qmake/qmake.pro ]; then
4856 #               (cd qmake && qmake) >/dev/null 2>&1 && continue
4857 #           fi
4858             in_mkfile="${mkfile}.unix"
4859         fi
4860         in_mkfile="$relpath/qmake/$in_mkfile"
4861         mkfile="$outpath/qmake/$mkfile"
4862         if [ -f "$mkfile" ]; then
4863             [ "$CFG_DEV" = "yes" ] && "$WHICH" chflags >/dev/null 2>&1 && chflags nouchg "$mkfile"
4864             rm -f "$mkfile"
4865         fi
4866         [ -f "$in_mkfile" ] || continue
4867
4868         echo "########################################################################" > "$mkfile"
4869         echo "## This file was autogenerated by configure, all changes will be lost ##" >> "$mkfile"
4870         echo "########################################################################" >> "$mkfile"
4871         EXTRA_OBJS=
4872         EXTRA_SRCS=
4873         EXTRA_CFLAGS="\$(QMAKE_CFLAGS)"
4874         EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS)"
4875         EXTRA_LFLAGS="\$(QMAKE_LFLAGS)"
4876
4877         if [ "$PLATFORM" = "irix-cc" ] || [ "$PLATFORM" = "irix-cc-64" ]; then
4878             EXTRA_LFLAGS="$EXTRA_LFLAGS -lm"
4879         fi
4880
4881         [ -n "$CC" ] && echo "CC = $CC" >> "$mkfile"
4882         [ -n "$CXX" ] && echo "CXX = $CXX" >> "$mkfile"
4883         if [ "$CFG_SILENT" = "yes" ]; then
4884             [ -z "$CC" ] && setBootstrapVariable QMAKE_CC 's,QMAKE_CC.*=,CC=\@,'
4885             [ -z "$CXX" ] && setBootstrapVariable QMAKE_CXX 's,QMAKE_CXX.*=,CXX=\@,'
4886         else
4887             [ -z "$CC" ] && setBootstrapVariable QMAKE_CC 's,QMAKE_CC,CC,'
4888             [ -z "$CXX" ] && setBootstrapVariable QMAKE_CXX 's,QMAKE_CXX,CXX,'
4889         fi
4890         setBootstrapVariable QMAKE_CFLAGS
4891         setBootstrapVariable QMAKE_CXXFLAGS 's,\$\$QMAKE_CFLAGS,\$(QMAKE_CFLAGS),'
4892         setBootstrapVariable QMAKE_LFLAGS
4893
4894         if [ $QT_EDITION = "QT_EDITION_OPENSOURCE" ]; then
4895             EXTRA_CFLAGS="$EXTRA_CFLAGS -DQMAKE_OPENSOURCE_EDITION"
4896             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -DQMAKE_OPENSOURCE_EDITION"
4897         fi
4898         if [ "$CFG_RELEASE_QMAKE" = "yes" ]; then
4899             setBootstrapVariable QMAKE_CFLAGS_RELEASE
4900             setBootstrapVariable QMAKE_CXXFLAGS_RELEASE 's,\$\$QMAKE_CFLAGS_RELEASE,\$(QMAKE_CFLAGS_RELEASE),'
4901             EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_RELEASE)"
4902             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_RELEASE)"
4903         elif [ "$CFG_DEBUG" = "yes" ]; then
4904             setBootstrapVariable QMAKE_CFLAGS_DEBUG
4905             setBootstrapVariable QMAKE_CXXFLAGS_DEBUG 's,\$\$QMAKE_CFLAGS_DEBUG,\$(QMAKE_CFLAGS_DEBUG),'
4906             EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_DEBUG)"
4907             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_DEBUG)"
4908         fi
4909
4910         if [ '!' -z "$RPATH_FLAGS" ] && [ '!' -z "`getQMakeConf \"$QMAKESPEC\" | $AWK '/QMAKE_(LFLAGS_)?RPATH/ {print $3;}'`" ]; then
4911             setBootstrapVariable "QMAKE_(LFLAGS_)?RPATH" 's,\$\$LITERAL_WHITESPACE, ,;s,QMAKE_RPATH,QMAKE_LFLAGS_RPATH,'
4912             for rpath in $RPATH_FLAGS; do
4913                 EXTRA_LFLAGS="\$(QMAKE_LFLAGS_RPATH)\"$rpath\" $EXTRA_LFLAGS"
4914             done
4915         fi
4916         if [ "$BUILD_ON_MAC" = "yes" ]; then
4917             echo "export MACOSX_DEPLOYMENT_TARGET = 10.4" >> "$mkfile"
4918             echo "CARBON_LFLAGS =-framework ApplicationServices" >>"$mkfile"
4919             echo "CARBON_CFLAGS =-fconstant-cfstrings" >>"$mkfile"
4920             EXTRA_LFLAGS="$EXTRA_LFLAGS \$(CARBON_LFLAGS)"
4921             EXTRA_CFLAGS="$EXTRA_CFLAGS \$(CARBON_CFLAGS)"
4922             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(CARBON_CFLAGS)"
4923             EXTRA_OBJS="qsettings_mac.o qcore_mac.o"
4924             EXTRA_SRCS="\"$relpath/src/corelib/io/qsettings_mac.cpp\" \"$relpath/src/corelib/kernel/qcore_mac.cpp\""
4925             if echo "$CFG_MAC_ARCHS" | grep x86 > /dev/null 2>&1; then # matches both x86 and x86_64
4926                 X86_CFLAGS="-arch i386"
4927                 X86_LFLAGS="-arch i386"
4928                 EXTRA_CFLAGS="$X86_CFLAGS $EXTRA_CFLAGS"
4929                 EXTRA_CXXFLAGS="$X86_CFLAGS $EXTRA_CXXFLAGS"
4930                 EXTRA_LFLAGS="$EXTRA_LFLAGS $X86_LFLAGS"
4931             fi
4932             if echo "$CFG_MAC_ARCHS" | grep ppc > /dev/null 2>&1; then # matches both ppc and ppc64
4933                 PPC_CFLAGS="-arch ppc"
4934                 PPC_LFLAGS="-arch ppc"
4935                 EXTRA_CFLAGS="$PPC_CFLAGS $EXTRA_CFLAGS"
4936                 EXTRA_CXXFLAGS="$PPC_CFLAGS $EXTRA_CXXFLAGS"
4937                 EXTRA_LFLAGS="$EXTRA_LFLAGS $PPC_LFLAGS"
4938             fi
4939             if [ '!' -z "$CFG_SDK" ]; then
4940                 echo "SDK_LFLAGS =-Wl,-syslibroot,$CFG_SDK" >>"$mkfile"
4941                 echo "SDK_CFLAGS =-isysroot $CFG_SDK" >>"$mkfile"
4942                 EXTRA_CFLAGS="$EXTRA_CFLAGS \$(SDK_CFLAGS)"
4943                 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(SDK_CFLAGS)"
4944                 EXTRA_LFLAGS="$EXTRA_LFLAGS \$(SDK_LFLAGS)"
4945             fi
4946         fi
4947         [ "$CFG_EMBEDDED" != "no" ] && EXTRA_CFLAGS="$EXTRA_CFLAGS -DQWS"
4948         if [ '!' -z "$D_FLAGS" ]; then
4949             for DEF in $D_FLAGS; do
4950                 EXTRA_CFLAGS="$EXTRA_CFLAGS \"-D${DEF}\""
4951             done
4952         fi
4953         QMAKE_BIN_DIR="$QT_INSTALL_BINS"
4954         [ -z "$QMAKE_BIN_DIR" ] && QMAKE_BIN_DIR="${QT_INSTALL_PREFIX}/bin"
4955         QMAKE_DATA_DIR="$QT_INSTALL_DATA"
4956         [ -z "$QMAKE_DATA_DIR" ] && QMAKE_DATA_DIR="${QT_INSTALL_PREFIX}"
4957         echo >>"$mkfile"
4958         adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'`
4959         adjoutpath=`echo "$outpath" | sed 's/ /\\\\\\\\ /g'`
4960         adjqmakespec=`echo "$QMAKESPEC" | sed 's/ /\\\\\\\\ /g'`
4961         sed -e "s,@SOURCE_PATH@,$adjrelpath,g" -e "s,@BUILD_PATH@,$adjoutpath,g" \
4962             -e "s,@QMAKE_CFLAGS@,$EXTRA_CFLAGS,g" -e "s,@QMAKE_LFLAGS@,$EXTRA_LFLAGS,g" \
4963             -e "s,@QMAKE_CXXFLAGS@,$EXTRA_CXXFLAGS,g" \
4964             -e "s,@QT_INSTALL_BINS@,\$(INSTALL_ROOT)$QMAKE_BIN_DIR,g" \
4965             -e "s,@QT_INSTALL_DATA@,\$(INSTALL_ROOT)$QMAKE_DATA_DIR,g" \
4966             -e "s,@QMAKE_QTOBJS@,$EXTRA_OBJS,g" -e "s,@QMAKE_QTSRCS@,$EXTRA_SRCS,g" \
4967             -e "s,@QMAKESPEC@,$adjqmakespec,g" -e "s,@QT_VERSION@,$QT_VERSION,g" "$in_mkfile" >>"$mkfile"
4968
4969         if "$WHICH" makedepend >/dev/null 2>&1 && grep 'depend:' "$mkfile" >/dev/null 2>&1; then
4970             (cd "$outpath/qmake" && "$MAKE" -f "$mkfile" depend) >/dev/null 2>&1
4971             sed "s,^.*/\([^/]*.o\):,\1:,g" "$mkfile" >"$mkfile.tmp"
4972             sed "s,$outpath,$adjoutpath,g" "$mkfile.tmp" >"$mkfile"
4973             rm "$mkfile.tmp"
4974         fi
4975     done
4976
4977     QMAKE_BUILD_ERROR=no
4978     (cd "$outpath/qmake"; "$MAKE") || QMAKE_BUILD_ERROR=yes
4979     [ '!' -z "$QCONFIG_H" ] && mv -f "$QCONFIG_H" "$QMAKE_QCONFIG_H" #move qmake's qconfig.h to qconfig.h.qmake
4980     [ '!' -z "$OLD_QCONFIG_H" ] && mv -f "${OLD_QCONFIG_H}.old" "$OLD_QCONFIG_H" #put back qconfig.h
4981     [ "$QMAKE_BUILD_ERROR" = "yes" ] && exit 2
4982 fi # Build qmake
4983
4984 #-------------------------------------------------------------------------------
4985 # tests that need qmake
4986 #-------------------------------------------------------------------------------
4987
4988 # detect availability of float math.h functions
4989 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/floatmath "floatmath" $L_FLAGS $I_FLAGS $l_FLAGS; then
4990     CFG_USE_FLOATMATH=yes
4991 else
4992     CFG_USE_FLOATMATH=no
4993 fi
4994
4995 # detect mmx support
4996 if [ "${CFG_MMX}" = "auto" ]; then
4997     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mmx "mmx" $L_FLAGS $I_FLAGS $l_FLAGS "-mmmx"; then
4998         CFG_MMX=yes
4999     else
5000         CFG_MMX=no
5001     fi
5002 fi
5003
5004 # detect 3dnow support
5005 if [ "${CFG_3DNOW}" = "auto" ]; then
5006     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/3dnow "3dnow" $L_FLAGS $I_FLAGS $l_FLAGS "-m3dnow"; then
5007         CFG_3DNOW=yes
5008     else
5009         CFG_3DNOW=no
5010     fi
5011 fi
5012
5013 # detect sse support
5014 if [ "${CFG_SSE}" = "auto" ]; then
5015     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse "sse" $L_FLAGS $I_FLAGS $l_FLAGS "-msse"; then
5016         CFG_SSE=yes
5017     else
5018         CFG_SSE=no
5019     fi
5020 fi
5021
5022 # detect sse2 support
5023 if [ "${CFG_SSE2}" = "auto" ]; then
5024     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse2 "sse2" $L_FLAGS $I_FLAGS $l_FLAGS "-msse2"; then
5025        CFG_SSE2=yes
5026     else
5027        CFG_SSE2=no
5028     fi
5029 fi
5030
5031 # detect sse3 support
5032 if [ "${CFG_SSE3}" = "auto" ]; then
5033     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse3 "sse3" $L_FLAGS $I_FLAGS $l_FLAGS "-msse3"; then
5034        CFG_SSE3=yes
5035     else
5036        CFG_SSE3=no
5037     fi
5038 fi
5039
5040 # detect ssse3 support
5041 if [ "${CFG_SSSE3}" = "auto" ]; then
5042     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ssse3 "ssse3" $L_FLAGS $I_FLAGS $l_FLAGS "-mssse3"; then
5043        CFG_SSSE3=yes
5044     else
5045        CFG_SSSE3=no
5046     fi
5047 fi
5048
5049 # detect sse4.1 support
5050 if [ "${CFG_SSE4_1}" = "auto" ]; then
5051     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse4_1 "sse4_1" $L_FLAGS $I_FLAGS $l_FLAGS "-msse4.1"; then
5052        CFG_SSE4_1=yes
5053     else
5054        CFG_SSE4_1=no
5055     fi
5056 fi
5057
5058 # detect sse4.2 support
5059 if [ "${CFG_SSE4_2}" = "auto" ]; then
5060     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse4_2 "sse4_2" $L_FLAGS $I_FLAGS $l_FLAGS "-msse4.2"; then
5061        CFG_SSE4_2=yes
5062     else
5063        CFG_SSE4_2=no
5064     fi
5065 fi
5066
5067 # detect avx support
5068 if [ "${CFG_AVX}" = "auto" ]; then
5069     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/avx "avx" $L_FLAGS $I_FLAGS $l_FLAGS "-mavx"; then
5070        CFG_AVX=yes
5071     else
5072        CFG_AVX=no
5073     fi
5074 fi
5075
5076 # check iWMMXt support
5077 if [ "$CFG_IWMMXT" = "yes" ]; then
5078     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iwmmxt "iwmmxt" $L_FLAGS $I_FLAGS $l_FLAGS "-mcpu=iwmmxt"
5079     if [ $? != "0" ]; then
5080         echo "The iWMMXt functionality test failed!"
5081         echo " Please make sure your compiler supports iWMMXt intrinsics!"
5082         exit 1
5083     fi
5084 fi
5085
5086 # detect neon support
5087 if [ "$CFG_ARCH" = "arm" ] && [ "${CFG_NEON}" = "auto" ]; then
5088     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/neon "neon" $L_FLAGS $I_FLAGS $l_FLAGS "-mfpu=neon"; then
5089         CFG_NEON=yes
5090     else
5091         CFG_NEON=no
5092     fi
5093 fi
5094
5095 [ "$XPLATFORM_MINGW" = "yes" ] && QMakeVar add styles "windowsxp windowsvista"
5096
5097 if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
5098     QMakeVar set styles "windows s60"   #overwrite previous default
5099     CFG_LIBFREETYPE=no
5100     CFG_ZLIB=yes
5101
5102     if [ "$CFG_LARGEFILE" = auto ]; then
5103         CFG_LARGEFILE=no
5104     fi
5105     if [ "$CFG_PHONON" = auto ]; then
5106         CFG_PHONON=yes
5107     fi
5108
5109     if test -z "$EPOCROOT"; then
5110         echo "Please export EPOCROOT. It should point to the sdk install dir"
5111         exit 1
5112     fi
5113     if test ! -d "$EPOCROOT/epoc32"; then
5114         echo "Could not find the 'epoc32' dir in your EPOCROOT."
5115         exit 1
5116     fi
5117
5118     if [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then
5119         # Raptor does not support configure tests.
5120
5121         # the main commands needed to compile;
5122         (mkdir -p config.tests/symbian/rcomp
5123             cd config.tests/symbian/rcomp
5124             rm -f rcomp_test.rsg
5125             touch rcomp_test.rpp rcomp_test.rsc rcomp_test.rss
5126             rcomp -u -m045,046,047 -s./rcomp_test.rpp -o./rcomp_test.rsc -h./rcomp_test.rsg -i./rcomp_test.rss 2>&1 > /dev/null
5127             if test ! -f rcomp_test.rsg; then
5128                 echo "Finding a working rcomp in your PATH failed."
5129                 echo "Fatal error. Make sure you have the epoc tools working and in your PATH";
5130                 exit 1;
5131             fi
5132         )
5133
5134         # compile a simple main that uses printf
5135         if ! "$symbiantests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/symbian/simple "simple" $L_FLAGS $I_FLAGS $l_FLAGS
5136         then
5137             echo "Testing your compiler failed. Could not compile a simple application."
5138             echo "Fatal error; Rerun configure with -verbose to get more details."
5139             exit 1;
5140         fi
5141     fi
5142 fi
5143
5144 # detect zlib
5145 if [ "$CFG_ZLIB" = "no" ]; then
5146     # Note: Qt no longer support builds without zlib
5147     # So we force a "no" to be "auto" here.
5148     # If you REALLY really need no zlib support, you can still disable
5149     # it by doing the following:
5150     #   add "no-zlib" to mkspecs/qconfig.pri
5151     #   #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h)
5152     #
5153     # There's no guarantee that Qt will build under those conditions
5154
5155     CFG_ZLIB=auto
5156     ZLIB_FORCED=yes
5157 fi
5158 if [ "$CFG_ZLIB" = "auto" ]; then
5159     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/zlib "zlib" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5160        CFG_ZLIB=system
5161     else
5162        CFG_ZLIB=yes
5163     fi
5164 fi
5165
5166 if [ "$CFG_LARGEFILE" = "auto" ]; then
5167     #Large files should be enabled for all Linux systems
5168     CFG_LARGEFILE=yes
5169 fi
5170
5171
5172 if [ "$CFG_S60" = "auto" ]; then
5173     if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
5174         CFG_S60=yes
5175     else
5176         CFG_S60=no
5177     fi
5178 fi
5179
5180 if [ "$CFG_QS60STYLE" = "auto" ]; then
5181     if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
5182         CFG_QS60STYLE=qt
5183     else
5184         CFG_QS60STYLE=no
5185     fi
5186 fi
5187
5188 if [ "$CFG_SYMBIAN_DEFFILES" = "auto" ]; then
5189     # elf2e32 crashes when using def files together with gcce.
5190     if [ "$XPLATFORM_SYMBIAN" = "yes" ] && [ "$CFG_DEV" = "no" ] && [ "$XPLATFORM" != "symbian-gcce" ]; then
5191         CFG_SYMBIAN_DEFFILES=yes
5192     else
5193         CFG_SYMBIAN_DEFFILES=no
5194     fi
5195 fi
5196
5197 # detect how jpeg should be built
5198 if [ "$CFG_JPEG" = "auto" ]; then
5199     if [ "$CFG_SHARED" = "yes" ]; then
5200         CFG_JPEG=plugin
5201     else
5202         CFG_JPEG=yes
5203     fi
5204 fi
5205 # detect jpeg
5206 if [ "$CFG_LIBJPEG" = "auto" ]; then
5207     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libjpeg "libjpeg" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5208        CFG_LIBJPEG=system
5209     else
5210        CFG_LIBJPEG=qt
5211     fi
5212 fi
5213
5214 # detect how gif should be built
5215 if [ "$CFG_GIF" = "auto" ]; then
5216     if [ "$CFG_SHARED" = "yes" ]; then
5217         CFG_GIF=plugin
5218     else
5219         CFG_GIF=yes
5220     fi
5221 fi
5222
5223 # detect how tiff should be built
5224 if [ "$CFG_TIFF" = "auto" ]; then
5225     if [ "$CFG_SHARED" = "yes" ]; then
5226         CFG_TIFF=plugin
5227     else
5228         CFG_TIFF=yes
5229     fi
5230 fi
5231
5232 # detect tiff
5233 if [ "$CFG_LIBTIFF" = "auto" ]; then
5234     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libtiff "libtiff" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5235         CFG_LIBTIFF=system
5236     else
5237         CFG_LIBTIFF=qt
5238     fi
5239 fi
5240
5241 # detect how mng should be built
5242 if [ "$CFG_MNG" = "auto" ]; then
5243     if [ "$CFG_SHARED" = "yes" ]; then
5244         CFG_MNG=plugin
5245     else
5246         CFG_MNG=yes
5247     fi
5248 fi
5249 # detect mng
5250 if [ "$CFG_LIBMNG" = "auto" ]; then
5251     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libmng "libmng" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5252        CFG_LIBMNG=system
5253     else
5254        CFG_LIBMNG=qt
5255     fi
5256 fi
5257
5258 # detect png
5259 if [ "$CFG_LIBPNG" = "auto" ]; then
5260     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libpng "libpng" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5261        CFG_LIBPNG=system
5262     else
5263        CFG_LIBPNG=qt
5264     fi
5265 fi
5266
5267 # detect accessibility
5268 if [ "$CFG_ACCESSIBILITY" = "auto" ]; then
5269     if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
5270         # accessibility is currently unsupported
5271         CFG_ACCESSIBILITY=no
5272     else
5273         CFG_ACCESSIBILITY=yes
5274     fi
5275 fi
5276
5277 # auto-detect SQL-modules support
5278 for _SQLDR in $CFG_SQL_AVAILABLE; do
5279         case $_SQLDR in
5280         mysql)
5281             if [ "$CFG_SQL_mysql" != "no" ]; then
5282                 [ -z "$CFG_MYSQL_CONFIG" ] && CFG_MYSQL_CONFIG=`"$WHICH" mysql_config`
5283                 if [ -x "$CFG_MYSQL_CONFIG" ]; then
5284                     QT_CFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --include 2>/dev/null`
5285                     QT_LFLAGS_MYSQL_R=`$CFG_MYSQL_CONFIG --libs_r 2>/dev/null`
5286                     QT_LFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --libs 2>/dev/null`
5287                     QT_MYSQL_VERSION=`$CFG_MYSQL_CONFIG --version 2>/dev/null`
5288                     QT_MYSQL_VERSION_MAJOR=`echo $QT_MYSQL_VERSION | cut -d . -f 1`
5289                 fi
5290                 if [ -n "$QT_MYSQL_VERSION" ] && [ "$QT_MYSQL_VERSION_MAJOR" -lt 4 ]; then
5291                     if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5292                         echo "This version of MySql is not supported ($QT_MYSQL_VERSION)."
5293                         echo " You need MySql 4 or higher."
5294                         echo " If you believe this message is in error you may use the continue"
5295                         echo " switch (-continue) to $0 to continue."
5296                         exit 101
5297                     else
5298                         CFG_SQL_mysql="no"
5299                         QT_LFLAGS_MYSQL=""
5300                         QT_LFLAGS_MYSQL_R=""
5301                         QT_CFLAGS_MYSQL=""
5302                     fi
5303                 else
5304                     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql_r "MySQL (thread-safe)" $QT_LFLAGS_MYSQL_R $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5305                         QMakeVar add CONFIG use_libmysqlclient_r
5306                         if [ "$CFG_SQL_mysql" = "auto" ]; then
5307                             CFG_SQL_mysql=plugin
5308                         fi
5309                         QT_LFLAGS_MYSQL="$QT_LFLAGS_MYSQL_R"
5310                     elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql "MySQL (thread-unsafe)" $QT_LFLAGS_MYSQL $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5311                         if [ "$CFG_SQL_mysql" = "auto" ]; then
5312                             CFG_SQL_mysql=plugin
5313                         fi
5314                     else
5315                         if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5316                             echo "MySQL support cannot be enabled due to functionality tests!"
5317                             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5318                             echo " If you believe this message is in error you may use the continue"
5319                             echo " switch (-continue) to $0 to continue."
5320                             exit 101
5321                         else
5322                             CFG_SQL_mysql=no
5323                             QT_LFLAGS_MYSQL=""
5324                             QT_LFLAGS_MYSQL_R=""
5325                             QT_CFLAGS_MYSQL=""
5326                         fi
5327                     fi
5328                 fi
5329             fi
5330             ;;
5331         psql)
5332             if [ "$CFG_SQL_psql" != "no" ]; then
5333                 # Be careful not to use native pg_config when cross building.
5334                 if [ "$XPLATFORM_MINGW" != "yes" ] && "$WHICH" pg_config >/dev/null 2>&1; then
5335                     QT_CFLAGS_PSQL=`pg_config --includedir 2>/dev/null`
5336                     QT_LFLAGS_PSQL=`pg_config --libdir 2>/dev/null`
5337                 fi
5338                 [ -z "$QT_CFLAGS_PSQL" ] || QT_CFLAGS_PSQL="-I$QT_CFLAGS_PSQL"
5339                 [ -z "$QT_LFLAGS_PSQL" ] || QT_LFLAGS_PSQL="-L$QT_LFLAGS_PSQL"
5340                 # But, respect PSQL_LIBS if set
5341                 [ -z "$PSQL_LIBS" ] || QT_LFLAGS_PSQL="$PSQL_LIBS"
5342                 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/psql "PostgreSQL" $QT_LFLAGS_PSQL $L_FLAGS $QT_CFLAGS_PSQL $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5343                     if [ "$CFG_SQL_psql" = "auto" ]; then
5344                         CFG_SQL_psql=plugin
5345                     fi
5346                 else
5347                     if [ "$CFG_SQL_psql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5348                         echo "PostgreSQL support cannot be enabled due to functionality tests!"
5349                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
5350                         echo " If you believe this message is in error you may use the continue"
5351                         echo " switch (-continue) to $0 to continue."
5352                         exit 101
5353                     else
5354                         CFG_SQL_psql=no
5355                         QT_CFLAGS_PSQL=""
5356                         QT_LFLAGS_PSQL=""
5357                     fi
5358                 fi
5359             fi
5360         ;;
5361         odbc)
5362             if [ "$CFG_SQL_odbc" != "no" ]; then
5363                 if ( [ "$PLATFORM_MAC" != "yes" ] || [ "$XPLATFORM_MINGW" = "yes" ] ) && "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/odbc "ODBC" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5364                     if [ "$CFG_SQL_odbc" = "auto" ]; then
5365                         CFG_SQL_odbc=plugin
5366                     fi
5367                 else
5368                     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iodbc "iODBC" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5369                         QT_LFLAGS_ODBC="-liodbc"
5370                         if [ "$CFG_SQL_odbc" = "auto" ]; then
5371                             CFG_SQL_odbc=plugin
5372                         fi
5373                     else
5374                         if [ "$CFG_SQL_odbc" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5375                             echo "ODBC support cannot be enabled due to functionality tests!"
5376                             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5377                             echo " If you believe this message is in error you may use the continue"
5378                             echo " switch (-continue) to $0 to continue."
5379                             exit 101
5380                         else
5381                             CFG_SQL_odbc=no
5382                         fi
5383                     fi
5384                 fi
5385             fi
5386             ;;
5387         oci)
5388             if [ "$CFG_SQL_oci" != "no" ]; then
5389                 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/oci "OCI" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5390                     if [ "$CFG_SQL_oci" = "auto" ]; then
5391                         CFG_SQL_oci=plugin
5392                     fi
5393                 else
5394                     if [ "$CFG_SQL_oci" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5395                         echo "Oracle (OCI) support cannot be enabled due to functionality tests!"
5396                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
5397                         echo " If you believe this message is in error you may use the continue"
5398                         echo " switch (-continue) to $0 to continue."
5399                         exit 101
5400                     else
5401                         CFG_SQL_oci=no
5402                     fi
5403                 fi
5404             fi
5405             ;;
5406         tds)
5407             if [ "$CFG_SQL_tds" != "no" ]; then
5408                 [ -z "$SYBASE" ] || QT_LFLAGS_TDS="-L$SYBASE/lib"
5409                 [ -z "$SYBASE_LIBS" ] || QT_LFLAGS_TDS="$QT_LFLAGS_TDS $SYBASE_LIBS"
5410                 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tds "TDS" $QT_LFLAGS_TDS $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5411                     if [ "$CFG_SQL_tds" = "auto" ]; then
5412                         CFG_SQL_tds=plugin
5413                     fi
5414                 else
5415                     if [ "$CFG_SQL_tds" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5416                         echo "TDS support cannot be enabled due to functionality tests!"
5417                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
5418                         echo " If you believe this message is in error you may use the continue"
5419                         echo " switch (-continue) to $0 to continue."
5420                         exit 101
5421                     else
5422                         CFG_SQL_tds=no
5423                     fi
5424                 fi
5425             fi
5426             ;;
5427         db2)
5428             if [ "$CFG_SQL_db2" != "no" ]; then
5429                 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/db2 "DB2" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5430                     if [ "$CFG_SQL_db2" = "auto" ]; then
5431                         CFG_SQL_db2=plugin
5432                     fi
5433                 else
5434                     if [ "$CFG_SQL_db2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5435                         echo "ODBC support cannot be enabled due to functionality tests!"
5436                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
5437                         echo " If you believe this message is in error you may use the continue"
5438                         echo " switch (-continue) to $0 to continue."
5439                         exit 101
5440                     else
5441                         CFG_SQL_db2=no
5442                     fi
5443                 fi
5444             fi
5445             ;;
5446         ibase)
5447             if [ "$CFG_SQL_ibase" != "no" ]; then
5448                 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ibase "InterBase" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5449                     if [ "$CFG_SQL_ibase" = "auto" ]; then
5450                         CFG_SQL_ibase=plugin
5451                     fi
5452                 else
5453                     if [ "$CFG_SQL_ibase" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5454                         echo "InterBase support cannot be enabled due to functionality tests!"
5455                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
5456                         echo " If you believe this message is in error you may use the continue"
5457                         echo " switch (-continue) to $0 to continue."
5458                         exit 101
5459                     else
5460                         CFG_SQL_ibase=no
5461                     fi
5462                 fi
5463             fi
5464             ;;
5465         sqlite2)
5466             if [ "$CFG_SQL_sqlite2" != "no" ]; then
5467                 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite2 "SQLite2" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5468                     if [ "$CFG_SQL_sqlite2" = "auto" ]; then
5469                         CFG_SQL_sqlite2=plugin
5470                     fi
5471                 else
5472                     if [ "$CFG_SQL_sqlite2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5473                         echo "SQLite2 support cannot be enabled due to functionality tests!"
5474                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
5475                         echo " If you believe this message is in error you may use the continue"
5476                         echo " switch (-continue) to $0 to continue."
5477                         exit 101
5478                     else
5479                         CFG_SQL_sqlite2=no
5480                     fi
5481                 fi
5482             fi
5483             ;;
5484         sqlite)
5485             if [ "$CFG_SQL_sqlite" = "auto" ]; then # the default
5486                 if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
5487                     # sqlite on symbian is typically not build in Qt but deployed as a pre-existing sis file and should be marked as driver.
5488                     # Configuration parameters should be set
5489                     CFG_SQL_sqlite=qt
5490                     QT_LFLAGS_SQLITE=-lsqlite3
5491                     QMAKE_CONFIG="$QMAKE_CONFIG system-sqlite"
5492                 fi
5493             fi
5494             if [ "$CFG_SQL_sqlite" != "no" ]; then
5495                 SQLITE_AUTODETECT_FAILED="no"
5496                 if [ "$CFG_SQLITE" = "system" ]; then
5497                     if [ -n "$PKG_CONFIG" ]; then
5498                         QT_CFLAGS_SQLITE=`$PKG_CONFIG --cflags sqlite3 2>/dev/null`
5499                         QT_LFLAGS_SQLITE=`$PKG_CONFIG --libs sqlite3 2>/dev/null`
5500                     fi
5501                     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite "SQLite" $QT_LFLAGS_SQLITE $L_FLAGS $QT_CFLAGS_SQLITE $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5502                         if [ "$CFG_SQL_sqlite" = "auto" ]; then
5503                             CFG_SQL_sqlite=plugin
5504                         fi
5505                         QMAKE_CONFIG="$QMAKE_CONFIG system-sqlite"
5506                     else
5507                         SQLITE_AUTODETECT_FAILED="yes"
5508                         CFG_SQL_sqlite=no
5509                     fi
5510                 elif [ -f "$relpath/src/3rdparty/sqlite/sqlite3.h" ]; then
5511                     if [ "$CFG_SQL_sqlite" = "auto" ]; then
5512                             CFG_SQL_sqlite=plugin
5513                     fi
5514                 else
5515                     SQLITE_AUTODETECT_FAILED="yes"
5516                     CFG_SQL_sqlite=no
5517                 fi
5518
5519                 if [ "$SQLITE_AUTODETECT_FAILED" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5520                     echo "SQLite support cannot be enabled due to functionality tests!"
5521                     echo " Turn on verbose messaging (-v) to $0 to see the final report."
5522                     echo " If you believe this message is in error you may use the continue"
5523                     echo " switch (-continue) to $0 to continue."
5524                     exit 101
5525                 fi
5526             fi
5527             ;;
5528         *)
5529             if [ "$OPT_VERBOSE" = "yes" ]; then
5530                 echo "unknown SQL driver: $_SQLDR"
5531             fi
5532             ;;
5533         esac
5534 done
5535
5536 # auto-detect NIS support
5537 if [ "$CFG_NIS" != "no" ]; then
5538     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/nis "NIS" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5539         CFG_NIS=yes
5540     else
5541         if [ "$CFG_NIS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5542             echo "NIS support cannot be enabled due to functionality tests!"
5543             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5544             echo " If you believe this message is in error you may use the continue"
5545             echo " switch (-continue) to $0 to continue."
5546             exit 101
5547         else
5548             CFG_NIS=no
5549         fi
5550     fi
5551 fi
5552
5553 # auto-detect CUPS support
5554 if [ "$CFG_CUPS" != "no" ]; then
5555     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/cups "Cups" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5556         CFG_CUPS=yes
5557     else
5558         if [ "$CFG_CUPS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5559             echo "Cups support cannot be enabled due to functionality tests!"
5560             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5561             echo " If you believe this message is in error you may use the continue"
5562             echo " switch (-continue) to $0 to continue."
5563             exit 101
5564         else
5565             CFG_CUPS=no
5566         fi
5567     fi
5568 fi
5569
5570 # auto-detect iconv(3) support
5571 if [ "$CFG_ICONV" != "no" ]; then
5572     if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
5573         CFG_ICONV=no
5574     elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/iconv" "POSIX iconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5575         CFG_ICONV=yes
5576     elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/sun-libiconv" "SUN libiconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5577         CFG_ICONV=sun
5578     elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/gnu-libiconv" "GNU libiconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5579         CFG_ICONV=gnu
5580     else
5581         if [ "$CFG_ICONV" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5582             echo "Iconv support cannot be enabled due to functionality tests!"
5583             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5584             echo " If you believe this message is in error you may use the continue"
5585             echo " switch (-continue) to $0 to continue."
5586             exit 101
5587         else
5588             CFG_ICONV=no
5589         fi
5590     fi
5591 fi
5592
5593 # auto-detect libdbus-1 support
5594 if [ "$CFG_DBUS" != "no" ]; then
5595     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then
5596         QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null`
5597         QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null`
5598     fi
5599     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/dbus "D-Bus" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_DBUS $QT_LIBS_DBUS $MAC_CONFIG_TEST_COMMANDLINE; then
5600         [ "$CFG_DBUS" = "auto" ] && CFG_DBUS=yes
5601         QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
5602         QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS"
5603     else
5604         if [ "$CFG_DBUS" = "auto" ]; then
5605             CFG_DBUS=no
5606         elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5607             # CFG_DBUS is "yes" or "linked" here
5608
5609             echo "The QtDBus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found."
5610             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5611             echo " If you believe this message is in error you may use the continue"
5612             echo " switch (-continue) to $0 to continue."
5613             exit 101
5614         fi
5615     fi
5616 fi
5617
5618 if [ "$CFG_MULTIMEDIA" = "auto" ]; then
5619     CFG_MULTIMEDIA="$CFG_GUI"
5620 fi
5621
5622 if [ "$CFG_MULTIMEDIA" = "yes" ] && [ "$CFG_GUI" = "no" ]; then
5623     echo "QtMultimedia requested, but it can't be built without QtGui"
5624     exit 1
5625 fi
5626
5627 # Generate a CRC of the namespace for using in constants for the Carbon port.
5628 # This should mean that you really *can* load two Qt's and have our custom
5629 # Carbon events work.
5630 if [ "$PLATFORM_MAC" = "yes" -a ! -z "$QT_NAMESPACE" ]; then
5631     QT_NAMESPACE_MAC_CRC=`"$mactests/crc.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/mac/crc $QT_NAMESPACE $L_FLAGS $I_FLAGS $l_FLAGS`
5632 fi
5633
5634 # X11/QWS/Lighthouse
5635 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
5636
5637     # auto-detect Glib support
5638     if [ "$CFG_GLIB" != "no" ]; then
5639         if [ -n "$PKG_CONFIG" ]; then
5640             QT_CFLAGS_GLIB=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0 2>/dev/null`
5641             QT_LIBS_GLIB=`$PKG_CONFIG --libs glib-2.0 gthread-2.0 2>/dev/null`
5642         fi
5643         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/glib "Glib" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_GLIB $QT_LIBS_GLIB $X11TESTS_FLAGS ; then
5644             CFG_GLIB=yes
5645             QMakeVar set QT_CFLAGS_GLIB "$QT_CFLAGS_GLIB"
5646             QMakeVar set QT_LIBS_GLIB "$QT_LIBS_GLIB"
5647         else
5648             if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5649                 echo "Glib support cannot be enabled due to functionality tests!"
5650                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5651                 echo " If you believe this message is in error you may use the continue"
5652                 echo " switch (-continue) to $0 to continue."
5653                 exit 101
5654             else
5655                 CFG_GLIB=no
5656             fi
5657         fi
5658     fi
5659
5660     if [ "$CFG_GUI" = "no" ]; then
5661         if [ "$CFG_PHONON" = "auto" ]; then
5662             CFG_PHONON=no
5663         fi
5664         if [ "$CFG_PHONON" != "no" ]; then
5665             echo "Phonon enabled, but GUI disabled."
5666             echo " You might need to either enable the GUI or disable Phonon"
5667             exit 1
5668         fi
5669     fi
5670
5671     # Auto-detect GStreamer support (needed for Phonon)
5672     if [ "$CFG_PHONON" != "no" ]; then
5673         if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then
5674             if [ -n "$PKG_CONFIG" ]; then
5675                 QT_CFLAGS_GSTREAMER=`$PKG_CONFIG --cflags gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
5676                 QT_LIBS_GSTREAMER=`$PKG_CONFIG --libs gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
5677             fi
5678             if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/gstreamer "GStreamer" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_GSTREAMER $QT_LIBS_GSTREAMER $X11TESTS_FLAGS; then
5679                 CFG_GSTREAMER=yes
5680                 QMakeVar set QT_CFLAGS_GSTREAMER "$QT_CFLAGS_GSTREAMER"
5681                 QMakeVar set QT_LIBS_GSTREAMER "$QT_LIBS_GSTREAMER"
5682             else
5683                 if [ "$CFG_GSTREAMER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5684                     echo "Gstreamer support cannot be enabled due to functionality tests!"
5685                     echo " Turn on verbose messaging (-v) to $0 to see the final report."
5686                     echo " If you believe this message is in error you may use the continue"
5687                     echo " switch (-continue) to $0 to continue."
5688                     exit 101
5689                 else
5690                     CFG_GSTREAMER=no
5691                 fi
5692             fi
5693         elif [ "$CFG_GLIB" = "no" ]; then
5694             CFG_GSTREAMER=no
5695         fi
5696     else
5697         CFG_GSTREAMER=no
5698     fi
5699
5700     if [ "$CFG_PHONON" != "no" ]; then
5701         if [ "$CFG_PHONON_BACKEND" != "no" ]; then
5702             if [ "$CFG_GSTREAMER" = "yes" ]; then
5703                 CFG_PHONON=yes
5704             else
5705                 if [ "$CFG_PHONON" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5706                     echo "Phonon support cannot be enabled due to functionality tests!"
5707                     echo " Turn on verbose messaging (-v) to $0 to see the final report."
5708                     echo " If you believe this message is in error you may use the continue"
5709                     echo " switch (-continue) to $0 to continue."
5710                     exit 101
5711                 else
5712                     CFG_PHONON=no
5713                 fi
5714             fi
5715         else
5716             CFG_PHONON=yes
5717         fi
5718     fi
5719
5720     # auto-detect icd support
5721     if [ "$CFG_GLIB" = "yes" -a "$CFG_ICD" != "no" ]; then
5722         if [ -n "$PKG_CONFIG" ]; then
5723             QT_CFLAGS_CONNSETTINGS=`$PKG_CONFIG --cflags connsettings icd2 2>/dev/null`
5724             QT_LIBS_CONNSETTINGS=`$PKG_CONFIG --libs connsettings icd2 2>/dev/null`
5725         fi
5726         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/icd "ICD" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_CONNSETTINGS $QT_LIBS_CONNSETTINGS; then
5727             [ "$CFG_ICD" = "auto" ] && CFG_ICD=yes
5728             QMakeVar set QT_CFLAGS_CONNSETTINGS "$QT_CFLAGS_CONNSETTINGS"
5729             QMakeVar set QT_LIBS_CONNSETTINGS "$QT_LIBS_CONNSETTINGS"
5730         else
5731             if [ "$CFG_ICD" = "auto" ]; then
5732                 CFG_ICD=no
5733             elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5734                 # CFG_ICD is "yes"
5735
5736                 echo "The ICD Bearer Management plugin cannot be enabled because connsettings was not found."
5737                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5738                 echo " If you believe this message is in error you may use the continue"
5739                 echo " switch (-continue) to $0 to continue."
5740                 exit 101
5741             fi
5742         fi
5743     elif [ "$CFG_GLIB" = "no" ]; then
5744         CFG_ICD=no
5745     fi
5746
5747     # auto-detect libicu support
5748     if [ "$CFG_ICU" != "no" ]; then
5749         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/icu "ICU" $L_FLAGS $I_FLAGS $l_FLAGS; then
5750             [ "$CFG_ICU" = "auto" ] && CFG_ICU=yes
5751         else
5752             if [ "$CFG_ICU" = "auto" ]; then
5753                 CFG_ICU=no
5754             elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5755                 # CFG_ICU is "yes"
5756
5757                 echo "The ICU library support cannot be enabled."
5758                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5759                 echo " If you believe this message is in error you may use the continue"
5760                 echo " switch (-continue) to $0 to continue."
5761                 exit 101
5762             fi
5763         fi
5764     fi
5765
5766     # Auto-detect PulseAudio support
5767     if [ "$CFG_PULSEAUDIO" != "no" ]; then
5768         if [ -n "$PKG_CONFIG" ]; then
5769             QT_CFLAGS_PULSEAUDIO=`$PKG_CONFIG --cflags libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
5770             QT_LIBS_PULSEAUDIO=`$PKG_CONFIG --libs libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
5771         fi
5772         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/pulseaudio "PulseAudio" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_PULSEAUDIO $QT_LIBS_PULSEAUDIO $X11TESTS_FLAGS; then
5773             CFG_PULSEAUDIO=yes
5774             QMakeVar set QT_CFLAGS_PULSEAUDIO "$QT_CFLAGS_PULSEAUDIO"
5775             QMakeVar set QT_LIBS_PULSEAUDIO "$QT_LIBS_PULSEAUDIO"
5776         else
5777             if [ "$CFG_PULSEAUDIO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5778                 echo "PulseAudio support cannot be enabled due to functionality tests!"
5779                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5780                 echo " If you believe this message is in error you may use the continue"
5781                 echo " switch (-continue) to $0 to continue."
5782                 exit 101
5783             else
5784                 CFG_PULSEAUDIO=no
5785             fi
5786         fi
5787     fi
5788 fi # X11/QWS/Lighthouse
5789
5790 # X11
5791 if [ "$PLATFORM_X11" = "yes" -a "$CFG_GUI" != "no" ]; then
5792     x11tests="$relpath/config.tests/x11"
5793     X11TESTS_FLAGS=
5794
5795     # work around broken X11 headers when using GCC 2.95 or later
5796     NOTYPE=no
5797     "$x11tests/notype.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" && NOTYPE=yes
5798     if [ $NOTYPE = "yes" ]; then
5799         QMakeVar add QMAKE_CXXFLAGS -fpermissive
5800         X11TESTS_FLAGS="$X11TESTS_FLAGS -fpermissive"
5801     fi
5802
5803     # Check we actually have X11 :-)
5804     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
5805     if [ $? != "0" ]; then
5806         echo "Basic XLib functionality test failed!"
5807         echo " You might need to modify the include and library search paths by editing"
5808         echo " QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in ${XQMAKESPEC}."
5809         exit 1
5810     fi
5811 fi
5812
5813 # X11/MINGW/SYMBIAN OpenGL
5814 if [ "$PLATFORM_X11" = "yes" -o "$XPLATFORM_MINGW" = "yes" -o "$XPLATFORM_SYMBIAN" = "yes" ]; then
5815     # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
5816     if [ "$CFG_GUI" = "no" ]; then
5817         if [ "$CFG_OPENGL" = "auto" ]; then
5818             CFG_OPENGL=no
5819         fi
5820         if [ "$CFG_OPENGL" != "no" ]; then
5821             echo "OpenGL enabled, but GUI disabled."
5822             echo " You might need to either enable the GUI or disable OpenGL"
5823             exit 1
5824         fi
5825     fi
5826     if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
5827         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
5828             CFG_OPENGL=desktop
5829         elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then
5830             CFG_OPENGL=es2
5831             if [ "$CFG_EGL" = "no" ]; then
5832                 CFG_EGL=auto
5833             fi
5834         else
5835             if [ "$CFG_OPENGL" = "yes" ]; then
5836                 echo "All the OpenGL functionality tests failed!"
5837                 echo " You might need to modify the include and library search paths by editing"
5838                 echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5839                 echo " ${XQMAKESPEC}."
5840                 exit 1
5841             fi
5842             CFG_OPENGL=no
5843         fi
5844         case "$PLATFORM" in
5845         hpux*)
5846             # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
5847             if [ "$CFG_OPENGL" = "desktop" ]; then
5848                 "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
5849                 if [ $? != "0" ]; then
5850                     QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
5851                 fi
5852             fi
5853             ;;
5854         *)
5855             ;;
5856         esac
5857     elif [ "$CFG_OPENGL" = "es2" ]; then
5858         #OpenGL ES 2.x
5859         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS
5860         if [ $? != "0" ]; then
5861             echo "The OpenGL ES 2.0 functionality test failed!"
5862             echo " You might need to modify the include and library search paths by editing"
5863             echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
5864             echo " ${XQMAKESPEC}."
5865             exit 1
5866         fi
5867     elif [ "$CFG_OPENGL" = "desktop" ]; then
5868         # Desktop OpenGL support
5869         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
5870         if [ $? != "0" ]; then
5871             echo "The OpenGL functionality test failed!"
5872             echo " You might need to modify the include and library search paths by editing"
5873             echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5874             echo " ${XQMAKESPEC}."
5875             exit 1
5876         fi
5877         case "$PLATFORM" in
5878         hpux*)
5879             # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
5880             "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
5881             if [ $? != "0" ]; then
5882                 QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
5883             fi
5884             ;;
5885         *)
5886             ;;
5887         esac
5888     fi
5889
5890     # if opengl is disabled and the user specified graphicssystem gl, disable it...
5891     if [ "$CFG_GRAPHICS_SYSTEM" = "opengl" ] && [ "$CFG_OPENGL" = "no" ]; then
5892         echo "OpenGL Graphics System is disabled due to missing OpenGL support..."
5893         CFG_GRAPHICS_SYSTEM=default
5894     fi
5895 fi # X11/MINGW OpenGL
5896
5897 # X11
5898 if [ "$PLATFORM_X11" = "yes" ]; then
5899     # auto-detect Xcursor support
5900     if [ "$CFG_XCURSOR" != "no" ]; then
5901         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xcursor "Xcursor" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
5902             if [ "$CFG_XCURSOR" != "runtime" ]; then
5903                 CFG_XCURSOR=yes;
5904             fi
5905         else
5906             if [ "$CFG_XCURSOR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5907                 echo "Xcursor support cannot be enabled due to functionality tests!"
5908                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5909                 echo " If you believe this message is in error you may use the continue"
5910                 echo " switch (-continue) to $0 to continue."
5911                 exit 101
5912             else
5913                 CFG_XCURSOR=no
5914             fi
5915         fi
5916     fi
5917
5918     # auto-detect Xfixes support
5919     if [ "$CFG_XFIXES" != "no" ]; then
5920         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xfixes "Xfixes" $L_FLAGS $I_FLAGS $X11TESTS_FLAGS; then
5921             if [ "$CFG_XFIXES" != "runtime" ]; then
5922                 CFG_XFIXES=yes;
5923             fi
5924         else
5925             if [ "$CFG_XFIXES" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5926                 echo "Xfixes support cannot be enabled due to functionality tests!"
5927                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5928                 echo " If you believe this message is in error you may use the continue"
5929                 echo " switch (-continue) to $0 to continue."
5930                 exit 101
5931             else
5932                 CFG_XFIXES=no
5933             fi
5934         fi
5935     fi
5936
5937     # auto-detect Xrandr support (resize and rotate extension)
5938     if [ "$CFG_XRANDR" != "no" ]; then
5939         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xrandr "Xrandr" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
5940             if [ "$CFG_XRANDR" != "runtime" ]; then
5941             CFG_XRANDR=yes
5942             fi
5943         else
5944             if [ "$CFG_XRANDR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5945                 echo "Xrandr support cannot be enabled due to functionality tests!"
5946                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5947                 echo " If you believe this message is in error you may use the continue"
5948                 echo " switch (-continue) to $0 to continue."
5949                 exit 101
5950             else
5951                 CFG_XRANDR=no
5952             fi
5953         fi
5954     fi
5955
5956     # auto-detect Xrender support
5957     if [ "$CFG_XRENDER" != "no" ]; then
5958         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xrender "Xrender" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
5959             CFG_XRENDER=yes
5960         else
5961             if [ "$CFG_XRENDER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5962                 echo "Xrender support cannot be enabled due to functionality tests!"
5963                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5964                 echo " If you believe this message is in error you may use the continue"
5965                 echo " switch (-continue) to $0 to continue."
5966                 exit 101
5967             else
5968                 CFG_XRENDER=no
5969             fi
5970         fi
5971     fi
5972
5973     # Additional check to decide if WebKit support will be included
5974     if [ "$CFG_XRENDER" = "no" ] && [ "$CFG_WEBKIT" != "no" ]; then
5975         echo "Warning: -no-xrender will disable the QtWebkit module."
5976         CFG_WEBKIT="no"
5977     fi
5978
5979     # auto-detect MIT-SHM support
5980     if [ "$CFG_MITSHM" != "no" ]; then
5981         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/mitshm "mitshm" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
5982             CFG_MITSHM=yes
5983         else
5984             if [ "$CFG_MITSHM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5985                 echo "MITSHM support cannot be enabled due to functionality tests!"
5986                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5987                 echo " If you believe this message is in error you may use the continue"
5988                 echo " switch (-continue) to $0 to continue."
5989                 exit 101
5990             else
5991                 CFG_MITSHM=no
5992             fi
5993         fi
5994     fi
5995
5996     # auto-detect FontConfig support
5997     if [ "$CFG_FONTCONFIG" != "no" ]; then
5998     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
5999         QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
6000         QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null`
6001     else
6002         QT_CFLAGS_FONTCONFIG=
6003         QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig"
6004     fi
6005     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/fontconfig "FontConfig" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS $QT_CFLAGS_FONTCONFIG $QT_LIBS_FONTCONFIG; then
6006             CFG_FONTCONFIG=yes
6007         QMakeVar set QMAKE_CFLAGS_X11 "$QT_CFLAGS_FONTCONFIG \$\$QMAKE_CFLAGS_X11"
6008         QMakeVar set QMAKE_LIBS_X11 "$QT_LIBS_FONTCONFIG \$\$QMAKE_LIBS_X11"
6009             CFG_LIBFREETYPE=system
6010         else
6011             if [ "$CFG_FONTCONFIG" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6012                 echo "FontConfig support cannot be enabled due to functionality tests!"
6013                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
6014                 echo " If you believe this message is in error you may use the continue"
6015                 echo " switch (-continue) to $0 to continue."
6016                 exit 101
6017             else
6018                 CFG_FONTCONFIG=no
6019             fi
6020         fi
6021     fi
6022
6023     # auto-detect Session Management support
6024     if [ "$CFG_SM" = "auto" ]; then
6025         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/sm "Session Management" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
6026             CFG_SM=yes
6027         else
6028             if [ "$CFG_SM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6029                 echo "Session Management support cannot be enabled due to functionality tests!"
6030                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
6031                 echo " If you believe this message is in error you may use the continue"
6032                 echo " switch (-continue) to $0 to continue."
6033                 exit 101
6034             else
6035                 CFG_SM=no
6036             fi
6037         fi
6038     fi
6039
6040     # auto-detect SHAPE support
6041     if [ "$CFG_XSHAPE" != "no" ]; then
6042         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xshape "XShape" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
6043             CFG_XSHAPE=yes
6044         else
6045             if [ "$CFG_XSHAPE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6046                 echo "XShape support cannot be enabled due to functionality tests!"
6047                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
6048                 echo " If you believe this message is in error you may use the continue"
6049                 echo " switch (-continue) to $0 to continue."
6050                 exit 101
6051             else
6052                 CFG_XSHAPE=no
6053             fi
6054         fi
6055     fi
6056
6057     # auto-detect XVideo support
6058     if [ "$CFG_XVIDEO" != "no" ]; then
6059         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xvideo "XVideo" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
6060             CFG_XVIDEO=yes
6061         else
6062             if [ "$CFG_XVIDEO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6063                 echo "XVideo support cannot be enabled due to functionality tests!"
6064                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
6065                 echo " If you believe this message is in error you may use the continue"
6066                 echo " switch (-continue) to $0 to continue."
6067                 exit 101
6068             else
6069                 CFG_XVIDEO=no
6070             fi
6071         fi
6072     fi
6073
6074     # auto-detect XSync support
6075     if [ "$CFG_XSYNC" != "no" ]; then
6076         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xsync "XSync" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
6077             CFG_XSYNC=yes
6078         else
6079             if [ "$CFG_XSYNC" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6080                 echo "XSync support cannot be enabled due to functionality tests!"
6081                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
6082                 echo " If you believe this message is in error you may use the continue"
6083                 echo " switch (-continue) to $0 to continue."
6084                 exit 101
6085             else
6086                 CFG_XSYNC=no
6087             fi
6088         fi
6089     fi
6090
6091     # auto-detect Xinerama support
6092     if [ "$CFG_XINERAMA" != "no" ]; then
6093         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xinerama "Xinerama" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
6094             if [ "$CFG_XINERAMA" != "runtime" ]; then
6095                 CFG_XINERAMA=yes
6096             fi
6097         else
6098             if [ "$CFG_XINERAMA" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6099                 echo "Xinerama support cannot be enabled due to functionality tests!"
6100                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
6101                 echo " If you believe this message is in error you may use the continue"
6102                 echo " switch (-continue) to $0 to continue."
6103                 exit 101
6104             else
6105                 CFG_XINERAMA=no
6106             fi
6107         fi
6108     fi
6109
6110     # auto-detect Xinput support
6111     if [ "$CFG_XINPUT" != "no" ]; then
6112         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xinput "XInput" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
6113             if [ "$CFG_XINPUT" != "runtime" ]; then
6114                 CFG_XINPUT=yes
6115             fi
6116         else
6117             if [ "$CFG_XINPUT" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6118                 echo "Tablet and Xinput support cannot be enabled due to functionality tests!"
6119                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
6120                 echo " If you believe this message is in error you may use the continue"
6121                 echo " switch (-continue) to $0 to continue."
6122                 exit 101
6123             else
6124                 CFG_XINPUT=no
6125             fi
6126         fi
6127     fi
6128
6129     # auto-detect XKB support
6130     if [ "$CFG_XKB" != "no" ]; then
6131         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xkb "XKB" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
6132             CFG_XKB=yes
6133         else
6134             if [ "$CFG_XKB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6135                 echo "XKB support cannot be enabled due to functionality tests!"
6136                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
6137                 echo " If you believe this message is in error you may use the continue"
6138                 echo " switch (-continue) to $0 to continue."
6139                 exit 101
6140             else
6141                 CFG_XKB=no
6142             fi
6143         fi
6144     fi
6145
6146     if [ "$CFG_GLIB" = "yes" -a "$CFG_QGTKSTYLE" != "no" ]; then
6147         if [ -n "$PKG_CONFIG" ]; then
6148             QT_CFLAGS_QGTKSTYLE=`$PKG_CONFIG --cflags gtk+-2.0 ">=" 2.10 atk 2>/dev/null`
6149             QT_LIBS_QGTKSTYLE=`$PKG_CONFIG --libs gobject-2.0 2>/dev/null`
6150         fi
6151         if [ -n "$QT_CFLAGS_QGTKSTYLE" ] ; then
6152             CFG_QGTKSTYLE=yes
6153             QMakeVar set QT_CFLAGS_QGTKSTYLE "$QT_CFLAGS_QGTKSTYLE"
6154             QMakeVar set QT_LIBS_QGTKSTYLE "$QT_LIBS_QGTKSTYLE"
6155         else
6156             if [ "$CFG_QGTKSTYLE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6157                 echo "Gtk theme support cannot be enabled due to functionality tests!"
6158                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
6159                 echo " If you believe this message is in error you may use the continue"
6160                 echo " switch (-continue) to $0 to continue."
6161                 exit 101
6162             else
6163                 CFG_QGTKSTYLE=no
6164             fi
6165         fi
6166     elif [ "$CFG_GLIB" = "no" ]; then
6167         CFG_QGTKSTYLE=no
6168     fi
6169 fi # X11
6170
6171
6172 if [ "$PLATFORM_MAC" = "yes" ]; then
6173     if [ "$CFG_PHONON" != "no" ]; then
6174         # Always enable Phonon (unless it was explicitly disabled)
6175         CFG_PHONON=yes
6176     fi
6177
6178     if [ "$CFG_COREWLAN" = "auto" ]; then
6179         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/mac/corewlan "CoreWlan" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
6180             CFG_COREWLAN=yes
6181         else
6182             CFG_COREWLAN=no
6183         fi
6184     fi
6185 fi
6186
6187
6188 if [ "$PLATFORM_QPA" = "yes" ]; then
6189     # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
6190     if [ "$CFG_ARCH" = "macosx" ]; then
6191         CFG_OPENGL=desktop
6192     elif [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
6193         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengldesktop "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
6194             CFG_OPENGL=desktop
6195         elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then
6196             CFG_OPENGL=es2
6197         else
6198             if [ "$CFG_OPENGL" = "yes" ]; then
6199                 echo "All the OpenGL functionality tests failed!"
6200                 echo " You might need to modify the include and library search paths by editing"
6201                 echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
6202                 echo " ${XQMAKESPEC}."
6203                 exit 1
6204             fi
6205             CFG_OPENGL=no
6206         fi
6207     elif [ "$CFG_OPENGL" = "es2" ]; then
6208         #OpenGL ES 2.x
6209         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists glesv2 2>/dev/null; then
6210             QMAKE_INCDIR_OPENGL_ES2=`$PKG_CONFIG --variable=includedir glesv2 2>/dev/null`
6211             QMAKE_LIBDIR_OPENGL_ES2=`$PKG_CONFIG --variable=libdir glesv2 2>/dev/null`
6212             QMAKE_LIBS_OPENGL_ES2=`$PKG_CONFIG --libs glesv2 2>/dev/null`
6213             QMAKE_CFLAGS_OPENGL_ES2=`$PKG_CONFIG --cflags glesv2 2>/dev/null`
6214             QMakeVar set QMAKE_INCDIR_OPENGL_ES2 "$QMAKE_INCDIR_OPENGL_ES2"
6215             QMakeVar set QMAKE_LIBDIR_OPENGL_ES2 "$QMAKE_LIBDIR_OPENGL_ES2"
6216             QMakeVar set QMAKE_LIBS_OPENGL_ES2 "$QMAKE_LIBS_OPENGL_ES2"
6217         fi
6218
6219         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_LIBS_OPENGL_ES2 $QMAKE_CFLAGS_OPENGL_ES2
6220         if [ $? != "0" ]; then
6221             echo "The OpenGL ES 2.0 functionality test failed!"
6222             echo " You might need to modify the include and library search paths by editing"
6223             echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
6224             echo " ${XQMAKESPEC}."
6225             exit 1
6226         fi
6227     elif [ "$CFG_OPENGL" = "desktop" ]; then
6228         # Desktop OpenGL support
6229         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengldesktop "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
6230         if [ $? != "0" ]; then
6231             echo "The OpenGL functionality test failed!"
6232             echo " You might need to modify the include and library search paths by editing"
6233             echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
6234             echo " ${XQMAKESPEC}."
6235             exit 1
6236         fi
6237     fi
6238
6239     # auto-detect FontConfig support
6240     if [ "$CFG_FONTCONFIG" != "no" ]; then
6241         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
6242             QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
6243             QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null`
6244         else
6245             QT_CFLAGS_FONTCONFIG=
6246             QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig"
6247         fi
6248         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/fontconfig "FontConfig" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS $QT_CFLAGS_FONTCONFIG $QT_LIBS_FONTCONFIG; then
6249                 QT_CONFIG="$QT_CONFIG fontconfig"
6250                 QMakeVar set QMAKE_CFLAGS_FONTCONFIG "$QT_CFLAGS_FONTCONFIG"
6251                 QMakeVar set QMAKE_LIBS_FONTCONFIG "$QT_LIBS_FONTCONFIG"
6252                 CFG_LIBFREETYPE=system
6253         fi
6254
6255     fi
6256
6257     # Save these for a check later
6258     ORIG_CFG_WAYLAND="$CFG_WAYLAND"
6259     ORIG_CFG_XCB="$CFG_XCB"
6260
6261     if [ "$CFG_WAYLAND" != "no" ]; then
6262         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists wayland-client 2>/dev/null; then
6263             QMAKE_CFLAGS_WAYLAND=`$PKG_CONFIG --cflags wayland-client 2>/dev/null`
6264             QMAKE_LIBS_WAYLAND=`$PKG_CONFIG --libs wayland-client 2>/dev/null`
6265             QMAKE_INCDIR_WAYLAND=`$PKG_CONFIG --variable=includedir wayland-client 2>/dev/null`
6266             QMAKE_LIBDIR_WAYLAND=`$PKG_CONFIG --variable=libdir wayland-client 2>/dev/null`
6267         fi
6268         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/wayland "Wayland" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_WAYLAND $QMAKE_LIBS_WAYLAND; then
6269             CFG_WAYLAND=yes
6270             QT_CONFIG="$QT_CONFIG wayland"
6271         elif [ "$CFG_WAYLAND" = "yes" ]; then
6272             echo "The Wayland functionality test failed!"
6273             exit 1
6274         else
6275             CFG_WAYLAND=no
6276             QMakeVar add DEFINES QT_NO_WAYLAND
6277         fi
6278     fi
6279
6280     # Check we actually have X11 :-)
6281     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
6282         QT_CONFIG="$QT_CONFIG xlib"
6283     fi
6284
6285     if [ "$CFG_XCB" != "no" ]; then
6286         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb "xcb" $L_FLAGS $I_FLAGS $l_FLAGS; then
6287             CFG_XCB=yes
6288             if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb-render "xcb-render" $L_FLAGS $I_FLAGS $l_FLAGS; then
6289                 QT_CONFIG="$QT_CONFIG xcb-render"
6290             fi
6291
6292             if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb-poll-for-queued-event "xcb-poll-for-queued-event" $L_FLAGS $I_FLAGS $l_FLAGS; then
6293                 CFG_XCB_LIMITED=no
6294                 QT_CONFIG="$QT_CONFIG xcb-poll-for-queued-event"
6295             fi
6296
6297             if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb-xlib "xcb-xlib" $L_FLAGS $I_FLAGS $l_FLAGS; then
6298                 QT_CONFIG="$QT_CONFIG xcb-xlib"
6299             fi
6300         else
6301             if [ "$CFG_XCB" = "yes" ]; then
6302                 echo "The XCB test failed!"
6303                 echo " You might need to install dependency packages."
6304                 echo " See src/plugins/platforms/xcb/README."
6305                 exit 1
6306             fi
6307             CFG_XCB=no
6308             QMakeVar add DEFINES QT_NO_XCB
6309         fi
6310     fi
6311
6312     # Detect libxkbcommon
6313     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xkbcommon 2>/dev/null; then
6314         QMAKE_CFLAGS_XKBCOMMON="`$PKG_CONFIG --cflags xkbcommon 2>/dev/null`"
6315         QMAKE_LIBS_XKBCOMMON="`$PKG_CONFIG --libs xkbcommon 2>/dev/null`"
6316         if [ "$CFG_WAYLAND" = "yes" ]; then
6317             QMAKE_CFLAGS_WAYLAND="$QMAKE_CFLAGS_WAYLAND $QMAKE_CFLAGS_XKBCOMMON"
6318             QMAKE_LIBS_WAYLAND="$QMAKE_LIBS_WAYLAND $QMAKE_LIBS_XKBCOMMON"
6319         fi
6320         QMAKE_CFLAGS_XCB="$QMAKE_CFLAGS_XCB $QMAKE_CFLAGS_XKBCOMMON"
6321         QMAKE_LIBS_XCB="$QMAKE_LIBS_XCB $QMAKE_LIBS_XKBCOMMON"
6322     else
6323         if [ "$CFG_WAYLAND" = "yes" ]; then
6324             QMAKE_DEFINES_WAYLAND=QT_NO_WAYLAND_XKB
6325         fi
6326         QMAKE_DEFINES_XCB=QT_NO_XCB_XKB
6327     fi
6328
6329     # QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero.
6330     if [ -n "$QMAKE_CFLAGS_WAYLAND" ] || [ -n "$QMAKE_LIBS_WAYLAND" ]; then
6331         QMakeVar set QMAKE_CFLAGS_WAYLAND "$QMAKE_CFLAGS_WAYLAND"
6332         QMakeVar set QMAKE_INCDIR_WAYLAND "$QMAKE_INCDIR_WAYLAND"
6333         QMakeVar set QMAKE_LIBS_WAYLAND "$QMAKE_LIBS_WAYLAND"
6334         QMakeVar set QMAKE_LIBDIR_WAYLAND "$QMAKE_LIBDIR_WAYLAND"
6335         QMakeVar set QMAKE_DEFINES_WAYLAND " $QMAKE_DEFINES_WAYLAND"
6336     fi
6337
6338     if [ -n "$QMAKE_CFLAGS_XCB" ] || [ -n "$QMAKE_LIBS_XCB" ]; then
6339         QMakeVar set QMAKE_CFLAGS_XCB "$QMAKE_CFLAGS_XCB"
6340         QMakeVar set QMAKE_LIBS_XCB "$QMAKE_LIBS_XCB"
6341         QMakeVar set QMAKE_DEFINES_XCB "$QMAKE_DEFINES_XCB"
6342     fi
6343
6344     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/mac/coreservices "CoreServices" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
6345         QT_CONFIG="$QT_CONFIG coreservices"
6346     else
6347         QMakeVar add DEFINES QT_NO_CORESERVICES
6348     fi
6349
6350     if [ "$PLATFORM_QPA" = "yes" ] && [ "$BUILD_ON_MAC" = "no" ]; then
6351         if [ "$CFG_XCB" = "no" ] && [ "$CFG_WAYLAND" = "no" ]; then
6352             if [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_WAYLAND" = "auto" ]; then
6353                 echo "No QPA platform plugin enabled!"
6354                 echo " If you really want to build without a QPA platform plugin you must pass"
6355                 echo " -no-xcb and -no-wayland to configure. Doing this will produce a Qt that"
6356                 echo " cannot run GUI applications."
6357                 exit 1
6358             fi
6359         fi
6360     fi
6361
6362 fi
6363
6364
6365 # QWS
6366 if [ "$PLATFORM_QWS" = "yes" ]; then
6367
6368     # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
6369     if [ "$CFG_GUI" = "no" ]; then
6370         if [ "$CFG_OPENGL" = "auto" ]; then
6371             CFG_OPENGL=no
6372         fi
6373         if [ "$CFG_OPENGL" != "no" ]; then
6374             echo "OpenGL enabled, but GUI disabled."
6375             echo " You might need to either enable the GUI or disable OpenGL"
6376             exit 1
6377         fi
6378     fi
6379     if [ "$CFG_OPENGL" = "yes" ]; then
6380         CFG_EGL=auto
6381         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then
6382             CFG_OPENGL=es2
6383         fi
6384     elif [ "$CFG_OPENGL" = "es2" ]; then
6385         #OpenGL ES 2.x
6386         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS
6387         if [ $? != "0" ]; then
6388             echo "The OpenGL ES 2.0 functionality test failed!"
6389             echo " You might need to modify the include and library search paths by editing"
6390             echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
6391             echo " ${XQMAKESPEC}."
6392             exit 1
6393         fi
6394         CFG_EGL=yes
6395     elif [ "$CFG_OPENGL" = "desktop" ]; then
6396         # Desktop OpenGL support
6397         echo "Desktop OpenGL support is not avaliable on Qt for Embedded Linux"
6398         exit 1
6399     fi
6400 fi
6401
6402 if [ "$PLATFORM_QWS" = "yes" ]; then
6403
6404     # screen drivers
6405     for screen in ${CFG_GFX_ON} ${CFG_GFX_PLUGIN}; do
6406        if [ "${screen}" = "ahi" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
6407            "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/ahi "Ahi" $L_FLAGS $I_FLAGS $l_FLAGS
6408            if [ $? != "0" ]; then
6409                echo "The Ahi screen driver functionality test failed!"
6410                echo " You might need to modify the include and library search paths by editing"
6411                echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
6412                echo " ${XQMAKESPEC}."
6413                exit 1
6414            fi
6415        fi
6416
6417        if [ "${screen}" = "svgalib" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
6418            "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/svgalib "SVGAlib" $L_FLAGS $I_FLAGS $l_FLAGS
6419            if [ $? != "0" ]; then
6420                echo "The SVGAlib screen driver functionality test failed!"
6421                echo " You might need to modify the include and library search paths by editing"
6422                echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
6423                echo " ${XQMAKESPEC}."
6424                exit 1
6425            fi
6426        fi
6427
6428        if [ "${screen}" = "directfb" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
6429            if test -n "$PKG_CONFIG" && "$PKG_CONFIG" --exists directfb 2>/dev/null; then
6430                QT_CFLAGS_DIRECTFB=`$PKG_CONFIG --cflags directfb 2>/dev/null`
6431                QT_LIBS_DIRECTFB=`$PKG_CONFIG --libs directfb 2>/dev/null`
6432            elif directfb-config --version >/dev/null 2>&1; then
6433                QT_CFLAGS_DIRECTFB=`directfb-config --cflags 2>/dev/null`
6434                QT_LIBS_DIRECTFB=`directfb-config --libs 2>/dev/null`
6435            fi
6436
6437            # QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero.
6438            if [ -n "$QT_CFLAGS_DIRECTFB" ] || [ -n "$QT_LIBS_DIRECTFB" ]; then
6439                QMakeVar set QT_CFLAGS_DIRECTFB "$QT_CFLAGS_DIRECTFB"
6440                QMakeVar set QT_LIBS_DIRECTFB "$QT_LIBS_DIRECTFB"
6441            fi
6442
6443            "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/directfb "DirectFB" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_DIRECTFB $QT_LIBS_DIRECTFB
6444            if [ $? != "0" ]; then
6445                echo "The DirectFB screen driver functionality test failed!"
6446                echo " You might need to modify the include and library search paths by editing"
6447                echo " QT_CFLAGS_DIRECTFB and QT_LIBS_DIRECTFB in"
6448                echo " ${XQMAKESPEC}."
6449                exit 1
6450            fi
6451        fi
6452
6453     done
6454
6455     # mouse drivers
6456     for mouse in ${CFG_MOUSE_ON} ${CFG_MOUSE_PLUGIN}; do
6457         if [ "${mouse}" = "tslib" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
6458             "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tslib "tslib" $L_FLAGS $I_FLAGS $l_FLAGS
6459             if [ $? != "0" ]; then
6460                echo "The tslib functionality test failed!"
6461                echo " You might need to modify the include and library search paths by editing"
6462                echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
6463                echo " ${XQMAKESPEC}."
6464                 exit 1
6465             fi
6466         fi
6467     done
6468
6469     CFG_QGTKSTYLE=no
6470
6471     # sound
6472     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/sound "sound" $L_FLAGS $I_FLAGS $l_FLAGS
6473     if [ $? != "0" ]; then
6474         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SOUND"
6475     fi
6476
6477 fi # QWS
6478
6479 EGL_VARIANT=none
6480 # EGL Support
6481 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then
6482     if [ "$CFG_EGL" != "no" ]; then
6483         # detect EGL support
6484         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/egl" "EGL (EGL/egl.h)" $L_FLAGS $I_FLAGS $l_FLAGS; then
6485             # EGL specified by QMAKE_*_EGL, included with <EGL/egl.h>
6486             EGL_VARIANT=regular
6487             CFG_EGL=yes
6488         fi
6489
6490         if [ "$EGL_VARIANT" = "none" ]; then
6491             if [ "$CFG_EGL" = "yes" ]; then
6492                 echo "The EGL functionality test failed!"
6493                 echo " EGL is required for OpenGL ES to manage contexts & surfaces."
6494                 echo " You might need to modify the include and library search paths by editing"
6495                 echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in"
6496                 echo " ${XQMAKESPEC}."
6497                 exit 1
6498             fi
6499             CFG_EGL=no
6500             # If QtOpenGL would be built against OpenGL ES, disable it as we can't to that if EGL is missing
6501             if [ "$CFG_OPENGL" = "es2" ]; then
6502                 CFG_OPENGL=no
6503             fi
6504         fi
6505     fi
6506 fi
6507
6508 [ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_PHONON" != "no" ] && CFG_PHONON="yes"
6509
6510 # freetype support
6511 [ "x$CFG_EMBEDDED" != "xno" ] && CFG_LIBFREETYPE="$CFG_QWS_FREETYPE"
6512 [ "x$PLATFORM_MAC" = "xyes" ] && CFG_LIBFREETYPE=no
6513 [ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_LIBFREETYPE" = "auto" ] && CFG_LIBFREETYPE=no
6514 if [ "$CFG_LIBFREETYPE" = "auto" ]; then
6515     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/freetype "FreeType" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
6516         CFG_LIBFREETYPE=system
6517     else
6518         CFG_LIBFREETYPE=yes
6519     fi
6520 fi
6521
6522 if [ "$CFG_ENDIAN" = "auto" ]; then
6523     if [ "$XPLATFORM_MINGW" = "yes" ]; then
6524         CFG_ENDIAN="Q_LITTLE_ENDIAN"
6525     elif [ "$XPLATFORM_SYMBIAN_SBSV2" = "yes" ]; then
6526         CFG_ENDIAN="Q_LITTLE_ENDIAN"
6527     elif [ "$PLATFORM_MAC" = "yes" ] && [ "$XPLATFORM_SYMBIAN" = "no" ]; then
6528         true #leave as auto
6529     else
6530         "$unixtests/endian.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
6531         F="$?"
6532         if [ "$F" -eq 0 ]; then
6533             CFG_ENDIAN="Q_LITTLE_ENDIAN"
6534         elif [ "$F" -eq 1 ]; then
6535             CFG_ENDIAN="Q_BIG_ENDIAN"
6536         else
6537             echo
6538             echo "The target system byte order could not be detected!"
6539             echo "Turn on verbose messaging (-v) to see the final report."
6540             echo "You can use the -little-endian or -big-endian switch to"
6541             echo "$0 to continue."
6542             exit 101
6543         fi
6544     fi
6545 fi
6546
6547 if [ "$CFG_HOST_ENDIAN" = "auto" ]; then
6548     if [ "$PLATFORM_MAC" = "yes" ]; then
6549         true #leave as auto
6550     else
6551         "$unixtests/endian.test" "$QMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
6552         F="$?"
6553         if [ "$F" -eq 0 ]; then
6554             CFG_HOST_ENDIAN="Q_LITTLE_ENDIAN"
6555         elif [ "$F" -eq 1 ]; then
6556             CFG_HOST_ENDIAN="Q_BIG_ENDIAN"
6557         else
6558             echo
6559             echo "The host system byte order could not be detected!"
6560             echo "Turn on verbose messaging (-v) to see the final report."
6561             echo "You can use the -host-little-endian or -host-big-endian switch to"
6562             echo "$0 to continue."
6563             exit 101
6564         fi
6565     fi
6566 fi
6567
6568 if [ "$CFG_ARMFPA" != "auto" ]; then
6569     if [ "$CFG_ARMFPA" = "yes" ]; then
6570         if [ "$CFG_ENDIAN" = "Q_LITTLE_ENDIAN" ]; then
6571             CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE_SWAPPED"
6572         else
6573             CFG_DOUBLEFORMAT="Q_DOUBLE_BIG_SWAPPED"
6574         fi
6575     else
6576         CFG_DOUBLEFORMAT="normal"
6577     fi
6578 fi
6579
6580
6581 if [ "$CFG_DOUBLEFORMAT" = "auto" ]; then
6582     if [ "$PLATFORM_QWS" != "yes" -o "$PLATFORM_QPA" = "yes" ]; then
6583         CFG_DOUBLEFORMAT=normal
6584     else
6585         "$unixtests/doubleformat.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
6586         F="$?"
6587         if [ "$F" -eq 10 ] && [ "$CFG_ENDIAN" = "Q_LITTLE_ENDIAN" ]; then
6588             CFG_DOUBLEFORMAT=normal
6589         elif [ "$F" -eq 11 ] && [ "$CFG_ENDIAN" = "Q_BIG_ENDIAN" ]; then
6590             CFG_DOUBLEFORMAT=normal
6591         elif [ "$F" -eq 10 ]; then
6592             CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE"
6593         elif [ "$F" -eq 11 ]; then
6594             CFG_DOUBLEFORMAT="Q_DOUBLE_BIG"
6595         elif [ "$F" -eq 12 ]; then
6596             CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE_SWAPPED"
6597             CFG_ARMFPA="yes"
6598         elif [ "$F" -eq 13 ]; then
6599             CFG_DOUBLEFORMAT="Q_DOUBLE_BIG_SWAPPED"
6600             CFG_ARMFPA="yes"
6601         else
6602             echo
6603             echo "The system floating point format could not be detected."
6604             echo "This may cause data to be generated in a wrong format"
6605             echo "Turn on verbose messaging (-v) to see the final report."
6606             # we do not fail on this since this is a new test, and if it fails,
6607             # the old behavior should be correct in most cases
6608             CFG_DOUBLEFORMAT=normal
6609         fi
6610     fi
6611 fi
6612
6613 HAVE_STL=no
6614 if [ "$XPLATFORM_SYMBIAN" = "yes" ] || "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stl "STL" $L_FLAGS $I_FLAGS $l_FLAGS; then
6615     HAVE_STL=yes
6616 fi
6617
6618 if [ "$CFG_STL" != "no" ]; then
6619     if [ "$HAVE_STL" = "yes" ]; then
6620         CFG_STL=yes
6621     else
6622         if [ "$CFG_STL" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6623             echo "STL support cannot be enabled due to functionality tests!"
6624             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6625             echo " If you believe this message is in error you may use the continue"
6626             echo " switch (-continue) to $0 to continue."
6627             exit 101
6628         else
6629             CFG_STL=no
6630         fi
6631     fi
6632 fi
6633
6634 # detect POSIX clock_gettime()
6635 if [ "$CFG_CLOCK_GETTIME" = "auto" ]; then
6636     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/clock-gettime "POSIX clock_gettime()" $L_FLAGS $I_FLAGS $l_FLAGS; then
6637         CFG_CLOCK_GETTIME=yes
6638     else
6639         CFG_CLOCK_GETTIME=no
6640     fi
6641 fi
6642
6643 # detect POSIX monotonic clocks
6644 if [ "$CFG_CLOCK_GETTIME" = "yes" ] && [ "$CFG_CLOCK_MONOTONIC" = "auto" ]; then
6645     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/clock-monotonic "POSIX Monotonic Clock" $L_FLAGS $I_FLAGS $l_FLAGS; then
6646         CFG_CLOCK_MONOTONIC=yes
6647     else
6648         CFG_CLOCK_MONOTONIC=no
6649     fi
6650 elif [ "$CFG_CLOCK_GETTIME" = "no" ]; then
6651     CFG_CLOCK_MONOTONIC=no
6652 fi
6653
6654 # detect mremap
6655 if [ "$CFG_MREMAP" = "auto" ]; then
6656     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mremap "mremap" $L_FLAGS $I_FLAGS $l_FLAGS; then
6657         CFG_MREMAP=yes
6658     else
6659         CFG_MREMAP=no
6660     fi
6661 fi
6662
6663 # find if the platform provides getaddrinfo (ipv6 dns lookups)
6664 if [ "$CFG_GETADDRINFO" != "no" ]; then
6665     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getaddrinfo "getaddrinfo" $L_FLAGS $I_FLAGS $l_FLAGS; then
6666         CFG_GETADDRINFO=yes
6667     else
6668         if [ "$CFG_GETADDRINFO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6669             echo "getaddrinfo support cannot be enabled due to functionality tests!"
6670             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6671             echo " If you believe this message is in error you may use the continue"
6672             echo " switch (-continue) to $0 to continue."
6673             exit 101
6674         else
6675             CFG_GETADDRINFO=no
6676         fi
6677     fi
6678 fi
6679
6680 # find if the platform provides inotify
6681 if [ "$CFG_INOTIFY" != "no" ]; then
6682     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/inotify "inotify" $L_FLAGS $I_FLAGS $l_FLAGS; then
6683         CFG_INOTIFY=yes
6684     else
6685         if [ "$CFG_INOTIFY" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6686             echo "inotify support cannot be enabled due to functionality tests!"
6687             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6688             echo " If you believe this message is in error you may use the continue"
6689             echo " switch (-continue) to $0 to continue."
6690             exit 101
6691         else
6692             CFG_INOTIFY=no
6693         fi
6694     fi
6695 fi
6696
6697 # find if the platform provides if_nametoindex (ipv6 interface name support)
6698 if [ "$CFG_IPV6IFNAME" != "no" ]; then
6699     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ipv6ifname "IPv6 interface name" $L_FLAGS $I_FLAGS $l_FLAGS; then
6700         CFG_IPV6IFNAME=yes
6701     else
6702         if [ "$CFG_IPV6IFNAME" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6703             echo "IPv6 interface name support cannot be enabled due to functionality tests!"
6704             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6705             echo " If you believe this message is in error you may use the continue"
6706             echo " switch (-continue) to $0 to continue."
6707             exit 101
6708         else
6709             CFG_IPV6IFNAME=no
6710         fi
6711     fi
6712 fi
6713
6714 # find if the platform provides getifaddrs (network interface enumeration)
6715 if [ "$CFG_GETIFADDRS" != "no" ]; then
6716     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getifaddrs "getifaddrs" $L_FLAGS $I_FLAGS $l_FLAGS; then
6717         CFG_GETIFADDRS=yes
6718     else
6719         if [ "$CFG_GETIFADDRS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6720             echo "getifaddrs support cannot be enabled due to functionality tests!"
6721             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6722             echo " If you believe this message is in error you may use the continue"
6723             echo " switch (-continue) to $0 to continue."
6724             exit 101
6725         else
6726             CFG_GETIFADDRS=no
6727         fi
6728     fi
6729 fi
6730
6731 # detect OpenSSL
6732 if [ "$CFG_OPENSSL" != "no" ] && [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then
6733     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/openssl "OpenSSL" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
6734         if [ "$CFG_OPENSSL" = "auto" ]; then
6735             CFG_OPENSSL=yes
6736         fi
6737     else
6738         if ( [ "$CFG_OPENSSL" = "yes" ] || [ "$CFG_OPENSSL" = "linked" ] ) && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6739             echo "OpenSSL support cannot be enabled due to functionality tests!"
6740             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6741             echo " If you believe this message is in error you may use the continue"
6742             echo " switch (-continue) to $0 to continue."
6743             exit 101
6744         else
6745             CFG_OPENSSL=no
6746         fi
6747     fi
6748 else
6749     if [ "$CFG_OPENSSL" = "auto" ] && [ "$XPLATFORM_SYMBIAN_SBSV2" = "yes" ]; then
6750         #OpenSSl should be enabled for Symbian release
6751         CFG_OPENSSL=yes
6752     fi
6753 fi
6754
6755 # detect OpenVG support
6756 if [ "$CFG_OPENVG" != "no" ] && [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then
6757     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/openvg" "OpenVG" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then
6758         if [ "$CFG_OPENVG" = "auto" ]; then
6759             CFG_OPENVG=yes
6760         fi
6761     elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG openvg_on_opengl" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/openvg" "OpenVG" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then
6762         if [ "$CFG_OPENVG" = "auto" ]; then
6763             CFG_OPENVG=yes
6764         fi
6765         CFG_OPENVG_ON_OPENGL=yes
6766     elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG lower_case_includes" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/openvg" "OpenVG (lc includes)" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then
6767         if [ "$CFG_OPENVG" = "auto" ]; then
6768             CFG_OPENVG=yes
6769         fi
6770         CFG_OPENVG_LC_INCLUDES=yes
6771     elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG openvg_on_opengl lower_case_includes" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/openvg" "OpenVG (lc includes)" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then
6772         if [ "$CFG_OPENVG" = "auto" ]; then
6773             CFG_OPENVG=yes
6774         fi
6775         CFG_OPENVG_LC_INCLUDES=yes
6776         CFG_OPENVG_ON_OPENGL=yes
6777     else
6778         if [ "$CFG_OPENVG" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6779             echo "$CFG_OPENVG was specified for OpenVG but cannot be enabled due to functionality tests!"
6780             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6781             echo " If you believe this message is in error you may use the continue"
6782             echo " switch (-continue) to $0 to continue."
6783             exit 101
6784         else
6785             CFG_OPENVG=no
6786         fi
6787     fi
6788     if [ "$CFG_OPENVG" = "yes" ] && "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/shivavg" "ShivaVG" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then
6789         CFG_OPENVG_SHIVA=yes
6790     fi
6791 fi
6792
6793 # if openvg is disabled and the user specified graphicssystem vg, disable it...
6794 if [ "$CFG_GRAPHICS_SYSTEM" = "openvg" ] && [ "$CFG_OPENVG" = "no" ]; then
6795     echo "OpenVG Graphics System is disabled due to missing OpenVG support..."
6796     CFG_GRAPHICS_SYSTEM=default
6797 fi
6798
6799 if [ -n "$CFG_RUNTIME_SYSTEM" -a "$CFG_GRAPHICS_SYSTEM" != "runtime" ] || [ "$CFG_RUNTIME_SYSTEM" = "runtime" ]; then
6800     echo "Argument to -runtimegraphicssystem is invalid so ignoring..."
6801     CFG_RUNTIME_SYSTEM=
6802 fi
6803
6804 if [ "$CFG_PTMALLOC" != "no" ]; then
6805     # build ptmalloc, copy .a file to lib/
6806     echo "Building ptmalloc. Please wait..."
6807     (cd "$relpath/src/3rdparty/ptmalloc/"; "$MAKE" "clean" ; "$MAKE" "posix"
6808      mkdir "$outpath/lib/" ; cp "libptmalloc3.a" "$outpath/lib/")
6809
6810     QMakeVar add QMAKE_LFLAGS "$outpath/lib/libptmalloc3.a"
6811 fi
6812
6813 if [ "$CFG_ALSA" = "auto" ] && [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then
6814     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/alsa "alsa" $L_FLAGS $I_FLAGS $l_FLAGS; then
6815         CFG_ALSA=yes
6816     else
6817         CFG_ALSA=no
6818     fi
6819 elif [ "$XPLATFORM_SYMBIAN_SBSV2" = "yes" ]; then
6820     # Disabled for Symbian release
6821     CFG_ALSA=no
6822 fi
6823
6824 if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ] || [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then 
6825     if [ "$CFG_ARCH" = "arm" ]; then
6826        "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/javascriptcore-jit "javascriptcore-jit" $L_FLAGS $I_FLAGS $l_FLAGS
6827         if [ $? != "0" ]; then
6828            CFG_JAVASCRIPTCORE_JIT=no
6829         fi
6830     else
6831         case "$XPLATFORM" in
6832             symbian-gcce)
6833                 CFG_JAVASCRIPTCORE_JIT=no
6834                 ;;
6835             linux-icc*)
6836                 CFG_JAVASCRIPTCORE_JIT=no
6837                 ;;
6838         esac
6839     fi
6840 fi
6841
6842 if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ]; then
6843     QMakeVar set JAVASCRIPTCORE_JIT yes
6844 elif [ "$CFG_JAVASCRIPTCORE_JIT" = "no" ]; then
6845     QMakeVar set JAVASCRIPTCORE_JIT no
6846 fi
6847
6848 if [ "$CFG_AUDIO_BACKEND" = "auto" ]; then
6849     if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
6850          if "$symbiantests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/symbian/audio "audio" $L_FLAGS $I_FLAGS $l_FLAGS ; then
6851             CFG_AUDIO_BACKEND=yes
6852          fi
6853     else
6854         CFG_AUDIO_BACKEND=yes
6855     fi
6856 fi
6857
6858 if [ "$CFG_LARGEFILE" != "yes" ] && [ "$XPLATFORM_MINGW" = "yes" ]; then
6859     echo "Warning: largefile support cannot be disabled for win32."
6860     CFG_LARGEFILE="yes"
6861 elif [ "$CFG_LARGEFILE" != "no" ] && [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
6862     echo "Warning: largefile support cannot be enabled for symbian."
6863     CFG_LARGEFILE="no"
6864 fi
6865
6866 #-------------------------------------------------------------------------------
6867 # ask for all that hasn't been auto-detected or specified in the arguments
6868 #-------------------------------------------------------------------------------
6869
6870 ### fix this: user input should be validated in a loop
6871 if [ "$PLATFORM_QWS" = "yes" ]; then
6872     PROMPT_FOR_DEPTHS="yes"
6873 else
6874     PROMPT_FOR_DEPTHS="no"
6875 fi
6876 if [ "$CFG_QWS_DEPTHS" = "prompted" -a "$PROMPT_FOR_DEPTHS" = "yes" ]; then
6877     echo
6878     echo "Choose pixel-depths to support:"
6879     echo
6880     echo "   1. 1bpp, black/white"
6881     echo "   4. 4bpp, grayscale"
6882     echo "   8. 8bpp, paletted"
6883     echo "  12. 12bpp, rgb 4-4-4"
6884     echo "  15. 15bpp, rgb 5-5-5"
6885     echo "  16. 16bpp, rgb 5-6-5"
6886     echo "  18. 18bpp, rgb 6-6-6"
6887     echo "  24. 24bpp, rgb 8-8-8"
6888     echo "  32. 32bpp, argb 8-8-8-8 and rgb 8-8-8"
6889     echo " all. All supported depths"
6890     echo
6891     echo "Your choices (default 8,16,32):"
6892     read CFG_QWS_DEPTHS
6893     if [ -z "$CFG_QWS_DEPTHS" ] || [ "$CFG_QWS_DEPTHS" = "yes" ]; then
6894         CFG_QWS_DEPTHS=8,16,32
6895     fi
6896 fi
6897 if [ -n "$CFG_QWS_DEPTHS" -a "$PLATFORM_QWS" = "yes" ]; then
6898     if [ "$CFG_QWS_DEPTHS" = "all" ]; then
6899         CFG_QWS_DEPTHS="1 4 8 12 15 16 18 24 32 generic"
6900     fi
6901     for D in `echo "$CFG_QWS_DEPTHS" | sed -e 's/,/ /g'`; do
6902         case $D in
6903             1|4|8|12|15|16|18|24|32) QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QWS_DEPTH_$D";;
6904             generic) QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QWS_DEPTH_GENERIC";;
6905         esac
6906     done
6907 fi
6908
6909 # enable dwarf2 support on Mac
6910 if [ "$CFG_MAC_DWARF2" = "yes" ]; then
6911     QT_CONFIG="$QT_CONFIG dwarf2"
6912 fi
6913
6914 # Set the default arch if there are no "-arch" arguments on the configure line
6915 # For "-carbon" builds: 32 bit x86/ppc.
6916 # For builds on snow leopard : compiler default (64-bit).
6917 # For builds on leopard : compiler default (32-bit).
6918 if [ "$CFG_ARCH" = "macosx" ]  && [ "$CFG_MAC_ARCHS" = "" ]; then
6919     source "$mactests/defaultarch.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests"
6920
6921         if [ "$CFG_MAC_CARBON" = "yes" ]; then
6922                 if [ "$QT_MAC_DEFAULT_ARCH" = "x86_64" ]; then
6923                         CFG_MAC_ARCHS=" x86"
6924                 elif [ "$QT_MAC_DEFAULT_ARCH" = "ppc64" ]; then
6925                         CFG_MAC_ARCHS=" ppc"
6926                 else
6927                         CFG_MAC_ARCHS=" $QT_MAC_DEFAULT_ARCH"
6928                 fi
6929         else
6930                 CFG_MAC_ARCHS=" $QT_MAC_DEFAULT_ARCH"
6931     fi
6932
6933     [ "$OPT_VERBOSE" = "yes" ] && echo "Setting Mac architechture to$CFG_MAC_ARCHS."
6934 fi
6935
6936 # enable Cocoa and/or Carbon on Mac
6937 #  -carbon on the command line disables Cocoa, except for 64-bit archs
6938 if [ "$CFG_MAC_CARBON" = "yes" ]; then
6939     CFG_MAC_CARBON="YES"
6940     CFG_MAC_COCOA="NO"
6941
6942 #    check which archs are in use, enable cocoa if we find a 64-bit one
6943     if echo "$CFG_MAC_ARCHS" | grep 64 > /dev/null 2>&1; then
6944         CFG_MAC_COCOA="yes";
6945         CFG_MAC_CARBON="no";
6946         if echo "$CFG_MAC_ARCHS" | grep -w ppc > /dev/null 2>&1; then
6947             CFG_MAC_CARBON="yes";
6948         fi
6949         if echo "$CFG_MAC_ARCHS" | grep -w x86 > /dev/null 2>&1; then
6950             CFG_MAC_CARBON="yes";
6951         fi
6952     fi
6953 fi
6954
6955 # select Carbon on 10.4 Tiger.
6956 if [ "$PLATFORM_MAC" = "yes" ]; then
6957     VERSION=`uname -r | tr '.' ' ' | awk '{print $1}'`
6958     if [ "$VERSION" == 8 ]; then
6959         CFG_MAC_COCOA="no";
6960         CFG_MAC_CARBON="yes";
6961     fi
6962 fi
6963
6964 # select Carbon when using the 10.4u SDK
6965 if [ "$PLATFORM_MAC" = "yes" ]; then
6966     if [ "TEST$CFG_SDK" = "TEST/Developer/SDKs/MacOSX10.4u.sdk/" ]; then
6967         echo "Carbon on";
6968         CFG_MAC_COCOA="no";
6969         CFG_MAC_CARBON="yes";
6970     fi
6971 fi
6972
6973 # but disable Cocoa if cross-building for mingw and symbian
6974 [ "$XPLATFORM_MINGW" = "yes" ] && CFG_MAC_COCOA="no"
6975 [ "$XPLATFORM_SYMBIAN" = "yes" ] && CFG_MAC_COCOA="no"
6976
6977 # disable Qt 3 support on VxWorks and Symbian
6978 case "$XPLATFORM" in
6979     unsupported/vxworks*|symbian*)
6980         CFG_QT3SUPPORT="no"
6981     ;;
6982 esac
6983
6984 # enable Qt 3 support functionality
6985 if [ "$CFG_QT3SUPPORT" = "yes" ]; then
6986     QT_CONFIG="$QT_CONFIG gui-qt3support"
6987 fi
6988
6989 # enable Phonon
6990 if [ "$CFG_PHONON" = "yes" ]; then
6991     # No longer needed after modularization
6992     #QT_CONFIG="$QT_CONFIG phonon"
6993     if [ "$CFG_PHONON_BACKEND" = "yes" ]; then
6994         QT_CONFIG="$QT_CONFIG phonon-backend"
6995     fi
6996 else
6997     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_PHONON"
6998 fi
6999
7000 # disable accessibility
7001 if [ "$CFG_ACCESSIBILITY" = "no" ]; then
7002     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ACCESSIBILITY"
7003 else
7004     QT_CONFIG="$QT_CONFIG accessibility"
7005 fi
7006
7007 # egl stuff does not belong in lighthouse, but rather in plugins
7008 if [ "$PLATFORM_QPA" = "yes" ]; then
7009     CFG_EGL="no"
7010 fi
7011
7012 # enable egl
7013 if [ "$CFG_EGL" = "no" ]; then
7014     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGL"
7015 else
7016     QT_CONFIG="$QT_CONFIG egl"
7017     if [ "$CFG_EGL_GLES_INCLUDES" = "yes" ]; then
7018         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GLES_EGL"
7019     fi
7020 fi
7021
7022 # enable openvg
7023 if [ "$CFG_OPENVG" = "no" ]; then
7024     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENVG"
7025 else
7026     QT_CONFIG="$QT_CONFIG openvg"
7027     if [ "$CFG_OPENVG_LC_INCLUDES" = "yes" ]; then
7028         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LOWER_CASE_VG_INCLUDES"
7029     fi
7030     if [ "$CFG_OPENVG_ON_OPENGL" = "yes" ]; then
7031         QT_CONFIG="$QT_CONFIG openvg_on_opengl"
7032     fi
7033     if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
7034         QT_CONFIG="$QT_CONFIG shivavg"
7035         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SHIVAVG"
7036     fi
7037 fi
7038
7039 if [ "$CFG_QS60STYLE" = "no" ]; then
7040     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STYLE_S60"
7041 else
7042     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_STYLE_S60"
7043 fi
7044
7045 # Just check if OpenGL is not set by command argumets for Symbian.
7046 if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
7047         if [ "$CFG_OPENGL" = "auto" ]; then
7048             CFG_OPENGL="no"
7049         fi
7050 fi
7051
7052 # enable opengl
7053 if [ "$CFG_OPENGL" = "no" ]; then
7054     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENGL"
7055 else
7056     QT_CONFIG="$QT_CONFIG opengl"
7057 fi
7058
7059 if [ "$CFG_OPENGL" = "es2" ]; then
7060     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES"
7061 fi
7062
7063 if [ "$CFG_OPENGL" = "es2" ]; then
7064     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_2"
7065     QT_CONFIG="$QT_CONFIG opengles2"
7066 fi
7067
7068 # safe execution environment
7069 if [ "$CFG_SXE" != "no" ]; then
7070     QT_CONFIG="$QT_CONFIG sxe"
7071 fi
7072
7073 # build up the variables for output
7074 if [ "$CFG_DEBUG" = "yes" ]; then
7075     QMAKE_OUTDIR="${QMAKE_OUTDIR}debug"
7076     QMAKE_CONFIG="$QMAKE_CONFIG debug"
7077 elif [ "$CFG_DEBUG" = "no" ]; then
7078     QMAKE_OUTDIR="${QMAKE_OUTDIR}release"
7079     QMAKE_CONFIG="$QMAKE_CONFIG release"
7080 fi
7081 if [ "$CFG_SHARED" = "yes" ]; then
7082     QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared"
7083     QMAKE_CONFIG="$QMAKE_CONFIG shared dll"
7084 elif [ "$CFG_SHARED" = "no" ]; then
7085     QMAKE_OUTDIR="${QMAKE_OUTDIR}-static"
7086     QMAKE_CONFIG="$QMAKE_CONFIG static"
7087 fi
7088 if [ "$PLATFORM_QWS" = "yes" ]; then
7089     QMAKE_OUTDIR="${QMAKE_OUTDIR}-emb-$CFG_EMBEDDED"
7090     QMAKE_CONFIG="$QMAKE_CONFIG embedded"
7091     QT_CONFIG="$QT_CONFIG embedded"
7092     rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
7093 fi
7094 if [ "$PLATFORM_QPA" = "yes" ]; then
7095     QMAKE_CONFIG="$QMAKE_CONFIG qpa"
7096     QT_CONFIG="$QT_CONFIG qpa"
7097     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qpa"
7098     rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
7099 fi
7100
7101 if [ "$CFG_EMBEDDED" = "nacl" ]; then
7102     QMAKE_CONFIG="$QMAKE_CONFIG nacl pepper"
7103     QT_CONFIG="$QT_CONFIG nacl pepper"
7104     rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
7105 fi
7106
7107 if [ "$XPLATFORM_MINGW" != "yes" ]; then
7108     # Do not set this here for Windows. Let qmake do it so
7109     # debug and release precompiled headers are kept separate.
7110     QMakeVar set PRECOMPILED_DIR ".pch/$QMAKE_OUTDIR"
7111 fi
7112 QMakeVar set OBJECTS_DIR ".obj/$QMAKE_OUTDIR"
7113 QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR"
7114 QMakeVar set RCC_DIR ".rcc/$QMAKE_OUTDIR"
7115 QMakeVar set UI_DIR ".uic/$QMAKE_OUTDIR"
7116 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
7117     QMAKE_CONFIG="$QMAKE_CONFIG largefile"
7118 fi
7119 if [ "$CFG_STL" = "no" ]; then
7120     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STL"
7121 else
7122     QMAKE_CONFIG="$QMAKE_CONFIG stl"
7123 fi
7124 if [ "$CFG_USE_GNUMAKE" = "yes" ]; then
7125     QMAKE_CONFIG="$QMAKE_CONFIG GNUmake"
7126 fi
7127 [ "$CFG_REDUCE_EXPORTS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_exports"
7128 [ "$CFG_REDUCE_RELOCATIONS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_relocations"
7129 [ "$CFG_PRECOMPILE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG precompile_header"
7130 if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
7131     QMakeVar add QMAKE_CFLAGS -g
7132     QMakeVar add QMAKE_CXXFLAGS -g
7133     QT_CONFIG="$QT_CONFIG separate_debug_info"
7134 fi
7135 if [ "$CFG_SEPARATE_DEBUG_INFO_NOCOPY" = "yes" ] ; then
7136     QT_CONFIG="$QT_CONFIG separate_debug_info_nocopy"
7137 fi
7138 [ "$CFG_MMX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mmx"
7139 [ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow"
7140 [ "$CFG_SSE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse"
7141 [ "$CFG_SSE2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse2"
7142 [ "$CFG_SSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse3"
7143 [ "$CFG_SSSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG ssse3"
7144 [ "$CFG_SSE4_1" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_1"
7145 [ "$CFG_SSE4_2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_2"
7146 [ "$CFG_AVX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG avx"
7147 [ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt"
7148 [ "$CFG_NEON" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG neon"
7149 [ "$CFG_ARCH" = "macosx" ] && QMAKE_CONFIG="$QMAKE_CONFIG $CFG_MAC_ARCHS"
7150 if [ "$CFG_CLOCK_GETTIME" = "yes" ]; then
7151     QT_CONFIG="$QT_CONFIG clock-gettime"
7152 fi
7153 if [ "$CFG_CLOCK_MONOTONIC" = "yes" ]; then
7154     QT_CONFIG="$QT_CONFIG clock-monotonic"
7155 fi
7156 if [ "$CFG_MREMAP" = "yes" ]; then
7157     QT_CONFIG="$QT_CONFIG mremap"
7158 fi
7159 if [ "$CFG_GETADDRINFO" = "yes" ]; then
7160     QT_CONFIG="$QT_CONFIG getaddrinfo"
7161 fi
7162 if [ "$CFG_IPV6IFNAME" = "yes" ]; then
7163     QT_CONFIG="$QT_CONFIG ipv6ifname"
7164 fi
7165 if [ "$CFG_GETIFADDRS" = "yes" ]; then
7166     QT_CONFIG="$QT_CONFIG getifaddrs"
7167 fi
7168 if [ "$CFG_INOTIFY" = "yes" ]; then
7169     QT_CONFIG="$QT_CONFIG inotify"
7170 fi
7171 if [ "$CFG_LIBJPEG" = "no" ]; then
7172     CFG_JPEG="no"
7173 elif [ "$CFG_LIBJPEG" = "system" ]; then
7174     QT_CONFIG="$QT_CONFIG system-jpeg"
7175 fi
7176 if [ "$CFG_JPEG" = "no" ]; then
7177     QT_CONFIG="$QT_CONFIG no-jpeg"
7178 elif [ "$CFG_JPEG" = "yes" ]; then
7179     QT_CONFIG="$QT_CONFIG jpeg"
7180 fi
7181 if [ "$CFG_LIBMNG" = "no" ]; then
7182     CFG_MNG="no"
7183 elif [ "$CFG_LIBMNG" = "system" ]; then
7184     QT_CONFIG="$QT_CONFIG system-mng"
7185 fi
7186 if [ "$CFG_MNG" = "no" ]; then
7187     QT_CONFIG="$QT_CONFIG no-mng"
7188 elif [ "$CFG_MNG" = "yes" ]; then
7189     QT_CONFIG="$QT_CONFIG mng"
7190 fi
7191 if [ "$CFG_LIBPNG" = "no" ]; then
7192     CFG_PNG="no"
7193 fi
7194 if [ "$CFG_LIBPNG" = "system" ]; then
7195     QT_CONFIG="$QT_CONFIG system-png"
7196 fi
7197 if [ "$CFG_PNG" = "no" ]; then
7198     QT_CONFIG="$QT_CONFIG no-png"
7199 elif [ "$CFG_PNG" = "yes" ]; then
7200     QT_CONFIG="$QT_CONFIG png"
7201 fi
7202 if [ "$CFG_GIF" = "no" ]; then
7203     QT_CONFIG="$QT_CONFIG no-gif"
7204 elif [ "$CFG_GIF" = "yes" ]; then
7205     QT_CONFIG="$QT_CONFIG gif"
7206 fi
7207 if [ "$CFG_LIBTIFF" = "no" ]; then
7208     CFG_TIFF="no"
7209 elif [ "$CFG_LIBTIFF" = "system" ]; then
7210     QT_CONFIG="$QT_CONFIG system-tiff"
7211 fi
7212 if [ "$CFG_TIFF" = "no" ]; then
7213     QT_CONFIG="$QT_CONFIG no-tiff"
7214 elif [ "$CFG_TIFF" = "yes" ]; then
7215     QT_CONFIG="$QT_CONFIG tiff"
7216 fi
7217 if [ "$CFG_LIBFREETYPE" = "no" ]; then
7218     QT_CONFIG="$QT_CONFIG no-freetype"
7219     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FREETYPE"
7220 elif [ "$CFG_LIBFREETYPE" = "system" ]; then
7221     QT_CONFIG="$QT_CONFIG system-freetype"
7222 else
7223     QT_CONFIG="$QT_CONFIG freetype"
7224 fi
7225 if [ "$CFG_GUI" = "auto" ]; then
7226     CFG_GUI="yes"
7227 fi
7228 if [ "$CFG_GUI" = "no" ]; then
7229     QT_CONFIG="$QT_CONFIG no-gui"
7230 else
7231     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GUI"
7232 fi
7233
7234
7235 if [ "x$PLATFORM_MAC" = "xyes" ] && [ "$XPLATFORM_MINGW" != "yes" ] && [ "$XPLATFORM_SYMBIAN" != "yes" ]; then
7236     #On Mac we implicitly link against libz, so we
7237     #never use the 3rdparty stuff.
7238     [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system"
7239 fi
7240 if [ "$CFG_ZLIB" = "yes" ]; then
7241     QT_CONFIG="$QT_CONFIG zlib"
7242 elif [ "$CFG_ZLIB" = "system" ]; then
7243     QT_CONFIG="$QT_CONFIG system-zlib"
7244 fi
7245
7246 if [ "$CFG_S60" = "yes" ]; then
7247     QT_CONFIG="$QT_CONFIG s60"
7248 fi
7249
7250 if [ "$CFG_SYMBIAN_DEFFILES" = "yes" ]; then
7251     QTCONFIG_CONFIG="$QTCONFIG_CONFIG def_files"
7252 else
7253     QTCONFIG_CONFIG="$QTCONFIG_CONFIG def_files_disabled"
7254 fi
7255
7256 [ "$CFG_NIS" = "yes" ] && QT_CONFIG="$QT_CONFIG nis"
7257 [ "$CFG_CUPS" = "yes" ] && QT_CONFIG="$QT_CONFIG cups"
7258 [ "$CFG_ICONV" = "yes" ] && QT_CONFIG="$QT_CONFIG iconv"
7259 [ "$CFG_ICONV" = "sun" ] && QT_CONFIG="$QT_CONFIG sun-libiconv"
7260 [ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv"
7261 [ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib"
7262 [ "$CFG_GSTREAMER" = "yes" ] && QT_CONFIG="$QT_CONFIG gstreamer"
7263 [ "$CFG_DBUS" = "yes" ] && QT_CONFIG="$QT_CONFIG dbus"
7264 [ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus dbus-linked"
7265 [ "$CFG_NAS" = "system" ] && QT_CONFIG="$QT_CONFIG nas"
7266 [ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl"
7267 [ "$CFG_OPENSSL" = "linked" ] && QT_CONFIG="$QT_CONFIG openssl-linked"
7268 [ "$CFG_MAC_HARFBUZZ" = "yes" ] && QT_CONFIG="$QT_CONFIG harfbuzz"
7269 [ "$CFG_XCB" = "yes" ] && QT_CONFIG="$QT_CONFIG xcb"
7270
7271 if [ "$PLATFORM_X11" = "yes" ]; then
7272     [ "$CFG_SM" = "yes" ] && QT_CONFIG="$QT_CONFIG x11sm"
7273
7274     # for some reason, the following libraries are not always built shared,
7275     # so *every* program/lib (including Qt) has to link against them
7276     if [ "$CFG_XSHAPE" = "yes" ]; then
7277         QT_CONFIG="$QT_CONFIG xshape"
7278     fi
7279     if [ "$CFG_XVIDEO" = "yes" ]; then
7280         QT_CONFIG="$QT_CONFIG xvideo"
7281     fi
7282     if [ "$CFG_XSYNC" = "yes" ]; then
7283         QT_CONFIG="$QT_CONFIG xsync"
7284     fi
7285     if [ "$CFG_XINERAMA" = "yes" ]; then
7286         QT_CONFIG="$QT_CONFIG xinerama"
7287         QMakeVar set QMAKE_LIBS_X11 '-lXinerama $$QMAKE_LIBS_X11'
7288     fi
7289     if [ "$CFG_XCURSOR" = "yes" ]; then
7290         QT_CONFIG="$QT_CONFIG xcursor"
7291         QMakeVar set QMAKE_LIBS_X11 '-lXcursor $$QMAKE_LIBS_X11'
7292     fi
7293     if [ "$CFG_XFIXES" = "yes" ]; then
7294         QT_CONFIG="$QT_CONFIG xfixes"
7295         QMakeVar set QMAKE_LIBS_X11 '-lXfixes $$QMAKE_LIBS_X11'
7296     fi
7297     if [ "$CFG_XRANDR" = "yes" ]; then
7298         QT_CONFIG="$QT_CONFIG xrandr"
7299         if [ "$CFG_XRENDER" != "yes" ]; then
7300             # libXrandr uses 1 function from libXrender, so we always have to have it :/
7301             QMakeVar set QMAKE_LIBS_X11 '-lXrandr -lXrender $$QMAKE_LIBS_X11'
7302         else
7303             QMakeVar set QMAKE_LIBS_X11 '-lXrandr $$QMAKE_LIBS_X11'
7304         fi
7305     fi
7306     if [ "$CFG_XRENDER" = "yes" ]; then
7307         QT_CONFIG="$QT_CONFIG xrender"
7308         QMakeVar set QMAKE_LIBS_X11 '-lXrender $$QMAKE_LIBS_X11'
7309     fi
7310     if [ "$CFG_MITSHM" = "yes" ]; then
7311         QT_CONFIG="$QT_CONFIG mitshm"
7312     fi
7313     if [ "$CFG_FONTCONFIG" = "yes" ]; then
7314         QT_CONFIG="$QT_CONFIG fontconfig"
7315     fi
7316     if [ "$CFG_XINPUT" = "yes" ]; then
7317         QMakeVar set QMAKE_LIBS_X11 '-lXi $$QMAKE_LIBS_X11'
7318     fi
7319     if [ "$CFG_XINPUT" = "yes" ]; then
7320         QT_CONFIG="$QT_CONFIG xinput tablet"
7321     fi
7322     if [ "$CFG_XKB" = "yes" ]; then
7323         QT_CONFIG="$QT_CONFIG xkb"
7324     fi
7325 fi
7326
7327 [ '!' -z "$D_FLAGS" ] && QMakeVar add DEFINES "$D_FLAGS"
7328 [ '!' -z "$L_FLAGS" ] && QMakeVar add QMAKE_LIBDIR_FLAGS "$L_FLAGS"
7329 [ '!' -z "$l_FLAGS" ] && QMakeVar add LIBS "$l_FLAGS"
7330
7331 if [ "$CFG_ARCH" = "macosx" ]; then
7332     if [ "$CFG_RPATH" = "yes" ]; then
7333        QMAKE_CONFIG="$QMAKE_CONFIG absolute_library_soname"
7334     fi
7335 elif [ -z "`getQMakeConf \"$XQMAKESPEC\" | $AWK '/QMAKE_(LFLAGS_)?RPATH/ {print $3;}'`" ]; then
7336     if [ -n "$RPATH_FLAGS" ]; then
7337         echo
7338         echo "ERROR: -R cannot be used on this platform as \$QMAKE_LFLAGS_RPATH is"
7339         echo "       undefined."
7340         echo
7341         exit 1
7342     elif [ "$CFG_RPATH" = "yes" ]; then
7343         RPATH_MESSAGE="        NOTE: This platform does not support runtime library paths, using -no-rpath."
7344         CFG_RPATH=no
7345     fi
7346 else
7347     if [ "$CFG_RPATH" = "yes" ]; then
7348         # set the default rpath to the library installation directory
7349         RPATH_FLAGS="\"$QT_INSTALL_LIBS\" $RPATH_FLAGS"
7350     fi
7351     if [ -n "$RPATH_FLAGS" ]; then
7352         # add the user defined rpaths
7353         QMakeVar add QMAKE_RPATHDIR "$RPATH_FLAGS"
7354     fi
7355 fi
7356
7357 if [ '!' -z "$I_FLAGS" ]; then
7358     # add the user define include paths
7359     QMakeVar add QMAKE_CFLAGS "$I_FLAGS"
7360     QMakeVar add QMAKE_CXXFLAGS "$I_FLAGS"
7361 fi
7362
7363 # turn off exceptions for the compilers that support it
7364 if [ "$PLATFORM_QWS" = "yes" ]; then
7365     COMPILER=`echo $XPLATFORM | cut -f 3- -d-`
7366 elif [ "$XPLATFORM" != "$PLATFORM" ]; then
7367     COMPILER=`echo $XPLATFORM | cut -f 2- -d-`
7368 else
7369     COMPILER=`echo $PLATFORM | cut -f 2- -d-`
7370 fi
7371 if [ "$CFG_EXCEPTIONS" = "unspecified" -a "$PLATFORM_QWS" = "yes" ]; then
7372     CFG_EXCEPTIONS=no
7373 fi
7374
7375 if [ "$CFG_EXCEPTIONS" != "no" ]; then
7376     QTCONFIG_CONFIG="$QTCONFIG_CONFIG exceptions"
7377 fi
7378
7379 if [ "$XPLATFORM_MINGW" = "yes" ]; then
7380     # mkspecs/features/win32/default_pre.prf sets "no-rtti".
7381     # Follow default behavior of configure.exe by overriding with "rtti".
7382     QTCONFIG_CONFIG="$QTCONFIG_CONFIG rtti"
7383 fi
7384
7385 if [ "$CFG_ALSA" = "yes" ]; then
7386     QT_CONFIG="$QT_CONFIG alsa"
7387 fi
7388
7389 if [ "$CFG_PULSEAUDIO" = "yes" ]; then
7390     QT_CONFIG="$QT_CONFIG pulseaudio"
7391 fi
7392
7393 if [ "$CFG_COREWLAN" = "yes" ]; then
7394     QT_CONFIG="$QT_CONFIG corewlan"
7395 fi
7396
7397 if [ "$CFG_ICD" = "yes" ]; then
7398     QT_CONFIG="$QT_CONFIG icd"
7399 fi
7400
7401 if [ "$CFG_ICU" = "yes" ]; then
7402     QT_CONFIG="$QT_CONFIG icu"
7403 fi
7404
7405 #
7406 # Some Qt modules are too advanced in C++ for some old compilers
7407 # Detect here the platforms where they are known to work.
7408 #
7409 # See Qt documentation for more information on which features are
7410 # supported and on which compilers.
7411 #
7412 canBuildQtXmlPatterns="yes"
7413 canBuildWebKit="$HAVE_STL"
7414 canBuildQtConcurrent="yes"
7415 canBuildV8="yes"
7416
7417 # WebKit requires stdint.h
7418 "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stdint "Stdint" $L_FLAGS $I_FLAGS $l_FLAGS
7419 if [ $? != "0" ]; then
7420     canBuildWebKit="no"
7421 fi
7422
7423 case "$XPLATFORM" in
7424     hpux-g++*)
7425         # PA-RISC's assembly is too limited
7426         # gcc 3.4 on that platform can't build QtXmlPatterns
7427         # the assembly it generates cannot be compiled
7428
7429         # Check gcc's version
7430         case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
7431             4*)
7432                 ;;
7433             3.4*)
7434                 canBuildQtXmlPatterns="no"
7435                 ;;
7436             *)
7437                 canBuildWebKit="no"
7438                 canBuildQtXmlPatterns="no"
7439                 ;;
7440         esac
7441         ;;
7442     unsupported/vxworks-*-g++*)
7443         canBuildWebKit="no"
7444         ;;
7445     unsupported/vxworks-*-dcc*)
7446         canBuildWebKit="no"
7447         canBuildQtXmlPatterns="no"
7448         ;;
7449     *-g++*)
7450         # Check gcc's version
7451         case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
7452             4*|3.4*)
7453                 ;;
7454             3.3*)
7455                 canBuildWebKit="no"
7456                 ;;
7457             *)
7458                 canBuildWebKit="no"
7459                 canBuildQtXmlPatterns="no"
7460                 ;;
7461         esac
7462         ;;
7463     solaris-cc*)
7464         # Check the compiler version
7465         case `${QMAKE_CONF_COMPILER} -V 2>&1 | awk '{print $4}'` in
7466             5.[012345678])
7467                 canBuildWebKit="no"
7468                 canBuildQtXmlPatterns="no"
7469                 canBuildQtConcurrent="no"
7470                 ;;
7471             5.*)
7472                 canBuildWebKit="no"
7473                 canBuildQtConcurrent="no"
7474                 ;;
7475         esac
7476         ;;
7477     hpux-acc*)
7478         canBuildWebKit="no"
7479         canBuildQtXmlPatterns="no"
7480         canBuildQtConcurrent="no"
7481         ;;
7482     hpuxi-acc*)
7483         canBuildWebKit="no"
7484         ;;
7485     aix-xlc*)
7486         # Get the xlC version
7487         cat > xlcver.c <<EOF
7488 #include <stdio.h>
7489 int main()
7490 {
7491     printf("%d.%d\n", __xlC__ >> 8, __xlC__ & 0xFF);
7492     return 0;
7493 }
7494 EOF
7495         xlcver=
7496         if ${QMAKE_CONF_COMPILER} -o xlcver xlcver.c >/dev/null 2>/dev/null; then
7497             xlcver=`./xlcver 2>/dev/null`
7498             rm -f ./xlcver
7499         fi
7500         if [ "$OPT_VERBOSE" = "yes" ]; then
7501             if [ -n "$xlcver" ]; then
7502                 echo Found IBM xlC version: $xlcver.
7503             else
7504                 echo Could not determine IBM xlC version, assuming oldest supported.
7505             fi
7506         fi
7507
7508         case "$xlcver" in
7509             [123456].*)
7510                 canBuildWebKit="no"
7511                 canBuildQtXmlPatterns="no"
7512                 canBuildQtConcurrent="no"
7513                 ;;
7514             *)
7515                 canBuildWebKit="no"
7516                 canBuildQtConcurrent="no"
7517                 ;;
7518         esac
7519         ;;
7520     irix-cc*)
7521         canBuildWebKit="no"
7522         canBuildQtConcurrent="no"
7523         ;;
7524     symbian-gcce)
7525         ;;
7526     symbian-armcc)
7527         ;;
7528 esac
7529
7530 if [ "$CFG_GUI" = "no" ]; then
7531     # WebKit requires QtGui
7532     canBuildWebKit="no"
7533 fi
7534
7535 if [ "$CFG_SHARED" = "no" ]; then
7536     echo
7537     echo "WARNING: Using static linking will disable the WebKit module."
7538     echo
7539     canBuildWebKit="no"
7540 fi
7541
7542 CFG_CONCURRENT="yes"
7543 if [ "$canBuildQtConcurrent" = "no" ]; then
7544     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT"
7545     CFG_CONCURRENT="no"
7546 fi
7547
7548 if [ "$CFG_XMLPATTERNS" = "yes" -a "$CFG_EXCEPTIONS" = "no" ]; then
7549     echo "QtXmlPatterns was requested, but it can't be built due to exceptions being disabled."
7550     exit 1
7551 fi
7552 if [ "$CFG_XMLPATTERNS" = "auto" -a "$CFG_EXCEPTIONS" != "no" ]; then
7553     CFG_XMLPATTERNS="$canBuildQtXmlPatterns"
7554 elif [ "$CFG_EXCEPTIONS" = "no" ]; then
7555     CFG_XMLPATTERNS="no"
7556 fi
7557 # No longer needed after modularization
7558 #if [ "$CFG_XMLPATTERNS" = "yes" ]; then
7559 #    QT_CONFIG="$QT_CONFIG xmlpatterns"
7560 #else
7561 #    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XMLPATTERNS"
7562 #fi
7563
7564 # No longer needed after modularization
7565 #if [ "$CFG_MULTIMEDIA" = "no" ]; then
7566 #    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MULTIMEDIA"
7567 #else
7568 #    QT_CONFIG="$QT_CONFIG multimedia"
7569 #fi
7570
7571 if [ "$CFG_AUDIO_BACKEND" = "yes" ]; then
7572     QT_CONFIG="$QT_CONFIG audio-backend"
7573 fi
7574
7575 if [ "$CFG_SVG" = "auto" ]; then
7576     CFG_SVG=$CFG_GUI
7577 fi
7578
7579 if [ "$CFG_SVG" = "yes" ] && [ "$CFG_GUI" = "no" ]; then
7580     echo "QtSvg requested, but it can't be built without QtGui"
7581     exit 1
7582 fi
7583
7584 if [ "$CFG_SVG" = "yes" ]; then
7585     QT_CONFIG="$QT_CONFIG svg"
7586 else
7587     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SVG"
7588 fi
7589
7590 if [ "$CFG_WEBKIT" != "no" ]; then
7591     CFG_WEBKIT="$canBuildWebKit"
7592 fi
7593
7594 if [ "$CFG_WEBKIT" != "no" ]; then
7595     # No longer needed after modularization
7596     #QT_CONFIG="$QT_CONFIG webkit"
7597     # The reason we set CFG_WEBKIT, is such that the printed overview of what will be enabled, shows correctly.
7598     if [ "$CFG_WEBKIT" = "debug" ]; then
7599         QMAKE_CONFIG="$QMAKE_CONFIG webkit-debug"
7600     fi
7601 fi
7602
7603 if [ "$CFG_SCRIPT" = "auto" ]; then
7604     CFG_SCRIPT="yes"
7605 fi
7606
7607 # No longer needed after modularization
7608 #if [ "$CFG_SCRIPT" = "yes" ]; then
7609 #    QT_CONFIG="$QT_CONFIG script"
7610 #else
7611 #    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SCRIPT"
7612 #fi
7613
7614 if [ "$CFG_SCRIPTTOOLS" = "yes" -a "$CFG_SCRIPT" = "no" ]; then
7615     echo "QtScriptTools was requested, but it can't be built due to QtScript being disabled."
7616     exit 1
7617 fi
7618 if [ "$CFG_SCRIPTTOOLS" = "auto" -a "$CFG_SCRIPT" != "no" ]; then
7619     case "$XPLATFORM" in
7620     symbian*)
7621         CFG_SCRIPTTOOLS="no"
7622         ;;
7623     *)
7624         CFG_SCRIPTTOOLS="yes"
7625         ;;
7626     esac
7627 elif [ "$CFG_SCRIPT" = "no" ]; then
7628     CFG_SCRIPTTOOLS="no"
7629 fi
7630
7631 # No longer needed after modularization
7632 #if [ "$CFG_SCRIPTTOOLS" = "yes" ]; then
7633 #    QT_CONFIG="$QT_CONFIG scripttools"
7634 #else
7635 #    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SCRIPTTOOLS"
7636 #fi
7637
7638
7639 case "$CFG_ARCH" in
7640 i386|x86_64|arm|macosx) ;;
7641 *) canBuildV8="no";;
7642 esac
7643
7644 if [ "$CFG_V8" = "yes" -a "$canBuildV8" = "no" ]; then
7645     echo "Error: V8 was requested, but is not supported on this platform."
7646     exit 1
7647 fi
7648
7649 if [ "$CFG_V8" = "auto" ]; then
7650     CFG_V8="$canBuildV8"
7651 fi
7652
7653 if [ "$CFG_V8" = "no" ]; then
7654     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_V8"
7655 else
7656     QT_CONFIG="$QT_CONFIG v8"
7657 fi
7658
7659 if [ "$CFG_DECLARATIVE" = "yes" ]; then
7660     if [ "$CFG_V8" = "no" -o "$CFG_GUI" = "no" ]; then
7661         echo "Error: QtDeclarative was requested, but it can't be built due to QtV8 or QtGui being disabled."
7662         exit 1
7663     fi
7664 fi
7665 if [ "$CFG_DECLARATIVE" = "auto" ]; then
7666     if [ "$CFG_V8" = "no" -o "$CFG_GUI" = "no" ]; then
7667             CFG_DECLARATIVE=no
7668     else
7669             CFG_DECLARATIVE=yes
7670     fi
7671 fi
7672
7673 if [ "$CFG_DECLARATIVE" = "yes" ]; then
7674     # No longer needed after modularization
7675     #QT_CONFIG="$QT_CONFIG declarative"
7676     if [ "$CFG_DECLARATIVE_DEBUG" = "no" ]; then
7677         QCONFIG_FLAGS="$QCONFIG_FLAGS QDECLARATIVE_NO_DEBUG_PROTOCOL"
7678     fi
7679 else
7680     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DECLARATIVE"
7681 fi
7682
7683 if [ "$CFG_LOCATION" = "auto" ]; then
7684     CFG_LOCATION="$CFG_GUI"
7685 fi
7686
7687 if [ "$CFG_LOCATION" = "yes" ] && [ "$CFG_GUI" = "no" ]; then
7688     echo "QtLocation requested, but it can't be built without QtGui"
7689     exit 1
7690 fi
7691
7692 #Disable QtLocation until ready
7693 CFG_LOCATION="no"
7694
7695 if [ "$CFG_LOCATION" = "no" ]; then
7696     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_LOCATION"
7697 fi
7698
7699 if [ "$CFG_EXCEPTIONS" = "no" ]; then
7700     case "$COMPILER" in
7701     g++*)
7702         QMakeVar add QMAKE_CFLAGS -fno-exceptions
7703         QMakeVar add QMAKE_CXXFLAGS -fno-exceptions
7704         QMakeVar add QMAKE_LFLAGS -fno-exceptions
7705         ;;
7706     cc*)
7707         case "$PLATFORM" in
7708         irix-cc*)
7709             QMakeVar add QMAKE_CFLAGS -LANG:exceptions=off
7710             QMakeVar add QMAKE_CXXFLAGS -LANG:exceptions=off
7711             QMakeVar add QMAKE_LFLAGS -LANG:exceptions=off
7712             ;;
7713         *) ;;
7714         esac
7715         ;;
7716     *) ;;
7717     esac
7718     QMAKE_CONFIG="$QMAKE_CONFIG exceptions_off"
7719 fi
7720
7721 # On Mac, set the minimum deployment target for the different architechtures 
7722 # using the Xarch compiler option when supported (10.5 and up).
7723 if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" != "no" ] ; then
7724     if echo "$CFG_MAC_ARCHS" | grep '\<x86\>' > /dev/null 2>&1; then
7725         QMakeVar add QMAKE_CFLAGS "-Xarch_i386 -mmacosx-version-min=10.4"
7726         QMakeVar add QMAKE_CXXFLAGS "-Xarch_i386 -mmacosx-version-min=10.4"
7727         QMakeVar add QMAKE_LFLAGS "-Xarch_i386 -mmacosx-version-min=10.4"
7728         QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86 "-arch i386 -Xarch_i386 -mmacosx-version-min=10.4"
7729     fi
7730     if echo "$CFG_MAC_ARCHS" | grep '\<ppc\>' > /dev/null 2>&1; then
7731         QMakeVar add QMAKE_CFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
7732         QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
7733         QMakeVar add QMAKE_LFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
7734         QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC "-arch ppc -Xarch_ppc -mmacosx-version-min=10.4"
7735     fi
7736     if echo "$CFG_MAC_ARCHS" | grep '\<x86_64\>' > /dev/null 2>&1; then
7737         QMakeVar add QMAKE_CFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
7738         QMakeVar add QMAKE_CXXFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
7739         QMakeVar add QMAKE_LFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
7740         QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86_64 "-arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5"
7741     fi
7742     if echo "$CFG_MAC_ARCHS" | grep '\<ppc64\>' > /dev/null 2>&1; then
7743         QMakeVar add QMAKE_CFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5"
7744         QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5"
7745         QMakeVar add QMAKE_LFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5"
7746         QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC_64 "-arch ppc64 -Xarch_ppc64 -mmacosx-version-min=10.5"
7747     fi
7748 fi
7749
7750 case "$COMPILER" in
7751 g++*)
7752     # GNU C++
7753     COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -dumpversion 2>/dev/null`
7754
7755     case "$COMPILER_VERSION" in
7756     *.*.*)
7757         QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'`
7758         QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'`
7759         QT_GCC_PATCH_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'`
7760         ;;
7761     *.*)
7762         QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\1,'`
7763         QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\2,'`
7764         QT_GCC_PATCH_VERSION=0
7765         ;;
7766     esac
7767
7768     ;;
7769 *)
7770     #
7771     ;;
7772 esac
7773
7774 #-------------------------------------------------------------------------------
7775 # part of configuration information goes into qconfig.h
7776 #-------------------------------------------------------------------------------
7777
7778 case "$CFG_QCONFIG" in
7779 full)
7780     echo "/* Everything */" >"$outpath/src/corelib/global/qconfig.h.new"
7781     ;;
7782 *)
7783     tmpconfig="$outpath/src/corelib/global/qconfig.h.new"
7784     echo "#ifndef QT_BOOTSTRAPPED" >"$tmpconfig"
7785     if [ -f "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" ]; then
7786         cat "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" >>"$tmpconfig"
7787     elif [ -f `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` ]; then
7788         cat `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` >>"$tmpconfig"
7789     fi
7790     echo "#endif" >>"$tmpconfig"
7791     ;;
7792 esac
7793
7794 cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
7795
7796 /* Qt Edition */
7797 #ifndef QT_EDITION
7798 #  define QT_EDITION $QT_EDITION
7799 #endif
7800
7801 /* Machine byte-order */
7802 #define Q_BIG_ENDIAN 4321
7803 #define Q_LITTLE_ENDIAN 1234
7804 EOF
7805
7806 echo "#ifdef QT_BOOTSTRAPPED" >>"$outpath/src/corelib/global/qconfig.h.new"
7807 if [ "$CFG_HOST_ENDIAN" = "auto" ]; then
7808     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
7809 #if defined(__BIG_ENDIAN__)
7810 # define Q_BYTE_ORDER Q_BIG_ENDIAN
7811 #elif defined(__LITTLE_ENDIAN__)
7812 # define Q_BYTE_ORDER Q_LITTLE_ENDIAN
7813 #else
7814 # error "Unable to determine byte order!"
7815 #endif
7816 EOF
7817 else
7818     echo "#define Q_BYTE_ORDER $CFG_HOST_ENDIAN" >>"$outpath/src/corelib/global/qconfig.h.new"
7819 fi
7820 echo "#else" >>"$outpath/src/corelib/global/qconfig.h.new"
7821 if [ "$CFG_ENDIAN" = "auto" ]; then
7822     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
7823 #if defined(__BIG_ENDIAN__)
7824 # define Q_BYTE_ORDER Q_BIG_ENDIAN
7825 #elif defined(__LITTLE_ENDIAN__)
7826 # define Q_BYTE_ORDER Q_LITTLE_ENDIAN
7827 #else
7828 # error "Unable to determine byte order!"
7829 #endif
7830 EOF
7831 else
7832     echo "#define Q_BYTE_ORDER $CFG_ENDIAN" >>"$outpath/src/corelib/global/qconfig.h.new"
7833 fi
7834 echo "#endif" >>"$outpath/src/corelib/global/qconfig.h.new"
7835
7836 if [ "$CFG_DOUBLEFORMAT" != "normal" ]; then
7837     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
7838 /* Non-IEEE double format */
7839 #define Q_DOUBLE_LITTLE "01234567"
7840 #define Q_DOUBLE_BIG "76543210"
7841 #define Q_DOUBLE_LITTLE_SWAPPED "45670123"
7842 #define Q_DOUBLE_BIG_SWAPPED "32107654"
7843 #define Q_DOUBLE_FORMAT $CFG_DOUBLEFORMAT
7844 EOF
7845 fi
7846 if [ "$CFG_ARMFPA" = "yes" ]; then
7847     if [ "$CFG_ARCH" != "$CFG_HOST_ARCH" ]; then
7848         cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
7849 #ifndef QT_BOOTSTRAPPED
7850 # define QT_ARMFPA
7851 #endif
7852 EOF
7853     else
7854         echo "#define QT_ARMFPA" >>"$outpath/src/corelib/global/qconfig.h.new"
7855     fi
7856 fi
7857
7858 CFG_ARCH_STR=`echo $CFG_ARCH | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7859 CFG_HOST_ARCH_STR=`echo $CFG_HOST_ARCH | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7860 cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
7861 /* Machine Architecture */
7862 #ifndef QT_BOOTSTRAPPED
7863 # define QT_ARCH_${CFG_ARCH_STR}
7864 #else
7865 # define QT_ARCH_${CFG_HOST_ARCH_STR}
7866 #endif
7867 EOF
7868
7869 echo '/* Compile time features */' >>"$outpath/src/corelib/global/qconfig.h.new"
7870 [ '!' -z "$LicenseKeyExt" ] && echo "#define QT_PRODUCT_LICENSEKEY \"$LicenseKeyExt\"" >>"$outpath/src/corelib/global/qconfig.h.new"
7871
7872 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
7873     echo "#define QT_LARGEFILE_SUPPORT 64" >>"$outpath/src/corelib/global/qconfig.h.new"
7874 fi
7875
7876 # if both carbon and cocoa are specified, enable the autodetection code.
7877 if [ "$PLATFORM_MAC" = "yes" -a "$CFG_MAC_COCOA" = "yes" -a "$CFG_MAC_CARBON" = "yes" ]; then
7878     echo "#define QT_AUTODETECT_COCOA 1" >>"$outpath/src/corelib/global/qconfig.h.new"
7879 elif [ "$PLATFORM_MAC" = "yes" -a "$CFG_MAC_COCOA" = "yes" ]; then
7880     echo "#define QT_MAC_USE_COCOA 1" >>"$outpath/src/corelib/global/qconfig.h.new"
7881 fi
7882
7883 if [ "$CFG_FRAMEWORK" = "yes" ]; then
7884     echo "#define QT_MAC_FRAMEWORK_BUILD" >>"$outpath/src/corelib/global/qconfig.h.new"
7885 fi
7886
7887 if [ "$PLATFORM_MAC" = "yes" ]; then
7888     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
7889 #if defined(__LP64__)
7890 # define QT_POINTER_SIZE 8
7891 #else
7892 # define QT_POINTER_SIZE 4
7893 #endif
7894 EOF
7895 else
7896     "$unixtests/ptrsize.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
7897     echo "#define QT_POINTER_SIZE $?" >>"$outpath/src/corelib/global/qconfig.h.new"
7898 fi
7899
7900
7901 echo "" >>"$outpath/src/corelib/global/qconfig.h.new"
7902
7903 if [ "$CFG_DEV" = "yes" ]; then
7904     echo "#define QT_BUILD_INTERNAL" >>"$outpath/src/corelib/global/qconfig.h.new"
7905 fi
7906
7907 # Embedded compile time options
7908 if [ "$PLATFORM_QWS" = "yes" ]; then
7909     # Add QWS to config.h
7910     QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QWS"
7911
7912     # Add excluded decorations to $QCONFIG_FLAGS
7913     decors=`grep '^decorations -= ' "$QMAKE_VARS_FILE" | ${AWK} '{print $3}'`
7914     for decor in $decors; do
7915         NODECORATION=`echo $decor | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7916         QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_NO_QWS_DECORATION_${NODECORATION}"
7917     done
7918
7919     # Figure which embedded drivers which are turned off
7920     CFG_GFX_OFF="$CFG_GFX_AVAILABLE"
7921     for ADRIVER in $CFG_GFX_ON; do
7922         CFG_GFX_OFF=`echo "${CFG_GFX_OFF} " | sed "s,${ADRIVER} ,,g"`
7923     done
7924
7925     CFG_KBD_OFF="$CFG_KBD_AVAILABLE"
7926     # the um driver is currently not in the available list for external builds
7927     if [ "$CFG_DEV" = "no" ]; then
7928         CFG_KBD_OFF="$CFG_KBD_OFF um"
7929     fi
7930     for ADRIVER in $CFG_KBD_ON; do
7931         CFG_KBD_OFF=`echo "${CFG_KBD_OFF} " | sed "s,${ADRIVER} ,,g"`
7932     done
7933
7934     CFG_MOUSE_OFF="$CFG_MOUSE_AVAILABLE"
7935     for ADRIVER in $CFG_MOUSE_ON; do
7936         CFG_MOUSE_OFF=`echo "${CFG_MOUSE_OFF} " | sed "s,${ADRIVER} ,,g"`
7937     done
7938
7939     for DRIVER in $CFG_GFX_OFF; do
7940         NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7941         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_$NODRIVER"
7942     done
7943
7944     for DRIVER in $CFG_KBD_OFF; do
7945         NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7946         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_KBD_$NODRIVER"
7947     done
7948
7949     for DRIVER in $CFG_MOUSE_OFF; do
7950         NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7951         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_MOUSE_$NODRIVER"
7952     done
7953 fi # QWS
7954
7955 if [ "$PLATFORM_QPA" = "yes" ]; then
7956     # Add QPA to config.h
7957     QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QPA QT_NO_QWS_QPF QT_NO_QWS_QPF2"
7958 fi
7959
7960 if [ "${CFG_USE_FLOATMATH}" = "yes" ]; then
7961     QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_USE_MATH_H_FLOATS"
7962 fi
7963
7964 # Add turned on SQL drivers
7965 for DRIVER in $CFG_SQL_AVAILABLE; do
7966     eval "VAL=\$CFG_SQL_$DRIVER"
7967     case "$VAL" in
7968     qt)
7969         ONDRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7970         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SQL_$ONDRIVER"
7971         SQL_DRIVERS="$SQL_DRIVERS $DRIVER"
7972     ;;
7973     plugin)
7974         SQL_PLUGINS="$SQL_PLUGINS $DRIVER"
7975     ;;
7976     esac
7977 done
7978
7979
7980 QMakeVar set sql-drivers "$SQL_DRIVERS"
7981 QMakeVar set sql-plugins "$SQL_PLUGINS"
7982
7983 # Add other configuration options to the qconfig.h file
7984 [ "$CFG_GIF" = "yes" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_BUILTIN_GIF_READER=1"
7985 [ "$CFG_TIFF" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_TIFF"
7986 [ "$CFG_PNG" != "yes" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_PNG"
7987 [ "$CFG_JPEG" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_JPEG"
7988 [ "$CFG_MNG" != "yes" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_MNG"
7989 [ "$CFG_ZLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ZLIB"
7990 [ "$CFG_S60" != "yes" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_S60"
7991 [ "$CFG_EXCEPTIONS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EXCEPTIONS"
7992 [ "$CFG_SXE" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SXE"
7993 [ "$CFG_DBUS" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS"
7994
7995 if [ "$PLATFORM_QWS" != "yes" -a "$PLATFORM_QPA" != "yes" ]; then
7996     [ "$CFG_GRAPHICS_SYSTEM" = "raster" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_RASTER"
7997     [ "$CFG_GRAPHICS_SYSTEM" = "opengl" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_OPENGL"
7998     [ "$CFG_GRAPHICS_SYSTEM" = "openvg" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_OPENVG"
7999     [ "$CFG_GRAPHICS_SYSTEM" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_RUNTIME"
8000 fi
8001
8002 # X11/Unix/Mac only configs
8003 [ "$CFG_CUPS" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CUPS"
8004 [ "$CFG_ICONV" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ICONV"
8005 [ "$CFG_GLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GLIB"
8006 [ "$CFG_GSTREAMER" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GSTREAMER"
8007 [ "$CFG_QGTKSTYLE" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STYLE_GTK"
8008 [ "$CFG_CLOCK_MONOTONIC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CLOCK_MONOTONIC"
8009 [ "$CFG_MREMAP" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MREMAP"
8010 [ "$CFG_GETADDRINFO" = "no" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETADDRINFO"
8011 [ "$CFG_IPV6IFNAME" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IPV6IFNAME"
8012 [ "$CFG_GETIFADDRS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETIFADDRS"
8013 [ "$CFG_INOTIFY" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_INOTIFY"
8014 [ "$CFG_NAS" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NAS"
8015 [ "$CFG_NIS" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NIS"
8016 [ "$CFG_OPENSSL" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENSSL"
8017 [ "$CFG_OPENSSL" = "linked" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LINKED_OPENSSL"
8018
8019 [ "$CFG_SM" = "no" ]         && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SESSIONMANAGER"
8020 [ "$CFG_XCURSOR" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XCURSOR"
8021 [ "$CFG_XFIXES" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XFIXES"
8022 [ "$CFG_FONTCONFIG" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FONTCONFIG"
8023 [ "$CFG_XINERAMA" = "no" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINERAMA"
8024 [ "$CFG_XKB" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XKB"
8025 [ "$CFG_XRANDR" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRANDR"
8026 [ "$CFG_XRENDER" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRENDER"
8027 [ "$CFG_MITSHM" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MITSHM"
8028 [ "$CFG_XSHAPE" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SHAPE"
8029 [ "$CFG_XVIDEO" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XVIDEO"
8030 [ "$CFG_XSYNC" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XSYNC"
8031 [ "$CFG_XINPUT" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINPUT QT_NO_TABLET"
8032
8033 [ "$CFG_XCURSOR" = "runtime" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XCURSOR"
8034 [ "$CFG_XINERAMA" = "runtime" ]  && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINERAMA"
8035 [ "$CFG_XFIXES" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XFIXES"
8036 [ "$CFG_XRANDR" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XRANDR"
8037 [ "$CFG_XINPUT" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINPUT"
8038 [ "$CFG_ALSA" = "no" ]           && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ALSA"
8039 [ "$CFG_PULSEAUDIO" = "no" ]          && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_PULSEAUDIO"
8040 [ "$CFG_COREWLAN" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_COREWLAN"
8041 [ "$CFG_ICD" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ICD"
8042
8043 # sort QCONFIG_FLAGS for neatness if we can
8044 [ '!' -z "$AWK" ] && QCONFIG_FLAGS=`echo $QCONFIG_FLAGS | $AWK '{ gsub(" ", "\n"); print }' | sort | uniq`
8045 QCONFIG_FLAGS=`echo $QCONFIG_FLAGS`
8046
8047 if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
8048     # Enable Symbian DLLs and export rules.
8049     # We cannot use Linux's default export rules since they export everything.
8050     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_DLL"
8051     # Disable non-working features.
8052     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CRASHHANDLER QT_NO_PRINTER QT_NO_SYSTEMTRAYICON"
8053 fi
8054
8055 if [ -n "$QCONFIG_FLAGS" ]; then
8056 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
8057 #ifndef QT_BOOTSTRAPPED
8058
8059 EOF
8060     for cfg in $QCONFIG_FLAGS; do
8061         cfgd=`echo $cfg | sed 's/=.*$//'` # trim pushed 'Foo=Bar' defines
8062         cfg=`echo $cfg | sed 's/=/ /'`    # turn first '=' into a space
8063         # figure out define logic, so we can output the correct
8064         # ifdefs to override the global defines in a project
8065         cfgdNeg=
8066         if [ true ] && echo "$cfgd" | grep 'QT_NO_' >/dev/null 2>&1; then
8067             # QT_NO_option can be forcefully turned on by QT_option
8068             cfgdNeg=`echo $cfgd | sed "s,QT_NO_,QT_,"`
8069         elif [ true ] && echo "$cfgd" | grep 'QT_' >/dev/null 2>&1; then
8070             # QT_option can be forcefully turned off by QT_NO_option
8071             cfgdNeg=`echo $cfgd | sed "s,QT_,QT_NO_,"`
8072         fi
8073
8074         if [ -z $cfgdNeg ]; then
8075 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
8076 #ifndef $cfgd
8077 # define $cfg
8078 #endif
8079
8080 EOF
8081         else
8082 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
8083 #if defined($cfgd) && defined($cfgdNeg)
8084 # undef $cfgd
8085 #elif !defined($cfgd) && !defined($cfgdNeg)
8086 # define $cfg
8087 #endif
8088
8089 EOF
8090         fi
8091     done
8092 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
8093 #endif // QT_BOOTSTRAPPED
8094
8095 EOF
8096 fi
8097
8098 if [ "$CFG_REDUCE_EXPORTS" = "yes" ]; then
8099 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
8100 #define QT_VISIBILITY_AVAILABLE
8101
8102 EOF
8103 fi
8104
8105 if [ -n "$QT_LIBINFIX" ]; then
8106 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
8107 #define QT_LIBINFIX "$QT_LIBINFIX"
8108
8109 EOF
8110 fi
8111
8112 if [ -n "$CFG_RUNTIME_SYSTEM" ]; then
8113 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
8114 #define QT_DEFAULT_RUNTIME_SYSTEM "$CFG_RUNTIME_SYSTEM"
8115
8116 EOF
8117 fi
8118
8119 # avoid unecessary rebuilds by copying only if qconfig.h has changed
8120 if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then
8121     rm -f "$outpath/src/corelib/global/qconfig.h.new"
8122 else
8123     [ -f "$outpath/src/corelib/global/qconfig.h" ] && chmod +w "$outpath/src/corelib/global/qconfig.h"
8124     mv "$outpath/src/corelib/global/qconfig.h.new" "$outpath/src/corelib/global/qconfig.h"
8125     chmod -w "$outpath/src/corelib/global/qconfig.h"
8126     for conf in "$outpath/include/QtCore/qconfig.h" "$outpath/include/Qt/qconfig.h"; do
8127         ln -s "$outpath/src/corelib/global/qconfig.h" "$conf"
8128     done
8129 fi
8130
8131 #-------------------------------------------------------------------------------
8132 # save configuration into qconfig.pri
8133 #-------------------------------------------------------------------------------
8134 QTCONFIG="$outpath/mkspecs/qconfig.pri"
8135 QTCONFIG_CONFIG="$QTCONFIG_CONFIG no_mocdepend"
8136 [ -f "$QTCONFIG.tmp" ] && rm -f "$QTCONFIG.tmp"
8137 if [ "$CFG_DEBUG" = "yes" ]; then
8138     QTCONFIG_CONFIG="$QTCONFIG_CONFIG debug"
8139     if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
8140         QT_CONFIG="$QT_CONFIG release"
8141     fi
8142     QT_CONFIG="$QT_CONFIG debug"
8143 elif [ "$CFG_DEBUG" = "no" ]; then
8144     QTCONFIG_CONFIG="$QTCONFIG_CONFIG release"
8145     if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
8146         QT_CONFIG="$QT_CONFIG debug"
8147     fi
8148     QT_CONFIG="$QT_CONFIG release"
8149 fi
8150 if [ "$CFG_STL" = "yes" ]; then
8151     QTCONFIG_CONFIG="$QTCONFIG_CONFIG stl"
8152 fi
8153 if [ "$CFG_FRAMEWORK" = "no" ]; then
8154     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_no_framework"
8155 else
8156     QT_CONFIG="$QT_CONFIG qt_framework"
8157     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_framework"
8158 fi
8159 if [ "$PLATFORM_MAC" = "yes" ]; then
8160     QT_CONFIG="$QT_CONFIG $CFG_MAC_ARCHS"
8161 fi
8162 if [ "$CFG_DEV" = "yes" ]; then
8163     QT_CONFIG="$QT_CONFIG private_tests"
8164 fi
8165
8166 if [ -z "$QT_CFLAGS_FPU" ]; then
8167     if echo "$XPLATFORM" | grep "symbian-sbsv2" > /dev/null 2>&1; then
8168         QT_CFLAGS_FPU=softvfp
8169     fi
8170 fi
8171
8172 # Make the application arch follow the Qt arch for single arch builds.
8173 # (for multiple-arch builds, set CONFIG manually in the application .pro file)
8174 if [ `echo "$CFG_MAC_ARCHS" | wc -w` -eq 1 ]; then
8175     QTCONFIG_CONFIG="$QTCONFIG_CONFIG $CFG_MAC_ARCHS"
8176 fi
8177
8178 cat >>"$QTCONFIG.tmp" <<EOF
8179 #configuration
8180 CONFIG += $QTCONFIG_CONFIG
8181 QT_ARCH = $CFG_ARCH
8182 QT_EDITION = $Edition
8183 QT_CONFIG += $QT_CONFIG
8184
8185 #versioning
8186 QT_VERSION = $QT_VERSION
8187 QT_MAJOR_VERSION = $QT_MAJOR_VERSION
8188 QT_MINOR_VERSION = $QT_MINOR_VERSION
8189 QT_PATCH_VERSION = $QT_PATCH_VERSION
8190
8191 #namespaces
8192 QT_LIBINFIX = $QT_LIBINFIX
8193 QT_NAMESPACE = $QT_NAMESPACE
8194 QT_NAMESPACE_MAC_CRC = $QT_NAMESPACE_MAC_CRC
8195
8196 EOF
8197 if [ -n "$CFG_SYSROOT" ]; then
8198     echo "# sysroot" >>"$QTCONFIG.tmp"
8199     echo `basename "$XQMAKESPEC"` \{ >>"$QTCONFIG.tmp"
8200     echo "  QT_SYSROOT      += \$\$quote($CFG_SYSROOT)" >>"$QTCONFIG.tmp"
8201     echo "  QMAKE_CFLAGS    += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp"
8202     echo "  QMAKE_CXXFLAGS  += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp"
8203     echo "  QMAKE_LFLAGS    += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp"
8204     echo "}" >> "$QTCONFIG.tmp"
8205     echo >> "$QTCONFIG.tmp"
8206 fi
8207 if [ "$CFG_RPATH" = "yes" ]; then
8208     echo "QMAKE_RPATHDIR += \"$QT_INSTALL_LIBS\"" >> "$QTCONFIG.tmp"
8209 fi
8210 if [ -n "$QT_GCC_MAJOR_VERSION" ]; then
8211     echo "QT_GCC_MAJOR_VERSION = $QT_GCC_MAJOR_VERSION" >> "$QTCONFIG.tmp"
8212     echo "QT_GCC_MINOR_VERSION = $QT_GCC_MINOR_VERSION" >> "$QTCONFIG.tmp"
8213     echo "QT_GCC_PATCH_VERSION = $QT_GCC_PATCH_VERSION" >> "$QTCONFIG.tmp"
8214 fi
8215 if [ -n "$QT_CFLAGS_FPU" ]; then
8216     echo "#Qt for symbian FPU settings" >> "$QTCONFIG.tmp"
8217     echo "MMP_RULES += \"ARMFPU $QT_CFLAGS_FPU\"" >> "$QTCONFIG.tmp"
8218 fi
8219
8220 if [ -n "$QMAKE_INCDIR_OPENGL_ES2" ]; then
8221     echo "#Qt opengl include path" >> "$QTCONFIG.tmp"
8222     echo "QMAKE_INCDIR_OPENGL_ES2 = \"$QMAKE_INCDIR_OPENGL_ES2\"" >> "$QTCONFIG.tmp"
8223 fi
8224
8225 # replace qconfig.pri if it differs from the newly created temp file
8226 if cmp -s "$QTCONFIG.tmp" "$QTCONFIG"; then
8227     rm -f "$QTCONFIG.tmp"
8228 else
8229     mv -f "$QTCONFIG.tmp" "$QTCONFIG"
8230 fi
8231
8232 #-------------------------------------------------------------------------------
8233 # save configuration into qmodule.pri
8234 #-------------------------------------------------------------------------------
8235 QTMODULE="$outpath/mkspecs/qmodule.pri"
8236
8237 # Ensure we can link to uninistalled libraries
8238 if [ "$XPLATFORM_MINGW" != "yes" ] && [ "$CFG_EMBEDDED" != "nacl" ] && linkerSupportsFlag -rpath-link "$outpath/lib"; then
8239     echo "QMAKE_LFLAGS    = -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib \$\$QMAKE_LFLAGS" >> "$QTMODULE.tmp"
8240 fi
8241 if [ -n "$QT_CFLAGS_PSQL" ]; then
8242     echo "QT_CFLAGS_PSQL   = $QT_CFLAGS_PSQL" >> "$QTMODULE.tmp"
8243 fi
8244 if [ -n "$QT_LFLAGS_PSQL" ]; then
8245     echo "QT_LFLAGS_PSQL   = $QT_LFLAGS_PSQL" >> "$QTMODULE.tmp"
8246 fi
8247 if [ -n "$QT_CFLAGS_MYSQL" ]; then
8248     echo "QT_CFLAGS_MYSQL   = $QT_CFLAGS_MYSQL" >> "$QTMODULE.tmp"
8249 fi
8250 if [ -n "$QT_LFLAGS_MYSQL" ]; then
8251     echo "QT_LFLAGS_MYSQL   = $QT_LFLAGS_MYSQL" >> "$QTMODULE.tmp"
8252 fi
8253 if [ -n "$QT_CFLAGS_SQLITE" ]; then
8254     echo "QT_CFLAGS_SQLITE   = $QT_CFLAGS_SQLITE" >> "$QTMODULE.tmp"
8255 fi
8256 if [ -n "$QT_LFLAGS_SQLITE" ]; then
8257     echo "QT_LFLAGS_SQLITE   = $QT_LFLAGS_SQLITE" >> "$QTMODULE.tmp"
8258 fi
8259 if [ -n "$QT_LFLAGS_ODBC" ]; then
8260     echo "QT_LFLAGS_ODBC   = $QT_LFLAGS_ODBC" >> "$QTMODULE.tmp"
8261 fi
8262 if [ -n "$QT_LFLAGS_TDS" ]; then
8263     echo "QT_LFLAGS_TDS   = $QT_LFLAGS_TDS" >> "$QTMODULE.tmp"
8264 fi
8265
8266 if [ "$QT_EDITION" != "QT_EDITION_OPENSOURCE" ]; then
8267     echo "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" >> "$QTMODULE.tmp"
8268 fi
8269
8270 #dump in the OPENSSL_LIBS info
8271 if [ '!' -z "$OPENSSL_LIBS" ]; then
8272     echo "OPENSSL_LIBS = $OPENSSL_LIBS" >> "$QTMODULE.tmp"
8273 elif [ "$CFG_OPENSSL" = "linked" ]; then
8274     echo "OPENSSL_LIBS = -lssl -lcrypto" >> "$QTMODULE.tmp"
8275 fi
8276
8277 #dump in the SDK info
8278 if [ '!' -z "$CFG_SDK" ]; then
8279    echo "QMAKE_MAC_SDK = $CFG_SDK" >> "$QTMODULE.tmp"
8280 fi
8281
8282 # mac gcc -Xarch support
8283 if [ "$CFG_MAC_XARCH" = "no" ]; then
8284    echo "QMAKE_MAC_XARCH = no" >> "$QTMODULE.tmp"
8285 fi
8286
8287 # cmdline args
8288 cat "$QMAKE_VARS_FILE" >> "$QTMODULE.tmp"
8289 rm -f "$QMAKE_VARS_FILE" 2>/dev/null
8290
8291 # replace qmodule.pri if it differs from the newly created temp file
8292 if cmp -s "$QTMODULE.tmp" "$QTMODULE"; then
8293     rm -f "$QTMODULE.tmp"
8294 else
8295     mv -f "$QTMODULE.tmp" "$QTMODULE"
8296 fi
8297
8298 #-------------------------------------------------------------------------------
8299 # save configuration into .qmake.cache
8300 #-------------------------------------------------------------------------------
8301
8302 CACHEFILE="$outpath/.qmake.cache"
8303 [ -f "$CACHEFILE.tmp" ] && rm -f "$CACHEFILE.tmp"
8304 cat >>"$CACHEFILE.tmp" <<EOF
8305 #paths
8306 QT_SOURCE_TREE = \$\$quote($relpath)
8307 QT_BUILD_TREE = \$\$quote($outpath)
8308 QT_BUILD_PARTS = $CFG_BUILD_PARTS
8309
8310 #local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR
8311 QMAKE_MOC        = \$\$QT_BUILD_TREE/bin/moc
8312 QMAKE_UIC        = \$\$QT_BUILD_TREE/bin/uic
8313 QMAKE_RCC        = \$\$QT_BUILD_TREE/bin/rcc
8314 QMAKE_QDBUSXML2CPP = \$\$QT_BUILD_TREE/bin/qdbusxml2cpp
8315 QMAKE_INCDIR_QT  = \$\$QT_BUILD_TREE/include
8316 QMAKE_LIBDIR_QT  = \$\$QT_BUILD_TREE/lib
8317
8318 include(\$\$PWD/mkspecs/qmodule.pri)
8319 CONFIG += $QMAKE_CONFIG dylib create_prl link_prl depend_includepath fix_output_dirs no_private_qt_headers_warning QTDIR_build
8320 QMAKE_ABSOLUTE_SOURCE_ROOT = \$\$QT_SOURCE_TREE
8321 QMAKE_MOC_SRC    = \$\$QT_BUILD_TREE/src/moc
8322
8323 EOF
8324
8325 #dump the qmake spec
8326 if [ -d "$outpath/mkspecs/$XPLATFORM" ]; then
8327    echo "QMAKESPEC = \$\$QT_BUILD_TREE/mkspecs/$XPLATFORM" >> "$CACHEFILE.tmp"
8328 else
8329    echo "QMAKESPEC = $XPLATFORM" >> "$CACHEFILE.tmp"
8330 fi
8331
8332 # incrementals
8333 INCREMENTAL=""
8334 [ "$CFG_INCREMENTAL" = "auto" ] && "$WHICH" p4 >/dev/null 2>&1 && [ "$CFG_DEV" = "yes" ] && CFG_INCREMENTAL="yes"
8335 if [ "$CFG_INCREMENTAL" = "yes" ]; then
8336     find "$relpath" -perm u+w -mtime -3 | grep 'cpp$' | while read f; do
8337         # don't need to worry about generated files
8338         [ -r `echo $f | sed "s,cpp$,ui,"` ] && continue
8339         basename "$f" | grep '^moc_' >/dev/null 2>&1 && continue
8340         # done
8341         INCREMENTAL="$INCREMENTAL `basename \"$f\" | sed 's,.cpp,.o,'`"
8342     done
8343     [ '!' -z "$INCREMENTAL" ] && echo "QMAKE_INCREMENTAL += $INCREMENTAL" >> "$CACHEFILE.tmp"
8344     [ -r "$outpath/.qmake.incremental" ] && echo "include($outpath/.qmake.incremental)" >> "$CACHEFILE.tmp"
8345 fi
8346
8347 # replace .qmake.cache if it differs from the newly created temp file
8348 if cmp -s "$CACHEFILE.tmp" "$CACHEFILE"; then
8349     rm -f "$CACHEFILE.tmp"
8350 else
8351     mv -f "$CACHEFILE.tmp" "$CACHEFILE"
8352 fi
8353
8354 #-------------------------------------------------------------------------------
8355 # give feedback on configuration
8356 #-------------------------------------------------------------------------------
8357
8358 case "$COMPILER" in
8359 g++*)
8360     if [ "$CFG_EXCEPTIONS" != "no" ]; then
8361         cat <<EOF
8362
8363         This target is using the GNU C++ compiler ($PLATFORM).
8364
8365         Recent versions of this compiler automatically include code for
8366         exceptions, which increase both the size of the Qt libraries and
8367         the amount of memory taken by your applications.
8368
8369         You may choose to re-run `basename $0` with the -no-exceptions
8370         option to compile Qt without exceptions. This is completely binary
8371         compatible, and existing applications will continue to work.
8372
8373 EOF
8374     fi
8375     ;;
8376 cc*)
8377     case "$PLATFORM" in
8378     irix-cc*)
8379         if [ "$CFG_EXCEPTIONS" != "no" ]; then
8380             cat <<EOF
8381
8382         This target is using the MIPSpro C++ compiler ($PLATFORM).
8383
8384         You may choose to re-run `basename $0` with the -no-exceptions
8385         option to compile Qt without exceptions. This will make the
8386         size of the Qt library smaller and reduce the amount of memory
8387         taken by your applications.
8388
8389 EOF
8390         fi
8391         ;;
8392     *) ;;
8393     esac
8394     ;;
8395 *) ;;
8396 esac
8397
8398 if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "no" ]  && [ "$CFG_WEBKIT" != "no" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
8399     cat <<EOF
8400         WARNING: DWARF2 debug symbols are not enabled. Linking webkit
8401         in debug mode will run out of memory on systems with 2GB or less.
8402         Install Xcode 2.4.1 or higher to enable DWARF2, or configure with
8403          -no-webkit or -release to skip webkit debug.
8404 EOF
8405 fi
8406
8407 echo
8408 if [ "$XPLATFORM" = "$PLATFORM" ]; then
8409     echo "Build type:    $PLATFORM"
8410 else
8411     echo "Building on:   $PLATFORM"
8412     echo "Building for:  $XPLATFORM"
8413 fi
8414
8415 if [ ! -z "$CFG_MAC_ARCHS" ]; then
8416     echo "Architecture:  $CFG_ARCH ($CFG_MAC_ARCHS )"
8417 else
8418     echo "Architecture:  $CFG_ARCH"
8419 fi
8420
8421 if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
8422     echo "Host architecture: $CFG_HOST_ARCH"
8423 fi
8424
8425 if [ "$PLATFORM_MAC" = "yes" ]; then
8426     if [ "$CFG_MAC_COCOA" = "yes" ]; then
8427         if [ "$CFG_MAC_CARBON" = "yes" ]; then
8428             echo "Using framework: Carbon for 32-bit, Cocoa for 64-bit"
8429         else
8430             echo "Using framework: Cocoa"
8431         fi
8432     else
8433         echo "Using framework: Carbon"
8434     fi
8435 fi
8436
8437 if [ -n "$PLATFORM_NOTES" ]; then
8438     echo "Platform notes:"
8439     echo "$PLATFORM_NOTES"
8440 else
8441     echo
8442 fi
8443
8444 if [ "$OPT_VERBOSE" = "yes" ]; then
8445     echo $ECHO_N "qmake vars .......... $ECHO_C"
8446     cat "$QMAKE_VARS_FILE" | tr '\n' ' '
8447     echo "qmake switches ......... $QMAKE_SWITCHES"
8448 fi
8449
8450 [ "$CFG_INCREMENTAL" = "yes" ] && [ '!' -z "$INCREMENTAL" ] && echo "Incremental ............ $INCREMENTAL"
8451 echo "Build .................. $CFG_BUILD_PARTS"
8452 echo "Configuration .......... $QMAKE_CONFIG $QT_CONFIG"
8453 if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
8454    echo "Debug .................. yes (combined)"
8455    if [ "$CFG_DEBUG" = "yes" ]; then
8456        echo "Default Link ........... debug"
8457    else
8458        echo "Default Link ........... release"
8459    fi
8460 else
8461    echo "Debug .................. $CFG_DEBUG"
8462 fi
8463 echo "Qt 3 compatibility ..... $CFG_QT3SUPPORT"
8464 [ "$CFG_DBUS" = "no" ]     && echo "QtDBus module .......... no"
8465 [ "$CFG_DBUS" = "yes" ]    && echo "QtDBus module .......... yes (run-time)"
8466 [ "$CFG_DBUS" = "linked" ] && echo "QtDBus module .......... yes (linked)"
8467 echo "QtConcurrent code ...... $CFG_CONCURRENT"
8468 echo "QtGui module ........... $CFG_GUI"
8469 echo "QtScript module ........ $CFG_SCRIPT"
8470 echo "QtScriptTools module ... $CFG_SCRIPTTOOLS"
8471 echo "QtXmlPatterns module ... $CFG_XMLPATTERNS"
8472 echo "Phonon module .......... $CFG_PHONON"
8473 echo "Multimedia module ...... $CFG_MULTIMEDIA"
8474 echo "SVG module ............. $CFG_SVG"
8475 case "$CFG_WEBKIT" in
8476     yes)   echo "WebKit module .......... yes" ;;
8477     debug) echo "WebKit module .......... yes (debug)" ;;
8478     no)    echo "WebKit module .......... no" ;;
8479 esac
8480 if [ "$CFG_WEBKIT" != "no" ] || [ "$CFG_SCRIPT" != "no" ]; then
8481     if [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
8482         echo "JavaScriptCore JIT ..... To be decided by JavaScriptCore"
8483     else
8484         echo "JavaScriptCore JIT ..... $CFG_JAVASCRIPTCORE_JIT"
8485     fi
8486 fi
8487 echo "V8 module .............. $CFG_V8"
8488 echo "Declarative module ..... $CFG_DECLARATIVE"
8489 if [ "$CFG_DECLARATIVE" = "yes" ]; then
8490     echo "Declarative debugging ...$CFG_DECLARATIVE_DEBUG"
8491 fi
8492 echo "Location module ........ $CFG_LOCATION"
8493 echo "Support for S60 ........ $CFG_S60"
8494 echo "Symbian DEF files ...... $CFG_SYMBIAN_DEFFILES"
8495 echo "STL support ............ $CFG_STL"
8496 echo "PCH support ............ $CFG_PRECOMPILE"
8497 echo "MMX/3DNOW/SSE/SSE2/SSE3. ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}/${CFG_SSE3}"
8498 echo "SSSE3/SSE4.1/SSE4.2..... ${CFG_SSSE3}/${CFG_SSE4_1}/${CFG_SSE4_2}"
8499 echo "AVX..................... ${CFG_AVX}"
8500 if [ "$CFG_ARCH" = "arm" ] || [ "$CFG_ARCH" = "armv6" ]; then
8501     echo "iWMMXt support ......... ${CFG_IWMMXT}"
8502     echo "NEON support ........... ${CFG_NEON}"
8503 fi
8504 [ "${PLATFORM_QWS}" != "yes" -a "${PLATFORM_QPA}" != "yes" ] && echo "Graphics System ........ $CFG_GRAPHICS_SYSTEM"
8505 echo "IPv6 ifname support .... $CFG_IPV6IFNAME"
8506 echo "getaddrinfo support .... $CFG_GETADDRINFO"
8507 echo "getifaddrs support ..... $CFG_GETIFADDRS"
8508 echo "Accessibility .......... $CFG_ACCESSIBILITY"
8509 echo "NIS support ............ $CFG_NIS"
8510 echo "CUPS support ........... $CFG_CUPS"
8511 echo "Iconv support .......... $CFG_ICONV"
8512 echo "Glib support ........... $CFG_GLIB"
8513 echo "GStreamer support ...... $CFG_GSTREAMER"
8514 echo "PulseAudio support ..... $CFG_PULSEAUDIO"
8515 echo "Large File support ..... $CFG_LARGEFILE"
8516 echo "GIF support ............ $CFG_GIF"
8517 if [ "$CFG_TIFF" = "no" ]; then
8518     echo "TIFF support ........... $CFG_TIFF"
8519 else
8520     echo "TIFF support ........... $CFG_TIFF ($CFG_LIBTIFF)"
8521 fi
8522 if [ "$CFG_JPEG" = "no" ]; then
8523     echo "JPEG support ........... $CFG_JPEG"
8524 else
8525     echo "JPEG support ........... $CFG_JPEG ($CFG_LIBJPEG)"
8526 fi
8527 if [ "$CFG_PNG" = "no" ]; then
8528     echo "PNG support ............ $CFG_PNG"
8529 else
8530     echo "PNG support ............ $CFG_PNG ($CFG_LIBPNG)"
8531 fi
8532 if [ "$CFG_MNG" = "no" ]; then
8533     echo "MNG support ............ $CFG_MNG"
8534 else
8535     echo "MNG support ............ $CFG_MNG ($CFG_LIBMNG)"
8536 fi
8537 echo "zlib support ........... $CFG_ZLIB"
8538 echo "Session management ..... $CFG_SM"
8539 if [ "$PLATFORM_QWS" = "yes" ]; then
8540     echo "Embedded support ....... $CFG_EMBEDDED"
8541     if [ "$CFG_QWS_FREETYPE" = "auto" ]; then
8542         echo "Freetype2 support ...... $CFG_QWS_FREETYPE ($CFG_LIBFREETYPE)"
8543     else
8544         echo "Freetype2 support ...... $CFG_QWS_FREETYPE"
8545     fi
8546     # Normalize the decoration output first
8547     CFG_GFX_ON=`echo ${CFG_GFX_ON}`
8548     CFG_GFX_PLUGIN=`echo ${CFG_GFX_PLUGIN}`
8549     echo "Graphics (qt) .......... ${CFG_GFX_ON}"
8550     echo "Graphics (plugin) ...... ${CFG_GFX_PLUGIN}"
8551     CFG_DECORATION_ON=`echo ${CFG_DECORATION_ON}`
8552     CFG_DECORATION_PLUGIN=`echo ${CFG_DECORATION_PLUGIN}`
8553     echo "Decorations (qt) ....... $CFG_DECORATION_ON"
8554     echo "Decorations (plugin) ... $CFG_DECORATION_PLUGIN"
8555     CFG_KBD_ON=`echo ${CFG_KBD_ON}`
8556     CFG_KBD_PLUGIN=`echo ${CFG_KBD_PLUGIN}`
8557     echo "Keyboard driver (qt) ... ${CFG_KBD_ON}"
8558     echo "Keyboard driver (plugin) .. ${CFG_KBD_PLUGIN}"
8559     CFG_MOUSE_ON=`echo ${CFG_MOUSE_ON}`
8560     CFG_MOUSE_PLUGIN=`echo ${CFG_MOUSE_PLUGIN}`
8561     echo "Mouse driver (qt) ...... $CFG_MOUSE_ON"
8562     echo "Mouse driver (plugin) .. $CFG_MOUSE_PLUGIN"
8563 fi
8564 if [ "$CFG_OPENGL" = "desktop" ]; then
8565     echo "OpenGL support ......... yes (Desktop OpenGL)"
8566 elif [ "$CFG_OPENGL" = "es2" ]; then
8567     echo "OpenGL support ......... yes (OpenGL ES 2.x)"
8568 else
8569     echo "OpenGL support ......... no"
8570 fi
8571 if [ "$CFG_EGL" != "no" ]; then
8572     if [ "$CFG_EGL_GLES_INCLUDES" = "yes" ]; then
8573         echo "EGL support ............ yes <GLES/egl.h>"
8574     else
8575         echo "EGL support ............ yes <EGL/egl.h>"
8576     fi
8577 fi
8578 if [ "$CFG_OPENVG" ]; then
8579     if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
8580         echo "OpenVG support ......... ShivaVG"
8581     else
8582         echo "OpenVG support ......... $CFG_OPENVG"
8583     fi
8584 fi
8585 if [ "$PLATFORM_X11" = "yes" ]; then
8586     echo "NAS sound support ...... $CFG_NAS"
8587     echo "XShape support ......... $CFG_XSHAPE"
8588     echo "XVideo support ......... $CFG_XVIDEO"
8589     echo "XSync support .......... $CFG_XSYNC"
8590     echo "Xinerama support ....... $CFG_XINERAMA"
8591     echo "Xcursor support ........ $CFG_XCURSOR"
8592     echo "Xfixes support ......... $CFG_XFIXES"
8593     echo "Xrandr support ......... $CFG_XRANDR"
8594     echo "Xrender support ........ $CFG_XRENDER"
8595     echo "Xi support ............. $CFG_XINPUT"
8596     echo "MIT-SHM support ........ $CFG_MITSHM"
8597     echo "FontConfig support ..... $CFG_FONTCONFIG"
8598     echo "XKB Support ............ $CFG_XKB"
8599     echo "immodule support ....... $CFG_IM"
8600     echo "GTK theme support ...... $CFG_QGTKSTYLE"
8601 fi
8602 [ "$CFG_SQL_mysql" != "no" ] && echo "MySQL support .......... $CFG_SQL_mysql"
8603 [ "$CFG_SQL_psql" != "no" ] && echo "PostgreSQL support ..... $CFG_SQL_psql"
8604 [ "$CFG_SQL_odbc" != "no" ] && echo "ODBC support ........... $CFG_SQL_odbc"
8605 [ "$CFG_SQL_oci" != "no" ] && echo "OCI support ............ $CFG_SQL_oci"
8606 [ "$CFG_SQL_tds" != "no" ] && echo "TDS support ............ $CFG_SQL_tds"
8607 [ "$CFG_SQL_db2" != "no" ] && echo "DB2 support ............ $CFG_SQL_db2"
8608 [ "$CFG_SQL_ibase" != "no" ] && echo "InterBase support ...... $CFG_SQL_ibase"
8609 [ "$CFG_SQL_sqlite2" != "no" ] && echo "SQLite 2 support ....... $CFG_SQL_sqlite2"
8610 [ "$CFG_SQL_sqlite" != "no" ] && echo "SQLite support ......... $CFG_SQL_sqlite ($CFG_SQLITE)"
8611
8612 OPENSSL_LINKAGE=""
8613 if [ "$CFG_OPENSSL" = "yes" ]; then
8614     OPENSSL_LINKAGE="(run-time)"
8615 elif [ "$CFG_OPENSSL" = "linked" ]; then
8616     OPENSSL_LINKAGE="(linked)"
8617 fi
8618 echo "OpenSSL support ........ $CFG_OPENSSL $OPENSSL_LINKAGE"
8619 echo "Alsa support ........... $CFG_ALSA"
8620 if [ "$PLATFORM_MAC" = "yes" ]; then
8621     echo "CoreWlan support ....... $CFG_COREWLAN"
8622 fi
8623 echo "ICD support ............ $CFG_ICD"
8624 echo "libICU support ......... $CFG_ICU"
8625 if [ "$CFG_XCB_LIMITED" = "yes" ] && [ "$CFG_XCB" = "yes" ]; then
8626     echo "Xcb support ............ limited (old version)"
8627 else
8628     echo "Xcb support ............ $CFG_XCB"
8629 fi
8630 echo
8631
8632 [ "$CFG_PTMALLOC" != "no" ] && echo "Use ptmalloc ........... $CFG_PTMALLOC"
8633
8634 # complain about not being able to use dynamic plugins if we are using a static build
8635 if [ "$CFG_SHARED" = "no" ]; then
8636     echo
8637     echo "WARNING: Using static linking will disable the use of dynamically"
8638     echo "loaded plugins. Make sure to import all needed static plugins,"
8639     echo "or compile needed modules into the library."
8640     echo
8641 fi
8642 if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then
8643     echo
8644     echo "NOTE: When linking against OpenSSL, you can override the default"
8645     echo "library names through OPENSSL_LIBS."
8646     echo "For example:"
8647     echo "    OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked"
8648     echo
8649 fi
8650 if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then
8651     echo
8652     echo "Error: debug-only framework builds are not supported. Configure with -no-framework"
8653     echo "if you want a pure debug build."
8654     echo
8655     exit 1
8656 fi
8657
8658 sepath=`echo "$relpath" | sed -e 's/\\./\\\\./g'`
8659 PROCS=1
8660 EXEC=""
8661
8662
8663 #-------------------------------------------------------------------------------
8664 # build makefiles based on the configuration
8665 #-------------------------------------------------------------------------------
8666
8667 echo "Finding project files. Please wait..."
8668 if [ "$CFG_NOPROCESS" != "yes" ]; then
8669     "$outpath/bin/qmake" -prl -r "${relpath}/qtbase.pro"
8670     if [ -f "${relpath}/qtbase.pro" ]; then
8671         mkfile="${outpath}/Makefile"
8672         [ -f "$mkfile" ] && chmod +w "$mkfile"
8673         QTDIR="$outpath" "$outpath/bin/qmake" -spec "$XQMAKESPEC" "${relpath}/qtbase.pro" -o "$mkfile"
8674     fi
8675 fi
8676
8677 # .projects      -> projects to process
8678 # .projects.1    -> qt and moc
8679 # .projects.2    -> subdirs and libs
8680 # .projects.3    -> the rest
8681 rm -f .projects .projects.1 .projects.2 .projects.3
8682
8683 QMAKE_PROJECTS=`find "$relpath/." -name '*.pro' -print | sed 's-/\./-/-'`
8684 if [ -z "$AWK" ]; then
8685     for p in `echo $QMAKE_PROJECTS`; do
8686         echo "$p" >> .projects
8687     done
8688 else
8689     cat >projects.awk <<EOF
8690 BEGIN {
8691     files = 0
8692     target_file = ""
8693     input_file = ""
8694
8695     first = "./.projects.1.tmp"
8696     second = "./.projects.2.tmp"
8697     third = "./.projects.3.tmp"
8698 }
8699
8700 FNR == 1 {
8701     if ( input_file ) {
8702         if ( ! target_file )
8703             target_file = third
8704         print input_file >target_file
8705     }
8706
8707     matched_target = 0
8708     template_lib = 0
8709     input_file = FILENAME
8710     target_file = ""
8711 }
8712
8713 /^(TARGET.*=)/ {
8714     if ( \$3 == "moc" || \$3 ~ /^Qt/ ) {
8715         target_file = first
8716         matched_target = 1
8717     } else if ( \$3 == "lrelease" || \$3 == "qm_phony_target" ) {
8718         target_file = second
8719         matched_target = 1
8720     }
8721 }
8722
8723 matched_target == 0 && /^(TEMPLATE.*=)/ {
8724     if ( \$3 == "subdirs" )
8725         target_file = second
8726     else if ( \$3 == "lib" )
8727         template_lib = 1
8728     else
8729         target_file = third
8730 }
8731
8732 matched_target == 0 && template_lib == 1 && /^(CONFIG.*=)/ {
8733     if ( \$0 ~ /plugin/ )
8734         target_file = third
8735     else
8736         target_file = second
8737 }
8738
8739 END {
8740     if ( input_file ) {
8741         if ( ! target_file )
8742             target_file = third
8743         print input_file >>target_file
8744     }
8745 }
8746
8747 EOF
8748
8749     rm -f .projects.all
8750     for p in `echo $QMAKE_PROJECTS`; do
8751        echo "$p" >> .projects.all
8752     done
8753
8754     # if you get errors about the length of the command line to awk, change the -l arg
8755     # to split below
8756     split -l 100 .projects.all .projects.all.
8757     for p in .projects.all.*; do
8758        "$AWK" -f projects.awk `cat $p`
8759        [ -f .projects.1.tmp ] && cat .projects.1.tmp >> .projects.1
8760        [ -f .projects.2.tmp ] && cat .projects.2.tmp >> .projects.2
8761        [ -f .projects.3.tmp ] && cat .projects.3.tmp >> .projects.3
8762        rm -f .projects.1.tmp .projects.2.tmp .projects.3.tmp $p
8763     done
8764     rm -f .projects.all* projects.awk
8765
8766     [ -f .projects.1 ] && cat .projects.1 >>.projects
8767     [ -f .projects.2 ] && cat .projects.2 >>.projects
8768     rm -f .projects.1 .projects.2
8769     if [ -f .projects.3 ] && [ "$OPT_FAST" = "no" ]; then
8770        cat .projects.3 >>.projects
8771        rm -f .projects.3
8772     fi
8773 fi
8774 # don't sort Qt and MOC in with the other project files
8775 # also work around a segfaulting uniq(1)
8776 if [ -f .sorted.projects.2 ]; then
8777     sort .sorted.projects.2 > .sorted.projects.2.new
8778     mv -f .sorted.projects.2.new .sorted.projects.2
8779     cat .sorted.projects.2 >> .sorted.projects.1
8780 fi
8781 [ -f .sorted.projects.1 ] && sort .sorted.projects.1 >> .sorted.projects
8782 rm -f .sorted.projects.2 .sorted.projects.1
8783
8784 NORM_PROJECTS=0
8785 FAST_PROJECTS=0
8786 if [ -f .projects ]; then
8787    uniq .projects >.tmp
8788    mv -f .tmp .projects
8789    NORM_PROJECTS=`cat .projects | wc -l | sed -e "s, ,,g"`
8790 fi
8791 if [ -f .projects.3 ]; then
8792    uniq .projects.3 >.tmp
8793    mv -f .tmp .projects.3
8794    FAST_PROJECTS=`cat .projects.3 | wc -l | sed -e "s, ,,g"`
8795 fi
8796 echo "  `expr $NORM_PROJECTS + $FAST_PROJECTS` projects found."
8797 echo
8798
8799 PART_ROOTS=
8800 for part in $CFG_BUILD_PARTS; do
8801     case "$part" in
8802     tools) PART_ROOTS="$PART_ROOTS tools" ;;
8803     libs) PART_ROOTS="$PART_ROOTS src tools/linguist/lrelease" ;;
8804     translations) PART_ROOTS="$PART_ROOTS translations" ;;
8805     examples) PART_ROOTS="$PART_ROOTS examples" ;;
8806     *) ;;
8807     esac
8808 done
8809
8810 if [ "$CFG_DEV" = "yes" ]; then
8811     PART_ROOTS="$PART_ROOTS tests"
8812 fi
8813
8814 echo "Creating makefiles. Please wait..."
8815 for file in .projects .projects.3; do
8816     [ '!' -f "$file" ] && continue
8817     for a in `cat $file`; do
8818         IN_ROOT=no
8819         for r in $PART_ROOTS; do
8820             if echo "$a" | grep "^$r" >/dev/null 2>&1 || echo "$a" | grep "^$relpath/$r" >/dev/null 2>&1; then
8821                 IN_ROOT=yes
8822                 break
8823             fi
8824         done
8825         [ "$IN_ROOT" = "no" ] && continue
8826
8827         case $a in
8828         *winmain/winmain.pro)
8829             if [ "$CFG_NOPROCESS" = "yes" ] || [ "$XPLATFORM_MINGW" != "yes" ]; then
8830                 continue
8831             fi
8832             SPEC=$XQMAKESPEC ;;
8833         *s60main/s60main.pro)
8834             if [ "$CFG_NOPROCESS" = "yes" ] || [ "$XPLATFORM_SYMBIAN" != "yes" ]; then
8835                 continue
8836             fi;;
8837         *examples/activeqt/*) continue ;;
8838         */qmake/qmake.pro) continue ;;
8839         *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*|*linguist/lrelease*) SPEC=$QMAKESPEC ;;
8840         *) if [ "$CFG_NOPROCESS" = "yes" ]; then
8841               continue
8842            else
8843               SPEC=$XQMAKESPEC
8844            fi;;
8845         esac
8846         dir=`dirname "$a" | sed -e "s;$sepath;.;g"`
8847         test -d "$dir" || mkdir -p "$dir"
8848         OUTDIR="$outpath/$dir"
8849         if [ -f "${OUTDIR}/Makefile" ] && [ "$OPT_FAST" = "yes" ]; then
8850             # fast configure - the makefile exists, skip it
8851             # since the makefile exists, it was generated by qmake, which means we
8852             # can skip it, since qmake has a rule to regenerate the makefile if the .pro
8853             # file changes...
8854             [ "$OPT_VERBOSE" = "yes" ] && echo "  skipping $a"
8855             continue;
8856         fi
8857         QMAKE_SPEC_ARGS="-spec $SPEC"
8858         echo $ECHO_N "  for $a$ECHO_C"
8859
8860         QMAKE="$outpath/bin/qmake"
8861         QMAKE_ARGS="$QMAKE_SWITCHES $QMAKE_SPEC_ARGS"
8862         if [ "$file" = ".projects.3" ]; then
8863             echo " (fast)"
8864
8865             cat >"${OUTDIR}/Makefile" <<EOF
8866 # ${OUTDIR}/Makefile: generated by configure
8867 #
8868 # WARNING: This makefile will be replaced with a real makefile.
8869 # All changes made to this file will be lost.
8870 EOF
8871             [ "$CFG_DEBUG_RELEASE" = "no" ] && echo "first_target: first" >>${OUTDIR}/Makefile
8872
8873             cat >>"${OUTDIR}/Makefile" <<EOF
8874 QMAKE = "$QMAKE"
8875 all clean install qmake first Makefile: FORCE
8876         \$(QMAKE) $QMAKE_ARGS -o "$OUTDIR" "$a"
8877         cd "$OUTDIR"
8878         \$(MAKE) \$@
8879
8880 FORCE:
8881
8882 EOF
8883         else
8884             if [ "$OPT_VERBOSE" = "yes" ]; then
8885                 echo " (`basename $SPEC`)"
8886                 echo "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
8887             else
8888                 echo
8889             fi
8890
8891             [ -f "${OUTDIR}/Makefile" ] && chmod +w "${OUTDIR}/Makefile"
8892             QTDIR="$outpath" "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
8893        fi
8894     done
8895 done
8896 rm -f .projects .projects.3
8897
8898 #-------------------------------------------------------------------------------
8899 # check for platforms that we don't yet know about
8900 #-------------------------------------------------------------------------------
8901 if [ "$CFG_ARCH" = "generic" ]; then
8902 cat <<EOF
8903
8904         NOTICE: Atomic operations are not yet supported for this
8905         architecture.
8906
8907         Qt will use the 'generic' architecture instead, which uses a
8908         single pthread_mutex_t to protect all atomic operations. This
8909         implementation is the slow (but safe) fallback implementation
8910         for architectures Qt does not yet support.
8911 EOF
8912 fi
8913
8914 #-------------------------------------------------------------------------------
8915 # check if the user passed the -no-zlib option, which is no longer supported
8916 #-------------------------------------------------------------------------------
8917 if [ -n "$ZLIB_FORCED" ]; then
8918     which_zlib="supplied"
8919     if [ "$CFG_ZLIB" = "system" ]; then
8920         which_zlib="system"
8921     fi
8922
8923 cat <<EOF
8924
8925         NOTICE: The -no-zlib option was supplied but is no longer
8926         supported.
8927
8928         Qt now requires zlib support in all builds, so the -no-zlib
8929         option was ignored. Qt will be built using the $which_zlib
8930         zlib.
8931 EOF
8932 fi
8933
8934 #-------------------------------------------------------------------------------
8935 # finally save the executed command to another script
8936 #-------------------------------------------------------------------------------
8937 if [ `basename $0` != "config.status" ]; then
8938     CONFIG_STATUS="$relpath/$relconf $OPT_CMDLINE"
8939
8940     # add the system variables
8941     for varname in $SYSTEM_VARIABLES; do
8942         cmd=`echo \
8943 'if [ -n "\$'${varname}'" ]; then
8944     CONFIG_STATUS="'${varname}'='"'\\\$${varname}'"' \$CONFIG_STATUS"
8945 fi'`
8946         eval "$cmd"
8947     done
8948
8949     echo "$CONFIG_STATUS" | grep '\-confirm\-license' >/dev/null 2>&1 || CONFIG_STATUS="$CONFIG_STATUS -confirm-license"
8950
8951     [ -f "$outpath/config.status" ] && rm -f "$outpath/config.status"
8952     echo "#!/bin/sh" > "$outpath/config.status"
8953     echo "if [ \"\$#\" -gt 0 ]; then" >> "$outpath/config.status"
8954     echo "  $CONFIG_STATUS \"\$@\"" >> "$outpath/config.status"
8955     echo "else" >> "$outpath/config.status"
8956     echo "  $CONFIG_STATUS" >> "$outpath/config.status"
8957     echo "fi" >> "$outpath/config.status"
8958     chmod +x "$outpath/config.status"
8959 fi
8960
8961 if [ -n "$RPATH_MESSAGE" ]; then
8962     echo
8963     echo "$RPATH_MESSAGE"
8964 fi
8965
8966 MAKE=`basename "$MAKE"`
8967 echo
8968 echo Qt is now configured for building. Just run \'$MAKE\'.
8969 if [ "$relpath" = "$QT_INSTALL_PREFIX" ]; then
8970     echo Once everything is built, Qt is installed.
8971     echo You should not run \'$MAKE install\'.
8972 else
8973     echo Once everything is built, you must run \'$MAKE install\'.
8974     echo Qt will be installed into $QT_INSTALL_PREFIX
8975 fi
8976 echo
8977 echo To reconfigure, run \'$MAKE confclean\' and \'configure\'.
8978 echo