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