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