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