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