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