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