device: Add -device and -device-option to configure
[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 tests"
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     # don't build tools by default when cross-compiling
2702     if [ "$PLATFORM" != "$XPLATFORM" ]; then
2703         CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, tools,,g"`
2704     fi
2705 fi
2706 for nobuild in $CFG_NOBUILD_PARTS; do
2707     CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, $nobuild,,g"`
2708 done
2709 if echo $CFG_BUILD_PARTS | grep -v libs >/dev/null 2>&1; then
2710 #    echo
2711 #    echo "WARNING: libs is a required part of the build."
2712 #    echo
2713     CFG_BUILD_PARTS="$CFG_BUILD_PARTS libs"
2714 fi
2715
2716 #-------------------------------------------------------------------------------
2717 # post process QT_INSTALL_* variables
2718 #-------------------------------------------------------------------------------
2719
2720 if [ -z "$QT_INSTALL_PREFIX" ]; then
2721     if [ "$CFG_DEV" = "yes" ]; then
2722         QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default
2723     else
2724         QT_INSTALL_PREFIX="/usr/local/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Qt-$QT_VERSION
2725     fi
2726 fi
2727 QT_INSTALL_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PREFIX"`
2728
2729 if [ -z "$QT_INSTALL_DOCS" ]; then #default
2730     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2731         if [ "$BUILD_ON_MAC" = "yes" ]; then
2732             QT_INSTALL_DOCS="/Developer/Documentation/Qt"
2733         fi
2734     fi
2735     [ -z "$QT_INSTALL_DOCS" ] && QT_INSTALL_DOCS="$QT_INSTALL_PREFIX/doc" #fallback
2736
2737 fi
2738 QT_INSTALL_DOCS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DOCS"`
2739
2740 if [ -z "$QT_INSTALL_HEADERS" ]; then #default
2741     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2742         if [ "$BUILD_ON_MAC" = "yes" ]; then
2743             if [ "$CFG_FRAMEWORK" = "yes" ]; then
2744                 QT_INSTALL_HEADERS=
2745             fi
2746         fi
2747     fi
2748     [ -z "$QT_INSTALL_HEADERS" ] && QT_INSTALL_HEADERS="$QT_INSTALL_PREFIX/include"
2749
2750 fi
2751 QT_INSTALL_HEADERS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_HEADERS"`
2752
2753 if [ -z "$QT_INSTALL_LIBS" ]; then #default
2754     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2755         if [ "$BUILD_ON_MAC" = "yes" ]; then
2756             if [ "$CFG_FRAMEWORK" = "yes" ]; then
2757                 QT_INSTALL_LIBS="/Libraries/Frameworks"
2758             fi
2759         fi
2760     fi
2761     [ -z "$QT_INSTALL_LIBS" ] && QT_INSTALL_LIBS="$QT_INSTALL_PREFIX/lib" #fallback
2762 fi
2763 QT_INSTALL_LIBS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_LIBS"`
2764
2765 if [ -z "$QT_INSTALL_BINS" ]; then #default
2766     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2767         if [ "$BUILD_ON_MAC" = "yes" ]; then
2768             QT_INSTALL_BINS="/Developer/Applications/Qt"
2769         fi
2770     fi
2771     [ -z "$QT_INSTALL_BINS" ] && QT_INSTALL_BINS="$QT_INSTALL_PREFIX/bin" #fallback
2772 fi
2773 QT_INSTALL_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_BINS"`
2774
2775 if [ -z "$QT_INSTALL_PLUGINS" ]; then #default
2776     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2777         if [ "$BUILD_ON_MAC" = "yes" ]; then
2778             QT_INSTALL_PLUGINS="/Developer/Applications/Qt/plugins"
2779         fi
2780     fi
2781     [ -z "$QT_INSTALL_PLUGINS" ] && QT_INSTALL_PLUGINS="$QT_INSTALL_PREFIX/plugins" #fallback
2782 fi
2783 QT_INSTALL_PLUGINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PLUGINS"`
2784
2785 if [ -z "$QT_INSTALL_IMPORTS" ]; then #default
2786     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2787         if [ "$BUILD_ON_MAC" = "yes" ]; then
2788             QT_INSTALL_IMPORTS="/Developer/Applications/Qt/imports"
2789         fi
2790     fi
2791     [ -z "$QT_INSTALL_IMPORTS" ] && QT_INSTALL_IMPORTS="$QT_INSTALL_PREFIX/imports" #fallback
2792 fi
2793 QT_INSTALL_IMPORTS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_IMPORTS"`
2794
2795 if [ -z "$QT_INSTALL_DATA" ]; then #default
2796     QT_INSTALL_DATA="$QT_INSTALL_PREFIX"
2797 fi
2798 QT_INSTALL_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DATA"`
2799
2800 if [ -z "$QT_INSTALL_TRANSLATIONS" ]; then #default
2801     QT_INSTALL_TRANSLATIONS="$QT_INSTALL_PREFIX/translations"
2802 fi
2803 QT_INSTALL_TRANSLATIONS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TRANSLATIONS"`
2804
2805 if [ -z "$QT_INSTALL_SETTINGS" ]; then #default
2806     if [ "$BUILD_ON_MAC" = "yes" ]; then
2807         QT_INSTALL_SETTINGS=/Library/Preferences/Qt
2808     else
2809         QT_INSTALL_SETTINGS=/etc/xdg
2810     fi
2811 fi
2812 QT_INSTALL_SETTINGS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_SETTINGS"`
2813
2814 if [ -z "$QT_INSTALL_EXAMPLES" ]; then #default
2815     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2816         if [ "$BUILD_ON_MAC" = "yes" ]; then
2817             QT_INSTALL_EXAMPLES="/Developer/Examples/Qt"
2818         fi
2819     fi
2820     [ -z "$QT_INSTALL_EXAMPLES" ] && QT_INSTALL_EXAMPLES="$QT_INSTALL_PREFIX/examples" #fallback
2821 fi
2822 QT_INSTALL_EXAMPLES=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_EXAMPLES"`
2823
2824 #tests
2825 if [ -z "$QT_INSTALL_TESTS" ]; then #default
2826     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2827         if [ "$BUILD_ON_MAC" = "yes" ]; then
2828             QT_INSTALL_TESTS="/Developer/Tests/Qt"
2829         fi
2830     fi
2831     [ -z "$QT_INSTALL_TESTS" ] && QT_INSTALL_TESTS="$QT_INSTALL_PREFIX/tests" #fallback
2832 fi
2833 QT_INSTALL_TESTS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TESTS"`
2834
2835 #------- host paths --------
2836
2837 if [ -z "$QT_HOST_PREFIX" ]; then
2838     QT_HOST_PREFIX=$QT_INSTALL_PREFIX
2839     haveHpx=false
2840 else
2841     QT_HOST_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_PREFIX"`
2842     haveHpx=true
2843 fi
2844
2845 if [ -z "$QT_HOST_BINS" ]; then #default
2846     if $haveHpx; then
2847         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2848             if [ "$BUILD_ON_MAC" = "yes" ]; then
2849                 QT_HOST_BINS="/Developer/Applications/Qt"
2850             fi
2851         fi
2852         [ -z "$QT_HOST_BINS" ] && QT_HOST_BINS="$QT_HOST_PREFIX/bin" #fallback
2853     else
2854         QT_HOST_BINS="$QT_INSTALL_BINS"
2855     fi
2856 fi
2857 QT_HOST_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_BINS"`
2858
2859 if [ -z "$QT_HOST_DATA" ]; then #default
2860     if $haveHpx; then
2861         QT_HOST_DATA="$QT_HOST_PREFIX"
2862     else
2863         QT_HOST_DATA="$QT_INSTALL_DATA"
2864     fi
2865 else
2866     QT_HOST_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_DATA"`
2867 fi
2868
2869 #-------------------------------------------------------------------------------
2870 # help - interactive parts of the script _after_ this section please
2871 #-------------------------------------------------------------------------------
2872
2873 # next, emit a usage message if something failed.
2874 if [ "$OPT_HELP" = "yes" ]; then
2875     [ "x$ERROR" = "xyes" ] && echo
2876     if [ "$CFG_NIS" = "no" ]; then
2877         NSY=" "
2878         NSN="*"
2879     else
2880         NSY="*"
2881         NSN=" "
2882     fi
2883     if [ "$CFG_CUPS" = "no" ]; then
2884         CUY=" "
2885         CUN="*"
2886     else
2887         CUY="*"
2888         CUN=" "
2889     fi
2890     if [ "$CFG_ICONV" = "no" ]; then
2891         CIY=" "
2892         CIN="*"
2893     else
2894         CIY="*"
2895         CIN=" "
2896     fi
2897     if [ "$CFG_LARGEFILE" = "no" ]; then
2898         LFSY=" "
2899         LFSN="*"
2900     else
2901         LFSY="*"
2902         LFSN=" "
2903     fi
2904     if [ "$CFG_STL" = "auto" ] || [ "$CFG_STL" = "yes" ]; then
2905         SHY="*"
2906         SHN=" "
2907     else
2908         SHY=" "
2909         SHN="*"
2910     fi
2911     if [ "$CFG_PRECOMPILE" = "auto" ] || [ "$CFG_PRECOMPILE" = "no" ]; then
2912         PHY=" "
2913         PHN="*"
2914     else
2915         PHY="*"
2916         PHN=" "
2917     fi
2918
2919     if [ "$CFG_XCB" = "no" ]; then
2920         XCBY=" "
2921         XCBN="*"
2922     else
2923         XCBY="*"
2924         XCBN=" "
2925     fi
2926
2927     if [ "$CFG_EGLFS" = "no" ]; then
2928         EGLFSY=" "
2929         EGLFSN="*"
2930     else
2931         EGLFSY="*"
2932         EGLFSN=" "
2933     fi
2934
2935     if [ "$CFG_XINPUT2" = "no" ]; then
2936         X2Y=" "
2937         X2N="*"
2938     else
2939         X2Y="*"
2940         X2N=" "
2941     fi
2942
2943     cat <<EOF
2944 Usage:  $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>]
2945         [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-importdir <dir>] [-datadir <dir>]
2946         [-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>] [-testsdir <dir>]
2947         [-release] [-debug] [-debug-and-release]
2948         [-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile]
2949         [-largefile] [-no-exceptions] [-exceptions] [-no-accessibility]
2950         [-accessibility] [-no-stl] [-stl] [-no-sql-<driver>] [-sql-<driver>]
2951         [-plugin-sql-<driver>] [-system-sqlite]
2952         [-platform] [-D <string>] [-I <string>] [-L <string>] [-help]
2953         [-qt-zlib] [-system-zlib] [-no-gif] [-no-libpng] [-qt-libpng] [-system-libpng]
2954         [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>]
2955         [-nomake <part>] [-R <string>]  [-l <string>] [-no-rpath]  [-rpath] [-continue]
2956         [-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [-no-iconv]
2957         [-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked] [-no-gui]
2958         [-no-separate-debug-info] [-no-mmx] [-no-3dnow] [-no-sse] [-no-sse2]
2959         [-no-sse3] [-no-ssse3] [-no-sse4.1] [-no-sse4.2] [-no-avx] [-no-neon]
2960         [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info]
2961         [-no-phonon-backend] [-phonon-backend] [-no-media-backend] [-media-backend]
2962         [-no-audio-backend] [-audio-backend]
2963         [-no-javascript-jit] [-javascript-jit] [-no-declarative-debug] [-declarative-debug]
2964         [-no-optimized-qmake] [-optimized-qmake]
2965         [-no-openssl] [-openssl] [-openssl-linked]
2966         [-no-gtkstyle] [-gtkstyle]
2967         [-qt-pcre] [-system-pcre]
2968         [-device <name>] [-device-option <key=value>]
2969         [additional platform specific options (see below)]
2970
2971
2972 Installation options:
2973
2974     -qpa ................ This will enable the QPA build.
2975                           QPA is a window system agnostic implementation of Qt.
2976
2977  These are optional, but you may specify install directories.
2978
2979     -prefix <dir> ...... This will install everything relative to <dir>
2980                          (default $QT_INSTALL_PREFIX)
2981 EOF
2982 if [ "$PLATFORM_QPA" = "yes" ]; then
2983 cat <<EOF
2984
2985     -hostprefix [dir] .. Tools and libraries needed when developing
2986                          applications are installed in [dir]. If [dir] is
2987                          not given, the current build directory will be used.
2988                          (default PREFIX)
2989 EOF
2990 fi
2991 cat <<EOF
2992
2993   * -prefix-install .... Force a sandboxed "local" installation of
2994                          Qt. This will install into
2995                          $QT_INSTALL_PREFIX, if this option is
2996                          disabled then some platforms will attempt a
2997                          "system" install by placing default values to
2998                          be placed in a system location other than
2999                          PREFIX.
3000
3001  You may use these to separate different parts of the install:
3002
3003     -bindir <dir> ......... Executables will be installed to <dir>
3004                             (default PREFIX/bin)
3005     -libdir <dir> ......... Libraries will be installed to <dir>
3006                             (default PREFIX/lib)
3007     -docdir <dir> ......... Documentation will be installed to <dir>
3008                             (default PREFIX/doc)
3009     -headerdir <dir> ...... Headers will be installed to <dir>
3010                             (default PREFIX/include)
3011     -plugindir <dir> ...... Plugins will be installed to <dir>
3012                             (default PREFIX/plugins)
3013     -importdir <dir> ...... Imports for QML will be installed to <dir>
3014                             (default PREFIX/imports)
3015     -datadir <dir> ........ Data used by Qt programs will be installed to <dir>
3016                             (default PREFIX)
3017     -translationdir <dir> . Translations of Qt programs will be installed to <dir>
3018                             (default PREFIX/translations)
3019     -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir>
3020                             (default PREFIX/etc/settings)
3021     -examplesdir <dir> .... Examples will be installed to <dir>
3022                             (default PREFIX/examples)
3023     -testsdir <dir> ....... Tests will be installed to <dir>
3024                             (default PREFIX/tests)
3025 EOF
3026 if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
3027 cat <<EOF
3028
3029     -hostbindir <dir> .. Host executables will be installed to <dir>
3030                          (default HOSTPREFIX/bin)
3031     -hostdatadir <dir> . Data used by qmake will be installed to <dir>
3032                          (default HOSTPREFIX)
3033 EOF
3034 fi
3035 cat <<EOF
3036
3037 Configure options:
3038
3039  The defaults (*) are usually acceptable. A plus (+) denotes a default value
3040  that needs to be evaluated. If the evaluation succeeds, the feature is
3041  included. Here is a short explanation of each option:
3042
3043  *  -release ........... Compile and link Qt with debugging turned off.
3044     -debug ............. Compile and link Qt with debugging turned on.
3045     -debug-and-release . Compile and link two versions of Qt, with and without
3046                          debugging turned on (Mac only).
3047
3048     -developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting)
3049
3050     -opensource ........ Compile and link the Open-Source Edition of Qt.
3051     -commercial ........ Compile and link the Commercial Edition of Qt.
3052
3053
3054  *  -shared ............ Create and use shared Qt libraries.
3055     -static ............ Create and use static Qt libraries.
3056
3057  *  -no-fast ........... Configure Qt normally by generating Makefiles for all
3058                          project files.
3059     -fast .............. Configure Qt quickly by generating Makefiles only for
3060                          library and subdirectory targets.  All other Makefiles
3061                          are created as wrappers, which will in turn run qmake.
3062
3063     -no-largefile ...... Disables large file support.
3064  +  -largefile ......... Enables Qt to access files larger than 4 GB.
3065
3066 EOF
3067 if [ "$PLATFORM_QPA" = "yes" ]; then
3068     EXCN="*"
3069     EXCY=" "
3070 else
3071     EXCN=" "
3072     EXCY="*"
3073 fi
3074 if [ "$CFG_DBUS" = "no" ]; then
3075     DBY=" "
3076     DBN="+"
3077 else
3078     DBY="+"
3079     DBN=" "
3080 fi
3081
3082     cat << EOF
3083  $EXCN  -no-exceptions ..... Disable exceptions on compilers that support it.
3084  $EXCY  -exceptions ........ Enable exceptions on compilers that support it.
3085
3086     -no-accessibility .. Do not compile Accessibility support.
3087  *  -accessibility ..... Compile Accessibility support.
3088
3089  $SHN  -no-stl ............ Do not compile STL support.
3090  $SHY  -stl ............... Compile STL support.
3091
3092     -no-sql-<driver> ... Disable SQL <driver> entirely.
3093     -qt-sql-<driver> ... Enable a SQL <driver> in the QtSql library, by default
3094                          none are turned on.
3095     -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to
3096                          at run time.
3097
3098                          Possible values for <driver>:
3099                          [ $CFG_SQL_AVAILABLE ]
3100
3101     -system-sqlite ..... Use sqlite from the operating system.
3102
3103     -no-phonon-backend.. Do not build the platform phonon plugin.
3104  +  -phonon-backend..... Build the platform phonon plugin.
3105
3106     -no-javascript-jit . Do not build the JavaScriptCore JIT compiler.
3107  +  -javascript-jit .... Build the JavaScriptCore JIT compiler.
3108
3109     -no-declarative-debug ..... Do not build the declarative debugging support.
3110  +  -declarative-debug ....... Build the declarative debugging support.
3111
3112     -platform target ... The operating system and compiler you are building
3113                          on ($PLATFORM).
3114
3115                          See the README file for a list of supported
3116                          operating systems and compilers.
3117 EOF
3118
3119 if [ "${PLATFORM_QPA}" != "yes" ]; then
3120 cat << EOF
3121     -graphicssystem <sys> Sets an alternate graphics system. Available options are:
3122                            raster - Software rasterizer
3123                            opengl - Rendering via OpenGL, Experimental!
3124                            openvg - Rendering via OpenVG, Experimental!
3125
3126 EOF
3127 fi
3128
3129 cat << EOF
3130
3131     -no-mmx ............ Do not compile with use of MMX instructions.
3132     -no-3dnow .......... Do not compile with use of 3DNOW instructions.
3133     -no-sse ............ Do not compile with use of SSE instructions.
3134     -no-sse2 ........... Do not compile with use of SSE2 instructions.
3135     -no-sse3 ........... Do not compile with use of SSE3 instructions.
3136     -no-ssse3 .......... Do not compile with use of SSSE3 instructions.
3137     -no-sse4.1.......... Do not compile with use of SSE4.1 instructions.
3138     -no-sse4.2.......... Do not compile with use of SSE4.2 instructions.
3139     -no-avx ............ Do not compile with use of AVX instructions.
3140     -no-neon ........... Do not compile with use of NEON instructions.
3141     -no-mips_dsp ....... Do not compile with use of MIPS DSP instructions.
3142     -no-mips_dspr2 ..... Do not compile with use of MIPS DSP rev2 instructions.
3143
3144     -qtnamespace <name>  Wraps all Qt library code in 'namespace <name> {...}'.
3145     -qtlibinfix <infix>  Renames all libQt*.so to libQt*<infix>.so.
3146
3147     -testcocoon          Instrument Qt with the TestCocoon code coverage tool.
3148
3149     -D <string> ........ Add an explicit define to the preprocessor.
3150     -I <string> ........ Add an explicit include path.
3151     -L <string> ........ Add an explicit library path.
3152
3153     -help, -h .......... Display this information.
3154
3155 Third Party Libraries:
3156
3157     -qt-zlib ........... Use the zlib bundled with Qt.
3158  +  -system-zlib ....... Use zlib from the operating system.
3159                          See http://www.gzip.org/zlib
3160
3161     -no-gif ............ Do not compile GIF reading support.
3162
3163     -no-libpng ......... Do not compile PNG support.
3164     -qt-libpng ......... Use the libpng bundled with Qt.
3165  +  -system-libpng ..... Use libpng from the operating system.
3166                          See http://www.libpng.org/pub/png
3167
3168     -no-libjpeg ........ Do not compile JPEG support.
3169     -qt-libjpeg ........ Use the libjpeg bundled with Qt.
3170  +  -system-libjpeg .... Use libjpeg from the operating system.
3171                          See http://www.ijg.org
3172
3173     -no-openssl ........ Do not compile support for OpenSSL.
3174  +  -openssl ........... Enable run-time OpenSSL support.
3175     -openssl-linked .... Enabled linked OpenSSL support.
3176
3177     -qt-pcre ........... Use the PCRE library bundled with Qt.
3178  +  -system-pcre ....... Use the PCRE library from the operating system.
3179
3180 Additional options:
3181
3182     -make <part> ....... Add part to the list of parts to be built at make time.
3183                          ($QT_DEFAULT_BUILD_PARTS)
3184     -nomake <part> ..... Exclude part from the list of parts to be built.
3185
3186     -R <string> ........ Add an explicit runtime library path to the Qt
3187                          libraries.
3188     -l <string> ........ Add an explicit library.
3189
3190     -no-rpath .......... Do not use the library install path as a runtime
3191                          library path.
3192  +  -rpath ............. Link Qt libraries and executables using the library
3193                          install path as a runtime library path. Equivalent
3194                          to -R install_libpath
3195
3196     -continue .......... Continue as far as possible if an error occurs.
3197
3198     -verbose, -v ....... Print verbose information about each step of the
3199                          configure process.
3200
3201     -silent ............ Reduce the build output so that warnings and errors
3202                          can be seen more easily.
3203
3204  *  -no-optimized-qmake ... Do not build qmake optimized.
3205     -optimized-qmake ...... Build qmake optimized.
3206
3207     -no-gui ............ Don't build the Qt GUI library
3208
3209  $NSN  -no-nis ............ Do not compile NIS support.
3210  $NSY  -nis ............... Compile NIS support.
3211
3212  $CUN  -no-cups ........... Do not compile CUPS support.
3213  $CUY  -cups .............. Compile CUPS support.
3214                          Requires cups/cups.h and libcups.so.2.
3215
3216  $CIN  -no-iconv .......... Do not compile support for iconv(3).
3217  $CIY  -iconv ............. Compile support for iconv(3).
3218
3219  $PHN  -no-pch ............ Do not use precompiled header support.
3220  $PHY  -pch ............... Use precompiled header support.
3221
3222  $DBN  -no-dbus ........... Do not compile the QtDBus module.
3223  $DBY  -dbus .............. Compile the QtDBus module and dynamically load libdbus-1.
3224     -dbus-linked ....... Compile the QtDBus module and link to libdbus-1.
3225
3226     -reduce-relocations ..... Reduce relocations in the libraries through extra
3227                               linker optimizations (Qt/X11 and Qt for Embedded Linux only;
3228                               experimental; needs GNU ld >= 2.18).
3229
3230     -force-asserts ........ Force Q_ASSERT to be enabled even in release builds.
3231
3232     -device <name> ............... Cross-compile for device <name> (experimental)
3233     -device-option <key=value> ... Add device specific options for the device mkspec
3234                                    (experimental)
3235
3236 EOF
3237
3238 if [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
3239     if [ "$QT_CROSS_COMPILE" = "yes" ]; then
3240         SBY=""
3241         SBN="*"
3242     else
3243         SBY="*"
3244         SBN=" "
3245     fi
3246 elif [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
3247     SBY="*"
3248     SBN=" "
3249 else
3250     SBY=" "
3251     SBN="*"
3252 fi
3253
3254 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
3255
3256     cat << EOF
3257
3258  $SBN  -no-separate-debug-info . Do not store debug information in a separate file.
3259  $SBY  -separate-debug-info .... Strip debug information into a separate .debug file.
3260
3261  $XCBN  -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support.
3262  $XCBY  -xcb ............... Compile Xcb support.
3263
3264  $EGLFSN  -no-eglfs .......... Do not compile EGLFS (EGL Full Screen/Single Surface) support.
3265  $EGLFSY  -eglfs ............. Compile EGLFS support.
3266
3267 EOF
3268
3269 fi # X11
3270
3271 if [ "$XPLATFORM_MAEMO" = "yes" ]; then
3272
3273     cat << EOF
3274
3275  $X2N  -no-xinput2......... Do not compile XInput2 support.
3276  $X2Y  -xinput2............ Compile XInput2 support.
3277
3278 EOF
3279
3280 fi
3281
3282 if [ "$PLATFORM_X11" = "yes" ]; then
3283     if [ "$CFG_SM" = "no" ]; then
3284         SMY=" "
3285         SMN="*"
3286     else
3287         SMY="*"
3288         SMN=" "
3289     fi
3290     if [ "$CFG_XSHAPE" = "no" ]; then
3291         SHY=" "
3292         SHN="*"
3293     else
3294         SHY="*"
3295         SHN=" "
3296     fi
3297     if [ "$CFG_XVIDEO" = "no" ]; then
3298         XVY=" "
3299         XVN="*"
3300     else
3301         XVY="*"
3302         XVN=" "
3303     fi
3304     if [ "$CFG_XINERAMA" = "no" ]; then
3305         XAY=" "
3306         XAN="*"
3307     else
3308         XAY="*"
3309         XAN=" "
3310     fi
3311     if [ "$CFG_FONTCONFIG" = "no" ]; then
3312         FCGY=" "
3313         FCGN="*"
3314     else
3315         FCGY="*"
3316         FCGN=" "
3317     fi
3318     if [ "$CFG_XCURSOR" = "no" ]; then
3319         XCY=" "
3320         XCN="*"
3321     else
3322         XCY="*"
3323         XCN=" "
3324     fi
3325     if [ "$CFG_XFIXES" = "no" ]; then
3326         XFY=" "
3327         XFN="*"
3328     else
3329         XFY="*"
3330         XFN=" "
3331     fi
3332     if [ "$CFG_XRANDR" = "no" ]; then
3333         XZY=" "
3334         XZN="*"
3335     else
3336         XZY="*"
3337         XZN=" "
3338     fi
3339     if [ "$CFG_XRENDER" = "no" ]; then
3340         XRY=" "
3341         XRN="*"
3342     else
3343         XRY="*"
3344         XRN=" "
3345     fi
3346     if [ "$CFG_MITSHM" = "no" ]; then
3347         XMY=" "
3348         XMN="*"
3349     else
3350         XMY="*"
3351         XMN=" "
3352     fi
3353     if [ "$CFG_XINPUT" = "no" ]; then
3354         XIY=" "
3355         XIN="*"
3356     else
3357         XIY="*"
3358         XIN=" "
3359     fi
3360     if [ "$CFG_XKB" = "no" ]; then
3361         XKY=" "
3362         XKN="*"
3363     else
3364         XKY="*"
3365         XKN=" "
3366     fi
3367     if [ "$CFG_IM" = "no" ]; then
3368         IMY=" "
3369         IMN="*"
3370     else
3371         IMY="*"
3372         IMN=" "
3373     fi
3374     cat << EOF
3375
3376 Qt/X11 only:
3377
3378     -no-gtkstyle ....... Do not build the GTK theme integration.
3379  +  -gtkstyle .......... Build the GTK theme integration.
3380
3381  *  -no-nas-sound ...... Do not compile in NAS sound support.
3382     -system-nas-sound .. Use NAS libaudio from the operating system.
3383                          See http://radscan.com/nas.html
3384
3385     -no-opengl ......... Do not support OpenGL.
3386  +  -opengl <api> ...... Enable OpenGL support.
3387                          With no parameter, this will auto-detect the "best"
3388                          OpenGL API to use. If desktop OpenGL is available, it
3389                          will be used. Use desktop or es2 for <api>
3390                          to force the use of the Desktop OpenGL or
3391                          OpenGL ES 2 APIs instead.
3392
3393      -no-openvg ........ Do not support OpenVG.
3394  +   -openvg ........... Enable OpenVG support.
3395                          Requires EGL support, typically supplied by an OpenGL
3396                          or other graphics implementation.
3397
3398  $SMN  -no-sm ............. Do not support X Session Management.
3399  $SMY  -sm ................ Support X Session Management, links in -lSM -lICE.
3400
3401  $SHN  -no-xshape ......... Do not compile XShape support.
3402  $SHY  -xshape ............ Compile XShape support.
3403                          Requires X11/extensions/shape.h.
3404
3405  $XVN  -no-xvideo ......... Do not compile XVideo support.
3406  $XVY  -xvideo ............ Compile XVideo support.
3407                          Requires X11/extensions/Xv.h & Xvlib.h.
3408
3409  $SHN  -no-xsync .......... Do not compile XSync support.
3410  $SHY  -xsync ............. Compile XSync support.
3411                          Requires X11/extensions/sync.h.
3412
3413  $XAN  -no-xinerama ....... Do not compile Xinerama (multihead) support.
3414  $XAY  -xinerama .......... Compile Xinerama support.
3415                          Requires X11/extensions/Xinerama.h and libXinerama.
3416                          By default, Xinerama support will be compiled if
3417                          available and the shared libraries are dynamically
3418                          loaded at runtime.
3419
3420  $XCN  -no-xcursor ........ Do not compile Xcursor support.
3421  $XCY  -xcursor ........... Compile Xcursor support.
3422                          Requires X11/Xcursor/Xcursor.h and libXcursor.
3423                          By default, Xcursor support will be compiled if
3424                          available and the shared libraries are dynamically
3425                          loaded at runtime.
3426
3427  $XFN  -no-xfixes ......... Do not compile Xfixes support.
3428  $XFY  -xfixes ............ Compile Xfixes support.
3429                          Requires X11/extensions/Xfixes.h and libXfixes.
3430                          By default, Xfixes support will be compiled if
3431                          available and the shared libraries are dynamically
3432                          loaded at runtime.
3433
3434  $XZN  -no-xrandr ......... Do not compile Xrandr (resize and rotate) support.
3435  $XZY  -xrandr ............ Compile Xrandr support.
3436                          Requires X11/extensions/Xrandr.h and libXrandr.
3437
3438  $XRN  -no-xrender ........ Do not compile Xrender support.
3439  $XRY  -xrender ........... Compile Xrender support.
3440                          Requires X11/extensions/Xrender.h and libXrender.
3441
3442  $XMN  -no-mitshm ......... Do not compile MIT-SHM support.
3443  $XMY  -mitshm ............ Compile MIT-SHM support.
3444                          Requires sys/ipc.h, sys/shm.h and X11/extensions/XShm.h
3445
3446  $FCGN  -no-fontconfig ..... Do not compile FontConfig (anti-aliased font) support.
3447  $FCGY  -fontconfig ........ Compile FontConfig support.
3448                          Requires fontconfig/fontconfig.h, libfontconfig,
3449                          freetype.h and libfreetype.
3450
3451  $XIN  -no-xinput ......... Do not compile Xinput support.
3452  $XIY  -xinput ............ Compile Xinput support. This also enabled tablet support
3453                          which requires IRIX with wacom.h and libXi or
3454                          XFree86 with X11/extensions/XInput.h and libXi.
3455
3456  $XKN  -no-xkb ............ Do not compile XKB (X KeyBoard extension) support.
3457  $XKY  -xkb ............... Compile XKB support.
3458
3459 EOF
3460 fi
3461
3462 if [ "$BUILD_ON_MAC" = "yes" ]; then
3463     cat << EOF
3464
3465 Qt/Mac only:
3466
3467     -Fstring ........... Add an explicit framework path.
3468     -fw string ......... Add an explicit framework.
3469
3470  *  -framework ......... Build Qt as a series of frameworks and
3471                          link tools against those frameworks.
3472     -no-framework ...... Do not build Qt as a series of frameworks.
3473
3474  *  -dwarf2 ............ Enable dwarf2 debugging symbols.
3475     -no-dwarf2 ......... Disable dwarf2 debugging symbols.
3476
3477     -sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. This option requires gcc 4.
3478                          To use a different SDK with gcc 3.3, set the SDKROOT environment variable.
3479
3480     -harfbuzz .......... Use HarfBuzz to do text layout instead of Core Text when possible.
3481  *  -no-harfbuzz ....... Disable HarfBuzz on Mac. It can still be enabled by setting
3482                          QT_ENABLE_HARFBUZZ environment variable.
3483
3484 EOF
3485 fi
3486
3487 if [ "$PLATFORM_QPA" = "yes" ]; then
3488     cat << EOF
3489 Qt for QPA only:
3490 EOF
3491 fi
3492
3493 if [ "$PLATFORM_QPA" = "yes" ]; then
3494     cat << EOF
3495
3496     -xplatform target ... The target platform when cross-compiling.
3497
3498     -no-feature-<feature> Do not compile in <feature>.
3499     -feature-<feature> .. Compile in <feature>. The available features
3500                           are described in src/corelib/global/qfeatures.txt
3501
3502     -no-freetype ........ Do not compile in Freetype2 support.
3503     -qt-freetype ........ Use the libfreetype bundled with Qt.
3504  *  -system-freetype .... Use libfreetype from the operating system.
3505                           See http://www.freetype.org/
3506
3507     -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the
3508                           default ($CFG_QCONFIG).
3509
3510     -no-opengl .......... Do not support OpenGL.
3511     -opengl <api> ....... Enable OpenGL ES support
3512                           With no parameter, this will attempt to auto-detect
3513                           OpenGL ES 2, or regular desktop OpenGL.
3514                           Use es2 for <api> to override auto-detection.
3515 EOF
3516 fi
3517
3518 if [ "$PLATFORM_QPA" = "yes" -o "$PLATFORM_X11" = "yes" ]; then
3519     if [ "$CFG_GLIB" = "no" ]; then
3520         GBY=" "
3521         GBN="+"
3522     else
3523         GBY="+"
3524         GBN=" "
3525     fi
3526     cat << EOF
3527  $GBN  -no-glib ........... Do not compile Glib support.
3528  $GBY  -glib .............. Compile Glib support.
3529
3530 EOF
3531 fi
3532
3533    [ "x$ERROR" = "xyes" ] && exit 1
3534    exit 0
3535 fi # Help
3536
3537
3538 # -----------------------------------------------------------------------------
3539 # LICENSING, INTERACTIVE PART
3540 # -----------------------------------------------------------------------------
3541
3542 if [ "$PLATFORM_QPA" = "yes" ]; then
3543     Platform="Qt Lighthouse"
3544 elif [ "$XPLATFORM_MINGW" = "yes" ]; then
3545     Platform="Qt for Windows"
3546 elif [ -n "`getXQMakeConf grep QMAKE_LIBS_X11`" ]; then
3547     PLATFORM_X11=yes
3548     Platform="Qt for Linux/X11"
3549 fi
3550
3551 echo
3552 echo "This is the $Platform ${EditionString} Edition."
3553 echo
3554
3555 if [ "$Edition" = "OpenSource" ]; then
3556     while true; do
3557         echo "You are licensed to use this software under the terms of"
3558         echo "the Lesser GNU General Public License (LGPL) versions 2.1."
3559         if [ -f "$relpath/LICENSE.GPL3" ]; then
3560             echo "You are also licensed to use this software under the terms of"
3561             echo "the GNU General Public License (GPL) versions 3."
3562             affix="either"
3563         else
3564             affix="the"
3565         fi
3566         echo
3567         if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
3568             echo "You have already accepted the terms of the $LicenseType license."
3569             acceptance=yes
3570         else
3571             if [ -f "$relpath/LICENSE.GPL3" ]; then
3572                 echo "Type '3' to view the GNU General Public License version 3."
3573             fi
3574             echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
3575             echo "Type 'yes' to accept this license offer."
3576             echo "Type 'no' to decline this license offer."
3577             echo
3578             echo $ECHO_N "Do you accept the terms of $affix license? $ECHO_C"
3579             read acceptance
3580         fi
3581         echo
3582         if [ "$acceptance" = "yes" ] || [ "$acceptance" = "y" ]; then
3583             break
3584         elif [ "$acceptance" = "no" ]; then
3585             echo "You are not licensed to use this software."
3586             echo
3587             exit 1
3588         elif [ "$acceptance" = "3" ]; then
3589             more "$relpath/LICENSE.GPL3"
3590         elif [ "$acceptance" = "L" ]; then
3591             more "$relpath/LICENSE.LGPL"
3592         fi
3593     done
3594 elif [ "$Edition" = "Preview" ]; then
3595     TheLicense=`head -n 1 "$relpath/LICENSE.PREVIEW.COMMERCIAL"`
3596     while true; do
3597
3598         if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
3599             echo "You have already accepted the terms of the $LicenseType license."
3600             acceptance=yes
3601         else
3602             echo "You are licensed to use this software under the terms of"
3603             echo "the $TheLicense"
3604             echo
3605             echo "Type '?' to read the Preview License."
3606             echo "Type 'yes' to accept this license offer."
3607             echo "Type 'no' to decline this license offer."
3608             echo
3609             echo $ECHO_N "Do you accept the terms of the license? $ECHO_C"
3610             read acceptance
3611         fi
3612         echo
3613         if [ "$acceptance" = "yes" ]; then
3614             break
3615         elif [ "$acceptance" = "no" ] ;then
3616             echo "You are not licensed to use this software."
3617             echo
3618             exit 0
3619         elif [ "$acceptance" = "?" ]; then
3620             more "$relpath/LICENSE.PREVIEW.COMMERCIAL"
3621         fi
3622     done
3623 elif [ "$Edition" != "OpenSource" ]; then
3624     if [ -n "$ExpiryDate" ]; then
3625         ExpiryDate=`echo $ExpiryDate | sed -e "s,-,,g" | tr -d "\n\r"`
3626         [ -z "$ExpiryDate" ] && ExpiryDate="0"
3627         Today=`date +%Y%m%d`
3628         if [ "$Today" -gt "$ExpiryDate" ]; then
3629             case "$LicenseType" in
3630             Commercial|Academic|Educational)
3631                 if [ "$QT_PACKAGEDATE" -gt "$ExpiryDate" ]; then
3632                     echo
3633                     echo "NOTICE  NOTICE  NOTICE  NOTICE"
3634                     echo
3635                     echo "  Your support and upgrade period has expired."
3636                     echo
3637                     echo "  You are no longer licensed to use this version of Qt."
3638                     echo "  Please contact qt-info@nokia.com to renew your support"
3639                     echo "  and upgrades for this license."
3640                     echo
3641                     echo "NOTICE  NOTICE  NOTICE  NOTICE"
3642                     echo
3643                     exit 1
3644                 else
3645                     echo
3646                     echo "WARNING  WARNING  WARNING  WARNING"
3647                     echo
3648                     echo "  Your support and upgrade period has expired."
3649                     echo
3650                     echo "  You may continue to use your last licensed release"
3651                     echo "  of Qt under the terms of your existing license"
3652                     echo "  agreement. But you are not entitled to technical"
3653                     echo "  support, nor are you entitled to use any more recent"
3654                     echo "  Qt releases."
3655                     echo
3656                     echo "  Please contact qt-info@nokia.com to renew your"
3657                     echo "  support and upgrades for this license."
3658                     echo
3659                     echo "WARNING  WARNING  WARNING  WARNING"
3660                     echo
3661                     sleep 3
3662                 fi
3663                 ;;
3664             Evaluation|*)
3665                 echo
3666                 echo "NOTICE  NOTICE  NOTICE  NOTICE"
3667                 echo
3668                 echo "  Your Evaluation license has expired."
3669                 echo
3670                 echo "  You are no longer licensed to use this software. Please"
3671                 echo "  contact qt-info@nokia.com to purchase license, or install"
3672                 echo "  the Qt Open Source Edition if you intend to develop free"
3673                 echo "  software."
3674                 echo
3675                 echo "NOTICE  NOTICE  NOTICE  NOTICE"
3676                 echo
3677                 exit 1
3678                 ;;
3679             esac
3680         fi
3681     fi
3682     TheLicense=`head -n 1 "$outpath/LICENSE"`
3683     while true; do
3684         if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
3685             echo "You have already accepted the terms of the $TheLicense."
3686             acceptance=yes
3687         else
3688             echo "You are licensed to use this software under the terms of"
3689             echo "the $TheLicense."
3690             echo
3691             echo "Type '?' to view the $TheLicense."
3692             echo "Type 'yes' to accept this license offer."
3693             echo "Type 'no' to decline this license offer."
3694             echo
3695             echo $ECHO_N "Do you accept the terms of the $TheLicense? $ECHO_C"
3696             read acceptance
3697         fi
3698         echo
3699         if [ "$acceptance" = "yes" ]; then
3700             break
3701         elif [ "$acceptance" = "no" ]; then
3702             echo "You are not licensed to use this software."
3703             echo
3704             exit 1
3705         else [ "$acceptance" = "?" ]
3706             more "$outpath/LICENSE"
3707         fi
3708     done
3709 fi
3710
3711 # this should be moved somewhere else
3712 case "$PLATFORM" in
3713 aix-*)
3714     AIX_VERSION=`uname -v`
3715     if [ "$AIX_VERSION" -lt "5" ]; then
3716         QMakeVar add QMAKE_LIBS_X11 -lbind
3717     fi
3718     ;;
3719 *)
3720     ;;
3721 esac
3722
3723 #-------------------------------------------------------------------------------
3724 # generate qconfig.cpp
3725 #-------------------------------------------------------------------------------
3726 [ -d "$outpath/src/corelib/global" ] || mkdir -p "$outpath/src/corelib/global"
3727
3728 cat > "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
3729 /* License Info */
3730 static const char qt_configure_licensee_str          [256 + 12] = "qt_lcnsuser=$Licensee";
3731 static const char qt_configure_licensed_products_str [256 + 12] = "qt_lcnsprod=$Edition";
3732
3733 /* Installation date */
3734 static const char qt_configure_installation          [12+11]    = "qt_instdate=`date +%Y-%m-%d`";
3735
3736 /* Installation Info */
3737 static const char qt_configure_prefix_path_strs[][256 + 12] = {
3738     "qt_prfxpath=$QT_INSTALL_PREFIX",
3739     "qt_docspath=$QT_INSTALL_DOCS",
3740     "qt_hdrspath=$QT_INSTALL_HEADERS",
3741     "qt_libspath=$QT_INSTALL_LIBS",
3742     "qt_binspath=$QT_INSTALL_BINS",
3743     "qt_plugpath=$QT_INSTALL_PLUGINS",
3744     "qt_impspath=$QT_INSTALL_IMPORTS",
3745     "qt_datapath=$QT_INSTALL_DATA",
3746     "qt_trnspath=$QT_INSTALL_TRANSLATIONS",
3747     "qt_xmplpath=$QT_INSTALL_EXAMPLES",
3748     "qt_tstspath=$QT_INSTALL_TESTS",
3749 #ifdef QT_BUILD_QMAKE
3750     "qt_ssrtpath=$CFG_SYSROOT",
3751     "qt_hpfxpath=$QT_HOST_PREFIX",
3752     "qt_hbinpath=$QT_HOST_BINS",
3753     "qt_hdatpath=$QT_HOST_DATA",
3754 #endif
3755 };
3756 static const char qt_configure_settings_path_str[256 + 12] = "qt_stngpath=$QT_INSTALL_SETTINGS";
3757 EOF
3758
3759 cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
3760
3761 /* strlen( "qt_lcnsxxxx" ) == 12 */
3762 #define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;
3763 #define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;
3764
3765 #define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;
3766 EOF
3767
3768 # avoid unecessary rebuilds by copying only if qconfig.cpp has changed
3769 if cmp -s "$outpath/src/corelib/global/qconfig.cpp" "$outpath/src/corelib/global/qconfig.cpp.new"; then
3770     rm -f "$outpath/src/corelib/global/qconfig.cpp.new"
3771 else
3772     [ -f "$outpath/src/corelib/global/qconfig.cpp" ] && chmod +w "$outpath/src/corelib/global/qconfig.cpp"
3773     mv "$outpath/src/corelib/global/qconfig.cpp.new" "$outpath/src/corelib/global/qconfig.cpp"
3774     chmod -w "$outpath/src/corelib/global/qconfig.cpp"
3775 fi
3776
3777 # -----------------------------------------------------------------------------
3778 if [ "$LicenseType" = "Evaluation" ]; then
3779     EVALKEY=qt_qevalkey=$LicenseKeyExt
3780 elif echo "$D_FLAGS" | grep QT_EVAL >/dev/null 2>&1; then
3781     EVALKEY=qt_qevalkey=
3782 fi
3783
3784 if [ -n "$EVALKEY" ]; then
3785     rm -f "$outpath/src/corelib/global/qconfig_eval.cpp"
3786     cat > "$outpath/src/corelib/global/qconfig_eval.cpp" <<EOF
3787 /* Evaluation license key */
3788 static const volatile char qt_eval_key_data                   [512 + 12] = "$EVALKEY";
3789 EOF
3790     chmod -w "$outpath/src/corelib/global/qconfig_eval.cpp"
3791 fi
3792
3793
3794 # -----------------------------------------------------------------------------
3795 # build qmake
3796 # -----------------------------------------------------------------------------
3797
3798 # symlink includes
3799 if [ -n "$PERL" ] && [ -x "$relpath/bin/syncqt" ]; then
3800     SYNCQT_OPTS=
3801     [ "$CFG_DEV" = "yes" ] && SYNCQT_OPTS="$SYNCQT_OPTS -check-includes"
3802     if [ "$OPT_SHADOW" = "yes" ]; then
3803         "$outpath/bin/syncqt" $SYNCQT_OPTS "$relpath" || exit 1
3804     elif [ "$CFG_DEV" = "yes" ] || [ ! -d $relpath/include ] || [ -d $relpath/.git ]; then
3805         QTDIR="$relpath" perl "$outpath/bin/syncqt" $SYNCQT_OPTS || exit 1
3806     fi
3807 fi
3808
3809 # $1: input variable name (awk regexp)
3810 # $2: optional output variable name
3811 # $3: optional value transformation (sed command)
3812 # relies on $QMAKESPEC, $COMPILER_CONF and $mkfile being set correctly, as the latter
3813 # is where the resulting variable is written to
3814 setBootstrapVariable()
3815 {
3816     getQMakeConf "$1" | echo ${2-$1} = `if [ -n "$3" ]; then sed "$3"; else cat; fi` >> "$mkfile"
3817 }
3818
3819 # build qmake
3820 if true; then ###[ '!' -f "$outpath/bin/qmake" ];
3821     echo "Creating qmake. Please wait..."
3822
3823     OLD_QCONFIG_H=
3824     QCONFIG_H="$outpath/src/corelib/global/qconfig.h"
3825     QMAKE_QCONFIG_H="${QCONFIG_H}.qmake"
3826     if [ -f "$QCONFIG_H" ]; then
3827          OLD_QCONFIG_H=$QCONFIG_H
3828          mv -f "$OLD_QCONFIG_H" "${OLD_QCONFIG_H}.old"
3829     fi
3830
3831     # create temporary qconfig.h for compiling qmake, if it doesn't exist
3832     # when building qmake, we use #defines for the install paths,
3833     # however they are real functions in the library
3834     if [ '!' -f "$QMAKE_QCONFIG_H" ]; then
3835         mkdir -p "$outpath/src/corelib/global"
3836         [ -f "$QCONFIG_H" ] && chmod +w "$QCONFIG_H"
3837         echo "/* All features enabled while building qmake */" >"$QMAKE_QCONFIG_H"
3838     fi
3839
3840     mv -f "$QMAKE_QCONFIG_H" "$QCONFIG_H"
3841
3842     #mkspecs/default is used as a (gasp!) default mkspec so QMAKESPEC needn't be set once configured
3843     rm -rf mkspecs/default
3844     ln -s `echo $XQMAKESPEC | sed "s,^${relpath}/mkspecs/,,"` mkspecs/default
3845     mkdir -p "$outpath/qmake" || exit
3846     # fix makefiles
3847     for mkfile in GNUmakefile Makefile; do
3848         EXTRA_LFLAGS=
3849         EXTRA_CFLAGS=
3850         in_mkfile="${mkfile}.in"
3851         if [ "$mkfile" = "Makefile" ]; then
3852 #           if which qmake >/dev/null 2>&1 && [ -f qmake/qmake.pro ]; then
3853 #               (cd qmake && qmake) >/dev/null 2>&1 && continue
3854 #           fi
3855             in_mkfile="${mkfile}.unix"
3856         fi
3857         in_mkfile="$relpath/qmake/$in_mkfile"
3858         mkfile="$outpath/qmake/$mkfile"
3859         if [ -f "$mkfile" ]; then
3860             [ "$CFG_DEV" = "yes" ] && "$WHICH" chflags >/dev/null 2>&1 && chflags nouchg "$mkfile"
3861             rm -f "$mkfile"
3862         fi
3863         [ -f "$in_mkfile" ] || continue
3864
3865         echo "########################################################################" > "$mkfile"
3866         echo "## This file was autogenerated by configure, all changes will be lost ##" >> "$mkfile"
3867         echo "########################################################################" >> "$mkfile"
3868         EXTRA_OBJS=
3869         EXTRA_SRCS=
3870         EXTRA_CFLAGS="\$(QMAKE_CFLAGS)"
3871         EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS)"
3872         EXTRA_LFLAGS="\$(QMAKE_LFLAGS)"
3873
3874         if [ "$PLATFORM" = "irix-cc" ] || [ "$PLATFORM" = "irix-cc-64" ]; then
3875             EXTRA_LFLAGS="$EXTRA_LFLAGS -lm"
3876         fi
3877
3878         [ "$CFG_SILENT" = "yes" ] && CC_TRANSFORM='s,^,\@,' || CC_TRANSFORM=
3879         setBootstrapVariable QMAKE_CC CC "$CC_TRANSFORM"
3880         setBootstrapVariable QMAKE_CXX CXX "$CC_TRANSFORM"
3881         setBootstrapVariable QMAKE_CFLAGS
3882         setBootstrapVariable QMAKE_CXXFLAGS
3883         setBootstrapVariable QMAKE_LFLAGS
3884
3885         if [ $QT_EDITION = "QT_EDITION_OPENSOURCE" ]; then
3886             EXTRA_CFLAGS="$EXTRA_CFLAGS -DQMAKE_OPENSOURCE_EDITION"
3887             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -DQMAKE_OPENSOURCE_EDITION"
3888         fi
3889         if [ "$CFG_RELEASE_QMAKE" = "yes" ]; then
3890             setBootstrapVariable QMAKE_CFLAGS_RELEASE
3891             setBootstrapVariable QMAKE_CXXFLAGS_RELEASE
3892             EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_RELEASE)"
3893             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_RELEASE)"
3894         elif [ "$CFG_DEBUG" = "yes" ]; then
3895             setBootstrapVariable QMAKE_CFLAGS_DEBUG
3896             setBootstrapVariable QMAKE_CXXFLAGS_DEBUG
3897             EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_DEBUG)"
3898             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_DEBUG)"
3899         fi
3900
3901         if [ -n "$RPATH_FLAGS" ] && [ -n "`getQMakeConf 'QMAKE_(LFLAGS_)?RPATH'`" ]; then
3902             setBootstrapVariable "QMAKE_(LFLAGS_)?RPATH" QMAKE_LFLAGS_RPATH
3903             for rpath in $RPATH_FLAGS; do
3904                 EXTRA_LFLAGS="\$(QMAKE_LFLAGS_RPATH)\"$rpath\" $EXTRA_LFLAGS"
3905             done
3906         fi
3907         if [ "$BUILD_ON_MAC" = "yes" ]; then
3908             echo "export MACOSX_DEPLOYMENT_TARGET = 10.6" >> "$mkfile"
3909             echo "CARBON_LFLAGS =-framework ApplicationServices" >>"$mkfile"
3910             echo "CARBON_CFLAGS =-fconstant-cfstrings" >>"$mkfile"
3911             EXTRA_LFLAGS="$EXTRA_LFLAGS \$(CARBON_LFLAGS)"
3912             EXTRA_CFLAGS="$EXTRA_CFLAGS \$(CARBON_CFLAGS)"
3913             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(CARBON_CFLAGS)"
3914             EXTRA_OBJS="qsettings_mac.o qcore_mac.o"
3915             EXTRA_SRCS="\"$relpath/src/corelib/io/qsettings_mac.cpp\" \"$relpath/src/corelib/kernel/qcore_mac.cpp\""
3916             if [ '!' -z "$CFG_SDK" ]; then
3917                 echo "SDK_LFLAGS =-Wl,-syslibroot,$CFG_SDK" >>"$mkfile"
3918                 echo "SDK_CFLAGS =-isysroot $CFG_SDK" >>"$mkfile"
3919                 EXTRA_CFLAGS="$EXTRA_CFLAGS \$(SDK_CFLAGS)"
3920                 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(SDK_CFLAGS)"
3921                 EXTRA_LFLAGS="$EXTRA_LFLAGS \$(SDK_LFLAGS)"
3922             fi
3923         fi
3924         if [ '!' -z "$D_FLAGS" ]; then
3925             for DEF in $D_FLAGS; do
3926                 EXTRA_CFLAGS="$EXTRA_CFLAGS \"-D${DEF}\""
3927             done
3928         fi
3929         QMAKE_BIN_DIR="$QT_INSTALL_BINS"
3930         [ -z "$QMAKE_BIN_DIR" ] && QMAKE_BIN_DIR="${QT_INSTALL_PREFIX}/bin"
3931         QMAKE_DATA_DIR="$QT_INSTALL_DATA"
3932         [ -z "$QMAKE_DATA_DIR" ] && QMAKE_DATA_DIR="${QT_INSTALL_PREFIX}"
3933         echo >>"$mkfile"
3934         adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'`
3935         adjoutpath=`echo "$outpath" | sed 's/ /\\\\\\\\ /g'`
3936         adjqmakespec=`echo "$QMAKESPEC" | sed 's/ /\\\\\\\\ /g'`
3937         sed -e "s,@SOURCE_PATH@,$adjrelpath,g" -e "s,@BUILD_PATH@,$adjoutpath,g" \
3938             -e "s,@QMAKE_CFLAGS@,$EXTRA_CFLAGS,g" -e "s,@QMAKE_LFLAGS@,$EXTRA_LFLAGS,g" \
3939             -e "s,@QMAKE_CXXFLAGS@,$EXTRA_CXXFLAGS,g" \
3940             -e "s,@QT_INSTALL_BINS@,\$(INSTALL_ROOT)$QMAKE_BIN_DIR,g" \
3941             -e "s,@QT_INSTALL_DATA@,\$(INSTALL_ROOT)$QMAKE_DATA_DIR,g" \
3942             -e "s,@QMAKE_QTOBJS@,$EXTRA_OBJS,g" -e "s,@QMAKE_QTSRCS@,$EXTRA_SRCS,g" \
3943             -e "s,@QMAKESPEC@,$adjqmakespec,g" -e "s,@QT_VERSION@,$QT_VERSION,g" "$in_mkfile" >>"$mkfile"
3944
3945         if "$WHICH" makedepend >/dev/null 2>&1 && grep 'depend:' "$mkfile" >/dev/null 2>&1; then
3946             (cd "$outpath/qmake" && "$MAKE" -f "$mkfile" depend) >/dev/null 2>&1
3947             sed "s,^.*/\([^/]*.o\):,\1:,g" "$mkfile" >"$mkfile.tmp"
3948             sed "s,$outpath,$adjoutpath,g" "$mkfile.tmp" >"$mkfile"
3949             rm "$mkfile.tmp"
3950         fi
3951     done
3952
3953     QMAKE_BUILD_ERROR=no
3954     (cd "$outpath/qmake"; "$MAKE") || QMAKE_BUILD_ERROR=yes
3955     [ '!' -z "$QCONFIG_H" ] && mv -f "$QCONFIG_H" "$QMAKE_QCONFIG_H" #move qmake's qconfig.h to qconfig.h.qmake
3956     [ '!' -z "$OLD_QCONFIG_H" ] && mv -f "${OLD_QCONFIG_H}.old" "$OLD_QCONFIG_H" #put back qconfig.h
3957     [ "$QMAKE_BUILD_ERROR" = "yes" ] && exit 2
3958 fi # Build qmake
3959
3960 #-------------------------------------------------------------------------------
3961 # tests that need qmake
3962 #-------------------------------------------------------------------------------
3963
3964 #-------------------------------------------------------------------------------
3965 # determine the target and host architectures
3966 #-------------------------------------------------------------------------------
3967
3968 # Use config.tests/arch/arch.pro to has the compiler tell us what the target architecture is
3969 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'`
3970
3971 [ -z "$CFG_ARCH" ] && CFG_ARCH="unknown"
3972 if [ "$QMAKESPEC" != "$XQMAKESPEC" ]; then
3973     # Do the same test again, using the host compiler
3974     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'`
3975     [ -z "$CFG_HOST_ARCH" ] && CFG_HOST_ARCH="unknown"
3976 else
3977     # not cross compiling, host == target
3978     CFG_HOST_ARCH="$CFG_ARCH"
3979 fi
3980
3981 if [ "$OPT_VERBOSE" = "yes" ]; then
3982     echo "System architecture: '$CFG_ARCH'"
3983     if [ "$PLATFORM_QPA" = "yes" ]; then
3984         echo "Host architecture: '$CFG_HOST_ARCH'"
3985     fi
3986 fi
3987
3988 #-------------------------------------------------------------------------------
3989 # functionality tests
3990 #-------------------------------------------------------------------------------
3991
3992 # detect availability of float math.h functions
3993 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/floatmath "floatmath" $L_FLAGS $I_FLAGS $l_FLAGS; then
3994     CFG_USE_FLOATMATH=yes
3995 else
3996     CFG_USE_FLOATMATH=no
3997 fi
3998
3999 # detect mmx support
4000 if [ "${CFG_MMX}" = "auto" ]; then
4001     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mmx "mmx" $L_FLAGS $I_FLAGS $l_FLAGS "-mmmx"; then
4002         CFG_MMX=yes
4003     else
4004         CFG_MMX=no
4005     fi
4006 fi
4007
4008 # detect 3dnow support
4009 if [ "${CFG_3DNOW}" = "auto" ]; then
4010     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/3dnow "3dnow" $L_FLAGS $I_FLAGS $l_FLAGS "-m3dnow"; then
4011         CFG_3DNOW=yes
4012     else
4013         CFG_3DNOW=no
4014     fi
4015 fi
4016
4017 # detect sse support
4018 if [ "${CFG_SSE}" = "auto" ]; then
4019     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse "sse" $L_FLAGS $I_FLAGS $l_FLAGS "-msse"; then
4020         CFG_SSE=yes
4021     else
4022         CFG_SSE=no
4023     fi
4024 fi
4025
4026 # detect sse2 support
4027 if [ "${CFG_SSE2}" = "auto" ]; then
4028     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse2 "sse2" $L_FLAGS $I_FLAGS $l_FLAGS "-msse2"; then
4029        CFG_SSE2=yes
4030     else
4031        CFG_SSE2=no
4032     fi
4033 fi
4034
4035 # detect sse3 support
4036 if [ "${CFG_SSE3}" = "auto" ]; then
4037     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse3 "sse3" $L_FLAGS $I_FLAGS $l_FLAGS "-msse3"; then
4038        CFG_SSE3=yes
4039     else
4040        CFG_SSE3=no
4041     fi
4042 fi
4043
4044 # detect ssse3 support
4045 if [ "${CFG_SSSE3}" = "auto" ]; then
4046     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ssse3 "ssse3" $L_FLAGS $I_FLAGS $l_FLAGS "-mssse3"; then
4047        CFG_SSSE3=yes
4048     else
4049        CFG_SSSE3=no
4050     fi
4051 fi
4052
4053 # detect sse4.1 support
4054 if [ "${CFG_SSE4_1}" = "auto" ]; then
4055     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
4056        CFG_SSE4_1=yes
4057     else
4058        CFG_SSE4_1=no
4059     fi
4060 fi
4061
4062 # detect sse4.2 support
4063 if [ "${CFG_SSE4_2}" = "auto" ]; then
4064     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
4065        CFG_SSE4_2=yes
4066     else
4067        CFG_SSE4_2=no
4068     fi
4069 fi
4070
4071 # detect avx support
4072 if [ "${CFG_AVX}" = "auto" ]; then
4073     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/avx "avx" $L_FLAGS $I_FLAGS $l_FLAGS "-mavx"; then
4074        CFG_AVX=yes
4075     else
4076        CFG_AVX=no
4077     fi
4078 fi
4079
4080 # check iWMMXt support
4081 if [ "$CFG_IWMMXT" = "yes" ]; then
4082     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iwmmxt "iwmmxt" $L_FLAGS $I_FLAGS $l_FLAGS "-mcpu=iwmmxt"
4083     if [ $? != "0" ]; then
4084         echo "The iWMMXt functionality test failed!"
4085         echo " Please make sure your compiler supports iWMMXt intrinsics!"
4086         exit 1
4087     fi
4088 fi
4089
4090 # detect neon support
4091 if [ "$CFG_ARCH" = "arm" ] && [ "${CFG_NEON}" = "auto" ]; then
4092     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
4093         CFG_NEON=yes
4094     else
4095         CFG_NEON=no
4096     fi
4097 elif [ "$CFG_ARCH" != "arm" ]; then
4098     CFG_NEON=no
4099 fi
4100
4101 # detect mips_dsp support
4102 if [ "${CFG_ARCH}" = "mips" ] && [ "${CFG_MIPS_DSP}" = "yes" ]; then
4103   CFG_MIPS_DSP=yes
4104     else
4105   CFG_MIPS_DSP=no
4106 fi
4107
4108 # detect mips_dspr2 support
4109 if [ "${CFG_ARCH}" = "mips" ] && [ "${CFG_MIPS_DSPR2}" = "yes" ]; then
4110   CFG_MIPS_DSPR2=yes
4111     else
4112   CFG_MIPS_DSPR2=no
4113 fi
4114
4115 [ "$XPLATFORM_MINGW" = "yes" ] && QMakeVar add styles "windowsxp windowsvista"
4116
4117 # detect zlib
4118 if [ "$CFG_ZLIB" = "no" ]; then
4119     # Note: Qt no longer support builds without zlib
4120     # So we force a "no" to be "auto" here.
4121     # If you REALLY really need no zlib support, you can still disable
4122     # it by doing the following:
4123     #   add "no-zlib" to mkspecs/qconfig.pri
4124     #   #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h)
4125     #
4126     # There's no guarantee that Qt will build under those conditions
4127
4128     CFG_ZLIB=auto
4129     ZLIB_FORCED=yes
4130 fi
4131 if [ "$CFG_ZLIB" = "auto" ]; then
4132     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
4133        CFG_ZLIB=system
4134     else
4135        CFG_ZLIB=yes
4136     fi
4137 fi
4138
4139 if [ "$CFG_LARGEFILE" = "auto" ]; then
4140     #Large files should be enabled for all Linux systems
4141     CFG_LARGEFILE=yes
4142 fi
4143
4144 if [ "$CFG_GUI" = "no" ]; then
4145     QPA_PLATFORM_GUARD=no
4146 fi
4147
4148 # detect how jpeg should be built
4149 if [ "$CFG_JPEG" = "auto" ]; then
4150     if [ "$CFG_SHARED" = "yes" ]; then
4151         CFG_JPEG=plugin
4152     else
4153         CFG_JPEG=yes
4154     fi
4155 fi
4156 # detect jpeg
4157 if [ "$CFG_LIBJPEG" = "auto" ]; then
4158     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
4159        CFG_LIBJPEG=system
4160     else
4161        CFG_LIBJPEG=qt
4162     fi
4163 fi
4164
4165 # detect how gif should be built
4166 if [ "$CFG_GIF" = "auto" ]; then
4167     if [ "$CFG_SHARED" = "yes" ]; then
4168         CFG_GIF=plugin
4169     else
4170         CFG_GIF=yes
4171     fi
4172 fi
4173
4174 # detect png
4175 if [ "$CFG_LIBPNG" = "auto" ]; then
4176     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
4177        CFG_LIBPNG=system
4178     else
4179        CFG_LIBPNG=qt
4180     fi
4181 fi
4182
4183 # detect accessibility
4184 if [ "$CFG_ACCESSIBILITY" = "auto" ]; then
4185     CFG_ACCESSIBILITY=yes
4186 fi
4187
4188 if [ "$CFG_EGLFS" = "yes" ]; then
4189     if [ "$CFG_EGL" = "no" ]; then
4190         echo "The EGLFS plugin requires EGL support and cannot be built"
4191         exit 101
4192     fi
4193     CFG_EGL=yes
4194 fi
4195
4196 # auto-detect SQL-modules support
4197 for _SQLDR in $CFG_SQL_AVAILABLE; do
4198         case $_SQLDR in
4199         mysql)
4200             if [ "$CFG_SQL_mysql" != "no" ]; then
4201                 [ -z "$CFG_MYSQL_CONFIG" ] && CFG_MYSQL_CONFIG=`"$WHICH" mysql_config`
4202                 if [ -x "$CFG_MYSQL_CONFIG" ]; then
4203                     QT_CFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --include 2>/dev/null`
4204                     QT_LFLAGS_MYSQL_R=`$CFG_MYSQL_CONFIG --libs_r 2>/dev/null`
4205                     QT_LFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --libs 2>/dev/null`
4206                     QT_MYSQL_VERSION=`$CFG_MYSQL_CONFIG --version 2>/dev/null`
4207                     QT_MYSQL_VERSION_MAJOR=`echo $QT_MYSQL_VERSION | cut -d . -f 1`
4208                 fi
4209                 if [ -n "$QT_MYSQL_VERSION" ] && [ "$QT_MYSQL_VERSION_MAJOR" -lt 4 ]; then
4210                     if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4211                         echo "This version of MySql is not supported ($QT_MYSQL_VERSION)."
4212                         echo " You need MySql 4 or higher."
4213                         echo " If you believe this message is in error you may use the continue"
4214                         echo " switch (-continue) to $0 to continue."
4215                         exit 101
4216                     else
4217                         CFG_SQL_mysql="no"
4218                         QT_LFLAGS_MYSQL=""
4219                         QT_LFLAGS_MYSQL_R=""
4220                         QT_CFLAGS_MYSQL=""
4221                     fi
4222                 else
4223                     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
4224                         QMakeVar add CONFIG use_libmysqlclient_r
4225                         if [ "$CFG_SQL_mysql" = "auto" ]; then
4226                             CFG_SQL_mysql=plugin
4227                         fi
4228                         QT_LFLAGS_MYSQL="$QT_LFLAGS_MYSQL_R"
4229                     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
4230                         if [ "$CFG_SQL_mysql" = "auto" ]; then
4231                             CFG_SQL_mysql=plugin
4232                         fi
4233                     else
4234                         if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4235                             echo "MySQL support cannot be enabled due to functionality tests!"
4236                             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4237                             echo " If you believe this message is in error you may use the continue"
4238                             echo " switch (-continue) to $0 to continue."
4239                             exit 101
4240                         else
4241                             CFG_SQL_mysql=no
4242                             QT_LFLAGS_MYSQL=""
4243                             QT_LFLAGS_MYSQL_R=""
4244                             QT_CFLAGS_MYSQL=""
4245                         fi
4246                     fi
4247                 fi
4248             fi
4249             ;;
4250         psql)
4251             if [ "$CFG_SQL_psql" != "no" ]; then
4252                 # Be careful not to use native pg_config when cross building.
4253                 if [ "$XPLATFORM_MINGW" != "yes" ] && "$WHICH" pg_config >/dev/null 2>&1; then
4254                     QT_CFLAGS_PSQL=`pg_config --includedir 2>/dev/null`
4255                     QT_LFLAGS_PSQL=`pg_config --libdir 2>/dev/null`
4256                 fi
4257                 [ -z "$QT_CFLAGS_PSQL" ] || QT_CFLAGS_PSQL="-I$QT_CFLAGS_PSQL"
4258                 [ -z "$QT_LFLAGS_PSQL" ] || QT_LFLAGS_PSQL="-L$QT_LFLAGS_PSQL"
4259                 # But, respect PSQL_LIBS if set
4260                 [ -z "$PSQL_LIBS" ] || QT_LFLAGS_PSQL="$PSQL_LIBS"
4261                 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
4262                     if [ "$CFG_SQL_psql" = "auto" ]; then
4263                         CFG_SQL_psql=plugin
4264                     fi
4265                 else
4266                     if [ "$CFG_SQL_psql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4267                         echo "PostgreSQL support cannot be enabled due to functionality tests!"
4268                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4269                         echo " If you believe this message is in error you may use the continue"
4270                         echo " switch (-continue) to $0 to continue."
4271                         exit 101
4272                     else
4273                         CFG_SQL_psql=no
4274                         QT_CFLAGS_PSQL=""
4275                         QT_LFLAGS_PSQL=""
4276                     fi
4277                 fi
4278             fi
4279         ;;
4280         odbc)
4281             if [ "$CFG_SQL_odbc" != "no" ]; then
4282                 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
4283                     if [ "$CFG_SQL_odbc" = "auto" ]; then
4284                         CFG_SQL_odbc=plugin
4285                     fi
4286                 else
4287                     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
4288                         QT_LFLAGS_ODBC="-liodbc"
4289                         if [ "$CFG_SQL_odbc" = "auto" ]; then
4290                             CFG_SQL_odbc=plugin
4291                         fi
4292                     else
4293                         if [ "$CFG_SQL_odbc" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4294                             echo "ODBC support cannot be enabled due to functionality tests!"
4295                             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4296                             echo " If you believe this message is in error you may use the continue"
4297                             echo " switch (-continue) to $0 to continue."
4298                             exit 101
4299                         else
4300                             CFG_SQL_odbc=no
4301                         fi
4302                     fi
4303                 fi
4304             fi
4305             ;;
4306         oci)
4307             if [ "$CFG_SQL_oci" != "no" ]; then
4308                 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
4309                     if [ "$CFG_SQL_oci" = "auto" ]; then
4310                         CFG_SQL_oci=plugin
4311                     fi
4312                 else
4313                     if [ "$CFG_SQL_oci" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4314                         echo "Oracle (OCI) support cannot be enabled due to functionality tests!"
4315                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4316                         echo " If you believe this message is in error you may use the continue"
4317                         echo " switch (-continue) to $0 to continue."
4318                         exit 101
4319                     else
4320                         CFG_SQL_oci=no
4321                     fi
4322                 fi
4323             fi
4324             ;;
4325         tds)
4326             if [ "$CFG_SQL_tds" != "no" ]; then
4327                 [ -z "$SYBASE" ] || QT_LFLAGS_TDS="-L$SYBASE/lib"
4328                 [ -z "$SYBASE_LIBS" ] || QT_LFLAGS_TDS="$QT_LFLAGS_TDS $SYBASE_LIBS"
4329                 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
4330                     if [ "$CFG_SQL_tds" = "auto" ]; then
4331                         CFG_SQL_tds=plugin
4332                     fi
4333                 else
4334                     if [ "$CFG_SQL_tds" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4335                         echo "TDS support cannot be enabled due to functionality tests!"
4336                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4337                         echo " If you believe this message is in error you may use the continue"
4338                         echo " switch (-continue) to $0 to continue."
4339                         exit 101
4340                     else
4341                         CFG_SQL_tds=no
4342                     fi
4343                 fi
4344             fi
4345             ;;
4346         db2)
4347             if [ "$CFG_SQL_db2" != "no" ]; then
4348                 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
4349                     if [ "$CFG_SQL_db2" = "auto" ]; then
4350                         CFG_SQL_db2=plugin
4351                     fi
4352                 else
4353                     if [ "$CFG_SQL_db2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4354                         echo "ODBC support cannot be enabled due to functionality tests!"
4355                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4356                         echo " If you believe this message is in error you may use the continue"
4357                         echo " switch (-continue) to $0 to continue."
4358                         exit 101
4359                     else
4360                         CFG_SQL_db2=no
4361                     fi
4362                 fi
4363             fi
4364             ;;
4365         ibase)
4366             if [ "$CFG_SQL_ibase" != "no" ]; then
4367                 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
4368                     if [ "$CFG_SQL_ibase" = "auto" ]; then
4369                         CFG_SQL_ibase=plugin
4370                     fi
4371                 else
4372                     if [ "$CFG_SQL_ibase" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4373                         echo "InterBase support cannot be enabled due to functionality tests!"
4374                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4375                         echo " If you believe this message is in error you may use the continue"
4376                         echo " switch (-continue) to $0 to continue."
4377                         exit 101
4378                     else
4379                         CFG_SQL_ibase=no
4380                     fi
4381                 fi
4382             fi
4383             ;;
4384         sqlite2)
4385             if [ "$CFG_SQL_sqlite2" != "no" ]; then
4386                 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
4387                     if [ "$CFG_SQL_sqlite2" = "auto" ]; then
4388                         CFG_SQL_sqlite2=plugin
4389                     fi
4390                 else
4391                     if [ "$CFG_SQL_sqlite2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4392                         echo "SQLite2 support cannot be enabled due to functionality tests!"
4393                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4394                         echo " If you believe this message is in error you may use the continue"
4395                         echo " switch (-continue) to $0 to continue."
4396                         exit 101
4397                     else
4398                         CFG_SQL_sqlite2=no
4399                     fi
4400                 fi
4401             fi
4402             ;;
4403         sqlite)
4404             if [ "$CFG_SQL_sqlite" != "no" ]; then
4405                 SQLITE_AUTODETECT_FAILED="no"
4406                 if [ "$CFG_SQLITE" = "system" ]; then
4407                     if [ -n "$PKG_CONFIG" ]; then
4408                         QT_CFLAGS_SQLITE=`$PKG_CONFIG --cflags sqlite3 2>/dev/null`
4409                         QT_LFLAGS_SQLITE=`$PKG_CONFIG --libs sqlite3 2>/dev/null`
4410                     fi
4411                     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
4412                         if [ "$CFG_SQL_sqlite" = "auto" ]; then
4413                             CFG_SQL_sqlite=plugin
4414                         fi
4415                         QMAKE_CONFIG="$QMAKE_CONFIG system-sqlite"
4416                     else
4417                         SQLITE_AUTODETECT_FAILED="yes"
4418                         CFG_SQL_sqlite=no
4419                     fi
4420                 elif [ -f "$relpath/src/3rdparty/sqlite/sqlite3.h" ]; then
4421                     if [ "$CFG_SQL_sqlite" = "auto" ]; then
4422                             CFG_SQL_sqlite=plugin
4423                     fi
4424                 else
4425                     SQLITE_AUTODETECT_FAILED="yes"
4426                     CFG_SQL_sqlite=no
4427                 fi
4428
4429                 if [ "$SQLITE_AUTODETECT_FAILED" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4430                     echo "SQLite support cannot be enabled due to functionality tests!"
4431                     echo " Turn on verbose messaging (-v) to $0 to see the final report."
4432                     echo " If you believe this message is in error you may use the continue"
4433                     echo " switch (-continue) to $0 to continue."
4434                     exit 101
4435                 fi
4436             fi
4437             ;;
4438         *)
4439             if [ "$OPT_VERBOSE" = "yes" ]; then
4440                 echo "unknown SQL driver: $_SQLDR"
4441             fi
4442             ;;
4443         esac
4444 done
4445
4446 # auto-detect NIS support
4447 if [ "$CFG_NIS" != "no" ]; then
4448     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
4449         CFG_NIS=yes
4450     else
4451         if [ "$CFG_NIS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4452             echo "NIS support cannot be enabled due to functionality tests!"
4453             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4454             echo " If you believe this message is in error you may use the continue"
4455             echo " switch (-continue) to $0 to continue."
4456             exit 101
4457         else
4458             CFG_NIS=no
4459         fi
4460     fi
4461 fi
4462
4463 # auto-detect CUPS support
4464 if [ "$CFG_CUPS" != "no" ]; then
4465     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
4466         CFG_CUPS=yes
4467     else
4468         if [ "$CFG_CUPS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4469             echo "Cups support cannot be enabled due to functionality tests!"
4470             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4471             echo " If you believe this message is in error you may use the continue"
4472             echo " switch (-continue) to $0 to continue."
4473             exit 101
4474         else
4475             CFG_CUPS=no
4476         fi
4477     fi
4478 fi
4479
4480 # auto-detect iconv(3) support
4481 if [ "$CFG_ICONV" != "no" ]; then
4482     if [ "$XPLATFORM_MINGW" = "yes" ]; then
4483         CFG_ICONV=no
4484     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
4485         CFG_ICONV=yes
4486     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
4487         CFG_ICONV=sun
4488     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
4489         CFG_ICONV=gnu
4490     else
4491         if [ "$CFG_ICONV" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4492             echo "Iconv support cannot be enabled due to functionality tests!"
4493             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4494             echo " If you believe this message is in error you may use the continue"
4495             echo " switch (-continue) to $0 to continue."
4496             exit 101
4497         else
4498             CFG_ICONV=no
4499         fi
4500     fi
4501 fi
4502
4503 # auto-detect libdbus-1 support
4504 if [ "$CFG_DBUS" != "no" ]; then
4505     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then
4506         QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null`
4507         QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null`
4508     fi
4509     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
4510         [ "$CFG_DBUS" = "auto" ] && CFG_DBUS=yes
4511         QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
4512         QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS"
4513     else
4514         if [ "$CFG_DBUS" = "auto" ]; then
4515             CFG_DBUS=no
4516         elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4517             # CFG_DBUS is "yes" or "linked" here
4518
4519             echo "The QtDBus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found."
4520             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4521             echo " If you believe this message is in error you may use the continue"
4522             echo " switch (-continue) to $0 to continue."
4523             exit 101
4524         fi
4525     fi
4526 fi
4527
4528 # X11/Lighthouse
4529 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
4530
4531     # auto-detect Glib support
4532     if [ "$CFG_GLIB" != "no" ]; then
4533         if [ -n "$PKG_CONFIG" ]; then
4534             QT_CFLAGS_GLIB=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0 2>/dev/null`
4535             QT_LIBS_GLIB=`$PKG_CONFIG --libs glib-2.0 gthread-2.0 2>/dev/null`
4536         fi
4537         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
4538             CFG_GLIB=yes
4539             QMakeVar set QT_CFLAGS_GLIB "$QT_CFLAGS_GLIB"
4540             QMakeVar set QT_LIBS_GLIB "$QT_LIBS_GLIB"
4541         else
4542             if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4543                 echo "Glib support cannot be enabled due to functionality tests!"
4544                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4545                 echo " If you believe this message is in error you may use the continue"
4546                 echo " switch (-continue) to $0 to continue."
4547                 exit 101
4548             else
4549                 CFG_GLIB=no
4550             fi
4551         fi
4552     fi
4553
4554     # ### Vestige
4555     if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then
4556         if [ -n "$PKG_CONFIG" ]; then
4557             QT_CFLAGS_GSTREAMER=`$PKG_CONFIG --cflags gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
4558             QT_LIBS_GSTREAMER=`$PKG_CONFIG --libs gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
4559         fi
4560         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
4561             CFG_GSTREAMER=yes
4562             QMakeVar set QT_CFLAGS_GSTREAMER "$QT_CFLAGS_GSTREAMER"
4563             QMakeVar set QT_LIBS_GSTREAMER "$QT_LIBS_GSTREAMER"
4564         else
4565             if [ "$CFG_GSTREAMER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4566                 echo "Gstreamer support cannot be enabled due to functionality tests!"
4567                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4568                 echo " If you believe this message is in error you may use the continue"
4569                 echo " switch (-continue) to $0 to continue."
4570                 exit 101
4571             else
4572                 CFG_GSTREAMER=no
4573             fi
4574         fi
4575     elif [ "$CFG_GLIB" = "no" ]; then
4576         CFG_GSTREAMER=no
4577     fi
4578
4579     # auto-detect libicu support
4580     if [ "$CFG_ICU" != "no" ]; then
4581         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/icu "ICU" $L_FLAGS $I_FLAGS $l_FLAGS; then
4582             [ "$CFG_ICU" = "auto" ] && CFG_ICU=yes
4583         else
4584             if [ "$CFG_ICU" = "auto" ]; then
4585                 CFG_ICU=no
4586             elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4587                 # CFG_ICU is "yes"
4588
4589                 echo "The ICU library support cannot be enabled."
4590                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4591                 echo " If you believe this message is in error you may use the continue"
4592                 echo " switch (-continue) to $0 to continue."
4593                 exit 101
4594             fi
4595         fi
4596     fi
4597
4598     # Auto-detect PulseAudio support
4599     if [ "$CFG_PULSEAUDIO" != "no" ]; then
4600         if [ -n "$PKG_CONFIG" ]; then
4601             QT_CFLAGS_PULSEAUDIO=`$PKG_CONFIG --cflags libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
4602             QT_LIBS_PULSEAUDIO=`$PKG_CONFIG --libs libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
4603         fi
4604         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
4605             CFG_PULSEAUDIO=yes
4606             QMakeVar set QT_CFLAGS_PULSEAUDIO "$QT_CFLAGS_PULSEAUDIO"
4607             QMakeVar set QT_LIBS_PULSEAUDIO "$QT_LIBS_PULSEAUDIO"
4608         else
4609             if [ "$CFG_PULSEAUDIO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4610                 echo "PulseAudio support cannot be enabled due to functionality tests!"
4611                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4612                 echo " If you believe this message is in error you may use the continue"
4613                 echo " switch (-continue) to $0 to continue."
4614                 exit 101
4615             else
4616                 CFG_PULSEAUDIO=no
4617             fi
4618         fi
4619     fi
4620 fi # X11/Lighthouse
4621
4622 # X11
4623 if [ "$PLATFORM_X11" = "yes" -a "$CFG_GUI" != "no" ]; then
4624     x11tests="$relpath/config.tests/x11"
4625     X11TESTS_FLAGS=
4626
4627     # work around broken X11 headers when using GCC 2.95 or later
4628     NOTYPE=no
4629     "$x11tests/notype.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" && NOTYPE=yes
4630     if [ $NOTYPE = "yes" ]; then
4631         QMakeVar add QMAKE_CXXFLAGS -fpermissive
4632         X11TESTS_FLAGS="$X11TESTS_FLAGS -fpermissive"
4633     fi
4634
4635     # Check we actually have X11 :-)
4636     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
4637     if [ $? != "0" ]; then
4638         echo "Basic XLib functionality test failed!"
4639         echo " You might need to modify the include and library search paths by editing"
4640         echo " QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in ${XQMAKESPEC}."
4641         exit 1
4642     fi
4643 fi
4644
4645 # X11/MINGW OpenGL
4646 if [ "$PLATFORM_X11" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
4647     # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
4648     if [ "$CFG_GUI" = "no" ]; then
4649         if [ "$CFG_OPENGL" = "auto" ]; then
4650             CFG_OPENGL=no
4651         fi
4652         if [ "$CFG_OPENGL" != "no" ]; then
4653             echo "OpenGL enabled, but GUI disabled."
4654             echo " You might need to either enable the GUI or disable OpenGL"
4655             exit 1
4656         fi
4657     fi
4658     if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
4659         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
4660             CFG_OPENGL=desktop
4661         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
4662             CFG_OPENGL=es2
4663         else
4664             if [ "$CFG_OPENGL" = "yes" ]; then
4665                 echo "All the OpenGL functionality tests failed!"
4666                 echo " You might need to modify the include and library search paths by editing"
4667                 echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
4668                 echo " ${XQMAKESPEC}."
4669                 exit 1
4670             fi
4671             CFG_OPENGL=no
4672         fi
4673         case "$PLATFORM" in
4674         hpux*)
4675             # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
4676             if [ "$CFG_OPENGL" = "desktop" ]; then
4677                 "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
4678                 if [ $? != "0" ]; then
4679                     QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
4680                 fi
4681             fi
4682             ;;
4683         *)
4684             ;;
4685         esac
4686     elif [ "$CFG_OPENGL" = "es2" ]; then
4687         #OpenGL ES 2.x
4688         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS
4689         if [ $? != "0" ]; then
4690             echo "The OpenGL ES 2.0 functionality test failed!"
4691             echo " You might need to modify the include and library search paths by editing"
4692             echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
4693             echo " ${XQMAKESPEC}."
4694             exit 1
4695         fi
4696     elif [ "$CFG_OPENGL" = "desktop" ]; then
4697         # Desktop OpenGL support
4698         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
4699         if [ $? != "0" ]; then
4700             echo "The OpenGL functionality test failed!"
4701             echo " You might need to modify the include and library search paths by editing"
4702             echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
4703             echo " ${XQMAKESPEC}."
4704             exit 1
4705         fi
4706         case "$PLATFORM" in
4707         hpux*)
4708             # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
4709             "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
4710             if [ $? != "0" ]; then
4711                 QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
4712             fi
4713             ;;
4714         *)
4715             ;;
4716         esac
4717     fi
4718 fi # X11/MINGW OpenGL
4719
4720 # X11
4721 if [ "$PLATFORM_X11" = "yes" ]; then
4722     # auto-detect Xcursor support
4723     if [ "$CFG_XCURSOR" != "no" ]; then
4724         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
4725             if [ "$CFG_XCURSOR" != "runtime" ]; then
4726                 CFG_XCURSOR=yes;
4727             fi
4728         else
4729             if [ "$CFG_XCURSOR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4730                 echo "Xcursor support cannot be enabled due to functionality tests!"
4731                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4732                 echo " If you believe this message is in error you may use the continue"
4733                 echo " switch (-continue) to $0 to continue."
4734                 exit 101
4735             else
4736                 CFG_XCURSOR=no
4737             fi
4738         fi
4739     fi
4740
4741     # auto-detect Xfixes support
4742     if [ "$CFG_XFIXES" != "no" ]; then
4743         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xfixes "Xfixes" $L_FLAGS $I_FLAGS $X11TESTS_FLAGS; then
4744             if [ "$CFG_XFIXES" != "runtime" ]; then
4745                 CFG_XFIXES=yes;
4746             fi
4747         else
4748             if [ "$CFG_XFIXES" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4749                 echo "Xfixes support cannot be enabled due to functionality tests!"
4750                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4751                 echo " If you believe this message is in error you may use the continue"
4752                 echo " switch (-continue) to $0 to continue."
4753                 exit 101
4754             else
4755                 CFG_XFIXES=no
4756             fi
4757         fi
4758     fi
4759
4760     # auto-detect Xrandr support (resize and rotate extension)
4761     if [ "$CFG_XRANDR" != "no" ]; then
4762         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
4763             if [ "$CFG_XRANDR" != "runtime" ]; then
4764             CFG_XRANDR=yes
4765             fi
4766         else
4767             if [ "$CFG_XRANDR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4768                 echo "Xrandr support cannot be enabled due to functionality tests!"
4769                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4770                 echo " If you believe this message is in error you may use the continue"
4771                 echo " switch (-continue) to $0 to continue."
4772                 exit 101
4773             else
4774                 CFG_XRANDR=no
4775             fi
4776         fi
4777     fi
4778
4779     # auto-detect Xrender support
4780     if [ "$CFG_XRENDER" != "no" ]; then
4781         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
4782             CFG_XRENDER=yes
4783         else
4784             if [ "$CFG_XRENDER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4785                 echo "Xrender support cannot be enabled due to functionality tests!"
4786                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4787                 echo " If you believe this message is in error you may use the continue"
4788                 echo " switch (-continue) to $0 to continue."
4789                 exit 101
4790             else
4791                 CFG_XRENDER=no
4792             fi
4793         fi
4794     fi
4795
4796     # auto-detect MIT-SHM support
4797     if [ "$CFG_MITSHM" != "no" ]; then
4798         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
4799             CFG_MITSHM=yes
4800         else
4801             if [ "$CFG_MITSHM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4802                 echo "MITSHM support cannot be enabled due to functionality tests!"
4803                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4804                 echo " If you believe this message is in error you may use the continue"
4805                 echo " switch (-continue) to $0 to continue."
4806                 exit 101
4807             else
4808                 CFG_MITSHM=no
4809             fi
4810         fi
4811     fi
4812
4813     # auto-detect Session Management support
4814     if [ "$CFG_SM" = "auto" ]; then
4815         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
4816             CFG_SM=yes
4817         else
4818             if [ "$CFG_SM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4819                 echo "Session Management support cannot be enabled due to functionality tests!"
4820                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4821                 echo " If you believe this message is in error you may use the continue"
4822                 echo " switch (-continue) to $0 to continue."
4823                 exit 101
4824             else
4825                 CFG_SM=no
4826             fi
4827         fi
4828     fi
4829
4830     # auto-detect SHAPE support
4831     if [ "$CFG_XSHAPE" != "no" ]; then
4832         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
4833             CFG_XSHAPE=yes
4834         else
4835             if [ "$CFG_XSHAPE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4836                 echo "XShape support cannot be enabled due to functionality tests!"
4837                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4838                 echo " If you believe this message is in error you may use the continue"
4839                 echo " switch (-continue) to $0 to continue."
4840                 exit 101
4841             else
4842                 CFG_XSHAPE=no
4843             fi
4844         fi
4845     fi
4846
4847     # auto-detect XVideo support
4848     if [ "$CFG_XVIDEO" != "no" ]; then
4849         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
4850             CFG_XVIDEO=yes
4851         else
4852             if [ "$CFG_XVIDEO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4853                 echo "XVideo support cannot be enabled due to functionality tests!"
4854                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4855                 echo " If you believe this message is in error you may use the continue"
4856                 echo " switch (-continue) to $0 to continue."
4857                 exit 101
4858             else
4859                 CFG_XVIDEO=no
4860             fi
4861         fi
4862     fi
4863
4864     # auto-detect XSync support
4865     if [ "$CFG_XSYNC" != "no" ]; then
4866         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
4867             CFG_XSYNC=yes
4868         else
4869             if [ "$CFG_XSYNC" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4870                 echo "XSync support cannot be enabled due to functionality tests!"
4871                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4872                 echo " If you believe this message is in error you may use the continue"
4873                 echo " switch (-continue) to $0 to continue."
4874                 exit 101
4875             else
4876                 CFG_XSYNC=no
4877             fi
4878         fi
4879     fi
4880
4881     # auto-detect Xinerama support
4882     if [ "$CFG_XINERAMA" != "no" ]; then
4883         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
4884             if [ "$CFG_XINERAMA" != "runtime" ]; then
4885                 CFG_XINERAMA=yes
4886             fi
4887         else
4888             if [ "$CFG_XINERAMA" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4889                 echo "Xinerama support cannot be enabled due to functionality tests!"
4890                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4891                 echo " If you believe this message is in error you may use the continue"
4892                 echo " switch (-continue) to $0 to continue."
4893                 exit 101
4894             else
4895                 CFG_XINERAMA=no
4896             fi
4897         fi
4898     fi
4899
4900     # auto-detect Xinput support
4901     if [ "$CFG_XINPUT" != "no" ]; then
4902         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
4903             if [ "$CFG_XINPUT" != "runtime" ]; then
4904                 CFG_XINPUT=yes
4905             fi
4906         else
4907             if [ "$CFG_XINPUT" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4908                 echo "Tablet and Xinput support cannot be enabled due to functionality tests!"
4909                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4910                 echo " If you believe this message is in error you may use the continue"
4911                 echo " switch (-continue) to $0 to continue."
4912                 exit 101
4913             else
4914                 CFG_XINPUT=no
4915             fi
4916         fi
4917     fi
4918
4919     # auto-detect XKB support
4920     if [ "$CFG_XKB" != "no" ]; then
4921         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
4922             CFG_XKB=yes
4923         else
4924             if [ "$CFG_XKB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4925                 echo "XKB support cannot be enabled due to functionality tests!"
4926                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4927                 echo " If you believe this message is in error you may use the continue"
4928                 echo " switch (-continue) to $0 to continue."
4929                 exit 101
4930             else
4931                 CFG_XKB=no
4932             fi
4933         fi
4934     fi
4935
4936     if [ "$CFG_GLIB" = "yes" -a "$CFG_QGTKSTYLE" != "no" ]; then
4937         if [ -n "$PKG_CONFIG" ]; then
4938             QT_CFLAGS_QGTKSTYLE=`$PKG_CONFIG --cflags gtk+-2.0 ">=" 2.10 atk 2>/dev/null`
4939             QT_LIBS_QGTKSTYLE=`$PKG_CONFIG --libs gobject-2.0 2>/dev/null`
4940         fi
4941         if [ -n "$QT_CFLAGS_QGTKSTYLE" ] ; then
4942             CFG_QGTKSTYLE=yes
4943             QMakeVar set QT_CFLAGS_QGTKSTYLE "$QT_CFLAGS_QGTKSTYLE"
4944             QMakeVar set QT_LIBS_QGTKSTYLE "$QT_LIBS_QGTKSTYLE"
4945         else
4946             if [ "$CFG_QGTKSTYLE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4947                 echo "Gtk theme support cannot be enabled due to functionality tests!"
4948                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4949                 echo " If you believe this message is in error you may use the continue"
4950                 echo " switch (-continue) to $0 to continue."
4951                 exit 101
4952             else
4953                 CFG_QGTKSTYLE=no
4954             fi
4955         fi
4956     elif [ "$CFG_GLIB" = "no" ]; then
4957         CFG_QGTKSTYLE=no
4958     fi
4959 fi # X11
4960
4961 # auto-detect FontConfig support
4962 if [ "$CFG_FONTCONFIG" != "no" ]; then
4963     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
4964         QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
4965         QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null`
4966     else
4967         QT_CFLAGS_FONTCONFIG=
4968         QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig"
4969     fi
4970     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
4971         CFG_FONTCONFIG=yes
4972         QMakeVar set QMAKE_CFLAGS_X11 "$QT_CFLAGS_FONTCONFIG \$\$QMAKE_CFLAGS_X11"
4973         QMakeVar set QMAKE_LIBS_X11 "$QT_LIBS_FONTCONFIG \$\$QMAKE_LIBS_X11"
4974         CFG_LIBFREETYPE=system
4975     else
4976         if [ "$CFG_FONTCONFIG" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4977             echo "FontConfig support cannot be enabled due to functionality tests!"
4978             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4979             echo " If you believe this message is in error you may use the continue"
4980             echo " switch (-continue) to $0 to continue."
4981             exit 101
4982         else
4983             CFG_FONTCONFIG=no
4984         fi
4985     fi
4986 fi
4987
4988
4989 if [ "$BUILD_ON_MAC" = "yes" ]; then
4990     if [ "$CFG_PHONON" != "no" ]; then
4991         # Always enable Phonon (unless it was explicitly disabled)
4992         CFG_PHONON=yes
4993     fi
4994
4995     if [ "$CFG_COREWLAN" = "auto" ]; then
4996         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
4997             CFG_COREWLAN=yes
4998         else
4999             CFG_COREWLAN=no
5000         fi
5001     fi
5002 fi
5003
5004 if [ "$PLATFORM_QPA" = "yes" ]; then
5005     # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
5006     if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
5007         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
5008             CFG_OPENGL=desktop
5009         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
5010             CFG_OPENGL=es2
5011         else
5012             if [ "$CFG_OPENGL" = "yes" ]; then
5013                 echo "All the OpenGL functionality tests failed!"
5014                 echo " You might need to modify the include and library search paths by editing"
5015                 echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5016                 echo " ${XQMAKESPEC}."
5017                 exit 1
5018             fi
5019             CFG_OPENGL=no
5020         fi
5021     elif [ "$CFG_OPENGL" = "es2" ]; then
5022         #OpenGL ES 2.x
5023         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists glesv2 2>/dev/null; then
5024             QMAKE_INCDIR_OPENGL_ES2=`$PKG_CONFIG --cflags-only-I glesv2 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
5025             QMAKE_LIBDIR_OPENGL_ES2=`$PKG_CONFIG --libs-only-L glesv2 2>/dev/null | sed -e 's,^-L,,g' -e 's, -L, ,g'`
5026             QMAKE_LIBS_OPENGL_ES2=`$PKG_CONFIG --libs glesv2 2>/dev/null`
5027             QMAKE_CFLAGS_OPENGL_ES2=`$PKG_CONFIG --cflags glesv2 2>/dev/null`
5028             QMakeVar set QMAKE_INCDIR_OPENGL_ES2 "$QMAKE_INCDIR_OPENGL_ES2"
5029             QMakeVar set QMAKE_LIBDIR_OPENGL_ES2 "$QMAKE_LIBDIR_OPENGL_ES2"
5030             QMakeVar set QMAKE_LIBS_OPENGL_ES2 "$QMAKE_LIBS_OPENGL_ES2"
5031         fi
5032
5033         "$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
5034         if [ $? != "0" ]; then
5035             echo "The OpenGL ES 2.0 functionality test failed!"
5036             echo " You might need to modify the include and library search paths by editing"
5037             echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
5038             echo " ${XQMAKESPEC}."
5039             exit 1
5040         fi
5041     elif [ "$CFG_OPENGL" = "desktop" ]; then
5042         # Desktop OpenGL support
5043         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengldesktop "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
5044         if [ $? != "0" ]; then
5045             echo "The OpenGL functionality test failed!"
5046             echo " You might need to modify the include and library search paths by editing"
5047             echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5048             echo " ${XQMAKESPEC}."
5049             exit 1
5050         fi
5051     fi
5052
5053     # auto-detect FontConfig support
5054     if [ "$CFG_FONTCONFIG" != "no" ]; then
5055         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
5056             QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
5057             QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null`
5058         else
5059             QT_CFLAGS_FONTCONFIG=
5060             QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig"
5061         fi
5062         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
5063                 QT_CONFIG="$QT_CONFIG fontconfig"
5064                 QMakeVar set QMAKE_CFLAGS_FONTCONFIG "$QT_CFLAGS_FONTCONFIG"
5065                 QMakeVar set QMAKE_LIBS_FONTCONFIG "$QT_LIBS_FONTCONFIG"
5066                 CFG_LIBFREETYPE=system
5067         fi
5068
5069     fi
5070
5071     # Save these for a check later
5072     ORIG_CFG_XCB="$CFG_XCB"
5073     ORIG_CFG_EGLFS="$CFG_EGLFS"
5074
5075     if [ "$CFG_LIBUDEV" != "no" ]; then
5076        if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists libudev 2>/dev/null; then
5077            QMAKE_INCDIR_LIBUDEV=`$PKG_CONFIG --cflags-only-I libudev 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
5078            QMAKE_LIBS_LIBUDEV=`$PKG_CONFIG --libs libudev 2>/dev/null`
5079            QMakeVar set QMAKE_INCDIR_LIBUDEV "$QMAKE_INCDIR_LIBUDEV"
5080            QMakeVar set QMAKE_LIBS_LIBUDEV "$QMAKE_LIBS_LIBUDEV"
5081        fi
5082        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
5083             CFG_LIBUDEV=yes
5084             QT_CONFIG="$QT_CONFIG libudev"
5085         elif [ "$CFG_LIBUDEV" = "yes" ]; then
5086             echo "The libudev functionality test failed!"
5087             exit 1
5088         else
5089             CFG_LIBUDEV=no
5090             QMakeVar add DEFINES QT_NO_LIBUDEV
5091         fi
5092     fi
5093
5094     if [ "$CFG_EVDEV" != "no" ]; then
5095         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/evdev "evdev" $L_FLAGS $I_FLAGS $l_FLAGS; then
5096             CFG_EVDEV=yes
5097             QT_CONFIG="$QT_CONFIG evdev"
5098         elif [ "$CFG_EVDEV" = "yes" ]; then
5099             echo "The evdev functionality test failed!"
5100             exit 1
5101         else
5102             CFG_EVDEV=no
5103             QMakeVar add DEFINES QT_NO_EVDEV
5104         fi
5105     fi
5106
5107     # Check we actually have X11 :-)
5108     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
5109         QT_CONFIG="$QT_CONFIG xlib"
5110     fi
5111
5112     # auto-detect Xrender support
5113     if [ "$CFG_XRENDER" != "no" ]; then
5114         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
5115             CFG_XRENDER=yes
5116             QT_CONFIG="$QT_CONFIG xrender"
5117         else
5118             if [ "$CFG_XRENDER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5119                 echo "Xrender support cannot be enabled due to functionality tests!"
5120                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5121                 echo " If you believe this message is in error you may use the continue"
5122                 echo " switch (-continue) to $0 to continue."
5123                 exit 101
5124             else
5125                 CFG_XRENDER=no
5126             fi
5127         fi
5128     fi
5129
5130     if [ "$CFG_XCB" != "no" ]; then
5131         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xcb >= 1.5" 2>/dev/null; then
5132             QMAKE_CFLAGS_XCB="`$PKG_CONFIG --cflags xcb 2>/dev/null`"
5133             QMAKE_LIBS_XCB="`$PKG_CONFIG --libs xcb 2>/dev/null`"
5134         fi
5135         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
5136             CFG_XCB=yes
5137             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
5138                 QT_CONFIG="$QT_CONFIG xcb-render"
5139             fi
5140
5141             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
5142                 CFG_XCB_LIMITED=no
5143                 QT_CONFIG="$QT_CONFIG xcb-poll-for-queued-event"
5144             fi
5145
5146             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
5147                 QT_CONFIG="$QT_CONFIG xcb-xlib"
5148             fi
5149
5150             if [ "$XPLATFORM_MAEMO" = "yes" ]; then
5151                 # auto-detect XInput2/Xinput support
5152                 if [ "$CFG_XINPUT2" != "no" ]; then
5153                     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
5154                     CFG_XINPUT2=yes
5155                     CFG_XINPUT=no
5156                     else
5157                         if [ "$CFG_XINPUT2" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5158                             echo "XInput2 support cannot be enabled due to functionality tests!"
5159                             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5160                             echo " If you believe this message is in error you may use the continue"
5161                             echo " switch (-continue) to $0 to continue."
5162                             exit 101
5163                         else
5164                             CFG_XINPUT2=no
5165                         fi
5166                     fi
5167                 fi
5168             fi
5169         else
5170             if [ "$CFG_XCB" = "yes" ]; then
5171                 echo "The XCB test failed!"
5172                 echo " You might need to install dependency packages."
5173                 echo " See src/plugins/platforms/xcb/README."
5174                 exit 1
5175             fi
5176             CFG_XCB=no
5177             QMakeVar add DEFINES QT_NO_XCB
5178         fi
5179     fi
5180
5181     # Detect libxkbcommon
5182     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xkbcommon 2>/dev/null; then
5183         QMAKE_CFLAGS_XKBCOMMON="`$PKG_CONFIG --cflags xkbcommon 2>/dev/null`"
5184         QMAKE_LIBS_XKBCOMMON="`$PKG_CONFIG --libs xkbcommon 2>/dev/null`"
5185         QMAKE_CFLAGS_XCB="$QMAKE_CFLAGS_XCB $QMAKE_CFLAGS_XKBCOMMON"
5186         QMAKE_LIBS_XCB="$QMAKE_LIBS_XCB $QMAKE_LIBS_XKBCOMMON"
5187     else
5188         QMAKE_DEFINES_XCB=QT_NO_XCB_XKB
5189     fi
5190
5191     # EGL Support
5192     if [ "$CFG_EGL" != "no" ]; then
5193         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists egl 2>/dev/null; then
5194             QMAKE_INCDIR_EGL=`$PKG_CONFIG --cflags-only-I egl 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
5195             QMAKE_LIBS_EGL=`$PKG_CONFIG --libs egl 2>/dev/null`
5196             QMAKE_CFLAGS_EGL=`$PKG_CONFIG --cflags egl 2>/dev/null`
5197             QMakeVar set QMAKE_INCDIR_EGL "$QMAKE_INCDIR_EGL"
5198             QMakeVar set QMAKE_LIBS_EGL "$QMAKE_LIBS_EGL"
5199         fi       # detect EGL support
5200         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
5201             CFG_EGL=yes
5202         elif [ "$CFG_EGL" = "yes" ]; then
5203             echo " The EGL functionality test failed; EGL is required by some QPA plugins to manage contexts & surfaces."
5204             echo " You might need to modify the include and library search paths by editing"
5205             echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in ${XQMAKESPEC}."
5206             exit 1
5207         else
5208             CFG_EGL=no
5209         fi
5210     fi
5211
5212     if [ "$CFG_EGLFS" != "no" ]; then
5213         CFG_EGLFS="$CFG_EGL"
5214     fi
5215
5216     if [ -n "$QMAKE_CFLAGS_XCB" ] || [ -n "$QMAKE_LIBS_XCB" ]; then
5217         QMakeVar set QMAKE_CFLAGS_XCB "$QMAKE_CFLAGS_XCB"
5218         QMakeVar set QMAKE_LIBS_XCB "$QMAKE_LIBS_XCB"
5219         QMakeVar set QMAKE_DEFINES_XCB "$QMAKE_DEFINES_XCB"
5220     fi
5221
5222     if [ "$BUILD_ON_MAC" = "yes" ]; then
5223         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
5224             QT_CONFIG="$QT_CONFIG coreservices"
5225         else
5226             QMakeVar add DEFINES QT_NO_CORESERVICES
5227         fi
5228     fi
5229
5230     if [ "$PLATFORM_QPA" = "yes" ] && [ "$BUILD_ON_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ]; then
5231         if [ "$CFG_XCB" = "no" ] && [ "$CFG_EGLFS" = "no" ]; then
5232             if [ "$QPA_PLATFORM_GUARD" = "yes" ] &&
5233                  ( [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_EGLFS" = "auto" ] ); then
5234                 echo "No QPA platform plugin enabled!"
5235                 echo " If you really want to build without a QPA platform plugin you must pass"
5236                 echo " -no-xcb and -no-eglfs to configure. Doing this will"
5237                 echo " produce a Qt that cannot run GUI applications."
5238                 echo " The dependencies needed for xcb to build are listed in"
5239                 echo " src/plugins/platforms/xcb/README"
5240                 exit 1
5241             fi
5242         fi
5243     fi
5244
5245 fi
5246
5247 [ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_PHONON" != "no" ] && CFG_PHONON="yes"
5248
5249 # freetype support
5250 [ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_LIBFREETYPE" = "auto" ] && CFG_LIBFREETYPE=no
5251 if [ "$CFG_LIBFREETYPE" = "auto" ]; then
5252     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
5253         CFG_LIBFREETYPE=system
5254     else
5255         CFG_LIBFREETYPE=yes
5256     fi
5257 fi
5258
5259 HAVE_STL=no
5260 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stl "STL" $L_FLAGS $I_FLAGS $l_FLAGS; then
5261     HAVE_STL=yes
5262 fi
5263
5264 if [ "$CFG_STL" != "no" ]; then
5265     if [ "$HAVE_STL" = "yes" ]; then
5266         CFG_STL=yes
5267     else
5268         if [ "$CFG_STL" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5269             echo "STL support cannot be enabled due to functionality tests!"
5270             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5271             echo " If you believe this message is in error you may use the continue"
5272             echo " switch (-continue) to $0 to continue."
5273             exit 101
5274         else
5275             CFG_STL=no
5276         fi
5277     fi
5278 fi
5279
5280 # detect POSIX clock_gettime()
5281 if [ "$CFG_CLOCK_GETTIME" = "auto" ]; then
5282     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
5283         CFG_CLOCK_GETTIME=yes
5284     else
5285         CFG_CLOCK_GETTIME=no
5286     fi
5287 fi
5288
5289 # detect POSIX monotonic clocks
5290 if [ "$CFG_CLOCK_GETTIME" = "yes" ] && [ "$CFG_CLOCK_MONOTONIC" = "auto" ]; then
5291     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
5292         CFG_CLOCK_MONOTONIC=yes
5293     else
5294         CFG_CLOCK_MONOTONIC=no
5295     fi
5296 elif [ "$CFG_CLOCK_GETTIME" = "no" ]; then
5297     CFG_CLOCK_MONOTONIC=no
5298 fi
5299
5300 # detect mremap
5301 if [ "$CFG_MREMAP" = "auto" ]; then
5302     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mremap "mremap" $L_FLAGS $I_FLAGS $l_FLAGS; then
5303         CFG_MREMAP=yes
5304     else
5305         CFG_MREMAP=no
5306     fi
5307 fi
5308
5309 # find if the platform provides getaddrinfo (ipv6 dns lookups)
5310 if [ "$CFG_GETADDRINFO" != "no" ]; then
5311     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getaddrinfo "getaddrinfo" $L_FLAGS $I_FLAGS $l_FLAGS; then
5312         CFG_GETADDRINFO=yes
5313     else
5314         if [ "$CFG_GETADDRINFO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5315             echo "getaddrinfo support cannot be enabled due to functionality tests!"
5316             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5317             echo " If you believe this message is in error you may use the continue"
5318             echo " switch (-continue) to $0 to continue."
5319             exit 101
5320         else
5321             CFG_GETADDRINFO=no
5322         fi
5323     fi
5324 fi
5325
5326 # find if the platform provides inotify
5327 if [ "$CFG_INOTIFY" != "no" ]; then
5328     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/inotify "inotify" $L_FLAGS $I_FLAGS $l_FLAGS; then
5329         CFG_INOTIFY=yes
5330     else
5331         if [ "$CFG_INOTIFY" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5332             echo "inotify support cannot be enabled due to functionality tests!"
5333             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5334             echo " If you believe this message is in error you may use the continue"
5335             echo " switch (-continue) to $0 to continue."
5336             exit 101
5337         else
5338             CFG_INOTIFY=no
5339         fi
5340     fi
5341 fi
5342
5343 # find if the platform provides if_nametoindex (ipv6 interface name support)
5344 if [ "$CFG_IPV6IFNAME" != "no" ]; then
5345     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
5346         CFG_IPV6IFNAME=yes
5347     else
5348         if [ "$CFG_IPV6IFNAME" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5349             echo "IPv6 interface name support cannot be enabled due to functionality tests!"
5350             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5351             echo " If you believe this message is in error you may use the continue"
5352             echo " switch (-continue) to $0 to continue."
5353             exit 101
5354         else
5355             CFG_IPV6IFNAME=no
5356         fi
5357     fi
5358 fi
5359
5360 # find if the platform provides getifaddrs (network interface enumeration)
5361 if [ "$CFG_GETIFADDRS" != "no" ]; then
5362     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getifaddrs "getifaddrs" $L_FLAGS $I_FLAGS $l_FLAGS; then
5363         CFG_GETIFADDRS=yes
5364     else
5365         if [ "$CFG_GETIFADDRS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5366             echo "getifaddrs support cannot be enabled due to functionality tests!"
5367             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5368             echo " If you believe this message is in error you may use the continue"
5369             echo " switch (-continue) to $0 to continue."
5370             exit 101
5371         else
5372             CFG_GETIFADDRS=no
5373         fi
5374     fi
5375 fi
5376
5377 # detect OpenSSL
5378 if [ "$CFG_OPENSSL" != "no" ]; then
5379     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
5380         if [ "$CFG_OPENSSL" = "auto" ]; then
5381             CFG_OPENSSL=yes
5382         fi
5383     else
5384         if ( [ "$CFG_OPENSSL" = "yes" ] || [ "$CFG_OPENSSL" = "linked" ] ) && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5385             echo "OpenSSL support cannot be enabled due to functionality tests!"
5386             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5387             echo " If you believe this message is in error you may use the continue"
5388             echo " switch (-continue) to $0 to continue."
5389             exit 101
5390         else
5391             CFG_OPENSSL=no
5392         fi
5393     fi
5394 fi
5395
5396 # detect PCRE
5397 if [ "$CFG_PCRE" != "qt" ]; then
5398     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/pcre "PCRE" $L_FLAGS $I_FLAGS $l_FLAGS; then
5399         CFG_PCRE=system
5400     else
5401         if [ "$CFG_PCRE" = "system" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5402             echo "PCRE support cannot be enabled due to functionality tests!"
5403             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5404             echo " If you believe this message is in error you may use the continue"
5405             echo " switch (-continue) to $0 to continue."
5406             exit 101
5407         else
5408             CFG_PCRE=qt
5409         fi
5410     fi
5411 fi
5412
5413 # detect OpenVG support
5414 if [ "$CFG_OPENVG" != "no" ]; then
5415     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
5416         if [ "$CFG_OPENVG" = "auto" ]; then
5417             CFG_OPENVG=yes
5418         fi
5419     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
5420         if [ "$CFG_OPENVG" = "auto" ]; then
5421             CFG_OPENVG=yes
5422         fi
5423         CFG_OPENVG_ON_OPENGL=yes
5424     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
5425         if [ "$CFG_OPENVG" = "auto" ]; then
5426             CFG_OPENVG=yes
5427         fi
5428         CFG_OPENVG_LC_INCLUDES=yes
5429     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
5430         if [ "$CFG_OPENVG" = "auto" ]; then
5431             CFG_OPENVG=yes
5432         fi
5433         CFG_OPENVG_LC_INCLUDES=yes
5434         CFG_OPENVG_ON_OPENGL=yes
5435     else
5436         if [ "$CFG_OPENVG" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5437             echo "$CFG_OPENVG was specified for OpenVG but cannot be enabled due to functionality tests!"
5438             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5439             echo " If you believe this message is in error you may use the continue"
5440             echo " switch (-continue) to $0 to continue."
5441             exit 101
5442         else
5443             CFG_OPENVG=no
5444         fi
5445     fi
5446     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
5447         CFG_OPENVG_SHIVA=yes
5448     fi
5449 fi
5450
5451 if [ "$CFG_ALSA" = "auto" ]; then
5452     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/alsa "alsa" $L_FLAGS $I_FLAGS $l_FLAGS; then
5453         CFG_ALSA=yes
5454     else
5455         CFG_ALSA=no
5456     fi
5457 fi
5458
5459 if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ] || [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then 
5460     if [ "$CFG_ARCH" = "arm" ]; then
5461        "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/javascriptcore-jit "javascriptcore-jit" $L_FLAGS $I_FLAGS $l_FLAGS
5462         if [ $? != "0" ]; then
5463            CFG_JAVASCRIPTCORE_JIT=no
5464         fi
5465     else
5466         case "$XPLATFORM" in
5467             linux-icc*)
5468                 CFG_JAVASCRIPTCORE_JIT=no
5469                 ;;
5470         esac
5471     fi
5472 fi
5473
5474 if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ]; then
5475     QMakeVar set JAVASCRIPTCORE_JIT yes
5476 elif [ "$CFG_JAVASCRIPTCORE_JIT" = "no" ]; then
5477     QMakeVar set JAVASCRIPTCORE_JIT no
5478 fi
5479
5480 if [ "$CFG_AUDIO_BACKEND" = "auto" ]; then
5481     CFG_AUDIO_BACKEND=yes
5482 fi
5483
5484 if [ "$CFG_LARGEFILE" != "yes" ] && [ "$XPLATFORM_MINGW" = "yes" ]; then
5485     echo "Warning: largefile support cannot be disabled for win32."
5486     CFG_LARGEFILE="yes"
5487 fi
5488
5489 #-------------------------------------------------------------------------------
5490 # ask for all that hasn't been auto-detected or specified in the arguments
5491 #-------------------------------------------------------------------------------
5492
5493 # enable dwarf2 support on Mac
5494 if [ "$CFG_MAC_DWARF2" = "yes" ]; then
5495     QT_CONFIG="$QT_CONFIG dwarf2"
5496 fi
5497
5498 # Detect the default arch (x86 or x86_64) on Mac OS X
5499 if [ "$BUILD_ON_MAC" = "yes" ] && [ "$QT_CROSS_COMPILE" = "no" ]; then
5500     DEFAULT_ARCH=
5501     case `file "${outpath}/bin/qmake"` in
5502     *i?86)
5503         DEFAULT_ARCH=x86
5504         ;;
5505     *x86_64)
5506         DEFAULT_ARCH=x86_64
5507         ;;
5508     *ppc|*ppc64|*)
5509         # unsupported/unknown
5510         ;;
5511     esac
5512
5513     if [ -n "$DEFAULT_ARCH" ]; then
5514         [ "$OPT_VERBOSE" = "yes" ] && echo "Setting default Mac OS X architechture to $DEFAULT_ARCH."
5515         QT_CONFIG="$QT_CONFIG $DEFAULT_ARCH"
5516         QMAKE_CONFIG="$QMAKE_CONFIG $DEFAULT_ARCH"
5517         # Make the application arch follow the Qt arch
5518         QTCONFIG_CONFIG="$QTCONFIG_CONFIG $DEFAULT_ARCH"
5519     fi
5520 fi
5521
5522 # ### Vestige
5523 if [ "$CFG_PHONON_BACKEND" = "yes" ]; then
5524     QT_CONFIG="$QT_CONFIG phonon-backend"
5525 fi
5526
5527 # disable accessibility
5528 if [ "$CFG_ACCESSIBILITY" = "no" ]; then
5529     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ACCESSIBILITY"
5530 else
5531     QT_CONFIG="$QT_CONFIG accessibility"
5532 fi
5533
5534 # enable egl
5535 if [ "$CFG_EGL" = "yes" ]; then
5536     QT_CONFIG="$QT_CONFIG egl"
5537 else
5538     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGL"
5539 fi
5540
5541 # enable eglfs
5542 if [ "$CFG_EGLFS" = "yes" ]; then
5543     QT_CONFIG="$QT_CONFIG eglfs"
5544 else
5545     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGLFS"
5546 fi
5547
5548 # enable openvg
5549 if [ "$CFG_OPENVG" = "no" ]; then
5550     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENVG"
5551 else
5552     QT_CONFIG="$QT_CONFIG openvg"
5553     if [ "$CFG_OPENVG_LC_INCLUDES" = "yes" ]; then
5554         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LOWER_CASE_VG_INCLUDES"
5555     fi
5556     if [ "$CFG_OPENVG_ON_OPENGL" = "yes" ]; then
5557         QT_CONFIG="$QT_CONFIG openvg_on_opengl"
5558     fi
5559     if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
5560         QT_CONFIG="$QT_CONFIG shivavg"
5561         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SHIVAVG"
5562     fi
5563 fi
5564
5565 # enable opengl
5566 if [ "$CFG_OPENGL" = "no" ]; then
5567     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENGL"
5568 else
5569     QT_CONFIG="$QT_CONFIG opengl"
5570 fi
5571
5572 if [ "$CFG_OPENGL" = "es2" ]; then
5573     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES"
5574 fi
5575
5576 if [ "$CFG_OPENGL" = "es2" ]; then
5577     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_2"
5578     QT_CONFIG="$QT_CONFIG opengles2"
5579 fi
5580
5581 # safe execution environment
5582 if [ "$CFG_SXE" != "no" ]; then
5583     QT_CONFIG="$QT_CONFIG sxe"
5584 fi
5585
5586 # build up the variables for output
5587 if [ "$CFG_DEBUG" = "yes" ]; then
5588     QMAKE_OUTDIR="${QMAKE_OUTDIR}debug"
5589     QMAKE_CONFIG="$QMAKE_CONFIG debug"
5590 elif [ "$CFG_DEBUG" = "no" ]; then
5591     QMAKE_OUTDIR="${QMAKE_OUTDIR}release"
5592     QMAKE_CONFIG="$QMAKE_CONFIG release"
5593 fi
5594 if [ "$CFG_SHARED" = "yes" ]; then
5595     QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared"
5596     QMAKE_CONFIG="$QMAKE_CONFIG shared dll"
5597 elif [ "$CFG_SHARED" = "no" ]; then
5598     QMAKE_OUTDIR="${QMAKE_OUTDIR}-static"
5599     QMAKE_CONFIG="$QMAKE_CONFIG static"
5600 fi
5601 if [ "$PLATFORM_QPA" = "yes" ]; then
5602     QMAKE_CONFIG="$QMAKE_CONFIG qpa"
5603     QT_CONFIG="$QT_CONFIG qpa"
5604     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qpa"
5605     rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
5606 fi
5607
5608 if [ "$XPLATFORM_MINGW" != "yes" ]; then
5609     # Do not set this here for Windows. Let qmake do it so
5610     # debug and release precompiled headers are kept separate.
5611     QMakeVar set PRECOMPILED_DIR ".pch/$QMAKE_OUTDIR"
5612 fi
5613 QMakeVar set OBJECTS_DIR ".obj/$QMAKE_OUTDIR"
5614 QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR"
5615 QMakeVar set RCC_DIR ".rcc/$QMAKE_OUTDIR"
5616 QMakeVar set UI_DIR ".uic/$QMAKE_OUTDIR"
5617 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
5618     QMAKE_CONFIG="$QMAKE_CONFIG largefile"
5619 fi
5620 if [ "$CFG_STL" = "no" ]; then
5621     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STL"
5622 else
5623     QMAKE_CONFIG="$QMAKE_CONFIG stl"
5624 fi
5625 if [ "$CFG_USE_GNUMAKE" = "yes" ]; then
5626     QMAKE_CONFIG="$QMAKE_CONFIG GNUmake"
5627 fi
5628 [ "$CFG_REDUCE_EXPORTS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_exports"
5629 [ "$CFG_REDUCE_RELOCATIONS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_relocations"
5630 [ "$CFG_PRECOMPILE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG precompile_header"
5631 if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
5632     QMakeVar add QMAKE_CFLAGS -g
5633     QMakeVar add QMAKE_CXXFLAGS -g
5634     QT_CONFIG="$QT_CONFIG separate_debug_info"
5635 fi
5636 if [ "$CFG_SEPARATE_DEBUG_INFO_NOCOPY" = "yes" ] ; then
5637     QT_CONFIG="$QT_CONFIG separate_debug_info_nocopy"
5638 fi
5639 [ "$CFG_MMX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mmx"
5640 [ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow"
5641 [ "$CFG_SSE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse"
5642 [ "$CFG_SSE2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse2"
5643 [ "$CFG_SSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse3"
5644 [ "$CFG_SSSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG ssse3"
5645 [ "$CFG_SSE4_1" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_1"
5646 [ "$CFG_SSE4_2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_2"
5647 [ "$CFG_AVX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG avx"
5648 [ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt"
5649 [ "$CFG_NEON" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG neon"
5650 if [ "$CFG_ARCH" = "mips" ]; then
5651     [ "$CFG_MIPS_DSP" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mips_dsp"
5652     [ "$CFG_MIPS_DSPR2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mips_dspr2"
5653 fi
5654 if [ "$CFG_CLOCK_GETTIME" = "yes" ]; then
5655     QT_CONFIG="$QT_CONFIG clock-gettime"
5656 fi
5657 if [ "$CFG_CLOCK_MONOTONIC" = "yes" ]; then
5658     QT_CONFIG="$QT_CONFIG clock-monotonic"
5659 fi
5660 if [ "$CFG_MREMAP" = "yes" ]; then
5661     QT_CONFIG="$QT_CONFIG mremap"
5662 fi
5663 if [ "$CFG_GETADDRINFO" = "yes" ]; then
5664     QT_CONFIG="$QT_CONFIG getaddrinfo"
5665 fi
5666 if [ "$CFG_IPV6IFNAME" = "yes" ]; then
5667     QT_CONFIG="$QT_CONFIG ipv6ifname"
5668 fi
5669 if [ "$CFG_GETIFADDRS" = "yes" ]; then
5670     QT_CONFIG="$QT_CONFIG getifaddrs"
5671 fi
5672 if [ "$CFG_INOTIFY" = "yes" ]; then
5673     QT_CONFIG="$QT_CONFIG inotify"
5674 fi
5675 if [ "$CFG_LIBJPEG" = "no" ]; then
5676     CFG_JPEG="no"
5677 elif [ "$CFG_LIBJPEG" = "system" ]; then
5678     QT_CONFIG="$QT_CONFIG system-jpeg"
5679 fi
5680 if [ "$CFG_JPEG" = "no" ]; then
5681     QT_CONFIG="$QT_CONFIG no-jpeg"
5682 elif [ "$CFG_JPEG" = "yes" ]; then
5683     QT_CONFIG="$QT_CONFIG jpeg"
5684 fi
5685 if [ "$CFG_LIBPNG" = "no" ]; then
5686     CFG_PNG="no"
5687 fi
5688 if [ "$CFG_LIBPNG" = "system" ]; then
5689     QT_CONFIG="$QT_CONFIG system-png"
5690 fi
5691 if [ "$CFG_PNG" = "no" ]; then
5692     QT_CONFIG="$QT_CONFIG no-png"
5693 elif [ "$CFG_PNG" = "yes" ]; then
5694     QT_CONFIG="$QT_CONFIG png"
5695 fi
5696 if [ "$CFG_GIF" = "no" ]; then
5697     QT_CONFIG="$QT_CONFIG no-gif"
5698 elif [ "$CFG_GIF" = "yes" ]; then
5699     QT_CONFIG="$QT_CONFIG gif"
5700 fi
5701 if [ "$CFG_LIBFREETYPE" = "no" ]; then
5702     QT_CONFIG="$QT_CONFIG no-freetype"
5703     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FREETYPE"
5704 elif [ "$CFG_LIBFREETYPE" = "system" ]; then
5705     QT_CONFIG="$QT_CONFIG system-freetype"
5706 else
5707     QT_CONFIG="$QT_CONFIG freetype"
5708 fi
5709 if [ "$CFG_GUI" = "auto" ]; then
5710     CFG_GUI="yes"
5711 fi
5712 if [ "$CFG_GUI" = "no" ]; then
5713     QT_CONFIG="$QT_CONFIG no-gui"
5714     CFG_WIDGETS="no"
5715 fi
5716 if [ "$CFG_WIDGETS" = "no" ]; then
5717     QT_CONFIG="$QT_CONFIG no-widgets"
5718     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_WIDGETS"
5719 fi
5720
5721 if [ "x$BUILD_ON_MAC" = "xyes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
5722     #On Mac we implicitly link against libz, so we
5723     #never use the 3rdparty stuff.
5724     [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system"
5725 fi
5726 if [ "$CFG_ZLIB" = "yes" ]; then
5727     QT_CONFIG="$QT_CONFIG zlib"
5728 elif [ "$CFG_ZLIB" = "system" ]; then
5729     QT_CONFIG="$QT_CONFIG system-zlib"
5730 fi
5731
5732 [ "$CFG_NIS" = "yes" ] && QT_CONFIG="$QT_CONFIG nis"
5733 [ "$CFG_CUPS" = "yes" ] && QT_CONFIG="$QT_CONFIG cups"
5734 [ "$CFG_ICONV" = "yes" ] && QT_CONFIG="$QT_CONFIG iconv"
5735 [ "$CFG_ICONV" = "sun" ] && QT_CONFIG="$QT_CONFIG sun-libiconv"
5736 [ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv"
5737 [ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib"
5738 [ "$CFG_GSTREAMER" = "yes" ] && QT_CONFIG="$QT_CONFIG gstreamer"
5739 [ "$CFG_DBUS" = "yes" ] && QT_CONFIG="$QT_CONFIG dbus"
5740 [ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus dbus-linked"
5741 [ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl"
5742 [ "$CFG_OPENSSL" = "linked" ] && QT_CONFIG="$QT_CONFIG openssl-linked"
5743 [ "$CFG_MAC_HARFBUZZ" = "yes" ] && QT_CONFIG="$QT_CONFIG harfbuzz"
5744 [ "$CFG_XCB" = "yes" ] && QT_CONFIG="$QT_CONFIG xcb"
5745 [ "$CFG_XINPUT2" = "yes" ] && QT_CONFIG="$QT_CONFIG xinput2"
5746
5747 if [ "$PLATFORM_X11" = "yes" ]; then
5748     [ "$CFG_SM" = "yes" ] && QT_CONFIG="$QT_CONFIG x11sm"
5749
5750     # for some reason, the following libraries are not always built shared,
5751     # so *every* program/lib (including Qt) has to link against them
5752     if [ "$CFG_XSHAPE" = "yes" ]; then
5753         QT_CONFIG="$QT_CONFIG xshape"
5754     fi
5755     if [ "$CFG_XVIDEO" = "yes" ]; then
5756         QT_CONFIG="$QT_CONFIG xvideo"
5757     fi
5758     if [ "$CFG_XSYNC" = "yes" ]; then
5759         QT_CONFIG="$QT_CONFIG xsync"
5760     fi
5761     if [ "$CFG_XINERAMA" = "yes" ]; then
5762         QT_CONFIG="$QT_CONFIG xinerama"
5763         QMakeVar set QMAKE_LIBS_X11 '-lXinerama $$QMAKE_LIBS_X11'
5764     fi
5765     if [ "$CFG_XCURSOR" = "yes" ]; then
5766         QT_CONFIG="$QT_CONFIG xcursor"
5767         QMakeVar set QMAKE_LIBS_X11 '-lXcursor $$QMAKE_LIBS_X11'
5768     fi
5769     if [ "$CFG_XFIXES" = "yes" ]; then
5770         QT_CONFIG="$QT_CONFIG xfixes"
5771         QMakeVar set QMAKE_LIBS_X11 '-lXfixes $$QMAKE_LIBS_X11'
5772     fi
5773     if [ "$CFG_XRANDR" = "yes" ]; then
5774         QT_CONFIG="$QT_CONFIG xrandr"
5775         if [ "$CFG_XRENDER" != "yes" ]; then
5776             # libXrandr uses 1 function from libXrender, so we always have to have it :/
5777             QMakeVar set QMAKE_LIBS_X11 '-lXrandr -lXrender $$QMAKE_LIBS_X11'
5778         else
5779             QMakeVar set QMAKE_LIBS_X11 '-lXrandr $$QMAKE_LIBS_X11'
5780         fi
5781     fi
5782     if [ "$CFG_XRENDER" = "yes" ]; then
5783         QT_CONFIG="$QT_CONFIG xrender"
5784         QMakeVar set QMAKE_LIBS_X11 '-lXrender $$QMAKE_LIBS_X11'
5785     fi
5786     if [ "$CFG_MITSHM" = "yes" ]; then
5787         QT_CONFIG="$QT_CONFIG mitshm"
5788     fi
5789     if [ "$CFG_FONTCONFIG" = "yes" ]; then
5790         QT_CONFIG="$QT_CONFIG fontconfig"
5791     fi
5792     if [ "$CFG_XINPUT" = "yes" ]; then
5793         QMakeVar set QMAKE_LIBS_X11 '-lXi $$QMAKE_LIBS_X11'
5794     fi
5795     if [ "$CFG_XINPUT" = "yes" ]; then
5796         QT_CONFIG="$QT_CONFIG xinput tablet"
5797     fi
5798     if [ "$CFG_XKB" = "yes" ]; then
5799         QT_CONFIG="$QT_CONFIG xkb"
5800     fi
5801 fi
5802
5803 [ '!' -z "$D_FLAGS" ] && QMakeVar add DEFINES "$D_FLAGS"
5804 [ '!' -z "$L_FLAGS" ] && QMakeVar add QMAKE_LIBDIR_FLAGS "$L_FLAGS"
5805 [ '!' -z "$l_FLAGS" ] && QMakeVar add LIBS "$l_FLAGS"
5806
5807 if [ "$PLATFORM_MAC" = "yes" ] && [ "$QT_CROSS_COMPILE" = "no" ]; then
5808     if [ "$CFG_RPATH" = "yes" ]; then
5809        QMAKE_CONFIG="$QMAKE_CONFIG absolute_library_soname"
5810        # set the default rpath to the library installation directory
5811        RPATH_FLAGS="\"$QT_INSTALL_LIBS\" $RPATH_FLAGS"
5812     fi
5813 elif [ -z "`getXQMakeConf 'QMAKE_(LFLAGS_)?RPATH'`" ]; then
5814     if [ -n "$RPATH_FLAGS" ]; then
5815         echo
5816         echo "ERROR: -R cannot be used on this platform as \$QMAKE_LFLAGS_RPATH is"
5817         echo "       undefined."
5818         echo
5819         exit 1
5820     elif [ "$CFG_RPATH" = "yes" ]; then
5821         RPATH_MESSAGE="        NOTE: This platform does not support runtime library paths, using -no-rpath."
5822         CFG_RPATH=no
5823     fi
5824 else
5825     if [ "$CFG_RPATH" = "yes" ]; then
5826         # set the default rpath to the library installation directory
5827         RPATH_FLAGS="\"$QT_INSTALL_LIBS\" $RPATH_FLAGS"
5828     fi
5829     if [ -n "$RPATH_FLAGS" ]; then
5830         # add the user defined rpaths
5831         QMakeVar add QMAKE_RPATHDIR "$RPATH_FLAGS"
5832     fi
5833 fi
5834
5835 if [ '!' -z "$I_FLAGS" ]; then
5836     # add the user define include paths
5837     QMakeVar add QMAKE_CFLAGS "$I_FLAGS"
5838     QMakeVar add QMAKE_CXXFLAGS "$I_FLAGS"
5839 fi
5840
5841 if [ '!' -z "$W_FLAGS" ]; then
5842     # add the user defined warning flags
5843     QMakeVar add QMAKE_CFLAGS_WARN_ON "$W_FLAGS"
5844     QMakeVar add QMAKE_CXXFLAGS_WARN_ON "$W_FLAGS"
5845     QMakeVar add QMAKE_OBJECTIVE_CFLAGS_WARN_ON "$W_FLAGS"
5846 fi
5847
5848 # turn off exceptions for the compilers that support it
5849 if [ "$XPLATFORM" != "$PLATFORM" ]; then
5850     COMPILER=`echo $XPLATFORM | cut -f 2- -d-`
5851 else
5852     COMPILER=`echo $PLATFORM | cut -f 2- -d-`
5853 fi
5854
5855 if [ "$CFG_EXCEPTIONS" != "no" ]; then
5856     QTCONFIG_CONFIG="$QTCONFIG_CONFIG exceptions"
5857 fi
5858
5859 if [ "$XPLATFORM_MINGW" = "yes" ]; then
5860     # mkspecs/features/win32/default_pre.prf sets "no-rtti".
5861     # Follow default behavior of configure.exe by overriding with "rtti".
5862     QTCONFIG_CONFIG="$QTCONFIG_CONFIG rtti"
5863 fi
5864
5865 if [ "$CFG_ALSA" = "yes" ]; then
5866     QT_CONFIG="$QT_CONFIG alsa"
5867 fi
5868
5869 if [ "$CFG_PULSEAUDIO" = "yes" ]; then
5870     QT_CONFIG="$QT_CONFIG pulseaudio"
5871 fi
5872
5873 if [ "$CFG_COREWLAN" = "yes" ]; then
5874     QT_CONFIG="$QT_CONFIG corewlan"
5875 fi
5876
5877 if [ "$CFG_ICU" = "yes" ]; then
5878     QT_CONFIG="$QT_CONFIG icu"
5879 fi
5880
5881 if [ "$CFG_FORCE_ASSERTS" = "yes" ]; then
5882     QT_CONFIG="$QT_CONFIG force_asserts"
5883 fi
5884
5885 if [ "$CFG_PCRE" = "qt" ]; then
5886     QMAKE_CONFIG="$QMAKE_CONFIG pcre"
5887 fi
5888
5889 #
5890 # Some Qt modules are too advanced in C++ for some old compilers
5891 # Detect here the platforms where they are known to work.
5892 #
5893 # See Qt documentation for more information on which features are
5894 # supported and on which compilers.
5895 #
5896 canBuildQtConcurrent="yes"
5897 canUseV8Snapshot="yes"
5898
5899 case "$XPLATFORM" in
5900     hpux-g++*)
5901         # PA-RISC's assembly is too limited
5902         # gcc 3.4 on that platform can't build QtXmlPatterns
5903         # the assembly it generates cannot be compiled
5904
5905         # Check gcc's version
5906         case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
5907             4*)
5908                 ;;
5909             3.4*)
5910                 canBuildQtXmlPatterns="no"
5911                 ;;
5912             *)
5913                 canBuildWebKit="no"
5914                 canBuildQtXmlPatterns="no"
5915                 ;;
5916         esac
5917         ;;
5918     unsupported/vxworks-*-g++*)
5919         canBuildWebKit="no"
5920         ;;
5921     unsupported/vxworks-*-dcc*)
5922         canBuildWebKit="no"
5923         canBuildQtXmlPatterns="no"
5924         ;;
5925     *-g++*)
5926         # Check gcc's version
5927         case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
5928             4*|3.4*)
5929                 ;;
5930             3.3*)
5931                 canBuildWebKit="no"
5932                 ;;
5933             *)
5934                 canBuildWebKit="no"
5935                 canBuildQtXmlPatterns="no"
5936                 ;;
5937         esac
5938         ;;
5939     solaris-cc*)
5940         # Check the compiler version
5941         case `${QMAKE_CONF_COMPILER} -V 2>&1 | awk '{print $4}'` in
5942             5.[012345678])
5943                 canBuildWebKit="no"
5944                 canBuildQtXmlPatterns="no"
5945                 canBuildQtConcurrent="no"
5946                 ;;
5947             5.*)
5948                 canBuildWebKit="no"
5949                 canBuildQtConcurrent="no"
5950                 ;;
5951         esac
5952         ;;
5953     hpux-acc*)
5954         canBuildWebKit="no"
5955         canBuildQtXmlPatterns="no"
5956         canBuildQtConcurrent="no"
5957         ;;
5958     hpuxi-acc*)
5959         canBuildWebKit="no"
5960         ;;
5961     aix-xlc*)
5962         # Get the xlC version
5963         cat > xlcver.c <<EOF
5964 #include <stdio.h>
5965 int main()
5966 {
5967     printf("%d.%d\n", __xlC__ >> 8, __xlC__ & 0xFF);
5968     return 0;
5969 }
5970 EOF
5971         xlcver=
5972         if ${QMAKE_CONF_COMPILER} -o xlcver xlcver.c >/dev/null 2>/dev/null; then
5973             xlcver=`./xlcver 2>/dev/null`
5974             rm -f ./xlcver
5975         fi
5976         if [ "$OPT_VERBOSE" = "yes" ]; then
5977             if [ -n "$xlcver" ]; then
5978                 echo Found IBM xlC version: $xlcver.
5979             else
5980                 echo Could not determine IBM xlC version, assuming oldest supported.
5981             fi
5982         fi
5983
5984         case "$xlcver" in
5985             [123456].*)
5986                 canBuildWebKit="no"
5987                 canBuildQtXmlPatterns="no"
5988                 canBuildQtConcurrent="no"
5989                 ;;
5990             *)
5991                 canBuildWebKit="no"
5992                 canBuildQtConcurrent="no"
5993                 ;;
5994         esac
5995         ;;
5996     irix-cc*)
5997         canBuildWebKit="no"
5998         canBuildQtConcurrent="no"
5999         ;;
6000 esac
6001
6002 if [ "$CFG_GUI" = "no" ]; then
6003     # WebKit requires QtGui
6004     canBuildWebKit="no"
6005 fi
6006
6007 if [ "$CFG_SHARED" = "no" ]; then
6008     echo
6009     echo "WARNING: Using static linking will disable the WebKit module."
6010     echo
6011     canBuildWebKit="no"
6012 fi
6013
6014 CFG_CONCURRENT="yes"
6015 if [ "$canBuildQtConcurrent" = "no" ]; then
6016     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT"
6017     CFG_CONCURRENT="no"
6018 else
6019     QT_CONFIG="$QT_CONFIG concurrent"
6020 fi
6021
6022 # ### Vestige
6023 if [ "$CFG_AUDIO_BACKEND" = "yes" ]; then
6024     QT_CONFIG="$QT_CONFIG audio-backend"
6025 fi
6026
6027 # ### Vestige
6028 if [ "$CFG_WEBKIT" = "debug" ]; then
6029     QMAKE_CONFIG="$QMAKE_CONFIG webkit-debug"
6030 fi
6031
6032 # ### Vestige
6033 QT_CONFIG="$QT_CONFIG v8"
6034 # Detect snapshot support
6035 if [ "$CFG_ARCH" != "$CFG_HOST_ARCH" ]; then
6036     case "$CFG_HOST_ARCH,$CFG_ARCH" in
6037         i386,arm)
6038         ;;
6039     *) canUseV8Snapshot="no"
6040         ;;
6041     esac
6042 else
6043     if [ -n "$_SBOX_DIR" -a "$CFG_ARCH" = "arm" ]; then
6044         # QEMU crashes when building inside Scratchbox with an ARM target
6045         canUseV8Snapshot="no"
6046     fi
6047 fi
6048 if [ "$CFG_V8SNAPSHOT" = "auto" ]; then
6049     CFG_V8SNAPSHOT="$canUseV8Snapshot"
6050 fi
6051 if [ "$CFG_V8SNAPSHOT" = "yes" -a "$canUseV8Snapshot" = "no" ]; then
6052     echo "Error: V8 snapshot was requested, but is not supported on this platform."
6053     exit 1
6054 fi
6055 if [ "$CFG_V8SNAPSHOT" = "yes" ]; then
6056     QT_CONFIG="$QT_CONFIG v8snapshot"
6057 fi
6058
6059 # ### Vestige
6060 if [ "$CFG_DECLARATIVE_DEBUG" = "no" ]; then
6061     QCONFIG_FLAGS="$QCONFIG_FLAGS QDECLARATIVE_NO_DEBUG_PROTOCOL"
6062 fi
6063
6064 if [ "$CFG_EXCEPTIONS" = "no" ]; then
6065     case "$COMPILER" in
6066     g++*)
6067         QMakeVar add QMAKE_CFLAGS -fno-exceptions
6068         QMakeVar add QMAKE_CXXFLAGS -fno-exceptions
6069         QMakeVar add QMAKE_LFLAGS -fno-exceptions
6070         ;;
6071     cc*)
6072         case "$PLATFORM" in
6073         irix-cc*)
6074             QMakeVar add QMAKE_CFLAGS -LANG:exceptions=off
6075             QMakeVar add QMAKE_CXXFLAGS -LANG:exceptions=off
6076             QMakeVar add QMAKE_LFLAGS -LANG:exceptions=off
6077             ;;
6078         *) ;;
6079         esac
6080         ;;
6081     *) ;;
6082     esac
6083     QMAKE_CONFIG="$QMAKE_CONFIG exceptions_off"
6084 fi
6085
6086 case "$COMPILER" in
6087 g++*)
6088     # GNU C++
6089     COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -dumpversion 2>/dev/null`
6090
6091     case "$COMPILER_VERSION" in
6092     *.*.*)
6093         QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'`
6094         QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'`
6095         QT_GCC_PATCH_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'`
6096         ;;
6097     *.*)
6098         QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\1,'`
6099         QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\2,'`
6100         QT_GCC_PATCH_VERSION=0
6101         ;;
6102     esac
6103
6104     ;;
6105 *)
6106     #
6107     ;;
6108 esac
6109
6110 #-------------------------------------------------------------------------------
6111 # part of configuration information goes into qconfig.h
6112 #-------------------------------------------------------------------------------
6113
6114 case "$CFG_QCONFIG" in
6115 full)
6116     echo "/* Everything */" >"$outpath/src/corelib/global/qconfig.h.new"
6117     ;;
6118 *)
6119     tmpconfig="$outpath/src/corelib/global/qconfig.h.new"
6120     echo "#ifndef QT_BOOTSTRAPPED" >"$tmpconfig"
6121     if [ -f "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" ]; then
6122         cat "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" >>"$tmpconfig"
6123     elif [ -f `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` ]; then
6124         cat `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` >>"$tmpconfig"
6125     fi
6126     echo "#endif" >>"$tmpconfig"
6127     ;;
6128 esac
6129
6130 cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6131
6132 /* Qt Edition */
6133 #ifndef QT_EDITION
6134 #  define QT_EDITION $QT_EDITION
6135 #endif
6136 EOF
6137
6138 echo '/* Compile time features */' >>"$outpath/src/corelib/global/qconfig.h.new"
6139 [ '!' -z "$LicenseKeyExt" ] && echo "#define QT_PRODUCT_LICENSEKEY \"$LicenseKeyExt\"" >>"$outpath/src/corelib/global/qconfig.h.new"
6140
6141 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
6142     echo "#define QT_LARGEFILE_SUPPORT 64" >>"$outpath/src/corelib/global/qconfig.h.new"
6143 fi
6144
6145 if [ "$CFG_FRAMEWORK" = "yes" ]; then
6146     echo "#define QT_MAC_FRAMEWORK_BUILD" >>"$outpath/src/corelib/global/qconfig.h.new"
6147 fi
6148
6149 if [ "$BUILD_ON_MAC" = "yes" ]; then
6150     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6151 #if defined(__LP64__)
6152 # define QT_POINTER_SIZE 8
6153 #else
6154 # define QT_POINTER_SIZE 4
6155 #endif
6156 EOF
6157 else
6158     "$unixtests/ptrsize.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
6159     echo "#define QT_POINTER_SIZE $?" >>"$outpath/src/corelib/global/qconfig.h.new"
6160 fi
6161
6162 #REDUCE_RELOCATIONS is a elf/unix only thing, so not in windows configure.exe
6163 if [ "$CFG_REDUCE_RELOCATIONS" = "yes" ]; then
6164     echo "#define QT_REDUCE_RELOCATIONS" >>"$outpath/src/corelib/global/qconfig.h.new"
6165 fi
6166
6167
6168 echo "" >>"$outpath/src/corelib/global/qconfig.h.new"
6169
6170 if [ "$CFG_DEV" = "yes" ]; then
6171     echo "#define QT_BUILD_INTERNAL" >>"$outpath/src/corelib/global/qconfig.h.new"
6172 fi
6173
6174 if [ "$PLATFORM_QPA" = "yes" ]; then
6175     # Add QPA to config.h
6176     QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QPA QT_NO_QWS_QPF QT_NO_QWS_QPF2"
6177 fi
6178
6179 if [ "${CFG_USE_FLOATMATH}" = "yes" ]; then
6180     QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_USE_MATH_H_FLOATS"
6181 fi
6182
6183 # Add turned on SQL drivers
6184 for DRIVER in $CFG_SQL_AVAILABLE; do
6185     eval "VAL=\$CFG_SQL_$DRIVER"
6186     case "$VAL" in
6187     qt)
6188         ONDRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
6189         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SQL_$ONDRIVER"
6190         SQL_DRIVERS="$SQL_DRIVERS $DRIVER"
6191     ;;
6192     plugin)
6193         SQL_PLUGINS="$SQL_PLUGINS $DRIVER"
6194     ;;
6195     esac
6196 done
6197
6198
6199 QMakeVar set sql-drivers "$SQL_DRIVERS"
6200 QMakeVar set sql-plugins "$SQL_PLUGINS"
6201
6202 # Add other configuration options to the qconfig.h file
6203 [ "$CFG_GIF" = "yes" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_BUILTIN_GIF_READER=1"
6204 [ "$CFG_PNG" != "yes" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_PNG"
6205 [ "$CFG_JPEG" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_JPEG"
6206 [ "$CFG_ZLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ZLIB"
6207 [ "$CFG_EXCEPTIONS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EXCEPTIONS"
6208 [ "$CFG_SXE" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SXE"
6209 [ "$CFG_DBUS" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS"
6210
6211 # X11/Unix/Mac only configs
6212 [ "$CFG_CUPS" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CUPS"
6213 [ "$CFG_ICONV" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ICONV"
6214 [ "$CFG_GLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GLIB"
6215 [ "$CFG_GSTREAMER" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GSTREAMER"
6216 [ "$CFG_QGTKSTYLE" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STYLE_GTK"
6217 [ "$CFG_CLOCK_MONOTONIC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CLOCK_MONOTONIC"
6218 [ "$CFG_MREMAP" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MREMAP"
6219 [ "$CFG_GETADDRINFO" = "no" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETADDRINFO"
6220 [ "$CFG_IPV6IFNAME" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IPV6IFNAME"
6221 [ "$CFG_GETIFADDRS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETIFADDRS"
6222 [ "$CFG_INOTIFY" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_INOTIFY"
6223 [ "$CFG_NIS" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NIS"
6224 [ "$CFG_OPENSSL" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENSSL QT_NO_SSL"
6225 [ "$CFG_OPENSSL" = "linked" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LINKED_OPENSSL"
6226
6227 [ "$CFG_SM" = "no" ]         && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SESSIONMANAGER"
6228 [ "$CFG_XCURSOR" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XCURSOR"
6229 [ "$CFG_XFIXES" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XFIXES"
6230 [ "$CFG_FONTCONFIG" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FONTCONFIG"
6231 [ "$CFG_XINERAMA" = "no" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINERAMA"
6232 [ "$CFG_XKB" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XKB"
6233 [ "$CFG_XRANDR" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRANDR"
6234 [ "$CFG_XRENDER" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRENDER"
6235 [ "$CFG_MITSHM" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MITSHM"
6236 [ "$CFG_XSHAPE" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SHAPE"
6237 [ "$CFG_XVIDEO" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XVIDEO"
6238 [ "$CFG_XSYNC" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XSYNC"
6239 [ "$CFG_XINPUT" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINPUT QT_NO_TABLET"
6240
6241 [ "$CFG_XCURSOR" = "runtime" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XCURSOR"
6242 [ "$CFG_XINERAMA" = "runtime" ]  && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINERAMA"
6243 [ "$CFG_XFIXES" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XFIXES"
6244 [ "$CFG_XRANDR" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XRANDR"
6245 [ "$CFG_XINPUT" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINPUT"
6246 [ "$CFG_ALSA" = "no" ]           && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ALSA"
6247 [ "$CFG_PULSEAUDIO" = "no" ]          && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_PULSEAUDIO"
6248 [ "$CFG_COREWLAN" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_COREWLAN"
6249
6250 # sort QCONFIG_FLAGS for neatness if we can
6251 [ '!' -z "$AWK" ] && QCONFIG_FLAGS=`echo $QCONFIG_FLAGS | $AWK '{ gsub(" ", "\n"); print }' | sort | uniq`
6252 QCONFIG_FLAGS=`echo $QCONFIG_FLAGS`
6253
6254 if [ -n "$QCONFIG_FLAGS" ]; then
6255 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6256 #ifndef QT_BOOTSTRAPPED
6257
6258 EOF
6259     for cfg in $QCONFIG_FLAGS; do
6260         cfgd=`echo $cfg | sed 's/=.*$//'` # trim pushed 'Foo=Bar' defines
6261         cfg=`echo $cfg | sed 's/=/ /'`    # turn first '=' into a space
6262         # figure out define logic, so we can output the correct
6263         # ifdefs to override the global defines in a project
6264         cfgdNeg=
6265         if [ true ] && echo "$cfgd" | grep 'QT_NO_' >/dev/null 2>&1; then
6266             # QT_NO_option can be forcefully turned on by QT_option
6267             cfgdNeg=`echo $cfgd | sed "s,QT_NO_,QT_,"`
6268         elif [ true ] && echo "$cfgd" | grep 'QT_' >/dev/null 2>&1; then
6269             # QT_option can be forcefully turned off by QT_NO_option
6270             cfgdNeg=`echo $cfgd | sed "s,QT_,QT_NO_,"`
6271         fi
6272
6273         if [ -z $cfgdNeg ]; then
6274 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6275 #ifndef $cfgd
6276 # define $cfg
6277 #endif
6278
6279 EOF
6280         else
6281 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6282 #if defined($cfgd) && defined($cfgdNeg)
6283 # undef $cfgd
6284 #elif !defined($cfgd) && !defined($cfgdNeg)
6285 # define $cfg
6286 #endif
6287
6288 EOF
6289         fi
6290     done
6291 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6292 #endif // QT_BOOTSTRAPPED
6293
6294 EOF
6295 fi
6296
6297 if [ "$CFG_REDUCE_EXPORTS" = "yes" ]; then
6298 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6299 #define QT_VISIBILITY_AVAILABLE
6300
6301 EOF
6302 fi
6303
6304 if [ -n "$QT_LIBINFIX" ]; then
6305 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6306 #define QT_LIBINFIX "$QT_LIBINFIX"
6307
6308 EOF
6309 fi
6310
6311 # avoid unecessary rebuilds by copying only if qconfig.h has changed
6312 if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then
6313     rm -f "$outpath/src/corelib/global/qconfig.h.new"
6314 else
6315     [ -f "$outpath/src/corelib/global/qconfig.h" ] && chmod +w "$outpath/src/corelib/global/qconfig.h"
6316     mv "$outpath/src/corelib/global/qconfig.h.new" "$outpath/src/corelib/global/qconfig.h"
6317     chmod -w "$outpath/src/corelib/global/qconfig.h"
6318     if [ ! -f "$outpath/include/QtCore/qconfig.h" ]; then
6319         ln -s "$outpath/src/corelib/global/qconfig.h" "$outpath/include/QtCore/qconfig.h"
6320     fi
6321 fi
6322
6323 #-------------------------------------------------------------------------------
6324 # save configuration into qconfig.pri
6325 #-------------------------------------------------------------------------------
6326 QTCONFIG="$outpath/mkspecs/qconfig.pri"
6327 QTCONFIG_CONFIG="$QTCONFIG_CONFIG no_mocdepend"
6328 [ -f "$QTCONFIG.tmp" ] && rm -f "$QTCONFIG.tmp"
6329 if [ "$CFG_DEBUG" = "yes" ]; then
6330     QTCONFIG_CONFIG="$QTCONFIG_CONFIG debug"
6331     if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
6332         QT_CONFIG="$QT_CONFIG release"
6333     fi
6334     QT_CONFIG="$QT_CONFIG debug"
6335 elif [ "$CFG_DEBUG" = "no" ]; then
6336     QTCONFIG_CONFIG="$QTCONFIG_CONFIG release"
6337     if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
6338         QT_CONFIG="$QT_CONFIG debug"
6339     fi
6340     QT_CONFIG="$QT_CONFIG release"
6341 fi
6342 if [ "$CFG_STL" = "yes" ]; then
6343     QTCONFIG_CONFIG="$QTCONFIG_CONFIG stl"
6344 fi
6345 if [ "$CFG_FRAMEWORK" = "no" ]; then
6346     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_no_framework"
6347 else
6348     QT_CONFIG="$QT_CONFIG qt_framework"
6349     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_framework"
6350 fi
6351 if [ "$CFG_DEV" = "yes" ]; then
6352     QT_CONFIG="$QT_CONFIG private_tests"
6353 fi
6354
6355 cat >>"$QTCONFIG.tmp" <<EOF
6356 #configuration
6357 CONFIG += $QTCONFIG_CONFIG
6358 QT_ARCH = $CFG_ARCH
6359 QT_HOST_ARCH = $CFG_HOST_ARCH
6360 QT_EDITION = $Edition
6361 QT_CONFIG += $QT_CONFIG
6362
6363 #versioning
6364 QT_VERSION = $QT_VERSION
6365 QT_MAJOR_VERSION = $QT_MAJOR_VERSION
6366 QT_MINOR_VERSION = $QT_MINOR_VERSION
6367 QT_PATCH_VERSION = $QT_PATCH_VERSION
6368
6369 #namespaces
6370 QT_LIBINFIX = $QT_LIBINFIX
6371 QT_NAMESPACE = $QT_NAMESPACE
6372
6373 EOF
6374 if [ -n "$CFG_SYSROOT" ]; then
6375     echo "# sysroot" >>"$QTCONFIG.tmp"
6376     echo `basename "$XQMAKESPEC"` \{ >>"$QTCONFIG.tmp"
6377     echo "    QMAKE_CFLAGS    += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
6378     echo "    QMAKE_CXXFLAGS  += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
6379     echo "    QMAKE_LFLAGS    += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
6380     echo "}" >> "$QTCONFIG.tmp"
6381     echo >> "$QTCONFIG.tmp"
6382 fi
6383 if [ -n "$RPATH_FLAGS" ]; then
6384     echo "QMAKE_RPATHDIR += $RPATH_FLAGS" >> "$QTCONFIG.tmp"
6385 fi
6386 if [ -n "$QT_GCC_MAJOR_VERSION" ]; then
6387     echo "QT_GCC_MAJOR_VERSION = $QT_GCC_MAJOR_VERSION" >> "$QTCONFIG.tmp"
6388     echo "QT_GCC_MINOR_VERSION = $QT_GCC_MINOR_VERSION" >> "$QTCONFIG.tmp"
6389     echo "QT_GCC_PATCH_VERSION = $QT_GCC_PATCH_VERSION" >> "$QTCONFIG.tmp"
6390 fi
6391
6392 if [ -n "$QMAKE_INCDIR_OPENGL_ES2" ]; then
6393     echo "#Qt opengl include path" >> "$QTCONFIG.tmp"
6394     echo "QMAKE_INCDIR_OPENGL_ES2 = \"$QMAKE_INCDIR_OPENGL_ES2\"" >> "$QTCONFIG.tmp"
6395 fi
6396
6397 # replace qconfig.pri if it differs from the newly created temp file
6398 if cmp -s "$QTCONFIG.tmp" "$QTCONFIG"; then
6399     rm -f "$QTCONFIG.tmp"
6400 else
6401     mv -f "$QTCONFIG.tmp" "$QTCONFIG"
6402 fi
6403
6404 #-------------------------------------------------------------------------------
6405 # save configuration into qmodule.pri
6406 #-------------------------------------------------------------------------------
6407 QTMODULE="$outpath/mkspecs/qmodule.pri"
6408
6409 echo "CONFIG += create_prl link_prl" >> "$QTMODULE.tmp"
6410
6411 # Ensure we can link to uninistalled libraries
6412 if [ "$BUILD_ON_MAC" != "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ] && linkerSupportsFlag -rpath-link "$outpath/lib"; then
6413     echo "QMAKE_LFLAGS    = -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib \$\$QMAKE_LFLAGS" >> "$QTMODULE.tmp"
6414 fi
6415 if [ -n "$QT_CFLAGS_PSQL" ]; then
6416     echo "QT_CFLAGS_PSQL   = $QT_CFLAGS_PSQL" >> "$QTMODULE.tmp"
6417 fi
6418 if [ -n "$QT_LFLAGS_PSQL" ]; then
6419     echo "QT_LFLAGS_PSQL   = $QT_LFLAGS_PSQL" >> "$QTMODULE.tmp"
6420 fi
6421 if [ -n "$QT_CFLAGS_MYSQL" ]; then
6422     echo "QT_CFLAGS_MYSQL   = $QT_CFLAGS_MYSQL" >> "$QTMODULE.tmp"
6423 fi
6424 if [ -n "$QT_LFLAGS_MYSQL" ]; then
6425     echo "QT_LFLAGS_MYSQL   = $QT_LFLAGS_MYSQL" >> "$QTMODULE.tmp"
6426 fi
6427 if [ -n "$QT_CFLAGS_SQLITE" ]; then
6428     echo "QT_CFLAGS_SQLITE   = $QT_CFLAGS_SQLITE" >> "$QTMODULE.tmp"
6429 fi
6430 if [ -n "$QT_LFLAGS_SQLITE" ]; then
6431     echo "QT_LFLAGS_SQLITE   = $QT_LFLAGS_SQLITE" >> "$QTMODULE.tmp"
6432 fi
6433 if [ -n "$QT_LFLAGS_ODBC" ]; then
6434     echo "QT_LFLAGS_ODBC   = $QT_LFLAGS_ODBC" >> "$QTMODULE.tmp"
6435 fi
6436 if [ -n "$QT_LFLAGS_TDS" ]; then
6437     echo "QT_LFLAGS_TDS   = $QT_LFLAGS_TDS" >> "$QTMODULE.tmp"
6438 fi
6439
6440 if [ "$QT_EDITION" != "QT_EDITION_OPENSOURCE" ]; then
6441     echo "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" >> "$QTMODULE.tmp"
6442 fi
6443
6444 #dump in the OPENSSL_LIBS info
6445 if [ '!' -z "$OPENSSL_LIBS" ]; then
6446     echo "OPENSSL_LIBS = $OPENSSL_LIBS" >> "$QTMODULE.tmp"
6447 elif [ "$CFG_OPENSSL" = "linked" ]; then
6448     echo "OPENSSL_LIBS = -lssl -lcrypto" >> "$QTMODULE.tmp"
6449 fi
6450
6451 #dump in the SDK info
6452 if [ '!' -z "$CFG_SDK" ]; then
6453    echo "QMAKE_MAC_SDK = $CFG_SDK" >> "$QTMODULE.tmp"
6454 fi
6455
6456 # cmdline args
6457 cat "$QMAKE_VARS_FILE" >> "$QTMODULE.tmp"
6458 rm -f "$QMAKE_VARS_FILE" 2>/dev/null
6459
6460 # replace qmodule.pri if it differs from the newly created temp file
6461 if cmp -s "$QTMODULE.tmp" "$QTMODULE"; then
6462     rm -f "$QTMODULE.tmp"
6463 else
6464     mv -f "$QTMODULE.tmp" "$QTMODULE"
6465 fi
6466
6467 #-------------------------------------------------------------------------------
6468 # save configuration into .qmake.cache
6469 #-------------------------------------------------------------------------------
6470
6471 CACHEFILE="$outpath/.qmake.cache"
6472 [ -f "$CACHEFILE.tmp" ] && rm -f "$CACHEFILE.tmp"
6473 cat >>"$CACHEFILE.tmp" <<EOF
6474 #paths
6475 QT_SOURCE_TREE = \$\$quote($relpath)
6476 QT_BUILD_TREE = \$\$quote($outpath)
6477 QT_BUILD_PARTS = $CFG_BUILD_PARTS
6478
6479 #local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR
6480 QMAKE_INCDIR_QT  = \$\$QT_BUILD_TREE/include
6481 QMAKE_LIBDIR_QT  = \$\$QT_BUILD_TREE/lib
6482
6483 include(\$\$PWD/mkspecs/qmodule.pri)
6484 CONFIG += $QMAKE_CONFIG dylib depend_includepath fix_output_dirs no_private_qt_headers_warning QTDIR_build
6485
6486 EOF
6487
6488 #dump the qmake spec
6489 if [ -d "$outpath/mkspecs/$XPLATFORM" ]; then
6490    echo "QMAKESPEC = \$\$QT_BUILD_TREE/mkspecs/$XPLATFORM" >> "$CACHEFILE.tmp"
6491 else
6492    echo "QMAKESPEC = $XPLATFORM" >> "$CACHEFILE.tmp"
6493 fi
6494
6495 # replace .qmake.cache if it differs from the newly created temp file
6496 if cmp -s "$CACHEFILE.tmp" "$CACHEFILE"; then
6497     rm -f "$CACHEFILE.tmp"
6498 else
6499     mv -f "$CACHEFILE.tmp" "$CACHEFILE"
6500 fi
6501
6502 #-------------------------------------------------------------------------------
6503 # give feedback on configuration
6504 #-------------------------------------------------------------------------------
6505
6506 case "$COMPILER" in
6507 g++*)
6508     if [ "$CFG_EXCEPTIONS" != "no" ]; then
6509         cat <<EOF
6510
6511         This target is using the GNU C++ compiler ($PLATFORM).
6512
6513         Recent versions of this compiler automatically include code for
6514         exceptions, which increase both the size of the Qt libraries and
6515         the amount of memory taken by your applications.
6516
6517         You may choose to re-run `basename $0` with the -no-exceptions
6518         option to compile Qt without exceptions. This is completely binary
6519         compatible, and existing applications will continue to work.
6520
6521 EOF
6522     fi
6523     ;;
6524 cc*)
6525     case "$PLATFORM" in
6526     irix-cc*)
6527         if [ "$CFG_EXCEPTIONS" != "no" ]; then
6528             cat <<EOF
6529
6530         This target is using the MIPSpro C++ compiler ($PLATFORM).
6531
6532         You may choose to re-run `basename $0` with the -no-exceptions
6533         option to compile Qt without exceptions. This will make the
6534         size of the Qt library smaller and reduce the amount of memory
6535         taken by your applications.
6536
6537 EOF
6538         fi
6539         ;;
6540     *) ;;
6541     esac
6542     ;;
6543 *) ;;
6544 esac
6545
6546 echo
6547 if [ "$XPLATFORM" = "$PLATFORM" ]; then
6548     echo "Build type:    $PLATFORM"
6549 else
6550     echo "Building on:   $PLATFORM"
6551     echo "Building for:  $XPLATFORM"
6552 fi
6553
6554 echo "Architecture:  $CFG_ARCH"
6555 if [ "$PLATFORM_QPA" = "yes" ]; then
6556     echo "Host architecture: $CFG_HOST_ARCH"
6557 fi
6558
6559 if [ -n "$PLATFORM_NOTES" ]; then
6560     echo "Platform notes:"
6561     echo "$PLATFORM_NOTES"
6562 else
6563     echo
6564 fi
6565
6566 if [ "$OPT_VERBOSE" = "yes" ]; then
6567     echo $ECHO_N "qmake vars .......... $ECHO_C"
6568     cat "$QMAKE_VARS_FILE" | tr '\n' ' '
6569     echo "qmake switches ......... $QMAKE_SWITCHES"
6570 fi
6571
6572 echo "Build .................. $CFG_BUILD_PARTS"
6573 echo "Configuration .......... $QMAKE_CONFIG $QT_CONFIG"
6574 if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
6575    echo "Debug .................. yes (combined)"
6576    if [ "$CFG_DEBUG" = "yes" ]; then
6577        echo "Default Link ........... debug"
6578    else
6579        echo "Default Link ........... release"
6580    fi
6581 else
6582    echo "Debug .................. $CFG_DEBUG"
6583 fi
6584 [ "$CFG_DBUS" = "no" ]     && echo "QtDBus module .......... no"
6585 [ "$CFG_DBUS" = "yes" ]    && echo "QtDBus module .......... yes (run-time)"
6586 [ "$CFG_DBUS" = "linked" ] && echo "QtDBus module .......... yes (linked)"
6587 echo "QtConcurrent code ...... $CFG_CONCURRENT"
6588 echo "QtGui module ........... $CFG_GUI"
6589 echo "QtWidgets module ....... $CFG_WIDGETS"
6590 if [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
6591     echo "JavaScriptCore JIT ..... To be decided by JavaScriptCore"
6592 else
6593     echo "JavaScriptCore JIT ..... $CFG_JAVASCRIPTCORE_JIT"
6594 fi
6595 echo "Declarative debugging ...$CFG_DECLARATIVE_DEBUG"
6596 echo "STL support ............ $CFG_STL"
6597 echo "PCH support ............ $CFG_PRECOMPILE"
6598 if [ "$CFG_ARCH" = "i386" -o "$CFG_ARCH" = "x86_64" ]; then
6599     echo "MMX/3DNOW/SSE/SSE2/SSE3. ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}/${CFG_SSE3}"
6600     echo "SSSE3/SSE4.1/SSE4.2..... ${CFG_SSSE3}/${CFG_SSE4_1}/${CFG_SSE4_2}"
6601     echo "AVX..................... ${CFG_AVX}"
6602 elif [ "$CFG_ARCH" = "arm" ]; then
6603     echo "iWMMXt support ......... ${CFG_IWMMXT}"
6604     echo "NEON support ........... ${CFG_NEON}"
6605 fi
6606 if [ "$CFG_ARCH" = "mips" ]; then
6607     echo "MIPS_DSP/MIPS_DSPR2..... ${CFG_MIPS_DSP}/${CFG_MIPS_DSPR2}"
6608 fi
6609 echo "IPv6 ifname support .... $CFG_IPV6IFNAME"
6610 echo "getaddrinfo support .... $CFG_GETADDRINFO"
6611 echo "getifaddrs support ..... $CFG_GETIFADDRS"
6612 echo "Accessibility .......... $CFG_ACCESSIBILITY"
6613 echo "NIS support ............ $CFG_NIS"
6614 echo "CUPS support ........... $CFG_CUPS"
6615 echo "Iconv support .......... $CFG_ICONV"
6616 echo "Glib support ........... $CFG_GLIB"
6617 echo "GStreamer support ...... $CFG_GSTREAMER"
6618 echo "PulseAudio support ..... $CFG_PULSEAUDIO"
6619 echo "Large File support ..... $CFG_LARGEFILE"
6620 echo "GIF support ............ $CFG_GIF"
6621 if [ "$CFG_JPEG" = "no" ]; then
6622     echo "JPEG support ........... $CFG_JPEG"
6623 else
6624     echo "JPEG support ........... $CFG_JPEG ($CFG_LIBJPEG)"
6625 fi
6626 if [ "$CFG_PNG" = "no" ]; then
6627     echo "PNG support ............ $CFG_PNG"
6628 else
6629     echo "PNG support ............ $CFG_PNG ($CFG_LIBPNG)"
6630 fi
6631 echo "zlib support ........... $CFG_ZLIB"
6632 echo "Session management ..... $CFG_SM"
6633 echo "libudev support ........ $CFG_LIBUDEV"
6634
6635 if [ "$CFG_OPENGL" = "desktop" ]; then
6636     echo "OpenGL support ......... yes (Desktop OpenGL)"
6637 elif [ "$CFG_OPENGL" = "es2" ]; then
6638     echo "OpenGL support ......... yes (OpenGL ES 2.x)"
6639 else
6640     echo "OpenGL support ......... no"
6641 fi
6642
6643 if [ "$CFG_OPENVG" ]; then
6644     if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
6645         echo "OpenVG support ......... ShivaVG"
6646     else
6647         echo "OpenVG support ......... $CFG_OPENVG"
6648     fi
6649 fi
6650 if [ "$PLATFORM_X11" = "yes" ]; then
6651     echo "NAS sound support ...... $CFG_NAS"
6652     echo "XShape support ......... $CFG_XSHAPE"
6653     echo "XVideo support ......... $CFG_XVIDEO"
6654     echo "XSync support .......... $CFG_XSYNC"
6655     echo "Xinerama support ....... $CFG_XINERAMA"
6656     echo "Xcursor support ........ $CFG_XCURSOR"
6657     echo "Xfixes support ......... $CFG_XFIXES"
6658     echo "Xrandr support ......... $CFG_XRANDR"
6659     echo "Xi support ............. $CFG_XINPUT"
6660     echo "MIT-SHM support ........ $CFG_MITSHM"
6661     echo "FontConfig support ..... $CFG_FONTCONFIG"
6662     echo "XKB Support ............ $CFG_XKB"
6663     echo "immodule support ....... $CFG_IM"
6664     echo "GTK theme support ...... $CFG_QGTKSTYLE"
6665 fi
6666 [ "$CFG_SQL_mysql" != "no" ] && echo "MySQL support .......... $CFG_SQL_mysql"
6667 [ "$CFG_SQL_psql" != "no" ] && echo "PostgreSQL support ..... $CFG_SQL_psql"
6668 [ "$CFG_SQL_odbc" != "no" ] && echo "ODBC support ........... $CFG_SQL_odbc"
6669 [ "$CFG_SQL_oci" != "no" ] && echo "OCI support ............ $CFG_SQL_oci"
6670 [ "$CFG_SQL_tds" != "no" ] && echo "TDS support ............ $CFG_SQL_tds"
6671 [ "$CFG_SQL_db2" != "no" ] && echo "DB2 support ............ $CFG_SQL_db2"
6672 [ "$CFG_SQL_ibase" != "no" ] && echo "InterBase support ...... $CFG_SQL_ibase"
6673 [ "$CFG_SQL_sqlite2" != "no" ] && echo "SQLite 2 support ....... $CFG_SQL_sqlite2"
6674 [ "$CFG_SQL_sqlite" != "no" ] && echo "SQLite support ......... $CFG_SQL_sqlite ($CFG_SQLITE)"
6675
6676 OPENSSL_LINKAGE=""
6677 if [ "$CFG_OPENSSL" = "yes" ]; then
6678     OPENSSL_LINKAGE="(run-time)"
6679 elif [ "$CFG_OPENSSL" = "linked" ]; then
6680     OPENSSL_LINKAGE="(linked)"
6681 fi
6682 echo "OpenSSL support ........ $CFG_OPENSSL $OPENSSL_LINKAGE"
6683 echo "Alsa support ........... $CFG_ALSA"
6684 if [ "$BUILD_ON_MAC" = "yes" ]; then
6685     echo "CoreWlan support ....... $CFG_COREWLAN"
6686 fi
6687 echo "libICU support ......... $CFG_ICU"
6688 echo "PCRE support ........... $CFG_PCRE"
6689 if [ "$CFG_XCB_LIMITED" = "yes" ] && [ "$CFG_XCB" = "yes" ]; then
6690     echo "Xcb support ............ limited (old version)"
6691 else
6692     echo "Xcb support ............ $CFG_XCB"
6693 fi
6694 echo "Xrender support ........ $CFG_XRENDER"
6695 if [ "$XPLATFORM_MAEMO" = "yes" ] && [ "$CFG_XCB" = "yes" ]; then
6696     echo "XInput2 support ........ $CFG_XINPUT2"
6697 fi
6698 echo "EGLFS support .......... $CFG_EGLFS"
6699 echo
6700
6701 # complain about not being able to use dynamic plugins if we are using a static build
6702 if [ "$CFG_SHARED" = "no" ]; then
6703     echo
6704     echo "WARNING: Using static linking will disable the use of dynamically"
6705     echo "loaded plugins. Make sure to import all needed static plugins,"
6706     echo "or compile needed modules into the library."
6707     echo
6708 fi
6709 if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then
6710     echo
6711     echo "NOTE: When linking against OpenSSL, you can override the default"
6712     echo "library names through OPENSSL_LIBS."
6713     echo "For example:"
6714     echo "    OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked"
6715     echo
6716 fi
6717 if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then
6718     echo
6719     echo "Error: debug-only framework builds are not supported. Configure with -no-framework"
6720     echo "if you want a pure debug build."
6721     echo
6722     exit 1
6723 fi
6724
6725 sepath=`echo "$relpath" | sed -e 's/\\./\\\\./g'`
6726 PROCS=1
6727 EXEC=""
6728
6729
6730 #-------------------------------------------------------------------------------
6731 # build makefiles based on the configuration
6732 #-------------------------------------------------------------------------------
6733
6734 echo "Finding project files. Please wait..."
6735 if [ "$CFG_NOPROCESS" != "yes" ]; then
6736     "$outpath/bin/qmake" -prl -r "${relpath}/qtbase.pro"
6737     if [ -f "${relpath}/qtbase.pro" ]; then
6738         mkfile="${outpath}/Makefile"
6739         [ -f "$mkfile" ] && chmod +w "$mkfile"
6740         QTDIR="$outpath" "$outpath/bin/qmake" -spec "$XQMAKESPEC" "${relpath}/qtbase.pro" -o "$mkfile"
6741     fi
6742 fi
6743
6744 # .projects      -> projects to process
6745 # .projects.1    -> qt and moc
6746 # .projects.2    -> subdirs and libs
6747 # .projects.3    -> the rest
6748 rm -f .projects .projects.1 .projects.2 .projects.3
6749
6750 QMAKE_PROJECTS=`find "$relpath/." -name '*.pro' -print | sed 's-/\./-/-'`
6751 if [ -z "$AWK" ]; then
6752     for p in `echo $QMAKE_PROJECTS`; do
6753         echo "$p" >> .projects
6754     done
6755 else
6756     cat >projects.awk <<EOF
6757 BEGIN {
6758     files = 0
6759     target_file = ""
6760     input_file = ""
6761
6762     first = "./.projects.1.tmp"
6763     second = "./.projects.2.tmp"
6764     third = "./.projects.3.tmp"
6765 }
6766
6767 FNR == 1 {
6768     if ( input_file ) {
6769         if ( ! target_file )
6770             target_file = third
6771         print input_file >target_file
6772     }
6773
6774     matched_target = 0
6775     template_lib = 0
6776     input_file = FILENAME
6777     target_file = ""
6778 }
6779
6780 /^(TARGET.*=)/ {
6781     if ( \$3 == "moc" || \$3 ~ /^Qt/ ) {
6782         target_file = first
6783         matched_target = 1
6784     } else if ( \$3 == "lrelease" || \$3 == "qm_phony_target" ) {
6785         target_file = second
6786         matched_target = 1
6787     }
6788 }
6789
6790 matched_target == 0 && /^(TEMPLATE.*=)/ {
6791     if ( \$3 == "subdirs" )
6792         target_file = second
6793     else if ( \$3 == "lib" )
6794         template_lib = 1
6795     else
6796         target_file = third
6797 }
6798
6799 matched_target == 0 && template_lib == 1 && /^(CONFIG.*=)/ {
6800     if ( \$0 ~ /plugin/ )
6801         target_file = third
6802     else
6803         target_file = second
6804 }
6805
6806 END {
6807     if ( input_file ) {
6808         if ( ! target_file )
6809             target_file = third
6810         print input_file >>target_file
6811     }
6812 }
6813
6814 EOF
6815
6816     rm -f .projects.all
6817     for p in `echo $QMAKE_PROJECTS`; do
6818        echo "$p" >> .projects.all
6819     done
6820
6821     # if you get errors about the length of the command line to awk, change the -l arg
6822     # to split below
6823     split -l 100 .projects.all .projects.all.
6824     for p in .projects.all.*; do
6825        "$AWK" -f projects.awk `cat $p`
6826        [ -f .projects.1.tmp ] && cat .projects.1.tmp >> .projects.1
6827        [ -f .projects.2.tmp ] && cat .projects.2.tmp >> .projects.2
6828        [ -f .projects.3.tmp ] && cat .projects.3.tmp >> .projects.3
6829        rm -f .projects.1.tmp .projects.2.tmp .projects.3.tmp $p
6830     done
6831     rm -f .projects.all* projects.awk
6832
6833     [ -f .projects.1 ] && cat .projects.1 >>.projects
6834     [ -f .projects.2 ] && cat .projects.2 >>.projects
6835     rm -f .projects.1 .projects.2
6836     if [ -f .projects.3 ] && [ "$OPT_FAST" = "no" ]; then
6837        cat .projects.3 >>.projects
6838        rm -f .projects.3
6839     fi
6840 fi
6841 # don't sort Qt and MOC in with the other project files
6842 # also work around a segfaulting uniq(1)
6843 if [ -f .sorted.projects.2 ]; then
6844     sort .sorted.projects.2 > .sorted.projects.2.new
6845     mv -f .sorted.projects.2.new .sorted.projects.2
6846     cat .sorted.projects.2 >> .sorted.projects.1
6847 fi
6848 [ -f .sorted.projects.1 ] && sort .sorted.projects.1 >> .sorted.projects
6849 rm -f .sorted.projects.2 .sorted.projects.1
6850
6851 NORM_PROJECTS=0
6852 FAST_PROJECTS=0
6853 if [ -f .projects ]; then
6854    uniq .projects >.tmp
6855    mv -f .tmp .projects
6856    NORM_PROJECTS=`cat .projects | wc -l | sed -e "s, ,,g"`
6857 fi
6858 if [ -f .projects.3 ]; then
6859    uniq .projects.3 >.tmp
6860    mv -f .tmp .projects.3
6861    FAST_PROJECTS=`cat .projects.3 | wc -l | sed -e "s, ,,g"`
6862 fi
6863 echo "  `expr $NORM_PROJECTS + $FAST_PROJECTS` projects found."
6864 echo
6865
6866 PART_ROOTS=
6867 for part in $CFG_BUILD_PARTS; do
6868     case "$part" in
6869     tools) PART_ROOTS="$PART_ROOTS tools" ;;
6870     libs) PART_ROOTS="$PART_ROOTS src" ;;
6871     translations) PART_ROOTS="$PART_ROOTS translations" ;;
6872     examples) PART_ROOTS="$PART_ROOTS examples" ;;
6873     *) ;;
6874     esac
6875 done
6876
6877 if [ "$CFG_DEV" = "yes" ]; then
6878     PART_ROOTS="$PART_ROOTS tests"
6879 fi
6880
6881 echo "Creating makefiles. Please wait..."
6882 for file in .projects .projects.3; do
6883     [ '!' -f "$file" ] && continue
6884     for a in `cat $file`; do
6885         IN_ROOT=no
6886         for r in $PART_ROOTS; do
6887             if echo "$a" | grep "^$r" >/dev/null 2>&1 || echo "$a" | grep "^$relpath/$r" >/dev/null 2>&1; then
6888                 IN_ROOT=yes
6889                 break
6890             fi
6891         done
6892         [ "$IN_ROOT" = "no" ] && continue
6893
6894         case $a in
6895         *winmain/winmain.pro)
6896             if [ "$CFG_NOPROCESS" = "yes" ] || [ "$XPLATFORM_MINGW" != "yes" ]; then
6897                 continue
6898             fi
6899             SPEC=$XQMAKESPEC ;;
6900         */qmake/qmake.pro) continue ;;
6901         *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*|*tools/qdoc*) SPEC=$QMAKESPEC ;;
6902         *) if [ "$CFG_NOPROCESS" = "yes" ]; then
6903               continue
6904            else
6905               SPEC=$XQMAKESPEC
6906            fi;;
6907         esac
6908         dir=`dirname "$a" | sed -e "s;$sepath;.;g"`
6909         test -d "$dir" || mkdir -p "$dir"
6910         OUTDIR="$outpath/$dir"
6911         if [ -f "${OUTDIR}/Makefile" ] && [ "$OPT_FAST" = "yes" ]; then
6912             # fast configure - the makefile exists, skip it
6913             # since the makefile exists, it was generated by qmake, which means we
6914             # can skip it, since qmake has a rule to regenerate the makefile if the .pro
6915             # file changes...
6916             [ "$OPT_VERBOSE" = "yes" ] && echo "  skipping $a"
6917             continue;
6918         fi
6919         QMAKE_SPEC_ARGS="-spec $SPEC"
6920         echo $ECHO_N "  for $a$ECHO_C"
6921
6922         QMAKE="$outpath/bin/qmake"
6923         QMAKE_ARGS="$QMAKE_SWITCHES $QMAKE_SPEC_ARGS"
6924         if [ "$file" = ".projects.3" ]; then
6925             echo " (fast)"
6926
6927             cat >"${OUTDIR}/Makefile" <<EOF
6928 # ${OUTDIR}/Makefile: generated by configure
6929 #
6930 # WARNING: This makefile will be replaced with a real makefile.
6931 # All changes made to this file will be lost.
6932 EOF
6933             [ "$CFG_DEBUG_RELEASE" = "no" ] && echo "first_target: first" >>${OUTDIR}/Makefile
6934
6935             cat >>"${OUTDIR}/Makefile" <<EOF
6936 QMAKE = "$QMAKE"
6937 all clean install qmake first Makefile: FORCE
6938         \$(QMAKE) $QMAKE_ARGS -o "$OUTDIR" "$a"
6939         cd "$OUTDIR"
6940         \$(MAKE) \$@
6941
6942 FORCE:
6943
6944 EOF
6945         else
6946             if [ "$OPT_VERBOSE" = "yes" ]; then
6947                 echo " (`basename $SPEC`)"
6948                 echo "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
6949             else
6950                 echo
6951             fi
6952
6953             [ -f "${OUTDIR}/Makefile" ] && chmod +w "${OUTDIR}/Makefile"
6954             QTDIR="$outpath" "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
6955        fi
6956     done
6957 done
6958 rm -f .projects .projects.3
6959
6960 #-------------------------------------------------------------------------------
6961 # check for platforms that we don't yet know about
6962 #-------------------------------------------------------------------------------
6963 if [ "$CFG_ARCH" = "unknown" ]; then
6964 cat <<EOF
6965
6966         NOTICE: configure was unable to determine the architecture
6967         for the $XQMAKESPEC target.
6968
6969         Qt will not use a specialized implementation for any atomic
6970         operations. Instead a generic implemention based on either GCC
6971         intrinsics or C++11 std::atomic<T> will be used (when
6972         available). The generic implementations are generally as fast
6973         as and always as safe as a specialized implementation.
6974
6975         If no generic implementation is available, Qt will use a
6976         fallback UNIX implementation which uses a single
6977         pthread_mutex_t to protect all atomic operations. This
6978         implementation is the slow (but safe) fallback implementation
6979         for architectures Qt does not yet support.
6980 EOF
6981 fi
6982
6983 #-------------------------------------------------------------------------------
6984 # check if the user passed the -no-zlib option, which is no longer supported
6985 #-------------------------------------------------------------------------------
6986 if [ -n "$ZLIB_FORCED" ]; then
6987     which_zlib="supplied"
6988     if [ "$CFG_ZLIB" = "system" ]; then
6989         which_zlib="system"
6990     fi
6991
6992 cat <<EOF
6993
6994         NOTICE: The -no-zlib option was supplied but is no longer
6995         supported.
6996
6997         Qt now requires zlib support in all builds, so the -no-zlib
6998         option was ignored. Qt will be built using the $which_zlib
6999         zlib.
7000 EOF
7001 fi
7002
7003 #-------------------------------------------------------------------------------
7004 # check if the user passed the obsoleted -wayland or -no-wayland flag
7005 #-------------------------------------------------------------------------------
7006 if [ "$CFG_OBSOLETE_WAYLAND" = "yes" ]; then
7007 cat <<EOF
7008
7009         NOTICE: The -wayland and -no-wayland flags are now obsolete
7010
7011         All configuring of QtWayland plugin and QtCompositor happens in the module
7012 EOF
7013 fi
7014
7015 #-------------------------------------------------------------------------------
7016 # check if the user passed the obsoleted -arch or -host-arch options
7017 #-------------------------------------------------------------------------------
7018 if [ "$OPT_OBSOLETE_HOST_ARG" = "yes" ]; then
7019 cat <<EOF
7020
7021         NOTICE: The -arch and -host-arch options are obsolete.
7022
7023         Qt now detects the target and host architectures based on compiler
7024         output. Qt will be built using $CFG_ARCH for the target architecture
7025         and $CFG_HOST_ARCH for the host architecture (note that these two
7026         will be the same unless you are cross-compiling).
7027 EOF
7028 fi
7029
7030 #-------------------------------------------------------------------------------
7031 # finally save the executed command to another script
7032 #-------------------------------------------------------------------------------
7033 if [ `basename $0` != "config.status" ]; then
7034     CONFIG_STATUS="$relpath/$relconf $OPT_CMDLINE"
7035
7036     # add the system variables
7037     for varname in $SYSTEM_VARIABLES; do
7038         cmd=`echo \
7039 'if [ -n "\$'${varname}'" ]; then
7040     CONFIG_STATUS="'${varname}'='"'\\\$${varname}'"' \$CONFIG_STATUS"
7041 fi'`
7042         eval "$cmd"
7043     done
7044
7045     echo "$CONFIG_STATUS" | grep '\-confirm\-license' >/dev/null 2>&1 || CONFIG_STATUS="$CONFIG_STATUS -confirm-license"
7046
7047     [ -f "$outpath/config.status" ] && rm -f "$outpath/config.status"
7048     echo "#!/bin/sh" > "$outpath/config.status"
7049     [ -n "$PKG_CONFIG_SYSROOT_DIR" ] && \
7050         echo "export PKG_CONFIG_SYSROOT_DIR=$PKG_CONFIG_SYSROOT_DIR" >> "$outpath/config.status"
7051     [ -n "$PKG_CONFIG_LIBDIR" ] && \
7052         echo "export PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR" >> "$outpath/config.status"
7053     echo "if [ \"\$#\" -gt 0 ]; then" >> "$outpath/config.status"
7054     echo "  $CONFIG_STATUS \"\$@\"" >> "$outpath/config.status"
7055     echo "else" >> "$outpath/config.status"
7056     echo "  $CONFIG_STATUS" >> "$outpath/config.status"
7057     echo "fi" >> "$outpath/config.status"
7058     chmod +x "$outpath/config.status"
7059 fi
7060
7061 if [ -n "$RPATH_MESSAGE" ]; then
7062     echo
7063     echo "$RPATH_MESSAGE"
7064 fi
7065
7066 MAKE=`basename "$MAKE"`
7067 echo
7068 echo Qt is now configured for building. Just run \'$MAKE\'.
7069 if [ "$relpath" = "$QT_INSTALL_PREFIX" ]; then
7070     echo Once everything is built, Qt is installed.
7071     echo You should not run \'$MAKE install\'.
7072 else
7073     echo Once everything is built, you must run \'$MAKE install\'.
7074     echo Qt will be installed into $QT_INSTALL_PREFIX
7075 fi
7076 echo
7077 echo To reconfigure, run \'$MAKE confclean\' and \'configure\'.
7078 echo