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