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