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