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