Remove Native Client special casing from configure.
[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 "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb "xcb" $L_FLAGS $I_FLAGS $l_FLAGS; then
5639             CFG_XCB=yes
5640             if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb-render "xcb-render" $L_FLAGS $I_FLAGS $l_FLAGS; then
5641                 QT_CONFIG="$QT_CONFIG xcb-render"
5642             fi
5643
5644             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; then
5645                 CFG_XCB_LIMITED=no
5646                 QT_CONFIG="$QT_CONFIG xcb-poll-for-queued-event"
5647             fi
5648
5649             if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb-xlib "xcb-xlib" $L_FLAGS $I_FLAGS $l_FLAGS; then
5650                 QT_CONFIG="$QT_CONFIG xcb-xlib"
5651             fi
5652
5653             if [ "$XPLATFORM_MAEMO" = "yes" ]; then
5654                 # auto-detect XInput2/Xinput support
5655                 if [ "$CFG_XINPUT2" != "no" ]; then
5656                     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
5657                     CFG_XINPUT2=yes
5658                     CFG_XINPUT=no
5659                     else
5660                         if [ "$CFG_XINPUT2" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5661                             echo "XInput2 support cannot be enabled due to functionality tests!"
5662                             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5663                             echo " If you believe this message is in error you may use the continue"
5664                             echo " switch (-continue) to $0 to continue."
5665                             exit 101
5666                         else
5667                             CFG_XINPUT2=no
5668                         fi
5669                     fi
5670                 fi
5671             fi
5672         else
5673             if [ "$CFG_XCB" = "yes" ]; then
5674                 echo "The XCB test failed!"
5675                 echo " You might need to install dependency packages."
5676                 echo " See src/plugins/platforms/xcb/README."
5677                 exit 1
5678             fi
5679             CFG_XCB=no
5680             QMakeVar add DEFINES QT_NO_XCB
5681         fi
5682     fi
5683
5684     # Detect libxkbcommon
5685     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xkbcommon 2>/dev/null; then
5686         QMAKE_CFLAGS_XKBCOMMON="`$PKG_CONFIG --cflags xkbcommon 2>/dev/null`"
5687         QMAKE_LIBS_XKBCOMMON="`$PKG_CONFIG --libs xkbcommon 2>/dev/null`"
5688         if [ "$CFG_WAYLAND" = "yes" ]; then
5689             QMAKE_CFLAGS_WAYLAND="$QMAKE_CFLAGS_WAYLAND $QMAKE_CFLAGS_XKBCOMMON"
5690             QMAKE_LIBS_WAYLAND="$QMAKE_LIBS_WAYLAND $QMAKE_LIBS_XKBCOMMON"
5691         fi
5692         QMAKE_CFLAGS_XCB="$QMAKE_CFLAGS_XCB $QMAKE_CFLAGS_XKBCOMMON"
5693         QMAKE_LIBS_XCB="$QMAKE_LIBS_XCB $QMAKE_LIBS_XKBCOMMON"
5694     else
5695         if [ "$CFG_WAYLAND" = "yes" ]; then
5696             QMAKE_DEFINES_WAYLAND=QT_NO_WAYLAND_XKB
5697         fi
5698         QMAKE_DEFINES_XCB=QT_NO_XCB_XKB
5699     fi
5700
5701     # QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero.
5702     if [ -n "$QMAKE_CFLAGS_WAYLAND" ] || [ -n "$QMAKE_LIBS_WAYLAND" ]; then
5703         QMakeVar set QMAKE_CFLAGS_WAYLAND "$QMAKE_CFLAGS_WAYLAND"
5704         QMakeVar set QMAKE_INCDIR_WAYLAND "$QMAKE_INCDIR_WAYLAND"
5705         QMakeVar set QMAKE_LIBS_WAYLAND "$QMAKE_LIBS_WAYLAND"
5706         QMakeVar set QMAKE_LIBDIR_WAYLAND "$QMAKE_LIBDIR_WAYLAND"
5707         QMakeVar set QMAKE_DEFINES_WAYLAND " $QMAKE_DEFINES_WAYLAND"
5708     fi
5709
5710     if [ -n "$QMAKE_CFLAGS_XCB" ] || [ -n "$QMAKE_LIBS_XCB" ]; then
5711         QMakeVar set QMAKE_CFLAGS_XCB "$QMAKE_CFLAGS_XCB"
5712         QMakeVar set QMAKE_LIBS_XCB "$QMAKE_LIBS_XCB"
5713         QMakeVar set QMAKE_DEFINES_XCB "$QMAKE_DEFINES_XCB"
5714     fi
5715
5716     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
5717         QT_CONFIG="$QT_CONFIG coreservices"
5718     else
5719         QMakeVar add DEFINES QT_NO_CORESERVICES
5720     fi
5721
5722     if [ "$PLATFORM_QPA" = "yes" ] && [ "$BUILD_ON_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ]; then
5723         if [ "$CFG_XCB" = "no" ] && [ "$CFG_WAYLAND" = "no" ]; then
5724             if [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_WAYLAND" = "auto" ]; then
5725                 echo "No QPA platform plugin enabled!"
5726                 echo " If you really want to build without a QPA platform plugin you must pass"
5727                 echo " -no-xcb and -no-wayland to configure. Doing this will produce a Qt that"
5728                 echo " cannot run GUI applications."
5729                 exit 1
5730             fi
5731         fi
5732     fi
5733
5734 fi
5735
5736
5737 # QWS
5738 if [ "$PLATFORM_QWS" = "yes" ]; then
5739
5740     # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
5741     if [ "$CFG_GUI" = "no" ]; then
5742         if [ "$CFG_OPENGL" = "auto" ]; then
5743             CFG_OPENGL=no
5744         fi
5745         if [ "$CFG_OPENGL" != "no" ]; then
5746             echo "OpenGL enabled, but GUI disabled."
5747             echo " You might need to either enable the GUI or disable OpenGL"
5748             exit 1
5749         fi
5750     fi
5751     if [ "$CFG_OPENGL" = "yes" ]; then
5752         CFG_EGL=auto
5753         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
5754             CFG_OPENGL=es2
5755         fi
5756     elif [ "$CFG_OPENGL" = "es2" ]; then
5757         #OpenGL ES 2.x
5758         "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS
5759         if [ $? != "0" ]; then
5760             echo "The OpenGL ES 2.0 functionality test failed!"
5761             echo " You might need to modify the include and library search paths by editing"
5762             echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5763             echo " ${XQMAKESPEC}."
5764             exit 1
5765         fi
5766         CFG_EGL=yes
5767     elif [ "$CFG_OPENGL" = "desktop" ]; then
5768         # Desktop OpenGL support
5769         echo "Desktop OpenGL support is not avaliable on Qt for Embedded Linux"
5770         exit 1
5771     fi
5772 fi
5773
5774 if [ "$PLATFORM_QWS" = "yes" ]; then
5775
5776     # screen drivers
5777     for screen in ${CFG_GFX_ON} ${CFG_GFX_PLUGIN}; do
5778        if [ "${screen}" = "ahi" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
5779            "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/ahi "Ahi" $L_FLAGS $I_FLAGS $l_FLAGS
5780            if [ $? != "0" ]; then
5781                echo "The Ahi screen driver functionality test failed!"
5782                echo " You might need to modify the include and library search paths by editing"
5783                echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
5784                echo " ${XQMAKESPEC}."
5785                exit 1
5786            fi
5787        fi
5788
5789        if [ "${screen}" = "svgalib" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
5790            "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/svgalib "SVGAlib" $L_FLAGS $I_FLAGS $l_FLAGS
5791            if [ $? != "0" ]; then
5792                echo "The SVGAlib screen driver functionality test failed!"
5793                echo " You might need to modify the include and library search paths by editing"
5794                echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
5795                echo " ${XQMAKESPEC}."
5796                exit 1
5797            fi
5798        fi
5799
5800        if [ "${screen}" = "directfb" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
5801            if test -n "$PKG_CONFIG" && "$PKG_CONFIG" --exists directfb 2>/dev/null; then
5802                QT_CFLAGS_DIRECTFB=`$PKG_CONFIG --cflags directfb 2>/dev/null`
5803                QT_LIBS_DIRECTFB=`$PKG_CONFIG --libs directfb 2>/dev/null`
5804            elif directfb-config --version >/dev/null 2>&1; then
5805                QT_CFLAGS_DIRECTFB=`directfb-config --cflags 2>/dev/null`
5806                QT_LIBS_DIRECTFB=`directfb-config --libs 2>/dev/null`
5807            fi
5808
5809            # QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero.
5810            if [ -n "$QT_CFLAGS_DIRECTFB" ] || [ -n "$QT_LIBS_DIRECTFB" ]; then
5811                QMakeVar set QT_CFLAGS_DIRECTFB "$QT_CFLAGS_DIRECTFB"
5812                QMakeVar set QT_LIBS_DIRECTFB "$QT_LIBS_DIRECTFB"
5813            fi
5814
5815            "$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
5816            if [ $? != "0" ]; then
5817                echo "The DirectFB screen driver functionality test failed!"
5818                echo " You might need to modify the include and library search paths by editing"
5819                echo " QT_CFLAGS_DIRECTFB and QT_LIBS_DIRECTFB in"
5820                echo " ${XQMAKESPEC}."
5821                exit 1
5822            fi
5823        fi
5824
5825     done
5826
5827     # mouse drivers
5828     for mouse in ${CFG_MOUSE_ON} ${CFG_MOUSE_PLUGIN}; do
5829         if [ "${mouse}" = "tslib" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
5830             "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tslib "tslib" $L_FLAGS $I_FLAGS $l_FLAGS
5831             if [ $? != "0" ]; then
5832                echo "The tslib functionality test failed!"
5833                echo " You might need to modify the include and library search paths by editing"
5834                echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
5835                echo " ${XQMAKESPEC}."
5836                 exit 1
5837             fi
5838         fi
5839     done
5840
5841     CFG_QGTKSTYLE=no
5842
5843     # sound
5844     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/sound "sound" $L_FLAGS $I_FLAGS $l_FLAGS
5845     if [ $? != "0" ]; then
5846         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SOUND"
5847     fi
5848
5849 fi # QWS
5850
5851 EGL_VARIANT=none
5852 # EGL Support
5853 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then
5854     if [ "$CFG_EGL" != "no" ]; then
5855         # detect EGL support
5856         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
5857             # EGL specified by QMAKE_*_EGL, included with <EGL/egl.h>
5858             EGL_VARIANT=regular
5859             CFG_EGL=yes
5860         fi
5861
5862         if [ "$EGL_VARIANT" = "none" ]; then
5863             if [ "$CFG_EGL" = "yes" ]; then
5864                 echo "The EGL functionality test failed!"
5865                 echo " EGL is required for OpenGL ES to manage contexts & surfaces."
5866                 echo " You might need to modify the include and library search paths by editing"
5867                 echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in"
5868                 echo " ${XQMAKESPEC}."
5869                 exit 1
5870             fi
5871             CFG_EGL=no
5872             # If QtOpenGL would be built against OpenGL ES, disable it as we can't to that if EGL is missing
5873             if [ "$CFG_OPENGL" = "es2" ]; then
5874                 CFG_OPENGL=no
5875             fi
5876         fi
5877     fi
5878 fi
5879
5880 [ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_PHONON" != "no" ] && CFG_PHONON="yes"
5881
5882 # freetype support
5883 [ "x$CFG_EMBEDDED" != "xno" ] && CFG_LIBFREETYPE="$CFG_QWS_FREETYPE"
5884 [ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_LIBFREETYPE" = "auto" ] && CFG_LIBFREETYPE=no
5885 if [ "$CFG_LIBFREETYPE" = "auto" ]; then
5886     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
5887         CFG_LIBFREETYPE=system
5888     else
5889         CFG_LIBFREETYPE=yes
5890     fi
5891 fi
5892
5893 if [ "$CFG_ENDIAN" = "auto" ]; then
5894     if [ "$XPLATFORM_MINGW" = "yes" ]; then
5895         CFG_ENDIAN="Q_LITTLE_ENDIAN"
5896     else
5897         "$unixtests/endian.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "QMAKE_LFLAGS+=$SYSROOT_FLAG"
5898         F="$?"
5899         if [ "$F" -eq 0 ]; then
5900             CFG_ENDIAN="Q_LITTLE_ENDIAN"
5901         elif [ "$F" -eq 1 ]; then
5902             CFG_ENDIAN="Q_BIG_ENDIAN"
5903         else
5904             echo
5905             echo "The target system byte order could not be detected!"
5906             echo "Turn on verbose messaging (-v) to see the final report."
5907             echo "You can use the -little-endian or -big-endian switch to"
5908             echo "$0 to continue."
5909             exit 101
5910         fi
5911     fi
5912 fi
5913
5914 if [ "$CFG_HOST_ENDIAN" = "auto" ]; then
5915     if [ "$BUILD_ON_MAC" = "yes" ]; then
5916         true #leave as auto
5917     else
5918         "$unixtests/endian.test" "$QMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
5919         F="$?"
5920         if [ "$F" -eq 0 ]; then
5921             CFG_HOST_ENDIAN="Q_LITTLE_ENDIAN"
5922         elif [ "$F" -eq 1 ]; then
5923             CFG_HOST_ENDIAN="Q_BIG_ENDIAN"
5924         else
5925             echo
5926             echo "The host system byte order could not be detected!"
5927             echo "Turn on verbose messaging (-v) to see the final report."
5928             echo "You can use the -host-little-endian or -host-big-endian switch to"
5929             echo "$0 to continue."
5930             exit 101
5931         fi
5932     fi
5933 fi
5934
5935 if [ "$CFG_ARMFPA" != "auto" ]; then
5936     if [ "$CFG_ARMFPA" = "yes" ]; then
5937         if [ "$CFG_ENDIAN" = "Q_LITTLE_ENDIAN" ]; then
5938             CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE_SWAPPED"
5939         else
5940             CFG_DOUBLEFORMAT="Q_DOUBLE_BIG_SWAPPED"
5941         fi
5942     else
5943         CFG_DOUBLEFORMAT="normal"
5944     fi
5945 fi
5946
5947
5948 if [ "$CFG_DOUBLEFORMAT" = "auto" ]; then
5949     if [ "$PLATFORM_QWS" != "yes" -o "$PLATFORM_QPA" = "yes" ]; then
5950         CFG_DOUBLEFORMAT=normal
5951     else
5952         "$unixtests/doubleformat.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
5953         F="$?"
5954         if [ "$F" -eq 10 ] && [ "$CFG_ENDIAN" = "Q_LITTLE_ENDIAN" ]; then
5955             CFG_DOUBLEFORMAT=normal
5956         elif [ "$F" -eq 11 ] && [ "$CFG_ENDIAN" = "Q_BIG_ENDIAN" ]; then
5957             CFG_DOUBLEFORMAT=normal
5958         elif [ "$F" -eq 10 ]; then
5959             CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE"
5960         elif [ "$F" -eq 11 ]; then
5961             CFG_DOUBLEFORMAT="Q_DOUBLE_BIG"
5962         elif [ "$F" -eq 12 ]; then
5963             CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE_SWAPPED"
5964             CFG_ARMFPA="yes"
5965         elif [ "$F" -eq 13 ]; then
5966             CFG_DOUBLEFORMAT="Q_DOUBLE_BIG_SWAPPED"
5967             CFG_ARMFPA="yes"
5968         else
5969             echo
5970             echo "The system floating point format could not be detected."
5971             echo "This may cause data to be generated in a wrong format"
5972             echo "Turn on verbose messaging (-v) to see the final report."
5973             # we do not fail on this since this is a new test, and if it fails,
5974             # the old behavior should be correct in most cases
5975             CFG_DOUBLEFORMAT=normal
5976         fi
5977     fi
5978 fi
5979
5980 HAVE_STL=no
5981 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stl "STL" $L_FLAGS $I_FLAGS $l_FLAGS; then
5982     HAVE_STL=yes
5983 fi
5984
5985 if [ "$CFG_STL" != "no" ]; then
5986     if [ "$HAVE_STL" = "yes" ]; then
5987         CFG_STL=yes
5988     else
5989         if [ "$CFG_STL" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5990             echo "STL support cannot be enabled due to functionality tests!"
5991             echo " Turn on verbose messaging (-v) to $0 to see the final report."
5992             echo " If you believe this message is in error you may use the continue"
5993             echo " switch (-continue) to $0 to continue."
5994             exit 101
5995         else
5996             CFG_STL=no
5997         fi
5998     fi
5999 fi
6000
6001 # detect POSIX clock_gettime()
6002 if [ "$CFG_CLOCK_GETTIME" = "auto" ]; then
6003     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
6004         CFG_CLOCK_GETTIME=yes
6005     else
6006         CFG_CLOCK_GETTIME=no
6007     fi
6008 fi
6009
6010 # detect POSIX monotonic clocks
6011 if [ "$CFG_CLOCK_GETTIME" = "yes" ] && [ "$CFG_CLOCK_MONOTONIC" = "auto" ]; then
6012     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
6013         CFG_CLOCK_MONOTONIC=yes
6014     else
6015         CFG_CLOCK_MONOTONIC=no
6016     fi
6017 elif [ "$CFG_CLOCK_GETTIME" = "no" ]; then
6018     CFG_CLOCK_MONOTONIC=no
6019 fi
6020
6021 # detect mremap
6022 if [ "$CFG_MREMAP" = "auto" ]; then
6023     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mremap "mremap" $L_FLAGS $I_FLAGS $l_FLAGS; then
6024         CFG_MREMAP=yes
6025     else
6026         CFG_MREMAP=no
6027     fi
6028 fi
6029
6030 # find if the platform provides getaddrinfo (ipv6 dns lookups)
6031 if [ "$CFG_GETADDRINFO" != "no" ]; then
6032     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getaddrinfo "getaddrinfo" $L_FLAGS $I_FLAGS $l_FLAGS; then
6033         CFG_GETADDRINFO=yes
6034     else
6035         if [ "$CFG_GETADDRINFO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6036             echo "getaddrinfo support cannot be enabled due to functionality tests!"
6037             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6038             echo " If you believe this message is in error you may use the continue"
6039             echo " switch (-continue) to $0 to continue."
6040             exit 101
6041         else
6042             CFG_GETADDRINFO=no
6043         fi
6044     fi
6045 fi
6046
6047 # find if the platform provides inotify
6048 if [ "$CFG_INOTIFY" != "no" ]; then
6049     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/inotify "inotify" $L_FLAGS $I_FLAGS $l_FLAGS; then
6050         CFG_INOTIFY=yes
6051     else
6052         if [ "$CFG_INOTIFY" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6053             echo "inotify support cannot be enabled due to functionality tests!"
6054             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6055             echo " If you believe this message is in error you may use the continue"
6056             echo " switch (-continue) to $0 to continue."
6057             exit 101
6058         else
6059             CFG_INOTIFY=no
6060         fi
6061     fi
6062 fi
6063
6064 # find if the platform provides if_nametoindex (ipv6 interface name support)
6065 if [ "$CFG_IPV6IFNAME" != "no" ]; then
6066     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
6067         CFG_IPV6IFNAME=yes
6068     else
6069         if [ "$CFG_IPV6IFNAME" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6070             echo "IPv6 interface name support cannot be enabled due to functionality tests!"
6071             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6072             echo " If you believe this message is in error you may use the continue"
6073             echo " switch (-continue) to $0 to continue."
6074             exit 101
6075         else
6076             CFG_IPV6IFNAME=no
6077         fi
6078     fi
6079 fi
6080
6081 # find if the platform provides getifaddrs (network interface enumeration)
6082 if [ "$CFG_GETIFADDRS" != "no" ]; then
6083     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getifaddrs "getifaddrs" $L_FLAGS $I_FLAGS $l_FLAGS; then
6084         CFG_GETIFADDRS=yes
6085     else
6086         if [ "$CFG_GETIFADDRS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6087             echo "getifaddrs support cannot be enabled due to functionality tests!"
6088             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6089             echo " If you believe this message is in error you may use the continue"
6090             echo " switch (-continue) to $0 to continue."
6091             exit 101
6092         else
6093             CFG_GETIFADDRS=no
6094         fi
6095     fi
6096 fi
6097
6098 # detect OpenSSL
6099 if [ "$CFG_OPENSSL" != "no" ]; then
6100     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
6101         if [ "$CFG_OPENSSL" = "auto" ]; then
6102             CFG_OPENSSL=yes
6103         fi
6104     else
6105         if ( [ "$CFG_OPENSSL" = "yes" ] || [ "$CFG_OPENSSL" = "linked" ] ) && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6106             echo "OpenSSL support cannot be enabled due to functionality tests!"
6107             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6108             echo " If you believe this message is in error you may use the continue"
6109             echo " switch (-continue) to $0 to continue."
6110             exit 101
6111         else
6112             CFG_OPENSSL=no
6113         fi
6114     fi
6115 fi
6116
6117 # detect PCRE
6118 if [ "$CFG_PCRE" != "qt" ]; then
6119     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/pcre "PCRE" $L_FLAGS $I_FLAGS $l_FLAGS; then
6120         CFG_PCRE=system
6121     else
6122         if [ "$CFG_PCRE" = "system" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6123             echo "PCRE support cannot be enabled due to functionality tests!"
6124             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6125             echo " If you believe this message is in error you may use the continue"
6126             echo " switch (-continue) to $0 to continue."
6127             exit 101
6128         else
6129             CFG_PCRE=qt
6130         fi
6131     fi
6132 fi
6133
6134 # detect OpenVG support
6135 if [ "$CFG_OPENVG" != "no" ]; then
6136     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
6137         if [ "$CFG_OPENVG" = "auto" ]; then
6138             CFG_OPENVG=yes
6139         fi
6140     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
6141         if [ "$CFG_OPENVG" = "auto" ]; then
6142             CFG_OPENVG=yes
6143         fi
6144         CFG_OPENVG_ON_OPENGL=yes
6145     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
6146         if [ "$CFG_OPENVG" = "auto" ]; then
6147             CFG_OPENVG=yes
6148         fi
6149         CFG_OPENVG_LC_INCLUDES=yes
6150     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
6151         if [ "$CFG_OPENVG" = "auto" ]; then
6152             CFG_OPENVG=yes
6153         fi
6154         CFG_OPENVG_LC_INCLUDES=yes
6155         CFG_OPENVG_ON_OPENGL=yes
6156     else
6157         if [ "$CFG_OPENVG" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
6158             echo "$CFG_OPENVG was specified for OpenVG but cannot be enabled due to functionality tests!"
6159             echo " Turn on verbose messaging (-v) to $0 to see the final report."
6160             echo " If you believe this message is in error you may use the continue"
6161             echo " switch (-continue) to $0 to continue."
6162             exit 101
6163         else
6164             CFG_OPENVG=no
6165         fi
6166     fi
6167     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
6168         CFG_OPENVG_SHIVA=yes
6169     fi
6170 fi
6171
6172 if [ "$CFG_ALSA" = "auto" ]; then
6173     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/alsa "alsa" $L_FLAGS $I_FLAGS $l_FLAGS; then
6174         CFG_ALSA=yes
6175     else
6176         CFG_ALSA=no
6177     fi
6178 fi
6179
6180 if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ] || [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then 
6181     if [ "$CFG_ARCH" = "arm" ]; then
6182        "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/javascriptcore-jit "javascriptcore-jit" $L_FLAGS $I_FLAGS $l_FLAGS
6183         if [ $? != "0" ]; then
6184            CFG_JAVASCRIPTCORE_JIT=no
6185         fi
6186     else
6187         case "$XPLATFORM" in
6188             linux-icc*)
6189                 CFG_JAVASCRIPTCORE_JIT=no
6190                 ;;
6191         esac
6192     fi
6193 fi
6194
6195 if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ]; then
6196     QMakeVar set JAVASCRIPTCORE_JIT yes
6197 elif [ "$CFG_JAVASCRIPTCORE_JIT" = "no" ]; then
6198     QMakeVar set JAVASCRIPTCORE_JIT no
6199 fi
6200
6201 if [ "$CFG_AUDIO_BACKEND" = "auto" ]; then
6202     CFG_AUDIO_BACKEND=yes
6203 fi
6204
6205 if [ "$CFG_LARGEFILE" != "yes" ] && [ "$XPLATFORM_MINGW" = "yes" ]; then
6206     echo "Warning: largefile support cannot be disabled for win32."
6207     CFG_LARGEFILE="yes"
6208 fi
6209
6210 #-------------------------------------------------------------------------------
6211 # ask for all that hasn't been auto-detected or specified in the arguments
6212 #-------------------------------------------------------------------------------
6213
6214 ### fix this: user input should be validated in a loop
6215 if [ "$PLATFORM_QWS" = "yes" ]; then
6216     PROMPT_FOR_DEPTHS="yes"
6217 else
6218     PROMPT_FOR_DEPTHS="no"
6219 fi
6220 if [ "$CFG_QWS_DEPTHS" = "prompted" -a "$PROMPT_FOR_DEPTHS" = "yes" ]; then
6221     echo
6222     echo "Choose pixel-depths to support:"
6223     echo
6224     echo "   1. 1bpp, black/white"
6225     echo "   4. 4bpp, grayscale"
6226     echo "   8. 8bpp, paletted"
6227     echo "  12. 12bpp, rgb 4-4-4"
6228     echo "  15. 15bpp, rgb 5-5-5"
6229     echo "  16. 16bpp, rgb 5-6-5"
6230     echo "  18. 18bpp, rgb 6-6-6"
6231     echo "  24. 24bpp, rgb 8-8-8"
6232     echo "  32. 32bpp, argb 8-8-8-8 and rgb 8-8-8"
6233     echo " all. All supported depths"
6234     echo
6235     echo "Your choices (default 8,16,32):"
6236     read CFG_QWS_DEPTHS
6237     if [ -z "$CFG_QWS_DEPTHS" ] || [ "$CFG_QWS_DEPTHS" = "yes" ]; then
6238         CFG_QWS_DEPTHS=8,16,32
6239     fi
6240 fi
6241 if [ -n "$CFG_QWS_DEPTHS" -a "$PLATFORM_QWS" = "yes" ]; then
6242     if [ "$CFG_QWS_DEPTHS" = "all" ]; then
6243         CFG_QWS_DEPTHS="1 4 8 12 15 16 18 24 32 generic"
6244     fi
6245     for D in `echo "$CFG_QWS_DEPTHS" | sed -e 's/,/ /g'`; do
6246         case $D in
6247             1|4|8|12|15|16|18|24|32) QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QWS_DEPTH_$D";;
6248             generic) QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QWS_DEPTH_GENERIC";;
6249         esac
6250     done
6251 fi
6252
6253 # enable dwarf2 support on Mac
6254 if [ "$CFG_MAC_DWARF2" = "yes" ]; then
6255     QT_CONFIG="$QT_CONFIG dwarf2"
6256 fi
6257
6258 # Set the default Mac OS X arch if there are no "-arch" arguments on the configure line
6259 if [ "$BUILD_ON_MAC" = "yes" ]; then
6260     DEFAULT_ARCH="$CFG_MAC_ARCHS"
6261     if [ -z "$DEFAULT_ARCH" ]; then
6262         case `file "${outpath}/bin/qmake"` in
6263         *i?86)
6264             DEFAULT_ARCH=x86
6265             ;;
6266         *x86_64)
6267             DEFAULT_ARCH=x86_64
6268             ;;
6269         *ppc|*ppc64|*)
6270             # unsupported/unknown
6271             ;;
6272         esac
6273     fi
6274     if [ -n "$DEFAULT_ARCH" ]; then
6275         [ "$OPT_VERBOSE" = "yes" ] && echo "Setting default Mac OS X architechture to $DEFAULT_ARCH."
6276         QT_CONFIG="$QT_CONFIG $DEFAULT_ARCH"
6277         QMAKE_CONFIG="$QMAKE_CONFIG $DEFAULT_ARCH"
6278         # Make the application arch follow the Qt arch for single arch builds.
6279         # (for multiple-arch builds, set CONFIG manually in the application .pro file)
6280         [ `echo "$DEFAULT_ARCH" | wc -w` -eq 1 ] && QTCONFIG_CONFIG="$QTCONFIG_CONFIG $DEFAULT_ARCH"
6281     fi
6282 fi
6283
6284 # ### Vestige
6285 if [ "$CFG_PHONON_BACKEND" = "yes" ]; then
6286     QT_CONFIG="$QT_CONFIG phonon-backend"
6287 fi
6288
6289 # disable accessibility
6290 if [ "$CFG_ACCESSIBILITY" = "no" ]; then
6291     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ACCESSIBILITY"
6292 else
6293     QT_CONFIG="$QT_CONFIG accessibility"
6294 fi
6295
6296 # egl stuff does not belong in lighthouse, but rather in plugins
6297 if [ "$PLATFORM_QPA" = "yes" ]; then
6298     CFG_EGL="no"
6299 fi
6300
6301 # enable egl
6302 if [ "$CFG_EGL" = "no" ]; then
6303     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGL"
6304 else
6305     QT_CONFIG="$QT_CONFIG egl"
6306     if [ "$CFG_EGL_GLES_INCLUDES" = "yes" ]; then
6307         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GLES_EGL"
6308     fi
6309 fi
6310
6311 # enable openvg
6312 if [ "$CFG_OPENVG" = "no" ]; then
6313     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENVG"
6314 else
6315     QT_CONFIG="$QT_CONFIG openvg"
6316     if [ "$CFG_OPENVG_LC_INCLUDES" = "yes" ]; then
6317         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LOWER_CASE_VG_INCLUDES"
6318     fi
6319     if [ "$CFG_OPENVG_ON_OPENGL" = "yes" ]; then
6320         QT_CONFIG="$QT_CONFIG openvg_on_opengl"
6321     fi
6322     if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
6323         QT_CONFIG="$QT_CONFIG shivavg"
6324         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SHIVAVG"
6325     fi
6326 fi
6327
6328 # enable opengl
6329 if [ "$CFG_OPENGL" = "no" ]; then
6330     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENGL"
6331 else
6332     QT_CONFIG="$QT_CONFIG opengl"
6333 fi
6334
6335 if [ "$CFG_OPENGL" = "es2" ]; then
6336     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES"
6337 fi
6338
6339 if [ "$CFG_OPENGL" = "es2" ]; then
6340     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_2"
6341     QT_CONFIG="$QT_CONFIG opengles2"
6342 fi
6343
6344 # safe execution environment
6345 if [ "$CFG_SXE" != "no" ]; then
6346     QT_CONFIG="$QT_CONFIG sxe"
6347 fi
6348
6349 # build up the variables for output
6350 if [ "$CFG_DEBUG" = "yes" ]; then
6351     QMAKE_OUTDIR="${QMAKE_OUTDIR}debug"
6352     QMAKE_CONFIG="$QMAKE_CONFIG debug"
6353 elif [ "$CFG_DEBUG" = "no" ]; then
6354     QMAKE_OUTDIR="${QMAKE_OUTDIR}release"
6355     QMAKE_CONFIG="$QMAKE_CONFIG release"
6356 fi
6357 if [ "$CFG_SHARED" = "yes" ]; then
6358     QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared"
6359     QMAKE_CONFIG="$QMAKE_CONFIG shared dll"
6360 elif [ "$CFG_SHARED" = "no" ]; then
6361     QMAKE_OUTDIR="${QMAKE_OUTDIR}-static"
6362     QMAKE_CONFIG="$QMAKE_CONFIG static"
6363 fi
6364 if [ "$PLATFORM_QWS" = "yes" ]; then
6365     QMAKE_OUTDIR="${QMAKE_OUTDIR}-emb-$CFG_EMBEDDED"
6366     QMAKE_CONFIG="$QMAKE_CONFIG embedded"
6367     QT_CONFIG="$QT_CONFIG embedded"
6368     rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
6369 fi
6370 if [ "$PLATFORM_QPA" = "yes" ]; then
6371     QMAKE_CONFIG="$QMAKE_CONFIG qpa"
6372     QT_CONFIG="$QT_CONFIG qpa"
6373     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qpa"
6374     rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
6375 fi
6376
6377 if [ "$XPLATFORM_MINGW" != "yes" ]; then
6378     # Do not set this here for Windows. Let qmake do it so
6379     # debug and release precompiled headers are kept separate.
6380     QMakeVar set PRECOMPILED_DIR ".pch/$QMAKE_OUTDIR"
6381 fi
6382 QMakeVar set OBJECTS_DIR ".obj/$QMAKE_OUTDIR"
6383 QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR"
6384 QMakeVar set RCC_DIR ".rcc/$QMAKE_OUTDIR"
6385 QMakeVar set UI_DIR ".uic/$QMAKE_OUTDIR"
6386 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
6387     QMAKE_CONFIG="$QMAKE_CONFIG largefile"
6388 fi
6389 if [ "$CFG_STL" = "no" ]; then
6390     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STL"
6391 else
6392     QMAKE_CONFIG="$QMAKE_CONFIG stl"
6393 fi
6394 if [ "$CFG_USE_GNUMAKE" = "yes" ]; then
6395     QMAKE_CONFIG="$QMAKE_CONFIG GNUmake"
6396 fi
6397 [ "$CFG_REDUCE_EXPORTS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_exports"
6398 [ "$CFG_REDUCE_RELOCATIONS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_relocations"
6399 [ "$CFG_PRECOMPILE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG precompile_header"
6400 if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
6401     QMakeVar add QMAKE_CFLAGS -g
6402     QMakeVar add QMAKE_CXXFLAGS -g
6403     QT_CONFIG="$QT_CONFIG separate_debug_info"
6404 fi
6405 if [ "$CFG_SEPARATE_DEBUG_INFO_NOCOPY" = "yes" ] ; then
6406     QT_CONFIG="$QT_CONFIG separate_debug_info_nocopy"
6407 fi
6408 [ "$CFG_MMX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mmx"
6409 [ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow"
6410 [ "$CFG_SSE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse"
6411 [ "$CFG_SSE2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse2"
6412 [ "$CFG_SSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse3"
6413 [ "$CFG_SSSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG ssse3"
6414 [ "$CFG_SSE4_1" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_1"
6415 [ "$CFG_SSE4_2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_2"
6416 [ "$CFG_AVX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG avx"
6417 [ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt"
6418 [ "$CFG_NEON" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG neon"
6419 if [ "$CFG_CLOCK_GETTIME" = "yes" ]; then
6420     QT_CONFIG="$QT_CONFIG clock-gettime"
6421 fi
6422 if [ "$CFG_CLOCK_MONOTONIC" = "yes" ]; then
6423     QT_CONFIG="$QT_CONFIG clock-monotonic"
6424 fi
6425 if [ "$CFG_MREMAP" = "yes" ]; then
6426     QT_CONFIG="$QT_CONFIG mremap"
6427 fi
6428 if [ "$CFG_GETADDRINFO" = "yes" ]; then
6429     QT_CONFIG="$QT_CONFIG getaddrinfo"
6430 fi
6431 if [ "$CFG_IPV6IFNAME" = "yes" ]; then
6432     QT_CONFIG="$QT_CONFIG ipv6ifname"
6433 fi
6434 if [ "$CFG_GETIFADDRS" = "yes" ]; then
6435     QT_CONFIG="$QT_CONFIG getifaddrs"
6436 fi
6437 if [ "$CFG_INOTIFY" = "yes" ]; then
6438     QT_CONFIG="$QT_CONFIG inotify"
6439 fi
6440 if [ "$CFG_LIBJPEG" = "no" ]; then
6441     CFG_JPEG="no"
6442 elif [ "$CFG_LIBJPEG" = "system" ]; then
6443     QT_CONFIG="$QT_CONFIG system-jpeg"
6444 fi
6445 if [ "$CFG_JPEG" = "no" ]; then
6446     QT_CONFIG="$QT_CONFIG no-jpeg"
6447 elif [ "$CFG_JPEG" = "yes" ]; then
6448     QT_CONFIG="$QT_CONFIG jpeg"
6449 fi
6450 if [ "$CFG_LIBPNG" = "no" ]; then
6451     CFG_PNG="no"
6452 fi
6453 if [ "$CFG_LIBPNG" = "system" ]; then
6454     QT_CONFIG="$QT_CONFIG system-png"
6455 fi
6456 if [ "$CFG_PNG" = "no" ]; then
6457     QT_CONFIG="$QT_CONFIG no-png"
6458 elif [ "$CFG_PNG" = "yes" ]; then
6459     QT_CONFIG="$QT_CONFIG png"
6460 fi
6461 if [ "$CFG_GIF" = "no" ]; then
6462     QT_CONFIG="$QT_CONFIG no-gif"
6463 elif [ "$CFG_GIF" = "yes" ]; then
6464     QT_CONFIG="$QT_CONFIG gif"
6465 fi
6466 if [ "$CFG_LIBFREETYPE" = "no" ]; then
6467     QT_CONFIG="$QT_CONFIG no-freetype"
6468     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FREETYPE"
6469 elif [ "$CFG_LIBFREETYPE" = "system" ]; then
6470     QT_CONFIG="$QT_CONFIG system-freetype"
6471 else
6472     QT_CONFIG="$QT_CONFIG freetype"
6473 fi
6474 if [ "$CFG_GUI" = "auto" ]; then
6475     CFG_GUI="yes"
6476 fi
6477 if [ "$CFG_GUI" = "no" ]; then
6478     QT_CONFIG="$QT_CONFIG no-gui"
6479 else
6480     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GUI"
6481 fi
6482
6483
6484 if [ "x$BUILD_ON_MAC" = "xyes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
6485     #On Mac we implicitly link against libz, so we
6486     #never use the 3rdparty stuff.
6487     [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system"
6488 fi
6489 if [ "$CFG_ZLIB" = "yes" ]; then
6490     QT_CONFIG="$QT_CONFIG zlib"
6491 elif [ "$CFG_ZLIB" = "system" ]; then
6492     QT_CONFIG="$QT_CONFIG system-zlib"
6493 fi
6494
6495 [ "$CFG_NIS" = "yes" ] && QT_CONFIG="$QT_CONFIG nis"
6496 [ "$CFG_CUPS" = "yes" ] && QT_CONFIG="$QT_CONFIG cups"
6497 [ "$CFG_ICONV" = "yes" ] && QT_CONFIG="$QT_CONFIG iconv"
6498 [ "$CFG_ICONV" = "sun" ] && QT_CONFIG="$QT_CONFIG sun-libiconv"
6499 [ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv"
6500 [ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib"
6501 [ "$CFG_GSTREAMER" = "yes" ] && QT_CONFIG="$QT_CONFIG gstreamer"
6502 [ "$CFG_DBUS" = "yes" ] && QT_CONFIG="$QT_CONFIG dbus"
6503 [ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus dbus-linked"
6504 [ "$CFG_NAS" = "system" ] && QT_CONFIG="$QT_CONFIG nas"
6505 [ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl"
6506 [ "$CFG_OPENSSL" = "linked" ] && QT_CONFIG="$QT_CONFIG openssl-linked"
6507 [ "$CFG_MAC_HARFBUZZ" = "yes" ] && QT_CONFIG="$QT_CONFIG harfbuzz"
6508 [ "$CFG_XCB" = "yes" ] && QT_CONFIG="$QT_CONFIG xcb"
6509 [ "$CFG_XINPUT2" = "yes" ] && QT_CONFIG="$QT_CONFIG xinput2"
6510
6511 if [ "$PLATFORM_X11" = "yes" ]; then
6512     [ "$CFG_SM" = "yes" ] && QT_CONFIG="$QT_CONFIG x11sm"
6513
6514     # for some reason, the following libraries are not always built shared,
6515     # so *every* program/lib (including Qt) has to link against them
6516     if [ "$CFG_XSHAPE" = "yes" ]; then
6517         QT_CONFIG="$QT_CONFIG xshape"
6518     fi
6519     if [ "$CFG_XVIDEO" = "yes" ]; then
6520         QT_CONFIG="$QT_CONFIG xvideo"
6521     fi
6522     if [ "$CFG_XSYNC" = "yes" ]; then
6523         QT_CONFIG="$QT_CONFIG xsync"
6524     fi
6525     if [ "$CFG_XINERAMA" = "yes" ]; then
6526         QT_CONFIG="$QT_CONFIG xinerama"
6527         QMakeVar set QMAKE_LIBS_X11 '-lXinerama $$QMAKE_LIBS_X11'
6528     fi
6529     if [ "$CFG_XCURSOR" = "yes" ]; then
6530         QT_CONFIG="$QT_CONFIG xcursor"
6531         QMakeVar set QMAKE_LIBS_X11 '-lXcursor $$QMAKE_LIBS_X11'
6532     fi
6533     if [ "$CFG_XFIXES" = "yes" ]; then
6534         QT_CONFIG="$QT_CONFIG xfixes"
6535         QMakeVar set QMAKE_LIBS_X11 '-lXfixes $$QMAKE_LIBS_X11'
6536     fi
6537     if [ "$CFG_XRANDR" = "yes" ]; then
6538         QT_CONFIG="$QT_CONFIG xrandr"
6539         if [ "$CFG_XRENDER" != "yes" ]; then
6540             # libXrandr uses 1 function from libXrender, so we always have to have it :/
6541             QMakeVar set QMAKE_LIBS_X11 '-lXrandr -lXrender $$QMAKE_LIBS_X11'
6542         else
6543             QMakeVar set QMAKE_LIBS_X11 '-lXrandr $$QMAKE_LIBS_X11'
6544         fi
6545     fi
6546     if [ "$CFG_XRENDER" = "yes" ]; then
6547         QT_CONFIG="$QT_CONFIG xrender"
6548         QMakeVar set QMAKE_LIBS_X11 '-lXrender $$QMAKE_LIBS_X11'
6549     fi
6550     if [ "$CFG_MITSHM" = "yes" ]; then
6551         QT_CONFIG="$QT_CONFIG mitshm"
6552     fi
6553     if [ "$CFG_FONTCONFIG" = "yes" ]; then
6554         QT_CONFIG="$QT_CONFIG fontconfig"
6555     fi
6556     if [ "$CFG_XINPUT" = "yes" ]; then
6557         QMakeVar set QMAKE_LIBS_X11 '-lXi $$QMAKE_LIBS_X11'
6558     fi
6559     if [ "$CFG_XINPUT" = "yes" ]; then
6560         QT_CONFIG="$QT_CONFIG xinput tablet"
6561     fi
6562     if [ "$CFG_XKB" = "yes" ]; then
6563         QT_CONFIG="$QT_CONFIG xkb"
6564     fi
6565 fi
6566
6567 [ '!' -z "$D_FLAGS" ] && QMakeVar add DEFINES "$D_FLAGS"
6568 [ '!' -z "$L_FLAGS" ] && QMakeVar add QMAKE_LIBDIR_FLAGS "$L_FLAGS"
6569 [ '!' -z "$l_FLAGS" ] && QMakeVar add LIBS "$l_FLAGS"
6570
6571 if [ "$PLATFORM_MAC" = "yes" ]; then
6572     if [ "$CFG_RPATH" = "yes" ]; then
6573        QMAKE_CONFIG="$QMAKE_CONFIG absolute_library_soname"
6574     fi
6575 elif [ -z "`getQMakeConf \"$XQMAKESPEC\" | $AWK '/QMAKE_(LFLAGS_)?RPATH/ {print $3;}'`" ]; then
6576     if [ -n "$RPATH_FLAGS" ]; then
6577         echo
6578         echo "ERROR: -R cannot be used on this platform as \$QMAKE_LFLAGS_RPATH is"
6579         echo "       undefined."
6580         echo
6581         exit 1
6582     elif [ "$CFG_RPATH" = "yes" ]; then
6583         RPATH_MESSAGE="        NOTE: This platform does not support runtime library paths, using -no-rpath."
6584         CFG_RPATH=no
6585     fi
6586 else
6587     if [ "$CFG_RPATH" = "yes" ]; then
6588         # set the default rpath to the library installation directory
6589         RPATH_FLAGS="\"$QT_INSTALL_LIBS\" $RPATH_FLAGS"
6590     fi
6591     if [ -n "$RPATH_FLAGS" ]; then
6592         # add the user defined rpaths
6593         QMakeVar add QMAKE_RPATHDIR "$RPATH_FLAGS"
6594     fi
6595 fi
6596
6597 if [ '!' -z "$I_FLAGS" ]; then
6598     # add the user define include paths
6599     QMakeVar add QMAKE_CFLAGS "$I_FLAGS"
6600     QMakeVar add QMAKE_CXXFLAGS "$I_FLAGS"
6601 fi
6602
6603 if [ '!' -z "$W_FLAGS" ]; then
6604     # add the user defined warning flags
6605     QMakeVar add QMAKE_CFLAGS_WARN_ON "$W_FLAGS"
6606     QMakeVar add QMAKE_CXXFLAGS_WARN_ON "$W_FLAGS"
6607     QMakeVar add QMAKE_OBJECTIVE_CFLAGS_WARN_ON "$W_FLAGS"
6608 fi
6609
6610 # turn off exceptions for the compilers that support it
6611 if [ "$PLATFORM_QWS" = "yes" ]; then
6612     COMPILER=`echo $XPLATFORM | cut -f 3- -d-`
6613 elif [ "$XPLATFORM" != "$PLATFORM" ]; then
6614     COMPILER=`echo $XPLATFORM | cut -f 2- -d-`
6615 else
6616     COMPILER=`echo $PLATFORM | cut -f 2- -d-`
6617 fi
6618 if [ "$CFG_EXCEPTIONS" = "unspecified" -a "$PLATFORM_QWS" = "yes" ]; then
6619     CFG_EXCEPTIONS=no
6620 fi
6621
6622 if [ "$CFG_EXCEPTIONS" != "no" ]; then
6623     QTCONFIG_CONFIG="$QTCONFIG_CONFIG exceptions"
6624 fi
6625
6626 if [ "$XPLATFORM_MINGW" = "yes" ]; then
6627     # mkspecs/features/win32/default_pre.prf sets "no-rtti".
6628     # Follow default behavior of configure.exe by overriding with "rtti".
6629     QTCONFIG_CONFIG="$QTCONFIG_CONFIG rtti"
6630 fi
6631
6632 if [ "$CFG_ALSA" = "yes" ]; then
6633     QT_CONFIG="$QT_CONFIG alsa"
6634 fi
6635
6636 if [ "$CFG_PULSEAUDIO" = "yes" ]; then
6637     QT_CONFIG="$QT_CONFIG pulseaudio"
6638 fi
6639
6640 if [ "$CFG_COREWLAN" = "yes" ]; then
6641     QT_CONFIG="$QT_CONFIG corewlan"
6642 fi
6643
6644 if [ "$CFG_ICU" = "yes" ]; then
6645     QT_CONFIG="$QT_CONFIG icu"
6646 fi
6647
6648 if [ "$CFG_FORCE_ASSERTS" = "yes" ]; then
6649     QT_CONFIG="$QT_CONFIG force_asserts"
6650 fi
6651
6652 if [ "$CFG_PCRE" = "qt" ]; then
6653     QMAKE_CONFIG="$QMAKE_CONFIG pcre"
6654 fi
6655
6656 #
6657 # Some Qt modules are too advanced in C++ for some old compilers
6658 # Detect here the platforms where they are known to work.
6659 #
6660 # See Qt documentation for more information on which features are
6661 # supported and on which compilers.
6662 #
6663 canBuildQtConcurrent="yes"
6664 canUseV8Snapshot="yes"
6665
6666 case "$XPLATFORM" in
6667     hpux-g++*)
6668         # PA-RISC's assembly is too limited
6669         # gcc 3.4 on that platform can't build QtXmlPatterns
6670         # the assembly it generates cannot be compiled
6671
6672         # Check gcc's version
6673         case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
6674             4*)
6675                 ;;
6676             3.4*)
6677                 canBuildQtXmlPatterns="no"
6678                 ;;
6679             *)
6680                 canBuildWebKit="no"
6681                 canBuildQtXmlPatterns="no"
6682                 ;;
6683         esac
6684         ;;
6685     unsupported/vxworks-*-g++*)
6686         canBuildWebKit="no"
6687         ;;
6688     unsupported/vxworks-*-dcc*)
6689         canBuildWebKit="no"
6690         canBuildQtXmlPatterns="no"
6691         ;;
6692     *-g++*)
6693         # Check gcc's version
6694         case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
6695             4*|3.4*)
6696                 ;;
6697             3.3*)
6698                 canBuildWebKit="no"
6699                 ;;
6700             *)
6701                 canBuildWebKit="no"
6702                 canBuildQtXmlPatterns="no"
6703                 ;;
6704         esac
6705         ;;
6706     solaris-cc*)
6707         # Check the compiler version
6708         case `${QMAKE_CONF_COMPILER} -V 2>&1 | awk '{print $4}'` in
6709             5.[012345678])
6710                 canBuildWebKit="no"
6711                 canBuildQtXmlPatterns="no"
6712                 canBuildQtConcurrent="no"
6713                 ;;
6714             5.*)
6715                 canBuildWebKit="no"
6716                 canBuildQtConcurrent="no"
6717                 ;;
6718         esac
6719         ;;
6720     hpux-acc*)
6721         canBuildWebKit="no"
6722         canBuildQtXmlPatterns="no"
6723         canBuildQtConcurrent="no"
6724         ;;
6725     hpuxi-acc*)
6726         canBuildWebKit="no"
6727         ;;
6728     aix-xlc*)
6729         # Get the xlC version
6730         cat > xlcver.c <<EOF
6731 #include <stdio.h>
6732 int main()
6733 {
6734     printf("%d.%d\n", __xlC__ >> 8, __xlC__ & 0xFF);
6735     return 0;
6736 }
6737 EOF
6738         xlcver=
6739         if ${QMAKE_CONF_COMPILER} -o xlcver xlcver.c >/dev/null 2>/dev/null; then
6740             xlcver=`./xlcver 2>/dev/null`
6741             rm -f ./xlcver
6742         fi
6743         if [ "$OPT_VERBOSE" = "yes" ]; then
6744             if [ -n "$xlcver" ]; then
6745                 echo Found IBM xlC version: $xlcver.
6746             else
6747                 echo Could not determine IBM xlC version, assuming oldest supported.
6748             fi
6749         fi
6750
6751         case "$xlcver" in
6752             [123456].*)
6753                 canBuildWebKit="no"
6754                 canBuildQtXmlPatterns="no"
6755                 canBuildQtConcurrent="no"
6756                 ;;
6757             *)
6758                 canBuildWebKit="no"
6759                 canBuildQtConcurrent="no"
6760                 ;;
6761         esac
6762         ;;
6763     irix-cc*)
6764         canBuildWebKit="no"
6765         canBuildQtConcurrent="no"
6766         ;;
6767 esac
6768
6769 if [ "$CFG_GUI" = "no" ]; then
6770     # WebKit requires QtGui
6771     canBuildWebKit="no"
6772 fi
6773
6774 if [ "$CFG_SHARED" = "no" ]; then
6775     echo
6776     echo "WARNING: Using static linking will disable the WebKit module."
6777     echo
6778     canBuildWebKit="no"
6779 fi
6780
6781 CFG_CONCURRENT="yes"
6782 if [ "$canBuildQtConcurrent" = "no" ]; then
6783     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT"
6784     CFG_CONCURRENT="no"
6785 else
6786     QT_CONFIG="$QT_CONFIG concurrent"
6787 fi
6788
6789 # ### Vestige
6790 if [ "$CFG_AUDIO_BACKEND" = "yes" ]; then
6791     QT_CONFIG="$QT_CONFIG audio-backend"
6792 fi
6793
6794 # ### Vestige
6795 if [ "$CFG_WEBKIT" = "debug" ]; then
6796     QMAKE_CONFIG="$QMAKE_CONFIG webkit-debug"
6797 fi
6798
6799 # ### Vestige
6800 QT_CONFIG="$QT_CONFIG v8"
6801 # Detect snapshot support
6802 if [ "$CFG_ARCH" != "$CFG_HOST_ARCH" ]; then
6803     case "$CFG_HOST_ARCH,$CFG_ARCH" in
6804         i386,arm)
6805         ;;
6806     *) canUseV8Snapshot="no"
6807         ;;
6808     esac
6809 else
6810     if [ -n "$_SBOX_DIR" -a "$CFG_ARCH" = "arm" ]; then
6811         # QEMU crashes when building inside Scratchbox with an ARM target
6812         canUseV8Snapshot="no"
6813     fi
6814 fi
6815 if [ "$CFG_V8SNAPSHOT" = "auto" ]; then
6816     CFG_V8SNAPSHOT="$canUseV8Snapshot"
6817 fi
6818 if [ "$CFG_V8SNAPSHOT" = "yes" -a "$canUseV8Snapshot" = "no" ]; then
6819     echo "Error: V8 snapshot was requested, but is not supported on this platform."
6820     exit 1
6821 fi
6822 if [ "$CFG_V8SNAPSHOT" = "yes" ]; then
6823     QT_CONFIG="$QT_CONFIG v8snapshot"
6824 fi
6825
6826 # ### Vestige
6827 if [ "$CFG_DECLARATIVE_DEBUG" = "no" ]; then
6828     QCONFIG_FLAGS="$QCONFIG_FLAGS QDECLARATIVE_NO_DEBUG_PROTOCOL"
6829 fi
6830
6831 if [ "$CFG_EXCEPTIONS" = "no" ]; then
6832     case "$COMPILER" in
6833     g++*)
6834         QMakeVar add QMAKE_CFLAGS -fno-exceptions
6835         QMakeVar add QMAKE_CXXFLAGS -fno-exceptions
6836         QMakeVar add QMAKE_LFLAGS -fno-exceptions
6837         ;;
6838     cc*)
6839         case "$PLATFORM" in
6840         irix-cc*)
6841             QMakeVar add QMAKE_CFLAGS -LANG:exceptions=off
6842             QMakeVar add QMAKE_CXXFLAGS -LANG:exceptions=off
6843             QMakeVar add QMAKE_LFLAGS -LANG:exceptions=off
6844             ;;
6845         *) ;;
6846         esac
6847         ;;
6848     *) ;;
6849     esac
6850     QMAKE_CONFIG="$QMAKE_CONFIG exceptions_off"
6851 fi
6852
6853 case "$COMPILER" in
6854 g++*)
6855     # GNU C++
6856     COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -dumpversion 2>/dev/null`
6857
6858     case "$COMPILER_VERSION" in
6859     *.*.*)
6860         QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'`
6861         QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'`
6862         QT_GCC_PATCH_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'`
6863         ;;
6864     *.*)
6865         QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\1,'`
6866         QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\2,'`
6867         QT_GCC_PATCH_VERSION=0
6868         ;;
6869     esac
6870
6871     ;;
6872 *)
6873     #
6874     ;;
6875 esac
6876
6877 #-------------------------------------------------------------------------------
6878 # part of configuration information goes into qconfig.h
6879 #-------------------------------------------------------------------------------
6880
6881 case "$CFG_QCONFIG" in
6882 full)
6883     echo "/* Everything */" >"$outpath/src/corelib/global/qconfig.h.new"
6884     ;;
6885 *)
6886     tmpconfig="$outpath/src/corelib/global/qconfig.h.new"
6887     echo "#ifndef QT_BOOTSTRAPPED" >"$tmpconfig"
6888     if [ -f "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" ]; then
6889         cat "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" >>"$tmpconfig"
6890     elif [ -f `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` ]; then
6891         cat `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` >>"$tmpconfig"
6892     fi
6893     echo "#endif" >>"$tmpconfig"
6894     ;;
6895 esac
6896
6897 cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6898
6899 /* Qt Edition */
6900 #ifndef QT_EDITION
6901 #  define QT_EDITION $QT_EDITION
6902 #endif
6903
6904 /* Machine byte-order */
6905 #define Q_BIG_ENDIAN 4321
6906 #define Q_LITTLE_ENDIAN 1234
6907 EOF
6908
6909 echo "#ifdef QT_BOOTSTRAPPED" >>"$outpath/src/corelib/global/qconfig.h.new"
6910 if [ "$CFG_HOST_ENDIAN" = "auto" ]; then
6911     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6912 #if defined(__BIG_ENDIAN__)
6913 # define Q_BYTE_ORDER Q_BIG_ENDIAN
6914 #elif defined(__LITTLE_ENDIAN__)
6915 # define Q_BYTE_ORDER Q_LITTLE_ENDIAN
6916 #else
6917 # error "Unable to determine byte order!"
6918 #endif
6919 EOF
6920 else
6921     echo "#define Q_BYTE_ORDER $CFG_HOST_ENDIAN" >>"$outpath/src/corelib/global/qconfig.h.new"
6922 fi
6923 echo "#else" >>"$outpath/src/corelib/global/qconfig.h.new"
6924 if [ "$CFG_ENDIAN" = "auto" ]; then
6925     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6926 #if defined(__BIG_ENDIAN__)
6927 # define Q_BYTE_ORDER Q_BIG_ENDIAN
6928 #elif defined(__LITTLE_ENDIAN__)
6929 # define Q_BYTE_ORDER Q_LITTLE_ENDIAN
6930 #else
6931 # error "Unable to determine byte order!"
6932 #endif
6933 EOF
6934 else
6935     echo "#define Q_BYTE_ORDER $CFG_ENDIAN" >>"$outpath/src/corelib/global/qconfig.h.new"
6936 fi
6937 echo "#endif" >>"$outpath/src/corelib/global/qconfig.h.new"
6938
6939 if [ "$CFG_DOUBLEFORMAT" != "normal" ]; then
6940     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6941 /* Non-IEEE double format */
6942 #define Q_DOUBLE_LITTLE "01234567"
6943 #define Q_DOUBLE_BIG "76543210"
6944 #define Q_DOUBLE_LITTLE_SWAPPED "45670123"
6945 #define Q_DOUBLE_BIG_SWAPPED "32107654"
6946 #define Q_DOUBLE_FORMAT $CFG_DOUBLEFORMAT
6947 EOF
6948 fi
6949 if [ "$CFG_ARMFPA" = "yes" ]; then
6950     if [ "$CFG_ARCH" != "$CFG_HOST_ARCH" ]; then
6951         cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6952 #ifndef QT_BOOTSTRAPPED
6953 # define QT_ARMFPA
6954 #endif
6955 EOF
6956     else
6957         echo "#define QT_ARMFPA" >>"$outpath/src/corelib/global/qconfig.h.new"
6958     fi
6959 fi
6960
6961 CFG_ARCH_STR=`echo $CFG_ARCH | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
6962 CFG_HOST_ARCH_STR=`echo $CFG_HOST_ARCH | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
6963 cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6964 /* Machine Architecture */
6965 #ifndef QT_BOOTSTRAPPED
6966 # define QT_ARCH_${CFG_ARCH_STR}
6967 #else
6968 # define QT_ARCH_${CFG_HOST_ARCH_STR}
6969 #endif
6970 EOF
6971
6972 echo '/* Compile time features */' >>"$outpath/src/corelib/global/qconfig.h.new"
6973 [ '!' -z "$LicenseKeyExt" ] && echo "#define QT_PRODUCT_LICENSEKEY \"$LicenseKeyExt\"" >>"$outpath/src/corelib/global/qconfig.h.new"
6974
6975 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
6976     echo "#define QT_LARGEFILE_SUPPORT 64" >>"$outpath/src/corelib/global/qconfig.h.new"
6977 fi
6978
6979 if [ "$CFG_FRAMEWORK" = "yes" ]; then
6980     echo "#define QT_MAC_FRAMEWORK_BUILD" >>"$outpath/src/corelib/global/qconfig.h.new"
6981 fi
6982
6983 if [ "$BUILD_ON_MAC" = "yes" ]; then
6984     cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6985 #if defined(__LP64__)
6986 # define QT_POINTER_SIZE 8
6987 #else
6988 # define QT_POINTER_SIZE 4
6989 #endif
6990 EOF
6991 else
6992     "$unixtests/ptrsize.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
6993     echo "#define QT_POINTER_SIZE $?" >>"$outpath/src/corelib/global/qconfig.h.new"
6994 fi
6995
6996 #REDUCE_RELOCATIONS is a elf/unix only thing, so not in windows configure.exe
6997 if [ "$CFG_REDUCE_RELOCATIONS" = "yes" ]; then
6998     echo "#define QT_REDUCE_RELOCATIONS" >>"$outpath/src/corelib/global/qconfig.h.new"
6999 fi
7000
7001
7002 echo "" >>"$outpath/src/corelib/global/qconfig.h.new"
7003
7004 if [ "$CFG_DEV" = "yes" ]; then
7005     echo "#define QT_BUILD_INTERNAL" >>"$outpath/src/corelib/global/qconfig.h.new"
7006 fi
7007
7008 # Embedded compile time options
7009 if [ "$PLATFORM_QWS" = "yes" ]; then
7010     # Add QWS to config.h
7011     QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QWS"
7012
7013     # Add excluded decorations to $QCONFIG_FLAGS
7014     decors=`grep '^decorations -= ' "$QMAKE_VARS_FILE" | ${AWK} '{print $3}'`
7015     for decor in $decors; do
7016         NODECORATION=`echo $decor | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7017         QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_NO_QWS_DECORATION_${NODECORATION}"
7018     done
7019
7020     # Figure which embedded drivers which are turned off
7021     CFG_GFX_OFF="$CFG_GFX_AVAILABLE"
7022     for ADRIVER in $CFG_GFX_ON; do
7023         CFG_GFX_OFF=`echo "${CFG_GFX_OFF} " | sed "s,${ADRIVER} ,,g"`
7024     done
7025
7026     CFG_KBD_OFF="$CFG_KBD_AVAILABLE"
7027     # the um driver is currently not in the available list for external builds
7028     if [ "$CFG_DEV" = "no" ]; then
7029         CFG_KBD_OFF="$CFG_KBD_OFF um"
7030     fi
7031     for ADRIVER in $CFG_KBD_ON; do
7032         CFG_KBD_OFF=`echo "${CFG_KBD_OFF} " | sed "s,${ADRIVER} ,,g"`
7033     done
7034
7035     CFG_MOUSE_OFF="$CFG_MOUSE_AVAILABLE"
7036     for ADRIVER in $CFG_MOUSE_ON; do
7037         CFG_MOUSE_OFF=`echo "${CFG_MOUSE_OFF} " | sed "s,${ADRIVER} ,,g"`
7038     done
7039
7040     for DRIVER in $CFG_GFX_OFF; do
7041         NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7042         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_$NODRIVER"
7043     done
7044
7045     for DRIVER in $CFG_KBD_OFF; do
7046         NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7047         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_KBD_$NODRIVER"
7048     done
7049
7050     for DRIVER in $CFG_MOUSE_OFF; do
7051         NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7052         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_MOUSE_$NODRIVER"
7053     done
7054 fi # QWS
7055
7056 if [ "$PLATFORM_QPA" = "yes" ]; then
7057     # Add QPA to config.h
7058     QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QPA QT_NO_QWS_QPF QT_NO_QWS_QPF2"
7059 fi
7060
7061 if [ "${CFG_USE_FLOATMATH}" = "yes" ]; then
7062     QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_USE_MATH_H_FLOATS"
7063 fi
7064
7065 # Add turned on SQL drivers
7066 for DRIVER in $CFG_SQL_AVAILABLE; do
7067     eval "VAL=\$CFG_SQL_$DRIVER"
7068     case "$VAL" in
7069     qt)
7070         ONDRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7071         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SQL_$ONDRIVER"
7072         SQL_DRIVERS="$SQL_DRIVERS $DRIVER"
7073     ;;
7074     plugin)
7075         SQL_PLUGINS="$SQL_PLUGINS $DRIVER"
7076     ;;
7077     esac
7078 done
7079
7080
7081 QMakeVar set sql-drivers "$SQL_DRIVERS"
7082 QMakeVar set sql-plugins "$SQL_PLUGINS"
7083
7084 # Add other configuration options to the qconfig.h file
7085 [ "$CFG_GIF" = "yes" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_BUILTIN_GIF_READER=1"
7086 [ "$CFG_PNG" != "yes" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_PNG"
7087 [ "$CFG_JPEG" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_JPEG"
7088 [ "$CFG_ZLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ZLIB"
7089 [ "$CFG_EXCEPTIONS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EXCEPTIONS"
7090 [ "$CFG_SXE" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SXE"
7091 [ "$CFG_DBUS" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS"
7092
7093 # X11/Unix/Mac only configs
7094 [ "$CFG_CUPS" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CUPS"
7095 [ "$CFG_ICONV" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ICONV"
7096 [ "$CFG_GLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GLIB"
7097 [ "$CFG_GSTREAMER" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GSTREAMER"
7098 [ "$CFG_QGTKSTYLE" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STYLE_GTK"
7099 [ "$CFG_CLOCK_MONOTONIC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CLOCK_MONOTONIC"
7100 [ "$CFG_MREMAP" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MREMAP"
7101 [ "$CFG_GETADDRINFO" = "no" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETADDRINFO"
7102 [ "$CFG_IPV6IFNAME" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IPV6IFNAME"
7103 [ "$CFG_GETIFADDRS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETIFADDRS"
7104 [ "$CFG_INOTIFY" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_INOTIFY"
7105 [ "$CFG_NAS" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NAS"
7106 [ "$CFG_NIS" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NIS"
7107 [ "$CFG_OPENSSL" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENSSL QT_NO_SSL"
7108 [ "$CFG_OPENSSL" = "linked" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LINKED_OPENSSL"
7109
7110 [ "$CFG_SM" = "no" ]         && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SESSIONMANAGER"
7111 [ "$CFG_XCURSOR" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XCURSOR"
7112 [ "$CFG_XFIXES" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XFIXES"
7113 [ "$CFG_FONTCONFIG" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FONTCONFIG"
7114 [ "$CFG_XINERAMA" = "no" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINERAMA"
7115 [ "$CFG_XKB" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XKB"
7116 [ "$CFG_XRANDR" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRANDR"
7117 [ "$CFG_XRENDER" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRENDER"
7118 [ "$CFG_MITSHM" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MITSHM"
7119 [ "$CFG_XSHAPE" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SHAPE"
7120 [ "$CFG_XVIDEO" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XVIDEO"
7121 [ "$CFG_XSYNC" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XSYNC"
7122 [ "$CFG_XINPUT" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINPUT QT_NO_TABLET"
7123
7124 [ "$CFG_XCURSOR" = "runtime" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XCURSOR"
7125 [ "$CFG_XINERAMA" = "runtime" ]  && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINERAMA"
7126 [ "$CFG_XFIXES" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XFIXES"
7127 [ "$CFG_XRANDR" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XRANDR"
7128 [ "$CFG_XINPUT" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINPUT"
7129 [ "$CFG_ALSA" = "no" ]           && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ALSA"
7130 [ "$CFG_PULSEAUDIO" = "no" ]          && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_PULSEAUDIO"
7131 [ "$CFG_COREWLAN" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_COREWLAN"
7132
7133 # sort QCONFIG_FLAGS for neatness if we can
7134 [ '!' -z "$AWK" ] && QCONFIG_FLAGS=`echo $QCONFIG_FLAGS | $AWK '{ gsub(" ", "\n"); print }' | sort | uniq`
7135 QCONFIG_FLAGS=`echo $QCONFIG_FLAGS`
7136
7137 if [ -n "$QCONFIG_FLAGS" ]; then
7138 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
7139 #ifndef QT_BOOTSTRAPPED
7140
7141 EOF
7142     for cfg in $QCONFIG_FLAGS; do
7143         cfgd=`echo $cfg | sed 's/=.*$//'` # trim pushed 'Foo=Bar' defines
7144         cfg=`echo $cfg | sed 's/=/ /'`    # turn first '=' into a space
7145         # figure out define logic, so we can output the correct
7146         # ifdefs to override the global defines in a project
7147         cfgdNeg=
7148         if [ true ] && echo "$cfgd" | grep 'QT_NO_' >/dev/null 2>&1; then
7149             # QT_NO_option can be forcefully turned on by QT_option
7150             cfgdNeg=`echo $cfgd | sed "s,QT_NO_,QT_,"`
7151         elif [ true ] && echo "$cfgd" | grep 'QT_' >/dev/null 2>&1; then
7152             # QT_option can be forcefully turned off by QT_NO_option
7153             cfgdNeg=`echo $cfgd | sed "s,QT_,QT_NO_,"`
7154         fi
7155
7156         if [ -z $cfgdNeg ]; then
7157 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
7158 #ifndef $cfgd
7159 # define $cfg
7160 #endif
7161
7162 EOF
7163         else
7164 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
7165 #if defined($cfgd) && defined($cfgdNeg)
7166 # undef $cfgd
7167 #elif !defined($cfgd) && !defined($cfgdNeg)
7168 # define $cfg
7169 #endif
7170
7171 EOF
7172         fi
7173     done
7174 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
7175 #endif // QT_BOOTSTRAPPED
7176
7177 EOF
7178 fi
7179
7180 if [ "$CFG_REDUCE_EXPORTS" = "yes" ]; then
7181 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
7182 #define QT_VISIBILITY_AVAILABLE
7183
7184 EOF
7185 fi
7186
7187 if [ -n "$QT_LIBINFIX" ]; then
7188 cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
7189 #define QT_LIBINFIX "$QT_LIBINFIX"
7190
7191 EOF
7192 fi
7193
7194 # avoid unecessary rebuilds by copying only if qconfig.h has changed
7195 if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then
7196     rm -f "$outpath/src/corelib/global/qconfig.h.new"
7197 else
7198     [ -f "$outpath/src/corelib/global/qconfig.h" ] && chmod +w "$outpath/src/corelib/global/qconfig.h"
7199     mv "$outpath/src/corelib/global/qconfig.h.new" "$outpath/src/corelib/global/qconfig.h"
7200     chmod -w "$outpath/src/corelib/global/qconfig.h"
7201     for conf in "$outpath/include/QtCore/qconfig.h" "$outpath/include/Qt/qconfig.h"; do
7202         ln -s "$outpath/src/corelib/global/qconfig.h" "$conf"
7203     done
7204 fi
7205
7206 #-------------------------------------------------------------------------------
7207 # save configuration into qconfig.pri
7208 #-------------------------------------------------------------------------------
7209 QTCONFIG="$outpath/mkspecs/qconfig.pri"
7210 QTCONFIG_CONFIG="$QTCONFIG_CONFIG no_mocdepend"
7211 [ -f "$QTCONFIG.tmp" ] && rm -f "$QTCONFIG.tmp"
7212 if [ "$CFG_DEBUG" = "yes" ]; then
7213     QTCONFIG_CONFIG="$QTCONFIG_CONFIG debug"
7214     if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
7215         QT_CONFIG="$QT_CONFIG release"
7216     fi
7217     QT_CONFIG="$QT_CONFIG debug"
7218 elif [ "$CFG_DEBUG" = "no" ]; then
7219     QTCONFIG_CONFIG="$QTCONFIG_CONFIG release"
7220     if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
7221         QT_CONFIG="$QT_CONFIG debug"
7222     fi
7223     QT_CONFIG="$QT_CONFIG release"
7224 fi
7225 if [ "$CFG_STL" = "yes" ]; then
7226     QTCONFIG_CONFIG="$QTCONFIG_CONFIG stl"
7227 fi
7228 if [ "$CFG_FRAMEWORK" = "no" ]; then
7229     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_no_framework"
7230 else
7231     QT_CONFIG="$QT_CONFIG qt_framework"
7232     QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_framework"
7233 fi
7234 if [ "$CFG_DEV" = "yes" ]; then
7235     QT_CONFIG="$QT_CONFIG private_tests"
7236 fi
7237
7238 cat >>"$QTCONFIG.tmp" <<EOF
7239 #configuration
7240 CONFIG += $QTCONFIG_CONFIG
7241 QT_ARCH = $CFG_ARCH
7242 QT_EDITION = $Edition
7243 QT_CONFIG += $QT_CONFIG
7244
7245 #versioning
7246 QT_VERSION = $QT_VERSION
7247 QT_MAJOR_VERSION = $QT_MAJOR_VERSION
7248 QT_MINOR_VERSION = $QT_MINOR_VERSION
7249 QT_PATCH_VERSION = $QT_PATCH_VERSION
7250
7251 #namespaces
7252 QT_LIBINFIX = $QT_LIBINFIX
7253 QT_NAMESPACE = $QT_NAMESPACE
7254
7255 EOF
7256 if [ -n "$CFG_SYSROOT" ]; then
7257     echo "# sysroot" >>"$QTCONFIG.tmp"
7258     echo `basename "$XQMAKESPEC"` \{ >>"$QTCONFIG.tmp"
7259     echo "  QT_SYSROOT      += \$\$quote($CFG_SYSROOT)" >>"$QTCONFIG.tmp"
7260     echo "  QMAKE_CFLAGS    += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp"
7261     echo "  QMAKE_CXXFLAGS  += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp"
7262     echo "  QMAKE_LFLAGS    += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp"
7263     echo "}" >> "$QTCONFIG.tmp"
7264     echo >> "$QTCONFIG.tmp"
7265 fi
7266 if [ "$CFG_RPATH" = "yes" ]; then
7267     echo "QMAKE_RPATHDIR += \"$QT_INSTALL_LIBS\"" >> "$QTCONFIG.tmp"
7268 fi
7269 if [ -n "$QT_GCC_MAJOR_VERSION" ]; then
7270     echo "QT_GCC_MAJOR_VERSION = $QT_GCC_MAJOR_VERSION" >> "$QTCONFIG.tmp"
7271     echo "QT_GCC_MINOR_VERSION = $QT_GCC_MINOR_VERSION" >> "$QTCONFIG.tmp"
7272     echo "QT_GCC_PATCH_VERSION = $QT_GCC_PATCH_VERSION" >> "$QTCONFIG.tmp"
7273 fi
7274
7275 if [ -n "$QMAKE_INCDIR_OPENGL_ES2" ]; then
7276     echo "#Qt opengl include path" >> "$QTCONFIG.tmp"
7277     echo "QMAKE_INCDIR_OPENGL_ES2 = \"$QMAKE_INCDIR_OPENGL_ES2\"" >> "$QTCONFIG.tmp"
7278 fi
7279
7280 # replace qconfig.pri if it differs from the newly created temp file
7281 if cmp -s "$QTCONFIG.tmp" "$QTCONFIG"; then
7282     rm -f "$QTCONFIG.tmp"
7283 else
7284     mv -f "$QTCONFIG.tmp" "$QTCONFIG"
7285 fi
7286
7287 #-------------------------------------------------------------------------------
7288 # save configuration into qmodule.pri
7289 #-------------------------------------------------------------------------------
7290 QTMODULE="$outpath/mkspecs/qmodule.pri"
7291
7292 echo "CONFIG += create_prl link_prl" >> "$QTMODULE.tmp"
7293
7294 # Ensure we can link to uninistalled libraries
7295 if [ "$BUILD_ON_MAC" != "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ] && linkerSupportsFlag -rpath-link "$outpath/lib"; then
7296     echo "QMAKE_LFLAGS    = -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib \$\$QMAKE_LFLAGS" >> "$QTMODULE.tmp"
7297 fi
7298 if [ -n "$QT_CFLAGS_PSQL" ]; then
7299     echo "QT_CFLAGS_PSQL   = $QT_CFLAGS_PSQL" >> "$QTMODULE.tmp"
7300 fi
7301 if [ -n "$QT_LFLAGS_PSQL" ]; then
7302     echo "QT_LFLAGS_PSQL   = $QT_LFLAGS_PSQL" >> "$QTMODULE.tmp"
7303 fi
7304 if [ -n "$QT_CFLAGS_MYSQL" ]; then
7305     echo "QT_CFLAGS_MYSQL   = $QT_CFLAGS_MYSQL" >> "$QTMODULE.tmp"
7306 fi
7307 if [ -n "$QT_LFLAGS_MYSQL" ]; then
7308     echo "QT_LFLAGS_MYSQL   = $QT_LFLAGS_MYSQL" >> "$QTMODULE.tmp"
7309 fi
7310 if [ -n "$QT_CFLAGS_SQLITE" ]; then
7311     echo "QT_CFLAGS_SQLITE   = $QT_CFLAGS_SQLITE" >> "$QTMODULE.tmp"
7312 fi
7313 if [ -n "$QT_LFLAGS_SQLITE" ]; then
7314     echo "QT_LFLAGS_SQLITE   = $QT_LFLAGS_SQLITE" >> "$QTMODULE.tmp"
7315 fi
7316 if [ -n "$QT_LFLAGS_ODBC" ]; then
7317     echo "QT_LFLAGS_ODBC   = $QT_LFLAGS_ODBC" >> "$QTMODULE.tmp"
7318 fi
7319 if [ -n "$QT_LFLAGS_TDS" ]; then
7320     echo "QT_LFLAGS_TDS   = $QT_LFLAGS_TDS" >> "$QTMODULE.tmp"
7321 fi
7322
7323 if [ "$QT_EDITION" != "QT_EDITION_OPENSOURCE" ]; then
7324     echo "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" >> "$QTMODULE.tmp"
7325 fi
7326
7327 #dump in the OPENSSL_LIBS info
7328 if [ '!' -z "$OPENSSL_LIBS" ]; then
7329     echo "OPENSSL_LIBS = $OPENSSL_LIBS" >> "$QTMODULE.tmp"
7330 elif [ "$CFG_OPENSSL" = "linked" ]; then
7331     echo "OPENSSL_LIBS = -lssl -lcrypto" >> "$QTMODULE.tmp"
7332 fi
7333
7334 #dump in the SDK info
7335 if [ '!' -z "$CFG_SDK" ]; then
7336    echo "QMAKE_MAC_SDK = $CFG_SDK" >> "$QTMODULE.tmp"
7337 fi
7338
7339 # cmdline args
7340 cat "$QMAKE_VARS_FILE" >> "$QTMODULE.tmp"
7341 rm -f "$QMAKE_VARS_FILE" 2>/dev/null
7342
7343 # replace qmodule.pri if it differs from the newly created temp file
7344 if cmp -s "$QTMODULE.tmp" "$QTMODULE"; then
7345     rm -f "$QTMODULE.tmp"
7346 else
7347     mv -f "$QTMODULE.tmp" "$QTMODULE"
7348 fi
7349
7350 #-------------------------------------------------------------------------------
7351 # save configuration into .qmake.cache
7352 #-------------------------------------------------------------------------------
7353
7354 CACHEFILE="$outpath/.qmake.cache"
7355 [ -f "$CACHEFILE.tmp" ] && rm -f "$CACHEFILE.tmp"
7356 cat >>"$CACHEFILE.tmp" <<EOF
7357 #paths
7358 QT_SOURCE_TREE = \$\$quote($relpath)
7359 QT_BUILD_TREE = \$\$quote($outpath)
7360 QT_BUILD_PARTS = $CFG_BUILD_PARTS
7361
7362 #local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR
7363 QMAKE_MOC        = \$\$QT_BUILD_TREE/bin/moc
7364 QMAKE_UIC        = \$\$QT_BUILD_TREE/bin/uic
7365 QMAKE_RCC        = \$\$QT_BUILD_TREE/bin/rcc
7366 QMAKE_INCDIR_QT  = \$\$QT_BUILD_TREE/include
7367 QMAKE_LIBDIR_QT  = \$\$QT_BUILD_TREE/lib
7368
7369 include(\$\$PWD/mkspecs/qmodule.pri)
7370 CONFIG += $QMAKE_CONFIG dylib depend_includepath fix_output_dirs no_private_qt_headers_warning QTDIR_build
7371 QMAKE_ABSOLUTE_SOURCE_ROOT = \$\$QT_SOURCE_TREE
7372 QMAKE_MOC_SRC    = \$\$QT_BUILD_TREE/src/moc
7373
7374 EOF
7375
7376 #dump the qmake spec
7377 if [ -d "$outpath/mkspecs/$XPLATFORM" ]; then
7378    echo "QMAKESPEC = \$\$QT_BUILD_TREE/mkspecs/$XPLATFORM" >> "$CACHEFILE.tmp"
7379 else
7380    echo "QMAKESPEC = $XPLATFORM" >> "$CACHEFILE.tmp"
7381 fi
7382
7383 # incrementals
7384 INCREMENTAL=""
7385 [ "$CFG_INCREMENTAL" = "auto" ] && "$WHICH" p4 >/dev/null 2>&1 && [ "$CFG_DEV" = "yes" ] && CFG_INCREMENTAL="yes"
7386 if [ "$CFG_INCREMENTAL" = "yes" ]; then
7387     find "$relpath" -perm u+w -mtime -3 | grep 'cpp$' | while read f; do
7388         # don't need to worry about generated files
7389         [ -r `echo $f | sed "s,cpp$,ui,"` ] && continue
7390         basename "$f" | grep '^moc_' >/dev/null 2>&1 && continue
7391         # done
7392         INCREMENTAL="$INCREMENTAL `basename \"$f\" | sed 's,.cpp,.o,'`"
7393     done
7394     [ '!' -z "$INCREMENTAL" ] && echo "QMAKE_INCREMENTAL += $INCREMENTAL" >> "$CACHEFILE.tmp"
7395     [ -r "$outpath/.qmake.incremental" ] && echo "include($outpath/.qmake.incremental)" >> "$CACHEFILE.tmp"
7396 fi
7397
7398 # replace .qmake.cache if it differs from the newly created temp file
7399 if cmp -s "$CACHEFILE.tmp" "$CACHEFILE"; then
7400     rm -f "$CACHEFILE.tmp"
7401 else
7402     mv -f "$CACHEFILE.tmp" "$CACHEFILE"
7403 fi
7404
7405 #-------------------------------------------------------------------------------
7406 # give feedback on configuration
7407 #-------------------------------------------------------------------------------
7408
7409 case "$COMPILER" in
7410 g++*)
7411     if [ "$CFG_EXCEPTIONS" != "no" ]; then
7412         cat <<EOF
7413
7414         This target is using the GNU C++ compiler ($PLATFORM).
7415
7416         Recent versions of this compiler automatically include code for
7417         exceptions, which increase both the size of the Qt libraries and
7418         the amount of memory taken by your applications.
7419
7420         You may choose to re-run `basename $0` with the -no-exceptions
7421         option to compile Qt without exceptions. This is completely binary
7422         compatible, and existing applications will continue to work.
7423
7424 EOF
7425     fi
7426     ;;
7427 cc*)
7428     case "$PLATFORM" in
7429     irix-cc*)
7430         if [ "$CFG_EXCEPTIONS" != "no" ]; then
7431             cat <<EOF
7432
7433         This target is using the MIPSpro C++ compiler ($PLATFORM).
7434
7435         You may choose to re-run `basename $0` with the -no-exceptions
7436         option to compile Qt without exceptions. This will make the
7437         size of the Qt library smaller and reduce the amount of memory
7438         taken by your applications.
7439
7440 EOF
7441         fi
7442         ;;
7443     *) ;;
7444     esac
7445     ;;
7446 *) ;;
7447 esac
7448
7449 echo
7450 if [ "$XPLATFORM" = "$PLATFORM" ]; then
7451     echo "Build type:    $PLATFORM"
7452 else
7453     echo "Building on:   $PLATFORM"
7454     echo "Building for:  $XPLATFORM"
7455 fi
7456
7457 if [ ! -z "$CFG_MAC_ARCHS" ]; then
7458     echo "Architecture:  $CFG_ARCH ($CFG_MAC_ARCHS )"
7459 else
7460     echo "Architecture:  $CFG_ARCH"
7461 fi
7462
7463 if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
7464     echo "Host architecture: $CFG_HOST_ARCH"
7465 fi
7466
7467 if [ -n "$PLATFORM_NOTES" ]; then
7468     echo "Platform notes:"
7469     echo "$PLATFORM_NOTES"
7470 else
7471     echo
7472 fi
7473
7474 if [ "$OPT_VERBOSE" = "yes" ]; then
7475     echo $ECHO_N "qmake vars .......... $ECHO_C"
7476     cat "$QMAKE_VARS_FILE" | tr '\n' ' '
7477     echo "qmake switches ......... $QMAKE_SWITCHES"
7478 fi
7479
7480 [ "$CFG_INCREMENTAL" = "yes" ] && [ '!' -z "$INCREMENTAL" ] && echo "Incremental ............ $INCREMENTAL"
7481 echo "Build .................. $CFG_BUILD_PARTS"
7482 echo "Configuration .......... $QMAKE_CONFIG $QT_CONFIG"
7483 if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
7484    echo "Debug .................. yes (combined)"
7485    if [ "$CFG_DEBUG" = "yes" ]; then
7486        echo "Default Link ........... debug"
7487    else
7488        echo "Default Link ........... release"
7489    fi
7490 else
7491    echo "Debug .................. $CFG_DEBUG"
7492 fi
7493 [ "$CFG_DBUS" = "no" ]     && echo "QtDBus module .......... no"
7494 [ "$CFG_DBUS" = "yes" ]    && echo "QtDBus module .......... yes (run-time)"
7495 [ "$CFG_DBUS" = "linked" ] && echo "QtDBus module .......... yes (linked)"
7496 echo "QtConcurrent code ...... $CFG_CONCURRENT"
7497 echo "QtGui module ........... $CFG_GUI"
7498 if [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
7499     echo "JavaScriptCore JIT ..... To be decided by JavaScriptCore"
7500 else
7501     echo "JavaScriptCore JIT ..... $CFG_JAVASCRIPTCORE_JIT"
7502 fi
7503 echo "Declarative debugging ...$CFG_DECLARATIVE_DEBUG"
7504 echo "STL support ............ $CFG_STL"
7505 echo "PCH support ............ $CFG_PRECOMPILE"
7506 echo "MMX/3DNOW/SSE/SSE2/SSE3. ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}/${CFG_SSE3}"
7507 echo "SSSE3/SSE4.1/SSE4.2..... ${CFG_SSSE3}/${CFG_SSE4_1}/${CFG_SSE4_2}"
7508 echo "AVX..................... ${CFG_AVX}"
7509 if [ "$CFG_ARCH" = "arm" ] || [ "$CFG_ARCH" = "armv6" ]; then
7510     echo "iWMMXt support ......... ${CFG_IWMMXT}"
7511     echo "NEON support ........... ${CFG_NEON}"
7512 fi
7513 echo "IPv6 ifname support .... $CFG_IPV6IFNAME"
7514 echo "getaddrinfo support .... $CFG_GETADDRINFO"
7515 echo "getifaddrs support ..... $CFG_GETIFADDRS"
7516 echo "Accessibility .......... $CFG_ACCESSIBILITY"
7517 echo "NIS support ............ $CFG_NIS"
7518 echo "CUPS support ........... $CFG_CUPS"
7519 echo "Iconv support .......... $CFG_ICONV"
7520 echo "Glib support ........... $CFG_GLIB"
7521 echo "GStreamer support ...... $CFG_GSTREAMER"
7522 echo "PulseAudio support ..... $CFG_PULSEAUDIO"
7523 echo "Large File support ..... $CFG_LARGEFILE"
7524 echo "GIF support ............ $CFG_GIF"
7525 if [ "$CFG_JPEG" = "no" ]; then
7526     echo "JPEG support ........... $CFG_JPEG"
7527 else
7528     echo "JPEG support ........... $CFG_JPEG ($CFG_LIBJPEG)"
7529 fi
7530 if [ "$CFG_PNG" = "no" ]; then
7531     echo "PNG support ............ $CFG_PNG"
7532 else
7533     echo "PNG support ............ $CFG_PNG ($CFG_LIBPNG)"
7534 fi
7535 echo "zlib support ........... $CFG_ZLIB"
7536 echo "Session management ..... $CFG_SM"
7537 if [ "$PLATFORM_QWS" = "yes" ]; then
7538     echo "Embedded support ....... $CFG_EMBEDDED"
7539     if [ "$CFG_QWS_FREETYPE" = "auto" ]; then
7540         echo "Freetype2 support ...... $CFG_QWS_FREETYPE ($CFG_LIBFREETYPE)"
7541     else
7542         echo "Freetype2 support ...... $CFG_QWS_FREETYPE"
7543     fi
7544     # Normalize the decoration output first
7545     CFG_GFX_ON=`echo ${CFG_GFX_ON}`
7546     CFG_GFX_PLUGIN=`echo ${CFG_GFX_PLUGIN}`
7547     echo "Graphics (qt) .......... ${CFG_GFX_ON}"
7548     echo "Graphics (plugin) ...... ${CFG_GFX_PLUGIN}"
7549     CFG_DECORATION_ON=`echo ${CFG_DECORATION_ON}`
7550     CFG_DECORATION_PLUGIN=`echo ${CFG_DECORATION_PLUGIN}`
7551     echo "Decorations (qt) ....... $CFG_DECORATION_ON"
7552     echo "Decorations (plugin) ... $CFG_DECORATION_PLUGIN"
7553     CFG_KBD_ON=`echo ${CFG_KBD_ON}`
7554     CFG_KBD_PLUGIN=`echo ${CFG_KBD_PLUGIN}`
7555     echo "Keyboard driver (qt) ... ${CFG_KBD_ON}"
7556     echo "Keyboard driver (plugin) .. ${CFG_KBD_PLUGIN}"
7557     CFG_MOUSE_ON=`echo ${CFG_MOUSE_ON}`
7558     CFG_MOUSE_PLUGIN=`echo ${CFG_MOUSE_PLUGIN}`
7559     echo "Mouse driver (qt) ...... $CFG_MOUSE_ON"
7560     echo "Mouse driver (plugin) .. $CFG_MOUSE_PLUGIN"
7561 fi
7562 if [ "$CFG_OPENGL" = "desktop" ]; then
7563     echo "OpenGL support ......... yes (Desktop OpenGL)"
7564 elif [ "$CFG_OPENGL" = "es2" ]; then
7565     echo "OpenGL support ......... yes (OpenGL ES 2.x)"
7566 else
7567     echo "OpenGL support ......... no"
7568 fi
7569 if [ "$CFG_EGL" != "no" ]; then
7570     if [ "$CFG_EGL_GLES_INCLUDES" = "yes" ]; then
7571         echo "EGL support ............ yes <GLES/egl.h>"
7572     else
7573         echo "EGL support ............ yes <EGL/egl.h>"
7574     fi
7575 fi
7576 if [ "$CFG_OPENVG" ]; then
7577     if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
7578         echo "OpenVG support ......... ShivaVG"
7579     else
7580         echo "OpenVG support ......... $CFG_OPENVG"
7581     fi
7582 fi
7583 if [ "$PLATFORM_X11" = "yes" ]; then
7584     echo "NAS sound support ...... $CFG_NAS"
7585     echo "XShape support ......... $CFG_XSHAPE"
7586     echo "XVideo support ......... $CFG_XVIDEO"
7587     echo "XSync support .......... $CFG_XSYNC"
7588     echo "Xinerama support ....... $CFG_XINERAMA"
7589     echo "Xcursor support ........ $CFG_XCURSOR"
7590     echo "Xfixes support ......... $CFG_XFIXES"
7591     echo "Xrandr support ......... $CFG_XRANDR"
7592     echo "Xi support ............. $CFG_XINPUT"
7593     echo "MIT-SHM support ........ $CFG_MITSHM"
7594     echo "FontConfig support ..... $CFG_FONTCONFIG"
7595     echo "XKB Support ............ $CFG_XKB"
7596     echo "immodule support ....... $CFG_IM"
7597     echo "GTK theme support ...... $CFG_QGTKSTYLE"
7598 fi
7599 [ "$CFG_SQL_mysql" != "no" ] && echo "MySQL support .......... $CFG_SQL_mysql"
7600 [ "$CFG_SQL_psql" != "no" ] && echo "PostgreSQL support ..... $CFG_SQL_psql"
7601 [ "$CFG_SQL_odbc" != "no" ] && echo "ODBC support ........... $CFG_SQL_odbc"
7602 [ "$CFG_SQL_oci" != "no" ] && echo "OCI support ............ $CFG_SQL_oci"
7603 [ "$CFG_SQL_tds" != "no" ] && echo "TDS support ............ $CFG_SQL_tds"
7604 [ "$CFG_SQL_db2" != "no" ] && echo "DB2 support ............ $CFG_SQL_db2"
7605 [ "$CFG_SQL_ibase" != "no" ] && echo "InterBase support ...... $CFG_SQL_ibase"
7606 [ "$CFG_SQL_sqlite2" != "no" ] && echo "SQLite 2 support ....... $CFG_SQL_sqlite2"
7607 [ "$CFG_SQL_sqlite" != "no" ] && echo "SQLite support ......... $CFG_SQL_sqlite ($CFG_SQLITE)"
7608
7609 OPENSSL_LINKAGE=""
7610 if [ "$CFG_OPENSSL" = "yes" ]; then
7611     OPENSSL_LINKAGE="(run-time)"
7612 elif [ "$CFG_OPENSSL" = "linked" ]; then
7613     OPENSSL_LINKAGE="(linked)"
7614 fi
7615 echo "OpenSSL support ........ $CFG_OPENSSL $OPENSSL_LINKAGE"
7616 echo "Alsa support ........... $CFG_ALSA"
7617 if [ "$BUILD_ON_MAC" = "yes" ]; then
7618     echo "CoreWlan support ....... $CFG_COREWLAN"
7619 fi
7620 echo "libICU support ......... $CFG_ICU"
7621 echo "PCRE support ........... $CFG_PCRE"
7622 if [ "$CFG_XCB_LIMITED" = "yes" ] && [ "$CFG_XCB" = "yes" ]; then
7623     echo "Xcb support ............ limited (old version)"
7624 else
7625     echo "Xcb support ............ $CFG_XCB"
7626 fi
7627 echo "Xrender support ........ $CFG_XRENDER"
7628 if [ "$XPLATFORM_MAEMO" = "yes" ] && [ "$CFG_XCB" = "yes" ]; then
7629     echo "XInput2 support ........ $CFG_XINPUT2"
7630 fi
7631 echo
7632
7633 # complain about not being able to use dynamic plugins if we are using a static build
7634 if [ "$CFG_SHARED" = "no" ]; then
7635     echo
7636     echo "WARNING: Using static linking will disable the use of dynamically"
7637     echo "loaded plugins. Make sure to import all needed static plugins,"
7638     echo "or compile needed modules into the library."
7639     echo
7640 fi
7641 if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then
7642     echo
7643     echo "NOTE: When linking against OpenSSL, you can override the default"
7644     echo "library names through OPENSSL_LIBS."
7645     echo "For example:"
7646     echo "    OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked"
7647     echo
7648 fi
7649 if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then
7650     echo
7651     echo "Error: debug-only framework builds are not supported. Configure with -no-framework"
7652     echo "if you want a pure debug build."
7653     echo
7654     exit 1
7655 fi
7656
7657 sepath=`echo "$relpath" | sed -e 's/\\./\\\\./g'`
7658 PROCS=1
7659 EXEC=""
7660
7661
7662 #-------------------------------------------------------------------------------
7663 # build makefiles based on the configuration
7664 #-------------------------------------------------------------------------------
7665
7666 echo "Finding project files. Please wait..."
7667 if [ "$CFG_NOPROCESS" != "yes" ]; then
7668     "$outpath/bin/qmake" -prl -r "${relpath}/qtbase.pro"
7669     if [ -f "${relpath}/qtbase.pro" ]; then
7670         mkfile="${outpath}/Makefile"
7671         [ -f "$mkfile" ] && chmod +w "$mkfile"
7672         QTDIR="$outpath" "$outpath/bin/qmake" -spec "$XQMAKESPEC" "${relpath}/qtbase.pro" -o "$mkfile"
7673     fi
7674 fi
7675
7676 # .projects      -> projects to process
7677 # .projects.1    -> qt and moc
7678 # .projects.2    -> subdirs and libs
7679 # .projects.3    -> the rest
7680 rm -f .projects .projects.1 .projects.2 .projects.3
7681
7682 QMAKE_PROJECTS=`find "$relpath/." -name '*.pro' -print | sed 's-/\./-/-'`
7683 if [ -z "$AWK" ]; then
7684     for p in `echo $QMAKE_PROJECTS`; do
7685         echo "$p" >> .projects
7686     done
7687 else
7688     cat >projects.awk <<EOF
7689 BEGIN {
7690     files = 0
7691     target_file = ""
7692     input_file = ""
7693
7694     first = "./.projects.1.tmp"
7695     second = "./.projects.2.tmp"
7696     third = "./.projects.3.tmp"
7697 }
7698
7699 FNR == 1 {
7700     if ( input_file ) {
7701         if ( ! target_file )
7702             target_file = third
7703         print input_file >target_file
7704     }
7705
7706     matched_target = 0
7707     template_lib = 0
7708     input_file = FILENAME
7709     target_file = ""
7710 }
7711
7712 /^(TARGET.*=)/ {
7713     if ( \$3 == "moc" || \$3 ~ /^Qt/ ) {
7714         target_file = first
7715         matched_target = 1
7716     } else if ( \$3 == "lrelease" || \$3 == "qm_phony_target" ) {
7717         target_file = second
7718         matched_target = 1
7719     }
7720 }
7721
7722 matched_target == 0 && /^(TEMPLATE.*=)/ {
7723     if ( \$3 == "subdirs" )
7724         target_file = second
7725     else if ( \$3 == "lib" )
7726         template_lib = 1
7727     else
7728         target_file = third
7729 }
7730
7731 matched_target == 0 && template_lib == 1 && /^(CONFIG.*=)/ {
7732     if ( \$0 ~ /plugin/ )
7733         target_file = third
7734     else
7735         target_file = second
7736 }
7737
7738 END {
7739     if ( input_file ) {
7740         if ( ! target_file )
7741             target_file = third
7742         print input_file >>target_file
7743     }
7744 }
7745
7746 EOF
7747
7748     rm -f .projects.all
7749     for p in `echo $QMAKE_PROJECTS`; do
7750        echo "$p" >> .projects.all
7751     done
7752
7753     # if you get errors about the length of the command line to awk, change the -l arg
7754     # to split below
7755     split -l 100 .projects.all .projects.all.
7756     for p in .projects.all.*; do
7757        "$AWK" -f projects.awk `cat $p`
7758        [ -f .projects.1.tmp ] && cat .projects.1.tmp >> .projects.1
7759        [ -f .projects.2.tmp ] && cat .projects.2.tmp >> .projects.2
7760        [ -f .projects.3.tmp ] && cat .projects.3.tmp >> .projects.3
7761        rm -f .projects.1.tmp .projects.2.tmp .projects.3.tmp $p
7762     done
7763     rm -f .projects.all* projects.awk
7764
7765     [ -f .projects.1 ] && cat .projects.1 >>.projects
7766     [ -f .projects.2 ] && cat .projects.2 >>.projects
7767     rm -f .projects.1 .projects.2
7768     if [ -f .projects.3 ] && [ "$OPT_FAST" = "no" ]; then
7769        cat .projects.3 >>.projects
7770        rm -f .projects.3
7771     fi
7772 fi
7773 # don't sort Qt and MOC in with the other project files
7774 # also work around a segfaulting uniq(1)
7775 if [ -f .sorted.projects.2 ]; then
7776     sort .sorted.projects.2 > .sorted.projects.2.new
7777     mv -f .sorted.projects.2.new .sorted.projects.2
7778     cat .sorted.projects.2 >> .sorted.projects.1
7779 fi
7780 [ -f .sorted.projects.1 ] && sort .sorted.projects.1 >> .sorted.projects
7781 rm -f .sorted.projects.2 .sorted.projects.1
7782
7783 NORM_PROJECTS=0
7784 FAST_PROJECTS=0
7785 if [ -f .projects ]; then
7786    uniq .projects >.tmp
7787    mv -f .tmp .projects
7788    NORM_PROJECTS=`cat .projects | wc -l | sed -e "s, ,,g"`
7789 fi
7790 if [ -f .projects.3 ]; then
7791    uniq .projects.3 >.tmp
7792    mv -f .tmp .projects.3
7793    FAST_PROJECTS=`cat .projects.3 | wc -l | sed -e "s, ,,g"`
7794 fi
7795 echo "  `expr $NORM_PROJECTS + $FAST_PROJECTS` projects found."
7796 echo
7797
7798 PART_ROOTS=
7799 for part in $CFG_BUILD_PARTS; do
7800     case "$part" in
7801     tools) PART_ROOTS="$PART_ROOTS tools" ;;
7802     libs) PART_ROOTS="$PART_ROOTS src" ;;
7803     translations) PART_ROOTS="$PART_ROOTS translations" ;;
7804     examples) PART_ROOTS="$PART_ROOTS examples" ;;
7805     *) ;;
7806     esac
7807 done
7808
7809 if [ "$CFG_DEV" = "yes" ]; then
7810     PART_ROOTS="$PART_ROOTS tests"
7811 fi
7812
7813 echo "Creating makefiles. Please wait..."
7814 for file in .projects .projects.3; do
7815     [ '!' -f "$file" ] && continue
7816     for a in `cat $file`; do
7817         IN_ROOT=no
7818         for r in $PART_ROOTS; do
7819             if echo "$a" | grep "^$r" >/dev/null 2>&1 || echo "$a" | grep "^$relpath/$r" >/dev/null 2>&1; then
7820                 IN_ROOT=yes
7821                 break
7822             fi
7823         done
7824         [ "$IN_ROOT" = "no" ] && continue
7825
7826         case $a in
7827         *winmain/winmain.pro)
7828             if [ "$CFG_NOPROCESS" = "yes" ] || [ "$XPLATFORM_MINGW" != "yes" ]; then
7829                 continue
7830             fi
7831             SPEC=$XQMAKESPEC ;;
7832         */qmake/qmake.pro) continue ;;
7833         *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*) SPEC=$QMAKESPEC ;;
7834         *) if [ "$CFG_NOPROCESS" = "yes" ]; then
7835               continue
7836            else
7837               SPEC=$XQMAKESPEC
7838            fi;;
7839         esac
7840         dir=`dirname "$a" | sed -e "s;$sepath;.;g"`
7841         test -d "$dir" || mkdir -p "$dir"
7842         OUTDIR="$outpath/$dir"
7843         if [ -f "${OUTDIR}/Makefile" ] && [ "$OPT_FAST" = "yes" ]; then
7844             # fast configure - the makefile exists, skip it
7845             # since the makefile exists, it was generated by qmake, which means we
7846             # can skip it, since qmake has a rule to regenerate the makefile if the .pro
7847             # file changes...
7848             [ "$OPT_VERBOSE" = "yes" ] && echo "  skipping $a"
7849             continue;
7850         fi
7851         QMAKE_SPEC_ARGS="-spec $SPEC"
7852         echo $ECHO_N "  for $a$ECHO_C"
7853
7854         QMAKE="$outpath/bin/qmake"
7855         QMAKE_ARGS="$QMAKE_SWITCHES $QMAKE_SPEC_ARGS"
7856         if [ "$file" = ".projects.3" ]; then
7857             echo " (fast)"
7858
7859             cat >"${OUTDIR}/Makefile" <<EOF
7860 # ${OUTDIR}/Makefile: generated by configure
7861 #
7862 # WARNING: This makefile will be replaced with a real makefile.
7863 # All changes made to this file will be lost.
7864 EOF
7865             [ "$CFG_DEBUG_RELEASE" = "no" ] && echo "first_target: first" >>${OUTDIR}/Makefile
7866
7867             cat >>"${OUTDIR}/Makefile" <<EOF
7868 QMAKE = "$QMAKE"
7869 all clean install qmake first Makefile: FORCE
7870         \$(QMAKE) $QMAKE_ARGS -o "$OUTDIR" "$a"
7871         cd "$OUTDIR"
7872         \$(MAKE) \$@
7873
7874 FORCE:
7875
7876 EOF
7877         else
7878             if [ "$OPT_VERBOSE" = "yes" ]; then
7879                 echo " (`basename $SPEC`)"
7880                 echo "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
7881             else
7882                 echo
7883             fi
7884
7885             [ -f "${OUTDIR}/Makefile" ] && chmod +w "${OUTDIR}/Makefile"
7886             QTDIR="$outpath" "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
7887        fi
7888     done
7889 done
7890 rm -f .projects .projects.3
7891
7892 #-------------------------------------------------------------------------------
7893 # check for platforms that we don't yet know about
7894 #-------------------------------------------------------------------------------
7895 if [ "$CFG_ARCH" = "generic" ]; then
7896 cat <<EOF
7897
7898         NOTICE: Atomic operations are not yet supported for this
7899         architecture.
7900
7901         Qt will use the 'generic' architecture instead, which uses a
7902         single pthread_mutex_t to protect all atomic operations. This
7903         implementation is the slow (but safe) fallback implementation
7904         for architectures Qt does not yet support.
7905 EOF
7906 fi
7907
7908 #-------------------------------------------------------------------------------
7909 # check if the user passed the -no-zlib option, which is no longer supported
7910 #-------------------------------------------------------------------------------
7911 if [ -n "$ZLIB_FORCED" ]; then
7912     which_zlib="supplied"
7913     if [ "$CFG_ZLIB" = "system" ]; then
7914         which_zlib="system"
7915     fi
7916
7917 cat <<EOF
7918
7919         NOTICE: The -no-zlib option was supplied but is no longer
7920         supported.
7921
7922         Qt now requires zlib support in all builds, so the -no-zlib
7923         option was ignored. Qt will be built using the $which_zlib
7924         zlib.
7925 EOF
7926 fi
7927
7928 #-------------------------------------------------------------------------------
7929 # finally save the executed command to another script
7930 #-------------------------------------------------------------------------------
7931 if [ `basename $0` != "config.status" ]; then
7932     CONFIG_STATUS="$relpath/$relconf $OPT_CMDLINE"
7933
7934     # add the system variables
7935     for varname in $SYSTEM_VARIABLES; do
7936         cmd=`echo \
7937 'if [ -n "\$'${varname}'" ]; then
7938     CONFIG_STATUS="'${varname}'='"'\\\$${varname}'"' \$CONFIG_STATUS"
7939 fi'`
7940         eval "$cmd"
7941     done
7942
7943     echo "$CONFIG_STATUS" | grep '\-confirm\-license' >/dev/null 2>&1 || CONFIG_STATUS="$CONFIG_STATUS -confirm-license"
7944
7945     [ -f "$outpath/config.status" ] && rm -f "$outpath/config.status"
7946     echo "#!/bin/sh" > "$outpath/config.status"
7947     echo "if [ \"\$#\" -gt 0 ]; then" >> "$outpath/config.status"
7948     echo "  $CONFIG_STATUS \"\$@\"" >> "$outpath/config.status"
7949     echo "else" >> "$outpath/config.status"
7950     echo "  $CONFIG_STATUS" >> "$outpath/config.status"
7951     echo "fi" >> "$outpath/config.status"
7952     chmod +x "$outpath/config.status"
7953 fi
7954
7955 if [ -n "$RPATH_MESSAGE" ]; then
7956     echo
7957     echo "$RPATH_MESSAGE"
7958 fi
7959
7960 MAKE=`basename "$MAKE"`
7961 echo
7962 echo Qt is now configured for building. Just run \'$MAKE\'.
7963 if [ "$relpath" = "$QT_INSTALL_PREFIX" ]; then
7964     echo Once everything is built, Qt is installed.
7965     echo You should not run \'$MAKE install\'.
7966 else
7967     echo Once everything is built, you must run \'$MAKE install\'.
7968     echo Qt will be installed into $QT_INSTALL_PREFIX
7969 fi
7970 echo
7971 echo To reconfigure, run \'$MAKE confclean\' and \'configure\'.
7972 echo