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