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