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