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