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