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