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