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