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