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