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