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