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