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