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