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