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