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