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