Add module specific pris, and make syncqt create fwd includes
[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 qt3support"
6962 fi
6963
6964 # enable Phonon
6965 if [ "$CFG_PHONON" = "yes" ]; then
6966     QT_CONFIG="$QT_CONFIG phonon"
6967     if [ "$CFG_PHONON_BACKEND" = "yes" ]; then
6968         QT_CONFIG="$QT_CONFIG phonon-backend"
6969     fi
6970 else
6971     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_PHONON"
6972 fi
6973
6974 # disable accessibility
6975 if [ "$CFG_ACCESSIBILITY" = "no" ]; then
6976     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ACCESSIBILITY"
6977 else
6978     QT_CONFIG="$QT_CONFIG accessibility"
6979 fi
6980
6981 # egl stuff does not belong in lighthouse, but rather in plugins
6982 if [ "$PLATFORM_QPA" = "yes" ]; then
6983     CFG_EGL="no"
6984 fi
6985
6986 # enable egl
6987 if [ "$CFG_EGL" = "no" ]; then
6988     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGL"
6989 else
6990     QT_CONFIG="$QT_CONFIG egl"
6991     if [ "$CFG_EGL_GLES_INCLUDES" = "yes" ]; then
6992         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GLES_EGL"
6993     fi
6994 fi
6995
6996 # enable openvg
6997 if [ "$CFG_OPENVG" = "no" ]; then
6998     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENVG"
6999 else
7000     QT_CONFIG="$QT_CONFIG openvg"
7001     if [ "$CFG_OPENVG_LC_INCLUDES" = "yes" ]; then
7002         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LOWER_CASE_VG_INCLUDES"
7003     fi
7004     if [ "$CFG_OPENVG_ON_OPENGL" = "yes" ]; then
7005         QT_CONFIG="$QT_CONFIG openvg_on_opengl"
7006     fi
7007     if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
7008         QT_CONFIG="$QT_CONFIG shivavg"
7009         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SHIVAVG"
7010     fi
7011 fi
7012
7013 if [ "$CFG_QS60STYLE" = "no" ]; then
7014     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STYLE_S60"
7015 else
7016     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_STYLE_S60"
7017 fi
7018
7019 # Just check if OpenGL is not set by command argumets for Symbian.
7020 if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
7021         if [ "$CFG_OPENGL" = "auto" ]; then
7022             CFG_OPENGL="no"
7023         fi
7024 fi
7025
7026 # enable opengl
7027 if [ "$CFG_OPENGL" = "no" ]; then
7028     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENGL"
7029 else
7030     QT_CONFIG="$QT_CONFIG opengl"
7031 fi
7032
7033 if [ "$CFG_OPENGL" = "es1" ] || [ "$CFG_OPENGL" = "es2" ]; then
7034     if [ "$PLATFORM_QWS" = "yes" ]; then
7035         QCONFIG_FLAGS="$QCONFIG_FLAGS Q_BACKINGSTORE_SUBSURFACES"
7036     fi
7037     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES"
7038 fi
7039
7040 if [ "$CFG_OPENGL" = "es1" ]; then
7041     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_1"
7042     QT_CONFIG="$QT_CONFIG opengles1"
7043 fi
7044
7045 if [ "$CFG_OPENGL" = "es2" ]; then
7046     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_2"
7047     QT_CONFIG="$QT_CONFIG opengles2"
7048 fi
7049
7050 # safe execution environment
7051 if [ "$CFG_SXE" != "no" ]; then
7052     QT_CONFIG="$QT_CONFIG sxe"
7053 fi
7054
7055 # build up the variables for output
7056 if [ "$CFG_DEBUG" = "yes" ]; then
7057     QMAKE_OUTDIR="${QMAKE_OUTDIR}debug"
7058     QMAKE_CONFIG="$QMAKE_CONFIG debug"
7059 elif [ "$CFG_DEBUG" = "no" ]; then
7060     QMAKE_OUTDIR="${QMAKE_OUTDIR}release"
7061     QMAKE_CONFIG="$QMAKE_CONFIG release"
7062 fi
7063 if [ "$CFG_SHARED" = "yes" ]; then
7064     QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared"
7065     QMAKE_CONFIG="$QMAKE_CONFIG shared dll"
7066 elif [ "$CFG_SHARED" = "no" ]; then
7067     QMAKE_OUTDIR="${QMAKE_OUTDIR}-static"
7068     QMAKE_CONFIG="$QMAKE_CONFIG static"
7069 fi
7070 if [ "$PLATFORM_QWS" = "yes" ]; then
7071     QMAKE_OUTDIR="${QMAKE_OUTDIR}-emb-$CFG_EMBEDDED"
7072     QMAKE_CONFIG="$QMAKE_CONFIG embedded"
7073     QT_CONFIG="$QT_CONFIG embedded"
7074     rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
7075 fi
7076 if [ "$PLATFORM_QPA" = "yes" ]; then
7077     QMAKE_CONFIG="$QMAKE_CONFIG qpa"
7078     QT_CONFIG="$QT_CONFIG qpa"
7079     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qpa"
7080     rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
7081 fi
7082
7083 if [ "$CFG_EMBEDDED" = "nacl" ]; then
7084     QMAKE_CONFIG="$QMAKE_CONFIG nacl pepper"
7085     QT_CONFIG="$QT_CONFIG nacl pepper"
7086     rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
7087 fi
7088
7089 if [ "$XPLATFORM_MINGW" != "yes" ]; then
7090     # Do not set this here for Windows. Let qmake do it so
7091     # debug and release precompiled headers are kept separate.
7092     QMakeVar set PRECOMPILED_DIR ".pch/$QMAKE_OUTDIR"
7093 fi
7094 QMakeVar set OBJECTS_DIR ".obj/$QMAKE_OUTDIR"
7095 QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR"
7096 QMakeVar set RCC_DIR ".rcc/$QMAKE_OUTDIR"
7097 QMakeVar set UI_DIR ".uic/$QMAKE_OUTDIR"
7098 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
7099     QMAKE_CONFIG="$QMAKE_CONFIG largefile"
7100 fi
7101 if [ "$CFG_STL" = "no" ]; then
7102     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STL"
7103 else
7104     QMAKE_CONFIG="$QMAKE_CONFIG stl"
7105 fi
7106 if [ "$CFG_USE_GNUMAKE" = "yes" ]; then
7107     QMAKE_CONFIG="$QMAKE_CONFIG GNUmake"
7108 fi
7109 [ "$CFG_REDUCE_EXPORTS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_exports"
7110 [ "$CFG_REDUCE_RELOCATIONS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_relocations"
7111 [ "$CFG_PRECOMPILE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG precompile_header"
7112 if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
7113     QMakeVar add QMAKE_CFLAGS -g
7114     QMakeVar add QMAKE_CXXFLAGS -g
7115     QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info"
7116 fi
7117 if [ "$CFG_SEPARATE_DEBUG_INFO_NOCOPY" = "yes" ] ; then
7118     QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info_nocopy"
7119 fi
7120 [ "$CFG_MMX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mmx"
7121 [ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow"
7122 [ "$CFG_SSE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse"
7123 [ "$CFG_SSE2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse2"
7124 [ "$CFG_SSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse3"
7125 [ "$CFG_SSSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG ssse3"
7126 [ "$CFG_SSE4_1" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_1"
7127 [ "$CFG_SSE4_2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_2"
7128 [ "$CFG_AVX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG avx"
7129 [ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt"
7130 [ "$CFG_NEON" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG neon"
7131 [ "$PLATFORM_MAC" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG $CFG_MAC_ARCHS"
7132 if [ "$CFG_IPV6" = "yes" ]; then
7133     QT_CONFIG="$QT_CONFIG ipv6"
7134 fi
7135 if [ "$CFG_CLOCK_GETTIME" = "yes" ]; then
7136     QT_CONFIG="$QT_CONFIG clock-gettime"
7137 fi
7138 if [ "$CFG_CLOCK_MONOTONIC" = "yes" ]; then
7139     QT_CONFIG="$QT_CONFIG clock-monotonic"
7140 fi
7141 if [ "$CFG_MREMAP" = "yes" ]; then
7142     QT_CONFIG="$QT_CONFIG mremap"
7143 fi
7144 if [ "$CFG_GETADDRINFO" = "yes" ]; then
7145     QT_CONFIG="$QT_CONFIG getaddrinfo"
7146 fi
7147 if [ "$CFG_IPV6IFNAME" = "yes" ]; then
7148     QT_CONFIG="$QT_CONFIG ipv6ifname"
7149 fi
7150 if [ "$CFG_GETIFADDRS" = "yes" ]; then
7151     QT_CONFIG="$QT_CONFIG getifaddrs"
7152 fi
7153 if [ "$CFG_INOTIFY" = "yes" ]; then
7154     QT_CONFIG="$QT_CONFIG inotify"
7155 fi
7156 if [ "$CFG_LIBJPEG" = "no" ]; then
7157     CFG_JPEG="no"
7158 elif [ "$CFG_LIBJPEG" = "system" ]; then
7159     QT_CONFIG="$QT_CONFIG system-jpeg"
7160 fi
7161 if [ "$CFG_JPEG" = "no" ]; then
7162     QT_CONFIG="$QT_CONFIG no-jpeg"
7163 elif [ "$CFG_JPEG" = "yes" ]; then
7164     QT_CONFIG="$QT_CONFIG jpeg"
7165 fi
7166 if [ "$CFG_LIBMNG" = "no" ]; then
7167     CFG_MNG="no"
7168 elif [ "$CFG_LIBMNG" = "system" ]; then
7169     QT_CONFIG="$QT_CONFIG system-mng"
7170 fi
7171 if [ "$CFG_MNG" = "no" ]; then
7172     QT_CONFIG="$QT_CONFIG no-mng"
7173 elif [ "$CFG_MNG" = "yes" ]; then
7174     QT_CONFIG="$QT_CONFIG mng"
7175 fi
7176 if [ "$CFG_LIBPNG" = "no" ]; then
7177     CFG_PNG="no"
7178 fi
7179 if [ "$CFG_LIBPNG" = "system" ]; then
7180     QT_CONFIG="$QT_CONFIG system-png"
7181 fi
7182 if [ "$CFG_PNG" = "no" ]; then
7183     QT_CONFIG="$QT_CONFIG no-png"
7184 elif [ "$CFG_PNG" = "yes" ]; then
7185     QT_CONFIG="$QT_CONFIG png"
7186 fi
7187 if [ "$CFG_GIF" = "no" ]; then
7188     QT_CONFIG="$QT_CONFIG no-gif"
7189 elif [ "$CFG_GIF" = "yes" ]; then
7190     QT_CONFIG="$QT_CONFIG gif"
7191 fi
7192 if [ "$CFG_LIBTIFF" = "no" ]; then
7193     CFG_TIFF="no"
7194 elif [ "$CFG_LIBTIFF" = "system" ]; then
7195     QT_CONFIG="$QT_CONFIG system-tiff"
7196 fi
7197 if [ "$CFG_TIFF" = "no" ]; then
7198     QT_CONFIG="$QT_CONFIG no-tiff"
7199 elif [ "$CFG_TIFF" = "yes" ]; then
7200     QT_CONFIG="$QT_CONFIG tiff"
7201 fi
7202 if [ "$CFG_LIBFREETYPE" = "no" ]; then
7203     QT_CONFIG="$QT_CONFIG no-freetype"
7204     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FREETYPE"
7205 elif [ "$CFG_LIBFREETYPE" = "system" ]; then
7206     QT_CONFIG="$QT_CONFIG system-freetype"
7207 else
7208     QT_CONFIG="$QT_CONFIG freetype"
7209 fi
7210 if [ "$CFG_GUI" = "auto" ]; then
7211     CFG_GUI="yes"
7212 fi
7213 if [ "$CFG_GUI" = "no" ]; then
7214     QT_CONFIG="$QT_CONFIG no-gui"
7215 else
7216     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GUI"
7217 fi
7218
7219
7220 if [ "x$PLATFORM_MAC" = "xyes" ] && [ "$XPLATFORM_MINGW" != "yes" ] && [ "$XPLATFORM_SYMBIAN" != "yes" ]; then
7221     #On Mac we implicitly link against libz, so we
7222     #never use the 3rdparty stuff.
7223     [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system"
7224 fi
7225 if [ "$CFG_ZLIB" = "yes" ]; then
7226     QT_CONFIG="$QT_CONFIG zlib"
7227 elif [ "$CFG_ZLIB" = "system" ]; then
7228     QT_CONFIG="$QT_CONFIG system-zlib"
7229 fi
7230
7231 if [ "$CFG_S60" = "yes" ]; then
7232     QT_CONFIG="$QT_CONFIG s60"
7233 fi
7234
7235 if [ "$CFG_SYMBIAN_DEFFILES" = "yes" ]; then
7236     QTCONFIG_CONFIG="$QTCONFIG_CONFIG def_files"
7237 else
7238     QTCONFIG_CONFIG="$QTCONFIG_CONFIG def_files_disabled"
7239 fi
7240
7241 [ "$CFG_NIS" = "yes" ] && QT_CONFIG="$QT_CONFIG nis"
7242 [ "$CFG_CUPS" = "yes" ] && QT_CONFIG="$QT_CONFIG cups"
7243 [ "$CFG_ICONV" = "yes" ] && QT_CONFIG="$QT_CONFIG iconv"
7244 [ "$CFG_ICONV" = "sun" ] && QT_CONFIG="$QT_CONFIG sun-libiconv"
7245 [ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv"
7246 [ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib"
7247 [ "$CFG_GSTREAMER" = "yes" ] && QT_CONFIG="$QT_CONFIG gstreamer"
7248 [ "$CFG_DBUS" = "yes" ] && QT_CONFIG="$QT_CONFIG dbus"
7249 [ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus dbus-linked"
7250 [ "$CFG_NAS" = "system" ] && QT_CONFIG="$QT_CONFIG nas"
7251 [ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl"
7252 [ "$CFG_OPENSSL" = "linked" ] && QT_CONFIG="$QT_CONFIG openssl-linked"
7253
7254 if [ "$PLATFORM_X11" = "yes" ]; then
7255     [ "$CFG_SM" = "yes" ] && QT_CONFIG="$QT_CONFIG x11sm"
7256
7257     # for some reason, the following libraries are not always built shared,
7258     # so *every* program/lib (including Qt) has to link against them
7259     if [ "$CFG_XSHAPE" = "yes" ]; then
7260         QT_CONFIG="$QT_CONFIG xshape"
7261     fi
7262     if [ "$CFG_XVIDEO" = "yes" ]; then
7263         QT_CONFIG="$QT_CONFIG xvideo"
7264     fi
7265     if [ "$CFG_XSYNC" = "yes" ]; then
7266         QT_CONFIG="$QT_CONFIG xsync"
7267     fi
7268     if [ "$CFG_XINERAMA" = "yes" ]; then
7269         QT_CONFIG="$QT_CONFIG xinerama"
7270         QMakeVar set QMAKE_LIBS_X11 '-lXinerama $$QMAKE_LIBS_X11'
7271     fi
7272     if [ "$CFG_XCURSOR" = "yes" ]; then
7273         QT_CONFIG="$QT_CONFIG xcursor"
7274         QMakeVar set QMAKE_LIBS_X11 '-lXcursor $$QMAKE_LIBS_X11'
7275     fi
7276     if [ "$CFG_XFIXES" = "yes" ]; then
7277         QT_CONFIG="$QT_CONFIG xfixes"
7278         QMakeVar set QMAKE_LIBS_X11 '-lXfixes $$QMAKE_LIBS_X11'
7279     fi
7280     if [ "$CFG_XRANDR" = "yes" ]; then
7281         QT_CONFIG="$QT_CONFIG xrandr"
7282         if [ "$CFG_XRENDER" != "yes" ]; then
7283             # libXrandr uses 1 function from libXrender, so we always have to have it :/
7284             QMakeVar set QMAKE_LIBS_X11 '-lXrandr -lXrender $$QMAKE_LIBS_X11'
7285         else
7286             QMakeVar set QMAKE_LIBS_X11 '-lXrandr $$QMAKE_LIBS_X11'
7287         fi
7288     fi
7289     if [ "$CFG_XRENDER" = "yes" ]; then
7290         QT_CONFIG="$QT_CONFIG xrender"
7291         QMakeVar set QMAKE_LIBS_X11 '-lXrender $$QMAKE_LIBS_X11'
7292     fi
7293     if [ "$CFG_MITSHM" = "yes" ]; then
7294         QT_CONFIG="$QT_CONFIG mitshm"
7295     fi
7296     if [ "$CFG_FONTCONFIG" = "yes" ]; then
7297         QT_CONFIG="$QT_CONFIG fontconfig"
7298     fi
7299     if [ "$CFG_XINPUT" = "yes" ]; then
7300         QMakeVar set QMAKE_LIBS_X11 '-lXi $$QMAKE_LIBS_X11'
7301     fi
7302     if [ "$CFG_XINPUT" = "yes" ]; then
7303         QT_CONFIG="$QT_CONFIG xinput tablet"
7304     fi
7305     if [ "$CFG_XKB" = "yes" ]; then
7306         QT_CONFIG="$QT_CONFIG xkb"
7307     fi
7308 fi
7309
7310 [ '!' -z "$D_FLAGS" ] && QMakeVar add DEFINES "$D_FLAGS"
7311 [ '!' -z "$L_FLAGS" ] && QMakeVar add QMAKE_LIBDIR_FLAGS "$L_FLAGS"
7312 [ '!' -z "$l_FLAGS" ] && QMakeVar add LIBS "$l_FLAGS"
7313
7314 if [ "$PLATFORM_MAC" = "yes" ]; then
7315     if [ "$CFG_RPATH" = "yes" ]; then
7316        QMAKE_CONFIG="$QMAKE_CONFIG absolute_library_soname"
7317     fi
7318 elif [ -z "`getQMakeConf \"$XQMAKESPEC\" | $AWK '/QMAKE_(LFLAGS_)?RPATH/ {print $3;}'`" ]; then
7319     if [ -n "$RPATH_FLAGS" ]; then
7320         echo
7321         echo "ERROR: -R cannot be used on this platform as \$QMAKE_LFLAGS_RPATH is"
7322         echo "       undefined."
7323         echo
7324         exit 1
7325     elif [ "$CFG_RPATH" = "yes" ]; then
7326         RPATH_MESSAGE="        NOTE: This platform does not support runtime library paths, using -no-rpath."
7327         CFG_RPATH=no
7328     fi
7329 else
7330     if [ "$CFG_RPATH" = "yes" ]; then
7331         # set the default rpath to the library installation directory
7332         RPATH_FLAGS="\"$QT_INSTALL_LIBS\" $RPATH_FLAGS"
7333     fi
7334     if [ -n "$RPATH_FLAGS" ]; then
7335         # add the user defined rpaths
7336         QMakeVar add QMAKE_RPATHDIR "$RPATH_FLAGS"
7337     fi
7338 fi
7339
7340 if [ '!' -z "$I_FLAGS" ]; then
7341     # add the user define include paths
7342     QMakeVar add QMAKE_CFLAGS "$I_FLAGS"
7343     QMakeVar add QMAKE_CXXFLAGS "$I_FLAGS"
7344 fi
7345
7346 # turn off exceptions for the compilers that support it
7347 if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
7348     COMPILER=`echo $XPLATFORM | cut -f 3- -d-`
7349 elif [ "$XPLATFORM" != "$PLATFORM" ]; then
7350     COMPILER=`echo $XPLATFORM | cut -f 2- -d-`
7351 else
7352     COMPILER=`echo $PLATFORM | cut -f 2- -d-`
7353 fi
7354 if [ "$CFG_EXCEPTIONS" = "unspecified" -a "$PLATFORM_QWS" = "yes" ]; then
7355     CFG_EXCEPTIONS=no
7356 fi
7357
7358 if [ "$CFG_EXCEPTIONS" != "no" ]; then
7359     QTCONFIG_CONFIG="$QTCONFIG_CONFIG exceptions"
7360 fi
7361
7362 if [ "$XPLATFORM_MINGW" = "yes" ]; then
7363     # mkspecs/features/win32/default_pre.prf sets "no-rtti".
7364     # Follow default behavior of configure.exe by overriding with "rtti".
7365     QTCONFIG_CONFIG="$QTCONFIG_CONFIG rtti"
7366 fi
7367
7368 if [ "$CFG_ALSA" = "yes" ]; then
7369     QT_CONFIG="$QT_CONFIG alsa"
7370 fi
7371
7372 if [ "$CFG_PULSEAUDIO" = "yes" ]; then
7373     QT_CONFIG="$QT_CONFIG pulseaudio"
7374 fi
7375
7376 if [ "$CFG_COREWLAN" = "yes" ]; then
7377     QT_CONFIG="$QT_CONFIG corewlan"
7378 fi
7379
7380 if [ "$CFG_ICD" = "yes" ]; then
7381     QT_CONFIG="$QT_CONFIG icd"
7382 fi
7383
7384 if [ "$CFG_ICU" = "yes" ]; then
7385     QT_CONFIG="$QT_CONFIG icu"
7386 fi
7387
7388 #
7389 # Some Qt modules are too advanced in C++ for some old compilers
7390 # Detect here the platforms where they are known to work.
7391 #
7392 # See Qt documentation for more information on which features are
7393 # supported and on which compilers.
7394 #
7395 canBuildQtXmlPatterns="yes"
7396 canBuildWebKit="$HAVE_STL"
7397 canBuildQtConcurrent="yes"
7398
7399 # WebKit requires stdint.h
7400 "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stdint "Stdint" $L_FLAGS $I_FLAGS $l_FLAGS
7401 if [ $? != "0" ]; then
7402     canBuildWebKit="no"
7403 fi
7404
7405 case "$XPLATFORM" in
7406     hpux-g++*)
7407         # PA-RISC's assembly is too limited
7408         # gcc 3.4 on that platform can't build QtXmlPatterns
7409         # the assembly it generates cannot be compiled
7410
7411         # Check gcc's version
7412         case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
7413             4*)
7414                 ;;
7415             3.4*)
7416                 canBuildQtXmlPatterns="no"
7417                 ;;
7418             *)
7419                 canBuildWebKit="no"
7420                 canBuildQtXmlPatterns="no"
7421                 ;;
7422         esac
7423         ;;
7424     unsupported/vxworks-*-g++*)
7425         canBuildWebKit="no"
7426         ;;
7427     unsupported/vxworks-*-dcc*)
7428         canBuildWebKit="no"
7429         canBuildQtXmlPatterns="no"
7430         ;;
7431     *-g++*)
7432         # Check gcc's version
7433         case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
7434             4*|3.4*)
7435                 ;;
7436             3.3*)
7437                 canBuildWebKit="no"
7438                 ;;
7439             *)
7440                 canBuildWebKit="no"
7441                 canBuildQtXmlPatterns="no"
7442                 ;;
7443         esac
7444         ;;
7445     solaris-cc*)
7446         # Check the compiler version
7447         case `${QMAKE_CONF_COMPILER} -V 2>&1 | awk '{print $4}'` in
7448             5.[012345678])
7449                 canBuildWebKit="no"
7450                 canBuildQtXmlPatterns="no"
7451                 canBuildQtConcurrent="no"
7452                 ;;
7453             5.*)
7454                 canBuildWebKit="no"
7455                 canBuildQtConcurrent="no"
7456                 ;;
7457         esac
7458         ;;
7459     hpux-acc*)
7460         canBuildWebKit="no"
7461         canBuildQtXmlPatterns="no"
7462         canBuildQtConcurrent="no"
7463         ;;
7464     hpuxi-acc*)
7465         canBuildWebKit="no"
7466         ;;
7467     aix-xlc*)
7468         # Get the xlC version
7469         cat > xlcver.c <<EOF
7470 #include <stdio.h>
7471 int main()
7472 {
7473     printf("%d.%d\n", __xlC__ >> 8, __xlC__ & 0xFF);
7474     return 0;
7475 }
7476 EOF
7477         xlcver=
7478         if ${QMAKE_CONF_COMPILER} -o xlcver xlcver.c >/dev/null 2>/dev/null; then
7479             xlcver=`./xlcver 2>/dev/null`
7480             rm -f ./xlcver
7481         fi
7482         if [ "$OPT_VERBOSE" = "yes" ]; then
7483             if [ -n "$xlcver" ]; then
7484                 echo Found IBM xlC version: $xlcver.
7485             else
7486                 echo Could not determine IBM xlC version, assuming oldest supported.
7487             fi
7488         fi
7489
7490         case "$xlcver" in
7491             [123456].*)
7492                 canBuildWebKit="no"
7493                 canBuildQtXmlPatterns="no"
7494                 canBuildQtConcurrent="no"
7495                 ;;
7496             *)
7497                 canBuildWebKit="no"
7498                 canBuildQtConcurrent="no"
7499                 ;;
7500         esac
7501         ;;
7502     irix-cc*)
7503         canBuildWebKit="no"
7504         canBuildQtConcurrent="no"
7505         ;;
7506     symbian-gcce)
7507         canBuildQtConcurrent="no"
7508         ;;
7509     symbian-armcc)
7510         canBuildQtConcurrent="no"
7511         ;;
7512 esac
7513
7514 if [ "$CFG_GUI" = "no" ]; then
7515     # WebKit requires QtGui
7516     canBuildWebKit="no"
7517 fi
7518
7519 if [ "$CFG_SHARED" = "no" ]; then
7520     echo
7521     echo "WARNING: Using static linking will disable the WebKit module."
7522     echo
7523     canBuildWebKit="no"
7524 fi
7525
7526 CFG_CONCURRENT="yes"
7527 if [ "$canBuildQtConcurrent" = "no" ]; then
7528     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT"
7529     CFG_CONCURRENT="no"
7530 fi
7531
7532 if [ "$CFG_XMLPATTERNS" = "yes" -a "$CFG_EXCEPTIONS" = "no" ]; then
7533     echo "QtXmlPatterns was requested, but it can't be built due to exceptions being disabled."
7534     exit 1
7535 fi
7536 if [ "$CFG_XMLPATTERNS" = "auto" -a "$CFG_EXCEPTIONS" != "no" ]; then
7537     CFG_XMLPATTERNS="$canBuildQtXmlPatterns"
7538 elif [ "$CFG_EXCEPTIONS" = "no" ]; then
7539     CFG_XMLPATTERNS="no"
7540 fi
7541 if [ "$CFG_XMLPATTERNS" = "yes" ]; then
7542     QT_CONFIG="$QT_CONFIG xmlpatterns"
7543 else
7544     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XMLPATTERNS"
7545 fi
7546
7547 if [ "$CFG_MULTIMEDIA" = "no" ]; then
7548     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MULTIMEDIA"
7549 else
7550     QT_CONFIG="$QT_CONFIG multimedia"
7551 fi
7552
7553 if [ "$CFG_AUDIO_BACKEND" = "yes" ]; then
7554     QT_CONFIG="$QT_CONFIG audio-backend"
7555 fi
7556
7557 if [ "$CFG_SVG" = "auto" ]; then
7558     CFG_SVG=$CFG_GUI
7559 fi
7560
7561 if [ "$CFG_SVG" = "yes" ] && [ "$CFG_GUI" = "no" ]; then
7562     echo "QtSvg requested, but it can't be built without QtGui"
7563     exit 1
7564 fi
7565
7566 if [ "$CFG_SVG" = "yes" ]; then
7567     QT_CONFIG="$QT_CONFIG svg"
7568 else
7569     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SVG"
7570 fi
7571
7572 if [ "$CFG_WEBKIT" != "no" ]; then
7573     CFG_WEBKIT="$canBuildWebKit"
7574 fi
7575
7576 if [ "$CFG_WEBKIT" != "no" ]; then
7577     # This include takes care of adding "webkit" to QT_CONFIG.
7578     cp -f "$relpath/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri" "$outpath/mkspecs/modules/qt_webkit_version.pri"
7579     # The reason we set CFG_WEBKIT, is such that the printed overview of what will be enabled, shows correctly.
7580     if [ "$CFG_WEBKIT" = "debug" ]; then
7581         QMAKE_CONFIG="$QMAKE_CONFIG webkit-debug"
7582     fi
7583 else
7584     rm -f "$outpath/mkspecs/modules/qt_webkit_version.pri"
7585     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_WEBKIT"
7586 fi
7587
7588 if [ "$CFG_SCRIPT" = "auto" ]; then
7589     CFG_SCRIPT="yes"
7590 fi
7591
7592 if [ "$CFG_SCRIPT" = "yes" ]; then
7593     QT_CONFIG="$QT_CONFIG script"
7594 else
7595     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SCRIPT"
7596 fi
7597
7598 if [ "$CFG_SCRIPTTOOLS" = "yes" -a "$CFG_SCRIPT" = "no" ]; then
7599     echo "QtScriptTools was requested, but it can't be built due to QtScript being disabled."
7600     exit 1
7601 fi
7602 if [ "$CFG_SCRIPTTOOLS" = "auto" -a "$CFG_SCRIPT" != "no" ]; then
7603     case "$XPLATFORM" in
7604     symbian*)
7605         CFG_SCRIPTTOOLS="no"
7606         ;;
7607     *)
7608         CFG_SCRIPTTOOLS="yes"
7609         ;;
7610     esac
7611 elif [ "$CFG_SCRIPT" = "no" ]; then
7612     CFG_SCRIPTTOOLS="no"
7613 fi
7614
7615 if [ "$CFG_SCRIPTTOOLS" = "yes" ]; then
7616     QT_CONFIG="$QT_CONFIG scripttools"
7617 else
7618     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SCRIPTTOOLS"
7619 fi
7620
7621
7622 if [ "$CFG_DECLARATIVE" = "yes" ]; then
7623     if [ "$CFG_SCRIPT" = "no" -o "$CFG_GUI" = "no" ]; then
7624         echo "Error: QtDeclarative was requested, but it can't be built due to QtScript or QtGui being disabled."
7625         exit 1
7626     fi
7627 fi
7628 if [ "$CFG_DECLARATIVE" = "auto" ]; then
7629     if [ "$CFG_SCRIPT" = "no" -o "$CFG_GUI" = "no" ]; then
7630             CFG_DECLARATIVE=no
7631     else
7632             CFG_DECLARATIVE=yes
7633     fi
7634 fi
7635
7636 if [ "$CFG_DECLARATIVE" = "yes" ]; then
7637     QT_CONFIG="$QT_CONFIG declarative"
7638     if [ "$CFG_DECLARATIVE_DEBUG" = "no" ]; then
7639         QCONFIG_FLAGS="$QCONFIG_FLAGS QDECLARATIVE_NO_DEBUG_PROTOCOL"
7640     fi
7641 else
7642     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DECLARATIVE"
7643 fi
7644
7645 if [ "$CFG_EXCEPTIONS" = "no" ]; then
7646     case "$COMPILER" in
7647     g++*)
7648         QMakeVar add QMAKE_CFLAGS -fno-exceptions
7649         QMakeVar add QMAKE_CXXFLAGS -fno-exceptions
7650         QMakeVar add QMAKE_LFLAGS -fno-exceptions
7651         ;;
7652     cc*)
7653         case "$PLATFORM" in
7654         irix-cc*)
7655             QMakeVar add QMAKE_CFLAGS -LANG:exceptions=off
7656             QMakeVar add QMAKE_CXXFLAGS -LANG:exceptions=off
7657             QMakeVar add QMAKE_LFLAGS -LANG:exceptions=off
7658             ;;
7659         *) ;;
7660         esac
7661         ;;
7662     *) ;;
7663     esac
7664     QMAKE_CONFIG="$QMAKE_CONFIG exceptions_off"
7665 fi
7666
7667 # On Mac, set the minimum deployment target for the different architechtures 
7668 # using the Xarch compiler option when supported (10.5 and up).  On 10.4 the
7669 # deployment version is set to 10.4 globally using the QMAKE_MACOSX_DEPLOYMENT_TARGET
7670 # env. variable. 
7671 if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" != "no" ] ; then
7672     if echo "$CFG_MAC_ARCHS" | grep '\<x86\>' > /dev/null 2>&1; then
7673         QMakeVar add QMAKE_CFLAGS "-Xarch_i386 -mmacosx-version-min=10.4"
7674         QMakeVar add QMAKE_CXXFLAGS "-Xarch_i386 -mmacosx-version-min=10.4"
7675         QMakeVar add QMAKE_LFLAGS "-Xarch_i386 -mmacosx-version-min=10.4"
7676         QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86 "-arch i386 -Xarch_i386 -mmacosx-version-min=10.4"
7677     fi
7678     if echo "$CFG_MAC_ARCHS" | grep '\<ppc\>' > /dev/null 2>&1; then
7679         QMakeVar add QMAKE_CFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
7680         QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
7681         QMakeVar add QMAKE_LFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
7682         QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC "-arch ppc -Xarch_ppc -mmacosx-version-min=10.4"
7683     fi
7684     if echo "$CFG_MAC_ARCHS" | grep '\<x86_64\>' > /dev/null 2>&1; then
7685         QMakeVar add QMAKE_CFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
7686         QMakeVar add QMAKE_CXXFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
7687         QMakeVar add QMAKE_LFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
7688         QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86_64 "-arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5"
7689     fi
7690     if echo "$CFG_MAC_ARCHS" | grep '\<ppc64\>' > /dev/null 2>&1; then
7691         QMakeVar add QMAKE_CFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5"
7692         QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5"
7693         QMakeVar add QMAKE_LFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5"
7694         QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC_64 "-arch ppc64 -Xarch_ppc64 -mmacosx-version-min=10.5"
7695     fi
7696 fi
7697
7698 #-------------------------------------------------------------------------------
7699 # generate QT_BUILD_KEY
7700 #-------------------------------------------------------------------------------
7701
7702 # some compilers generate binary incompatible code between different versions,
7703 # so we need to generate a build key that is different between these compilers
7704 COMPAT_COMPILER=
7705 case "$COMPILER" in
7706 g++*)
7707     # GNU C++
7708     COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -dumpversion 2>/dev/null`
7709
7710     case "$COMPILER_VERSION" in
7711     *.*.*)
7712         QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'`
7713         QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'`
7714         QT_GCC_PATCH_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'`
7715         ;;
7716     *.*)
7717         QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\1,'`
7718         QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\2,'`
7719         QT_GCC_PATCH_VERSION=0
7720         ;;
7721     esac
7722
7723     case "$COMPILER_VERSION" in
7724     2.95.*)
7725         COMPILER_VERSION="2.95.*"
7726         ;;
7727     3.*)
7728         COMPILER_VERSION="3.*"
7729         ;;
7730     4.*)
7731         COMPILER_VERSION="4"
7732         ;;
7733     *)
7734         ;;
7735     esac
7736     [ '!' -z "$COMPILER_VERSION" ] && COMPILER="g++-${COMPILER_VERSION}"
7737     ;;
7738 icc*)
7739     # The Intel CC compiler on Unix systems matches the ABI of the g++
7740     # that is found on PATH
7741     COMPAT_COMPILER="icc"
7742     COMPILER="g++-4"
7743     case "`g++ -dumpversion` 2>/dev/null" in
7744     2.95.*)
7745         COMPILER="g++-2.95.*"
7746         ;;
7747     3.*)
7748 a        COMPILER="g++-3.*"
7749         ;;
7750     *)
7751         ;;
7752     esac
7753     ;;
7754 *)
7755     #
7756     ;;
7757 esac
7758
7759 # QT_CONFIG can contain the following:
7760 #
7761 # Things that affect the Qt API/ABI:
7762 #
7763 #   Options:
7764 #     minimal-config small-config medium-config large-config full-config
7765 #
7766 #   Different edition modules:
7767 #     gui network canvas table xml opengl sql
7768 #
7769 # Things that do not affect the Qt API/ABI:
7770 #     stl
7771 #     system-jpeg no-jpeg jpeg
7772 #     system-mng no-mng mng
7773 #     system-png no-png png
7774 #     system-zlib no-zlib zlib
7775 #     system-libtiff no-libtiff
7776 #     no-gif gif
7777 #     debug release
7778 #     dll staticlib
7779 #
7780 #     nocrosscompiler
7781 #     GNUmake
7782 #     largefile
7783 #     nis
7784 #     nas
7785 #     tablet
7786 #     ipv6
7787 #
7788 #     X11     : x11sm xinerama xcursor xfixes xrandr xrender mitshm fontconfig xkb
7789 #     Embedded: embedded qpa freetype
7790 #
7791 ALL_OPTIONS=
7792 BUILD_CONFIG=
7793 BUILD_OPTIONS=
7794
7795 # determine the build options
7796 for config_option in $QMAKE_CONFIG $QT_CONFIG; do
7797     SKIP="yes"
7798     case "$config_option" in
7799     *-config)
7800         # take the last *-config setting.  this is the highest config being used,
7801         # and is the one that we will use for tagging plugins
7802         BUILD_CONFIG="$config_option"
7803         ;;
7804
7805     *) # skip all other options since they don't affect the Qt API/ABI.
7806         ;;
7807     esac
7808
7809     if [ "$SKIP" = "no" ]; then
7810         BUILD_OPTIONS="$BUILD_OPTIONS $config_option"
7811     fi
7812 done
7813
7814 # put the options that we are missing into .options
7815 rm -f .options
7816 for opt in `echo $ALL_OPTIONS`; do
7817     SKIP="no"
7818     if echo $BUILD_OPTIONS | grep $opt >/dev/null 2>&1; then
7819         SKIP="yes"
7820     fi
7821     if [ "$SKIP" = "no" ]; then
7822         echo "$opt" >> .options
7823     fi
7824 done
7825
7826 # reconstruct BUILD_OPTIONS with a sorted negative feature list
7827 # (ie. only things that are missing are will be put into the build key)
7828 BUILD_OPTIONS=
7829 if [ -f .options ]; then
7830     for opt in `sort -f .options | uniq`; do
7831         BUILD_OPTIONS="$BUILD_OPTIONS no-$opt"
7832     done
7833 fi
7834 rm -f .options
7835
7836 # QT_NO* defines affect the Qt API (and binary compatibility).  they need
7837 # to be included in the build key
7838 for build_option in $D_FLAGS; do
7839     build_option=`echo $build_option | cut -d \" -f 2 -`
7840     case "$build_option" in
7841     QT_NO*)
7842         echo "$build_option" >> .options
7843         ;;
7844     *)
7845         # skip all other compiler defines
7846         ;;
7847     esac
7848 done
7849
7850 # sort the compile time defines (helps ensure that changes in this configure
7851 # script don't affect the QT_BUILD_KEY generation)
7852 if [ -f .options ]; then
7853     for opt in `sort -f .options | uniq`; do
7854         BUILD_OPTIONS="$BUILD_OPTIONS $opt"
7855     done
7856 fi
7857 rm -f .options
7858
7859 BUILD_OPTIONS="$BUILD_CONFIG $BUILD_OPTIONS"
7860 # extract the operating system from the XPLATFORM
7861 TARGET_OPERATING_SYSTEM=`echo $XPLATFORM | cut -f 2- -d/ | cut -f -1 -d-`
7862 if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
7863     QT_BUILD_KEY_SYSTEM_PART="Symbian"
7864 else
7865     QT_BUILD_KEY_SYSTEM_PART="$CFG_ARCH $TARGET_OPERATING_SYSTEM $COMPILER"
7866 fi
7867
7868 # when cross-compiling, don't include build-host information (build key is target specific)
7869 QT_BUILD_KEY="$CFG_USER_BUILD_KEY $QT_BUILD_KEY_SYSTEM_PART $BUILD_OPTIONS"
7870 if [ -n "$QT_NAMESPACE" ]; then
7871     QT_BUILD_KEY="$QT_BUILD_KEY $QT_NAMESPACE"
7872 fi
7873 MAC_NEED_TWO_BUILD_KEYS="no"
7874 if [ "$PLATFORM_MAC" = "yes" -a "$CFG_MAC_COCOA" = "yes" ]; then
7875     QT_BUILD_KEY_CARBON=$QT_BUILD_KEY
7876     TARGET_OPERATING_SYSTEM="$TARGET_OPERATING_SYSTEM-cocoa"
7877     QT_BUILD_KEY_COCOA="$CFG_USER_BUILD_KEY $CFG_ARCH $TARGET_OPERATING_SYSTEM $COMPILER $BUILD_OPTIONS"
7878     if [ "$CFG_MAC_CARBON" = "no" ]; then
7879         QT_BUILD_KEY=$QT_BUILD_KEY_COCOA
7880     else
7881         MAC_NEED_TWO_BUILD_KEYS="yes"
7882     fi
7883 fi
7884 # don't break loading plugins build with an older version of Qt
7885 QT_BUILD_KEY_COMPAT=
7886 if [ "$QT_CROSS_COMPILE" = "no" ]; then
7887     # previous versions of Qt used a build key built from the uname
7888     QT_BUILD_KEY_COMPAT="$CFG_USER_BUILD_KEY $UNAME_MACHINE $UNAME_SYSTEM $COMPILER $BUILD_OPTIONS"
7889     if [ -n "$QT_NAMESPACE" ]; then
7890         QT_BUILD_KEY_COMPAT="$QT_BUILD_KEY_COMPAT $QT_NAMESPACE"
7891     fi
7892 fi
7893
7894 # is this compiler compatible with some other "standard" build key
7895 QT_BUILD_KEY_COMPAT_COMPILER=
7896 if [ ! -z "$COMPAT_COMPILER" ]; then
7897     QT_BUILD_KEY_COMPAT_COMPILER="$CFG_USER_BUILD_KEY $CFG_ARCH $TARGET_OPERATING_SYSTEM $COMPAT_COMPILER $BUILD_OPTIONS"
7898     if [ -n "$QT_NAMESPACE" ]; then
7899         QT_BUILD_KEY_COMPAT_COMPILER="$QT_BUILD_KEY_COMPAT_COMPILER $QT_NAMESPACE"
7900     fi
7901 fi
7902
7903 # is this arch compatible with some other "standard" build key
7904 QT_BUILD_KEY_COMPAT_ARCH=
7905 if [ ! -z "$COMPAT_ARCH" ]; then
7906     QT_BUILD_KEY_COMPAT_ARCH="$CFG_USER_BUILD_KEY $COMPAT_ARCH $TARGET_OPERATING_SYSTEM $COMPILER $BUILD_OPTIONS"
7907     if [ -n "$QT_NAMESPACE" ]; then
7908         QT_BUILD_KEY_COMPAT_COMPILER="$QT_BUILD_KEY_COMPAT_ARCH $QT_NAMESPACE"
7909     fi
7910 fi
7911
7912 # strip out leading/trailing/extra whitespace
7913 QT_BUILD_KEY=`echo $QT_BUILD_KEY | sed -e "s,  *, ,g" -e "s,^  *,," -e "s,  *$,,"`
7914 QT_BUILD_KEY_COMPAT=`echo $QT_BUILD_KEY_COMPAT | sed -e "s,  *, ,g" -e "s,^  *,," -e "s,  *$,,"`
7915 QT_BUILD_KEY_COMPAT_COMPILER=`echo $QT_BUILD_KEY_COMPAT_COMPILER | sed -e "s,  *, ,g" -e "s,^  *,," -e "s,  *$,,"`
7916 QT_BUILD_KEY_COMPAT_ARCH=`echo $QT_BUILD_KEY_COMPAT_ARCH | sed -e "s,  *, ,g" -e "s,^  *,," -e "s,  *$,,"`
7917
7918 #-------------------------------------------------------------------------------
7919 # part of configuration information goes into qconfig.h
7920 #-------------------------------------------------------------------------------
7921
7922 case "$CFG_QCONFIG" in
7923 full)
7924     echo "/* Everything */" >"$outpath/src/corelib/global/qconfig.h.new"
7925     ;;
7926 *)
7927     tmpconfig="$outpath/src/corelib/global/qconfig.h.new"
7928     echo "#ifndef QT_BOOTSTRAPPED" >"$tmpconfig"
7929     if [ -f "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" ]; then
7930         cat "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" >>"$tmpconfig"
7931     elif [ -f `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` ]; then
7932         cat `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` >>"$tmpconfig"
7933     fi
7934     echo "#endif" >>"$tmpconfig"
7935     ;;
7936 esac
7937
7938 cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
7939
7940 /* Qt Edition */
7941 #ifndef QT_EDITION
7942 #  define QT_EDITION $QT_EDITION
7943 #endif
7944
7945 /* Machine byte-order */
7946 #define Q_BIG_ENDIAN 4321
7947 #define Q_LITTLE_ENDIAN 1234
7948 EOF
7949
7950 if [ "$MAC_NEED_TWO_BUILD_KEYS" = "no" ]; then
7951     echo "#define QT_BUILD_KEY \"$QT_BUILD_KEY\"" \
7952         >> "$outpath/src/corelib/global/qconfig.h.new"
7953 else
7954     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
7955
7956 #define QT_BUILD_KEY_CARBON "$QT_BUILD_KEY_CARBON"
7957 #define QT_BUILD_KEY_COCOA "$QT_BUILD_KEY_COCOA"
7958 EOF
7959 fi
7960
7961 if [ -n "$QT_BUILD_KEY_COMPAT" ]; then
7962     echo "#define QT_BUILD_KEY_COMPAT \"$QT_BUILD_KEY_COMPAT\"" \
7963         >> "$outpath/src/corelib/global/qconfig.h.new"
7964 fi
7965 if [ -n "$QT_BUILD_KEY_COMPAT_COMPILER" ]; then
7966     echo "#define QT_BUILD_KEY_COMPAT2 \"$QT_BUILD_KEY_COMPAT_COMPILER\"" \
7967         >> "$outpath/src/corelib/global/qconfig.h.new"
7968 fi
7969 if [ -n "$QT_BUILD_KEY_COMPAT_ARCH" ]; then
7970     echo "#define QT_BUILD_KEY_COMPAT3 \"$QT_BUILD_KEY_COMPAT_ARCH\"" \
7971         >> "$outpath/src/corelib/global/qconfig.h.new"
7972 fi
7973
7974 echo "" >>"$outpath/src/corelib/global/qconfig.h.new"
7975
7976 echo "#ifdef QT_BOOTSTRAPPED" >>"$outpath/src/corelib/global/qconfig.h.new"
7977 if [ "$CFG_HOST_ENDIAN" = "auto" ]; then
7978     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
7979 #if defined(__BIG_ENDIAN__)
7980 # define Q_BYTE_ORDER Q_BIG_ENDIAN
7981 #elif defined(__LITTLE_ENDIAN__)
7982 # define Q_BYTE_ORDER Q_LITTLE_ENDIAN
7983 #else
7984 # error "Unable to determine byte order!"
7985 #endif
7986 EOF
7987 else
7988     echo "#define Q_BYTE_ORDER $CFG_HOST_ENDIAN" >>"$outpath/src/corelib/global/qconfig.h.new"
7989 fi
7990 echo "#else" >>"$outpath/src/corelib/global/qconfig.h.new"
7991 if [ "$CFG_ENDIAN" = "auto" ]; then
7992     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
7993 #if defined(__BIG_ENDIAN__)
7994 # define Q_BYTE_ORDER Q_BIG_ENDIAN
7995 #elif defined(__LITTLE_ENDIAN__)
7996 # define Q_BYTE_ORDER Q_LITTLE_ENDIAN
7997 #else
7998 # error "Unable to determine byte order!"
7999 #endif
8000 EOF
8001 else
8002     echo "#define Q_BYTE_ORDER $CFG_ENDIAN" >>"$outpath/src/corelib/global/qconfig.h.new"
8003 fi
8004 echo "#endif" >>"$outpath/src/corelib/global/qconfig.h.new"
8005
8006 if [ "$CFG_DOUBLEFORMAT" != "normal" ]; then
8007     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
8008 /* Non-IEEE double format */
8009 #define Q_DOUBLE_LITTLE "01234567"
8010 #define Q_DOUBLE_BIG "76543210"
8011 #define Q_DOUBLE_LITTLE_SWAPPED "45670123"
8012 #define Q_DOUBLE_BIG_SWAPPED "32107654"
8013 #define Q_DOUBLE_FORMAT $CFG_DOUBLEFORMAT
8014 EOF
8015 fi
8016 if [ "$CFG_ARMFPA" = "yes" ]; then
8017     if [ "$CFG_ARCH" != "$CFG_HOST_ARCH" ]; then
8018         cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
8019 #ifndef QT_BOOTSTRAPPED
8020 # define QT_ARMFPA
8021 #endif
8022 EOF
8023     else
8024         echo "#define QT_ARMFPA" >>"$outpath/src/corelib/global/qconfig.h.new"
8025     fi
8026 fi
8027
8028 CFG_ARCH_STR=`echo $CFG_ARCH | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
8029 CFG_HOST_ARCH_STR=`echo $CFG_HOST_ARCH | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
8030 cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
8031 /* Machine Architecture */
8032 #ifndef QT_BOOTSTRAPPED
8033 # define QT_ARCH_${CFG_ARCH_STR}
8034 #else
8035 # define QT_ARCH_${CFG_HOST_ARCH_STR}
8036 #endif
8037 EOF
8038
8039 echo '/* Compile time features */' >>"$outpath/src/corelib/global/qconfig.h.new"
8040 [ '!' -z "$LicenseKeyExt" ] && echo "#define QT_PRODUCT_LICENSEKEY \"$LicenseKeyExt\"" >>"$outpath/src/corelib/global/qconfig.h.new"
8041
8042 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
8043     echo "#define QT_LARGEFILE_SUPPORT 64" >>"$outpath/src/corelib/global/qconfig.h.new"
8044 fi
8045
8046 # if both carbon and cocoa are specified, enable the autodetection code.
8047 if [ "$PLATFORM_MAC" = "yes" -a "$CFG_MAC_COCOA" = "yes" -a "$CFG_MAC_CARBON" = "yes" ]; then
8048     echo "#define QT_AUTODETECT_COCOA 1" >>"$outpath/src/corelib/global/qconfig.h.new"
8049 elif [ "$PLATFORM_MAC" = "yes" -a "$CFG_MAC_COCOA" = "yes" ]; then
8050     echo "#define QT_MAC_USE_COCOA 1" >>"$outpath/src/corelib/global/qconfig.h.new"
8051 fi
8052
8053 if [ "$CFG_FRAMEWORK" = "yes" ]; then
8054     echo "#define QT_MAC_FRAMEWORK_BUILD" >>"$outpath/src/corelib/global/qconfig.h.new"
8055 fi
8056
8057 if [ "$PLATFORM_MAC" = "yes" ]; then
8058     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
8059 #if defined(__LP64__)
8060 # define QT_POINTER_SIZE 8
8061 #else
8062 # define QT_POINTER_SIZE 4
8063 #endif
8064 EOF
8065 else
8066     "$unixtests/ptrsize.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
8067     echo "#define QT_POINTER_SIZE $?" >>"$outpath/src/corelib/global/qconfig.h.new"
8068 fi
8069
8070
8071 echo "" >>"$outpath/src/corelib/global/qconfig.h.new"
8072
8073 if [ "$CFG_DEV" = "yes" ]; then
8074     echo "#define QT_BUILD_INTERNAL" >>"$outpath/src/corelib/global/qconfig.h.new"
8075 fi
8076
8077 # Embedded compile time options
8078 if [ "$PLATFORM_QWS" = "yes" ]; then
8079     # Add QWS to config.h
8080     QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QWS"
8081
8082     # Add excluded decorations to $QCONFIG_FLAGS
8083     decors=`grep '^decorations -= ' "$QMAKE_VARS_FILE" | ${AWK} '{print $3}'`
8084     for decor in $decors; do
8085         NODECORATION=`echo $decor | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
8086         QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_NO_QWS_DECORATION_${NODECORATION}"
8087     done
8088
8089     # Figure which embedded drivers which are turned off
8090     CFG_GFX_OFF="$CFG_GFX_AVAILABLE"
8091     for ADRIVER in $CFG_GFX_ON; do
8092         CFG_GFX_OFF=`echo "${CFG_GFX_OFF} " | sed "s,${ADRIVER} ,,g"`
8093     done
8094
8095     CFG_KBD_OFF="$CFG_KBD_AVAILABLE"
8096     # the um driver is currently not in the available list for external builds
8097     if [ "$CFG_DEV" = "no" ]; then
8098         CFG_KBD_OFF="$CFG_KBD_OFF um"
8099     fi
8100     for ADRIVER in $CFG_KBD_ON; do
8101         CFG_KBD_OFF=`echo "${CFG_KBD_OFF} " | sed "s,${ADRIVER} ,,g"`
8102     done
8103
8104     CFG_MOUSE_OFF="$CFG_MOUSE_AVAILABLE"
8105     for ADRIVER in $CFG_MOUSE_ON; do
8106         CFG_MOUSE_OFF=`echo "${CFG_MOUSE_OFF} " | sed "s,${ADRIVER} ,,g"`
8107     done
8108
8109     for DRIVER in $CFG_GFX_OFF; do
8110         NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
8111         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_$NODRIVER"
8112     done
8113
8114     for DRIVER in $CFG_KBD_OFF; do
8115         NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
8116         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_KBD_$NODRIVER"
8117     done
8118
8119     for DRIVER in $CFG_MOUSE_OFF; do
8120         NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
8121         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_MOUSE_$NODRIVER"
8122     done
8123 fi # QWS
8124
8125 if [ "$PLATFORM_QPA" = "yes" ]; then
8126     # Add QPA to config.h
8127     QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QPA QT_NO_QWS_QPF QT_NO_QWS_QPF2"
8128 fi
8129
8130 if [ "${CFG_USE_FLOATMATH}" = "yes" ]; then
8131     QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_USE_MATH_H_FLOATS"
8132 fi
8133
8134 # Add turned on SQL drivers
8135 for DRIVER in $CFG_SQL_AVAILABLE; do
8136     eval "VAL=\$CFG_SQL_$DRIVER"
8137     case "$VAL" in
8138     qt)
8139         ONDRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
8140         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SQL_$ONDRIVER"
8141         SQL_DRIVERS="$SQL_DRIVERS $DRIVER"
8142     ;;
8143     plugin)
8144         SQL_PLUGINS="$SQL_PLUGINS $DRIVER"
8145     ;;
8146     esac
8147 done
8148
8149
8150 QMakeVar set sql-drivers "$SQL_DRIVERS"
8151 QMakeVar set sql-plugins "$SQL_PLUGINS"
8152
8153 # Add other configuration options to the qconfig.h file
8154 [ "$CFG_GIF" = "yes" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_BUILTIN_GIF_READER=1"
8155 [ "$CFG_TIFF" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_TIFF"
8156 [ "$CFG_PNG" != "yes" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_PNG"
8157 [ "$CFG_JPEG" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_JPEG"
8158 [ "$CFG_MNG" != "yes" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_MNG"
8159 [ "$CFG_ZLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ZLIB"
8160 [ "$CFG_S60" != "yes" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_S60"
8161 [ "$CFG_EXCEPTIONS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EXCEPTIONS"
8162 [ "$CFG_IPV6" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IPV6"
8163 [ "$CFG_SXE" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SXE"
8164 [ "$CFG_DBUS" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS"
8165
8166 if [ "$PLATFORM_QWS" != "yes" -a "$PLATFORM_QPA" != "yes" ]; then
8167     [ "$CFG_GRAPHICS_SYSTEM" = "raster" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_RASTER"
8168     [ "$CFG_GRAPHICS_SYSTEM" = "opengl" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_OPENGL"
8169     [ "$CFG_GRAPHICS_SYSTEM" = "openvg" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_OPENVG"
8170     [ "$CFG_GRAPHICS_SYSTEM" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_RUNTIME"
8171 fi
8172
8173 # X11/Unix/Mac only configs
8174 [ "$CFG_CUPS" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CUPS"
8175 [ "$CFG_ICONV" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ICONV"
8176 [ "$CFG_GLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GLIB"
8177 [ "$CFG_GSTREAMER" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GSTREAMER"
8178 [ "$CFG_QGTKSTYLE" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STYLE_GTK"
8179 [ "$CFG_CLOCK_MONOTONIC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CLOCK_MONOTONIC"
8180 [ "$CFG_MREMAP" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MREMAP"
8181 [ "$CFG_GETADDRINFO" = "no" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETADDRINFO"
8182 [ "$CFG_IPV6IFNAME" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IPV6IFNAME"
8183 [ "$CFG_GETIFADDRS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETIFADDRS"
8184 [ "$CFG_INOTIFY" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_INOTIFY"
8185 [ "$CFG_NAS" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NAS"
8186 [ "$CFG_NIS" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NIS"
8187 [ "$CFG_OPENSSL" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENSSL"
8188 [ "$CFG_OPENSSL" = "linked" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LINKED_OPENSSL"
8189
8190 [ "$CFG_SM" = "no" ]         && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SESSIONMANAGER"
8191 [ "$CFG_XCURSOR" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XCURSOR"
8192 [ "$CFG_XFIXES" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XFIXES"
8193 [ "$CFG_FONTCONFIG" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FONTCONFIG"
8194 [ "$CFG_XINERAMA" = "no" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINERAMA"
8195 [ "$CFG_XKB" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XKB"
8196 [ "$CFG_XRANDR" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRANDR"
8197 [ "$CFG_XRENDER" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRENDER"
8198 [ "$CFG_MITSHM" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MITSHM"
8199 [ "$CFG_XSHAPE" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SHAPE"
8200 [ "$CFG_XVIDEO" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XVIDEO"
8201 [ "$CFG_XSYNC" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XSYNC"
8202 [ "$CFG_XINPUT" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINPUT QT_NO_TABLET"
8203
8204 [ "$CFG_XCURSOR" = "runtime" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XCURSOR"
8205 [ "$CFG_XINERAMA" = "runtime" ]  && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINERAMA"
8206 [ "$CFG_XFIXES" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XFIXES"
8207 [ "$CFG_XRANDR" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XRANDR"
8208 [ "$CFG_XINPUT" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINPUT"
8209 [ "$CFG_ALSA" = "no" ]           && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ALSA"
8210 [ "$CFG_PULSEAUDIO" = "no" ]          && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_PULSEAUDIO"
8211 [ "$CFG_COREWLAN" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_COREWLAN"
8212 [ "$CFG_ICD" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ICD"
8213
8214 # sort QCONFIG_FLAGS for neatness if we can
8215 [ '!' -z "$AWK" ] && QCONFIG_FLAGS=`echo $QCONFIG_FLAGS | $AWK '{ gsub(" ", "\n"); print }' | sort | uniq`
8216 QCONFIG_FLAGS=`echo $QCONFIG_FLAGS`
8217
8218 if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
8219     # Enable Symbian DLLs and export rules.
8220     # We cannot use Linux's default export rules since they export everything.
8221     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_DLL"
8222     # Disable non-working features.
8223     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT QT_NO_QFUTURE QT_NO_CRASHHANDLER QT_NO_PRINTER QT_NO_SYSTEMTRAYICON"
8224 fi
8225
8226 if [ -n "$QCONFIG_FLAGS" ]; then
8227 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
8228 #ifndef QT_BOOTSTRAPPED
8229
8230 EOF
8231     for cfg in $QCONFIG_FLAGS; do
8232         cfgd=`echo $cfg | sed 's/=.*$//'` # trim pushed 'Foo=Bar' defines
8233         cfg=`echo $cfg | sed 's/=/ /'`    # turn first '=' into a space
8234         # figure out define logic, so we can output the correct
8235         # ifdefs to override the global defines in a project
8236         cfgdNeg=
8237         if [ true ] && echo "$cfgd" | grep 'QT_NO_' >/dev/null 2>&1; then
8238             # QT_NO_option can be forcefully turned on by QT_option
8239             cfgdNeg=`echo $cfgd | sed "s,QT_NO_,QT_,"`
8240         elif [ true ] && echo "$cfgd" | grep 'QT_' >/dev/null 2>&1; then
8241             # QT_option can be forcefully turned off by QT_NO_option
8242             cfgdNeg=`echo $cfgd | sed "s,QT_,QT_NO_,"`
8243         fi
8244
8245         if [ -z $cfgdNeg ]; then
8246 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
8247 #ifndef $cfgd
8248 # define $cfg
8249 #endif
8250
8251 EOF
8252         else
8253 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
8254 #if defined($cfgd) && defined($cfgdNeg)
8255 # undef $cfgd
8256 #elif !defined($cfgd) && !defined($cfgdNeg)
8257 # define $cfg
8258 #endif
8259
8260 EOF
8261         fi
8262     done
8263 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
8264 #endif // QT_BOOTSTRAPPED
8265
8266 EOF
8267 fi
8268
8269 if [ "$CFG_REDUCE_EXPORTS" = "yes" ]; then
8270 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
8271 #define QT_VISIBILITY_AVAILABLE
8272
8273 EOF
8274 fi
8275
8276 if [ -n "$QT_LIBINFIX" ]; then
8277 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
8278 #define QT_LIBINFIX "$QT_LIBINFIX"
8279
8280 EOF
8281 fi
8282
8283 if [ -n "$CFG_RUNTIME_SYSTEM" ]; then
8284 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
8285 #define QT_DEFAULT_RUNTIME_SYSTEM "$CFG_RUNTIME_SYSTEM"
8286
8287 EOF
8288 fi
8289
8290 # avoid unecessary rebuilds by copying only if qconfig.h has changed
8291 if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then
8292     rm -f "$outpath/src/corelib/global/qconfig.h.new"
8293 else
8294     [ -f "$outpath/src/corelib/global/qconfig.h" ] && chmod +w "$outpath/src/corelib/global/qconfig.h"
8295     mv "$outpath/src/corelib/global/qconfig.h.new" "$outpath/src/corelib/global/qconfig.h"
8296     chmod -w "$outpath/src/corelib/global/qconfig.h"
8297     for conf in "$outpath/include/QtCore/qconfig.h" "$outpath/include/Qt/qconfig.h"; do
8298         ln -s "$outpath/src/corelib/global/qconfig.h" "$conf"
8299     done
8300 fi
8301
8302 #-------------------------------------------------------------------------------
8303 # save configuration into qconfig.pri
8304 #-------------------------------------------------------------------------------
8305 QTCONFIG="$outpath/mkspecs/qconfig.pri"
8306 QTCONFIG_CONFIG="$QTCONFIG_CONFIG no_mocdepend"
8307 [ -f "$QTCONFIG.tmp" ] && rm -f "$QTCONFIG.tmp"
8308 if [ "$CFG_DEBUG" = "yes" ]; then
8309     QTCONFIG_CONFIG="$QTCONFIG_CONFIG debug"
8310     if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
8311         QT_CONFIG="$QT_CONFIG release"
8312     fi
8313     QT_CONFIG="$QT_CONFIG debug"
8314 elif [ "$CFG_DEBUG" = "no" ]; then
8315     QTCONFIG_CONFIG="$QTCONFIG_CONFIG release"
8316     if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
8317         QT_CONFIG="$QT_CONFIG debug"
8318     fi
8319     QT_CONFIG="$QT_CONFIG release"
8320 fi
8321 if [ "$CFG_STL" = "yes" ]; then
8322     QTCONFIG_CONFIG="$QTCONFIG_CONFIG stl"
8323 fi
8324 if [ "$CFG_FRAMEWORK" = "no" ]; then
8325     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_no_framework"
8326 else
8327     QT_CONFIG="$QT_CONFIG qt_framework"
8328     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_framework"
8329 fi
8330 if [ "$PLATFORM_MAC" = "yes" ]; then
8331     QT_CONFIG="$QT_CONFIG $CFG_MAC_ARCHS"
8332 fi
8333 if [ "$CFG_DEV" = "yes" ]; then
8334     QT_CONFIG="$QT_CONFIG private_tests"
8335 fi
8336
8337 if [ -z "$QT_CFLAGS_FPU" ]; then
8338     if echo "$XPLATFORM" | grep "symbian-sbsv2" > /dev/null 2>&1; then
8339         QT_CFLAGS_FPU=softvfp
8340     fi
8341 fi
8342
8343 # Make the application arch follow the Qt arch for single arch builds.
8344 # (for multiple-arch builds, set CONFIG manually in the application .pro file)
8345 if [ `echo "$CFG_MAC_ARCHS" | wc -w` -eq 1 ]; then
8346     QTCONFIG_CONFIG="$QTCONFIG_CONFIG $CFG_MAC_ARCHS"
8347 fi
8348
8349 cat >>"$QTCONFIG.tmp" <<EOF
8350 #configuration
8351 CONFIG += $QTCONFIG_CONFIG
8352 QT_ARCH = $CFG_ARCH
8353 QT_EDITION = $Edition
8354 QT_CONFIG += $QT_CONFIG
8355
8356 #versioning
8357 QT_VERSION = $QT_VERSION
8358 QT_MAJOR_VERSION = $QT_MAJOR_VERSION
8359 QT_MINOR_VERSION = $QT_MINOR_VERSION
8360 QT_PATCH_VERSION = $QT_PATCH_VERSION
8361
8362 #namespaces
8363 QT_LIBINFIX = $QT_LIBINFIX
8364 QT_NAMESPACE = $QT_NAMESPACE
8365 QT_NAMESPACE_MAC_CRC = $QT_NAMESPACE_MAC_CRC
8366
8367 EOF
8368 if [ -n "$CFG_SYSROOT" ]; then
8369     echo "# sysroot" >>"$QTCONFIG.tmp"
8370     echo `basename "$XQMAKESPEC"` \{ >>"$QTCONFIG.tmp"
8371     echo "  QT_SYSROOT      += \$\$quote($CFG_SYSROOT)" >>"$QTCONFIG.tmp"
8372     echo "  QMAKE_CFLAGS    += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp"
8373     echo "  QMAKE_CXXFLAGS  += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp"
8374     echo "  QMAKE_LFLAGS    += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp"
8375     echo "}" >> "$QTCONFIG.tmp"
8376     echo >> "$QTCONFIG.tmp"
8377 fi
8378 if [ "$CFG_RPATH" = "yes" ]; then
8379     echo "QMAKE_RPATHDIR += \"$QT_INSTALL_LIBS\"" >> "$QTCONFIG.tmp"
8380 fi
8381 if [ -n "$QT_GCC_MAJOR_VERSION" ]; then
8382     echo "QT_GCC_MAJOR_VERSION = $QT_GCC_MAJOR_VERSION" >> "$QTCONFIG.tmp"
8383     echo "QT_GCC_MINOR_VERSION = $QT_GCC_MINOR_VERSION" >> "$QTCONFIG.tmp"
8384     echo "QT_GCC_PATCH_VERSION = $QT_GCC_PATCH_VERSION" >> "$QTCONFIG.tmp"
8385 fi
8386 if [ -n "$QT_CFLAGS_FPU" ]; then
8387     echo "#Qt for symbian FPU settings" >> "$QTCONFIG.tmp"
8388     echo "MMP_RULES += \"ARMFPU $QT_CFLAGS_FPU\"" >> "$QTCONFIG.tmp"
8389 fi
8390
8391 if [ -n "$QMAKE_INCDIR_OPENGL_ES2" ]; then
8392     echo "\n#Qt opengl include path" >> "$QTCONFIG.tmp"
8393     echo "QMAKE_INCDIR_OPENGL_ES2 = \"$QMAKE_INCDIR_OPENGL_ES2\"" >> "$QTCONFIG.tmp"
8394 fi
8395
8396 # replace qconfig.pri if it differs from the newly created temp file
8397 if cmp -s "$QTCONFIG.tmp" "$QTCONFIG"; then
8398     rm -f "$QTCONFIG.tmp"
8399 else
8400     mv -f "$QTCONFIG.tmp" "$QTCONFIG"
8401 fi
8402
8403 #-------------------------------------------------------------------------------
8404 # save configuration into qmodule.pri
8405 #-------------------------------------------------------------------------------
8406 QTMODULE="$outpath/mkspecs/qmodule.pri"
8407
8408 cat >>"$QTMODULE.tmp" <<EOF
8409 #paths
8410 QT_SOURCE_TREE = \$\$quote($relpath)
8411 QT_BUILD_TREE = \$\$quote($outpath)
8412 QT_BUILD_PARTS = $CFG_BUILD_PARTS
8413
8414 #local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR
8415 QMAKE_MOC        = \$\$QT_BUILD_TREE/bin/moc
8416 QMAKE_UIC        = \$\$QT_BUILD_TREE/bin/uic
8417 QMAKE_RCC        = \$\$QT_BUILD_TREE/bin/rcc
8418 QMAKE_QDBUSXML2CPP = \$\$QT_BUILD_TREE/bin/qdbusxml2cpp
8419 QMAKE_INCDIR_QT  = \$\$QT_BUILD_TREE/include
8420 QMAKE_LIBDIR_QT  = \$\$QT_BUILD_TREE/lib
8421
8422 EOF
8423
8424 # Ensure we can link to uninistalled libraries
8425 if [ "$XPLATFORM_MINGW" != "yes" ] && [ "$CFG_EMBEDDED" != "nacl" ] && linkerSupportsFlag -rpath-link "$outpath/lib"; then
8426     echo "QMAKE_LFLAGS    = -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib \$\$QMAKE_LFLAGS" >> "$QTMODULE.tmp"
8427 fi
8428 if [ -n "$QT_CFLAGS_PSQL" ]; then
8429     echo "QT_CFLAGS_PSQL   = $QT_CFLAGS_PSQL" >> "$QTMODULE.tmp"
8430 fi
8431 if [ -n "$QT_LFLAGS_PSQL" ]; then
8432     echo "QT_LFLAGS_PSQL   = $QT_LFLAGS_PSQL" >> "$QTMODULE.tmp"
8433 fi
8434 if [ -n "$QT_CFLAGS_MYSQL" ]; then
8435     echo "QT_CFLAGS_MYSQL   = $QT_CFLAGS_MYSQL" >> "$QTMODULE.tmp"
8436 fi
8437 if [ -n "$QT_LFLAGS_MYSQL" ]; then
8438     echo "QT_LFLAGS_MYSQL   = $QT_LFLAGS_MYSQL" >> "$QTMODULE.tmp"
8439 fi
8440 if [ -n "$QT_CFLAGS_SQLITE" ]; then
8441     echo "QT_CFLAGS_SQLITE   = $QT_CFLAGS_SQLITE" >> "$QTMODULE.tmp"
8442 fi
8443 if [ -n "$QT_LFLAGS_SQLITE" ]; then
8444     echo "QT_LFLAGS_SQLITE   = $QT_LFLAGS_SQLITE" >> "$QTMODULE.tmp"
8445 fi
8446 if [ -n "$QT_LFLAGS_ODBC" ]; then
8447     echo "QT_LFLAGS_ODBC   = $QT_LFLAGS_ODBC" >> "$QTMODULE.tmp"
8448 fi
8449 if [ -n "$QT_LFLAGS_TDS" ]; then
8450     echo "QT_LFLAGS_TDS   = $QT_LFLAGS_TDS" >> "$QTMODULE.tmp"
8451 fi
8452
8453 if [ "$QT_EDITION" != "QT_EDITION_OPENSOURCE" ]; then
8454     echo "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" >> "$QTMODULE.tmp"
8455 fi
8456
8457 #dump in the OPENSSL_LIBS info
8458 if [ '!' -z "$OPENSSL_LIBS" ]; then
8459     echo "OPENSSL_LIBS = $OPENSSL_LIBS" >> "$QTMODULE.tmp"
8460 elif [ "$CFG_OPENSSL" = "linked" ]; then
8461     echo "OPENSSL_LIBS = -lssl -lcrypto" >> "$QTMODULE.tmp"
8462 fi
8463
8464 #dump in the SDK info
8465 if [ '!' -z "$CFG_SDK" ]; then
8466    echo "QMAKE_MAC_SDK = $CFG_SDK" >> "$QTMODULE.tmp"
8467 fi
8468
8469 # mac gcc -Xarch support
8470 if [ "$CFG_MAC_XARCH" = "no" ]; then
8471    echo "QMAKE_MAC_XARCH = no" >> "$QTMODULE.tmp"
8472 fi
8473
8474 #dump the qmake spec
8475 if [ -d "$outpath/mkspecs/$XPLATFORM" ]; then
8476    echo "QMAKESPEC = \$\$QT_BUILD_TREE/mkspecs/$XPLATFORM" >> "$QTMODULE.tmp"
8477 else
8478    echo "QMAKESPEC = $XPLATFORM" >> "$QTMODULE.tmp"
8479 fi
8480
8481 # cmdline args
8482 cat "$QMAKE_VARS_FILE" >> "$QTMODULE.tmp"
8483 rm -f "$QMAKE_VARS_FILE" 2>/dev/null
8484
8485 # replace qmodule.pri if it differs from the newly created temp file
8486 if cmp -s "$QTMODULE.tmp" "$QTMODULE"; then
8487     rm -f "$QTMODULE.tmp"
8488 else
8489     mv -f "$QTMODULE.tmp" "$QTMODULE"
8490 fi
8491
8492 #-------------------------------------------------------------------------------
8493 # save configuration into .qmake.cache
8494 #-------------------------------------------------------------------------------
8495
8496 CACHEFILE="$outpath/.qmake.cache"
8497 [ -f "$CACHEFILE.tmp" ] && rm -f "$CACHEFILE.tmp"
8498 cat >>"$CACHEFILE.tmp" <<EOF
8499 include(\$\$PWD/mkspecs/qmodule.pri)
8500 CONFIG += $QMAKE_CONFIG dylib create_prl link_prl depend_includepath fix_output_dirs QTDIR_build
8501 QMAKE_ABSOLUTE_SOURCE_ROOT = \$\$QT_SOURCE_TREE
8502 QMAKE_MOC_SRC    = \$\$QT_BUILD_TREE/src/moc
8503
8504 EOF
8505
8506 # incrementals
8507 INCREMENTAL=""
8508 [ "$CFG_INCREMENTAL" = "auto" ] && "$WHICH" p4 >/dev/null 2>&1 && [ "$CFG_DEV" = "yes" ] && CFG_INCREMENTAL="yes"
8509 if [ "$CFG_INCREMENTAL" = "yes" ]; then
8510     find "$relpath" -perm u+w -mtime -3 | grep 'cpp$' | while read f; do
8511         # don't need to worry about generated files
8512         [ -r `echo $f | sed "s,cpp$,ui,"` ] && continue
8513         basename "$f" | grep '^moc_' >/dev/null 2>&1 && continue
8514         # done
8515         INCREMENTAL="$INCREMENTAL `basename \"$f\" | sed 's,.cpp,.o,'`"
8516     done
8517     [ '!' -z "$INCREMENTAL" ] && echo "QMAKE_INCREMENTAL += $INCREMENTAL" >> "$CACHEFILE.tmp"
8518     [ -r "$outpath/.qmake.incremental" ] && echo "include($outpath/.qmake.incremental)" >> "$CACHEFILE.tmp"
8519 fi
8520
8521 # replace .qmake.cache if it differs from the newly created temp file
8522 if cmp -s "$CACHEFILE.tmp" "$CACHEFILE"; then
8523     rm -f "$CACHEFILE.tmp"
8524 else
8525     mv -f "$CACHEFILE.tmp" "$CACHEFILE"
8526 fi
8527
8528 #-------------------------------------------------------------------------------
8529 # give feedback on configuration
8530 #-------------------------------------------------------------------------------
8531
8532 case "$COMPILER" in
8533 g++*)
8534     if [ "$CFG_EXCEPTIONS" != "no" ]; then
8535         cat <<EOF
8536
8537         This target is using the GNU C++ compiler ($PLATFORM).
8538
8539         Recent versions of this compiler automatically include code for
8540         exceptions, which increase both the size of the Qt libraries and
8541         the amount of memory taken by your applications.
8542
8543         You may choose to re-run `basename $0` with the -no-exceptions
8544         option to compile Qt without exceptions. This is completely binary
8545         compatible, and existing applications will continue to work.
8546
8547 EOF
8548     fi
8549     ;;
8550 cc*)
8551     case "$PLATFORM" in
8552     irix-cc*)
8553         if [ "$CFG_EXCEPTIONS" != "no" ]; then
8554             cat <<EOF
8555
8556         This target is using the MIPSpro C++ compiler ($PLATFORM).
8557
8558         You may choose to re-run `basename $0` with the -no-exceptions
8559         option to compile Qt without exceptions. This will make the
8560         size of the Qt library smaller and reduce the amount of memory
8561         taken by your applications.
8562
8563 EOF
8564         fi
8565         ;;
8566     *) ;;
8567     esac
8568     ;;
8569 *) ;;
8570 esac
8571
8572 if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "no" ]  && [ "$CFG_WEBKIT" != "no" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
8573     cat <<EOF
8574         WARNING: DWARF2 debug symbols are not enabled. Linking webkit
8575         in debug mode will run out of memory on systems with 2GB or less.
8576         Install Xcode 2.4.1 or higher to enable DWARF2, or configure with
8577          -no-webkit or -release to skip webkit debug.
8578 EOF
8579 fi
8580
8581 echo
8582 if [ "$XPLATFORM" = "$PLATFORM" ]; then
8583     echo "Build type:    $PLATFORM"
8584 else
8585     echo "Building on:   $PLATFORM"
8586     echo "Building for:  $XPLATFORM"
8587 fi
8588
8589 if [ "$PLATFORM_MAC" = "yes" ]; then
8590     echo "Architecture:  $CFG_ARCH ($CFG_MAC_ARCHS )"
8591 else
8592     echo "Architecture:  $CFG_ARCH"
8593 fi
8594
8595 if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
8596     echo "Host architecture: $CFG_HOST_ARCH"
8597 fi
8598
8599 if [ "$PLATFORM_MAC" = "yes" ]; then
8600     if [ "$CFG_MAC_COCOA" = "yes" ]; then
8601         if [ "$CFG_MAC_CARBON" = "yes" ]; then
8602             echo "Using framework: Carbon for 32-bit, Cocoa for 64-bit"
8603         else
8604             echo "Using framework: Cocoa"
8605         fi
8606     else
8607         echo "Using framework: Carbon"
8608     fi
8609 fi
8610
8611 if [ -n "$PLATFORM_NOTES" ]; then
8612     echo "Platform notes:"
8613     echo "$PLATFORM_NOTES"
8614 else
8615     echo
8616 fi
8617
8618 if [ "$OPT_VERBOSE" = "yes" ]; then
8619     echo $ECHO_N "qmake vars .......... $ECHO_C"
8620     cat "$QMAKE_VARS_FILE" | tr '\n' ' '
8621     echo "qmake switches ......... $QMAKE_SWITCHES"
8622 fi
8623
8624 [ "$CFG_INCREMENTAL" = "yes" ] && [ '!' -z "$INCREMENTAL" ] && echo "Incremental ............ $INCREMENTAL"
8625 echo "Build .................. $CFG_BUILD_PARTS"
8626 echo "Configuration .......... $QMAKE_CONFIG $QT_CONFIG"
8627 if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
8628    echo "Debug .................. yes (combined)"
8629    if [ "$CFG_DEBUG" = "yes" ]; then
8630        echo "Default Link ........... debug"
8631    else
8632        echo "Default Link ........... release"
8633    fi
8634 else
8635    echo "Debug .................. $CFG_DEBUG"
8636 fi
8637 echo "Qt 3 compatibility ..... $CFG_QT3SUPPORT"
8638 [ "$CFG_DBUS" = "no" ]     && echo "QtDBus module .......... no"
8639 [ "$CFG_DBUS" = "yes" ]    && echo "QtDBus module .......... yes (run-time)"
8640 [ "$CFG_DBUS" = "linked" ] && echo "QtDBus module .......... yes (linked)"
8641 echo "QtConcurrent code ...... $CFG_CONCURRENT"
8642 echo "QtGui module ........... $CFG_GUI"
8643 echo "QtScript module ........ $CFG_SCRIPT"
8644 echo "QtScriptTools module ... $CFG_SCRIPTTOOLS"
8645 echo "QtXmlPatterns module ... $CFG_XMLPATTERNS"
8646 echo "Phonon module .......... $CFG_PHONON"
8647 echo "Multimedia module ...... $CFG_MULTIMEDIA"
8648 echo "SVG module ............. $CFG_SVG"
8649 case "$CFG_WEBKIT" in
8650     yes)   echo "WebKit module .......... yes" ;;
8651     debug) echo "WebKit module .......... yes (debug)" ;;
8652     no)    echo "WebKit module .......... no" ;;
8653 esac
8654 if [ "$CFG_WEBKIT" != "no" ] || [ "$CFG_SCRIPT" != "no" ]; then
8655     if [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
8656         echo "JavaScriptCore JIT ..... To be decided by JavaScriptCore"
8657     else
8658         echo "JavaScriptCore JIT ..... $CFG_JAVASCRIPTCORE_JIT"
8659     fi
8660 fi
8661 echo "Declarative module ..... $CFG_DECLARATIVE"
8662 if [ "$CFG_DECLARATIVE" = "yes" ]; then
8663     echo "Declarative debugging ...$CFG_DECLARATIVE_DEBUG"
8664 fi
8665 echo "Support for S60 ........ $CFG_S60"
8666 echo "Symbian DEF files ...... $CFG_SYMBIAN_DEFFILES"
8667 echo "STL support ............ $CFG_STL"
8668 echo "PCH support ............ $CFG_PRECOMPILE"
8669 echo "MMX/3DNOW/SSE/SSE2/SSE3. ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}/${CFG_SSE3}"
8670 echo "SSSE3/SSE4.1/SSE4.2..... ${CFG_SSSE3}/${CFG_SSE4_1}/${CFG_SSE4_2}"
8671 echo "AVX..................... ${CFG_AVX}"
8672 if [ "$CFG_ARCH" = "arm" ] || [ "$CFG_ARCH" = "armv6" ]; then
8673     echo "iWMMXt support ......... ${CFG_IWMMXT}"
8674     echo "NEON support ........... ${CFG_NEON}"
8675 fi
8676 [ "${PLATFORM_QWS}" != "yes" -a "${PLATFORM_QPA}" != "yes" ] && echo "Graphics System ........ $CFG_GRAPHICS_SYSTEM"
8677 echo "IPv6 support ........... $CFG_IPV6"
8678 echo "IPv6 ifname support .... $CFG_IPV6IFNAME"
8679 echo "getaddrinfo support .... $CFG_GETADDRINFO"
8680 echo "getifaddrs support ..... $CFG_GETIFADDRS"
8681 echo "Accessibility .......... $CFG_ACCESSIBILITY"
8682 echo "NIS support ............ $CFG_NIS"
8683 echo "CUPS support ........... $CFG_CUPS"
8684 echo "Iconv support .......... $CFG_ICONV"
8685 echo "Glib support ........... $CFG_GLIB"
8686 echo "GStreamer support ...... $CFG_GSTREAMER"
8687 echo "PulseAudio support ..... $CFG_PULSEAUDIO"
8688 echo "Large File support ..... $CFG_LARGEFILE"
8689 echo "GIF support ............ $CFG_GIF"
8690 if [ "$CFG_TIFF" = "no" ]; then
8691     echo "TIFF support ........... $CFG_TIFF"
8692 else
8693     echo "TIFF support ........... $CFG_TIFF ($CFG_LIBTIFF)"
8694 fi
8695 if [ "$CFG_JPEG" = "no" ]; then
8696     echo "JPEG support ........... $CFG_JPEG"
8697 else
8698     echo "JPEG support ........... $CFG_JPEG ($CFG_LIBJPEG)"
8699 fi
8700 if [ "$CFG_PNG" = "no" ]; then
8701     echo "PNG support ............ $CFG_PNG"
8702 else
8703     echo "PNG support ............ $CFG_PNG ($CFG_LIBPNG)"
8704 fi
8705 if [ "$CFG_MNG" = "no" ]; then
8706     echo "MNG support ............ $CFG_MNG"
8707 else
8708     echo "MNG support ............ $CFG_MNG ($CFG_LIBMNG)"
8709 fi
8710 echo "zlib support ........... $CFG_ZLIB"
8711 echo "Session management ..... $CFG_SM"
8712 if [ "$PLATFORM_QWS" = "yes" ]; then
8713     echo "Embedded support ....... $CFG_EMBEDDED"
8714     if [ "$CFG_QWS_FREETYPE" = "auto" ]; then
8715         echo "Freetype2 support ...... $CFG_QWS_FREETYPE ($CFG_LIBFREETYPE)"
8716     else
8717         echo "Freetype2 support ...... $CFG_QWS_FREETYPE"
8718     fi
8719     # Normalize the decoration output first
8720     CFG_GFX_ON=`echo ${CFG_GFX_ON}`
8721     CFG_GFX_PLUGIN=`echo ${CFG_GFX_PLUGIN}`
8722     echo "Graphics (qt) .......... ${CFG_GFX_ON}"
8723     echo "Graphics (plugin) ...... ${CFG_GFX_PLUGIN}"
8724     CFG_DECORATION_ON=`echo ${CFG_DECORATION_ON}`
8725     CFG_DECORATION_PLUGIN=`echo ${CFG_DECORATION_PLUGIN}`
8726     echo "Decorations (qt) ....... $CFG_DECORATION_ON"
8727     echo "Decorations (plugin) ... $CFG_DECORATION_PLUGIN"
8728     CFG_KBD_ON=`echo ${CFG_KBD_ON}`
8729     CFG_KBD_PLUGIN=`echo ${CFG_KBD_PLUGIN}`
8730     echo "Keyboard driver (qt) ... ${CFG_KBD_ON}"
8731     echo "Keyboard driver (plugin) .. ${CFG_KBD_PLUGIN}"
8732     CFG_MOUSE_ON=`echo ${CFG_MOUSE_ON}`
8733     CFG_MOUSE_PLUGIN=`echo ${CFG_MOUSE_PLUGIN}`
8734     echo "Mouse driver (qt) ...... $CFG_MOUSE_ON"
8735     echo "Mouse driver (plugin) .. $CFG_MOUSE_PLUGIN"
8736 fi
8737 if [ "$CFG_OPENGL" = "desktop" ]; then
8738     echo "OpenGL support ......... yes (Desktop OpenGL)"
8739 elif [ "$CFG_OPENGL" = "es1" ]; then
8740     echo "OpenGL support ......... yes (OpenGL ES 1.x Common profile)"
8741 elif [ "$CFG_OPENGL" = "es2" ]; then
8742     echo "OpenGL support ......... yes (OpenGL ES 2.x)"
8743 else
8744     echo "OpenGL support ......... no"
8745 fi
8746 if [ "$CFG_EGL" != "no" ]; then
8747     if [ "$CFG_EGL_GLES_INCLUDES" = "yes" ]; then
8748         echo "EGL support ............ yes <GLES/egl.h>"
8749     else
8750         echo "EGL support ............ yes <EGL/egl.h>"
8751     fi
8752 fi
8753 if [ "$CFG_OPENVG" ]; then
8754     if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
8755         echo "OpenVG support ......... ShivaVG"
8756     else
8757         echo "OpenVG support ......... $CFG_OPENVG"
8758     fi
8759 fi
8760 if [ "$PLATFORM_X11" = "yes" ]; then
8761     echo "NAS sound support ...... $CFG_NAS"
8762     echo "XShape support ......... $CFG_XSHAPE"
8763     echo "XVideo support ......... $CFG_XVIDEO"
8764     echo "XSync support .......... $CFG_XSYNC"
8765     echo "Xinerama support ....... $CFG_XINERAMA"
8766     echo "Xcursor support ........ $CFG_XCURSOR"
8767     echo "Xfixes support ......... $CFG_XFIXES"
8768     echo "Xrandr support ......... $CFG_XRANDR"
8769     echo "Xrender support ........ $CFG_XRENDER"
8770     echo "Xi support ............. $CFG_XINPUT"
8771     echo "MIT-SHM support ........ $CFG_MITSHM"
8772     echo "FontConfig support ..... $CFG_FONTCONFIG"
8773     echo "XKB Support ............ $CFG_XKB"
8774     echo "immodule support ....... $CFG_IM"
8775     echo "GTK theme support ...... $CFG_QGTKSTYLE"
8776 fi
8777 [ "$CFG_SQL_mysql" != "no" ] && echo "MySQL support .......... $CFG_SQL_mysql"
8778 [ "$CFG_SQL_psql" != "no" ] && echo "PostgreSQL support ..... $CFG_SQL_psql"
8779 [ "$CFG_SQL_odbc" != "no" ] && echo "ODBC support ........... $CFG_SQL_odbc"
8780 [ "$CFG_SQL_oci" != "no" ] && echo "OCI support ............ $CFG_SQL_oci"
8781 [ "$CFG_SQL_tds" != "no" ] && echo "TDS support ............ $CFG_SQL_tds"
8782 [ "$CFG_SQL_db2" != "no" ] && echo "DB2 support ............ $CFG_SQL_db2"
8783 [ "$CFG_SQL_ibase" != "no" ] && echo "InterBase support ...... $CFG_SQL_ibase"
8784 [ "$CFG_SQL_sqlite2" != "no" ] && echo "SQLite 2 support ....... $CFG_SQL_sqlite2"
8785 [ "$CFG_SQL_sqlite" != "no" ] && echo "SQLite support ......... $CFG_SQL_sqlite ($CFG_SQLITE)"
8786
8787 OPENSSL_LINKAGE=""
8788 if [ "$CFG_OPENSSL" = "yes" ]; then
8789     OPENSSL_LINKAGE="(run-time)"
8790 elif [ "$CFG_OPENSSL" = "linked" ]; then
8791     OPENSSL_LINKAGE="(linked)"
8792 fi
8793 echo "OpenSSL support ........ $CFG_OPENSSL $OPENSSL_LINKAGE"
8794 echo "Alsa support ........... $CFG_ALSA"
8795 if [ "$PLATFORM_MAC" = "yes" ]; then
8796     echo "CoreWlan support ....... $CFG_COREWLAN"
8797 fi
8798 echo "ICD support ............ $CFG_ICD"
8799 echo "libICU support ......... $CFG_ICU"
8800 echo
8801
8802 [ "$CFG_PTMALLOC" != "no" ] && echo "Use ptmalloc ........... $CFG_PTMALLOC"
8803
8804 # complain about not being able to use dynamic plugins if we are using a static build
8805 if [ "$CFG_SHARED" = "no" ]; then
8806     echo
8807     echo "WARNING: Using static linking will disable the use of dynamically"
8808     echo "loaded plugins. Make sure to import all needed static plugins,"
8809     echo "or compile needed modules into the library."
8810     echo
8811 fi
8812 if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then
8813     echo
8814     echo "NOTE: When linking against OpenSSL, you can override the default"
8815     echo "library names through OPENSSL_LIBS."
8816     echo "For example:"
8817     echo "    OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked"
8818     echo
8819 fi
8820 if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then
8821     echo
8822     echo "Error: debug-only framework builds are not supported. Configure with -no-framework"
8823     echo "if you want a pure debug build."
8824     echo
8825     exit 1
8826 fi
8827
8828 sepath=`echo "$relpath" | sed -e 's/\\./\\\\./g'`
8829 PROCS=1
8830 EXEC=""
8831
8832
8833 #-------------------------------------------------------------------------------
8834 # build makefiles based on the configuration
8835 #-------------------------------------------------------------------------------
8836
8837 echo "Finding project files. Please wait..."
8838 if [ "$CFG_NOPROCESS" != "yes" ]; then
8839     "$outpath/bin/qmake" -prl -r "${relpath}/qtbase.pro"
8840     if [ -f "${relpath}/qtbase.pro" ]; then
8841         mkfile="${outpath}/Makefile"
8842         [ -f "$mkfile" ] && chmod +w "$mkfile"
8843         QTDIR="$outpath" "$outpath/bin/qmake" -spec "$XQMAKESPEC" "${relpath}/qtbase.pro" -o "$mkfile"
8844     fi
8845 fi
8846
8847 # .projects      -> projects to process
8848 # .projects.1    -> qt and moc
8849 # .projects.2    -> subdirs and libs
8850 # .projects.3    -> the rest
8851 rm -f .projects .projects.1 .projects.2 .projects.3
8852
8853 QMAKE_PROJECTS=`find "$relpath/." -name '*.pro' -print | sed 's-/\./-/-'`
8854 if [ -z "$AWK" ]; then
8855     for p in `echo $QMAKE_PROJECTS`; do
8856         echo "$p" >> .projects
8857     done
8858 else
8859     cat >projects.awk <<EOF
8860 BEGIN {
8861     files = 0
8862     target_file = ""
8863     input_file = ""
8864
8865     first = "./.projects.1.tmp"
8866     second = "./.projects.2.tmp"
8867     third = "./.projects.3.tmp"
8868 }
8869
8870 FNR == 1 {
8871     if ( input_file ) {
8872         if ( ! target_file )
8873             target_file = third
8874         print input_file >target_file
8875     }
8876
8877     matched_target = 0
8878     template_lib = 0
8879     input_file = FILENAME
8880     target_file = ""
8881 }
8882
8883 /^(TARGET.*=)/ {
8884     if ( \$3 == "moc" || \$3 ~ /^Qt/ ) {
8885         target_file = first
8886         matched_target = 1
8887     } else if ( \$3 == "lrelease" || \$3 == "qm_phony_target" ) {
8888         target_file = second
8889         matched_target = 1
8890     }
8891 }
8892
8893 matched_target == 0 && /^(TEMPLATE.*=)/ {
8894     if ( \$3 == "subdirs" )
8895         target_file = second
8896     else if ( \$3 == "lib" )
8897         template_lib = 1
8898     else
8899         target_file = third
8900 }
8901
8902 matched_target == 0 && template_lib == 1 && /^(CONFIG.*=)/ {
8903     if ( \$0 ~ /plugin/ )
8904         target_file = third
8905     else
8906         target_file = second
8907 }
8908
8909 END {
8910     if ( input_file ) {
8911         if ( ! target_file )
8912             target_file = third
8913         print input_file >>target_file
8914     }
8915 }
8916
8917 EOF
8918
8919     rm -f .projects.all
8920     for p in `echo $QMAKE_PROJECTS`; do
8921        echo "$p" >> .projects.all
8922     done
8923
8924     # if you get errors about the length of the command line to awk, change the -l arg
8925     # to split below
8926     split -l 100 .projects.all .projects.all.
8927     for p in .projects.all.*; do
8928        "$AWK" -f projects.awk `cat $p`
8929        [ -f .projects.1.tmp ] && cat .projects.1.tmp >> .projects.1
8930        [ -f .projects.2.tmp ] && cat .projects.2.tmp >> .projects.2
8931        [ -f .projects.3.tmp ] && cat .projects.3.tmp >> .projects.3
8932        rm -f .projects.1.tmp .projects.2.tmp .projects.3.tmp $p
8933     done
8934     rm -f .projects.all* projects.awk
8935
8936     [ -f .projects.1 ] && cat .projects.1 >>.projects
8937     [ -f .projects.2 ] && cat .projects.2 >>.projects
8938     rm -f .projects.1 .projects.2
8939     if [ -f .projects.3 ] && [ "$OPT_FAST" = "no" ]; then
8940        cat .projects.3 >>.projects
8941        rm -f .projects.3
8942     fi
8943 fi
8944 # don't sort Qt and MOC in with the other project files
8945 # also work around a segfaulting uniq(1)
8946 if [ -f .sorted.projects.2 ]; then
8947     sort .sorted.projects.2 > .sorted.projects.2.new
8948     mv -f .sorted.projects.2.new .sorted.projects.2
8949     cat .sorted.projects.2 >> .sorted.projects.1
8950 fi
8951 [ -f .sorted.projects.1 ] && sort .sorted.projects.1 >> .sorted.projects
8952 rm -f .sorted.projects.2 .sorted.projects.1
8953
8954 NORM_PROJECTS=0
8955 FAST_PROJECTS=0
8956 if [ -f .projects ]; then
8957    uniq .projects >.tmp
8958    mv -f .tmp .projects
8959    NORM_PROJECTS=`cat .projects | wc -l | sed -e "s, ,,g"`
8960 fi
8961 if [ -f .projects.3 ]; then
8962    uniq .projects.3 >.tmp
8963    mv -f .tmp .projects.3
8964    FAST_PROJECTS=`cat .projects.3 | wc -l | sed -e "s, ,,g"`
8965 fi
8966 echo "  `expr $NORM_PROJECTS + $FAST_PROJECTS` projects found."
8967 echo
8968
8969 PART_ROOTS=
8970 for part in $CFG_BUILD_PARTS; do
8971     case "$part" in
8972     tools) PART_ROOTS="$PART_ROOTS tools" ;;
8973     libs) PART_ROOTS="$PART_ROOTS src tools/linguist/lrelease" ;;
8974     translations) PART_ROOTS="$PART_ROOTS translations" ;;
8975     examples) PART_ROOTS="$PART_ROOTS examples demos" ;;
8976     *) ;;
8977     esac
8978 done
8979
8980 if [ "$CFG_DEV" = "yes" ]; then
8981     PART_ROOTS="$PART_ROOTS tests"
8982 fi
8983
8984 echo "Creating makefiles. Please wait..."
8985 for file in .projects .projects.3; do
8986     [ '!' -f "$file" ] && continue
8987     for a in `cat $file`; do
8988         IN_ROOT=no
8989         for r in $PART_ROOTS; do
8990             if echo "$a" | grep "^$r" >/dev/null 2>&1 || echo "$a" | grep "^$relpath/$r" >/dev/null 2>&1; then
8991                 IN_ROOT=yes
8992                 break
8993             fi
8994         done
8995         [ "$IN_ROOT" = "no" ] && continue
8996
8997         case $a in
8998         *winmain/winmain.pro)
8999             if [ "$CFG_NOPROCESS" = "yes" ] || [ "$XPLATFORM_MINGW" != "yes" ]; then
9000                 continue
9001             fi
9002             SPEC=$XQMAKESPEC ;;
9003         *s60main/s60main.pro)
9004             if [ "$CFG_NOPROCESS" = "yes" ] || [ "$XPLATFORM_SYMBIAN" != "yes" ]; then
9005                 continue
9006             fi;;
9007         *examples/activeqt/*) continue ;;
9008         */qmake/qmake.pro) continue ;;
9009         *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*|*linguist/lrelease*) SPEC=$QMAKESPEC ;;
9010         *) if [ "$CFG_NOPROCESS" = "yes" ]; then
9011               continue
9012            else
9013               SPEC=$XQMAKESPEC
9014            fi;;
9015         esac
9016         dir=`dirname "$a" | sed -e "s;$sepath;.;g"`
9017         test -d "$dir" || mkdir -p "$dir"
9018         OUTDIR="$outpath/$dir"
9019         if [ -f "${OUTDIR}/Makefile" ] && [ "$OPT_FAST" = "yes" ]; then
9020             # fast configure - the makefile exists, skip it
9021             # since the makefile exists, it was generated by qmake, which means we
9022             # can skip it, since qmake has a rule to regenerate the makefile if the .pro
9023             # file changes...
9024             [ "$OPT_VERBOSE" = "yes" ] && echo "  skipping $a"
9025             continue;
9026         fi
9027         QMAKE_SPEC_ARGS="-spec $SPEC"
9028         echo $ECHO_N "  for $a$ECHO_C"
9029
9030         QMAKE="$outpath/bin/qmake"
9031         QMAKE_ARGS="$QMAKE_SWITCHES $QMAKE_SPEC_ARGS"
9032         if [ "$file" = ".projects.3" ]; then
9033             echo " (fast)"
9034
9035             cat >"${OUTDIR}/Makefile" <<EOF
9036 # ${OUTDIR}/Makefile: generated by configure
9037 #
9038 # WARNING: This makefile will be replaced with a real makefile.
9039 # All changes made to this file will be lost.
9040 EOF
9041             [ "$CFG_DEBUG_RELEASE" = "no" ] && echo "first_target: first" >>${OUTDIR}/Makefile
9042
9043             cat >>"${OUTDIR}/Makefile" <<EOF
9044 QMAKE = "$QMAKE"
9045 all clean install qmake first Makefile: FORCE
9046         \$(QMAKE) $QMAKE_ARGS -o "$OUTDIR" "$a"
9047         cd "$OUTDIR"
9048         \$(MAKE) \$@
9049
9050 FORCE:
9051
9052 EOF
9053         else
9054             if [ "$OPT_VERBOSE" = "yes" ]; then
9055                 echo " (`basename $SPEC`)"
9056                 echo "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
9057             else
9058                 echo
9059             fi
9060
9061             [ -f "${OUTDIR}/Makefile" ] && chmod +w "${OUTDIR}/Makefile"
9062             QTDIR="$outpath" "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
9063        fi
9064     done
9065 done
9066 rm -f .projects .projects.3
9067
9068 #-------------------------------------------------------------------------------
9069 # check for platforms that we don't yet know about
9070 #-------------------------------------------------------------------------------
9071 if [ "$CFG_ARCH" = "generic" ]; then
9072 cat <<EOF
9073
9074         NOTICE: Atomic operations are not yet supported for this
9075         architecture.
9076
9077         Qt will use the 'generic' architecture instead, which uses a
9078         single pthread_mutex_t to protect all atomic operations. This
9079         implementation is the slow (but safe) fallback implementation
9080         for architectures Qt does not yet support.
9081 EOF
9082 fi
9083
9084 #-------------------------------------------------------------------------------
9085 # check if the user passed the -no-zlib option, which is no longer supported
9086 #-------------------------------------------------------------------------------
9087 if [ -n "$ZLIB_FORCED" ]; then
9088     which_zlib="supplied"
9089     if [ "$CFG_ZLIB" = "system" ]; then
9090         which_zlib="system"
9091     fi
9092
9093 cat <<EOF
9094
9095         NOTICE: The -no-zlib option was supplied but is no longer
9096         supported.
9097
9098         Qt now requires zlib support in all builds, so the -no-zlib
9099         option was ignored. Qt will be built using the $which_zlib
9100         zlib.
9101 EOF
9102 fi
9103
9104 #-------------------------------------------------------------------------------
9105 # finally save the executed command to another script
9106 #-------------------------------------------------------------------------------
9107 if [ `basename $0` != "config.status" ]; then
9108     CONFIG_STATUS="$relpath/$relconf $OPT_CMDLINE"
9109
9110     # add the system variables
9111     for varname in $SYSTEM_VARIABLES; do
9112         cmd=`echo \
9113 'if [ -n "\$'${varname}'" ]; then
9114     CONFIG_STATUS="'${varname}'='"'\\\$${varname}'"' \$CONFIG_STATUS"
9115 fi'`
9116         eval "$cmd"
9117     done
9118
9119     echo "$CONFIG_STATUS" | grep '\-confirm\-license' >/dev/null 2>&1 || CONFIG_STATUS="$CONFIG_STATUS -confirm-license"
9120
9121     [ -f "$outpath/config.status" ] && rm -f "$outpath/config.status"
9122     echo "#!/bin/sh" > "$outpath/config.status"
9123     echo "if [ \"\$#\" -gt 0 ]; then" >> "$outpath/config.status"
9124     echo "  $CONFIG_STATUS \"\$@\"" >> "$outpath/config.status"
9125     echo "else" >> "$outpath/config.status"
9126     echo "  $CONFIG_STATUS" >> "$outpath/config.status"
9127     echo "fi" >> "$outpath/config.status"
9128     chmod +x "$outpath/config.status"
9129 fi
9130
9131 if [ -n "$RPATH_MESSAGE" ]; then
9132     echo
9133     echo "$RPATH_MESSAGE"
9134 fi
9135
9136 MAKE=`basename "$MAKE"`
9137 echo
9138 echo Qt is now configured for building. Just run \'$MAKE\'.
9139 if [ "$relpath" = "$QT_INSTALL_PREFIX" ]; then
9140     echo Once everything is built, Qt is installed.
9141     echo You should not run \'$MAKE install\'.
9142 else
9143     echo Once everything is built, you must run \'$MAKE install\'.
9144     echo Qt will be installed into $QT_INSTALL_PREFIX
9145 fi
9146 echo
9147 echo To reconfigure, run \'$MAKE confclean\' and \'configure\'.
9148 echo