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