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