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