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