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