Remove 'tests' as default build part.
[profile/ivi/qtbase.git] / configure
1 #!/bin/sh
2 #############################################################################
3 ##
4 ## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
5 ## Contact: http://www.qt-project.org/
6 ##
7 ## This file is the build configuration utility of the Qt Toolkit.
8 ##
9 ## $QT_BEGIN_LICENSE:LGPL$
10 ## GNU Lesser General Public License Usage
11 ## This file may be used under the terms of the GNU Lesser General Public
12 ## License version 2.1 as published by the Free Software Foundation and
13 ## appearing in the file LICENSE.LGPL included in the packaging of this
14 ## file. Please review the following information to ensure the GNU Lesser
15 ## General Public License version 2.1 requirements will be met:
16 ## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 ##
18 ## In addition, as a special exception, Nokia gives you certain additional
19 ## rights. These rights are described in the Nokia Qt LGPL Exception
20 ## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 ##
22 ## GNU General Public License Usage
23 ## Alternatively, this file may be used under the terms of the GNU General
24 ## Public License version 3.0 as published by the Free Software Foundation
25 ## and appearing in the file LICENSE.GPL included in the packaging of this
26 ## file. Please review the following information to ensure the GNU General
27 ## Public License version 3.0 requirements will be met:
28 ## http://www.gnu.org/copyleft/gpl.html.
29 ##
30 ## Other Usage
31 ## Alternatively, this file may be used in accordance with the terms and
32 ## conditions contained in a signed written agreement between you and Nokia.
33 ##
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 DEVICE_VARS_FILE=.device.vars
75
76 :> "$QMAKE_VARS_FILE"
77 :> "$DEVICE_VARS_FILE"
78
79 #-------------------------------------------------------------------------------
80 # utility functions
81 #-------------------------------------------------------------------------------
82
83 shellEscape()
84 {
85     echo "$@" | sed 's/ /\ /g'
86 }
87
88 # Adds a new qmake variable to the cache
89 # Usage: QMakeVar mode varname contents
90 #   where mode is one of: set, add, del
91 QMakeVar()
92 {
93     case "$1" in
94         set)
95             eq="="
96             ;;
97         add)
98             eq="+="
99             ;;
100         del)
101             eq="-="
102             ;;
103         *)
104             echo >&2 "BUG: wrong command to QMakeVar: $1"
105             ;;
106     esac
107
108     echo "$2" "$eq" "$3" >> "$QMAKE_VARS_FILE"
109 }
110
111 # Helper function for getQMakeConf. It parses include statements in
112 # qmake.conf and prints out the expanded file
113 getQMakeConf1()
114 {
115     while read line; do case "$line" in
116         include*)
117             inc_file=`echo "$line" | sed -n -e "/^include.*(.*)/s/include.*(\(.*\)).*$/\1/p"`
118             current_dir=`dirname "$1"`
119             conf_file="$current_dir/$inc_file"
120             if [ ! -f  "$conf_file" ]; then
121                 echo "WARNING: Unable to find file $conf_file" >&2
122                 continue
123             fi
124             getQMakeConf1 "$conf_file"
125         ;;
126         *)
127             echo "$line"
128         ;;
129     esac; done < "$1"
130 }
131
132 getQMakeConf2()
133 {
134     $AWK '
135 BEGIN {
136     values["LITERAL_WHITESPACE"] = " "
137     values["LITERAL_DOLLAR"] = "$"
138 }
139 /^[_A-Z0-9.]+[ \t]*\+?=/ {
140     valStart = index($0, "=") + 1
141
142     append = 0
143     if (substr($0, valStart - 2, 1) == "+") {
144         append = 1
145     }
146
147     variable = substr($0, 0, valStart - 2 - append)
148     value = substr($0, valStart)
149     gsub("[ \t]+", "", variable)
150     gsub("^[ \t]+", "", value)
151     gsub("[ \t]+$", "", value)
152
153     ovalue = ""
154     while (match(value, /\$\$(\{[_A-Z0-9.]+\}|[_A-Z0-9.]+)/)) {
155         ovalue = ovalue substr(value, 1, RSTART - 1)
156         var = substr(value, RSTART + 2, RLENGTH - 2)
157         value = substr(value, RSTART + RLENGTH)
158         if (var ~ /^{/) {
159             var = substr(var, 2, length(var) - 2)
160         }
161         ovalue = ovalue values[var]
162     }
163     ovalue = ovalue value
164
165     combinedValue = values[variable]
166     if (append == 1 && length(combinedValue) > 0) {
167         combinedValue = combinedValue " " ovalue
168     } else {
169         combinedValue = ovalue
170     }
171     values[variable] = combinedValue
172 }
173 END {
174     for (var in values) {
175         print var "=" values[var]
176     }
177 }
178 '
179 }
180
181 getQMakeConf3()
182 {
183     echo "$2" | $AWK "/^($1)=/ { print substr(\$0, index(\$0, \"=\") + 1) }"
184 }
185
186 # relies on $QMAKESPEC being set correctly. parses include statements in
187 # qmake.conf and prints out the expanded file
188 getQMakeConf()
189 {
190     if [ -z "$specvals" ]; then
191         specvals=`getQMakeConf1 "$QMAKESPEC/qmake.conf" | getQMakeConf2`
192     fi
193     getQMakeConf3 "$1" "$specvals"
194 }
195
196 getXQMakeConf()
197 {
198     if [ -z "$xspecvals" ]; then
199         xspecvals=`getQMakeConf1 "$XQMAKESPEC/qmake.conf" | getQMakeConf2`
200     fi
201     getQMakeConf3 "$1" "$xspecvals"
202 }
203
204 # relies on $TEST_COMPILER being set correctly
205 compilerSupportsFlag()
206 {
207     cat >conftest.cpp <<EOF
208 int main() { return 0; }
209 EOF
210     "$TEST_COMPILER" "$@" -o conftest.o conftest.cpp
211     ret=$?
212     rm -f conftest.cpp conftest.o
213     return $ret
214 }
215
216 # relies on $TEST_COMPILER being set correctly
217 linkerSupportsFlag()
218 {
219     lflags=-Wl
220     for flag
221     do
222         safe_flag=`shellEscape "$flag"`
223         lflags=$lflags,$safe_flag
224     done
225     compilerSupportsFlag "$lflags" >/dev/null 2>&1
226 }
227
228 #-------------------------------------------------------------------------------
229 # device options
230 #-------------------------------------------------------------------------------
231 DeviceVar()
232 {
233     case "$1" in
234         set)
235             eq="="
236             ;;
237         *)
238             echo >&2 "BUG: wrong command to QMakeVar: $1"
239             ;;
240     esac
241
242     echo "$2" "$eq" "$3" >> "$DEVICE_VARS_FILE"
243 }
244
245 #-------------------------------------------------------------------------------
246 # operating system detection
247 #-------------------------------------------------------------------------------
248
249 # need that throughout the script
250 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
251 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
252 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
253 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
254
255 # detect the "echo without newline" style. usage: echo $ECHO_N "<string>$ECHO_C"
256 if echo '\c' | grep '\c' >/dev/null; then
257     ECHO_N=-n
258 else
259     ECHO_C='\c'
260 fi
261
262 #-------------------------------------------------------------------------------
263 # window system detection
264 #-------------------------------------------------------------------------------
265
266 PLATFORM_X11=no
267 PLATFORM_QPA=yes
268 BUILD_ON_MAC=no
269 PLATFORM_MAC=no
270 if [ -d /System/Library/Frameworks/Carbon.framework ]; then
271     BUILD_ON_MAC=yes
272     PLATFORM_MAC=maybe
273 fi
274
275 #-----------------------------------------------------------------------------
276 # Qt version detection
277 #-----------------------------------------------------------------------------
278 QT_VERSION=`grep '^# *define *QT_VERSION_STR' "$relpath"/src/corelib/global/qglobal.h`
279 QT_MAJOR_VERSION=
280 QT_MINOR_VERSION=0
281 QT_PATCH_VERSION=0
282 if [ -n "$QT_VERSION" ]; then
283    QT_VERSION=`echo $QT_VERSION | sed 's,^# *define *QT_VERSION_STR *"*\([^ ]*\)"$,\1,'`
284    MAJOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'`
285    if [ -n "$MAJOR" ]; then
286      MINOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'`
287       PATCH=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'`
288       QT_MAJOR_VERSION="$MAJOR"
289       [ -z "$MINOR" ] || QT_MINOR_VERSION="$MINOR"
290       [ -z "$PATCH" ] || QT_PATCH_VERSION="$PATCH"
291    fi
292 fi
293 if [ -z "$QT_MAJOR_VERSION" ]; then
294    echo "Cannot process version from qglobal.h: $QT_VERSION"
295    echo "Cannot proceed."
296    exit 1
297 fi
298
299 QT_PACKAGEDATE=`grep '^# *define *QT_PACKAGEDATE_STR' "$relpath"/src/corelib/global/qglobal.h | sed -e 's,^# *define *QT_PACKAGEDATE_STR *"\([^ ]*\)"$,\1,' -e s,-,,g`
300 if [ -z "$QT_PACKAGEDATE" ]; then
301    echo "Unable to determine package date from qglobal.h: '$QT_PACKAGEDATE'"
302    echo "Cannot proceed"
303    exit 1
304 fi
305
306 #-------------------------------------------------------------------------------
307 # check the license
308 #-------------------------------------------------------------------------------
309 COMMERCIAL_USER=ask
310 CFG_DEV=no
311 CFG_RTOS_ENABLED=yes
312 EditionString=Commercial
313
314 earlyArgParse()
315 {
316     # parse the arguments, setting things to "yes" or "no"
317     while [ "$#" -gt 0 ]; do
318         CURRENT_OPT="$1"
319         UNKNOWN_ARG=no
320         case "$1" in
321         #Autoconf style options
322         --enable-*)
323             VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"`
324             VAL=yes
325             ;;
326         --disable-*)
327             VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"`
328             VAL=no
329             ;;
330         --*=*)
331             VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"`
332             VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"`
333             ;;
334         --no-*)
335             VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
336             VAL=no
337             ;;
338         -embedded-lite|-qpa)
339             VAR=qpa
340             # this option may or may not be followed by an argument
341             if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
342                 VAL=auto
343             else
344                 shift;
345                 VAL=$1
346             fi
347             ;;
348         -h|help|--help|-help)
349             if [ "$VAL" = "yes" ]; then
350                 OPT_HELP="$VAL"
351                 COMMERCIAL_USER="no" #doesn't matter we will display the help
352             else
353                 UNKNOWN_OPT=yes
354                 COMMERCIAL_USER="no" #doesn't matter we will display the help
355             fi
356             ;;
357         --*)
358             VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
359             VAL=yes
360             ;;
361         -*)
362             VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
363             VAL="unknown"
364             ;;
365         *)
366             UNKNOWN_ARG=yes
367             ;;
368         esac
369         if [ "$UNKNOWN_ARG" = "yes" ]; then
370             shift
371             continue
372         fi
373         shift
374
375         UNKNOWN_OPT=no
376         case "$VAR" in
377         qpa)
378             if [ "$PLATFORM_QPA" != "no" ]; then
379                 if [ "$PLATFORM_QPA" = "maybe" ]; then
380                     PLATFORM_X11=no
381                     PLATFORM_QPA=yes
382                 fi
383             else
384                 echo "No license exists to enable Qt QPA. Disabling."
385             fi
386             ;;
387         developer-build)
388             CFG_DEV="yes"
389             ;;
390         commercial)
391             COMMERCIAL_USER="yes"
392             ;;
393         opensource)
394             COMMERCIAL_USER="no"
395             ;;
396         *)
397             UNKNOWN_OPT=yes
398             ;;
399         esac
400     done
401 }
402
403 earlyArgParse "$@"
404
405 if [ "$COMMERCIAL_USER" = "ask" ]; then
406     while true; do
407         echo "Which edition of Qt do you want to use ?"
408         echo
409         echo "Type 'c' if you want to use the Commercial Edition."
410         echo "Type 'o' if you want to use the Open Source Edition."
411         echo
412         read commercial
413         echo
414         if [ "$commercial" = "c" ]; then
415             COMMERCIAL_USER="yes"
416             break
417         elif [ "$commercial" = "o" ]; then
418             COMMERCIAL_USER="no"
419             break
420         fi
421     done
422 fi
423
424 if [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ]; then
425     # Commercial preview release
426     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
427     Licensee="Preview"
428     Edition="Preview"
429     QT_EDITION="QT_EDITION_DESKTOP"
430     LicenseType="Technology Preview"
431 elif [ $COMMERCIAL_USER = "yes" ]; then
432     # one of commercial editions
433     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
434     [ "$PLATFORM_QPA" = "maybe" ] && PLATFORM_QPA=no
435
436     # read in the license file
437     if [ -f "$LICENSE_FILE" ]; then
438         . "$LICENSE_FILE" >/dev/null 2>&1
439         if [ -z "$LicenseKeyExt" ]; then
440             echo
441             echo "You are using an old license file."
442             echo
443             echo "Please install the license file supplied by Nokia,"
444             echo "or install the Qt Open Source Edition if you intend to"
445             echo "develop free software."
446             exit 1
447         fi
448         if [ -z "$Licensee" ]; then
449             echo
450             echo "Invalid license key. Please check the license key."
451             exit 1
452         fi
453     else
454         if [ -z "$LicenseKeyExt" ]; then
455             echo
456             echo $ECHO_N "Please enter your license key: $ECHO_C"
457             read LicenseKeyExt
458             Licensee="Unknown user"
459         fi
460     fi
461
462     # Key verification
463     echo "$LicenseKeyExt" | grep ".....*-....*-....*-....*-.....*-.....*-...." >/dev/null 2>&1 \
464         && LicenseValid="yes" \
465         || LicenseValid="no"
466     if [ "$LicenseValid" != "yes" ]; then
467         echo
468         echo "Invalid license key. Please check the license key."
469         exit 1
470     fi
471     ProductCode=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1`
472     PlatformCode=`echo $LicenseKeyExt | cut -f 2 -d -`
473     LicenseTypeCode=`echo $LicenseKeyExt | cut -f 3 -d -`
474     LicenseFeatureCode=`echo $LicenseKeyExt | cut -f 4 -d - | cut -b 1`
475
476     # determine which edition we are licensed to use
477     case "$LicenseTypeCode" in
478     F4M)
479         LicenseType="Commercial"
480         case $ProductCode in
481         F)
482             Edition="Universal"
483             QT_EDITION="QT_EDITION_UNIVERSAL"
484             ;;
485         B)
486             Edition="FullFramework"
487             EditionString="Full Framework"
488             QT_EDITION="QT_EDITION_DESKTOP"
489             ;;
490         L)
491             Edition="GUIFramework"
492             EditionString="GUI Framework"
493             QT_EDITION="QT_EDITION_DESKTOPLIGHT"
494             ;;
495         esac
496         ;;
497     Z4M|R4M|Q4M)
498         LicenseType="Evaluation"
499         QMakeVar add DEFINES QT_EVAL
500         case $ProductCode in
501          B)
502             Edition="Evaluation"
503             QT_EDITION="QT_EDITION_EVALUATION"
504             ;;
505         esac
506         ;;
507     esac
508     if [ -z "$LicenseType" -o -z "$Edition" -o -z "$QT_EDITION" ]; then
509         echo
510         echo "Invalid license key. Please check the license key."
511         exit 1
512     fi
513
514     # verify that we are licensed to use Qt on this platform
515     LICENSE_EXTENSION=
516     case "$PlatformCode" in
517         *L)
518             CFG_RTOS_ENABLED=yes
519             PlatformCode=`echo "$PlatformCode" | sed 'h;y/8NPQRTZ/UCWX9M7/;x;G;s/\(.\)....\(.\)./\1\2/'`
520             ;;
521         *)
522             CFG_RTOS_ENABLED=no
523             PlatformCode=`echo "$PlatformCode" | sed 's/.$//'`
524             ;;
525     esac
526     ### EMBEDDED_QPA logic missing ###
527     case "$PlatformCode,$PLATFORM_MAC,$PLATFORM_QWS" in
528         X9,* | XC,* | XU,* | XW,* | XM,*)
529             # Qt All-OS
530             LICENSE_EXTENSION="-ALLOS"
531             ;;
532         8M,* | KM,* | S9,* | SC,* | SM,* | SU,* | SW,* | X9,* | XC,* | XU,* | XW,*)
533             # Qt for Embedded Linux
534             LICENSE_EXTENSION="-EMBEDDED"
535             ;;
536         6M,*,no | N7,*,no | N9,*,no | NX,*,no)
537             # Embedded no-deploy
538             LICENSE_EXTENSION="-EMBEDDED"
539             ;;
540         FM,*,no | LM,yes,* | ZM,no,no)
541             # Desktop
542             LICENSE_EXTENSION="-DESKTOP"
543             ;;
544         *)
545             Platform=Linux/X11
546             [ "$PLATFORM_MAC" = "yes" ] && Platform='Mac OS X'
547             echo
548             echo "You are not licensed for the $Platform platform."
549             echo
550             echo "Please contact qt-info@nokia.com to upgrade your license to"
551             echo "include the $Platform platform, or install the Qt Open Source Edition"
552             echo "if you intend to develop free software."
553             exit 1
554             ;;
555     esac
556
557     if test -r "$relpath/.LICENSE"; then
558         # Generic, non-final license
559         LICENSE_EXTENSION=""
560         line=`sed 'y/a-z/A-Z/;q' "$relpath"/.LICENSE`
561         case "$line" in
562             *BETA*)
563                 Edition=Beta
564                 ;;
565             *TECHNOLOGY?PREVIEW*)
566                 Edition=Preview
567                 ;;
568             *EVALUATION*)
569                 Edition=Evaluation
570                 ;;
571             *)
572                 echo >&2 "Invalid license files; cannot continue"
573                 exit 1
574                 ;;
575         esac
576         Licensee="$Edition"
577         EditionString="$Edition"
578         QT_EDITION="QT_EDITION_DESKTOP"
579     fi
580
581     case "$LicenseFeatureCode" in
582     B|G|L|Y)
583         # US
584         case "$LicenseType" in
585         Commercial)
586             cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}-US" "$outpath/LICENSE"
587             ;;
588         Evaluation)
589             cp -f "$relpath/.LICENSE-EVALUATION-US" "$outpath/LICENSE"
590             ;;
591         esac
592         ;;
593     2|4|5|F)
594         # non-US
595         case "$LicenseType" in
596         Commercial)
597             cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}" "$outpath/LICENSE"
598             ;;
599         Evaluation)
600             cp -f "$relpath/.LICENSE-EVALUATION" "$outpath/LICENSE"
601             ;;
602         esac
603         ;;
604     *)
605         echo
606         echo "Invalid license key. Please check the license key."
607         exit 1
608         ;;
609     esac
610     case "$LicenseFeatureCode" in
611         4|B|F|Y)
612             CFG_RTOS_ENABLED=yes
613             ;;
614         2|5|G|L)
615             CFG_RTOS_ENABLED=no
616             ;;
617     esac
618     if [ '!' -f "$outpath/LICENSE" ]; then
619         echo "The LICENSE, LICENSE.GPL3 LICENSE.LGPL file shipped with"
620         echo "this software has disappeared."
621         echo
622         echo "Sorry, you are not licensed to use this software."
623         echo "Try re-installing."
624         echo
625         exit 1
626     fi
627 elif [ $COMMERCIAL_USER = "no" ]; then
628     # Open Source edition - may only be used under the terms of the GPL or LGPL.
629     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
630     Licensee="Open Source"
631     Edition="OpenSource"
632     EditionString="Open Source"
633     QT_EDITION="QT_EDITION_OPENSOURCE"
634 fi
635
636 #-------------------------------------------------------------------------------
637 # initalize variables
638 #-------------------------------------------------------------------------------
639
640 SYSTEM_VARIABLES="RANLIB STRIP OBJDUMP LD CC CXX CFLAGS CXXFLAGS LDFLAGS"
641 for varname in $SYSTEM_VARIABLES; do
642     qmakevarname="${varname}"
643     # use LDFLAGS for autoconf compat, but qmake uses QMAKE_LFLAGS
644     if [ "${varname}" = "LDFLAGS" ]; then
645         qmakevarname="LFLAGS"
646     elif [ "${varname}" = "LD" ]; then
647         qmakevarname="LINK"
648     fi
649     cmd=`echo \
650 'if [ -n "\$'${varname}'" ]; then
651     QMakeVar set QMAKE_'${qmakevarname}' "\$'${varname}'"
652 fi'`
653     eval "$cmd"
654 done
655 # Use CC/CXX to run config.tests
656 mkdir -p "$outpath/config.tests"
657 rm -f "$outpath/config.tests/.qmake.cache"
658 cp "$QMAKE_VARS_FILE" "$outpath/config.tests/.qmake.cache"
659
660 QMakeVar add styles "cde mac motif plastique cleanlooks windows"
661
662 # QTDIR may be set and point to an old or system-wide Qt installation
663 unset QTDIR
664
665 # the minimum version of libdbus-1 that we require:
666 MIN_DBUS_1_VERSION=0.93
667
668 # initalize internal variables
669 CFG_CONFIGURE_EXIT_ON_ERROR=yes
670 CFG_PROFILE=no
671 CFG_EXCEPTIONS=unspecified
672 CFG_GUI=auto # (yes|no|auto)
673 CFG_WIDGETS=yes
674 CFG_QCONFIG=full
675 CFG_DEBUG=auto
676 CFG_MYSQL_CONFIG=
677 CFG_DEBUG_RELEASE=no
678 CFG_SHARED=yes
679 CFG_SM=auto
680 CFG_XSHAPE=auto
681 CFG_XSYNC=auto
682 CFG_XVIDEO=auto
683 CFG_XINERAMA=runtime
684 CFG_XFIXES=runtime
685 CFG_ZLIB=auto
686 CFG_SQLITE=qt
687 CFG_GIF=auto
688 CFG_PNG=yes
689 CFG_LIBPNG=auto
690 CFG_JPEG=auto
691 CFG_LIBJPEG=auto
692 CFG_XCURSOR=runtime
693 CFG_XRANDR=runtime
694 CFG_XRENDER=auto
695 CFG_MITSHM=auto
696 CFG_OPENGL=auto
697 CFG_OPENVG=auto
698 CFG_OPENVG_LC_INCLUDES=no
699 CFG_OPENVG_SHIVA=auto
700 CFG_OPENVG_ON_OPENGL=auto
701 CFG_EGL=auto
702 CFG_SSE=auto
703 CFG_FONTCONFIG=auto
704 CFG_LIBFREETYPE=auto
705 CFG_SQL_AVAILABLE=
706 QT_DEFAULT_BUILD_PARTS="libs examples"
707 CFG_BUILD_PARTS=""
708 CFG_NOBUILD_PARTS=""
709 CFG_RELEASE_QMAKE=no
710 CFG_AUDIO_BACKEND=auto
711 CFG_V8SNAPSHOT=auto
712 CFG_DECLARATIVE_DEBUG=yes
713 CFG_JAVASCRIPTCORE_JIT=auto
714
715 # Target architecture
716 CFG_ARCH=
717 # Host architecture, same as CFG_ARCH when not cross-compiling
718 CFG_HOST_ARCH=
719 # Set when the -arch or -host-arch arguments are used
720 OPT_OBSOLETE_HOST_ARG=no
721
722 CFG_USE_GNUMAKE=no
723 CFG_IM=yes
724 CFG_XINPUT2=auto
725 CFG_XINPUT=runtime
726 CFG_XKB=auto
727 CFG_XCB=auto
728 CFG_XCB_LIMITED=yes
729 CFG_EGLFS=auto
730 CFG_LIBUDEV=auto
731 CFG_OBSOLETE_WAYLAND=no
732 CFG_EVDEV=auto
733 CFG_NIS=auto
734 CFG_CUPS=auto
735 CFG_ICONV=auto
736 CFG_DBUS=auto
737 CFG_GLIB=auto
738 CFG_GSTREAMER=auto
739 CFG_QGTKSTYLE=auto
740 CFG_LARGEFILE=auto
741 CFG_OPENSSL=auto
742 CFG_STL=auto
743 CFG_PRECOMPILE=auto
744 CFG_SEPARATE_DEBUG_INFO=no
745 CFG_SEPARATE_DEBUG_INFO_NOCOPY=no
746 CFG_REDUCE_EXPORTS=auto
747 CFG_MMX=auto
748 CFG_3DNOW=auto
749 CFG_SSE=auto
750 CFG_SSE2=auto
751 CFG_SSE3=auto
752 CFG_SSSE3=auto
753 CFG_SSE4_1=auto
754 CFG_SSE4_2=auto
755 CFG_AVX=auto
756 CFG_REDUCE_RELOCATIONS=auto
757 CFG_ACCESSIBILITY=auto
758 CFG_IWMMXT=no
759 CFG_NEON=auto
760 CFG_MIPS_DSP=yes
761 CFG_MIPS_DSPR2=yes
762 CFG_CLOCK_GETTIME=auto
763 CFG_CLOCK_MONOTONIC=auto
764 CFG_MREMAP=auto
765 CFG_GETADDRINFO=auto
766 CFG_IPV6IFNAME=auto
767 CFG_GETIFADDRS=auto
768 CFG_INOTIFY=auto
769 CFG_RPATH=yes
770 CFG_FRAMEWORK=auto
771 MAC_CONFIG_TEST_COMMANDLINE=  # used to make the configure tests run with the correct arch's and SDK settings
772 CFG_MAC_DWARF2=auto
773 CFG_MAC_HARFBUZZ=no
774 CFG_SXE=no
775 CFG_PREFIX_INSTALL=yes
776 CFG_SDK=
777 D_FLAGS=
778 I_FLAGS=
779 L_FLAGS=
780 RPATH_FLAGS=
781 l_FLAGS=
782 W_FLAGS=
783 QCONFIG_FLAGS=
784 XPLATFORM=              # This seems to be the QMAKESPEC, like "linux-g++"
785 XPLATFORM_MINGW=no      # Whether target platform is MinGW (win32-g++*)
786 XPLATFORM_MAEMO=no
787 PLATFORM=$QMAKESPEC
788 QT_CROSS_COMPILE=no
789 OPT_CONFIRM_LICENSE=no
790 OPT_SHADOW=maybe
791 OPT_FAST=auto
792 OPT_VERBOSE=no
793 OPT_HELP=
794 CFG_SILENT=no
795 CFG_ALSA=auto
796 CFG_PULSEAUDIO=auto
797 CFG_COREWLAN=auto
798 CFG_NOPROCESS=no
799 CFG_ICU=auto
800 CFG_FORCE_ASSERTS=no
801 CFG_PCRE=auto
802 QPA_PLATFORM_GUARD=yes
803
804 # initalize variables used for installation
805 QT_INSTALL_PREFIX=
806 QT_INSTALL_DOCS=
807 QT_INSTALL_HEADERS=
808 QT_INSTALL_LIBS=
809 QT_INSTALL_BINS=
810 QT_INSTALL_PLUGINS=
811 QT_INSTALL_IMPORTS=
812 QT_INSTALL_DATA=
813 QT_INSTALL_TRANSLATIONS=
814 QT_INSTALL_SETTINGS=
815 QT_INSTALL_EXAMPLES=
816 QT_INSTALL_TESTS=
817 CFG_SYSROOT=
818 QT_HOST_PREFIX=
819 QT_HOST_BINS=
820 QT_HOST_DATA=
821
822 #flags for SQL drivers
823 QT_CFLAGS_PSQL=
824 QT_LFLAGS_PSQL=
825 QT_CFLAGS_MYSQL=
826 QT_LFLAGS_MYSQL=
827 QT_LFLAGS_MYSQL_R=
828 QT_CFLAGS_SQLITE=
829 QT_LFLAGS_SQLITE=
830 QT_LFLAGS_ODBC="-lodbc"
831 QT_LFLAGS_TDS=
832
833 # flags for libdbus-1
834 QT_CFLAGS_DBUS=
835 QT_LIBS_DBUS=
836
837 # flags for Glib (X11 only)
838 QT_CFLAGS_GLIB=
839 QT_LIBS_GLIB=
840
841 # flags for GStreamer (X11 only)
842 QT_CFLAGS_GSTREAMER=
843 QT_LIBS_GSTREAMER=
844
845 #-------------------------------------------------------------------------------
846 # check SQL drivers available in this package
847 #-------------------------------------------------------------------------------
848
849 # opensource version removes some drivers, so force them to be off
850 CFG_SQL_tds=no
851 CFG_SQL_oci=no
852 CFG_SQL_db2=no
853
854 CFG_SQL_AVAILABLE=
855 if [ -d "$relpath/src/plugins/sqldrivers" ]; then
856   for a in "$relpath/src/plugins/sqldrivers/"*; do
857      if [ -d "$a" ]; then
858          base_a=`basename "$a"`
859          CFG_SQL_AVAILABLE="${CFG_SQL_AVAILABLE} ${base_a}"
860          eval "CFG_SQL_${base_a}=auto"
861      fi
862   done
863 fi
864
865 CFG_IMAGEFORMAT_PLUGIN_AVAILABLE=
866 if [ -d "$relpath/src/plugins/imageformats" ]; then
867     for a in "$relpath/src/plugins/imageformats/"*; do
868         if [ -d "$a" ]; then
869             base_a=`basename "$a"`
870             CFG_IMAGEFORMAT_PLUGIN_AVAILABLE="${CFG_IMAGEFORMAT_PLUGIN_AVAILABLE} ${base_a}"
871         fi
872     done
873 fi
874
875 #-------------------------------------------------------------------------------
876 # parse command line arguments
877 #-------------------------------------------------------------------------------
878
879 # parse the arguments, setting things to "yes" or "no"
880 while [ "$#" -gt 0 ]; do
881     CURRENT_OPT="$1"
882     UNKNOWN_ARG=no
883     case "$1" in
884     #Autoconf style options
885     --enable-*)
886         VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"`
887         VAL=yes
888         ;;
889     --disable-*)
890         VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"`
891         VAL=no
892         ;;
893     --*=*)
894         VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"`
895         VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"`
896         ;;
897     --no-*)
898         VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
899         VAL=no
900         ;;
901     --*)
902         VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
903         VAL=yes
904         ;;
905     #Qt plugin options
906     -no-*-*|-plugin-*-*|-qt-*-*)
907         VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
908         VAL=`echo $1 | sed "s,^-\([^-]*\).*,\1,"`
909         ;;
910     #Qt style no options
911     -no-*)
912         VAR=`echo $1 | sed "s,^-no-\(.*\),\1,"`
913         VAL=no
914         ;;
915     #Qt style yes options
916     -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|-eglfs|-nis|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-debug-and-release|-exceptions|-harfbuzz|-prefix-install|-silent|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-phonon-backend|-audio-backend|-declarative-debug|-javascript-jit|-rpath|-force-pkg-config|-icu|-force-asserts|-testcocoon)
917         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
918         VAL=yes
919         ;;
920     #Qt style options that pass an argument
921     -qconfig)
922         if [ "$PLATFORM_QPA" != "yes" ]; then
923             echo
924             echo "WARNING: -qconfig is only tested and supported on Qt for Embedded Linux."
925             echo
926         fi
927         CFG_QCONFIG="$VAL"
928         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
929         shift
930         VAL=$1
931         ;;
932     -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir)
933         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
934         shift
935         VAL="$1"
936         ;;
937     #Qt style complex options in one command
938     -enable-*|-disable-*)
939         VAR=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
940         VAL=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
941         ;;
942     #Qt Builtin/System style options
943     -no-*|-system-*|-qt-*)
944         VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
945         VAL=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
946         ;;
947     #Options that cannot be generalized
948     -k|-continue)
949         VAR=fatal_error
950         VAL=no
951         ;;
952     -embedded-lite|-qpa)
953         VAR=qpa
954         # this option may or may not be followed by an argument
955         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
956             VAL=auto
957         else
958             shift;
959             VAL=$1
960         fi
961         ;;
962     -opengl)
963         VAR=opengl
964         # this option may or may not be followed by an argument
965         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
966             VAL=yes
967         else
968             shift;
969             VAL=$1
970         fi
971         ;;
972     -openvg)
973         VAR=openvg
974         # this option may or may not be followed by an argument
975         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
976             VAL=yes
977         else
978             shift;
979             VAL=$1
980         fi
981         ;;
982     -hostprefix)
983         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
984         # this option may or may not be followed by an argument
985         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
986             VAL=$outpath
987         else
988             shift;
989             VAL=$1
990         fi
991         ;;
992     -qtnamespace)
993         VAR="qtnamespace"
994         shift
995         VAL="$1"
996         ;;
997     -qtlibinfix)
998         VAR="qtlibinfix"
999         shift
1000         VAL="$1"
1001         ;;
1002     -D?*|-D)
1003         VAR="add_define"
1004         if [ "$1" = "-D" ]; then
1005             shift
1006             VAL="$1"
1007         else
1008             VAL=`echo $1 | sed 's,-D,,'`
1009         fi
1010         ;;
1011     -fpu)
1012         VAR="fpu"
1013         # this option may or may not be followed by an argument
1014         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
1015             VAL=no
1016         else
1017             shift
1018             VAL=$1
1019         fi
1020         ;;
1021     -I?*|-I)
1022         VAR="add_ipath"
1023         if [ "$1" = "-I" ]; then
1024             shift
1025             VAL="$1"
1026         else
1027             VAL=`echo $1 | sed 's,-I,,'`
1028         fi
1029         ;;
1030     -L?*|-L)
1031         VAR="add_lpath"
1032         if [ "$1" = "-L" ]; then
1033             shift
1034             VAL="$1"
1035         else
1036             VAL=`echo $1 | sed 's,-L,,'`
1037         fi
1038         ;;
1039     -R?*|-R)
1040         VAR="add_rpath"
1041         if [ "$1" = "-R" ]; then
1042             shift
1043             VAL="$1"
1044         else
1045             VAL=`echo $1 | sed 's,-R,,'`
1046         fi
1047         ;;
1048     -l?*)
1049         VAR="add_link"
1050         VAL=`echo $1 | sed 's,-l,,'`
1051         ;;
1052     -F?*|-F)
1053         VAR="add_fpath"
1054         if [ "$1" = "-F" ]; then
1055             shift
1056             VAL="$1"
1057         else
1058             VAL=`echo $1 | sed 's,-F,,'`
1059         fi
1060         ;;
1061     -fw?*|-fw)
1062         VAR="add_framework"
1063         if [ "$1" = "-fw" ]; then
1064             shift
1065             VAL="$1"
1066         else
1067             VAL=`echo $1 | sed 's,-fw,,'`
1068         fi
1069         ;;
1070     -W*)
1071         VAR="add_warn"
1072         VAL="$1"
1073         ;;
1074     -*)
1075         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
1076         VAL="unknown"
1077         ;;
1078     *)
1079         UNKNOWN_ARG=yes
1080         ;;
1081     esac
1082     if [ "$UNKNOWN_ARG" = "yes" ]; then
1083         echo "$1: unknown argument"
1084         OPT_HELP=yes
1085         ERROR=yes
1086         shift
1087         continue
1088      fi
1089     shift
1090
1091     UNKNOWN_OPT=no
1092     case "$VAR" in
1093     accessibility)
1094         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1095             CFG_ACCESSIBILITY="$VAL"
1096         else
1097             UNKNOWN_OPT=yes
1098         fi
1099         ;;
1100     license)
1101         LICENSE_FILE="$VAL"
1102         ;;
1103     gnumake)
1104         CFG_USE_GNUMAKE="$VAL"
1105         ;;
1106     mysql_config)
1107         CFG_MYSQL_CONFIG="$VAL"
1108         ;;
1109     prefix)
1110         QT_INSTALL_PREFIX="$VAL"
1111         ;;
1112     hostprefix)
1113         QT_HOST_PREFIX="$VAL"
1114         ;;
1115     hostdatadir)
1116         QT_HOST_DATA="$VAL"
1117         ;;
1118     hostbindir)
1119         QT_HOST_BINS="$VAL"
1120         ;;
1121     force-pkg-config)
1122         QT_FORCE_PKGCONFIG=yes
1123         ;;
1124     docdir)
1125         QT_INSTALL_DOCS="$VAL"
1126         ;;
1127     headerdir)
1128         QT_INSTALL_HEADERS="$VAL"
1129         ;;
1130     plugindir)
1131         QT_INSTALL_PLUGINS="$VAL"
1132         ;;
1133     importdir)
1134         QT_INSTALL_IMPORTS="$VAL"
1135         ;;
1136     datadir)
1137         QT_INSTALL_DATA="$VAL"
1138         ;;
1139     libdir)
1140         QT_INSTALL_LIBS="$VAL"
1141         ;;
1142     qtnamespace)
1143         QT_NAMESPACE="$VAL"
1144         ;;
1145     qtlibinfix)
1146         QT_LIBINFIX="$VAL"
1147         ;;
1148     translationdir)
1149         QT_INSTALL_TRANSLATIONS="$VAL"
1150         ;;
1151     sysconfdir|settingsdir)
1152         QT_INSTALL_SETTINGS="$VAL"
1153         ;;
1154     examplesdir)
1155         QT_INSTALL_EXAMPLES="$VAL"
1156         ;;
1157     testsdir)
1158         QT_INSTALL_TESTS="$VAL"
1159         ;;
1160     qconfig)
1161         CFG_QCONFIG="$VAL"
1162         ;;
1163     sysroot)
1164         CFG_SYSROOT="$VAL"
1165         ;;
1166     bindir)
1167         QT_INSTALL_BINS="$VAL"
1168         ;;
1169     sxe)
1170         CFG_SXE="$VAL"
1171         ;;
1172     embedded-lite|qpa)
1173         PLATFORM_X11=no
1174         PLATFORM_QPA=yes
1175         ;;
1176     sse)
1177         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1178             CFG_SSE="$VAL"
1179         else
1180             UNKNOWN_OPT=yes
1181         fi
1182         ;;
1183     opengl)
1184         if  [ "$VAL" = "auto" ] || [ "$VAL" = "desktop" ] ||
1185             [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] ||
1186             [ "$VAL" = "es2" ]; then
1187             CFG_OPENGL="$VAL"
1188         else
1189             UNKNOWN_OPT=yes
1190         fi
1191         ;;
1192     openvg)
1193         if [ "$VAL" = "auto" ] || [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1194             CFG_OPENVG="$VAL"
1195         else
1196             UNKNOWN_OPT=yes
1197         fi
1198         ;;
1199     nomake)
1200         CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS $VAL"
1201         ;;
1202     make)
1203         CFG_BUILD_PARTS="$CFG_BUILD_PARTS $VAL"
1204         ;;
1205     x11)
1206         PLATFORM_QPA=no
1207         PLATFORM_MAC=no
1208         PLATFORM_X11=yes
1209         ;;
1210     sdk)
1211         if [ "$BUILD_ON_MAC" = "yes" ]; then
1212             CFG_SDK="$VAL"
1213         else
1214             UNKNOWN_OPT=yes
1215         fi
1216         ;;
1217      dwarf2)
1218         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1219             CFG_MAC_DWARF2="$VAL"
1220         else
1221             UNKNOWN_OPT=yes
1222         fi
1223         ;;
1224     arch|host-arch)
1225         OPT_OBSOLETE_HOST_ARG=yes
1226         ;;
1227     harfbuzz)
1228         if [ "$BUILD_ON_MAC" = "yes" ] && [ "$VAL" = "yes" ]; then
1229             CFG_MAC_HARFBUZZ="$VAL"
1230         else
1231             UNKNOWN_OPT=yes
1232         fi
1233         ;;
1234
1235     framework)
1236         if [ "$BUILD_ON_MAC" = "yes" ]; then
1237             CFG_FRAMEWORK="$VAL"
1238         else
1239             UNKNOWN_OPT=yes
1240         fi
1241         ;;
1242     profile)
1243         if [ "$VAL" = "yes" ]; then
1244             CFG_PROFILE=yes
1245             QMakeVar add QMAKE_CFLAGS -pg
1246             QMakeVar add QMAKE_CXXFLAGS -pg
1247             QMakeVar add QMAKE_LFLAGS -pg
1248             QMAKE_VARS="$QMAKE_VARS CONFIG+=nostrip"
1249         else
1250             UNKNOWN_OPT=yes
1251         fi
1252         ;;
1253     testcocoon)
1254         if [ "$VAL" = "yes" ]; then
1255             QTCONFIG_CONFIG="$QTCONFIG_CONFIG testcocoon"
1256         fi
1257         ;;
1258     exceptions|g++-exceptions)
1259         if [ "$VAL" = "no" ]; then
1260             CFG_EXCEPTIONS=no
1261         elif [ "$VAL" = "yes" ]; then
1262             CFG_EXCEPTIONS=yes
1263         else
1264             UNKNOWN_OPT=yes
1265         fi
1266         ;;
1267     platform)
1268         PLATFORM="$VAL"
1269         # keep compatibility with old platform names
1270         case $PLATFORM in
1271         aix-64)
1272             PLATFORM=aix-xlc-64
1273             ;;
1274         hpux-o64)
1275             PLATFORM=hpux-acc-o64
1276             ;;
1277         hpux-n64)
1278             PLATFORM=hpux-acc-64
1279             ;;
1280         hpux-acc-n64)
1281             PLATFORM=hpux-acc-64
1282             ;;
1283         irix-n32)
1284             PLATFORM=irix-cc
1285             ;;
1286         irix-64)
1287             PLATFORM=irix-cc-64
1288             ;;
1289         irix-cc-n64)
1290             PLATFORM=irix-cc-64
1291             ;;
1292         reliant-64)
1293             PLATFORM=reliant-cds-64
1294             ;;
1295         solaris-64)
1296             PLATFORM=solaris-cc-64
1297             ;;
1298         openunix-cc)
1299             PLATFORM=unixware-cc
1300             ;;
1301         openunix-g++)
1302             PLATFORM=unixware-g++
1303             ;;
1304         unixware7-cc)
1305             PLATFORM=unixware-cc
1306             ;;
1307         unixware7-g++)
1308             PLATFORM=unixware-g++
1309             ;;
1310         macx-g++-64)
1311             PLATFORM=macx-g++
1312             NATIVE_64_ARCH=
1313             case `uname -p` in
1314             i386) NATIVE_64_ARCH="x86_64" ;;
1315             powerpc) NATIVE_64_ARCH="ppc64" ;;
1316             *)   echo "WARNING: Can't detect CPU architecture for macx-g++-64" ;;
1317             esac
1318             if [ ! -z "$NATIVE_64_ARCH" ]; then
1319                 QTCONFIG_CONFIG="$QTCONFIG_CONFIG $NATIVE_64_ARCH"
1320             fi
1321             ;;
1322         esac
1323         ;;
1324     xplatform)
1325         XPLATFORM="$VAL"
1326         case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac
1327         ;;
1328     device)
1329         XPLATFORM="devices/$VAL"
1330         ;;
1331     device-option)
1332         DEV_VAR=`echo $VAL | sed "s,^\(.*\)=.*,\1,"`
1333         DEV_VAL=`echo $VAL | sed "s,^.*=\(.*\),\1,"`
1334         DeviceVar set $DEV_VAR $DEV_VAL
1335         ;;
1336     debug-and-release)
1337         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1338             CFG_DEBUG_RELEASE="$VAL"
1339         else
1340             UNKNOWN_OPT=yes
1341         fi
1342         ;;
1343     optimized-qmake)
1344         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1345             CFG_RELEASE_QMAKE="$VAL"
1346         else
1347             UNKNOWN_OPT=yes
1348         fi
1349         ;;
1350     release)
1351         if [ "$VAL" = "yes" ]; then
1352             CFG_DEBUG=no
1353         elif [ "$VAL" = "no" ]; then
1354             CFG_DEBUG=yes
1355         else
1356             UNKNOWN_OPT=yes
1357         fi
1358         ;;
1359     prefix-install)
1360         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1361             CFG_PREFIX_INSTALL="$VAL"
1362         else
1363             UNKNOWN_OPT=yes
1364         fi
1365         ;;
1366     debug)
1367         CFG_DEBUG="$VAL"
1368         ;;
1369     developer-build|commercial|opensource)
1370         # These switches have been dealt with already
1371         ;;
1372     static)
1373         if [ "$VAL" = "yes" ]; then
1374             CFG_SHARED=no
1375         elif [ "$VAL" = "no" ]; then
1376             CFG_SHARED=yes
1377         else
1378             UNKNOWN_OPT=yes
1379         fi
1380         ;;
1381     fatal_error)
1382         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1383             CFG_CONFIGURE_EXIT_ON_ERROR="$VAL"
1384         else
1385             UNKNOWN_OPT=yes
1386         fi
1387         ;;
1388     feature-*)
1389             FEATURE=`echo $VAR | sed "s,^[^-]*-\([^-]*\),\1," | tr 'abcdefghijklmnopqrstuvwxyz-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
1390             if [ "$VAL" = "no" ]; then
1391                 QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_$FEATURE"
1392             elif [ "$VAL" = "yes" ] || [ "$VAL" = "unknown" ]; then
1393                 QCONFIG_FLAGS="$QCONFIG_FLAGS QT_$FEATURE"
1394             else
1395                 UNKNOWN_OPT=yes
1396             fi
1397         ;;
1398     shared)
1399         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1400             CFG_SHARED="$VAL"
1401         else
1402             UNKNOWN_OPT=yes
1403         fi
1404         ;;
1405     gif)
1406         if [ "$VAL" = "no" ]; then
1407             CFG_GIF="$VAL"
1408         else
1409             UNKNOWN_OPT=yes
1410         fi
1411         ;;
1412     sm)
1413         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1414             CFG_SM="$VAL"
1415         else
1416             UNKNOWN_OPT=yes
1417         fi
1418
1419         ;;
1420     xinerama)
1421         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1422             CFG_XINERAMA="$VAL"
1423         else
1424             UNKNOWN_OPT=yes
1425         fi
1426         ;;
1427     xshape)
1428         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1429             CFG_XSHAPE="$VAL"
1430         else
1431             UNKNOWN_OPT=yes
1432         fi
1433         ;;
1434     xvideo)
1435         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1436             CFG_XVIDEO="$VAL"
1437         else
1438             UNKNOWN_OPT=yes
1439         fi
1440         ;;
1441     xsync)
1442         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1443             CFG_XSYNC="$VAL"
1444         else
1445             UNKNOWN_OPT=yes
1446         fi
1447         ;;
1448      xinput2)
1449         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1450             CFG_XINPUT2="$VAL"
1451         else
1452             UNKNOWN_OPT=yes
1453         fi
1454         ;;
1455     xinput)
1456         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1457             CFG_XINPUT="$VAL"
1458         else
1459             UNKNOWN_OPT=yes
1460         fi
1461         ;;
1462     egl)
1463         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1464             CFG_EGL="$VAL"
1465         else
1466             UNKNOWN_OPT=yes
1467         fi
1468         ;;
1469     stl)
1470         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1471             CFG_STL="$VAL"
1472         else
1473             UNKNOWN_OPT=yes
1474         fi
1475         ;;
1476     pch)
1477         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1478             CFG_PRECOMPILE="$VAL"
1479         else
1480             UNKNOWN_OPT=yes
1481         fi
1482         ;;
1483     separate-debug-info)
1484         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1485             CFG_SEPARATE_DEBUG_INFO="$VAL"
1486         elif [ "$VAL" = "nocopy" ] ; then
1487             CFG_SEPARATE_DEBUG_INFO="yes"
1488             CFG_SEPARATE_DEBUG_INFO_NOCOPY="yes"
1489         else
1490             UNKNOWN_OPT=yes
1491         fi
1492         ;;
1493     reduce-exports)
1494         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1495             CFG_REDUCE_EXPORTS="$VAL"
1496         else
1497             UNKNOWN_OPT=yes
1498         fi
1499         ;;
1500     mmx)
1501         if [ "$VAL" = "no" ]; then
1502             CFG_MMX="$VAL"
1503         else
1504             UNKNOWN_OPT=yes
1505         fi
1506         ;;
1507     3dnow)
1508         if [ "$VAL" = "no" ]; then
1509             CFG_3DNOW="$VAL"
1510         else
1511             UNKNOWN_OPT=yes
1512         fi
1513         ;;
1514     sse)
1515         if [ "$VAL" = "no" ]; then
1516             CFG_SSE="$VAL"
1517         else
1518             UNKNOWN_OPT=yes
1519         fi
1520         ;;
1521     sse2)
1522         if [ "$VAL" = "no" ]; then
1523             CFG_SSE2="$VAL"
1524         else
1525             UNKNOWN_OPT=yes
1526         fi
1527         ;;
1528     sse3)
1529         if [ "$VAL" = "no" ]; then
1530             CFG_SSE3="$VAL"
1531         else
1532             UNKNOWN_OPT=yes
1533         fi
1534         ;;
1535     ssse3)
1536         if [ "$VAL" = "no" ]; then
1537             CFG_SSSE3="$VAL"
1538         else
1539             UNKNOWN_OPT=yes
1540         fi
1541         ;;
1542     sse4.1)
1543         if [ "$VAL" = "no" ]; then
1544             CFG_SSE4_1="$VAL"
1545         else
1546             UNKNOWN_OPT=yes
1547         fi
1548         ;;
1549     sse4.2)
1550         if [ "$VAL" = "no" ]; then
1551             CFG_SSE4_2="$VAL"
1552         else
1553             UNKNOWN_OPT=yes
1554         fi
1555         ;;
1556     avx)
1557         if [ "$VAL" = "no" ]; then
1558             CFG_AVX="$VAL"
1559         else
1560             UNKNOWN_OPT=yes
1561         fi
1562         ;;
1563     iwmmxt)
1564         CFG_IWMMXT="yes"
1565         ;;
1566     neon)
1567         if [ "$VAL" = "no" ]; then
1568             CFG_NEON="$VAL"
1569         else
1570             UNKNOWN_OPT=yes
1571         fi
1572         ;;
1573     mips_dsp)
1574         if [ "$VAL" = "no" ]; then
1575             CFG_MIPS_DSP="$VAL"
1576         else
1577             UNKNOWN_OPT=yes
1578         fi
1579         ;;
1580     mips_dspr2)
1581         if [ "$VAL" = "no" ]; then
1582             CFG_MIPS_DSPR2="$VAL"
1583         else
1584             UNKNOWN_OPT=yes
1585         fi
1586         ;;
1587     reduce-relocations)
1588         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1589             CFG_REDUCE_RELOCATIONS="$VAL"
1590         else
1591             UNKNOWN_OPT=yes
1592         fi
1593         ;;
1594     zlib)
1595         [ "$VAL" = "qt" ] && VAL=yes
1596         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1597             CFG_ZLIB="$VAL"
1598         else
1599             UNKNOWN_OPT=yes
1600         fi
1601         # No longer supported:
1602         #[ "$VAL" = "no" ] && CFG_LIBPNG=no
1603         ;;
1604     sqlite)
1605         if [ "$VAL" = "system" ]; then
1606             CFG_SQLITE=system
1607         else
1608             UNKNOWN_OPT=yes
1609         fi
1610         ;;
1611     libpng)
1612         [ "$VAL" = "yes" ] && VAL=qt
1613         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1614             CFG_LIBPNG="$VAL"
1615         else
1616             UNKNOWN_OPT=yes
1617         fi
1618         ;;
1619     libjpeg)
1620         [ "$VAL" = "yes" ] && VAL=qt
1621         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1622             CFG_LIBJPEG="$VAL"
1623         else
1624             UNKNOWN_OPT=yes
1625         fi
1626         ;;
1627     xcursor)
1628         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1629             CFG_XCURSOR="$VAL"
1630         else
1631             UNKNOWN_OPT=yes
1632         fi
1633         ;;
1634     xfixes)
1635         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1636             CFG_XFIXES="$VAL"
1637         else
1638             UNKNOWN_OPT=yes
1639         fi
1640         ;;
1641     xrandr)
1642         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1643             CFG_XRANDR="$VAL"
1644         else
1645             UNKNOWN_OPT=yes
1646         fi
1647         ;;
1648     xrender)
1649         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1650             CFG_XRENDER="$VAL"
1651         else
1652             UNKNOWN_OPT=yes
1653         fi
1654         ;;
1655     mitshm)
1656         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1657             CFG_MITSHM="$VAL"
1658         else
1659             UNKNOWN_OPT=yes
1660         fi
1661         ;;
1662     fontconfig)
1663         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1664             CFG_FONTCONFIG="$VAL"
1665         else
1666             UNKNOWN_OPT=yes
1667         fi
1668         ;;
1669     xkb)
1670         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1671             CFG_XKB="$VAL"
1672         else
1673             UNKNOWN_OPT=yes
1674         fi
1675         ;;
1676     xcb)
1677         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1678             CFG_XCB="$VAL"
1679         else
1680             UNKNOWN_OPT=yes
1681         fi
1682         ;;
1683     wayland)
1684         CFG_OBSOLETE_WAYLAND=yes
1685         ;;
1686     eglfs)
1687         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1688             CFG_EGLFS="$VAL"
1689         else
1690             UNKNOWN_OPT=yes
1691         fi
1692         ;;
1693     libudev)
1694         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1695             CFG_LIBUDEV="$VAL"
1696         else
1697             UNKNOWN_OPT=yes
1698         fi
1699         ;;
1700     evdev)
1701         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1702             CFG_EVDEV="$VAL"
1703         else
1704             UNKNOWN_OPT=yes
1705         fi
1706         ;;
1707     cups)
1708         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1709             CFG_CUPS="$VAL"
1710         else
1711             UNKNOWN_OPT=yes
1712         fi
1713         ;;
1714     iconv)
1715         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1716             CFG_ICONV="$VAL"
1717         else
1718             UNKNOWN_OPT=yes
1719         fi
1720         ;;
1721     glib)
1722         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1723             CFG_GLIB="$VAL"
1724         else
1725             UNKNOWN_OPT=yes
1726         fi
1727         ;;
1728     gstreamer)
1729         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1730             CFG_GSTREAMER="$VAL"
1731         else
1732             UNKNOWN_OPT=yes
1733         fi
1734         ;;
1735     gtkstyle)
1736         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1737             CFG_QGTKSTYLE="$VAL"
1738         else
1739             UNKNOWN_OPT=yes
1740         fi
1741         ;;
1742     gui)
1743         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1744             CFG_GUI="yes"
1745         else
1746             if [ "$VAL" = "no" ]; then
1747                 CFG_GUI="no"
1748             else
1749                 UNKNOWN_OPT=yes
1750             fi
1751         fi
1752         ;;
1753     widgets)
1754         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1755             CFG_WIDGETS="yes"
1756         elif [ "$VAL" = "no" ]; then
1757             CFG_WIDGETS="no"
1758         else
1759             UNKNOWN_OPT=yes
1760         fi
1761         ;;
1762     qpa-platform-guard)
1763         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1764             QPA_PLATFORM_GUARD="$VAL"
1765         else
1766             UNKNOWN_OPT=yes
1767         fi
1768         ;;
1769     dbus)
1770         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "linked" ]; then
1771             CFG_DBUS="$VAL"
1772         elif [ "$VAL" = "runtime" ]; then
1773             CFG_DBUS="yes"
1774         else
1775             UNKNOWN_OPT=yes
1776         fi
1777         ;;
1778     dbus-linked)
1779         if [ "$VAL" = "yes" ]; then
1780             CFG_DBUS="linked"
1781         else
1782             UNKNOWN_OPT=yes
1783         fi
1784         ;;
1785     nis)
1786         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1787             CFG_NIS="$VAL"
1788         else
1789             UNKNOWN_OPT=yes
1790         fi
1791         ;;
1792     largefile)
1793         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1794             CFG_LARGEFILE="$VAL"
1795         else
1796             UNKNOWN_OPT=yes
1797         fi
1798         ;;
1799     openssl)
1800         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1801             CFG_OPENSSL="$VAL"
1802         else
1803             UNKNOWN_OPT=yes
1804         fi
1805         ;;
1806     openssl-linked)
1807         if [ "$VAL" = "yes" ]; then
1808             CFG_OPENSSL="linked"
1809         else
1810             UNKNOWN_OPT=yes
1811         fi
1812         ;;
1813     declarative-debug)
1814         if [ "$VAL" = "yes" ]; then
1815             CFG_DECLARATIVE_DEBUG="yes"
1816         else
1817             if [ "$VAL" = "no" ]; then
1818                 CFG_DECLARATIVE_DEBUG="no"
1819             else
1820                 UNKNOWN_OPT=yes
1821             fi
1822         fi
1823         ;;
1824     javascript-jit)
1825         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then 
1826             CFG_JAVASCRIPTCORE_JIT="$VAL"
1827         else
1828             UNKNOWN_OPT=yes
1829         fi
1830         ;;
1831     confirm-license)
1832         if [ "$VAL" = "yes" ]; then
1833             OPT_CONFIRM_LICENSE="$VAL"
1834         else
1835             UNKNOWN_OPT=yes
1836         fi
1837         ;;
1838     h|help)
1839         if [ "$VAL" = "yes" ]; then
1840             OPT_HELP="$VAL"
1841         else
1842             UNKNOWN_OPT=yes
1843         fi
1844         ;;
1845     sql-*|imageformat-*)
1846         # if Qt style options were used, $VAL can be "no", "qt", or "plugin"
1847         # if autoconf style options were used, $VAL can be "yes" or "no"
1848         [ "$VAL" = "yes" ] && VAL=qt
1849         # now $VAL should be "no", "qt", or "plugin"... double-check
1850         if [ "$VAL" != "no" ] && [ "$VAL" != "qt" ] && [ "$VAL" != "plugin" ]; then
1851             UNKNOWN_OPT=yes
1852         fi
1853         # now $VAL is "no", "qt", or "plugin"
1854         OPT="$VAL"
1855         VAL=`echo $VAR | sed "s,^[^-]*-\([^-]*\).*,\1,"`
1856         VAR=`echo $VAR | sed "s,^\([^-]*\).*,\1,"`
1857
1858         # Grab the available values
1859         case "$VAR" in
1860         sql)
1861             avail="$CFG_SQL_AVAILABLE"
1862             ;;
1863         imageformat)
1864             avail="$CFG_IMAGEFORMAT_PLUGIN_AVAILABLE"
1865             if [ "$OPT" != "plugin" ]; then
1866                 # png is always built in
1867                 avail="$avail png"
1868             fi
1869             ;;
1870         *)
1871             avail=""
1872             echo "BUG: Unhandled type $VAR used in $CURRENT_OPT"
1873             ;;
1874         esac
1875
1876         # Check that that user's value is available.
1877         found=no
1878         for d in $avail; do
1879             if [ "$VAL" = "$d" ]; then
1880                 found=yes
1881                 break
1882             fi
1883         done
1884         [ "$found" = yes ] || ERROR=yes
1885
1886         if [ "$VAR" = "sql" ]; then
1887             # set the CFG_SQL_driver
1888             eval "CFG_SQL_$VAL=\$OPT"
1889             continue
1890         elif [ "$VAR" = "imageformat" ]; then
1891             [ "$OPT" = "qt" ] && OPT=yes
1892             VAL="`echo $VAL |tr a-z A-Z`"
1893             eval "CFG_$VAL=$OPT"
1894             continue
1895         fi
1896
1897         if [ "$OPT" = "plugin" ] || [ "$OPT" = "qt" ]; then
1898             if [ "$OPT" = "plugin" ]; then
1899                 VAR="${VAR}-${OPT}"
1900             fi
1901             QMakeVar add "${VAR}s" "${VAL}"
1902         elif [ "$OPT" = "no" ]; then
1903             PLUG_VAR="${VAR}-plugin"
1904             IN_VAR="${VAR}"
1905             QMakeVar del "${IN_VAR}s" "$VAL"
1906             QMakeVar del "${PLUG_VAR}s" "$VAL"
1907         fi
1908         if [ "$ERROR" = "yes" ]; then
1909            echo "$CURRENT_OPT: unknown argument"
1910            OPT_HELP=yes
1911         fi
1912         ;;
1913     v|verbose)
1914         if [ "$VAL" = "yes" ]; then
1915             if [ "$OPT_VERBOSE" = "$VAL" ]; then            # takes two verboses to turn on qmake debugs
1916                 QMAKE_SWITCHES="$QMAKE_SWITCHES -d"
1917             else
1918                 OPT_VERBOSE=yes
1919             fi
1920         elif [ "$VAL" = "no" ]; then
1921             if [ "$OPT_VERBOSE" = "$VAL" ] && echo "$QMAKE_SWITCHES" | grep ' -d' >/dev/null 2>&1; then
1922                 QMAKE_SWITCHES=`echo $QMAKE_SWITCHES | sed "s, -d,,"`
1923             else
1924                 OPT_VERBOSE=no
1925             fi
1926         else
1927             UNKNOWN_OPT=yes
1928         fi
1929         ;;
1930     fast)
1931         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1932             OPT_FAST="$VAL"
1933         else
1934             UNKNOWN_OPT=yes
1935         fi
1936         ;;
1937     rpath)
1938         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1939             CFG_RPATH="$VAL"
1940         else
1941             UNKNOWN_OPT=yes
1942         fi
1943         ;;
1944     add_define)
1945         D_FLAGS="$D_FLAGS \"$VAL\""
1946         ;;
1947     add_ipath)
1948         I_FLAGS="$I_FLAGS -I\"${VAL}\""
1949         ;;
1950     add_lpath)
1951         L_FLAGS="$L_FLAGS -L\"${VAL}\""
1952         ;;
1953     add_rpath)
1954         RPATH_FLAGS="$RPATH_FLAGS \"${VAL}\""
1955         ;;
1956     add_link)
1957         l_FLAGS="$l_FLAGS -l\"${VAL}\""
1958         ;;
1959     add_fpath)
1960         if [ "$BUILD_ON_MAC" = "yes" ]; then
1961             L_FLAGS="$L_FLAGS -F\"${VAL}\""
1962             I_FLAGS="$I_FLAGS -F\"${VAL}\""
1963         else
1964             UNKNOWN_OPT=yes
1965         fi
1966         ;;
1967     add_framework)
1968         if [ "$BUILD_ON_MAC" = "yes" ]; then
1969             l_FLAGS="$l_FLAGS -framework \"${VAL}\""
1970         else
1971             UNKNOWN_OPT=yes
1972         fi
1973         ;;
1974     add_warn)
1975         W_FLAGS="$W_FLAGS \"${VAL}\""
1976         ;;
1977     silent)
1978         CFG_SILENT="$VAL"
1979         ;;
1980     phonon-backend)
1981         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1982             CFG_PHONON_BACKEND="$VAL"
1983         else
1984             UNKNOWN_OPT=yes
1985         fi
1986         ;;
1987     dont-process)
1988         CFG_NOPROCESS=yes
1989         ;;
1990     process)
1991         CFG_NOPROCESS=no
1992         ;;
1993     audio-backend)
1994         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1995             CFG_AUDIO_BACKEND="$VAL"
1996         else
1997             UNKNOWN_OPT=yes
1998         fi
1999         ;;
2000     icu)
2001         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2002             CFG_ICU="$VAL"
2003         else
2004             UNKNOWN_OPT=yes
2005         fi
2006         ;;
2007     force-asserts)
2008         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2009             CFG_FORCE_ASSERTS="$VAL"
2010         else
2011             UNKNOWN_OPT=yes
2012         fi
2013         ;;
2014     pcre)
2015         if [ "$VAL" = "qt" ] || [ "$VAL" = "system" ]; then
2016             CFG_PCRE="$VAL"
2017         else
2018             UNKNOWN_OPT=yes
2019         fi
2020         ;;
2021     *)
2022         UNKNOWN_OPT=yes
2023         ;;
2024     esac
2025     if [ "$UNKNOWN_OPT" = "yes" ]; then
2026         echo "${CURRENT_OPT}: invalid command-line switch"
2027         OPT_HELP=yes
2028         ERROR=yes
2029     fi
2030 done
2031
2032 # update QT_CONFIG to show our current predefined configuration
2033 case "$CFG_QCONFIG" in
2034 minimal|small|medium|large|full)
2035     # these are a sequence of increasing functionality
2036     for c in minimal small medium large full; do
2037         QT_CONFIG="$QT_CONFIG $c-config"
2038         [ "$CFG_QCONFIG" = $c ] && break
2039     done
2040     ;;
2041 *)
2042     # not known to be sufficient for anything
2043     if [ '!' -f "$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h" ] && [ '!' -f `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` ]; then
2044         echo >&2 "Error: configuration file not found:"
2045         echo >&2 "  $relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h"
2046         echo >&2 "  or"
2047         echo >&2 "  `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"`"
2048         OPT_HELP=yes
2049     fi
2050 esac
2051
2052 #-------------------------------------------------------------------------------
2053 # build tree initialization
2054 #-------------------------------------------------------------------------------
2055
2056 # where to find which..
2057 unixtests="$relpath/config.tests/unix"
2058 mactests="$relpath/config.tests/mac"
2059 WHICH="$unixtests/which.test"
2060
2061 PERL=`$WHICH perl 2>/dev/null`
2062
2063 # find out which awk we want to use, prefer gawk, then nawk, then regular awk
2064 AWK=
2065 for e in gawk nawk awk; do
2066     if "$WHICH" $e >/dev/null 2>&1 && ( $e -f /dev/null /dev/null ) >/dev/null 2>&1; then
2067         AWK=$e
2068         break
2069     fi
2070 done
2071
2072 # find perl
2073 PERL="/usr/bin/perl"
2074 if "$WHICH" perl >/dev/null 2>&1 && ( perl /dev/null ) >/dev/null 2>&1; then
2075     PERL=`$WHICH perl`
2076 fi
2077
2078 ### skip this if the user just needs help...
2079 if [ "$OPT_HELP" != "yes" ]; then
2080
2081 # is this a shadow build?
2082 if [ "$OPT_SHADOW" = "maybe" ]; then
2083     OPT_SHADOW=no
2084     if [ "$relpath" != "$outpath" ] && [ '!' -f "$outpath/configure" ]; then
2085         if [ -h "$outpath" ]; then
2086             [ "$relpath" -ef "$outpath" ] || OPT_SHADOW=yes
2087         else
2088             OPT_SHADOW=yes
2089         fi
2090     fi
2091 fi
2092 if [ "$OPT_SHADOW" = "yes" ]; then
2093     if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" -o -f "$relpath/src/corelib/global/qconfig.cpp" ]; then
2094         echo >&2 "You cannot make a shadow build from a source tree containing a previous build."
2095         echo >&2 "Cannot proceed."
2096         exit 1
2097     fi
2098     [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..."
2099 fi
2100
2101 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QPA" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
2102     echo
2103     echo "WARNING: -debug-and-release is not supported anymore on Qt/X11 and Qt for Embedded Linux"
2104     echo "Qt can be built in release mode with separate debug information, so"
2105     echo "-debug-and-release is not necessary anymore"
2106     echo
2107 fi
2108
2109 if [ "$CFG_SILENT" = "yes" ]; then
2110     QMAKE_CONFIG="$QMAKE_CONFIG silent"
2111 fi
2112
2113 # if the source tree is different from the build tree,
2114 # symlink or copy part of the sources
2115 if [ "$OPT_SHADOW" = "yes" ]; then
2116     echo "Preparing build tree..."
2117
2118     if [ -z "$PERL" ]; then
2119         echo
2120         echo "You need perl in your PATH to make a shadow build."
2121         echo "Cannot proceed."
2122         exit 1
2123     fi
2124
2125     [ -d "$outpath/bin" ] || mkdir -p "$outpath/bin"
2126
2127     # make a syncqt script that can be used in the shadow
2128     rm -f "$outpath/bin/syncqt"
2129     if [ -x "$relpath/bin/syncqt" ]; then
2130         mkdir -p "$outpath/bin"
2131         echo "#!/bin/sh" >"$outpath/bin/syncqt"
2132         echo "perl \"$relpath/bin/syncqt\" -qtdir \"$outpath\" \"\$@\"" >>"$outpath/bin/syncqt"
2133         chmod 755 "$outpath/bin/syncqt"
2134     fi
2135
2136     for i in elf2e32_qtwrapper createpackage patch_capabilities qtmodule-configtests; do
2137         rm -f "$outpath/bin/$i"
2138         if [ -x "$relpath/bin/$i" ]; then
2139             mkdir -p "$outpath/bin"
2140             echo "#!/bin/sh" >"$outpath/bin/$i"
2141             echo "QTDIR=\"$relpath\"; export QTDIR" >>"$outpath/bin/$i"
2142             echo "\"$relpath/bin/$i\" \"\$@\"" >>"$outpath/bin/$i"
2143             chmod 755 "$outpath/bin/$i"
2144         fi
2145     done
2146
2147     # symlink the mkspecs directory
2148     mkdir -p "$outpath/mkspecs"
2149     rm -rf "$outpath"/mkspecs/*
2150     ln -s "$relpath"/mkspecs/* "$outpath/mkspecs"
2151     rm -f "$outpath/mkspecs/default"
2152
2153     ShadowMkspecs()
2154     {
2155         rm -rf "$outpath/mkspecs/$1"
2156         find "$relpath/mkspecs/$1" -type d | sed "s,^$relpath,$outpath," | xargs mkdir -p
2157         find "$relpath/mkspecs/$1" -type f | sed "s,^$relpath/,," | while read f; do ln -s "$relpath/$f" "$outpath/$f"; done
2158     }
2159
2160     # Special case for mkspecs/features directory.
2161     # To be able to place .prf files into a shadow build directory,
2162     # we're creating links for files only. The directory structure is reproduced.
2163     ShadowMkspecs features
2164
2165     # The modules dir is special, too.
2166     ShadowMkspecs modules
2167
2168     # symlink the doc directory
2169     rm -rf "$outpath/doc"
2170     ln -s "$relpath/doc" "$outpath/doc"
2171 fi
2172
2173 # symlink fonts to be able to run application from build directory
2174 if [ "$PLATFORM_QPA" = "yes" ] && [ ! -d "${outpath}/lib/fonts" ]; then
2175     if [ "$PLATFORM" = "$XPLATFORM" ]; then
2176         mkdir -p "${outpath}/lib"
2177         ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts"
2178     fi
2179 fi
2180
2181 if [ "$OPT_FAST" = "auto" ]; then
2182    if [ '!' -z "$AWK" ] && [ "$CFG_DEV" = "yes" ]; then
2183        OPT_FAST=yes
2184    else
2185        OPT_FAST=no
2186    fi
2187 fi
2188
2189 # find a make command
2190 if [ -z "$MAKE" ]; then
2191     MAKE=
2192     for mk in gmake make; do
2193         if "$WHICH" $mk >/dev/null 2>&1; then
2194             MAKE=`"$WHICH" $mk`
2195             break
2196         fi
2197     done
2198     if [ -z "$MAKE" ]; then
2199         echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH."
2200         echo >&2 "Cannot proceed."
2201         exit 1
2202     fi
2203     # export MAKE, we need it later in the config.tests
2204     export MAKE
2205 fi
2206
2207 fi ### help
2208
2209 #-------------------------------------------------------------------------------
2210 # auto-detect all that hasn't been specified in the arguments
2211 #-------------------------------------------------------------------------------
2212
2213 if [ -z "$PLATFORM" ]; then
2214     PLATFORM_NOTES=
2215     case "$UNAME_SYSTEM:$UNAME_RELEASE" in
2216      Darwin:*)
2217         if [ "$PLATFORM_QPA" = "yes" ]; then
2218           OSX_VERSION=`uname -r | cut -d. -f1`
2219           if [ "$OSX_VERSION" -ge 11 ]; then
2220               # We're on Lion or above. Check if we have a supported Clang version
2221               case "$(clang -v 2>&1 | grep -Po '(?<=version )\d[\d.]+')" in
2222                   3.*)
2223                       PLATFORM=macx-clang
2224                       PLATFORM_NOTES="\n    - Also available for Mac OS X: macx-g++\n"
2225                       ;;
2226                   *)
2227                       PLATFORM=macx-g++
2228                       ;;
2229               esac
2230           else
2231               PLATFORM=macx-g++
2232           fi
2233         else
2234           PLATFORM=darwin-g++
2235         fi
2236         ;;
2237      AIX:*)
2238         #PLATFORM=aix-g++
2239         #PLATFORM=aix-g++-64
2240         PLATFORM=aix-xlc
2241         #PLATFORM=aix-xlc-64
2242         PLATFORM_NOTES="
2243             - Also available for AIX: aix-g++ aix-g++-64 aix-xlc-64
2244         "
2245         ;;
2246      GNU:*)
2247         PLATFORM=hurd-g++
2248         ;;
2249      dgux:*)
2250         PLATFORM=dgux-g++
2251         ;;
2252 #     DYNIX/ptx:4*)
2253 #       PLATFORM=dynix-g++
2254 #       ;;
2255      ULTRIX:*)
2256         PLATFORM=ultrix-g++
2257         ;;
2258      FreeBSD:*)
2259         PLATFORM=freebsd-g++
2260         PLATFORM_NOTES="
2261             - Also available for FreeBSD: freebsd-icc
2262         "
2263         ;;
2264      OpenBSD:*)
2265         PLATFORM=openbsd-g++
2266         ;;
2267      NetBSD:*)
2268         PLATFORM=netbsd-g++
2269         ;;
2270      BSD/OS:*|BSD/386:*)
2271         PLATFORM=bsdi-g++
2272         ;;
2273      IRIX*:*)
2274         #PLATFORM=irix-g++
2275         PLATFORM=irix-cc
2276         #PLATFORM=irix-cc-64
2277         PLATFORM_NOTES="
2278             - Also available for IRIX: irix-g++ irix-cc-64
2279         "
2280         ;;
2281      HP-UX:*)
2282         case "$UNAME_MACHINE" in
2283             ia64)
2284                 #PLATFORM=hpuxi-acc-32
2285                 PLATFORM=hpuxi-acc-64
2286                 PLATFORM_NOTES="
2287                     - Also available for HP-UXi: hpuxi-acc-32
2288                 "
2289             ;;
2290             *)
2291                 #PLATFORM=hpux-g++
2292                 PLATFORM=hpux-acc
2293                 #PLATFORM=hpux-acc-64
2294                 #PLATFORM=hpux-cc
2295                 #PLATFORM=hpux-acc-o64
2296                 PLATFORM_NOTES="
2297                     - Also available for HP-UX: hpux-g++ hpux-acc-64 hpux-acc-o64
2298                 "
2299             ;;
2300         esac
2301         ;;
2302      OSF1:*)
2303         #PLATFORM=tru64-g++
2304         PLATFORM=tru64-cxx
2305         PLATFORM_NOTES="
2306             - Also available for Tru64: tru64-g++
2307         "
2308         ;;
2309      Linux:*)
2310         case "$UNAME_MACHINE" in
2311             x86_64|s390x|ppc64)
2312                 PLATFORM=linux-g++-64
2313                 ;;
2314             *)
2315                 PLATFORM=linux-g++
2316                 ;;
2317         esac
2318         PLATFORM_NOTES="
2319             - Also available for Linux: linux-kcc linux-icc linux-cxx
2320         "
2321         ;;
2322      SunOS:5*)
2323         if [ "$XPLATFORM_MINGW" = "yes" ]; then
2324             PLATFORM="solaris-g++"
2325         else
2326             #PLATFORM=solaris-g++
2327             PLATFORM=solaris-cc
2328             #PLATFORM=solaris-cc64
2329         fi
2330         PLATFORM_NOTES="
2331             - Also available for Solaris: solaris-g++ solaris-cc-64
2332         "
2333         ;;
2334      ReliantUNIX-*:*|SINIX-*:*)
2335         PLATFORM=reliant-cds
2336         #PLATFORM=reliant-cds-64
2337         PLATFORM_NOTES="
2338             - Also available for Reliant UNIX: reliant-cds-64
2339         "
2340         ;;
2341      CYGWIN*:*)
2342         PLATFORM=cygwin-g++
2343         ;;
2344      LynxOS*:*)
2345         PLATFORM=lynxos-g++
2346         ;;
2347      OpenUNIX:*)
2348         #PLATFORM=unixware-g++
2349         PLATFORM=unixware-cc
2350         PLATFORM_NOTES="
2351             - Also available for OpenUNIX: unixware-g++
2352         "
2353         ;;
2354      UnixWare:*)
2355         #PLATFORM=unixware-g++
2356         PLATFORM=unixware-cc
2357         PLATFORM_NOTES="
2358             - Also available for UnixWare: unixware-g++
2359         "
2360         ;;
2361      SCO_SV:*)
2362         #PLATFORM=sco-g++
2363         PLATFORM=sco-cc
2364         PLATFORM_NOTES="
2365             - Also available for SCO OpenServer: sco-g++
2366         "
2367         ;;
2368      UNIX_SV:*)
2369         PLATFORM=unixware-g++
2370         ;;
2371      QNX:*)
2372         PLATFORM=unsupported/qnx-g++
2373         ;;
2374      *)
2375         if [ "$OPT_HELP" != "yes" ]; then
2376             echo
2377             for p in $PLATFORMS; do
2378                 echo "    $relconf $* -platform $p"
2379             done
2380             echo >&2
2381             echo "   The build script does not currently recognize all" >&2
2382             echo "   platforms supported by Qt." >&2
2383             echo "   Rerun this script with a -platform option listed to" >&2
2384             echo "   set the system/compiler combination you use." >&2
2385             echo >&2
2386             exit 2
2387         fi
2388     esac
2389 fi
2390
2391 PLATFORMS=`find "$relpath/mkspecs/" -type f | grep -v qws | sed "s,$relpath/mkspecs/qws/,,"`
2392
2393 [ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM"
2394
2395 case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac
2396 case "$XPLATFORM" in linux-g++-maemo) XPLATFORM_MAEMO=yes;; esac
2397
2398 if [ -d "$PLATFORM" ]; then
2399   QMAKESPEC="$PLATFORM"
2400 else
2401   QMAKESPEC="$relpath/mkspecs/${PLATFORM}"
2402 fi
2403 if [ -d "$XPLATFORM" ]; then
2404   XQMAKESPEC="$XPLATFORM"
2405 else
2406   XQMAKESPEC="$relpath/mkspecs/${XPLATFORM}"
2407 fi
2408 if [ "$PLATFORM" != "$XPLATFORM" ]; then
2409     QT_CROSS_COMPILE=yes
2410     QMAKE_CONFIG="$QMAKE_CONFIG cross_compile"
2411     QTCONFIG_CONFIG="$QTCONFIG_CONFIG cross_compile"
2412 fi
2413
2414 if [ "$BUILD_ON_MAC" = "yes" ]; then
2415    if [ `basename $QMAKESPEC` = "macx-xcode" ] || [ `basename $XQMAKESPEC` = "macx-xcode" ]; then
2416       echo >&2
2417       echo "   Platform 'macx-xcode' should not be used when building Qt/Mac." >&2
2418       echo "   Please build Qt/Mac with 'macx-g++', then if you would like to" >&2
2419       echo "   use mac-xcode on your application code it can link to a Qt/Mac" >&2
2420       echo "   built with 'macx-g++'" >&2
2421       echo >&2
2422       exit 2
2423     fi
2424 fi
2425
2426 # check specified platforms are supported
2427 if [ '!' -d "$QMAKESPEC" ]; then
2428     echo
2429     echo "   The specified system/compiler is not supported:"
2430     echo
2431     echo "      $QMAKESPEC"
2432     echo
2433     echo "   Please see the README file for a complete list."
2434     echo
2435     exit 2
2436 fi
2437 if [ '!' -d "$XQMAKESPEC" ]; then
2438     echo
2439     echo "   The specified system/compiler is not supported:"
2440     echo
2441     echo "      $XQMAKESPEC"
2442     echo
2443     echo "   Please see the README file for a complete list."
2444     echo
2445     exit 2
2446 fi
2447 if [ '!' -f "${XQMAKESPEC}/qplatformdefs.h" ]; then
2448     echo
2449     echo "   The specified system/compiler port is not complete:"
2450     echo
2451     echo "      $XQMAKESPEC/qplatformdefs.h"
2452     echo
2453     echo "   Please contact qt-info@nokia.com."
2454     echo
2455     exit 2
2456 fi
2457
2458 # now look at the configs and figure out what platform we are config'd for
2459 [ "$PLATFORM_QPA" != "yes" ] \
2460   && [ -n "`getXQMakeConf QMAKE_LIBS_X11`" ] \
2461   && PLATFORM_X11=yes
2462 ### echo "$XQMAKESPEC" | grep mkspecs/qws >/dev/null 2>&1 && PLATFORM_QWS=yes
2463
2464 if [ "$UNAME_SYSTEM" = "SunOS" ]; then
2465     # Solaris 2.5 and 2.6 have libposix4, which was renamed to librt for Solaris 7 and up
2466     if echo $UNAME_RELEASE | grep "^5\.[5|6]" >/dev/null 2>&1; then
2467         sed -e "s,-lrt,-lposix4," "$XQMAKESPEC/qmake.conf" > "$XQMAKESPEC/qmake.conf.new"
2468         mv "$XQMAKESPEC/qmake.conf.new" "$XQMAKESPEC/qmake.conf"
2469     fi
2470 fi
2471
2472 if [ "$CFG_RTOS_ENABLED" = "no" ]; then
2473     case `basename "$XPLATFORM"` in
2474         qnx-* | vxworks-*)
2475             echo ""
2476             echo "You are not licensed for Qt for `basename $XPLATFORM`."
2477             echo ""
2478             echo "Please contact qt-info@nokia.com to upgrade your license to"
2479             echo "include this platform, or install the Qt Open Source Edition"
2480             echo "if you intend to develop free software."
2481             exit 1
2482             ;;
2483     esac
2484 fi
2485
2486 #-------------------------------------------------------------------------------
2487 # write out device config before we run the test.
2488 #-------------------------------------------------------------------------------
2489 if cmp -s "$DEVICE_VARS_FILE" "$outpath/mkspecs/qdevice.pri"; then
2490     rm -f "$DEVICE_VARS_FILE"
2491 else
2492     mv -f $DEVICE_VARS_FILE "$outpath/mkspecs/qdevice.pri"
2493 fi
2494
2495 #-------------------------------------------------------------------------------
2496 # tests that don't need qmake (must be run before displaying help)
2497 #-------------------------------------------------------------------------------
2498
2499 # detect build style
2500 if [ "$CFG_DEBUG" = "auto" ]; then
2501     if [ "$PLATFORM_MAC" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
2502         CFG_DEBUG_RELEASE=yes
2503         CFG_DEBUG=yes
2504     elif [ "$CFG_DEV" = "yes" ]; then
2505         CFG_DEBUG_RELEASE=no
2506         CFG_DEBUG=yes
2507     else
2508         CFG_DEBUG_RELEASE=no
2509         CFG_DEBUG=no
2510     fi
2511 fi
2512 if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
2513     QT_CONFIG="$QT_CONFIG build_all"
2514 fi
2515
2516 if [ -z "$PKG_CONFIG" ]; then
2517     # See if PKG_CONFIG is set in the mkspec:
2518     PKG_CONFIG=`getXQMakeConf PKG_CONFIG`
2519 fi
2520 if [ -z "$PKG_CONFIG" ]; then
2521     PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null`
2522 fi
2523
2524 # Work out if we can use pkg-config
2525 if [ "$QT_CROSS_COMPILE" = "yes" ]; then
2526     if [ "$QT_FORCE_PKGCONFIG" = "yes" ]; then
2527         echo >&2 ""
2528         echo >&2 "You have asked to use pkg-config and are cross-compiling."
2529         echo >&2 "Please make sure you have a correctly set-up pkg-config"
2530         echo >&2 "environment!"
2531         echo >&2 ""
2532         if [ -z "$PKG_CONFIG_LIBDIR" ]; then
2533             echo >&2 ""
2534             echo >&2 "Warning: PKG_CONFIG_LIBDIR has not been set.  This could mean"
2535             echo >&2 "the host's .pc files will be used (even if you set PKG_CONFIG_PATH)."
2536             echo >&2 "This is probably not what you want."
2537             echo >&2 ""
2538         elif [ -z "$PKG_CONFIG_SYSROOT" ] && [ -z "$PKG_CONFIG_SYSROOT_DIR" ]; then
2539             echo >&2 ""
2540             echo >&2 "Warning: PKG_CONFIG_SYSROOT/PKG_CONFIG_SYSROOT_DIR has not"
2541             echo >&2 "been set. This means your toolchain's .pc files must contain"
2542             echo >&2 "the paths to the toolchain's libraries & headers. If configure"
2543             echo >&2 "tests are failing, please check these files."
2544             echo >&2 ""
2545         fi
2546     else
2547         echo >&2 ""
2548         echo >&2 "You have not explicitly asked to use pkg-config and are cross-compiling."
2549         echo >&2 "pkg-config will not be used to automatically query cflag/lib parameters for"
2550         echo >&2 "dependencies"
2551         echo >&2 ""
2552         PKG_CONFIG=""
2553     fi
2554 fi
2555
2556 if [ ! -n "$PKG_CONFIG" ]; then
2557     QT_CONFIG="$QT_CONFIG no-pkg-config"
2558 fi
2559
2560 # pass on $CFG_SDK to the configure tests.
2561 if [ '!' -z "$CFG_SDK" ]; then
2562     MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -sdk $CFG_SDK"
2563 fi
2564
2565 # find the default framework value
2566 if [ "$BUILD_ON_MAC" = "yes" ]; then
2567     if [ "$CFG_FRAMEWORK" = "auto" ]; then
2568         CFG_FRAMEWORK="$CFG_SHARED"
2569     elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
2570         echo
2571         echo "WARNING: Using static linking will disable the use of Mac frameworks."
2572         echo
2573         CFG_FRAMEWORK="no"
2574     fi
2575 else
2576     CFG_FRAMEWORK=no
2577 fi
2578
2579 QMAKE_CONF_COMPILER=`getXQMakeConf QMAKE_CXX`
2580
2581 TEST_COMPILER=$QMAKE_CONF_COMPILER
2582 if [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then
2583     if [ -z "$TEST_COMPILER" ]; then
2584         echo "ERROR: Cannot set the compiler for the configuration tests"
2585         exit 1
2586     fi
2587 fi
2588
2589 SYSROOT_FLAG=
2590 if [ -n "$CFG_SYSROOT" ]; then
2591     if compilerSupportsFlag --sysroot="$CFG_SYSROOT"; then
2592         [ "$OPT_VERBOSE" = "yes" ] && echo "Setting sysroot to: $CFG_SYSROOT"
2593         SYSROOT_FLAG="--sysroot=$CFG_SYSROOT"
2594     else
2595         echo >&2 "The compiler doesn't support the --sysroot flag, I can't set the sysroot"
2596         exit 1
2597     fi
2598 fi
2599 export SYSROOT_FLAG    # used by config.tests/unix/compile.test
2600
2601 # auto-detect precompiled header support
2602 if [ "$CFG_PRECOMPILE" = "auto" ]; then
2603     if "$unixtests/precomp.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
2604        CFG_PRECOMPILE=no
2605     else
2606        CFG_PRECOMPILE=yes
2607     fi
2608 fi
2609
2610 #auto-detect DWARF2 on the mac
2611 if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "auto" ]; then
2612     if "$mactests/dwarf2.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
2613         CFG_MAC_DWARF2=no
2614     else
2615         CFG_MAC_DWARF2=yes
2616     fi
2617 fi
2618
2619 # don't autodetect support for separate debug info on objcopy when
2620 # cross-compiling as lots of toolchains seems to have problems with this
2621 if [ "$QT_CROSS_COMPILE" = "yes" ] && [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
2622     CFG_SEPARATE_DEBUG_INFO="no"
2623 fi
2624
2625 # auto-detect support for separate debug info in objcopy
2626 if [ "$CFG_SEPARATE_DEBUG_INFO" != "no" ] && [ "$CFG_SHARED" = "yes" ]; then
2627     TEST_COMPILER_CFLAGS=`getXQMakeConf QMAKE_CFLAGS`
2628     TEST_COMPILER_CXXFLAGS=`getXQMakeConf QMAKE_CXXFLAGS`
2629     TEST_OBJCOPY=`getXQMakeConf QMAKE_OBJCOPY`
2630     COMPILER_WITH_FLAGS="$TEST_COMPILER $TEST_COMPILER_CXXFLAGS"
2631     COMPILER_WITH_FLAGS=`echo "$COMPILER_WITH_FLAGS" | sed -e "s%\\$\\$QMAKE_CFLAGS%$TEST_COMPILER_CFLAGS%g"`
2632     if "$unixtests/objcopy.test" "$COMPILER_WITH_FLAGS" "$TEST_OBJCOPY" "$OPT_VERBOSE"; then
2633        CFG_SEPARATE_DEBUG_INFO=no
2634     else
2635        case "$PLATFORM" in
2636        hpux-*)
2637            # binutils on HP-UX is buggy; default to no.
2638            CFG_SEPARATE_DEBUG_INFO=no
2639            ;;
2640        *)
2641            CFG_SEPARATE_DEBUG_INFO=yes
2642            ;;
2643        esac
2644     fi
2645 fi
2646
2647 # auto-detect -fvisibility support
2648 if [ "$CFG_REDUCE_EXPORTS" != "no" ]; then
2649     if "$unixtests/fvisibility.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
2650        if [ "$CFG_REDUCE_EXPORTS" = "yes" ]; then
2651            echo "-reduce-exports was requested but this compiler does not support it"
2652            echo "Re-run configure with -v for more information"
2653            exit 1
2654        fi
2655        CFG_REDUCE_EXPORTS=no
2656     else
2657        CFG_REDUCE_EXPORTS=yes
2658     fi
2659 fi
2660
2661 # detect the availability of the -Bsymbolic-functions linker optimization
2662 if [ "$CFG_REDUCE_RELOCATIONS" != "no" ]; then
2663     if "$unixtests/bsymbolic_functions.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
2664        if [ "$CFG_REDUCE_RELOCATIONS" = "yes" ]; then
2665            echo "-reduce-relocations was requested but this compiler does not support it"
2666            echo "Re-run configure with -v for more information"
2667            exit 1
2668        fi
2669         CFG_REDUCE_RELOCATIONS=no
2670     else
2671         CFG_REDUCE_RELOCATIONS=yes
2672     fi
2673 fi
2674
2675 # auto-detect GNU make support
2676 if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2>&1; then
2677    CFG_USE_GNUMAKE=yes
2678 fi
2679
2680 # find the default framework value
2681 if [ "$BUILD_ON_MAC" = "yes" ]; then
2682     if [ "$CFG_FRAMEWORK" = "auto" ]; then
2683         CFG_FRAMEWORK="$CFG_SHARED"
2684     elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
2685         echo
2686         echo "WARNING: Using static linking will disable the use of Mac frameworks."
2687         echo
2688         CFG_FRAMEWORK="no"
2689     fi
2690 else
2691     CFG_FRAMEWORK=no
2692 fi
2693
2694 # x11 tests are done after qmake is built
2695
2696
2697 #setup the build parts
2698 if [ -z "$CFG_BUILD_PARTS" ]; then
2699     CFG_BUILD_PARTS="$QT_DEFAULT_BUILD_PARTS"
2700
2701     # build tests by default, if a developer build
2702     if [ "$CFG_DEV" = "yes" ]; then
2703         CFG_BUILD_PARTS="$CFG_BUILD_PARTS tests"
2704     fi
2705
2706     # don't build tools by default when cross-compiling
2707     if [ "$PLATFORM" != "$XPLATFORM" ]; then
2708         CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, tools,,g"`
2709     fi
2710 fi
2711 for nobuild in $CFG_NOBUILD_PARTS; do
2712     CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, $nobuild,,g"`
2713 done
2714 if echo $CFG_BUILD_PARTS | grep -v libs >/dev/null 2>&1; then
2715 #    echo
2716 #    echo "WARNING: libs is a required part of the build."
2717 #    echo
2718     CFG_BUILD_PARTS="$CFG_BUILD_PARTS libs"
2719 fi
2720
2721 #-------------------------------------------------------------------------------
2722 # post process QT_INSTALL_* variables
2723 #-------------------------------------------------------------------------------
2724
2725 if [ -z "$QT_INSTALL_PREFIX" ]; then
2726     if [ "$CFG_DEV" = "yes" ]; then
2727         QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default
2728     else
2729         QT_INSTALL_PREFIX="/usr/local/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Qt-$QT_VERSION
2730     fi
2731 fi
2732 QT_INSTALL_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PREFIX"`
2733
2734 if [ -z "$QT_INSTALL_DOCS" ]; then #default
2735     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2736         if [ "$BUILD_ON_MAC" = "yes" ]; then
2737             QT_INSTALL_DOCS="/Developer/Documentation/Qt"
2738         fi
2739     fi
2740     [ -z "$QT_INSTALL_DOCS" ] && QT_INSTALL_DOCS="$QT_INSTALL_PREFIX/doc" #fallback
2741
2742 fi
2743 QT_INSTALL_DOCS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DOCS"`
2744
2745 if [ -z "$QT_INSTALL_HEADERS" ]; then #default
2746     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2747         if [ "$BUILD_ON_MAC" = "yes" ]; then
2748             if [ "$CFG_FRAMEWORK" = "yes" ]; then
2749                 QT_INSTALL_HEADERS=
2750             fi
2751         fi
2752     fi
2753     [ -z "$QT_INSTALL_HEADERS" ] && QT_INSTALL_HEADERS="$QT_INSTALL_PREFIX/include"
2754
2755 fi
2756 QT_INSTALL_HEADERS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_HEADERS"`
2757
2758 if [ -z "$QT_INSTALL_LIBS" ]; then #default
2759     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2760         if [ "$BUILD_ON_MAC" = "yes" ]; then
2761             if [ "$CFG_FRAMEWORK" = "yes" ]; then
2762                 QT_INSTALL_LIBS="/Libraries/Frameworks"
2763             fi
2764         fi
2765     fi
2766     [ -z "$QT_INSTALL_LIBS" ] && QT_INSTALL_LIBS="$QT_INSTALL_PREFIX/lib" #fallback
2767 fi
2768 QT_INSTALL_LIBS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_LIBS"`
2769
2770 if [ -z "$QT_INSTALL_BINS" ]; then #default
2771     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2772         if [ "$BUILD_ON_MAC" = "yes" ]; then
2773             QT_INSTALL_BINS="/Developer/Applications/Qt"
2774         fi
2775     fi
2776     [ -z "$QT_INSTALL_BINS" ] && QT_INSTALL_BINS="$QT_INSTALL_PREFIX/bin" #fallback
2777 fi
2778 QT_INSTALL_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_BINS"`
2779
2780 if [ -z "$QT_INSTALL_PLUGINS" ]; then #default
2781     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2782         if [ "$BUILD_ON_MAC" = "yes" ]; then
2783             QT_INSTALL_PLUGINS="/Developer/Applications/Qt/plugins"
2784         fi
2785     fi
2786     [ -z "$QT_INSTALL_PLUGINS" ] && QT_INSTALL_PLUGINS="$QT_INSTALL_PREFIX/plugins" #fallback
2787 fi
2788 QT_INSTALL_PLUGINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PLUGINS"`
2789
2790 if [ -z "$QT_INSTALL_IMPORTS" ]; then #default
2791     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2792         if [ "$BUILD_ON_MAC" = "yes" ]; then
2793             QT_INSTALL_IMPORTS="/Developer/Applications/Qt/imports"
2794         fi
2795     fi
2796     [ -z "$QT_INSTALL_IMPORTS" ] && QT_INSTALL_IMPORTS="$QT_INSTALL_PREFIX/imports" #fallback
2797 fi
2798 QT_INSTALL_IMPORTS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_IMPORTS"`
2799
2800 if [ -z "$QT_INSTALL_DATA" ]; then #default
2801     QT_INSTALL_DATA="$QT_INSTALL_PREFIX"
2802 fi
2803 QT_INSTALL_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DATA"`
2804
2805 if [ -z "$QT_INSTALL_TRANSLATIONS" ]; then #default
2806     QT_INSTALL_TRANSLATIONS="$QT_INSTALL_PREFIX/translations"
2807 fi
2808 QT_INSTALL_TRANSLATIONS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TRANSLATIONS"`
2809
2810 if [ -z "$QT_INSTALL_SETTINGS" ]; then #default
2811     if [ "$BUILD_ON_MAC" = "yes" ]; then
2812         QT_INSTALL_SETTINGS=/Library/Preferences/Qt
2813     else
2814         QT_INSTALL_SETTINGS=/etc/xdg
2815     fi
2816 fi
2817 QT_INSTALL_SETTINGS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_SETTINGS"`
2818
2819 if [ -z "$QT_INSTALL_EXAMPLES" ]; then #default
2820     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2821         if [ "$BUILD_ON_MAC" = "yes" ]; then
2822             QT_INSTALL_EXAMPLES="/Developer/Examples/Qt"
2823         fi
2824     fi
2825     [ -z "$QT_INSTALL_EXAMPLES" ] && QT_INSTALL_EXAMPLES="$QT_INSTALL_PREFIX/examples" #fallback
2826 fi
2827 QT_INSTALL_EXAMPLES=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_EXAMPLES"`
2828
2829 #tests
2830 if [ -z "$QT_INSTALL_TESTS" ]; then #default
2831     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2832         if [ "$BUILD_ON_MAC" = "yes" ]; then
2833             QT_INSTALL_TESTS="/Developer/Tests/Qt"
2834         fi
2835     fi
2836     [ -z "$QT_INSTALL_TESTS" ] && QT_INSTALL_TESTS="$QT_INSTALL_PREFIX/tests" #fallback
2837 fi
2838 QT_INSTALL_TESTS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TESTS"`
2839
2840 #------- host paths --------
2841
2842 if [ -z "$QT_HOST_PREFIX" ]; then
2843     QT_HOST_PREFIX=$QT_INSTALL_PREFIX
2844     haveHpx=false
2845 else
2846     QT_HOST_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_PREFIX"`
2847     haveHpx=true
2848 fi
2849
2850 if [ -z "$QT_HOST_BINS" ]; then #default
2851     if $haveHpx; then
2852         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2853             if [ "$BUILD_ON_MAC" = "yes" ]; then
2854                 QT_HOST_BINS="/Developer/Applications/Qt"
2855             fi
2856         fi
2857         [ -z "$QT_HOST_BINS" ] && QT_HOST_BINS="$QT_HOST_PREFIX/bin" #fallback
2858     else
2859         QT_HOST_BINS="$QT_INSTALL_BINS"
2860     fi
2861 fi
2862 QT_HOST_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_BINS"`
2863
2864 if [ -z "$QT_HOST_DATA" ]; then #default
2865     if $haveHpx; then
2866         QT_HOST_DATA="$QT_HOST_PREFIX"
2867     else
2868         QT_HOST_DATA="$QT_INSTALL_DATA"
2869     fi
2870 else
2871     QT_HOST_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_DATA"`
2872 fi
2873
2874 #-------------------------------------------------------------------------------
2875 # help - interactive parts of the script _after_ this section please
2876 #-------------------------------------------------------------------------------
2877
2878 # next, emit a usage message if something failed.
2879 if [ "$OPT_HELP" = "yes" ]; then
2880     [ "x$ERROR" = "xyes" ] && echo
2881     if [ "$CFG_NIS" = "no" ]; then
2882         NSY=" "
2883         NSN="*"
2884     else
2885         NSY="*"
2886         NSN=" "
2887     fi
2888     if [ "$CFG_CUPS" = "no" ]; then
2889         CUY=" "
2890         CUN="*"
2891     else
2892         CUY="*"
2893         CUN=" "
2894     fi
2895     if [ "$CFG_ICONV" = "no" ]; then
2896         CIY=" "
2897         CIN="*"
2898     else
2899         CIY="*"
2900         CIN=" "
2901     fi
2902     if [ "$CFG_LARGEFILE" = "no" ]; then
2903         LFSY=" "
2904         LFSN="*"
2905     else
2906         LFSY="*"
2907         LFSN=" "
2908     fi
2909     if [ "$CFG_STL" = "auto" ] || [ "$CFG_STL" = "yes" ]; then
2910         SHY="*"
2911         SHN=" "
2912     else
2913         SHY=" "
2914         SHN="*"
2915     fi
2916     if [ "$CFG_PRECOMPILE" = "auto" ] || [ "$CFG_PRECOMPILE" = "no" ]; then
2917         PHY=" "
2918         PHN="*"
2919     else
2920         PHY="*"
2921         PHN=" "
2922     fi
2923
2924     if [ "$CFG_XCB" = "no" ]; then
2925         XCBY=" "
2926         XCBN="*"
2927     else
2928         XCBY="*"
2929         XCBN=" "
2930     fi
2931
2932     if [ "$CFG_EGLFS" = "no" ]; then
2933         EGLFSY=" "
2934         EGLFSN="*"
2935     else
2936         EGLFSY="*"
2937         EGLFSN=" "
2938     fi
2939
2940     if [ "$CFG_XINPUT2" = "no" ]; then
2941         X2Y=" "
2942         X2N="*"
2943     else
2944         X2Y="*"
2945         X2N=" "
2946     fi
2947
2948     cat <<EOF
2949 Usage:  $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>]
2950         [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-importdir <dir>] [-datadir <dir>]
2951         [-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>] [-testsdir <dir>]
2952         [-release] [-debug] [-debug-and-release]
2953         [-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile]
2954         [-largefile] [-no-exceptions] [-exceptions] [-no-accessibility]
2955         [-accessibility] [-no-stl] [-stl] [-no-sql-<driver>] [-sql-<driver>]
2956         [-plugin-sql-<driver>] [-system-sqlite]
2957         [-platform] [-D <string>] [-I <string>] [-L <string>] [-help]
2958         [-qt-zlib] [-system-zlib] [-no-gif] [-no-libpng] [-qt-libpng] [-system-libpng]
2959         [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>]
2960         [-nomake <part>] [-R <string>]  [-l <string>] [-no-rpath]  [-rpath] [-continue]
2961         [-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [-no-iconv]
2962         [-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked] [-no-gui]
2963         [-no-separate-debug-info] [-no-mmx] [-no-3dnow] [-no-sse] [-no-sse2]
2964         [-no-sse3] [-no-ssse3] [-no-sse4.1] [-no-sse4.2] [-no-avx] [-no-neon]
2965         [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info]
2966         [-no-phonon-backend] [-phonon-backend] [-no-media-backend] [-media-backend]
2967         [-no-audio-backend] [-audio-backend]
2968         [-no-javascript-jit] [-javascript-jit] [-no-declarative-debug] [-declarative-debug]
2969         [-no-optimized-qmake] [-optimized-qmake]
2970         [-no-openssl] [-openssl] [-openssl-linked]
2971         [-no-gtkstyle] [-gtkstyle]
2972         [-qt-pcre] [-system-pcre]
2973         [-device <name>] [-device-option <key=value>]
2974         [additional platform specific options (see below)]
2975
2976
2977 Installation options:
2978
2979     -qpa ................ This will enable the QPA build.
2980                           QPA is a window system agnostic implementation of Qt.
2981
2982  These are optional, but you may specify install directories.
2983
2984     -prefix <dir> ...... This will install everything relative to <dir>
2985                          (default $QT_INSTALL_PREFIX)
2986 EOF
2987 if [ "$PLATFORM_QPA" = "yes" ]; then
2988 cat <<EOF
2989
2990     -hostprefix [dir] .. Tools and libraries needed when developing
2991                          applications are installed in [dir]. If [dir] is
2992                          not given, the current build directory will be used.
2993                          (default PREFIX)
2994 EOF
2995 fi
2996 cat <<EOF
2997
2998   * -prefix-install .... Force a sandboxed "local" installation of
2999                          Qt. This will install into
3000                          $QT_INSTALL_PREFIX, if this option is
3001                          disabled then some platforms will attempt a
3002                          "system" install by placing default values to
3003                          be placed in a system location other than
3004                          PREFIX.
3005
3006  You may use these to separate different parts of the install:
3007
3008     -bindir <dir> ......... Executables will be installed to <dir>
3009                             (default PREFIX/bin)
3010     -libdir <dir> ......... Libraries will be installed to <dir>
3011                             (default PREFIX/lib)
3012     -docdir <dir> ......... Documentation will be installed to <dir>
3013                             (default PREFIX/doc)
3014     -headerdir <dir> ...... Headers will be installed to <dir>
3015                             (default PREFIX/include)
3016     -plugindir <dir> ...... Plugins will be installed to <dir>
3017                             (default PREFIX/plugins)
3018     -importdir <dir> ...... Imports for QML will be installed to <dir>
3019                             (default PREFIX/imports)
3020     -datadir <dir> ........ Data used by Qt programs will be installed to <dir>
3021                             (default PREFIX)
3022     -translationdir <dir> . Translations of Qt programs will be installed to <dir>
3023                             (default PREFIX/translations)
3024     -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir>
3025                             (default PREFIX/etc/settings)
3026     -examplesdir <dir> .... Examples will be installed to <dir>
3027                             (default PREFIX/examples)
3028     -testsdir <dir> ....... Tests will be installed to <dir>
3029                             (default PREFIX/tests)
3030 EOF
3031 if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
3032 cat <<EOF
3033
3034     -hostbindir <dir> .. Host executables will be installed to <dir>
3035                          (default HOSTPREFIX/bin)
3036     -hostdatadir <dir> . Data used by qmake will be installed to <dir>
3037                          (default HOSTPREFIX)
3038 EOF
3039 fi
3040 cat <<EOF
3041
3042 Configure options:
3043
3044  The defaults (*) are usually acceptable. A plus (+) denotes a default value
3045  that needs to be evaluated. If the evaluation succeeds, the feature is
3046  included. Here is a short explanation of each option:
3047
3048  *  -release ........... Compile and link Qt with debugging turned off.
3049     -debug ............. Compile and link Qt with debugging turned on.
3050     -debug-and-release . Compile and link two versions of Qt, with and without
3051                          debugging turned on (Mac only).
3052
3053     -developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting)
3054
3055     -opensource ........ Compile and link the Open-Source Edition of Qt.
3056     -commercial ........ Compile and link the Commercial Edition of Qt.
3057
3058
3059  *  -shared ............ Create and use shared Qt libraries.
3060     -static ............ Create and use static Qt libraries.
3061
3062  *  -no-fast ........... Configure Qt normally by generating Makefiles for all
3063                          project files.
3064     -fast .............. Configure Qt quickly by generating Makefiles only for
3065                          library and subdirectory targets.  All other Makefiles
3066                          are created as wrappers, which will in turn run qmake.
3067
3068     -no-largefile ...... Disables large file support.
3069  +  -largefile ......... Enables Qt to access files larger than 4 GB.
3070
3071 EOF
3072 if [ "$PLATFORM_QPA" = "yes" ]; then
3073     EXCN="*"
3074     EXCY=" "
3075 else
3076     EXCN=" "
3077     EXCY="*"
3078 fi
3079 if [ "$CFG_DBUS" = "no" ]; then
3080     DBY=" "
3081     DBN="+"
3082 else
3083     DBY="+"
3084     DBN=" "
3085 fi
3086
3087     cat << EOF
3088  $EXCN  -no-exceptions ..... Disable exceptions on compilers that support it.
3089  $EXCY  -exceptions ........ Enable exceptions on compilers that support it.
3090
3091     -no-accessibility .. Do not compile Accessibility support.
3092  *  -accessibility ..... Compile Accessibility support.
3093
3094  $SHN  -no-stl ............ Do not compile STL support.
3095  $SHY  -stl ............... Compile STL support.
3096
3097     -no-sql-<driver> ... Disable SQL <driver> entirely.
3098     -qt-sql-<driver> ... Enable a SQL <driver> in the QtSql library, by default
3099                          none are turned on.
3100     -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to
3101                          at run time.
3102
3103                          Possible values for <driver>:
3104                          [ $CFG_SQL_AVAILABLE ]
3105
3106     -system-sqlite ..... Use sqlite from the operating system.
3107
3108     -no-phonon-backend.. Do not build the platform phonon plugin.
3109  +  -phonon-backend..... Build the platform phonon plugin.
3110
3111     -no-javascript-jit . Do not build the JavaScriptCore JIT compiler.
3112  +  -javascript-jit .... Build the JavaScriptCore JIT compiler.
3113
3114     -no-declarative-debug ..... Do not build the declarative debugging support.
3115  +  -declarative-debug ....... Build the declarative debugging support.
3116
3117     -platform target ... The operating system and compiler you are building
3118                          on ($PLATFORM).
3119
3120                          See the README file for a list of supported
3121                          operating systems and compilers.
3122 EOF
3123
3124 if [ "${PLATFORM_QPA}" != "yes" ]; then
3125 cat << EOF
3126     -graphicssystem <sys> Sets an alternate graphics system. Available options are:
3127                            raster - Software rasterizer
3128                            opengl - Rendering via OpenGL, Experimental!
3129                            openvg - Rendering via OpenVG, Experimental!
3130
3131 EOF
3132 fi
3133
3134 cat << EOF
3135
3136     -no-mmx ............ Do not compile with use of MMX instructions.
3137     -no-3dnow .......... Do not compile with use of 3DNOW instructions.
3138     -no-sse ............ Do not compile with use of SSE instructions.
3139     -no-sse2 ........... Do not compile with use of SSE2 instructions.
3140     -no-sse3 ........... Do not compile with use of SSE3 instructions.
3141     -no-ssse3 .......... Do not compile with use of SSSE3 instructions.
3142     -no-sse4.1.......... Do not compile with use of SSE4.1 instructions.
3143     -no-sse4.2.......... Do not compile with use of SSE4.2 instructions.
3144     -no-avx ............ Do not compile with use of AVX instructions.
3145     -no-neon ........... Do not compile with use of NEON instructions.
3146     -no-mips_dsp ....... Do not compile with use of MIPS DSP instructions.
3147     -no-mips_dspr2 ..... Do not compile with use of MIPS DSP rev2 instructions.
3148
3149     -qtnamespace <name>  Wraps all Qt library code in 'namespace <name> {...}'.
3150     -qtlibinfix <infix>  Renames all libQt*.so to libQt*<infix>.so.
3151
3152     -testcocoon          Instrument Qt with the TestCocoon code coverage tool.
3153
3154     -D <string> ........ Add an explicit define to the preprocessor.
3155     -I <string> ........ Add an explicit include path.
3156     -L <string> ........ Add an explicit library path.
3157
3158     -help, -h .......... Display this information.
3159
3160 Third Party Libraries:
3161
3162     -qt-zlib ........... Use the zlib bundled with Qt.
3163  +  -system-zlib ....... Use zlib from the operating system.
3164                          See http://www.gzip.org/zlib
3165
3166     -no-gif ............ Do not compile GIF reading support.
3167
3168     -no-libpng ......... Do not compile PNG support.
3169     -qt-libpng ......... Use the libpng bundled with Qt.
3170  +  -system-libpng ..... Use libpng from the operating system.
3171                          See http://www.libpng.org/pub/png
3172
3173     -no-libjpeg ........ Do not compile JPEG support.
3174     -qt-libjpeg ........ Use the libjpeg bundled with Qt.
3175  +  -system-libjpeg .... Use libjpeg from the operating system.
3176                          See http://www.ijg.org
3177
3178     -no-openssl ........ Do not compile support for OpenSSL.
3179  +  -openssl ........... Enable run-time OpenSSL support.
3180     -openssl-linked .... Enabled linked OpenSSL support.
3181
3182     -qt-pcre ........... Use the PCRE library bundled with Qt.
3183  +  -system-pcre ....... Use the PCRE library from the operating system.
3184
3185 Additional options:
3186
3187     -make <part> ....... Add part to the list of parts to be built at make time.
3188                          ($QT_DEFAULT_BUILD_PARTS)
3189     -nomake <part> ..... Exclude part from the list of parts to be built.
3190
3191     -R <string> ........ Add an explicit runtime library path to the Qt
3192                          libraries.
3193     -l <string> ........ Add an explicit library.
3194
3195     -no-rpath .......... Do not use the library install path as a runtime
3196                          library path.
3197  +  -rpath ............. Link Qt libraries and executables using the library
3198                          install path as a runtime library path. Equivalent
3199                          to -R install_libpath
3200
3201     -continue .......... Continue as far as possible if an error occurs.
3202
3203     -verbose, -v ....... Print verbose information about each step of the
3204                          configure process.
3205
3206     -silent ............ Reduce the build output so that warnings and errors
3207                          can be seen more easily.
3208
3209  *  -no-optimized-qmake ... Do not build qmake optimized.
3210     -optimized-qmake ...... Build qmake optimized.
3211
3212     -no-gui ............ Don't build the Qt GUI library
3213
3214  $NSN  -no-nis ............ Do not compile NIS support.
3215  $NSY  -nis ............... Compile NIS support.
3216
3217  $CUN  -no-cups ........... Do not compile CUPS support.
3218  $CUY  -cups .............. Compile CUPS support.
3219                          Requires cups/cups.h and libcups.so.2.
3220
3221  $CIN  -no-iconv .......... Do not compile support for iconv(3).
3222  $CIY  -iconv ............. Compile support for iconv(3).
3223
3224  $PHN  -no-pch ............ Do not use precompiled header support.
3225  $PHY  -pch ............... Use precompiled header support.
3226
3227  $DBN  -no-dbus ........... Do not compile the QtDBus module.
3228  $DBY  -dbus .............. Compile the QtDBus module and dynamically load libdbus-1.
3229     -dbus-linked ....... Compile the QtDBus module and link to libdbus-1.
3230
3231     -reduce-relocations ..... Reduce relocations in the libraries through extra
3232                               linker optimizations (Qt/X11 and Qt for Embedded Linux only;
3233                               experimental; needs GNU ld >= 2.18).
3234
3235     -force-asserts ........ Force Q_ASSERT to be enabled even in release builds.
3236
3237     -device <name> ............... Cross-compile for device <name> (experimental)
3238     -device-option <key=value> ... Add device specific options for the device mkspec
3239                                    (experimental)
3240
3241 EOF
3242
3243 if [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
3244     if [ "$QT_CROSS_COMPILE" = "yes" ]; then
3245         SBY=""
3246         SBN="*"
3247     else
3248         SBY="*"
3249         SBN=" "
3250     fi
3251 elif [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
3252     SBY="*"
3253     SBN=" "
3254 else
3255     SBY=" "
3256     SBN="*"
3257 fi
3258
3259 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
3260
3261     cat << EOF
3262
3263  $SBN  -no-separate-debug-info . Do not store debug information in a separate file.
3264  $SBY  -separate-debug-info .... Strip debug information into a separate .debug file.
3265
3266  $XCBN  -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support.
3267  $XCBY  -xcb ............... Compile Xcb support.
3268
3269  $EGLFSN  -no-eglfs .......... Do not compile EGLFS (EGL Full Screen/Single Surface) support.
3270  $EGLFSY  -eglfs ............. Compile EGLFS support.
3271
3272 EOF
3273
3274 fi # X11
3275
3276 if [ "$XPLATFORM_MAEMO" = "yes" ]; then
3277
3278     cat << EOF
3279
3280  $X2N  -no-xinput2......... Do not compile XInput2 support.
3281  $X2Y  -xinput2............ Compile XInput2 support.
3282
3283 EOF
3284
3285 fi
3286
3287 if [ "$PLATFORM_X11" = "yes" ]; then
3288     if [ "$CFG_SM" = "no" ]; then
3289         SMY=" "
3290         SMN="*"
3291     else
3292         SMY="*"
3293         SMN=" "
3294     fi
3295     if [ "$CFG_XSHAPE" = "no" ]; then
3296         SHY=" "
3297         SHN="*"
3298     else
3299         SHY="*"
3300         SHN=" "
3301     fi
3302     if [ "$CFG_XVIDEO" = "no" ]; then
3303         XVY=" "
3304         XVN="*"
3305     else
3306         XVY="*"
3307         XVN=" "
3308     fi
3309     if [ "$CFG_XINERAMA" = "no" ]; then
3310         XAY=" "
3311         XAN="*"
3312     else
3313         XAY="*"
3314         XAN=" "
3315     fi
3316     if [ "$CFG_FONTCONFIG" = "no" ]; then
3317         FCGY=" "
3318         FCGN="*"
3319     else
3320         FCGY="*"
3321         FCGN=" "
3322     fi
3323     if [ "$CFG_XCURSOR" = "no" ]; then
3324         XCY=" "
3325         XCN="*"
3326     else
3327         XCY="*"
3328         XCN=" "
3329     fi
3330     if [ "$CFG_XFIXES" = "no" ]; then
3331         XFY=" "
3332         XFN="*"
3333     else
3334         XFY="*"
3335         XFN=" "
3336     fi
3337     if [ "$CFG_XRANDR" = "no" ]; then
3338         XZY=" "
3339         XZN="*"
3340     else
3341         XZY="*"
3342         XZN=" "
3343     fi
3344     if [ "$CFG_XRENDER" = "no" ]; then
3345         XRY=" "
3346         XRN="*"
3347     else
3348         XRY="*"
3349         XRN=" "
3350     fi
3351     if [ "$CFG_MITSHM" = "no" ]; then
3352         XMY=" "
3353         XMN="*"
3354     else
3355         XMY="*"
3356         XMN=" "
3357     fi
3358     if [ "$CFG_XINPUT" = "no" ]; then
3359         XIY=" "
3360         XIN="*"
3361     else
3362         XIY="*"
3363         XIN=" "
3364     fi
3365     if [ "$CFG_XKB" = "no" ]; then
3366         XKY=" "
3367         XKN="*"
3368     else
3369         XKY="*"
3370         XKN=" "
3371     fi
3372     if [ "$CFG_IM" = "no" ]; then
3373         IMY=" "
3374         IMN="*"
3375     else
3376         IMY="*"
3377         IMN=" "
3378     fi
3379     cat << EOF
3380
3381 Qt/X11 only:
3382
3383     -no-gtkstyle ....... Do not build the GTK theme integration.
3384  +  -gtkstyle .......... Build the GTK theme integration.
3385
3386  *  -no-nas-sound ...... Do not compile in NAS sound support.
3387     -system-nas-sound .. Use NAS libaudio from the operating system.
3388                          See http://radscan.com/nas.html
3389
3390     -no-opengl ......... Do not support OpenGL.
3391  +  -opengl <api> ...... Enable OpenGL support.
3392                          With no parameter, this will auto-detect the "best"
3393                          OpenGL API to use. If desktop OpenGL is available, it
3394                          will be used. Use desktop or es2 for <api>
3395                          to force the use of the Desktop OpenGL or
3396                          OpenGL ES 2 APIs instead.
3397
3398      -no-openvg ........ Do not support OpenVG.
3399  +   -openvg ........... Enable OpenVG support.
3400                          Requires EGL support, typically supplied by an OpenGL
3401                          or other graphics implementation.
3402
3403  $SMN  -no-sm ............. Do not support X Session Management.
3404  $SMY  -sm ................ Support X Session Management, links in -lSM -lICE.
3405
3406  $SHN  -no-xshape ......... Do not compile XShape support.
3407  $SHY  -xshape ............ Compile XShape support.
3408                          Requires X11/extensions/shape.h.
3409
3410  $XVN  -no-xvideo ......... Do not compile XVideo support.
3411  $XVY  -xvideo ............ Compile XVideo support.
3412                          Requires X11/extensions/Xv.h & Xvlib.h.
3413
3414  $SHN  -no-xsync .......... Do not compile XSync support.
3415  $SHY  -xsync ............. Compile XSync support.
3416                          Requires X11/extensions/sync.h.
3417
3418  $XAN  -no-xinerama ....... Do not compile Xinerama (multihead) support.
3419  $XAY  -xinerama .......... Compile Xinerama support.
3420                          Requires X11/extensions/Xinerama.h and libXinerama.
3421                          By default, Xinerama support will be compiled if
3422                          available and the shared libraries are dynamically
3423                          loaded at runtime.
3424
3425  $XCN  -no-xcursor ........ Do not compile Xcursor support.
3426  $XCY  -xcursor ........... Compile Xcursor support.
3427                          Requires X11/Xcursor/Xcursor.h and libXcursor.
3428                          By default, Xcursor support will be compiled if
3429                          available and the shared libraries are dynamically
3430                          loaded at runtime.
3431
3432  $XFN  -no-xfixes ......... Do not compile Xfixes support.
3433  $XFY  -xfixes ............ Compile Xfixes support.
3434                          Requires X11/extensions/Xfixes.h and libXfixes.
3435                          By default, Xfixes support will be compiled if
3436                          available and the shared libraries are dynamically
3437                          loaded at runtime.
3438
3439  $XZN  -no-xrandr ......... Do not compile Xrandr (resize and rotate) support.
3440  $XZY  -xrandr ............ Compile Xrandr support.
3441                          Requires X11/extensions/Xrandr.h and libXrandr.
3442
3443  $XRN  -no-xrender ........ Do not compile Xrender support.
3444  $XRY  -xrender ........... Compile Xrender support.
3445                          Requires X11/extensions/Xrender.h and libXrender.
3446
3447  $XMN  -no-mitshm ......... Do not compile MIT-SHM support.
3448  $XMY  -mitshm ............ Compile MIT-SHM support.
3449                          Requires sys/ipc.h, sys/shm.h and X11/extensions/XShm.h
3450
3451  $FCGN  -no-fontconfig ..... Do not compile FontConfig (anti-aliased font) support.
3452  $FCGY  -fontconfig ........ Compile FontConfig support.
3453                          Requires fontconfig/fontconfig.h, libfontconfig,
3454                          freetype.h and libfreetype.
3455
3456  $XIN  -no-xinput ......... Do not compile Xinput support.
3457  $XIY  -xinput ............ Compile Xinput support. This also enabled tablet support
3458                          which requires IRIX with wacom.h and libXi or
3459                          XFree86 with X11/extensions/XInput.h and libXi.
3460
3461  $XKN  -no-xkb ............ Do not compile XKB (X KeyBoard extension) support.
3462  $XKY  -xkb ............... Compile XKB support.
3463
3464 EOF
3465 fi
3466
3467 if [ "$BUILD_ON_MAC" = "yes" ]; then
3468     cat << EOF
3469
3470 Qt/Mac only:
3471
3472     -Fstring ........... Add an explicit framework path.
3473     -fw string ......... Add an explicit framework.
3474
3475  *  -framework ......... Build Qt as a series of frameworks and
3476                          link tools against those frameworks.
3477     -no-framework ...... Do not build Qt as a series of frameworks.
3478
3479  *  -dwarf2 ............ Enable dwarf2 debugging symbols.
3480     -no-dwarf2 ......... Disable dwarf2 debugging symbols.
3481
3482     -sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. This option requires gcc 4.
3483                          To use a different SDK with gcc 3.3, set the SDKROOT environment variable.
3484
3485     -harfbuzz .......... Use HarfBuzz to do text layout instead of Core Text when possible.
3486  *  -no-harfbuzz ....... Disable HarfBuzz on Mac. It can still be enabled by setting
3487                          QT_ENABLE_HARFBUZZ environment variable.
3488
3489 EOF
3490 fi
3491
3492 if [ "$PLATFORM_QPA" = "yes" ]; then
3493     cat << EOF
3494 Qt for QPA only:
3495 EOF
3496 fi
3497
3498 if [ "$PLATFORM_QPA" = "yes" ]; then
3499     cat << EOF
3500
3501     -xplatform target ... The target platform when cross-compiling.
3502
3503     -no-feature-<feature> Do not compile in <feature>.
3504     -feature-<feature> .. Compile in <feature>. The available features
3505                           are described in src/corelib/global/qfeatures.txt
3506
3507     -no-freetype ........ Do not compile in Freetype2 support.
3508     -qt-freetype ........ Use the libfreetype bundled with Qt.
3509  *  -system-freetype .... Use libfreetype from the operating system.
3510                           See http://www.freetype.org/
3511
3512     -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the
3513                           default ($CFG_QCONFIG).
3514
3515     -no-opengl .......... Do not support OpenGL.
3516     -opengl <api> ....... Enable OpenGL ES support
3517                           With no parameter, this will attempt to auto-detect
3518                           OpenGL ES 2, or regular desktop OpenGL.
3519                           Use es2 for <api> to override auto-detection.
3520 EOF
3521 fi
3522
3523 if [ "$PLATFORM_QPA" = "yes" -o "$PLATFORM_X11" = "yes" ]; then
3524     if [ "$CFG_GLIB" = "no" ]; then
3525         GBY=" "
3526         GBN="+"
3527     else
3528         GBY="+"
3529         GBN=" "
3530     fi
3531     cat << EOF
3532  $GBN  -no-glib ........... Do not compile Glib support.
3533  $GBY  -glib .............. Compile Glib support.
3534
3535 EOF
3536 fi
3537
3538    [ "x$ERROR" = "xyes" ] && exit 1
3539    exit 0
3540 fi # Help
3541
3542
3543 # -----------------------------------------------------------------------------
3544 # LICENSING, INTERACTIVE PART
3545 # -----------------------------------------------------------------------------
3546
3547 if [ "$PLATFORM_QPA" = "yes" ]; then
3548     Platform="Qt Lighthouse"
3549 elif [ "$XPLATFORM_MINGW" = "yes" ]; then
3550     Platform="Qt for Windows"
3551 elif [ -n "`getXQMakeConf grep QMAKE_LIBS_X11`" ]; then
3552     PLATFORM_X11=yes
3553     Platform="Qt for Linux/X11"
3554 fi
3555
3556 echo
3557 echo "This is the $Platform ${EditionString} Edition."
3558 echo
3559
3560 if [ "$Edition" = "OpenSource" ]; then
3561     while true; do
3562         echo "You are licensed to use this software under the terms of"
3563         echo "the Lesser GNU General Public License (LGPL) versions 2.1."
3564         if [ -f "$relpath/LICENSE.GPL3" ]; then
3565             echo "You are also licensed to use this software under the terms of"
3566             echo "the GNU General Public License (GPL) versions 3."
3567             affix="either"
3568         else
3569             affix="the"
3570         fi
3571         echo
3572         if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
3573             echo "You have already accepted the terms of the $LicenseType license."
3574             acceptance=yes
3575         else
3576             if [ -f "$relpath/LICENSE.GPL3" ]; then
3577                 echo "Type '3' to view the GNU General Public License version 3."
3578             fi
3579             echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
3580             echo "Type 'yes' to accept this license offer."
3581             echo "Type 'no' to decline this license offer."
3582             echo
3583             echo $ECHO_N "Do you accept the terms of $affix license? $ECHO_C"
3584             read acceptance
3585         fi
3586         echo
3587         if [ "$acceptance" = "yes" ] || [ "$acceptance" = "y" ]; then
3588             break
3589         elif [ "$acceptance" = "no" ]; then
3590             echo "You are not licensed to use this software."
3591             echo
3592             exit 1
3593         elif [ "$acceptance" = "3" ]; then
3594             more "$relpath/LICENSE.GPL3"
3595         elif [ "$acceptance" = "L" ]; then
3596             more "$relpath/LICENSE.LGPL"
3597         fi
3598     done
3599 elif [ "$Edition" = "Preview" ]; then
3600     TheLicense=`head -n 1 "$relpath/LICENSE.PREVIEW.COMMERCIAL"`
3601     while true; do
3602
3603         if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
3604             echo "You have already accepted the terms of the $LicenseType license."
3605             acceptance=yes
3606         else
3607             echo "You are licensed to use this software under the terms of"
3608             echo "the $TheLicense"
3609             echo
3610             echo "Type '?' to read the Preview License."
3611             echo "Type 'yes' to accept this license offer."
3612             echo "Type 'no' to decline this license offer."
3613             echo
3614             echo $ECHO_N "Do you accept the terms of the license? $ECHO_C"
3615             read acceptance
3616         fi
3617         echo
3618         if [ "$acceptance" = "yes" ]; then
3619             break
3620         elif [ "$acceptance" = "no" ] ;then
3621             echo "You are not licensed to use this software."
3622             echo
3623             exit 0
3624         elif [ "$acceptance" = "?" ]; then
3625             more "$relpath/LICENSE.PREVIEW.COMMERCIAL"
3626         fi
3627     done
3628 elif [ "$Edition" != "OpenSource" ]; then
3629     if [ -n "$ExpiryDate" ]; then
3630         ExpiryDate=`echo $ExpiryDate | sed -e "s,-,,g" | tr -d "\n\r"`
3631         [ -z "$ExpiryDate" ] && ExpiryDate="0"
3632         Today=`date +%Y%m%d`
3633         if [ "$Today" -gt "$ExpiryDate" ]; then
3634             case "$LicenseType" in
3635             Commercial|Academic|Educational)
3636                 if [ "$QT_PACKAGEDATE" -gt "$ExpiryDate" ]; then
3637                     echo
3638                     echo "NOTICE  NOTICE  NOTICE  NOTICE"
3639                     echo
3640                     echo "  Your support and upgrade period has expired."
3641                     echo
3642                     echo "  You are no longer licensed to use this version of Qt."
3643                     echo "  Please contact qt-info@nokia.com to renew your support"
3644                     echo "  and upgrades for this license."
3645                     echo
3646                     echo "NOTICE  NOTICE  NOTICE  NOTICE"
3647                     echo
3648                     exit 1
3649                 else
3650                     echo
3651                     echo "WARNING  WARNING  WARNING  WARNING"
3652                     echo
3653                     echo "  Your support and upgrade period has expired."
3654                     echo
3655                     echo "  You may continue to use your last licensed release"
3656                     echo "  of Qt under the terms of your existing license"
3657                     echo "  agreement. But you are not entitled to technical"
3658                     echo "  support, nor are you entitled to use any more recent"
3659                     echo "  Qt releases."
3660                     echo
3661                     echo "  Please contact qt-info@nokia.com to renew your"
3662                     echo "  support and upgrades for this license."
3663                     echo
3664                     echo "WARNING  WARNING  WARNING  WARNING"
3665                     echo
3666                     sleep 3
3667                 fi
3668                 ;;
3669             Evaluation|*)
3670                 echo
3671                 echo "NOTICE  NOTICE  NOTICE  NOTICE"
3672                 echo
3673                 echo "  Your Evaluation license has expired."
3674                 echo
3675                 echo "  You are no longer licensed to use this software. Please"
3676                 echo "  contact qt-info@nokia.com to purchase license, or install"
3677                 echo "  the Qt Open Source Edition if you intend to develop free"
3678                 echo "  software."
3679                 echo
3680                 echo "NOTICE  NOTICE  NOTICE  NOTICE"
3681                 echo
3682                 exit 1
3683                 ;;
3684             esac
3685         fi
3686     fi
3687     TheLicense=`head -n 1 "$outpath/LICENSE"`
3688     while true; do
3689         if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
3690             echo "You have already accepted the terms of the $TheLicense."
3691             acceptance=yes
3692         else
3693             echo "You are licensed to use this software under the terms of"
3694             echo "the $TheLicense."
3695             echo
3696             echo "Type '?' to view the $TheLicense."
3697             echo "Type 'yes' to accept this license offer."
3698             echo "Type 'no' to decline this license offer."
3699             echo
3700             echo $ECHO_N "Do you accept the terms of the $TheLicense? $ECHO_C"
3701             read acceptance
3702         fi
3703         echo
3704         if [ "$acceptance" = "yes" ]; then
3705             break
3706         elif [ "$acceptance" = "no" ]; then
3707             echo "You are not licensed to use this software."
3708             echo
3709             exit 1
3710         else [ "$acceptance" = "?" ]
3711             more "$outpath/LICENSE"
3712         fi
3713     done
3714 fi
3715
3716 # this should be moved somewhere else
3717 case "$PLATFORM" in
3718 aix-*)
3719     AIX_VERSION=`uname -v`
3720     if [ "$AIX_VERSION" -lt "5" ]; then
3721         QMakeVar add QMAKE_LIBS_X11 -lbind
3722     fi
3723     ;;
3724 *)
3725     ;;
3726 esac
3727
3728 #-------------------------------------------------------------------------------
3729 # generate qconfig.cpp
3730 #-------------------------------------------------------------------------------
3731 [ -d "$outpath/src/corelib/global" ] || mkdir -p "$outpath/src/corelib/global"
3732
3733 cat > "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
3734 /* License Info */
3735 static const char qt_configure_licensee_str          [256 + 12] = "qt_lcnsuser=$Licensee";
3736 static const char qt_configure_licensed_products_str [256 + 12] = "qt_lcnsprod=$Edition";
3737
3738 /* Installation date */
3739 static const char qt_configure_installation          [12+11]    = "qt_instdate=`date +%Y-%m-%d`";
3740
3741 /* Installation Info */
3742 static const char qt_configure_prefix_path_strs[][256 + 12] = {
3743     "qt_prfxpath=$QT_INSTALL_PREFIX",
3744     "qt_docspath=$QT_INSTALL_DOCS",
3745     "qt_hdrspath=$QT_INSTALL_HEADERS",
3746     "qt_libspath=$QT_INSTALL_LIBS",
3747     "qt_binspath=$QT_INSTALL_BINS",
3748     "qt_plugpath=$QT_INSTALL_PLUGINS",
3749     "qt_impspath=$QT_INSTALL_IMPORTS",
3750     "qt_datapath=$QT_INSTALL_DATA",
3751     "qt_trnspath=$QT_INSTALL_TRANSLATIONS",
3752     "qt_xmplpath=$QT_INSTALL_EXAMPLES",
3753     "qt_tstspath=$QT_INSTALL_TESTS",
3754 #ifdef QT_BUILD_QMAKE
3755     "qt_ssrtpath=$CFG_SYSROOT",
3756     "qt_hpfxpath=$QT_HOST_PREFIX",
3757     "qt_hbinpath=$QT_HOST_BINS",
3758     "qt_hdatpath=$QT_HOST_DATA",
3759 #endif
3760 };
3761 static const char qt_configure_settings_path_str[256 + 12] = "qt_stngpath=$QT_INSTALL_SETTINGS";
3762 EOF
3763
3764 cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
3765
3766 /* strlen( "qt_lcnsxxxx" ) == 12 */
3767 #define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;
3768 #define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;
3769
3770 #define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;
3771 EOF
3772
3773 # avoid unecessary rebuilds by copying only if qconfig.cpp has changed
3774 if cmp -s "$outpath/src/corelib/global/qconfig.cpp" "$outpath/src/corelib/global/qconfig.cpp.new"; then
3775     rm -f "$outpath/src/corelib/global/qconfig.cpp.new"
3776 else
3777     [ -f "$outpath/src/corelib/global/qconfig.cpp" ] && chmod +w "$outpath/src/corelib/global/qconfig.cpp"
3778     mv "$outpath/src/corelib/global/qconfig.cpp.new" "$outpath/src/corelib/global/qconfig.cpp"
3779     chmod -w "$outpath/src/corelib/global/qconfig.cpp"
3780 fi
3781
3782 # -----------------------------------------------------------------------------
3783 if [ "$LicenseType" = "Evaluation" ]; then
3784     EVALKEY=qt_qevalkey=$LicenseKeyExt
3785 elif echo "$D_FLAGS" | grep QT_EVAL >/dev/null 2>&1; then
3786     EVALKEY=qt_qevalkey=
3787 fi
3788
3789 if [ -n "$EVALKEY" ]; then
3790     rm -f "$outpath/src/corelib/global/qconfig_eval.cpp"
3791     cat > "$outpath/src/corelib/global/qconfig_eval.cpp" <<EOF
3792 /* Evaluation license key */
3793 static const volatile char qt_eval_key_data                   [512 + 12] = "$EVALKEY";
3794 EOF
3795     chmod -w "$outpath/src/corelib/global/qconfig_eval.cpp"
3796 fi
3797
3798
3799 # -----------------------------------------------------------------------------
3800 # build qmake
3801 # -----------------------------------------------------------------------------
3802
3803 # symlink includes
3804 if [ -n "$PERL" ] && [ -x "$relpath/bin/syncqt" ]; then
3805     SYNCQT_OPTS=
3806     [ "$CFG_DEV" = "yes" ] && SYNCQT_OPTS="$SYNCQT_OPTS -check-includes"
3807     if [ "$OPT_SHADOW" = "yes" ]; then
3808         "$outpath/bin/syncqt" $SYNCQT_OPTS "$relpath" || exit 1
3809     elif [ "$CFG_DEV" = "yes" ] || [ ! -d $relpath/include ] || [ -d $relpath/.git ]; then
3810         QTDIR="$relpath" perl "$outpath/bin/syncqt" $SYNCQT_OPTS || exit 1
3811     fi
3812 fi
3813
3814 # $1: input variable name (awk regexp)
3815 # $2: optional output variable name
3816 # $3: optional value transformation (sed command)
3817 # relies on $QMAKESPEC, $COMPILER_CONF and $mkfile being set correctly, as the latter
3818 # is where the resulting variable is written to
3819 setBootstrapVariable()
3820 {
3821     getQMakeConf "$1" | echo ${2-$1} = `if [ -n "$3" ]; then sed "$3"; else cat; fi` >> "$mkfile"
3822 }
3823
3824 # build qmake
3825 if true; then ###[ '!' -f "$outpath/bin/qmake" ];
3826     echo "Creating qmake. Please wait..."
3827
3828     OLD_QCONFIG_H=
3829     QCONFIG_H="$outpath/src/corelib/global/qconfig.h"
3830     QMAKE_QCONFIG_H="${QCONFIG_H}.qmake"
3831     if [ -f "$QCONFIG_H" ]; then
3832          OLD_QCONFIG_H=$QCONFIG_H
3833          mv -f "$OLD_QCONFIG_H" "${OLD_QCONFIG_H}.old"
3834     fi
3835
3836     # create temporary qconfig.h for compiling qmake, if it doesn't exist
3837     # when building qmake, we use #defines for the install paths,
3838     # however they are real functions in the library
3839     if [ '!' -f "$QMAKE_QCONFIG_H" ]; then
3840         mkdir -p "$outpath/src/corelib/global"
3841         [ -f "$QCONFIG_H" ] && chmod +w "$QCONFIG_H"
3842         echo "/* All features enabled while building qmake */" >"$QMAKE_QCONFIG_H"
3843     fi
3844
3845     mv -f "$QMAKE_QCONFIG_H" "$QCONFIG_H"
3846
3847     #mkspecs/default is used as a (gasp!) default mkspec so QMAKESPEC needn't be set once configured
3848     rm -rf mkspecs/default
3849     ln -s `echo $XQMAKESPEC | sed "s,^${relpath}/mkspecs/,,"` mkspecs/default
3850     mkdir -p "$outpath/qmake" || exit
3851     # fix makefiles
3852     for mkfile in GNUmakefile Makefile; do
3853         EXTRA_LFLAGS=
3854         EXTRA_CFLAGS=
3855         in_mkfile="${mkfile}.in"
3856         if [ "$mkfile" = "Makefile" ]; then
3857 #           if which qmake >/dev/null 2>&1 && [ -f qmake/qmake.pro ]; then
3858 #               (cd qmake && qmake) >/dev/null 2>&1 && continue
3859 #           fi
3860             in_mkfile="${mkfile}.unix"
3861         fi
3862         in_mkfile="$relpath/qmake/$in_mkfile"
3863         mkfile="$outpath/qmake/$mkfile"
3864         if [ -f "$mkfile" ]; then
3865             [ "$CFG_DEV" = "yes" ] && "$WHICH" chflags >/dev/null 2>&1 && chflags nouchg "$mkfile"
3866             rm -f "$mkfile"
3867         fi
3868         [ -f "$in_mkfile" ] || continue
3869
3870         echo "########################################################################" > "$mkfile"
3871         echo "## This file was autogenerated by configure, all changes will be lost ##" >> "$mkfile"
3872         echo "########################################################################" >> "$mkfile"
3873         EXTRA_OBJS=
3874         EXTRA_SRCS=
3875         EXTRA_CFLAGS="\$(QMAKE_CFLAGS)"
3876         EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS)"
3877         EXTRA_LFLAGS="\$(QMAKE_LFLAGS)"
3878
3879         if [ "$PLATFORM" = "irix-cc" ] || [ "$PLATFORM" = "irix-cc-64" ]; then
3880             EXTRA_LFLAGS="$EXTRA_LFLAGS -lm"
3881         fi
3882
3883         [ "$CFG_SILENT" = "yes" ] && CC_TRANSFORM='s,^,\@,' || CC_TRANSFORM=
3884         setBootstrapVariable QMAKE_CC CC "$CC_TRANSFORM"
3885         setBootstrapVariable QMAKE_CXX CXX "$CC_TRANSFORM"
3886         setBootstrapVariable QMAKE_CFLAGS
3887         setBootstrapVariable QMAKE_CXXFLAGS
3888         setBootstrapVariable QMAKE_LFLAGS
3889
3890         if [ $QT_EDITION = "QT_EDITION_OPENSOURCE" ]; then
3891             EXTRA_CFLAGS="$EXTRA_CFLAGS -DQMAKE_OPENSOURCE_EDITION"
3892             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -DQMAKE_OPENSOURCE_EDITION"
3893         fi
3894         if [ "$CFG_RELEASE_QMAKE" = "yes" ]; then
3895             setBootstrapVariable QMAKE_CFLAGS_RELEASE
3896             setBootstrapVariable QMAKE_CXXFLAGS_RELEASE
3897             EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_RELEASE)"
3898             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_RELEASE)"
3899         elif [ "$CFG_DEBUG" = "yes" ]; then
3900             setBootstrapVariable QMAKE_CFLAGS_DEBUG
3901             setBootstrapVariable QMAKE_CXXFLAGS_DEBUG
3902             EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_DEBUG)"
3903             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_DEBUG)"
3904         fi
3905
3906         if [ -n "$RPATH_FLAGS" ] && [ -n "`getQMakeConf 'QMAKE_(LFLAGS_)?RPATH'`" ]; then
3907             setBootstrapVariable "QMAKE_(LFLAGS_)?RPATH" QMAKE_LFLAGS_RPATH
3908             for rpath in $RPATH_FLAGS; do
3909                 EXTRA_LFLAGS="\$(QMAKE_LFLAGS_RPATH)\"$rpath\" $EXTRA_LFLAGS"
3910             done
3911         fi
3912         if [ "$BUILD_ON_MAC" = "yes" ]; then
3913             echo "export MACOSX_DEPLOYMENT_TARGET = 10.6" >> "$mkfile"
3914             echo "CARBON_LFLAGS =-framework ApplicationServices" >>"$mkfile"
3915             echo "CARBON_CFLAGS =-fconstant-cfstrings" >>"$mkfile"
3916             EXTRA_LFLAGS="$EXTRA_LFLAGS \$(CARBON_LFLAGS)"
3917             EXTRA_CFLAGS="$EXTRA_CFLAGS \$(CARBON_CFLAGS)"
3918             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(CARBON_CFLAGS)"
3919             EXTRA_OBJS="qsettings_mac.o qcore_mac.o"
3920             EXTRA_SRCS="\"$relpath/src/corelib/io/qsettings_mac.cpp\" \"$relpath/src/corelib/kernel/qcore_mac.cpp\""
3921             if [ '!' -z "$CFG_SDK" ]; then
3922                 echo "SDK_LFLAGS =-Wl,-syslibroot,$CFG_SDK" >>"$mkfile"
3923                 echo "SDK_CFLAGS =-isysroot $CFG_SDK" >>"$mkfile"
3924                 EXTRA_CFLAGS="$EXTRA_CFLAGS \$(SDK_CFLAGS)"
3925                 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(SDK_CFLAGS)"
3926                 EXTRA_LFLAGS="$EXTRA_LFLAGS \$(SDK_LFLAGS)"
3927             fi
3928         fi
3929         if [ '!' -z "$D_FLAGS" ]; then
3930             for DEF in $D_FLAGS; do
3931                 EXTRA_CFLAGS="$EXTRA_CFLAGS \"-D${DEF}\""
3932             done
3933         fi
3934         QMAKE_BIN_DIR="$QT_INSTALL_BINS"
3935         [ -z "$QMAKE_BIN_DIR" ] && QMAKE_BIN_DIR="${QT_INSTALL_PREFIX}/bin"
3936         QMAKE_DATA_DIR="$QT_INSTALL_DATA"
3937         [ -z "$QMAKE_DATA_DIR" ] && QMAKE_DATA_DIR="${QT_INSTALL_PREFIX}"
3938         echo >>"$mkfile"
3939         adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'`
3940         adjoutpath=`echo "$outpath" | sed 's/ /\\\\\\\\ /g'`
3941         adjqmakespec=`echo "$QMAKESPEC" | sed 's/ /\\\\\\\\ /g'`
3942         sed -e "s,@SOURCE_PATH@,$adjrelpath,g" -e "s,@BUILD_PATH@,$adjoutpath,g" \
3943             -e "s,@QMAKE_CFLAGS@,$EXTRA_CFLAGS,g" -e "s,@QMAKE_LFLAGS@,$EXTRA_LFLAGS,g" \
3944             -e "s,@QMAKE_CXXFLAGS@,$EXTRA_CXXFLAGS,g" \
3945             -e "s,@QT_INSTALL_BINS@,\$(INSTALL_ROOT)$QMAKE_BIN_DIR,g" \
3946             -e "s,@QT_INSTALL_DATA@,\$(INSTALL_ROOT)$QMAKE_DATA_DIR,g" \
3947             -e "s,@QMAKE_QTOBJS@,$EXTRA_OBJS,g" -e "s,@QMAKE_QTSRCS@,$EXTRA_SRCS,g" \
3948             -e "s,@QMAKESPEC@,$adjqmakespec,g" -e "s,@QT_VERSION@,$QT_VERSION,g" "$in_mkfile" >>"$mkfile"
3949
3950         if "$WHICH" makedepend >/dev/null 2>&1 && grep 'depend:' "$mkfile" >/dev/null 2>&1; then
3951             (cd "$outpath/qmake" && "$MAKE" -f "$mkfile" depend) >/dev/null 2>&1
3952             sed "s,^.*/\([^/]*.o\):,\1:,g" "$mkfile" >"$mkfile.tmp"
3953             sed "s,$outpath,$adjoutpath,g" "$mkfile.tmp" >"$mkfile"
3954             rm "$mkfile.tmp"
3955         fi
3956     done
3957
3958     QMAKE_BUILD_ERROR=no
3959     (cd "$outpath/qmake"; "$MAKE") || QMAKE_BUILD_ERROR=yes
3960     [ '!' -z "$QCONFIG_H" ] && mv -f "$QCONFIG_H" "$QMAKE_QCONFIG_H" #move qmake's qconfig.h to qconfig.h.qmake
3961     [ '!' -z "$OLD_QCONFIG_H" ] && mv -f "${OLD_QCONFIG_H}.old" "$OLD_QCONFIG_H" #put back qconfig.h
3962     [ "$QMAKE_BUILD_ERROR" = "yes" ] && exit 2
3963 fi # Build qmake
3964
3965 #-------------------------------------------------------------------------------
3966 # tests that need qmake
3967 #-------------------------------------------------------------------------------
3968
3969 #-------------------------------------------------------------------------------
3970 # determine the target and host architectures
3971 #-------------------------------------------------------------------------------
3972
3973 # Use config.tests/arch/arch.pro to has the compiler tell us what the target architecture is
3974 CFG_ARCH=`OUTDIR="$outpath" "$outpath/bin/qmake" -spec "$XQMAKESPEC" -o /dev/null "$relpath/config.tests/arch/arch.pro" 2>&1 | sed -n -e 's,^Project MESSAGE:.*Architecture: \([a-zA-Z0-9_]*\).*,\1,p'`
3975
3976 [ -z "$CFG_ARCH" ] && CFG_ARCH="unknown"
3977 if [ "$QMAKESPEC" != "$XQMAKESPEC" ]; then
3978     # Do the same test again, using the host compiler
3979     CFG_HOST_ARCH=`OUTDIR="$outpath" "$outpath/bin/qmake" -spec "$QMAKESPEC" -o /dev/null "$relpath/config.tests/arch/arch.pro" 2>&1 | sed -n -e 's,^Project MESSAGE:.*Architecture: \([a-zA-Z0-9_]*\).*,\1,p'`
3980     [ -z "$CFG_HOST_ARCH" ] && CFG_HOST_ARCH="unknown"
3981 else
3982     # not cross compiling, host == target
3983     CFG_HOST_ARCH="$CFG_ARCH"
3984 fi
3985
3986 if [ "$OPT_VERBOSE" = "yes" ]; then
3987     echo "System architecture: '$CFG_ARCH'"
3988     if [ "$PLATFORM_QPA" = "yes" ]; then
3989         echo "Host architecture: '$CFG_HOST_ARCH'"
3990     fi
3991 fi
3992
3993 #-------------------------------------------------------------------------------
3994 # functionality tests
3995 #-------------------------------------------------------------------------------
3996
3997 # detect availability of float math.h functions
3998 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/floatmath "floatmath" $L_FLAGS $I_FLAGS $l_FLAGS; then
3999     CFG_USE_FLOATMATH=yes
4000 else
4001     CFG_USE_FLOATMATH=no
4002 fi
4003
4004 # detect mmx support
4005 if [ "${CFG_MMX}" = "auto" ]; then
4006     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mmx "mmx" $L_FLAGS $I_FLAGS $l_FLAGS "-mmmx"; then
4007         CFG_MMX=yes
4008     else
4009         CFG_MMX=no
4010     fi
4011 fi
4012
4013 # detect 3dnow support
4014 if [ "${CFG_3DNOW}" = "auto" ]; then
4015     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/3dnow "3dnow" $L_FLAGS $I_FLAGS $l_FLAGS "-m3dnow"; then
4016         CFG_3DNOW=yes
4017     else
4018         CFG_3DNOW=no
4019     fi
4020 fi
4021
4022 # detect sse support
4023 if [ "${CFG_SSE}" = "auto" ]; then
4024     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse "sse" $L_FLAGS $I_FLAGS $l_FLAGS "-msse"; then
4025         CFG_SSE=yes
4026     else
4027         CFG_SSE=no
4028     fi
4029 fi
4030
4031 # detect sse2 support
4032 if [ "${CFG_SSE2}" = "auto" ]; then
4033     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse2 "sse2" $L_FLAGS $I_FLAGS $l_FLAGS "-msse2"; then
4034        CFG_SSE2=yes
4035     else
4036        CFG_SSE2=no
4037     fi
4038 fi
4039
4040 # detect sse3 support
4041 if [ "${CFG_SSE3}" = "auto" ]; then
4042     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse3 "sse3" $L_FLAGS $I_FLAGS $l_FLAGS "-msse3"; then
4043        CFG_SSE3=yes
4044     else
4045        CFG_SSE3=no
4046     fi
4047 fi
4048
4049 # detect ssse3 support
4050 if [ "${CFG_SSSE3}" = "auto" ]; then
4051     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ssse3 "ssse3" $L_FLAGS $I_FLAGS $l_FLAGS "-mssse3"; then
4052        CFG_SSSE3=yes
4053     else
4054        CFG_SSSE3=no
4055     fi
4056 fi
4057
4058 # detect sse4.1 support
4059 if [ "${CFG_SSE4_1}" = "auto" ]; then
4060     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
4061        CFG_SSE4_1=yes
4062     else
4063        CFG_SSE4_1=no
4064     fi
4065 fi
4066
4067 # detect sse4.2 support
4068 if [ "${CFG_SSE4_2}" = "auto" ]; then
4069     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
4070        CFG_SSE4_2=yes
4071     else
4072        CFG_SSE4_2=no
4073     fi
4074 fi
4075
4076 # detect avx support
4077 if [ "${CFG_AVX}" = "auto" ]; then
4078     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/avx "avx" $L_FLAGS $I_FLAGS $l_FLAGS "-mavx"; then
4079        CFG_AVX=yes
4080     else
4081        CFG_AVX=no
4082     fi
4083 fi
4084
4085 # check iWMMXt support
4086 if [ "$CFG_IWMMXT" = "yes" ]; then
4087     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iwmmxt "iwmmxt" $L_FLAGS $I_FLAGS $l_FLAGS "-mcpu=iwmmxt"
4088     if [ $? != "0" ]; then
4089         echo "The iWMMXt functionality test failed!"
4090         echo " Please make sure your compiler supports iWMMXt intrinsics!"
4091         exit 1
4092     fi
4093 fi
4094
4095 # detect neon support
4096 if [ "$CFG_ARCH" = "arm" ] && [ "${CFG_NEON}" = "auto" ]; then
4097     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
4098         CFG_NEON=yes
4099     else
4100         CFG_NEON=no
4101     fi
4102 elif [ "$CFG_ARCH" != "arm" ]; then
4103     CFG_NEON=no
4104 fi
4105
4106 # detect mips_dsp support
4107 if [ "${CFG_ARCH}" = "mips" ] && [ "${CFG_MIPS_DSP}" = "yes" ]; then
4108   CFG_MIPS_DSP=yes
4109     else
4110   CFG_MIPS_DSP=no
4111 fi
4112
4113 # detect mips_dspr2 support
4114 if [ "${CFG_ARCH}" = "mips" ] && [ "${CFG_MIPS_DSPR2}" = "yes" ]; then
4115   CFG_MIPS_DSPR2=yes
4116     else
4117   CFG_MIPS_DSPR2=no
4118 fi
4119
4120 [ "$XPLATFORM_MINGW" = "yes" ] && QMakeVar add styles "windowsxp windowsvista"
4121
4122 # detect zlib
4123 if [ "$CFG_ZLIB" = "no" ]; then
4124     # Note: Qt no longer support builds without zlib
4125     # So we force a "no" to be "auto" here.
4126     # If you REALLY really need no zlib support, you can still disable
4127     # it by doing the following:
4128     #   add "no-zlib" to mkspecs/qconfig.pri
4129     #   #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h)
4130     #
4131     # There's no guarantee that Qt will build under those conditions
4132
4133     CFG_ZLIB=auto
4134     ZLIB_FORCED=yes
4135 fi
4136 if [ "$CFG_ZLIB" = "auto" ]; then
4137     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
4138        CFG_ZLIB=system
4139     else
4140        CFG_ZLIB=yes
4141     fi
4142 fi
4143
4144 if [ "$CFG_LARGEFILE" = "auto" ]; then
4145     #Large files should be enabled for all Linux systems
4146     CFG_LARGEFILE=yes
4147 fi
4148
4149 if [ "$CFG_GUI" = "no" ]; then
4150     QPA_PLATFORM_GUARD=no
4151 fi
4152
4153 # detect how jpeg should be built
4154 if [ "$CFG_JPEG" = "auto" ]; then
4155     if [ "$CFG_SHARED" = "yes" ]; then
4156         CFG_JPEG=plugin
4157     else
4158         CFG_JPEG=yes
4159     fi
4160 fi
4161 # detect jpeg
4162 if [ "$CFG_LIBJPEG" = "auto" ]; then
4163     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
4164        CFG_LIBJPEG=system
4165     else
4166        CFG_LIBJPEG=qt
4167     fi
4168 fi
4169
4170 # detect how gif should be built
4171 if [ "$CFG_GIF" = "auto" ]; then
4172     if [ "$CFG_SHARED" = "yes" ]; then
4173         CFG_GIF=plugin
4174     else
4175         CFG_GIF=yes
4176     fi
4177 fi
4178
4179 # detect png
4180 if [ "$CFG_LIBPNG" = "auto" ]; then
4181     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
4182        CFG_LIBPNG=system
4183     else
4184        CFG_LIBPNG=qt
4185     fi
4186 fi
4187
4188 # detect accessibility
4189 if [ "$CFG_ACCESSIBILITY" = "auto" ]; then
4190     CFG_ACCESSIBILITY=yes
4191 fi
4192
4193 if [ "$CFG_EGLFS" = "yes" ]; then
4194     if [ "$CFG_EGL" = "no" ]; then
4195         echo "The EGLFS plugin requires EGL support and cannot be built"
4196         exit 101
4197     fi
4198     CFG_EGL=yes
4199 fi
4200
4201 # auto-detect SQL-modules support
4202 for _SQLDR in $CFG_SQL_AVAILABLE; do
4203         case $_SQLDR in
4204         mysql)
4205             if [ "$CFG_SQL_mysql" != "no" ]; then
4206                 [ -z "$CFG_MYSQL_CONFIG" ] && CFG_MYSQL_CONFIG=`"$WHICH" mysql_config`
4207                 if [ -x "$CFG_MYSQL_CONFIG" ]; then
4208                     QT_CFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --include 2>/dev/null`
4209                     QT_LFLAGS_MYSQL_R=`$CFG_MYSQL_CONFIG --libs_r 2>/dev/null`
4210                     QT_LFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --libs 2>/dev/null`
4211                     QT_MYSQL_VERSION=`$CFG_MYSQL_CONFIG --version 2>/dev/null`
4212                     QT_MYSQL_VERSION_MAJOR=`echo $QT_MYSQL_VERSION | cut -d . -f 1`
4213                 fi
4214                 if [ -n "$QT_MYSQL_VERSION" ] && [ "$QT_MYSQL_VERSION_MAJOR" -lt 4 ]; then
4215                     if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4216                         echo "This version of MySql is not supported ($QT_MYSQL_VERSION)."
4217                         echo " You need MySql 4 or higher."
4218                         echo " If you believe this message is in error you may use the continue"
4219                         echo " switch (-continue) to $0 to continue."
4220                         exit 101
4221                     else
4222                         CFG_SQL_mysql="no"
4223                         QT_LFLAGS_MYSQL=""
4224                         QT_LFLAGS_MYSQL_R=""
4225                         QT_CFLAGS_MYSQL=""
4226                     fi
4227                 else
4228                     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
4229                         QMakeVar add CONFIG use_libmysqlclient_r
4230                         if [ "$CFG_SQL_mysql" = "auto" ]; then
4231                             CFG_SQL_mysql=plugin
4232                         fi
4233                         QT_LFLAGS_MYSQL="$QT_LFLAGS_MYSQL_R"
4234                     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
4235                         if [ "$CFG_SQL_mysql" = "auto" ]; then
4236                             CFG_SQL_mysql=plugin
4237                         fi
4238                     else
4239                         if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4240                             echo "MySQL support cannot be enabled due to functionality tests!"
4241                             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4242                             echo " If you believe this message is in error you may use the continue"
4243                             echo " switch (-continue) to $0 to continue."
4244                             exit 101
4245                         else
4246                             CFG_SQL_mysql=no
4247                             QT_LFLAGS_MYSQL=""
4248                             QT_LFLAGS_MYSQL_R=""
4249                             QT_CFLAGS_MYSQL=""
4250                         fi
4251                     fi
4252                 fi
4253             fi
4254             ;;
4255         psql)
4256             if [ "$CFG_SQL_psql" != "no" ]; then
4257                 # Be careful not to use native pg_config when cross building.
4258                 if [ "$XPLATFORM_MINGW" != "yes" ] && "$WHICH" pg_config >/dev/null 2>&1; then
4259                     QT_CFLAGS_PSQL=`pg_config --includedir 2>/dev/null`
4260                     QT_LFLAGS_PSQL=`pg_config --libdir 2>/dev/null`
4261                 fi
4262                 [ -z "$QT_CFLAGS_PSQL" ] || QT_CFLAGS_PSQL="-I$QT_CFLAGS_PSQL"
4263                 [ -z "$QT_LFLAGS_PSQL" ] || QT_LFLAGS_PSQL="-L$QT_LFLAGS_PSQL"
4264                 # But, respect PSQL_LIBS if set
4265                 [ -z "$PSQL_LIBS" ] || QT_LFLAGS_PSQL="$PSQL_LIBS"
4266                 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
4267                     if [ "$CFG_SQL_psql" = "auto" ]; then
4268                         CFG_SQL_psql=plugin
4269                     fi
4270                 else
4271                     if [ "$CFG_SQL_psql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4272                         echo "PostgreSQL support cannot be enabled due to functionality tests!"
4273                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4274                         echo " If you believe this message is in error you may use the continue"
4275                         echo " switch (-continue) to $0 to continue."
4276                         exit 101
4277                     else
4278                         CFG_SQL_psql=no
4279                         QT_CFLAGS_PSQL=""
4280                         QT_LFLAGS_PSQL=""
4281                     fi
4282                 fi
4283             fi
4284         ;;
4285         odbc)
4286             if [ "$CFG_SQL_odbc" != "no" ]; then
4287                 if ( [ "$BUILD_ON_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
4288                     if [ "$CFG_SQL_odbc" = "auto" ]; then
4289                         CFG_SQL_odbc=plugin
4290                     fi
4291                 else
4292                     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
4293                         QT_LFLAGS_ODBC="-liodbc"
4294                         if [ "$CFG_SQL_odbc" = "auto" ]; then
4295                             CFG_SQL_odbc=plugin
4296                         fi
4297                     else
4298                         if [ "$CFG_SQL_odbc" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4299                             echo "ODBC support cannot be enabled due to functionality tests!"
4300                             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4301                             echo " If you believe this message is in error you may use the continue"
4302                             echo " switch (-continue) to $0 to continue."
4303                             exit 101
4304                         else
4305                             CFG_SQL_odbc=no
4306                         fi
4307                     fi
4308                 fi
4309             fi
4310             ;;
4311         oci)
4312             if [ "$CFG_SQL_oci" != "no" ]; then
4313                 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
4314                     if [ "$CFG_SQL_oci" = "auto" ]; then
4315                         CFG_SQL_oci=plugin
4316                     fi
4317                 else
4318                     if [ "$CFG_SQL_oci" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4319                         echo "Oracle (OCI) support cannot be enabled due to functionality tests!"
4320                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4321                         echo " If you believe this message is in error you may use the continue"
4322                         echo " switch (-continue) to $0 to continue."
4323                         exit 101
4324                     else
4325                         CFG_SQL_oci=no
4326                     fi
4327                 fi
4328             fi
4329             ;;
4330         tds)
4331             if [ "$CFG_SQL_tds" != "no" ]; then
4332                 [ -z "$SYBASE" ] || QT_LFLAGS_TDS="-L$SYBASE/lib"
4333                 [ -z "$SYBASE_LIBS" ] || QT_LFLAGS_TDS="$QT_LFLAGS_TDS $SYBASE_LIBS"
4334                 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
4335                     if [ "$CFG_SQL_tds" = "auto" ]; then
4336                         CFG_SQL_tds=plugin
4337                     fi
4338                 else
4339                     if [ "$CFG_SQL_tds" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4340                         echo "TDS support cannot be enabled due to functionality tests!"
4341                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4342                         echo " If you believe this message is in error you may use the continue"
4343                         echo " switch (-continue) to $0 to continue."
4344                         exit 101
4345                     else
4346                         CFG_SQL_tds=no
4347                     fi
4348                 fi
4349             fi
4350             ;;
4351         db2)
4352             if [ "$CFG_SQL_db2" != "no" ]; then
4353                 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
4354                     if [ "$CFG_SQL_db2" = "auto" ]; then
4355                         CFG_SQL_db2=plugin
4356                     fi
4357                 else
4358                     if [ "$CFG_SQL_db2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4359                         echo "ODBC support cannot be enabled due to functionality tests!"
4360                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4361                         echo " If you believe this message is in error you may use the continue"
4362                         echo " switch (-continue) to $0 to continue."
4363                         exit 101
4364                     else
4365                         CFG_SQL_db2=no
4366                     fi
4367                 fi
4368             fi
4369             ;;
4370         ibase)
4371             if [ "$CFG_SQL_ibase" != "no" ]; then
4372                 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
4373                     if [ "$CFG_SQL_ibase" = "auto" ]; then
4374                         CFG_SQL_ibase=plugin
4375                     fi
4376                 else
4377                     if [ "$CFG_SQL_ibase" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4378                         echo "InterBase support cannot be enabled due to functionality tests!"
4379                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4380                         echo " If you believe this message is in error you may use the continue"
4381                         echo " switch (-continue) to $0 to continue."
4382                         exit 101
4383                     else
4384                         CFG_SQL_ibase=no
4385                     fi
4386                 fi
4387             fi
4388             ;;
4389         sqlite2)
4390             if [ "$CFG_SQL_sqlite2" != "no" ]; then
4391                 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
4392                     if [ "$CFG_SQL_sqlite2" = "auto" ]; then
4393                         CFG_SQL_sqlite2=plugin
4394                     fi
4395                 else
4396                     if [ "$CFG_SQL_sqlite2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4397                         echo "SQLite2 support cannot be enabled due to functionality tests!"
4398                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4399                         echo " If you believe this message is in error you may use the continue"
4400                         echo " switch (-continue) to $0 to continue."
4401                         exit 101
4402                     else
4403                         CFG_SQL_sqlite2=no
4404                     fi
4405                 fi
4406             fi
4407             ;;
4408         sqlite)
4409             if [ "$CFG_SQL_sqlite" != "no" ]; then
4410                 SQLITE_AUTODETECT_FAILED="no"
4411                 if [ "$CFG_SQLITE" = "system" ]; then
4412                     if [ -n "$PKG_CONFIG" ]; then
4413                         QT_CFLAGS_SQLITE=`$PKG_CONFIG --cflags sqlite3 2>/dev/null`
4414                         QT_LFLAGS_SQLITE=`$PKG_CONFIG --libs sqlite3 2>/dev/null`
4415                     fi
4416                     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
4417                         if [ "$CFG_SQL_sqlite" = "auto" ]; then
4418                             CFG_SQL_sqlite=plugin
4419                         fi
4420                         QMAKE_CONFIG="$QMAKE_CONFIG system-sqlite"
4421                     else
4422                         SQLITE_AUTODETECT_FAILED="yes"
4423                         CFG_SQL_sqlite=no
4424                     fi
4425                 elif [ -f "$relpath/src/3rdparty/sqlite/sqlite3.h" ]; then
4426                     if [ "$CFG_SQL_sqlite" = "auto" ]; then
4427                             CFG_SQL_sqlite=plugin
4428                     fi
4429                 else
4430                     SQLITE_AUTODETECT_FAILED="yes"
4431                     CFG_SQL_sqlite=no
4432                 fi
4433
4434                 if [ "$SQLITE_AUTODETECT_FAILED" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4435                     echo "SQLite support cannot be enabled due to functionality tests!"
4436                     echo " Turn on verbose messaging (-v) to $0 to see the final report."
4437                     echo " If you believe this message is in error you may use the continue"
4438                     echo " switch (-continue) to $0 to continue."
4439                     exit 101
4440                 fi
4441             fi
4442             ;;
4443         *)
4444             if [ "$OPT_VERBOSE" = "yes" ]; then
4445                 echo "unknown SQL driver: $_SQLDR"
4446             fi
4447             ;;
4448         esac
4449 done
4450
4451 # auto-detect NIS support
4452 if [ "$CFG_NIS" != "no" ]; then
4453     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
4454         CFG_NIS=yes
4455     else
4456         if [ "$CFG_NIS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4457             echo "NIS support cannot be enabled due to functionality tests!"
4458             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4459             echo " If you believe this message is in error you may use the continue"
4460             echo " switch (-continue) to $0 to continue."
4461             exit 101
4462         else
4463             CFG_NIS=no
4464         fi
4465     fi
4466 fi
4467
4468 # auto-detect CUPS support
4469 if [ "$CFG_CUPS" != "no" ]; then
4470     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
4471         CFG_CUPS=yes
4472     else
4473         if [ "$CFG_CUPS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4474             echo "Cups support cannot be enabled due to functionality tests!"
4475             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4476             echo " If you believe this message is in error you may use the continue"
4477             echo " switch (-continue) to $0 to continue."
4478             exit 101
4479         else
4480             CFG_CUPS=no
4481         fi
4482     fi
4483 fi
4484
4485 # auto-detect iconv(3) support
4486 if [ "$CFG_ICONV" != "no" ]; then
4487     if [ "$XPLATFORM_MINGW" = "yes" ]; then
4488         CFG_ICONV=no
4489     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
4490         CFG_ICONV=yes
4491     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
4492         CFG_ICONV=sun
4493     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
4494         CFG_ICONV=gnu
4495     else
4496         if [ "$CFG_ICONV" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4497             echo "Iconv support cannot be enabled due to functionality tests!"
4498             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4499             echo " If you believe this message is in error you may use the continue"
4500             echo " switch (-continue) to $0 to continue."
4501             exit 101
4502         else
4503             CFG_ICONV=no
4504         fi
4505     fi
4506 fi
4507
4508 # auto-detect libdbus-1 support
4509 if [ "$CFG_DBUS" != "no" ]; then
4510     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then
4511         QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null`
4512         QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null`
4513     fi
4514     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
4515         [ "$CFG_DBUS" = "auto" ] && CFG_DBUS=yes
4516         QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
4517         QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS"
4518     else
4519         if [ "$CFG_DBUS" = "auto" ]; then
4520             CFG_DBUS=no
4521         elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4522             # CFG_DBUS is "yes" or "linked" here
4523
4524             echo "The QtDBus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found."
4525             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4526             echo " If you believe this message is in error you may use the continue"
4527             echo " switch (-continue) to $0 to continue."
4528             exit 101
4529         fi
4530     fi
4531 fi
4532
4533 # X11/Lighthouse
4534 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
4535
4536     # auto-detect Glib support
4537     if [ "$CFG_GLIB" != "no" ]; then
4538         if [ -n "$PKG_CONFIG" ]; then
4539             QT_CFLAGS_GLIB=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0 2>/dev/null`
4540             QT_LIBS_GLIB=`$PKG_CONFIG --libs glib-2.0 gthread-2.0 2>/dev/null`
4541         fi
4542         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
4543             CFG_GLIB=yes
4544             QMakeVar set QT_CFLAGS_GLIB "$QT_CFLAGS_GLIB"
4545             QMakeVar set QT_LIBS_GLIB "$QT_LIBS_GLIB"
4546         else
4547             if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4548                 echo "Glib support cannot be enabled due to functionality tests!"
4549                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4550                 echo " If you believe this message is in error you may use the continue"
4551                 echo " switch (-continue) to $0 to continue."
4552                 exit 101
4553             else
4554                 CFG_GLIB=no
4555             fi
4556         fi
4557     fi
4558
4559     # ### Vestige
4560     if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then
4561         if [ -n "$PKG_CONFIG" ]; then
4562             QT_CFLAGS_GSTREAMER=`$PKG_CONFIG --cflags gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
4563             QT_LIBS_GSTREAMER=`$PKG_CONFIG --libs gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
4564         fi
4565         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
4566             CFG_GSTREAMER=yes
4567             QMakeVar set QT_CFLAGS_GSTREAMER "$QT_CFLAGS_GSTREAMER"
4568             QMakeVar set QT_LIBS_GSTREAMER "$QT_LIBS_GSTREAMER"
4569         else
4570             if [ "$CFG_GSTREAMER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4571                 echo "Gstreamer support cannot be enabled due to functionality tests!"
4572                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4573                 echo " If you believe this message is in error you may use the continue"
4574                 echo " switch (-continue) to $0 to continue."
4575                 exit 101
4576             else
4577                 CFG_GSTREAMER=no
4578             fi
4579         fi
4580     elif [ "$CFG_GLIB" = "no" ]; then
4581         CFG_GSTREAMER=no
4582     fi
4583
4584     # auto-detect libicu support
4585     if [ "$CFG_ICU" != "no" ]; then
4586         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/icu "ICU" $L_FLAGS $I_FLAGS $l_FLAGS; then
4587             [ "$CFG_ICU" = "auto" ] && CFG_ICU=yes
4588         else
4589             if [ "$CFG_ICU" = "auto" ]; then
4590                 CFG_ICU=no
4591             elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4592                 # CFG_ICU is "yes"
4593
4594                 echo "The ICU library support cannot be enabled."
4595                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4596                 echo " If you believe this message is in error you may use the continue"
4597                 echo " switch (-continue) to $0 to continue."
4598                 exit 101
4599             fi
4600         fi
4601     fi
4602
4603     # Auto-detect PulseAudio support
4604     if [ "$CFG_PULSEAUDIO" != "no" ]; then
4605         if [ -n "$PKG_CONFIG" ]; then
4606             QT_CFLAGS_PULSEAUDIO=`$PKG_CONFIG --cflags libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
4607             QT_LIBS_PULSEAUDIO=`$PKG_CONFIG --libs libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
4608         fi
4609         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
4610             CFG_PULSEAUDIO=yes
4611             QMakeVar set QT_CFLAGS_PULSEAUDIO "$QT_CFLAGS_PULSEAUDIO"
4612             QMakeVar set QT_LIBS_PULSEAUDIO "$QT_LIBS_PULSEAUDIO"
4613         else
4614             if [ "$CFG_PULSEAUDIO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4615                 echo "PulseAudio support cannot be enabled due to functionality tests!"
4616                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4617                 echo " If you believe this message is in error you may use the continue"
4618                 echo " switch (-continue) to $0 to continue."
4619                 exit 101
4620             else
4621                 CFG_PULSEAUDIO=no
4622             fi
4623         fi
4624     fi
4625 fi # X11/Lighthouse
4626
4627 # X11
4628 if [ "$PLATFORM_X11" = "yes" -a "$CFG_GUI" != "no" ]; then
4629     x11tests="$relpath/config.tests/x11"
4630     X11TESTS_FLAGS=
4631
4632     # work around broken X11 headers when using GCC 2.95 or later
4633     NOTYPE=no
4634     "$x11tests/notype.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" && NOTYPE=yes
4635     if [ $NOTYPE = "yes" ]; then
4636         QMakeVar add QMAKE_CXXFLAGS -fpermissive
4637         X11TESTS_FLAGS="$X11TESTS_FLAGS -fpermissive"
4638     fi
4639
4640     # Check we actually have X11 :-)
4641     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
4642     if [ $? != "0" ]; then
4643         echo "Basic XLib functionality test failed!"
4644         echo " You might need to modify the include and library search paths by editing"
4645         echo " QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in ${XQMAKESPEC}."
4646         exit 1
4647     fi
4648 fi
4649
4650 # X11/MINGW OpenGL
4651 if [ "$PLATFORM_X11" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
4652     # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
4653     if [ "$CFG_GUI" = "no" ]; then
4654         if [ "$CFG_OPENGL" = "auto" ]; then
4655             CFG_OPENGL=no
4656         fi
4657         if [ "$CFG_OPENGL" != "no" ]; then
4658             echo "OpenGL enabled, but GUI disabled."
4659             echo " You might need to either enable the GUI or disable OpenGL"
4660             exit 1
4661         fi
4662     fi
4663     if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
4664         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
4665             CFG_OPENGL=desktop
4666         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
4667             CFG_OPENGL=es2
4668         else
4669             if [ "$CFG_OPENGL" = "yes" ]; then
4670                 echo "All the OpenGL functionality tests failed!"
4671                 echo " You might need to modify the include and library search paths by editing"
4672                 echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
4673                 echo " ${XQMAKESPEC}."
4674                 exit 1
4675             fi
4676             CFG_OPENGL=no
4677         fi
4678         case "$PLATFORM" in
4679         hpux*)
4680             # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
4681             if [ "$CFG_OPENGL" = "desktop" ]; then
4682                 "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
4683                 if [ $? != "0" ]; then
4684                     QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
4685                 fi
4686             fi
4687             ;;
4688         *)
4689             ;;
4690         esac
4691     elif [ "$CFG_OPENGL" = "es2" ]; then
4692         #OpenGL ES 2.x
4693         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS
4694         if [ $? != "0" ]; then
4695             echo "The OpenGL ES 2.0 functionality test failed!"
4696             echo " You might need to modify the include and library search paths by editing"
4697             echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
4698             echo " ${XQMAKESPEC}."
4699             exit 1
4700         fi
4701     elif [ "$CFG_OPENGL" = "desktop" ]; then
4702         # Desktop OpenGL support
4703         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
4704         if [ $? != "0" ]; then
4705             echo "The OpenGL functionality test failed!"
4706             echo " You might need to modify the include and library search paths by editing"
4707             echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
4708             echo " ${XQMAKESPEC}."
4709             exit 1
4710         fi
4711         case "$PLATFORM" in
4712         hpux*)
4713             # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
4714             "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
4715             if [ $? != "0" ]; then
4716                 QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
4717             fi
4718             ;;
4719         *)
4720             ;;
4721         esac
4722     fi
4723 fi # X11/MINGW OpenGL
4724
4725 # X11
4726 if [ "$PLATFORM_X11" = "yes" ]; then
4727     # auto-detect Xcursor support
4728     if [ "$CFG_XCURSOR" != "no" ]; then
4729         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
4730             if [ "$CFG_XCURSOR" != "runtime" ]; then
4731                 CFG_XCURSOR=yes;
4732             fi
4733         else
4734             if [ "$CFG_XCURSOR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4735                 echo "Xcursor support cannot be enabled due to functionality tests!"
4736                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4737                 echo " If you believe this message is in error you may use the continue"
4738                 echo " switch (-continue) to $0 to continue."
4739                 exit 101
4740             else
4741                 CFG_XCURSOR=no
4742             fi
4743         fi
4744     fi
4745
4746     # auto-detect Xfixes support
4747     if [ "$CFG_XFIXES" != "no" ]; then
4748         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xfixes "Xfixes" $L_FLAGS $I_FLAGS $X11TESTS_FLAGS; then
4749             if [ "$CFG_XFIXES" != "runtime" ]; then
4750                 CFG_XFIXES=yes;
4751             fi
4752         else
4753             if [ "$CFG_XFIXES" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4754                 echo "Xfixes support cannot be enabled due to functionality tests!"
4755                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4756                 echo " If you believe this message is in error you may use the continue"
4757                 echo " switch (-continue) to $0 to continue."
4758                 exit 101
4759             else
4760                 CFG_XFIXES=no
4761             fi
4762         fi
4763     fi
4764
4765     # auto-detect Xrandr support (resize and rotate extension)
4766     if [ "$CFG_XRANDR" != "no" ]; then
4767         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
4768             if [ "$CFG_XRANDR" != "runtime" ]; then
4769             CFG_XRANDR=yes
4770             fi
4771         else
4772             if [ "$CFG_XRANDR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4773                 echo "Xrandr support cannot be enabled due to functionality tests!"
4774                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4775                 echo " If you believe this message is in error you may use the continue"
4776                 echo " switch (-continue) to $0 to continue."
4777                 exit 101
4778             else
4779                 CFG_XRANDR=no
4780             fi
4781         fi
4782     fi
4783
4784     # auto-detect Xrender support
4785     if [ "$CFG_XRENDER" != "no" ]; then
4786         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
4787             CFG_XRENDER=yes
4788         else
4789             if [ "$CFG_XRENDER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4790                 echo "Xrender support cannot be enabled due to functionality tests!"
4791                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4792                 echo " If you believe this message is in error you may use the continue"
4793                 echo " switch (-continue) to $0 to continue."
4794                 exit 101
4795             else
4796                 CFG_XRENDER=no
4797             fi
4798         fi
4799     fi
4800
4801     # auto-detect MIT-SHM support
4802     if [ "$CFG_MITSHM" != "no" ]; then
4803         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
4804             CFG_MITSHM=yes
4805         else
4806             if [ "$CFG_MITSHM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4807                 echo "MITSHM support cannot be enabled due to functionality tests!"
4808                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4809                 echo " If you believe this message is in error you may use the continue"
4810                 echo " switch (-continue) to $0 to continue."
4811                 exit 101
4812             else
4813                 CFG_MITSHM=no
4814             fi
4815         fi
4816     fi
4817
4818     # auto-detect Session Management support
4819     if [ "$CFG_SM" = "auto" ]; then
4820         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
4821             CFG_SM=yes
4822         else
4823             if [ "$CFG_SM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4824                 echo "Session Management support cannot be enabled due to functionality tests!"
4825                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4826                 echo " If you believe this message is in error you may use the continue"
4827                 echo " switch (-continue) to $0 to continue."
4828                 exit 101
4829             else
4830                 CFG_SM=no
4831             fi
4832         fi
4833     fi
4834
4835     # auto-detect SHAPE support
4836     if [ "$CFG_XSHAPE" != "no" ]; then
4837         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
4838             CFG_XSHAPE=yes
4839         else
4840             if [ "$CFG_XSHAPE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4841                 echo "XShape support cannot be enabled due to functionality tests!"
4842                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4843                 echo " If you believe this message is in error you may use the continue"
4844                 echo " switch (-continue) to $0 to continue."
4845                 exit 101
4846             else
4847                 CFG_XSHAPE=no
4848             fi
4849         fi
4850     fi
4851
4852     # auto-detect XVideo support
4853     if [ "$CFG_XVIDEO" != "no" ]; then
4854         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
4855             CFG_XVIDEO=yes
4856         else
4857             if [ "$CFG_XVIDEO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4858                 echo "XVideo support cannot be enabled due to functionality tests!"
4859                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4860                 echo " If you believe this message is in error you may use the continue"
4861                 echo " switch (-continue) to $0 to continue."
4862                 exit 101
4863             else
4864                 CFG_XVIDEO=no
4865             fi
4866         fi
4867     fi
4868
4869     # auto-detect XSync support
4870     if [ "$CFG_XSYNC" != "no" ]; then
4871         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
4872             CFG_XSYNC=yes
4873         else
4874             if [ "$CFG_XSYNC" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4875                 echo "XSync support cannot be enabled due to functionality tests!"
4876                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4877                 echo " If you believe this message is in error you may use the continue"
4878                 echo " switch (-continue) to $0 to continue."
4879                 exit 101
4880             else
4881                 CFG_XSYNC=no
4882             fi
4883         fi
4884     fi
4885
4886     # auto-detect Xinerama support
4887     if [ "$CFG_XINERAMA" != "no" ]; then
4888         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
4889             if [ "$CFG_XINERAMA" != "runtime" ]; then
4890                 CFG_XINERAMA=yes
4891             fi
4892         else
4893             if [ "$CFG_XINERAMA" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4894                 echo "Xinerama support cannot be enabled due to functionality tests!"
4895                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4896                 echo " If you believe this message is in error you may use the continue"
4897                 echo " switch (-continue) to $0 to continue."
4898                 exit 101
4899             else
4900                 CFG_XINERAMA=no
4901             fi
4902         fi
4903     fi
4904
4905     # auto-detect Xinput support
4906     if [ "$CFG_XINPUT" != "no" ]; then
4907         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
4908             if [ "$CFG_XINPUT" != "runtime" ]; then
4909                 CFG_XINPUT=yes
4910             fi
4911         else
4912             if [ "$CFG_XINPUT" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4913                 echo "Tablet and Xinput support cannot be enabled due to functionality tests!"
4914                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4915                 echo " If you believe this message is in error you may use the continue"
4916                 echo " switch (-continue) to $0 to continue."
4917                 exit 101
4918             else
4919                 CFG_XINPUT=no
4920             fi
4921         fi
4922     fi
4923
4924     # auto-detect XKB support
4925     if [ "$CFG_XKB" != "no" ]; then
4926         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
4927             CFG_XKB=yes
4928         else
4929             if [ "$CFG_XKB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4930                 echo "XKB support cannot be enabled due to functionality tests!"
4931                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4932                 echo " If you believe this message is in error you may use the continue"
4933                 echo " switch (-continue) to $0 to continue."
4934                 exit 101
4935             else
4936                 CFG_XKB=no
4937             fi
4938         fi
4939     fi
4940
4941     if [ "$CFG_GLIB" = "yes" -a "$CFG_QGTKSTYLE" != "no" ]; then
4942         if [ -n "$PKG_CONFIG" ]; then
4943             QT_CFLAGS_QGTKSTYLE=`$PKG_CONFIG --cflags gtk+-2.0 ">=" 2.10 atk 2>/dev/null`
4944             QT_LIBS_QGTKSTYLE=`$PKG_CONFIG --libs gobject-2.0 2>/dev/null`
4945         fi
4946         if [ -n "$QT_CFLAGS_QGTKSTYLE" ] ; then
4947             CFG_QGTKSTYLE=yes
4948             QMakeVar set QT_CFLAGS_QGTKSTYLE "$QT_CFLAGS_QGTKSTYLE"
4949             QMakeVar set QT_LIBS_QGTKSTYLE "$QT_LIBS_QGTKSTYLE"
4950         else
4951             if [ "$CFG_QGTKSTYLE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4952                 echo "Gtk theme support cannot be enabled due to functionality tests!"
4953                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4954                 echo " If you believe this message is in error you may use the continue"
4955                 echo " switch (-continue) to $0 to continue."
4956                 exit 101
4957             else
4958                 CFG_QGTKSTYLE=no
4959             fi
4960         fi
4961     elif [ "$CFG_GLIB" = "no" ]; then
4962         CFG_QGTKSTYLE=no
4963     fi
4964 fi # X11
4965
4966 # auto-detect FontConfig support
4967 if [ "$CFG_FONTCONFIG" != "no" ]; then
4968     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
4969         QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
4970         QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null`
4971     else
4972         QT_CFLAGS_FONTCONFIG=
4973         QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig"
4974     fi
4975     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
4976         CFG_FONTCONFIG=yes
4977         QMakeVar set QMAKE_CFLAGS_X11 "$QT_CFLAGS_FONTCONFIG \$\$QMAKE_CFLAGS_X11"
4978         QMakeVar set QMAKE_LIBS_X11 "$QT_LIBS_FONTCONFIG \$\$QMAKE_LIBS_X11"
4979         CFG_LIBFREETYPE=system
4980     else
4981         if [ "$CFG_FONTCONFIG" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4982             echo "FontConfig support cannot be enabled due to functionality tests!"
4983             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4984             echo " If you believe this message is in error you may use the continue"
4985             echo " switch (-continue) to $0 to continue."
4986             exit 101
4987         else
4988             CFG_FONTCONFIG=no
4989         fi
4990     fi
4991 fi
4992
4993
4994 if [ "$BUILD_ON_MAC" = "yes" ]; then
4995     if [ "$CFG_PHONON" != "no" ]; then
4996         # Always enable Phonon (unless it was explicitly disabled)
4997         CFG_PHONON=yes
4998     fi
4999
5000     if [ "$CFG_COREWLAN" = "auto" ]; then
5001         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
5002             CFG_COREWLAN=yes
5003         else
5004             CFG_COREWLAN=no
5005         fi
5006     fi
5007 fi
5008
5009 if [ "$PLATFORM_QPA" = "yes" ]; then
5010     # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
5011     if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
5012         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
5013             CFG_OPENGL=desktop
5014         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
5015             CFG_OPENGL=es2
5016         else
5017             if [ "$CFG_OPENGL" = "yes" ]; then
5018                 echo "All the OpenGL functionality tests failed!"
5019                 echo " You might need to modify the include and library search paths by editing"
5020                 echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5021                 echo " ${XQMAKESPEC}."
5022                 exit 1
5023             fi
5024             CFG_OPENGL=no
5025         fi
5026     elif [ "$CFG_OPENGL" = "es2" ]; then
5027         #OpenGL ES 2.x
5028         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists glesv2 2>/dev/null; then
5029             QMAKE_INCDIR_OPENGL_ES2=`$PKG_CONFIG --cflags-only-I glesv2 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
5030             QMAKE_LIBDIR_OPENGL_ES2=`$PKG_CONFIG --libs-only-L glesv2 2>/dev/null | sed -e 's,^-L,,g' -e 's, -L, ,g'`
5031             QMAKE_LIBS_OPENGL_ES2=`$PKG_CONFIG --libs glesv2 2>/dev/null`
5032             QMAKE_CFLAGS_OPENGL_ES2=`$PKG_CONFIG --cflags glesv2 2>/dev/null`
5033             QMakeVar set QMAKE_INCDIR_OPENGL_ES2 "$QMAKE_INCDIR_OPENGL_ES2"
5034             QMakeVar set QMAKE_LIBDIR_OPENGL_ES2 "$QMAKE_LIBDIR_OPENGL_ES2"
5035             QMakeVar set QMAKE_LIBS_OPENGL_ES2 "$QMAKE_LIBS_OPENGL_ES2"
5036         fi
5037
5038         "$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
5039         if [ $? != "0" ]; then
5040             echo "The OpenGL ES 2.0 functionality test failed!"
5041             echo " You might need to modify the include and library search paths by editing"
5042             echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
5043             echo " ${XQMAKESPEC}."
5044             exit 1
5045         fi
5046     elif [ "$CFG_OPENGL" = "desktop" ]; then
5047         # Desktop OpenGL support
5048         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengldesktop "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
5049         if [ $? != "0" ]; then
5050             echo "The OpenGL functionality test failed!"
5051             echo " You might need to modify the include and library search paths by editing"
5052             echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5053             echo " ${XQMAKESPEC}."
5054             exit 1
5055         fi
5056     fi
5057
5058     # auto-detect FontConfig support
5059     if [ "$CFG_FONTCONFIG" != "no" ]; then
5060         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
5061             QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
5062             QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null`
5063         else
5064             QT_CFLAGS_FONTCONFIG=
5065             QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig"
5066         fi
5067         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
5068                 QT_CONFIG="$QT_CONFIG fontconfig"
5069                 QMakeVar set QMAKE_CFLAGS_FONTCONFIG "$QT_CFLAGS_FONTCONFIG"
5070                 QMakeVar set QMAKE_LIBS_FONTCONFIG "$QT_LIBS_FONTCONFIG"
5071                 CFG_LIBFREETYPE=system
5072         fi
5073
5074     fi
5075
5076     # Save these for a check later
5077     ORIG_CFG_XCB="$CFG_XCB"
5078     ORIG_CFG_EGLFS="$CFG_EGLFS"
5079
5080     if [ "$CFG_LIBUDEV" != "no" ]; then
5081        if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists libudev 2>/dev/null; then
5082            QMAKE_INCDIR_LIBUDEV=`$PKG_CONFIG --cflags-only-I libudev 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
5083            QMAKE_LIBS_LIBUDEV=`$PKG_CONFIG --libs libudev 2>/dev/null`
5084            QMakeVar set QMAKE_INCDIR_LIBUDEV "$QMAKE_INCDIR_LIBUDEV"
5085            QMakeVar set QMAKE_LIBS_LIBUDEV "$QMAKE_LIBS_LIBUDEV"
5086        fi
5087        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libudev "libudev" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_INCDIR_LIBUDEV $QMAKE_LIBS_LIBUDEV; then
5088             CFG_LIBUDEV=yes
5089             QT_CONFIG="$QT_CONFIG libudev"
5090         elif [ "$CFG_LIBUDEV" = "yes" ]; then
5091             echo "The libudev functionality test failed!"
5092             exit 1
5093         else
5094             CFG_LIBUDEV=no
5095             QMakeVar add DEFINES QT_NO_LIBUDEV
5096         fi
5097     fi
5098
5099     if [ "$CFG_EVDEV" != "no" ]; then
5100         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/evdev "evdev" $L_FLAGS $I_FLAGS $l_FLAGS; then
5101             CFG_EVDEV=yes
5102             QT_CONFIG="$QT_CONFIG evdev"
5103         elif [ "$CFG_EVDEV" = "yes" ]; then
5104             echo "The evdev functionality test failed!"
5105             exit 1
5106         else
5107             CFG_EVDEV=no
5108             QMakeVar add DEFINES QT_NO_EVDEV
5109         fi
5110     fi
5111
5112     # Check we actually have X11 :-)
5113     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
5114         QT_CONFIG="$QT_CONFIG xlib"
5115     fi
5116
5117     # auto-detect Xrender support
5118     if [ "$CFG_XRENDER" != "no" ]; then
5119         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
5120             CFG_XRENDER=yes
5121             QT_CONFIG="$QT_CONFIG xrender"
5122         else
5123             if [ "$CFG_XRENDER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5124                 echo "Xrender support cannot be enabled due to functionality tests!"
5125                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5126                 echo " If you believe this message is in error you may use the continue"
5127                 echo " switch (-continue) to $0 to continue."
5128                 exit 101
5129             else
5130                 CFG_XRENDER=no
5131             fi
5132         fi
5133     fi
5134
5135     if [ "$CFG_XCB" != "no" ]; then
5136         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xcb >= 1.5" 2>/dev/null; then
5137             QMAKE_CFLAGS_XCB="`$PKG_CONFIG --cflags xcb 2>/dev/null`"
5138             QMAKE_LIBS_XCB="`$PKG_CONFIG --libs xcb 2>/dev/null`"
5139         fi
5140         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb "xcb" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
5141             CFG_XCB=yes
5142             if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb-render "xcb-render" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
5143                 QT_CONFIG="$QT_CONFIG xcb-render"
5144             fi
5145
5146             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 $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
5147                 CFG_XCB_LIMITED=no
5148                 QT_CONFIG="$QT_CONFIG xcb-poll-for-queued-event"
5149             fi
5150
5151             if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb-xlib "xcb-xlib" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
5152                 QT_CONFIG="$QT_CONFIG xcb-xlib"
5153             fi
5154
5155             if [ "$XPLATFORM_MAEMO" = "yes" ]; then
5156                 # auto-detect XInput2/Xinput support
5157                 if [ "$CFG_XINPUT2" != "no" ]; then
5158                     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
5159                     CFG_XINPUT2=yes
5160                     CFG_XINPUT=no
5161                     else
5162                         if [ "$CFG_XINPUT2" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5163                             echo "XInput2 support cannot be enabled due to functionality tests!"
5164                             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5165                             echo " If you believe this message is in error you may use the continue"
5166                             echo " switch (-continue) to $0 to continue."
5167                             exit 101
5168                         else
5169                             CFG_XINPUT2=no
5170                         fi
5171                     fi
5172                 fi
5173             fi
5174         else
5175             if [ "$CFG_XCB" = "yes" ]; then
5176                 echo "The XCB test failed!"
5177                 echo " You might need to install dependency packages."
5178                 echo " See src/plugins/platforms/xcb/README."
5179                 exit 1
5180             fi
5181             CFG_XCB=no
5182             QMakeVar add DEFINES QT_NO_XCB
5183         fi
5184     fi
5185
5186     # Detect libxkbcommon
5187     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xkbcommon 2>/dev/null; then
5188         QMAKE_CFLAGS_XKBCOMMON="`$PKG_CONFIG --cflags xkbcommon 2>/dev/null`"
5189         QMAKE_LIBS_XKBCOMMON="`$PKG_CONFIG --libs xkbcommon 2>/dev/null`"
5190         QMAKE_CFLAGS_XCB="$QMAKE_CFLAGS_XCB $QMAKE_CFLAGS_XKBCOMMON"
5191         QMAKE_LIBS_XCB="$QMAKE_LIBS_XCB $QMAKE_LIBS_XKBCOMMON"
5192     else
5193         QMAKE_DEFINES_XCB=QT_NO_XCB_XKB
5194     fi
5195
5196     # EGL Support
5197     if [ "$CFG_EGL" != "no" ]; then
5198         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists egl 2>/dev/null; then
5199             QMAKE_INCDIR_EGL=`$PKG_CONFIG --cflags-only-I egl 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
5200             QMAKE_LIBS_EGL=`$PKG_CONFIG --libs egl 2>/dev/null`
5201             QMAKE_CFLAGS_EGL=`$PKG_CONFIG --cflags egl 2>/dev/null`
5202             QMakeVar set QMAKE_INCDIR_EGL "$QMAKE_INCDIR_EGL"
5203             QMakeVar set QMAKE_LIBS_EGL "$QMAKE_LIBS_EGL"
5204         fi       # detect EGL support
5205         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/qpa/egl" "EGL" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_EGL $QMAKE_LIBS_EGL; then
5206             CFG_EGL=yes
5207         elif [ "$CFG_EGL" = "yes" ]; then
5208             echo " The EGL functionality test failed; EGL is required by some QPA plugins to manage contexts & surfaces."
5209             echo " You might need to modify the include and library search paths by editing"
5210             echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in ${XQMAKESPEC}."
5211             exit 1
5212         else
5213             CFG_EGL=no
5214         fi
5215     fi
5216
5217     if [ "$CFG_EGLFS" != "no" ]; then
5218         CFG_EGLFS="$CFG_EGL"
5219     fi
5220
5221     if [ -n "$QMAKE_CFLAGS_XCB" ] || [ -n "$QMAKE_LIBS_XCB" ]; then
5222         QMakeVar set QMAKE_CFLAGS_XCB "$QMAKE_CFLAGS_XCB"
5223         QMakeVar set QMAKE_LIBS_XCB "$QMAKE_LIBS_XCB"
5224         QMakeVar set QMAKE_DEFINES_XCB "$QMAKE_DEFINES_XCB"
5225     fi
5226
5227     if [ "$BUILD_ON_MAC" = "yes" ]; then
5228         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
5229             QT_CONFIG="$QT_CONFIG coreservices"
5230         else
5231             QMakeVar add DEFINES QT_NO_CORESERVICES
5232         fi
5233     fi
5234
5235     if [ "$PLATFORM_QPA" = "yes" ] && [ "$BUILD_ON_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ]; then
5236         if [ "$CFG_XCB" = "no" ] && [ "$CFG_EGLFS" = "no" ]; then
5237             if [ "$QPA_PLATFORM_GUARD" = "yes" ] &&
5238                  ( [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_EGLFS" = "auto" ] ); then
5239                 echo "No QPA platform plugin enabled!"
5240                 echo " If you really want to build without a QPA platform plugin you must pass"
5241                 echo " -no-xcb and -no-eglfs to configure. Doing this will"
5242                 echo " produce a Qt that cannot run GUI applications."
5243                 echo " The dependencies needed for xcb to build are listed in"
5244                 echo " src/plugins/platforms/xcb/README"
5245                 exit 1
5246             fi
5247         fi
5248     fi
5249
5250 fi
5251
5252 [ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_PHONON" != "no" ] && CFG_PHONON="yes"
5253
5254 # freetype support
5255 [ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_LIBFREETYPE" = "auto" ] && CFG_LIBFREETYPE=no
5256 if [ "$CFG_LIBFREETYPE" = "auto" ]; then
5257     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
5258         CFG_LIBFREETYPE=system
5259     else
5260         CFG_LIBFREETYPE=yes
5261     fi
5262 fi
5263
5264 HAVE_STL=no
5265 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stl "STL" $L_FLAGS $I_FLAGS $l_FLAGS; then
5266     HAVE_STL=yes
5267 fi
5268
5269 if [ "$CFG_STL" != "no" ]; then
5270     if [ "$HAVE_STL" = "yes" ]; then
5271         CFG_STL=yes
5272     else
5273         if [ "$CFG_STL" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5274             echo "STL support cannot be enabled due to functionality tests!"
5275             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5276             echo " If you believe this message is in error you may use the continue"
5277             echo " switch (-continue) to $0 to continue."
5278             exit 101
5279         else
5280             CFG_STL=no
5281         fi
5282     fi
5283 fi
5284
5285 # detect POSIX clock_gettime()
5286 if [ "$CFG_CLOCK_GETTIME" = "auto" ]; then
5287     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
5288         CFG_CLOCK_GETTIME=yes
5289     else
5290         CFG_CLOCK_GETTIME=no
5291     fi
5292 fi
5293
5294 # detect POSIX monotonic clocks
5295 if [ "$CFG_CLOCK_GETTIME" = "yes" ] && [ "$CFG_CLOCK_MONOTONIC" = "auto" ]; then
5296     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
5297         CFG_CLOCK_MONOTONIC=yes
5298     else
5299         CFG_CLOCK_MONOTONIC=no
5300     fi
5301 elif [ "$CFG_CLOCK_GETTIME" = "no" ]; then
5302     CFG_CLOCK_MONOTONIC=no
5303 fi
5304
5305 # detect mremap
5306 if [ "$CFG_MREMAP" = "auto" ]; then
5307     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mremap "mremap" $L_FLAGS $I_FLAGS $l_FLAGS; then
5308         CFG_MREMAP=yes
5309     else
5310         CFG_MREMAP=no
5311     fi
5312 fi
5313
5314 # find if the platform provides getaddrinfo (ipv6 dns lookups)
5315 if [ "$CFG_GETADDRINFO" != "no" ]; then
5316     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getaddrinfo "getaddrinfo" $L_FLAGS $I_FLAGS $l_FLAGS; then
5317         CFG_GETADDRINFO=yes
5318     else
5319         if [ "$CFG_GETADDRINFO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5320             echo "getaddrinfo support cannot be enabled due to functionality tests!"
5321             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5322             echo " If you believe this message is in error you may use the continue"
5323             echo " switch (-continue) to $0 to continue."
5324             exit 101
5325         else
5326             CFG_GETADDRINFO=no
5327         fi
5328     fi
5329 fi
5330
5331 # find if the platform provides inotify
5332 if [ "$CFG_INOTIFY" != "no" ]; then
5333     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/inotify "inotify" $L_FLAGS $I_FLAGS $l_FLAGS; then
5334         CFG_INOTIFY=yes
5335     else
5336         if [ "$CFG_INOTIFY" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5337             echo "inotify support cannot be enabled due to functionality tests!"
5338             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5339             echo " If you believe this message is in error you may use the continue"
5340             echo " switch (-continue) to $0 to continue."
5341             exit 101
5342         else
5343             CFG_INOTIFY=no
5344         fi
5345     fi
5346 fi
5347
5348 # find if the platform provides if_nametoindex (ipv6 interface name support)
5349 if [ "$CFG_IPV6IFNAME" != "no" ]; then
5350     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
5351         CFG_IPV6IFNAME=yes
5352     else
5353         if [ "$CFG_IPV6IFNAME" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5354             echo "IPv6 interface name support cannot be enabled due to functionality tests!"
5355             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5356             echo " If you believe this message is in error you may use the continue"
5357             echo " switch (-continue) to $0 to continue."
5358             exit 101
5359         else
5360             CFG_IPV6IFNAME=no
5361         fi
5362     fi
5363 fi
5364
5365 # find if the platform provides getifaddrs (network interface enumeration)
5366 if [ "$CFG_GETIFADDRS" != "no" ]; then
5367     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getifaddrs "getifaddrs" $L_FLAGS $I_FLAGS $l_FLAGS; then
5368         CFG_GETIFADDRS=yes
5369     else
5370         if [ "$CFG_GETIFADDRS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5371             echo "getifaddrs support cannot be enabled due to functionality tests!"
5372             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5373             echo " If you believe this message is in error you may use the continue"
5374             echo " switch (-continue) to $0 to continue."
5375             exit 101
5376         else
5377             CFG_GETIFADDRS=no
5378         fi
5379     fi
5380 fi
5381
5382 # detect OpenSSL
5383 if [ "$CFG_OPENSSL" != "no" ]; then
5384     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
5385         if [ "$CFG_OPENSSL" = "auto" ]; then
5386             CFG_OPENSSL=yes
5387         fi
5388     else
5389         if ( [ "$CFG_OPENSSL" = "yes" ] || [ "$CFG_OPENSSL" = "linked" ] ) && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5390             echo "OpenSSL support cannot be enabled due to functionality tests!"
5391             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5392             echo " If you believe this message is in error you may use the continue"
5393             echo " switch (-continue) to $0 to continue."
5394             exit 101
5395         else
5396             CFG_OPENSSL=no
5397         fi
5398     fi
5399 fi
5400
5401 # detect PCRE
5402 if [ "$CFG_PCRE" != "qt" ]; then
5403     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/pcre "PCRE" $L_FLAGS $I_FLAGS $l_FLAGS; then
5404         CFG_PCRE=system
5405     else
5406         if [ "$CFG_PCRE" = "system" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5407             echo "PCRE support cannot be enabled due to functionality tests!"
5408             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5409             echo " If you believe this message is in error you may use the continue"
5410             echo " switch (-continue) to $0 to continue."
5411             exit 101
5412         else
5413             CFG_PCRE=qt
5414         fi
5415     fi
5416 fi
5417
5418 # detect OpenVG support
5419 if [ "$CFG_OPENVG" != "no" ]; then
5420     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
5421         if [ "$CFG_OPENVG" = "auto" ]; then
5422             CFG_OPENVG=yes
5423         fi
5424     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
5425         if [ "$CFG_OPENVG" = "auto" ]; then
5426             CFG_OPENVG=yes
5427         fi
5428         CFG_OPENVG_ON_OPENGL=yes
5429     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
5430         if [ "$CFG_OPENVG" = "auto" ]; then
5431             CFG_OPENVG=yes
5432         fi
5433         CFG_OPENVG_LC_INCLUDES=yes
5434     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
5435         if [ "$CFG_OPENVG" = "auto" ]; then
5436             CFG_OPENVG=yes
5437         fi
5438         CFG_OPENVG_LC_INCLUDES=yes
5439         CFG_OPENVG_ON_OPENGL=yes
5440     else
5441         if [ "$CFG_OPENVG" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5442             echo "$CFG_OPENVG was specified for OpenVG but cannot be enabled due to functionality tests!"
5443             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5444             echo " If you believe this message is in error you may use the continue"
5445             echo " switch (-continue) to $0 to continue."
5446             exit 101
5447         else
5448             CFG_OPENVG=no
5449         fi
5450     fi
5451     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
5452         CFG_OPENVG_SHIVA=yes
5453     fi
5454 fi
5455
5456 if [ "$CFG_ALSA" = "auto" ]; then
5457     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/alsa "alsa" $L_FLAGS $I_FLAGS $l_FLAGS; then
5458         CFG_ALSA=yes
5459     else
5460         CFG_ALSA=no
5461     fi
5462 fi
5463
5464 if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ] || [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then 
5465     if [ "$CFG_ARCH" = "arm" ]; then
5466        "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/javascriptcore-jit "javascriptcore-jit" $L_FLAGS $I_FLAGS $l_FLAGS
5467         if [ $? != "0" ]; then
5468            CFG_JAVASCRIPTCORE_JIT=no
5469         fi
5470     else
5471         case "$XPLATFORM" in
5472             linux-icc*)
5473                 CFG_JAVASCRIPTCORE_JIT=no
5474                 ;;
5475         esac
5476     fi
5477 fi
5478
5479 if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ]; then
5480     QMakeVar set JAVASCRIPTCORE_JIT yes
5481 elif [ "$CFG_JAVASCRIPTCORE_JIT" = "no" ]; then
5482     QMakeVar set JAVASCRIPTCORE_JIT no
5483 fi
5484
5485 if [ "$CFG_AUDIO_BACKEND" = "auto" ]; then
5486     CFG_AUDIO_BACKEND=yes
5487 fi
5488
5489 if [ "$CFG_LARGEFILE" != "yes" ] && [ "$XPLATFORM_MINGW" = "yes" ]; then
5490     echo "Warning: largefile support cannot be disabled for win32."
5491     CFG_LARGEFILE="yes"
5492 fi
5493
5494 #-------------------------------------------------------------------------------
5495 # ask for all that hasn't been auto-detected or specified in the arguments
5496 #-------------------------------------------------------------------------------
5497
5498 # enable dwarf2 support on Mac
5499 if [ "$CFG_MAC_DWARF2" = "yes" ]; then
5500     QT_CONFIG="$QT_CONFIG dwarf2"
5501 fi
5502
5503 # Detect the default arch (x86 or x86_64) on Mac OS X
5504 if [ "$BUILD_ON_MAC" = "yes" ] && [ "$QT_CROSS_COMPILE" = "no" ]; then
5505     DEFAULT_ARCH=
5506     case `file "${outpath}/bin/qmake"` in
5507     *i?86)
5508         DEFAULT_ARCH=x86
5509         ;;
5510     *x86_64)
5511         DEFAULT_ARCH=x86_64
5512         ;;
5513     *ppc|*ppc64|*)
5514         # unsupported/unknown
5515         ;;
5516     esac
5517
5518     if [ -n "$DEFAULT_ARCH" ]; then
5519         [ "$OPT_VERBOSE" = "yes" ] && echo "Setting default Mac OS X architechture to $DEFAULT_ARCH."
5520         QT_CONFIG="$QT_CONFIG $DEFAULT_ARCH"
5521         QMAKE_CONFIG="$QMAKE_CONFIG $DEFAULT_ARCH"
5522         # Make the application arch follow the Qt arch
5523         QTCONFIG_CONFIG="$QTCONFIG_CONFIG $DEFAULT_ARCH"
5524     fi
5525 fi
5526
5527 # ### Vestige
5528 if [ "$CFG_PHONON_BACKEND" = "yes" ]; then
5529     QT_CONFIG="$QT_CONFIG phonon-backend"
5530 fi
5531
5532 # disable accessibility
5533 if [ "$CFG_ACCESSIBILITY" = "no" ]; then
5534     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ACCESSIBILITY"
5535 else
5536     QT_CONFIG="$QT_CONFIG accessibility"
5537 fi
5538
5539 # enable egl
5540 if [ "$CFG_EGL" = "yes" ]; then
5541     QT_CONFIG="$QT_CONFIG egl"
5542 else
5543     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGL"
5544 fi
5545
5546 # enable eglfs
5547 if [ "$CFG_EGLFS" = "yes" ]; then
5548     QT_CONFIG="$QT_CONFIG eglfs"
5549 else
5550     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGLFS"
5551 fi
5552
5553 # enable openvg
5554 if [ "$CFG_OPENVG" = "no" ]; then
5555     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENVG"
5556 else
5557     QT_CONFIG="$QT_CONFIG openvg"
5558     if [ "$CFG_OPENVG_LC_INCLUDES" = "yes" ]; then
5559         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LOWER_CASE_VG_INCLUDES"
5560     fi
5561     if [ "$CFG_OPENVG_ON_OPENGL" = "yes" ]; then
5562         QT_CONFIG="$QT_CONFIG openvg_on_opengl"
5563     fi
5564     if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
5565         QT_CONFIG="$QT_CONFIG shivavg"
5566         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SHIVAVG"
5567     fi
5568 fi
5569
5570 # enable opengl
5571 if [ "$CFG_OPENGL" = "no" ]; then
5572     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENGL"
5573 else
5574     QT_CONFIG="$QT_CONFIG opengl"
5575 fi
5576
5577 if [ "$CFG_OPENGL" = "es2" ]; then
5578     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES"
5579 fi
5580
5581 if [ "$CFG_OPENGL" = "es2" ]; then
5582     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_2"
5583     QT_CONFIG="$QT_CONFIG opengles2"
5584 fi
5585
5586 # safe execution environment
5587 if [ "$CFG_SXE" != "no" ]; then
5588     QT_CONFIG="$QT_CONFIG sxe"
5589 fi
5590
5591 # build up the variables for output
5592 if [ "$CFG_DEBUG" = "yes" ]; then
5593     QMAKE_OUTDIR="${QMAKE_OUTDIR}debug"
5594     QMAKE_CONFIG="$QMAKE_CONFIG debug"
5595 elif [ "$CFG_DEBUG" = "no" ]; then
5596     QMAKE_OUTDIR="${QMAKE_OUTDIR}release"
5597     QMAKE_CONFIG="$QMAKE_CONFIG release"
5598 fi
5599 if [ "$CFG_SHARED" = "yes" ]; then
5600     QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared"
5601     QMAKE_CONFIG="$QMAKE_CONFIG shared dll"
5602 elif [ "$CFG_SHARED" = "no" ]; then
5603     QMAKE_OUTDIR="${QMAKE_OUTDIR}-static"
5604     QMAKE_CONFIG="$QMAKE_CONFIG static"
5605 fi
5606 if [ "$PLATFORM_QPA" = "yes" ]; then
5607     QMAKE_CONFIG="$QMAKE_CONFIG qpa"
5608     QT_CONFIG="$QT_CONFIG qpa"
5609     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qpa"
5610     rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
5611 fi
5612
5613 if [ "$XPLATFORM_MINGW" != "yes" ]; then
5614     # Do not set this here for Windows. Let qmake do it so
5615     # debug and release precompiled headers are kept separate.
5616     QMakeVar set PRECOMPILED_DIR ".pch/$QMAKE_OUTDIR"
5617 fi
5618 QMakeVar set OBJECTS_DIR ".obj/$QMAKE_OUTDIR"
5619 QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR"
5620 QMakeVar set RCC_DIR ".rcc/$QMAKE_OUTDIR"
5621 QMakeVar set UI_DIR ".uic/$QMAKE_OUTDIR"
5622 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
5623     QMAKE_CONFIG="$QMAKE_CONFIG largefile"
5624 fi
5625 if [ "$CFG_STL" = "no" ]; then
5626     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STL"
5627 else
5628     QMAKE_CONFIG="$QMAKE_CONFIG stl"
5629 fi
5630 if [ "$CFG_USE_GNUMAKE" = "yes" ]; then
5631     QMAKE_CONFIG="$QMAKE_CONFIG GNUmake"
5632 fi
5633 [ "$CFG_REDUCE_EXPORTS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_exports"
5634 [ "$CFG_REDUCE_RELOCATIONS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_relocations"
5635 [ "$CFG_PRECOMPILE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG precompile_header"
5636 if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
5637     QMakeVar add QMAKE_CFLAGS -g
5638     QMakeVar add QMAKE_CXXFLAGS -g
5639     QT_CONFIG="$QT_CONFIG separate_debug_info"
5640 fi
5641 if [ "$CFG_SEPARATE_DEBUG_INFO_NOCOPY" = "yes" ] ; then
5642     QT_CONFIG="$QT_CONFIG separate_debug_info_nocopy"
5643 fi
5644 [ "$CFG_MMX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mmx"
5645 [ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow"
5646 [ "$CFG_SSE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse"
5647 [ "$CFG_SSE2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse2"
5648 [ "$CFG_SSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse3"
5649 [ "$CFG_SSSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG ssse3"
5650 [ "$CFG_SSE4_1" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_1"
5651 [ "$CFG_SSE4_2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_2"
5652 [ "$CFG_AVX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG avx"
5653 [ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt"
5654 [ "$CFG_NEON" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG neon"
5655 if [ "$CFG_ARCH" = "mips" ]; then
5656     [ "$CFG_MIPS_DSP" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mips_dsp"
5657     [ "$CFG_MIPS_DSPR2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mips_dspr2"
5658 fi
5659 if [ "$CFG_CLOCK_GETTIME" = "yes" ]; then
5660     QT_CONFIG="$QT_CONFIG clock-gettime"
5661 fi
5662 if [ "$CFG_CLOCK_MONOTONIC" = "yes" ]; then
5663     QT_CONFIG="$QT_CONFIG clock-monotonic"
5664 fi
5665 if [ "$CFG_MREMAP" = "yes" ]; then
5666     QT_CONFIG="$QT_CONFIG mremap"
5667 fi
5668 if [ "$CFG_GETADDRINFO" = "yes" ]; then
5669     QT_CONFIG="$QT_CONFIG getaddrinfo"
5670 fi
5671 if [ "$CFG_IPV6IFNAME" = "yes" ]; then
5672     QT_CONFIG="$QT_CONFIG ipv6ifname"
5673 fi
5674 if [ "$CFG_GETIFADDRS" = "yes" ]; then
5675     QT_CONFIG="$QT_CONFIG getifaddrs"
5676 fi
5677 if [ "$CFG_INOTIFY" = "yes" ]; then
5678     QT_CONFIG="$QT_CONFIG inotify"
5679 fi
5680 if [ "$CFG_LIBJPEG" = "no" ]; then
5681     CFG_JPEG="no"
5682 elif [ "$CFG_LIBJPEG" = "system" ]; then
5683     QT_CONFIG="$QT_CONFIG system-jpeg"
5684 fi
5685 if [ "$CFG_JPEG" = "no" ]; then
5686     QT_CONFIG="$QT_CONFIG no-jpeg"
5687 elif [ "$CFG_JPEG" = "yes" ]; then
5688     QT_CONFIG="$QT_CONFIG jpeg"
5689 fi
5690 if [ "$CFG_LIBPNG" = "no" ]; then
5691     CFG_PNG="no"
5692 fi
5693 if [ "$CFG_LIBPNG" = "system" ]; then
5694     QT_CONFIG="$QT_CONFIG system-png"
5695 fi
5696 if [ "$CFG_PNG" = "no" ]; then
5697     QT_CONFIG="$QT_CONFIG no-png"
5698 elif [ "$CFG_PNG" = "yes" ]; then
5699     QT_CONFIG="$QT_CONFIG png"
5700 fi
5701 if [ "$CFG_GIF" = "no" ]; then
5702     QT_CONFIG="$QT_CONFIG no-gif"
5703 elif [ "$CFG_GIF" = "yes" ]; then
5704     QT_CONFIG="$QT_CONFIG gif"
5705 fi
5706 if [ "$CFG_LIBFREETYPE" = "no" ]; then
5707     QT_CONFIG="$QT_CONFIG no-freetype"
5708     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FREETYPE"
5709 elif [ "$CFG_LIBFREETYPE" = "system" ]; then
5710     QT_CONFIG="$QT_CONFIG system-freetype"
5711 else
5712     QT_CONFIG="$QT_CONFIG freetype"
5713 fi
5714 if [ "$CFG_GUI" = "auto" ]; then
5715     CFG_GUI="yes"
5716 fi
5717 if [ "$CFG_GUI" = "no" ]; then
5718     QT_CONFIG="$QT_CONFIG no-gui"
5719     CFG_WIDGETS="no"
5720 fi
5721 if [ "$CFG_WIDGETS" = "no" ]; then
5722     QT_CONFIG="$QT_CONFIG no-widgets"
5723     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_WIDGETS"
5724 fi
5725
5726 if [ "x$BUILD_ON_MAC" = "xyes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
5727     #On Mac we implicitly link against libz, so we
5728     #never use the 3rdparty stuff.
5729     [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system"
5730 fi
5731 if [ "$CFG_ZLIB" = "yes" ]; then
5732     QT_CONFIG="$QT_CONFIG zlib"
5733 elif [ "$CFG_ZLIB" = "system" ]; then
5734     QT_CONFIG="$QT_CONFIG system-zlib"
5735 fi
5736
5737 [ "$CFG_NIS" = "yes" ] && QT_CONFIG="$QT_CONFIG nis"
5738 [ "$CFG_CUPS" = "yes" ] && QT_CONFIG="$QT_CONFIG cups"
5739 [ "$CFG_ICONV" = "yes" ] && QT_CONFIG="$QT_CONFIG iconv"
5740 [ "$CFG_ICONV" = "sun" ] && QT_CONFIG="$QT_CONFIG sun-libiconv"
5741 [ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv"
5742 [ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib"
5743 [ "$CFG_GSTREAMER" = "yes" ] && QT_CONFIG="$QT_CONFIG gstreamer"
5744 [ "$CFG_DBUS" = "yes" ] && QT_CONFIG="$QT_CONFIG dbus"
5745 [ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus dbus-linked"
5746 [ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl"
5747 [ "$CFG_OPENSSL" = "linked" ] && QT_CONFIG="$QT_CONFIG openssl-linked"
5748 [ "$CFG_MAC_HARFBUZZ" = "yes" ] && QT_CONFIG="$QT_CONFIG harfbuzz"
5749 [ "$CFG_XCB" = "yes" ] && QT_CONFIG="$QT_CONFIG xcb"
5750 [ "$CFG_XINPUT2" = "yes" ] && QT_CONFIG="$QT_CONFIG xinput2"
5751
5752 if [ "$PLATFORM_X11" = "yes" ]; then
5753     [ "$CFG_SM" = "yes" ] && QT_CONFIG="$QT_CONFIG x11sm"
5754
5755     # for some reason, the following libraries are not always built shared,
5756     # so *every* program/lib (including Qt) has to link against them
5757     if [ "$CFG_XSHAPE" = "yes" ]; then
5758         QT_CONFIG="$QT_CONFIG xshape"
5759     fi
5760     if [ "$CFG_XVIDEO" = "yes" ]; then
5761         QT_CONFIG="$QT_CONFIG xvideo"
5762     fi
5763     if [ "$CFG_XSYNC" = "yes" ]; then
5764         QT_CONFIG="$QT_CONFIG xsync"
5765     fi
5766     if [ "$CFG_XINERAMA" = "yes" ]; then
5767         QT_CONFIG="$QT_CONFIG xinerama"
5768         QMakeVar set QMAKE_LIBS_X11 '-lXinerama $$QMAKE_LIBS_X11'
5769     fi
5770     if [ "$CFG_XCURSOR" = "yes" ]; then
5771         QT_CONFIG="$QT_CONFIG xcursor"
5772         QMakeVar set QMAKE_LIBS_X11 '-lXcursor $$QMAKE_LIBS_X11'
5773     fi
5774     if [ "$CFG_XFIXES" = "yes" ]; then
5775         QT_CONFIG="$QT_CONFIG xfixes"
5776         QMakeVar set QMAKE_LIBS_X11 '-lXfixes $$QMAKE_LIBS_X11'
5777     fi
5778     if [ "$CFG_XRANDR" = "yes" ]; then
5779         QT_CONFIG="$QT_CONFIG xrandr"
5780         if [ "$CFG_XRENDER" != "yes" ]; then
5781             # libXrandr uses 1 function from libXrender, so we always have to have it :/
5782             QMakeVar set QMAKE_LIBS_X11 '-lXrandr -lXrender $$QMAKE_LIBS_X11'
5783         else
5784             QMakeVar set QMAKE_LIBS_X11 '-lXrandr $$QMAKE_LIBS_X11'
5785         fi
5786     fi
5787     if [ "$CFG_XRENDER" = "yes" ]; then
5788         QT_CONFIG="$QT_CONFIG xrender"
5789         QMakeVar set QMAKE_LIBS_X11 '-lXrender $$QMAKE_LIBS_X11'
5790     fi
5791     if [ "$CFG_MITSHM" = "yes" ]; then
5792         QT_CONFIG="$QT_CONFIG mitshm"
5793     fi
5794     if [ "$CFG_FONTCONFIG" = "yes" ]; then
5795         QT_CONFIG="$QT_CONFIG fontconfig"
5796     fi
5797     if [ "$CFG_XINPUT" = "yes" ]; then
5798         QMakeVar set QMAKE_LIBS_X11 '-lXi $$QMAKE_LIBS_X11'
5799     fi
5800     if [ "$CFG_XINPUT" = "yes" ]; then
5801         QT_CONFIG="$QT_CONFIG xinput tablet"
5802     fi
5803     if [ "$CFG_XKB" = "yes" ]; then
5804         QT_CONFIG="$QT_CONFIG xkb"
5805     fi
5806 fi
5807
5808 [ '!' -z "$D_FLAGS" ] && QMakeVar add DEFINES "$D_FLAGS"
5809 [ '!' -z "$L_FLAGS" ] && QMakeVar add QMAKE_LIBDIR_FLAGS "$L_FLAGS"
5810 [ '!' -z "$l_FLAGS" ] && QMakeVar add LIBS "$l_FLAGS"
5811
5812 if [ "$PLATFORM_MAC" = "yes" ] && [ "$QT_CROSS_COMPILE" = "no" ]; then
5813     if [ "$CFG_RPATH" = "yes" ]; then
5814        QMAKE_CONFIG="$QMAKE_CONFIG absolute_library_soname"
5815        # set the default rpath to the library installation directory
5816        RPATH_FLAGS="\"$QT_INSTALL_LIBS\" $RPATH_FLAGS"
5817     fi
5818 elif [ -z "`getXQMakeConf 'QMAKE_(LFLAGS_)?RPATH'`" ]; then
5819     if [ -n "$RPATH_FLAGS" ]; then
5820         echo
5821         echo "ERROR: -R cannot be used on this platform as \$QMAKE_LFLAGS_RPATH is"
5822         echo "       undefined."
5823         echo
5824         exit 1
5825     elif [ "$CFG_RPATH" = "yes" ]; then
5826         RPATH_MESSAGE="        NOTE: This platform does not support runtime library paths, using -no-rpath."
5827         CFG_RPATH=no
5828     fi
5829 else
5830     if [ "$CFG_RPATH" = "yes" ]; then
5831         # set the default rpath to the library installation directory
5832         RPATH_FLAGS="\"$QT_INSTALL_LIBS\" $RPATH_FLAGS"
5833     fi
5834     if [ -n "$RPATH_FLAGS" ]; then
5835         # add the user defined rpaths
5836         QMakeVar add QMAKE_RPATHDIR "$RPATH_FLAGS"
5837     fi
5838 fi
5839
5840 if [ '!' -z "$I_FLAGS" ]; then
5841     # add the user define include paths
5842     QMakeVar add QMAKE_CFLAGS "$I_FLAGS"
5843     QMakeVar add QMAKE_CXXFLAGS "$I_FLAGS"
5844 fi
5845
5846 if [ '!' -z "$W_FLAGS" ]; then
5847     # add the user defined warning flags
5848     QMakeVar add QMAKE_CFLAGS_WARN_ON "$W_FLAGS"
5849     QMakeVar add QMAKE_CXXFLAGS_WARN_ON "$W_FLAGS"
5850     QMakeVar add QMAKE_OBJECTIVE_CFLAGS_WARN_ON "$W_FLAGS"
5851 fi
5852
5853 # turn off exceptions for the compilers that support it
5854 if [ "$XPLATFORM" != "$PLATFORM" ]; then
5855     COMPILER=`echo $XPLATFORM | cut -f 2- -d-`
5856 else
5857     COMPILER=`echo $PLATFORM | cut -f 2- -d-`
5858 fi
5859
5860 if [ "$CFG_EXCEPTIONS" != "no" ]; then
5861     QTCONFIG_CONFIG="$QTCONFIG_CONFIG exceptions"
5862 fi
5863
5864 if [ "$XPLATFORM_MINGW" = "yes" ]; then
5865     # mkspecs/features/win32/default_pre.prf sets "no-rtti".
5866     # Follow default behavior of configure.exe by overriding with "rtti".
5867     QTCONFIG_CONFIG="$QTCONFIG_CONFIG rtti"
5868 fi
5869
5870 if [ "$CFG_ALSA" = "yes" ]; then
5871     QT_CONFIG="$QT_CONFIG alsa"
5872 fi
5873
5874 if [ "$CFG_PULSEAUDIO" = "yes" ]; then
5875     QT_CONFIG="$QT_CONFIG pulseaudio"
5876 fi
5877
5878 if [ "$CFG_COREWLAN" = "yes" ]; then
5879     QT_CONFIG="$QT_CONFIG corewlan"
5880 fi
5881
5882 if [ "$CFG_ICU" = "yes" ]; then
5883     QT_CONFIG="$QT_CONFIG icu"
5884 fi
5885
5886 if [ "$CFG_FORCE_ASSERTS" = "yes" ]; then
5887     QT_CONFIG="$QT_CONFIG force_asserts"
5888 fi
5889
5890 if [ "$CFG_PCRE" = "qt" ]; then
5891     QMAKE_CONFIG="$QMAKE_CONFIG pcre"
5892 fi
5893
5894 #
5895 # Some Qt modules are too advanced in C++ for some old compilers
5896 # Detect here the platforms where they are known to work.
5897 #
5898 # See Qt documentation for more information on which features are
5899 # supported and on which compilers.
5900 #
5901 canBuildQtConcurrent="yes"
5902 canUseV8Snapshot="yes"
5903
5904 case "$XPLATFORM" in
5905     hpux-g++*)
5906         # PA-RISC's assembly is too limited
5907         # gcc 3.4 on that platform can't build QtXmlPatterns
5908         # the assembly it generates cannot be compiled
5909
5910         # Check gcc's version
5911         case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
5912             4*)
5913                 ;;
5914             3.4*)
5915                 canBuildQtXmlPatterns="no"
5916                 ;;
5917             *)
5918                 canBuildWebKit="no"
5919                 canBuildQtXmlPatterns="no"
5920                 ;;
5921         esac
5922         ;;
5923     unsupported/vxworks-*-g++*)
5924         canBuildWebKit="no"
5925         ;;
5926     unsupported/vxworks-*-dcc*)
5927         canBuildWebKit="no"
5928         canBuildQtXmlPatterns="no"
5929         ;;
5930     *-g++*)
5931         # Check gcc's version
5932         case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
5933             4*|3.4*)
5934                 ;;
5935             3.3*)
5936                 canBuildWebKit="no"
5937                 ;;
5938             *)
5939                 canBuildWebKit="no"
5940                 canBuildQtXmlPatterns="no"
5941                 ;;
5942         esac
5943         ;;
5944     solaris-cc*)
5945         # Check the compiler version
5946         case `${QMAKE_CONF_COMPILER} -V 2>&1 | awk '{print $4}'` in
5947             5.[012345678])
5948                 canBuildWebKit="no"
5949                 canBuildQtXmlPatterns="no"
5950                 canBuildQtConcurrent="no"
5951                 ;;
5952             5.*)
5953                 canBuildWebKit="no"
5954                 canBuildQtConcurrent="no"
5955                 ;;
5956         esac
5957         ;;
5958     hpux-acc*)
5959         canBuildWebKit="no"
5960         canBuildQtXmlPatterns="no"
5961         canBuildQtConcurrent="no"
5962         ;;
5963     hpuxi-acc*)
5964         canBuildWebKit="no"
5965         ;;
5966     aix-xlc*)
5967         # Get the xlC version
5968         cat > xlcver.c <<EOF
5969 #include <stdio.h>
5970 int main()
5971 {
5972     printf("%d.%d\n", __xlC__ >> 8, __xlC__ & 0xFF);
5973     return 0;
5974 }
5975 EOF
5976         xlcver=
5977         if ${QMAKE_CONF_COMPILER} -o xlcver xlcver.c >/dev/null 2>/dev/null; then
5978             xlcver=`./xlcver 2>/dev/null`
5979             rm -f ./xlcver
5980         fi
5981         if [ "$OPT_VERBOSE" = "yes" ]; then
5982             if [ -n "$xlcver" ]; then
5983                 echo Found IBM xlC version: $xlcver.
5984             else
5985                 echo Could not determine IBM xlC version, assuming oldest supported.
5986             fi
5987         fi
5988
5989         case "$xlcver" in
5990             [123456].*)
5991                 canBuildWebKit="no"
5992                 canBuildQtXmlPatterns="no"
5993                 canBuildQtConcurrent="no"
5994                 ;;
5995             *)
5996                 canBuildWebKit="no"
5997                 canBuildQtConcurrent="no"
5998                 ;;
5999         esac
6000         ;;
6001     irix-cc*)
6002         canBuildWebKit="no"
6003         canBuildQtConcurrent="no"
6004         ;;
6005 esac
6006
6007 if [ "$CFG_GUI" = "no" ]; then
6008     # WebKit requires QtGui
6009     canBuildWebKit="no"
6010 fi
6011
6012 if [ "$CFG_SHARED" = "no" ]; then
6013     echo
6014     echo "WARNING: Using static linking will disable the WebKit module."
6015     echo
6016     canBuildWebKit="no"
6017 fi
6018
6019 CFG_CONCURRENT="yes"
6020 if [ "$canBuildQtConcurrent" = "no" ]; then
6021     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT"
6022     CFG_CONCURRENT="no"
6023 else
6024     QT_CONFIG="$QT_CONFIG concurrent"
6025 fi
6026
6027 # ### Vestige
6028 if [ "$CFG_AUDIO_BACKEND" = "yes" ]; then
6029     QT_CONFIG="$QT_CONFIG audio-backend"
6030 fi
6031
6032 # ### Vestige
6033 if [ "$CFG_WEBKIT" = "debug" ]; then
6034     QMAKE_CONFIG="$QMAKE_CONFIG webkit-debug"
6035 fi
6036
6037 # ### Vestige
6038 QT_CONFIG="$QT_CONFIG v8"
6039 # Detect snapshot support
6040 if [ "$CFG_ARCH" != "$CFG_HOST_ARCH" ]; then
6041     case "$CFG_HOST_ARCH,$CFG_ARCH" in
6042         i386,arm)
6043         ;;
6044     *) canUseV8Snapshot="no"
6045         ;;
6046     esac
6047 else
6048     if [ -n "$_SBOX_DIR" -a "$CFG_ARCH" = "arm" ]; then
6049         # QEMU crashes when building inside Scratchbox with an ARM target
6050         canUseV8Snapshot="no"
6051     fi
6052 fi
6053 if [ "$CFG_V8SNAPSHOT" = "auto" ]; then
6054     CFG_V8SNAPSHOT="$canUseV8Snapshot"
6055 fi
6056 if [ "$CFG_V8SNAPSHOT" = "yes" -a "$canUseV8Snapshot" = "no" ]; then
6057     echo "Error: V8 snapshot was requested, but is not supported on this platform."
6058     exit 1
6059 fi
6060 if [ "$CFG_V8SNAPSHOT" = "yes" ]; then
6061     QT_CONFIG="$QT_CONFIG v8snapshot"
6062 fi
6063
6064 # ### Vestige
6065 if [ "$CFG_DECLARATIVE_DEBUG" = "no" ]; then
6066     QCONFIG_FLAGS="$QCONFIG_FLAGS QDECLARATIVE_NO_DEBUG_PROTOCOL"
6067 fi
6068
6069 if [ "$CFG_EXCEPTIONS" = "no" ]; then
6070     case "$COMPILER" in
6071     g++*)
6072         QMakeVar add QMAKE_CFLAGS -fno-exceptions
6073         QMakeVar add QMAKE_CXXFLAGS -fno-exceptions
6074         QMakeVar add QMAKE_LFLAGS -fno-exceptions
6075         ;;
6076     cc*)
6077         case "$PLATFORM" in
6078         irix-cc*)
6079             QMakeVar add QMAKE_CFLAGS -LANG:exceptions=off
6080             QMakeVar add QMAKE_CXXFLAGS -LANG:exceptions=off
6081             QMakeVar add QMAKE_LFLAGS -LANG:exceptions=off
6082             ;;
6083         *) ;;
6084         esac
6085         ;;
6086     *) ;;
6087     esac
6088     QMAKE_CONFIG="$QMAKE_CONFIG exceptions_off"
6089 fi
6090
6091 case "$COMPILER" in
6092 g++*)
6093     # GNU C++
6094     COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -dumpversion 2>/dev/null`
6095
6096     case "$COMPILER_VERSION" in
6097     *.*.*)
6098         QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'`
6099         QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'`
6100         QT_GCC_PATCH_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'`
6101         ;;
6102     *.*)
6103         QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\1,'`
6104         QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\2,'`
6105         QT_GCC_PATCH_VERSION=0
6106         ;;
6107     esac
6108
6109     ;;
6110 *)
6111     #
6112     ;;
6113 esac
6114
6115 #-------------------------------------------------------------------------------
6116 # part of configuration information goes into qconfig.h
6117 #-------------------------------------------------------------------------------
6118
6119 case "$CFG_QCONFIG" in
6120 full)
6121     echo "/* Everything */" >"$outpath/src/corelib/global/qconfig.h.new"
6122     ;;
6123 *)
6124     tmpconfig="$outpath/src/corelib/global/qconfig.h.new"
6125     echo "#ifndef QT_BOOTSTRAPPED" >"$tmpconfig"
6126     if [ -f "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" ]; then
6127         cat "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" >>"$tmpconfig"
6128     elif [ -f `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` ]; then
6129         cat `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` >>"$tmpconfig"
6130     fi
6131     echo "#endif" >>"$tmpconfig"
6132     ;;
6133 esac
6134
6135 cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6136
6137 /* Qt Edition */
6138 #ifndef QT_EDITION
6139 #  define QT_EDITION $QT_EDITION
6140 #endif
6141 EOF
6142
6143 echo '/* Compile time features */' >>"$outpath/src/corelib/global/qconfig.h.new"
6144 [ '!' -z "$LicenseKeyExt" ] && echo "#define QT_PRODUCT_LICENSEKEY \"$LicenseKeyExt\"" >>"$outpath/src/corelib/global/qconfig.h.new"
6145
6146 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
6147     echo "#define QT_LARGEFILE_SUPPORT 64" >>"$outpath/src/corelib/global/qconfig.h.new"
6148 fi
6149
6150 if [ "$CFG_FRAMEWORK" = "yes" ]; then
6151     echo "#define QT_MAC_FRAMEWORK_BUILD" >>"$outpath/src/corelib/global/qconfig.h.new"
6152 fi
6153
6154 if [ "$BUILD_ON_MAC" = "yes" ]; then
6155     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6156 #if defined(__LP64__)
6157 # define QT_POINTER_SIZE 8
6158 #else
6159 # define QT_POINTER_SIZE 4
6160 #endif
6161 EOF
6162 else
6163     "$unixtests/ptrsize.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
6164     echo "#define QT_POINTER_SIZE $?" >>"$outpath/src/corelib/global/qconfig.h.new"
6165 fi
6166
6167 #REDUCE_RELOCATIONS is a elf/unix only thing, so not in windows configure.exe
6168 if [ "$CFG_REDUCE_RELOCATIONS" = "yes" ]; then
6169     echo "#define QT_REDUCE_RELOCATIONS" >>"$outpath/src/corelib/global/qconfig.h.new"
6170 fi
6171
6172
6173 echo "" >>"$outpath/src/corelib/global/qconfig.h.new"
6174
6175 if [ "$CFG_DEV" = "yes" ]; then
6176     echo "#define QT_BUILD_INTERNAL" >>"$outpath/src/corelib/global/qconfig.h.new"
6177 fi
6178
6179 if [ "$PLATFORM_QPA" = "yes" ]; then
6180     # Add QPA to config.h
6181     QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QPA QT_NO_QWS_QPF QT_NO_QWS_QPF2"
6182 fi
6183
6184 if [ "${CFG_USE_FLOATMATH}" = "yes" ]; then
6185     QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_USE_MATH_H_FLOATS"
6186 fi
6187
6188 # Add turned on SQL drivers
6189 for DRIVER in $CFG_SQL_AVAILABLE; do
6190     eval "VAL=\$CFG_SQL_$DRIVER"
6191     case "$VAL" in
6192     qt)
6193         ONDRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
6194         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SQL_$ONDRIVER"
6195         SQL_DRIVERS="$SQL_DRIVERS $DRIVER"
6196     ;;
6197     plugin)
6198         SQL_PLUGINS="$SQL_PLUGINS $DRIVER"
6199     ;;
6200     esac
6201 done
6202
6203
6204 QMakeVar set sql-drivers "$SQL_DRIVERS"
6205 QMakeVar set sql-plugins "$SQL_PLUGINS"
6206
6207 # Add other configuration options to the qconfig.h file
6208 [ "$CFG_GIF" = "yes" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_BUILTIN_GIF_READER=1"
6209 [ "$CFG_PNG" != "yes" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_PNG"
6210 [ "$CFG_JPEG" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_JPEG"
6211 [ "$CFG_ZLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ZLIB"
6212 [ "$CFG_EXCEPTIONS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EXCEPTIONS"
6213 [ "$CFG_SXE" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SXE"
6214 [ "$CFG_DBUS" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS"
6215
6216 # X11/Unix/Mac only configs
6217 [ "$CFG_CUPS" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CUPS"
6218 [ "$CFG_ICONV" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ICONV"
6219 [ "$CFG_GLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GLIB"
6220 [ "$CFG_GSTREAMER" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GSTREAMER"
6221 [ "$CFG_QGTKSTYLE" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STYLE_GTK"
6222 [ "$CFG_CLOCK_MONOTONIC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CLOCK_MONOTONIC"
6223 [ "$CFG_MREMAP" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MREMAP"
6224 [ "$CFG_GETADDRINFO" = "no" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETADDRINFO"
6225 [ "$CFG_IPV6IFNAME" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IPV6IFNAME"
6226 [ "$CFG_GETIFADDRS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETIFADDRS"
6227 [ "$CFG_INOTIFY" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_INOTIFY"
6228 [ "$CFG_NIS" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NIS"
6229 [ "$CFG_OPENSSL" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENSSL QT_NO_SSL"
6230 [ "$CFG_OPENSSL" = "linked" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LINKED_OPENSSL"
6231
6232 [ "$CFG_SM" = "no" ]         && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SESSIONMANAGER"
6233 [ "$CFG_XCURSOR" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XCURSOR"
6234 [ "$CFG_XFIXES" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XFIXES"
6235 [ "$CFG_FONTCONFIG" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FONTCONFIG"
6236 [ "$CFG_XINERAMA" = "no" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINERAMA"
6237 [ "$CFG_XKB" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XKB"
6238 [ "$CFG_XRANDR" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRANDR"
6239 [ "$CFG_XRENDER" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRENDER"
6240 [ "$CFG_MITSHM" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MITSHM"
6241 [ "$CFG_XSHAPE" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SHAPE"
6242 [ "$CFG_XVIDEO" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XVIDEO"
6243 [ "$CFG_XSYNC" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XSYNC"
6244 [ "$CFG_XINPUT" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINPUT QT_NO_TABLET"
6245
6246 [ "$CFG_XCURSOR" = "runtime" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XCURSOR"
6247 [ "$CFG_XINERAMA" = "runtime" ]  && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINERAMA"
6248 [ "$CFG_XFIXES" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XFIXES"
6249 [ "$CFG_XRANDR" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XRANDR"
6250 [ "$CFG_XINPUT" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINPUT"
6251 [ "$CFG_ALSA" = "no" ]           && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ALSA"
6252 [ "$CFG_PULSEAUDIO" = "no" ]          && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_PULSEAUDIO"
6253 [ "$CFG_COREWLAN" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_COREWLAN"
6254
6255 # sort QCONFIG_FLAGS for neatness if we can
6256 [ '!' -z "$AWK" ] && QCONFIG_FLAGS=`echo $QCONFIG_FLAGS | $AWK '{ gsub(" ", "\n"); print }' | sort | uniq`
6257 QCONFIG_FLAGS=`echo $QCONFIG_FLAGS`
6258
6259 if [ -n "$QCONFIG_FLAGS" ]; then
6260 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6261 #ifndef QT_BOOTSTRAPPED
6262
6263 EOF
6264     for cfg in $QCONFIG_FLAGS; do
6265         cfgd=`echo $cfg | sed 's/=.*$//'` # trim pushed 'Foo=Bar' defines
6266         cfg=`echo $cfg | sed 's/=/ /'`    # turn first '=' into a space
6267         # figure out define logic, so we can output the correct
6268         # ifdefs to override the global defines in a project
6269         cfgdNeg=
6270         if [ true ] && echo "$cfgd" | grep 'QT_NO_' >/dev/null 2>&1; then
6271             # QT_NO_option can be forcefully turned on by QT_option
6272             cfgdNeg=`echo $cfgd | sed "s,QT_NO_,QT_,"`
6273         elif [ true ] && echo "$cfgd" | grep 'QT_' >/dev/null 2>&1; then
6274             # QT_option can be forcefully turned off by QT_NO_option
6275             cfgdNeg=`echo $cfgd | sed "s,QT_,QT_NO_,"`
6276         fi
6277
6278         if [ -z $cfgdNeg ]; then
6279 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6280 #ifndef $cfgd
6281 # define $cfg
6282 #endif
6283
6284 EOF
6285         else
6286 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6287 #if defined($cfgd) && defined($cfgdNeg)
6288 # undef $cfgd
6289 #elif !defined($cfgd) && !defined($cfgdNeg)
6290 # define $cfg
6291 #endif
6292
6293 EOF
6294         fi
6295     done
6296 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6297 #endif // QT_BOOTSTRAPPED
6298
6299 EOF
6300 fi
6301
6302 if [ "$CFG_REDUCE_EXPORTS" = "yes" ]; then
6303 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6304 #define QT_VISIBILITY_AVAILABLE
6305
6306 EOF
6307 fi
6308
6309 if [ -n "$QT_LIBINFIX" ]; then
6310 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6311 #define QT_LIBINFIX "$QT_LIBINFIX"
6312
6313 EOF
6314 fi
6315
6316 # avoid unecessary rebuilds by copying only if qconfig.h has changed
6317 if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then
6318     rm -f "$outpath/src/corelib/global/qconfig.h.new"
6319 else
6320     [ -f "$outpath/src/corelib/global/qconfig.h" ] && chmod +w "$outpath/src/corelib/global/qconfig.h"
6321     mv "$outpath/src/corelib/global/qconfig.h.new" "$outpath/src/corelib/global/qconfig.h"
6322     chmod -w "$outpath/src/corelib/global/qconfig.h"
6323     if [ ! -f "$outpath/include/QtCore/qconfig.h" ]; then
6324         ln -s "$outpath/src/corelib/global/qconfig.h" "$outpath/include/QtCore/qconfig.h"
6325     fi
6326 fi
6327
6328 #-------------------------------------------------------------------------------
6329 # save configuration into qconfig.pri
6330 #-------------------------------------------------------------------------------
6331 QTCONFIG="$outpath/mkspecs/qconfig.pri"
6332 QTCONFIG_CONFIG="$QTCONFIG_CONFIG no_mocdepend"
6333 [ -f "$QTCONFIG.tmp" ] && rm -f "$QTCONFIG.tmp"
6334 if [ "$CFG_DEBUG" = "yes" ]; then
6335     QTCONFIG_CONFIG="$QTCONFIG_CONFIG debug"
6336     if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
6337         QT_CONFIG="$QT_CONFIG release"
6338     fi
6339     QT_CONFIG="$QT_CONFIG debug"
6340 elif [ "$CFG_DEBUG" = "no" ]; then
6341     QTCONFIG_CONFIG="$QTCONFIG_CONFIG release"
6342     if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
6343         QT_CONFIG="$QT_CONFIG debug"
6344     fi
6345     QT_CONFIG="$QT_CONFIG release"
6346 fi
6347 if [ "$CFG_STL" = "yes" ]; then
6348     QTCONFIG_CONFIG="$QTCONFIG_CONFIG stl"
6349 fi
6350 if [ "$CFG_FRAMEWORK" = "no" ]; then
6351     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_no_framework"
6352 else
6353     QT_CONFIG="$QT_CONFIG qt_framework"
6354     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_framework"
6355 fi
6356 if [ "$CFG_DEV" = "yes" ]; then
6357     QT_CONFIG="$QT_CONFIG private_tests"
6358 fi
6359
6360 cat >>"$QTCONFIG.tmp" <<EOF
6361 #configuration
6362 CONFIG += $QTCONFIG_CONFIG
6363 QT_ARCH = $CFG_ARCH
6364 QT_HOST_ARCH = $CFG_HOST_ARCH
6365 QT_EDITION = $Edition
6366 QT_CONFIG += $QT_CONFIG
6367
6368 #versioning
6369 QT_VERSION = $QT_VERSION
6370 QT_MAJOR_VERSION = $QT_MAJOR_VERSION
6371 QT_MINOR_VERSION = $QT_MINOR_VERSION
6372 QT_PATCH_VERSION = $QT_PATCH_VERSION
6373
6374 #namespaces
6375 QT_LIBINFIX = $QT_LIBINFIX
6376 QT_NAMESPACE = $QT_NAMESPACE
6377
6378 EOF
6379 if [ -n "$CFG_SYSROOT" ]; then
6380     echo "# sysroot" >>"$QTCONFIG.tmp"
6381     echo `basename "$XQMAKESPEC"` \{ >>"$QTCONFIG.tmp"
6382     echo "    QMAKE_CFLAGS    += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
6383     echo "    QMAKE_CXXFLAGS  += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
6384     echo "    QMAKE_LFLAGS    += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
6385     echo "}" >> "$QTCONFIG.tmp"
6386     echo >> "$QTCONFIG.tmp"
6387 fi
6388 if [ -n "$RPATH_FLAGS" ]; then
6389     echo "QMAKE_RPATHDIR += $RPATH_FLAGS" >> "$QTCONFIG.tmp"
6390 fi
6391 if [ -n "$QT_GCC_MAJOR_VERSION" ]; then
6392     echo "QT_GCC_MAJOR_VERSION = $QT_GCC_MAJOR_VERSION" >> "$QTCONFIG.tmp"
6393     echo "QT_GCC_MINOR_VERSION = $QT_GCC_MINOR_VERSION" >> "$QTCONFIG.tmp"
6394     echo "QT_GCC_PATCH_VERSION = $QT_GCC_PATCH_VERSION" >> "$QTCONFIG.tmp"
6395 fi
6396
6397 if [ -n "$QMAKE_INCDIR_OPENGL_ES2" ]; then
6398     echo "#Qt opengl include path" >> "$QTCONFIG.tmp"
6399     echo "QMAKE_INCDIR_OPENGL_ES2 = \"$QMAKE_INCDIR_OPENGL_ES2\"" >> "$QTCONFIG.tmp"
6400 fi
6401
6402 # replace qconfig.pri if it differs from the newly created temp file
6403 if cmp -s "$QTCONFIG.tmp" "$QTCONFIG"; then
6404     rm -f "$QTCONFIG.tmp"
6405 else
6406     mv -f "$QTCONFIG.tmp" "$QTCONFIG"
6407 fi
6408
6409 #-------------------------------------------------------------------------------
6410 # save configuration into qmodule.pri
6411 #-------------------------------------------------------------------------------
6412 QTMODULE="$outpath/mkspecs/qmodule.pri"
6413
6414 echo "CONFIG += create_prl link_prl" >> "$QTMODULE.tmp"
6415
6416 # Ensure we can link to uninistalled libraries
6417 if [ "$BUILD_ON_MAC" != "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ] && linkerSupportsFlag -rpath-link "$outpath/lib"; then
6418     echo "QMAKE_LFLAGS    = -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib \$\$QMAKE_LFLAGS" >> "$QTMODULE.tmp"
6419 fi
6420 if [ -n "$QT_CFLAGS_PSQL" ]; then
6421     echo "QT_CFLAGS_PSQL   = $QT_CFLAGS_PSQL" >> "$QTMODULE.tmp"
6422 fi
6423 if [ -n "$QT_LFLAGS_PSQL" ]; then
6424     echo "QT_LFLAGS_PSQL   = $QT_LFLAGS_PSQL" >> "$QTMODULE.tmp"
6425 fi
6426 if [ -n "$QT_CFLAGS_MYSQL" ]; then
6427     echo "QT_CFLAGS_MYSQL   = $QT_CFLAGS_MYSQL" >> "$QTMODULE.tmp"
6428 fi
6429 if [ -n "$QT_LFLAGS_MYSQL" ]; then
6430     echo "QT_LFLAGS_MYSQL   = $QT_LFLAGS_MYSQL" >> "$QTMODULE.tmp"
6431 fi
6432 if [ -n "$QT_CFLAGS_SQLITE" ]; then
6433     echo "QT_CFLAGS_SQLITE   = $QT_CFLAGS_SQLITE" >> "$QTMODULE.tmp"
6434 fi
6435 if [ -n "$QT_LFLAGS_SQLITE" ]; then
6436     echo "QT_LFLAGS_SQLITE   = $QT_LFLAGS_SQLITE" >> "$QTMODULE.tmp"
6437 fi
6438 if [ -n "$QT_LFLAGS_ODBC" ]; then
6439     echo "QT_LFLAGS_ODBC   = $QT_LFLAGS_ODBC" >> "$QTMODULE.tmp"
6440 fi
6441 if [ -n "$QT_LFLAGS_TDS" ]; then
6442     echo "QT_LFLAGS_TDS   = $QT_LFLAGS_TDS" >> "$QTMODULE.tmp"
6443 fi
6444
6445 if [ "$QT_EDITION" != "QT_EDITION_OPENSOURCE" ]; then
6446     echo "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" >> "$QTMODULE.tmp"
6447 fi
6448
6449 #dump in the OPENSSL_LIBS info
6450 if [ '!' -z "$OPENSSL_LIBS" ]; then
6451     echo "OPENSSL_LIBS = $OPENSSL_LIBS" >> "$QTMODULE.tmp"
6452 elif [ "$CFG_OPENSSL" = "linked" ]; then
6453     echo "OPENSSL_LIBS = -lssl -lcrypto" >> "$QTMODULE.tmp"
6454 fi
6455
6456 #dump in the SDK info
6457 if [ '!' -z "$CFG_SDK" ]; then
6458    echo "QMAKE_MAC_SDK = $CFG_SDK" >> "$QTMODULE.tmp"
6459 fi
6460
6461 # cmdline args
6462 cat "$QMAKE_VARS_FILE" >> "$QTMODULE.tmp"
6463 rm -f "$QMAKE_VARS_FILE" 2>/dev/null
6464
6465 # replace qmodule.pri if it differs from the newly created temp file
6466 if cmp -s "$QTMODULE.tmp" "$QTMODULE"; then
6467     rm -f "$QTMODULE.tmp"
6468 else
6469     mv -f "$QTMODULE.tmp" "$QTMODULE"
6470 fi
6471
6472 #-------------------------------------------------------------------------------
6473 # save configuration into .qmake.cache
6474 #-------------------------------------------------------------------------------
6475
6476 CACHEFILE="$outpath/.qmake.cache"
6477 [ -f "$CACHEFILE.tmp" ] && rm -f "$CACHEFILE.tmp"
6478 cat >>"$CACHEFILE.tmp" <<EOF
6479 #paths
6480 QT_SOURCE_TREE = \$\$quote($relpath)
6481 QT_BUILD_TREE = \$\$quote($outpath)
6482 QT_BUILD_PARTS = $CFG_BUILD_PARTS
6483
6484 #local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR
6485 QMAKE_INCDIR_QT  = \$\$QT_BUILD_TREE/include
6486 QMAKE_LIBDIR_QT  = \$\$QT_BUILD_TREE/lib
6487
6488 include(\$\$PWD/mkspecs/qmodule.pri)
6489 CONFIG += $QMAKE_CONFIG dylib depend_includepath fix_output_dirs no_private_qt_headers_warning QTDIR_build
6490
6491 EOF
6492
6493 #dump the qmake spec
6494 if [ -d "$outpath/mkspecs/$XPLATFORM" ]; then
6495    echo "QMAKESPEC = \$\$QT_BUILD_TREE/mkspecs/$XPLATFORM" >> "$CACHEFILE.tmp"
6496 else
6497    echo "QMAKESPEC = $XPLATFORM" >> "$CACHEFILE.tmp"
6498 fi
6499
6500 # replace .qmake.cache if it differs from the newly created temp file
6501 if cmp -s "$CACHEFILE.tmp" "$CACHEFILE"; then
6502     rm -f "$CACHEFILE.tmp"
6503 else
6504     mv -f "$CACHEFILE.tmp" "$CACHEFILE"
6505 fi
6506
6507 #-------------------------------------------------------------------------------
6508 # give feedback on configuration
6509 #-------------------------------------------------------------------------------
6510
6511 case "$COMPILER" in
6512 g++*)
6513     if [ "$CFG_EXCEPTIONS" != "no" ]; then
6514         cat <<EOF
6515
6516         This target is using the GNU C++ compiler ($PLATFORM).
6517
6518         Recent versions of this compiler automatically include code for
6519         exceptions, which increase both the size of the Qt libraries and
6520         the amount of memory taken by your applications.
6521
6522         You may choose to re-run `basename $0` with the -no-exceptions
6523         option to compile Qt without exceptions. This is completely binary
6524         compatible, and existing applications will continue to work.
6525
6526 EOF
6527     fi
6528     ;;
6529 cc*)
6530     case "$PLATFORM" in
6531     irix-cc*)
6532         if [ "$CFG_EXCEPTIONS" != "no" ]; then
6533             cat <<EOF
6534
6535         This target is using the MIPSpro C++ compiler ($PLATFORM).
6536
6537         You may choose to re-run `basename $0` with the -no-exceptions
6538         option to compile Qt without exceptions. This will make the
6539         size of the Qt library smaller and reduce the amount of memory
6540         taken by your applications.
6541
6542 EOF
6543         fi
6544         ;;
6545     *) ;;
6546     esac
6547     ;;
6548 *) ;;
6549 esac
6550
6551 echo
6552 if [ "$XPLATFORM" = "$PLATFORM" ]; then
6553     echo "Build type:    $PLATFORM"
6554 else
6555     echo "Building on:   $PLATFORM"
6556     echo "Building for:  $XPLATFORM"
6557 fi
6558
6559 echo "Architecture:  $CFG_ARCH"
6560 if [ "$PLATFORM_QPA" = "yes" ]; then
6561     echo "Host architecture: $CFG_HOST_ARCH"
6562 fi
6563
6564 if [ -n "$PLATFORM_NOTES" ]; then
6565     echo "Platform notes:"
6566     echo "$PLATFORM_NOTES"
6567 else
6568     echo
6569 fi
6570
6571 if [ "$OPT_VERBOSE" = "yes" ]; then
6572     echo $ECHO_N "qmake vars .......... $ECHO_C"
6573     cat "$QMAKE_VARS_FILE" | tr '\n' ' '
6574     echo "qmake switches ......... $QMAKE_SWITCHES"
6575 fi
6576
6577 echo "Build .................. $CFG_BUILD_PARTS"
6578 echo "Configuration .......... $QMAKE_CONFIG $QT_CONFIG"
6579 if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
6580    echo "Debug .................. yes (combined)"
6581    if [ "$CFG_DEBUG" = "yes" ]; then
6582        echo "Default Link ........... debug"
6583    else
6584        echo "Default Link ........... release"
6585    fi
6586 else
6587    echo "Debug .................. $CFG_DEBUG"
6588 fi
6589 [ "$CFG_DBUS" = "no" ]     && echo "QtDBus module .......... no"
6590 [ "$CFG_DBUS" = "yes" ]    && echo "QtDBus module .......... yes (run-time)"
6591 [ "$CFG_DBUS" = "linked" ] && echo "QtDBus module .......... yes (linked)"
6592 echo "QtConcurrent code ...... $CFG_CONCURRENT"
6593 echo "QtGui module ........... $CFG_GUI"
6594 echo "QtWidgets module ....... $CFG_WIDGETS"
6595 if [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
6596     echo "JavaScriptCore JIT ..... To be decided by JavaScriptCore"
6597 else
6598     echo "JavaScriptCore JIT ..... $CFG_JAVASCRIPTCORE_JIT"
6599 fi
6600 echo "Declarative debugging ...$CFG_DECLARATIVE_DEBUG"
6601 echo "STL support ............ $CFG_STL"
6602 echo "PCH support ............ $CFG_PRECOMPILE"
6603 if [ "$CFG_ARCH" = "i386" -o "$CFG_ARCH" = "x86_64" ]; then
6604     echo "MMX/3DNOW/SSE/SSE2/SSE3. ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}/${CFG_SSE3}"
6605     echo "SSSE3/SSE4.1/SSE4.2..... ${CFG_SSSE3}/${CFG_SSE4_1}/${CFG_SSE4_2}"
6606     echo "AVX..................... ${CFG_AVX}"
6607 elif [ "$CFG_ARCH" = "arm" ]; then
6608     echo "iWMMXt support ......... ${CFG_IWMMXT}"
6609     echo "NEON support ........... ${CFG_NEON}"
6610 fi
6611 if [ "$CFG_ARCH" = "mips" ]; then
6612     echo "MIPS_DSP/MIPS_DSPR2..... ${CFG_MIPS_DSP}/${CFG_MIPS_DSPR2}"
6613 fi
6614 echo "IPv6 ifname support .... $CFG_IPV6IFNAME"
6615 echo "getaddrinfo support .... $CFG_GETADDRINFO"
6616 echo "getifaddrs support ..... $CFG_GETIFADDRS"
6617 echo "Accessibility .......... $CFG_ACCESSIBILITY"
6618 echo "NIS support ............ $CFG_NIS"
6619 echo "CUPS support ........... $CFG_CUPS"
6620 echo "Iconv support .......... $CFG_ICONV"
6621 echo "Glib support ........... $CFG_GLIB"
6622 echo "GStreamer support ...... $CFG_GSTREAMER"
6623 echo "PulseAudio support ..... $CFG_PULSEAUDIO"
6624 echo "Large File support ..... $CFG_LARGEFILE"
6625 echo "GIF support ............ $CFG_GIF"
6626 if [ "$CFG_JPEG" = "no" ]; then
6627     echo "JPEG support ........... $CFG_JPEG"
6628 else
6629     echo "JPEG support ........... $CFG_JPEG ($CFG_LIBJPEG)"
6630 fi
6631 if [ "$CFG_PNG" = "no" ]; then
6632     echo "PNG support ............ $CFG_PNG"
6633 else
6634     echo "PNG support ............ $CFG_PNG ($CFG_LIBPNG)"
6635 fi
6636 echo "zlib support ........... $CFG_ZLIB"
6637 echo "Session management ..... $CFG_SM"
6638 echo "libudev support ........ $CFG_LIBUDEV"
6639
6640 if [ "$CFG_OPENGL" = "desktop" ]; then
6641     echo "OpenGL support ......... yes (Desktop OpenGL)"
6642 elif [ "$CFG_OPENGL" = "es2" ]; then
6643     echo "OpenGL support ......... yes (OpenGL ES 2.x)"
6644 else
6645     echo "OpenGL support ......... no"
6646 fi
6647
6648 if [ "$CFG_OPENVG" ]; then
6649     if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
6650         echo "OpenVG support ......... ShivaVG"
6651     else
6652         echo "OpenVG support ......... $CFG_OPENVG"
6653     fi
6654 fi
6655 if [ "$PLATFORM_X11" = "yes" ]; then
6656     echo "NAS sound support ...... $CFG_NAS"
6657     echo "XShape support ......... $CFG_XSHAPE"
6658     echo "XVideo support ......... $CFG_XVIDEO"
6659     echo "XSync support .......... $CFG_XSYNC"
6660     echo "Xinerama support ....... $CFG_XINERAMA"
6661     echo "Xcursor support ........ $CFG_XCURSOR"
6662     echo "Xfixes support ......... $CFG_XFIXES"
6663     echo "Xrandr support ......... $CFG_XRANDR"
6664     echo "Xi support ............. $CFG_XINPUT"
6665     echo "MIT-SHM support ........ $CFG_MITSHM"
6666     echo "FontConfig support ..... $CFG_FONTCONFIG"
6667     echo "XKB Support ............ $CFG_XKB"
6668     echo "immodule support ....... $CFG_IM"
6669     echo "GTK theme support ...... $CFG_QGTKSTYLE"
6670 fi
6671 [ "$CFG_SQL_mysql" != "no" ] && echo "MySQL support .......... $CFG_SQL_mysql"
6672 [ "$CFG_SQL_psql" != "no" ] && echo "PostgreSQL support ..... $CFG_SQL_psql"
6673 [ "$CFG_SQL_odbc" != "no" ] && echo "ODBC support ........... $CFG_SQL_odbc"
6674 [ "$CFG_SQL_oci" != "no" ] && echo "OCI support ............ $CFG_SQL_oci"
6675 [ "$CFG_SQL_tds" != "no" ] && echo "TDS support ............ $CFG_SQL_tds"
6676 [ "$CFG_SQL_db2" != "no" ] && echo "DB2 support ............ $CFG_SQL_db2"
6677 [ "$CFG_SQL_ibase" != "no" ] && echo "InterBase support ...... $CFG_SQL_ibase"
6678 [ "$CFG_SQL_sqlite2" != "no" ] && echo "SQLite 2 support ....... $CFG_SQL_sqlite2"
6679 [ "$CFG_SQL_sqlite" != "no" ] && echo "SQLite support ......... $CFG_SQL_sqlite ($CFG_SQLITE)"
6680
6681 OPENSSL_LINKAGE=""
6682 if [ "$CFG_OPENSSL" = "yes" ]; then
6683     OPENSSL_LINKAGE="(run-time)"
6684 elif [ "$CFG_OPENSSL" = "linked" ]; then
6685     OPENSSL_LINKAGE="(linked)"
6686 fi
6687 echo "OpenSSL support ........ $CFG_OPENSSL $OPENSSL_LINKAGE"
6688 echo "Alsa support ........... $CFG_ALSA"
6689 if [ "$BUILD_ON_MAC" = "yes" ]; then
6690     echo "CoreWlan support ....... $CFG_COREWLAN"
6691 fi
6692 echo "libICU support ......... $CFG_ICU"
6693 echo "PCRE support ........... $CFG_PCRE"
6694 if [ "$CFG_XCB_LIMITED" = "yes" ] && [ "$CFG_XCB" = "yes" ]; then
6695     echo "Xcb support ............ limited (old version)"
6696 else
6697     echo "Xcb support ............ $CFG_XCB"
6698 fi
6699 echo "Xrender support ........ $CFG_XRENDER"
6700 if [ "$XPLATFORM_MAEMO" = "yes" ] && [ "$CFG_XCB" = "yes" ]; then
6701     echo "XInput2 support ........ $CFG_XINPUT2"
6702 fi
6703 echo "EGLFS support .......... $CFG_EGLFS"
6704 echo
6705
6706 # complain about not being able to use dynamic plugins if we are using a static build
6707 if [ "$CFG_SHARED" = "no" ]; then
6708     echo
6709     echo "WARNING: Using static linking will disable the use of dynamically"
6710     echo "loaded plugins. Make sure to import all needed static plugins,"
6711     echo "or compile needed modules into the library."
6712     echo
6713 fi
6714 if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then
6715     echo
6716     echo "NOTE: When linking against OpenSSL, you can override the default"
6717     echo "library names through OPENSSL_LIBS."
6718     echo "For example:"
6719     echo "    OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked"
6720     echo
6721 fi
6722 if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then
6723     echo
6724     echo "Error: debug-only framework builds are not supported. Configure with -no-framework"
6725     echo "if you want a pure debug build."
6726     echo
6727     exit 1
6728 fi
6729
6730 sepath=`echo "$relpath" | sed -e 's/\\./\\\\./g'`
6731 PROCS=1
6732 EXEC=""
6733
6734
6735 #-------------------------------------------------------------------------------
6736 # build makefiles based on the configuration
6737 #-------------------------------------------------------------------------------
6738
6739 echo "Finding project files. Please wait..."
6740 if [ "$CFG_NOPROCESS" != "yes" ]; then
6741     "$outpath/bin/qmake" -prl -r "${relpath}/qtbase.pro"
6742     if [ -f "${relpath}/qtbase.pro" ]; then
6743         mkfile="${outpath}/Makefile"
6744         [ -f "$mkfile" ] && chmod +w "$mkfile"
6745         QTDIR="$outpath" "$outpath/bin/qmake" -spec "$XQMAKESPEC" "${relpath}/qtbase.pro" -o "$mkfile"
6746     fi
6747 fi
6748
6749 # .projects      -> projects to process
6750 # .projects.1    -> qt and moc
6751 # .projects.2    -> subdirs and libs
6752 # .projects.3    -> the rest
6753 rm -f .projects .projects.1 .projects.2 .projects.3
6754
6755 QMAKE_PROJECTS=`find "$relpath/." -name '*.pro' -print | sed 's-/\./-/-'`
6756 if [ -z "$AWK" ]; then
6757     for p in `echo $QMAKE_PROJECTS`; do
6758         echo "$p" >> .projects
6759     done
6760 else
6761     cat >projects.awk <<EOF
6762 BEGIN {
6763     files = 0
6764     target_file = ""
6765     input_file = ""
6766
6767     first = "./.projects.1.tmp"
6768     second = "./.projects.2.tmp"
6769     third = "./.projects.3.tmp"
6770 }
6771
6772 FNR == 1 {
6773     if ( input_file ) {
6774         if ( ! target_file )
6775             target_file = third
6776         print input_file >target_file
6777     }
6778
6779     matched_target = 0
6780     template_lib = 0
6781     input_file = FILENAME
6782     target_file = ""
6783 }
6784
6785 /^(TARGET.*=)/ {
6786     if ( \$3 == "moc" || \$3 ~ /^Qt/ ) {
6787         target_file = first
6788         matched_target = 1
6789     } else if ( \$3 == "lrelease" || \$3 == "qm_phony_target" ) {
6790         target_file = second
6791         matched_target = 1
6792     }
6793 }
6794
6795 matched_target == 0 && /^(TEMPLATE.*=)/ {
6796     if ( \$3 == "subdirs" )
6797         target_file = second
6798     else if ( \$3 == "lib" )
6799         template_lib = 1
6800     else
6801         target_file = third
6802 }
6803
6804 matched_target == 0 && template_lib == 1 && /^(CONFIG.*=)/ {
6805     if ( \$0 ~ /plugin/ )
6806         target_file = third
6807     else
6808         target_file = second
6809 }
6810
6811 END {
6812     if ( input_file ) {
6813         if ( ! target_file )
6814             target_file = third
6815         print input_file >>target_file
6816     }
6817 }
6818
6819 EOF
6820
6821     rm -f .projects.all
6822     for p in `echo $QMAKE_PROJECTS`; do
6823        echo "$p" >> .projects.all
6824     done
6825
6826     # if you get errors about the length of the command line to awk, change the -l arg
6827     # to split below
6828     split -l 100 .projects.all .projects.all.
6829     for p in .projects.all.*; do
6830        "$AWK" -f projects.awk `cat $p`
6831        [ -f .projects.1.tmp ] && cat .projects.1.tmp >> .projects.1
6832        [ -f .projects.2.tmp ] && cat .projects.2.tmp >> .projects.2
6833        [ -f .projects.3.tmp ] && cat .projects.3.tmp >> .projects.3
6834        rm -f .projects.1.tmp .projects.2.tmp .projects.3.tmp $p
6835     done
6836     rm -f .projects.all* projects.awk
6837
6838     [ -f .projects.1 ] && cat .projects.1 >>.projects
6839     [ -f .projects.2 ] && cat .projects.2 >>.projects
6840     rm -f .projects.1 .projects.2
6841     if [ -f .projects.3 ] && [ "$OPT_FAST" = "no" ]; then
6842        cat .projects.3 >>.projects
6843        rm -f .projects.3
6844     fi
6845 fi
6846 # don't sort Qt and MOC in with the other project files
6847 # also work around a segfaulting uniq(1)
6848 if [ -f .sorted.projects.2 ]; then
6849     sort .sorted.projects.2 > .sorted.projects.2.new
6850     mv -f .sorted.projects.2.new .sorted.projects.2
6851     cat .sorted.projects.2 >> .sorted.projects.1
6852 fi
6853 [ -f .sorted.projects.1 ] && sort .sorted.projects.1 >> .sorted.projects
6854 rm -f .sorted.projects.2 .sorted.projects.1
6855
6856 NORM_PROJECTS=0
6857 FAST_PROJECTS=0
6858 if [ -f .projects ]; then
6859    uniq .projects >.tmp
6860    mv -f .tmp .projects
6861    NORM_PROJECTS=`cat .projects | wc -l | sed -e "s, ,,g"`
6862 fi
6863 if [ -f .projects.3 ]; then
6864    uniq .projects.3 >.tmp
6865    mv -f .tmp .projects.3
6866    FAST_PROJECTS=`cat .projects.3 | wc -l | sed -e "s, ,,g"`
6867 fi
6868 echo "  `expr $NORM_PROJECTS + $FAST_PROJECTS` projects found."
6869 echo
6870
6871 PART_ROOTS=
6872 for part in $CFG_BUILD_PARTS; do
6873     case "$part" in
6874     tools) PART_ROOTS="$PART_ROOTS tools" ;;
6875     libs) PART_ROOTS="$PART_ROOTS src" ;;
6876     translations) PART_ROOTS="$PART_ROOTS translations" ;;
6877     examples) PART_ROOTS="$PART_ROOTS examples" ;;
6878     *) ;;
6879     esac
6880 done
6881
6882 if [ "$CFG_DEV" = "yes" ]; then
6883     PART_ROOTS="$PART_ROOTS tests"
6884 fi
6885
6886 echo "Creating makefiles. Please wait..."
6887 for file in .projects .projects.3; do
6888     [ '!' -f "$file" ] && continue
6889     for a in `cat $file`; do
6890         IN_ROOT=no
6891         for r in $PART_ROOTS; do
6892             if echo "$a" | grep "^$r" >/dev/null 2>&1 || echo "$a" | grep "^$relpath/$r" >/dev/null 2>&1; then
6893                 IN_ROOT=yes
6894                 break
6895             fi
6896         done
6897         [ "$IN_ROOT" = "no" ] && continue
6898
6899         case $a in
6900         *winmain/winmain.pro)
6901             if [ "$CFG_NOPROCESS" = "yes" ] || [ "$XPLATFORM_MINGW" != "yes" ]; then
6902                 continue
6903             fi
6904             SPEC=$XQMAKESPEC ;;
6905         */qmake/qmake.pro) continue ;;
6906         *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*|*tools/qdoc*) SPEC=$QMAKESPEC ;;
6907         *) if [ "$CFG_NOPROCESS" = "yes" ]; then
6908               continue
6909            else
6910               SPEC=$XQMAKESPEC
6911            fi;;
6912         esac
6913         dir=`dirname "$a" | sed -e "s;$sepath;.;g"`
6914         test -d "$dir" || mkdir -p "$dir"
6915         OUTDIR="$outpath/$dir"
6916         if [ -f "${OUTDIR}/Makefile" ] && [ "$OPT_FAST" = "yes" ]; then
6917             # fast configure - the makefile exists, skip it
6918             # since the makefile exists, it was generated by qmake, which means we
6919             # can skip it, since qmake has a rule to regenerate the makefile if the .pro
6920             # file changes...
6921             [ "$OPT_VERBOSE" = "yes" ] && echo "  skipping $a"
6922             continue;
6923         fi
6924         QMAKE_SPEC_ARGS="-spec $SPEC"
6925         echo $ECHO_N "  for $a$ECHO_C"
6926
6927         QMAKE="$outpath/bin/qmake"
6928         QMAKE_ARGS="$QMAKE_SWITCHES $QMAKE_SPEC_ARGS"
6929         if [ "$file" = ".projects.3" ]; then
6930             echo " (fast)"
6931
6932             cat >"${OUTDIR}/Makefile" <<EOF
6933 # ${OUTDIR}/Makefile: generated by configure
6934 #
6935 # WARNING: This makefile will be replaced with a real makefile.
6936 # All changes made to this file will be lost.
6937 EOF
6938             [ "$CFG_DEBUG_RELEASE" = "no" ] && echo "first_target: first" >>${OUTDIR}/Makefile
6939
6940             cat >>"${OUTDIR}/Makefile" <<EOF
6941 QMAKE = "$QMAKE"
6942 all clean install qmake first Makefile: FORCE
6943         \$(QMAKE) $QMAKE_ARGS -o "$OUTDIR" "$a"
6944         cd "$OUTDIR"
6945         \$(MAKE) \$@
6946
6947 FORCE:
6948
6949 EOF
6950         else
6951             if [ "$OPT_VERBOSE" = "yes" ]; then
6952                 echo " (`basename $SPEC`)"
6953                 echo "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
6954             else
6955                 echo
6956             fi
6957
6958             [ -f "${OUTDIR}/Makefile" ] && chmod +w "${OUTDIR}/Makefile"
6959             QTDIR="$outpath" "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
6960        fi
6961     done
6962 done
6963 rm -f .projects .projects.3
6964
6965 #-------------------------------------------------------------------------------
6966 # check for platforms that we don't yet know about
6967 #-------------------------------------------------------------------------------
6968 if [ "$CFG_ARCH" = "unknown" ]; then
6969 cat <<EOF
6970
6971         NOTICE: configure was unable to determine the architecture
6972         for the $XQMAKESPEC target.
6973
6974         Qt will not use a specialized implementation for any atomic
6975         operations. Instead a generic implemention based on either GCC
6976         intrinsics or C++11 std::atomic<T> will be used (when
6977         available). The generic implementations are generally as fast
6978         as and always as safe as a specialized implementation.
6979
6980         If no generic implementation is available, Qt will use a
6981         fallback UNIX implementation which uses a single
6982         pthread_mutex_t to protect all atomic operations. This
6983         implementation is the slow (but safe) fallback implementation
6984         for architectures Qt does not yet support.
6985 EOF
6986 fi
6987
6988 #-------------------------------------------------------------------------------
6989 # check if the user passed the -no-zlib option, which is no longer supported
6990 #-------------------------------------------------------------------------------
6991 if [ -n "$ZLIB_FORCED" ]; then
6992     which_zlib="supplied"
6993     if [ "$CFG_ZLIB" = "system" ]; then
6994         which_zlib="system"
6995     fi
6996
6997 cat <<EOF
6998
6999         NOTICE: The -no-zlib option was supplied but is no longer
7000         supported.
7001
7002         Qt now requires zlib support in all builds, so the -no-zlib
7003         option was ignored. Qt will be built using the $which_zlib
7004         zlib.
7005 EOF
7006 fi
7007
7008 #-------------------------------------------------------------------------------
7009 # check if the user passed the obsoleted -wayland or -no-wayland flag
7010 #-------------------------------------------------------------------------------
7011 if [ "$CFG_OBSOLETE_WAYLAND" = "yes" ]; then
7012 cat <<EOF
7013
7014         NOTICE: The -wayland and -no-wayland flags are now obsolete
7015
7016         All configuring of QtWayland plugin and QtCompositor happens in the module
7017 EOF
7018 fi
7019
7020 #-------------------------------------------------------------------------------
7021 # check if the user passed the obsoleted -arch or -host-arch options
7022 #-------------------------------------------------------------------------------
7023 if [ "$OPT_OBSOLETE_HOST_ARG" = "yes" ]; then
7024 cat <<EOF
7025
7026         NOTICE: The -arch and -host-arch options are obsolete.
7027
7028         Qt now detects the target and host architectures based on compiler
7029         output. Qt will be built using $CFG_ARCH for the target architecture
7030         and $CFG_HOST_ARCH for the host architecture (note that these two
7031         will be the same unless you are cross-compiling).
7032 EOF
7033 fi
7034
7035 #-------------------------------------------------------------------------------
7036 # finally save the executed command to another script
7037 #-------------------------------------------------------------------------------
7038 if [ `basename $0` != "config.status" ]; then
7039     CONFIG_STATUS="$relpath/$relconf $OPT_CMDLINE"
7040
7041     # add the system variables
7042     for varname in $SYSTEM_VARIABLES; do
7043         cmd=`echo \
7044 'if [ -n "\$'${varname}'" ]; then
7045     CONFIG_STATUS="'${varname}'='"'\\\$${varname}'"' \$CONFIG_STATUS"
7046 fi'`
7047         eval "$cmd"
7048     done
7049
7050     echo "$CONFIG_STATUS" | grep '\-confirm\-license' >/dev/null 2>&1 || CONFIG_STATUS="$CONFIG_STATUS -confirm-license"
7051
7052     [ -f "$outpath/config.status" ] && rm -f "$outpath/config.status"
7053     echo "#!/bin/sh" > "$outpath/config.status"
7054     [ -n "$PKG_CONFIG_SYSROOT_DIR" ] && \
7055         echo "export PKG_CONFIG_SYSROOT_DIR=$PKG_CONFIG_SYSROOT_DIR" >> "$outpath/config.status"
7056     [ -n "$PKG_CONFIG_LIBDIR" ] && \
7057         echo "export PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR" >> "$outpath/config.status"
7058     echo "if [ \"\$#\" -gt 0 ]; then" >> "$outpath/config.status"
7059     echo "  $CONFIG_STATUS \"\$@\"" >> "$outpath/config.status"
7060     echo "else" >> "$outpath/config.status"
7061     echo "  $CONFIG_STATUS" >> "$outpath/config.status"
7062     echo "fi" >> "$outpath/config.status"
7063     chmod +x "$outpath/config.status"
7064 fi
7065
7066 if [ -n "$RPATH_MESSAGE" ]; then
7067     echo
7068     echo "$RPATH_MESSAGE"
7069 fi
7070
7071 MAKE=`basename "$MAKE"`
7072 echo
7073 echo Qt is now configured for building. Just run \'$MAKE\'.
7074 if [ "$relpath" = "$QT_INSTALL_PREFIX" ]; then
7075     echo Once everything is built, Qt is installed.
7076     echo You should not run \'$MAKE install\'.
7077 else
7078     echo Once everything is built, you must run \'$MAKE install\'.
7079     echo Qt will be installed into $QT_INSTALL_PREFIX
7080 fi
7081 echo
7082 echo To reconfigure, run \'$MAKE confclean\' and \'configure\'.
7083 echo