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