Save the pkg-config settings in config.status
[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 -e "s,^Project MESSAGE: ,," -e "s,^#.*$,,g" | grep -v "^$"`
3937 [ -z "$CFG_ARCH" ] && CFG_ARCH="unknown"
3938 if [ "$QMAKESPEC" != "$XQMAKESPEC" ]; then
3939     # Do the same test again, using the host compiler
3940     CFG_HOST_ARCH=`"$outpath/bin/qmake" -spec "$QMAKESPEC" -o /dev/null "$relpath/config.tests/arch/arch.pro" 2>&1 | sed -e "s,^Project MESSAGE: ,," -e "s,^#.*$,,g" | grep -v "^$"`
3941     [ -z "$CFG_HOST_ARCH" ] && CFG_HOST_ARCH="unknown"
3942 else
3943     # not cross compiling, host == target
3944     CFG_HOST_ARCH="$CFG_ARCH"
3945 fi
3946
3947 if [ "$OPT_VERBOSE" = "yes" ]; then
3948     echo "System architecture: '$CFG_ARCH'"
3949     if [ "$PLATFORM_QPA" = "yes" ]; then
3950         echo "Host architecture: '$CFG_HOST_ARCH'"
3951     fi
3952 fi
3953
3954 #-------------------------------------------------------------------------------
3955 # functionality tests
3956 #-------------------------------------------------------------------------------
3957
3958 # detect availability of float math.h functions
3959 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/floatmath "floatmath" $L_FLAGS $I_FLAGS $l_FLAGS; then
3960     CFG_USE_FLOATMATH=yes
3961 else
3962     CFG_USE_FLOATMATH=no
3963 fi
3964
3965 # detect mmx support
3966 if [ "${CFG_MMX}" = "auto" ]; then
3967     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mmx "mmx" $L_FLAGS $I_FLAGS $l_FLAGS "-mmmx"; then
3968         CFG_MMX=yes
3969     else
3970         CFG_MMX=no
3971     fi
3972 fi
3973
3974 # detect 3dnow support
3975 if [ "${CFG_3DNOW}" = "auto" ]; then
3976     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/3dnow "3dnow" $L_FLAGS $I_FLAGS $l_FLAGS "-m3dnow"; then
3977         CFG_3DNOW=yes
3978     else
3979         CFG_3DNOW=no
3980     fi
3981 fi
3982
3983 # detect sse support
3984 if [ "${CFG_SSE}" = "auto" ]; then
3985     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse "sse" $L_FLAGS $I_FLAGS $l_FLAGS "-msse"; then
3986         CFG_SSE=yes
3987     else
3988         CFG_SSE=no
3989     fi
3990 fi
3991
3992 # detect sse2 support
3993 if [ "${CFG_SSE2}" = "auto" ]; then
3994     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse2 "sse2" $L_FLAGS $I_FLAGS $l_FLAGS "-msse2"; then
3995        CFG_SSE2=yes
3996     else
3997        CFG_SSE2=no
3998     fi
3999 fi
4000
4001 # detect sse3 support
4002 if [ "${CFG_SSE3}" = "auto" ]; then
4003     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse3 "sse3" $L_FLAGS $I_FLAGS $l_FLAGS "-msse3"; then
4004        CFG_SSE3=yes
4005     else
4006        CFG_SSE3=no
4007     fi
4008 fi
4009
4010 # detect ssse3 support
4011 if [ "${CFG_SSSE3}" = "auto" ]; then
4012     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ssse3 "ssse3" $L_FLAGS $I_FLAGS $l_FLAGS "-mssse3"; then
4013        CFG_SSSE3=yes
4014     else
4015        CFG_SSSE3=no
4016     fi
4017 fi
4018
4019 # detect sse4.1 support
4020 if [ "${CFG_SSE4_1}" = "auto" ]; then
4021     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
4022        CFG_SSE4_1=yes
4023     else
4024        CFG_SSE4_1=no
4025     fi
4026 fi
4027
4028 # detect sse4.2 support
4029 if [ "${CFG_SSE4_2}" = "auto" ]; then
4030     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
4031        CFG_SSE4_2=yes
4032     else
4033        CFG_SSE4_2=no
4034     fi
4035 fi
4036
4037 # detect avx support
4038 if [ "${CFG_AVX}" = "auto" ]; then
4039     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/avx "avx" $L_FLAGS $I_FLAGS $l_FLAGS "-mavx"; then
4040        CFG_AVX=yes
4041     else
4042        CFG_AVX=no
4043     fi
4044 fi
4045
4046 # check iWMMXt support
4047 if [ "$CFG_IWMMXT" = "yes" ]; then
4048     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iwmmxt "iwmmxt" $L_FLAGS $I_FLAGS $l_FLAGS "-mcpu=iwmmxt"
4049     if [ $? != "0" ]; then
4050         echo "The iWMMXt functionality test failed!"
4051         echo " Please make sure your compiler supports iWMMXt intrinsics!"
4052         exit 1
4053     fi
4054 fi
4055
4056 # detect neon support
4057 if [ "$CFG_ARCH" = "arm" ] && [ "${CFG_NEON}" = "auto" ]; then
4058     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
4059         CFG_NEON=yes
4060     else
4061         CFG_NEON=no
4062     fi
4063 elif [ "$CFG_ARCH" != "arm" ]; then
4064     CFG_NEON=no
4065 fi
4066
4067 # detect mips_dsp support
4068 if [ "${CFG_ARCH}" = "mips" ] && [ "${CFG_MIPS_DSP}" = "yes" ]; then
4069   CFG_MIPS_DSP=yes
4070     else
4071   CFG_MIPS_DSP=no
4072 fi
4073
4074 # detect mips_dspr2 support
4075 if [ "${CFG_ARCH}" = "mips" ] && [ "${CFG_MIPS_DSPR2}" = "yes" ]; then
4076   CFG_MIPS_DSPR2=yes
4077     else
4078   CFG_MIPS_DSPR2=no
4079 fi
4080
4081 [ "$XPLATFORM_MINGW" = "yes" ] && QMakeVar add styles "windowsxp windowsvista"
4082
4083 # detect zlib
4084 if [ "$CFG_ZLIB" = "no" ]; then
4085     # Note: Qt no longer support builds without zlib
4086     # So we force a "no" to be "auto" here.
4087     # If you REALLY really need no zlib support, you can still disable
4088     # it by doing the following:
4089     #   add "no-zlib" to mkspecs/qconfig.pri
4090     #   #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h)
4091     #
4092     # There's no guarantee that Qt will build under those conditions
4093
4094     CFG_ZLIB=auto
4095     ZLIB_FORCED=yes
4096 fi
4097 if [ "$CFG_ZLIB" = "auto" ]; then
4098     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
4099        CFG_ZLIB=system
4100     else
4101        CFG_ZLIB=yes
4102     fi
4103 fi
4104
4105 if [ "$CFG_LARGEFILE" = "auto" ]; then
4106     #Large files should be enabled for all Linux systems
4107     CFG_LARGEFILE=yes
4108 fi
4109
4110 if [ "$CFG_GUI" = "no" ]; then
4111     QPA_PLATFORM_GUARD=no
4112 fi
4113
4114 # detect how jpeg should be built
4115 if [ "$CFG_JPEG" = "auto" ]; then
4116     if [ "$CFG_SHARED" = "yes" ]; then
4117         CFG_JPEG=plugin
4118     else
4119         CFG_JPEG=yes
4120     fi
4121 fi
4122 # detect jpeg
4123 if [ "$CFG_LIBJPEG" = "auto" ]; then
4124     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
4125        CFG_LIBJPEG=system
4126     else
4127        CFG_LIBJPEG=qt
4128     fi
4129 fi
4130
4131 # detect how gif should be built
4132 if [ "$CFG_GIF" = "auto" ]; then
4133     if [ "$CFG_SHARED" = "yes" ]; then
4134         CFG_GIF=plugin
4135     else
4136         CFG_GIF=yes
4137     fi
4138 fi
4139
4140 # detect png
4141 if [ "$CFG_LIBPNG" = "auto" ]; then
4142     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
4143        CFG_LIBPNG=system
4144     else
4145        CFG_LIBPNG=qt
4146     fi
4147 fi
4148
4149 # detect accessibility
4150 if [ "$CFG_ACCESSIBILITY" = "auto" ]; then
4151     CFG_ACCESSIBILITY=yes
4152 fi
4153
4154 if [ "$CFG_EGLFS" = "yes" ]; then
4155     if [ "$CFG_EGL" = "no" ]; then
4156         echo "The EGLFS plugin requires EGL support and cannot be built"
4157         exit 101
4158     fi
4159     CFG_EGL=yes
4160 fi
4161
4162 # auto-detect SQL-modules support
4163 for _SQLDR in $CFG_SQL_AVAILABLE; do
4164         case $_SQLDR in
4165         mysql)
4166             if [ "$CFG_SQL_mysql" != "no" ]; then
4167                 [ -z "$CFG_MYSQL_CONFIG" ] && CFG_MYSQL_CONFIG=`"$WHICH" mysql_config`
4168                 if [ -x "$CFG_MYSQL_CONFIG" ]; then
4169                     QT_CFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --include 2>/dev/null`
4170                     QT_LFLAGS_MYSQL_R=`$CFG_MYSQL_CONFIG --libs_r 2>/dev/null`
4171                     QT_LFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --libs 2>/dev/null`
4172                     QT_MYSQL_VERSION=`$CFG_MYSQL_CONFIG --version 2>/dev/null`
4173                     QT_MYSQL_VERSION_MAJOR=`echo $QT_MYSQL_VERSION | cut -d . -f 1`
4174                 fi
4175                 if [ -n "$QT_MYSQL_VERSION" ] && [ "$QT_MYSQL_VERSION_MAJOR" -lt 4 ]; then
4176                     if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4177                         echo "This version of MySql is not supported ($QT_MYSQL_VERSION)."
4178                         echo " You need MySql 4 or higher."
4179                         echo " If you believe this message is in error you may use the continue"
4180                         echo " switch (-continue) to $0 to continue."
4181                         exit 101
4182                     else
4183                         CFG_SQL_mysql="no"
4184                         QT_LFLAGS_MYSQL=""
4185                         QT_LFLAGS_MYSQL_R=""
4186                         QT_CFLAGS_MYSQL=""
4187                     fi
4188                 else
4189                     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
4190                         QMakeVar add CONFIG use_libmysqlclient_r
4191                         if [ "$CFG_SQL_mysql" = "auto" ]; then
4192                             CFG_SQL_mysql=plugin
4193                         fi
4194                         QT_LFLAGS_MYSQL="$QT_LFLAGS_MYSQL_R"
4195                     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
4196                         if [ "$CFG_SQL_mysql" = "auto" ]; then
4197                             CFG_SQL_mysql=plugin
4198                         fi
4199                     else
4200                         if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4201                             echo "MySQL support cannot be enabled due to functionality tests!"
4202                             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4203                             echo " If you believe this message is in error you may use the continue"
4204                             echo " switch (-continue) to $0 to continue."
4205                             exit 101
4206                         else
4207                             CFG_SQL_mysql=no
4208                             QT_LFLAGS_MYSQL=""
4209                             QT_LFLAGS_MYSQL_R=""
4210                             QT_CFLAGS_MYSQL=""
4211                         fi
4212                     fi
4213                 fi
4214             fi
4215             ;;
4216         psql)
4217             if [ "$CFG_SQL_psql" != "no" ]; then
4218                 # Be careful not to use native pg_config when cross building.
4219                 if [ "$XPLATFORM_MINGW" != "yes" ] && "$WHICH" pg_config >/dev/null 2>&1; then
4220                     QT_CFLAGS_PSQL=`pg_config --includedir 2>/dev/null`
4221                     QT_LFLAGS_PSQL=`pg_config --libdir 2>/dev/null`
4222                 fi
4223                 [ -z "$QT_CFLAGS_PSQL" ] || QT_CFLAGS_PSQL="-I$QT_CFLAGS_PSQL"
4224                 [ -z "$QT_LFLAGS_PSQL" ] || QT_LFLAGS_PSQL="-L$QT_LFLAGS_PSQL"
4225                 # But, respect PSQL_LIBS if set
4226                 [ -z "$PSQL_LIBS" ] || QT_LFLAGS_PSQL="$PSQL_LIBS"
4227                 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
4228                     if [ "$CFG_SQL_psql" = "auto" ]; then
4229                         CFG_SQL_psql=plugin
4230                     fi
4231                 else
4232                     if [ "$CFG_SQL_psql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4233                         echo "PostgreSQL support cannot be enabled due to functionality tests!"
4234                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4235                         echo " If you believe this message is in error you may use the continue"
4236                         echo " switch (-continue) to $0 to continue."
4237                         exit 101
4238                     else
4239                         CFG_SQL_psql=no
4240                         QT_CFLAGS_PSQL=""
4241                         QT_LFLAGS_PSQL=""
4242                     fi
4243                 fi
4244             fi
4245         ;;
4246         odbc)
4247             if [ "$CFG_SQL_odbc" != "no" ]; then
4248                 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
4249                     if [ "$CFG_SQL_odbc" = "auto" ]; then
4250                         CFG_SQL_odbc=plugin
4251                     fi
4252                 else
4253                     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
4254                         QT_LFLAGS_ODBC="-liodbc"
4255                         if [ "$CFG_SQL_odbc" = "auto" ]; then
4256                             CFG_SQL_odbc=plugin
4257                         fi
4258                     else
4259                         if [ "$CFG_SQL_odbc" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4260                             echo "ODBC support cannot be enabled due to functionality tests!"
4261                             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4262                             echo " If you believe this message is in error you may use the continue"
4263                             echo " switch (-continue) to $0 to continue."
4264                             exit 101
4265                         else
4266                             CFG_SQL_odbc=no
4267                         fi
4268                     fi
4269                 fi
4270             fi
4271             ;;
4272         oci)
4273             if [ "$CFG_SQL_oci" != "no" ]; then
4274                 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
4275                     if [ "$CFG_SQL_oci" = "auto" ]; then
4276                         CFG_SQL_oci=plugin
4277                     fi
4278                 else
4279                     if [ "$CFG_SQL_oci" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4280                         echo "Oracle (OCI) support cannot be enabled due to functionality tests!"
4281                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4282                         echo " If you believe this message is in error you may use the continue"
4283                         echo " switch (-continue) to $0 to continue."
4284                         exit 101
4285                     else
4286                         CFG_SQL_oci=no
4287                     fi
4288                 fi
4289             fi
4290             ;;
4291         tds)
4292             if [ "$CFG_SQL_tds" != "no" ]; then
4293                 [ -z "$SYBASE" ] || QT_LFLAGS_TDS="-L$SYBASE/lib"
4294                 [ -z "$SYBASE_LIBS" ] || QT_LFLAGS_TDS="$QT_LFLAGS_TDS $SYBASE_LIBS"
4295                 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
4296                     if [ "$CFG_SQL_tds" = "auto" ]; then
4297                         CFG_SQL_tds=plugin
4298                     fi
4299                 else
4300                     if [ "$CFG_SQL_tds" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4301                         echo "TDS support cannot be enabled due to functionality tests!"
4302                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4303                         echo " If you believe this message is in error you may use the continue"
4304                         echo " switch (-continue) to $0 to continue."
4305                         exit 101
4306                     else
4307                         CFG_SQL_tds=no
4308                     fi
4309                 fi
4310             fi
4311             ;;
4312         db2)
4313             if [ "$CFG_SQL_db2" != "no" ]; then
4314                 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
4315                     if [ "$CFG_SQL_db2" = "auto" ]; then
4316                         CFG_SQL_db2=plugin
4317                     fi
4318                 else
4319                     if [ "$CFG_SQL_db2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4320                         echo "ODBC support cannot be enabled due to functionality tests!"
4321                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4322                         echo " If you believe this message is in error you may use the continue"
4323                         echo " switch (-continue) to $0 to continue."
4324                         exit 101
4325                     else
4326                         CFG_SQL_db2=no
4327                     fi
4328                 fi
4329             fi
4330             ;;
4331         ibase)
4332             if [ "$CFG_SQL_ibase" != "no" ]; then
4333                 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
4334                     if [ "$CFG_SQL_ibase" = "auto" ]; then
4335                         CFG_SQL_ibase=plugin
4336                     fi
4337                 else
4338                     if [ "$CFG_SQL_ibase" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4339                         echo "InterBase support cannot be enabled due to functionality tests!"
4340                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4341                         echo " If you believe this message is in error you may use the continue"
4342                         echo " switch (-continue) to $0 to continue."
4343                         exit 101
4344                     else
4345                         CFG_SQL_ibase=no
4346                     fi
4347                 fi
4348             fi
4349             ;;
4350         sqlite2)
4351             if [ "$CFG_SQL_sqlite2" != "no" ]; then
4352                 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
4353                     if [ "$CFG_SQL_sqlite2" = "auto" ]; then
4354                         CFG_SQL_sqlite2=plugin
4355                     fi
4356                 else
4357                     if [ "$CFG_SQL_sqlite2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4358                         echo "SQLite2 support cannot be enabled due to functionality tests!"
4359                         echo " Turn on verbose messaging (-v) to $0 to see the final report."
4360                         echo " If you believe this message is in error you may use the continue"
4361                         echo " switch (-continue) to $0 to continue."
4362                         exit 101
4363                     else
4364                         CFG_SQL_sqlite2=no
4365                     fi
4366                 fi
4367             fi
4368             ;;
4369         sqlite)
4370             if [ "$CFG_SQL_sqlite" != "no" ]; then
4371                 SQLITE_AUTODETECT_FAILED="no"
4372                 if [ "$CFG_SQLITE" = "system" ]; then
4373                     if [ -n "$PKG_CONFIG" ]; then
4374                         QT_CFLAGS_SQLITE=`$PKG_CONFIG --cflags sqlite3 2>/dev/null`
4375                         QT_LFLAGS_SQLITE=`$PKG_CONFIG --libs sqlite3 2>/dev/null`
4376                     fi
4377                     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
4378                         if [ "$CFG_SQL_sqlite" = "auto" ]; then
4379                             CFG_SQL_sqlite=plugin
4380                         fi
4381                         QMAKE_CONFIG="$QMAKE_CONFIG system-sqlite"
4382                     else
4383                         SQLITE_AUTODETECT_FAILED="yes"
4384                         CFG_SQL_sqlite=no
4385                     fi
4386                 elif [ -f "$relpath/src/3rdparty/sqlite/sqlite3.h" ]; then
4387                     if [ "$CFG_SQL_sqlite" = "auto" ]; then
4388                             CFG_SQL_sqlite=plugin
4389                     fi
4390                 else
4391                     SQLITE_AUTODETECT_FAILED="yes"
4392                     CFG_SQL_sqlite=no
4393                 fi
4394
4395                 if [ "$SQLITE_AUTODETECT_FAILED" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4396                     echo "SQLite support cannot be enabled due to functionality tests!"
4397                     echo " Turn on verbose messaging (-v) to $0 to see the final report."
4398                     echo " If you believe this message is in error you may use the continue"
4399                     echo " switch (-continue) to $0 to continue."
4400                     exit 101
4401                 fi
4402             fi
4403             ;;
4404         *)
4405             if [ "$OPT_VERBOSE" = "yes" ]; then
4406                 echo "unknown SQL driver: $_SQLDR"
4407             fi
4408             ;;
4409         esac
4410 done
4411
4412 # auto-detect NIS support
4413 if [ "$CFG_NIS" != "no" ]; then
4414     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
4415         CFG_NIS=yes
4416     else
4417         if [ "$CFG_NIS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4418             echo "NIS support cannot be enabled due to functionality tests!"
4419             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4420             echo " If you believe this message is in error you may use the continue"
4421             echo " switch (-continue) to $0 to continue."
4422             exit 101
4423         else
4424             CFG_NIS=no
4425         fi
4426     fi
4427 fi
4428
4429 # auto-detect CUPS support
4430 if [ "$CFG_CUPS" != "no" ]; then
4431     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
4432         CFG_CUPS=yes
4433     else
4434         if [ "$CFG_CUPS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4435             echo "Cups support cannot be enabled due to functionality tests!"
4436             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4437             echo " If you believe this message is in error you may use the continue"
4438             echo " switch (-continue) to $0 to continue."
4439             exit 101
4440         else
4441             CFG_CUPS=no
4442         fi
4443     fi
4444 fi
4445
4446 # auto-detect iconv(3) support
4447 if [ "$CFG_ICONV" != "no" ]; then
4448     if [ "$XPLATFORM_MINGW" = "yes" ]; then
4449         CFG_ICONV=no
4450     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
4451         CFG_ICONV=yes
4452     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
4453         CFG_ICONV=sun
4454     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
4455         CFG_ICONV=gnu
4456     else
4457         if [ "$CFG_ICONV" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4458             echo "Iconv support cannot be enabled due to functionality tests!"
4459             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4460             echo " If you believe this message is in error you may use the continue"
4461             echo " switch (-continue) to $0 to continue."
4462             exit 101
4463         else
4464             CFG_ICONV=no
4465         fi
4466     fi
4467 fi
4468
4469 # auto-detect libdbus-1 support
4470 if [ "$CFG_DBUS" != "no" ]; then
4471     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then
4472         QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null`
4473         QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null`
4474     fi
4475     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
4476         [ "$CFG_DBUS" = "auto" ] && CFG_DBUS=yes
4477         QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
4478         QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS"
4479     else
4480         if [ "$CFG_DBUS" = "auto" ]; then
4481             CFG_DBUS=no
4482         elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4483             # CFG_DBUS is "yes" or "linked" here
4484
4485             echo "The QtDBus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found."
4486             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4487             echo " If you believe this message is in error you may use the continue"
4488             echo " switch (-continue) to $0 to continue."
4489             exit 101
4490         fi
4491     fi
4492 fi
4493
4494 # X11/Lighthouse
4495 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
4496
4497     # auto-detect Glib support
4498     if [ "$CFG_GLIB" != "no" ]; then
4499         if [ -n "$PKG_CONFIG" ]; then
4500             QT_CFLAGS_GLIB=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0 2>/dev/null`
4501             QT_LIBS_GLIB=`$PKG_CONFIG --libs glib-2.0 gthread-2.0 2>/dev/null`
4502         fi
4503         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
4504             CFG_GLIB=yes
4505             QMakeVar set QT_CFLAGS_GLIB "$QT_CFLAGS_GLIB"
4506             QMakeVar set QT_LIBS_GLIB "$QT_LIBS_GLIB"
4507         else
4508             if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4509                 echo "Glib support cannot be enabled due to functionality tests!"
4510                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4511                 echo " If you believe this message is in error you may use the continue"
4512                 echo " switch (-continue) to $0 to continue."
4513                 exit 101
4514             else
4515                 CFG_GLIB=no
4516             fi
4517         fi
4518     fi
4519
4520     # ### Vestige
4521     if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then
4522         if [ -n "$PKG_CONFIG" ]; then
4523             QT_CFLAGS_GSTREAMER=`$PKG_CONFIG --cflags gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
4524             QT_LIBS_GSTREAMER=`$PKG_CONFIG --libs gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
4525         fi
4526         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
4527             CFG_GSTREAMER=yes
4528             QMakeVar set QT_CFLAGS_GSTREAMER "$QT_CFLAGS_GSTREAMER"
4529             QMakeVar set QT_LIBS_GSTREAMER "$QT_LIBS_GSTREAMER"
4530         else
4531             if [ "$CFG_GSTREAMER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4532                 echo "Gstreamer support cannot be enabled due to functionality tests!"
4533                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4534                 echo " If you believe this message is in error you may use the continue"
4535                 echo " switch (-continue) to $0 to continue."
4536                 exit 101
4537             else
4538                 CFG_GSTREAMER=no
4539             fi
4540         fi
4541     elif [ "$CFG_GLIB" = "no" ]; then
4542         CFG_GSTREAMER=no
4543     fi
4544
4545     # auto-detect libicu support
4546     if [ "$CFG_ICU" != "no" ]; then
4547         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/icu "ICU" $L_FLAGS $I_FLAGS $l_FLAGS; then
4548             [ "$CFG_ICU" = "auto" ] && CFG_ICU=yes
4549         else
4550             if [ "$CFG_ICU" = "auto" ]; then
4551                 CFG_ICU=no
4552             elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4553                 # CFG_ICU is "yes"
4554
4555                 echo "The ICU library support cannot be enabled."
4556                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4557                 echo " If you believe this message is in error you may use the continue"
4558                 echo " switch (-continue) to $0 to continue."
4559                 exit 101
4560             fi
4561         fi
4562     fi
4563
4564     # Auto-detect PulseAudio support
4565     if [ "$CFG_PULSEAUDIO" != "no" ]; then
4566         if [ -n "$PKG_CONFIG" ]; then
4567             QT_CFLAGS_PULSEAUDIO=`$PKG_CONFIG --cflags libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
4568             QT_LIBS_PULSEAUDIO=`$PKG_CONFIG --libs libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
4569         fi
4570         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
4571             CFG_PULSEAUDIO=yes
4572             QMakeVar set QT_CFLAGS_PULSEAUDIO "$QT_CFLAGS_PULSEAUDIO"
4573             QMakeVar set QT_LIBS_PULSEAUDIO "$QT_LIBS_PULSEAUDIO"
4574         else
4575             if [ "$CFG_PULSEAUDIO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4576                 echo "PulseAudio support cannot be enabled due to functionality tests!"
4577                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4578                 echo " If you believe this message is in error you may use the continue"
4579                 echo " switch (-continue) to $0 to continue."
4580                 exit 101
4581             else
4582                 CFG_PULSEAUDIO=no
4583             fi
4584         fi
4585     fi
4586 fi # X11/Lighthouse
4587
4588 # X11
4589 if [ "$PLATFORM_X11" = "yes" -a "$CFG_GUI" != "no" ]; then
4590     x11tests="$relpath/config.tests/x11"
4591     X11TESTS_FLAGS=
4592
4593     # work around broken X11 headers when using GCC 2.95 or later
4594     NOTYPE=no
4595     "$x11tests/notype.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" && NOTYPE=yes
4596     if [ $NOTYPE = "yes" ]; then
4597         QMakeVar add QMAKE_CXXFLAGS -fpermissive
4598         X11TESTS_FLAGS="$X11TESTS_FLAGS -fpermissive"
4599     fi
4600
4601     # Check we actually have X11 :-)
4602     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
4603     if [ $? != "0" ]; then
4604         echo "Basic XLib functionality test failed!"
4605         echo " You might need to modify the include and library search paths by editing"
4606         echo " QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in ${XQMAKESPEC}."
4607         exit 1
4608     fi
4609 fi
4610
4611 # X11/MINGW OpenGL
4612 if [ "$PLATFORM_X11" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
4613     # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
4614     if [ "$CFG_GUI" = "no" ]; then
4615         if [ "$CFG_OPENGL" = "auto" ]; then
4616             CFG_OPENGL=no
4617         fi
4618         if [ "$CFG_OPENGL" != "no" ]; then
4619             echo "OpenGL enabled, but GUI disabled."
4620             echo " You might need to either enable the GUI or disable OpenGL"
4621             exit 1
4622         fi
4623     fi
4624     if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
4625         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
4626             CFG_OPENGL=desktop
4627         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
4628             CFG_OPENGL=es2
4629         else
4630             if [ "$CFG_OPENGL" = "yes" ]; then
4631                 echo "All the OpenGL functionality tests failed!"
4632                 echo " You might need to modify the include and library search paths by editing"
4633                 echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
4634                 echo " ${XQMAKESPEC}."
4635                 exit 1
4636             fi
4637             CFG_OPENGL=no
4638         fi
4639         case "$PLATFORM" in
4640         hpux*)
4641             # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
4642             if [ "$CFG_OPENGL" = "desktop" ]; then
4643                 "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
4644                 if [ $? != "0" ]; then
4645                     QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
4646                 fi
4647             fi
4648             ;;
4649         *)
4650             ;;
4651         esac
4652     elif [ "$CFG_OPENGL" = "es2" ]; then
4653         #OpenGL ES 2.x
4654         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS
4655         if [ $? != "0" ]; then
4656             echo "The OpenGL ES 2.0 functionality test failed!"
4657             echo " You might need to modify the include and library search paths by editing"
4658             echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
4659             echo " ${XQMAKESPEC}."
4660             exit 1
4661         fi
4662     elif [ "$CFG_OPENGL" = "desktop" ]; then
4663         # Desktop OpenGL support
4664         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
4665         if [ $? != "0" ]; then
4666             echo "The OpenGL functionality test failed!"
4667             echo " You might need to modify the include and library search paths by editing"
4668             echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
4669             echo " ${XQMAKESPEC}."
4670             exit 1
4671         fi
4672         case "$PLATFORM" in
4673         hpux*)
4674             # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
4675             "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
4676             if [ $? != "0" ]; then
4677                 QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
4678             fi
4679             ;;
4680         *)
4681             ;;
4682         esac
4683     fi
4684 fi # X11/MINGW OpenGL
4685
4686 # X11
4687 if [ "$PLATFORM_X11" = "yes" ]; then
4688     # auto-detect Xcursor support
4689     if [ "$CFG_XCURSOR" != "no" ]; then
4690         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
4691             if [ "$CFG_XCURSOR" != "runtime" ]; then
4692                 CFG_XCURSOR=yes;
4693             fi
4694         else
4695             if [ "$CFG_XCURSOR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4696                 echo "Xcursor support cannot be enabled due to functionality tests!"
4697                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4698                 echo " If you believe this message is in error you may use the continue"
4699                 echo " switch (-continue) to $0 to continue."
4700                 exit 101
4701             else
4702                 CFG_XCURSOR=no
4703             fi
4704         fi
4705     fi
4706
4707     # auto-detect Xfixes support
4708     if [ "$CFG_XFIXES" != "no" ]; then
4709         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xfixes "Xfixes" $L_FLAGS $I_FLAGS $X11TESTS_FLAGS; then
4710             if [ "$CFG_XFIXES" != "runtime" ]; then
4711                 CFG_XFIXES=yes;
4712             fi
4713         else
4714             if [ "$CFG_XFIXES" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4715                 echo "Xfixes support cannot be enabled due to functionality tests!"
4716                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4717                 echo " If you believe this message is in error you may use the continue"
4718                 echo " switch (-continue) to $0 to continue."
4719                 exit 101
4720             else
4721                 CFG_XFIXES=no
4722             fi
4723         fi
4724     fi
4725
4726     # auto-detect Xrandr support (resize and rotate extension)
4727     if [ "$CFG_XRANDR" != "no" ]; then
4728         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
4729             if [ "$CFG_XRANDR" != "runtime" ]; then
4730             CFG_XRANDR=yes
4731             fi
4732         else
4733             if [ "$CFG_XRANDR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4734                 echo "Xrandr support cannot be enabled due to functionality tests!"
4735                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4736                 echo " If you believe this message is in error you may use the continue"
4737                 echo " switch (-continue) to $0 to continue."
4738                 exit 101
4739             else
4740                 CFG_XRANDR=no
4741             fi
4742         fi
4743     fi
4744
4745     # auto-detect Xrender support
4746     if [ "$CFG_XRENDER" != "no" ]; then
4747         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
4748             CFG_XRENDER=yes
4749         else
4750             if [ "$CFG_XRENDER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4751                 echo "Xrender support cannot be enabled due to functionality tests!"
4752                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4753                 echo " If you believe this message is in error you may use the continue"
4754                 echo " switch (-continue) to $0 to continue."
4755                 exit 101
4756             else
4757                 CFG_XRENDER=no
4758             fi
4759         fi
4760     fi
4761
4762     # auto-detect MIT-SHM support
4763     if [ "$CFG_MITSHM" != "no" ]; then
4764         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
4765             CFG_MITSHM=yes
4766         else
4767             if [ "$CFG_MITSHM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4768                 echo "MITSHM support cannot be enabled due to functionality tests!"
4769                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4770                 echo " If you believe this message is in error you may use the continue"
4771                 echo " switch (-continue) to $0 to continue."
4772                 exit 101
4773             else
4774                 CFG_MITSHM=no
4775             fi
4776         fi
4777     fi
4778
4779     # auto-detect Session Management support
4780     if [ "$CFG_SM" = "auto" ]; then
4781         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
4782             CFG_SM=yes
4783         else
4784             if [ "$CFG_SM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4785                 echo "Session Management support cannot be enabled due to functionality tests!"
4786                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4787                 echo " If you believe this message is in error you may use the continue"
4788                 echo " switch (-continue) to $0 to continue."
4789                 exit 101
4790             else
4791                 CFG_SM=no
4792             fi
4793         fi
4794     fi
4795
4796     # auto-detect SHAPE support
4797     if [ "$CFG_XSHAPE" != "no" ]; then
4798         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
4799             CFG_XSHAPE=yes
4800         else
4801             if [ "$CFG_XSHAPE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4802                 echo "XShape support cannot be enabled due to functionality tests!"
4803                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4804                 echo " If you believe this message is in error you may use the continue"
4805                 echo " switch (-continue) to $0 to continue."
4806                 exit 101
4807             else
4808                 CFG_XSHAPE=no
4809             fi
4810         fi
4811     fi
4812
4813     # auto-detect XVideo support
4814     if [ "$CFG_XVIDEO" != "no" ]; then
4815         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
4816             CFG_XVIDEO=yes
4817         else
4818             if [ "$CFG_XVIDEO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4819                 echo "XVideo support cannot be enabled due to functionality tests!"
4820                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4821                 echo " If you believe this message is in error you may use the continue"
4822                 echo " switch (-continue) to $0 to continue."
4823                 exit 101
4824             else
4825                 CFG_XVIDEO=no
4826             fi
4827         fi
4828     fi
4829
4830     # auto-detect XSync support
4831     if [ "$CFG_XSYNC" != "no" ]; then
4832         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
4833             CFG_XSYNC=yes
4834         else
4835             if [ "$CFG_XSYNC" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4836                 echo "XSync support cannot be enabled due to functionality tests!"
4837                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4838                 echo " If you believe this message is in error you may use the continue"
4839                 echo " switch (-continue) to $0 to continue."
4840                 exit 101
4841             else
4842                 CFG_XSYNC=no
4843             fi
4844         fi
4845     fi
4846
4847     # auto-detect Xinerama support
4848     if [ "$CFG_XINERAMA" != "no" ]; then
4849         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
4850             if [ "$CFG_XINERAMA" != "runtime" ]; then
4851                 CFG_XINERAMA=yes
4852             fi
4853         else
4854             if [ "$CFG_XINERAMA" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4855                 echo "Xinerama support cannot be enabled due to functionality tests!"
4856                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4857                 echo " If you believe this message is in error you may use the continue"
4858                 echo " switch (-continue) to $0 to continue."
4859                 exit 101
4860             else
4861                 CFG_XINERAMA=no
4862             fi
4863         fi
4864     fi
4865
4866     # auto-detect Xinput support
4867     if [ "$CFG_XINPUT" != "no" ]; then
4868         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
4869             if [ "$CFG_XINPUT" != "runtime" ]; then
4870                 CFG_XINPUT=yes
4871             fi
4872         else
4873             if [ "$CFG_XINPUT" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4874                 echo "Tablet and Xinput support cannot be enabled due to functionality tests!"
4875                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4876                 echo " If you believe this message is in error you may use the continue"
4877                 echo " switch (-continue) to $0 to continue."
4878                 exit 101
4879             else
4880                 CFG_XINPUT=no
4881             fi
4882         fi
4883     fi
4884
4885     # auto-detect XKB support
4886     if [ "$CFG_XKB" != "no" ]; then
4887         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
4888             CFG_XKB=yes
4889         else
4890             if [ "$CFG_XKB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4891                 echo "XKB support cannot be enabled due to functionality tests!"
4892                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4893                 echo " If you believe this message is in error you may use the continue"
4894                 echo " switch (-continue) to $0 to continue."
4895                 exit 101
4896             else
4897                 CFG_XKB=no
4898             fi
4899         fi
4900     fi
4901
4902     if [ "$CFG_GLIB" = "yes" -a "$CFG_QGTKSTYLE" != "no" ]; then
4903         if [ -n "$PKG_CONFIG" ]; then
4904             QT_CFLAGS_QGTKSTYLE=`$PKG_CONFIG --cflags gtk+-2.0 ">=" 2.10 atk 2>/dev/null`
4905             QT_LIBS_QGTKSTYLE=`$PKG_CONFIG --libs gobject-2.0 2>/dev/null`
4906         fi
4907         if [ -n "$QT_CFLAGS_QGTKSTYLE" ] ; then
4908             CFG_QGTKSTYLE=yes
4909             QMakeVar set QT_CFLAGS_QGTKSTYLE "$QT_CFLAGS_QGTKSTYLE"
4910             QMakeVar set QT_LIBS_QGTKSTYLE "$QT_LIBS_QGTKSTYLE"
4911         else
4912             if [ "$CFG_QGTKSTYLE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4913                 echo "Gtk theme support cannot be enabled due to functionality tests!"
4914                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
4915                 echo " If you believe this message is in error you may use the continue"
4916                 echo " switch (-continue) to $0 to continue."
4917                 exit 101
4918             else
4919                 CFG_QGTKSTYLE=no
4920             fi
4921         fi
4922     elif [ "$CFG_GLIB" = "no" ]; then
4923         CFG_QGTKSTYLE=no
4924     fi
4925 fi # X11
4926
4927 # auto-detect FontConfig support
4928 if [ "$CFG_FONTCONFIG" != "no" ]; then
4929     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
4930         QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
4931         QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null`
4932     else
4933         QT_CFLAGS_FONTCONFIG=
4934         QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig"
4935     fi
4936     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
4937         CFG_FONTCONFIG=yes
4938         QMakeVar set QMAKE_CFLAGS_X11 "$QT_CFLAGS_FONTCONFIG \$\$QMAKE_CFLAGS_X11"
4939         QMakeVar set QMAKE_LIBS_X11 "$QT_LIBS_FONTCONFIG \$\$QMAKE_LIBS_X11"
4940         CFG_LIBFREETYPE=system
4941     else
4942         if [ "$CFG_FONTCONFIG" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4943             echo "FontConfig support cannot be enabled due to functionality tests!"
4944             echo " Turn on verbose messaging (-v) to $0 to see the final report."
4945             echo " If you believe this message is in error you may use the continue"
4946             echo " switch (-continue) to $0 to continue."
4947             exit 101
4948         else
4949             CFG_FONTCONFIG=no
4950         fi
4951     fi
4952 fi
4953
4954
4955 if [ "$BUILD_ON_MAC" = "yes" ]; then
4956     if [ "$CFG_PHONON" != "no" ]; then
4957         # Always enable Phonon (unless it was explicitly disabled)
4958         CFG_PHONON=yes
4959     fi
4960
4961     if [ "$CFG_COREWLAN" = "auto" ]; then
4962         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
4963             CFG_COREWLAN=yes
4964         else
4965             CFG_COREWLAN=no
4966         fi
4967     fi
4968 fi
4969
4970 if [ "$PLATFORM_QPA" = "yes" ]; then
4971     # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
4972     if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
4973         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
4974             CFG_OPENGL=desktop
4975         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
4976             CFG_OPENGL=es2
4977         else
4978             if [ "$CFG_OPENGL" = "yes" ]; then
4979                 echo "All the OpenGL functionality tests failed!"
4980                 echo " You might need to modify the include and library search paths by editing"
4981                 echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
4982                 echo " ${XQMAKESPEC}."
4983                 exit 1
4984             fi
4985             CFG_OPENGL=no
4986         fi
4987     elif [ "$CFG_OPENGL" = "es2" ]; then
4988         #OpenGL ES 2.x
4989         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists glesv2 2>/dev/null; then
4990             QMAKE_INCDIR_OPENGL_ES2=`$PKG_CONFIG --cflags-only-I glesv2 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
4991             QMAKE_LIBDIR_OPENGL_ES2=`$PKG_CONFIG --libs-only-L glesv2 2>/dev/null | sed -e 's,^-L,,g' -e 's, -L, ,g'`
4992             QMAKE_LIBS_OPENGL_ES2=`$PKG_CONFIG --libs glesv2 2>/dev/null`
4993             QMAKE_CFLAGS_OPENGL_ES2=`$PKG_CONFIG --cflags glesv2 2>/dev/null`
4994             QMakeVar set QMAKE_INCDIR_OPENGL_ES2 "$QMAKE_INCDIR_OPENGL_ES2"
4995             QMakeVar set QMAKE_LIBDIR_OPENGL_ES2 "$QMAKE_LIBDIR_OPENGL_ES2"
4996             QMakeVar set QMAKE_LIBS_OPENGL_ES2 "$QMAKE_LIBS_OPENGL_ES2"
4997         fi
4998
4999         "$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
5000         if [ $? != "0" ]; then
5001             echo "The OpenGL ES 2.0 functionality test failed!"
5002             echo " You might need to modify the include and library search paths by editing"
5003             echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
5004             echo " ${XQMAKESPEC}."
5005             exit 1
5006         fi
5007     elif [ "$CFG_OPENGL" = "desktop" ]; then
5008         # Desktop OpenGL support
5009         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengldesktop "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
5010         if [ $? != "0" ]; then
5011             echo "The OpenGL functionality test failed!"
5012             echo " You might need to modify the include and library search paths by editing"
5013             echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5014             echo " ${XQMAKESPEC}."
5015             exit 1
5016         fi
5017     fi
5018
5019     # auto-detect FontConfig support
5020     if [ "$CFG_FONTCONFIG" != "no" ]; then
5021         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
5022             QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
5023             QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null`
5024         else
5025             QT_CFLAGS_FONTCONFIG=
5026             QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig"
5027         fi
5028         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
5029                 QT_CONFIG="$QT_CONFIG fontconfig"
5030                 QMakeVar set QMAKE_CFLAGS_FONTCONFIG "$QT_CFLAGS_FONTCONFIG"
5031                 QMakeVar set QMAKE_LIBS_FONTCONFIG "$QT_LIBS_FONTCONFIG"
5032                 CFG_LIBFREETYPE=system
5033         fi
5034
5035     fi
5036
5037     # Save these for a check later
5038     ORIG_CFG_XCB="$CFG_XCB"
5039     ORIG_CFG_EGLFS="$CFG_EGLFS"
5040
5041     if [ "$CFG_LIBUDEV" != "no" ]; then
5042        if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists libudev 2>/dev/null; then
5043            QMAKE_INCDIR_LIBUDEV=`$PKG_CONFIG --cflags-only-I libudev 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
5044            QMAKE_LIBS_LIBUDEV=`$PKG_CONFIG --libs libudev 2>/dev/null`
5045            QMakeVar set QMAKE_INCDIR_LIBUDEV "$QMAKE_INCDIR_LIBUDEV"
5046            QMakeVar set QMAKE_LIBS_LIBUDEV "$QMAKE_LIBS_LIBUDEV"
5047        fi
5048        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
5049             CFG_LIBUDEV=yes
5050             QT_CONFIG="$QT_CONFIG libudev"
5051         elif [ "$CFG_LIBUDEV" = "yes" ]; then
5052             echo "The libudev functionality test failed!"
5053             exit 1
5054         else
5055             CFG_LIBUDEV=no
5056             QMakeVar add DEFINES QT_NO_LIBUDEV
5057         fi
5058     fi
5059
5060     if [ "$CFG_EVDEV" != "no" ]; then
5061         if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/evdev "evdev" $L_FLAGS $I_FLAGS $l_FLAGS; then
5062             CFG_EVDEV=yes
5063             QT_CONFIG="$QT_CONFIG evdev"
5064         elif [ "$CFG_EVDEV" = "yes" ]; then
5065             echo "The evdev functionality test failed!"
5066             exit 1
5067         else
5068             CFG_EVDEV=no
5069             QMakeVar add DEFINES QT_NO_EVDEV
5070         fi
5071     fi
5072
5073     # Check we actually have X11 :-)
5074     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
5075         QT_CONFIG="$QT_CONFIG xlib"
5076     fi
5077
5078     # auto-detect Xrender support
5079     if [ "$CFG_XRENDER" != "no" ]; then
5080         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
5081             CFG_XRENDER=yes
5082             QT_CONFIG="$QT_CONFIG xrender"
5083         else
5084             if [ "$CFG_XRENDER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5085                 echo "Xrender support cannot be enabled due to functionality tests!"
5086                 echo " Turn on verbose messaging (-v) to $0 to see the final report."
5087                 echo " If you believe this message is in error you may use the continue"
5088                 echo " switch (-continue) to $0 to continue."
5089                 exit 101
5090             else
5091                 CFG_XRENDER=no
5092             fi
5093         fi
5094     fi
5095
5096     if [ "$CFG_XCB" != "no" ]; then
5097         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xcb >= 1.5" 2>/dev/null; then
5098             QMAKE_CFLAGS_XCB="`$PKG_CONFIG --cflags xcb 2>/dev/null`"
5099             QMAKE_LIBS_XCB="`$PKG_CONFIG --libs xcb 2>/dev/null`"
5100         fi
5101         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
5102             CFG_XCB=yes
5103             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
5104                 QT_CONFIG="$QT_CONFIG xcb-render"
5105             fi
5106
5107             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
5108                 CFG_XCB_LIMITED=no
5109                 QT_CONFIG="$QT_CONFIG xcb-poll-for-queued-event"
5110             fi
5111
5112             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
5113                 QT_CONFIG="$QT_CONFIG xcb-xlib"
5114             fi
5115
5116             if [ "$XPLATFORM_MAEMO" = "yes" ]; then
5117                 # auto-detect XInput2/Xinput support
5118                 if [ "$CFG_XINPUT2" != "no" ]; then
5119                     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
5120                     CFG_XINPUT2=yes
5121                     CFG_XINPUT=no
5122                     else
5123                         if [ "$CFG_XINPUT2" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5124                             echo "XInput2 support cannot be enabled due to functionality tests!"
5125                             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5126                             echo " If you believe this message is in error you may use the continue"
5127                             echo " switch (-continue) to $0 to continue."
5128                             exit 101
5129                         else
5130                             CFG_XINPUT2=no
5131                         fi
5132                     fi
5133                 fi
5134             fi
5135         else
5136             if [ "$CFG_XCB" = "yes" ]; then
5137                 echo "The XCB test failed!"
5138                 echo " You might need to install dependency packages."
5139                 echo " See src/plugins/platforms/xcb/README."
5140                 exit 1
5141             fi
5142             CFG_XCB=no
5143             QMakeVar add DEFINES QT_NO_XCB
5144         fi
5145     fi
5146
5147     # Detect libxkbcommon
5148     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xkbcommon 2>/dev/null; then
5149         QMAKE_CFLAGS_XKBCOMMON="`$PKG_CONFIG --cflags xkbcommon 2>/dev/null`"
5150         QMAKE_LIBS_XKBCOMMON="`$PKG_CONFIG --libs xkbcommon 2>/dev/null`"
5151         QMAKE_CFLAGS_XCB="$QMAKE_CFLAGS_XCB $QMAKE_CFLAGS_XKBCOMMON"
5152         QMAKE_LIBS_XCB="$QMAKE_LIBS_XCB $QMAKE_LIBS_XKBCOMMON"
5153     else
5154         QMAKE_DEFINES_XCB=QT_NO_XCB_XKB
5155     fi
5156
5157     # EGL Support
5158     if [ "$CFG_EGL" != "no" ]; then
5159         if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists egl 2>/dev/null; then
5160             QMAKE_INCDIR_EGL=`$PKG_CONFIG --cflags-only-I egl 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
5161             QMAKE_LIBS_EGL=`$PKG_CONFIG --libs egl 2>/dev/null`
5162             QMAKE_CFLAGS_EGL=`$PKG_CONFIG --cflags egl 2>/dev/null`
5163             QMakeVar set QMAKE_INCDIR_EGL "$QMAKE_INCDIR_EGL"
5164             QMakeVar set QMAKE_LIBS_EGL "$QMAKE_LIBS_EGL"
5165         fi       # detect EGL support
5166         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
5167             CFG_EGL=yes
5168         elif [ "$CFG_EGL" = "yes" ]; then
5169             echo " The EGL functionality test failed; EGL is required by some QPA plugins to manage contexts & surfaces."
5170             echo " You might need to modify the include and library search paths by editing"
5171             echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in ${XQMAKESPEC}."
5172             exit 1
5173         else
5174             CFG_EGL=no
5175         fi
5176     fi
5177
5178     if [ "$CFG_EGLFS" != "no" ]; then
5179         CFG_EGLFS="$CFG_EGL"
5180     fi
5181
5182     if [ -n "$QMAKE_CFLAGS_XCB" ] || [ -n "$QMAKE_LIBS_XCB" ]; then
5183         QMakeVar set QMAKE_CFLAGS_XCB "$QMAKE_CFLAGS_XCB"
5184         QMakeVar set QMAKE_LIBS_XCB "$QMAKE_LIBS_XCB"
5185         QMakeVar set QMAKE_DEFINES_XCB "$QMAKE_DEFINES_XCB"
5186     fi
5187
5188     if [ "$BUILD_ON_MAC" = "yes" ]; then
5189         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
5190             QT_CONFIG="$QT_CONFIG coreservices"
5191         else
5192             QMakeVar add DEFINES QT_NO_CORESERVICES
5193         fi
5194     fi
5195
5196     if [ "$PLATFORM_QPA" = "yes" ] && [ "$BUILD_ON_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ]; then
5197         if [ "$CFG_XCB" = "no" ] && [ "$CFG_EGLFS" = "no" ]; then
5198             if [ "$QPA_PLATFORM_GUARD" = "yes" ] &&
5199                  ( [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_EGLFS" = "auto" ] ); then
5200                 echo "No QPA platform plugin enabled!"
5201                 echo " If you really want to build without a QPA platform plugin you must pass"
5202                 echo " -no-xcb and -no-eglfs to configure. Doing this will"
5203                 echo " produce a Qt that cannot run GUI applications."
5204                 echo " The dependencies needed for xcb to build are listed in"
5205                 echo " src/plugins/platforms/xcb/README"
5206                 exit 1
5207             fi
5208         fi
5209     fi
5210
5211 fi
5212
5213 [ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_PHONON" != "no" ] && CFG_PHONON="yes"
5214
5215 # freetype support
5216 [ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_LIBFREETYPE" = "auto" ] && CFG_LIBFREETYPE=no
5217 if [ "$CFG_LIBFREETYPE" = "auto" ]; then
5218     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
5219         CFG_LIBFREETYPE=system
5220     else
5221         CFG_LIBFREETYPE=yes
5222     fi
5223 fi
5224
5225 HAVE_STL=no
5226 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stl "STL" $L_FLAGS $I_FLAGS $l_FLAGS; then
5227     HAVE_STL=yes
5228 fi
5229
5230 if [ "$CFG_STL" != "no" ]; then
5231     if [ "$HAVE_STL" = "yes" ]; then
5232         CFG_STL=yes
5233     else
5234         if [ "$CFG_STL" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5235             echo "STL support cannot be enabled due to functionality tests!"
5236             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5237             echo " If you believe this message is in error you may use the continue"
5238             echo " switch (-continue) to $0 to continue."
5239             exit 101
5240         else
5241             CFG_STL=no
5242         fi
5243     fi
5244 fi
5245
5246 # detect POSIX clock_gettime()
5247 if [ "$CFG_CLOCK_GETTIME" = "auto" ]; then
5248     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
5249         CFG_CLOCK_GETTIME=yes
5250     else
5251         CFG_CLOCK_GETTIME=no
5252     fi
5253 fi
5254
5255 # detect POSIX monotonic clocks
5256 if [ "$CFG_CLOCK_GETTIME" = "yes" ] && [ "$CFG_CLOCK_MONOTONIC" = "auto" ]; then
5257     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
5258         CFG_CLOCK_MONOTONIC=yes
5259     else
5260         CFG_CLOCK_MONOTONIC=no
5261     fi
5262 elif [ "$CFG_CLOCK_GETTIME" = "no" ]; then
5263     CFG_CLOCK_MONOTONIC=no
5264 fi
5265
5266 # detect mremap
5267 if [ "$CFG_MREMAP" = "auto" ]; then
5268     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mremap "mremap" $L_FLAGS $I_FLAGS $l_FLAGS; then
5269         CFG_MREMAP=yes
5270     else
5271         CFG_MREMAP=no
5272     fi
5273 fi
5274
5275 # find if the platform provides getaddrinfo (ipv6 dns lookups)
5276 if [ "$CFG_GETADDRINFO" != "no" ]; then
5277     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getaddrinfo "getaddrinfo" $L_FLAGS $I_FLAGS $l_FLAGS; then
5278         CFG_GETADDRINFO=yes
5279     else
5280         if [ "$CFG_GETADDRINFO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5281             echo "getaddrinfo support cannot be enabled due to functionality tests!"
5282             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5283             echo " If you believe this message is in error you may use the continue"
5284             echo " switch (-continue) to $0 to continue."
5285             exit 101
5286         else
5287             CFG_GETADDRINFO=no
5288         fi
5289     fi
5290 fi
5291
5292 # find if the platform provides inotify
5293 if [ "$CFG_INOTIFY" != "no" ]; then
5294     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/inotify "inotify" $L_FLAGS $I_FLAGS $l_FLAGS; then
5295         CFG_INOTIFY=yes
5296     else
5297         if [ "$CFG_INOTIFY" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5298             echo "inotify support cannot be enabled due to functionality tests!"
5299             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5300             echo " If you believe this message is in error you may use the continue"
5301             echo " switch (-continue) to $0 to continue."
5302             exit 101
5303         else
5304             CFG_INOTIFY=no
5305         fi
5306     fi
5307 fi
5308
5309 # find if the platform provides if_nametoindex (ipv6 interface name support)
5310 if [ "$CFG_IPV6IFNAME" != "no" ]; then
5311     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
5312         CFG_IPV6IFNAME=yes
5313     else
5314         if [ "$CFG_IPV6IFNAME" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5315             echo "IPv6 interface name support cannot be enabled due to functionality tests!"
5316             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5317             echo " If you believe this message is in error you may use the continue"
5318             echo " switch (-continue) to $0 to continue."
5319             exit 101
5320         else
5321             CFG_IPV6IFNAME=no
5322         fi
5323     fi
5324 fi
5325
5326 # find if the platform provides getifaddrs (network interface enumeration)
5327 if [ "$CFG_GETIFADDRS" != "no" ]; then
5328     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getifaddrs "getifaddrs" $L_FLAGS $I_FLAGS $l_FLAGS; then
5329         CFG_GETIFADDRS=yes
5330     else
5331         if [ "$CFG_GETIFADDRS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5332             echo "getifaddrs support cannot be enabled due to functionality tests!"
5333             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5334             echo " If you believe this message is in error you may use the continue"
5335             echo " switch (-continue) to $0 to continue."
5336             exit 101
5337         else
5338             CFG_GETIFADDRS=no
5339         fi
5340     fi
5341 fi
5342
5343 # detect OpenSSL
5344 if [ "$CFG_OPENSSL" != "no" ]; then
5345     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
5346         if [ "$CFG_OPENSSL" = "auto" ]; then
5347             CFG_OPENSSL=yes
5348         fi
5349     else
5350         if ( [ "$CFG_OPENSSL" = "yes" ] || [ "$CFG_OPENSSL" = "linked" ] ) && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5351             echo "OpenSSL support cannot be enabled due to functionality tests!"
5352             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5353             echo " If you believe this message is in error you may use the continue"
5354             echo " switch (-continue) to $0 to continue."
5355             exit 101
5356         else
5357             CFG_OPENSSL=no
5358         fi
5359     fi
5360 fi
5361
5362 # detect PCRE
5363 if [ "$CFG_PCRE" != "qt" ]; then
5364     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/pcre "PCRE" $L_FLAGS $I_FLAGS $l_FLAGS; then
5365         CFG_PCRE=system
5366     else
5367         if [ "$CFG_PCRE" = "system" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5368             echo "PCRE support cannot be enabled due to functionality tests!"
5369             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5370             echo " If you believe this message is in error you may use the continue"
5371             echo " switch (-continue) to $0 to continue."
5372             exit 101
5373         else
5374             CFG_PCRE=qt
5375         fi
5376     fi
5377 fi
5378
5379 # detect OpenVG support
5380 if [ "$CFG_OPENVG" != "no" ]; then
5381     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
5382         if [ "$CFG_OPENVG" = "auto" ]; then
5383             CFG_OPENVG=yes
5384         fi
5385     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
5386         if [ "$CFG_OPENVG" = "auto" ]; then
5387             CFG_OPENVG=yes
5388         fi
5389         CFG_OPENVG_ON_OPENGL=yes
5390     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
5391         if [ "$CFG_OPENVG" = "auto" ]; then
5392             CFG_OPENVG=yes
5393         fi
5394         CFG_OPENVG_LC_INCLUDES=yes
5395     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
5396         if [ "$CFG_OPENVG" = "auto" ]; then
5397             CFG_OPENVG=yes
5398         fi
5399         CFG_OPENVG_LC_INCLUDES=yes
5400         CFG_OPENVG_ON_OPENGL=yes
5401     else
5402         if [ "$CFG_OPENVG" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5403             echo "$CFG_OPENVG was specified for OpenVG but cannot be enabled due to functionality tests!"
5404             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5405             echo " If you believe this message is in error you may use the continue"
5406             echo " switch (-continue) to $0 to continue."
5407             exit 101
5408         else
5409             CFG_OPENVG=no
5410         fi
5411     fi
5412     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
5413         CFG_OPENVG_SHIVA=yes
5414     fi
5415 fi
5416
5417 if [ "$CFG_ALSA" = "auto" ]; then
5418     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/alsa "alsa" $L_FLAGS $I_FLAGS $l_FLAGS; then
5419         CFG_ALSA=yes
5420     else
5421         CFG_ALSA=no
5422     fi
5423 fi
5424
5425 if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ] || [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then 
5426     if [ "$CFG_ARCH" = "arm" ]; then
5427        "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/javascriptcore-jit "javascriptcore-jit" $L_FLAGS $I_FLAGS $l_FLAGS
5428         if [ $? != "0" ]; then
5429            CFG_JAVASCRIPTCORE_JIT=no
5430         fi
5431     else
5432         case "$XPLATFORM" in
5433             linux-icc*)
5434                 CFG_JAVASCRIPTCORE_JIT=no
5435                 ;;
5436         esac
5437     fi
5438 fi
5439
5440 if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ]; then
5441     QMakeVar set JAVASCRIPTCORE_JIT yes
5442 elif [ "$CFG_JAVASCRIPTCORE_JIT" = "no" ]; then
5443     QMakeVar set JAVASCRIPTCORE_JIT no
5444 fi
5445
5446 if [ "$CFG_AUDIO_BACKEND" = "auto" ]; then
5447     CFG_AUDIO_BACKEND=yes
5448 fi
5449
5450 if [ "$CFG_LARGEFILE" != "yes" ] && [ "$XPLATFORM_MINGW" = "yes" ]; then
5451     echo "Warning: largefile support cannot be disabled for win32."
5452     CFG_LARGEFILE="yes"
5453 fi
5454
5455 #-------------------------------------------------------------------------------
5456 # ask for all that hasn't been auto-detected or specified in the arguments
5457 #-------------------------------------------------------------------------------
5458
5459 # enable dwarf2 support on Mac
5460 if [ "$CFG_MAC_DWARF2" = "yes" ]; then
5461     QT_CONFIG="$QT_CONFIG dwarf2"
5462 fi
5463
5464 # Detect the default arch (x86 or x86_64) on Mac OS X
5465 if [ "$BUILD_ON_MAC" = "yes" ] && [ "$QT_CROSS_COMPILE" = "no" ]; then
5466     DEFAULT_ARCH=
5467     case `file "${outpath}/bin/qmake"` in
5468     *i?86)
5469         DEFAULT_ARCH=x86
5470         ;;
5471     *x86_64)
5472         DEFAULT_ARCH=x86_64
5473         ;;
5474     *ppc|*ppc64|*)
5475         # unsupported/unknown
5476         ;;
5477     esac
5478
5479     if [ -n "$DEFAULT_ARCH" ]; then
5480         [ "$OPT_VERBOSE" = "yes" ] && echo "Setting default Mac OS X architechture to $DEFAULT_ARCH."
5481         QT_CONFIG="$QT_CONFIG $DEFAULT_ARCH"
5482         QMAKE_CONFIG="$QMAKE_CONFIG $DEFAULT_ARCH"
5483         # Make the application arch follow the Qt arch
5484         QTCONFIG_CONFIG="$QTCONFIG_CONFIG $DEFAULT_ARCH"
5485     fi
5486 fi
5487
5488 # ### Vestige
5489 if [ "$CFG_PHONON_BACKEND" = "yes" ]; then
5490     QT_CONFIG="$QT_CONFIG phonon-backend"
5491 fi
5492
5493 # disable accessibility
5494 if [ "$CFG_ACCESSIBILITY" = "no" ]; then
5495     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ACCESSIBILITY"
5496 else
5497     QT_CONFIG="$QT_CONFIG accessibility"
5498 fi
5499
5500 # enable egl
5501 if [ "$CFG_EGL" = "yes" ]; then
5502     QT_CONFIG="$QT_CONFIG egl"
5503 else
5504     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGL"
5505 fi
5506
5507 # enable eglfs
5508 if [ "$CFG_EGLFS" = "yes" ]; then
5509     QT_CONFIG="$QT_CONFIG eglfs"
5510 else
5511     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGLFS"
5512 fi
5513
5514 # enable openvg
5515 if [ "$CFG_OPENVG" = "no" ]; then
5516     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENVG"
5517 else
5518     QT_CONFIG="$QT_CONFIG openvg"
5519     if [ "$CFG_OPENVG_LC_INCLUDES" = "yes" ]; then
5520         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LOWER_CASE_VG_INCLUDES"
5521     fi
5522     if [ "$CFG_OPENVG_ON_OPENGL" = "yes" ]; then
5523         QT_CONFIG="$QT_CONFIG openvg_on_opengl"
5524     fi
5525     if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
5526         QT_CONFIG="$QT_CONFIG shivavg"
5527         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SHIVAVG"
5528     fi
5529 fi
5530
5531 # enable opengl
5532 if [ "$CFG_OPENGL" = "no" ]; then
5533     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENGL"
5534 else
5535     QT_CONFIG="$QT_CONFIG opengl"
5536 fi
5537
5538 if [ "$CFG_OPENGL" = "es2" ]; then
5539     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES"
5540 fi
5541
5542 if [ "$CFG_OPENGL" = "es2" ]; then
5543     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_2"
5544     QT_CONFIG="$QT_CONFIG opengles2"
5545 fi
5546
5547 # safe execution environment
5548 if [ "$CFG_SXE" != "no" ]; then
5549     QT_CONFIG="$QT_CONFIG sxe"
5550 fi
5551
5552 # build up the variables for output
5553 if [ "$CFG_DEBUG" = "yes" ]; then
5554     QMAKE_OUTDIR="${QMAKE_OUTDIR}debug"
5555     QMAKE_CONFIG="$QMAKE_CONFIG debug"
5556 elif [ "$CFG_DEBUG" = "no" ]; then
5557     QMAKE_OUTDIR="${QMAKE_OUTDIR}release"
5558     QMAKE_CONFIG="$QMAKE_CONFIG release"
5559 fi
5560 if [ "$CFG_SHARED" = "yes" ]; then
5561     QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared"
5562     QMAKE_CONFIG="$QMAKE_CONFIG shared dll"
5563 elif [ "$CFG_SHARED" = "no" ]; then
5564     QMAKE_OUTDIR="${QMAKE_OUTDIR}-static"
5565     QMAKE_CONFIG="$QMAKE_CONFIG static"
5566 fi
5567 if [ "$PLATFORM_QPA" = "yes" ]; then
5568     QMAKE_CONFIG="$QMAKE_CONFIG qpa"
5569     QT_CONFIG="$QT_CONFIG qpa"
5570     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qpa"
5571     rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
5572 fi
5573
5574 if [ "$XPLATFORM_MINGW" != "yes" ]; then
5575     # Do not set this here for Windows. Let qmake do it so
5576     # debug and release precompiled headers are kept separate.
5577     QMakeVar set PRECOMPILED_DIR ".pch/$QMAKE_OUTDIR"
5578 fi
5579 QMakeVar set OBJECTS_DIR ".obj/$QMAKE_OUTDIR"
5580 QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR"
5581 QMakeVar set RCC_DIR ".rcc/$QMAKE_OUTDIR"
5582 QMakeVar set UI_DIR ".uic/$QMAKE_OUTDIR"
5583 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
5584     QMAKE_CONFIG="$QMAKE_CONFIG largefile"
5585 fi
5586 if [ "$CFG_STL" = "no" ]; then
5587     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STL"
5588 else
5589     QMAKE_CONFIG="$QMAKE_CONFIG stl"
5590 fi
5591 if [ "$CFG_USE_GNUMAKE" = "yes" ]; then
5592     QMAKE_CONFIG="$QMAKE_CONFIG GNUmake"
5593 fi
5594 [ "$CFG_REDUCE_EXPORTS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_exports"
5595 [ "$CFG_REDUCE_RELOCATIONS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_relocations"
5596 [ "$CFG_PRECOMPILE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG precompile_header"
5597 if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
5598     QMakeVar add QMAKE_CFLAGS -g
5599     QMakeVar add QMAKE_CXXFLAGS -g
5600     QT_CONFIG="$QT_CONFIG separate_debug_info"
5601 fi
5602 if [ "$CFG_SEPARATE_DEBUG_INFO_NOCOPY" = "yes" ] ; then
5603     QT_CONFIG="$QT_CONFIG separate_debug_info_nocopy"
5604 fi
5605 [ "$CFG_MMX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mmx"
5606 [ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow"
5607 [ "$CFG_SSE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse"
5608 [ "$CFG_SSE2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse2"
5609 [ "$CFG_SSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse3"
5610 [ "$CFG_SSSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG ssse3"
5611 [ "$CFG_SSE4_1" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_1"
5612 [ "$CFG_SSE4_2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_2"
5613 [ "$CFG_AVX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG avx"
5614 [ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt"
5615 [ "$CFG_NEON" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG neon"
5616 if [ "$CFG_ARCH" = "mips" ]; then
5617     [ "$CFG_MIPS_DSP" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mips_dsp"
5618     [ "$CFG_MIPS_DSPR2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mips_dspr2"
5619 fi
5620 if [ "$CFG_CLOCK_GETTIME" = "yes" ]; then
5621     QT_CONFIG="$QT_CONFIG clock-gettime"
5622 fi
5623 if [ "$CFG_CLOCK_MONOTONIC" = "yes" ]; then
5624     QT_CONFIG="$QT_CONFIG clock-monotonic"
5625 fi
5626 if [ "$CFG_MREMAP" = "yes" ]; then
5627     QT_CONFIG="$QT_CONFIG mremap"
5628 fi
5629 if [ "$CFG_GETADDRINFO" = "yes" ]; then
5630     QT_CONFIG="$QT_CONFIG getaddrinfo"
5631 fi
5632 if [ "$CFG_IPV6IFNAME" = "yes" ]; then
5633     QT_CONFIG="$QT_CONFIG ipv6ifname"
5634 fi
5635 if [ "$CFG_GETIFADDRS" = "yes" ]; then
5636     QT_CONFIG="$QT_CONFIG getifaddrs"
5637 fi
5638 if [ "$CFG_INOTIFY" = "yes" ]; then
5639     QT_CONFIG="$QT_CONFIG inotify"
5640 fi
5641 if [ "$CFG_LIBJPEG" = "no" ]; then
5642     CFG_JPEG="no"
5643 elif [ "$CFG_LIBJPEG" = "system" ]; then
5644     QT_CONFIG="$QT_CONFIG system-jpeg"
5645 fi
5646 if [ "$CFG_JPEG" = "no" ]; then
5647     QT_CONFIG="$QT_CONFIG no-jpeg"
5648 elif [ "$CFG_JPEG" = "yes" ]; then
5649     QT_CONFIG="$QT_CONFIG jpeg"
5650 fi
5651 if [ "$CFG_LIBPNG" = "no" ]; then
5652     CFG_PNG="no"
5653 fi
5654 if [ "$CFG_LIBPNG" = "system" ]; then
5655     QT_CONFIG="$QT_CONFIG system-png"
5656 fi
5657 if [ "$CFG_PNG" = "no" ]; then
5658     QT_CONFIG="$QT_CONFIG no-png"
5659 elif [ "$CFG_PNG" = "yes" ]; then
5660     QT_CONFIG="$QT_CONFIG png"
5661 fi
5662 if [ "$CFG_GIF" = "no" ]; then
5663     QT_CONFIG="$QT_CONFIG no-gif"
5664 elif [ "$CFG_GIF" = "yes" ]; then
5665     QT_CONFIG="$QT_CONFIG gif"
5666 fi
5667 if [ "$CFG_LIBFREETYPE" = "no" ]; then
5668     QT_CONFIG="$QT_CONFIG no-freetype"
5669     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FREETYPE"
5670 elif [ "$CFG_LIBFREETYPE" = "system" ]; then
5671     QT_CONFIG="$QT_CONFIG system-freetype"
5672 else
5673     QT_CONFIG="$QT_CONFIG freetype"
5674 fi
5675 if [ "$CFG_GUI" = "auto" ]; then
5676     CFG_GUI="yes"
5677 fi
5678 if [ "$CFG_GUI" = "no" ]; then
5679     QT_CONFIG="$QT_CONFIG no-gui"
5680     CFG_WIDGETS="no"
5681 fi
5682 if [ "$CFG_WIDGETS" = "no" ]; then
5683     QT_CONFIG="$QT_CONFIG no-widgets"
5684     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_WIDGETS"
5685 fi
5686
5687 if [ "x$BUILD_ON_MAC" = "xyes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
5688     #On Mac we implicitly link against libz, so we
5689     #never use the 3rdparty stuff.
5690     [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system"
5691 fi
5692 if [ "$CFG_ZLIB" = "yes" ]; then
5693     QT_CONFIG="$QT_CONFIG zlib"
5694 elif [ "$CFG_ZLIB" = "system" ]; then
5695     QT_CONFIG="$QT_CONFIG system-zlib"
5696 fi
5697
5698 [ "$CFG_NIS" = "yes" ] && QT_CONFIG="$QT_CONFIG nis"
5699 [ "$CFG_CUPS" = "yes" ] && QT_CONFIG="$QT_CONFIG cups"
5700 [ "$CFG_ICONV" = "yes" ] && QT_CONFIG="$QT_CONFIG iconv"
5701 [ "$CFG_ICONV" = "sun" ] && QT_CONFIG="$QT_CONFIG sun-libiconv"
5702 [ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv"
5703 [ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib"
5704 [ "$CFG_GSTREAMER" = "yes" ] && QT_CONFIG="$QT_CONFIG gstreamer"
5705 [ "$CFG_DBUS" = "yes" ] && QT_CONFIG="$QT_CONFIG dbus"
5706 [ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus dbus-linked"
5707 [ "$CFG_NAS" = "system" ] && QT_CONFIG="$QT_CONFIG nas"
5708 [ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl"
5709 [ "$CFG_OPENSSL" = "linked" ] && QT_CONFIG="$QT_CONFIG openssl-linked"
5710 [ "$CFG_MAC_HARFBUZZ" = "yes" ] && QT_CONFIG="$QT_CONFIG harfbuzz"
5711 [ "$CFG_XCB" = "yes" ] && QT_CONFIG="$QT_CONFIG xcb"
5712 [ "$CFG_XINPUT2" = "yes" ] && QT_CONFIG="$QT_CONFIG xinput2"
5713
5714 if [ "$PLATFORM_X11" = "yes" ]; then
5715     [ "$CFG_SM" = "yes" ] && QT_CONFIG="$QT_CONFIG x11sm"
5716
5717     # for some reason, the following libraries are not always built shared,
5718     # so *every* program/lib (including Qt) has to link against them
5719     if [ "$CFG_XSHAPE" = "yes" ]; then
5720         QT_CONFIG="$QT_CONFIG xshape"
5721     fi
5722     if [ "$CFG_XVIDEO" = "yes" ]; then
5723         QT_CONFIG="$QT_CONFIG xvideo"
5724     fi
5725     if [ "$CFG_XSYNC" = "yes" ]; then
5726         QT_CONFIG="$QT_CONFIG xsync"
5727     fi
5728     if [ "$CFG_XINERAMA" = "yes" ]; then
5729         QT_CONFIG="$QT_CONFIG xinerama"
5730         QMakeVar set QMAKE_LIBS_X11 '-lXinerama $$QMAKE_LIBS_X11'
5731     fi
5732     if [ "$CFG_XCURSOR" = "yes" ]; then
5733         QT_CONFIG="$QT_CONFIG xcursor"
5734         QMakeVar set QMAKE_LIBS_X11 '-lXcursor $$QMAKE_LIBS_X11'
5735     fi
5736     if [ "$CFG_XFIXES" = "yes" ]; then
5737         QT_CONFIG="$QT_CONFIG xfixes"
5738         QMakeVar set QMAKE_LIBS_X11 '-lXfixes $$QMAKE_LIBS_X11'
5739     fi
5740     if [ "$CFG_XRANDR" = "yes" ]; then
5741         QT_CONFIG="$QT_CONFIG xrandr"
5742         if [ "$CFG_XRENDER" != "yes" ]; then
5743             # libXrandr uses 1 function from libXrender, so we always have to have it :/
5744             QMakeVar set QMAKE_LIBS_X11 '-lXrandr -lXrender $$QMAKE_LIBS_X11'
5745         else
5746             QMakeVar set QMAKE_LIBS_X11 '-lXrandr $$QMAKE_LIBS_X11'
5747         fi
5748     fi
5749     if [ "$CFG_XRENDER" = "yes" ]; then
5750         QT_CONFIG="$QT_CONFIG xrender"
5751         QMakeVar set QMAKE_LIBS_X11 '-lXrender $$QMAKE_LIBS_X11'
5752     fi
5753     if [ "$CFG_MITSHM" = "yes" ]; then
5754         QT_CONFIG="$QT_CONFIG mitshm"
5755     fi
5756     if [ "$CFG_FONTCONFIG" = "yes" ]; then
5757         QT_CONFIG="$QT_CONFIG fontconfig"
5758     fi
5759     if [ "$CFG_XINPUT" = "yes" ]; then
5760         QMakeVar set QMAKE_LIBS_X11 '-lXi $$QMAKE_LIBS_X11'
5761     fi
5762     if [ "$CFG_XINPUT" = "yes" ]; then
5763         QT_CONFIG="$QT_CONFIG xinput tablet"
5764     fi
5765     if [ "$CFG_XKB" = "yes" ]; then
5766         QT_CONFIG="$QT_CONFIG xkb"
5767     fi
5768 fi
5769
5770 [ '!' -z "$D_FLAGS" ] && QMakeVar add DEFINES "$D_FLAGS"
5771 [ '!' -z "$L_FLAGS" ] && QMakeVar add QMAKE_LIBDIR_FLAGS "$L_FLAGS"
5772 [ '!' -z "$l_FLAGS" ] && QMakeVar add LIBS "$l_FLAGS"
5773
5774 if [ "$PLATFORM_MAC" = "yes" ] && [ "$QT_CROSS_COMPILE" = "no" ]; then
5775     if [ "$CFG_RPATH" = "yes" ]; then
5776        QMAKE_CONFIG="$QMAKE_CONFIG absolute_library_soname"
5777        # set the default rpath to the library installation directory
5778        RPATH_FLAGS="\"$QT_INSTALL_LIBS\" $RPATH_FLAGS"
5779     fi
5780 elif [ -z "`getXQMakeConf 'QMAKE_(LFLAGS_)?RPATH'`" ]; then
5781     if [ -n "$RPATH_FLAGS" ]; then
5782         echo
5783         echo "ERROR: -R cannot be used on this platform as \$QMAKE_LFLAGS_RPATH is"
5784         echo "       undefined."
5785         echo
5786         exit 1
5787     elif [ "$CFG_RPATH" = "yes" ]; then
5788         RPATH_MESSAGE="        NOTE: This platform does not support runtime library paths, using -no-rpath."
5789         CFG_RPATH=no
5790     fi
5791 else
5792     if [ "$CFG_RPATH" = "yes" ]; then
5793         # set the default rpath to the library installation directory
5794         RPATH_FLAGS="\"$QT_INSTALL_LIBS\" $RPATH_FLAGS"
5795     fi
5796     if [ -n "$RPATH_FLAGS" ]; then
5797         # add the user defined rpaths
5798         QMakeVar add QMAKE_RPATHDIR "$RPATH_FLAGS"
5799     fi
5800 fi
5801
5802 if [ '!' -z "$I_FLAGS" ]; then
5803     # add the user define include paths
5804     QMakeVar add QMAKE_CFLAGS "$I_FLAGS"
5805     QMakeVar add QMAKE_CXXFLAGS "$I_FLAGS"
5806 fi
5807
5808 if [ '!' -z "$W_FLAGS" ]; then
5809     # add the user defined warning flags
5810     QMakeVar add QMAKE_CFLAGS_WARN_ON "$W_FLAGS"
5811     QMakeVar add QMAKE_CXXFLAGS_WARN_ON "$W_FLAGS"
5812     QMakeVar add QMAKE_OBJECTIVE_CFLAGS_WARN_ON "$W_FLAGS"
5813 fi
5814
5815 # turn off exceptions for the compilers that support it
5816 if [ "$XPLATFORM" != "$PLATFORM" ]; then
5817     COMPILER=`echo $XPLATFORM | cut -f 2- -d-`
5818 else
5819     COMPILER=`echo $PLATFORM | cut -f 2- -d-`
5820 fi
5821
5822 if [ "$CFG_EXCEPTIONS" != "no" ]; then
5823     QTCONFIG_CONFIG="$QTCONFIG_CONFIG exceptions"
5824 fi
5825
5826 if [ "$XPLATFORM_MINGW" = "yes" ]; then
5827     # mkspecs/features/win32/default_pre.prf sets "no-rtti".
5828     # Follow default behavior of configure.exe by overriding with "rtti".
5829     QTCONFIG_CONFIG="$QTCONFIG_CONFIG rtti"
5830 fi
5831
5832 if [ "$CFG_ALSA" = "yes" ]; then
5833     QT_CONFIG="$QT_CONFIG alsa"
5834 fi
5835
5836 if [ "$CFG_PULSEAUDIO" = "yes" ]; then
5837     QT_CONFIG="$QT_CONFIG pulseaudio"
5838 fi
5839
5840 if [ "$CFG_COREWLAN" = "yes" ]; then
5841     QT_CONFIG="$QT_CONFIG corewlan"
5842 fi
5843
5844 if [ "$CFG_ICU" = "yes" ]; then
5845     QT_CONFIG="$QT_CONFIG icu"
5846 fi
5847
5848 if [ "$CFG_FORCE_ASSERTS" = "yes" ]; then
5849     QT_CONFIG="$QT_CONFIG force_asserts"
5850 fi
5851
5852 if [ "$CFG_PCRE" = "qt" ]; then
5853     QMAKE_CONFIG="$QMAKE_CONFIG pcre"
5854 fi
5855
5856 #
5857 # Some Qt modules are too advanced in C++ for some old compilers
5858 # Detect here the platforms where they are known to work.
5859 #
5860 # See Qt documentation for more information on which features are
5861 # supported and on which compilers.
5862 #
5863 canBuildQtConcurrent="yes"
5864 canUseV8Snapshot="yes"
5865
5866 case "$XPLATFORM" in
5867     hpux-g++*)
5868         # PA-RISC's assembly is too limited
5869         # gcc 3.4 on that platform can't build QtXmlPatterns
5870         # the assembly it generates cannot be compiled
5871
5872         # Check gcc's version
5873         case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
5874             4*)
5875                 ;;
5876             3.4*)
5877                 canBuildQtXmlPatterns="no"
5878                 ;;
5879             *)
5880                 canBuildWebKit="no"
5881                 canBuildQtXmlPatterns="no"
5882                 ;;
5883         esac
5884         ;;
5885     unsupported/vxworks-*-g++*)
5886         canBuildWebKit="no"
5887         ;;
5888     unsupported/vxworks-*-dcc*)
5889         canBuildWebKit="no"
5890         canBuildQtXmlPatterns="no"
5891         ;;
5892     *-g++*)
5893         # Check gcc's version
5894         case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
5895             4*|3.4*)
5896                 ;;
5897             3.3*)
5898                 canBuildWebKit="no"
5899                 ;;
5900             *)
5901                 canBuildWebKit="no"
5902                 canBuildQtXmlPatterns="no"
5903                 ;;
5904         esac
5905         ;;
5906     solaris-cc*)
5907         # Check the compiler version
5908         case `${QMAKE_CONF_COMPILER} -V 2>&1 | awk '{print $4}'` in
5909             5.[012345678])
5910                 canBuildWebKit="no"
5911                 canBuildQtXmlPatterns="no"
5912                 canBuildQtConcurrent="no"
5913                 ;;
5914             5.*)
5915                 canBuildWebKit="no"
5916                 canBuildQtConcurrent="no"
5917                 ;;
5918         esac
5919         ;;
5920     hpux-acc*)
5921         canBuildWebKit="no"
5922         canBuildQtXmlPatterns="no"
5923         canBuildQtConcurrent="no"
5924         ;;
5925     hpuxi-acc*)
5926         canBuildWebKit="no"
5927         ;;
5928     aix-xlc*)
5929         # Get the xlC version
5930         cat > xlcver.c <<EOF
5931 #include <stdio.h>
5932 int main()
5933 {
5934     printf("%d.%d\n", __xlC__ >> 8, __xlC__ & 0xFF);
5935     return 0;
5936 }
5937 EOF
5938         xlcver=
5939         if ${QMAKE_CONF_COMPILER} -o xlcver xlcver.c >/dev/null 2>/dev/null; then
5940             xlcver=`./xlcver 2>/dev/null`
5941             rm -f ./xlcver
5942         fi
5943         if [ "$OPT_VERBOSE" = "yes" ]; then
5944             if [ -n "$xlcver" ]; then
5945                 echo Found IBM xlC version: $xlcver.
5946             else
5947                 echo Could not determine IBM xlC version, assuming oldest supported.
5948             fi
5949         fi
5950
5951         case "$xlcver" in
5952             [123456].*)
5953                 canBuildWebKit="no"
5954                 canBuildQtXmlPatterns="no"
5955                 canBuildQtConcurrent="no"
5956                 ;;
5957             *)
5958                 canBuildWebKit="no"
5959                 canBuildQtConcurrent="no"
5960                 ;;
5961         esac
5962         ;;
5963     irix-cc*)
5964         canBuildWebKit="no"
5965         canBuildQtConcurrent="no"
5966         ;;
5967 esac
5968
5969 if [ "$CFG_GUI" = "no" ]; then
5970     # WebKit requires QtGui
5971     canBuildWebKit="no"
5972 fi
5973
5974 if [ "$CFG_SHARED" = "no" ]; then
5975     echo
5976     echo "WARNING: Using static linking will disable the WebKit module."
5977     echo
5978     canBuildWebKit="no"
5979 fi
5980
5981 CFG_CONCURRENT="yes"
5982 if [ "$canBuildQtConcurrent" = "no" ]; then
5983     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT"
5984     CFG_CONCURRENT="no"
5985 else
5986     QT_CONFIG="$QT_CONFIG concurrent"
5987 fi
5988
5989 # ### Vestige
5990 if [ "$CFG_AUDIO_BACKEND" = "yes" ]; then
5991     QT_CONFIG="$QT_CONFIG audio-backend"
5992 fi
5993
5994 # ### Vestige
5995 if [ "$CFG_WEBKIT" = "debug" ]; then
5996     QMAKE_CONFIG="$QMAKE_CONFIG webkit-debug"
5997 fi
5998
5999 # ### Vestige
6000 QT_CONFIG="$QT_CONFIG v8"
6001 # Detect snapshot support
6002 if [ "$CFG_ARCH" != "$CFG_HOST_ARCH" ]; then
6003     case "$CFG_HOST_ARCH,$CFG_ARCH" in
6004         i386,arm)
6005         ;;
6006     *) canUseV8Snapshot="no"
6007         ;;
6008     esac
6009 else
6010     if [ -n "$_SBOX_DIR" -a "$CFG_ARCH" = "arm" ]; then
6011         # QEMU crashes when building inside Scratchbox with an ARM target
6012         canUseV8Snapshot="no"
6013     fi
6014 fi
6015 if [ "$CFG_V8SNAPSHOT" = "auto" ]; then
6016     CFG_V8SNAPSHOT="$canUseV8Snapshot"
6017 fi
6018 if [ "$CFG_V8SNAPSHOT" = "yes" -a "$canUseV8Snapshot" = "no" ]; then
6019     echo "Error: V8 snapshot was requested, but is not supported on this platform."
6020     exit 1
6021 fi
6022 if [ "$CFG_V8SNAPSHOT" = "yes" ]; then
6023     QT_CONFIG="$QT_CONFIG v8snapshot"
6024 fi
6025
6026 # ### Vestige
6027 if [ "$CFG_DECLARATIVE_DEBUG" = "no" ]; then
6028     QCONFIG_FLAGS="$QCONFIG_FLAGS QDECLARATIVE_NO_DEBUG_PROTOCOL"
6029 fi
6030
6031 if [ "$CFG_EXCEPTIONS" = "no" ]; then
6032     case "$COMPILER" in
6033     g++*)
6034         QMakeVar add QMAKE_CFLAGS -fno-exceptions
6035         QMakeVar add QMAKE_CXXFLAGS -fno-exceptions
6036         QMakeVar add QMAKE_LFLAGS -fno-exceptions
6037         ;;
6038     cc*)
6039         case "$PLATFORM" in
6040         irix-cc*)
6041             QMakeVar add QMAKE_CFLAGS -LANG:exceptions=off
6042             QMakeVar add QMAKE_CXXFLAGS -LANG:exceptions=off
6043             QMakeVar add QMAKE_LFLAGS -LANG:exceptions=off
6044             ;;
6045         *) ;;
6046         esac
6047         ;;
6048     *) ;;
6049     esac
6050     QMAKE_CONFIG="$QMAKE_CONFIG exceptions_off"
6051 fi
6052
6053 case "$COMPILER" in
6054 g++*)
6055     # GNU C++
6056     COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -dumpversion 2>/dev/null`
6057
6058     case "$COMPILER_VERSION" in
6059     *.*.*)
6060         QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'`
6061         QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'`
6062         QT_GCC_PATCH_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'`
6063         ;;
6064     *.*)
6065         QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\1,'`
6066         QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\2,'`
6067         QT_GCC_PATCH_VERSION=0
6068         ;;
6069     esac
6070
6071     ;;
6072 *)
6073     #
6074     ;;
6075 esac
6076
6077 #-------------------------------------------------------------------------------
6078 # part of configuration information goes into qconfig.h
6079 #-------------------------------------------------------------------------------
6080
6081 case "$CFG_QCONFIG" in
6082 full)
6083     echo "/* Everything */" >"$outpath/src/corelib/global/qconfig.h.new"
6084     ;;
6085 *)
6086     tmpconfig="$outpath/src/corelib/global/qconfig.h.new"
6087     echo "#ifndef QT_BOOTSTRAPPED" >"$tmpconfig"
6088     if [ -f "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" ]; then
6089         cat "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" >>"$tmpconfig"
6090     elif [ -f `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` ]; then
6091         cat `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` >>"$tmpconfig"
6092     fi
6093     echo "#endif" >>"$tmpconfig"
6094     ;;
6095 esac
6096
6097 cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6098
6099 /* Qt Edition */
6100 #ifndef QT_EDITION
6101 #  define QT_EDITION $QT_EDITION
6102 #endif
6103 EOF
6104
6105 echo '/* Compile time features */' >>"$outpath/src/corelib/global/qconfig.h.new"
6106 [ '!' -z "$LicenseKeyExt" ] && echo "#define QT_PRODUCT_LICENSEKEY \"$LicenseKeyExt\"" >>"$outpath/src/corelib/global/qconfig.h.new"
6107
6108 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
6109     echo "#define QT_LARGEFILE_SUPPORT 64" >>"$outpath/src/corelib/global/qconfig.h.new"
6110 fi
6111
6112 if [ "$CFG_FRAMEWORK" = "yes" ]; then
6113     echo "#define QT_MAC_FRAMEWORK_BUILD" >>"$outpath/src/corelib/global/qconfig.h.new"
6114 fi
6115
6116 if [ "$BUILD_ON_MAC" = "yes" ]; then
6117     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6118 #if defined(__LP64__)
6119 # define QT_POINTER_SIZE 8
6120 #else
6121 # define QT_POINTER_SIZE 4
6122 #endif
6123 EOF
6124 else
6125     "$unixtests/ptrsize.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
6126     echo "#define QT_POINTER_SIZE $?" >>"$outpath/src/corelib/global/qconfig.h.new"
6127 fi
6128
6129 #REDUCE_RELOCATIONS is a elf/unix only thing, so not in windows configure.exe
6130 if [ "$CFG_REDUCE_RELOCATIONS" = "yes" ]; then
6131     echo "#define QT_REDUCE_RELOCATIONS" >>"$outpath/src/corelib/global/qconfig.h.new"
6132 fi
6133
6134
6135 echo "" >>"$outpath/src/corelib/global/qconfig.h.new"
6136
6137 if [ "$CFG_DEV" = "yes" ]; then
6138     echo "#define QT_BUILD_INTERNAL" >>"$outpath/src/corelib/global/qconfig.h.new"
6139 fi
6140
6141 if [ "$PLATFORM_QPA" = "yes" ]; then
6142     # Add QPA to config.h
6143     QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QPA QT_NO_QWS_QPF QT_NO_QWS_QPF2"
6144 fi
6145
6146 if [ "${CFG_USE_FLOATMATH}" = "yes" ]; then
6147     QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_USE_MATH_H_FLOATS"
6148 fi
6149
6150 # Add turned on SQL drivers
6151 for DRIVER in $CFG_SQL_AVAILABLE; do
6152     eval "VAL=\$CFG_SQL_$DRIVER"
6153     case "$VAL" in
6154     qt)
6155         ONDRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
6156         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SQL_$ONDRIVER"
6157         SQL_DRIVERS="$SQL_DRIVERS $DRIVER"
6158     ;;
6159     plugin)
6160         SQL_PLUGINS="$SQL_PLUGINS $DRIVER"
6161     ;;
6162     esac
6163 done
6164
6165
6166 QMakeVar set sql-drivers "$SQL_DRIVERS"
6167 QMakeVar set sql-plugins "$SQL_PLUGINS"
6168
6169 # Add other configuration options to the qconfig.h file
6170 [ "$CFG_GIF" = "yes" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_BUILTIN_GIF_READER=1"
6171 [ "$CFG_PNG" != "yes" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_PNG"
6172 [ "$CFG_JPEG" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_JPEG"
6173 [ "$CFG_ZLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ZLIB"
6174 [ "$CFG_EXCEPTIONS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EXCEPTIONS"
6175 [ "$CFG_SXE" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SXE"
6176 [ "$CFG_DBUS" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS"
6177
6178 # X11/Unix/Mac only configs
6179 [ "$CFG_CUPS" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CUPS"
6180 [ "$CFG_ICONV" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ICONV"
6181 [ "$CFG_GLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GLIB"
6182 [ "$CFG_GSTREAMER" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GSTREAMER"
6183 [ "$CFG_QGTKSTYLE" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STYLE_GTK"
6184 [ "$CFG_CLOCK_MONOTONIC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CLOCK_MONOTONIC"
6185 [ "$CFG_MREMAP" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MREMAP"
6186 [ "$CFG_GETADDRINFO" = "no" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETADDRINFO"
6187 [ "$CFG_IPV6IFNAME" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IPV6IFNAME"
6188 [ "$CFG_GETIFADDRS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETIFADDRS"
6189 [ "$CFG_INOTIFY" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_INOTIFY"
6190 [ "$CFG_NAS" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NAS"
6191 [ "$CFG_NIS" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NIS"
6192 [ "$CFG_OPENSSL" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENSSL QT_NO_SSL"
6193 [ "$CFG_OPENSSL" = "linked" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LINKED_OPENSSL"
6194
6195 [ "$CFG_SM" = "no" ]         && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SESSIONMANAGER"
6196 [ "$CFG_XCURSOR" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XCURSOR"
6197 [ "$CFG_XFIXES" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XFIXES"
6198 [ "$CFG_FONTCONFIG" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FONTCONFIG"
6199 [ "$CFG_XINERAMA" = "no" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINERAMA"
6200 [ "$CFG_XKB" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XKB"
6201 [ "$CFG_XRANDR" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRANDR"
6202 [ "$CFG_XRENDER" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRENDER"
6203 [ "$CFG_MITSHM" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MITSHM"
6204 [ "$CFG_XSHAPE" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SHAPE"
6205 [ "$CFG_XVIDEO" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XVIDEO"
6206 [ "$CFG_XSYNC" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XSYNC"
6207 [ "$CFG_XINPUT" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINPUT QT_NO_TABLET"
6208
6209 [ "$CFG_XCURSOR" = "runtime" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XCURSOR"
6210 [ "$CFG_XINERAMA" = "runtime" ]  && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINERAMA"
6211 [ "$CFG_XFIXES" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XFIXES"
6212 [ "$CFG_XRANDR" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XRANDR"
6213 [ "$CFG_XINPUT" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINPUT"
6214 [ "$CFG_ALSA" = "no" ]           && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ALSA"
6215 [ "$CFG_PULSEAUDIO" = "no" ]          && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_PULSEAUDIO"
6216 [ "$CFG_COREWLAN" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_COREWLAN"
6217
6218 # sort QCONFIG_FLAGS for neatness if we can
6219 [ '!' -z "$AWK" ] && QCONFIG_FLAGS=`echo $QCONFIG_FLAGS | $AWK '{ gsub(" ", "\n"); print }' | sort | uniq`
6220 QCONFIG_FLAGS=`echo $QCONFIG_FLAGS`
6221
6222 if [ -n "$QCONFIG_FLAGS" ]; then
6223 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6224 #ifndef QT_BOOTSTRAPPED
6225
6226 EOF
6227     for cfg in $QCONFIG_FLAGS; do
6228         cfgd=`echo $cfg | sed 's/=.*$//'` # trim pushed 'Foo=Bar' defines
6229         cfg=`echo $cfg | sed 's/=/ /'`    # turn first '=' into a space
6230         # figure out define logic, so we can output the correct
6231         # ifdefs to override the global defines in a project
6232         cfgdNeg=
6233         if [ true ] && echo "$cfgd" | grep 'QT_NO_' >/dev/null 2>&1; then
6234             # QT_NO_option can be forcefully turned on by QT_option
6235             cfgdNeg=`echo $cfgd | sed "s,QT_NO_,QT_,"`
6236         elif [ true ] && echo "$cfgd" | grep 'QT_' >/dev/null 2>&1; then
6237             # QT_option can be forcefully turned off by QT_NO_option
6238             cfgdNeg=`echo $cfgd | sed "s,QT_,QT_NO_,"`
6239         fi
6240
6241         if [ -z $cfgdNeg ]; then
6242 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6243 #ifndef $cfgd
6244 # define $cfg
6245 #endif
6246
6247 EOF
6248         else
6249 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6250 #if defined($cfgd) && defined($cfgdNeg)
6251 # undef $cfgd
6252 #elif !defined($cfgd) && !defined($cfgdNeg)
6253 # define $cfg
6254 #endif
6255
6256 EOF
6257         fi
6258     done
6259 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6260 #endif // QT_BOOTSTRAPPED
6261
6262 EOF
6263 fi
6264
6265 if [ "$CFG_REDUCE_EXPORTS" = "yes" ]; then
6266 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6267 #define QT_VISIBILITY_AVAILABLE
6268
6269 EOF
6270 fi
6271
6272 if [ -n "$QT_LIBINFIX" ]; then
6273 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
6274 #define QT_LIBINFIX "$QT_LIBINFIX"
6275
6276 EOF
6277 fi
6278
6279 # avoid unecessary rebuilds by copying only if qconfig.h has changed
6280 if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then
6281     rm -f "$outpath/src/corelib/global/qconfig.h.new"
6282 else
6283     [ -f "$outpath/src/corelib/global/qconfig.h" ] && chmod +w "$outpath/src/corelib/global/qconfig.h"
6284     mv "$outpath/src/corelib/global/qconfig.h.new" "$outpath/src/corelib/global/qconfig.h"
6285     chmod -w "$outpath/src/corelib/global/qconfig.h"
6286     if [ ! -f "$outpath/include/QtCore/qconfig.h" ]; then
6287         ln -s "$outpath/src/corelib/global/qconfig.h" "$outpath/include/QtCore/qconfig.h"
6288     fi
6289 fi
6290
6291 #-------------------------------------------------------------------------------
6292 # save configuration into qconfig.pri
6293 #-------------------------------------------------------------------------------
6294 QTCONFIG="$outpath/mkspecs/qconfig.pri"
6295 QTCONFIG_CONFIG="$QTCONFIG_CONFIG no_mocdepend"
6296 [ -f "$QTCONFIG.tmp" ] && rm -f "$QTCONFIG.tmp"
6297 if [ "$CFG_DEBUG" = "yes" ]; then
6298     QTCONFIG_CONFIG="$QTCONFIG_CONFIG debug"
6299     if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
6300         QT_CONFIG="$QT_CONFIG release"
6301     fi
6302     QT_CONFIG="$QT_CONFIG debug"
6303 elif [ "$CFG_DEBUG" = "no" ]; then
6304     QTCONFIG_CONFIG="$QTCONFIG_CONFIG release"
6305     if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
6306         QT_CONFIG="$QT_CONFIG debug"
6307     fi
6308     QT_CONFIG="$QT_CONFIG release"
6309 fi
6310 if [ "$CFG_STL" = "yes" ]; then
6311     QTCONFIG_CONFIG="$QTCONFIG_CONFIG stl"
6312 fi
6313 if [ "$CFG_FRAMEWORK" = "no" ]; then
6314     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_no_framework"
6315 else
6316     QT_CONFIG="$QT_CONFIG qt_framework"
6317     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_framework"
6318 fi
6319 if [ "$CFG_DEV" = "yes" ]; then
6320     QT_CONFIG="$QT_CONFIG private_tests"
6321 fi
6322
6323 cat >>"$QTCONFIG.tmp" <<EOF
6324 #configuration
6325 CONFIG += $QTCONFIG_CONFIG
6326 QT_ARCH = $CFG_ARCH
6327 QT_HOST_ARCH = $CFG_HOST_ARCH
6328 QT_EDITION = $Edition
6329 QT_CONFIG += $QT_CONFIG
6330
6331 #versioning
6332 QT_VERSION = $QT_VERSION
6333 QT_MAJOR_VERSION = $QT_MAJOR_VERSION
6334 QT_MINOR_VERSION = $QT_MINOR_VERSION
6335 QT_PATCH_VERSION = $QT_PATCH_VERSION
6336
6337 #namespaces
6338 QT_LIBINFIX = $QT_LIBINFIX
6339 QT_NAMESPACE = $QT_NAMESPACE
6340
6341 EOF
6342 if [ -n "$CFG_SYSROOT" ]; then
6343     echo "# sysroot" >>"$QTCONFIG.tmp"
6344     echo `basename "$XQMAKESPEC"` \{ >>"$QTCONFIG.tmp"
6345     echo "    QMAKE_CFLAGS    += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
6346     echo "    QMAKE_CXXFLAGS  += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
6347     echo "    QMAKE_LFLAGS    += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
6348     echo "}" >> "$QTCONFIG.tmp"
6349     echo >> "$QTCONFIG.tmp"
6350 fi
6351 if [ -n "$RPATH_FLAGS" ]; then
6352     echo "QMAKE_RPATHDIR += $RPATH_FLAGS" >> "$QTCONFIG.tmp"
6353 fi
6354 if [ -n "$QT_GCC_MAJOR_VERSION" ]; then
6355     echo "QT_GCC_MAJOR_VERSION = $QT_GCC_MAJOR_VERSION" >> "$QTCONFIG.tmp"
6356     echo "QT_GCC_MINOR_VERSION = $QT_GCC_MINOR_VERSION" >> "$QTCONFIG.tmp"
6357     echo "QT_GCC_PATCH_VERSION = $QT_GCC_PATCH_VERSION" >> "$QTCONFIG.tmp"
6358 fi
6359
6360 if [ -n "$QMAKE_INCDIR_OPENGL_ES2" ]; then
6361     echo "#Qt opengl include path" >> "$QTCONFIG.tmp"
6362     echo "QMAKE_INCDIR_OPENGL_ES2 = \"$QMAKE_INCDIR_OPENGL_ES2\"" >> "$QTCONFIG.tmp"
6363 fi
6364
6365 # replace qconfig.pri if it differs from the newly created temp file
6366 if cmp -s "$QTCONFIG.tmp" "$QTCONFIG"; then
6367     rm -f "$QTCONFIG.tmp"
6368 else
6369     mv -f "$QTCONFIG.tmp" "$QTCONFIG"
6370 fi
6371
6372 #-------------------------------------------------------------------------------
6373 # save configuration into qmodule.pri
6374 #-------------------------------------------------------------------------------
6375 QTMODULE="$outpath/mkspecs/qmodule.pri"
6376
6377 echo "CONFIG += create_prl link_prl" >> "$QTMODULE.tmp"
6378
6379 # Ensure we can link to uninistalled libraries
6380 if [ "$BUILD_ON_MAC" != "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ] && linkerSupportsFlag -rpath-link "$outpath/lib"; then
6381     echo "QMAKE_LFLAGS    = -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib \$\$QMAKE_LFLAGS" >> "$QTMODULE.tmp"
6382 fi
6383 if [ -n "$QT_CFLAGS_PSQL" ]; then
6384     echo "QT_CFLAGS_PSQL   = $QT_CFLAGS_PSQL" >> "$QTMODULE.tmp"
6385 fi
6386 if [ -n "$QT_LFLAGS_PSQL" ]; then
6387     echo "QT_LFLAGS_PSQL   = $QT_LFLAGS_PSQL" >> "$QTMODULE.tmp"
6388 fi
6389 if [ -n "$QT_CFLAGS_MYSQL" ]; then
6390     echo "QT_CFLAGS_MYSQL   = $QT_CFLAGS_MYSQL" >> "$QTMODULE.tmp"
6391 fi
6392 if [ -n "$QT_LFLAGS_MYSQL" ]; then
6393     echo "QT_LFLAGS_MYSQL   = $QT_LFLAGS_MYSQL" >> "$QTMODULE.tmp"
6394 fi
6395 if [ -n "$QT_CFLAGS_SQLITE" ]; then
6396     echo "QT_CFLAGS_SQLITE   = $QT_CFLAGS_SQLITE" >> "$QTMODULE.tmp"
6397 fi
6398 if [ -n "$QT_LFLAGS_SQLITE" ]; then
6399     echo "QT_LFLAGS_SQLITE   = $QT_LFLAGS_SQLITE" >> "$QTMODULE.tmp"
6400 fi
6401 if [ -n "$QT_LFLAGS_ODBC" ]; then
6402     echo "QT_LFLAGS_ODBC   = $QT_LFLAGS_ODBC" >> "$QTMODULE.tmp"
6403 fi
6404 if [ -n "$QT_LFLAGS_TDS" ]; then
6405     echo "QT_LFLAGS_TDS   = $QT_LFLAGS_TDS" >> "$QTMODULE.tmp"
6406 fi
6407
6408 if [ "$QT_EDITION" != "QT_EDITION_OPENSOURCE" ]; then
6409     echo "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" >> "$QTMODULE.tmp"
6410 fi
6411
6412 #dump in the OPENSSL_LIBS info
6413 if [ '!' -z "$OPENSSL_LIBS" ]; then
6414     echo "OPENSSL_LIBS = $OPENSSL_LIBS" >> "$QTMODULE.tmp"
6415 elif [ "$CFG_OPENSSL" = "linked" ]; then
6416     echo "OPENSSL_LIBS = -lssl -lcrypto" >> "$QTMODULE.tmp"
6417 fi
6418
6419 #dump in the SDK info
6420 if [ '!' -z "$CFG_SDK" ]; then
6421    echo "QMAKE_MAC_SDK = $CFG_SDK" >> "$QTMODULE.tmp"
6422 fi
6423
6424 # cmdline args
6425 cat "$QMAKE_VARS_FILE" >> "$QTMODULE.tmp"
6426 rm -f "$QMAKE_VARS_FILE" 2>/dev/null
6427
6428 # replace qmodule.pri if it differs from the newly created temp file
6429 if cmp -s "$QTMODULE.tmp" "$QTMODULE"; then
6430     rm -f "$QTMODULE.tmp"
6431 else
6432     mv -f "$QTMODULE.tmp" "$QTMODULE"
6433 fi
6434
6435 #-------------------------------------------------------------------------------
6436 # save configuration into .qmake.cache
6437 #-------------------------------------------------------------------------------
6438
6439 CACHEFILE="$outpath/.qmake.cache"
6440 [ -f "$CACHEFILE.tmp" ] && rm -f "$CACHEFILE.tmp"
6441 cat >>"$CACHEFILE.tmp" <<EOF
6442 #paths
6443 QT_SOURCE_TREE = \$\$quote($relpath)
6444 QT_BUILD_TREE = \$\$quote($outpath)
6445 QT_BUILD_PARTS = $CFG_BUILD_PARTS
6446
6447 #local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR
6448 QMAKE_INCDIR_QT  = \$\$QT_BUILD_TREE/include
6449 QMAKE_LIBDIR_QT  = \$\$QT_BUILD_TREE/lib
6450
6451 include(\$\$PWD/mkspecs/qmodule.pri)
6452 CONFIG += $QMAKE_CONFIG dylib depend_includepath fix_output_dirs no_private_qt_headers_warning QTDIR_build
6453
6454 EOF
6455
6456 #dump the qmake spec
6457 if [ -d "$outpath/mkspecs/$XPLATFORM" ]; then
6458    echo "QMAKESPEC = \$\$QT_BUILD_TREE/mkspecs/$XPLATFORM" >> "$CACHEFILE.tmp"
6459 else
6460    echo "QMAKESPEC = $XPLATFORM" >> "$CACHEFILE.tmp"
6461 fi
6462
6463 # replace .qmake.cache if it differs from the newly created temp file
6464 if cmp -s "$CACHEFILE.tmp" "$CACHEFILE"; then
6465     rm -f "$CACHEFILE.tmp"
6466 else
6467     mv -f "$CACHEFILE.tmp" "$CACHEFILE"
6468 fi
6469
6470 #-------------------------------------------------------------------------------
6471 # give feedback on configuration
6472 #-------------------------------------------------------------------------------
6473
6474 case "$COMPILER" in
6475 g++*)
6476     if [ "$CFG_EXCEPTIONS" != "no" ]; then
6477         cat <<EOF
6478
6479         This target is using the GNU C++ compiler ($PLATFORM).
6480
6481         Recent versions of this compiler automatically include code for
6482         exceptions, which increase both the size of the Qt libraries and
6483         the amount of memory taken by your applications.
6484
6485         You may choose to re-run `basename $0` with the -no-exceptions
6486         option to compile Qt without exceptions. This is completely binary
6487         compatible, and existing applications will continue to work.
6488
6489 EOF
6490     fi
6491     ;;
6492 cc*)
6493     case "$PLATFORM" in
6494     irix-cc*)
6495         if [ "$CFG_EXCEPTIONS" != "no" ]; then
6496             cat <<EOF
6497
6498         This target is using the MIPSpro C++ compiler ($PLATFORM).
6499
6500         You may choose to re-run `basename $0` with the -no-exceptions
6501         option to compile Qt without exceptions. This will make the
6502         size of the Qt library smaller and reduce the amount of memory
6503         taken by your applications.
6504
6505 EOF
6506         fi
6507         ;;
6508     *) ;;
6509     esac
6510     ;;
6511 *) ;;
6512 esac
6513
6514 echo
6515 if [ "$XPLATFORM" = "$PLATFORM" ]; then
6516     echo "Build type:    $PLATFORM"
6517 else
6518     echo "Building on:   $PLATFORM"
6519     echo "Building for:  $XPLATFORM"
6520 fi
6521
6522 echo "Architecture:  $CFG_ARCH"
6523 if [ "$PLATFORM_QPA" = "yes" ]; then
6524     echo "Host architecture: $CFG_HOST_ARCH"
6525 fi
6526
6527 if [ -n "$PLATFORM_NOTES" ]; then
6528     echo "Platform notes:"
6529     echo "$PLATFORM_NOTES"
6530 else
6531     echo
6532 fi
6533
6534 if [ "$OPT_VERBOSE" = "yes" ]; then
6535     echo $ECHO_N "qmake vars .......... $ECHO_C"
6536     cat "$QMAKE_VARS_FILE" | tr '\n' ' '
6537     echo "qmake switches ......... $QMAKE_SWITCHES"
6538 fi
6539
6540 echo "Build .................. $CFG_BUILD_PARTS"
6541 echo "Configuration .......... $QMAKE_CONFIG $QT_CONFIG"
6542 if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
6543    echo "Debug .................. yes (combined)"
6544    if [ "$CFG_DEBUG" = "yes" ]; then
6545        echo "Default Link ........... debug"
6546    else
6547        echo "Default Link ........... release"
6548    fi
6549 else
6550    echo "Debug .................. $CFG_DEBUG"
6551 fi
6552 [ "$CFG_DBUS" = "no" ]     && echo "QtDBus module .......... no"
6553 [ "$CFG_DBUS" = "yes" ]    && echo "QtDBus module .......... yes (run-time)"
6554 [ "$CFG_DBUS" = "linked" ] && echo "QtDBus module .......... yes (linked)"
6555 echo "QtConcurrent code ...... $CFG_CONCURRENT"
6556 echo "QtGui module ........... $CFG_GUI"
6557 echo "QtWidgets module ....... $CFG_WIDGETS"
6558 if [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
6559     echo "JavaScriptCore JIT ..... To be decided by JavaScriptCore"
6560 else
6561     echo "JavaScriptCore JIT ..... $CFG_JAVASCRIPTCORE_JIT"
6562 fi
6563 echo "Declarative debugging ...$CFG_DECLARATIVE_DEBUG"
6564 echo "STL support ............ $CFG_STL"
6565 echo "PCH support ............ $CFG_PRECOMPILE"
6566 if [ "$CFG_ARCH" = "i386" -o "$CFG_ARCH" = "x86_64" ]; then
6567     echo "MMX/3DNOW/SSE/SSE2/SSE3. ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}/${CFG_SSE3}"
6568     echo "SSSE3/SSE4.1/SSE4.2..... ${CFG_SSSE3}/${CFG_SSE4_1}/${CFG_SSE4_2}"
6569     echo "AVX..................... ${CFG_AVX}"
6570 elif [ "$CFG_ARCH" = "arm" ]; then
6571     echo "iWMMXt support ......... ${CFG_IWMMXT}"
6572     echo "NEON support ........... ${CFG_NEON}"
6573 fi
6574 if [ "$CFG_ARCH" = "mips" ]; then
6575     echo "MIPS_DSP/MIPS_DSPR2..... ${CFG_MIPS_DSP}/${CFG_MIPS_DSPR2}"
6576 fi
6577 echo "IPv6 ifname support .... $CFG_IPV6IFNAME"
6578 echo "getaddrinfo support .... $CFG_GETADDRINFO"
6579 echo "getifaddrs support ..... $CFG_GETIFADDRS"
6580 echo "Accessibility .......... $CFG_ACCESSIBILITY"
6581 echo "NIS support ............ $CFG_NIS"
6582 echo "CUPS support ........... $CFG_CUPS"
6583 echo "Iconv support .......... $CFG_ICONV"
6584 echo "Glib support ........... $CFG_GLIB"
6585 echo "GStreamer support ...... $CFG_GSTREAMER"
6586 echo "PulseAudio support ..... $CFG_PULSEAUDIO"
6587 echo "Large File support ..... $CFG_LARGEFILE"
6588 echo "GIF support ............ $CFG_GIF"
6589 if [ "$CFG_JPEG" = "no" ]; then
6590     echo "JPEG support ........... $CFG_JPEG"
6591 else
6592     echo "JPEG support ........... $CFG_JPEG ($CFG_LIBJPEG)"
6593 fi
6594 if [ "$CFG_PNG" = "no" ]; then
6595     echo "PNG support ............ $CFG_PNG"
6596 else
6597     echo "PNG support ............ $CFG_PNG ($CFG_LIBPNG)"
6598 fi
6599 echo "zlib support ........... $CFG_ZLIB"
6600 echo "Session management ..... $CFG_SM"
6601 echo "libudev support ........ $CFG_LIBUDEV"
6602
6603 if [ "$CFG_OPENGL" = "desktop" ]; then
6604     echo "OpenGL support ......... yes (Desktop OpenGL)"
6605 elif [ "$CFG_OPENGL" = "es2" ]; then
6606     echo "OpenGL support ......... yes (OpenGL ES 2.x)"
6607 else
6608     echo "OpenGL support ......... no"
6609 fi
6610
6611 if [ "$CFG_OPENVG" ]; then
6612     if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
6613         echo "OpenVG support ......... ShivaVG"
6614     else
6615         echo "OpenVG support ......... $CFG_OPENVG"
6616     fi
6617 fi
6618 if [ "$PLATFORM_X11" = "yes" ]; then
6619     echo "NAS sound support ...... $CFG_NAS"
6620     echo "XShape support ......... $CFG_XSHAPE"
6621     echo "XVideo support ......... $CFG_XVIDEO"
6622     echo "XSync support .......... $CFG_XSYNC"
6623     echo "Xinerama support ....... $CFG_XINERAMA"
6624     echo "Xcursor support ........ $CFG_XCURSOR"
6625     echo "Xfixes support ......... $CFG_XFIXES"
6626     echo "Xrandr support ......... $CFG_XRANDR"
6627     echo "Xi support ............. $CFG_XINPUT"
6628     echo "MIT-SHM support ........ $CFG_MITSHM"
6629     echo "FontConfig support ..... $CFG_FONTCONFIG"
6630     echo "XKB Support ............ $CFG_XKB"
6631     echo "immodule support ....... $CFG_IM"
6632     echo "GTK theme support ...... $CFG_QGTKSTYLE"
6633 fi
6634 [ "$CFG_SQL_mysql" != "no" ] && echo "MySQL support .......... $CFG_SQL_mysql"
6635 [ "$CFG_SQL_psql" != "no" ] && echo "PostgreSQL support ..... $CFG_SQL_psql"
6636 [ "$CFG_SQL_odbc" != "no" ] && echo "ODBC support ........... $CFG_SQL_odbc"
6637 [ "$CFG_SQL_oci" != "no" ] && echo "OCI support ............ $CFG_SQL_oci"
6638 [ "$CFG_SQL_tds" != "no" ] && echo "TDS support ............ $CFG_SQL_tds"
6639 [ "$CFG_SQL_db2" != "no" ] && echo "DB2 support ............ $CFG_SQL_db2"
6640 [ "$CFG_SQL_ibase" != "no" ] && echo "InterBase support ...... $CFG_SQL_ibase"
6641 [ "$CFG_SQL_sqlite2" != "no" ] && echo "SQLite 2 support ....... $CFG_SQL_sqlite2"
6642 [ "$CFG_SQL_sqlite" != "no" ] && echo "SQLite support ......... $CFG_SQL_sqlite ($CFG_SQLITE)"
6643
6644 OPENSSL_LINKAGE=""
6645 if [ "$CFG_OPENSSL" = "yes" ]; then
6646     OPENSSL_LINKAGE="(run-time)"
6647 elif [ "$CFG_OPENSSL" = "linked" ]; then
6648     OPENSSL_LINKAGE="(linked)"
6649 fi
6650 echo "OpenSSL support ........ $CFG_OPENSSL $OPENSSL_LINKAGE"
6651 echo "Alsa support ........... $CFG_ALSA"
6652 if [ "$BUILD_ON_MAC" = "yes" ]; then
6653     echo "CoreWlan support ....... $CFG_COREWLAN"
6654 fi
6655 echo "libICU support ......... $CFG_ICU"
6656 echo "PCRE support ........... $CFG_PCRE"
6657 if [ "$CFG_XCB_LIMITED" = "yes" ] && [ "$CFG_XCB" = "yes" ]; then
6658     echo "Xcb support ............ limited (old version)"
6659 else
6660     echo "Xcb support ............ $CFG_XCB"
6661 fi
6662 echo "Xrender support ........ $CFG_XRENDER"
6663 if [ "$XPLATFORM_MAEMO" = "yes" ] && [ "$CFG_XCB" = "yes" ]; then
6664     echo "XInput2 support ........ $CFG_XINPUT2"
6665 fi
6666 echo "EGLFS support .......... $CFG_EGLFS"
6667 echo
6668
6669 # complain about not being able to use dynamic plugins if we are using a static build
6670 if [ "$CFG_SHARED" = "no" ]; then
6671     echo
6672     echo "WARNING: Using static linking will disable the use of dynamically"
6673     echo "loaded plugins. Make sure to import all needed static plugins,"
6674     echo "or compile needed modules into the library."
6675     echo
6676 fi
6677 if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then
6678     echo
6679     echo "NOTE: When linking against OpenSSL, you can override the default"
6680     echo "library names through OPENSSL_LIBS."
6681     echo "For example:"
6682     echo "    OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked"
6683     echo
6684 fi
6685 if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then
6686     echo
6687     echo "Error: debug-only framework builds are not supported. Configure with -no-framework"
6688     echo "if you want a pure debug build."
6689     echo
6690     exit 1
6691 fi
6692
6693 sepath=`echo "$relpath" | sed -e 's/\\./\\\\./g'`
6694 PROCS=1
6695 EXEC=""
6696
6697
6698 #-------------------------------------------------------------------------------
6699 # build makefiles based on the configuration
6700 #-------------------------------------------------------------------------------
6701
6702 echo "Finding project files. Please wait..."
6703 if [ "$CFG_NOPROCESS" != "yes" ]; then
6704     "$outpath/bin/qmake" -prl -r "${relpath}/qtbase.pro"
6705     if [ -f "${relpath}/qtbase.pro" ]; then
6706         mkfile="${outpath}/Makefile"
6707         [ -f "$mkfile" ] && chmod +w "$mkfile"
6708         QTDIR="$outpath" "$outpath/bin/qmake" -spec "$XQMAKESPEC" "${relpath}/qtbase.pro" -o "$mkfile"
6709     fi
6710 fi
6711
6712 # .projects      -> projects to process
6713 # .projects.1    -> qt and moc
6714 # .projects.2    -> subdirs and libs
6715 # .projects.3    -> the rest
6716 rm -f .projects .projects.1 .projects.2 .projects.3
6717
6718 QMAKE_PROJECTS=`find "$relpath/." -name '*.pro' -print | sed 's-/\./-/-'`
6719 if [ -z "$AWK" ]; then
6720     for p in `echo $QMAKE_PROJECTS`; do
6721         echo "$p" >> .projects
6722     done
6723 else
6724     cat >projects.awk <<EOF
6725 BEGIN {
6726     files = 0
6727     target_file = ""
6728     input_file = ""
6729
6730     first = "./.projects.1.tmp"
6731     second = "./.projects.2.tmp"
6732     third = "./.projects.3.tmp"
6733 }
6734
6735 FNR == 1 {
6736     if ( input_file ) {
6737         if ( ! target_file )
6738             target_file = third
6739         print input_file >target_file
6740     }
6741
6742     matched_target = 0
6743     template_lib = 0
6744     input_file = FILENAME
6745     target_file = ""
6746 }
6747
6748 /^(TARGET.*=)/ {
6749     if ( \$3 == "moc" || \$3 ~ /^Qt/ ) {
6750         target_file = first
6751         matched_target = 1
6752     } else if ( \$3 == "lrelease" || \$3 == "qm_phony_target" ) {
6753         target_file = second
6754         matched_target = 1
6755     }
6756 }
6757
6758 matched_target == 0 && /^(TEMPLATE.*=)/ {
6759     if ( \$3 == "subdirs" )
6760         target_file = second
6761     else if ( \$3 == "lib" )
6762         template_lib = 1
6763     else
6764         target_file = third
6765 }
6766
6767 matched_target == 0 && template_lib == 1 && /^(CONFIG.*=)/ {
6768     if ( \$0 ~ /plugin/ )
6769         target_file = third
6770     else
6771         target_file = second
6772 }
6773
6774 END {
6775     if ( input_file ) {
6776         if ( ! target_file )
6777             target_file = third
6778         print input_file >>target_file
6779     }
6780 }
6781
6782 EOF
6783
6784     rm -f .projects.all
6785     for p in `echo $QMAKE_PROJECTS`; do
6786        echo "$p" >> .projects.all
6787     done
6788
6789     # if you get errors about the length of the command line to awk, change the -l arg
6790     # to split below
6791     split -l 100 .projects.all .projects.all.
6792     for p in .projects.all.*; do
6793        "$AWK" -f projects.awk `cat $p`
6794        [ -f .projects.1.tmp ] && cat .projects.1.tmp >> .projects.1
6795        [ -f .projects.2.tmp ] && cat .projects.2.tmp >> .projects.2
6796        [ -f .projects.3.tmp ] && cat .projects.3.tmp >> .projects.3
6797        rm -f .projects.1.tmp .projects.2.tmp .projects.3.tmp $p
6798     done
6799     rm -f .projects.all* projects.awk
6800
6801     [ -f .projects.1 ] && cat .projects.1 >>.projects
6802     [ -f .projects.2 ] && cat .projects.2 >>.projects
6803     rm -f .projects.1 .projects.2
6804     if [ -f .projects.3 ] && [ "$OPT_FAST" = "no" ]; then
6805        cat .projects.3 >>.projects
6806        rm -f .projects.3
6807     fi
6808 fi
6809 # don't sort Qt and MOC in with the other project files
6810 # also work around a segfaulting uniq(1)
6811 if [ -f .sorted.projects.2 ]; then
6812     sort .sorted.projects.2 > .sorted.projects.2.new
6813     mv -f .sorted.projects.2.new .sorted.projects.2
6814     cat .sorted.projects.2 >> .sorted.projects.1
6815 fi
6816 [ -f .sorted.projects.1 ] && sort .sorted.projects.1 >> .sorted.projects
6817 rm -f .sorted.projects.2 .sorted.projects.1
6818
6819 NORM_PROJECTS=0
6820 FAST_PROJECTS=0
6821 if [ -f .projects ]; then
6822    uniq .projects >.tmp
6823    mv -f .tmp .projects
6824    NORM_PROJECTS=`cat .projects | wc -l | sed -e "s, ,,g"`
6825 fi
6826 if [ -f .projects.3 ]; then
6827    uniq .projects.3 >.tmp
6828    mv -f .tmp .projects.3
6829    FAST_PROJECTS=`cat .projects.3 | wc -l | sed -e "s, ,,g"`
6830 fi
6831 echo "  `expr $NORM_PROJECTS + $FAST_PROJECTS` projects found."
6832 echo
6833
6834 PART_ROOTS=
6835 for part in $CFG_BUILD_PARTS; do
6836     case "$part" in
6837     tools) PART_ROOTS="$PART_ROOTS tools" ;;
6838     libs) PART_ROOTS="$PART_ROOTS src" ;;
6839     translations) PART_ROOTS="$PART_ROOTS translations" ;;
6840     examples) PART_ROOTS="$PART_ROOTS examples" ;;
6841     *) ;;
6842     esac
6843 done
6844
6845 if [ "$CFG_DEV" = "yes" ]; then
6846     PART_ROOTS="$PART_ROOTS tests"
6847 fi
6848
6849 echo "Creating makefiles. Please wait..."
6850 for file in .projects .projects.3; do
6851     [ '!' -f "$file" ] && continue
6852     for a in `cat $file`; do
6853         IN_ROOT=no
6854         for r in $PART_ROOTS; do
6855             if echo "$a" | grep "^$r" >/dev/null 2>&1 || echo "$a" | grep "^$relpath/$r" >/dev/null 2>&1; then
6856                 IN_ROOT=yes
6857                 break
6858             fi
6859         done
6860         [ "$IN_ROOT" = "no" ] && continue
6861
6862         case $a in
6863         *winmain/winmain.pro)
6864             if [ "$CFG_NOPROCESS" = "yes" ] || [ "$XPLATFORM_MINGW" != "yes" ]; then
6865                 continue
6866             fi
6867             SPEC=$XQMAKESPEC ;;
6868         */qmake/qmake.pro) continue ;;
6869         *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*|*tools/qdoc*) SPEC=$QMAKESPEC ;;
6870         *) if [ "$CFG_NOPROCESS" = "yes" ]; then
6871               continue
6872            else
6873               SPEC=$XQMAKESPEC
6874            fi;;
6875         esac
6876         dir=`dirname "$a" | sed -e "s;$sepath;.;g"`
6877         test -d "$dir" || mkdir -p "$dir"
6878         OUTDIR="$outpath/$dir"
6879         if [ -f "${OUTDIR}/Makefile" ] && [ "$OPT_FAST" = "yes" ]; then
6880             # fast configure - the makefile exists, skip it
6881             # since the makefile exists, it was generated by qmake, which means we
6882             # can skip it, since qmake has a rule to regenerate the makefile if the .pro
6883             # file changes...
6884             [ "$OPT_VERBOSE" = "yes" ] && echo "  skipping $a"
6885             continue;
6886         fi
6887         QMAKE_SPEC_ARGS="-spec $SPEC"
6888         echo $ECHO_N "  for $a$ECHO_C"
6889
6890         QMAKE="$outpath/bin/qmake"
6891         QMAKE_ARGS="$QMAKE_SWITCHES $QMAKE_SPEC_ARGS"
6892         if [ "$file" = ".projects.3" ]; then
6893             echo " (fast)"
6894
6895             cat >"${OUTDIR}/Makefile" <<EOF
6896 # ${OUTDIR}/Makefile: generated by configure
6897 #
6898 # WARNING: This makefile will be replaced with a real makefile.
6899 # All changes made to this file will be lost.
6900 EOF
6901             [ "$CFG_DEBUG_RELEASE" = "no" ] && echo "first_target: first" >>${OUTDIR}/Makefile
6902
6903             cat >>"${OUTDIR}/Makefile" <<EOF
6904 QMAKE = "$QMAKE"
6905 all clean install qmake first Makefile: FORCE
6906         \$(QMAKE) $QMAKE_ARGS -o "$OUTDIR" "$a"
6907         cd "$OUTDIR"
6908         \$(MAKE) \$@
6909
6910 FORCE:
6911
6912 EOF
6913         else
6914             if [ "$OPT_VERBOSE" = "yes" ]; then
6915                 echo " (`basename $SPEC`)"
6916                 echo "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
6917             else
6918                 echo
6919             fi
6920
6921             [ -f "${OUTDIR}/Makefile" ] && chmod +w "${OUTDIR}/Makefile"
6922             QTDIR="$outpath" "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
6923        fi
6924     done
6925 done
6926 rm -f .projects .projects.3
6927
6928 #-------------------------------------------------------------------------------
6929 # check for platforms that we don't yet know about
6930 #-------------------------------------------------------------------------------
6931 if [ "$CFG_ARCH" = "unknown" ]; then
6932 cat <<EOF
6933
6934         NOTICE: configure was unable to determine the architecture
6935         for the $XQMAKESPEC target.
6936
6937         Qt will not use a specialized implementation for any atomic
6938         operations. Instead a generic implemention based on either GCC
6939         intrinsics or C++11 std::atomic<T> will be used (when
6940         available). The generic implementations are generally as fast
6941         as and always as safe as a specialized implementation.
6942
6943         If no generic implementation is available, Qt will use a
6944         fallback UNIX implementation which uses a single
6945         pthread_mutex_t to protect all atomic operations. This
6946         implementation is the slow (but safe) fallback implementation
6947         for architectures Qt does not yet support.
6948 EOF
6949 fi
6950
6951 #-------------------------------------------------------------------------------
6952 # check if the user passed the -no-zlib option, which is no longer supported
6953 #-------------------------------------------------------------------------------
6954 if [ -n "$ZLIB_FORCED" ]; then
6955     which_zlib="supplied"
6956     if [ "$CFG_ZLIB" = "system" ]; then
6957         which_zlib="system"
6958     fi
6959
6960 cat <<EOF
6961
6962         NOTICE: The -no-zlib option was supplied but is no longer
6963         supported.
6964
6965         Qt now requires zlib support in all builds, so the -no-zlib
6966         option was ignored. Qt will be built using the $which_zlib
6967         zlib.
6968 EOF
6969 fi
6970
6971 #-------------------------------------------------------------------------------
6972 # check if the user passed the obsoleted -wayland or -no-wayland flag
6973 #-------------------------------------------------------------------------------
6974 if [ "$CFG_OBSOLETE_WAYLAND" = "yes" ]; then
6975 cat <<EOF
6976
6977         NOTICE: The -wayland and -no-wayland flags are now obsolete
6978
6979         All configuring of QtWayland plugin and QtCompositor happens in the module
6980 EOF
6981 fi
6982
6983 #-------------------------------------------------------------------------------
6984 # check if the user passed the obsoleted -arch or -host-arch options
6985 #-------------------------------------------------------------------------------
6986 if [ "$OPT_OBSOLETE_HOST_ARG" = "yes" ]; then
6987 cat <<EOF
6988
6989         NOTICE: The -arch and -host-arch options are obsolete.
6990
6991         Qt now detects the target and host architectures based on compiler
6992         output. Qt will be built using $CFG_ARCH for the target architecture
6993         and $CFG_HOST_ARCH for the host architecture (note that these two
6994         will be the same unless you are cross-compiling).
6995 EOF
6996 fi
6997
6998 #-------------------------------------------------------------------------------
6999 # finally save the executed command to another script
7000 #-------------------------------------------------------------------------------
7001 if [ `basename $0` != "config.status" ]; then
7002     CONFIG_STATUS="$relpath/$relconf $OPT_CMDLINE"
7003
7004     # add the system variables
7005     for varname in $SYSTEM_VARIABLES; do
7006         cmd=`echo \
7007 'if [ -n "\$'${varname}'" ]; then
7008     CONFIG_STATUS="'${varname}'='"'\\\$${varname}'"' \$CONFIG_STATUS"
7009 fi'`
7010         eval "$cmd"
7011     done
7012
7013     echo "$CONFIG_STATUS" | grep '\-confirm\-license' >/dev/null 2>&1 || CONFIG_STATUS="$CONFIG_STATUS -confirm-license"
7014
7015     [ -f "$outpath/config.status" ] && rm -f "$outpath/config.status"
7016     echo "#!/bin/sh" > "$outpath/config.status"
7017     [ -n "$PKG_CONFIG_SYSROOT_DIR" ] && \
7018         echo "export PKG_CONFIG_SYSROOT_DIR=$PKG_CONFIG_SYSROOT_DIR" >> "$outpath/config.status"
7019     [ -n "$PKG_CONFIG_LIBDIR" ] && \
7020         echo "export PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR" >> "$outpath/config.status"
7021     echo "if [ \"\$#\" -gt 0 ]; then" >> "$outpath/config.status"
7022     echo "  $CONFIG_STATUS \"\$@\"" >> "$outpath/config.status"
7023     echo "else" >> "$outpath/config.status"
7024     echo "  $CONFIG_STATUS" >> "$outpath/config.status"
7025     echo "fi" >> "$outpath/config.status"
7026     chmod +x "$outpath/config.status"
7027 fi
7028
7029 if [ -n "$RPATH_MESSAGE" ]; then
7030     echo
7031     echo "$RPATH_MESSAGE"
7032 fi
7033
7034 MAKE=`basename "$MAKE"`
7035 echo
7036 echo Qt is now configured for building. Just run \'$MAKE\'.
7037 if [ "$relpath" = "$QT_INSTALL_PREFIX" ]; then
7038     echo Once everything is built, Qt is installed.
7039     echo You should not run \'$MAKE install\'.
7040 else
7041     echo Once everything is built, you must run \'$MAKE install\'.
7042     echo Qt will be installed into $QT_INSTALL_PREFIX
7043 fi
7044 echo
7045 echo To reconfigure, run \'$MAKE confclean\' and \'configure\'.
7046 echo