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