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