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