Clean up default arch setting on Mac OS X
[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 TEST_COMPILER="$CXX"
3060
3061 [ -z "$TEST_COMPILER" ] && TEST_COMPILER=$QMAKE_CONF_COMPILER
3062 if [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then
3063     if [ -z "$TEST_COMPILER" ]; then
3064         echo "ERROR: Cannot set the compiler for the configuration tests"
3065         exit 1
3066     fi
3067 fi
3068
3069 if [ "$CFG_EMBEDDED" = "nacl" ]; then
3070     TEST_COMPILER="nacl-gcc"
3071 fi
3072
3073 SYSROOT_FLAG=
3074 if [ -n "$CFG_SYSROOT" ]; then
3075     if compilerSupportsFlag --sysroot="$CFG_SYSROOT"; then
3076         [ "$OPT_VERBOSE" = "yes" ] && echo "Setting sysroot to: $CFG_SYSROOT"
3077         SYSROOT_FLAG="--sysroot=$CFG_SYSROOT"
3078     else
3079         echo >&2 "The compiler doesn't support the --sysroot flag, I can't set the sysroot"
3080         exit 1
3081     fi
3082 fi
3083 export SYSROOT_FLAG    # used by config.tests/unix/compile.test
3084
3085 # auto-detect precompiled header support
3086 if [ "$CFG_PRECOMPILE" = "auto" ]; then
3087     if "$unixtests/precomp.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
3088        CFG_PRECOMPILE=no
3089     else
3090        CFG_PRECOMPILE=yes
3091     fi
3092 fi
3093
3094 #auto-detect DWARF2 on the mac
3095 if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "auto" ]; then
3096     if "$mactests/dwarf2.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
3097         CFG_MAC_DWARF2=no
3098     else
3099         CFG_MAC_DWARF2=yes
3100     fi
3101 fi
3102
3103 # don't autodetect support for separate debug info on objcopy when
3104 # cross-compiling as lots of toolchains seems to have problems with this
3105 if [ "$QT_CROSS_COMPILE" = "yes" ] && [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
3106     CFG_SEPARATE_DEBUG_INFO="no"
3107 fi
3108
3109 # auto-detect support for separate debug info in objcopy
3110 if [ "$CFG_SEPARATE_DEBUG_INFO" != "no" ] && [ "$CFG_SHARED" = "yes" ]; then
3111     TEST_COMPILER_CFLAGS=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%QMAKE_CFLAGS[^_=]*[+*]*=%%p' | tr '\n' ' '`
3112     TEST_COMPILER_CXXFLAGS=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%QMAKE_CXXFLAGS[^_=]*[+*]*=%%p' | tr '\n' ' '`
3113     TEST_OBJCOPY=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_OBJCOPY" | sed "s%.* *= *\(.*\)$%\1%" | tail -1`
3114     COMPILER_WITH_FLAGS="$TEST_COMPILER $TEST_COMPILER_CXXFLAGS"
3115     COMPILER_WITH_FLAGS=`echo "$COMPILER_WITH_FLAGS" | sed -e "s%\\$\\$QMAKE_CFLAGS%$TEST_COMPILER_CFLAGS%g"`
3116     if "$unixtests/objcopy.test" "$COMPILER_WITH_FLAGS" "$TEST_OBJCOPY" "$OPT_VERBOSE"; then
3117        CFG_SEPARATE_DEBUG_INFO=no
3118     else
3119        case "$PLATFORM" in
3120        hpux-*)
3121            # binutils on HP-UX is buggy; default to no.
3122            CFG_SEPARATE_DEBUG_INFO=no
3123            ;;
3124        *)
3125            CFG_SEPARATE_DEBUG_INFO=yes
3126            ;;
3127        esac
3128     fi
3129 fi
3130
3131 # auto-detect -fvisibility support
3132 if [ "$CFG_REDUCE_EXPORTS" = "auto" ]; then
3133     if "$unixtests/fvisibility.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
3134        CFG_REDUCE_EXPORTS=no
3135     else
3136        CFG_REDUCE_EXPORTS=yes
3137     fi
3138 fi
3139
3140 # detect the availability of the -Bsymbolic-functions linker optimization
3141 if [ "$CFG_REDUCE_RELOCATIONS" != "no" ]; then
3142     if "$unixtests/bsymbolic_functions.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
3143         CFG_REDUCE_RELOCATIONS=no
3144     else
3145         CFG_REDUCE_RELOCATIONS=yes
3146     fi
3147 fi
3148
3149 # auto-detect GNU make support
3150 if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2>&1; then
3151    CFG_USE_GNUMAKE=yes
3152 fi
3153
3154 # If -opengl wasn't specified, don't try to auto-detect
3155 if [ "$PLATFORM_QWS" = "yes" ] && [ "$CFG_OPENGL" = "auto" ]; then
3156         CFG_OPENGL=no
3157 fi
3158
3159 # find the default framework value
3160 if [ "$BUILD_ON_MAC" = "yes" ]; then
3161     if [ "$CFG_FRAMEWORK" = "auto" ]; then
3162         CFG_FRAMEWORK="$CFG_SHARED"
3163     elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
3164         echo
3165         echo "WARNING: Using static linking will disable the use of Mac frameworks."
3166         echo
3167         CFG_FRAMEWORK="no"
3168     fi
3169 else
3170     CFG_FRAMEWORK=no
3171 fi
3172
3173 # x11 tests are done after qmake is built
3174
3175
3176 #setup the build parts
3177 if [ -z "$CFG_BUILD_PARTS" ]; then
3178     CFG_BUILD_PARTS="$QT_DEFAULT_BUILD_PARTS"
3179
3180     # don't build tools by default when cross-compiling
3181     if [ "$PLATFORM" != "$XPLATFORM" ]; then
3182         CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, tools,,g"`
3183     fi
3184 fi
3185 for nobuild in $CFG_NOBUILD_PARTS; do
3186     CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, $nobuild,,g"`
3187 done
3188 if echo $CFG_BUILD_PARTS | grep -v libs >/dev/null 2>&1; then
3189 #    echo
3190 #    echo "WARNING: libs is a required part of the build."
3191 #    echo
3192     CFG_BUILD_PARTS="$CFG_BUILD_PARTS libs"
3193 fi
3194
3195 #-------------------------------------------------------------------------------
3196 # post process QT_INSTALL_* variables
3197 #-------------------------------------------------------------------------------
3198
3199 if [ -z "$QT_INSTALL_PREFIX" ]; then
3200     if [ "$CFG_DEV" = "yes" ]; then
3201         QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default
3202     else
3203         QT_INSTALL_PREFIX="/usr/local/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Qt-$QT_VERSION
3204     fi
3205 fi
3206 QT_INSTALL_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PREFIX"`
3207
3208 if [ -z "$QT_INSTALL_DOCS" ]; then #default
3209     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3210         if [ "$BUILD_ON_MAC" = "yes" ]; then
3211             QT_INSTALL_DOCS="/Developer/Documentation/Qt"
3212         fi
3213     fi
3214     [ -z "$QT_INSTALL_DOCS" ] && QT_INSTALL_DOCS="$QT_INSTALL_PREFIX/doc" #fallback
3215
3216 fi
3217 QT_INSTALL_DOCS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DOCS"`
3218
3219 if [ -z "$QT_INSTALL_HEADERS" ]; then #default
3220     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3221         if [ "$BUILD_ON_MAC" = "yes" ]; then
3222             if [ "$CFG_FRAMEWORK" = "yes" ]; then
3223                 QT_INSTALL_HEADERS=
3224             fi
3225         fi
3226     fi
3227     [ -z "$QT_INSTALL_HEADERS" ] && QT_INSTALL_HEADERS="$QT_INSTALL_PREFIX/include"
3228
3229 fi
3230 QT_INSTALL_HEADERS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_HEADERS"`
3231
3232 if [ -z "$QT_INSTALL_LIBS" ]; then #default
3233     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3234         if [ "$BUILD_ON_MAC" = "yes" ]; then
3235             if [ "$CFG_FRAMEWORK" = "yes" ]; then
3236                 QT_INSTALL_LIBS="/Libraries/Frameworks"
3237             fi
3238         fi
3239     fi
3240     [ -z "$QT_INSTALL_LIBS" ] && QT_INSTALL_LIBS="$QT_INSTALL_PREFIX/lib" #fallback
3241 fi
3242 QT_INSTALL_LIBS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_LIBS"`
3243
3244 if [ -z "$QT_INSTALL_BINS" ]; then #default
3245     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3246         if [ "$BUILD_ON_MAC" = "yes" ]; then
3247             QT_INSTALL_BINS="/Developer/Applications/Qt"
3248         fi
3249     fi
3250     [ -z "$QT_INSTALL_BINS" ] && QT_INSTALL_BINS="$QT_INSTALL_PREFIX/bin" #fallback
3251 fi
3252 QT_INSTALL_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_BINS"`
3253
3254 if [ -z "$QT_INSTALL_PLUGINS" ]; then #default
3255     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3256         if [ "$BUILD_ON_MAC" = "yes" ]; then
3257             QT_INSTALL_PLUGINS="/Developer/Applications/Qt/plugins"
3258         fi
3259     fi
3260     [ -z "$QT_INSTALL_PLUGINS" ] && QT_INSTALL_PLUGINS="$QT_INSTALL_PREFIX/plugins" #fallback
3261 fi
3262 QT_INSTALL_PLUGINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PLUGINS"`
3263
3264 if [ -z "$QT_INSTALL_IMPORTS" ]; then #default
3265     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3266         if [ "$BUILD_ON_MAC" = "yes" ]; then
3267             QT_INSTALL_IMPORTS="/Developer/Applications/Qt/imports"
3268         fi
3269     fi
3270     [ -z "$QT_INSTALL_IMPORTS" ] && QT_INSTALL_IMPORTS="$QT_INSTALL_PREFIX/imports" #fallback
3271 fi
3272 QT_INSTALL_IMPORTS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_IMPORTS"`
3273
3274 if [ -z "$QT_INSTALL_DATA" ]; then #default
3275     QT_INSTALL_DATA="$QT_INSTALL_PREFIX"
3276 fi
3277 QT_INSTALL_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DATA"`
3278
3279 if [ -z "$QT_INSTALL_TRANSLATIONS" ]; then #default
3280     QT_INSTALL_TRANSLATIONS="$QT_INSTALL_PREFIX/translations"
3281 fi
3282 QT_INSTALL_TRANSLATIONS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TRANSLATIONS"`
3283
3284 if [ -z "$QT_INSTALL_SETTINGS" ]; then #default
3285     if [ "$BUILD_ON_MAC" = "yes" ]; then
3286         QT_INSTALL_SETTINGS=/Library/Preferences/Qt
3287     else
3288         QT_INSTALL_SETTINGS=/etc/xdg
3289     fi
3290 fi
3291 QT_INSTALL_SETTINGS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_SETTINGS"`
3292
3293 if [ -z "$QT_INSTALL_EXAMPLES" ]; then #default
3294     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3295         if [ "$BUILD_ON_MAC" = "yes" ]; then
3296             QT_INSTALL_EXAMPLES="/Developer/Examples/Qt"
3297         fi
3298     fi
3299     [ -z "$QT_INSTALL_EXAMPLES" ] && QT_INSTALL_EXAMPLES="$QT_INSTALL_PREFIX/examples" #fallback
3300 fi
3301 QT_INSTALL_EXAMPLES=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_EXAMPLES"`
3302
3303 #tests
3304 if [ -z "$QT_INSTALL_TESTS" ]; then #default
3305     if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3306         if [ "$BUILD_ON_MAC" = "yes" ]; then
3307             QT_INSTALL_TESTS="/Developer/Tests/Qt"
3308         fi
3309     fi
3310     [ -z "$QT_INSTALL_TESTS" ] && QT_INSTALL_TESTS="$QT_INSTALL_PREFIX/tests" #fallback
3311 fi
3312 QT_INSTALL_TESTS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TESTS"`
3313
3314 #-------------------------------------------------------------------------------
3315 # help - interactive parts of the script _after_ this section please
3316 #-------------------------------------------------------------------------------
3317
3318 # next, emit a usage message if something failed.
3319 if [ "$OPT_HELP" = "yes" ]; then
3320     [ "x$ERROR" = "xyes" ] && echo
3321     if [ "$CFG_NIS" = "no" ]; then
3322         NSY=" "
3323         NSN="*"
3324     else
3325         NSY="*"
3326         NSN=" "
3327     fi
3328     if [ "$CFG_CUPS" = "no" ]; then
3329         CUY=" "
3330         CUN="*"
3331     else
3332         CUY="*"
3333         CUN=" "
3334     fi
3335     if [ "$CFG_ICONV" = "no" ]; then
3336         CIY=" "
3337         CIN="*"
3338     else
3339         CIY="*"
3340         CIN=" "
3341     fi
3342     if [ "$CFG_LARGEFILE" = "no" ]; then
3343         LFSY=" "
3344         LFSN="*"
3345     else
3346         LFSY="*"
3347         LFSN=" "
3348     fi
3349     if [ "$CFG_STL" = "auto" ] || [ "$CFG_STL" = "yes" ]; then
3350         SHY="*"
3351         SHN=" "
3352     else
3353         SHY=" "
3354         SHN="*"
3355     fi
3356     if [ "$CFG_PRECOMPILE" = "auto" ] || [ "$CFG_PRECOMPILE" = "no" ]; then
3357         PHY=" "
3358         PHN="*"
3359     else
3360         PHY="*"
3361         PHN=" "
3362     fi
3363
3364     if [ "$CFG_XCB" = "no" ]; then
3365         XCBY=" "
3366         XCBN="*"
3367     else
3368         XCBY="*"
3369         XCBN=" "
3370     fi
3371
3372     if [ "$CFG_WAYLAND" = "no" ]; then
3373         XWY=" "
3374         XWN="*"
3375     else
3376         XWY="*"
3377         XWN=" "
3378     fi
3379     if [ "$CFG_XINPUT2" = "no" ]; then
3380         X2Y=" "
3381         X2N="*"
3382     else
3383         X2Y="*"
3384         X2N=" "
3385     fi
3386
3387     cat <<EOF
3388 Usage:  $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>]
3389         [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-importdir <dir>] [-datadir <dir>]
3390         [-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>] [-testsdir <dir>]
3391         [-release] [-debug] [-debug-and-release]
3392         [-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile]
3393         [-largefile] [-no-exceptions] [-exceptions] [-no-accessibility]
3394         [-accessibility] [-no-stl] [-stl] [-no-sql-<driver>] [-sql-<driver>]
3395         [-plugin-sql-<driver>] [-system-sqlite]
3396         [-platform] [-D <string>] [-I <string>] [-L <string>] [-help]
3397         [-qt-zlib] [-system-zlib] [-no-gif] [-no-libpng] [-qt-libpng] [-system-libpng]
3398         [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>]
3399         [-nomake <part>] [-R <string>]  [-l <string>] [-no-rpath]  [-rpath] [-continue]
3400         [-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [-no-iconv]
3401         [-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked] [-no-gui]
3402         [-no-separate-debug-info] [-no-mmx] [-no-3dnow] [-no-sse] [-no-sse2]
3403         [-no-sse3] [-no-ssse3] [-no-sse4.1] [-no-sse4.2] [-no-avx] [-no-neon]
3404         [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info] [-armfpa]
3405         [-no-phonon-backend] [-phonon-backend] [-no-media-backend] [-media-backend]
3406         [-no-audio-backend] [-audio-backend]
3407         [-no-javascript-jit] [-javascript-jit] [-no-declarative-debug] [-declarative-debug]
3408         [-no-optimized-qmake] [-optimized-qmake]
3409         [-no-openssl] [-openssl] [-openssl-linked]
3410         [-no-gtkstyle] [-gtkstyle]
3411         [-qt-pcre] [-system-pcre]
3412         [additional platform specific options (see below)]
3413
3414
3415 Installation options:
3416
3417     -qpa ................ This will enable the QPA build.
3418                           QPA is a window system agnostic implementation of Qt.
3419
3420  These are optional, but you may specify install directories.
3421
3422     -prefix <dir> ...... This will install everything relative to <dir>
3423                          (default $QT_INSTALL_PREFIX)
3424 EOF
3425 if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
3426 cat <<EOF
3427
3428     -hostprefix [dir] .. Tools and libraries needed when developing
3429                          applications are installed in [dir]. If [dir] is
3430                          not given, the current build directory will be used.
3431 EOF
3432 fi
3433 cat <<EOF
3434
3435   * -prefix-install .... Force a sandboxed "local" installation of
3436                          Qt. This will install into
3437                          $QT_INSTALL_PREFIX, if this option is
3438                          disabled then some platforms will attempt a
3439                          "system" install by placing default values to
3440                          be placed in a system location other than
3441                          PREFIX.
3442
3443  You may use these to separate different parts of the install:
3444
3445     -bindir <dir> ......... Executables will be installed to <dir>
3446                             (default PREFIX/bin)
3447     -libdir <dir> ......... Libraries will be installed to <dir>
3448                             (default PREFIX/lib)
3449     -docdir <dir> ......... Documentation will be installed to <dir>
3450                             (default PREFIX/doc)
3451     -headerdir <dir> ...... Headers will be installed to <dir>
3452                             (default PREFIX/include)
3453     -plugindir <dir> ...... Plugins will be installed to <dir>
3454                             (default PREFIX/plugins)
3455     -importdir <dir> ...... Imports for QML will be installed to <dir>
3456                             (default PREFIX/imports)
3457     -datadir <dir> ........ Data used by Qt programs will be installed to <dir>
3458                             (default PREFIX)
3459     -translationdir <dir> . Translations of Qt programs will be installed to <dir>
3460                             (default PREFIX/translations)
3461     -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir>
3462                             (default PREFIX/etc/settings)
3463     -examplesdir <dir> .... Examples will be installed to <dir>
3464                             (default PREFIX/examples)
3465     -testsdir <dir> ....... Tests will be installed to <dir>
3466                             (default PREFIX/tests)
3467
3468 Configure options:
3469
3470  The defaults (*) are usually acceptable. A plus (+) denotes a default value
3471  that needs to be evaluated. If the evaluation succeeds, the feature is
3472  included. Here is a short explanation of each option:
3473
3474  *  -release ........... Compile and link Qt with debugging turned off.
3475     -debug ............. Compile and link Qt with debugging turned on.
3476     -debug-and-release . Compile and link two versions of Qt, with and without
3477                          debugging turned on (Mac only).
3478
3479     -developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting)
3480
3481     -opensource ........ Compile and link the Open-Source Edition of Qt.
3482     -commercial ........ Compile and link the Commercial Edition of Qt.
3483
3484
3485  *  -shared ............ Create and use shared Qt libraries.
3486     -static ............ Create and use static Qt libraries.
3487
3488  *  -no-fast ........... Configure Qt normally by generating Makefiles for all
3489                          project files.
3490     -fast .............. Configure Qt quickly by generating Makefiles only for
3491                          library and subdirectory targets.  All other Makefiles
3492                          are created as wrappers, which will in turn run qmake.
3493
3494     -no-largefile ...... Disables large file support.
3495  +  -largefile ......... Enables Qt to access files larger than 4 GB.
3496
3497 EOF
3498 if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
3499     EXCN="*"
3500     EXCY=" "
3501 else
3502     EXCN=" "
3503     EXCY="*"
3504 fi
3505 if [ "$CFG_DBUS" = "no" ]; then
3506     DBY=" "
3507     DBN="+"
3508 else
3509     DBY="+"
3510     DBN=" "
3511 fi
3512
3513     cat << EOF
3514  $EXCN  -no-exceptions ..... Disable exceptions on compilers that support it.
3515  $EXCY  -exceptions ........ Enable exceptions on compilers that support it.
3516
3517     -no-accessibility .. Do not compile Accessibility support.
3518  *  -accessibility ..... Compile Accessibility support.
3519
3520  $SHN  -no-stl ............ Do not compile STL support.
3521  $SHY  -stl ............... Compile STL support.
3522
3523     -no-sql-<driver> ... Disable SQL <driver> entirely.
3524     -qt-sql-<driver> ... Enable a SQL <driver> in the QtSql library, by default
3525                          none are turned on.
3526     -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to
3527                          at run time.
3528
3529                          Possible values for <driver>:
3530                          [ $CFG_SQL_AVAILABLE ]
3531
3532     -system-sqlite ..... Use sqlite from the operating system.
3533
3534     -no-phonon-backend.. Do not build the platform phonon plugin.
3535  +  -phonon-backend..... Build the platform phonon plugin.
3536
3537     -no-javascript-jit . Do not build the JavaScriptCore JIT compiler.
3538  +  -javascript-jit .... Build the JavaScriptCore JIT compiler.
3539
3540     -no-declarative-debug ..... Do not build the declarative debugging support.
3541  +  -declarative-debug ....... Build the declarative debugging support.
3542
3543     -platform target ... The operating system and compiler you are building
3544                          on ($PLATFORM).
3545
3546                          See the README file for a list of supported
3547                          operating systems and compilers.
3548 EOF
3549
3550 if [ "${PLATFORM_QWS}" != "yes" -a "${PLATFORM_QPA}" != "yes" ]; then
3551 cat << EOF
3552     -graphicssystem <sys> Sets an alternate graphics system. Available options are:
3553                            raster - Software rasterizer
3554                            opengl - Rendering via OpenGL, Experimental!
3555                            openvg - Rendering via OpenVG, Experimental!
3556
3557 EOF
3558 fi
3559
3560 cat << EOF
3561
3562     -no-mmx ............ Do not compile with use of MMX instructions.
3563     -no-3dnow .......... Do not compile with use of 3DNOW instructions.
3564     -no-sse ............ Do not compile with use of SSE instructions.
3565     -no-sse2 ........... Do not compile with use of SSE2 instructions.
3566     -no-sse3 ........... Do not compile with use of SSE3 instructions.
3567     -no-ssse3 .......... Do not compile with use of SSSE3 instructions.
3568     -no-sse4.1.......... Do not compile with use of SSE4.1 instructions.
3569     -no-sse4.2.......... Do not compile with use of SSE4.2 instructions.
3570     -no-avx ............ Do not compile with use of AVX instructions.
3571     -no-neon ........... Do not compile with use of NEON instructions.
3572
3573     -qtnamespace <name>  Wraps all Qt library code in 'namespace <name> {...}'.
3574     -qtlibinfix <infix>  Renames all libQt*.so to libQt*<infix>.so.
3575
3576     -testcocoon          Instrument Qt with the TestCocoon code coverage tool.
3577
3578     -D <string> ........ Add an explicit define to the preprocessor.
3579     -I <string> ........ Add an explicit include path.
3580     -L <string> ........ Add an explicit library path.
3581
3582     -help, -h .......... Display this information.
3583
3584 Third Party Libraries:
3585
3586     -qt-zlib ........... Use the zlib bundled with Qt.
3587  +  -system-zlib ....... Use zlib from the operating system.
3588                          See http://www.gzip.org/zlib
3589
3590     -no-gif ............ Do not compile GIF reading support.
3591
3592     -no-libpng ......... Do not compile PNG support.
3593     -qt-libpng ......... Use the libpng bundled with Qt.
3594  +  -system-libpng ..... Use libpng from the operating system.
3595                          See http://www.libpng.org/pub/png
3596
3597     -no-libjpeg ........ Do not compile JPEG support.
3598     -qt-libjpeg ........ Use the libjpeg bundled with Qt.
3599  +  -system-libjpeg .... Use libjpeg from the operating system.
3600                          See http://www.ijg.org
3601
3602     -no-openssl ........ Do not compile support for OpenSSL.
3603  +  -openssl ........... Enable run-time OpenSSL support.
3604     -openssl-linked .... Enabled linked OpenSSL support.
3605
3606     -qt-pcre ........... Use the PCRE library bundled with Qt.
3607  +  -system-pcre ....... Use the PCRE library from the operating system.
3608
3609 Additional options:
3610
3611     -make <part> ....... Add part to the list of parts to be built at make time.
3612                          ($QT_DEFAULT_BUILD_PARTS)
3613     -nomake <part> ..... Exclude part from the list of parts to be built.
3614
3615     -R <string> ........ Add an explicit runtime library path to the Qt
3616                          libraries.
3617     -l <string> ........ Add an explicit library.
3618
3619     -no-rpath .......... Do not use the library install path as a runtime
3620                          library path.
3621  +  -rpath ............. Link Qt libraries and executables using the library
3622                          install path as a runtime library path. Equivalent
3623                          to -R install_libpath
3624
3625     -continue .......... Continue as far as possible if an error occurs.
3626
3627     -verbose, -v ....... Print verbose information about each step of the
3628                          configure process.
3629
3630     -silent ............ Reduce the build output so that warnings and errors
3631                          can be seen more easily.
3632
3633  *  -no-optimized-qmake ... Do not build qmake optimized.
3634     -optimized-qmake ...... Build qmake optimized.
3635
3636     -no-gui ............ Don't build the Qt GUI library
3637
3638  $NSN  -no-nis ............ Do not compile NIS support.
3639  $NSY  -nis ............... Compile NIS support.
3640
3641  $CUN  -no-cups ........... Do not compile CUPS support.
3642  $CUY  -cups .............. Compile CUPS support.
3643                          Requires cups/cups.h and libcups.so.2.
3644
3645  $CIN  -no-iconv .......... Do not compile support for iconv(3).
3646  $CIY  -iconv ............. Compile support for iconv(3).
3647
3648  $PHN  -no-pch ............ Do not use precompiled header support.
3649  $PHY  -pch ............... Use precompiled header support.
3650
3651  $DBN  -no-dbus ........... Do not compile the QtDBus module.
3652  $DBY  -dbus .............. Compile the QtDBus module and dynamically load libdbus-1.
3653     -dbus-linked ....... Compile the QtDBus module and link to libdbus-1.
3654
3655     -reduce-relocations ..... Reduce relocations in the libraries through extra
3656                               linker optimizations (Qt/X11 and Qt for Embedded Linux only;
3657                               experimental; needs GNU ld >= 2.18).
3658
3659     -force-asserts ........ Force Q_ASSERT to be enabled even in release builds.
3660
3661 EOF
3662
3663 if [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
3664     if [ "$QT_CROSS_COMPILE" = "yes" ]; then
3665         SBY=""
3666         SBN="*"
3667     else
3668         SBY="*"
3669         SBN=" "
3670     fi
3671 elif [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
3672     SBY="*"
3673     SBN=" "
3674 else
3675     SBY=" "
3676     SBN="*"
3677 fi
3678
3679 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
3680
3681     cat << EOF
3682
3683  $SBN  -no-separate-debug-info . Do not store debug information in a separate file.
3684  $SBY  -separate-debug-info .... Strip debug information into a separate .debug file.
3685
3686  $XCBN  -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support.
3687  $XCBY  -xcb ............... Compile Xcb support.
3688
3689  $XWN  -no-wayland......... Do not compile Wayland support.
3690  $XWY  -wayland  .......... Compile Wayland support.
3691
3692 EOF
3693
3694 fi # X11/QWS
3695
3696 if [ "$XPLATFORM_MAEMO" = "yes" ]; then
3697
3698     cat << EOF
3699
3700  $X2N  -no-xinput2......... Do not compile XInput2 support.
3701  $X2Y  -xinput2............ Compile XInput2 support.
3702
3703 EOF
3704
3705 fi
3706
3707 if [ "$PLATFORM_X11" = "yes" ]; then
3708     if [ "$CFG_SM" = "no" ]; then
3709         SMY=" "
3710         SMN="*"
3711     else
3712         SMY="*"
3713         SMN=" "
3714     fi
3715     if [ "$CFG_XSHAPE" = "no" ]; then
3716         SHY=" "
3717         SHN="*"
3718     else
3719         SHY="*"
3720         SHN=" "
3721     fi
3722     if [ "$CFG_XVIDEO" = "no" ]; then
3723         XVY=" "
3724         XVN="*"
3725     else
3726         XVY="*"
3727         XVN=" "
3728     fi
3729     if [ "$CFG_XINERAMA" = "no" ]; then
3730         XAY=" "
3731         XAN="*"
3732     else
3733         XAY="*"
3734         XAN=" "
3735     fi
3736     if [ "$CFG_FONTCONFIG" = "no" ]; then
3737         FCGY=" "
3738         FCGN="*"
3739     else
3740         FCGY="*"
3741         FCGN=" "
3742     fi
3743     if [ "$CFG_XCURSOR" = "no" ]; then
3744         XCY=" "
3745         XCN="*"
3746     else
3747         XCY="*"
3748         XCN=" "
3749     fi
3750     if [ "$CFG_XFIXES" = "no" ]; then
3751         XFY=" "
3752         XFN="*"
3753     else
3754         XFY="*"
3755         XFN=" "
3756     fi
3757     if [ "$CFG_XRANDR" = "no" ]; then
3758         XZY=" "
3759         XZN="*"
3760     else
3761         XZY="*"
3762         XZN=" "
3763     fi
3764     if [ "$CFG_XRENDER" = "no" ]; then
3765         XRY=" "
3766         XRN="*"
3767     else
3768         XRY="*"
3769         XRN=" "
3770     fi
3771     if [ "$CFG_MITSHM" = "no" ]; then
3772         XMY=" "
3773         XMN="*"
3774     else
3775         XMY="*"
3776         XMN=" "
3777     fi
3778     if [ "$CFG_XINPUT" = "no" ]; then
3779         XIY=" "
3780         XIN="*"
3781     else
3782         XIY="*"
3783         XIN=" "
3784     fi
3785     if [ "$CFG_XKB" = "no" ]; then
3786         XKY=" "
3787         XKN="*"
3788     else
3789         XKY="*"
3790         XKN=" "
3791     fi
3792     if [ "$CFG_IM" = "no" ]; then
3793         IMY=" "
3794         IMN="*"
3795     else
3796         IMY="*"
3797         IMN=" "
3798     fi
3799     cat << EOF
3800
3801 Qt/X11 only:
3802
3803     -no-gtkstyle ....... Do not build the GTK theme integration.
3804  +  -gtkstyle .......... Build the GTK theme integration.
3805
3806  *  -no-nas-sound ...... Do not compile in NAS sound support.
3807     -system-nas-sound .. Use NAS libaudio from the operating system.
3808                          See http://radscan.com/nas.html
3809
3810     -egl ............... Use EGL instead of GLX to manage contexts.
3811                          When building for desktop OpenGL, this option will
3812                          make Qt use EGL to manage contexts rather than the
3813                          GLX, which is the default. Note: For OpenGL ES, EGL
3814                          is always used.
3815
3816     -no-opengl ......... Do not support OpenGL.
3817  +  -opengl <api> ...... Enable OpenGL support.
3818                          With no parameter, this will auto-detect the "best"
3819                          OpenGL API to use. If desktop OpenGL is available, it
3820                          will be used. Use desktop or es2 for <api>
3821                          to force the use of the Desktop OpenGL or
3822                          OpenGL ES 2 APIs instead.
3823
3824      -no-openvg ........ Do not support OpenVG.
3825  +   -openvg ........... Enable OpenVG support.
3826                          Requires EGL support, typically supplied by an OpenGL
3827                          or other graphics implementation.
3828
3829  $SMN  -no-sm ............. Do not support X Session Management.
3830  $SMY  -sm ................ Support X Session Management, links in -lSM -lICE.
3831
3832  $SHN  -no-xshape ......... Do not compile XShape support.
3833  $SHY  -xshape ............ Compile XShape support.
3834                          Requires X11/extensions/shape.h.
3835
3836  $XVN  -no-xvideo ......... Do not compile XVideo support.
3837  $XVY  -xvideo ............ Compile XVideo support.
3838                          Requires X11/extensions/Xv.h & Xvlib.h.
3839
3840  $SHN  -no-xsync .......... Do not compile XSync support.
3841  $SHY  -xsync ............. Compile XSync support.
3842                          Requires X11/extensions/sync.h.
3843
3844  $XAN  -no-xinerama ....... Do not compile Xinerama (multihead) support.
3845  $XAY  -xinerama .......... Compile Xinerama support.
3846                          Requires X11/extensions/Xinerama.h and libXinerama.
3847                          By default, Xinerama support will be compiled if
3848                          available and the shared libraries are dynamically
3849                          loaded at runtime.
3850
3851  $XCN  -no-xcursor ........ Do not compile Xcursor support.
3852  $XCY  -xcursor ........... Compile Xcursor support.
3853                          Requires X11/Xcursor/Xcursor.h and libXcursor.
3854                          By default, Xcursor support will be compiled if
3855                          available and the shared libraries are dynamically
3856                          loaded at runtime.
3857
3858  $XFN  -no-xfixes ......... Do not compile Xfixes support.
3859  $XFY  -xfixes ............ Compile Xfixes support.
3860                          Requires X11/extensions/Xfixes.h and libXfixes.
3861                          By default, Xfixes support will be compiled if
3862                          available and the shared libraries are dynamically
3863                          loaded at runtime.
3864
3865  $XZN  -no-xrandr ......... Do not compile Xrandr (resize and rotate) support.
3866  $XZY  -xrandr ............ Compile Xrandr support.
3867                          Requires X11/extensions/Xrandr.h and libXrandr.
3868
3869  $XRN  -no-xrender ........ Do not compile Xrender support.
3870  $XRY  -xrender ........... Compile Xrender support.
3871                          Requires X11/extensions/Xrender.h and libXrender.
3872
3873  $XMN  -no-mitshm ......... Do not compile MIT-SHM support.
3874  $XMY  -mitshm ............ Compile MIT-SHM support.
3875                          Requires sys/ipc.h, sys/shm.h and X11/extensions/XShm.h
3876
3877  $FCGN  -no-fontconfig ..... Do not compile FontConfig (anti-aliased font) support.
3878  $FCGY  -fontconfig ........ Compile FontConfig support.
3879                          Requires fontconfig/fontconfig.h, libfontconfig,
3880                          freetype.h and libfreetype.
3881
3882  $XIN  -no-xinput ......... Do not compile Xinput support.
3883  $XIY  -xinput ............ Compile Xinput support. This also enabled tablet support
3884                          which requires IRIX with wacom.h and libXi or
3885                          XFree86 with X11/extensions/XInput.h and libXi.
3886
3887  $XKN  -no-xkb ............ Do not compile XKB (X KeyBoard extension) support.
3888  $XKY  -xkb ............... Compile XKB support.
3889
3890 EOF
3891 fi
3892
3893 if [ "$BUILD_ON_MAC" = "yes" ]; then
3894     cat << EOF
3895
3896 Qt/Mac only:
3897
3898     -Fstring ........... Add an explicit framework path.
3899     -fw string ......... Add an explicit framework.
3900
3901  *  -framework ......... Build Qt as a series of frameworks and
3902                          link tools against those frameworks.
3903     -no-framework ...... Do not build Qt as a series of frameworks.
3904
3905  *  -dwarf2 ............ Enable dwarf2 debugging symbols.
3906     -no-dwarf2 ......... Disable dwarf2 debugging symbols.
3907
3908     -arch <arch> ....... Build Qt for <arch>. Supported arch values: x86 x86_64.
3909                          Only one arch value can be specified.
3910
3911     -sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. This option requires gcc 4.
3912                          To use a different SDK with gcc 3.3, set the SDKROOT environment variable.
3913
3914     -harfbuzz .......... Use HarfBuzz to do text layout instead of Core Text when possible.
3915  *  -no-harfbuzz ....... Disable HarfBuzz on Mac. It can still be enabled by setting
3916                          QT_ENABLE_HARFBUZZ environment variable.
3917
3918 EOF
3919 fi
3920
3921 if [ "$PLATFORM_QWS" = "yes" ]; then
3922     cat << EOF
3923 Qt for Embedded Linux:
3924
3925     -embedded <arch> .... This will enable the embedded build, you must have a
3926                           proper license for this switch to work.
3927                           Example values for <arch>: arm mips x86 generic
3928 EOF
3929 fi
3930
3931 if [ "$PLATFORM_QPA" = "yes" ]; then
3932     cat << EOF
3933 Qt for QPA only:
3934 EOF
3935 fi
3936
3937 if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
3938     cat << EOF
3939
3940     -xplatform target ... The target platform when cross-compiling.
3941
3942     -no-feature-<feature> Do not compile in <feature>.
3943     -feature-<feature> .. Compile in <feature>. The available features
3944                           are described in src/corelib/global/qfeatures.txt
3945
3946     -armfpa ............. Target platform uses the ARM-FPA floating point format.
3947     -no-armfpa .......... Target platform does not use the ARM-FPA floating point format.
3948
3949                           The floating point format is usually autodetected by configure. Use this
3950                           to override the detected value.
3951
3952     -little-endian ...... Target platform is little endian (LSB first).
3953     -big-endian ......... Target platform is big endian (MSB first).
3954
3955     -host-little-endian . Host platform is little endian (LSB first).
3956     -host-big-endian .... Host platform is big endian (MSB first).
3957
3958                           You only need to specify the endianness when
3959                           cross-compiling, otherwise the host
3960                           endianness will be used.
3961
3962     -no-freetype ........ Do not compile in Freetype2 support.
3963     -qt-freetype ........ Use the libfreetype bundled with Qt.
3964  *  -system-freetype .... Use libfreetype from the operating system.
3965                           See http://www.freetype.org/
3966
3967     -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the
3968                           default ($CFG_QCONFIG).
3969
3970     -no-opengl .......... Do not support OpenGL.
3971     -opengl <api> ....... Enable OpenGL ES support
3972                           With no parameter, this will attempt to auto-detect
3973                           OpenGL ES 2, or regular desktop OpenGL.
3974                           Use es2 for <api> to override auto-detection.
3975 EOF
3976 fi
3977
3978 if [ "$PLATFORM_QWS" = "yes" ]; then
3979     cat << EOF
3980
3981     -depths <list> ...... Comma-separated list of supported bit-per-pixel
3982                           depths, from: 1, 4, 8, 12, 15, 16, 18, 24, 32 and 'all'.
3983
3984     -qt-decoration-<style> ....Enable a decoration <style> in the QtGui library,
3985                                by default all available decorations are on.
3986                                Possible values for <style>: [ $CFG_DECORATION_AVAILABLE ]
3987     -plugin-decoration-<style> Enable decoration <style> as a plugin to be
3988                                linked to at run time.
3989                                Possible values for <style>: [ $CFG_DECORATION_PLUGIN_AVAILABLE ]
3990     -no-decoration-<style> ....Disable decoration <style> entirely.
3991                                Possible values for <style>: [ $CFG_DECORATION_AVAILABLE ]
3992
3993     -qt-gfx-<driver> ... Enable a graphics <driver> in the QtGui library.
3994                          Possible values for <driver>: [ $CFG_GFX_AVAILABLE ]
3995     -plugin-gfx-<driver> Enable graphics <driver> as a plugin to be
3996                          linked to at run time.
3997                          Possible values for <driver>: [ $CFG_GFX_PLUGIN_AVAILABLE ]
3998     -no-gfx-<driver> ... Disable graphics <driver> entirely.
3999                          Possible values for <driver>: [ $CFG_GFX_AVAILABLE ]
4000
4001     -qt-kbd-<driver> ... Enable a keyboard <driver> in the QtGui library.
4002                          Possible values for <driver>: [ $CFG_KBD_AVAILABLE ]
4003
4004     -plugin-kbd-<driver> Enable keyboard <driver> as a plugin to be linked to
4005                          at runtime.
4006                          Possible values for <driver>: [ $CFG_KBD_PLUGIN_AVAILABLE ]
4007
4008     -no-kbd-<driver> ... Disable keyboard <driver> entirely.
4009                          Possible values for <driver>: [ $CFG_KBD_AVAILABLE ]
4010
4011     -qt-mouse-<driver> ... Enable a mouse <driver> in the QtGui library.
4012                            Possible values for <driver>: [ $CFG_MOUSE_AVAILABLE ]
4013     -plugin-mouse-<driver> Enable mouse <driver> as a plugin to be linked to
4014                            at runtime.
4015                            Possible values for <driver>: [ $CFG_MOUSE_PLUGIN_AVAILABLE ]
4016     -no-mouse-<driver> ... Disable mouse <driver> entirely.
4017                            Possible values for <driver>: [ $CFG_MOUSE_AVAILABLE ]
4018
4019     -iwmmxt ............ Compile using the iWMMXt instruction set
4020                          (available on some XScale CPUs).
4021 EOF
4022 fi
4023
4024 if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" -o "$PLATFORM_X11" = "yes" ]; then
4025     if [ "$CFG_GLIB" = "no" ]; then
4026         GBY=" "
4027         GBN="+"
4028     else
4029         GBY="+"
4030         GBN=" "
4031     fi
4032     cat << EOF
4033  $GBN  -no-glib ........... Do not compile Glib support.
4034  $GBY  -glib .............. Compile Glib support.
4035
4036 EOF
4037 fi
4038
4039    [ "x$ERROR" = "xyes" ] && exit 1
4040    exit 0
4041 fi # Help
4042
4043
4044 # -----------------------------------------------------------------------------
4045 # LICENSING, INTERACTIVE PART
4046 # -----------------------------------------------------------------------------
4047
4048 if [ "$PLATFORM_QWS" = "yes" ]; then
4049     Platform="Qt for Embedded Linux"
4050 elif [ "$PLATFORM_QPA" = "yes" ]; then
4051     Platform="Qt Lighthouse"
4052 elif [ "$XPLATFORM_MINGW" = "yes" ]; then
4053     Platform="Qt for Windows"
4054 elif [ '!' -z "`getQMakeConf \"$XQMAKESPEC\" | grep QMAKE_LIBS_X11 | awk '{print $3;}'`" ]; then
4055     PLATFORM_X11=yes
4056     Platform="Qt for Linux/X11"
4057 fi
4058
4059 echo
4060 echo "This is the $Platform ${EditionString} Edition."
4061 echo
4062
4063 if [ "$Edition" = "OpenSource" ]; then
4064     while true; do
4065         echo "You are licensed to use this software under the terms of"
4066         echo "the Lesser GNU General Public License (LGPL) versions 2.1."
4067         if [ -f "$relpath/LICENSE.GPL3" ]; then
4068             echo "You are also licensed to use this software under the terms of"
4069             echo "the GNU General Public License (GPL) versions 3."
4070             affix="either"
4071         else
4072             affix="the"
4073         fi
4074         echo
4075         if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
4076             echo "You have already accepted the terms of the $LicenseType license."
4077             acceptance=yes
4078         else
4079             if [ -f "$relpath/LICENSE.GPL3" ]; then
4080                 echo "Type '3' to view the GNU General Public License version 3."
4081             fi
4082             echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
4083             echo "Type 'yes' to accept this license offer."
4084             echo "Type 'no' to decline this license offer."
4085             echo
4086             echo $ECHO_N "Do you accept the terms of $affix license? $ECHO_C"
4087             read acceptance
4088         fi
4089         echo
4090         if [ "$acceptance" = "yes" ] || [ "$acceptance" = "y" ]; then
4091             break
4092         elif [ "$acceptance" = "no" ]; then
4093             echo "You are not licensed to use this software."
4094             echo
4095             exit 1
4096         elif [ "$acceptance" = "3" ]; then
4097             more "$relpath/LICENSE.GPL3"
4098         elif [ "$acceptance" = "L" ]; then
4099             more "$relpath/LICENSE.LGPL"
4100         fi
4101     done
4102 elif [ "$Edition" = "Preview" ]; then
4103     TheLicense=`head -n 1 "$relpath/LICENSE.PREVIEW.COMMERCIAL"`
4104     while true; do
4105
4106         if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
4107             echo "You have already accepted the terms of the $LicenseType license."
4108             acceptance=yes
4109         else
4110             echo "You are licensed to use this software under the terms of"
4111             echo "the $TheLicense"
4112             echo
4113             echo "Type '?' to read the Preview License."
4114             echo "Type 'yes' to accept this license offer."
4115             echo "Type 'no' to decline this license offer."
4116             echo
4117             echo $ECHO_N "Do you accept the terms of the license? $ECHO_C"
4118             read acceptance
4119         fi
4120         echo
4121         if [ "$acceptance" = "yes" ]; then
4122             break
4123         elif [ "$acceptance" = "no" ] ;then
4124             echo "You are not licensed to use this software."
4125             echo
4126             exit 0
4127         elif [ "$acceptance" = "?" ]; then
4128             more "$relpath/LICENSE.PREVIEW.COMMERCIAL"
4129         fi
4130     done
4131 elif [ "$Edition" != "OpenSource" ]; then
4132     if [ -n "$ExpiryDate" ]; then
4133         ExpiryDate=`echo $ExpiryDate | sed -e "s,-,,g" | tr -d "\n\r"`
4134         [ -z "$ExpiryDate" ] && ExpiryDate="0"
4135         Today=`date +%Y%m%d`
4136         if [ "$Today" -gt "$ExpiryDate" ]; then
4137             case "$LicenseType" in
4138             Commercial|Academic|Educational)
4139                 if [ "$QT_PACKAGEDATE" -gt "$ExpiryDate" ]; then
4140                     echo
4141                     echo "NOTICE  NOTICE  NOTICE  NOTICE"
4142                     echo
4143                     echo "  Your support and upgrade period has expired."
4144                     echo
4145                     echo "  You are no longer licensed to use this version of Qt."
4146                     echo "  Please contact qt-info@nokia.com to renew your support"
4147                     echo "  and upgrades for this license."
4148                     echo
4149                     echo "NOTICE  NOTICE  NOTICE  NOTICE"
4150                     echo
4151                     exit 1
4152                 else
4153                     echo
4154                     echo "WARNING  WARNING  WARNING  WARNING"
4155                     echo
4156                     echo "  Your support and upgrade period has expired."
4157                     echo
4158                     echo "  You may continue to use your last licensed release"
4159                     echo "  of Qt under the terms of your existing license"
4160                     echo "  agreement. But you are not entitled to technical"
4161                     echo "  support, nor are you entitled to use any more recent"
4162                     echo "  Qt releases."
4163                     echo
4164                     echo "  Please contact qt-info@nokia.com to renew your"
4165                     echo "  support and upgrades for this license."
4166                     echo
4167                     echo "WARNING  WARNING  WARNING  WARNING"
4168                     echo
4169                     sleep 3
4170                 fi
4171                 ;;
4172             Evaluation|*)
4173                 echo
4174                 echo "NOTICE  NOTICE  NOTICE  NOTICE"
4175                 echo
4176                 echo "  Your Evaluation license has expired."
4177                 echo
4178                 echo "  You are no longer licensed to use this software. Please"
4179                 echo "  contact qt-info@nokia.com to purchase license, or install"
4180                 echo "  the Qt Open Source Edition if you intend to develop free"
4181                 echo "  software."
4182                 echo
4183                 echo "NOTICE  NOTICE  NOTICE  NOTICE"
4184                 echo
4185                 exit 1
4186                 ;;
4187             esac
4188         fi
4189     fi
4190     TheLicense=`head -n 1 "$outpath/LICENSE"`
4191     while true; do
4192         if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
4193             echo "You have already accepted the terms of the $TheLicense."
4194             acceptance=yes
4195         else
4196             echo "You are licensed to use this software under the terms of"
4197             echo "the $TheLicense."
4198             echo
4199             echo "Type '?' to view the $TheLicense."
4200             echo "Type 'yes' to accept this license offer."
4201             echo "Type 'no' to decline this license offer."
4202             echo
4203             echo $ECHO_N "Do you accept the terms of the $TheLicense? $ECHO_C"
4204             read acceptance
4205         fi
4206         echo
4207         if [ "$acceptance" = "yes" ]; then
4208             break
4209         elif [ "$acceptance" = "no" ]; then
4210             echo "You are not licensed to use this software."
4211             echo
4212             exit 1
4213         else [ "$acceptance" = "?" ]
4214             more "$outpath/LICENSE"
4215         fi
4216     done
4217 fi
4218
4219 # this should be moved somewhere else
4220 case "$PLATFORM" in
4221 aix-*)
4222     AIX_VERSION=`uname -v`
4223     if [ "$AIX_VERSION" -lt "5" ]; then
4224         QMakeVar add QMAKE_LIBS_X11 -lbind
4225     fi
4226     ;;
4227 *)
4228     ;;
4229 esac
4230
4231 #-------------------------------------------------------------------------------
4232 # generate qconfig.cpp
4233 #-------------------------------------------------------------------------------
4234 [ -d "$outpath/src/corelib/global" ] || mkdir -p "$outpath/src/corelib/global"
4235
4236 LICENSE_USER_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_lcnsuser=$Licensee"`
4237 LICENSE_PRODUCTS_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_lcnsprod=$Edition"`
4238 PREFIX_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_prfxpath=$QT_INSTALL_PREFIX"`
4239 DOCUMENTATION_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_docspath=$QT_INSTALL_DOCS"`
4240 HEADERS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_hdrspath=$QT_INSTALL_HEADERS"`
4241 LIBRARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_libspath=$QT_INSTALL_LIBS"`
4242 BINARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_binspath=$QT_INSTALL_BINS"`
4243 PLUGINS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_plugpath=$QT_INSTALL_PLUGINS"`
4244 IMPORTS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_impspath=$QT_INSTALL_IMPORTS"`
4245 DATA_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_datapath=$QT_INSTALL_DATA"`
4246 TRANSLATIONS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_trnspath=$QT_INSTALL_TRANSLATIONS"`
4247 SETTINGS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_stngpath=$QT_INSTALL_SETTINGS"`
4248 EXAMPLES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_xmplpath=$QT_INSTALL_EXAMPLES"`
4249 TESTS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_tstspath=$QT_INSTALL_TESTS"`
4250
4251 TODAY=`date +%Y-%m-%d`
4252 cat > "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
4253 /* License Info */
4254 static const char qt_configure_licensee_str          [256 + 12] = "$LICENSE_USER_STR";
4255 static const char qt_configure_licensed_products_str [256 + 12] = "$LICENSE_PRODUCTS_STR";
4256
4257 /* Installation date */
4258 static const char qt_configure_installation          [12+11]    = "qt_instdate=$TODAY";
4259 EOF
4260
4261
4262 if [ ! -z "$QT_HOST_PREFIX" ]; then
4263     HOSTPREFIX_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_prfxpath=$QT_HOST_PREFIX"`
4264     HOSTDOCUMENTATION_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_docspath=$QT_HOST_PREFIX/doc"`
4265     HOSTHEADERS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_hdrspath=$QT_HOST_PREFIX/include"`
4266     HOSTLIBRARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_libspath=$QT_HOST_PREFIX/lib"`
4267     HOSTBINARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_binspath=$QT_HOST_PREFIX/bin"`
4268     HOSTPLUGINS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_plugpath=$QT_HOST_PREFIX/plugins"`
4269     HOSTIMPORTS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_impspath=$QT_HOST_PREFIX/IMPORTS"`
4270     HOSTDATA_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_datapath=$QT_HOST_PREFIX"`
4271     HOSTTRANSLATIONS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_trnspath=$QT_HOST_PREFIX/translations"`
4272     HOSTSETTINGS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_stngpath=$QT_INSTALL_SETTINGS"`
4273     HOSTEXAMPLES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_xmplpath=$QT_INSTALL_EXAMPLES"`
4274     HOSTTESTS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_tstspath=$QT_INSTALL_TESTS"`
4275
4276     cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
4277
4278 #if defined(QT_BOOTSTRAPPED) || defined(QT_BUILD_QMAKE)
4279 /* Installation Info */
4280 static const char qt_configure_prefix_path_str       [256 + 12] = "$HOSTPREFIX_PATH_STR";
4281 static const char qt_configure_documentation_path_str[256 + 12] = "$HOSTDOCUMENTATION_PATH_STR";
4282 static const char qt_configure_headers_path_str      [256 + 12] = "$HOSTHEADERS_PATH_STR";
4283 static const char qt_configure_libraries_path_str    [256 + 12] = "$HOSTLIBRARIES_PATH_STR";
4284 static const char qt_configure_binaries_path_str     [256 + 12] = "$HOSTBINARIES_PATH_STR";
4285 static const char qt_configure_plugins_path_str      [256 + 12] = "$HOSTPLUGINS_PATH_STR";
4286 static const char qt_configure_imports_path_str      [256 + 12] = "$HOSTIMPORTS_PATH_STR";
4287 static const char qt_configure_data_path_str         [256 + 12] = "$HOSTDATA_PATH_STR";
4288 static const char qt_configure_translations_path_str [256 + 12] = "$HOSTTRANSLATIONS_PATH_STR";
4289 static const char qt_configure_settings_path_str     [256 + 12] = "$HOSTSETTINGS_PATH_STR";
4290 static const char qt_configure_examples_path_str     [256 + 12] = "$HOSTEXAMPLES_PATH_STR";
4291 static const char qt_configure_tests_path_str        [256 + 12] = "$HOSTTESTS_PATH_STR";
4292 #else // QT_BOOTSTRAPPED
4293 EOF
4294 fi
4295
4296 cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
4297 /* Installation Info */
4298 static const char qt_configure_prefix_path_str       [256 + 12] = "$PREFIX_PATH_STR";
4299 static const char qt_configure_documentation_path_str[256 + 12] = "$DOCUMENTATION_PATH_STR";
4300 static const char qt_configure_headers_path_str      [256 + 12] = "$HEADERS_PATH_STR";
4301 static const char qt_configure_libraries_path_str    [256 + 12] = "$LIBRARIES_PATH_STR";
4302 static const char qt_configure_binaries_path_str     [256 + 12] = "$BINARIES_PATH_STR";
4303 static const char qt_configure_plugins_path_str      [256 + 12] = "$PLUGINS_PATH_STR";
4304 static const char qt_configure_imports_path_str      [256 + 12] = "$IMPORTS_PATH_STR";
4305 static const char qt_configure_data_path_str         [256 + 12] = "$DATA_PATH_STR";
4306 static const char qt_configure_translations_path_str [256 + 12] = "$TRANSLATIONS_PATH_STR";
4307 static const char qt_configure_settings_path_str     [256 + 12] = "$SETTINGS_PATH_STR";
4308 static const char qt_configure_examples_path_str     [256 + 12] = "$EXAMPLES_PATH_STR";
4309 static const char qt_configure_tests_path_str        [256 + 12] = "$TESTS_PATH_STR";
4310 EOF
4311
4312 if [ ! -z "$QT_HOST_PREFIX" ]; then
4313     cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
4314 #endif // QT_BOOTSTRAPPED
4315
4316 EOF
4317 fi
4318
4319 cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
4320 /* strlen( "qt_lcnsxxxx" ) == 12 */
4321 #define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;
4322 #define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;
4323 #define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12;
4324 #define QT_CONFIGURE_DOCUMENTATION_PATH qt_configure_documentation_path_str + 12;
4325 #define QT_CONFIGURE_HEADERS_PATH qt_configure_headers_path_str + 12;
4326 #define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;
4327 #define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;
4328 #define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;
4329 #define QT_CONFIGURE_IMPORTS_PATH qt_configure_imports_path_str + 12;
4330 #define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;
4331 #define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;
4332 #define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;
4333 #define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;
4334 #define QT_CONFIGURE_TESTS_PATH qt_configure_tests_path_str + 12;
4335 EOF
4336
4337 # avoid unecessary rebuilds by copying only if qconfig.cpp has changed
4338 if cmp -s "$outpath/src/corelib/global/qconfig.cpp" "$outpath/src/corelib/global/qconfig.cpp.new"; then
4339     rm -f "$outpath/src/corelib/global/qconfig.cpp.new"
4340 else
4341     [ -f "$outpath/src/corelib/global/qconfig.cpp" ] && chmod +w "$outpath/src/corelib/global/qconfig.cpp"
4342     mv "$outpath/src/corelib/global/qconfig.cpp.new" "$outpath/src/corelib/global/qconfig.cpp"
4343     chmod -w "$outpath/src/corelib/global/qconfig.cpp"
4344 fi
4345
4346 # -----------------------------------------------------------------------------
4347 if [ "$LicenseType" = "Evaluation" ]; then
4348     EVALKEY=`"$relpath/config.tests/unix/padstring" 524 "qt_qevalkey=$LicenseKeyExt"`
4349 elif echo "$D_FLAGS" | grep QT_EVAL >/dev/null 2>&1; then
4350     EVALKEY=`"$relpath/config.tests/unix/padstring" 524 "qt_qevalkey="`
4351 fi
4352
4353 if [ -n "$EVALKEY" ]; then
4354     rm -f "$outpath/src/corelib/global/qconfig_eval.cpp"
4355     cat > "$outpath/src/corelib/global/qconfig_eval.cpp" <<EOF
4356 /* Evaluation license key */
4357 static const volatile char qt_eval_key_data                   [512 + 12] = "$EVALKEY";
4358 EOF
4359     chmod -w "$outpath/src/corelib/global/qconfig_eval.cpp"
4360 fi
4361
4362
4363 # -----------------------------------------------------------------------------
4364 # build qmake
4365 # -----------------------------------------------------------------------------
4366
4367 # symlink includes
4368 if [ -n "$PERL" ] && [ -x "$relpath/bin/syncqt" ]; then
4369     SYNCQT_OPTS=
4370     [ "$CFG_DEV" = "yes" ] && SYNCQT_OPTS="$SYNCQT_OPTS -check-includes"
4371     if [ "$OPT_SHADOW" = "yes" ]; then
4372         "$outpath/bin/syncqt" $SYNCQT_OPTS "$relpath" || exit 1
4373     elif [ "$CFG_DEV" = "yes" ] || [ ! -d $relpath/include ] || [ -d $relpath/.git ]; then
4374         QTDIR="$relpath" perl "$outpath/bin/syncqt" $SYNCQT_OPTS || exit 1
4375     fi
4376 fi
4377
4378 # $1: variable name
4379 # $2: optional transformation
4380 # relies on $QMAKESPEC, $COMPILER_CONF and $mkfile being set correctly, as the latter
4381 # is where the resulting variable is written to
4382 # Assumes that the optional transformation produces the same variable name for each hit
4383 setBootstrapVariable()
4384 {
4385     getQMakeConf | $AWK '/^('"$1"')[^_A-Z0-9]/ { print $0; }' | ( [ -n "$2" ] && sed "$2" ; [ -z "$2" ] && cat ) | $AWK '
4386 BEGIN {
4387     variable = ""
4388     combinedValue = ""
4389 }
4390 {
4391     valStart = index($0, "=") + 1
4392
4393     append = 0
4394     if (substr($0, valStart - 2, 1) == "+") {
4395         append = 1
4396     }
4397
4398     variable = substr($0, 0, valStart - 2 - append)
4399     value = substr($0, valStart)
4400     gsub("[ \t]+", "", variable)
4401     gsub("^[ \t]+", "", value)
4402     gsub("[ \t]+$", "", value)
4403
4404     if (append == 1 && length(combinedValue) > 0) {
4405         combinedValue = combinedValue " " value
4406     } else {
4407         combinedValue = value
4408     }
4409 }
4410 END {
4411     if (length(combinedValue) > 0) {
4412         printf "%s = %s\n", variable, combinedValue
4413     }
4414 }' >> "$mkfile"
4415 }
4416
4417 # build qmake
4418 if true; then ###[ '!' -f "$outpath/bin/qmake" ];
4419     echo "Creating qmake. Please wait..."
4420
4421     OLD_QCONFIG_H=
4422     QCONFIG_H="$outpath/src/corelib/global/qconfig.h"
4423     QMAKE_QCONFIG_H="${QCONFIG_H}.qmake"
4424     if [ -f "$QCONFIG_H" ]; then
4425          OLD_QCONFIG_H=$QCONFIG_H
4426          mv -f "$OLD_QCONFIG_H" "${OLD_QCONFIG_H}.old"
4427     fi
4428
4429     # create temporary qconfig.h for compiling qmake, if it doesn't exist
4430     # when building qmake, we use #defines for the install paths,
4431     # however they are real functions in the library
4432     if [ '!' -f "$QMAKE_QCONFIG_H" ]; then
4433         mkdir -p "$outpath/src/corelib/global"
4434         [ -f "$QCONFIG_H" ] && chmod +w "$QCONFIG_H"
4435         echo "/* All features enabled while building qmake */" >"$QMAKE_QCONFIG_H"
4436     fi
4437
4438     mv -f "$QMAKE_QCONFIG_H" "$QCONFIG_H"
4439
4440     #mkspecs/default is used as a (gasp!) default mkspec so QMAKESPEC needn't be set once configured
4441     rm -rf mkspecs/default
4442     ln -s `echo $XQMAKESPEC | sed "s,^${relpath}/mkspecs/,,"` mkspecs/default
4443     # fix makefiles
4444     for mkfile in GNUmakefile Makefile; do
4445         EXTRA_LFLAGS=
4446         EXTRA_CFLAGS=
4447         in_mkfile="${mkfile}.in"
4448         if [ "$mkfile" = "Makefile" ]; then
4449 #           if which qmake >/dev/null 2>&1 && [ -f qmake/qmake.pro ]; then
4450 #               (cd qmake && qmake) >/dev/null 2>&1 && continue
4451 #           fi
4452             in_mkfile="${mkfile}.unix"
4453         fi
4454         in_mkfile="$relpath/qmake/$in_mkfile"
4455         mkfile="$outpath/qmake/$mkfile"
4456         if [ -f "$mkfile" ]; then
4457             [ "$CFG_DEV" = "yes" ] && "$WHICH" chflags >/dev/null 2>&1 && chflags nouchg "$mkfile"
4458             rm -f "$mkfile"
4459         fi
4460         [ -f "$in_mkfile" ] || continue
4461
4462         echo "########################################################################" > "$mkfile"
4463         echo "## This file was autogenerated by configure, all changes will be lost ##" >> "$mkfile"
4464         echo "########################################################################" >> "$mkfile"
4465         EXTRA_OBJS=
4466         EXTRA_SRCS=
4467         EXTRA_CFLAGS="\$(QMAKE_CFLAGS)"
4468         EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS)"
4469         EXTRA_LFLAGS="\$(QMAKE_LFLAGS)"
4470
4471         if [ "$PLATFORM" = "irix-cc" ] || [ "$PLATFORM" = "irix-cc-64" ]; then
4472             EXTRA_LFLAGS="$EXTRA_LFLAGS -lm"
4473         fi
4474
4475         [ -n "$CC" ] && echo "CC = $CC" >> "$mkfile"
4476         [ -n "$CXX" ] && echo "CXX = $CXX" >> "$mkfile"
4477         if [ "$CFG_SILENT" = "yes" ]; then
4478             [ -z "$CC" ] && setBootstrapVariable QMAKE_CC 's,QMAKE_CC.*=,CC=\@,'
4479             [ -z "$CXX" ] && setBootstrapVariable QMAKE_CXX 's,QMAKE_CXX.*=,CXX=\@,'
4480         else
4481             [ -z "$CC" ] && setBootstrapVariable QMAKE_CC 's,QMAKE_CC,CC,'
4482             [ -z "$CXX" ] && setBootstrapVariable QMAKE_CXX 's,QMAKE_CXX,CXX,'
4483         fi
4484         setBootstrapVariable QMAKE_CFLAGS
4485         setBootstrapVariable QMAKE_CXXFLAGS 's,\$\$QMAKE_CFLAGS,\$(QMAKE_CFLAGS),'
4486         setBootstrapVariable QMAKE_LFLAGS
4487
4488         if [ $QT_EDITION = "QT_EDITION_OPENSOURCE" ]; then
4489             EXTRA_CFLAGS="$EXTRA_CFLAGS -DQMAKE_OPENSOURCE_EDITION"
4490             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -DQMAKE_OPENSOURCE_EDITION"
4491         fi
4492         if [ "$CFG_RELEASE_QMAKE" = "yes" ]; then
4493             setBootstrapVariable QMAKE_CFLAGS_RELEASE
4494             setBootstrapVariable QMAKE_CXXFLAGS_RELEASE 's,\$\$QMAKE_CFLAGS_RELEASE,\$(QMAKE_CFLAGS_RELEASE),'
4495             EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_RELEASE)"
4496             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_RELEASE)"
4497         elif [ "$CFG_DEBUG" = "yes" ]; then
4498             setBootstrapVariable QMAKE_CFLAGS_DEBUG
4499             setBootstrapVariable QMAKE_CXXFLAGS_DEBUG 's,\$\$QMAKE_CFLAGS_DEBUG,\$(QMAKE_CFLAGS_DEBUG),'
4500             EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_DEBUG)"
4501             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_DEBUG)"
4502         fi
4503
4504         if [ '!' -z "$RPATH_FLAGS" ] && [ '!' -z "`getQMakeConf \"$QMAKESPEC\" | $AWK '/QMAKE_(LFLAGS_)?RPATH/ {print $3;}'`" ]; then
4505             setBootstrapVariable "QMAKE_(LFLAGS_)?RPATH" 's,\$\$LITERAL_WHITESPACE, ,;s,QMAKE_RPATH,QMAKE_LFLAGS_RPATH,'
4506             for rpath in $RPATH_FLAGS; do
4507                 EXTRA_LFLAGS="\$(QMAKE_LFLAGS_RPATH)\"$rpath\" $EXTRA_LFLAGS"
4508             done
4509         fi
4510         if [ "$BUILD_ON_MAC" = "yes" ]; then
4511             echo "export MACOSX_DEPLOYMENT_TARGET = 10.6" >> "$mkfile"
4512             echo "CARBON_LFLAGS =-framework ApplicationServices" >>"$mkfile"
4513             echo "CARBON_CFLAGS =-fconstant-cfstrings" >>"$mkfile"
4514             EXTRA_LFLAGS="$EXTRA_LFLAGS \$(CARBON_LFLAGS)"
4515             EXTRA_CFLAGS="$EXTRA_CFLAGS \$(CARBON_CFLAGS)"
4516             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(CARBON_CFLAGS)"
4517             EXTRA_OBJS="qsettings_mac.o qcore_mac.o"
4518             EXTRA_SRCS="\"$relpath/src/corelib/io/qsettings_mac.cpp\" \"$relpath/src/corelib/kernel/qcore_mac.cpp\""
4519             if [ '!' -z "$CFG_SDK" ]; then
4520                 echo "SDK_LFLAGS =-Wl,-syslibroot,$CFG_SDK" >>"$mkfile"
4521                 echo "SDK_CFLAGS =-isysroot $CFG_SDK" >>"$mkfile"
4522                 EXTRA_CFLAGS="$EXTRA_CFLAGS \$(SDK_CFLAGS)"
4523                 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(SDK_CFLAGS)"
4524                 EXTRA_LFLAGS="$EXTRA_LFLAGS \$(SDK_LFLAGS)"
4525             fi
4526         fi
4527         [ "$CFG_EMBEDDED" != "no" ] && EXTRA_CFLAGS="$EXTRA_CFLAGS -DQWS"
4528         if [ '!' -z "$D_FLAGS" ]; then
4529             for DEF in $D_FLAGS; do
4530                 EXTRA_CFLAGS="$EXTRA_CFLAGS \"-D${DEF}\""
4531             done
4532         fi
4533         QMAKE_BIN_DIR="$QT_INSTALL_BINS"
4534         [ -z "$QMAKE_BIN_DIR" ] && QMAKE_BIN_DIR="${QT_INSTALL_PREFIX}/bin"
4535         QMAKE_DATA_DIR="$QT_INSTALL_DATA"
4536         [ -z "$QMAKE_DATA_DIR" ] && QMAKE_DATA_DIR="${QT_INSTALL_PREFIX}"
4537         echo >>"$mkfile"
4538         adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'`
4539         adjoutpath=`echo "$outpath" | sed 's/ /\\\\\\\\ /g'`
4540         adjqmakespec=`echo "$QMAKESPEC" | sed 's/ /\\\\\\\\ /g'`
4541         sed -e "s,@SOURCE_PATH@,$adjrelpath,g" -e "s,@BUILD_PATH@,$adjoutpath,g" \
4542             -e "s,@QMAKE_CFLAGS@,$EXTRA_CFLAGS,g" -e "s,@QMAKE_LFLAGS@,$EXTRA_LFLAGS,g" \
4543             -e "s,@QMAKE_CXXFLAGS@,$EXTRA_CXXFLAGS,g" \
4544             -e "s,@QT_INSTALL_BINS@,\$(INSTALL_ROOT)$QMAKE_BIN_DIR,g" \
4545             -e "s,@QT_INSTALL_DATA@,\$(INSTALL_ROOT)$QMAKE_DATA_DIR,g" \
4546             -e "s,@QMAKE_QTOBJS@,$EXTRA_OBJS,g" -e "s,@QMAKE_QTSRCS@,$EXTRA_SRCS,g" \
4547             -e "s,@QMAKESPEC@,$adjqmakespec,g" -e "s,@QT_VERSION@,$QT_VERSION,g" "$in_mkfile" >>"$mkfile"
4548
4549         if "$WHICH" makedepend >/dev/null 2>&1 && grep 'depend:' "$mkfile" >/dev/null 2>&1; then
4550             (cd "$outpath/qmake" && "$MAKE" -f "$mkfile" depend) >/dev/null 2>&1
4551             sed "s,^.*/\([^/]*.o\):,\1:,g" "$mkfile" >"$mkfile.tmp"
4552             sed "s,$outpath,$adjoutpath,g" "$mkfile.tmp" >"$mkfile"
4553             rm "$mkfile.tmp"
4554         fi
4555     done
4556
4557     QMAKE_BUILD_ERROR=no
4558     (cd "$outpath/qmake"; "$MAKE") || QMAKE_BUILD_ERROR=yes
4559     [ '!' -z "$QCONFIG_H" ] && mv -f "$QCONFIG_H" "$QMAKE_QCONFIG_H" #move qmake's qconfig.h to qconfig.h.qmake
4560     [ '!' -z "$OLD_QCONFIG_H" ] && mv -f "${OLD_QCONFIG_H}.old" "$OLD_QCONFIG_H" #put back qconfig.h
4561     [ "$QMAKE_BUILD_ERROR" = "yes" ] && exit 2
4562 fi # Build qmake
4563
4564 #-------------------------------------------------------------------------------
4565 # tests that need qmake
4566 #-------------------------------------------------------------------------------
4567
4568 # detect availability of float math.h functions
4569 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/floatmath "floatmath" $L_FLAGS $I_FLAGS $l_FLAGS; then
4570     CFG_USE_FLOATMATH=yes
4571 else
4572     CFG_USE_FLOATMATH=no
4573 fi
4574
4575 # detect mmx support
4576 if [ "${CFG_MMX}" = "auto" ]; then
4577     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mmx "mmx" $L_FLAGS $I_FLAGS $l_FLAGS "-mmmx"; then
4578         CFG_MMX=yes
4579     else
4580         CFG_MMX=no
4581     fi
4582 fi
4583
4584 # detect 3dnow support
4585 if [ "${CFG_3DNOW}" = "auto" ]; then
4586     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/3dnow "3dnow" $L_FLAGS $I_FLAGS $l_FLAGS "-m3dnow"; then
4587         CFG_3DNOW=yes
4588     else
4589         CFG_3DNOW=no
4590     fi
4591 fi
4592
4593 # detect sse support
4594 if [ "${CFG_SSE}" = "auto" ]; then
4595     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse "sse" $L_FLAGS $I_FLAGS $l_FLAGS "-msse"; then
4596         CFG_SSE=yes
4597     else
4598         CFG_SSE=no
4599     fi
4600 fi
4601
4602 # detect sse2 support
4603 if [ "${CFG_SSE2}" = "auto" ]; then
4604     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse2 "sse2" $L_FLAGS $I_FLAGS $l_FLAGS "-msse2"; then
4605        CFG_SSE2=yes
4606     else
4607        CFG_SSE2=no
4608     fi
4609 fi
4610
4611 # detect sse3 support
4612 if [ "${CFG_SSE3}" = "auto" ]; then
4613     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse3 "sse3" $L_FLAGS $I_FLAGS $l_FLAGS "-msse3"; then
4614        CFG_SSE3=yes
4615     else
4616        CFG_SSE3=no
4617     fi
4618 fi
4619
4620 # detect ssse3 support
4621 if [ "${CFG_SSSE3}" = "auto" ]; then
4622     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ssse3 "ssse3" $L_FLAGS $I_FLAGS $l_FLAGS "-mssse3"; then
4623        CFG_SSSE3=yes
4624     else
4625        CFG_SSSE3=no
4626     fi
4627 fi
4628
4629 # detect sse4.1 support
4630 if [ "${CFG_SSE4_1}" = "auto" ]; then
4631     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
4632        CFG_SSE4_1=yes
4633     else
4634        CFG_SSE4_1=no
4635     fi
4636 fi
4637
4638 # detect sse4.2 support
4639 if [ "${CFG_SSE4_2}" = "auto" ]; then
4640     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
4641        CFG_SSE4_2=yes
4642     else
4643        CFG_SSE4_2=no
4644     fi
4645 fi
4646
4647 # detect avx support
4648 if [ "${CFG_AVX}" = "auto" ]; then
4649     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/avx "avx" $L_FLAGS $I_FLAGS $l_FLAGS "-mavx"; then
4650        CFG_AVX=yes
4651     else
4652        CFG_AVX=no
4653     fi
4654 fi
4655
4656 # check iWMMXt support
4657 if [ "$CFG_IWMMXT" = "yes" ]; then
4658     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iwmmxt "iwmmxt" $L_FLAGS $I_FLAGS $l_FLAGS "-mcpu=iwmmxt"
4659     if [ $? != "0" ]; then
4660         echo "The iWMMXt functionality test failed!"
4661         echo " Please make sure your compiler supports iWMMXt intrinsics!"
4662         exit 1
4663     fi
4664 fi
4665
4666 # detect neon support
4667 if [ "$CFG_ARCH" = "arm" ] && [ "${CFG_NEON}" = "auto" ]; then
4668     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
4669         CFG_NEON=yes
4670     else
4671         CFG_NEON=no
4672     fi
4673 fi
4674
4675 [ "$XPLATFORM_MINGW" = "yes" ] && QMakeVar add styles "windowsxp windowsvista"
4676
4677 # detect zlib
4678 if [ "$CFG_ZLIB" = "no" ]; then
4679     # Note: Qt no longer support builds without zlib
4680     # So we force a "no" to be "auto" here.
4681     # If you REALLY really need no zlib support, you can still disable
4682     # it by doing the following:
4683     #   add "no-zlib" to mkspecs/qconfig.pri
4684     #   #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h)
4685     #
4686     # There's no guarantee that Qt will build under those conditions
4687
4688     CFG_ZLIB=auto
4689     ZLIB_FORCED=yes
4690 fi
4691 if [ "$CFG_ZLIB" = "auto" ]; then
4692     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
4693        CFG_ZLIB=system
4694     else
4695        CFG_ZLIB=yes
4696     fi
4697 fi
4698
4699 if [ "$CFG_LARGEFILE" = "auto" ]; then
4700     #Large files should be enabled for all Linux systems
4701     CFG_LARGEFILE=yes
4702 fi
4703
4704 # detect how jpeg should be built
4705 if [ "$CFG_JPEG" = "auto" ]; then
4706     if [ "$CFG_SHARED" = "yes" ]; then
4707         CFG_JPEG=plugin
4708     else
4709         CFG_JPEG=yes
4710     fi
4711 fi
4712 # detect jpeg
4713 if [ "$CFG_LIBJPEG" = "auto" ]; then
4714     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
4715        CFG_LIBJPEG=system
4716     else
4717        CFG_LIBJPEG=qt
4718     fi
4719 fi
4720
4721 # detect how gif should be built
4722 if [ "$CFG_GIF" = "auto" ]; then
4723     if [ "$CFG_SHARED" = "yes" ]; then
4724         CFG_GIF=plugin
4725     else
4726         CFG_GIF=yes
4727     fi
4728 fi
4729
4730 # detect png
4731 if [ "$CFG_LIBPNG" = "auto" ]; then
4732     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
4733        CFG_LIBPNG=system
4734     else
4735        CFG_LIBPNG=qt
4736     fi
4737 fi
4738
4739 # detect accessibility
4740 if [ "$CFG_ACCESSIBILITY" = "auto" ]; then
4741     CFG_ACCESSIBILITY=yes
4742 fi
4743
4744 # auto-detect SQL-modules support
4745 for _SQLDR in $CFG_SQL_AVAILABLE; do
4746         case $_SQLDR in
4747         mysql)
4748             if [ "$CFG_SQL_mysql" != "no" ]; then
4749                 [ -z "$CFG_MYSQL_CONFIG" ] && CFG_MYSQL_CONFIG=`"$WHICH" mysql_config`
4750                 if [ -x "$CFG_MYSQL_CONFIG" ]; then
4751                     QT_CFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --include 2>/dev/null`
4752                     QT_LFLAGS_MYSQL_R=`$CFG_MYSQL_CONFIG --libs_r 2>/dev/null`
4753                     QT_LFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --libs 2>/dev/null`
4754                     QT_MYSQL_VERSION=`$CFG_MYSQL_CONFIG --version 2>/dev/null`
4755                     QT_MYSQL_VERSION_MAJOR=`echo $QT_MYSQL_VERSION | cut -d . -f 1`
4756                 fi
4757                 if [ -n "$QT_MYSQL_VERSION" ] && [ "$QT_MYSQL_VERSION_MAJOR" -lt 4 ]; then
4758                     if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4759                         echo "This version of MySql is not supported ($QT_MYSQL_VERSION)."
4760                         echo " You need MySql 4 or higher."
4761                         echo " If you believe this message is in error you may use the continue"
4762                         echo " switch (-continue) to $0 to continue."
4763                         exit 101
4764                     else
4765                         CFG_SQL_mysql="no"
4766                         QT_LFLAGS_MYSQL=""
4767                         QT_LFLAGS_MYSQL_R=""
4768                         QT_CFLAGS_MYSQL=""
4769                     fi
4770                 else
4771                     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
4772                         QMakeVar add CONFIG use_libmysqlclient_r
4773                         if [ "$CFG_SQL_mysql" = "auto" ]; then
4774                             CFG_SQL_mysql=plugin
4775                         fi
4776                         QT_LFLAGS_MYSQL="$QT_LFLAGS_MYSQL_R"
4777                     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
4778                         if [ "$CFG_SQL_mysql" = "auto" ]; then
4779                             CFG_SQL_mysql=plugin
4780                         fi
4781                     else
4782                         if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4783                             echo "MySQL support cannot be enabled due to functionality tests!"
4784                             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4785                             echo " If you believe this message is in error you may use the continue"
4786                             echo " switch (-continue) to $0 to continue."
4787                             exit 101
4788                         else
4789                             CFG_SQL_mysql=no
4790                             QT_LFLAGS_MYSQL=""
4791                             QT_LFLAGS_MYSQL_R=""
4792                             QT_CFLAGS_MYSQL=""
4793                         fi
4794                     fi
4795                 fi
4796             fi
4797             ;;
4798         psql)
4799             if [ "$CFG_SQL_psql" != "no" ]; then
4800                 # Be careful not to use native pg_config when cross building.
4801                 if [ "$XPLATFORM_MINGW" != "yes" ] && "$WHICH" pg_config >/dev/null 2>&1; then
4802                     QT_CFLAGS_PSQL=`pg_config --includedir 2>/dev/null`
4803                     QT_LFLAGS_PSQL=`pg_config --libdir 2>/dev/null`
4804                 fi
4805                 [ -z "$QT_CFLAGS_PSQL" ] || QT_CFLAGS_PSQL="-I$QT_CFLAGS_PSQL"
4806                 [ -z "$QT_LFLAGS_PSQL" ] || QT_LFLAGS_PSQL="-L$QT_LFLAGS_PSQL"
4807                 # But, respect PSQL_LIBS if set
4808                 [ -z "$PSQL_LIBS" ] || QT_LFLAGS_PSQL="$PSQL_LIBS"
4809                 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
4810                     if [ "$CFG_SQL_psql" = "auto" ]; then
4811                         CFG_SQL_psql=plugin
4812                     fi
4813                 else
4814                     if [ "$CFG_SQL_psql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4815                         echo "PostgreSQL support cannot be enabled due to functionality tests!"
4816                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4817                         echo " If you believe this message is in error you may use the continue"
4818                         echo " switch (-continue) to $0 to continue."
4819                         exit 101
4820                     else
4821                         CFG_SQL_psql=no
4822                         QT_CFLAGS_PSQL=""
4823                         QT_LFLAGS_PSQL=""
4824                     fi
4825                 fi
4826             fi
4827         ;;
4828         odbc)
4829             if [ "$CFG_SQL_odbc" != "no" ]; then
4830                 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
4831                     if [ "$CFG_SQL_odbc" = "auto" ]; then
4832                         CFG_SQL_odbc=plugin
4833                     fi
4834                 else
4835                     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
4836                         QT_LFLAGS_ODBC="-liodbc"
4837                         if [ "$CFG_SQL_odbc" = "auto" ]; then
4838                             CFG_SQL_odbc=plugin
4839                         fi
4840                     else
4841                         if [ "$CFG_SQL_odbc" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4842                             echo "ODBC support cannot be enabled due to functionality tests!"
4843                             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4844                             echo " If you believe this message is in error you may use the continue"
4845                             echo " switch (-continue) to $0 to continue."
4846                             exit 101
4847                         else
4848                             CFG_SQL_odbc=no
4849                         fi
4850                     fi
4851                 fi
4852             fi
4853             ;;
4854         oci)
4855             if [ "$CFG_SQL_oci" != "no" ]; then
4856                 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
4857                     if [ "$CFG_SQL_oci" = "auto" ]; then
4858                         CFG_SQL_oci=plugin
4859                     fi
4860                 else
4861                     if [ "$CFG_SQL_oci" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4862                         echo "Oracle (OCI) support cannot be enabled due to functionality tests!"
4863                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4864                         echo " If you believe this message is in error you may use the continue"
4865                         echo " switch (-continue) to $0 to continue."
4866                         exit 101
4867                     else
4868                         CFG_SQL_oci=no
4869                     fi
4870                 fi
4871             fi
4872             ;;
4873         tds)
4874             if [ "$CFG_SQL_tds" != "no" ]; then
4875                 [ -z "$SYBASE" ] || QT_LFLAGS_TDS="-L$SYBASE/lib"
4876                 [ -z "$SYBASE_LIBS" ] || QT_LFLAGS_TDS="$QT_LFLAGS_TDS $SYBASE_LIBS"
4877                 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
4878                     if [ "$CFG_SQL_tds" = "auto" ]; then
4879                         CFG_SQL_tds=plugin
4880                     fi
4881                 else
4882                     if [ "$CFG_SQL_tds" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4883                         echo "TDS support cannot be enabled due to functionality tests!"
4884                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4885                         echo " If you believe this message is in error you may use the continue"
4886                         echo " switch (-continue) to $0 to continue."
4887                         exit 101
4888                     else
4889                         CFG_SQL_tds=no
4890                     fi
4891                 fi
4892             fi
4893             ;;
4894         db2)
4895             if [ "$CFG_SQL_db2" != "no" ]; then
4896                 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
4897                     if [ "$CFG_SQL_db2" = "auto" ]; then
4898                         CFG_SQL_db2=plugin
4899                     fi
4900                 else
4901                     if [ "$CFG_SQL_db2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4902                         echo "ODBC support cannot be enabled due to functionality tests!"
4903                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4904                         echo " If you believe this message is in error you may use the continue"
4905                         echo " switch (-continue) to $0 to continue."
4906                         exit 101
4907                     else
4908                         CFG_SQL_db2=no
4909                     fi
4910                 fi
4911             fi
4912             ;;
4913         ibase)
4914             if [ "$CFG_SQL_ibase" != "no" ]; then
4915                 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
4916                     if [ "$CFG_SQL_ibase" = "auto" ]; then
4917                         CFG_SQL_ibase=plugin
4918                     fi
4919                 else
4920                     if [ "$CFG_SQL_ibase" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4921                         echo "InterBase support cannot be enabled due to functionality tests!"
4922                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4923                         echo " If you believe this message is in error you may use the continue"
4924                         echo " switch (-continue) to $0 to continue."
4925                         exit 101
4926                     else
4927                         CFG_SQL_ibase=no
4928                     fi
4929                 fi
4930             fi
4931             ;;
4932         sqlite2)
4933             if [ "$CFG_SQL_sqlite2" != "no" ]; then
4934                 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
4935                     if [ "$CFG_SQL_sqlite2" = "auto" ]; then
4936                         CFG_SQL_sqlite2=plugin
4937                     fi
4938                 else
4939                     if [ "$CFG_SQL_sqlite2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4940                         echo "SQLite2 support cannot be enabled due to functionality tests!"
4941                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4942                         echo " If you believe this message is in error you may use the continue"
4943                         echo " switch (-continue) to $0 to continue."
4944                         exit 101
4945                     else
4946                         CFG_SQL_sqlite2=no
4947                     fi
4948                 fi
4949             fi
4950             ;;
4951         sqlite)
4952             if [ "$CFG_SQL_sqlite" != "no" ]; then
4953                 SQLITE_AUTODETECT_FAILED="no"
4954                 if [ "$CFG_SQLITE" = "system" ]; then
4955                     if [ -n "$PKG_CONFIG" ]; then
4956                         QT_CFLAGS_SQLITE=`$PKG_CONFIG --cflags sqlite3 2>/dev/null`
4957                         QT_LFLAGS_SQLITE=`$PKG_CONFIG --libs sqlite3 2>/dev/null`
4958                     fi
4959                     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
4960                         if [ "$CFG_SQL_sqlite" = "auto" ]; then
4961                             CFG_SQL_sqlite=plugin
4962                         fi
4963                         QMAKE_CONFIG="$QMAKE_CONFIG system-sqlite"
4964                     else
4965                         SQLITE_AUTODETECT_FAILED="yes"
4966                         CFG_SQL_sqlite=no
4967                     fi
4968                 elif [ -f "$relpath/src/3rdparty/sqlite/sqlite3.h" ]; then
4969                     if [ "$CFG_SQL_sqlite" = "auto" ]; then
4970                             CFG_SQL_sqlite=plugin
4971                     fi
4972                 else
4973                     SQLITE_AUTODETECT_FAILED="yes"
4974                     CFG_SQL_sqlite=no
4975                 fi
4976
4977                 if [ "$SQLITE_AUTODETECT_FAILED" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4978                     echo "SQLite support cannot be enabled due to functionality tests!"
4979                     echo " Turn on verbose messaging (-v) to $0 to see the final report."
4980                     echo " If you believe this message is in error you may use the continue"
4981                     echo " switch (-continue) to $0 to continue."
4982                     exit 101
4983                 fi
4984             fi
4985             ;;
4986         *)
4987             if [ "$OPT_VERBOSE" = "yes" ]; then
4988                 echo "unknown SQL driver: $_SQLDR"
4989             fi
4990             ;;
4991         esac
4992 done
4993
4994 # auto-detect NIS support
4995 if [ "$CFG_NIS" != "no" ]; then
4996     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
4997         CFG_NIS=yes
4998     else
4999         if [ "$CFG_NIS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5000             echo "NIS support cannot be enabled due to functionality tests!"
5001             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5002             echo " If you believe this message is in error you may use the continue"
5003             echo " switch (-continue) to $0 to continue."
5004             exit 101
5005         else
5006             CFG_NIS=no
5007         fi
5008     fi
5009 fi
5010
5011 # auto-detect CUPS support
5012 if [ "$CFG_CUPS" != "no" ]; then
5013     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
5014         CFG_CUPS=yes
5015     else
5016         if [ "$CFG_CUPS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5017             echo "Cups support cannot be enabled due to functionality tests!"
5018             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5019             echo " If you believe this message is in error you may use the continue"
5020             echo " switch (-continue) to $0 to continue."
5021             exit 101
5022         else
5023             CFG_CUPS=no
5024         fi
5025     fi
5026 fi
5027
5028 # auto-detect iconv(3) support
5029 if [ "$CFG_ICONV" != "no" ]; then
5030     if [ "$PLATFORM_QWS" = "yes" -o "$XPLATFORM_MINGW" = "yes" ] || [ "$PLATFORM_QPA" = "yes" -a "$CFG_ICONV" = "auto" ]; then
5031         CFG_ICONV=no
5032     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
5033         CFG_ICONV=yes
5034     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
5035         CFG_ICONV=sun
5036     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
5037         CFG_ICONV=gnu
5038     else
5039         if [ "$CFG_ICONV" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5040             echo "Iconv support cannot be enabled due to functionality tests!"
5041             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5042             echo " If you believe this message is in error you may use the continue"
5043             echo " switch (-continue) to $0 to continue."
5044             exit 101
5045         else
5046             CFG_ICONV=no
5047         fi
5048     fi
5049 fi
5050
5051 # auto-detect libdbus-1 support
5052 if [ "$CFG_DBUS" != "no" ]; then
5053     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then
5054         QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null`
5055         QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null`
5056     fi
5057     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
5058         [ "$CFG_DBUS" = "auto" ] && CFG_DBUS=yes
5059         QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
5060         QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS"
5061     else
5062         if [ "$CFG_DBUS" = "auto" ]; then
5063             CFG_DBUS=no
5064         elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5065             # CFG_DBUS is "yes" or "linked" here
5066
5067             echo "The QtDBus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found."
5068             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5069             echo " If you believe this message is in error you may use the continue"
5070             echo " switch (-continue) to $0 to continue."
5071             exit 101
5072         fi
5073     fi
5074 fi
5075
5076 # X11/QWS/Lighthouse
5077 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
5078
5079     # auto-detect Glib support
5080     if [ "$CFG_GLIB" != "no" ]; then
5081         if [ -n "$PKG_CONFIG" ]; then
5082             QT_CFLAGS_GLIB=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0 2>/dev/null`
5083             QT_LIBS_GLIB=`$PKG_CONFIG --libs glib-2.0 gthread-2.0 2>/dev/null`
5084         fi
5085         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
5086             CFG_GLIB=yes
5087             QMakeVar set QT_CFLAGS_GLIB "$QT_CFLAGS_GLIB"
5088             QMakeVar set QT_LIBS_GLIB "$QT_LIBS_GLIB"
5089         else
5090             if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5091                 echo "Glib support cannot be enabled due to functionality tests!"
5092                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5093                 echo " If you believe this message is in error you may use the continue"
5094                 echo " switch (-continue) to $0 to continue."
5095                 exit 101
5096             else
5097                 CFG_GLIB=no
5098             fi
5099         fi
5100     fi
5101
5102     # ### Vestige
5103     if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then
5104         if [ -n "$PKG_CONFIG" ]; then
5105             QT_CFLAGS_GSTREAMER=`$PKG_CONFIG --cflags gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
5106             QT_LIBS_GSTREAMER=`$PKG_CONFIG --libs gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
5107         fi
5108         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
5109             CFG_GSTREAMER=yes
5110             QMakeVar set QT_CFLAGS_GSTREAMER "$QT_CFLAGS_GSTREAMER"
5111             QMakeVar set QT_LIBS_GSTREAMER "$QT_LIBS_GSTREAMER"
5112         else
5113             if [ "$CFG_GSTREAMER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5114                 echo "Gstreamer support cannot be enabled due to functionality tests!"
5115                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5116                 echo " If you believe this message is in error you may use the continue"
5117                 echo " switch (-continue) to $0 to continue."
5118                 exit 101
5119             else
5120                 CFG_GSTREAMER=no
5121             fi
5122         fi
5123     elif [ "$CFG_GLIB" = "no" ]; then
5124         CFG_GSTREAMER=no
5125     fi
5126
5127     # auto-detect libicu support
5128     if [ "$CFG_ICU" != "no" ]; then
5129         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/icu "ICU" $L_FLAGS $I_FLAGS $l_FLAGS; then
5130             [ "$CFG_ICU" = "auto" ] && CFG_ICU=yes
5131         else
5132             if [ "$CFG_ICU" = "auto" ]; then
5133                 CFG_ICU=no
5134             elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5135                 # CFG_ICU is "yes"
5136
5137                 echo "The ICU library support cannot be enabled."
5138                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5139                 echo " If you believe this message is in error you may use the continue"
5140                 echo " switch (-continue) to $0 to continue."
5141                 exit 101
5142             fi
5143         fi
5144     fi
5145
5146     # Auto-detect PulseAudio support
5147     if [ "$CFG_PULSEAUDIO" != "no" ]; then
5148         if [ -n "$PKG_CONFIG" ]; then
5149             QT_CFLAGS_PULSEAUDIO=`$PKG_CONFIG --cflags libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
5150             QT_LIBS_PULSEAUDIO=`$PKG_CONFIG --libs libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
5151         fi
5152         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
5153             CFG_PULSEAUDIO=yes
5154             QMakeVar set QT_CFLAGS_PULSEAUDIO "$QT_CFLAGS_PULSEAUDIO"
5155             QMakeVar set QT_LIBS_PULSEAUDIO "$QT_LIBS_PULSEAUDIO"
5156         else
5157             if [ "$CFG_PULSEAUDIO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5158                 echo "PulseAudio support cannot be enabled due to functionality tests!"
5159                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5160                 echo " If you believe this message is in error you may use the continue"
5161                 echo " switch (-continue) to $0 to continue."
5162                 exit 101
5163             else
5164                 CFG_PULSEAUDIO=no
5165             fi
5166         fi
5167     fi
5168 fi # X11/QWS/Lighthouse
5169
5170 # X11
5171 if [ "$PLATFORM_X11" = "yes" -a "$CFG_GUI" != "no" ]; then
5172     x11tests="$relpath/config.tests/x11"
5173     X11TESTS_FLAGS=
5174
5175     # work around broken X11 headers when using GCC 2.95 or later
5176     NOTYPE=no
5177     "$x11tests/notype.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" && NOTYPE=yes
5178     if [ $NOTYPE = "yes" ]; then
5179         QMakeVar add QMAKE_CXXFLAGS -fpermissive
5180         X11TESTS_FLAGS="$X11TESTS_FLAGS -fpermissive"
5181     fi
5182
5183     # Check we actually have X11 :-)
5184     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
5185     if [ $? != "0" ]; then
5186         echo "Basic XLib functionality test failed!"
5187         echo " You might need to modify the include and library search paths by editing"
5188         echo " QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in ${XQMAKESPEC}."
5189         exit 1
5190     fi
5191 fi
5192
5193 # X11/MINGW OpenGL
5194 if [ "$PLATFORM_X11" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
5195     # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
5196     if [ "$CFG_GUI" = "no" ]; then
5197         if [ "$CFG_OPENGL" = "auto" ]; then
5198             CFG_OPENGL=no
5199         fi
5200         if [ "$CFG_OPENGL" != "no" ]; then
5201             echo "OpenGL enabled, but GUI disabled."
5202             echo " You might need to either enable the GUI or disable OpenGL"
5203             exit 1
5204         fi
5205     fi
5206     if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
5207         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
5208             CFG_OPENGL=desktop
5209         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
5210             CFG_OPENGL=es2
5211             if [ "$CFG_EGL" = "no" ]; then
5212                 CFG_EGL=auto
5213             fi
5214         else
5215             if [ "$CFG_OPENGL" = "yes" ]; then
5216                 echo "All the OpenGL functionality tests failed!"
5217                 echo " You might need to modify the include and library search paths by editing"
5218                 echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5219                 echo " ${XQMAKESPEC}."
5220                 exit 1
5221             fi
5222             CFG_OPENGL=no
5223         fi
5224         case "$PLATFORM" in
5225         hpux*)
5226             # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
5227             if [ "$CFG_OPENGL" = "desktop" ]; then
5228                 "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
5229                 if [ $? != "0" ]; then
5230                     QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
5231                 fi
5232             fi
5233             ;;
5234         *)
5235             ;;
5236         esac
5237     elif [ "$CFG_OPENGL" = "es2" ]; then
5238         #OpenGL ES 2.x
5239         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS
5240         if [ $? != "0" ]; then
5241             echo "The OpenGL ES 2.0 functionality test failed!"
5242             echo " You might need to modify the include and library search paths by editing"
5243             echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
5244             echo " ${XQMAKESPEC}."
5245             exit 1
5246         fi
5247     elif [ "$CFG_OPENGL" = "desktop" ]; then
5248         # Desktop OpenGL support
5249         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
5250         if [ $? != "0" ]; then
5251             echo "The OpenGL functionality test failed!"
5252             echo " You might need to modify the include and library search paths by editing"
5253             echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5254             echo " ${XQMAKESPEC}."
5255             exit 1
5256         fi
5257         case "$PLATFORM" in
5258         hpux*)
5259             # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
5260             "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
5261             if [ $? != "0" ]; then
5262                 QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
5263             fi
5264             ;;
5265         *)
5266             ;;
5267         esac
5268     fi
5269 fi # X11/MINGW OpenGL
5270
5271 # X11
5272 if [ "$PLATFORM_X11" = "yes" ]; then
5273     # auto-detect Xcursor support
5274     if [ "$CFG_XCURSOR" != "no" ]; then
5275         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
5276             if [ "$CFG_XCURSOR" != "runtime" ]; then
5277                 CFG_XCURSOR=yes;
5278             fi
5279         else
5280             if [ "$CFG_XCURSOR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5281                 echo "Xcursor support cannot be enabled due to functionality tests!"
5282                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5283                 echo " If you believe this message is in error you may use the continue"
5284                 echo " switch (-continue) to $0 to continue."
5285                 exit 101
5286             else
5287                 CFG_XCURSOR=no
5288             fi
5289         fi
5290     fi
5291
5292     # auto-detect Xfixes support
5293     if [ "$CFG_XFIXES" != "no" ]; then
5294         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xfixes "Xfixes" $L_FLAGS $I_FLAGS $X11TESTS_FLAGS; then
5295             if [ "$CFG_XFIXES" != "runtime" ]; then
5296                 CFG_XFIXES=yes;
5297             fi
5298         else
5299             if [ "$CFG_XFIXES" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5300                 echo "Xfixes support cannot be enabled due to functionality tests!"
5301                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5302                 echo " If you believe this message is in error you may use the continue"
5303                 echo " switch (-continue) to $0 to continue."
5304                 exit 101
5305             else
5306                 CFG_XFIXES=no
5307             fi
5308         fi
5309     fi
5310
5311     # auto-detect Xrandr support (resize and rotate extension)
5312     if [ "$CFG_XRANDR" != "no" ]; then
5313         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
5314             if [ "$CFG_XRANDR" != "runtime" ]; then
5315             CFG_XRANDR=yes
5316             fi
5317         else
5318             if [ "$CFG_XRANDR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5319                 echo "Xrandr support cannot be enabled due to functionality tests!"
5320                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5321                 echo " If you believe this message is in error you may use the continue"
5322                 echo " switch (-continue) to $0 to continue."
5323                 exit 101
5324             else
5325                 CFG_XRANDR=no
5326             fi
5327         fi
5328     fi
5329
5330     # auto-detect Xrender support
5331     if [ "$CFG_XRENDER" != "no" ]; then
5332         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
5333             CFG_XRENDER=yes
5334         else
5335             if [ "$CFG_XRENDER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5336                 echo "Xrender support cannot be enabled due to functionality tests!"
5337                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5338                 echo " If you believe this message is in error you may use the continue"
5339                 echo " switch (-continue) to $0 to continue."
5340                 exit 101
5341             else
5342                 CFG_XRENDER=no
5343             fi
5344         fi
5345     fi
5346
5347     # auto-detect MIT-SHM support
5348     if [ "$CFG_MITSHM" != "no" ]; then
5349         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
5350             CFG_MITSHM=yes
5351         else
5352             if [ "$CFG_MITSHM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5353                 echo "MITSHM support cannot be enabled due to functionality tests!"
5354                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5355                 echo " If you believe this message is in error you may use the continue"
5356                 echo " switch (-continue) to $0 to continue."
5357                 exit 101
5358             else
5359                 CFG_MITSHM=no
5360             fi
5361         fi
5362     fi
5363
5364     # auto-detect FontConfig support
5365     if [ "$CFG_FONTCONFIG" != "no" ]; then
5366     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
5367         QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
5368         QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null`
5369     else
5370         QT_CFLAGS_FONTCONFIG=
5371         QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig"
5372     fi
5373     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
5374             CFG_FONTCONFIG=yes
5375         QMakeVar set QMAKE_CFLAGS_X11 "$QT_CFLAGS_FONTCONFIG \$\$QMAKE_CFLAGS_X11"
5376         QMakeVar set QMAKE_LIBS_X11 "$QT_LIBS_FONTCONFIG \$\$QMAKE_LIBS_X11"
5377             CFG_LIBFREETYPE=system
5378         else
5379             if [ "$CFG_FONTCONFIG" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5380                 echo "FontConfig support cannot be enabled due to functionality tests!"
5381                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5382                 echo " If you believe this message is in error you may use the continue"
5383                 echo " switch (-continue) to $0 to continue."
5384                 exit 101
5385             else
5386                 CFG_FONTCONFIG=no
5387             fi
5388         fi
5389     fi
5390
5391     # auto-detect Session Management support
5392     if [ "$CFG_SM" = "auto" ]; then
5393         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
5394             CFG_SM=yes
5395         else
5396             if [ "$CFG_SM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5397                 echo "Session Management support cannot be enabled due to functionality tests!"
5398                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5399                 echo " If you believe this message is in error you may use the continue"
5400                 echo " switch (-continue) to $0 to continue."
5401                 exit 101
5402             else
5403                 CFG_SM=no
5404             fi
5405         fi
5406     fi
5407
5408     # auto-detect SHAPE support
5409     if [ "$CFG_XSHAPE" != "no" ]; then
5410         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
5411             CFG_XSHAPE=yes
5412         else
5413             if [ "$CFG_XSHAPE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5414                 echo "XShape support cannot be enabled due to functionality tests!"
5415                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5416                 echo " If you believe this message is in error you may use the continue"
5417                 echo " switch (-continue) to $0 to continue."
5418                 exit 101
5419             else
5420                 CFG_XSHAPE=no
5421             fi
5422         fi
5423     fi
5424
5425     # auto-detect XVideo support
5426     if [ "$CFG_XVIDEO" != "no" ]; then
5427         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
5428             CFG_XVIDEO=yes
5429         else
5430             if [ "$CFG_XVIDEO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5431                 echo "XVideo support cannot be enabled due to functionality tests!"
5432                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5433                 echo " If you believe this message is in error you may use the continue"
5434                 echo " switch (-continue) to $0 to continue."
5435                 exit 101
5436             else
5437                 CFG_XVIDEO=no
5438             fi
5439         fi
5440     fi
5441
5442     # auto-detect XSync support
5443     if [ "$CFG_XSYNC" != "no" ]; then
5444         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
5445             CFG_XSYNC=yes
5446         else
5447             if [ "$CFG_XSYNC" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5448                 echo "XSync support cannot be enabled due to functionality tests!"
5449                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5450                 echo " If you believe this message is in error you may use the continue"
5451                 echo " switch (-continue) to $0 to continue."
5452                 exit 101
5453             else
5454                 CFG_XSYNC=no
5455             fi
5456         fi
5457     fi
5458
5459     # auto-detect Xinerama support
5460     if [ "$CFG_XINERAMA" != "no" ]; then
5461         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
5462             if [ "$CFG_XINERAMA" != "runtime" ]; then
5463                 CFG_XINERAMA=yes
5464             fi
5465         else
5466             if [ "$CFG_XINERAMA" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5467                 echo "Xinerama support cannot be enabled due to functionality tests!"
5468                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5469                 echo " If you believe this message is in error you may use the continue"
5470                 echo " switch (-continue) to $0 to continue."
5471                 exit 101
5472             else
5473                 CFG_XINERAMA=no
5474             fi
5475         fi
5476     fi
5477
5478     # auto-detect Xinput support
5479     if [ "$CFG_XINPUT" != "no" ]; then
5480         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
5481             if [ "$CFG_XINPUT" != "runtime" ]; then
5482                 CFG_XINPUT=yes
5483             fi
5484         else
5485             if [ "$CFG_XINPUT" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5486                 echo "Tablet and Xinput support cannot be enabled due to functionality tests!"
5487                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5488                 echo " If you believe this message is in error you may use the continue"
5489                 echo " switch (-continue) to $0 to continue."
5490                 exit 101
5491             else
5492                 CFG_XINPUT=no
5493             fi
5494         fi
5495     fi
5496
5497     # auto-detect XKB support
5498     if [ "$CFG_XKB" != "no" ]; then
5499         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
5500             CFG_XKB=yes
5501         else
5502             if [ "$CFG_XKB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5503                 echo "XKB support cannot be enabled due to functionality tests!"
5504                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5505                 echo " If you believe this message is in error you may use the continue"
5506                 echo " switch (-continue) to $0 to continue."
5507                 exit 101
5508             else
5509                 CFG_XKB=no
5510             fi
5511         fi
5512     fi
5513
5514     if [ "$CFG_GLIB" = "yes" -a "$CFG_QGTKSTYLE" != "no" ]; then
5515         if [ -n "$PKG_CONFIG" ]; then
5516             QT_CFLAGS_QGTKSTYLE=`$PKG_CONFIG --cflags gtk+-2.0 ">=" 2.10 atk 2>/dev/null`
5517             QT_LIBS_QGTKSTYLE=`$PKG_CONFIG --libs gobject-2.0 2>/dev/null`
5518         fi
5519         if [ -n "$QT_CFLAGS_QGTKSTYLE" ] ; then
5520             CFG_QGTKSTYLE=yes
5521             QMakeVar set QT_CFLAGS_QGTKSTYLE "$QT_CFLAGS_QGTKSTYLE"
5522             QMakeVar set QT_LIBS_QGTKSTYLE "$QT_LIBS_QGTKSTYLE"
5523         else
5524             if [ "$CFG_QGTKSTYLE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5525                 echo "Gtk theme support cannot be enabled due to functionality tests!"
5526                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5527                 echo " If you believe this message is in error you may use the continue"
5528                 echo " switch (-continue) to $0 to continue."
5529                 exit 101
5530             else
5531                 CFG_QGTKSTYLE=no
5532             fi
5533         fi
5534     elif [ "$CFG_GLIB" = "no" ]; then
5535         CFG_QGTKSTYLE=no
5536     fi
5537 fi # X11
5538
5539
5540 if [ "$BUILD_ON_MAC" = "yes" ]; then
5541     if [ "$CFG_PHONON" != "no" ]; then
5542         # Always enable Phonon (unless it was explicitly disabled)
5543         CFG_PHONON=yes
5544     fi
5545
5546     if [ "$CFG_COREWLAN" = "auto" ]; then
5547         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
5548             CFG_COREWLAN=yes
5549         else
5550             CFG_COREWLAN=no
5551         fi
5552     fi
5553 fi
5554
5555
5556 if [ "$PLATFORM_QPA" = "yes" ]; then
5557     # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
5558     if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
5559         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
5560             CFG_OPENGL=desktop
5561         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
5562             CFG_OPENGL=es2
5563         else
5564             if [ "$CFG_OPENGL" = "yes" ]; then
5565                 echo "All the OpenGL functionality tests failed!"
5566                 echo " You might need to modify the include and library search paths by editing"
5567                 echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5568                 echo " ${XQMAKESPEC}."
5569                 exit 1
5570             fi
5571             CFG_OPENGL=no
5572         fi
5573     elif [ "$CFG_OPENGL" = "es2" ]; then
5574         #OpenGL ES 2.x
5575         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists glesv2 2>/dev/null; then
5576             QMAKE_INCDIR_OPENGL_ES2=`$PKG_CONFIG --variable=includedir glesv2 2>/dev/null`
5577             QMAKE_LIBDIR_OPENGL_ES2=`$PKG_CONFIG --variable=libdir glesv2 2>/dev/null`
5578             QMAKE_LIBS_OPENGL_ES2=`$PKG_CONFIG --libs glesv2 2>/dev/null`
5579             QMAKE_CFLAGS_OPENGL_ES2=`$PKG_CONFIG --cflags glesv2 2>/dev/null`
5580             QMakeVar set QMAKE_INCDIR_OPENGL_ES2 "$QMAKE_INCDIR_OPENGL_ES2"
5581             QMakeVar set QMAKE_LIBDIR_OPENGL_ES2 "$QMAKE_LIBDIR_OPENGL_ES2"
5582             QMakeVar set QMAKE_LIBS_OPENGL_ES2 "$QMAKE_LIBS_OPENGL_ES2"
5583         fi
5584
5585         "$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
5586         if [ $? != "0" ]; then
5587             echo "The OpenGL ES 2.0 functionality test failed!"
5588             echo " You might need to modify the include and library search paths by editing"
5589             echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
5590             echo " ${XQMAKESPEC}."
5591             exit 1
5592         fi
5593     elif [ "$CFG_OPENGL" = "desktop" ]; then
5594         # Desktop OpenGL support
5595         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengldesktop "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
5596         if [ $? != "0" ]; then
5597             echo "The OpenGL functionality test failed!"
5598             echo " You might need to modify the include and library search paths by editing"
5599             echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5600             echo " ${XQMAKESPEC}."
5601             exit 1
5602         fi
5603     fi
5604
5605     # auto-detect FontConfig support
5606     if [ "$CFG_FONTCONFIG" != "no" ]; then
5607         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
5608             QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
5609             QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null`
5610         else
5611             QT_CFLAGS_FONTCONFIG=
5612             QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig"
5613         fi
5614         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
5615                 QT_CONFIG="$QT_CONFIG fontconfig"
5616                 QMakeVar set QMAKE_CFLAGS_FONTCONFIG "$QT_CFLAGS_FONTCONFIG"
5617                 QMakeVar set QMAKE_LIBS_FONTCONFIG "$QT_LIBS_FONTCONFIG"
5618                 CFG_LIBFREETYPE=system
5619         fi
5620
5621     fi
5622
5623     # Save these for a check later
5624     ORIG_CFG_WAYLAND="$CFG_WAYLAND"
5625     ORIG_CFG_XCB="$CFG_XCB"
5626
5627     if [ "$CFG_WAYLAND" != "no" ]; then
5628         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists wayland-client 2>/dev/null; then
5629             QMAKE_CFLAGS_WAYLAND=`$PKG_CONFIG --cflags wayland-client 2>/dev/null`
5630             QMAKE_LIBS_WAYLAND=`$PKG_CONFIG --libs wayland-client 2>/dev/null`
5631             QMAKE_INCDIR_WAYLAND=`$PKG_CONFIG --variable=includedir wayland-client 2>/dev/null`
5632             QMAKE_LIBDIR_WAYLAND=`$PKG_CONFIG --variable=libdir wayland-client 2>/dev/null`
5633         fi
5634         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
5635             CFG_WAYLAND=yes
5636             QT_CONFIG="$QT_CONFIG wayland"
5637         elif [ "$CFG_WAYLAND" = "yes" ]; then
5638             echo "The Wayland functionality test failed!"
5639             exit 1
5640         else
5641             CFG_WAYLAND=no
5642             QMakeVar add DEFINES QT_NO_WAYLAND
5643         fi
5644     fi
5645
5646     if [ "$CFG_LIBUDEV" != "no" ]; then
5647         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libudev "libudev" $L_FLAGS $I_FLAGS $l_FLAGS; then
5648             CFG_LIBUDEV=yes
5649             QT_CONFIG="$QT_CONFIG libudev"
5650         elif [ "$CFG_LIBUDEV" = "yes" ]; then
5651             echo "The libudev functionality test failed!"
5652             exit 1
5653         else
5654             CFG_LIBUDEV=no
5655             QMakeVar add DEFINES QT_NO_LIBUDEV
5656         fi
5657     fi
5658
5659     if [ "$CFG_EVDEV" != "no" ]; then
5660         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/evdev "evdev" $L_FLAGS $I_FLAGS $l_FLAGS; then
5661             CFG_EVDEV=yes
5662             QT_CONFIG="$QT_CONFIG evdev"
5663         elif [ "$CFG_EVDEV" = "yes" ]; then
5664             echo "The evdev functionality test failed!"
5665             exit 1
5666         else
5667             CFG_EVDEV=no
5668             QMakeVar add DEFINES QT_NO_EVDEV
5669         fi
5670     fi
5671
5672     # Check we actually have X11 :-)
5673     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
5674         QT_CONFIG="$QT_CONFIG xlib"
5675     fi
5676
5677     # auto-detect Xrender support
5678     if [ "$CFG_XRENDER" != "no" ]; then
5679         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
5680             CFG_XRENDER=yes
5681             QT_CONFIG="$QT_CONFIG xrender"
5682         else
5683             if [ "$CFG_XRENDER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5684                 echo "Xrender support cannot be enabled due to functionality tests!"
5685                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5686                 echo " If you believe this message is in error you may use the continue"
5687                 echo " switch (-continue) to $0 to continue."
5688                 exit 101
5689             else
5690                 CFG_XRENDER=no
5691             fi
5692         fi
5693     fi
5694
5695     if [ "$CFG_XCB" != "no" ]; then
5696         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb "xcb" $L_FLAGS $I_FLAGS $l_FLAGS; then
5697             CFG_XCB=yes
5698             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
5699                 QT_CONFIG="$QT_CONFIG xcb-render"
5700             fi
5701
5702             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
5703                 CFG_XCB_LIMITED=no
5704                 QT_CONFIG="$QT_CONFIG xcb-poll-for-queued-event"
5705             fi
5706
5707             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
5708                 QT_CONFIG="$QT_CONFIG xcb-xlib"
5709             fi
5710
5711             if [ "$XPLATFORM_MAEMO" = "yes" ]; then
5712                 # auto-detect XInput2/Xinput support
5713                 if [ "$CFG_XINPUT2" != "no" ]; then
5714                     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
5715                     CFG_XINPUT2=yes
5716                     CFG_XINPUT=no
5717                     else
5718                         if [ "$CFG_XINPUT2" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5719                             echo "XInput2 support cannot be enabled due to functionality tests!"
5720                             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5721                             echo " If you believe this message is in error you may use the continue"
5722                             echo " switch (-continue) to $0 to continue."
5723                             exit 101
5724                         else
5725                             CFG_XINPUT2=no
5726                         fi
5727                     fi
5728                 fi
5729             fi
5730         else
5731             if [ "$CFG_XCB" = "yes" ]; then
5732                 echo "The XCB test failed!"
5733                 echo " You might need to install dependency packages."
5734                 echo " See src/plugins/platforms/xcb/README."
5735                 exit 1
5736             fi
5737             CFG_XCB=no
5738             QMakeVar add DEFINES QT_NO_XCB
5739         fi
5740     fi
5741
5742     # Detect libxkbcommon
5743     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xkbcommon 2>/dev/null; then
5744         QMAKE_CFLAGS_XKBCOMMON="`$PKG_CONFIG --cflags xkbcommon 2>/dev/null`"
5745         QMAKE_LIBS_XKBCOMMON="`$PKG_CONFIG --libs xkbcommon 2>/dev/null`"
5746         if [ "$CFG_WAYLAND" = "yes" ]; then
5747             QMAKE_CFLAGS_WAYLAND="$QMAKE_CFLAGS_WAYLAND $QMAKE_CFLAGS_XKBCOMMON"
5748             QMAKE_LIBS_WAYLAND="$QMAKE_LIBS_WAYLAND $QMAKE_LIBS_XKBCOMMON"
5749         fi
5750         QMAKE_CFLAGS_XCB="$QMAKE_CFLAGS_XCB $QMAKE_CFLAGS_XKBCOMMON"
5751         QMAKE_LIBS_XCB="$QMAKE_LIBS_XCB $QMAKE_LIBS_XKBCOMMON"
5752     else
5753         if [ "$CFG_WAYLAND" = "yes" ]; then
5754             QMAKE_DEFINES_WAYLAND=QT_NO_WAYLAND_XKB
5755         fi
5756         QMAKE_DEFINES_XCB=QT_NO_XCB_XKB
5757     fi
5758
5759     # QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero.
5760     if [ -n "$QMAKE_CFLAGS_WAYLAND" ] || [ -n "$QMAKE_LIBS_WAYLAND" ]; then
5761         QMakeVar set QMAKE_CFLAGS_WAYLAND "$QMAKE_CFLAGS_WAYLAND"
5762         QMakeVar set QMAKE_INCDIR_WAYLAND "$QMAKE_INCDIR_WAYLAND"
5763         QMakeVar set QMAKE_LIBS_WAYLAND "$QMAKE_LIBS_WAYLAND"
5764         QMakeVar set QMAKE_LIBDIR_WAYLAND "$QMAKE_LIBDIR_WAYLAND"
5765         QMakeVar set QMAKE_DEFINES_WAYLAND " $QMAKE_DEFINES_WAYLAND"
5766     fi
5767
5768     if [ -n "$QMAKE_CFLAGS_XCB" ] || [ -n "$QMAKE_LIBS_XCB" ]; then
5769         QMakeVar set QMAKE_CFLAGS_XCB "$QMAKE_CFLAGS_XCB"
5770         QMakeVar set QMAKE_LIBS_XCB "$QMAKE_LIBS_XCB"
5771         QMakeVar set QMAKE_DEFINES_XCB "$QMAKE_DEFINES_XCB"
5772     fi
5773
5774     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
5775         QT_CONFIG="$QT_CONFIG coreservices"
5776     else
5777         QMakeVar add DEFINES QT_NO_CORESERVICES
5778     fi
5779
5780     if [ "$PLATFORM_QPA" = "yes" ] && [ "$BUILD_ON_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ]; then
5781         if [ "$CFG_XCB" = "no" ] && [ "$CFG_WAYLAND" = "no" ]; then
5782             if [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_WAYLAND" = "auto" ]; then
5783                 echo "No QPA platform plugin enabled!"
5784                 echo " If you really want to build without a QPA platform plugin you must pass"
5785                 echo " -no-xcb and -no-wayland to configure. Doing this will produce a Qt that"
5786                 echo " cannot run GUI applications."
5787                 exit 1
5788             fi
5789         fi
5790     fi
5791
5792 fi
5793
5794
5795 # QWS
5796 if [ "$PLATFORM_QWS" = "yes" ]; then
5797
5798     # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
5799     if [ "$CFG_GUI" = "no" ]; then
5800         if [ "$CFG_OPENGL" = "auto" ]; then
5801             CFG_OPENGL=no
5802         fi
5803         if [ "$CFG_OPENGL" != "no" ]; then
5804             echo "OpenGL enabled, but GUI disabled."
5805             echo " You might need to either enable the GUI or disable OpenGL"
5806             exit 1
5807         fi
5808     fi
5809     if [ "$CFG_OPENGL" = "yes" ]; then
5810         CFG_EGL=auto
5811         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
5812             CFG_OPENGL=es2
5813         fi
5814     elif [ "$CFG_OPENGL" = "es2" ]; then
5815         #OpenGL ES 2.x
5816         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS
5817         if [ $? != "0" ]; then
5818             echo "The OpenGL ES 2.0 functionality test failed!"
5819             echo " You might need to modify the include and library search paths by editing"
5820             echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5821             echo " ${XQMAKESPEC}."
5822             exit 1
5823         fi
5824         CFG_EGL=yes
5825     elif [ "$CFG_OPENGL" = "desktop" ]; then
5826         # Desktop OpenGL support
5827         echo "Desktop OpenGL support is not avaliable on Qt for Embedded Linux"
5828         exit 1
5829     fi
5830 fi
5831
5832 if [ "$PLATFORM_QWS" = "yes" ]; then
5833
5834     # screen drivers
5835     for screen in ${CFG_GFX_ON} ${CFG_GFX_PLUGIN}; do
5836        if [ "${screen}" = "ahi" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
5837            "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/ahi "Ahi" $L_FLAGS $I_FLAGS $l_FLAGS
5838            if [ $? != "0" ]; then
5839                echo "The Ahi screen driver functionality test failed!"
5840                echo " You might need to modify the include and library search paths by editing"
5841                echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
5842                echo " ${XQMAKESPEC}."
5843                exit 1
5844            fi
5845        fi
5846
5847        if [ "${screen}" = "svgalib" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
5848            "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/svgalib "SVGAlib" $L_FLAGS $I_FLAGS $l_FLAGS
5849            if [ $? != "0" ]; then
5850                echo "The SVGAlib screen driver functionality test failed!"
5851                echo " You might need to modify the include and library search paths by editing"
5852                echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
5853                echo " ${XQMAKESPEC}."
5854                exit 1
5855            fi
5856        fi
5857
5858        if [ "${screen}" = "directfb" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
5859            if test -n "$PKG_CONFIG" && "$PKG_CONFIG" --exists directfb 2>/dev/null; then
5860                QT_CFLAGS_DIRECTFB=`$PKG_CONFIG --cflags directfb 2>/dev/null`
5861                QT_LIBS_DIRECTFB=`$PKG_CONFIG --libs directfb 2>/dev/null`
5862            elif directfb-config --version >/dev/null 2>&1; then
5863                QT_CFLAGS_DIRECTFB=`directfb-config --cflags 2>/dev/null`
5864                QT_LIBS_DIRECTFB=`directfb-config --libs 2>/dev/null`
5865            fi
5866
5867            # QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero.
5868            if [ -n "$QT_CFLAGS_DIRECTFB" ] || [ -n "$QT_LIBS_DIRECTFB" ]; then
5869                QMakeVar set QT_CFLAGS_DIRECTFB "$QT_CFLAGS_DIRECTFB"
5870                QMakeVar set QT_LIBS_DIRECTFB "$QT_LIBS_DIRECTFB"
5871            fi
5872
5873            "$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
5874            if [ $? != "0" ]; then
5875                echo "The DirectFB screen driver functionality test failed!"
5876                echo " You might need to modify the include and library search paths by editing"
5877                echo " QT_CFLAGS_DIRECTFB and QT_LIBS_DIRECTFB in"
5878                echo " ${XQMAKESPEC}."
5879                exit 1
5880            fi
5881        fi
5882
5883     done
5884
5885     # mouse drivers
5886     for mouse in ${CFG_MOUSE_ON} ${CFG_MOUSE_PLUGIN}; do
5887         if [ "${mouse}" = "tslib" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
5888             "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tslib "tslib" $L_FLAGS $I_FLAGS $l_FLAGS
5889             if [ $? != "0" ]; then
5890                echo "The tslib functionality test failed!"
5891                echo " You might need to modify the include and library search paths by editing"
5892                echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
5893                echo " ${XQMAKESPEC}."
5894                 exit 1
5895             fi
5896         fi
5897     done
5898
5899     CFG_QGTKSTYLE=no
5900
5901     # sound
5902     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/sound "sound" $L_FLAGS $I_FLAGS $l_FLAGS
5903     if [ $? != "0" ]; then
5904         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SOUND"
5905     fi
5906
5907 fi # QWS
5908
5909 EGL_VARIANT=none
5910 # EGL Support
5911 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then
5912     if [ "$CFG_EGL" != "no" ]; then
5913         # detect EGL support
5914         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
5915             # EGL specified by QMAKE_*_EGL, included with <EGL/egl.h>
5916             EGL_VARIANT=regular
5917             CFG_EGL=yes
5918         fi
5919
5920         if [ "$EGL_VARIANT" = "none" ]; then
5921             if [ "$CFG_EGL" = "yes" ]; then
5922                 echo "The EGL functionality test failed!"
5923                 echo " EGL is required for OpenGL ES to manage contexts & surfaces."
5924                 echo " You might need to modify the include and library search paths by editing"
5925                 echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in"
5926                 echo " ${XQMAKESPEC}."
5927                 exit 1
5928             fi
5929             CFG_EGL=no
5930             # If QtOpenGL would be built against OpenGL ES, disable it as we can't to that if EGL is missing
5931             if [ "$CFG_OPENGL" = "es2" ]; then
5932                 CFG_OPENGL=no
5933             fi
5934         fi
5935     fi
5936 fi
5937
5938 [ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_PHONON" != "no" ] && CFG_PHONON="yes"
5939
5940 # freetype support
5941 [ "x$CFG_EMBEDDED" != "xno" ] && CFG_LIBFREETYPE="$CFG_QWS_FREETYPE"
5942 [ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_LIBFREETYPE" = "auto" ] && CFG_LIBFREETYPE=no
5943 if [ "$CFG_LIBFREETYPE" = "auto" ]; then
5944     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
5945         CFG_LIBFREETYPE=system
5946     else
5947         CFG_LIBFREETYPE=yes
5948     fi
5949 fi
5950
5951 if [ "$CFG_ENDIAN" = "auto" ]; then
5952     if [ "$XPLATFORM_MINGW" = "yes" ]; then
5953         CFG_ENDIAN="Q_LITTLE_ENDIAN"
5954     elif [ "$BUILD_ON_MAC" = "yes" ]; then
5955         true #leave as auto
5956     else
5957         "$unixtests/endian.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "QMAKE_LFLAGS+=$SYSROOT_FLAG"
5958         F="$?"
5959         if [ "$F" -eq 0 ]; then
5960             CFG_ENDIAN="Q_LITTLE_ENDIAN"
5961         elif [ "$F" -eq 1 ]; then
5962             CFG_ENDIAN="Q_BIG_ENDIAN"
5963         else
5964             echo
5965             echo "The target system byte order could not be detected!"
5966             echo "Turn on verbose messaging (-v) to see the final report."
5967             echo "You can use the -little-endian or -big-endian switch to"
5968             echo "$0 to continue."
5969             exit 101
5970         fi
5971     fi
5972 fi
5973
5974 if [ "$CFG_HOST_ENDIAN" = "auto" ]; then
5975     if [ "$BUILD_ON_MAC" = "yes" ]; then
5976         true #leave as auto
5977     else
5978         "$unixtests/endian.test" "$QMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
5979         F="$?"
5980         if [ "$F" -eq 0 ]; then
5981             CFG_HOST_ENDIAN="Q_LITTLE_ENDIAN"
5982         elif [ "$F" -eq 1 ]; then
5983             CFG_HOST_ENDIAN="Q_BIG_ENDIAN"
5984         else
5985             echo
5986             echo "The host system byte order could not be detected!"
5987             echo "Turn on verbose messaging (-v) to see the final report."
5988             echo "You can use the -host-little-endian or -host-big-endian switch to"
5989             echo "$0 to continue."
5990             exit 101
5991         fi
5992     fi
5993 fi
5994
5995 if [ "$CFG_ARMFPA" != "auto" ]; then
5996     if [ "$CFG_ARMFPA" = "yes" ]; then
5997         if [ "$CFG_ENDIAN" = "Q_LITTLE_ENDIAN" ]; then
5998             CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE_SWAPPED"
5999         else
6000             CFG_DOUBLEFORMAT="Q_DOUBLE_BIG_SWAPPED"
6001         fi
6002     else
6003         CFG_DOUBLEFORMAT="normal"
6004     fi
6005 fi
6006
6007
6008 if [ "$CFG_DOUBLEFORMAT" = "auto" ]; then
6009     if [ "$PLATFORM_QWS" != "yes" -o "$PLATFORM_QPA" = "yes" ]; then
6010         CFG_DOUBLEFORMAT=normal
6011     else
6012         "$unixtests/doubleformat.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
6013         F="$?"
6014         if [ "$F" -eq 10 ] && [ "$CFG_ENDIAN" = "Q_LITTLE_ENDIAN" ]; then
6015             CFG_DOUBLEFORMAT=normal
6016         elif [ "$F" -eq 11 ] && [ "$CFG_ENDIAN" = "Q_BIG_ENDIAN" ]; then
6017             CFG_DOUBLEFORMAT=normal
6018         elif [ "$F" -eq 10 ]; then
6019             CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE"
6020         elif [ "$F" -eq 11 ]; then
6021             CFG_DOUBLEFORMAT="Q_DOUBLE_BIG"
6022         elif [ "$F" -eq 12 ]; then
6023             CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE_SWAPPED"
6024             CFG_ARMFPA="yes"
6025         elif [ "$F" -eq 13 ]; then
6026             CFG_DOUBLEFORMAT="Q_DOUBLE_BIG_SWAPPED"
6027             CFG_ARMFPA="yes"
6028         else
6029             echo
6030             echo "The system floating point format could not be detected."
6031             echo "This may cause data to be generated in a wrong format"
6032             echo "Turn on verbose messaging (-v) to see the final report."
6033             # we do not fail on this since this is a new test, and if it fails,
6034             # the old behavior should be correct in most cases
6035             CFG_DOUBLEFORMAT=normal
6036         fi
6037     fi
6038 fi
6039
6040 HAVE_STL=no
6041 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stl "STL" $L_FLAGS $I_FLAGS $l_FLAGS; then
6042     HAVE_STL=yes
6043 fi
6044
6045 if [ "$CFG_STL" != "no" ]; then
6046     if [ "$HAVE_STL" = "yes" ]; then
6047         CFG_STL=yes
6048     else
6049         if [ "$CFG_STL" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6050             echo "STL support cannot be enabled due to functionality tests!"
6051             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6052             echo " If you believe this message is in error you may use the continue"
6053             echo " switch (-continue) to $0 to continue."
6054             exit 101
6055         else
6056             CFG_STL=no
6057         fi
6058     fi
6059 fi
6060
6061 # detect POSIX clock_gettime()
6062 if [ "$CFG_CLOCK_GETTIME" = "auto" ]; then
6063     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
6064         CFG_CLOCK_GETTIME=yes
6065     else
6066         CFG_CLOCK_GETTIME=no
6067     fi
6068 fi
6069
6070 # detect POSIX monotonic clocks
6071 if [ "$CFG_CLOCK_GETTIME" = "yes" ] && [ "$CFG_CLOCK_MONOTONIC" = "auto" ]; then
6072     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
6073         CFG_CLOCK_MONOTONIC=yes
6074     else
6075         CFG_CLOCK_MONOTONIC=no
6076     fi
6077 elif [ "$CFG_CLOCK_GETTIME" = "no" ]; then
6078     CFG_CLOCK_MONOTONIC=no
6079 fi
6080
6081 # detect mremap
6082 if [ "$CFG_MREMAP" = "auto" ]; then
6083     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mremap "mremap" $L_FLAGS $I_FLAGS $l_FLAGS; then
6084         CFG_MREMAP=yes
6085     else
6086         CFG_MREMAP=no
6087     fi
6088 fi
6089
6090 # find if the platform provides getaddrinfo (ipv6 dns lookups)
6091 if [ "$CFG_GETADDRINFO" != "no" ]; then
6092     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getaddrinfo "getaddrinfo" $L_FLAGS $I_FLAGS $l_FLAGS; then
6093         CFG_GETADDRINFO=yes
6094     else
6095         if [ "$CFG_GETADDRINFO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6096             echo "getaddrinfo support cannot be enabled due to functionality tests!"
6097             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6098             echo " If you believe this message is in error you may use the continue"
6099             echo " switch (-continue) to $0 to continue."
6100             exit 101
6101         else
6102             CFG_GETADDRINFO=no
6103         fi
6104     fi
6105 fi
6106
6107 # find if the platform provides inotify
6108 if [ "$CFG_INOTIFY" != "no" ]; then
6109     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/inotify "inotify" $L_FLAGS $I_FLAGS $l_FLAGS; then
6110         CFG_INOTIFY=yes
6111     else
6112         if [ "$CFG_INOTIFY" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6113             echo "inotify support cannot be enabled due to functionality tests!"
6114             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6115             echo " If you believe this message is in error you may use the continue"
6116             echo " switch (-continue) to $0 to continue."
6117             exit 101
6118         else
6119             CFG_INOTIFY=no
6120         fi
6121     fi
6122 fi
6123
6124 # find if the platform provides if_nametoindex (ipv6 interface name support)
6125 if [ "$CFG_IPV6IFNAME" != "no" ]; then
6126     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
6127         CFG_IPV6IFNAME=yes
6128     else
6129         if [ "$CFG_IPV6IFNAME" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6130             echo "IPv6 interface name support cannot be enabled due to functionality tests!"
6131             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6132             echo " If you believe this message is in error you may use the continue"
6133             echo " switch (-continue) to $0 to continue."
6134             exit 101
6135         else
6136             CFG_IPV6IFNAME=no
6137         fi
6138     fi
6139 fi
6140
6141 # find if the platform provides getifaddrs (network interface enumeration)
6142 if [ "$CFG_GETIFADDRS" != "no" ]; then
6143     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getifaddrs "getifaddrs" $L_FLAGS $I_FLAGS $l_FLAGS; then
6144         CFG_GETIFADDRS=yes
6145     else
6146         if [ "$CFG_GETIFADDRS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6147             echo "getifaddrs support cannot be enabled due to functionality tests!"
6148             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6149             echo " If you believe this message is in error you may use the continue"
6150             echo " switch (-continue) to $0 to continue."
6151             exit 101
6152         else
6153             CFG_GETIFADDRS=no
6154         fi
6155     fi
6156 fi
6157
6158 # detect OpenSSL
6159 if [ "$CFG_OPENSSL" != "no" ]; then
6160     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
6161         if [ "$CFG_OPENSSL" = "auto" ]; then
6162             CFG_OPENSSL=yes
6163         fi
6164     else
6165         if ( [ "$CFG_OPENSSL" = "yes" ] || [ "$CFG_OPENSSL" = "linked" ] ) && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6166             echo "OpenSSL support cannot be enabled due to functionality tests!"
6167             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6168             echo " If you believe this message is in error you may use the continue"
6169             echo " switch (-continue) to $0 to continue."
6170             exit 101
6171         else
6172             CFG_OPENSSL=no
6173         fi
6174     fi
6175 fi
6176
6177 # detect PCRE
6178 if [ "$CFG_PCRE" != "qt" ]; then
6179     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/pcre "PCRE" $L_FLAGS $I_FLAGS $l_FLAGS; then
6180         CFG_PCRE=system
6181     else
6182         if [ "$CFG_PCRE" = "system" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6183             echo "PCRE support cannot be enabled due to functionality tests!"
6184             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6185             echo " If you believe this message is in error you may use the continue"
6186             echo " switch (-continue) to $0 to continue."
6187             exit 101
6188         else
6189             CFG_PCRE=qt
6190         fi
6191     fi
6192 fi
6193
6194 # detect OpenVG support
6195 if [ "$CFG_OPENVG" != "no" ]; then
6196     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
6197         if [ "$CFG_OPENVG" = "auto" ]; then
6198             CFG_OPENVG=yes
6199         fi
6200     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
6201         if [ "$CFG_OPENVG" = "auto" ]; then
6202             CFG_OPENVG=yes
6203         fi
6204         CFG_OPENVG_ON_OPENGL=yes
6205     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
6206         if [ "$CFG_OPENVG" = "auto" ]; then
6207             CFG_OPENVG=yes
6208         fi
6209         CFG_OPENVG_LC_INCLUDES=yes
6210     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
6211         if [ "$CFG_OPENVG" = "auto" ]; then
6212             CFG_OPENVG=yes
6213         fi
6214         CFG_OPENVG_LC_INCLUDES=yes
6215         CFG_OPENVG_ON_OPENGL=yes
6216     else
6217         if [ "$CFG_OPENVG" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6218             echo "$CFG_OPENVG was specified for OpenVG but cannot be enabled due to functionality tests!"
6219             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6220             echo " If you believe this message is in error you may use the continue"
6221             echo " switch (-continue) to $0 to continue."
6222             exit 101
6223         else
6224             CFG_OPENVG=no
6225         fi
6226     fi
6227     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
6228         CFG_OPENVG_SHIVA=yes
6229     fi
6230 fi
6231
6232 if [ "$CFG_ALSA" = "auto" ]; then
6233     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/alsa "alsa" $L_FLAGS $I_FLAGS $l_FLAGS; then
6234         CFG_ALSA=yes
6235     else
6236         CFG_ALSA=no
6237     fi
6238 fi
6239
6240 if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ] || [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then 
6241     if [ "$CFG_ARCH" = "arm" ]; then
6242        "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/javascriptcore-jit "javascriptcore-jit" $L_FLAGS $I_FLAGS $l_FLAGS
6243         if [ $? != "0" ]; then
6244            CFG_JAVASCRIPTCORE_JIT=no
6245         fi
6246     else
6247         case "$XPLATFORM" in
6248             linux-icc*)
6249                 CFG_JAVASCRIPTCORE_JIT=no
6250                 ;;
6251         esac
6252     fi
6253 fi
6254
6255 if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ]; then
6256     QMakeVar set JAVASCRIPTCORE_JIT yes
6257 elif [ "$CFG_JAVASCRIPTCORE_JIT" = "no" ]; then
6258     QMakeVar set JAVASCRIPTCORE_JIT no
6259 fi
6260
6261 if [ "$CFG_AUDIO_BACKEND" = "auto" ]; then
6262     CFG_AUDIO_BACKEND=yes
6263 fi
6264
6265 if [ "$CFG_LARGEFILE" != "yes" ] && [ "$XPLATFORM_MINGW" = "yes" ]; then
6266     echo "Warning: largefile support cannot be disabled for win32."
6267     CFG_LARGEFILE="yes"
6268 fi
6269
6270 #-------------------------------------------------------------------------------
6271 # ask for all that hasn't been auto-detected or specified in the arguments
6272 #-------------------------------------------------------------------------------
6273
6274 ### fix this: user input should be validated in a loop
6275 if [ "$PLATFORM_QWS" = "yes" ]; then
6276     PROMPT_FOR_DEPTHS="yes"
6277 else
6278     PROMPT_FOR_DEPTHS="no"
6279 fi
6280 if [ "$CFG_QWS_DEPTHS" = "prompted" -a "$PROMPT_FOR_DEPTHS" = "yes" ]; then
6281     echo
6282     echo "Choose pixel-depths to support:"
6283     echo
6284     echo "   1. 1bpp, black/white"
6285     echo "   4. 4bpp, grayscale"
6286     echo "   8. 8bpp, paletted"
6287     echo "  12. 12bpp, rgb 4-4-4"
6288     echo "  15. 15bpp, rgb 5-5-5"
6289     echo "  16. 16bpp, rgb 5-6-5"
6290     echo "  18. 18bpp, rgb 6-6-6"
6291     echo "  24. 24bpp, rgb 8-8-8"
6292     echo "  32. 32bpp, argb 8-8-8-8 and rgb 8-8-8"
6293     echo " all. All supported depths"
6294     echo
6295     echo "Your choices (default 8,16,32):"
6296     read CFG_QWS_DEPTHS
6297     if [ -z "$CFG_QWS_DEPTHS" ] || [ "$CFG_QWS_DEPTHS" = "yes" ]; then
6298         CFG_QWS_DEPTHS=8,16,32
6299     fi
6300 fi
6301 if [ -n "$CFG_QWS_DEPTHS" -a "$PLATFORM_QWS" = "yes" ]; then
6302     if [ "$CFG_QWS_DEPTHS" = "all" ]; then
6303         CFG_QWS_DEPTHS="1 4 8 12 15 16 18 24 32 generic"
6304     fi
6305     for D in `echo "$CFG_QWS_DEPTHS" | sed -e 's/,/ /g'`; do
6306         case $D in
6307             1|4|8|12|15|16|18|24|32) QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QWS_DEPTH_$D";;
6308             generic) QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QWS_DEPTH_GENERIC";;
6309         esac
6310     done
6311 fi
6312
6313 # enable dwarf2 support on Mac
6314 if [ "$CFG_MAC_DWARF2" = "yes" ]; then
6315     QT_CONFIG="$QT_CONFIG dwarf2"
6316 fi
6317
6318 # Set the default Mac OS X arch if there are no "-arch" arguments on the configure line
6319 if [ "$BUILD_ON_MAC" = "yes" ]; then
6320     DEFAULT_ARCH="$CFG_MAC_ARCHS"
6321     if [ -z "$DEFAULT_ARCH" ]; then
6322         case `file "${outpath}/bin/qmake"` in
6323         *i?86)
6324             DEFAULT_ARCH=x86
6325             ;;
6326         *x86_64)
6327             DEFAULT_ARCH=x86_64
6328             ;;
6329         *ppc|*ppc64|*)
6330             # unsupported/unknown
6331             ;;
6332         esac
6333     fi
6334     if [ -n "$DEFAULT_ARCH" ]; then
6335         [ "$OPT_VERBOSE" = "yes" ] && echo "Setting default Mac OS X architechture to $DEFAULT_ARCH."
6336         QT_CONFIG="$QT_CONFIG $DEFAULT_ARCH"
6337         QMAKE_CONFIG="$QMAKE_CONFIG $DEFAULT_ARCH"
6338         # Make the application arch follow the Qt arch for single arch builds.
6339         # (for multiple-arch builds, set CONFIG manually in the application .pro file)
6340         [ `echo "$DEFAULT_ARCH" | wc -w` -eq 1 ] && QTCONFIG_CONFIG="$QTCONFIG_CONFIG $DEFAULT_ARCH"
6341     fi
6342 fi
6343
6344 # ### Vestige
6345 if [ "$CFG_PHONON_BACKEND" = "yes" ]; then
6346     QT_CONFIG="$QT_CONFIG phonon-backend"
6347 fi
6348
6349 # disable accessibility
6350 if [ "$CFG_ACCESSIBILITY" = "no" ]; then
6351     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ACCESSIBILITY"
6352 else
6353     QT_CONFIG="$QT_CONFIG accessibility"
6354 fi
6355
6356 # egl stuff does not belong in lighthouse, but rather in plugins
6357 if [ "$PLATFORM_QPA" = "yes" ]; then
6358     CFG_EGL="no"
6359 fi
6360
6361 # enable egl
6362 if [ "$CFG_EGL" = "no" ]; then
6363     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGL"
6364 else
6365     QT_CONFIG="$QT_CONFIG egl"
6366     if [ "$CFG_EGL_GLES_INCLUDES" = "yes" ]; then
6367         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GLES_EGL"
6368     fi
6369 fi
6370
6371 # enable openvg
6372 if [ "$CFG_OPENVG" = "no" ]; then
6373     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENVG"
6374 else
6375     QT_CONFIG="$QT_CONFIG openvg"
6376     if [ "$CFG_OPENVG_LC_INCLUDES" = "yes" ]; then
6377         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LOWER_CASE_VG_INCLUDES"
6378     fi
6379     if [ "$CFG_OPENVG_ON_OPENGL" = "yes" ]; then
6380         QT_CONFIG="$QT_CONFIG openvg_on_opengl"
6381     fi
6382     if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
6383         QT_CONFIG="$QT_CONFIG shivavg"
6384         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SHIVAVG"
6385     fi
6386 fi
6387
6388 # enable opengl
6389 if [ "$CFG_OPENGL" = "no" ]; then
6390     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENGL"
6391 else
6392     QT_CONFIG="$QT_CONFIG opengl"
6393 fi
6394
6395 if [ "$CFG_OPENGL" = "es2" ]; then
6396     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES"
6397 fi
6398
6399 if [ "$CFG_OPENGL" = "es2" ]; then
6400     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_2"
6401     QT_CONFIG="$QT_CONFIG opengles2"
6402 fi
6403
6404 # safe execution environment
6405 if [ "$CFG_SXE" != "no" ]; then
6406     QT_CONFIG="$QT_CONFIG sxe"
6407 fi
6408
6409 # build up the variables for output
6410 if [ "$CFG_DEBUG" = "yes" ]; then
6411     QMAKE_OUTDIR="${QMAKE_OUTDIR}debug"
6412     QMAKE_CONFIG="$QMAKE_CONFIG debug"
6413 elif [ "$CFG_DEBUG" = "no" ]; then
6414     QMAKE_OUTDIR="${QMAKE_OUTDIR}release"
6415     QMAKE_CONFIG="$QMAKE_CONFIG release"
6416 fi
6417 if [ "$CFG_SHARED" = "yes" ]; then
6418     QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared"
6419     QMAKE_CONFIG="$QMAKE_CONFIG shared dll"
6420 elif [ "$CFG_SHARED" = "no" ]; then
6421     QMAKE_OUTDIR="${QMAKE_OUTDIR}-static"
6422     QMAKE_CONFIG="$QMAKE_CONFIG static"
6423 fi
6424 if [ "$PLATFORM_QWS" = "yes" ]; then
6425     QMAKE_OUTDIR="${QMAKE_OUTDIR}-emb-$CFG_EMBEDDED"
6426     QMAKE_CONFIG="$QMAKE_CONFIG embedded"
6427     QT_CONFIG="$QT_CONFIG embedded"
6428     rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
6429 fi
6430 if [ "$PLATFORM_QPA" = "yes" ]; then
6431     QMAKE_CONFIG="$QMAKE_CONFIG qpa"
6432     QT_CONFIG="$QT_CONFIG qpa"
6433     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qpa"
6434     rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
6435 fi
6436
6437 if [ "$CFG_EMBEDDED" = "nacl" ]; then
6438     QMAKE_CONFIG="$QMAKE_CONFIG nacl pepper"
6439     QT_CONFIG="$QT_CONFIG nacl pepper"
6440     rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
6441 fi
6442
6443 if [ "$XPLATFORM_MINGW" != "yes" ]; then
6444     # Do not set this here for Windows. Let qmake do it so
6445     # debug and release precompiled headers are kept separate.
6446     QMakeVar set PRECOMPILED_DIR ".pch/$QMAKE_OUTDIR"
6447 fi
6448 QMakeVar set OBJECTS_DIR ".obj/$QMAKE_OUTDIR"
6449 QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR"
6450 QMakeVar set RCC_DIR ".rcc/$QMAKE_OUTDIR"
6451 QMakeVar set UI_DIR ".uic/$QMAKE_OUTDIR"
6452 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
6453     QMAKE_CONFIG="$QMAKE_CONFIG largefile"
6454 fi
6455 if [ "$CFG_STL" = "no" ]; then
6456     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STL"
6457 else
6458     QMAKE_CONFIG="$QMAKE_CONFIG stl"
6459 fi
6460 if [ "$CFG_USE_GNUMAKE" = "yes" ]; then
6461     QMAKE_CONFIG="$QMAKE_CONFIG GNUmake"
6462 fi
6463 [ "$CFG_REDUCE_EXPORTS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_exports"
6464 [ "$CFG_REDUCE_RELOCATIONS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_relocations"
6465 [ "$CFG_PRECOMPILE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG precompile_header"
6466 if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
6467     QMakeVar add QMAKE_CFLAGS -g
6468     QMakeVar add QMAKE_CXXFLAGS -g
6469     QT_CONFIG="$QT_CONFIG separate_debug_info"
6470 fi
6471 if [ "$CFG_SEPARATE_DEBUG_INFO_NOCOPY" = "yes" ] ; then
6472     QT_CONFIG="$QT_CONFIG separate_debug_info_nocopy"
6473 fi
6474 [ "$CFG_MMX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mmx"
6475 [ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow"
6476 [ "$CFG_SSE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse"
6477 [ "$CFG_SSE2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse2"
6478 [ "$CFG_SSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse3"
6479 [ "$CFG_SSSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG ssse3"
6480 [ "$CFG_SSE4_1" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_1"
6481 [ "$CFG_SSE4_2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_2"
6482 [ "$CFG_AVX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG avx"
6483 [ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt"
6484 [ "$CFG_NEON" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG neon"
6485 if [ "$CFG_CLOCK_GETTIME" = "yes" ]; then
6486     QT_CONFIG="$QT_CONFIG clock-gettime"
6487 fi
6488 if [ "$CFG_CLOCK_MONOTONIC" = "yes" ]; then
6489     QT_CONFIG="$QT_CONFIG clock-monotonic"
6490 fi
6491 if [ "$CFG_MREMAP" = "yes" ]; then
6492     QT_CONFIG="$QT_CONFIG mremap"
6493 fi
6494 if [ "$CFG_GETADDRINFO" = "yes" ]; then
6495     QT_CONFIG="$QT_CONFIG getaddrinfo"
6496 fi
6497 if [ "$CFG_IPV6IFNAME" = "yes" ]; then
6498     QT_CONFIG="$QT_CONFIG ipv6ifname"
6499 fi
6500 if [ "$CFG_GETIFADDRS" = "yes" ]; then
6501     QT_CONFIG="$QT_CONFIG getifaddrs"
6502 fi
6503 if [ "$CFG_INOTIFY" = "yes" ]; then
6504     QT_CONFIG="$QT_CONFIG inotify"
6505 fi
6506 if [ "$CFG_LIBJPEG" = "no" ]; then
6507     CFG_JPEG="no"
6508 elif [ "$CFG_LIBJPEG" = "system" ]; then
6509     QT_CONFIG="$QT_CONFIG system-jpeg"
6510 fi
6511 if [ "$CFG_JPEG" = "no" ]; then
6512     QT_CONFIG="$QT_CONFIG no-jpeg"
6513 elif [ "$CFG_JPEG" = "yes" ]; then
6514     QT_CONFIG="$QT_CONFIG jpeg"
6515 fi
6516 if [ "$CFG_LIBPNG" = "no" ]; then
6517     CFG_PNG="no"
6518 fi
6519 if [ "$CFG_LIBPNG" = "system" ]; then
6520     QT_CONFIG="$QT_CONFIG system-png"
6521 fi
6522 if [ "$CFG_PNG" = "no" ]; then
6523     QT_CONFIG="$QT_CONFIG no-png"
6524 elif [ "$CFG_PNG" = "yes" ]; then
6525     QT_CONFIG="$QT_CONFIG png"
6526 fi
6527 if [ "$CFG_GIF" = "no" ]; then
6528     QT_CONFIG="$QT_CONFIG no-gif"
6529 elif [ "$CFG_GIF" = "yes" ]; then
6530     QT_CONFIG="$QT_CONFIG gif"
6531 fi
6532 if [ "$CFG_LIBFREETYPE" = "no" ]; then
6533     QT_CONFIG="$QT_CONFIG no-freetype"
6534     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FREETYPE"
6535 elif [ "$CFG_LIBFREETYPE" = "system" ]; then
6536     QT_CONFIG="$QT_CONFIG system-freetype"
6537 else
6538     QT_CONFIG="$QT_CONFIG freetype"
6539 fi
6540 if [ "$CFG_GUI" = "auto" ]; then
6541     CFG_GUI="yes"
6542 fi
6543 if [ "$CFG_GUI" = "no" ]; then
6544     QT_CONFIG="$QT_CONFIG no-gui"
6545 else
6546     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GUI"
6547 fi
6548
6549
6550 if [ "x$BUILD_ON_MAC" = "xyes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
6551     #On Mac we implicitly link against libz, so we
6552     #never use the 3rdparty stuff.
6553     [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system"
6554 fi
6555 if [ "$CFG_ZLIB" = "yes" ]; then
6556     QT_CONFIG="$QT_CONFIG zlib"
6557 elif [ "$CFG_ZLIB" = "system" ]; then
6558     QT_CONFIG="$QT_CONFIG system-zlib"
6559 fi
6560
6561 [ "$CFG_NIS" = "yes" ] && QT_CONFIG="$QT_CONFIG nis"
6562 [ "$CFG_CUPS" = "yes" ] && QT_CONFIG="$QT_CONFIG cups"
6563 [ "$CFG_ICONV" = "yes" ] && QT_CONFIG="$QT_CONFIG iconv"
6564 [ "$CFG_ICONV" = "sun" ] && QT_CONFIG="$QT_CONFIG sun-libiconv"
6565 [ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv"
6566 [ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib"
6567 [ "$CFG_GSTREAMER" = "yes" ] && QT_CONFIG="$QT_CONFIG gstreamer"
6568 [ "$CFG_DBUS" = "yes" ] && QT_CONFIG="$QT_CONFIG dbus"
6569 [ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus dbus-linked"
6570 [ "$CFG_NAS" = "system" ] && QT_CONFIG="$QT_CONFIG nas"
6571 [ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl"
6572 [ "$CFG_OPENSSL" = "linked" ] && QT_CONFIG="$QT_CONFIG openssl-linked"
6573 [ "$CFG_MAC_HARFBUZZ" = "yes" ] && QT_CONFIG="$QT_CONFIG harfbuzz"
6574 [ "$CFG_XCB" = "yes" ] && QT_CONFIG="$QT_CONFIG xcb"
6575 [ "$CFG_XINPUT2" = "yes" ] && QT_CONFIG="$QT_CONFIG xinput2"
6576
6577 if [ "$PLATFORM_X11" = "yes" ]; then
6578     [ "$CFG_SM" = "yes" ] && QT_CONFIG="$QT_CONFIG x11sm"
6579
6580     # for some reason, the following libraries are not always built shared,
6581     # so *every* program/lib (including Qt) has to link against them
6582     if [ "$CFG_XSHAPE" = "yes" ]; then
6583         QT_CONFIG="$QT_CONFIG xshape"
6584     fi
6585     if [ "$CFG_XVIDEO" = "yes" ]; then
6586         QT_CONFIG="$QT_CONFIG xvideo"
6587     fi
6588     if [ "$CFG_XSYNC" = "yes" ]; then
6589         QT_CONFIG="$QT_CONFIG xsync"
6590     fi
6591     if [ "$CFG_XINERAMA" = "yes" ]; then
6592         QT_CONFIG="$QT_CONFIG xinerama"
6593         QMakeVar set QMAKE_LIBS_X11 '-lXinerama $$QMAKE_LIBS_X11'
6594     fi
6595     if [ "$CFG_XCURSOR" = "yes" ]; then
6596         QT_CONFIG="$QT_CONFIG xcursor"
6597         QMakeVar set QMAKE_LIBS_X11 '-lXcursor $$QMAKE_LIBS_X11'
6598     fi
6599     if [ "$CFG_XFIXES" = "yes" ]; then
6600         QT_CONFIG="$QT_CONFIG xfixes"
6601         QMakeVar set QMAKE_LIBS_X11 '-lXfixes $$QMAKE_LIBS_X11'
6602     fi
6603     if [ "$CFG_XRANDR" = "yes" ]; then
6604         QT_CONFIG="$QT_CONFIG xrandr"
6605         if [ "$CFG_XRENDER" != "yes" ]; then
6606             # libXrandr uses 1 function from libXrender, so we always have to have it :/
6607             QMakeVar set QMAKE_LIBS_X11 '-lXrandr -lXrender $$QMAKE_LIBS_X11'
6608         else
6609             QMakeVar set QMAKE_LIBS_X11 '-lXrandr $$QMAKE_LIBS_X11'
6610         fi
6611     fi
6612     if [ "$CFG_XRENDER" = "yes" ]; then
6613         QT_CONFIG="$QT_CONFIG xrender"
6614         QMakeVar set QMAKE_LIBS_X11 '-lXrender $$QMAKE_LIBS_X11'
6615     fi
6616     if [ "$CFG_MITSHM" = "yes" ]; then
6617         QT_CONFIG="$QT_CONFIG mitshm"
6618     fi
6619     if [ "$CFG_FONTCONFIG" = "yes" ]; then
6620         QT_CONFIG="$QT_CONFIG fontconfig"
6621     fi
6622     if [ "$CFG_XINPUT" = "yes" ]; then
6623         QMakeVar set QMAKE_LIBS_X11 '-lXi $$QMAKE_LIBS_X11'
6624     fi
6625     if [ "$CFG_XINPUT" = "yes" ]; then
6626         QT_CONFIG="$QT_CONFIG xinput tablet"
6627     fi
6628     if [ "$CFG_XKB" = "yes" ]; then
6629         QT_CONFIG="$QT_CONFIG xkb"
6630     fi
6631 fi
6632
6633 [ '!' -z "$D_FLAGS" ] && QMakeVar add DEFINES "$D_FLAGS"
6634 [ '!' -z "$L_FLAGS" ] && QMakeVar add QMAKE_LIBDIR_FLAGS "$L_FLAGS"
6635 [ '!' -z "$l_FLAGS" ] && QMakeVar add LIBS "$l_FLAGS"
6636
6637 if [ "$PLATFORM_MAC" = "yes" ]; then
6638     if [ "$CFG_RPATH" = "yes" ]; then
6639        QMAKE_CONFIG="$QMAKE_CONFIG absolute_library_soname"
6640     fi
6641 elif [ -z "`getQMakeConf \"$XQMAKESPEC\" | $AWK '/QMAKE_(LFLAGS_)?RPATH/ {print $3;}'`" ]; then
6642     if [ -n "$RPATH_FLAGS" ]; then
6643         echo
6644         echo "ERROR: -R cannot be used on this platform as \$QMAKE_LFLAGS_RPATH is"
6645         echo "       undefined."
6646         echo
6647         exit 1
6648     elif [ "$CFG_RPATH" = "yes" ]; then
6649         RPATH_MESSAGE="        NOTE: This platform does not support runtime library paths, using -no-rpath."
6650         CFG_RPATH=no
6651     fi
6652 else
6653     if [ "$CFG_RPATH" = "yes" ]; then
6654         # set the default rpath to the library installation directory
6655         RPATH_FLAGS="\"$QT_INSTALL_LIBS\" $RPATH_FLAGS"
6656     fi
6657     if [ -n "$RPATH_FLAGS" ]; then
6658         # add the user defined rpaths
6659         QMakeVar add QMAKE_RPATHDIR "$RPATH_FLAGS"
6660     fi
6661 fi
6662
6663 if [ '!' -z "$I_FLAGS" ]; then
6664     # add the user define include paths
6665     QMakeVar add QMAKE_CFLAGS "$I_FLAGS"
6666     QMakeVar add QMAKE_CXXFLAGS "$I_FLAGS"
6667 fi
6668
6669 if [ '!' -z "$W_FLAGS" ]; then
6670     # add the user defined warning flags
6671     QMakeVar add QMAKE_CFLAGS_WARN_ON "$W_FLAGS"
6672     QMakeVar add QMAKE_CXXFLAGS_WARN_ON "$W_FLAGS"
6673     QMakeVar add QMAKE_OBJECTIVE_CFLAGS_WARN_ON "$W_FLAGS"
6674 fi
6675
6676 # turn off exceptions for the compilers that support it
6677 if [ "$PLATFORM_QWS" = "yes" ]; then
6678     COMPILER=`echo $XPLATFORM | cut -f 3- -d-`
6679 elif [ "$XPLATFORM" != "$PLATFORM" ]; then
6680     COMPILER=`echo $XPLATFORM | cut -f 2- -d-`
6681 else
6682     COMPILER=`echo $PLATFORM | cut -f 2- -d-`
6683 fi
6684 if [ "$CFG_EXCEPTIONS" = "unspecified" -a "$PLATFORM_QWS" = "yes" ]; then
6685     CFG_EXCEPTIONS=no
6686 fi
6687
6688 if [ "$CFG_EXCEPTIONS" != "no" ]; then
6689     QTCONFIG_CONFIG="$QTCONFIG_CONFIG exceptions"
6690 fi
6691
6692 if [ "$XPLATFORM_MINGW" = "yes" ]; then
6693     # mkspecs/features/win32/default_pre.prf sets "no-rtti".
6694     # Follow default behavior of configure.exe by overriding with "rtti".
6695     QTCONFIG_CONFIG="$QTCONFIG_CONFIG rtti"
6696 fi
6697
6698 if [ "$CFG_ALSA" = "yes" ]; then
6699     QT_CONFIG="$QT_CONFIG alsa"
6700 fi
6701
6702 if [ "$CFG_PULSEAUDIO" = "yes" ]; then
6703     QT_CONFIG="$QT_CONFIG pulseaudio"
6704 fi
6705
6706 if [ "$CFG_COREWLAN" = "yes" ]; then
6707     QT_CONFIG="$QT_CONFIG corewlan"
6708 fi
6709
6710 if [ "$CFG_ICU" = "yes" ]; then
6711     QT_CONFIG="$QT_CONFIG icu"
6712 fi
6713
6714 if [ "$CFG_FORCE_ASSERTS" = "yes" ]; then
6715     QT_CONFIG="$QT_CONFIG force_asserts"
6716 fi
6717
6718 if [ "$CFG_PCRE" = "qt" ]; then
6719     QMAKE_CONFIG="$QMAKE_CONFIG pcre"
6720 fi
6721
6722 #
6723 # Some Qt modules are too advanced in C++ for some old compilers
6724 # Detect here the platforms where they are known to work.
6725 #
6726 # See Qt documentation for more information on which features are
6727 # supported and on which compilers.
6728 #
6729 canBuildQtConcurrent="yes"
6730 canUseV8Snapshot="yes"
6731
6732 case "$XPLATFORM" in
6733     hpux-g++*)
6734         # PA-RISC's assembly is too limited
6735         # gcc 3.4 on that platform can't build QtXmlPatterns
6736         # the assembly it generates cannot be compiled
6737
6738         # Check gcc's version
6739         case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
6740             4*)
6741                 ;;
6742             3.4*)
6743                 canBuildQtXmlPatterns="no"
6744                 ;;
6745             *)
6746                 canBuildWebKit="no"
6747                 canBuildQtXmlPatterns="no"
6748                 ;;
6749         esac
6750         ;;
6751     unsupported/vxworks-*-g++*)
6752         canBuildWebKit="no"
6753         ;;
6754     unsupported/vxworks-*-dcc*)
6755         canBuildWebKit="no"
6756         canBuildQtXmlPatterns="no"
6757         ;;
6758     *-g++*)
6759         # Check gcc's version
6760         case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
6761             4*|3.4*)
6762                 ;;
6763             3.3*)
6764                 canBuildWebKit="no"
6765                 ;;
6766             *)
6767                 canBuildWebKit="no"
6768                 canBuildQtXmlPatterns="no"
6769                 ;;
6770         esac
6771         ;;
6772     solaris-cc*)
6773         # Check the compiler version
6774         case `${QMAKE_CONF_COMPILER} -V 2>&1 | awk '{print $4}'` in
6775             5.[012345678])
6776                 canBuildWebKit="no"
6777                 canBuildQtXmlPatterns="no"
6778                 canBuildQtConcurrent="no"
6779                 ;;
6780             5.*)
6781                 canBuildWebKit="no"
6782                 canBuildQtConcurrent="no"
6783                 ;;
6784         esac
6785         ;;
6786     hpux-acc*)
6787         canBuildWebKit="no"
6788         canBuildQtXmlPatterns="no"
6789         canBuildQtConcurrent="no"
6790         ;;
6791     hpuxi-acc*)
6792         canBuildWebKit="no"
6793         ;;
6794     aix-xlc*)
6795         # Get the xlC version
6796         cat > xlcver.c <<EOF
6797 #include <stdio.h>
6798 int main()
6799 {
6800     printf("%d.%d\n", __xlC__ >> 8, __xlC__ & 0xFF);
6801     return 0;
6802 }
6803 EOF
6804         xlcver=
6805         if ${QMAKE_CONF_COMPILER} -o xlcver xlcver.c >/dev/null 2>/dev/null; then
6806             xlcver=`./xlcver 2>/dev/null`
6807             rm -f ./xlcver
6808         fi
6809         if [ "$OPT_VERBOSE" = "yes" ]; then
6810             if [ -n "$xlcver" ]; then
6811                 echo Found IBM xlC version: $xlcver.
6812             else
6813                 echo Could not determine IBM xlC version, assuming oldest supported.
6814             fi
6815         fi
6816
6817         case "$xlcver" in
6818             [123456].*)
6819                 canBuildWebKit="no"
6820                 canBuildQtXmlPatterns="no"
6821                 canBuildQtConcurrent="no"
6822                 ;;
6823             *)
6824                 canBuildWebKit="no"
6825                 canBuildQtConcurrent="no"
6826                 ;;
6827         esac
6828         ;;
6829     irix-cc*)
6830         canBuildWebKit="no"
6831         canBuildQtConcurrent="no"
6832         ;;
6833 esac
6834
6835 if [ "$CFG_GUI" = "no" ]; then
6836     # WebKit requires QtGui
6837     canBuildWebKit="no"
6838 fi
6839
6840 if [ "$CFG_SHARED" = "no" ]; then
6841     echo
6842     echo "WARNING: Using static linking will disable the WebKit module."
6843     echo
6844     canBuildWebKit="no"
6845 fi
6846
6847 CFG_CONCURRENT="yes"
6848 if [ "$canBuildQtConcurrent" = "no" ]; then
6849     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT"
6850     CFG_CONCURRENT="no"
6851 else
6852     QT_CONFIG="$QT_CONFIG concurrent"
6853 fi
6854
6855 # ### Vestige
6856 if [ "$CFG_AUDIO_BACKEND" = "yes" ]; then
6857     QT_CONFIG="$QT_CONFIG audio-backend"
6858 fi
6859
6860 # ### Vestige
6861 if [ "$CFG_WEBKIT" = "debug" ]; then
6862     QMAKE_CONFIG="$QMAKE_CONFIG webkit-debug"
6863 fi
6864
6865 # ### Vestige
6866 QT_CONFIG="$QT_CONFIG v8"
6867 # Detect snapshot support
6868 if [ "$CFG_ARCH" != "$CFG_HOST_ARCH" ]; then
6869     case "$CFG_HOST_ARCH,$CFG_ARCH" in
6870         i386,arm)
6871         ;;
6872     *) canUseV8Snapshot="no"
6873         ;;
6874     esac
6875 else
6876     if [ -n "$_SBOX_DIR" -a "$CFG_ARCH" = "arm" ]; then
6877         # QEMU crashes when building inside Scratchbox with an ARM target
6878         canUseV8Snapshot="no"
6879     fi
6880 fi
6881 if [ "$CFG_V8SNAPSHOT" = "auto" ]; then
6882     CFG_V8SNAPSHOT="$canUseV8Snapshot"
6883 fi
6884 if [ "$CFG_V8SNAPSHOT" = "yes" -a "$canUseV8Snapshot" = "no" ]; then
6885     echo "Error: V8 snapshot was requested, but is not supported on this platform."
6886     exit 1
6887 fi
6888 if [ "$CFG_V8SNAPSHOT" = "yes" ]; then
6889     QT_CONFIG="$QT_CONFIG v8snapshot"
6890 fi
6891
6892 # ### Vestige
6893 if [ "$CFG_DECLARATIVE_DEBUG" = "no" ]; then
6894     QCONFIG_FLAGS="$QCONFIG_FLAGS QDECLARATIVE_NO_DEBUG_PROTOCOL"
6895 fi
6896
6897 if [ "$CFG_EXCEPTIONS" = "no" ]; then
6898     case "$COMPILER" in
6899     g++*)
6900         QMakeVar add QMAKE_CFLAGS -fno-exceptions
6901         QMakeVar add QMAKE_CXXFLAGS -fno-exceptions
6902         QMakeVar add QMAKE_LFLAGS -fno-exceptions
6903         ;;
6904     cc*)
6905         case "$PLATFORM" in
6906         irix-cc*)
6907             QMakeVar add QMAKE_CFLAGS -LANG:exceptions=off
6908             QMakeVar add QMAKE_CXXFLAGS -LANG:exceptions=off
6909             QMakeVar add QMAKE_LFLAGS -LANG:exceptions=off
6910             ;;
6911         *) ;;
6912         esac
6913         ;;
6914     *) ;;
6915     esac
6916     QMAKE_CONFIG="$QMAKE_CONFIG exceptions_off"
6917 fi
6918
6919 case "$COMPILER" in
6920 g++*)
6921     # GNU C++
6922     COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -dumpversion 2>/dev/null`
6923
6924     case "$COMPILER_VERSION" in
6925     *.*.*)
6926         QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'`
6927         QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'`
6928         QT_GCC_PATCH_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'`
6929         ;;
6930     *.*)
6931         QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\1,'`
6932         QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\2,'`
6933         QT_GCC_PATCH_VERSION=0
6934         ;;
6935     esac
6936
6937     ;;
6938 *)
6939     #
6940     ;;
6941 esac
6942
6943 #-------------------------------------------------------------------------------
6944 # part of configuration information goes into qconfig.h
6945 #-------------------------------------------------------------------------------
6946
6947 case "$CFG_QCONFIG" in
6948 full)
6949     echo "/* Everything */" >"$outpath/src/corelib/global/qconfig.h.new"
6950     ;;
6951 *)
6952     tmpconfig="$outpath/src/corelib/global/qconfig.h.new"
6953     echo "#ifndef QT_BOOTSTRAPPED" >"$tmpconfig"
6954     if [ -f "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" ]; then
6955         cat "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" >>"$tmpconfig"
6956     elif [ -f `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` ]; then
6957         cat `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` >>"$tmpconfig"
6958     fi
6959     echo "#endif" >>"$tmpconfig"
6960     ;;
6961 esac
6962
6963 cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6964
6965 /* Qt Edition */
6966 #ifndef QT_EDITION
6967 #  define QT_EDITION $QT_EDITION
6968 #endif
6969
6970 /* Machine byte-order */
6971 #define Q_BIG_ENDIAN 4321
6972 #define Q_LITTLE_ENDIAN 1234
6973 EOF
6974
6975 echo "#ifdef QT_BOOTSTRAPPED" >>"$outpath/src/corelib/global/qconfig.h.new"
6976 if [ "$CFG_HOST_ENDIAN" = "auto" ]; then
6977     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6978 #if defined(__BIG_ENDIAN__)
6979 # define Q_BYTE_ORDER Q_BIG_ENDIAN
6980 #elif defined(__LITTLE_ENDIAN__)
6981 # define Q_BYTE_ORDER Q_LITTLE_ENDIAN
6982 #else
6983 # error "Unable to determine byte order!"
6984 #endif
6985 EOF
6986 else
6987     echo "#define Q_BYTE_ORDER $CFG_HOST_ENDIAN" >>"$outpath/src/corelib/global/qconfig.h.new"
6988 fi
6989 echo "#else" >>"$outpath/src/corelib/global/qconfig.h.new"
6990 if [ "$CFG_ENDIAN" = "auto" ]; then
6991     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6992 #if defined(__BIG_ENDIAN__)
6993 # define Q_BYTE_ORDER Q_BIG_ENDIAN
6994 #elif defined(__LITTLE_ENDIAN__)
6995 # define Q_BYTE_ORDER Q_LITTLE_ENDIAN
6996 #else
6997 # error "Unable to determine byte order!"
6998 #endif
6999 EOF
7000 else
7001     echo "#define Q_BYTE_ORDER $CFG_ENDIAN" >>"$outpath/src/corelib/global/qconfig.h.new"
7002 fi
7003 echo "#endif" >>"$outpath/src/corelib/global/qconfig.h.new"
7004
7005 if [ "$CFG_DOUBLEFORMAT" != "normal" ]; then
7006     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
7007 /* Non-IEEE double format */
7008 #define Q_DOUBLE_LITTLE "01234567"
7009 #define Q_DOUBLE_BIG "76543210"
7010 #define Q_DOUBLE_LITTLE_SWAPPED "45670123"
7011 #define Q_DOUBLE_BIG_SWAPPED "32107654"
7012 #define Q_DOUBLE_FORMAT $CFG_DOUBLEFORMAT
7013 EOF
7014 fi
7015 if [ "$CFG_ARMFPA" = "yes" ]; then
7016     if [ "$CFG_ARCH" != "$CFG_HOST_ARCH" ]; then
7017         cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
7018 #ifndef QT_BOOTSTRAPPED
7019 # define QT_ARMFPA
7020 #endif
7021 EOF
7022     else
7023         echo "#define QT_ARMFPA" >>"$outpath/src/corelib/global/qconfig.h.new"
7024     fi
7025 fi
7026
7027 CFG_ARCH_STR=`echo $CFG_ARCH | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7028 CFG_HOST_ARCH_STR=`echo $CFG_HOST_ARCH | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7029 cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
7030 /* Machine Architecture */
7031 #ifndef QT_BOOTSTRAPPED
7032 # define QT_ARCH_${CFG_ARCH_STR}
7033 #else
7034 # define QT_ARCH_${CFG_HOST_ARCH_STR}
7035 #endif
7036 EOF
7037
7038 echo '/* Compile time features */' >>"$outpath/src/corelib/global/qconfig.h.new"
7039 [ '!' -z "$LicenseKeyExt" ] && echo "#define QT_PRODUCT_LICENSEKEY \"$LicenseKeyExt\"" >>"$outpath/src/corelib/global/qconfig.h.new"
7040
7041 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
7042     echo "#define QT_LARGEFILE_SUPPORT 64" >>"$outpath/src/corelib/global/qconfig.h.new"
7043 fi
7044
7045 if [ "$CFG_FRAMEWORK" = "yes" ]; then
7046     echo "#define QT_MAC_FRAMEWORK_BUILD" >>"$outpath/src/corelib/global/qconfig.h.new"
7047 fi
7048
7049 if [ "$BUILD_ON_MAC" = "yes" ]; then
7050     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
7051 #if defined(__LP64__)
7052 # define QT_POINTER_SIZE 8
7053 #else
7054 # define QT_POINTER_SIZE 4
7055 #endif
7056 EOF
7057 else
7058     "$unixtests/ptrsize.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
7059     echo "#define QT_POINTER_SIZE $?" >>"$outpath/src/corelib/global/qconfig.h.new"
7060 fi
7061
7062 #REDUCE_RELOCATIONS is a elf/unix only thing, so not in windows configure.exe
7063 if [ "$CFG_REDUCE_RELOCATIONS" = "yes" ]; then
7064     echo "#define QT_REDUCE_RELOCATIONS" >>"$outpath/src/corelib/global/qconfig.h.new"
7065 fi
7066
7067
7068 echo "" >>"$outpath/src/corelib/global/qconfig.h.new"
7069
7070 if [ "$CFG_DEV" = "yes" ]; then
7071     echo "#define QT_BUILD_INTERNAL" >>"$outpath/src/corelib/global/qconfig.h.new"
7072 fi
7073
7074 # Embedded compile time options
7075 if [ "$PLATFORM_QWS" = "yes" ]; then
7076     # Add QWS to config.h
7077     QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QWS"
7078
7079     # Add excluded decorations to $QCONFIG_FLAGS
7080     decors=`grep '^decorations -= ' "$QMAKE_VARS_FILE" | ${AWK} '{print $3}'`
7081     for decor in $decors; do
7082         NODECORATION=`echo $decor | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7083         QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_NO_QWS_DECORATION_${NODECORATION}"
7084     done
7085
7086     # Figure which embedded drivers which are turned off
7087     CFG_GFX_OFF="$CFG_GFX_AVAILABLE"
7088     for ADRIVER in $CFG_GFX_ON; do
7089         CFG_GFX_OFF=`echo "${CFG_GFX_OFF} " | sed "s,${ADRIVER} ,,g"`
7090     done
7091
7092     CFG_KBD_OFF="$CFG_KBD_AVAILABLE"
7093     # the um driver is currently not in the available list for external builds
7094     if [ "$CFG_DEV" = "no" ]; then
7095         CFG_KBD_OFF="$CFG_KBD_OFF um"
7096     fi
7097     for ADRIVER in $CFG_KBD_ON; do
7098         CFG_KBD_OFF=`echo "${CFG_KBD_OFF} " | sed "s,${ADRIVER} ,,g"`
7099     done
7100
7101     CFG_MOUSE_OFF="$CFG_MOUSE_AVAILABLE"
7102     for ADRIVER in $CFG_MOUSE_ON; do
7103         CFG_MOUSE_OFF=`echo "${CFG_MOUSE_OFF} " | sed "s,${ADRIVER} ,,g"`
7104     done
7105
7106     for DRIVER in $CFG_GFX_OFF; do
7107         NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7108         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_$NODRIVER"
7109     done
7110
7111     for DRIVER in $CFG_KBD_OFF; do
7112         NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7113         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_KBD_$NODRIVER"
7114     done
7115
7116     for DRIVER in $CFG_MOUSE_OFF; do
7117         NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7118         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_MOUSE_$NODRIVER"
7119     done
7120 fi # QWS
7121
7122 if [ "$PLATFORM_QPA" = "yes" ]; then
7123     # Add QPA to config.h
7124     QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QPA QT_NO_QWS_QPF QT_NO_QWS_QPF2"
7125 fi
7126
7127 if [ "${CFG_USE_FLOATMATH}" = "yes" ]; then
7128     QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_USE_MATH_H_FLOATS"
7129 fi
7130
7131 # Add turned on SQL drivers
7132 for DRIVER in $CFG_SQL_AVAILABLE; do
7133     eval "VAL=\$CFG_SQL_$DRIVER"
7134     case "$VAL" in
7135     qt)
7136         ONDRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7137         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SQL_$ONDRIVER"
7138         SQL_DRIVERS="$SQL_DRIVERS $DRIVER"
7139     ;;
7140     plugin)
7141         SQL_PLUGINS="$SQL_PLUGINS $DRIVER"
7142     ;;
7143     esac
7144 done
7145
7146
7147 QMakeVar set sql-drivers "$SQL_DRIVERS"
7148 QMakeVar set sql-plugins "$SQL_PLUGINS"
7149
7150 # Add other configuration options to the qconfig.h file
7151 [ "$CFG_GIF" = "yes" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_BUILTIN_GIF_READER=1"
7152 [ "$CFG_PNG" != "yes" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_PNG"
7153 [ "$CFG_JPEG" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_JPEG"
7154 [ "$CFG_ZLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ZLIB"
7155 [ "$CFG_EXCEPTIONS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EXCEPTIONS"
7156 [ "$CFG_SXE" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SXE"
7157 [ "$CFG_DBUS" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS"
7158
7159 # X11/Unix/Mac only configs
7160 [ "$CFG_CUPS" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CUPS"
7161 [ "$CFG_ICONV" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ICONV"
7162 [ "$CFG_GLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GLIB"
7163 [ "$CFG_GSTREAMER" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GSTREAMER"
7164 [ "$CFG_QGTKSTYLE" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STYLE_GTK"
7165 [ "$CFG_CLOCK_MONOTONIC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CLOCK_MONOTONIC"
7166 [ "$CFG_MREMAP" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MREMAP"
7167 [ "$CFG_GETADDRINFO" = "no" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETADDRINFO"
7168 [ "$CFG_IPV6IFNAME" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IPV6IFNAME"
7169 [ "$CFG_GETIFADDRS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETIFADDRS"
7170 [ "$CFG_INOTIFY" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_INOTIFY"
7171 [ "$CFG_NAS" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NAS"
7172 [ "$CFG_NIS" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NIS"
7173 [ "$CFG_OPENSSL" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENSSL QT_NO_SSL"
7174 [ "$CFG_OPENSSL" = "linked" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LINKED_OPENSSL"
7175
7176 [ "$CFG_SM" = "no" ]         && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SESSIONMANAGER"
7177 [ "$CFG_XCURSOR" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XCURSOR"
7178 [ "$CFG_XFIXES" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XFIXES"
7179 [ "$CFG_FONTCONFIG" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FONTCONFIG"
7180 [ "$CFG_XINERAMA" = "no" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINERAMA"
7181 [ "$CFG_XKB" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XKB"
7182 [ "$CFG_XRANDR" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRANDR"
7183 [ "$CFG_XRENDER" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRENDER"
7184 [ "$CFG_MITSHM" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MITSHM"
7185 [ "$CFG_XSHAPE" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SHAPE"
7186 [ "$CFG_XVIDEO" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XVIDEO"
7187 [ "$CFG_XSYNC" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XSYNC"
7188 [ "$CFG_XINPUT" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINPUT QT_NO_TABLET"
7189
7190 [ "$CFG_XCURSOR" = "runtime" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XCURSOR"
7191 [ "$CFG_XINERAMA" = "runtime" ]  && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINERAMA"
7192 [ "$CFG_XFIXES" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XFIXES"
7193 [ "$CFG_XRANDR" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XRANDR"
7194 [ "$CFG_XINPUT" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINPUT"
7195 [ "$CFG_ALSA" = "no" ]           && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ALSA"
7196 [ "$CFG_PULSEAUDIO" = "no" ]          && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_PULSEAUDIO"
7197 [ "$CFG_COREWLAN" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_COREWLAN"
7198
7199 # sort QCONFIG_FLAGS for neatness if we can
7200 [ '!' -z "$AWK" ] && QCONFIG_FLAGS=`echo $QCONFIG_FLAGS | $AWK '{ gsub(" ", "\n"); print }' | sort | uniq`
7201 QCONFIG_FLAGS=`echo $QCONFIG_FLAGS`
7202
7203 if [ -n "$QCONFIG_FLAGS" ]; then
7204 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
7205 #ifndef QT_BOOTSTRAPPED
7206
7207 EOF
7208     for cfg in $QCONFIG_FLAGS; do
7209         cfgd=`echo $cfg | sed 's/=.*$//'` # trim pushed 'Foo=Bar' defines
7210         cfg=`echo $cfg | sed 's/=/ /'`    # turn first '=' into a space
7211         # figure out define logic, so we can output the correct
7212         # ifdefs to override the global defines in a project
7213         cfgdNeg=
7214         if [ true ] && echo "$cfgd" | grep 'QT_NO_' >/dev/null 2>&1; then
7215             # QT_NO_option can be forcefully turned on by QT_option
7216             cfgdNeg=`echo $cfgd | sed "s,QT_NO_,QT_,"`
7217         elif [ true ] && echo "$cfgd" | grep 'QT_' >/dev/null 2>&1; then
7218             # QT_option can be forcefully turned off by QT_NO_option
7219             cfgdNeg=`echo $cfgd | sed "s,QT_,QT_NO_,"`
7220         fi
7221
7222         if [ -z $cfgdNeg ]; then
7223 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
7224 #ifndef $cfgd
7225 # define $cfg
7226 #endif
7227
7228 EOF
7229         else
7230 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
7231 #if defined($cfgd) && defined($cfgdNeg)
7232 # undef $cfgd
7233 #elif !defined($cfgd) && !defined($cfgdNeg)
7234 # define $cfg
7235 #endif
7236
7237 EOF
7238         fi
7239     done
7240 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
7241 #endif // QT_BOOTSTRAPPED
7242
7243 EOF
7244 fi
7245
7246 if [ "$CFG_REDUCE_EXPORTS" = "yes" ]; then
7247 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
7248 #define QT_VISIBILITY_AVAILABLE
7249
7250 EOF
7251 fi
7252
7253 if [ -n "$QT_LIBINFIX" ]; then
7254 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
7255 #define QT_LIBINFIX "$QT_LIBINFIX"
7256
7257 EOF
7258 fi
7259
7260 # avoid unecessary rebuilds by copying only if qconfig.h has changed
7261 if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then
7262     rm -f "$outpath/src/corelib/global/qconfig.h.new"
7263 else
7264     [ -f "$outpath/src/corelib/global/qconfig.h" ] && chmod +w "$outpath/src/corelib/global/qconfig.h"
7265     mv "$outpath/src/corelib/global/qconfig.h.new" "$outpath/src/corelib/global/qconfig.h"
7266     chmod -w "$outpath/src/corelib/global/qconfig.h"
7267     for conf in "$outpath/include/QtCore/qconfig.h" "$outpath/include/Qt/qconfig.h"; do
7268         ln -s "$outpath/src/corelib/global/qconfig.h" "$conf"
7269     done
7270 fi
7271
7272 #-------------------------------------------------------------------------------
7273 # save configuration into qconfig.pri
7274 #-------------------------------------------------------------------------------
7275 QTCONFIG="$outpath/mkspecs/qconfig.pri"
7276 QTCONFIG_CONFIG="$QTCONFIG_CONFIG no_mocdepend"
7277 [ -f "$QTCONFIG.tmp" ] && rm -f "$QTCONFIG.tmp"
7278 if [ "$CFG_DEBUG" = "yes" ]; then
7279     QTCONFIG_CONFIG="$QTCONFIG_CONFIG debug"
7280     if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
7281         QT_CONFIG="$QT_CONFIG release"
7282     fi
7283     QT_CONFIG="$QT_CONFIG debug"
7284 elif [ "$CFG_DEBUG" = "no" ]; then
7285     QTCONFIG_CONFIG="$QTCONFIG_CONFIG release"
7286     if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
7287         QT_CONFIG="$QT_CONFIG debug"
7288     fi
7289     QT_CONFIG="$QT_CONFIG release"
7290 fi
7291 if [ "$CFG_STL" = "yes" ]; then
7292     QTCONFIG_CONFIG="$QTCONFIG_CONFIG stl"
7293 fi
7294 if [ "$CFG_FRAMEWORK" = "no" ]; then
7295     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_no_framework"
7296 else
7297     QT_CONFIG="$QT_CONFIG qt_framework"
7298     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_framework"
7299 fi
7300 if [ "$CFG_DEV" = "yes" ]; then
7301     QT_CONFIG="$QT_CONFIG private_tests"
7302 fi
7303
7304 cat >>"$QTCONFIG.tmp" <<EOF
7305 #configuration
7306 CONFIG += $QTCONFIG_CONFIG
7307 QT_ARCH = $CFG_ARCH
7308 QT_EDITION = $Edition
7309 QT_CONFIG += $QT_CONFIG
7310
7311 #versioning
7312 QT_VERSION = $QT_VERSION
7313 QT_MAJOR_VERSION = $QT_MAJOR_VERSION
7314 QT_MINOR_VERSION = $QT_MINOR_VERSION
7315 QT_PATCH_VERSION = $QT_PATCH_VERSION
7316
7317 #namespaces
7318 QT_LIBINFIX = $QT_LIBINFIX
7319 QT_NAMESPACE = $QT_NAMESPACE
7320
7321 EOF
7322 if [ -n "$CFG_SYSROOT" ]; then
7323     echo "# sysroot" >>"$QTCONFIG.tmp"
7324     echo `basename "$XQMAKESPEC"` \{ >>"$QTCONFIG.tmp"
7325     echo "  QT_SYSROOT      += \$\$quote($CFG_SYSROOT)" >>"$QTCONFIG.tmp"
7326     echo "  QMAKE_CFLAGS    += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp"
7327     echo "  QMAKE_CXXFLAGS  += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp"
7328     echo "  QMAKE_LFLAGS    += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp"
7329     echo "}" >> "$QTCONFIG.tmp"
7330     echo >> "$QTCONFIG.tmp"
7331 fi
7332 if [ "$CFG_RPATH" = "yes" ]; then
7333     echo "QMAKE_RPATHDIR += \"$QT_INSTALL_LIBS\"" >> "$QTCONFIG.tmp"
7334 fi
7335 if [ -n "$QT_GCC_MAJOR_VERSION" ]; then
7336     echo "QT_GCC_MAJOR_VERSION = $QT_GCC_MAJOR_VERSION" >> "$QTCONFIG.tmp"
7337     echo "QT_GCC_MINOR_VERSION = $QT_GCC_MINOR_VERSION" >> "$QTCONFIG.tmp"
7338     echo "QT_GCC_PATCH_VERSION = $QT_GCC_PATCH_VERSION" >> "$QTCONFIG.tmp"
7339 fi
7340
7341 if [ -n "$QMAKE_INCDIR_OPENGL_ES2" ]; then
7342     echo "#Qt opengl include path" >> "$QTCONFIG.tmp"
7343     echo "QMAKE_INCDIR_OPENGL_ES2 = \"$QMAKE_INCDIR_OPENGL_ES2\"" >> "$QTCONFIG.tmp"
7344 fi
7345
7346 # replace qconfig.pri if it differs from the newly created temp file
7347 if cmp -s "$QTCONFIG.tmp" "$QTCONFIG"; then
7348     rm -f "$QTCONFIG.tmp"
7349 else
7350     mv -f "$QTCONFIG.tmp" "$QTCONFIG"
7351 fi
7352
7353 #-------------------------------------------------------------------------------
7354 # save configuration into qmodule.pri
7355 #-------------------------------------------------------------------------------
7356 QTMODULE="$outpath/mkspecs/qmodule.pri"
7357
7358 echo "CONFIG += create_prl link_prl" >> "$QTMODULE.tmp"
7359
7360 # Ensure we can link to uninistalled libraries
7361 if [ "$XPLATFORM_MINGW" != "yes" ] && [ "$CFG_EMBEDDED" != "nacl" ] && linkerSupportsFlag -rpath-link "$outpath/lib"; then
7362     echo "QMAKE_LFLAGS    = -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib \$\$QMAKE_LFLAGS" >> "$QTMODULE.tmp"
7363 fi
7364 if [ -n "$QT_CFLAGS_PSQL" ]; then
7365     echo "QT_CFLAGS_PSQL   = $QT_CFLAGS_PSQL" >> "$QTMODULE.tmp"
7366 fi
7367 if [ -n "$QT_LFLAGS_PSQL" ]; then
7368     echo "QT_LFLAGS_PSQL   = $QT_LFLAGS_PSQL" >> "$QTMODULE.tmp"
7369 fi
7370 if [ -n "$QT_CFLAGS_MYSQL" ]; then
7371     echo "QT_CFLAGS_MYSQL   = $QT_CFLAGS_MYSQL" >> "$QTMODULE.tmp"
7372 fi
7373 if [ -n "$QT_LFLAGS_MYSQL" ]; then
7374     echo "QT_LFLAGS_MYSQL   = $QT_LFLAGS_MYSQL" >> "$QTMODULE.tmp"
7375 fi
7376 if [ -n "$QT_CFLAGS_SQLITE" ]; then
7377     echo "QT_CFLAGS_SQLITE   = $QT_CFLAGS_SQLITE" >> "$QTMODULE.tmp"
7378 fi
7379 if [ -n "$QT_LFLAGS_SQLITE" ]; then
7380     echo "QT_LFLAGS_SQLITE   = $QT_LFLAGS_SQLITE" >> "$QTMODULE.tmp"
7381 fi
7382 if [ -n "$QT_LFLAGS_ODBC" ]; then
7383     echo "QT_LFLAGS_ODBC   = $QT_LFLAGS_ODBC" >> "$QTMODULE.tmp"
7384 fi
7385 if [ -n "$QT_LFLAGS_TDS" ]; then
7386     echo "QT_LFLAGS_TDS   = $QT_LFLAGS_TDS" >> "$QTMODULE.tmp"
7387 fi
7388
7389 if [ "$QT_EDITION" != "QT_EDITION_OPENSOURCE" ]; then
7390     echo "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" >> "$QTMODULE.tmp"
7391 fi
7392
7393 #dump in the OPENSSL_LIBS info
7394 if [ '!' -z "$OPENSSL_LIBS" ]; then
7395     echo "OPENSSL_LIBS = $OPENSSL_LIBS" >> "$QTMODULE.tmp"
7396 elif [ "$CFG_OPENSSL" = "linked" ]; then
7397     echo "OPENSSL_LIBS = -lssl -lcrypto" >> "$QTMODULE.tmp"
7398 fi
7399
7400 #dump in the SDK info
7401 if [ '!' -z "$CFG_SDK" ]; then
7402    echo "QMAKE_MAC_SDK = $CFG_SDK" >> "$QTMODULE.tmp"
7403 fi
7404
7405 # cmdline args
7406 cat "$QMAKE_VARS_FILE" >> "$QTMODULE.tmp"
7407 rm -f "$QMAKE_VARS_FILE" 2>/dev/null
7408
7409 # replace qmodule.pri if it differs from the newly created temp file
7410 if cmp -s "$QTMODULE.tmp" "$QTMODULE"; then
7411     rm -f "$QTMODULE.tmp"
7412 else
7413     mv -f "$QTMODULE.tmp" "$QTMODULE"
7414 fi
7415
7416 #-------------------------------------------------------------------------------
7417 # save configuration into .qmake.cache
7418 #-------------------------------------------------------------------------------
7419
7420 CACHEFILE="$outpath/.qmake.cache"
7421 [ -f "$CACHEFILE.tmp" ] && rm -f "$CACHEFILE.tmp"
7422 cat >>"$CACHEFILE.tmp" <<EOF
7423 #paths
7424 QT_SOURCE_TREE = \$\$quote($relpath)
7425 QT_BUILD_TREE = \$\$quote($outpath)
7426 QT_BUILD_PARTS = $CFG_BUILD_PARTS
7427
7428 #local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR
7429 QMAKE_MOC        = \$\$QT_BUILD_TREE/bin/moc
7430 QMAKE_UIC        = \$\$QT_BUILD_TREE/bin/uic
7431 QMAKE_RCC        = \$\$QT_BUILD_TREE/bin/rcc
7432 QMAKE_INCDIR_QT  = \$\$QT_BUILD_TREE/include
7433 QMAKE_LIBDIR_QT  = \$\$QT_BUILD_TREE/lib
7434
7435 include(\$\$PWD/mkspecs/qmodule.pri)
7436 CONFIG += $QMAKE_CONFIG dylib depend_includepath fix_output_dirs no_private_qt_headers_warning QTDIR_build
7437 QMAKE_ABSOLUTE_SOURCE_ROOT = \$\$QT_SOURCE_TREE
7438 QMAKE_MOC_SRC    = \$\$QT_BUILD_TREE/src/moc
7439
7440 EOF
7441
7442 #dump the qmake spec
7443 if [ -d "$outpath/mkspecs/$XPLATFORM" ]; then
7444    echo "QMAKESPEC = \$\$QT_BUILD_TREE/mkspecs/$XPLATFORM" >> "$CACHEFILE.tmp"
7445 else
7446    echo "QMAKESPEC = $XPLATFORM" >> "$CACHEFILE.tmp"
7447 fi
7448
7449 # incrementals
7450 INCREMENTAL=""
7451 [ "$CFG_INCREMENTAL" = "auto" ] && "$WHICH" p4 >/dev/null 2>&1 && [ "$CFG_DEV" = "yes" ] && CFG_INCREMENTAL="yes"
7452 if [ "$CFG_INCREMENTAL" = "yes" ]; then
7453     find "$relpath" -perm u+w -mtime -3 | grep 'cpp$' | while read f; do
7454         # don't need to worry about generated files
7455         [ -r `echo $f | sed "s,cpp$,ui,"` ] && continue
7456         basename "$f" | grep '^moc_' >/dev/null 2>&1 && continue
7457         # done
7458         INCREMENTAL="$INCREMENTAL `basename \"$f\" | sed 's,.cpp,.o,'`"
7459     done
7460     [ '!' -z "$INCREMENTAL" ] && echo "QMAKE_INCREMENTAL += $INCREMENTAL" >> "$CACHEFILE.tmp"
7461     [ -r "$outpath/.qmake.incremental" ] && echo "include($outpath/.qmake.incremental)" >> "$CACHEFILE.tmp"
7462 fi
7463
7464 # replace .qmake.cache if it differs from the newly created temp file
7465 if cmp -s "$CACHEFILE.tmp" "$CACHEFILE"; then
7466     rm -f "$CACHEFILE.tmp"
7467 else
7468     mv -f "$CACHEFILE.tmp" "$CACHEFILE"
7469 fi
7470
7471 #-------------------------------------------------------------------------------
7472 # give feedback on configuration
7473 #-------------------------------------------------------------------------------
7474
7475 case "$COMPILER" in
7476 g++*)
7477     if [ "$CFG_EXCEPTIONS" != "no" ]; then
7478         cat <<EOF
7479
7480         This target is using the GNU C++ compiler ($PLATFORM).
7481
7482         Recent versions of this compiler automatically include code for
7483         exceptions, which increase both the size of the Qt libraries and
7484         the amount of memory taken by your applications.
7485
7486         You may choose to re-run `basename $0` with the -no-exceptions
7487         option to compile Qt without exceptions. This is completely binary
7488         compatible, and existing applications will continue to work.
7489
7490 EOF
7491     fi
7492     ;;
7493 cc*)
7494     case "$PLATFORM" in
7495     irix-cc*)
7496         if [ "$CFG_EXCEPTIONS" != "no" ]; then
7497             cat <<EOF
7498
7499         This target is using the MIPSpro C++ compiler ($PLATFORM).
7500
7501         You may choose to re-run `basename $0` with the -no-exceptions
7502         option to compile Qt without exceptions. This will make the
7503         size of the Qt library smaller and reduce the amount of memory
7504         taken by your applications.
7505
7506 EOF
7507         fi
7508         ;;
7509     *) ;;
7510     esac
7511     ;;
7512 *) ;;
7513 esac
7514
7515 echo
7516 if [ "$XPLATFORM" = "$PLATFORM" ]; then
7517     echo "Build type:    $PLATFORM"
7518 else
7519     echo "Building on:   $PLATFORM"
7520     echo "Building for:  $XPLATFORM"
7521 fi
7522
7523 if [ ! -z "$CFG_MAC_ARCHS" ]; then
7524     echo "Architecture:  $CFG_ARCH ($CFG_MAC_ARCHS )"
7525 else
7526     echo "Architecture:  $CFG_ARCH"
7527 fi
7528
7529 if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
7530     echo "Host architecture: $CFG_HOST_ARCH"
7531 fi
7532
7533 if [ -n "$PLATFORM_NOTES" ]; then
7534     echo "Platform notes:"
7535     echo "$PLATFORM_NOTES"
7536 else
7537     echo
7538 fi
7539
7540 if [ "$OPT_VERBOSE" = "yes" ]; then
7541     echo $ECHO_N "qmake vars .......... $ECHO_C"
7542     cat "$QMAKE_VARS_FILE" | tr '\n' ' '
7543     echo "qmake switches ......... $QMAKE_SWITCHES"
7544 fi
7545
7546 [ "$CFG_INCREMENTAL" = "yes" ] && [ '!' -z "$INCREMENTAL" ] && echo "Incremental ............ $INCREMENTAL"
7547 echo "Build .................. $CFG_BUILD_PARTS"
7548 echo "Configuration .......... $QMAKE_CONFIG $QT_CONFIG"
7549 if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
7550    echo "Debug .................. yes (combined)"
7551    if [ "$CFG_DEBUG" = "yes" ]; then
7552        echo "Default Link ........... debug"
7553    else
7554        echo "Default Link ........... release"
7555    fi
7556 else
7557    echo "Debug .................. $CFG_DEBUG"
7558 fi
7559 [ "$CFG_DBUS" = "no" ]     && echo "QtDBus module .......... no"
7560 [ "$CFG_DBUS" = "yes" ]    && echo "QtDBus module .......... yes (run-time)"
7561 [ "$CFG_DBUS" = "linked" ] && echo "QtDBus module .......... yes (linked)"
7562 echo "QtConcurrent code ...... $CFG_CONCURRENT"
7563 echo "QtGui module ........... $CFG_GUI"
7564 if [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
7565     echo "JavaScriptCore JIT ..... To be decided by JavaScriptCore"
7566 else
7567     echo "JavaScriptCore JIT ..... $CFG_JAVASCRIPTCORE_JIT"
7568 fi
7569 echo "Declarative debugging ...$CFG_DECLARATIVE_DEBUG"
7570 echo "STL support ............ $CFG_STL"
7571 echo "PCH support ............ $CFG_PRECOMPILE"
7572 echo "MMX/3DNOW/SSE/SSE2/SSE3. ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}/${CFG_SSE3}"
7573 echo "SSSE3/SSE4.1/SSE4.2..... ${CFG_SSSE3}/${CFG_SSE4_1}/${CFG_SSE4_2}"
7574 echo "AVX..................... ${CFG_AVX}"
7575 if [ "$CFG_ARCH" = "arm" ] || [ "$CFG_ARCH" = "armv6" ]; then
7576     echo "iWMMXt support ......... ${CFG_IWMMXT}"
7577     echo "NEON support ........... ${CFG_NEON}"
7578 fi
7579 echo "IPv6 ifname support .... $CFG_IPV6IFNAME"
7580 echo "getaddrinfo support .... $CFG_GETADDRINFO"
7581 echo "getifaddrs support ..... $CFG_GETIFADDRS"
7582 echo "Accessibility .......... $CFG_ACCESSIBILITY"
7583 echo "NIS support ............ $CFG_NIS"
7584 echo "CUPS support ........... $CFG_CUPS"
7585 echo "Iconv support .......... $CFG_ICONV"
7586 echo "Glib support ........... $CFG_GLIB"
7587 echo "GStreamer support ...... $CFG_GSTREAMER"
7588 echo "PulseAudio support ..... $CFG_PULSEAUDIO"
7589 echo "Large File support ..... $CFG_LARGEFILE"
7590 echo "GIF support ............ $CFG_GIF"
7591 if [ "$CFG_JPEG" = "no" ]; then
7592     echo "JPEG support ........... $CFG_JPEG"
7593 else
7594     echo "JPEG support ........... $CFG_JPEG ($CFG_LIBJPEG)"
7595 fi
7596 if [ "$CFG_PNG" = "no" ]; then
7597     echo "PNG support ............ $CFG_PNG"
7598 else
7599     echo "PNG support ............ $CFG_PNG ($CFG_LIBPNG)"
7600 fi
7601 echo "zlib support ........... $CFG_ZLIB"
7602 echo "Session management ..... $CFG_SM"
7603 if [ "$PLATFORM_QWS" = "yes" ]; then
7604     echo "Embedded support ....... $CFG_EMBEDDED"
7605     if [ "$CFG_QWS_FREETYPE" = "auto" ]; then
7606         echo "Freetype2 support ...... $CFG_QWS_FREETYPE ($CFG_LIBFREETYPE)"
7607     else
7608         echo "Freetype2 support ...... $CFG_QWS_FREETYPE"
7609     fi
7610     # Normalize the decoration output first
7611     CFG_GFX_ON=`echo ${CFG_GFX_ON}`
7612     CFG_GFX_PLUGIN=`echo ${CFG_GFX_PLUGIN}`
7613     echo "Graphics (qt) .......... ${CFG_GFX_ON}"
7614     echo "Graphics (plugin) ...... ${CFG_GFX_PLUGIN}"
7615     CFG_DECORATION_ON=`echo ${CFG_DECORATION_ON}`
7616     CFG_DECORATION_PLUGIN=`echo ${CFG_DECORATION_PLUGIN}`
7617     echo "Decorations (qt) ....... $CFG_DECORATION_ON"
7618     echo "Decorations (plugin) ... $CFG_DECORATION_PLUGIN"
7619     CFG_KBD_ON=`echo ${CFG_KBD_ON}`
7620     CFG_KBD_PLUGIN=`echo ${CFG_KBD_PLUGIN}`
7621     echo "Keyboard driver (qt) ... ${CFG_KBD_ON}"
7622     echo "Keyboard driver (plugin) .. ${CFG_KBD_PLUGIN}"
7623     CFG_MOUSE_ON=`echo ${CFG_MOUSE_ON}`
7624     CFG_MOUSE_PLUGIN=`echo ${CFG_MOUSE_PLUGIN}`
7625     echo "Mouse driver (qt) ...... $CFG_MOUSE_ON"
7626     echo "Mouse driver (plugin) .. $CFG_MOUSE_PLUGIN"
7627 fi
7628 if [ "$CFG_OPENGL" = "desktop" ]; then
7629     echo "OpenGL support ......... yes (Desktop OpenGL)"
7630 elif [ "$CFG_OPENGL" = "es2" ]; then
7631     echo "OpenGL support ......... yes (OpenGL ES 2.x)"
7632 else
7633     echo "OpenGL support ......... no"
7634 fi
7635 if [ "$CFG_EGL" != "no" ]; then
7636     if [ "$CFG_EGL_GLES_INCLUDES" = "yes" ]; then
7637         echo "EGL support ............ yes <GLES/egl.h>"
7638     else
7639         echo "EGL support ............ yes <EGL/egl.h>"
7640     fi
7641 fi
7642 if [ "$CFG_OPENVG" ]; then
7643     if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
7644         echo "OpenVG support ......... ShivaVG"
7645     else
7646         echo "OpenVG support ......... $CFG_OPENVG"
7647     fi
7648 fi
7649 if [ "$PLATFORM_X11" = "yes" ]; then
7650     echo "NAS sound support ...... $CFG_NAS"
7651     echo "XShape support ......... $CFG_XSHAPE"
7652     echo "XVideo support ......... $CFG_XVIDEO"
7653     echo "XSync support .......... $CFG_XSYNC"
7654     echo "Xinerama support ....... $CFG_XINERAMA"
7655     echo "Xcursor support ........ $CFG_XCURSOR"
7656     echo "Xfixes support ......... $CFG_XFIXES"
7657     echo "Xrandr support ......... $CFG_XRANDR"
7658     echo "Xi support ............. $CFG_XINPUT"
7659     echo "MIT-SHM support ........ $CFG_MITSHM"
7660     echo "FontConfig support ..... $CFG_FONTCONFIG"
7661     echo "XKB Support ............ $CFG_XKB"
7662     echo "immodule support ....... $CFG_IM"
7663     echo "GTK theme support ...... $CFG_QGTKSTYLE"
7664 fi
7665 [ "$CFG_SQL_mysql" != "no" ] && echo "MySQL support .......... $CFG_SQL_mysql"
7666 [ "$CFG_SQL_psql" != "no" ] && echo "PostgreSQL support ..... $CFG_SQL_psql"
7667 [ "$CFG_SQL_odbc" != "no" ] && echo "ODBC support ........... $CFG_SQL_odbc"
7668 [ "$CFG_SQL_oci" != "no" ] && echo "OCI support ............ $CFG_SQL_oci"
7669 [ "$CFG_SQL_tds" != "no" ] && echo "TDS support ............ $CFG_SQL_tds"
7670 [ "$CFG_SQL_db2" != "no" ] && echo "DB2 support ............ $CFG_SQL_db2"
7671 [ "$CFG_SQL_ibase" != "no" ] && echo "InterBase support ...... $CFG_SQL_ibase"
7672 [ "$CFG_SQL_sqlite2" != "no" ] && echo "SQLite 2 support ....... $CFG_SQL_sqlite2"
7673 [ "$CFG_SQL_sqlite" != "no" ] && echo "SQLite support ......... $CFG_SQL_sqlite ($CFG_SQLITE)"
7674
7675 OPENSSL_LINKAGE=""
7676 if [ "$CFG_OPENSSL" = "yes" ]; then
7677     OPENSSL_LINKAGE="(run-time)"
7678 elif [ "$CFG_OPENSSL" = "linked" ]; then
7679     OPENSSL_LINKAGE="(linked)"
7680 fi
7681 echo "OpenSSL support ........ $CFG_OPENSSL $OPENSSL_LINKAGE"
7682 echo "Alsa support ........... $CFG_ALSA"
7683 if [ "$BUILD_ON_MAC" = "yes" ]; then
7684     echo "CoreWlan support ....... $CFG_COREWLAN"
7685 fi
7686 echo "libICU support ......... $CFG_ICU"
7687 echo "PCRE support ........... $CFG_PCRE"
7688 if [ "$CFG_XCB_LIMITED" = "yes" ] && [ "$CFG_XCB" = "yes" ]; then
7689     echo "Xcb support ............ limited (old version)"
7690 else
7691     echo "Xcb support ............ $CFG_XCB"
7692 fi
7693 echo "Xrender support ........ $CFG_XRENDER"
7694 if [ "$XPLATFORM_MAEMO" = "yes" ] && [ "$CFG_XCB" = "yes" ]; then
7695     echo "XInput2 support ........ $CFG_XINPUT2"
7696 fi
7697 echo
7698
7699 # complain about not being able to use dynamic plugins if we are using a static build
7700 if [ "$CFG_SHARED" = "no" ]; then
7701     echo
7702     echo "WARNING: Using static linking will disable the use of dynamically"
7703     echo "loaded plugins. Make sure to import all needed static plugins,"
7704     echo "or compile needed modules into the library."
7705     echo
7706 fi
7707 if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then
7708     echo
7709     echo "NOTE: When linking against OpenSSL, you can override the default"
7710     echo "library names through OPENSSL_LIBS."
7711     echo "For example:"
7712     echo "    OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked"
7713     echo
7714 fi
7715 if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then
7716     echo
7717     echo "Error: debug-only framework builds are not supported. Configure with -no-framework"
7718     echo "if you want a pure debug build."
7719     echo
7720     exit 1
7721 fi
7722
7723 sepath=`echo "$relpath" | sed -e 's/\\./\\\\./g'`
7724 PROCS=1
7725 EXEC=""
7726
7727
7728 #-------------------------------------------------------------------------------
7729 # build makefiles based on the configuration
7730 #-------------------------------------------------------------------------------
7731
7732 echo "Finding project files. Please wait..."
7733 if [ "$CFG_NOPROCESS" != "yes" ]; then
7734     "$outpath/bin/qmake" -prl -r "${relpath}/qtbase.pro"
7735     if [ -f "${relpath}/qtbase.pro" ]; then
7736         mkfile="${outpath}/Makefile"
7737         [ -f "$mkfile" ] && chmod +w "$mkfile"
7738         QTDIR="$outpath" "$outpath/bin/qmake" -spec "$XQMAKESPEC" "${relpath}/qtbase.pro" -o "$mkfile"
7739     fi
7740 fi
7741
7742 # .projects      -> projects to process
7743 # .projects.1    -> qt and moc
7744 # .projects.2    -> subdirs and libs
7745 # .projects.3    -> the rest
7746 rm -f .projects .projects.1 .projects.2 .projects.3
7747
7748 QMAKE_PROJECTS=`find "$relpath/." -name '*.pro' -print | sed 's-/\./-/-'`
7749 if [ -z "$AWK" ]; then
7750     for p in `echo $QMAKE_PROJECTS`; do
7751         echo "$p" >> .projects
7752     done
7753 else
7754     cat >projects.awk <<EOF
7755 BEGIN {
7756     files = 0
7757     target_file = ""
7758     input_file = ""
7759
7760     first = "./.projects.1.tmp"
7761     second = "./.projects.2.tmp"
7762     third = "./.projects.3.tmp"
7763 }
7764
7765 FNR == 1 {
7766     if ( input_file ) {
7767         if ( ! target_file )
7768             target_file = third
7769         print input_file >target_file
7770     }
7771
7772     matched_target = 0
7773     template_lib = 0
7774     input_file = FILENAME
7775     target_file = ""
7776 }
7777
7778 /^(TARGET.*=)/ {
7779     if ( \$3 == "moc" || \$3 ~ /^Qt/ ) {
7780         target_file = first
7781         matched_target = 1
7782     } else if ( \$3 == "lrelease" || \$3 == "qm_phony_target" ) {
7783         target_file = second
7784         matched_target = 1
7785     }
7786 }
7787
7788 matched_target == 0 && /^(TEMPLATE.*=)/ {
7789     if ( \$3 == "subdirs" )
7790         target_file = second
7791     else if ( \$3 == "lib" )
7792         template_lib = 1
7793     else
7794         target_file = third
7795 }
7796
7797 matched_target == 0 && template_lib == 1 && /^(CONFIG.*=)/ {
7798     if ( \$0 ~ /plugin/ )
7799         target_file = third
7800     else
7801         target_file = second
7802 }
7803
7804 END {
7805     if ( input_file ) {
7806         if ( ! target_file )
7807             target_file = third
7808         print input_file >>target_file
7809     }
7810 }
7811
7812 EOF
7813
7814     rm -f .projects.all
7815     for p in `echo $QMAKE_PROJECTS`; do
7816        echo "$p" >> .projects.all
7817     done
7818
7819     # if you get errors about the length of the command line to awk, change the -l arg
7820     # to split below
7821     split -l 100 .projects.all .projects.all.
7822     for p in .projects.all.*; do
7823        "$AWK" -f projects.awk `cat $p`
7824        [ -f .projects.1.tmp ] && cat .projects.1.tmp >> .projects.1
7825        [ -f .projects.2.tmp ] && cat .projects.2.tmp >> .projects.2
7826        [ -f .projects.3.tmp ] && cat .projects.3.tmp >> .projects.3
7827        rm -f .projects.1.tmp .projects.2.tmp .projects.3.tmp $p
7828     done
7829     rm -f .projects.all* projects.awk
7830
7831     [ -f .projects.1 ] && cat .projects.1 >>.projects
7832     [ -f .projects.2 ] && cat .projects.2 >>.projects
7833     rm -f .projects.1 .projects.2
7834     if [ -f .projects.3 ] && [ "$OPT_FAST" = "no" ]; then
7835        cat .projects.3 >>.projects
7836        rm -f .projects.3
7837     fi
7838 fi
7839 # don't sort Qt and MOC in with the other project files
7840 # also work around a segfaulting uniq(1)
7841 if [ -f .sorted.projects.2 ]; then
7842     sort .sorted.projects.2 > .sorted.projects.2.new
7843     mv -f .sorted.projects.2.new .sorted.projects.2
7844     cat .sorted.projects.2 >> .sorted.projects.1
7845 fi
7846 [ -f .sorted.projects.1 ] && sort .sorted.projects.1 >> .sorted.projects
7847 rm -f .sorted.projects.2 .sorted.projects.1
7848
7849 NORM_PROJECTS=0
7850 FAST_PROJECTS=0
7851 if [ -f .projects ]; then
7852    uniq .projects >.tmp
7853    mv -f .tmp .projects
7854    NORM_PROJECTS=`cat .projects | wc -l | sed -e "s, ,,g"`
7855 fi
7856 if [ -f .projects.3 ]; then
7857    uniq .projects.3 >.tmp
7858    mv -f .tmp .projects.3
7859    FAST_PROJECTS=`cat .projects.3 | wc -l | sed -e "s, ,,g"`
7860 fi
7861 echo "  `expr $NORM_PROJECTS + $FAST_PROJECTS` projects found."
7862 echo
7863
7864 PART_ROOTS=
7865 for part in $CFG_BUILD_PARTS; do
7866     case "$part" in
7867     tools) PART_ROOTS="$PART_ROOTS tools" ;;
7868     libs) PART_ROOTS="$PART_ROOTS src" ;;
7869     translations) PART_ROOTS="$PART_ROOTS translations" ;;
7870     examples) PART_ROOTS="$PART_ROOTS examples" ;;
7871     *) ;;
7872     esac
7873 done
7874
7875 if [ "$CFG_DEV" = "yes" ]; then
7876     PART_ROOTS="$PART_ROOTS tests"
7877 fi
7878
7879 echo "Creating makefiles. Please wait..."
7880 for file in .projects .projects.3; do
7881     [ '!' -f "$file" ] && continue
7882     for a in `cat $file`; do
7883         IN_ROOT=no
7884         for r in $PART_ROOTS; do
7885             if echo "$a" | grep "^$r" >/dev/null 2>&1 || echo "$a" | grep "^$relpath/$r" >/dev/null 2>&1; then
7886                 IN_ROOT=yes
7887                 break
7888             fi
7889         done
7890         [ "$IN_ROOT" = "no" ] && continue
7891
7892         case $a in
7893         *winmain/winmain.pro)
7894             if [ "$CFG_NOPROCESS" = "yes" ] || [ "$XPLATFORM_MINGW" != "yes" ]; then
7895                 continue
7896             fi
7897             SPEC=$XQMAKESPEC ;;
7898         */qmake/qmake.pro) continue ;;
7899         *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*) SPEC=$QMAKESPEC ;;
7900         *) if [ "$CFG_NOPROCESS" = "yes" ]; then
7901               continue
7902            else
7903               SPEC=$XQMAKESPEC
7904            fi;;
7905         esac
7906         dir=`dirname "$a" | sed -e "s;$sepath;.;g"`
7907         test -d "$dir" || mkdir -p "$dir"
7908         OUTDIR="$outpath/$dir"
7909         if [ -f "${OUTDIR}/Makefile" ] && [ "$OPT_FAST" = "yes" ]; then
7910             # fast configure - the makefile exists, skip it
7911             # since the makefile exists, it was generated by qmake, which means we
7912             # can skip it, since qmake has a rule to regenerate the makefile if the .pro
7913             # file changes...
7914             [ "$OPT_VERBOSE" = "yes" ] && echo "  skipping $a"
7915             continue;
7916         fi
7917         QMAKE_SPEC_ARGS="-spec $SPEC"
7918         echo $ECHO_N "  for $a$ECHO_C"
7919
7920         QMAKE="$outpath/bin/qmake"
7921         QMAKE_ARGS="$QMAKE_SWITCHES $QMAKE_SPEC_ARGS"
7922         if [ "$file" = ".projects.3" ]; then
7923             echo " (fast)"
7924
7925             cat >"${OUTDIR}/Makefile" <<EOF
7926 # ${OUTDIR}/Makefile: generated by configure
7927 #
7928 # WARNING: This makefile will be replaced with a real makefile.
7929 # All changes made to this file will be lost.
7930 EOF
7931             [ "$CFG_DEBUG_RELEASE" = "no" ] && echo "first_target: first" >>${OUTDIR}/Makefile
7932
7933             cat >>"${OUTDIR}/Makefile" <<EOF
7934 QMAKE = "$QMAKE"
7935 all clean install qmake first Makefile: FORCE
7936         \$(QMAKE) $QMAKE_ARGS -o "$OUTDIR" "$a"
7937         cd "$OUTDIR"
7938         \$(MAKE) \$@
7939
7940 FORCE:
7941
7942 EOF
7943         else
7944             if [ "$OPT_VERBOSE" = "yes" ]; then
7945                 echo " (`basename $SPEC`)"
7946                 echo "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
7947             else
7948                 echo
7949             fi
7950
7951             [ -f "${OUTDIR}/Makefile" ] && chmod +w "${OUTDIR}/Makefile"
7952             QTDIR="$outpath" "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
7953        fi
7954     done
7955 done
7956 rm -f .projects .projects.3
7957
7958 #-------------------------------------------------------------------------------
7959 # check for platforms that we don't yet know about
7960 #-------------------------------------------------------------------------------
7961 if [ "$CFG_ARCH" = "generic" ]; then
7962 cat <<EOF
7963
7964         NOTICE: Atomic operations are not yet supported for this
7965         architecture.
7966
7967         Qt will use the 'generic' architecture instead, which uses a
7968         single pthread_mutex_t to protect all atomic operations. This
7969         implementation is the slow (but safe) fallback implementation
7970         for architectures Qt does not yet support.
7971 EOF
7972 fi
7973
7974 #-------------------------------------------------------------------------------
7975 # check if the user passed the -no-zlib option, which is no longer supported
7976 #-------------------------------------------------------------------------------
7977 if [ -n "$ZLIB_FORCED" ]; then
7978     which_zlib="supplied"
7979     if [ "$CFG_ZLIB" = "system" ]; then
7980         which_zlib="system"
7981     fi
7982
7983 cat <<EOF
7984
7985         NOTICE: The -no-zlib option was supplied but is no longer
7986         supported.
7987
7988         Qt now requires zlib support in all builds, so the -no-zlib
7989         option was ignored. Qt will be built using the $which_zlib
7990         zlib.
7991 EOF
7992 fi
7993
7994 #-------------------------------------------------------------------------------
7995 # finally save the executed command to another script
7996 #-------------------------------------------------------------------------------
7997 if [ `basename $0` != "config.status" ]; then
7998     CONFIG_STATUS="$relpath/$relconf $OPT_CMDLINE"
7999
8000     # add the system variables
8001     for varname in $SYSTEM_VARIABLES; do
8002         cmd=`echo \
8003 'if [ -n "\$'${varname}'" ]; then
8004     CONFIG_STATUS="'${varname}'='"'\\\$${varname}'"' \$CONFIG_STATUS"
8005 fi'`
8006         eval "$cmd"
8007     done
8008
8009     echo "$CONFIG_STATUS" | grep '\-confirm\-license' >/dev/null 2>&1 || CONFIG_STATUS="$CONFIG_STATUS -confirm-license"
8010
8011     [ -f "$outpath/config.status" ] && rm -f "$outpath/config.status"
8012     echo "#!/bin/sh" > "$outpath/config.status"
8013     echo "if [ \"\$#\" -gt 0 ]; then" >> "$outpath/config.status"
8014     echo "  $CONFIG_STATUS \"\$@\"" >> "$outpath/config.status"
8015     echo "else" >> "$outpath/config.status"
8016     echo "  $CONFIG_STATUS" >> "$outpath/config.status"
8017     echo "fi" >> "$outpath/config.status"
8018     chmod +x "$outpath/config.status"
8019 fi
8020
8021 if [ -n "$RPATH_MESSAGE" ]; then
8022     echo
8023     echo "$RPATH_MESSAGE"
8024 fi
8025
8026 MAKE=`basename "$MAKE"`
8027 echo
8028 echo Qt is now configured for building. Just run \'$MAKE\'.
8029 if [ "$relpath" = "$QT_INSTALL_PREFIX" ]; then
8030     echo Once everything is built, Qt is installed.
8031     echo You should not run \'$MAKE install\'.
8032 else
8033     echo Once everything is built, you must run \'$MAKE install\'.
8034     echo Qt will be installed into $QT_INSTALL_PREFIX
8035 fi
8036 echo
8037 echo To reconfigure, run \'$MAKE confclean\' and \'configure\'.
8038 echo