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