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