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