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