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