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