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