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