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