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