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