-device: c01621ec8 broke device feature
[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 resolveDeviceMkspec()
246 {
247     result=$(find "$relpath/mkspecs/devices/" -type d -name "*$VAL*" | sed "s,^$relpath/mkspecs/,,")
248     match_count=$(echo "$result" | wc -w)
249     if [ "$match_count" -gt 1 ]; then
250         echo >&2 "Error: Multiple matches for device '$VAL'. Candidates are:"
251         tabbed_result=$(echo "$result" | sed "s,^,    ,")
252         echo >&2 "$tabbed_result"
253         echo "undefined"
254     elif [ "$match_count" -eq 0 ]; then
255         echo >&2 "Error: No device matching '$VAL'"
256         echo "undefined"
257     else
258         echo "$result"
259     fi
260 }
261
262 #-------------------------------------------------------------------------------
263 # operating system detection
264 #-------------------------------------------------------------------------------
265
266 # need that throughout the script
267 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
268 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
269 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
270 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
271
272 # detect the "echo without newline" style. usage: echo $ECHO_N "<string>$ECHO_C"
273 if echo '\c' | grep '\c' >/dev/null; then
274     ECHO_N=-n
275 else
276     ECHO_C='\c'
277 fi
278
279 #-------------------------------------------------------------------------------
280 # window system detection
281 #-------------------------------------------------------------------------------
282
283 BUILD_ON_MAC=no
284 PLATFORM_MAC=no
285 if [ -d /System/Library/Frameworks/Carbon.framework ]; then
286     BUILD_ON_MAC=yes
287     PLATFORM_MAC=maybe
288 fi
289
290 #-----------------------------------------------------------------------------
291 # Qt version detection
292 #-----------------------------------------------------------------------------
293 QT_VERSION=`grep '^# *define *QT_VERSION_STR' "$relpath"/src/corelib/global/qglobal.h`
294 QT_MAJOR_VERSION=
295 QT_MINOR_VERSION=0
296 QT_PATCH_VERSION=0
297 if [ -n "$QT_VERSION" ]; then
298    QT_VERSION=`echo $QT_VERSION | sed 's,^# *define *QT_VERSION_STR *"*\([^ ]*\)"$,\1,'`
299    MAJOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'`
300    if [ -n "$MAJOR" ]; then
301      MINOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'`
302       PATCH=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'`
303       QT_MAJOR_VERSION="$MAJOR"
304       [ -z "$MINOR" ] || QT_MINOR_VERSION="$MINOR"
305       [ -z "$PATCH" ] || QT_PATCH_VERSION="$PATCH"
306    fi
307 fi
308 if [ -z "$QT_MAJOR_VERSION" ]; then
309    echo "Cannot process version from qglobal.h: $QT_VERSION"
310    echo "Cannot proceed."
311    exit 1
312 fi
313
314 QT_PACKAGEDATE=`grep '^# *define *QT_PACKAGEDATE_STR' "$relpath"/src/corelib/global/qglobal.h | sed -e 's,^# *define *QT_PACKAGEDATE_STR *"\([^ ]*\)"$,\1,' -e s,-,,g`
315 if [ -z "$QT_PACKAGEDATE" ]; then
316    echo "Unable to determine package date from qglobal.h: '$QT_PACKAGEDATE'"
317    echo "Cannot proceed"
318    exit 1
319 fi
320
321 #-------------------------------------------------------------------------------
322 # check the license
323 #-------------------------------------------------------------------------------
324 COMMERCIAL_USER=ask
325 CFG_DEV=no
326 CFG_RTOS_ENABLED=yes
327 EditionString=Commercial
328
329 earlyArgParse()
330 {
331     # parse the arguments, setting things to "yes" or "no"
332     while [ "$#" -gt 0 ]; do
333         CURRENT_OPT="$1"
334         UNKNOWN_ARG=no
335         case "$1" in
336         #Autoconf style options
337         --enable-*)
338             VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"`
339             VAL=yes
340             ;;
341         --disable-*)
342             VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"`
343             VAL=no
344             ;;
345         --*=*)
346             VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"`
347             VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"`
348             ;;
349         --no-*)
350             VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
351             VAL=no
352             ;;
353         -h|help|--help|-help)
354             if [ "$VAL" = "yes" ]; then
355                 OPT_HELP="$VAL"
356                 COMMERCIAL_USER="no" #doesn't matter we will display the help
357             else
358                 UNKNOWN_OPT=yes
359                 COMMERCIAL_USER="no" #doesn't matter we will display the help
360             fi
361             ;;
362         --*)
363             VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
364             VAL=yes
365             ;;
366         -*)
367             VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
368             VAL="unknown"
369             ;;
370         *)
371             UNKNOWN_ARG=yes
372             ;;
373         esac
374         if [ "$UNKNOWN_ARG" = "yes" ]; then
375             shift
376             continue
377         fi
378         shift
379
380         UNKNOWN_OPT=no
381         case "$VAR" in
382         developer-build)
383             CFG_DEV="yes"
384             ;;
385         commercial)
386             COMMERCIAL_USER="yes"
387             ;;
388         opensource)
389             COMMERCIAL_USER="no"
390             ;;
391         *)
392             UNKNOWN_OPT=yes
393             ;;
394         esac
395     done
396 }
397
398 earlyArgParse "$@"
399
400 if [ "$COMMERCIAL_USER" = "ask" ]; then
401     while true; do
402         echo "Which edition of Qt do you want to use ?"
403         echo
404         echo "Type 'c' if you want to use the Commercial Edition."
405         echo "Type 'o' if you want to use the Open Source Edition."
406         echo
407         read commercial
408         echo
409         if [ "$commercial" = "c" ]; then
410             COMMERCIAL_USER="yes"
411             break
412         elif [ "$commercial" = "o" ]; then
413             COMMERCIAL_USER="no"
414             break
415         fi
416     done
417 fi
418
419 if [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ]; then
420     # Commercial preview release
421     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
422     Licensee="Preview"
423     Edition="Preview"
424     QT_EDITION="QT_EDITION_DESKTOP"
425     LicenseType="Technology Preview"
426 elif [ $COMMERCIAL_USER = "yes" ]; then
427     # one of commercial editions
428     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
429
430     # read in the license file
431     if [ -f "$LICENSE_FILE" ]; then
432         . "$LICENSE_FILE" >/dev/null 2>&1
433         if [ -z "$LicenseKeyExt" ]; then
434             echo
435             echo "You are using an old license file."
436             echo
437             echo "Please install the license file supplied by Nokia,"
438             echo "or install the Qt Open Source Edition if you intend to"
439             echo "develop free software."
440             exit 1
441         fi
442         if [ -z "$Licensee" ]; then
443             echo
444             echo "Invalid license key. Please check the license key."
445             exit 1
446         fi
447     else
448         if [ -z "$LicenseKeyExt" ]; then
449             echo
450             echo $ECHO_N "Please enter your license key: $ECHO_C"
451             read LicenseKeyExt
452             Licensee="Unknown user"
453         fi
454     fi
455
456     # Key verification
457     echo "$LicenseKeyExt" | grep ".....*-....*-....*-....*-.....*-.....*-...." >/dev/null 2>&1 \
458         && LicenseValid="yes" \
459         || LicenseValid="no"
460     if [ "$LicenseValid" != "yes" ]; then
461         echo
462         echo "Invalid license key. Please check the license key."
463         exit 1
464     fi
465     ProductCode=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1`
466     PlatformCode=`echo $LicenseKeyExt | cut -f 2 -d -`
467     LicenseTypeCode=`echo $LicenseKeyExt | cut -f 3 -d -`
468     LicenseFeatureCode=`echo $LicenseKeyExt | cut -f 4 -d - | cut -b 1`
469
470     # determine which edition we are licensed to use
471     case "$LicenseTypeCode" in
472     F4M)
473         LicenseType="Commercial"
474         case $ProductCode in
475         F)
476             Edition="Universal"
477             QT_EDITION="QT_EDITION_UNIVERSAL"
478             ;;
479         B)
480             Edition="FullFramework"
481             EditionString="Full Framework"
482             QT_EDITION="QT_EDITION_DESKTOP"
483             ;;
484         L)
485             Edition="GUIFramework"
486             EditionString="GUI Framework"
487             QT_EDITION="QT_EDITION_DESKTOPLIGHT"
488             ;;
489         esac
490         ;;
491     Z4M|R4M|Q4M)
492         LicenseType="Evaluation"
493         QMakeVar add DEFINES QT_EVAL
494         case $ProductCode in
495          B)
496             Edition="Evaluation"
497             QT_EDITION="QT_EDITION_EVALUATION"
498             ;;
499         esac
500         ;;
501     esac
502     if [ -z "$LicenseType" -o -z "$Edition" -o -z "$QT_EDITION" ]; then
503         echo
504         echo "Invalid license key. Please check the license key."
505         exit 1
506     fi
507
508     # verify that we are licensed to use Qt on this platform
509     LICENSE_EXTENSION=
510     case "$PlatformCode" in
511         *L)
512             CFG_RTOS_ENABLED=yes
513             PlatformCode=`echo "$PlatformCode" | sed 'h;y/8NPQRTZ/UCWX9M7/;x;G;s/\(.\)....\(.\)./\1\2/'`
514             ;;
515         *)
516             CFG_RTOS_ENABLED=no
517             PlatformCode=`echo "$PlatformCode" | sed 's/.$//'`
518             ;;
519     esac
520     ### EMBEDDED_QPA logic missing ###
521     case "$PlatformCode,$PLATFORM_MAC" in
522         X9,* | XC,* | XU,* | XW,* | XM,*)
523             # Qt All-OS
524             LICENSE_EXTENSION="-ALLOS"
525             ;;
526         8M,* | KM,* | S9,* | SC,* | SM,* | SU,* | SW,* | X9,* | XC,* | XU,* | XW,*)
527             # Qt for Embedded Linux
528             LICENSE_EXTENSION="-EMBEDDED"
529             ;;
530         6M,* | N7,* | N9,* | NX,*)
531             # Embedded no-deploy
532             LICENSE_EXTENSION="-EMBEDDED"
533             ;;
534         FM,* | LM,yes | ZM,no)
535             # Desktop
536             LICENSE_EXTENSION="-DESKTOP"
537             ;;
538         *)
539             Platform=Linux/X11
540             [ "$PLATFORM_MAC" = "yes" ] && Platform='Mac OS X'
541             echo
542             echo "You are not licensed for the $Platform platform."
543             echo
544             echo "Please contact qt-info@nokia.com to upgrade your license to"
545             echo "include the $Platform platform, or install the Qt Open Source Edition"
546             echo "if you intend to develop free software."
547             exit 1
548             ;;
549     esac
550
551     if test -r "$relpath/.LICENSE"; then
552         # Generic, non-final license
553         LICENSE_EXTENSION=""
554         line=`sed 'y/a-z/A-Z/;q' "$relpath"/.LICENSE`
555         case "$line" in
556             *BETA*)
557                 Edition=Beta
558                 ;;
559             *TECHNOLOGY?PREVIEW*)
560                 Edition=Preview
561                 ;;
562             *EVALUATION*)
563                 Edition=Evaluation
564                 ;;
565             *)
566                 echo >&2 "Invalid license files; cannot continue"
567                 exit 1
568                 ;;
569         esac
570         Licensee="$Edition"
571         EditionString="$Edition"
572         QT_EDITION="QT_EDITION_DESKTOP"
573     fi
574
575     case "$LicenseFeatureCode" in
576     B|G|L|Y)
577         # US
578         case "$LicenseType" in
579         Commercial)
580             cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}-US" "$outpath/LICENSE"
581             ;;
582         Evaluation)
583             cp -f "$relpath/.LICENSE-EVALUATION-US" "$outpath/LICENSE"
584             ;;
585         esac
586         ;;
587     2|4|5|F)
588         # non-US
589         case "$LicenseType" in
590         Commercial)
591             cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}" "$outpath/LICENSE"
592             ;;
593         Evaluation)
594             cp -f "$relpath/.LICENSE-EVALUATION" "$outpath/LICENSE"
595             ;;
596         esac
597         ;;
598     *)
599         echo
600         echo "Invalid license key. Please check the license key."
601         exit 1
602         ;;
603     esac
604     case "$LicenseFeatureCode" in
605         4|B|F|Y)
606             CFG_RTOS_ENABLED=yes
607             ;;
608         2|5|G|L)
609             CFG_RTOS_ENABLED=no
610             ;;
611     esac
612     if [ '!' -f "$outpath/LICENSE" ]; then
613         echo "The LICENSE, LICENSE.GPL3 LICENSE.LGPL file shipped with"
614         echo "this software has disappeared."
615         echo
616         echo "Sorry, you are not licensed to use this software."
617         echo "Try re-installing."
618         echo
619         exit 1
620     fi
621 elif [ $COMMERCIAL_USER = "no" ]; then
622     # Open Source edition - may only be used under the terms of the GPL or LGPL.
623     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
624     Licensee="Open Source"
625     Edition="OpenSource"
626     EditionString="Open Source"
627     QT_EDITION="QT_EDITION_OPENSOURCE"
628 fi
629
630 #-------------------------------------------------------------------------------
631 # initalize variables
632 #-------------------------------------------------------------------------------
633
634 SYSTEM_VARIABLES="RANLIB STRIP OBJDUMP LD CC CXX CFLAGS CXXFLAGS LDFLAGS"
635 for varname in $SYSTEM_VARIABLES; do
636     qmakevarname="${varname}"
637     # use LDFLAGS for autoconf compat, but qmake uses QMAKE_LFLAGS
638     if [ "${varname}" = "LDFLAGS" ]; then
639         qmakevarname="LFLAGS"
640     elif [ "${varname}" = "LD" ]; then
641         qmakevarname="LINK"
642     fi
643     cmd=`echo \
644 'if [ -n "\$'${varname}'" ]; then
645     QMakeVar set QMAKE_'${qmakevarname}' "\$'${varname}'"
646 fi'`
647     eval "$cmd"
648 done
649 # Use CC/CXX to run config.tests
650 mkdir -p "$outpath/config.tests"
651 rm -f "$outpath/config.tests/.qmake.cache"
652 cp "$QMAKE_VARS_FILE" "$outpath/config.tests/.qmake.cache"
653
654 QMakeVar add styles "cde mac motif plastique cleanlooks windows"
655
656 # QTDIR may be set and point to an old or system-wide Qt installation
657 unset QTDIR
658
659 # the minimum version of libdbus-1 that we require:
660 MIN_DBUS_1_VERSION=0.93
661
662 # initalize internal variables
663 CFG_CONFIGURE_EXIT_ON_ERROR=yes
664 CFG_PROFILE=no
665 CFG_GUI=auto # (yes|no|auto)
666 CFG_WIDGETS=yes
667 CFG_QCONFIG=full
668 CFG_DEBUG=auto
669 CFG_MYSQL_CONFIG=
670 CFG_DEBUG_RELEASE=no
671 CFG_SHARED=yes
672 CFG_SM=auto
673 CFG_XSHAPE=auto
674 CFG_XSYNC=auto
675 CFG_XVIDEO=auto
676 CFG_XINERAMA=runtime
677 CFG_XFIXES=runtime
678 CFG_ZLIB=auto
679 CFG_SQLITE=qt
680 CFG_GIF=auto
681 CFG_PNG=yes
682 CFG_LIBPNG=auto
683 CFG_JPEG=auto
684 CFG_LIBJPEG=auto
685 CFG_XCURSOR=runtime
686 CFG_XRANDR=runtime
687 CFG_XRENDER=auto
688 CFG_MITSHM=auto
689 CFG_OPENGL=auto
690 CFG_OPENVG=auto
691 CFG_OPENVG_LC_INCLUDES=no
692 CFG_OPENVG_SHIVA=auto
693 CFG_OPENVG_ON_OPENGL=auto
694 CFG_EGL=auto
695 CFG_SSE=auto
696 CFG_FONTCONFIG=auto
697 CFG_LIBFREETYPE=auto
698 CFG_SQL_AVAILABLE=
699 QT_DEFAULT_BUILD_PARTS="libs examples"
700 CFG_BUILD_PARTS=""
701 CFG_NOBUILD_PARTS=""
702 CFG_RELEASE_QMAKE=no
703 CFG_AUDIO_BACKEND=auto
704 CFG_V8SNAPSHOT=auto
705 CFG_QML_DEBUG=yes
706 CFG_JAVASCRIPTCORE_JIT=auto
707 CFG_PKGCONFIG=auto
708
709 # Target architecture
710 CFG_ARCH=
711 # Host architecture, same as CFG_ARCH when not cross-compiling
712 CFG_HOST_ARCH=
713 # Set when the -arch or -host-arch arguments are used
714 OPT_OBSOLETE_HOST_ARG=no
715
716 CFG_USE_GNUMAKE=no
717 CFG_IM=yes
718 CFG_XINPUT2=auto
719 CFG_XINPUT=runtime
720 CFG_XKB=auto
721 CFG_XCB=auto
722 CFG_XCB_LIMITED=yes
723 CFG_EGLFS=auto
724 CFG_DIRECTFB=auto
725 CFG_LIBUDEV=auto
726 CFG_OBSOLETE_WAYLAND=no
727 CFG_EVDEV=auto
728 CFG_NIS=auto
729 CFG_CUPS=auto
730 CFG_ICONV=auto
731 CFG_DBUS=auto
732 CFG_GLIB=auto
733 CFG_GSTREAMER=auto
734 CFG_QGTKSTYLE=auto
735 CFG_LARGEFILE=auto
736 CFG_OPENSSL=auto
737 CFG_PRECOMPILE=auto
738 CFG_SEPARATE_DEBUG_INFO=no
739 CFG_SEPARATE_DEBUG_INFO_NOCOPY=no
740 CFG_REDUCE_EXPORTS=auto
741 CFG_SSE2=auto
742 CFG_SSE3=auto
743 CFG_SSSE3=auto
744 CFG_SSE4_1=auto
745 CFG_SSE4_2=auto
746 CFG_AVX=auto
747 CFG_AVX2=auto
748 CFG_REDUCE_RELOCATIONS=auto
749 CFG_ACCESSIBILITY=auto
750 CFG_IWMMXT=no
751 CFG_NEON=auto
752 CFG_MIPS_DSP=yes
753 CFG_MIPS_DSPR2=yes
754 CFG_CLOCK_GETTIME=auto
755 CFG_CLOCK_MONOTONIC=auto
756 CFG_MREMAP=auto
757 CFG_GETADDRINFO=auto
758 CFG_IPV6IFNAME=auto
759 CFG_GETIFADDRS=auto
760 CFG_INOTIFY=auto
761 CFG_RPATH=yes
762 CFG_FRAMEWORK=auto
763 MAC_CONFIG_TEST_COMMANDLINE=  # used to make the configure tests run with the correct arch's and SDK settings
764 CFG_MAC_HARFBUZZ=no
765 CFG_SXE=no
766 CFG_PREFIX_INSTALL=yes
767 CFG_SDK=
768 D_FLAGS=
769 I_FLAGS=
770 L_FLAGS=
771 RPATH_FLAGS=
772 l_FLAGS=
773 W_FLAGS=
774 QCONFIG_FLAGS=
775 XPLATFORM=              # This seems to be the QMAKESPEC, like "linux-g++"
776 XPLATFORM_MINGW=no      # Whether target platform is MinGW (win32-g++*)
777 XPLATFORM_MAEMO=no
778 PLATFORM=$QMAKESPEC
779 QT_CROSS_COMPILE=no
780 OPT_CONFIRM_LICENSE=no
781 OPT_SHADOW=maybe
782 OPT_FAST=auto
783 OPT_VERBOSE=no
784 OPT_HELP=
785 CFG_SILENT=no
786 CFG_ALSA=auto
787 CFG_PULSEAUDIO=auto
788 CFG_COREWLAN=auto
789 CFG_NOPROCESS=no
790 CFG_ICU=auto
791 CFG_FORCE_ASSERTS=no
792 CFG_PCRE=auto
793 QPA_PLATFORM_GUARD=yes
794
795 # initalize variables used for installation
796 QT_INSTALL_PREFIX=
797 QT_INSTALL_DOCS=
798 QT_INSTALL_HEADERS=
799 QT_INSTALL_LIBS=
800 QT_INSTALL_BINS=
801 QT_INSTALL_PLUGINS=
802 QT_INSTALL_IMPORTS=
803 QT_INSTALL_DATA=
804 QT_INSTALL_TRANSLATIONS=
805 QT_INSTALL_SETTINGS=
806 QT_INSTALL_EXAMPLES=
807 QT_INSTALL_TESTS=
808 CFG_SYSROOT=
809 QT_HOST_PREFIX=
810 QT_HOST_BINS=
811 QT_HOST_DATA=
812
813 #flags for SQL drivers
814 QT_CFLAGS_PSQL=
815 QT_LFLAGS_PSQL=
816 QT_CFLAGS_MYSQL=
817 QT_LFLAGS_MYSQL=
818 QT_LFLAGS_MYSQL_R=
819 QT_CFLAGS_SQLITE=
820 QT_LFLAGS_SQLITE=
821 QT_LFLAGS_ODBC="-lodbc"
822 QT_LFLAGS_TDS=
823
824 # flags for libdbus-1
825 QT_CFLAGS_DBUS=
826 QT_LIBS_DBUS=
827
828 # flags for Glib (X11 only)
829 QT_CFLAGS_GLIB=
830 QT_LIBS_GLIB=
831
832 # flags for GStreamer (X11 only)
833 QT_CFLAGS_GSTREAMER=
834 QT_LIBS_GSTREAMER=
835
836 # default qpa platform
837 QT_QPA_DEFAULT_PLATFORM=
838
839 #-------------------------------------------------------------------------------
840 # check SQL drivers available in this package
841 #-------------------------------------------------------------------------------
842
843 # opensource version removes some drivers, so force them to be off
844 CFG_SQL_tds=no
845 CFG_SQL_oci=no
846 CFG_SQL_db2=no
847
848 CFG_SQL_AVAILABLE=
849 if [ -d "$relpath/src/plugins/sqldrivers" ]; then
850   for a in "$relpath/src/plugins/sqldrivers/"*; do
851      if [ -d "$a" ]; then
852          base_a=`basename "$a"`
853          CFG_SQL_AVAILABLE="${CFG_SQL_AVAILABLE} ${base_a}"
854          eval "CFG_SQL_${base_a}=auto"
855      fi
856   done
857 fi
858
859 CFG_IMAGEFORMAT_PLUGIN_AVAILABLE=
860 if [ -d "$relpath/src/plugins/imageformats" ]; then
861     for a in "$relpath/src/plugins/imageformats/"*; do
862         if [ -d "$a" ]; then
863             base_a=`basename "$a"`
864             CFG_IMAGEFORMAT_PLUGIN_AVAILABLE="${CFG_IMAGEFORMAT_PLUGIN_AVAILABLE} ${base_a}"
865         fi
866     done
867 fi
868
869 #-------------------------------------------------------------------------------
870 # parse command line arguments
871 #-------------------------------------------------------------------------------
872
873 # parse the arguments, setting things to "yes" or "no"
874 while [ "$#" -gt 0 ]; do
875     CURRENT_OPT="$1"
876     UNKNOWN_ARG=no
877     case "$1" in
878     #Autoconf style options
879     --enable-*)
880         VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"`
881         VAL=yes
882         ;;
883     --disable-*)
884         VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"`
885         VAL=no
886         ;;
887     --*=*)
888         VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"`
889         VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"`
890         ;;
891     --no-*)
892         VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
893         VAL=no
894         ;;
895     --*)
896         VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
897         VAL=yes
898         ;;
899     #Qt plugin options
900     -no-*-*|-plugin-*-*|-qt-*-*)
901         VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
902         VAL=`echo $1 | sed "s,^-\([^-]*\).*,\1,"`
903         ;;
904     #Qt style no options
905     -no-*)
906         VAR=`echo $1 | sed "s,^-no-\(.*\),\1,"`
907         VAL=no
908         ;;
909     #Qt style yes options
910     -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|-harfbuzz|-prefix-install|-silent|-optimized-qmake|-reduce-relocations|-sse|-openssl|-openssl-linked|-phonon-backend|-audio-backend|-qml-debug|-javascript-jit|-rpath|-pkg-config|-force-pkg-config|-icu|-force-asserts|-testcocoon)
911         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
912         VAL=yes
913         ;;
914     #Qt style options that pass an argument
915     -qconfig)
916         CFG_QCONFIG="$VAL"
917         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
918         shift
919         VAL=$1
920         ;;
921     -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)
922         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
923         shift
924         VAL="$1"
925         ;;
926     #Qt style complex options in one command
927     -enable-*|-disable-*)
928         VAR=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
929         VAL=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
930         ;;
931     #Qt Builtin/System style options
932     -no-*|-system-*|-qt-*)
933         VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
934         VAL=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
935         ;;
936     #Options that cannot be generalized
937     -k|-continue)
938         VAR=fatal_error
939         VAL=no
940         ;;
941     -opengl)
942         VAR=opengl
943         # this option may or may not be followed by an argument
944         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
945             VAL=yes
946         else
947             shift;
948             VAL=$1
949         fi
950         ;;
951     -openvg)
952         VAR=openvg
953         # this option may or may not be followed by an argument
954         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
955             VAL=yes
956         else
957             shift;
958             VAL=$1
959         fi
960         ;;
961     -hostprefix)
962         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
963         # this option may or may not be followed by an argument
964         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
965             VAL=$outpath
966         else
967             shift;
968             VAL=$1
969         fi
970         ;;
971     -qtnamespace)
972         VAR="qtnamespace"
973         shift
974         VAL="$1"
975         ;;
976     -qtlibinfix)
977         VAR="qtlibinfix"
978         shift
979         VAL="$1"
980         ;;
981     -D?*|-D)
982         VAR="add_define"
983         if [ "$1" = "-D" ]; then
984             shift
985             VAL="$1"
986         else
987             VAL=`echo $1 | sed 's,-D,,'`
988         fi
989         ;;
990     -fpu)
991         VAR="fpu"
992         # this option may or may not be followed by an argument
993         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
994             VAL=no
995         else
996             shift
997             VAL=$1
998         fi
999         ;;
1000     -I?*|-I)
1001         VAR="add_ipath"
1002         if [ "$1" = "-I" ]; then
1003             shift
1004             VAL="$1"
1005         else
1006             VAL=`echo $1 | sed 's,-I,,'`
1007         fi
1008         ;;
1009     -L?*|-L)
1010         VAR="add_lpath"
1011         if [ "$1" = "-L" ]; then
1012             shift
1013             VAL="$1"
1014         else
1015             VAL=`echo $1 | sed 's,-L,,'`
1016         fi
1017         ;;
1018     -R?*|-R)
1019         VAR="add_rpath"
1020         if [ "$1" = "-R" ]; then
1021             shift
1022             VAL="$1"
1023         else
1024             VAL=`echo $1 | sed 's,-R,,'`
1025         fi
1026         ;;
1027     -l?*)
1028         VAR="add_link"
1029         VAL=`echo $1 | sed 's,-l,,'`
1030         ;;
1031     -F?*|-F)
1032         VAR="add_fpath"
1033         if [ "$1" = "-F" ]; then
1034             shift
1035             VAL="$1"
1036         else
1037             VAL=`echo $1 | sed 's,-F,,'`
1038         fi
1039         ;;
1040     -fw?*|-fw)
1041         VAR="add_framework"
1042         if [ "$1" = "-fw" ]; then
1043             shift
1044             VAL="$1"
1045         else
1046             VAL=`echo $1 | sed 's,-fw,,'`
1047         fi
1048         ;;
1049     -W*)
1050         VAR="add_warn"
1051         VAL="$1"
1052         ;;
1053     -*)
1054         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
1055         VAL="unknown"
1056         ;;
1057     *)
1058         UNKNOWN_ARG=yes
1059         ;;
1060     esac
1061     if [ "$UNKNOWN_ARG" = "yes" ]; then
1062         echo "$1: unknown argument"
1063         OPT_HELP=yes
1064         ERROR=yes
1065         shift
1066         continue
1067      fi
1068     shift
1069
1070     UNKNOWN_OPT=no
1071     case "$VAR" in
1072     accessibility)
1073         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1074             CFG_ACCESSIBILITY="$VAL"
1075         else
1076             UNKNOWN_OPT=yes
1077         fi
1078         ;;
1079     license)
1080         LICENSE_FILE="$VAL"
1081         ;;
1082     gnumake)
1083         CFG_USE_GNUMAKE="$VAL"
1084         ;;
1085     mysql_config)
1086         CFG_MYSQL_CONFIG="$VAL"
1087         ;;
1088     prefix)
1089         QT_INSTALL_PREFIX="$VAL"
1090         ;;
1091     hostprefix)
1092         QT_HOST_PREFIX="$VAL"
1093         ;;
1094     hostdatadir)
1095         QT_HOST_DATA="$VAL"
1096         ;;
1097     hostbindir)
1098         QT_HOST_BINS="$VAL"
1099         ;;
1100     pkg-config)
1101         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1102             CFG_PKGCONFIG="$VAL"
1103         else
1104             UNKNOWN_OPT=yes
1105         fi
1106         ;;
1107     force-pkg-config)
1108         CFG_PKGCONFIG="force"
1109         ;;
1110     docdir)
1111         QT_INSTALL_DOCS="$VAL"
1112         ;;
1113     headerdir)
1114         QT_INSTALL_HEADERS="$VAL"
1115         ;;
1116     plugindir)
1117         QT_INSTALL_PLUGINS="$VAL"
1118         ;;
1119     importdir)
1120         QT_INSTALL_IMPORTS="$VAL"
1121         ;;
1122     datadir)
1123         QT_INSTALL_DATA="$VAL"
1124         ;;
1125     libdir)
1126         QT_INSTALL_LIBS="$VAL"
1127         ;;
1128     qtnamespace)
1129         QT_NAMESPACE="$VAL"
1130         ;;
1131     qtlibinfix)
1132         QT_LIBINFIX="$VAL"
1133         ;;
1134     translationdir)
1135         QT_INSTALL_TRANSLATIONS="$VAL"
1136         ;;
1137     sysconfdir|settingsdir)
1138         QT_INSTALL_SETTINGS="$VAL"
1139         ;;
1140     examplesdir)
1141         QT_INSTALL_EXAMPLES="$VAL"
1142         ;;
1143     testsdir)
1144         QT_INSTALL_TESTS="$VAL"
1145         ;;
1146     qconfig)
1147         CFG_QCONFIG="$VAL"
1148         ;;
1149     sysroot)
1150         CFG_SYSROOT="$VAL"
1151         ;;
1152     bindir)
1153         QT_INSTALL_BINS="$VAL"
1154         ;;
1155     sxe)
1156         CFG_SXE="$VAL"
1157         ;;
1158     sse)
1159         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1160             CFG_SSE="$VAL"
1161         else
1162             UNKNOWN_OPT=yes
1163         fi
1164         ;;
1165     opengl)
1166         if  [ "$VAL" = "auto" ] || [ "$VAL" = "desktop" ] ||
1167             [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] ||
1168             [ "$VAL" = "es2" ]; then
1169             CFG_OPENGL="$VAL"
1170         else
1171             UNKNOWN_OPT=yes
1172         fi
1173         ;;
1174     openvg)
1175         if [ "$VAL" = "auto" ] || [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1176             CFG_OPENVG="$VAL"
1177         else
1178             UNKNOWN_OPT=yes
1179         fi
1180         ;;
1181     nomake)
1182         CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS $VAL"
1183         ;;
1184     make)
1185         CFG_BUILD_PARTS="$CFG_BUILD_PARTS $VAL"
1186         ;;
1187     sdk)
1188         if [ "$BUILD_ON_MAC" = "yes" ]; then
1189             CFG_SDK="$VAL"
1190         else
1191             UNKNOWN_OPT=yes
1192         fi
1193         ;;
1194     arch|host-arch)
1195         OPT_OBSOLETE_HOST_ARG=yes
1196         ;;
1197     harfbuzz)
1198         if [ "$BUILD_ON_MAC" = "yes" ] && [ "$VAL" = "yes" ]; then
1199             CFG_MAC_HARFBUZZ="$VAL"
1200         else
1201             UNKNOWN_OPT=yes
1202         fi
1203         ;;
1204
1205     framework)
1206         if [ "$BUILD_ON_MAC" = "yes" ]; then
1207             CFG_FRAMEWORK="$VAL"
1208         else
1209             UNKNOWN_OPT=yes
1210         fi
1211         ;;
1212     profile)
1213         if [ "$VAL" = "yes" ]; then
1214             CFG_PROFILE=yes
1215             QMakeVar add QMAKE_CFLAGS -pg
1216             QMakeVar add QMAKE_CXXFLAGS -pg
1217             QMakeVar add QMAKE_LFLAGS -pg
1218             QMAKE_VARS="$QMAKE_VARS CONFIG+=nostrip"
1219         else
1220             UNKNOWN_OPT=yes
1221         fi
1222         ;;
1223     testcocoon)
1224         if [ "$VAL" = "yes" ]; then
1225             QTCONFIG_CONFIG="$QTCONFIG_CONFIG testcocoon"
1226         fi
1227         ;;
1228     platform)
1229         PLATFORM="$VAL"
1230         # keep compatibility with old platform names
1231         case $PLATFORM in
1232         aix-64)
1233             PLATFORM=aix-xlc-64
1234             ;;
1235         hpux-o64)
1236             PLATFORM=hpux-acc-o64
1237             ;;
1238         hpux-n64)
1239             PLATFORM=hpux-acc-64
1240             ;;
1241         hpux-acc-n64)
1242             PLATFORM=hpux-acc-64
1243             ;;
1244         irix-n32)
1245             PLATFORM=irix-cc
1246             ;;
1247         irix-64)
1248             PLATFORM=irix-cc-64
1249             ;;
1250         irix-cc-n64)
1251             PLATFORM=irix-cc-64
1252             ;;
1253         reliant-64)
1254             PLATFORM=reliant-cds-64
1255             ;;
1256         solaris-64)
1257             PLATFORM=solaris-cc-64
1258             ;;
1259         openunix-cc)
1260             PLATFORM=unixware-cc
1261             ;;
1262         openunix-g++)
1263             PLATFORM=unixware-g++
1264             ;;
1265         unixware7-cc)
1266             PLATFORM=unixware-cc
1267             ;;
1268         unixware7-g++)
1269             PLATFORM=unixware-g++
1270             ;;
1271         macx-g++-64)
1272             PLATFORM=macx-g++
1273             NATIVE_64_ARCH=
1274             case `uname -p` in
1275             i386) NATIVE_64_ARCH="x86_64" ;;
1276             powerpc) NATIVE_64_ARCH="ppc64" ;;
1277             *)   echo "WARNING: Can't detect CPU architecture for macx-g++-64" ;;
1278             esac
1279             if [ ! -z "$NATIVE_64_ARCH" ]; then
1280                 QTCONFIG_CONFIG="$QTCONFIG_CONFIG $NATIVE_64_ARCH"
1281             fi
1282             ;;
1283         esac
1284         ;;
1285     xplatform)
1286         XPLATFORM="$VAL"
1287         case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac
1288         ;;
1289     device)
1290         XPLATFORM=`resolveDeviceMkspec $VAL`
1291         [ "$XPLATFORM" = "undefined" ] && exit 101
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 support for separate debug info in objcopy
2504 if [ "$CFG_SEPARATE_DEBUG_INFO" != "no" ] && [ "$CFG_SHARED" = "yes" ]; then
2505     TEST_COMPILER_CFLAGS=`getXQMakeConf QMAKE_CFLAGS`
2506     TEST_COMPILER_CXXFLAGS=`getXQMakeConf QMAKE_CXXFLAGS`
2507     TEST_OBJCOPY=`getXQMakeConf QMAKE_OBJCOPY`
2508     COMPILER_WITH_FLAGS="$TEST_COMPILER $TEST_COMPILER_CXXFLAGS"
2509     COMPILER_WITH_FLAGS=`echo "$COMPILER_WITH_FLAGS" | sed -e "s%\\$\\$QMAKE_CFLAGS%$TEST_COMPILER_CFLAGS%g"`
2510     if "$unixtests/objcopy.test" "$COMPILER_WITH_FLAGS" "$TEST_OBJCOPY" "$OPT_VERBOSE"; then
2511        CFG_SEPARATE_DEBUG_INFO=no
2512     else
2513        case "$PLATFORM" in
2514        hpux-*)
2515            # binutils on HP-UX is buggy; default to no.
2516            CFG_SEPARATE_DEBUG_INFO=no
2517            ;;
2518        *)
2519            CFG_SEPARATE_DEBUG_INFO=yes
2520            ;;
2521        esac
2522     fi
2523 fi
2524
2525 # auto-detect -fvisibility support
2526 if [ "$CFG_REDUCE_EXPORTS" != "no" ]; then
2527     if "$unixtests/fvisibility.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
2528        if [ "$CFG_REDUCE_EXPORTS" = "yes" ]; then
2529            echo "-reduce-exports was requested but this compiler does not support it"
2530            echo "Re-run configure with -v for more information"
2531            exit 1
2532        fi
2533        CFG_REDUCE_EXPORTS=no
2534     else
2535        CFG_REDUCE_EXPORTS=yes
2536     fi
2537 fi
2538
2539 # detect the availability of the -Bsymbolic-functions linker optimization
2540 if [ "$CFG_REDUCE_RELOCATIONS" != "no" ]; then
2541     if "$unixtests/bsymbolic_functions.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
2542        if [ "$CFG_REDUCE_RELOCATIONS" = "yes" ]; then
2543            echo "-reduce-relocations was requested but this compiler does not support it"
2544            echo "Re-run configure with -v for more information"
2545            exit 1
2546        fi
2547         CFG_REDUCE_RELOCATIONS=no
2548     else
2549         CFG_REDUCE_RELOCATIONS=yes
2550     fi
2551 fi
2552
2553 # auto-detect GNU make support
2554 if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2>&1; then
2555    CFG_USE_GNUMAKE=yes
2556 fi
2557
2558 # find the default framework value
2559 if [ "$BUILD_ON_MAC" = "yes" ]; then
2560     if [ "$CFG_FRAMEWORK" = "auto" ]; then
2561         CFG_FRAMEWORK="$CFG_SHARED"
2562     elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
2563         echo
2564         echo "WARNING: Using static linking will disable the use of Mac frameworks."
2565         echo
2566         CFG_FRAMEWORK="no"
2567     fi
2568 else
2569     CFG_FRAMEWORK=no
2570 fi
2571
2572 #setup the build parts
2573 if [ -z "$CFG_BUILD_PARTS" ]; then
2574     CFG_BUILD_PARTS="$QT_DEFAULT_BUILD_PARTS"
2575
2576     # build tests by default, if a developer build
2577     if [ "$CFG_DEV" = "yes" ]; then
2578         CFG_BUILD_PARTS="$CFG_BUILD_PARTS tests"
2579     fi
2580
2581     # don't build tools by default when cross-compiling
2582     if [ "$PLATFORM" != "$XPLATFORM" ]; then
2583         CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, tools,,g"`
2584     fi
2585 fi
2586 for nobuild in $CFG_NOBUILD_PARTS; do
2587     CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, $nobuild,,g"`
2588 done
2589 if echo $CFG_BUILD_PARTS | grep -v libs >/dev/null 2>&1; then
2590 #    echo
2591 #    echo "WARNING: libs is a required part of the build."
2592 #    echo
2593     CFG_BUILD_PARTS="$CFG_BUILD_PARTS libs"
2594 fi
2595
2596 #-------------------------------------------------------------------------------
2597 # post process QT_INSTALL_* variables
2598 #-------------------------------------------------------------------------------
2599
2600 if [ -z "$QT_INSTALL_PREFIX" ]; then
2601     if [ "$CFG_DEV" = "yes" ]; then
2602         QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default
2603     else
2604         QT_INSTALL_PREFIX="/usr/local/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Qt-$QT_VERSION
2605     fi
2606 fi
2607 QT_INSTALL_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PREFIX"`
2608
2609 if [ -z "$QT_INSTALL_DOCS" ]; then #default
2610     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2611         if [ "$BUILD_ON_MAC" = "yes" ]; then
2612             QT_INSTALL_DOCS="/Developer/Documentation/Qt"
2613         fi
2614     fi
2615     [ -z "$QT_INSTALL_DOCS" ] && QT_INSTALL_DOCS="$QT_INSTALL_PREFIX/doc" #fallback
2616
2617 fi
2618 QT_INSTALL_DOCS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DOCS"`
2619
2620 if [ -z "$QT_INSTALL_HEADERS" ]; then #default
2621     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2622         if [ "$BUILD_ON_MAC" = "yes" ]; then
2623             if [ "$CFG_FRAMEWORK" = "yes" ]; then
2624                 QT_INSTALL_HEADERS=
2625             fi
2626         fi
2627     fi
2628     [ -z "$QT_INSTALL_HEADERS" ] && QT_INSTALL_HEADERS="$QT_INSTALL_PREFIX/include"
2629
2630 fi
2631 QT_INSTALL_HEADERS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_HEADERS"`
2632
2633 if [ -z "$QT_INSTALL_LIBS" ]; then #default
2634     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2635         if [ "$BUILD_ON_MAC" = "yes" ]; then
2636             if [ "$CFG_FRAMEWORK" = "yes" ]; then
2637                 QT_INSTALL_LIBS="/Libraries/Frameworks"
2638             fi
2639         fi
2640     fi
2641     [ -z "$QT_INSTALL_LIBS" ] && QT_INSTALL_LIBS="$QT_INSTALL_PREFIX/lib" #fallback
2642 fi
2643 QT_INSTALL_LIBS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_LIBS"`
2644
2645 if [ -z "$QT_INSTALL_BINS" ]; then #default
2646     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2647         if [ "$BUILD_ON_MAC" = "yes" ]; then
2648             QT_INSTALL_BINS="/Developer/Applications/Qt"
2649         fi
2650     fi
2651     [ -z "$QT_INSTALL_BINS" ] && QT_INSTALL_BINS="$QT_INSTALL_PREFIX/bin" #fallback
2652 fi
2653 QT_INSTALL_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_BINS"`
2654
2655 if [ -z "$QT_INSTALL_PLUGINS" ]; then #default
2656     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2657         if [ "$BUILD_ON_MAC" = "yes" ]; then
2658             QT_INSTALL_PLUGINS="/Developer/Applications/Qt/plugins"
2659         fi
2660     fi
2661     [ -z "$QT_INSTALL_PLUGINS" ] && QT_INSTALL_PLUGINS="$QT_INSTALL_PREFIX/plugins" #fallback
2662 fi
2663 QT_INSTALL_PLUGINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PLUGINS"`
2664
2665 if [ -z "$QT_INSTALL_IMPORTS" ]; then #default
2666     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2667         if [ "$BUILD_ON_MAC" = "yes" ]; then
2668             QT_INSTALL_IMPORTS="/Developer/Applications/Qt/imports"
2669         fi
2670     fi
2671     [ -z "$QT_INSTALL_IMPORTS" ] && QT_INSTALL_IMPORTS="$QT_INSTALL_PREFIX/imports" #fallback
2672 fi
2673 QT_INSTALL_IMPORTS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_IMPORTS"`
2674
2675 if [ -z "$QT_INSTALL_DATA" ]; then #default
2676     QT_INSTALL_DATA="$QT_INSTALL_PREFIX"
2677 fi
2678 QT_INSTALL_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DATA"`
2679
2680 if [ -z "$QT_INSTALL_TRANSLATIONS" ]; then #default
2681     QT_INSTALL_TRANSLATIONS="$QT_INSTALL_PREFIX/translations"
2682 fi
2683 QT_INSTALL_TRANSLATIONS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TRANSLATIONS"`
2684
2685 if [ -z "$QT_INSTALL_SETTINGS" ]; then #default
2686     if [ "$BUILD_ON_MAC" = "yes" ]; then
2687         QT_INSTALL_SETTINGS=/Library/Preferences/Qt
2688     else
2689         QT_INSTALL_SETTINGS=/etc/xdg
2690     fi
2691 fi
2692 QT_INSTALL_SETTINGS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_SETTINGS"`
2693
2694 if [ -z "$QT_INSTALL_EXAMPLES" ]; then #default
2695     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2696         if [ "$BUILD_ON_MAC" = "yes" ]; then
2697             QT_INSTALL_EXAMPLES="/Developer/Examples/Qt"
2698         fi
2699     fi
2700     [ -z "$QT_INSTALL_EXAMPLES" ] && QT_INSTALL_EXAMPLES="$QT_INSTALL_PREFIX/examples" #fallback
2701 fi
2702 QT_INSTALL_EXAMPLES=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_EXAMPLES"`
2703
2704 #tests
2705 if [ -z "$QT_INSTALL_TESTS" ]; then #default
2706     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2707         if [ "$BUILD_ON_MAC" = "yes" ]; then
2708             QT_INSTALL_TESTS="/Developer/Tests/Qt"
2709         fi
2710     fi
2711     [ -z "$QT_INSTALL_TESTS" ] && QT_INSTALL_TESTS="$QT_INSTALL_PREFIX/tests" #fallback
2712 fi
2713 QT_INSTALL_TESTS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TESTS"`
2714
2715 #------- host paths --------
2716
2717 if [ -z "$QT_HOST_PREFIX" ]; then
2718     QT_HOST_PREFIX=$QT_INSTALL_PREFIX
2719     haveHpx=false
2720 else
2721     QT_HOST_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_PREFIX"`
2722     haveHpx=true
2723 fi
2724
2725 if [ -z "$QT_HOST_BINS" ]; then #default
2726     if $haveHpx; then
2727         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2728             if [ "$BUILD_ON_MAC" = "yes" ]; then
2729                 QT_HOST_BINS="/Developer/Applications/Qt"
2730             fi
2731         fi
2732         [ -z "$QT_HOST_BINS" ] && QT_HOST_BINS="$QT_HOST_PREFIX/bin" #fallback
2733     else
2734         QT_HOST_BINS="$QT_INSTALL_BINS"
2735     fi
2736 fi
2737 QT_HOST_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_BINS"`
2738
2739 if [ -z "$QT_HOST_DATA" ]; then #default
2740     if $haveHpx; then
2741         QT_HOST_DATA="$QT_HOST_PREFIX"
2742     else
2743         QT_HOST_DATA="$QT_INSTALL_DATA"
2744     fi
2745 else
2746     QT_HOST_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_DATA"`
2747 fi
2748
2749 #-------------------------------------------------------------------------------
2750 # help - interactive parts of the script _after_ this section please
2751 #-------------------------------------------------------------------------------
2752
2753 # next, emit a usage message if something failed.
2754 if [ "$OPT_HELP" = "yes" ]; then
2755     [ "x$ERROR" = "xyes" ] && echo
2756     if [ "$CFG_NIS" = "no" ]; then
2757         NSY=" "
2758         NSN="*"
2759     else
2760         NSY="*"
2761         NSN=" "
2762     fi
2763     if [ "$CFG_CUPS" = "no" ]; then
2764         CUY=" "
2765         CUN="*"
2766     else
2767         CUY="*"
2768         CUN=" "
2769     fi
2770     if [ "$CFG_ICONV" = "no" ]; then
2771         CIY=" "
2772         CIN="*"
2773     else
2774         CIY="*"
2775         CIN=" "
2776     fi
2777     if [ "$CFG_LARGEFILE" = "no" ]; then
2778         LFSY=" "
2779         LFSN="*"
2780     else
2781         LFSY="*"
2782         LFSN=" "
2783     fi
2784     if [ "$CFG_PRECOMPILE" = "auto" ] || [ "$CFG_PRECOMPILE" = "no" ]; then
2785         PHY=" "
2786         PHN="*"
2787     else
2788         PHY="*"
2789         PHN=" "
2790     fi
2791
2792     if [ "$CFG_XCB" = "no" ]; then
2793         XCBY=" "
2794         XCBN="*"
2795     else
2796         XCBY="*"
2797         XCBN=" "
2798     fi
2799
2800     if [ "$CFG_EGLFS" = "no" ]; then
2801         EGLFSY=" "
2802         EGLFSN="*"
2803     else
2804         EGLFSY="*"
2805         EGLFSN=" "
2806     fi
2807
2808     if [ "$CFG_DIRECTFB" = "no" ]; then
2809         DFBY=" "
2810         DFBN="*"
2811     else
2812         DFBY="*"
2813         DFBN=" "
2814     fi
2815     if [ "$CFG_XINPUT2" = "no" ]; then
2816         X2Y=" "
2817         X2N="*"
2818     else
2819         X2Y="*"
2820         X2N=" "
2821     fi
2822
2823     if [ "$CFG_DBUS" = "no" ]; then
2824         DBY=" "
2825         DBN="+"
2826     else
2827         DBY="+"
2828         DBN=" "
2829     fi
2830
2831     if [ "$CFG_SEPARATE_DEBUG_INFO" = "no" ]; then
2832         SBY=" "
2833         SBN="*"
2834     else
2835         SBY="*"
2836         SBN=" "
2837     fi
2838
2839     if [ "$CFG_GLIB" = "no" ]; then
2840         GBY=" "
2841         GBN="+"
2842     else
2843         GBY="+"
2844         GBN=" "
2845     fi
2846
2847     cat <<EOF
2848 Usage:  $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>]
2849         [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-importdir <dir>] [-datadir <dir>]
2850         [-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>] [-testsdir <dir>]
2851         [-release] [-debug] [-debug-and-release]
2852         [-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile]
2853         [-largefile] [-no-accessibility] [-accessibility] [-no-sql-<driver>] [-sql-<driver>]
2854         [-plugin-sql-<driver>] [-system-sqlite]
2855         [-platform] [-D <string>] [-I <string>] [-L <string>] [-help]
2856         [-qt-zlib] [-system-zlib] [-no-gif] [-no-libpng] [-qt-libpng] [-system-libpng]
2857         [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>]
2858         [-nomake <part>] [-R <string>]  [-l <string>] [-no-rpath]  [-rpath] [-continue]
2859         [-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [-no-iconv]
2860         [-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked] [-no-gui]
2861         [-no-separate-debug-info] [-no-sse2]
2862         [-no-sse3] [-no-ssse3] [-no-sse4.1] [-no-sse4.2] [-no-avx] [-no-neon]
2863         [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info]
2864         [-no-phonon-backend] [-phonon-backend] [-no-media-backend] [-media-backend]
2865         [-no-audio-backend] [-audio-backend]
2866         [-no-javascript-jit] [-javascript-jit] [-no-qml-debug] [-qml-debug]
2867         [-no-optimized-qmake] [-optimized-qmake]
2868         [-no-openssl] [-openssl] [-openssl-linked]
2869         [-no-gtkstyle] [-gtkstyle]
2870         [-qt-pcre] [-system-pcre]
2871         [-device <name>] [-device-option <key=value>]
2872         [additional platform specific options (see below)]
2873
2874
2875 Installation options:
2876
2877  These are optional, but you may specify install directories.
2878
2879     -prefix <dir> ...... This will install everything relative to <dir>
2880                          (default $QT_INSTALL_PREFIX)
2881
2882     -hostprefix [dir] .. Tools and libraries needed when developing
2883                          applications are installed in [dir]. If [dir] is
2884                          not given, the current build directory will be used.
2885                          (default PREFIX)
2886
2887   * -prefix-install .... Force a sandboxed "local" installation of
2888                          Qt. This will install into
2889                          $QT_INSTALL_PREFIX, if this option is
2890                          disabled then some platforms will attempt a
2891                          "system" install by placing default values to
2892                          be placed in a system location other than
2893                          PREFIX.
2894
2895  You may use these to separate different parts of the install:
2896
2897     -bindir <dir> ......... Executables will be installed to <dir>
2898                             (default PREFIX/bin)
2899     -libdir <dir> ......... Libraries will be installed to <dir>
2900                             (default PREFIX/lib)
2901     -docdir <dir> ......... Documentation will be installed to <dir>
2902                             (default PREFIX/doc)
2903     -headerdir <dir> ...... Headers will be installed to <dir>
2904                             (default PREFIX/include)
2905     -plugindir <dir> ...... Plugins will be installed to <dir>
2906                             (default PREFIX/plugins)
2907     -importdir <dir> ...... Imports for QML will be installed to <dir>
2908                             (default PREFIX/imports)
2909     -datadir <dir> ........ Data used by Qt programs will be installed to <dir>
2910                             (default PREFIX)
2911     -translationdir <dir> . Translations of Qt programs will be installed to <dir>
2912                             (default PREFIX/translations)
2913     -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir>
2914                             (default PREFIX/etc/settings)
2915     -examplesdir <dir> .... Examples will be installed to <dir>
2916                             (default PREFIX/examples)
2917     -testsdir <dir> ....... Tests will be installed to <dir>
2918                             (default PREFIX/tests)
2919
2920     -hostbindir <dir> .. Host executables will be installed to <dir>
2921                          (default HOSTPREFIX/bin)
2922     -hostdatadir <dir> . Data used by qmake will be installed to <dir>
2923                          (default HOSTPREFIX)
2924
2925 Configure options:
2926
2927  The defaults (*) are usually acceptable. A plus (+) denotes a default value
2928  that needs to be evaluated. If the evaluation succeeds, the feature is
2929  included. Here is a short explanation of each option:
2930
2931  *  -release ........... Compile and link Qt with debugging turned off.
2932     -debug ............. Compile and link Qt with debugging turned on.
2933     -debug-and-release . Compile and link two versions of Qt, with and without
2934                          debugging turned on (Mac only).
2935
2936     -developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting)
2937
2938     -opensource ........ Compile and link the Open-Source Edition of Qt.
2939     -commercial ........ Compile and link the Commercial Edition of Qt.
2940
2941
2942  *  -shared ............ Create and use shared Qt libraries.
2943     -static ............ Create and use static Qt libraries.
2944
2945  *  -no-fast ........... Configure Qt normally by generating Makefiles for all
2946                          project files.
2947     -fast .............. Configure Qt quickly by generating Makefiles only for
2948                          library and subdirectory targets.  All other Makefiles
2949                          are created as wrappers, which will in turn run qmake.
2950
2951     -no-largefile ...... Disables large file support.
2952  +  -largefile ......... Enables Qt to access files larger than 4 GB.
2953
2954     -no-accessibility .. Do not compile Accessibility support.
2955  *  -accessibility ..... Compile Accessibility support.
2956
2957     -no-sql-<driver> ... Disable SQL <driver> entirely.
2958     -qt-sql-<driver> ... Enable a SQL <driver> in the QtSql library, by default
2959                          none are turned on.
2960     -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to
2961                          at run time.
2962
2963                          Possible values for <driver>:
2964                          [ $CFG_SQL_AVAILABLE ]
2965
2966     -system-sqlite ..... Use sqlite from the operating system.
2967
2968     -no-phonon-backend.. Do not build the platform phonon plugin.
2969  +  -phonon-backend..... Build the platform phonon plugin.
2970
2971     -no-javascript-jit . Do not build the JavaScriptCore JIT compiler.
2972  +  -javascript-jit .... Build the JavaScriptCore JIT compiler.
2973
2974     -no-qml-debug ...... Do not build the in-process QML debugging support.
2975  +  -qml-debug ......... Build the QML debugging support.
2976
2977     -platform target ... The operating system and compiler you are building
2978                          on ($PLATFORM).
2979
2980                          See the README file for a list of supported
2981                          operating systems and compilers.
2982
2983     -no-sse2 ........... Do not compile with use of SSE2 instructions.
2984     -no-sse3 ........... Do not compile with use of SSE3 instructions.
2985     -no-ssse3 .......... Do not compile with use of SSSE3 instructions.
2986     -no-sse4.1.......... Do not compile with use of SSE4.1 instructions.
2987     -no-sse4.2.......... Do not compile with use of SSE4.2 instructions.
2988     -no-avx ............ Do not compile with use of AVX instructions.
2989     -no-avx2 ........... Do not compile with use of AVX2 instructions.
2990     -no-neon ........... Do not compile with use of NEON instructions.
2991     -no-mips_dsp ....... Do not compile with use of MIPS DSP instructions.
2992     -no-mips_dspr2 ..... Do not compile with use of MIPS DSP rev2 instructions.
2993
2994     -qtnamespace <name>  Wraps all Qt library code in 'namespace <name> {...}'.
2995     -qtlibinfix <infix>  Renames all libQt*.so to libQt*<infix>.so.
2996
2997     -testcocoon          Instrument Qt with the TestCocoon code coverage tool.
2998
2999     -D <string> ........ Add an explicit define to the preprocessor.
3000     -I <string> ........ Add an explicit include path.
3001     -L <string> ........ Add an explicit library path.
3002
3003  +  -pkg-config ........ Use pkg-config to detect include and library paths. By default,
3004                          configure determines whether to use pkg-config or not with
3005                          some heuristics such as checking the environment variables.
3006     -no-pkg-config ..... Disable use of pkg-config.
3007     -force-pkg-config .. Force usage of pkg-config (skips pkg-config usability
3008                          detection heuristic).
3009
3010     -help, -h .......... Display this information.
3011
3012 Third Party Libraries:
3013
3014     -qt-zlib ........... Use the zlib bundled with Qt.
3015  +  -system-zlib ....... Use zlib from the operating system.
3016                          See http://www.gzip.org/zlib
3017
3018     -no-gif ............ Do not compile GIF reading support.
3019
3020     -no-libpng ......... Do not compile PNG support.
3021     -qt-libpng ......... Use the libpng bundled with Qt.
3022  +  -system-libpng ..... Use libpng from the operating system.
3023                          See http://www.libpng.org/pub/png
3024
3025     -no-libjpeg ........ Do not compile JPEG support.
3026     -qt-libjpeg ........ Use the libjpeg bundled with Qt.
3027  +  -system-libjpeg .... Use libjpeg from the operating system.
3028                          See http://www.ijg.org
3029
3030     -no-openssl ........ Do not compile support for OpenSSL.
3031  +  -openssl ........... Enable run-time OpenSSL support.
3032     -openssl-linked .... Enabled linked OpenSSL support.
3033
3034     -qt-pcre ........... Use the PCRE library bundled with Qt.
3035  +  -system-pcre ....... Use the PCRE library from the operating system.
3036
3037 Additional options:
3038
3039     -make <part> ....... Add part to the list of parts to be built at make time.
3040                          ($QT_DEFAULT_BUILD_PARTS)
3041     -nomake <part> ..... Exclude part from the list of parts to be built.
3042
3043     -R <string> ........ Add an explicit runtime library path to the Qt
3044                          libraries.
3045     -l <string> ........ Add an explicit library.
3046
3047     -no-rpath .......... Do not use the library install path as a runtime
3048                          library path.
3049  +  -rpath ............. Link Qt libraries and executables using the library
3050                          install path as a runtime library path. Equivalent
3051                          to -R install_libpath
3052
3053     -continue .......... Continue as far as possible if an error occurs.
3054
3055     -verbose, -v ....... Print verbose information about each step of the
3056                          configure process.
3057
3058     -silent ............ Reduce the build output so that warnings and errors
3059                          can be seen more easily.
3060
3061  *  -no-optimized-qmake ... Do not build qmake optimized.
3062     -optimized-qmake ...... Build qmake optimized.
3063
3064     -no-gui ............ Don't build the Qt GUI library
3065
3066  $NSN  -no-nis ............ Do not compile NIS support.
3067  $NSY  -nis ............... Compile NIS support.
3068
3069  $CUN  -no-cups ........... Do not compile CUPS support.
3070  $CUY  -cups .............. Compile CUPS support.
3071                          Requires cups/cups.h and libcups.so.2.
3072
3073  $CIN  -no-iconv .......... Do not compile support for iconv(3).
3074  $CIY  -iconv ............. Compile support for iconv(3).
3075
3076  $PHN  -no-pch ............ Do not use precompiled header support.
3077  $PHY  -pch ............... Use precompiled header support.
3078
3079  $DBN  -no-dbus ........... Do not compile the QtDBus module.
3080  $DBY  -dbus .............. Compile the QtDBus module and dynamically load libdbus-1.
3081     -dbus-linked ....... Compile the QtDBus module and link to libdbus-1.
3082
3083     -reduce-relocations ..... Reduce relocations in the libraries through extra
3084                               linker optimizations (Qt/X11 and Qt for Embedded Linux only;
3085                               experimental; needs GNU ld >= 2.18).
3086
3087     -force-asserts ........ Force Q_ASSERT to be enabled even in release builds.
3088
3089     -device <name> ............... Cross-compile for device <name> (experimental)
3090     -device-option <key=value> ... Add device specific options for the device mkspec
3091                                    (experimental)
3092
3093  $SBN  -no-separate-debug-info . Do not store debug information in a separate file.
3094  $SBY  -separate-debug-info .... Strip debug information into a separate .debug file.
3095
3096  $XCBN  -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support.
3097  $XCBY  -xcb ............... Compile Xcb support.
3098
3099  $EGLFSN  -no-eglfs .......... Do not compile EGLFS (EGL Full Screen/Single Surface) support.
3100  $EGLFSY  -eglfs ............. Compile EGLFS support (Requires OpenGL ES 2 support).
3101
3102  $DFBN  -no-directfb ....... Do not compile DirectFB support.
3103  $DFBY  -directfb .......... Compile DirectFB support.
3104
3105     -qpa <name> ......... Sets the default QPA platform (e.g xcb, cocoa, windows).
3106
3107     -xplatform target ... The target platform when cross-compiling.
3108
3109     -sysroot <dir> ...... Sets <dir> as the target compiler's and qmake's sysroot.
3110
3111     -no-feature-<feature> Do not compile in <feature>.
3112     -feature-<feature> .. Compile in <feature>. The available features
3113                           are described in src/corelib/global/qfeatures.txt
3114
3115     -no-freetype ........ Do not compile in Freetype2 support.
3116     -qt-freetype ........ Use the libfreetype bundled with Qt.
3117  *  -system-freetype .... Use libfreetype from the operating system.
3118                           See http://www.freetype.org/
3119
3120     -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the
3121                           default ($CFG_QCONFIG).
3122
3123     -no-opengl .......... Do not support OpenGL.
3124     -opengl <api> ....... Enable OpenGL support
3125                           With no parameter, this will attempt to auto-detect
3126                           OpenGL ES 2, or regular desktop OpenGL.
3127                           Use es2 for <api> to override auto-detection.
3128
3129  $GBN  -no-glib ........... Do not compile Glib support.
3130  $GBY  -glib .............. Compile Glib support.
3131 EOF
3132
3133 if [ "$XPLATFORM_MAEMO" = "yes" ]; then
3134     cat << EOF
3135
3136  $X2N  -no-xinput2......... Do not compile XInput2 support.
3137  $X2Y  -xinput2............ Compile XInput2 support.
3138
3139 EOF
3140
3141 fi
3142
3143 if [ "$BUILD_ON_MAC" = "yes" ]; then
3144     cat << EOF
3145
3146 Qt/Mac only:
3147
3148     -Fstring ........... Add an explicit framework path.
3149     -fw string ......... Add an explicit framework.
3150
3151  *  -framework ......... Build Qt as a series of frameworks and
3152                          link tools against those frameworks.
3153     -no-framework ...... Do not build Qt as a series of frameworks.
3154
3155     -sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. This option requires gcc 4.
3156                          To use a different SDK with gcc 3.3, set the SDKROOT environment variable.
3157
3158     -harfbuzz .......... Use HarfBuzz to do text layout instead of Core Text when possible.
3159  *  -no-harfbuzz ....... Disable HarfBuzz on Mac. It can still be enabled by setting
3160                          QT_ENABLE_HARFBUZZ environment variable.
3161
3162 EOF
3163 fi
3164
3165    [ "x$ERROR" = "xyes" ] && exit 1
3166    exit 0
3167 fi # Help
3168
3169
3170 # -----------------------------------------------------------------------------
3171 # LICENSING, INTERACTIVE PART
3172 # -----------------------------------------------------------------------------
3173
3174 echo
3175 echo "This is the Qt ${EditionString} Edition."
3176 echo
3177
3178 if [ "$Edition" = "OpenSource" ]; then
3179     while true; do
3180         echo "You are licensed to use this software under the terms of"
3181         echo "the Lesser GNU General Public License (LGPL) versions 2.1."
3182         if [ -f "$relpath/LICENSE.GPL3" ]; then
3183             echo "You are also licensed to use this software under the terms of"
3184             echo "the GNU General Public License (GPL) versions 3."
3185             affix="either"
3186         else
3187             affix="the"
3188         fi
3189         echo
3190         if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
3191             echo "You have already accepted the terms of the $LicenseType license."
3192             acceptance=yes
3193         else
3194             if [ -f "$relpath/LICENSE.GPL3" ]; then
3195                 echo "Type '3' to view the GNU General Public License version 3."
3196             fi
3197             echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
3198             echo "Type 'yes' to accept this license offer."
3199             echo "Type 'no' to decline this license offer."
3200             echo
3201             echo $ECHO_N "Do you accept the terms of $affix license? $ECHO_C"
3202             read acceptance
3203         fi
3204         echo
3205         if [ "$acceptance" = "yes" ] || [ "$acceptance" = "y" ]; then
3206             break
3207         elif [ "$acceptance" = "no" ]; then
3208             echo "You are not licensed to use this software."
3209             echo
3210             exit 1
3211         elif [ "$acceptance" = "3" ]; then
3212             more "$relpath/LICENSE.GPL3"
3213         elif [ "$acceptance" = "L" ]; then
3214             more "$relpath/LICENSE.LGPL"
3215         fi
3216     done
3217 elif [ "$Edition" = "Preview" ]; then
3218     TheLicense=`head -n 1 "$relpath/LICENSE.PREVIEW.COMMERCIAL"`
3219     while true; do
3220
3221         if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
3222             echo "You have already accepted the terms of the $LicenseType license."
3223             acceptance=yes
3224         else
3225             echo "You are licensed to use this software under the terms of"
3226             echo "the $TheLicense"
3227             echo
3228             echo "Type '?' to read the Preview License."
3229             echo "Type 'yes' to accept this license offer."
3230             echo "Type 'no' to decline this license offer."
3231             echo
3232             echo $ECHO_N "Do you accept the terms of the license? $ECHO_C"
3233             read acceptance
3234         fi
3235         echo
3236         if [ "$acceptance" = "yes" ]; then
3237             break
3238         elif [ "$acceptance" = "no" ] ;then
3239             echo "You are not licensed to use this software."
3240             echo
3241             exit 0
3242         elif [ "$acceptance" = "?" ]; then
3243             more "$relpath/LICENSE.PREVIEW.COMMERCIAL"
3244         fi
3245     done
3246 elif [ "$Edition" != "OpenSource" ]; then
3247     if [ -n "$ExpiryDate" ]; then
3248         ExpiryDate=`echo $ExpiryDate | sed -e "s,-,,g" | tr -d "\n\r"`
3249         [ -z "$ExpiryDate" ] && ExpiryDate="0"
3250         Today=`date +%Y%m%d`
3251         if [ "$Today" -gt "$ExpiryDate" ]; then
3252             case "$LicenseType" in
3253             Commercial|Academic|Educational)
3254                 if [ "$QT_PACKAGEDATE" -gt "$ExpiryDate" ]; then
3255                     echo
3256                     echo "NOTICE  NOTICE  NOTICE  NOTICE"
3257                     echo
3258                     echo "  Your support and upgrade period has expired."
3259                     echo
3260                     echo "  You are no longer licensed to use this version of Qt."
3261                     echo "  Please contact qt-info@nokia.com to renew your support"
3262                     echo "  and upgrades for this license."
3263                     echo
3264                     echo "NOTICE  NOTICE  NOTICE  NOTICE"
3265                     echo
3266                     exit 1
3267                 else
3268                     echo
3269                     echo "WARNING  WARNING  WARNING  WARNING"
3270                     echo
3271                     echo "  Your support and upgrade period has expired."
3272                     echo
3273                     echo "  You may continue to use your last licensed release"
3274                     echo "  of Qt under the terms of your existing license"
3275                     echo "  agreement. But you are not entitled to technical"
3276                     echo "  support, nor are you entitled to use any more recent"
3277                     echo "  Qt releases."
3278                     echo
3279                     echo "  Please contact qt-info@nokia.com to renew your"
3280                     echo "  support and upgrades for this license."
3281                     echo
3282                     echo "WARNING  WARNING  WARNING  WARNING"
3283                     echo
3284                     sleep 3
3285                 fi
3286                 ;;
3287             Evaluation|*)
3288                 echo
3289                 echo "NOTICE  NOTICE  NOTICE  NOTICE"
3290                 echo
3291                 echo "  Your Evaluation license has expired."
3292                 echo
3293                 echo "  You are no longer licensed to use this software. Please"
3294                 echo "  contact qt-info@nokia.com to purchase license, or install"
3295                 echo "  the Qt Open Source Edition if you intend to develop free"
3296                 echo "  software."
3297                 echo
3298                 echo "NOTICE  NOTICE  NOTICE  NOTICE"
3299                 echo
3300                 exit 1
3301                 ;;
3302             esac
3303         fi
3304     fi
3305     TheLicense=`head -n 1 "$outpath/LICENSE"`
3306     while true; do
3307         if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
3308             echo "You have already accepted the terms of the $TheLicense."
3309             acceptance=yes
3310         else
3311             echo "You are licensed to use this software under the terms of"
3312             echo "the $TheLicense."
3313             echo
3314             echo "Type '?' to view the $TheLicense."
3315             echo "Type 'yes' to accept this license offer."
3316             echo "Type 'no' to decline this license offer."
3317             echo
3318             echo $ECHO_N "Do you accept the terms of the $TheLicense? $ECHO_C"
3319             read acceptance
3320         fi
3321         echo
3322         if [ "$acceptance" = "yes" ]; then
3323             break
3324         elif [ "$acceptance" = "no" ]; then
3325             echo "You are not licensed to use this software."
3326             echo
3327             exit 1
3328         else [ "$acceptance" = "?" ]
3329             more "$outpath/LICENSE"
3330         fi
3331     done
3332 fi
3333
3334 # this should be moved somewhere else
3335 case "$PLATFORM" in
3336 aix-*)
3337     AIX_VERSION=`uname -v`
3338     if [ "$AIX_VERSION" -lt "5" ]; then
3339         QMakeVar add QMAKE_LIBS_X11 -lbind
3340     fi
3341     ;;
3342 *)
3343     ;;
3344 esac
3345
3346 #-------------------------------------------------------------------------------
3347 # generate qconfig.cpp
3348 #-------------------------------------------------------------------------------
3349 [ -d "$outpath/src/corelib/global" ] || mkdir -p "$outpath/src/corelib/global"
3350
3351 cat > "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
3352 /* License Info */
3353 static const char qt_configure_licensee_str          [256 + 12] = "qt_lcnsuser=$Licensee";
3354 static const char qt_configure_licensed_products_str [256 + 12] = "qt_lcnsprod=$Edition";
3355
3356 /* Installation date */
3357 static const char qt_configure_installation          [12+11]    = "qt_instdate=`date +%Y-%m-%d`";
3358
3359 /* Installation Info */
3360 static const char qt_configure_prefix_path_strs[][256 + 12] = {
3361     "qt_prfxpath=$QT_INSTALL_PREFIX",
3362     "qt_docspath=$QT_INSTALL_DOCS",
3363     "qt_hdrspath=$QT_INSTALL_HEADERS",
3364     "qt_libspath=$QT_INSTALL_LIBS",
3365     "qt_binspath=$QT_INSTALL_BINS",
3366     "qt_plugpath=$QT_INSTALL_PLUGINS",
3367     "qt_impspath=$QT_INSTALL_IMPORTS",
3368     "qt_datapath=$QT_INSTALL_DATA",
3369     "qt_trnspath=$QT_INSTALL_TRANSLATIONS",
3370     "qt_xmplpath=$QT_INSTALL_EXAMPLES",
3371     "qt_tstspath=$QT_INSTALL_TESTS",
3372 #ifdef QT_BUILD_QMAKE
3373     "qt_ssrtpath=$CFG_SYSROOT",
3374     "qt_hpfxpath=$QT_HOST_PREFIX",
3375     "qt_hbinpath=$QT_HOST_BINS",
3376     "qt_hdatpath=$QT_HOST_DATA",
3377 #endif
3378 };
3379 static const char qt_configure_settings_path_str[256 + 12] = "qt_stngpath=$QT_INSTALL_SETTINGS";
3380 EOF
3381
3382 cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
3383
3384 /* strlen( "qt_lcnsxxxx" ) == 12 */
3385 #define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;
3386 #define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;
3387
3388 #define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;
3389 EOF
3390
3391 # avoid unecessary rebuilds by copying only if qconfig.cpp has changed
3392 if cmp -s "$outpath/src/corelib/global/qconfig.cpp" "$outpath/src/corelib/global/qconfig.cpp.new"; then
3393     rm -f "$outpath/src/corelib/global/qconfig.cpp.new"
3394 else
3395     [ -f "$outpath/src/corelib/global/qconfig.cpp" ] && chmod +w "$outpath/src/corelib/global/qconfig.cpp"
3396     mv "$outpath/src/corelib/global/qconfig.cpp.new" "$outpath/src/corelib/global/qconfig.cpp"
3397     chmod -w "$outpath/src/corelib/global/qconfig.cpp"
3398 fi
3399
3400 # -----------------------------------------------------------------------------
3401 if [ "$LicenseType" = "Evaluation" ]; then
3402     EVALKEY=qt_qevalkey=$LicenseKeyExt
3403 elif echo "$D_FLAGS" | grep QT_EVAL >/dev/null 2>&1; then
3404     EVALKEY=qt_qevalkey=
3405 fi
3406
3407 if [ -n "$EVALKEY" ]; then
3408     rm -f "$outpath/src/corelib/global/qconfig_eval.cpp"
3409     cat > "$outpath/src/corelib/global/qconfig_eval.cpp" <<EOF
3410 /* Evaluation license key */
3411 static const volatile char qt_eval_key_data                   [512 + 12] = "$EVALKEY";
3412 EOF
3413     chmod -w "$outpath/src/corelib/global/qconfig_eval.cpp"
3414 fi
3415
3416
3417 # -----------------------------------------------------------------------------
3418 # build qmake
3419 # -----------------------------------------------------------------------------
3420
3421 # symlink includes
3422 if [ -n "$PERL" ] && [ -x "$relpath/bin/syncqt" ]; then
3423     SYNCQT_OPTS=
3424     [ "$CFG_DEV" = "yes" ] && SYNCQT_OPTS="$SYNCQT_OPTS -check-includes"
3425     if [ "$OPT_SHADOW" = "yes" ]; then
3426         "$outpath/bin/syncqt" $SYNCQT_OPTS "$relpath" || exit 1
3427     elif [ "$CFG_DEV" = "yes" ] || [ ! -d $relpath/include ] || [ -d $relpath/.git ]; then
3428         QTDIR="$relpath" perl "$outpath/bin/syncqt" $SYNCQT_OPTS || exit 1
3429     fi
3430 fi
3431
3432 # $1: input variable name (awk regexp)
3433 # $2: optional output variable name
3434 # $3: optional value transformation (sed command)
3435 # relies on $QMAKESPEC, $COMPILER_CONF and $mkfile being set correctly, as the latter
3436 # is where the resulting variable is written to
3437 setBootstrapVariable()
3438 {
3439     getQMakeConf "$1" | echo ${2-$1} = `if [ -n "$3" ]; then sed "$3"; else cat; fi` >> "$mkfile"
3440 }
3441
3442 # build qmake
3443 if true; then ###[ '!' -f "$outpath/bin/qmake" ];
3444     echo "Creating qmake. Please wait..."
3445
3446     OLD_QCONFIG_H=
3447     QCONFIG_H="$outpath/src/corelib/global/qconfig.h"
3448     QMAKE_QCONFIG_H="${QCONFIG_H}.qmake"
3449     if [ -f "$QCONFIG_H" ]; then
3450          OLD_QCONFIG_H=$QCONFIG_H
3451          mv -f "$OLD_QCONFIG_H" "${OLD_QCONFIG_H}.old"
3452     fi
3453
3454     # create temporary qconfig.h for compiling qmake, if it doesn't exist
3455     # when building qmake, we use #defines for the install paths,
3456     # however they are real functions in the library
3457     if [ '!' -f "$QMAKE_QCONFIG_H" ]; then
3458         mkdir -p "$outpath/src/corelib/global"
3459         [ -f "$QCONFIG_H" ] && chmod +w "$QCONFIG_H"
3460         echo "/* All features enabled while building qmake */" >"$QMAKE_QCONFIG_H"
3461     fi
3462
3463     mv -f "$QMAKE_QCONFIG_H" "$QCONFIG_H"
3464
3465     #mkspecs/default is used as a (gasp!) default mkspec so QMAKESPEC needn't be set once configured
3466     rm -rf mkspecs/default
3467     ln -s `echo $XQMAKESPEC | sed "s,^${relpath}/mkspecs/,,"` mkspecs/default
3468     mkdir -p "$outpath/qmake" || exit
3469     # fix makefiles
3470     for mkfile in GNUmakefile Makefile; do
3471         EXTRA_LFLAGS=
3472         EXTRA_CFLAGS=
3473         in_mkfile="${mkfile}.in"
3474         if [ "$mkfile" = "Makefile" ]; then
3475 #           if which qmake >/dev/null 2>&1 && [ -f qmake/qmake.pro ]; then
3476 #               (cd qmake && qmake) >/dev/null 2>&1 && continue
3477 #           fi
3478             in_mkfile="${mkfile}.unix"
3479         fi
3480         in_mkfile="$relpath/qmake/$in_mkfile"
3481         mkfile="$outpath/qmake/$mkfile"
3482         if [ -f "$mkfile" ]; then
3483             [ "$CFG_DEV" = "yes" ] && "$WHICH" chflags >/dev/null 2>&1 && chflags nouchg "$mkfile"
3484             rm -f "$mkfile"
3485         fi
3486         [ -f "$in_mkfile" ] || continue
3487
3488         echo "########################################################################" > "$mkfile"
3489         echo "## This file was autogenerated by configure, all changes will be lost ##" >> "$mkfile"
3490         echo "########################################################################" >> "$mkfile"
3491         EXTRA_OBJS=
3492         EXTRA_SRCS=
3493         EXTRA_CFLAGS="\$(QMAKE_CFLAGS)"
3494         EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS)"
3495         EXTRA_LFLAGS="\$(QMAKE_LFLAGS)"
3496
3497         if [ "$PLATFORM" = "irix-cc" ] || [ "$PLATFORM" = "irix-cc-64" ]; then
3498             EXTRA_LFLAGS="$EXTRA_LFLAGS -lm"
3499         fi
3500
3501         [ "$CFG_SILENT" = "yes" ] && CC_TRANSFORM='s,^,\@,' || CC_TRANSFORM=
3502         setBootstrapVariable QMAKE_CC CC "$CC_TRANSFORM"
3503         setBootstrapVariable QMAKE_CXX CXX "$CC_TRANSFORM"
3504         setBootstrapVariable QMAKE_CFLAGS
3505         setBootstrapVariable QMAKE_CXXFLAGS
3506         setBootstrapVariable QMAKE_LFLAGS
3507
3508         if [ $QT_EDITION = "QT_EDITION_OPENSOURCE" ]; then
3509             EXTRA_CFLAGS="$EXTRA_CFLAGS -DQMAKE_OPENSOURCE_EDITION"
3510             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -DQMAKE_OPENSOURCE_EDITION"
3511         fi
3512         if [ "$CFG_RELEASE_QMAKE" = "yes" ]; then
3513             setBootstrapVariable QMAKE_CFLAGS_RELEASE
3514             setBootstrapVariable QMAKE_CXXFLAGS_RELEASE
3515             EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_RELEASE)"
3516             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_RELEASE)"
3517         elif [ "$CFG_DEBUG" = "yes" ]; then
3518             setBootstrapVariable QMAKE_CFLAGS_DEBUG
3519             setBootstrapVariable QMAKE_CXXFLAGS_DEBUG
3520             EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_DEBUG)"
3521             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_DEBUG)"
3522         fi
3523
3524         if [ -n "$RPATH_FLAGS" ] && [ -n "`getQMakeConf 'QMAKE_(LFLAGS_)?RPATH'`" ]; then
3525             setBootstrapVariable "QMAKE_(LFLAGS_)?RPATH" QMAKE_LFLAGS_RPATH
3526             for rpath in $RPATH_FLAGS; do
3527                 EXTRA_LFLAGS="\$(QMAKE_LFLAGS_RPATH)\"$rpath\" $EXTRA_LFLAGS"
3528             done
3529         fi
3530         if [ "$BUILD_ON_MAC" = "yes" ]; then
3531             echo "export MACOSX_DEPLOYMENT_TARGET = 10.6" >> "$mkfile"
3532             echo "CARBON_LFLAGS =-framework ApplicationServices" >>"$mkfile"
3533             echo "CARBON_CFLAGS =-fconstant-cfstrings" >>"$mkfile"
3534             EXTRA_LFLAGS="$EXTRA_LFLAGS \$(CARBON_LFLAGS)"
3535             EXTRA_CFLAGS="$EXTRA_CFLAGS \$(CARBON_CFLAGS)"
3536             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(CARBON_CFLAGS)"
3537             EXTRA_OBJS="qsettings_mac.o qcore_mac.o"
3538             EXTRA_SRCS="\"$relpath/src/corelib/io/qsettings_mac.cpp\" \"$relpath/src/corelib/kernel/qcore_mac.cpp\""
3539             if [ '!' -z "$CFG_SDK" ]; then
3540                 echo "SDK_LFLAGS =-Wl,-syslibroot,$CFG_SDK" >>"$mkfile"
3541                 echo "SDK_CFLAGS =-isysroot $CFG_SDK" >>"$mkfile"
3542                 EXTRA_CFLAGS="$EXTRA_CFLAGS \$(SDK_CFLAGS)"
3543                 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(SDK_CFLAGS)"
3544                 EXTRA_LFLAGS="$EXTRA_LFLAGS \$(SDK_LFLAGS)"
3545             fi
3546         fi
3547         if [ '!' -z "$D_FLAGS" ]; then
3548             for DEF in $D_FLAGS; do
3549                 EXTRA_CFLAGS="$EXTRA_CFLAGS \"-D${DEF}\""
3550             done
3551         fi
3552         QMAKE_BIN_DIR="$QT_INSTALL_BINS"
3553         [ -z "$QMAKE_BIN_DIR" ] && QMAKE_BIN_DIR="${QT_INSTALL_PREFIX}/bin"
3554         QMAKE_DATA_DIR="$QT_INSTALL_DATA"
3555         [ -z "$QMAKE_DATA_DIR" ] && QMAKE_DATA_DIR="${QT_INSTALL_PREFIX}"
3556         echo >>"$mkfile"
3557         adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'`
3558         adjoutpath=`echo "$outpath" | sed 's/ /\\\\\\\\ /g'`
3559         adjqmakespec=`echo "$QMAKESPEC" | sed 's/ /\\\\\\\\ /g'`
3560         sed -e "s,@SOURCE_PATH@,$adjrelpath,g" -e "s,@BUILD_PATH@,$adjoutpath,g" \
3561             -e "s,@QMAKE_CFLAGS@,$EXTRA_CFLAGS,g" -e "s,@QMAKE_LFLAGS@,$EXTRA_LFLAGS,g" \
3562             -e "s,@QMAKE_CXXFLAGS@,$EXTRA_CXXFLAGS,g" \
3563             -e "s,@QT_INSTALL_BINS@,\$(INSTALL_ROOT)$QMAKE_BIN_DIR,g" \
3564             -e "s,@QT_INSTALL_DATA@,\$(INSTALL_ROOT)$QMAKE_DATA_DIR,g" \
3565             -e "s,@QMAKE_QTOBJS@,$EXTRA_OBJS,g" -e "s,@QMAKE_QTSRCS@,$EXTRA_SRCS,g" \
3566             -e "s,@QMAKESPEC@,$adjqmakespec,g" -e "s,@QT_VERSION@,$QT_VERSION,g" "$in_mkfile" >>"$mkfile"
3567
3568         if "$WHICH" makedepend >/dev/null 2>&1 && grep 'depend:' "$mkfile" >/dev/null 2>&1; then
3569             (cd "$outpath/qmake" && "$MAKE" -f "$mkfile" depend) >/dev/null 2>&1
3570             sed "s,^.*/\([^/]*.o\):,\1:,g" "$mkfile" >"$mkfile.tmp"
3571             sed "s,$outpath,$adjoutpath,g" "$mkfile.tmp" >"$mkfile"
3572             rm "$mkfile.tmp"
3573         fi
3574     done
3575
3576     QMAKE_BUILD_ERROR=no
3577     (cd "$outpath/qmake"; "$MAKE") || QMAKE_BUILD_ERROR=yes
3578     [ '!' -z "$QCONFIG_H" ] && mv -f "$QCONFIG_H" "$QMAKE_QCONFIG_H" #move qmake's qconfig.h to qconfig.h.qmake
3579     [ '!' -z "$OLD_QCONFIG_H" ] && mv -f "${OLD_QCONFIG_H}.old" "$OLD_QCONFIG_H" #put back qconfig.h
3580     [ "$QMAKE_BUILD_ERROR" = "yes" ] && exit 2
3581 fi # Build qmake
3582
3583 #-------------------------------------------------------------------------------
3584 # Detect pkg-config
3585 #-------------------------------------------------------------------------------
3586 if [ -z "$PKG_CONFIG" ]; then
3587     # See if PKG_CONFIG is set in the mkspec:
3588     PKG_CONFIG=`getXQMakeConf PKG_CONFIG`
3589 fi
3590 if [ -z "$PKG_CONFIG" ]; then
3591     PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null`
3592 fi
3593
3594 if [ "$CFG_PKGCONFIG" = "no" ]; then
3595     PKG_CONFIG=
3596 elif [ "$CFG_PKGCONFIG" = "force" ]; then
3597     echo >&2 ""
3598     echo >&2 "You have asked to use pkg-config. Please make sure you have"
3599     echo >&2 "a correctly setup pkg-config environment!"
3600     echo >&2 ""
3601 elif [ -n "$PKG_CONFIG" ]; then
3602     # found a pkg-config
3603     if [ "$QT_CROSS_COMPILE" = "yes" ]; then
3604         # when xcompiling, check environment to see if it's actually usable
3605         if [ -z "$PKG_CONFIG_LIBDIR" ]; then
3606             if [ -n "$CFG_SYSROOT" ] && [ -d "$CFG_SYSROOT/usr/lib/pkgconfig" ]; then
3607                 PKG_CONFIG_LIBDIR=$CFG_SYSROOT/usr/lib/pkgconfig:$CFG_SYSROOT/usr/share/pkgconfig
3608                 export PKG_CONFIG_LIBDIR
3609                 echo >&2 "Note: PKG_CONFIG_LIBDIR automatically set to $PKG_CONFIG_LIBDIR"
3610             elif [ "$CFG_PKGCONFIG" = "yes" ]; then
3611                 echo >&2 "Error: PKG_CONFIG_LIBDIR has not been set. This could mean"
3612                 echo >&2 "the host's .pc files will be used (even if you set PKG_CONFIG_PATH)."
3613                 echo >&2 "Set this variable to the directory that contains target .pc files"
3614                 echo >&2 "for pkg-config to function correctly when cross-compiling or"
3615                 echo >&2 "use -force-pkg-config to override this test."
3616                 exit 101
3617             else
3618                 PKG_CONFIG=
3619                 echo >&2 "Warning: Disabling pkg-config since PKG_CONFIG_LIBDIR is not set."
3620             fi
3621         fi
3622         if [ -z "$PKG_CONFIG_SYSROOT_DIR" ]; then
3623             if [ -n "$CFG_SYSROOT" ]; then
3624                 PKG_CONFIG_SYSROOT_DIR=$CFG_SYSROOT
3625                 export PKG_CONFIG_SYSROOT_DIR
3626                 echo >&2 "Note: PKG_CONFIG_SYSROOT_DIR automatically set to $PKG_CONFIG_SYSROOT_DIR"
3627             elif [ "$CFG_PKGCONFIG" = "yes" ]; then
3628                 echo >&2 "Error: PKG_CONFIG_SYSROOT_DIR has not been set. Set this variable"
3629                 echo >&2 "to your sysroot for pkg-config to function correctly when cross-compiling"
3630                 echo >&2 "or use -force-pkg-config to override this test."
3631                 exit 101
3632             else
3633                 PKG_CONFIG=
3634                 echo >&2 "Warning: Disabling pkg-config since PKG_CONFIG_SYSROOT_DIR is not set."
3635             fi
3636         fi
3637     fi
3638 elif [ "$CFG_PKGCONFIG" = "yes" ]; then
3639     echo >&2 "Could not detect pkg-config from mkspec or PATH."
3640     exit 101
3641 fi
3642
3643 if [ -z "$PKG_CONFIG" ]; then
3644     QT_CONFIG="$QT_CONFIG no-pkg-config"
3645 fi
3646
3647 #-------------------------------------------------------------------------------
3648 # write out device config before we run the test.
3649 #-------------------------------------------------------------------------------
3650 if cmp -s "$DEVICE_VARS_FILE" "$outpath/mkspecs/qdevice.pri"; then
3651     rm -f "$DEVICE_VARS_FILE"
3652 else
3653     mv -f $DEVICE_VARS_FILE "$outpath/mkspecs/qdevice.pri"
3654 fi
3655
3656 #-------------------------------------------------------------------------------
3657 # tests that need qmake
3658 #-------------------------------------------------------------------------------
3659
3660 #-------------------------------------------------------------------------------
3661 # determine the target and host architectures
3662 #-------------------------------------------------------------------------------
3663
3664 # Use config.tests/arch/arch.pro to has the compiler tell us what the target architecture is
3665 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'`
3666
3667 [ -z "$CFG_ARCH" ] && CFG_ARCH="unknown"
3668 if [ "$QMAKESPEC" != "$XQMAKESPEC" ]; then
3669     # Do the same test again, using the host compiler
3670     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'`
3671     [ -z "$CFG_HOST_ARCH" ] && CFG_HOST_ARCH="unknown"
3672 else
3673     # not cross compiling, host == target
3674     CFG_HOST_ARCH="$CFG_ARCH"
3675 fi
3676
3677 if [ "$OPT_VERBOSE" = "yes" ]; then
3678     echo "System architecture: '$CFG_ARCH'"
3679     echo "Host architecture: '$CFG_HOST_ARCH'"
3680 fi
3681
3682 #-------------------------------------------------------------------------------
3683 # functionality tests
3684 #-------------------------------------------------------------------------------
3685
3686 # detect availability of float math.h functions
3687 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/floatmath "floatmath" $L_FLAGS $I_FLAGS $l_FLAGS; then
3688     CFG_USE_FLOATMATH=yes
3689 else
3690     CFG_USE_FLOATMATH=no
3691 fi
3692
3693 # detect sse2 support
3694 if [ "${CFG_SSE2}" = "auto" ]; then
3695     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse2 "sse2" $L_FLAGS $I_FLAGS $l_FLAGS "-msse2"; then
3696        CFG_SSE2=yes
3697     else
3698        CFG_SSE2=no
3699     fi
3700 fi
3701
3702 # detect sse3 support
3703 if [ "${CFG_SSE3}" = "auto" ]; then
3704     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse3 "sse3" $L_FLAGS $I_FLAGS $l_FLAGS "-msse3"; then
3705        CFG_SSE3=yes
3706     else
3707        CFG_SSE3=no
3708     fi
3709 fi
3710
3711 # detect ssse3 support
3712 if [ "${CFG_SSSE3}" = "auto" ]; then
3713     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ssse3 "ssse3" $L_FLAGS $I_FLAGS $l_FLAGS "-mssse3"; then
3714        CFG_SSSE3=yes
3715     else
3716        CFG_SSSE3=no
3717     fi
3718 fi
3719
3720 # detect sse4.1 support
3721 if [ "${CFG_SSE4_1}" = "auto" ]; then
3722     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
3723        CFG_SSE4_1=yes
3724     else
3725        CFG_SSE4_1=no
3726     fi
3727 fi
3728
3729 # detect sse4.2 support
3730 if [ "${CFG_SSE4_2}" = "auto" ]; then
3731     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
3732        CFG_SSE4_2=yes
3733     else
3734        CFG_SSE4_2=no
3735     fi
3736 fi
3737
3738 # detect avx support
3739 if [ "${CFG_AVX}" = "auto" ]; then
3740     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/avx "avx" $L_FLAGS $I_FLAGS $l_FLAGS "-mavx"; then
3741        case "$XQMAKESPEC" in
3742            *g++*|*-clang*)
3743                # Some clang versions produce internal compiler errors compiling Qt AVX code
3744                case `$TEST_COMPILER --version` in
3745                    Apple\ clang\ version\ 2*|Apple\ clang\ version\ 3.0*)
3746                        CFG_AVX=no
3747                        if [ "$OPT_VERBOSE" = "yes" ]; then
3748                            echo 'AVX support disabled for blacklisted clang compiler'
3749                        fi
3750                        ;;
3751                    *)
3752                        CFG_AVX=yes
3753                        ;;
3754                esac
3755                ;;
3756            *)
3757                CFG_AVX=yes
3758                ;;
3759        esac
3760     else
3761        CFG_AVX=no
3762     fi
3763 fi
3764
3765 # detect avx2 support
3766 if [ "${CFG_AVX}" = "no" ]; then
3767     CFG_AVX2=no
3768 fi
3769 if [ "${CFG_AVX2}" = "auto" ]; then
3770     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
3771        CFG_AVX2=yes
3772     else
3773        CFG_AVX2=no
3774     fi
3775 fi
3776
3777 # check iWMMXt support
3778 if [ "$CFG_IWMMXT" = "yes" ]; then
3779     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iwmmxt "iwmmxt" $L_FLAGS $I_FLAGS $l_FLAGS "-mcpu=iwmmxt"
3780     if [ $? != "0" ]; then
3781         echo "The iWMMXt functionality test failed!"
3782         echo " Please make sure your compiler supports iWMMXt intrinsics!"
3783         exit 1
3784     fi
3785 fi
3786
3787 # detect neon support
3788 if [ "$CFG_ARCH" = "arm" ] && [ "${CFG_NEON}" = "auto" ]; then
3789     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
3790         CFG_NEON=yes
3791     else
3792         CFG_NEON=no
3793     fi
3794 elif [ "$CFG_ARCH" != "arm" ]; then
3795     CFG_NEON=no
3796 fi
3797
3798 # detect mips_dsp support
3799 if [ "${CFG_ARCH}" = "mips" ] && [ "${CFG_MIPS_DSP}" = "yes" ]; then
3800   CFG_MIPS_DSP=yes
3801     else
3802   CFG_MIPS_DSP=no
3803 fi
3804
3805 # detect mips_dspr2 support
3806 if [ "${CFG_ARCH}" = "mips" ] && [ "${CFG_MIPS_DSPR2}" = "yes" ]; then
3807   CFG_MIPS_DSPR2=yes
3808     else
3809   CFG_MIPS_DSPR2=no
3810 fi
3811
3812 [ "$XPLATFORM_MINGW" = "yes" ] && QMakeVar add styles "windowsxp windowsvista"
3813
3814 # detect zlib
3815 if [ "$CFG_ZLIB" = "no" ]; then
3816     # Note: Qt no longer support builds without zlib
3817     # So we force a "no" to be "auto" here.
3818     # If you REALLY really need no zlib support, you can still disable
3819     # it by doing the following:
3820     #   add "no-zlib" to mkspecs/qconfig.pri
3821     #   #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h)
3822     #
3823     # There's no guarantee that Qt will build under those conditions
3824
3825     CFG_ZLIB=auto
3826     ZLIB_FORCED=yes
3827 fi
3828 if [ "$CFG_ZLIB" = "auto" ]; then
3829     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
3830        CFG_ZLIB=system
3831     else
3832        CFG_ZLIB=yes
3833     fi
3834 fi
3835
3836 if [ "$CFG_LARGEFILE" = "auto" ]; then
3837     #Large files should be enabled for all Linux systems
3838     CFG_LARGEFILE=yes
3839 fi
3840
3841 if [ "$CFG_GUI" = "no" ]; then
3842     QPA_PLATFORM_GUARD=no
3843 fi
3844
3845 # detect how jpeg should be built
3846 if [ "$CFG_JPEG" = "auto" ]; then
3847     if [ "$CFG_SHARED" = "yes" ]; then
3848         CFG_JPEG=plugin
3849     else
3850         CFG_JPEG=yes
3851     fi
3852 fi
3853 # detect jpeg
3854 if [ "$CFG_LIBJPEG" = "auto" ]; then
3855     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
3856        CFG_LIBJPEG=system
3857     else
3858        CFG_LIBJPEG=qt
3859     fi
3860 fi
3861
3862 # detect how gif should be built
3863 if [ "$CFG_GIF" = "auto" ]; then
3864     if [ "$CFG_SHARED" = "yes" ]; then
3865         CFG_GIF=plugin
3866     else
3867         CFG_GIF=yes
3868     fi
3869 fi
3870
3871 # detect png
3872 if [ "$CFG_LIBPNG" = "auto" ]; then
3873     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
3874        CFG_LIBPNG=system
3875     else
3876        CFG_LIBPNG=qt
3877     fi
3878 fi
3879
3880 # detect accessibility
3881 if [ "$CFG_ACCESSIBILITY" = "auto" ]; then
3882     CFG_ACCESSIBILITY=yes
3883 fi
3884
3885 if [ "$CFG_EGLFS" = "yes" ]; then
3886     if [ "$CFG_EGL" = "no" ]; then
3887         echo "The EGLFS plugin requires EGL support and cannot be built"
3888         exit 101
3889     fi
3890     if [ "$CFG_OPENGL" != "es2" ]; then
3891         echo "The EGLFS plugin requires OpenGL ES 2 support and cannot be built"
3892         exit 101
3893     fi
3894     CFG_OPENGL="es2"
3895     CFG_EGL=yes
3896 fi
3897
3898 # auto-detect SQL-modules support
3899 for _SQLDR in $CFG_SQL_AVAILABLE; do
3900         case $_SQLDR in
3901         mysql)
3902             if [ "$CFG_SQL_mysql" != "no" ]; then
3903                 [ -z "$CFG_MYSQL_CONFIG" ] && CFG_MYSQL_CONFIG=`"$WHICH" mysql_config`
3904                 if [ -x "$CFG_MYSQL_CONFIG" ]; then
3905                     QT_CFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --include 2>/dev/null`
3906                     QT_LFLAGS_MYSQL_R=`$CFG_MYSQL_CONFIG --libs_r 2>/dev/null`
3907                     QT_LFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --libs 2>/dev/null`
3908                     QT_MYSQL_VERSION=`$CFG_MYSQL_CONFIG --version 2>/dev/null`
3909                     QT_MYSQL_VERSION_MAJOR=`echo $QT_MYSQL_VERSION | cut -d . -f 1`
3910                 fi
3911                 if [ -n "$QT_MYSQL_VERSION" ] && [ "$QT_MYSQL_VERSION_MAJOR" -lt 4 ]; then
3912                     if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
3913                         echo "This version of MySql is not supported ($QT_MYSQL_VERSION)."
3914                         echo " You need MySql 4 or higher."
3915                         echo " If you believe this message is in error you may use the continue"
3916                         echo " switch (-continue) to $0 to continue."
3917                         exit 101
3918                     else
3919                         CFG_SQL_mysql="no"
3920                         QT_LFLAGS_MYSQL=""
3921                         QT_LFLAGS_MYSQL_R=""
3922                         QT_CFLAGS_MYSQL=""
3923                     fi
3924                 else
3925                     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
3926                         QMakeVar add CONFIG use_libmysqlclient_r
3927                         if [ "$CFG_SQL_mysql" = "auto" ]; then
3928                             CFG_SQL_mysql=plugin
3929                         fi
3930                         QT_LFLAGS_MYSQL="$QT_LFLAGS_MYSQL_R"
3931                     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
3932                         if [ "$CFG_SQL_mysql" = "auto" ]; then
3933                             CFG_SQL_mysql=plugin
3934                         fi
3935                     else
3936                         if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
3937                             echo "MySQL support cannot be enabled due to functionality tests!"
3938                             echo " Turn on verbose messaging (-v) to $0 to see the final report."
3939                             echo " If you believe this message is in error you may use the continue"
3940                             echo " switch (-continue) to $0 to continue."
3941                             exit 101
3942                         else
3943                             CFG_SQL_mysql=no
3944                             QT_LFLAGS_MYSQL=""
3945                             QT_LFLAGS_MYSQL_R=""
3946                             QT_CFLAGS_MYSQL=""
3947                         fi
3948                     fi
3949                 fi
3950             fi
3951             ;;
3952         psql)
3953             if [ "$CFG_SQL_psql" != "no" ]; then
3954                 # Be careful not to use native pg_config when cross building.
3955                 if [ "$XPLATFORM_MINGW" != "yes" ] && "$WHICH" pg_config >/dev/null 2>&1; then
3956                     QT_CFLAGS_PSQL=`pg_config --includedir 2>/dev/null`
3957                     QT_LFLAGS_PSQL=`pg_config --libdir 2>/dev/null`
3958                 fi
3959                 [ -z "$QT_CFLAGS_PSQL" ] || QT_CFLAGS_PSQL="-I$QT_CFLAGS_PSQL"
3960                 [ -z "$QT_LFLAGS_PSQL" ] || QT_LFLAGS_PSQL="-L$QT_LFLAGS_PSQL"
3961                 # But, respect PSQL_LIBS if set
3962                 [ -z "$PSQL_LIBS" ] || QT_LFLAGS_PSQL="$PSQL_LIBS"
3963                 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
3964                     if [ "$CFG_SQL_psql" = "auto" ]; then
3965                         CFG_SQL_psql=plugin
3966                     fi
3967                 else
3968                     if [ "$CFG_SQL_psql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
3969                         echo "PostgreSQL support cannot be enabled due to functionality tests!"
3970                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
3971                         echo " If you believe this message is in error you may use the continue"
3972                         echo " switch (-continue) to $0 to continue."
3973                         exit 101
3974                     else
3975                         CFG_SQL_psql=no
3976                         QT_CFLAGS_PSQL=""
3977                         QT_LFLAGS_PSQL=""
3978                     fi
3979                 fi
3980             fi
3981         ;;
3982         odbc)
3983             if [ "$CFG_SQL_odbc" != "no" ]; then
3984                 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
3985                     if [ "$CFG_SQL_odbc" = "auto" ]; then
3986                         CFG_SQL_odbc=plugin
3987                     fi
3988                 else
3989                     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
3990                         QT_LFLAGS_ODBC="-liodbc"
3991                         if [ "$CFG_SQL_odbc" = "auto" ]; then
3992                             CFG_SQL_odbc=plugin
3993                         fi
3994                     else
3995                         if [ "$CFG_SQL_odbc" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
3996                             echo "ODBC support cannot be enabled due to functionality tests!"
3997                             echo " Turn on verbose messaging (-v) to $0 to see the final report."
3998                             echo " If you believe this message is in error you may use the continue"
3999                             echo " switch (-continue) to $0 to continue."
4000                             exit 101
4001                         else
4002                             CFG_SQL_odbc=no
4003                         fi
4004                     fi
4005                 fi
4006             fi
4007             ;;
4008         oci)
4009             if [ "$CFG_SQL_oci" != "no" ]; then
4010                 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
4011                     if [ "$CFG_SQL_oci" = "auto" ]; then
4012                         CFG_SQL_oci=plugin
4013                     fi
4014                 else
4015                     if [ "$CFG_SQL_oci" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4016                         echo "Oracle (OCI) support cannot be enabled due to functionality tests!"
4017                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4018                         echo " If you believe this message is in error you may use the continue"
4019                         echo " switch (-continue) to $0 to continue."
4020                         exit 101
4021                     else
4022                         CFG_SQL_oci=no
4023                     fi
4024                 fi
4025             fi
4026             ;;
4027         tds)
4028             if [ "$CFG_SQL_tds" != "no" ]; then
4029                 [ -z "$SYBASE" ] || QT_LFLAGS_TDS="-L$SYBASE/lib"
4030                 [ -z "$SYBASE_LIBS" ] || QT_LFLAGS_TDS="$QT_LFLAGS_TDS $SYBASE_LIBS"
4031                 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
4032                     if [ "$CFG_SQL_tds" = "auto" ]; then
4033                         CFG_SQL_tds=plugin
4034                     fi
4035                 else
4036                     if [ "$CFG_SQL_tds" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4037                         echo "TDS support cannot be enabled due to functionality tests!"
4038                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4039                         echo " If you believe this message is in error you may use the continue"
4040                         echo " switch (-continue) to $0 to continue."
4041                         exit 101
4042                     else
4043                         CFG_SQL_tds=no
4044                     fi
4045                 fi
4046             fi
4047             ;;
4048         db2)
4049             if [ "$CFG_SQL_db2" != "no" ]; then
4050                 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
4051                     if [ "$CFG_SQL_db2" = "auto" ]; then
4052                         CFG_SQL_db2=plugin
4053                     fi
4054                 else
4055                     if [ "$CFG_SQL_db2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4056                         echo "ODBC support cannot be enabled due to functionality tests!"
4057                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4058                         echo " If you believe this message is in error you may use the continue"
4059                         echo " switch (-continue) to $0 to continue."
4060                         exit 101
4061                     else
4062                         CFG_SQL_db2=no
4063                     fi
4064                 fi
4065             fi
4066             ;;
4067         ibase)
4068             if [ "$CFG_SQL_ibase" != "no" ]; then
4069                 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
4070                     if [ "$CFG_SQL_ibase" = "auto" ]; then
4071                         CFG_SQL_ibase=plugin
4072                     fi
4073                 else
4074                     if [ "$CFG_SQL_ibase" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4075                         echo "InterBase support cannot be enabled due to functionality tests!"
4076                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4077                         echo " If you believe this message is in error you may use the continue"
4078                         echo " switch (-continue) to $0 to continue."
4079                         exit 101
4080                     else
4081                         CFG_SQL_ibase=no
4082                     fi
4083                 fi
4084             fi
4085             ;;
4086         sqlite2)
4087             if [ "$CFG_SQL_sqlite2" != "no" ]; then
4088                 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
4089                     if [ "$CFG_SQL_sqlite2" = "auto" ]; then
4090                         CFG_SQL_sqlite2=plugin
4091                     fi
4092                 else
4093                     if [ "$CFG_SQL_sqlite2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4094                         echo "SQLite2 support cannot be enabled due to functionality tests!"
4095                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4096                         echo " If you believe this message is in error you may use the continue"
4097                         echo " switch (-continue) to $0 to continue."
4098                         exit 101
4099                     else
4100                         CFG_SQL_sqlite2=no
4101                     fi
4102                 fi
4103             fi
4104             ;;
4105         sqlite)
4106             if [ "$CFG_SQL_sqlite" != "no" ]; then
4107                 SQLITE_AUTODETECT_FAILED="no"
4108                 if [ "$CFG_SQLITE" = "system" ]; then
4109                     if [ -n "$PKG_CONFIG" ]; then
4110                         QT_CFLAGS_SQLITE=`$PKG_CONFIG --cflags sqlite3 2>/dev/null`
4111                         QT_LFLAGS_SQLITE=`$PKG_CONFIG --libs sqlite3 2>/dev/null`
4112                     fi
4113                     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
4114                         if [ "$CFG_SQL_sqlite" = "auto" ]; then
4115                             CFG_SQL_sqlite=plugin
4116                         fi
4117                         QMAKE_CONFIG="$QMAKE_CONFIG system-sqlite"
4118                     else
4119                         SQLITE_AUTODETECT_FAILED="yes"
4120                         CFG_SQL_sqlite=no
4121                     fi
4122                 elif [ -f "$relpath/src/3rdparty/sqlite/sqlite3.h" ]; then
4123                     if [ "$CFG_SQL_sqlite" = "auto" ]; then
4124                             CFG_SQL_sqlite=plugin
4125                     fi
4126                 else
4127                     SQLITE_AUTODETECT_FAILED="yes"
4128                     CFG_SQL_sqlite=no
4129                 fi
4130
4131                 if [ "$SQLITE_AUTODETECT_FAILED" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4132                     echo "SQLite support cannot be enabled due to functionality tests!"
4133                     echo " Turn on verbose messaging (-v) to $0 to see the final report."
4134                     echo " If you believe this message is in error you may use the continue"
4135                     echo " switch (-continue) to $0 to continue."
4136                     exit 101
4137                 fi
4138             fi
4139             ;;
4140         *)
4141             if [ "$OPT_VERBOSE" = "yes" ]; then
4142                 echo "unknown SQL driver: $_SQLDR"
4143             fi
4144             ;;
4145         esac
4146 done
4147
4148 # auto-detect NIS support
4149 if [ "$CFG_NIS" != "no" ]; then
4150     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
4151         CFG_NIS=yes
4152     else
4153         if [ "$CFG_NIS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4154             echo "NIS support cannot be enabled due to functionality tests!"
4155             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4156             echo " If you believe this message is in error you may use the continue"
4157             echo " switch (-continue) to $0 to continue."
4158             exit 101
4159         else
4160             CFG_NIS=no
4161         fi
4162     fi
4163 fi
4164
4165 # auto-detect CUPS support
4166 if [ "$CFG_CUPS" != "no" ]; then
4167     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
4168         CFG_CUPS=yes
4169     else
4170         if [ "$CFG_CUPS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4171             echo "Cups support cannot be enabled due to functionality tests!"
4172             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4173             echo " If you believe this message is in error you may use the continue"
4174             echo " switch (-continue) to $0 to continue."
4175             exit 101
4176         else
4177             CFG_CUPS=no
4178         fi
4179     fi
4180 fi
4181
4182 # auto-detect iconv(3) support
4183 if [ "$CFG_ICONV" != "no" ]; then
4184     if [ "$XPLATFORM_MINGW" = "yes" ]; then
4185         CFG_ICONV=no
4186     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
4187         CFG_ICONV=yes
4188     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
4189         CFG_ICONV=sun
4190     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
4191         CFG_ICONV=gnu
4192     else
4193         if [ "$CFG_ICONV" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4194             echo "Iconv support cannot be enabled due to functionality tests!"
4195             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4196             echo " If you believe this message is in error you may use the continue"
4197             echo " switch (-continue) to $0 to continue."
4198             exit 101
4199         else
4200             CFG_ICONV=no
4201         fi
4202     fi
4203 fi
4204
4205 # auto-detect libdbus-1 support
4206 if [ "$CFG_DBUS" != "no" ]; then
4207     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then
4208         QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null`
4209         QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null`
4210     fi
4211     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
4212         [ "$CFG_DBUS" = "auto" ] && CFG_DBUS=yes
4213         QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
4214         QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS"
4215     else
4216         if [ "$CFG_DBUS" = "auto" ]; then
4217             CFG_DBUS=no
4218         elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4219             # CFG_DBUS is "yes" or "linked" here
4220
4221             echo "The QtDBus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found."
4222             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4223             echo " If you believe this message is in error you may use the continue"
4224             echo " switch (-continue) to $0 to continue."
4225             exit 101
4226         fi
4227     fi
4228 fi
4229
4230 # auto-detect Glib support
4231 if [ "$CFG_GLIB" != "no" ]; then
4232     if [ -n "$PKG_CONFIG" ]; then
4233         QT_CFLAGS_GLIB=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0 2>/dev/null`
4234         QT_LIBS_GLIB=`$PKG_CONFIG --libs glib-2.0 gthread-2.0 2>/dev/null`
4235     fi
4236     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
4237         CFG_GLIB=yes
4238         QMakeVar set QT_CFLAGS_GLIB "$QT_CFLAGS_GLIB"
4239         QMakeVar set QT_LIBS_GLIB "$QT_LIBS_GLIB"
4240     else
4241         if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4242             echo "Glib support cannot be enabled due to functionality tests!"
4243             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4244             echo " If you believe this message is in error you may use the continue"
4245             echo " switch (-continue) to $0 to continue."
4246             exit 101
4247         else
4248             CFG_GLIB=no
4249         fi
4250     fi
4251 fi
4252
4253 # auto-detect GTK style support
4254 if [ "$CFG_GLIB" = "yes" -a "$CFG_QGTKSTYLE" != "no" ]; then
4255     if [ -n "$PKG_CONFIG" ]; then
4256         QT_CFLAGS_QGTKSTYLE=`$PKG_CONFIG --cflags gtk+-2.0 ">=" 2.10 atk 2>/dev/null`
4257         QT_LIBS_QGTKSTYLE=`$PKG_CONFIG --libs gobject-2.0 2>/dev/null`
4258     fi
4259     if [ -n "$QT_CFLAGS_QGTKSTYLE" ] ; then
4260         CFG_QGTKSTYLE=yes
4261         QT_CONFIG="$QT_CONFIG gtkstyle"
4262         QMakeVar set QT_CFLAGS_QGTKSTYLE "$QT_CFLAGS_QGTKSTYLE"
4263         QMakeVar set QT_LIBS_QGTKSTYLE "$QT_LIBS_QGTKSTYLE"
4264     else
4265         if [ "$CFG_QGTKSTYLE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4266             echo "Gtk theme support cannot be enabled due to functionality tests!"
4267             echo " Turn on verbose messaging (-v) to $0 to see the fin  al report."
4268             echo " If you believe this message is in error you may use the continue"
4269             echo " switch (-continue) to $0 to continue."
4270             exit 101
4271         else
4272             CFG_QGTKSTYLE=no
4273         fi
4274     fi
4275 elif [ "$CFG_GLIB" = "no" ]; then
4276     CFG_QGTKSTYLE=no
4277 fi
4278
4279 # ### Vestige
4280 if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then
4281     if [ -n "$PKG_CONFIG" ]; then
4282         QT_CFLAGS_GSTREAMER=`$PKG_CONFIG --cflags gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
4283         QT_LIBS_GSTREAMER=`$PKG_CONFIG --libs gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
4284     fi
4285     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
4286         CFG_GSTREAMER=yes
4287         QMakeVar set QT_CFLAGS_GSTREAMER "$QT_CFLAGS_GSTREAMER"
4288         QMakeVar set QT_LIBS_GSTREAMER "$QT_LIBS_GSTREAMER"
4289     else
4290         if [ "$CFG_GSTREAMER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4291             echo "Gstreamer support cannot be enabled due to functionality tests!"
4292             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4293             echo " If you believe this message is in error you may use the continue"
4294             echo " switch (-continue) to $0 to continue."
4295             exit 101
4296         else
4297             CFG_GSTREAMER=no
4298         fi
4299     fi
4300 elif [ "$CFG_GLIB" = "no" ]; then
4301     CFG_GSTREAMER=no
4302 fi
4303
4304 # auto-detect libicu support
4305 if [ "$CFG_ICU" != "no" ]; then
4306     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/icu "ICU" $L_FLAGS $I_FLAGS $l_FLAGS; then
4307         [ "$CFG_ICU" = "auto" ] && CFG_ICU=yes
4308     else
4309         if [ "$CFG_ICU" = "auto" ]; then
4310             CFG_ICU=no
4311         elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4312             # CFG_ICU is "yes"
4313
4314             echo "The ICU library support cannot be enabled."
4315             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4316             echo " If you believe this message is in error you may use the continue"
4317             echo " switch (-continue) to $0 to continue."
4318             exit 101
4319         fi
4320     fi
4321 fi
4322
4323 # Auto-detect PulseAudio support
4324 if [ "$CFG_PULSEAUDIO" != "no" ]; then
4325     if [ -n "$PKG_CONFIG" ]; then
4326         QT_CFLAGS_PULSEAUDIO=`$PKG_CONFIG --cflags libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
4327         QT_LIBS_PULSEAUDIO=`$PKG_CONFIG --libs libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
4328     fi
4329     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
4330         CFG_PULSEAUDIO=yes
4331         QMakeVar set QT_CFLAGS_PULSEAUDIO "$QT_CFLAGS_PULSEAUDIO"
4332         QMakeVar set QT_LIBS_PULSEAUDIO "$QT_LIBS_PULSEAUDIO"
4333     else
4334         if [ "$CFG_PULSEAUDIO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4335             echo "PulseAudio support cannot be enabled due to functionality tests!"
4336             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4337             echo " If you believe this message is in error you may use the continue"
4338             echo " switch (-continue) to $0 to continue."
4339             exit 101
4340         else
4341             CFG_PULSEAUDIO=no
4342         fi
4343     fi
4344 fi
4345
4346 # X11/MINGW OpenGL
4347 if [ "$XPLATFORM_MINGW" = "yes" ]; then
4348     # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
4349     if [ "$CFG_GUI" = "no" ]; then
4350         if [ "$CFG_OPENGL" = "auto" ]; then
4351             CFG_OPENGL=no
4352         fi
4353         if [ "$CFG_OPENGL" != "no" ]; then
4354             echo "OpenGL enabled, but GUI disabled."
4355             echo " You might need to either enable the GUI or disable OpenGL"
4356             exit 1
4357         fi
4358     fi
4359     if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
4360         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS; then
4361             CFG_OPENGL=desktop
4362         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
4363             CFG_OPENGL=es2
4364         else
4365             if [ "$CFG_OPENGL" = "yes" ]; then
4366                 echo "All the OpenGL functionality tests failed!"
4367                 echo " You might need to modify the include and library search paths by editing"
4368                 echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
4369                 echo " ${XQMAKESPEC}."
4370                 exit 1
4371             fi
4372             CFG_OPENGL=no
4373         fi
4374         case "$PLATFORM" in
4375         hpux*)
4376             # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
4377             if [ "$CFG_OPENGL" = "desktop" ]; then
4378                 "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS
4379                 if [ $? != "0" ]; then
4380                     QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
4381                 fi
4382             fi
4383             ;;
4384         *)
4385             ;;
4386         esac
4387     elif [ "$CFG_OPENGL" = "es2" ]; then
4388         #OpenGL ES 2.x
4389         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS
4390         if [ $? != "0" ]; then
4391             echo "The OpenGL ES 2.0 functionality test failed!"
4392             echo " You might need to modify the include and library search paths by editing"
4393             echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
4394             echo " ${XQMAKESPEC}."
4395             exit 1
4396         fi
4397     elif [ "$CFG_OPENGL" = "desktop" ]; then
4398         # Desktop OpenGL support
4399         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS
4400         if [ $? != "0" ]; then
4401             echo "The OpenGL functionality test failed!"
4402             echo " You might need to modify the include and library search paths by editing"
4403             echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
4404             echo " ${XQMAKESPEC}."
4405             exit 1
4406         fi
4407         case "$PLATFORM" in
4408         hpux*)
4409             # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
4410             "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS
4411             if [ $? != "0" ]; then
4412                 QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
4413             fi
4414             ;;
4415         *)
4416             ;;
4417         esac
4418     fi
4419 fi # X11/MINGW OpenGL
4420
4421 if [ "$BUILD_ON_MAC" = "yes" ]; then
4422     if [ "$CFG_PHONON" != "no" ]; then
4423         # Always enable Phonon (unless it was explicitly disabled)
4424         CFG_PHONON=yes
4425     fi
4426
4427     if [ "$CFG_COREWLAN" = "auto" ]; then
4428         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
4429             CFG_COREWLAN=yes
4430         else
4431             CFG_COREWLAN=no
4432         fi
4433     fi
4434 fi
4435
4436 # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
4437 if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
4438     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengldesktop "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS; then
4439         CFG_OPENGL=desktop
4440     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
4441         CFG_OPENGL=es2
4442     else
4443         if [ "$CFG_OPENGL" = "yes" ]; then
4444             echo "All the OpenGL functionality tests failed!"
4445             echo " You might need to modify the include and library search paths by editing"
4446             echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
4447             echo " ${XQMAKESPEC}."
4448             exit 1
4449         fi
4450         CFG_OPENGL=no
4451     fi
4452 elif [ "$CFG_OPENGL" = "es2" ]; then
4453     #OpenGL ES 2.x
4454     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists glesv2 2>/dev/null; then
4455         QMAKE_INCDIR_OPENGL_ES2=`$PKG_CONFIG --cflags-only-I glesv2 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
4456         QMAKE_LIBDIR_OPENGL_ES2=`$PKG_CONFIG --libs-only-L glesv2 2>/dev/null | sed -e 's,^-L,,g' -e 's, -L, ,g'`
4457         QMAKE_LIBS_OPENGL_ES2=`$PKG_CONFIG --libs glesv2 2>/dev/null`
4458         QMAKE_CFLAGS_OPENGL_ES2=`$PKG_CONFIG --cflags glesv2 2>/dev/null`
4459         QMakeVar set QMAKE_INCDIR_OPENGL_ES2 "$QMAKE_INCDIR_OPENGL_ES2"
4460         QMakeVar set QMAKE_LIBDIR_OPENGL_ES2 "$QMAKE_LIBDIR_OPENGL_ES2"
4461         QMakeVar set QMAKE_LIBS_OPENGL_ES2 "$QMAKE_LIBS_OPENGL_ES2"
4462     fi
4463
4464     "$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
4465     if [ $? != "0" ]; then
4466         echo "The OpenGL ES 2.0 functionality test failed!"
4467         echo " You might need to modify the include and library search paths by editing"
4468         echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
4469         echo " ${XQMAKESPEC}."
4470         exit 1
4471     fi
4472 elif [ "$CFG_OPENGL" = "desktop" ]; then
4473     # Desktop OpenGL support
4474     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengldesktop "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS
4475     if [ $? != "0" ]; then
4476         echo "The OpenGL functionality test failed!"
4477         echo " You might need to modify the include and library search paths by editing"
4478         echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
4479         echo " ${XQMAKESPEC}."
4480         exit 1
4481     fi
4482 fi
4483
4484 # auto-detect FontConfig support
4485 if [ "$CFG_FONTCONFIG" != "no" ]; then
4486     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
4487         QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
4488         QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null`
4489     else
4490         QT_CFLAGS_FONTCONFIG=
4491         QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig"
4492     fi
4493     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
4494         QT_CONFIG="$QT_CONFIG fontconfig"
4495         QMakeVar set QMAKE_CFLAGS_FONTCONFIG "$QT_CFLAGS_FONTCONFIG"
4496         QMakeVar set QMAKE_LIBS_FONTCONFIG "$QT_LIBS_FONTCONFIG"
4497         CFG_LIBFREETYPE=system
4498     fi
4499
4500 fi
4501
4502 # Save these for a check later
4503 ORIG_CFG_XCB="$CFG_XCB"
4504 ORIG_CFG_EGLFS="$CFG_EGLFS"
4505 ORIG_CFG_DIRECTFB="$CFG_DIRECTFB"
4506
4507 if [ "$CFG_LIBUDEV" != "no" ]; then
4508     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists libudev 2>/dev/null; then
4509         QMAKE_INCDIR_LIBUDEV=`$PKG_CONFIG --cflags-only-I libudev 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
4510         QMAKE_LIBS_LIBUDEV=`$PKG_CONFIG --libs libudev 2>/dev/null`
4511         QMakeVar set QMAKE_INCDIR_LIBUDEV "$QMAKE_INCDIR_LIBUDEV"
4512         QMakeVar set QMAKE_LIBS_LIBUDEV "$QMAKE_LIBS_LIBUDEV"
4513     fi
4514     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
4515         CFG_LIBUDEV=yes
4516         QT_CONFIG="$QT_CONFIG libudev"
4517     elif [ "$CFG_LIBUDEV" = "yes" ]; then
4518         echo "The libudev functionality test failed!"
4519         exit 1
4520     else
4521         CFG_LIBUDEV=no
4522         QMakeVar add DEFINES QT_NO_LIBUDEV
4523     fi
4524 fi
4525
4526 if [ "$CFG_EVDEV" != "no" ]; then
4527     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/evdev "evdev" $L_FLAGS $I_FLAGS $l_FLAGS; then
4528         CFG_EVDEV=yes
4529         QT_CONFIG="$QT_CONFIG evdev"
4530     elif [ "$CFG_EVDEV" = "yes" ]; then
4531         echo "The evdev functionality test failed!"
4532         exit 1
4533     else
4534         CFG_EVDEV=no
4535         QMakeVar add DEFINES QT_NO_EVDEV
4536     fi
4537 fi
4538
4539 # Check we actually have X11 :-)
4540 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS; then
4541     QT_CONFIG="$QT_CONFIG xlib"
4542 fi
4543
4544 # auto-detect Xrender support
4545 if [ "$CFG_XRENDER" != "no" ]; then
4546     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xrender "Xrender" $L_FLAGS $I_FLAGS $l_FLAGS; then
4547         CFG_XRENDER=yes
4548         QT_CONFIG="$QT_CONFIG xrender"
4549     else
4550         if [ "$CFG_XRENDER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4551             echo "Xrender support cannot be enabled due to functionality tests!"
4552             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4553             echo " If you believe this message is in error you may use the continue"
4554             echo " switch (-continue) to $0 to continue."
4555             exit 101
4556         else
4557             CFG_XRENDER=no
4558         fi
4559     fi
4560 fi
4561
4562 if [ "$CFG_XCB" != "no" ]; then
4563     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xcb >= 1.5" 2>/dev/null; then
4564         QMAKE_CFLAGS_XCB="`$PKG_CONFIG --cflags xcb 2>/dev/null`"
4565         QMAKE_LIBS_XCB="`$PKG_CONFIG --libs xcb 2>/dev/null`"
4566     fi
4567     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
4568         CFG_XCB=yes
4569         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
4570             QT_CONFIG="$QT_CONFIG xcb-render"
4571         fi
4572
4573         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
4574             CFG_XCB_LIMITED=no
4575             QT_CONFIG="$QT_CONFIG xcb-poll-for-queued-event"
4576         fi
4577
4578         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
4579             QT_CONFIG="$QT_CONFIG xcb-xlib"
4580         fi
4581
4582         if [ "$XPLATFORM_MAEMO" = "yes" ]; then
4583             # auto-detect XInput2/Xinput support
4584             if [ "$CFG_XINPUT2" != "no" ]; then
4585                 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xinput2 "XInput2" $L_FLAGS $I_FLAGS $l_FLAGS; then
4586                     CFG_XINPUT2=yes
4587                     CFG_XINPUT=no
4588                 else
4589                     if [ "$CFG_XINPUT2" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4590                         echo "XInput2 support cannot be enabled due to functionality tests!"
4591                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4592                         echo " If you believe this message is in error you may use the continue"
4593                         echo " switch (-continue) to $0 to continue."
4594                         exit 101
4595                     else
4596                         CFG_XINPUT2=no
4597                     fi
4598                 fi
4599             fi
4600         fi
4601     else
4602         if [ "$CFG_XCB" = "yes" ]; then
4603             echo "The XCB test failed!"
4604             echo " You might need to install dependency packages."
4605             echo " See src/plugins/platforms/xcb/README."
4606             exit 1
4607         fi
4608         CFG_XCB=no
4609         QMakeVar add DEFINES QT_NO_XCB
4610     fi
4611 fi
4612
4613 if [ "$CFG_DIRECTFB" != "no" ]; then
4614     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists directfb 2>/dev/null; then
4615         QMAKE_CFLAGS_DIRECTFB=`$PKG_CONFIG --cflags directfb 2>/dev/null`
4616         QMAKE_LIBS_DIRECTFB=`$PKG_CONFIG --libs directfb 2>/dev/null`
4617         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
4618             CFG_DIRECTFB=yes
4619         elif [ "$CFG_DIRECTFB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4620             echo " DirectFB support cannot be enabled due to functionality tests!"
4621             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4622             echo " If you believe this message is in error you may use the continue"
4623             echo " switch (-continue) to $0 to continue."
4624             exit 101
4625         else
4626             CFG_DIRECTFB=no
4627         fi
4628     else
4629         CFG_DIRECTFB=no
4630     fi
4631 fi
4632
4633 # Detect libxkbcommon
4634 if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xkbcommon 2>/dev/null; then
4635     QMAKE_CFLAGS_XKBCOMMON="`$PKG_CONFIG --cflags xkbcommon 2>/dev/null`"
4636     QMAKE_LIBS_XKBCOMMON="`$PKG_CONFIG --libs xkbcommon 2>/dev/null`"
4637     QMAKE_CFLAGS_XCB="$QMAKE_CFLAGS_XCB $QMAKE_CFLAGS_XKBCOMMON"
4638     QMAKE_LIBS_XCB="$QMAKE_LIBS_XCB $QMAKE_LIBS_XKBCOMMON"
4639 else
4640     QMAKE_DEFINES_XCB=QT_NO_XCB_XKB
4641 fi
4642
4643 # EGL Support
4644 if [ "$CFG_EGL" != "no" ] && [ "$CFG_OPENGL" != "desktop" ]; then
4645     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists egl 2>/dev/null; then
4646         QMAKE_INCDIR_EGL=`$PKG_CONFIG --cflags-only-I egl 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
4647         QMAKE_LIBS_EGL=`$PKG_CONFIG --libs egl 2>/dev/null`
4648         QMAKE_CFLAGS_EGL=`$PKG_CONFIG --cflags egl 2>/dev/null`
4649         QMakeVar set QMAKE_INCDIR_EGL "$QMAKE_INCDIR_EGL"
4650         QMakeVar set QMAKE_LIBS_EGL "$QMAKE_LIBS_EGL"
4651     fi       # detect EGL support
4652     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
4653         CFG_EGL=yes
4654     elif [ "$CFG_EGL" = "yes" ]; then
4655         echo " The EGL functionality test failed; EGL is required by some QPA plugins to manage contexts & surfaces."
4656         echo " You might need to modify the include and library search paths by editing"
4657         echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in ${XQMAKESPEC}."
4658         exit 1
4659     else
4660         CFG_EGL=no
4661     fi
4662 elif [ "$CFG_OPENGL" = "desktop" ]; then
4663     if [ "$CFG_EGL" = "yes" ]; then
4664         echo "EGL support was requested but Qt is being configured for desktop OpenGL."
4665         echo "Either disable EGL support or enable OpenGL ES support."
4666         exit 101
4667     fi
4668     CFG_EGL=no
4669 fi
4670
4671 if [ "$CFG_EGLFS" != "no" ]; then
4672     if [ "$CFG_OPENGL" = "es2" ]; then
4673         CFG_EGLFS="$CFG_EGL"
4674     else
4675         CFG_EGLFS="no"
4676     fi
4677 fi
4678
4679 # Determine the default QPA platform
4680 if [ -z "$QT_QPA_DEFAULT_PLATFORM" ]; then
4681     # check the mkspec
4682     QT_QPA_DEFAULT_PLATFORM=`getXQMakeConf QT_QPA_DEFAULT_PLATFORM`
4683     if [ -z "$QT_QPA_DEFAULT_PLATFORM" ]; then
4684         if [ "$BUILD_ON_MAC" = "yes" ]; then
4685             QT_QPA_DEFAULT_PLATFORM="cocoa"
4686         elif [ "$UNAME_SYSTEM" = "QNX" ]; then
4687             QT_QPA_DEFAULT_PLATFORM="qnx"
4688         else
4689             QT_QPA_DEFAULT_PLATFORM="xcb"
4690         fi
4691     fi
4692 fi
4693
4694 if [ -n "$QMAKE_CFLAGS_XCB" ] || [ -n "$QMAKE_LIBS_XCB" ]; then
4695     QMakeVar set QMAKE_CFLAGS_XCB "$QMAKE_CFLAGS_XCB"
4696     QMakeVar set QMAKE_LIBS_XCB "$QMAKE_LIBS_XCB"
4697     QMakeVar set QMAKE_DEFINES_XCB "$QMAKE_DEFINES_XCB"
4698 fi
4699 if [ "$CFG_DIRECTFB" = "yes" ]; then
4700     QT_CONFIG="$QT_CONFIG directfb"
4701     QMakeVar set QMAKE_CFLAGS_DIRECTFB "$QMAKE_CFLAGS_DIRECTFB"
4702     QMakeVar set QMAKE_LIBS_DIRECTFB "$QMAKE_LIBS_DIRECTFB"
4703 fi
4704
4705 if [ "$BUILD_ON_MAC" = "yes" ]; then
4706     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
4707         QT_CONFIG="$QT_CONFIG coreservices"
4708     else
4709         QMakeVar add DEFINES QT_NO_CORESERVICES
4710     fi
4711 fi
4712
4713 if [ "$BUILD_ON_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ] && [ "$XPLATFORM_QNX" = "no" ]; then
4714     if [ "$CFG_XCB" = "no" ] && [ "$CFG_EGLFS" = "no" ] && [ "$CFG_DIRECTFB" = "no" ]; then
4715         if [ "$QPA_PLATFORM_GUARD" = "yes" ] &&
4716             ( [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_EGLFS" = "auto" ] || [ "$ORIG_CFG_DIRECTFB" = "auto" ] ); then
4717         echo "No QPA platform plugin enabled!"
4718         echo " If you really want to build without a QPA platform plugin you must pass"
4719         echo " -no-qpa-platform-guard to configure. Doing this will"
4720         echo " produce a Qt that can not run GUI applications."
4721         echo " The dependencies needed for xcb to build are listed in"
4722         echo " src/plugins/platforms/xcb/README"
4723         exit 1
4724     fi
4725 fi
4726     fi
4727
4728 [ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_PHONON" != "no" ] && CFG_PHONON="yes"
4729
4730 # freetype support
4731 [ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_LIBFREETYPE" = "auto" ] && CFG_LIBFREETYPE=no
4732 if [ "$CFG_LIBFREETYPE" = "auto" ]; then
4733     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
4734         CFG_LIBFREETYPE=system
4735     else
4736         CFG_LIBFREETYPE=yes
4737     fi
4738 fi
4739
4740 if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stl "STL" $L_FLAGS $I_FLAGS $l_FLAGS &&
4741     [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4742     echo "STL functionality check failed! Cannot build Qt with this STL library."
4743     echo " Turn on verbose messaging (-v) to $0 to see the final report."
4744     exit 101
4745 fi
4746
4747
4748 # detect POSIX clock_gettime()
4749 if [ "$CFG_CLOCK_GETTIME" = "auto" ]; then
4750     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
4751         CFG_CLOCK_GETTIME=yes
4752     else
4753         CFG_CLOCK_GETTIME=no
4754     fi
4755 fi
4756
4757 # detect POSIX monotonic clocks
4758 if [ "$CFG_CLOCK_GETTIME" = "yes" ] && [ "$CFG_CLOCK_MONOTONIC" = "auto" ]; then
4759     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
4760         CFG_CLOCK_MONOTONIC=yes
4761     else
4762         CFG_CLOCK_MONOTONIC=no
4763     fi
4764 elif [ "$CFG_CLOCK_GETTIME" = "no" ]; then
4765     CFG_CLOCK_MONOTONIC=no
4766 fi
4767
4768 # detect mremap
4769 if [ "$CFG_MREMAP" = "auto" ]; then
4770     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mremap "mremap" $L_FLAGS $I_FLAGS $l_FLAGS; then
4771         CFG_MREMAP=yes
4772     else
4773         CFG_MREMAP=no
4774     fi
4775 fi
4776
4777 # find if the platform provides getaddrinfo (ipv6 dns lookups)
4778 if [ "$CFG_GETADDRINFO" != "no" ]; then
4779     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getaddrinfo "getaddrinfo" $L_FLAGS $I_FLAGS $l_FLAGS; then
4780         CFG_GETADDRINFO=yes
4781     else
4782         if [ "$CFG_GETADDRINFO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4783             echo "getaddrinfo support cannot be enabled due to functionality tests!"
4784             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4785             echo " If you believe this message is in error you may use the continue"
4786             echo " switch (-continue) to $0 to continue."
4787             exit 101
4788         else
4789             CFG_GETADDRINFO=no
4790         fi
4791     fi
4792 fi
4793
4794 # find if the platform provides inotify
4795 if [ "$CFG_INOTIFY" != "no" ]; then
4796     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/inotify "inotify" $L_FLAGS $I_FLAGS $l_FLAGS; then
4797         CFG_INOTIFY=yes
4798     else
4799         if [ "$CFG_INOTIFY" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4800             echo "inotify support cannot be enabled due to functionality tests!"
4801             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4802             echo " If you believe this message is in error you may use the continue"
4803             echo " switch (-continue) to $0 to continue."
4804             exit 101
4805         else
4806             CFG_INOTIFY=no
4807         fi
4808     fi
4809 fi
4810
4811 # find if the platform provides if_nametoindex (ipv6 interface name support)
4812 if [ "$CFG_IPV6IFNAME" != "no" ]; then
4813     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
4814         CFG_IPV6IFNAME=yes
4815     else
4816         if [ "$CFG_IPV6IFNAME" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4817             echo "IPv6 interface name support cannot be enabled due to functionality tests!"
4818             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4819             echo " If you believe this message is in error you may use the continue"
4820             echo " switch (-continue) to $0 to continue."
4821             exit 101
4822         else
4823             CFG_IPV6IFNAME=no
4824         fi
4825     fi
4826 fi
4827
4828 # find if the platform provides getifaddrs (network interface enumeration)
4829 if [ "$CFG_GETIFADDRS" != "no" ]; then
4830     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getifaddrs "getifaddrs" $L_FLAGS $I_FLAGS $l_FLAGS; then
4831         CFG_GETIFADDRS=yes
4832     else
4833         if [ "$CFG_GETIFADDRS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4834             echo "getifaddrs support cannot be enabled due to functionality tests!"
4835             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4836             echo " If you believe this message is in error you may use the continue"
4837             echo " switch (-continue) to $0 to continue."
4838             exit 101
4839         else
4840             CFG_GETIFADDRS=no
4841         fi
4842     fi
4843 fi
4844
4845 # detect OpenSSL
4846 if [ "$CFG_OPENSSL" != "no" ]; then
4847     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
4848         if [ "$CFG_OPENSSL" = "auto" ]; then
4849             CFG_OPENSSL=yes
4850         fi
4851     else
4852         if ( [ "$CFG_OPENSSL" = "yes" ] || [ "$CFG_OPENSSL" = "linked" ] ) && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4853             echo "OpenSSL support cannot be enabled due to functionality tests!"
4854             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4855             echo " If you believe this message is in error you may use the continue"
4856             echo " switch (-continue) to $0 to continue."
4857             exit 101
4858         else
4859             CFG_OPENSSL=no
4860         fi
4861     fi
4862 fi
4863
4864 # detect PCRE
4865 if [ "$CFG_PCRE" != "qt" ]; then
4866     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/pcre "PCRE" $L_FLAGS $I_FLAGS $l_FLAGS; then
4867         CFG_PCRE=system
4868     else
4869         if [ "$CFG_PCRE" = "system" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4870             echo "PCRE support cannot be enabled due to functionality tests!"
4871             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4872             echo " If you believe this message is in error you may use the continue"
4873             echo " switch (-continue) to $0 to continue."
4874             exit 101
4875         else
4876             CFG_PCRE=qt
4877         fi
4878     fi
4879 fi
4880
4881 # detect OpenVG support
4882 if [ "$CFG_OPENVG" != "no" ]; then
4883     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
4884         if [ "$CFG_OPENVG" = "auto" ]; then
4885             CFG_OPENVG=yes
4886         fi
4887     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
4888         if [ "$CFG_OPENVG" = "auto" ]; then
4889             CFG_OPENVG=yes
4890         fi
4891         CFG_OPENVG_ON_OPENGL=yes
4892     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
4893         if [ "$CFG_OPENVG" = "auto" ]; then
4894             CFG_OPENVG=yes
4895         fi
4896         CFG_OPENVG_LC_INCLUDES=yes
4897     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
4898         if [ "$CFG_OPENVG" = "auto" ]; then
4899             CFG_OPENVG=yes
4900         fi
4901         CFG_OPENVG_LC_INCLUDES=yes
4902         CFG_OPENVG_ON_OPENGL=yes
4903     else
4904         if [ "$CFG_OPENVG" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4905             echo "$CFG_OPENVG was specified for OpenVG but cannot be enabled due to functionality tests!"
4906             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4907             echo " If you believe this message is in error you may use the continue"
4908             echo " switch (-continue) to $0 to continue."
4909             exit 101
4910         else
4911             CFG_OPENVG=no
4912         fi
4913     fi
4914     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
4915         CFG_OPENVG_SHIVA=yes
4916     fi
4917 fi
4918
4919 if [ "$CFG_ALSA" = "auto" ]; then
4920     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/alsa "alsa" $L_FLAGS $I_FLAGS $l_FLAGS; then
4921         CFG_ALSA=yes
4922     else
4923         CFG_ALSA=no
4924     fi
4925 fi
4926
4927 if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ] || [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then 
4928     if [ "$CFG_ARCH" = "arm" ]; then
4929        "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/javascriptcore-jit "javascriptcore-jit" $L_FLAGS $I_FLAGS $l_FLAGS
4930         if [ $? != "0" ]; then
4931            CFG_JAVASCRIPTCORE_JIT=no
4932         fi
4933     else
4934         case "$XPLATFORM" in
4935             linux-icc*)
4936                 CFG_JAVASCRIPTCORE_JIT=no
4937                 ;;
4938         esac
4939     fi
4940 fi
4941
4942 if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ]; then
4943     QMakeVar set JAVASCRIPTCORE_JIT yes
4944 elif [ "$CFG_JAVASCRIPTCORE_JIT" = "no" ]; then
4945     QMakeVar set JAVASCRIPTCORE_JIT no
4946 fi
4947
4948 if [ "$CFG_AUDIO_BACKEND" = "auto" ]; then
4949     CFG_AUDIO_BACKEND=yes
4950 fi
4951
4952 if [ "$CFG_LARGEFILE" != "yes" ] && [ "$XPLATFORM_MINGW" = "yes" ]; then
4953     echo "Warning: largefile support cannot be disabled for win32."
4954     CFG_LARGEFILE="yes"
4955 fi
4956
4957 #-------------------------------------------------------------------------------
4958 # ask for all that hasn't been auto-detected or specified in the arguments
4959 #-------------------------------------------------------------------------------
4960
4961 # ### Vestige
4962 if [ "$CFG_PHONON_BACKEND" = "yes" ]; then
4963     QT_CONFIG="$QT_CONFIG phonon-backend"
4964 fi
4965
4966 # disable accessibility
4967 if [ "$CFG_ACCESSIBILITY" = "no" ]; then
4968     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ACCESSIBILITY"
4969 else
4970     QT_CONFIG="$QT_CONFIG accessibility"
4971 fi
4972
4973 # enable egl
4974 if [ "$CFG_EGL" = "yes" ]; then
4975     QT_CONFIG="$QT_CONFIG egl"
4976 else
4977     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGL"
4978 fi
4979
4980 # enable eglfs
4981 if [ "$CFG_EGLFS" = "yes" ]; then
4982     QT_CONFIG="$QT_CONFIG eglfs"
4983 else
4984     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGLFS"
4985 fi
4986
4987 # enable openvg
4988 if [ "$CFG_OPENVG" = "no" ]; then
4989     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENVG"
4990 else
4991     QT_CONFIG="$QT_CONFIG openvg"
4992     if [ "$CFG_OPENVG_LC_INCLUDES" = "yes" ]; then
4993         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LOWER_CASE_VG_INCLUDES"
4994     fi
4995     if [ "$CFG_OPENVG_ON_OPENGL" = "yes" ]; then
4996         QT_CONFIG="$QT_CONFIG openvg_on_opengl"
4997     fi
4998     if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
4999         QT_CONFIG="$QT_CONFIG shivavg"
5000         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SHIVAVG"
5001     fi
5002 fi
5003
5004 # enable opengl
5005 if [ "$CFG_OPENGL" = "no" ]; then
5006     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENGL"
5007 else
5008     QT_CONFIG="$QT_CONFIG opengl"
5009 fi
5010
5011 if [ "$CFG_OPENGL" = "es2" ]; then
5012     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES"
5013 fi
5014
5015 if [ "$CFG_OPENGL" = "es2" ]; then
5016     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_2"
5017     QT_CONFIG="$QT_CONFIG opengles2"
5018 fi
5019
5020 # safe execution environment
5021 if [ "$CFG_SXE" != "no" ]; then
5022     QT_CONFIG="$QT_CONFIG sxe"
5023 fi
5024
5025 # build up the variables for output
5026 if [ "$CFG_DEBUG" = "yes" ]; then
5027     QMAKE_OUTDIR="${QMAKE_OUTDIR}debug"
5028     QMAKE_CONFIG="$QMAKE_CONFIG debug"
5029 elif [ "$CFG_DEBUG" = "no" ]; then
5030     QMAKE_OUTDIR="${QMAKE_OUTDIR}release"
5031     QMAKE_CONFIG="$QMAKE_CONFIG release"
5032 fi
5033 if [ "$CFG_SHARED" = "yes" ]; then
5034     QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared"
5035     QMAKE_CONFIG="$QMAKE_CONFIG shared dll"
5036 elif [ "$CFG_SHARED" = "no" ]; then
5037     QMAKE_OUTDIR="${QMAKE_OUTDIR}-static"
5038     QMAKE_CONFIG="$QMAKE_CONFIG static"
5039 fi
5040
5041 #FIXME: qpa is implicit this should all be removed
5042 QMAKE_CONFIG="$QMAKE_CONFIG qpa"
5043 QT_CONFIG="$QT_CONFIG qpa"
5044 QTCONFIG_CONFIG="$QTCONFIG_CONFIG qpa"
5045 rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
5046
5047 if [ "$XPLATFORM_MINGW" != "yes" ]; then
5048     # Do not set this here for Windows. Let qmake do it so
5049     # debug and release precompiled headers are kept separate.
5050     QMakeVar set PRECOMPILED_DIR ".pch/$QMAKE_OUTDIR"
5051 fi
5052 QMakeVar set OBJECTS_DIR ".obj/$QMAKE_OUTDIR"
5053 QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR"
5054 QMakeVar set RCC_DIR ".rcc/$QMAKE_OUTDIR"
5055 QMakeVar set UI_DIR ".uic/$QMAKE_OUTDIR"
5056 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
5057     QMAKE_CONFIG="$QMAKE_CONFIG largefile"
5058 fi
5059 if [ "$CFG_USE_GNUMAKE" = "yes" ]; then
5060     QMAKE_CONFIG="$QMAKE_CONFIG GNUmake"
5061 fi
5062 [ "$CFG_REDUCE_EXPORTS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_exports"
5063 [ "$CFG_REDUCE_RELOCATIONS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_relocations"
5064 [ "$CFG_PRECOMPILE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG precompile_header"
5065 if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
5066     QMakeVar add QMAKE_CFLAGS -g
5067     QMakeVar add QMAKE_CXXFLAGS -g
5068     QT_CONFIG="$QT_CONFIG separate_debug_info"
5069 fi
5070 if [ "$CFG_SEPARATE_DEBUG_INFO_NOCOPY" = "yes" ] ; then
5071     QT_CONFIG="$QT_CONFIG separate_debug_info_nocopy"
5072 fi
5073 [ "$CFG_SSE2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse2"
5074 [ "$CFG_SSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse3"
5075 [ "$CFG_SSSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG ssse3"
5076 [ "$CFG_SSE4_1" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_1"
5077 [ "$CFG_SSE4_2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_2"
5078 [ "$CFG_AVX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG avx"
5079 [ "$CFG_AVX2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG avx2"
5080 [ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt"
5081 [ "$CFG_NEON" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG neon"
5082 if [ "$CFG_ARCH" = "mips" ]; then
5083     [ "$CFG_MIPS_DSP" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mips_dsp"
5084     [ "$CFG_MIPS_DSPR2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mips_dspr2"
5085 fi
5086 if [ "$CFG_CLOCK_GETTIME" = "yes" ]; then
5087     QT_CONFIG="$QT_CONFIG clock-gettime"
5088 fi
5089 if [ "$CFG_CLOCK_MONOTONIC" = "yes" ]; then
5090     QT_CONFIG="$QT_CONFIG clock-monotonic"
5091 fi
5092 if [ "$CFG_MREMAP" = "yes" ]; then
5093     QT_CONFIG="$QT_CONFIG mremap"
5094 fi
5095 if [ "$CFG_GETADDRINFO" = "yes" ]; then
5096     QT_CONFIG="$QT_CONFIG getaddrinfo"
5097 fi
5098 if [ "$CFG_IPV6IFNAME" = "yes" ]; then
5099     QT_CONFIG="$QT_CONFIG ipv6ifname"
5100 fi
5101 if [ "$CFG_GETIFADDRS" = "yes" ]; then
5102     QT_CONFIG="$QT_CONFIG getifaddrs"
5103 fi
5104 if [ "$CFG_INOTIFY" = "yes" ]; then
5105     QT_CONFIG="$QT_CONFIG inotify"
5106 fi
5107 if [ "$CFG_LIBJPEG" = "no" ]; then
5108     CFG_JPEG="no"
5109 elif [ "$CFG_LIBJPEG" = "system" ]; then
5110     QT_CONFIG="$QT_CONFIG system-jpeg"
5111 fi
5112 if [ "$CFG_JPEG" = "no" ]; then
5113     QT_CONFIG="$QT_CONFIG no-jpeg"
5114 elif [ "$CFG_JPEG" = "yes" ]; then
5115     QT_CONFIG="$QT_CONFIG jpeg"
5116 fi
5117 if [ "$CFG_LIBPNG" = "no" ]; then
5118     CFG_PNG="no"
5119 fi
5120 if [ "$CFG_LIBPNG" = "system" ]; then
5121     QT_CONFIG="$QT_CONFIG system-png"
5122 fi
5123 if [ "$CFG_PNG" = "no" ]; then
5124     QT_CONFIG="$QT_CONFIG no-png"
5125 elif [ "$CFG_PNG" = "yes" ]; then
5126     QT_CONFIG="$QT_CONFIG png"
5127 fi
5128 if [ "$CFG_GIF" = "no" ]; then
5129     QT_CONFIG="$QT_CONFIG no-gif"
5130 elif [ "$CFG_GIF" = "yes" ]; then
5131     QT_CONFIG="$QT_CONFIG gif"
5132 fi
5133 if [ "$CFG_LIBFREETYPE" = "no" ]; then
5134     QT_CONFIG="$QT_CONFIG no-freetype"
5135     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FREETYPE"
5136 elif [ "$CFG_LIBFREETYPE" = "system" ]; then
5137     QT_CONFIG="$QT_CONFIG system-freetype"
5138 else
5139     QT_CONFIG="$QT_CONFIG freetype"
5140 fi
5141 if [ "$CFG_GUI" = "auto" ]; then
5142     CFG_GUI="yes"
5143 fi
5144 if [ "$CFG_GUI" = "no" ]; then
5145     QT_CONFIG="$QT_CONFIG no-gui"
5146     CFG_WIDGETS="no"
5147 fi
5148 if [ "$CFG_WIDGETS" = "no" ]; then
5149     QT_CONFIG="$QT_CONFIG no-widgets"
5150     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_WIDGETS"
5151 fi
5152
5153 if [ "x$BUILD_ON_MAC" = "xyes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
5154     #On Mac we implicitly link against libz, so we
5155     #never use the 3rdparty stuff.
5156     [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system"
5157 fi
5158 if [ "$CFG_ZLIB" = "yes" ]; then
5159     QT_CONFIG="$QT_CONFIG zlib"
5160 elif [ "$CFG_ZLIB" = "system" ]; then
5161     QT_CONFIG="$QT_CONFIG system-zlib"
5162 fi
5163
5164 [ "$CFG_NIS" = "yes" ] && QT_CONFIG="$QT_CONFIG nis"
5165 [ "$CFG_CUPS" = "yes" ] && QT_CONFIG="$QT_CONFIG cups"
5166 [ "$CFG_ICONV" = "yes" ] && QT_CONFIG="$QT_CONFIG iconv"
5167 [ "$CFG_ICONV" = "sun" ] && QT_CONFIG="$QT_CONFIG sun-libiconv"
5168 [ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv"
5169 [ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib"
5170 [ "$CFG_GSTREAMER" = "yes" ] && QT_CONFIG="$QT_CONFIG gstreamer"
5171 [ "$CFG_DBUS" = "yes" ] && QT_CONFIG="$QT_CONFIG dbus"
5172 [ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus dbus-linked"
5173 [ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl"
5174 [ "$CFG_OPENSSL" = "linked" ] && QT_CONFIG="$QT_CONFIG openssl-linked"
5175 [ "$CFG_MAC_HARFBUZZ" = "yes" ] && QT_CONFIG="$QT_CONFIG harfbuzz"
5176 [ "$CFG_XCB" = "yes" ] && QT_CONFIG="$QT_CONFIG xcb"
5177 [ "$CFG_XINPUT2" = "yes" ] && QT_CONFIG="$QT_CONFIG xinput2"
5178
5179 [ '!' -z "$D_FLAGS" ] && QMakeVar add DEFINES "$D_FLAGS"
5180 [ '!' -z "$L_FLAGS" ] && QMakeVar add QMAKE_LIBDIR_FLAGS "$L_FLAGS"
5181 [ '!' -z "$l_FLAGS" ] && QMakeVar add LIBS "$l_FLAGS"
5182
5183 if [ "$PLATFORM_MAC" = "yes" ] && [ "$QT_CROSS_COMPILE" = "no" ]; then
5184     if [ "$CFG_RPATH" = "yes" ]; then
5185        QMAKE_CONFIG="$QMAKE_CONFIG absolute_library_soname"
5186        # set the default rpath to the library installation directory
5187        RPATH_FLAGS="\"$QT_INSTALL_LIBS\" $RPATH_FLAGS"
5188     fi
5189 elif [ -z "`getXQMakeConf 'QMAKE_(LFLAGS_)?RPATH'`" ]; then
5190     if [ -n "$RPATH_FLAGS" ]; then
5191         echo
5192         echo "ERROR: -R cannot be used on this platform as \$QMAKE_LFLAGS_RPATH is"
5193         echo "       undefined."
5194         echo
5195         exit 1
5196     elif [ "$CFG_RPATH" = "yes" ]; then
5197         RPATH_MESSAGE="        NOTE: This platform does not support runtime library paths, using -no-rpath."
5198         CFG_RPATH=no
5199     fi
5200 else
5201     if [ "$CFG_RPATH" = "yes" ]; then
5202         # set the default rpath to the library installation directory
5203         RPATH_FLAGS="\"$QT_INSTALL_LIBS\" $RPATH_FLAGS"
5204     fi
5205     if [ -n "$RPATH_FLAGS" ]; then
5206         # add the user defined rpaths
5207         QMakeVar add QMAKE_RPATHDIR "$RPATH_FLAGS"
5208     fi
5209 fi
5210
5211 if [ '!' -z "$I_FLAGS" ]; then
5212     # add the user define include paths
5213     QMakeVar add QMAKE_CFLAGS "$I_FLAGS"
5214     QMakeVar add QMAKE_CXXFLAGS "$I_FLAGS"
5215 fi
5216
5217 if [ '!' -z "$W_FLAGS" ]; then
5218     # add the user defined warning flags
5219     QMakeVar add QMAKE_CFLAGS_WARN_ON "$W_FLAGS"
5220     QMakeVar add QMAKE_CXXFLAGS_WARN_ON "$W_FLAGS"
5221     QMakeVar add QMAKE_OBJECTIVE_CFLAGS_WARN_ON "$W_FLAGS"
5222 fi
5223
5224 if [ "$XPLATFORM_MINGW" = "yes" ]; then
5225     # mkspecs/features/win32/default_pre.prf sets "no-rtti".
5226     # Follow default behavior of configure.exe by overriding with "rtti".
5227     QTCONFIG_CONFIG="$QTCONFIG_CONFIG rtti"
5228 fi
5229
5230 if [ "$CFG_ALSA" = "yes" ]; then
5231     QT_CONFIG="$QT_CONFIG alsa"
5232 fi
5233
5234 if [ "$CFG_PULSEAUDIO" = "yes" ]; then
5235     QT_CONFIG="$QT_CONFIG pulseaudio"
5236 fi
5237
5238 if [ "$CFG_COREWLAN" = "yes" ]; then
5239     QT_CONFIG="$QT_CONFIG corewlan"
5240 fi
5241
5242 if [ "$CFG_ICU" = "yes" ]; then
5243     QT_CONFIG="$QT_CONFIG icu"
5244 fi
5245
5246 if [ "$CFG_FORCE_ASSERTS" = "yes" ]; then
5247     QT_CONFIG="$QT_CONFIG force_asserts"
5248 fi
5249
5250 if [ "$CFG_PCRE" = "qt" ]; then
5251     QMAKE_CONFIG="$QMAKE_CONFIG pcre"
5252 fi
5253
5254 #
5255 # Some Qt modules are too advanced in C++ for some old compilers
5256 # Detect here the platforms where they are known to work.
5257 #
5258 # See Qt documentation for more information on which features are
5259 # supported and on which compilers.
5260 #
5261 canBuildQtConcurrent="yes"
5262 canUseV8Snapshot="yes"
5263
5264 case "$XPLATFORM" in
5265     hpux-g++*)
5266         # PA-RISC's assembly is too limited
5267         # gcc 3.4 on that platform can't build QtXmlPatterns
5268         # the assembly it generates cannot be compiled
5269
5270         # Check gcc's version
5271         case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
5272             4*)
5273                 ;;
5274             3.4*)
5275                 canBuildQtXmlPatterns="no"
5276                 ;;
5277             *)
5278                 canBuildWebKit="no"
5279                 canBuildQtXmlPatterns="no"
5280                 ;;
5281         esac
5282         ;;
5283     unsupported/vxworks-*-g++*)
5284         canBuildWebKit="no"
5285         ;;
5286     unsupported/vxworks-*-dcc*)
5287         canBuildWebKit="no"
5288         canBuildQtXmlPatterns="no"
5289         ;;
5290     *-g++*)
5291         # Check gcc's version
5292         case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
5293             4*|3.4*)
5294                 ;;
5295             3.3*)
5296                 canBuildWebKit="no"
5297                 ;;
5298             *)
5299                 canBuildWebKit="no"
5300                 canBuildQtXmlPatterns="no"
5301                 ;;
5302         esac
5303         ;;
5304     solaris-cc*)
5305         # Check the compiler version
5306         case `${QMAKE_CONF_COMPILER} -V 2>&1 | awk '{print $4}'` in
5307             5.[012345678])
5308                 canBuildWebKit="no"
5309                 canBuildQtXmlPatterns="no"
5310                 canBuildQtConcurrent="no"
5311                 ;;
5312             5.*)
5313                 canBuildWebKit="no"
5314                 canBuildQtConcurrent="no"
5315                 ;;
5316         esac
5317         ;;
5318     hpux-acc*)
5319         canBuildWebKit="no"
5320         canBuildQtXmlPatterns="no"
5321         canBuildQtConcurrent="no"
5322         ;;
5323     hpuxi-acc*)
5324         canBuildWebKit="no"
5325         ;;
5326     aix-xlc*)
5327         # Get the xlC version
5328         cat > xlcver.c <<EOF
5329 #include <stdio.h>
5330 int main()
5331 {
5332     printf("%d.%d\n", __xlC__ >> 8, __xlC__ & 0xFF);
5333     return 0;
5334 }
5335 EOF
5336         xlcver=
5337         if ${QMAKE_CONF_COMPILER} -o xlcver xlcver.c >/dev/null 2>/dev/null; then
5338             xlcver=`./xlcver 2>/dev/null`
5339             rm -f ./xlcver
5340         fi
5341         if [ "$OPT_VERBOSE" = "yes" ]; then
5342             if [ -n "$xlcver" ]; then
5343                 echo Found IBM xlC version: $xlcver.
5344             else
5345                 echo Could not determine IBM xlC version, assuming oldest supported.
5346             fi
5347         fi
5348
5349         case "$xlcver" in
5350             [123456].*)
5351                 canBuildWebKit="no"
5352                 canBuildQtXmlPatterns="no"
5353                 canBuildQtConcurrent="no"
5354                 ;;
5355             *)
5356                 canBuildWebKit="no"
5357                 canBuildQtConcurrent="no"
5358                 ;;
5359         esac
5360         ;;
5361     irix-cc*)
5362         canBuildWebKit="no"
5363         canBuildQtConcurrent="no"
5364         ;;
5365 esac
5366
5367 if [ "$CFG_GUI" = "no" ]; then
5368     # WebKit requires QtGui
5369     canBuildWebKit="no"
5370 fi
5371
5372 if [ "$CFG_SHARED" = "no" ]; then
5373     echo
5374     echo "WARNING: Using static linking will disable the WebKit module."
5375     echo
5376     canBuildWebKit="no"
5377 fi
5378
5379 CFG_CONCURRENT="yes"
5380 if [ "$canBuildQtConcurrent" = "no" ]; then
5381     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT"
5382     CFG_CONCURRENT="no"
5383 else
5384     QT_CONFIG="$QT_CONFIG concurrent"
5385 fi
5386
5387 # ### Vestige
5388 if [ "$CFG_AUDIO_BACKEND" = "yes" ]; then
5389     QT_CONFIG="$QT_CONFIG audio-backend"
5390 fi
5391
5392 # ### Vestige
5393 if [ "$CFG_WEBKIT" = "debug" ]; then
5394     QMAKE_CONFIG="$QMAKE_CONFIG webkit-debug"
5395 fi
5396
5397 # ### Vestige
5398 QT_CONFIG="$QT_CONFIG v8"
5399 # Detect snapshot support
5400 if [ "$CFG_ARCH" != "$CFG_HOST_ARCH" ]; then
5401     case "$CFG_HOST_ARCH,$CFG_ARCH" in
5402         i386,arm)
5403         ;;
5404     *) canUseV8Snapshot="no"
5405         ;;
5406     esac
5407 else
5408     if [ -n "$_SBOX_DIR" -a "$CFG_ARCH" = "arm" ]; then
5409         # QEMU crashes when building inside Scratchbox with an ARM target
5410         canUseV8Snapshot="no"
5411     fi
5412 fi
5413 if [ "$CFG_V8SNAPSHOT" = "auto" ]; then
5414     CFG_V8SNAPSHOT="$canUseV8Snapshot"
5415 fi
5416 if [ "$CFG_V8SNAPSHOT" = "yes" -a "$canUseV8Snapshot" = "no" ]; then
5417     echo "Error: V8 snapshot was requested, but is not supported on this platform."
5418     exit 1
5419 fi
5420 if [ "$CFG_V8SNAPSHOT" = "yes" ]; then
5421     QT_CONFIG="$QT_CONFIG v8snapshot"
5422 fi
5423
5424 # ### Vestige
5425 if [ "$CFG_QML_DEBUG" = "no" ]; then
5426     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QML_NO_DEBUGGER"
5427 fi
5428
5429 case "$COMPILER" in
5430 g++*)
5431     # GNU C++
5432     COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -dumpversion 2>/dev/null`
5433
5434     case "$COMPILER_VERSION" in
5435     *.*.*)
5436         QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'`
5437         QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'`
5438         QT_GCC_PATCH_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'`
5439         ;;
5440     *.*)
5441         QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\1,'`
5442         QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\2,'`
5443         QT_GCC_PATCH_VERSION=0
5444         ;;
5445     esac
5446
5447     ;;
5448 *)
5449     #
5450     ;;
5451 esac
5452
5453 #-------------------------------------------------------------------------------
5454 # part of configuration information goes into qconfig.h
5455 #-------------------------------------------------------------------------------
5456
5457 case "$CFG_QCONFIG" in
5458 full)
5459     echo "/* Everything */" >"$outpath/src/corelib/global/qconfig.h.new"
5460     ;;
5461 *)
5462     tmpconfig="$outpath/src/corelib/global/qconfig.h.new"
5463     echo "#ifndef QT_BOOTSTRAPPED" >"$tmpconfig"
5464     if [ -f "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" ]; then
5465         cat "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" >>"$tmpconfig"
5466     elif [ -f `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` ]; then
5467         cat `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` >>"$tmpconfig"
5468     fi
5469     echo "#endif" >>"$tmpconfig"
5470     ;;
5471 esac
5472
5473 cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
5474
5475 /* Qt Edition */
5476 #ifndef QT_EDITION
5477 #  define QT_EDITION $QT_EDITION
5478 #endif
5479 EOF
5480
5481 echo '/* Compile time features */' >>"$outpath/src/corelib/global/qconfig.h.new"
5482 [ '!' -z "$LicenseKeyExt" ] && echo "#define QT_PRODUCT_LICENSEKEY \"$LicenseKeyExt\"" >>"$outpath/src/corelib/global/qconfig.h.new"
5483
5484 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
5485     echo "#define QT_LARGEFILE_SUPPORT 64" >>"$outpath/src/corelib/global/qconfig.h.new"
5486 fi
5487
5488 if [ "$CFG_FRAMEWORK" = "yes" ]; then
5489     echo "#define QT_MAC_FRAMEWORK_BUILD" >>"$outpath/src/corelib/global/qconfig.h.new"
5490 fi
5491
5492 if [ "$BUILD_ON_MAC" = "yes" ]; then
5493     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
5494 #if defined(__LP64__)
5495 # define QT_POINTER_SIZE 8
5496 #else
5497 # define QT_POINTER_SIZE 4
5498 #endif
5499 EOF
5500 else
5501     "$unixtests/ptrsize.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
5502     echo "#define QT_POINTER_SIZE $?" >>"$outpath/src/corelib/global/qconfig.h.new"
5503 fi
5504
5505 #REDUCE_RELOCATIONS is a elf/unix only thing, so not in windows configure.exe
5506 if [ "$CFG_REDUCE_RELOCATIONS" = "yes" ]; then
5507     echo "#define QT_REDUCE_RELOCATIONS" >>"$outpath/src/corelib/global/qconfig.h.new"
5508 fi
5509
5510
5511 echo "" >>"$outpath/src/corelib/global/qconfig.h.new"
5512
5513 if [ "$CFG_DEV" = "yes" ]; then
5514     echo "#define QT_BUILD_INTERNAL" >>"$outpath/src/corelib/global/qconfig.h.new"
5515 fi
5516
5517 # Add QPA to config.h
5518 QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QPA QT_NO_QWS_QPF QT_NO_QWS_QPF2"
5519
5520 if [ "${CFG_USE_FLOATMATH}" = "yes" ]; then
5521     QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_USE_MATH_H_FLOATS"
5522 fi
5523
5524 # Add turned on SQL drivers
5525 for DRIVER in $CFG_SQL_AVAILABLE; do
5526     eval "VAL=\$CFG_SQL_$DRIVER"
5527     case "$VAL" in
5528     qt)
5529         ONDRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
5530         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SQL_$ONDRIVER"
5531         SQL_DRIVERS="$SQL_DRIVERS $DRIVER"
5532     ;;
5533     plugin)
5534         SQL_PLUGINS="$SQL_PLUGINS $DRIVER"
5535     ;;
5536     esac
5537 done
5538
5539
5540 QMakeVar set sql-drivers "$SQL_DRIVERS"
5541 QMakeVar set sql-plugins "$SQL_PLUGINS"
5542
5543 # Add other configuration options to the qconfig.h file
5544 [ "$CFG_GIF" = "yes" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_BUILTIN_GIF_READER=1"
5545 [ "$CFG_PNG" != "yes" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_PNG"
5546 [ "$CFG_JPEG" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_JPEG"
5547 [ "$CFG_ZLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ZLIB"
5548 [ "$CFG_SXE" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SXE"
5549 [ "$CFG_DBUS" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS"
5550
5551 # X11/Unix/Mac only configs
5552 [ "$CFG_CUPS" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CUPS"
5553 [ "$CFG_ICONV" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ICONV"
5554 [ "$CFG_GLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GLIB"
5555 [ "$CFG_GSTREAMER" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GSTREAMER"
5556 [ "$CFG_QGTKSTYLE" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STYLE_GTK"
5557 [ "$CFG_CLOCK_MONOTONIC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CLOCK_MONOTONIC"
5558 [ "$CFG_MREMAP" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MREMAP"
5559 [ "$CFG_GETADDRINFO" = "no" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETADDRINFO"
5560 [ "$CFG_IPV6IFNAME" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IPV6IFNAME"
5561 [ "$CFG_GETIFADDRS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETIFADDRS"
5562 [ "$CFG_INOTIFY" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_INOTIFY"
5563 [ "$CFG_NIS" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NIS"
5564 [ "$CFG_OPENSSL" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENSSL QT_NO_SSL"
5565 [ "$CFG_OPENSSL" = "linked" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LINKED_OPENSSL"
5566
5567 [ "$CFG_SM" = "no" ]         && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SESSIONMANAGER"
5568 [ "$CFG_XCURSOR" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XCURSOR"
5569 [ "$CFG_XFIXES" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XFIXES"
5570 [ "$CFG_FONTCONFIG" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FONTCONFIG"
5571 [ "$CFG_XINERAMA" = "no" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINERAMA"
5572 [ "$CFG_XKB" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XKB"
5573 [ "$CFG_XRANDR" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRANDR"
5574 [ "$CFG_XRENDER" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRENDER"
5575 [ "$CFG_MITSHM" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MITSHM"
5576 [ "$CFG_XSHAPE" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SHAPE"
5577 [ "$CFG_XVIDEO" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XVIDEO"
5578 [ "$CFG_XSYNC" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XSYNC"
5579 [ "$CFG_XINPUT" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINPUT QT_NO_TABLET"
5580
5581 [ "$CFG_XCURSOR" = "runtime" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XCURSOR"
5582 [ "$CFG_XINERAMA" = "runtime" ]  && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINERAMA"
5583 [ "$CFG_XFIXES" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XFIXES"
5584 [ "$CFG_XRANDR" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XRANDR"
5585 [ "$CFG_XINPUT" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINPUT"
5586 [ "$CFG_ALSA" = "no" ]           && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ALSA"
5587 [ "$CFG_PULSEAUDIO" = "no" ]          && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_PULSEAUDIO"
5588 [ "$CFG_COREWLAN" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_COREWLAN"
5589
5590 # sort QCONFIG_FLAGS for neatness if we can
5591 [ '!' -z "$AWK" ] && QCONFIG_FLAGS=`echo $QCONFIG_FLAGS | $AWK '{ gsub(" ", "\n"); print }' | sort | uniq`
5592 QCONFIG_FLAGS=`echo $QCONFIG_FLAGS`
5593
5594 if [ -n "$QCONFIG_FLAGS" ]; then
5595 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
5596 #ifndef QT_BOOTSTRAPPED
5597
5598 EOF
5599     for cfg in $QCONFIG_FLAGS; do
5600         cfgd=`echo $cfg | sed 's/=.*$//'` # trim pushed 'Foo=Bar' defines
5601         cfg=`echo $cfg | sed 's/=/ /'`    # turn first '=' into a space
5602         # figure out define logic, so we can output the correct
5603         # ifdefs to override the global defines in a project
5604         cfgdNeg=
5605         if [ true ] && echo "$cfgd" | grep 'QT_NO_' >/dev/null 2>&1; then
5606             # QT_NO_option can be forcefully turned on by QT_option
5607             cfgdNeg=`echo $cfgd | sed "s,QT_NO_,QT_,"`
5608         elif [ true ] && echo "$cfgd" | grep 'QT_' >/dev/null 2>&1; then
5609             # QT_option can be forcefully turned off by QT_NO_option
5610             cfgdNeg=`echo $cfgd | sed "s,QT_,QT_NO_,"`
5611         fi
5612
5613         if [ -z $cfgdNeg ]; then
5614 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
5615 #ifndef $cfgd
5616 # define $cfg
5617 #endif
5618
5619 EOF
5620         else
5621 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
5622 #if defined($cfgd) && defined($cfgdNeg)
5623 # undef $cfgd
5624 #elif !defined($cfgd) && !defined($cfgdNeg)
5625 # define $cfg
5626 #endif
5627
5628 EOF
5629         fi
5630     done
5631 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
5632 #endif // QT_BOOTSTRAPPED
5633
5634 EOF
5635 fi
5636
5637 if [ "$CFG_REDUCE_EXPORTS" = "yes" ]; then
5638 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
5639 #define QT_VISIBILITY_AVAILABLE
5640
5641 EOF
5642 fi
5643
5644 if [ -n "$QT_LIBINFIX" ]; then
5645 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
5646 #define QT_LIBINFIX "$QT_LIBINFIX"
5647
5648 EOF
5649 fi
5650
5651 echo "#define QT_QPA_DEFAULT_PLATFORM_NAME \"$QT_QPA_DEFAULT_PLATFORM\"" >>"$outpath/src/corelib/global/qconfig.h.new"
5652
5653 # avoid unecessary rebuilds by copying only if qconfig.h has changed
5654 if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then
5655     rm -f "$outpath/src/corelib/global/qconfig.h.new"
5656 else
5657     [ -f "$outpath/src/corelib/global/qconfig.h" ] && chmod +w "$outpath/src/corelib/global/qconfig.h"
5658     mv "$outpath/src/corelib/global/qconfig.h.new" "$outpath/src/corelib/global/qconfig.h"
5659     chmod -w "$outpath/src/corelib/global/qconfig.h"
5660     if [ ! -f "$outpath/include/QtCore/qconfig.h" ]; then
5661         ln -s "$outpath/src/corelib/global/qconfig.h" "$outpath/include/QtCore/qconfig.h"
5662     fi
5663 fi
5664
5665 #-------------------------------------------------------------------------------
5666 # save configuration into qconfig.pri
5667 #-------------------------------------------------------------------------------
5668 QTCONFIG="$outpath/mkspecs/qconfig.pri"
5669 QTCONFIG_CONFIG="$QTCONFIG_CONFIG no_mocdepend"
5670 [ -f "$QTCONFIG.tmp" ] && rm -f "$QTCONFIG.tmp"
5671 if [ "$CFG_DEBUG" = "yes" ]; then
5672     QTCONFIG_CONFIG="$QTCONFIG_CONFIG debug"
5673     if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
5674         QT_CONFIG="$QT_CONFIG release"
5675     fi
5676     QT_CONFIG="$QT_CONFIG debug"
5677 elif [ "$CFG_DEBUG" = "no" ]; then
5678     QTCONFIG_CONFIG="$QTCONFIG_CONFIG release"
5679     if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
5680         QT_CONFIG="$QT_CONFIG debug"
5681     fi
5682     QT_CONFIG="$QT_CONFIG release"
5683 fi
5684 if [ "$CFG_FRAMEWORK" = "no" ]; then
5685     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_no_framework"
5686 else
5687     QT_CONFIG="$QT_CONFIG qt_framework"
5688     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_framework"
5689 fi
5690 if [ "$CFG_DEV" = "yes" ]; then
5691     QT_CONFIG="$QT_CONFIG private_tests"
5692 fi
5693
5694 cat >>"$QTCONFIG.tmp" <<EOF
5695 #configuration
5696 CONFIG += $QTCONFIG_CONFIG
5697 QT_ARCH = $CFG_ARCH
5698 QT_HOST_ARCH = $CFG_HOST_ARCH
5699 QT_EDITION = $Edition
5700 QT_CONFIG += $QT_CONFIG
5701
5702 #versioning
5703 QT_VERSION = $QT_VERSION
5704 QT_MAJOR_VERSION = $QT_MAJOR_VERSION
5705 QT_MINOR_VERSION = $QT_MINOR_VERSION
5706 QT_PATCH_VERSION = $QT_PATCH_VERSION
5707
5708 #namespaces
5709 QT_LIBINFIX = $QT_LIBINFIX
5710 QT_NAMESPACE = $QT_NAMESPACE
5711
5712 EOF
5713
5714 if [ -n "$PKG_CONFIG_SYSROOT_DIR" ] || [ -n "$PKG_CONFIG_LIBDIR" ]; then
5715     echo "# pkgconfig" >> "$QTCONFIG.tmp"
5716     echo "PKG_CONFIG_SYSROOT_DIR = $PKG_CONFIG_SYSROOT_DIR" >> "$QTCONFIG.tmp"
5717     echo "PKG_CONFIG_LIBDIR = $PKG_CONFIG_LIBDIR" >> "$QTCONFIG.tmp"
5718     echo >> $"$QTCONFIG.tmp"
5719 fi
5720
5721 if [ -n "$CFG_SYSROOT" ]; then
5722     echo "# sysroot" >>"$QTCONFIG.tmp"
5723     echo `basename "$XQMAKESPEC"` \{ >>"$QTCONFIG.tmp"
5724     echo "    QMAKE_CFLAGS    += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
5725     echo "    QMAKE_CXXFLAGS  += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
5726     echo "    QMAKE_LFLAGS    += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
5727     echo "}" >> "$QTCONFIG.tmp"
5728     echo >> "$QTCONFIG.tmp"
5729 fi
5730 if [ -n "$RPATH_FLAGS" ]; then
5731     echo "QMAKE_RPATHDIR += $RPATH_FLAGS" >> "$QTCONFIG.tmp"
5732 fi
5733 if [ -n "$QT_GCC_MAJOR_VERSION" ]; then
5734     echo "QT_GCC_MAJOR_VERSION = $QT_GCC_MAJOR_VERSION" >> "$QTCONFIG.tmp"
5735     echo "QT_GCC_MINOR_VERSION = $QT_GCC_MINOR_VERSION" >> "$QTCONFIG.tmp"
5736     echo "QT_GCC_PATCH_VERSION = $QT_GCC_PATCH_VERSION" >> "$QTCONFIG.tmp"
5737 fi
5738
5739 if [ -n "$QMAKE_INCDIR_OPENGL_ES2" ]; then
5740     echo "#Qt opengl include path" >> "$QTCONFIG.tmp"
5741     echo "QMAKE_INCDIR_OPENGL_ES2 = \"$QMAKE_INCDIR_OPENGL_ES2\"" >> "$QTCONFIG.tmp"
5742 fi
5743
5744 # replace qconfig.pri if it differs from the newly created temp file
5745 if cmp -s "$QTCONFIG.tmp" "$QTCONFIG"; then
5746     rm -f "$QTCONFIG.tmp"
5747 else
5748     mv -f "$QTCONFIG.tmp" "$QTCONFIG"
5749 fi
5750
5751 #-------------------------------------------------------------------------------
5752 # save configuration into qmodule.pri
5753 #-------------------------------------------------------------------------------
5754 QTMODULE="$outpath/mkspecs/qmodule.pri"
5755
5756 echo "CONFIG += create_prl link_prl" >> "$QTMODULE.tmp"
5757
5758 # Ensure we can link to uninistalled libraries
5759 if [ "$BUILD_ON_MAC" != "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ] && linkerSupportsFlag -rpath-link "$outpath/lib"; then
5760     echo "QMAKE_LFLAGS    = -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib \$\$QMAKE_LFLAGS" >> "$QTMODULE.tmp"
5761 fi
5762 if [ -n "$QT_CFLAGS_PSQL" ]; then
5763     echo "QT_CFLAGS_PSQL   = $QT_CFLAGS_PSQL" >> "$QTMODULE.tmp"
5764 fi
5765 if [ -n "$QT_LFLAGS_PSQL" ]; then
5766     echo "QT_LFLAGS_PSQL   = $QT_LFLAGS_PSQL" >> "$QTMODULE.tmp"
5767 fi
5768 if [ -n "$QT_CFLAGS_MYSQL" ]; then
5769     echo "QT_CFLAGS_MYSQL   = $QT_CFLAGS_MYSQL" >> "$QTMODULE.tmp"
5770 fi
5771 if [ -n "$QT_LFLAGS_MYSQL" ]; then
5772     echo "QT_LFLAGS_MYSQL   = $QT_LFLAGS_MYSQL" >> "$QTMODULE.tmp"
5773 fi
5774 if [ -n "$QT_CFLAGS_SQLITE" ]; then
5775     echo "QT_CFLAGS_SQLITE   = $QT_CFLAGS_SQLITE" >> "$QTMODULE.tmp"
5776 fi
5777 if [ -n "$QT_LFLAGS_SQLITE" ]; then
5778     echo "QT_LFLAGS_SQLITE   = $QT_LFLAGS_SQLITE" >> "$QTMODULE.tmp"
5779 fi
5780 if [ -n "$QT_LFLAGS_ODBC" ]; then
5781     echo "QT_LFLAGS_ODBC   = $QT_LFLAGS_ODBC" >> "$QTMODULE.tmp"
5782 fi
5783 if [ -n "$QT_LFLAGS_TDS" ]; then
5784     echo "QT_LFLAGS_TDS   = $QT_LFLAGS_TDS" >> "$QTMODULE.tmp"
5785 fi
5786
5787 if [ "$QT_EDITION" != "QT_EDITION_OPENSOURCE" ]; then
5788     echo "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" >> "$QTMODULE.tmp"
5789 fi
5790
5791 #dump in the OPENSSL_LIBS info
5792 if [ '!' -z "$OPENSSL_LIBS" ]; then
5793     echo "OPENSSL_LIBS = $OPENSSL_LIBS" >> "$QTMODULE.tmp"
5794 elif [ "$CFG_OPENSSL" = "linked" ]; then
5795     echo "OPENSSL_LIBS = -lssl -lcrypto" >> "$QTMODULE.tmp"
5796 fi
5797
5798 #dump in the SDK info
5799 if [ '!' -z "$CFG_SDK" ]; then
5800    echo "QMAKE_MAC_SDK = $CFG_SDK" >> "$QTMODULE.tmp"
5801 fi
5802
5803 # cmdline args
5804 cat "$QMAKE_VARS_FILE" >> "$QTMODULE.tmp"
5805 rm -f "$QMAKE_VARS_FILE" 2>/dev/null
5806
5807 # replace qmodule.pri if it differs from the newly created temp file
5808 if cmp -s "$QTMODULE.tmp" "$QTMODULE"; then
5809     rm -f "$QTMODULE.tmp"
5810 else
5811     mv -f "$QTMODULE.tmp" "$QTMODULE"
5812 fi
5813
5814 #-------------------------------------------------------------------------------
5815 # save configuration into .qmake.cache
5816 #-------------------------------------------------------------------------------
5817
5818 CACHEFILE="$outpath/.qmake.cache"
5819 [ -f "$CACHEFILE.tmp" ] && rm -f "$CACHEFILE.tmp"
5820 cat >>"$CACHEFILE.tmp" <<EOF
5821 #paths
5822 QT_SOURCE_TREE = \$\$quote($relpath)
5823 QT_BUILD_TREE = \$\$quote($outpath)
5824 QT_BUILD_PARTS = $CFG_BUILD_PARTS
5825
5826 #local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR
5827 QMAKE_INCDIR_QT  = \$\$QT_BUILD_TREE/include
5828 QMAKE_LIBDIR_QT  = \$\$QT_BUILD_TREE/lib
5829
5830 include(\$\$PWD/mkspecs/qmodule.pri)
5831 CONFIG += $QMAKE_CONFIG dylib depend_includepath fix_output_dirs no_private_qt_headers_warning QTDIR_build
5832
5833 EOF
5834
5835 #dump the qmake spec
5836 if [ -d "$outpath/mkspecs/$XPLATFORM" ]; then
5837    echo "QMAKESPEC = \$\$QT_BUILD_TREE/mkspecs/$XPLATFORM" >> "$CACHEFILE.tmp"
5838 else
5839    echo "QMAKESPEC = $XPLATFORM" >> "$CACHEFILE.tmp"
5840 fi
5841
5842 # replace .qmake.cache if it differs from the newly created temp file
5843 if cmp -s "$CACHEFILE.tmp" "$CACHEFILE"; then
5844     rm -f "$CACHEFILE.tmp"
5845 else
5846     mv -f "$CACHEFILE.tmp" "$CACHEFILE"
5847 fi
5848
5849 #-------------------------------------------------------------------------------
5850 # give feedback on configuration
5851 #-------------------------------------------------------------------------------
5852 exec 3>&1 1>$outpath/config.summary # redirect output temporarily to config.summary
5853
5854 echo
5855 if [ "$XPLATFORM" = "$PLATFORM" ]; then
5856     echo "Build type:    $PLATFORM"
5857 else
5858     echo "Building on:   $PLATFORM"
5859     echo "Building for:  $XPLATFORM"
5860 fi
5861
5862 echo "Architecture:  $CFG_ARCH"
5863 echo "Host architecture: $CFG_HOST_ARCH"
5864
5865 if [ -n "$PLATFORM_NOTES" ]; then
5866     echo "Platform notes:"
5867     echo "$PLATFORM_NOTES"
5868 else
5869     echo
5870 fi
5871
5872 if [ "$OPT_VERBOSE" = "yes" ]; then
5873     echo $ECHO_N "qmake vars .......... $ECHO_C"
5874     cat "$QMAKE_VARS_FILE" | tr '\n' ' '
5875     echo "qmake switches ......... $QMAKE_SWITCHES"
5876 fi
5877
5878 echo "Build .................. $CFG_BUILD_PARTS"
5879 echo "Configuration .......... $QMAKE_CONFIG $QT_CONFIG"
5880 if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
5881    echo "Debug .................. yes (combined)"
5882    if [ "$CFG_DEBUG" = "yes" ]; then
5883        echo "Default Link ........... debug"
5884    else
5885        echo "Default Link ........... release"
5886    fi
5887 else
5888    echo "Debug .................. $CFG_DEBUG"
5889 fi
5890 if [ -n "$PKG_CONFIG" ]; then
5891     echo "pkg-config ............. yes"
5892 else
5893     echo "pkg-config ............. no"
5894 fi
5895 [ "$CFG_DBUS" = "no" ]     && echo "QtDBus module .......... no"
5896 [ "$CFG_DBUS" = "yes" ]    && echo "QtDBus module .......... yes (run-time)"
5897 [ "$CFG_DBUS" = "linked" ] && echo "QtDBus module .......... yes (linked)"
5898 echo "QtConcurrent code ...... $CFG_CONCURRENT"
5899 echo "QtGui module ........... $CFG_GUI"
5900 echo "QtWidgets module ....... $CFG_WIDGETS"
5901 if [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
5902     echo "JavaScriptCore JIT ..... To be decided by JavaScriptCore"
5903 else
5904     echo "JavaScriptCore JIT ..... $CFG_JAVASCRIPTCORE_JIT"
5905 fi
5906 echo "QML debugging .......... $CFG_QML_DEBUG"
5907 echo "PCH support ............ $CFG_PRECOMPILE"
5908 if [ "$CFG_ARCH" = "i386" -o "$CFG_ARCH" = "x86_64" ]; then
5909     echo "SSE2/SSE3/SSSE3......... ${CFG_SSE2}/${CFG_SSE3}/${CFG_SSSE3}"
5910     echo "SSE4.1/SSE4.2........... ${CFG_SSSE3}/${CFG_SSE4_1}/${CFG_SSE4_2}"
5911     echo "AVX/AVX2................ ${CFG_AVX}/${CFG_AVX2}"
5912 elif [ "$CFG_ARCH" = "arm" ]; then
5913     echo "iWMMXt support ......... ${CFG_IWMMXT}"
5914     echo "NEON support ........... ${CFG_NEON}"
5915 fi
5916 if [ "$CFG_ARCH" = "mips" ]; then
5917     echo "MIPS_DSP/MIPS_DSPR2..... ${CFG_MIPS_DSP}/${CFG_MIPS_DSPR2}"
5918 fi
5919 echo "IPv6 ifname support .... $CFG_IPV6IFNAME"
5920 echo "getaddrinfo support .... $CFG_GETADDRINFO"
5921 echo "getifaddrs support ..... $CFG_GETIFADDRS"
5922 echo "Accessibility .......... $CFG_ACCESSIBILITY"
5923 echo "NIS support ............ $CFG_NIS"
5924 echo "CUPS support ........... $CFG_CUPS"
5925 echo "Iconv support .......... $CFG_ICONV"
5926 echo "Glib support ........... $CFG_GLIB"
5927 echo "GStreamer support ...... $CFG_GSTREAMER"
5928 echo "PulseAudio support ..... $CFG_PULSEAUDIO"
5929 echo "Large File support ..... $CFG_LARGEFILE"
5930 echo "GIF support ............ $CFG_GIF"
5931 if [ "$CFG_JPEG" = "no" ]; then
5932     echo "JPEG support ........... $CFG_JPEG"
5933 else
5934     echo "JPEG support ........... $CFG_JPEG ($CFG_LIBJPEG)"
5935 fi
5936 if [ "$CFG_PNG" = "no" ]; then
5937     echo "PNG support ............ $CFG_PNG"
5938 else
5939     echo "PNG support ............ $CFG_PNG ($CFG_LIBPNG)"
5940 fi
5941 echo "zlib support ........... $CFG_ZLIB"
5942 echo "Session management ..... $CFG_SM"
5943 echo "libudev support ........ $CFG_LIBUDEV"
5944
5945 if [ "$CFG_OPENGL" = "desktop" ]; then
5946     echo "OpenGL support ......... yes (Desktop OpenGL)"
5947 elif [ "$CFG_OPENGL" = "es2" ]; then
5948     echo "OpenGL support ......... yes (OpenGL ES 2.x)"
5949 else
5950     echo "OpenGL support ......... no"
5951 fi
5952
5953 if [ "$CFG_OPENVG" ]; then
5954     if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
5955         echo "OpenVG support ......... ShivaVG"
5956     else
5957         echo "OpenVG support ......... $CFG_OPENVG"
5958     fi
5959 fi
5960
5961 echo "XShape support ......... $CFG_XSHAPE"
5962 echo "XVideo support ......... $CFG_XVIDEO"
5963 echo "XSync support .......... $CFG_XSYNC"
5964 echo "Xinerama support ....... $CFG_XINERAMA"
5965 echo "Xcursor support ........ $CFG_XCURSOR"
5966 echo "Xfixes support ......... $CFG_XFIXES"
5967 echo "Xrandr support ......... $CFG_XRANDR"
5968 echo "Xi support ............. $CFG_XINPUT"
5969 echo "MIT-SHM support ........ $CFG_MITSHM"
5970 echo "FontConfig support ..... $CFG_FONTCONFIG"
5971 echo "XKB Support ............ $CFG_XKB"
5972 echo "immodule support ....... $CFG_IM"
5973 echo "GTK theme support ...... $CFG_QGTKSTYLE"
5974
5975 [ "$CFG_SQL_mysql" != "no" ] && echo "MySQL support .......... $CFG_SQL_mysql"
5976 [ "$CFG_SQL_psql" != "no" ] && echo "PostgreSQL support ..... $CFG_SQL_psql"
5977 [ "$CFG_SQL_odbc" != "no" ] && echo "ODBC support ........... $CFG_SQL_odbc"
5978 [ "$CFG_SQL_oci" != "no" ] && echo "OCI support ............ $CFG_SQL_oci"
5979 [ "$CFG_SQL_tds" != "no" ] && echo "TDS support ............ $CFG_SQL_tds"
5980 [ "$CFG_SQL_db2" != "no" ] && echo "DB2 support ............ $CFG_SQL_db2"
5981 [ "$CFG_SQL_ibase" != "no" ] && echo "InterBase support ...... $CFG_SQL_ibase"
5982 [ "$CFG_SQL_sqlite2" != "no" ] && echo "SQLite 2 support ....... $CFG_SQL_sqlite2"
5983 [ "$CFG_SQL_sqlite" != "no" ] && echo "SQLite support ......... $CFG_SQL_sqlite ($CFG_SQLITE)"
5984
5985 OPENSSL_LINKAGE=""
5986 if [ "$CFG_OPENSSL" = "yes" ]; then
5987     OPENSSL_LINKAGE="(run-time)"
5988 elif [ "$CFG_OPENSSL" = "linked" ]; then
5989     OPENSSL_LINKAGE="(linked)"
5990 fi
5991 echo "OpenSSL support ........ $CFG_OPENSSL $OPENSSL_LINKAGE"
5992 echo "Alsa support ........... $CFG_ALSA"
5993 if [ "$BUILD_ON_MAC" = "yes" ]; then
5994     echo "CoreWlan support ....... $CFG_COREWLAN"
5995 fi
5996 echo "libICU support ......... $CFG_ICU"
5997 echo "PCRE support ........... $CFG_PCRE"
5998 if [ "$CFG_XCB_LIMITED" = "yes" ] && [ "$CFG_XCB" = "yes" ]; then
5999     echo "Xcb support ............ limited (old version)"
6000 else
6001     echo "Xcb support ............ $CFG_XCB"
6002 fi
6003 echo "Xrender support ........ $CFG_XRENDER"
6004 if [ "$XPLATFORM_MAEMO" = "yes" ] && [ "$CFG_XCB" = "yes" ]; then
6005     echo "XInput2 support ........ $CFG_XINPUT2"
6006 fi
6007 echo "EGLFS support .......... $CFG_EGLFS"
6008 echo "DirectFB support ....... $CFG_DIRECTFB"
6009 echo
6010
6011 # complain about not being able to use dynamic plugins if we are using a static build
6012 if [ "$CFG_SHARED" = "no" ]; then
6013     echo
6014     echo "WARNING: Using static linking will disable the use of dynamically"
6015     echo "loaded plugins. Make sure to import all needed static plugins,"
6016     echo "or compile needed modules into the library."
6017     echo
6018 fi
6019 if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then
6020     echo
6021     echo "NOTE: When linking against OpenSSL, you can override the default"
6022     echo "library names through OPENSSL_LIBS."
6023     echo "For example:"
6024     echo "    OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked"
6025     echo
6026 fi
6027
6028 exec 1>&3 3>&- # restore stdout
6029 cat $outpath/config.summary # display config feedback to user
6030
6031 if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then
6032     echo
6033     echo "Error: debug-only framework builds are not supported. Configure with -no-framework"
6034     echo "if you want a pure debug build."
6035     echo
6036     exit 1
6037 fi
6038
6039 sepath=`echo "$relpath" | sed -e 's/\\./\\\\./g'`
6040 PROCS=1
6041 EXEC=""
6042
6043
6044 #-------------------------------------------------------------------------------
6045 # build makefiles based on the configuration
6046 #-------------------------------------------------------------------------------
6047
6048 echo "Finding project files. Please wait..."
6049 if [ "$CFG_NOPROCESS" != "yes" ]; then
6050     "$outpath/bin/qmake" -prl -r "${relpath}/qtbase.pro"
6051     if [ -f "${relpath}/qtbase.pro" ]; then
6052         mkfile="${outpath}/Makefile"
6053         [ -f "$mkfile" ] && chmod +w "$mkfile"
6054         QTDIR="$outpath" "$outpath/bin/qmake" -spec "$XQMAKESPEC" "${relpath}/qtbase.pro" -o "$mkfile"
6055     fi
6056 fi
6057
6058 # .projects      -> projects to process
6059 # .projects.1    -> qt and moc
6060 # .projects.2    -> subdirs and libs
6061 # .projects.3    -> the rest
6062 rm -f .projects .projects.1 .projects.2 .projects.3
6063
6064 QMAKE_PROJECTS=`find "$relpath/." -name '*.pro' -print | sed 's-/\./-/-'`
6065 if [ -z "$AWK" ]; then
6066     for p in `echo $QMAKE_PROJECTS`; do
6067         echo "$p" >> .projects
6068     done
6069 else
6070     cat >projects.awk <<EOF
6071 BEGIN {
6072     files = 0
6073     target_file = ""
6074     input_file = ""
6075
6076     first = "./.projects.1.tmp"
6077     second = "./.projects.2.tmp"
6078     third = "./.projects.3.tmp"
6079 }
6080
6081 FNR == 1 {
6082     if ( input_file ) {
6083         if ( ! target_file )
6084             target_file = third
6085         print input_file >target_file
6086     }
6087
6088     matched_target = 0
6089     template_lib = 0
6090     input_file = FILENAME
6091     target_file = ""
6092 }
6093
6094 /^(TARGET.*=)/ {
6095     if ( \$3 == "moc" || \$3 ~ /^Qt/ ) {
6096         target_file = first
6097         matched_target = 1
6098     } else if ( \$3 == "lrelease" || \$3 == "qm_phony_target" ) {
6099         target_file = second
6100         matched_target = 1
6101     }
6102 }
6103
6104 matched_target == 0 && /^(TEMPLATE.*=)/ {
6105     if ( \$3 == "subdirs" )
6106         target_file = second
6107     else if ( \$3 == "lib" )
6108         template_lib = 1
6109     else
6110         target_file = third
6111 }
6112
6113 matched_target == 0 && template_lib == 1 && /^(CONFIG.*=)/ {
6114     if ( \$0 ~ /plugin/ )
6115         target_file = third
6116     else
6117         target_file = second
6118 }
6119
6120 END {
6121     if ( input_file ) {
6122         if ( ! target_file )
6123             target_file = third
6124         print input_file >>target_file
6125     }
6126 }
6127
6128 EOF
6129
6130     rm -f .projects.all
6131     for p in `echo $QMAKE_PROJECTS`; do
6132        echo "$p" >> .projects.all
6133     done
6134
6135     # if you get errors about the length of the command line to awk, change the -l arg
6136     # to split below
6137     split -l 100 .projects.all .projects.all.
6138     for p in .projects.all.*; do
6139        "$AWK" -f projects.awk `cat $p`
6140        [ -f .projects.1.tmp ] && cat .projects.1.tmp >> .projects.1
6141        [ -f .projects.2.tmp ] && cat .projects.2.tmp >> .projects.2
6142        [ -f .projects.3.tmp ] && cat .projects.3.tmp >> .projects.3
6143        rm -f .projects.1.tmp .projects.2.tmp .projects.3.tmp $p
6144     done
6145     rm -f .projects.all* projects.awk
6146
6147     [ -f .projects.1 ] && cat .projects.1 >>.projects
6148     [ -f .projects.2 ] && cat .projects.2 >>.projects
6149     rm -f .projects.1 .projects.2
6150     if [ -f .projects.3 ] && [ "$OPT_FAST" = "no" ]; then
6151        cat .projects.3 >>.projects
6152        rm -f .projects.3
6153     fi
6154 fi
6155 # don't sort Qt and MOC in with the other project files
6156 # also work around a segfaulting uniq(1)
6157 if [ -f .sorted.projects.2 ]; then
6158     sort .sorted.projects.2 > .sorted.projects.2.new
6159     mv -f .sorted.projects.2.new .sorted.projects.2
6160     cat .sorted.projects.2 >> .sorted.projects.1
6161 fi
6162 [ -f .sorted.projects.1 ] && sort .sorted.projects.1 >> .sorted.projects
6163 rm -f .sorted.projects.2 .sorted.projects.1
6164
6165 NORM_PROJECTS=0
6166 FAST_PROJECTS=0
6167 if [ -f .projects ]; then
6168    uniq .projects >.tmp
6169    mv -f .tmp .projects
6170    NORM_PROJECTS=`cat .projects | wc -l | sed -e "s, ,,g"`
6171 fi
6172 if [ -f .projects.3 ]; then
6173    uniq .projects.3 >.tmp
6174    mv -f .tmp .projects.3
6175    FAST_PROJECTS=`cat .projects.3 | wc -l | sed -e "s, ,,g"`
6176 fi
6177 echo "  `expr $NORM_PROJECTS + $FAST_PROJECTS` projects found."
6178 echo
6179
6180 PART_ROOTS=
6181 for part in $CFG_BUILD_PARTS; do
6182     case "$part" in
6183     tools) PART_ROOTS="$PART_ROOTS tools" ;;
6184     libs) PART_ROOTS="$PART_ROOTS src" ;;
6185     translations) PART_ROOTS="$PART_ROOTS translations" ;;
6186     examples) PART_ROOTS="$PART_ROOTS examples" ;;
6187     *) ;;
6188     esac
6189 done
6190
6191 if [ "$CFG_DEV" = "yes" ]; then
6192     PART_ROOTS="$PART_ROOTS tests"
6193 fi
6194
6195 echo "Creating makefiles. Please wait..."
6196 for file in .projects .projects.3; do
6197     [ '!' -f "$file" ] && continue
6198     for a in `cat $file`; do
6199         IN_ROOT=no
6200         for r in $PART_ROOTS; do
6201             if echo "$a" | grep "^$r" >/dev/null 2>&1 || echo "$a" | grep "^$relpath/$r" >/dev/null 2>&1; then
6202                 IN_ROOT=yes
6203                 break
6204             fi
6205         done
6206         [ "$IN_ROOT" = "no" ] && continue
6207
6208         case $a in
6209         *winmain/winmain.pro)
6210             if [ "$CFG_NOPROCESS" = "yes" ] || [ "$XPLATFORM_MINGW" != "yes" ]; then
6211                 continue
6212             fi
6213             SPEC=$XQMAKESPEC ;;
6214         */qmake/qmake.pro) continue ;;
6215         *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*|*tools/qdoc*|*tools/qdbusxml2cpp*|*tools/qdbuscpp2xml*) SPEC=$QMAKESPEC ;;
6216         *) if [ "$CFG_NOPROCESS" = "yes" ]; then
6217               continue
6218            else
6219               SPEC=$XQMAKESPEC
6220            fi;;
6221         esac
6222         dir=`dirname "$a" | sed -e "s;$sepath;.;g"`
6223         test -d "$dir" || mkdir -p "$dir"
6224         OUTDIR="$outpath/$dir"
6225         if [ -f "${OUTDIR}/Makefile" ] && [ "$OPT_FAST" = "yes" ]; then
6226             # fast configure - the makefile exists, skip it
6227             # since the makefile exists, it was generated by qmake, which means we
6228             # can skip it, since qmake has a rule to regenerate the makefile if the .pro
6229             # file changes...
6230             [ "$OPT_VERBOSE" = "yes" ] && echo "  skipping $a"
6231             continue;
6232         fi
6233         QMAKE_SPEC_ARGS="-spec $SPEC"
6234         echo $ECHO_N "  for $a$ECHO_C"
6235
6236         QMAKE="$outpath/bin/qmake"
6237         QMAKE_ARGS="$QMAKE_SWITCHES $QMAKE_SPEC_ARGS"
6238         if [ "$file" = ".projects.3" ]; then
6239             echo " (fast)"
6240
6241             cat >"${OUTDIR}/Makefile" <<EOF
6242 # ${OUTDIR}/Makefile: generated by configure
6243 #
6244 # WARNING: This makefile will be replaced with a real makefile.
6245 # All changes made to this file will be lost.
6246 EOF
6247             [ "$CFG_DEBUG_RELEASE" = "no" ] && echo "first_target: first" >>${OUTDIR}/Makefile
6248
6249             cat >>"${OUTDIR}/Makefile" <<EOF
6250 QMAKE = "$QMAKE"
6251 all clean install qmake first Makefile: FORCE
6252         \$(QMAKE) $QMAKE_ARGS -o "$OUTDIR" "$a"
6253         cd "$OUTDIR"
6254         \$(MAKE) \$@
6255
6256 FORCE:
6257
6258 EOF
6259         else
6260             if [ "$OPT_VERBOSE" = "yes" ]; then
6261                 echo " (`basename $SPEC`)"
6262                 echo "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
6263             else
6264                 echo
6265             fi
6266
6267             [ -f "${OUTDIR}/Makefile" ] && chmod +w "${OUTDIR}/Makefile"
6268             QTDIR="$outpath" "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
6269        fi
6270     done
6271 done
6272 rm -f .projects .projects.3
6273
6274 #-------------------------------------------------------------------------------
6275 # check for platforms that we don't yet know about
6276 #-------------------------------------------------------------------------------
6277 if [ "$CFG_ARCH" = "unknown" ]; then
6278 cat <<EOF
6279
6280         NOTICE: configure was unable to determine the architecture
6281         for the $XQMAKESPEC target.
6282
6283         Qt will not use a specialized implementation for any atomic
6284         operations. Instead a generic implemention based on either GCC
6285         intrinsics or C++11 std::atomic<T> will be used (when
6286         available). The generic implementations are generally as fast
6287         as and always as safe as a specialized implementation.
6288
6289         If no generic implementation is available, Qt will use a
6290         fallback UNIX implementation which uses a single
6291         pthread_mutex_t to protect all atomic operations. This
6292         implementation is the slow (but safe) fallback implementation
6293         for architectures Qt does not yet support.
6294 EOF
6295 fi
6296
6297 #-------------------------------------------------------------------------------
6298 # check if the user passed the -no-zlib option, which is no longer supported
6299 #-------------------------------------------------------------------------------
6300 if [ -n "$ZLIB_FORCED" ]; then
6301     which_zlib="supplied"
6302     if [ "$CFG_ZLIB" = "system" ]; then
6303         which_zlib="system"
6304     fi
6305
6306 cat <<EOF
6307
6308         NOTICE: The -no-zlib option was supplied but is no longer
6309         supported.
6310
6311         Qt now requires zlib support in all builds, so the -no-zlib
6312         option was ignored. Qt will be built using the $which_zlib
6313         zlib.
6314 EOF
6315 fi
6316
6317 #-------------------------------------------------------------------------------
6318 # check if the user passed the obsoleted -wayland or -no-wayland flag
6319 #-------------------------------------------------------------------------------
6320 if [ "$CFG_OBSOLETE_WAYLAND" = "yes" ]; then
6321 cat <<EOF
6322
6323         NOTICE: The -wayland and -no-wayland flags are now obsolete
6324
6325         All configuring of QtWayland plugin and QtCompositor happens in the module
6326 EOF
6327 fi
6328
6329 #-------------------------------------------------------------------------------
6330 # check if the user passed the obsoleted -arch or -host-arch options
6331 #-------------------------------------------------------------------------------
6332 if [ "$OPT_OBSOLETE_HOST_ARG" = "yes" ]; then
6333 cat <<EOF
6334
6335         NOTICE: The -arch and -host-arch options are obsolete.
6336
6337         Qt now detects the target and host architectures based on compiler
6338         output. Qt will be built using $CFG_ARCH for the target architecture
6339         and $CFG_HOST_ARCH for the host architecture (note that these two
6340         will be the same unless you are cross-compiling).
6341 EOF
6342 fi
6343
6344 #-------------------------------------------------------------------------------
6345 # finally save the executed command to another script
6346 #-------------------------------------------------------------------------------
6347 if [ `basename $0` != "config.status" ]; then
6348     CONFIG_STATUS="$relpath/$relconf $OPT_CMDLINE"
6349
6350     # add the system variables
6351     for varname in $SYSTEM_VARIABLES; do
6352         cmd=`echo \
6353 'if [ -n "\$'${varname}'" ]; then
6354     CONFIG_STATUS="'${varname}'='"'\\\$${varname}'"' \$CONFIG_STATUS"
6355 fi'`
6356         eval "$cmd"
6357     done
6358
6359     echo "$CONFIG_STATUS" | grep '\-confirm\-license' >/dev/null 2>&1 || CONFIG_STATUS="$CONFIG_STATUS -confirm-license"
6360
6361     [ -f "$outpath/config.status" ] && rm -f "$outpath/config.status"
6362     echo "#!/bin/sh" > "$outpath/config.status"
6363     [ -n "$PKG_CONFIG_SYSROOT_DIR" ] && \
6364         echo "export PKG_CONFIG_SYSROOT_DIR=$PKG_CONFIG_SYSROOT_DIR" >> "$outpath/config.status"
6365     [ -n "$PKG_CONFIG_LIBDIR" ] && \
6366         echo "export PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR" >> "$outpath/config.status"
6367     echo "if [ \"\$#\" -gt 0 ]; then" >> "$outpath/config.status"
6368     echo "  $CONFIG_STATUS \"\$@\"" >> "$outpath/config.status"
6369     echo "else" >> "$outpath/config.status"
6370     echo "  $CONFIG_STATUS" >> "$outpath/config.status"
6371     echo "fi" >> "$outpath/config.status"
6372     chmod +x "$outpath/config.status"
6373 fi
6374
6375 if [ -n "$RPATH_MESSAGE" ]; then
6376     echo
6377     echo "$RPATH_MESSAGE"
6378 fi
6379
6380 MAKE=`basename "$MAKE"`
6381 echo
6382 echo Qt is now configured for building. Just run \'$MAKE\'.
6383 if [ "$relpath" = "$QT_INSTALL_PREFIX" ]; then
6384     echo Once everything is built, Qt is installed.
6385     echo You should not run \'$MAKE install\'.
6386 else
6387     echo Once everything is built, you must run \'$MAKE install\'.
6388     echo Qt will be installed into $QT_INSTALL_PREFIX
6389 fi
6390 echo
6391 echo To reconfigure, run \'$MAKE confclean\' and \'configure\'.
6392 echo