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