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