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