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