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