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