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