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