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