Reduce unnecessary QtCore DLL loads during Symbian app thread creation
[qt:staging.git] / configure
1 #!/bin/sh
2 #############################################################################
3 ##
4 ## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
5 ## All rights reserved.
6 ## Contact: Nokia Corporation (qt-info@nokia.com)
7 ##
8 ## This file is the build configuration utility of the Qt Toolkit.
9 ##
10 ## $QT_BEGIN_LICENSE:LGPL$
11 ## GNU Lesser General Public License Usage
12 ## This file may be used under the terms of the GNU Lesser General Public
13 ## License version 2.1 as published by the Free Software Foundation and
14 ## appearing in the file LICENSE.LGPL included in the packaging of this
15 ## file. Please review the following information to ensure the GNU Lesser
16 ## General Public License version 2.1 requirements will be met:
17 ## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ##
19 ## In addition, as a special exception, Nokia gives you certain additional
20 ## rights. These rights are described in the Nokia Qt LGPL Exception
21 ## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ##
23 ## GNU General Public License Usage
24 ## Alternatively, this file may be used under the terms of the GNU General
25 ## Public License version 3.0 as published by the Free Software Foundation
26 ## and appearing in the file LICENSE.GPL included in the packaging of this
27 ## file. Please review the following information to ensure the GNU General
28 ## Public License version 3.0 requirements will be met:
29 ## http://www.gnu.org/copyleft/gpl.html.
30 ##
31 ## Other Usage
32 ## Alternatively, this file may be used in accordance with the terms and
33 ## conditions contained in a signed written agreement between you and Nokia.
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=maybe
189 if [ -d /System/Library/Frameworks/Carbon.framework ]; then
190     PLATFORM_MAC=maybe
191 else
192     PLATFORM_MAC=no
193 fi
194
195 #-----------------------------------------------------------------------------
196 # Qt version detection
197 #-----------------------------------------------------------------------------
198 QT_VERSION=`grep '^# *define *QT_VERSION_STR' "$relpath"/src/corelib/global/qglobal.h`
199 QT_MAJOR_VERSION=
200 QT_MINOR_VERSION=0
201 QT_PATCH_VERSION=0
202 if [ -n "$QT_VERSION" ]; then
203    QT_VERSION=`echo $QT_VERSION | sed 's,^# *define *QT_VERSION_STR *"*\([^ ]*\)"$,\1,'`
204    MAJOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'`
205    if [ -n "$MAJOR" ]; then
206      MINOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'`
207       PATCH=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'`
208       QT_MAJOR_VERSION="$MAJOR"
209       [ -z "$MINOR" ] || QT_MINOR_VERSION="$MINOR"
210       [ -z "$PATCH" ] || QT_PATCH_VERSION="$PATCH"
211    fi
212 fi
213 if [ -z "$QT_MAJOR_VERSION" ]; then
214    echo "Cannot process version from qglobal.h: $QT_VERSION"
215    echo "Cannot proceed."
216    exit 1
217 fi
218
219 QT_PACKAGEDATE=`grep '^# *define *QT_PACKAGEDATE_STR' "$relpath"/src/corelib/global/qglobal.h | sed -e 's,^# *define *QT_PACKAGEDATE_STR *"\([^ ]*\)"$,\1,' -e s,-,,g`
220 if [ -z "$QT_PACKAGEDATE" ]; then
221    echo "Unable to determine package date from qglobal.h: '$QT_PACKAGEDATE'"
222    echo "Cannot proceed"
223    exit 1
224 fi
225
226 #-------------------------------------------------------------------------------
227 # check the license
228 #-------------------------------------------------------------------------------
229 COMMERCIAL_USER=ask
230 CFG_DEV=no
231 CFG_NOKIA=no
232 CFG_EMBEDDED=no
233 CFG_RTOS_ENABLED=yes
234 EditionString=Commercial
235
236 earlyArgParse()
237 {
238     # parse the arguments, setting things to "yes" or "no"
239     while [ "$#" -gt 0 ]; do
240         CURRENT_OPT="$1"
241         UNKNOWN_ARG=no
242         case "$1" in
243         #Autoconf style options
244         --enable-*)
245             VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"`
246             VAL=yes
247             ;;
248         --disable-*)
249             VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"`
250             VAL=no
251             ;;
252         --*=*)
253             VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"`
254             VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"`
255             ;;
256         --no-*)
257             VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
258             VAL=no
259             ;;
260         -embedded)
261             VAR=embedded
262             # this option may or may not be followed by an argument
263             if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
264                 VAL=auto
265             else
266                 shift;
267                 VAL=$1
268             fi
269             ;;
270         -h|help|--help|-help)
271             if [ "$VAL" = "yes" ]; then
272                 OPT_HELP="$VAL"
273                 COMMERCIAL_USER="no" #doesn't matter we will display the help
274             else
275                 UNKNOWN_OPT=yes
276                 COMMERCIAL_USER="no" #doesn't matter we will display the help
277             fi
278             ;;
279         --*)
280             VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
281             VAL=yes
282             ;;
283         -*)
284             VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
285             VAL="unknown"
286             ;;
287         *)
288             UNKNOWN_ARG=yes
289             ;;
290         esac
291         if [ "$UNKNOWN_ARG" = "yes" ]; then
292             shift
293             continue
294         fi
295         shift
296
297         UNKNOWN_OPT=no
298         case "$VAR" in
299         embedded)
300             CFG_EMBEDDED="$VAL"
301             PLATFORM_X11=no
302             PLATFORM_MAC=no
303             PLATFORM_QWS=yes
304             ;;
305         developer-build)
306             CFG_DEV="yes"
307             ;;
308         nokia-developer)
309             CFG_DEV="yes"
310             CFG_NOKIA="yes"
311             COMMERCIAL_USER="no"
312             ;;
313         commercial)
314             COMMERCIAL_USER="yes"
315             ;;
316         opensource)
317             COMMERCIAL_USER="no"
318             ;;
319         *)
320             UNKNOWN_OPT=yes
321             ;;
322         esac
323     done
324 }
325
326 earlyArgParse "$@"
327
328 if [ "$COMMERCIAL_USER" = "ask" ]; then
329     while true; do
330         echo "Which edition of Qt do you want to use ?"
331         echo
332         echo "Type 'c' if you want to use the Commercial Edition."
333         echo "Type 'o' if you want to use the Open Source Edition."
334         echo
335         read commercial
336         echo
337         if [ "$commercial" = "c" ]; then
338             COMMERCIAL_USER="yes"
339             break
340         elif [ "$commercial" = "o" ]; then
341             COMMERCIAL_USER="no"
342             break
343         fi
344     done
345 fi
346
347 if [ "$CFG_NOKIA" = "yes" ]; then
348     Licensee="Nokia"
349     Edition="NokiaInternalBuild"
350     EditionString="Nokia Internal Build"
351     QT_EDITION="QT_EDITION_OPENSOURCE"
352     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
353 elif [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ]; then
354     # Commercial preview release
355     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
356     Licensee="Preview"
357     Edition="Preview"
358     QT_EDITION="QT_EDITION_DESKTOP"
359     LicenseType="Technology Preview"
360 elif [ $COMMERCIAL_USER = "yes" ]; then
361     # one of commercial editions
362     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
363     [ "$PLATFORM_QWS" = "maybe" ] && PLATFORM_QWS=no
364
365     # read in the license file
366     if [ -f "$LICENSE_FILE" ]; then
367         . "$LICENSE_FILE" >/dev/null 2>&1
368         if [ -z "$LicenseKeyExt" ]; then
369             echo
370             echo "You are using an old license file."
371             echo
372             echo "Please install the license file supplied by Nokia,"
373             echo "or install the Qt Open Source Edition if you intend to"
374             echo "develop free software."
375             exit 1
376         fi
377         if [ -z "$Licensee" ]; then
378             echo
379             echo "Invalid license key. Please check the license key."
380             exit 1
381         fi
382     else
383         if [ -z "$LicenseKeyExt" ]; then
384             echo
385             echo $ECHO_N "Please enter your license key: $ECHO_C"
386             read LicenseKeyExt
387             Licensee="Unknown user"
388         fi
389     fi
390
391     # Key verification
392     echo "$LicenseKeyExt" | grep ".....*-....*-....*-....*-.....*-.....*-...." >/dev/null 2>&1 \
393         && LicenseValid="yes" \
394         || LicenseValid="no"
395     if [ "$LicenseValid" != "yes" ]; then
396         echo
397         echo "Invalid license key. Please check the license key."
398         exit 1
399     fi
400     ProductCode=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1`
401     PlatformCode=`echo $LicenseKeyExt | cut -f 2 -d -`
402     LicenseTypeCode=`echo $LicenseKeyExt | cut -f 3 -d -`
403     LicenseFeatureCode=`echo $LicenseKeyExt | cut -f 4 -d - | cut -b 1`
404
405     # determine which edition we are licensed to use
406     case "$LicenseTypeCode" in
407     F4M)
408         LicenseType="Commercial"
409         case $ProductCode in
410         F)
411             Edition="Universal"
412             QT_EDITION="QT_EDITION_UNIVERSAL"
413             ;;
414         B)
415             Edition="FullFramework"
416             EditionString="Full Framework"
417             QT_EDITION="QT_EDITION_DESKTOP"
418             ;;
419         L)
420             Edition="GUIFramework"
421             EditionString="GUI Framework"
422             QT_EDITION="QT_EDITION_DESKTOPLIGHT"
423             ;;
424         esac
425         ;;
426     Z4M|R4M|Q4M)
427         LicenseType="Evaluation"
428         QMakeVar add DEFINES QT_EVAL
429         case $ProductCode in
430          B)
431             Edition="Evaluation"
432             QT_EDITION="QT_EDITION_EVALUATION"
433             ;;
434         esac
435         ;;
436     esac
437     if [ -z "$LicenseType" -o -z "$Edition" -o -z "$QT_EDITION" ]; then
438         echo
439         echo "Invalid license key. Please check the license key."
440         exit 1
441     fi
442
443     # verify that we are licensed to use Qt on this platform
444     LICENSE_EXTENSION=
445     case "$PlatformCode" in
446         *L)
447             CFG_RTOS_ENABLED=yes
448             PlatformCode=`echo "$PlatformCode" | sed 'h;y/8NPQRTZ/UCWX9M7/;x;G;s/\(.\)....\(.\)./\1\2/'`
449             ;;
450         *)
451             CFG_RTOS_ENABLED=no
452             PlatformCode=`echo "$PlatformCode" | sed 's/.$//'`
453             ;;
454     esac
455     case "$PlatformCode,$PLATFORM_MAC,$PLATFORM_QWS" in
456         X9,* | XC,* | XU,* | XW,* | XM,*)
457             # Qt All-OS
458             LICENSE_EXTENSION="-ALLOS"
459             ;;
460         8M,* | KM,* | S9,* | SC,* | SM,* | SU,* | SW,* | X9,* | XC,* | XU,* | XW,*)
461             # Qt for Embedded Linux
462             LICENSE_EXTENSION="-EMBEDDED"
463             ;;
464         6M,*,no | N7,*,no | N9,*,no | NX,*,no)
465             # Embedded no-deploy
466             LICENSE_EXTENSION="-EMBEDDED"
467             ;;
468         FM,*,no | LM,yes,* | ZM,no,no)
469             # Desktop
470             LICENSE_EXTENSION="-DESKTOP"
471             ;;
472         *)
473             Platform=Linux/X11
474             [ "$PLATFORM_MAC" = "yes" ] && Platform='Mac OS X'
475             [ "$PLATFORM_QWS" = "yes" ] && Platform='Embedded Linux'
476             echo
477             echo "You are not licensed for the $Platform platform."
478             echo
479             echo "Please contact qt-info@nokia.com to upgrade your license to"
480             echo "include the $Platform platform, or install the Qt Open Source Edition"
481             echo "if you intend to develop free software."
482             exit 1
483             ;;
484     esac
485
486     if test -r "$relpath/.LICENSE"; then
487         # Generic, non-final license
488         LICENSE_EXTENSION=""
489         line=`sed 'y/a-z/A-Z/;q' "$relpath"/.LICENSE`
490         case "$line" in
491             *BETA*)
492                 Edition=Beta
493                 ;;
494             *TECHNOLOGY?PREVIEW*)
495                 Edition=Preview
496                 ;;
497             *EVALUATION*)
498                 Edition=Evaluation
499                 ;;
500             *)
501                 echo >&2 "Invalid license files; cannot continue"
502                 exit 1
503                 ;;
504         esac
505         Licensee="$Edition"
506         EditionString="$Edition"
507         QT_EDITION="QT_EDITION_DESKTOP"
508     fi
509
510     case "$LicenseFeatureCode" in
511     B|G|L|Y)
512         # US
513         case "$LicenseType" in
514         Commercial)
515             cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}-US" "$outpath/LICENSE"
516             ;;
517         Evaluation)
518             cp -f "$relpath/.LICENSE-EVALUATION-US" "$outpath/LICENSE"
519             ;;
520         esac
521         ;;
522     2|4|5|F)
523         # non-US
524         case "$LicenseType" in
525         Commercial)
526             cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}" "$outpath/LICENSE"
527             ;;
528         Evaluation)
529             cp -f "$relpath/.LICENSE-EVALUATION" "$outpath/LICENSE"
530             ;;
531         esac
532         ;;
533     *)
534         echo
535         echo "Invalid license key. Please check the license key."
536         exit 1
537         ;;
538     esac
539     case "$LicenseFeatureCode" in
540         4|B|F|Y)
541             CFG_RTOS_ENABLED=yes
542             ;;
543         2|5|G|L)
544             CFG_RTOS_ENABLED=no
545             ;;
546     esac
547     if [ '!' -f "$outpath/LICENSE" ]; then
548         echo "The LICENSE, LICENSE.GPL3 LICENSE.LGPL file shipped with"
549         echo "this software has disappeared."
550         echo
551         echo "Sorry, you are not licensed to use this software."
552         echo "Try re-installing."
553         echo
554         exit 1
555     fi
556 elif [ $COMMERCIAL_USER = "no" ]; then
557     # Open Source edition - may only be used under the terms of the GPL or LGPL.
558     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
559     Licensee="Open Source"
560     Edition="OpenSource"
561     EditionString="Open Source"
562     QT_EDITION="QT_EDITION_OPENSOURCE"
563 fi
564
565 #-------------------------------------------------------------------------------
566 # initalize variables
567 #-------------------------------------------------------------------------------
568
569 SYSTEM_VARIABLES="CC CXX CFLAGS CXXFLAGS LDFLAGS"
570 for varname in $SYSTEM_VARIABLES; do
571     qmakevarname="${varname}"
572     # use LDFLAGS for autoconf compat, but qmake uses QMAKE_LFLAGS
573     if [ "${varname}" = "LDFLAGS" ]; then
574         qmakevarname="LFLAGS"
575     fi
576     cmd=`echo \
577 'if [ -n "\$'${varname}'" ]; then
578     QMakeVar set QMAKE_'${qmakevarname}' "\$'${varname}'"
579 fi'`
580     eval "$cmd"
581 done
582 # Use CC/CXX to run config.tests
583 mkdir -p "$outpath/config.tests"
584 rm -f "$outpath/config.tests/.qmake.cache"
585 cp "$QMAKE_VARS_FILE" "$outpath/config.tests/.qmake.cache"
586
587 QMakeVar add styles "cde mac motif plastique cleanlooks windows"
588 QMakeVar add decorations "default windows styled"
589 QMakeVar add mouse-drivers "pc"
590 if [ "$UNAME_SYSTEM" = "Linux" ] ; then
591     QMakeVar add gfx-drivers "linuxfb"
592     QMakeVar add mouse-drivers "linuxtp"
593 fi
594 QMakeVar add kbd-drivers "tty"
595
596 if [ "$CFG_DEV" = "yes" ]; then
597     QMakeVar add kbd-drivers "um"
598 fi
599
600 # QTDIR may be set and point to an old or system-wide Qt installation
601 unset QTDIR
602
603 # the minimum version of libdbus-1 that we require:
604 MIN_DBUS_1_VERSION=0.93
605
606 # initalize internal variables
607 CFG_CONFIGURE_EXIT_ON_ERROR=yes
608 CFG_PROFILE=no
609 CFG_EXCEPTIONS=unspecified
610 CFG_GUI=auto # (yes|no|auto)
611 CFG_SCRIPT=auto # (yes|no|auto)
612 CFG_SCRIPTTOOLS=auto # (yes|no|auto)
613 CFG_XMLPATTERNS=auto # (yes|no|auto)
614 CFG_INCREMENTAL=auto
615 CFG_QCONFIG=full
616 CFG_DEBUG=auto
617 CFG_MYSQL_CONFIG=
618 CFG_DEBUG_RELEASE=no
619 CFG_SHARED=yes
620 CFG_SM=auto
621 CFG_XSHAPE=auto
622 CFG_XSYNC=auto
623 CFG_XVIDEO=auto
624 CFG_XINERAMA=runtime
625 CFG_XFIXES=runtime
626 CFG_ZLIB=auto
627 CFG_SYMBIAN_DEFFILES=auto
628 CFG_S60=auto
629 CFG_SQLITE=qt
630 CFG_GIF=auto
631 CFG_TIFF=auto
632 CFG_LIBTIFF=auto
633 CFG_PNG=yes
634 CFG_LIBPNG=auto
635 CFG_JPEG=auto
636 CFG_LIBJPEG=auto
637 CFG_MNG=auto
638 CFG_LIBMNG=auto
639 CFG_XCURSOR=runtime
640 CFG_XRANDR=runtime
641 CFG_XRENDER=auto
642 CFG_MITSHM=auto
643 CFG_OPENGL=auto
644 CFG_OPENVG=auto
645 CFG_OPENVG_LC_INCLUDES=no
646 CFG_OPENVG_SHIVA=auto
647 CFG_OPENVG_ON_OPENGL=auto
648 CFG_EGL=no
649 CFG_EGL_GLES_INCLUDES=no
650 CFG_SSE=auto
651 CFG_FONTCONFIG=auto
652 CFG_QWS_FREETYPE=auto
653 CFG_LIBFREETYPE=auto
654 CFG_SQL_AVAILABLE=
655 QT_DEFAULT_BUILD_PARTS="libs tools examples demos docs translations"
656 CFG_BUILD_PARTS=""
657 CFG_NOBUILD_PARTS=""
658 CFG_RELEASE_QMAKE=no
659 CFG_PHONON=auto
660 CFG_PHONON_BACKEND=yes
661 CFG_MULTIMEDIA=auto
662 CFG_AUDIO_BACKEND=auto
663 CFG_SVG=auto
664 CFG_DECLARATIVE=auto
665 CFG_DECLARATIVE_DEBUG=yes
666 CFG_WEBKIT=auto # (yes|no|auto|debug)
667 CFG_JAVASCRIPTCORE_JIT=auto
668
669 CFG_GFX_AVAILABLE="linuxfb transformed qvfb vnc multiscreen directfb"
670 CFG_GFX_ON="linuxfb multiscreen"
671 CFG_GFX_PLUGIN_AVAILABLE=
672 CFG_GFX_PLUGIN=
673 CFG_GFX_OFF=
674 CFG_KBD_AVAILABLE="tty linuxinput qvfb"
675 CFG_KBD_ON="tty"    #default, see QMakeVar above
676 CFG_MOUSE_AVAILABLE="pc linuxtp linuxinput tslib qvfb"
677 CFG_MOUSE_ON="pc linuxtp"   #default, see QMakeVar above
678
679 if [ -f "$relpath/src/gui/embedded/qscreenqnx_qws.cpp" ]; then
680     CFG_KBD_AVAILABLE="${CFG_KBD_AVAILABLE} qnx"
681     CFG_MOUSE_AVAILABLE="${CFG_MOUSE_AVAILABLE} qnx"
682     CFG_GFX_AVAILABLE="${CFG_GFX_AVAILABLE} qnx"
683 fi
684
685 CFG_ARCH=
686 CFG_HOST_ARCH=
687 CFG_KBD_PLUGIN_AVAILABLE=
688 CFG_KBD_PLUGIN=
689 CFG_KBD_OFF=
690 CFG_MOUSE_PLUGIN_AVAILABLE=
691 CFG_MOUSE_PLUGIN=
692 CFG_MOUSE_OFF=
693 CFG_USE_GNUMAKE=no
694 CFG_IM=yes
695 CFG_DECORATION_AVAILABLE="styled windows default"
696 CFG_DECORATION_ON="${CFG_DECORATION_AVAILABLE}" # all on by default
697 CFG_DECORATION_PLUGIN_AVAILABLE=
698 CFG_DECORATION_PLUGIN=
699 CFG_XINPUT=runtime
700 CFG_XKB=auto
701 CFG_NIS=auto
702 CFG_CUPS=auto
703 CFG_ICONV=auto
704 CFG_DBUS=auto
705 CFG_GLIB=auto
706 CFG_GSTREAMER=auto
707 CFG_QGTKSTYLE=auto
708 CFG_QS60STYLE=auto
709 CFG_LARGEFILE=auto
710 CFG_OPENSSL=auto
711 CFG_PTMALLOC=no
712 CFG_STL=auto
713 CFG_PRECOMPILE=auto
714 CFG_SEPARATE_DEBUG_INFO=no
715 CFG_SEPARATE_DEBUG_INFO_NOCOPY=no
716 CFG_REDUCE_EXPORTS=auto
717 CFG_MMX=auto
718 CFG_3DNOW=auto
719 CFG_SSE=auto
720 CFG_SSE2=auto
721 CFG_SSE3=auto
722 CFG_SSSE3=auto
723 CFG_SSE4_1=auto
724 CFG_SSE4_2=auto
725 CFG_AVX=auto
726 CFG_REDUCE_RELOCATIONS=no
727 CFG_IPV6=auto
728 CFG_NAS=no
729 CFG_QWS_DEPTHS=all
730 CFG_USER_BUILD_KEY=
731 CFG_ACCESSIBILITY=auto
732 CFG_QT3SUPPORT=yes
733 CFG_ENDIAN=auto
734 CFG_HOST_ENDIAN=auto
735 CFG_DOUBLEFORMAT=auto
736 CFG_ARMFPA=auto
737 CFG_IWMMXT=no
738 CFG_NEON=auto
739 CFG_CLOCK_GETTIME=auto
740 CFG_CLOCK_MONOTONIC=auto
741 CFG_MREMAP=auto
742 CFG_GETADDRINFO=auto
743 CFG_IPV6IFNAME=auto
744 CFG_GETIFADDRS=auto
745 CFG_INOTIFY=auto
746 CFG_RPATH=yes
747 CFG_FRAMEWORK=auto
748 CFG_MAC_ARCHS=
749 MAC_CONFIG_TEST_COMMANDLINE=  # used to make the configure tests run with the correct arch's and SDK settings
750 CFG_MAC_DWARF2=auto
751 CFG_MAC_XARCH=auto
752 CFG_MAC_CARBON=no
753 CFG_MAC_COCOA=yes
754 COMMANDLINE_MAC_CARBON=no
755 CFG_SXE=no
756 CFG_PREFIX_INSTALL=yes
757 CFG_SDK=
758 D_FLAGS=
759 I_FLAGS=
760 L_FLAGS=
761 RPATH_FLAGS=
762 l_FLAGS=
763 QCONFIG_FLAGS=
764 XPLATFORM=              # This seems to be the QMAKESPEC, like "linux-g++" or "symbian-gcce"
765 XPLATFORM_MINGW=no      # Whether target platform is MinGW (win32-g++*)
766 XPLATFORM_SYMBIAN=no    # Whether target platform is SYMBIAN (*symbian*)
767 XPLATFORM_SYMBIAN_SBSV2=no # Whether target platform is SYMBIAN_SBSV2 (symbian-sbsv2)
768 PLATFORM=$QMAKESPEC
769 QT_CROSS_COMPILE=no
770 OPT_CONFIRM_LICENSE=no
771 OPT_SHADOW=maybe
772 OPT_FAST=auto
773 OPT_VERBOSE=no
774 OPT_HELP=
775 CFG_SILENT=no
776 CFG_GRAPHICS_SYSTEM=default
777 CFG_RUNTIME_SYSTEM=
778 CFG_ALSA=auto
779 CFG_PULSEAUDIO=auto
780 CFG_COREWLAN=auto
781 CFG_ICD=auto
782 CFG_NOPROCESS=no
783
784 # initalize variables used for installation
785 QT_INSTALL_PREFIX=
786 QT_INSTALL_DOCS=
787 QT_INSTALL_HEADERS=
788 QT_INSTALL_LIBS=
789 QT_INSTALL_BINS=
790 QT_INSTALL_PLUGINS=
791 QT_INSTALL_IMPORTS=
792 QT_INSTALL_DATA=
793 QT_INSTALL_TRANSLATIONS=
794 QT_INSTALL_SETTINGS=
795 QT_INSTALL_EXAMPLES=
796 QT_INSTALL_DEMOS=
797 QT_HOST_PREFIX=
798
799 #flags for SQL drivers
800 QT_CFLAGS_PSQL=
801 QT_LFLAGS_PSQL=
802 QT_CFLAGS_MYSQL=
803 QT_LFLAGS_MYSQL=
804 QT_LFLAGS_MYSQL_R=
805 QT_CFLAGS_SQLITE=
806 QT_LFLAGS_SQLITE=
807 QT_LFLAGS_ODBC="-lodbc"
808 QT_LFLAGS_TDS=
809
810 # flags for libdbus-1
811 QT_CFLAGS_DBUS=
812 QT_LIBS_DBUS=
813
814 # flags for Glib (X11 only)
815 QT_CFLAGS_GLIB=
816 QT_LIBS_GLIB=
817
818 # flags for GStreamer (X11 only)
819 QT_CFLAGS_GSTREAMER=
820 QT_LIBS_GSTREAMER=
821
822 #flag for Symbian fpu settings
823 QT_CFLAGS_FPU=
824
825 # flags for libconnsettings0 (used for Maemo ICD bearer management plugin)
826 QT_CFLAGS_CONNSETTINGS=
827 QT_LIBS_CONNSETTINGS=
828
829 #-------------------------------------------------------------------------------
830 # check SQL drivers, mouse drivers and decorations available in this package
831 #-------------------------------------------------------------------------------
832
833 # opensource version removes some drivers, so force them to be off
834 CFG_SQL_tds=no
835 CFG_SQL_oci=no
836 CFG_SQL_db2=no
837
838 CFG_SQL_AVAILABLE=
839 if [ -d "$relpath/src/plugins/sqldrivers" ]; then
840   for a in "$relpath/src/plugins/sqldrivers/"*; do
841      if [ -d "$a" ]; then
842          base_a=`basename "$a"`
843          CFG_SQL_AVAILABLE="${CFG_SQL_AVAILABLE} ${base_a}"
844          eval "CFG_SQL_${base_a}=auto"
845      fi
846   done
847 fi
848
849 CFG_DECORATION_PLUGIN_AVAILABLE=
850 if [ -d "$relpath/src/plugins/decorations" ]; then
851   for a in "$relpath/src/plugins/decorations/"*; do
852      if [ -d "$a" ]; then
853          base_a=`basename "$a"`
854          CFG_DECORATION_PLUGIN_AVAILABLE="${CFG_DECORATION_PLUGIN_AVAILABLE} ${base_a}"
855      fi
856   done
857 fi
858
859 CFG_KBD_PLUGIN_AVAILABLE=
860 if [ -d "$relpath/src/plugins/kbddrivers" ]; then
861   for a in "$relpath/src/plugins/kbddrivers/"*; do
862      if [ -d "$a" ]; then
863          base_a=`basename "$a"`
864          CFG_KBD_PLUGIN_AVAILABLE="${CFG_KBD_PLUGIN_AVAILABLE} ${base_a}"
865      fi
866   done
867 fi
868
869 CFG_MOUSE_PLUGIN_AVAILABLE=
870 if [ -d "$relpath/src/plugins/mousedrivers" ]; then
871   for a in "$relpath/src/plugins/mousedrivers/"*; do
872      if [ -d "$a" ]; then
873          base_a=`basename "$a"`
874          CFG_MOUSE_PLUGIN_AVAILABLE="${CFG_MOUSE_PLUGIN_AVAILABLE} ${base_a}"
875      fi
876   done
877 fi
878
879 CFG_GFX_PLUGIN_AVAILABLE=
880 if [ -d "$relpath/src/plugins/gfxdrivers" ]; then
881   for a in "$relpath/src/plugins/gfxdrivers/"*; do
882      if [ -d "$a" ]; then
883          base_a=`basename "$a"`
884          CFG_GFX_PLUGIN_AVAILABLE="${CFG_GFX_PLUGIN_AVAILABLE} ${base_a}"
885      fi
886   done
887   CFG_GFX_OFF="$CFG_GFX_AVAILABLE" # assume all off
888 fi
889
890 #-------------------------------------------------------------------------------
891 # parse command line arguments
892 #-------------------------------------------------------------------------------
893
894 # parse the arguments, setting things to "yes" or "no"
895 while [ "$#" -gt 0 ]; do
896     CURRENT_OPT="$1"
897     UNKNOWN_ARG=no
898     case "$1" in
899     #Autoconf style options
900     --enable-*)
901         VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"`
902         VAL=yes
903         ;;
904     --disable-*)
905         VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"`
906         VAL=no
907         ;;
908     --*=*)
909         VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"`
910         VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"`
911         ;;
912     --no-*)
913         VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
914         VAL=no
915         ;;
916     --*)
917         VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
918         VAL=yes
919         ;;
920     #Qt plugin options
921     -no-*-*|-plugin-*-*|-qt-*-*)
922         VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
923         VAL=`echo $1 | sed "s,^-\([^-]*\).*,\1,"`
924         ;;
925     #WebKit options
926     -webkit)
927         VAR="webkit"
928         VAL="yes"
929         ;;
930     -webkit-debug)
931         VAR="webkit"
932         VAL="debug"
933         ;;
934     -no-webkit)
935         VAR="webkit"
936         VAL="no"
937         ;;
938     #Qt style no options
939     -no-*)
940         VAR=`echo $1 | sed "s,^-no-\(.*\),\1,"`
941         VAL=no
942         ;;
943     #Qt style yes options
944     -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-declarative-debug|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles)
945         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
946         VAL=yes
947         ;;
948     #Qt style options that pass an argument
949     -qconfig)
950         if [ "$PLATFORM_QWS" != "yes" ]; then
951             echo
952             echo "WARNING: -qconfig is only tested and supported on Qt for Embedded Linux."
953             echo
954         fi
955         CFG_QCONFIG="$VAL"
956         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
957         shift
958         VAL=$1
959         ;;
960     -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-demosdir|-depths|-make|-nomake|-platform|-xplatform|-buildkey|-sdk|-arch|-host-arch|-mysql_config)
961         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
962         shift
963         VAL="$1"
964         ;;
965     #Qt style complex options in one command
966     -enable-*|-disable-*)
967         VAR=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
968         VAL=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
969         ;;
970     #Qt Builtin/System style options
971     -no-*|-system-*|-qt-*)
972         VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
973         VAL=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
974         ;;
975     #Options that cannot be generalized
976     -k|-continue)
977         VAR=fatal_error
978         VAL=no
979         ;;
980     -embedded)
981         VAR=embedded
982         # this option may or may not be followed by an argument
983         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
984             VAL=auto
985         else
986             shift;
987             VAL=$1
988         fi
989         ;;
990     -opengl)
991         VAR=opengl
992         # this option may or may not be followed by an argument
993         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
994             VAL=yes
995         else
996             shift;
997             VAL=$1
998         fi
999         ;;
1000     -openvg)
1001         VAR=openvg
1002         # this option may or may not be followed by an argument
1003         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
1004             VAL=yes
1005         else
1006             shift;
1007             VAL=$1
1008         fi
1009         ;;
1010     -hostprefix)
1011         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
1012         # this option may or may not be followed by an argument
1013         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
1014             VAL=$outpath
1015         else
1016             shift;
1017             VAL=$1
1018         fi
1019         ;;
1020     -host-*-endian)
1021         VAR=host_endian
1022         VAL=`echo $1 | sed "s,^-.*-\(.*\)-.*,\1,"`
1023         ;;
1024     -*-endian)
1025         VAR=endian
1026         VAL=`echo $1 | sed "s,^-\(.*\)-.*,\1,"`
1027         ;;
1028     -qtnamespace)
1029         VAR="qtnamespace"
1030         shift
1031         VAL="$1"
1032         ;;
1033     -graphicssystem)
1034         VAR="graphicssystem"
1035         shift
1036         VAL=$1
1037         ;;
1038     -runtimegraphicssystem)
1039         VAR="runtimegraphicssystem"
1040         shift
1041         VAL=$1
1042         ;;
1043     -qtlibinfix)
1044         VAR="qtlibinfix"
1045         shift
1046         VAL="$1"
1047         ;;
1048     -D?*|-D)
1049         VAR="add_define"
1050         if [ "$1" = "-D" ]; then
1051             shift
1052             VAL="$1"
1053         else
1054             VAL=`echo $1 | sed 's,-D,,'`
1055         fi
1056         ;;
1057     -fpu)
1058         VAR="fpu"
1059         # this option may or may not be followed by an argument
1060         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
1061             VAL=no
1062         else
1063             shift
1064             VAL=$1
1065         fi
1066         ;;
1067     -I?*|-I)
1068         VAR="add_ipath"
1069         if [ "$1" = "-I" ]; then
1070             shift
1071             VAL="$1"
1072         else
1073             VAL=`echo $1 | sed 's,-I,,'`
1074         fi
1075         ;;
1076     -L?*|-L)
1077         VAR="add_lpath"
1078         if [ "$1" = "-L" ]; then
1079             shift
1080             VAL="$1"
1081         else
1082             VAL=`echo $1 | sed 's,-L,,'`
1083         fi
1084         ;;
1085     -R?*|-R)
1086         VAR="add_rpath"
1087         if [ "$1" = "-R" ]; then
1088             shift
1089             VAL="$1"
1090         else
1091             VAL=`echo $1 | sed 's,-R,,'`
1092         fi
1093         ;;
1094     -l?*)
1095         VAR="add_link"
1096         VAL=`echo $1 | sed 's,-l,,'`
1097         ;;
1098     -F?*|-F)
1099         VAR="add_fpath"
1100         if [ "$1" = "-F" ]; then
1101             shift
1102             VAL="$1"
1103         else
1104             VAL=`echo $1 | sed 's,-F,,'`
1105         fi
1106         ;;
1107     -fw?*|-fw)
1108         VAR="add_framework"
1109         if [ "$1" = "-fw" ]; then
1110             shift
1111             VAL="$1"
1112         else
1113             VAL=`echo $1 | sed 's,-fw,,'`
1114         fi
1115         ;;
1116     -*)
1117         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
1118         VAL="unknown"
1119         ;;
1120     *)
1121         UNKNOWN_ARG=yes
1122         ;;
1123     esac
1124     if [ "$UNKNOWN_ARG" = "yes" ]; then
1125         echo "$1: unknown argument"
1126         OPT_HELP=yes
1127         ERROR=yes
1128         shift
1129         continue
1130      fi
1131     shift
1132
1133     UNKNOWN_OPT=no
1134     case "$VAR" in
1135     qt3support)
1136         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1137             CFG_QT3SUPPORT="$VAL"
1138         else
1139             UNKNOWN_OPT=yes
1140         fi
1141         ;;
1142     accessibility)
1143         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1144             CFG_ACCESSIBILITY="$VAL"
1145         else
1146             UNKNOWN_OPT=yes
1147         fi
1148         ;;
1149     license)
1150         LICENSE_FILE="$VAL"
1151         ;;
1152     gnumake)
1153         CFG_USE_GNUMAKE="$VAL"
1154         ;;
1155     mysql_config)
1156         CFG_MYSQL_CONFIG="$VAL"
1157         ;;
1158     prefix)
1159         QT_INSTALL_PREFIX="$VAL"
1160         ;;
1161     hostprefix)
1162         QT_HOST_PREFIX="$VAL"
1163         ;;
1164     force-pkg-config)
1165         QT_FORCE_PKGCONFIG=yes
1166         ;;
1167     docdir)
1168         QT_INSTALL_DOCS="$VAL"
1169         ;;
1170     headerdir)
1171         QT_INSTALL_HEADERS="$VAL"
1172         ;;
1173     plugindir)
1174         QT_INSTALL_PLUGINS="$VAL"
1175         ;;
1176     importdir)
1177         QT_INSTALL_IMPORTS="$VAL"
1178         ;;
1179     datadir)
1180         QT_INSTALL_DATA="$VAL"
1181         ;;
1182     libdir)
1183         QT_INSTALL_LIBS="$VAL"
1184         ;;
1185     qtnamespace)
1186         QT_NAMESPACE="$VAL"
1187         ;;
1188     qtlibinfix)
1189         QT_LIBINFIX="$VAL"
1190         ;;
1191     translationdir)
1192         QT_INSTALL_TRANSLATIONS="$VAL"
1193         ;;
1194     sysconfdir|settingsdir)
1195         QT_INSTALL_SETTINGS="$VAL"
1196         ;;
1197     examplesdir)
1198         QT_INSTALL_EXAMPLES="$VAL"
1199         ;;
1200     demosdir)
1201         QT_INSTALL_DEMOS="$VAL"
1202         ;;
1203     qconfig)
1204         CFG_QCONFIG="$VAL"
1205         ;;
1206     bindir)
1207         QT_INSTALL_BINS="$VAL"
1208         ;;
1209     buildkey)
1210         CFG_USER_BUILD_KEY="$VAL"
1211         ;;
1212     sxe)
1213         CFG_SXE="$VAL"
1214         ;;
1215     embedded)
1216         CFG_EMBEDDED="$VAL"
1217         PLATFORM_X11=no
1218         PLATFORM_MAC=no
1219         PLATFORM_QWS=yes
1220         ;;
1221     sse)
1222         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1223             CFG_SSE="$VAL"
1224         else
1225             UNKNOWN_OPT=yes
1226         fi
1227         ;;
1228     endian)
1229         if [ "$VAL" = "little" ]; then
1230             CFG_ENDIAN="Q_LITTLE_ENDIAN"
1231         elif [ "$VAL" = "big" ]; then
1232             CFG_ENDIAN="Q_BIG_ENDIAN"
1233         else
1234             UNKNOWN_OPT=yes
1235         fi
1236         ;;
1237     host_endian)
1238         if [ "$VAL" = "little" ]; then
1239             CFG_HOST_ENDIAN="Q_LITTLE_ENDIAN"
1240         elif [ "$VAL" = "big" ]; then
1241             CFG_HOST_ENDIAN="Q_BIG_ENDIAN"
1242         else
1243             UNKNOWN_OPT=yes
1244         fi
1245         ;;
1246     armfpa)
1247         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1248             CFG_ARMFPA="$VAL"
1249         else
1250             UNKNOWN_OPT=yes
1251         fi
1252         ;;
1253     depths)
1254         CFG_QWS_DEPTHS="$VAL"
1255         ;;
1256     opengl)
1257         if  [ "$VAL" = "auto" ] || [ "$VAL" = "desktop" ] ||
1258             [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] ||
1259             [ "$VAL" = "es1" ] || [ "$VAL" = "es2" ]; then
1260             CFG_OPENGL="$VAL"
1261             if  [ "$VAL" = "es1" ] || [ "$VAL" = "es2" ]; then
1262                 CFG_EGL="yes"
1263             fi
1264         else
1265             UNKNOWN_OPT=yes
1266         fi
1267         ;;
1268     openvg)
1269         if [ "$VAL" = "auto" ] || [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1270             CFG_OPENVG="$VAL"
1271             if [ "$CFG_EGL" = "no" ] && [ "$VAL" != "no" ]; then
1272                 CFG_EGL=auto
1273             fi
1274         else
1275             UNKNOWN_OPT=yes
1276         fi
1277         ;;
1278     graphicssystem)
1279         if [ "$PLATFORM_QWS" = "yes" ]; then
1280             echo "Error: Graphics System plugins are not supported on QWS."
1281             echo "   On QWS, the graphics system API is part of the QScreen plugin architecture "
1282             echo "   rather than existing as a separate plugin."
1283             echo ""
1284             UNKNOWN_OPT=yes
1285         else
1286             if  [ "$VAL" = "opengl" ]; then
1287                 CFG_GRAPHICS_SYSTEM="opengl"
1288             elif [ "$VAL" = "openvg" ]; then
1289                 CFG_GRAPHICS_SYSTEM="openvg"
1290             elif [ "$VAL" = "raster" ]; then
1291                 CFG_GRAPHICS_SYSTEM="raster"
1292             elif [ "$VAL" = "runtime" ]; then
1293                 CFG_GRAPHICS_SYSTEM="runtime"
1294             else
1295                 UNKNOWN_OPT=yes
1296             fi
1297         fi
1298         ;;
1299     runtimegraphicssystem)
1300         if  [ "$VAL" != "runtime" ]; then
1301             CFG_RUNTIME_SYSTEM="$VAL"
1302         fi
1303         ;;
1304
1305     qvfb) # left for commandline compatibility, not documented
1306         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1307             if [ "$VAL" = "yes" ]; then
1308                 QMakeVar add gfx-drivers qvfb
1309                 QMakeVar add kbd-drivers qvfb
1310                 QMakeVar add mouse-drivers qvfb
1311                 CFG_GFX_ON="$CFG_GFX_ON qvfb"
1312                 CFG_KBD_ON="$CFG_KBD_ON qvfb"
1313                 CFG_MOUSE_ON="$CFG_MOUSE_ON qvfb"
1314             fi
1315         else
1316             UNKNOWN_OPT=yes
1317         fi
1318         ;;
1319     nomake)
1320         CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS $VAL"
1321         ;;
1322     make)
1323         CFG_BUILD_PARTS="$CFG_BUILD_PARTS $VAL"
1324         ;;
1325     x11)
1326         PLATFORM_MAC=no
1327         PLATFORM_QWS=no
1328         PLATFORM_X11=yes
1329         ;;
1330     sdk)
1331         if [ "$PLATFORM_MAC" = "yes" ]; then
1332             CFG_SDK="$VAL"
1333         else
1334             UNKNOWN_OPT=yes
1335         fi
1336         ;;
1337      dwarf2)
1338         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1339             CFG_MAC_DWARF2="$VAL"
1340         else
1341             UNKNOWN_OPT=yes
1342         fi
1343         ;;
1344     arch)
1345         # if this is a Mac then "windows" probably means
1346         # we are cross-compiling for MinGW
1347         if [ "$PLATFORM_MAC" = "yes" ] && [ "$VAL" != "windows" ]; then
1348             CFG_MAC_ARCHS="$CFG_MAC_ARCHS $VAL"
1349         else
1350             CFG_ARCH=$VAL
1351         fi
1352         ;;
1353     host-arch)
1354         CFG_HOST_ARCH=$VAL
1355         ;;
1356     universal)
1357         if [ "$PLATFORM_MAC" = "yes" ] && [ "$VAL" = "yes" ]; then
1358             CFG_MAC_ARCHS="$CFG_MAC_ARCHS x86 ppc"
1359         else
1360             UNKNOWN_OPT=yes
1361         fi
1362         ;;
1363     cocoa)
1364 #       do nothing - Cocoa is the default.
1365         ;;
1366     carbon)
1367         if [ "$PLATFORM_MAC" = "yes" ] && [ "$VAL" = "yes" ]; then
1368             CFG_MAC_CARBON="$VAL"
1369             COMMANDLINE_MAC_CARBON="$VAL"
1370         else
1371             UNKNOWN_OPT=yes
1372         fi
1373         ;;
1374
1375     framework)
1376         if [ "$PLATFORM_MAC" = "yes" ]; then
1377             CFG_FRAMEWORK="$VAL"
1378         else
1379             UNKNOWN_OPT=yes
1380         fi
1381         ;;
1382     profile)
1383         if [ "$VAL" = "yes" ]; then
1384             CFG_PROFILE=yes
1385             QMakeVar add QMAKE_CFLAGS -pg
1386             QMakeVar add QMAKE_CXXFLAGS -pg
1387             QMakeVar add QMAKE_LFLAGS -pg
1388             QMAKE_VARS="$QMAKE_VARS CONFIG+=nostrip"
1389         else
1390             UNKNOWN_OPT=yes
1391         fi
1392         ;;
1393     exceptions|g++-exceptions)
1394         if [ "$VAL" = "no" ]; then
1395             CFG_EXCEPTIONS=no
1396         elif [ "$VAL" = "yes" ]; then
1397             CFG_EXCEPTIONS=yes
1398         else
1399             UNKNOWN_OPT=yes
1400         fi
1401         ;;
1402     platform)
1403         PLATFORM="$VAL"
1404         # keep compatibility with old platform names
1405         case $PLATFORM in
1406         aix-64)
1407             PLATFORM=aix-xlc-64
1408             ;;
1409         hpux-o64)
1410             PLATFORM=hpux-acc-o64
1411             ;;
1412         hpux-n64)
1413             PLATFORM=hpux-acc-64
1414             ;;
1415         hpux-acc-n64)
1416             PLATFORM=hpux-acc-64
1417             ;;
1418         irix-n32)
1419             PLATFORM=irix-cc
1420             ;;
1421         irix-64)
1422             PLATFORM=irix-cc-64
1423             ;;
1424         irix-cc-n64)
1425             PLATFORM=irix-cc-64
1426             ;;
1427         reliant-64)
1428             PLATFORM=reliant-cds-64
1429             ;;
1430         solaris-64)
1431             PLATFORM=solaris-cc-64
1432             ;;
1433         openunix-cc)
1434             PLATFORM=unixware-cc
1435             ;;
1436         openunix-g++)
1437             PLATFORM=unixware-g++
1438             ;;
1439         unixware7-cc)
1440             PLATFORM=unixware-cc
1441             ;;
1442         unixware7-g++)
1443             PLATFORM=unixware-g++
1444             ;;
1445         macx-g++-64)
1446             PLATFORM=macx-g++
1447             NATIVE_64_ARCH=
1448             case `uname -p` in
1449             i386) NATIVE_64_ARCH="x86_64" ;;
1450             powerpc) NATIVE_64_ARCH="ppc64" ;;
1451             *)   echo "WARNING: Can't detect CPU architecture for macx-g++-64" ;;
1452             esac
1453             if [ ! -z "$NATIVE_64_ARCH" ]; then
1454                 QTCONFIG_CONFIG="$QTCONFIG_CONFIG $NATIVE_64_ARCH"
1455                 CFG_MAC_ARCHS="$CFG_MAC_ARCHS $NATIVE_64_ARCH"
1456             fi
1457             ;;
1458         esac
1459         ;;
1460     xplatform)
1461         XPLATFORM="$VAL"
1462         case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac
1463         case "$XPLATFORM" in *symbian*) XPLATFORM_SYMBIAN=yes;; esac
1464         case "$XPLATFORM" in symbian-sbsv2) XPLATFORM_SYMBIAN_SBSV2=yes;; esac
1465         ;;
1466     debug-and-release)
1467         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1468             CFG_DEBUG_RELEASE="$VAL"
1469         else
1470             UNKNOWN_OPT=yes
1471         fi
1472         ;;
1473     optimized-qmake)
1474         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1475             CFG_RELEASE_QMAKE="$VAL"
1476         else
1477             UNKNOWN_OPT=yes
1478         fi
1479         ;;
1480     release)
1481         if [ "$VAL" = "yes" ]; then
1482             CFG_DEBUG=no
1483         elif [ "$VAL" = "no" ]; then
1484             CFG_DEBUG=yes
1485         else
1486             UNKNOWN_OPT=yes
1487         fi
1488         ;;
1489     prefix-install)
1490         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1491             CFG_PREFIX_INSTALL="$VAL"
1492         else
1493             UNKNOWN_OPT=yes
1494         fi
1495         ;;
1496     debug)
1497         CFG_DEBUG="$VAL"
1498         ;;
1499     developer-build|commercial|opensource|nokia-developer)
1500         # These switches have been dealt with already
1501         ;;
1502     static)
1503         if [ "$VAL" = "yes" ]; then
1504             CFG_SHARED=no
1505         elif [ "$VAL" = "no" ]; then
1506             CFG_SHARED=yes
1507         else
1508             UNKNOWN_OPT=yes
1509         fi
1510         ;;
1511     incremental)
1512         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1513             CFG_INCREMENTAL="$VAL"
1514         else
1515             UNKNOWN_OPT=yes
1516         fi
1517         ;;
1518     fatal_error)
1519         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1520             CFG_CONFIGURE_EXIT_ON_ERROR="$VAL"
1521         else
1522             UNKNOWN_OPT=yes
1523         fi
1524         ;;
1525     feature-*)
1526             FEATURE=`echo $VAR | sed "s,^[^-]*-\([^-]*\),\1," | tr 'abcdefghijklmnopqrstuvwxyz-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
1527             if [ "$VAL" = "no" ]; then
1528                 QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_$FEATURE"
1529             elif [ "$VAL" = "yes" ] || [ "$VAL" = "unknown" ]; then
1530                 QCONFIG_FLAGS="$QCONFIG_FLAGS QT_$FEATURE"
1531             else
1532                 UNKNOWN_OPT=yes
1533             fi
1534         ;;
1535     shared)
1536         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1537             CFG_SHARED="$VAL"
1538         else
1539             UNKNOWN_OPT=yes
1540         fi
1541         ;;
1542     gif)
1543         [ "$VAL" = "qt" ] && VAL=auto
1544         if [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then
1545             CFG_GIF="$VAL"
1546         else
1547             UNKNOWN_OPT=yes
1548         fi
1549         ;;
1550     sm)
1551         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1552             CFG_SM="$VAL"
1553         else
1554             UNKNOWN_OPT=yes
1555         fi
1556
1557         ;;
1558     xinerama)
1559         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1560             CFG_XINERAMA="$VAL"
1561         else
1562             UNKNOWN_OPT=yes
1563         fi
1564         ;;
1565     xshape)
1566         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1567             CFG_XSHAPE="$VAL"
1568         else
1569             UNKNOWN_OPT=yes
1570         fi
1571         ;;
1572     xvideo)
1573         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1574             CFG_XVIDEO="$VAL"
1575         else
1576             UNKNOWN_OPT=yes
1577         fi
1578         ;;
1579     xsync)
1580         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1581             CFG_XSYNC="$VAL"
1582         else
1583             UNKNOWN_OPT=yes
1584         fi
1585         ;;
1586     xinput)
1587         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1588             CFG_XINPUT="$VAL"
1589         else
1590             UNKNOWN_OPT=yes
1591         fi
1592         ;;
1593     egl)
1594         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1595             CFG_EGL="$VAL"
1596         else
1597             UNKNOWN_OPT=yes
1598         fi
1599         ;;
1600     stl)
1601         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1602             CFG_STL="$VAL"
1603         else
1604             UNKNOWN_OPT=yes
1605         fi
1606         ;;
1607     pch)
1608         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1609             CFG_PRECOMPILE="$VAL"
1610         else
1611             UNKNOWN_OPT=yes
1612         fi
1613         ;;
1614     separate-debug-info)
1615         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1616             CFG_SEPARATE_DEBUG_INFO="$VAL"
1617         elif [ "$VAL" = "nocopy" ] ; then
1618             CFG_SEPARATE_DEBUG_INFO="yes"
1619             CFG_SEPARATE_DEBUG_INFO_NOCOPY="yes"
1620         else
1621             UNKNOWN_OPT=yes
1622         fi
1623         ;;
1624     reduce-exports)
1625         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1626             CFG_REDUCE_EXPORTS="$VAL"
1627         else
1628             UNKNOWN_OPT=yes
1629         fi
1630         ;;
1631     mmx)
1632         if [ "$VAL" = "no" ]; then
1633             CFG_MMX="$VAL"
1634         else
1635             UNKNOWN_OPT=yes
1636         fi
1637         ;;
1638     3dnow)
1639         if [ "$VAL" = "no" ]; then
1640             CFG_3DNOW="$VAL"
1641         else
1642             UNKNOWN_OPT=yes
1643         fi
1644         ;;
1645     sse)
1646         if [ "$VAL" = "no" ]; then
1647             CFG_SSE="$VAL"
1648         else
1649             UNKNOWN_OPT=yes
1650         fi
1651         ;;
1652     sse2)
1653         if [ "$VAL" = "no" ]; then
1654             CFG_SSE2="$VAL"
1655         else
1656             UNKNOWN_OPT=yes
1657         fi
1658         ;;
1659     sse3)
1660         if [ "$VAL" = "no" ]; then
1661             CFG_SSE3="$VAL"
1662         else
1663             UNKNOWN_OPT=yes
1664         fi
1665         ;;
1666     ssse3)
1667         if [ "$VAL" = "no" ]; then
1668             CFG_SSSE3="$VAL"
1669         else
1670             UNKNOWN_OPT=yes
1671         fi
1672         ;;
1673     sse4.1)
1674         if [ "$VAL" = "no" ]; then
1675             CFG_SSE4_1="$VAL"
1676         else
1677             UNKNOWN_OPT=yes
1678         fi
1679         ;;
1680     sse4.2)
1681         if [ "$VAL" = "no" ]; then
1682             CFG_SSE4_2="$VAL"
1683         else
1684             UNKNOWN_OPT=yes
1685         fi
1686         ;;
1687     avx)
1688         if [ "$VAL" = "no" ]; then
1689             CFG_AVX="$VAL"
1690         else
1691             UNKNOWN_OPT=yes
1692         fi
1693         ;;
1694     iwmmxt)
1695         CFG_IWMMXT="yes"
1696         ;;
1697     neon)
1698         if [ "$VAL" = "no" ]; then
1699             CFG_NEON="$VAL"
1700         else
1701             UNKNOWN_OPT=yes
1702         fi
1703         ;;
1704     reduce-relocations)
1705         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1706             CFG_REDUCE_RELOCATIONS="$VAL"
1707         else
1708             UNKNOWN_OPT=yes
1709         fi
1710         ;;
1711     freetype)
1712         [ "$VAL" = "qt" ] && VAL=yes
1713         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1714             CFG_QWS_FREETYPE="$VAL"
1715         else
1716             UNKNOWN_OPT=yes
1717         fi
1718         ;;
1719     zlib)
1720         [ "$VAL" = "qt" ] && VAL=yes
1721         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1722             CFG_ZLIB="$VAL"
1723         else
1724             UNKNOWN_OPT=yes
1725         fi
1726         # No longer supported:
1727         #[ "$VAL" = "no" ] && CFG_LIBPNG=no
1728         ;;
1729     s60)
1730         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1731             CFG_S60="$VAL"
1732         else
1733             UNKNOWN_OPT=yes
1734         fi
1735         ;;
1736     usedeffiles)
1737         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1738             CFG_SYMBIAN_DEFFILES="$VAL"
1739         else
1740             UNKNOWN_OPT=yes
1741         fi
1742         ;;
1743     sqlite)
1744         if [ "$VAL" = "system" ]; then
1745             CFG_SQLITE=system
1746         else
1747             UNKNOWN_OPT=yes
1748         fi
1749         ;;
1750     libpng)
1751         [ "$VAL" = "yes" ] && VAL=qt
1752         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1753             CFG_LIBPNG="$VAL"
1754         else
1755             UNKNOWN_OPT=yes
1756         fi
1757         ;;
1758     libjpeg)
1759         [ "$VAL" = "yes" ] && VAL=qt
1760         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1761             CFG_LIBJPEG="$VAL"
1762         else
1763             UNKNOWN_OPT=yes
1764         fi
1765         ;;
1766     libmng)
1767         [ "$VAL" = "yes" ] && VAL=qt
1768         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1769             CFG_LIBMNG="$VAL"
1770         else
1771             UNKNOWN_OPT=yes
1772         fi
1773         ;;
1774     libtiff)
1775         [ "$VAL" = "yes" ] && VAL=qt
1776         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1777             CFG_LIBTIFF="$VAL"
1778         else
1779             UNKNOWN_OPT=yes
1780         fi
1781         ;;
1782     nas-sound)
1783         if [ "$VAL" = "system" ] || [ "$VAL" = "no" ]; then
1784             CFG_NAS="$VAL"
1785         else
1786             UNKNOWN_OPT=yes
1787         fi
1788         ;;
1789     xcursor)
1790         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1791             CFG_XCURSOR="$VAL"
1792         else
1793             UNKNOWN_OPT=yes
1794         fi
1795         ;;
1796     xfixes)
1797         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1798             CFG_XFIXES="$VAL"
1799         else
1800             UNKNOWN_OPT=yes
1801         fi
1802         ;;
1803     xrandr)
1804         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1805             CFG_XRANDR="$VAL"
1806         else
1807             UNKNOWN_OPT=yes
1808         fi
1809         ;;
1810     xrender)
1811         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1812             CFG_XRENDER="$VAL"
1813         else
1814             UNKNOWN_OPT=yes
1815         fi
1816         ;;
1817     mitshm)
1818         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1819             CFG_MITSHM="$VAL"
1820         else
1821             UNKNOWN_OPT=yes
1822         fi
1823         ;;
1824     fontconfig)
1825         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1826             CFG_FONTCONFIG="$VAL"
1827         else
1828             UNKNOWN_OPT=yes
1829         fi
1830         ;;
1831     xkb)
1832         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1833             CFG_XKB="$VAL"
1834         else
1835             UNKNOWN_OPT=yes
1836         fi
1837         ;;
1838     cups)
1839         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1840             CFG_CUPS="$VAL"
1841         else
1842             UNKNOWN_OPT=yes
1843         fi
1844         ;;
1845     iconv)
1846         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1847             CFG_ICONV="$VAL"
1848         else
1849             UNKNOWN_OPT=yes
1850         fi
1851         ;;
1852     glib)
1853         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1854             CFG_GLIB="$VAL"
1855         else
1856             UNKNOWN_OPT=yes
1857         fi
1858         ;;
1859     gstreamer)
1860         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1861             CFG_GSTREAMER="$VAL"
1862         else
1863             UNKNOWN_OPT=yes
1864         fi
1865         ;;
1866     gtkstyle)
1867         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1868             CFG_QGTKSTYLE="$VAL"
1869         else
1870             UNKNOWN_OPT=yes
1871         fi
1872         ;;
1873     style-s60)
1874         if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ]; then
1875             CFG_QS60STYLE="$VAL"
1876         else
1877             UNKNOWN_OPT=yes
1878         fi
1879         ;;
1880     gui)
1881         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1882             CFG_GUI="yes"
1883         else
1884             if [ "$VAL" = "no" ]; then
1885                 CFG_GUI="no"
1886             else
1887                 UNKNOWN_OPT=yes
1888             fi
1889         fi
1890         ;;
1891     qdbus|dbus)
1892         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "linked" ]; then
1893             CFG_DBUS="$VAL"
1894         elif [ "$VAL" = "runtime" ]; then
1895             CFG_DBUS="yes"
1896         else
1897             UNKNOWN_OPT=yes
1898         fi
1899         ;;
1900     dbus-linked)
1901         if [ "$VAL" = "yes" ]; then
1902             CFG_DBUS="linked"
1903         else
1904             UNKNOWN_OPT=yes
1905         fi
1906         ;;
1907     nis)
1908         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1909             CFG_NIS="$VAL"
1910         else
1911             UNKNOWN_OPT=yes
1912         fi
1913         ;;
1914     largefile)
1915         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1916             CFG_LARGEFILE="$VAL"
1917         else
1918             UNKNOWN_OPT=yes
1919         fi
1920         ;;
1921     openssl)
1922         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1923             CFG_OPENSSL="$VAL"
1924         else
1925             UNKNOWN_OPT=yes
1926         fi
1927         ;;
1928     openssl-linked)
1929         if [ "$VAL" = "yes" ]; then
1930             CFG_OPENSSL="linked"
1931         else
1932             UNKNOWN_OPT=yes
1933         fi
1934         ;;
1935     ptmalloc)
1936         if [ "$VAL" = "yes" ]; then
1937             CFG_PTMALLOC="yes"
1938         else
1939             UNKNOWN_OPT=yes
1940         fi
1941         ;;
1942
1943     xmlpatterns)
1944         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1945             CFG_XMLPATTERNS="yes"
1946         else
1947             if [ "$VAL" = "no" ]; then
1948                 CFG_XMLPATTERNS="no"
1949             else
1950                 UNKNOWN_OPT=yes
1951             fi
1952         fi
1953         ;;
1954     script)
1955         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1956             CFG_SCRIPT="yes"
1957         else
1958             if [ "$VAL" = "no" ]; then
1959                 CFG_SCRIPT="no"
1960             else
1961                 UNKNOWN_OPT=yes
1962             fi
1963         fi
1964         ;;
1965     scripttools)
1966         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1967             CFG_SCRIPTTOOLS="yes"
1968         else
1969             if [ "$VAL" = "no" ]; then
1970                 CFG_SCRIPTTOOLS="no"
1971             else
1972                 UNKNOWN_OPT=yes
1973             fi
1974         fi
1975         ;;
1976     svg)
1977         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1978             CFG_SVG="yes"
1979         else
1980             if [ "$VAL" = "no" ]; then
1981                 CFG_SVG="no"
1982             else
1983                 UNKNOWN_OPT=yes
1984             fi
1985         fi
1986         ;;
1987     declarative)
1988         if [ "$VAL" = "yes" ]; then
1989             CFG_DECLARATIVE="yes"
1990         else
1991             if [ "$VAL" = "no" ]; then
1992                 CFG_DECLARATIVE="no"
1993             else
1994                 UNKNOWN_OPT=yes
1995             fi
1996         fi
1997         ;;
1998     declarative-debug)
1999         if [ "$VAL" = "yes" ]; then
2000             CFG_DECLARATIVE_DEBUG="yes"
2001         else
2002             if [ "$VAL" = "no" ]; then
2003                 CFG_DECLARATIVE_DEBUG="no"
2004             else
2005                 UNKNOWN_OPT=yes
2006             fi
2007         fi
2008         ;;
2009     webkit)
2010         [ "$VAL" = "auto" ] && VAL="yes"
2011         CFG_WEBKIT="$VAL"
2012         ;;
2013     javascript-jit)
2014         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then 
2015             CFG_JAVASCRIPTCORE_JIT="$VAL"
2016         else
2017             UNKNOWN_OPT=yes
2018         fi
2019         ;;
2020     confirm-license)
2021         if [ "$VAL" = "yes" ]; then
2022             OPT_CONFIRM_LICENSE="$VAL"
2023         else
2024             UNKNOWN_OPT=yes
2025         fi
2026         ;;
2027     h|help)
2028         if [ "$VAL" = "yes" ]; then
2029             OPT_HELP="$VAL"
2030         else
2031             UNKNOWN_OPT=yes
2032         fi
2033         ;;
2034     sql-*|gfx-*|decoration-*|kbd-*|mouse-*)
2035         # if Qt style options were used, $VAL can be "no", "qt", or "plugin"
2036         # if autoconf style options were used, $VAL can be "yes" or "no"
2037         [ "$VAL" = "yes" ] && VAL=qt
2038         # now $VAL should be "no", "qt", or "plugin"... double-check
2039         if [ "$VAL" != "no" ] && [ "$VAL" != "qt" ] && [ "$VAL" != "plugin" ]; then
2040             UNKNOWN_OPT=yes
2041         fi
2042         # now $VAL is "no", "qt", or "plugin"
2043         OPT="$VAL"
2044         VAL=`echo $VAR | sed "s,^[^-]*-\([^-]*\).*,\1,"`
2045         VAR=`echo $VAR | sed "s,^\([^-]*\).*,\1,"`
2046
2047         # Grab the available values
2048         case "$VAR" in
2049         sql)
2050             avail="$CFG_SQL_AVAILABLE"
2051             ;;
2052         gfx)
2053             avail="$CFG_GFX_AVAILABLE"
2054             if [ "$OPT" = "plugin" ]; then
2055                 avail="$CFG_GFX_PLUGIN_AVAILABLE"
2056             fi
2057             ;;
2058         decoration)
2059             avail="$CFG_DECORATION_AVAILABLE"
2060             if [ "$OPT" = "plugin" ]; then
2061                 avail="$CFG_DECORATION_PLUGIN_AVAILABLE"
2062             fi
2063             ;;
2064         kbd)
2065             avail="$CFG_KBD_AVAILABLE"
2066             if [ "$OPT" = "plugin" ]; then
2067                 avail="$CFG_KBD_PLUGIN_AVAILABLE"
2068             fi
2069             ;;
2070         mouse)
2071             avail="$CFG_MOUSE_AVAILABLE"
2072             if [ "$OPT" = "plugin" ]; then
2073                 avail="$CFG_MOUSE_PLUGIN_AVAILABLE"
2074             fi
2075             ;;
2076         *)
2077             avail=""
2078             echo "BUG: Unhandled type $VAR used in $CURRENT_OPT"
2079             ;;
2080         esac
2081
2082         # Check that that user's value is available.
2083         found=no
2084         for d in $avail; do
2085             if [ "$VAL" = "$d" ]; then
2086                 found=yes
2087                 break
2088             fi
2089         done
2090         [ "$found" = yes ] || ERROR=yes
2091
2092         if [ "$VAR" = "sql" ]; then
2093             # set the CFG_SQL_driver
2094             eval "CFG_SQL_$VAL=\$OPT"
2095             continue
2096         fi
2097
2098         if [ "$OPT" = "plugin" ] || [ "$OPT" = "qt" ]; then
2099             if [ "$OPT" = "plugin" ]; then
2100                 [ "$VAR" = "decoration" ] && QMakeVar del "${VAR}s" "$VAL"
2101                 [ "$VAR" = "decoration" ] && CFG_DECORATION_ON=`echo "${CFG_DECORATION_ON} " | sed "s,${VAL} ,,g"` && CFG_DECORATION_PLUGIN="$CFG_DECORATION_PLUGIN ${VAL}"
2102                 [ "$VAR" = "kbd" ] && QMakeVar del "${VAR}s" "$VAL"
2103                 [ "$VAR" = "kbd" ] && CFG_KBD_ON=`echo "${CFG_KBD_ON} " | sed "s,${VAL} ,,g"` && CFG_KBD_PLUGIN="$CFG_KBD_PLUGIN ${VAL}"
2104                 [ "$VAR" = "mouse" ] && QMakeVar del "${VAR}s" "$VAL"
2105                 [ "$VAR" = "mouse" ] && CFG_MOUSE_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"` && CFG_MOUSE_PLUGIN="$CFG_MOUSE_PLUGIN ${VAL}"
2106                 [ "$VAR" = "gfx" ] && QMakeVar del "${VAR}s" "$VAL"
2107                 [ "$VAR" = "gfx" ] && CFG_GFX_ON=`echo "${CFG_GFX_ON} " | sed "s,${VAL} ,,g"` && CFG_GFX_PLUGIN="${CFG_GFX_PLUGIN} ${VAL}"
2108                 VAR="${VAR}-${OPT}"
2109             else
2110                 if [ "$VAR" = "gfx" ] || [ "$VAR" = "kbd" ] || [ "$VAR" = "decoration" ] || [ "$VAR" = "mouse" ]; then
2111                     [ "$VAR" = "gfx" ] && CFG_GFX_ON="$CFG_GFX_ON $VAL"
2112                     [ "$VAR" = "kbd" ] && CFG_KBD_ON="$CFG_KBD_ON $VAL"
2113                     [ "$VAR" = "decoration" ] && CFG_DECORATION_ON="$CFG_DECORATION_ON $VAL"
2114                     [ "$VAR" = "mouse" ] && CFG_MOUSE_ON="$CFG_MOUSE_ON $VAL"
2115                     VAR="${VAR}-driver"
2116                 fi
2117             fi
2118             QMakeVar add "${VAR}s" "${VAL}"
2119         elif [ "$OPT" = "no" ]; then
2120             PLUG_VAR="${VAR}-plugin"
2121             if [ "$VAR" = "gfx" ] || [ "$VAR" = "kbd" ] || [ "$VAR" = "mouse" ]; then
2122                 IN_VAR="${VAR}-driver"
2123             else
2124                 IN_VAR="${VAR}"
2125             fi
2126             [ "$VAR" = "decoration" ] && CFG_DECORATION_ON=`echo "${CFG_DECORATION_ON} " | sed "s,${VAL} ,,g"`
2127             [ "$VAR" = "gfx" ] && CFG_GFX_ON=`echo "${CFG_GFX_ON} " | sed "s,${VAL} ,,g"`
2128             [ "$VAR" = "kbd" ] && CFG_KBD_ON=`echo "${CFG_KBD_ON} " | sed "s,${VAL} ,,g"`
2129             [ "$VAR" = "mouse" ] && CFG_MOUSE_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"`
2130             QMakeVar del "${IN_VAR}s" "$VAL"
2131             QMakeVar del "${PLUG_VAR}s" "$VAL"
2132         fi
2133         if [ "$ERROR" = "yes" ]; then
2134            echo "$CURRENT_OPT: unknown argument"
2135            OPT_HELP=yes
2136         fi
2137         ;;
2138     v|verbose)
2139         if [ "$VAL" = "yes" ]; then
2140             if [ "$OPT_VERBOSE" = "$VAL" ]; then            # takes two verboses to turn on qmake debugs
2141                 QMAKE_SWITCHES="$QMAKE_SWITCHES -d"
2142             else
2143                 OPT_VERBOSE=yes
2144             fi
2145         elif [ "$VAL" = "no" ]; then
2146             if [ "$OPT_VERBOSE" = "$VAL" ] && echo "$QMAKE_SWITCHES" | grep ' -d' >/dev/null 2>&1; then
2147                 QMAKE_SWITCHES=`echo $QMAKE_SWITCHES | sed "s, -d,,"`
2148             else
2149                 OPT_VERBOSE=no
2150             fi
2151         else
2152             UNKNOWN_OPT=yes
2153         fi
2154         ;;
2155     fast)
2156         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2157             OPT_FAST="$VAL"
2158         else
2159             UNKNOWN_OPT=yes
2160         fi
2161         ;;
2162     rpath)
2163         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2164             CFG_RPATH="$VAL"
2165         else
2166             UNKNOWN_OPT=yes
2167         fi
2168         ;;
2169     add_define)
2170         D_FLAGS="$D_FLAGS \"$VAL\""
2171         ;;
2172     add_ipath)
2173         I_FLAGS="$I_FLAGS -I\"${VAL}\""
2174         ;;
2175     add_lpath)
2176         L_FLAGS="$L_FLAGS -L\"${VAL}\""
2177         ;;
2178     add_rpath)
2179         RPATH_FLAGS="$RPATH_FLAGS \"${VAL}\""
2180         ;;
2181     add_link)
2182         l_FLAGS="$l_FLAGS -l\"${VAL}\""
2183         ;;
2184     add_fpath)
2185         if [ "$PLATFORM_MAC" = "yes" ]; then
2186             L_FLAGS="$L_FLAGS -F\"${VAL}\""
2187             I_FLAGS="$I_FLAGS -F\"${VAL}\""
2188         else
2189             UNKNOWN_OPT=yes
2190         fi
2191         ;;
2192     add_framework)
2193         if [ "$PLATFORM_MAC" = "yes" ]; then
2194             l_FLAGS="$l_FLAGS -framework \"${VAL}\""
2195         else
2196             UNKNOWN_OPT=yes
2197         fi
2198         ;;
2199     silent)
2200         CFG_SILENT="$VAL"
2201         ;;
2202     phonon)
2203         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2204             CFG_PHONON="$VAL"
2205         else
2206             UNKNOWN_OPT=yes
2207         fi
2208         ;;
2209     phonon-backend)
2210         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2211             CFG_PHONON_BACKEND="$VAL"
2212         else
2213             UNKNOWN_OPT=yes
2214         fi
2215         ;;
2216     multimedia)
2217         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2218             CFG_MULTIMEDIA="$VAL"
2219         else
2220             UNKNOWN_OPT=yes
2221         fi
2222         ;;
2223     dont-process)
2224         CFG_NOPROCESS=yes
2225         ;;
2226     process)
2227         CFG_NOPROCESS=no
2228         ;;
2229     audio-backend)
2230         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2231             CFG_AUDIO_BACKEND="$VAL"
2232         else
2233             UNKNOWN_OPT=yes
2234         fi
2235         ;;
2236     fpu)
2237        if [ "$VAL" != "no" ]; then
2238           QT_CFLAGS_FPU=$VAL
2239        fi
2240        ;;
2241     *)
2242         UNKNOWN_OPT=yes
2243         ;;
2244     esac
2245     if [ "$UNKNOWN_OPT" = "yes" ]; then
2246         echo "${CURRENT_OPT}: invalid command-line switch"
2247         OPT_HELP=yes
2248         ERROR=yes
2249     fi
2250 done
2251
2252 if [ "$CFG_QCONFIG" != "full" ] && [ "$CFG_QT3SUPPORT" = "yes" ]; then
2253     echo "Warning: '-qconfig $CFG_QCONFIG' will disable the qt3support library."
2254     CFG_QT3SUPPORT="no"
2255 fi
2256 if [ "$CFG_GUI" = "no" ]; then
2257     echo "Warning: -no-gui will disable the qt3support library."
2258     CFG_QT3SUPPORT="no"
2259 fi
2260
2261 # update QT_CONFIG to show our current predefined configuration
2262 case "$CFG_QCONFIG" in
2263 minimal|small|medium|large|full)
2264     # these are a sequence of increasing functionality
2265     for c in minimal small medium large full; do
2266         QT_CONFIG="$QT_CONFIG $c-config"
2267         [ "$CFG_QCONFIG" = $c ] && break
2268     done
2269     ;;
2270 *)
2271     # not known to be sufficient for anything
2272     if [ '!' -f "$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h" ] && [ '!' -f `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` ]; then
2273         echo >&2 "Error: configuration file not found:"
2274         echo >&2 "  $relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h"
2275         echo >&2 "  or"
2276         echo >&2 "  `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"`"
2277         OPT_HELP=yes
2278     fi
2279 esac
2280
2281 #-------------------------------------------------------------------------------
2282 # build tree initialization
2283 #-------------------------------------------------------------------------------
2284
2285 # where to find which..
2286 unixtests="$relpath/config.tests/unix"
2287 mactests="$relpath/config.tests/mac"
2288 symbiantests="$relpath/config.tests/symbian"
2289 WHICH="$unixtests/which.test"
2290
2291 PERL=`$WHICH perl 2>/dev/null`
2292
2293 # find out which awk we want to use, prefer gawk, then nawk, then regular awk
2294 AWK=
2295 for e in gawk nawk awk; do
2296     if "$WHICH" $e >/dev/null 2>&1 && ( $e -f /dev/null /dev/null ) >/dev/null 2>&1; then
2297         AWK=$e
2298         break
2299     fi
2300 done
2301
2302 # find perl
2303 PERL="/usr/bin/perl"
2304 if "$WHICH" perl >/dev/null 2>&1 && ( perl /dev/null ) >/dev/null 2>&1; then
2305     PERL=`$WHICH perl`
2306 fi
2307
2308 ### skip this if the user just needs help...
2309 if [ "$OPT_HELP" != "yes" ]; then
2310
2311 # is this a shadow build?
2312 if [ "$OPT_SHADOW" = "maybe" ]; then
2313     OPT_SHADOW=no
2314     if [ "$relpath" != "$outpath" ] && [ '!' -f "$outpath/configure" ]; then
2315         if [ -h "$outpath" ]; then
2316             [ "$relpath" -ef "$outpath" ] || OPT_SHADOW=yes
2317         else
2318             OPT_SHADOW=yes
2319         fi
2320     fi
2321 fi
2322 if [ "$OPT_SHADOW" = "yes" ]; then
2323     if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" -o -f "$relpath/src/corelib/global/qconfig.cpp" ]; then
2324         echo >&2 "You cannot make a shadow build from a source tree containing a previous build."
2325         echo >&2 "Cannot proceed."
2326         exit 1
2327     fi
2328     [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..."
2329 fi
2330
2331 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
2332     echo
2333     echo "WARNING: -debug-and-release is not supported anymore on Qt/X11 and Qt for Embedded Linux"
2334     echo "Qt can be built in release mode with separate debug information, so"
2335     echo "-debug-and-release is not necessary anymore"
2336     echo
2337 fi
2338
2339 # detect build style
2340 if [ "$CFG_DEBUG" = "auto" ]; then
2341     if [ "$PLATFORM_MAC" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
2342         CFG_DEBUG_RELEASE=yes
2343         CFG_DEBUG=yes
2344     elif [ "$CFG_DEV" = "yes" ]; then
2345         CFG_DEBUG_RELEASE=no
2346         CFG_DEBUG=yes
2347     else
2348         CFG_DEBUG_RELEASE=no
2349         CFG_DEBUG=no
2350     fi
2351 fi
2352 if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
2353     QMAKE_CONFIG="$QMAKE_CONFIG build_all"
2354 fi
2355
2356 if [ "$CFG_SILENT" = "yes" ]; then
2357     QMAKE_CONFIG="$QMAKE_CONFIG silent"
2358 fi
2359
2360 # if the source tree is different from the build tree,
2361 # symlink or copy part of the sources
2362 if [ "$OPT_SHADOW" = "yes" ]; then
2363     echo "Preparing build tree..."
2364
2365     if [ -z "$PERL" ]; then
2366         echo
2367         echo "You need perl in your PATH to make a shadow build."
2368         echo "Cannot proceed."
2369         exit 1
2370     fi
2371
2372     [ -d "$outpath/bin" ] || mkdir -p "$outpath/bin"
2373
2374     # symlink the qmake directory
2375     find "$relpath/qmake" | while read a; do
2376         my_a=`echo "$a" | sed "s,^${relpath}/,${outpath}/,"`
2377         if [ '!' -f "$my_a" ]; then
2378             if [ -d "$a" ]; then
2379                 # directories are created...
2380                 mkdir -p "$my_a"
2381             else
2382                 a_dir=`dirname "$my_a"`
2383                 [ -d "$a_dir" ] || mkdir -p "$a_dir"
2384                 # ... and files are symlinked
2385                 case `basename "$a"` in
2386                 *.o|*.d|GNUmakefile*|qmake)
2387                     ;;
2388                 *)
2389                     rm -f "$my_a"
2390                     ln -s "$a" "$my_a"
2391                     ;;
2392                 esac
2393             fi
2394         fi
2395     done
2396
2397     # make a syncqt script that can be used in the shadow
2398     rm -f "$outpath/bin/syncqt"
2399     if [ -x "$relpath/bin/syncqt" ]; then
2400         mkdir -p "$outpath/bin"
2401         echo "#!/bin/sh" >"$outpath/bin/syncqt"
2402         echo "QTDIR=\"$relpath\"; export QTDIR" >>"$outpath/bin/syncqt"
2403         echo "perl \"$relpath/bin/syncqt\" -outdir \"$outpath\" \"\$@\"" >>"$outpath/bin/syncqt"
2404         chmod 755 "$outpath/bin/syncqt"
2405     fi
2406
2407     for i in elf2e32_qtwrapper createpackage patch_capabilities; do
2408         rm -f "$outpath/bin/$i"
2409         if [ -x "$relpath/bin/$i" ]; then
2410             mkdir -p "$outpath/bin"
2411             echo "#!/bin/sh" >"$outpath/bin/$i"
2412             echo "QTDIR=\"$relpath\"; export QTDIR" >>"$outpath/bin/$i"
2413             echo "\"$relpath/bin/$i\" \"\$@\"" >>"$outpath/bin/$i"
2414             chmod 755 "$outpath/bin/$i"
2415         fi
2416     done
2417
2418     # symlink the mkspecs directory
2419     mkdir -p "$outpath/mkspecs"
2420     rm -rf "$outpath"/mkspecs/*
2421     ln -s "$relpath"/mkspecs/* "$outpath/mkspecs"
2422     rm -f "$outpath/mkspecs/default"
2423
2424     ShadowMkspecs()
2425     {
2426         rm -rf "$outpath/mkspecs/$1"
2427         find "$relpath/mkspecs/$1" -type d | sed "s,^$relpath,$outpath," | xargs mkdir -p
2428         find "$relpath/mkspecs/$1" -type f | sed "s,^$relpath/,," | while read f; do ln -s "$relpath/$f" "$outpath/$f"; done
2429     }
2430
2431     # Special case for mkspecs/features directory.
2432     # To be able to place .prf files into a shadow build directory,
2433     # we're creating links for files only. The directory structure is reproduced.
2434     ShadowMkspecs features
2435
2436     # The modules dir is special, too.
2437     ShadowMkspecs modules
2438
2439     # symlink the doc directory
2440     rm -rf "$outpath/doc"
2441     ln -s "$relpath/doc" "$outpath/doc"
2442
2443     # make sure q3porting.xml can be found
2444     mkdir -p "$outpath/tools/porting/src"
2445     rm -f "$outpath/tools/porting/src/q3porting.xml"
2446     ln -s "$relpath/tools/porting/src/q3porting.xml" "$outpath/tools/porting/src"
2447 fi
2448
2449 # symlink fonts to be able to run application from build directory
2450 if [ "$PLATFORM_QWS" = "yes" ] && [ ! -d "${outpath}/lib/fonts" ]; then
2451     if [ "$PLATFORM" = "$XPLATFORM" ]; then
2452         mkdir -p "${outpath}/lib"
2453         ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts"
2454     fi
2455 fi
2456
2457 if [ "$OPT_FAST" = "auto" ]; then
2458    if [ '!' -z "$AWK" ] && [ "$CFG_DEV" = "yes" ]; then
2459        OPT_FAST=yes
2460    else
2461        OPT_FAST=no
2462    fi
2463 fi
2464
2465 # find a make command
2466 if [ -z "$MAKE" ]; then
2467     MAKE=
2468     for mk in gmake make; do
2469         if "$WHICH" $mk >/dev/null 2>&1; then
2470             MAKE=`"$WHICH" $mk`
2471             break
2472         fi
2473     done
2474     if [ -z "$MAKE" ]; then
2475         echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH."
2476         echo >&2 "Cannot proceed."
2477         exit 1
2478     fi
2479     # export MAKE, we need it later in the config.tests
2480     export MAKE
2481 fi
2482
2483 fi ### help
2484
2485 #-------------------------------------------------------------------------------
2486 # auto-detect all that hasn't been specified in the arguments
2487 #-------------------------------------------------------------------------------
2488
2489 [ "$PLATFORM_QWS" = "yes" -a "$CFG_EMBEDDED" = "no" ] && CFG_EMBEDDED=auto
2490 if [ "$CFG_EMBEDDED" != "no" ]; then
2491     case "$UNAME_SYSTEM:$UNAME_RELEASE" in
2492     Darwin:*)
2493         [ -z "$PLATFORM" ] && PLATFORM=qws/macx-generic-g++
2494         if [ -z "$XPLATFORM" ]; then
2495             [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2496             XPLATFORM="qws/macx-$CFG_EMBEDDED-g++"
2497         fi
2498         ;;
2499     FreeBSD:*)
2500         [ -z "$PLATFORM" ] && PLATFORM=qws/freebsd-generic-g++
2501         if [ -z "$XPLATFORM" ]; then
2502             [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2503             XPLATFORM="qws/freebsd-$CFG_EMBEDDED-g++"
2504         fi
2505         ;;
2506     SunOS:5*)
2507         [ -z "$PLATFORM" ] && PLATFORM=qws/solaris-generic-g++
2508         if [ -z "$XPLATFORM" ]; then
2509             [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2510             XPLATFORM="qws/solaris-$CFG_EMBEDDED-g++"
2511         fi
2512         ;;
2513     Linux:*)
2514         if [ -z "$PLATFORM" ]; then
2515             case "$UNAME_MACHINE" in
2516             *86)
2517                 PLATFORM=qws/linux-x86-g++
2518                 ;;
2519             *86_64)
2520                 PLATFORM=qws/linux-x86_64-g++
2521                 ;;
2522             *)
2523                 PLATFORM=qws/linux-generic-g++
2524                 ;;
2525             esac
2526         fi
2527         if [ -z "$XPLATFORM" ]; then
2528             if [ "$CFG_EMBEDDED" = "auto" ]; then
2529                 if [ -n "$CFG_ARCH" ]; then
2530                     CFG_EMBEDDED=$CFG_ARCH
2531                 else
2532                     case "$UNAME_MACHINE" in
2533                     *86)
2534                         CFG_EMBEDDED=x86
2535                         ;;
2536                     *86_64)
2537                         CFG_EMBEDDED=x86_64
2538                         ;;
2539                     *)
2540                         CFG_EMBEDDED=generic
2541                         ;;
2542                     esac
2543                 fi
2544             fi
2545             XPLATFORM="qws/linux-$CFG_EMBEDDED-g++"
2546         fi
2547         ;;
2548     QNX:*)
2549         [ -z "$PLATFORM" ] && PLATFORM=unsupported/qws/qnx-generic-g++
2550         if [ -z "$XPLATFORM" ]; then
2551             [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2552             XPLATFORM="unsupported/qws/qnx-$CFG_EMBEDDED-g++"
2553         fi
2554         ;;
2555     CYGWIN*:*)
2556         if [ -z "$XPLATFORM" ]; then
2557                 CFG_EMBEDDED=x86
2558         fi
2559         ;;
2560     *)
2561         echo "Qt for Embedded Linux is not supported on this platform. Disabling."
2562         CFG_EMBEDDED=no
2563         PLATFORM_QWS=no
2564         ;;
2565     esac
2566 fi
2567 if [ -z "$PLATFORM" ]; then
2568     PLATFORM_NOTES=
2569     case "$UNAME_SYSTEM:$UNAME_RELEASE" in
2570      Darwin:*)
2571         if [ "$PLATFORM_MAC" = "yes" ]; then
2572           PLATFORM=macx-g++
2573         # PLATFORM=macx-xcode
2574         else
2575           PLATFORM=darwin-g++
2576         fi
2577         ;;
2578      AIX:*)
2579         #PLATFORM=aix-g++
2580         #PLATFORM=aix-g++-64
2581         PLATFORM=aix-xlc
2582         #PLATFORM=aix-xlc-64
2583         PLATFORM_NOTES="
2584             - Also available for AIX: aix-g++ aix-g++-64 aix-xlc-64
2585         "
2586         ;;
2587      GNU:*)
2588         PLATFORM=hurd-g++
2589         ;;
2590      dgux:*)
2591         PLATFORM=dgux-g++
2592         ;;
2593 #     DYNIX/ptx:4*)
2594 #       PLATFORM=dynix-g++
2595 #       ;;
2596      ULTRIX:*)
2597         PLATFORM=ultrix-g++
2598         ;;
2599      FreeBSD:*)
2600         PLATFORM=freebsd-g++
2601         PLATFORM_NOTES="
2602             - Also available for FreeBSD: freebsd-icc
2603         "
2604         ;;
2605      OpenBSD:*)
2606         PLATFORM=openbsd-g++
2607         ;;
2608      NetBSD:*)
2609         PLATFORM=netbsd-g++
2610         ;;
2611      BSD/OS:*|BSD/386:*)
2612         PLATFORM=bsdi-g++
2613         ;;
2614      IRIX*:*)
2615         #PLATFORM=irix-g++
2616         PLATFORM=irix-cc
2617         #PLATFORM=irix-cc-64
2618         PLATFORM_NOTES="
2619             - Also available for IRIX: irix-g++ irix-cc-64
2620         "
2621         ;;
2622      HP-UX:*)
2623         case "$UNAME_MACHINE" in
2624             ia64)
2625                 #PLATFORM=hpuxi-acc-32
2626                 PLATFORM=hpuxi-acc-64
2627                 PLATFORM_NOTES="
2628                     - Also available for HP-UXi: hpuxi-acc-32
2629                 "
2630             ;;
2631             *)
2632                 #PLATFORM=hpux-g++
2633                 PLATFORM=hpux-acc
2634                 #PLATFORM=hpux-acc-64
2635                 #PLATFORM=hpux-cc
2636                 #PLATFORM=hpux-acc-o64
2637                 PLATFORM_NOTES="
2638                     - Also available for HP-UX: hpux-g++ hpux-acc-64 hpux-acc-o64
2639                 "
2640             ;;
2641         esac
2642         ;;
2643      OSF1:*)
2644         #PLATFORM=tru64-g++
2645         PLATFORM=tru64-cxx
2646         PLATFORM_NOTES="
2647             - Also available for Tru64: tru64-g++
2648         "
2649         ;;
2650      Linux:*)
2651         case "$UNAME_MACHINE" in
2652             x86_64|s390x|ppc64)
2653                 PLATFORM=linux-g++-64
2654                 ;;
2655             *)
2656                 PLATFORM=linux-g++
2657                 ;;
2658         esac
2659         PLATFORM_NOTES="
2660             - Also available for Linux: linux-kcc linux-icc linux-cxx
2661         "
2662         ;;
2663      SunOS:5*)
2664         if [ "$XPLATFORM_MINGW" = "yes" ]; then
2665             PLATFORM="solaris-g++"
2666         else
2667             #PLATFORM=solaris-g++
2668             PLATFORM=solaris-cc
2669             #PLATFORM=solaris-cc64
2670         fi
2671         PLATFORM_NOTES="
2672             - Also available for Solaris: solaris-g++ solaris-cc-64
2673         "
2674         ;;
2675      ReliantUNIX-*:*|SINIX-*:*)
2676         PLATFORM=reliant-cds
2677         #PLATFORM=reliant-cds-64
2678         PLATFORM_NOTES="
2679             - Also available for Reliant UNIX: reliant-cds-64
2680         "
2681         ;;
2682      CYGWIN*:*)
2683         PLATFORM=cygwin-g++
2684         ;;
2685      LynxOS*:*)
2686         PLATFORM=lynxos-g++
2687         ;;
2688      OpenUNIX:*)
2689         #PLATFORM=unixware-g++
2690         PLATFORM=unixware-cc
2691         PLATFORM_NOTES="
2692             - Also available for OpenUNIX: unixware-g++
2693         "
2694         ;;
2695      UnixWare:*)
2696         #PLATFORM=unixware-g++
2697         PLATFORM=unixware-cc
2698         PLATFORM_NOTES="
2699             - Also available for UnixWare: unixware-g++
2700         "
2701         ;;
2702      SCO_SV:*)
2703         #PLATFORM=sco-g++
2704         PLATFORM=sco-cc
2705         PLATFORM_NOTES="
2706             - Also available for SCO OpenServer: sco-g++
2707         "
2708         ;;
2709      UNIX_SV:*)
2710         PLATFORM=unixware-g++
2711         ;;
2712      QNX:*)
2713         PLATFORM=unsupported/qnx-g++
2714         ;;
2715      *)
2716         if [ "$OPT_HELP" != "yes" ]; then
2717             echo
2718             for p in $PLATFORMS; do
2719                 echo "    $relconf $* -platform $p"
2720             done
2721             echo >&2
2722             echo "   The build script does not currently recognize all" >&2
2723             echo "   platforms supported by Qt." >&2
2724             echo "   Rerun this script with a -platform option listed to" >&2
2725             echo "   set the system/compiler combination you use." >&2
2726             echo >&2
2727             exit 2
2728         fi
2729     esac
2730 fi
2731
2732 if [ "$PLATFORM_QWS" = "yes" ]; then
2733     CFG_SM=no
2734     PLATFORMS=`find "$relpath/mkspecs/qws" | sed "s,$relpath/mkspecs/qws/,,"`
2735 else
2736     PLATFORMS=`find "$relpath/mkspecs/" -type f | grep -v qws | sed "s,$relpath/mkspecs/qws/,,"`
2737 fi
2738
2739 [ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM"
2740
2741 case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac
2742 case "$XPLATFORM" in *symbian*) XPLATFORM_SYMBIAN=yes;; esac
2743 case "$XPLATFORM" in symbian-sbsv2) XPLATFORM_SYMBIAN_SBSV2=yes;; esac
2744
2745 if [ -d "$PLATFORM" ]; then
2746   QMAKESPEC="$PLATFORM"
2747 else
2748   QMAKESPEC="$relpath/mkspecs/${PLATFORM}"
2749 fi
2750 if [ -d "$XPLATFORM" ]; then
2751   XQMAKESPEC="$XPLATFORM"
2752 else
2753   XQMAKESPEC="$relpath/mkspecs/${XPLATFORM}"
2754 fi
2755 if [ "$PLATFORM" != "$XPLATFORM" ]; then
2756     QT_CROSS_COMPILE=yes
2757     QMAKE_CONFIG="$QMAKE_CONFIG cross_compile"
2758 fi
2759
2760 if [ "$PLATFORM_MAC" = "yes" ]; then
2761    if [ `basename $QMAKESPEC` = "macx-xcode" ] || [ `basename $XQMAKESPEC` = "macx-xcode" ]; then
2762       echo >&2
2763       echo "   Platform 'macx-xcode' should not be used when building Qt/Mac." >&2
2764       echo "   Please build Qt/Mac with 'macx-g++', then if you would like to" >&2
2765       echo "   use mac-xcode on your application code it can link to a Qt/Mac" >&2
2766       echo "   built with 'macx-g++'" >&2
2767       echo >&2
2768       exit 2
2769     fi
2770 fi
2771
2772 # check specified platforms are supported
2773 if [ '!' -d "$QMAKESPEC" ]; then
2774     echo
2775     echo "   The specified system/compiler is not supported:"
2776     echo
2777     echo "      $QMAKESPEC"
2778     echo
2779     echo "   Please see the README file for a complete list."
2780     echo
2781     exit 2
2782 fi
2783 if [ '!' -d "$XQMAKESPEC" ]; then
2784     echo
2785     echo "   The specified system/compiler is not supported:"
2786     echo
2787     echo "      $XQMAKESPEC"
2788     echo
2789     echo "   Please see the README file for a complete list."
2790     echo
2791     exit 2
2792 fi
2793 if [ '!' -f "${XQMAKESPEC}/qplatformdefs.h" ]; then
2794     echo
2795     echo "   The specified system/compiler port is not complete:"
2796     echo
2797     echo "      $XQMAKESPEC/qplatformdefs.h"
2798     echo
2799     echo "   Please contact qt-bugs@trolltech.com."
2800     echo
2801     exit 2
2802 fi
2803
2804 # now look at the configs and figure out what platform we are config'd for
2805 [ "$CFG_EMBEDDED" = "no" ] \
2806   && [ '!' -z "`getQMakeConf \"$XQMAKESPEC\" | grep QMAKE_LIBS_X11 | awk '{print $3;}'`" ] \
2807   && PLATFORM_X11=yes
2808 ### echo "$XQMAKESPEC" | grep mkspecs/qws >/dev/null 2>&1 && PLATFORM_QWS=yes
2809
2810 if [ "$UNAME_SYSTEM" = "SunOS" ]; then
2811     # Solaris 2.5 and 2.6 have libposix4, which was renamed to librt for Solaris 7 and up
2812     if echo $UNAME_RELEASE | grep "^5\.[5|6]" >/dev/null 2>&1; then
2813         sed -e "s,-lrt,-lposix4," "$XQMAKESPEC/qmake.conf" > "$XQMAKESPEC/qmake.conf.new"
2814         mv "$XQMAKESPEC/qmake.conf.new" "$XQMAKESPEC/qmake.conf"
2815     fi
2816 fi
2817
2818 #-------------------------------------------------------------------------------
2819 # determine the system architecture
2820 #-------------------------------------------------------------------------------
2821 if [ "$OPT_VERBOSE" = "yes" ]; then
2822     echo "Determining system architecture... ($UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_MACHINE)"
2823 fi
2824
2825 if [ "$CFG_EMBEDDED" != "no" -a "$CFG_EMBEDDED" != "auto" ] && [ -n "$CFG_ARCH" ]; then
2826     if [ "$CFG_ARCH" != "$CFG_EMBEDDED" ]; then
2827         echo ""
2828         echo "You have specified a target architecture with -embedded and -arch."
2829         echo "The two architectures you have specified are different, so we can"
2830         echo "not proceed. Either set both to be the same, or only use -embedded."
2831         echo ""
2832         exit 1
2833     fi
2834 fi
2835
2836 if [ "$CFG_RTOS_ENABLED" = "no" ]; then
2837     case `basename "$XPLATFORM"` in
2838         qnx-* | vxworks-*)
2839             echo ""
2840             echo "You are not licensed for Qt for `basename $XPLATFORM`."
2841             echo ""
2842             echo "Please contact qt-info@nokia.com to upgrade your license to"
2843             echo "include this platform, or install the Qt Open Source Edition"
2844             echo "if you intend to develop free software."
2845             exit 1
2846             ;;
2847     esac
2848 fi
2849
2850 if [ -z "${CFG_HOST_ARCH}" ]; then
2851     case "$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_MACHINE" in
2852     GNU:*:*)
2853         CFG_HOST_ARCH=`echo ${UNAME_MACHINE} | sed -e 's,[-/].*$,,'`
2854         case "$CFG_HOST_ARCH" in
2855             i?86)
2856                 CFG_HOST_ARCH=i386
2857                 ;;
2858         esac
2859         if [ "$OPT_VERBOSE" = "yes" ]; then
2860             echo "    GNU/Hurd ($CFG_HOST_ARCH)"
2861         fi
2862         ;;
2863     IRIX*:*:*)
2864         CFG_HOST_ARCH=`uname -p`
2865         if [ "$OPT_VERBOSE" = "yes" ]; then
2866             echo "    SGI ($CFG_HOST_ARCH)"
2867         fi
2868         ;;
2869     SunOS:5*:*)
2870         case "$UNAME_MACHINE" in
2871         sun4u*|sun4v*)
2872             if [ "$OPT_VERBOSE" = "yes" ]; then
2873                 echo "    Sun SPARC (sparc)"
2874             fi
2875             CFG_HOST_ARCH=sparc
2876             ;;
2877         i86pc)
2878             case "$PLATFORM" in
2879             *-64*)
2880                 if [ "$OPT_VERBOSE" = "yes" ]; then
2881                     echo "    64-bit AMD 80x86 (x86_64)"
2882                 fi
2883                 CFG_HOST_ARCH=x86_64
2884                 ;;
2885             *)
2886                 if [ "$OPT_VERBOSE" = "yes" ]; then
2887                     echo "    32-bit Intel 80x86 (i386)"
2888                 fi
2889                 CFG_HOST_ARCH=i386
2890                 ;;
2891             esac
2892         esac
2893         ;;
2894     Darwin:*:*)
2895         case "$UNAME_MACHINE" in
2896             Power?Macintosh)
2897                 if [ "$OPT_VERBOSE" = "yes" ]; then
2898                     echo "    32-bit Apple PowerPC (powerpc)"
2899                 fi
2900                 ;;
2901             x86)
2902                 if [ "$OPT_VERBOSE" = "yes" ]; then
2903                     echo "    32-bit Intel 80x86 (i386)"
2904                 fi
2905                 ;;
2906         esac
2907         CFG_HOST_ARCH=macosx
2908         ;;
2909     AIX:*:00????????00)
2910         if [ "$OPT_VERBOSE" = "yes" ]; then
2911         echo "    64-bit IBM PowerPC (powerpc)"
2912         fi
2913         CFG_HOST_ARCH=powerpc
2914         ;;
2915     HP-UX:*:9000*)
2916         if [ "$OPT_VERBOSE" = "yes" ]; then
2917             echo "    HP PA-RISC (parisc)"
2918         fi
2919         CFG_HOST_ARCH=parisc
2920         ;;
2921     *:*:i?86)
2922         if [ "$OPT_VERBOSE" = "yes" ]; then
2923             echo "    32-bit Intel 80x86 (i386)"
2924         fi
2925         CFG_HOST_ARCH=i386
2926         ;;
2927     *:*:x86_64|*:*:amd64)
2928         if [ "$PLATFORM" = "linux-g++-32" -o "$PLATFORM" = "linux-icc-32" ]; then
2929             if [ "$OPT_VERBOSE" = "yes" ]; then
2930                 echo "    32 bit on 64-bit AMD 80x86 (i386)"
2931             fi
2932             CFG_HOST_ARCH=i386
2933         else
2934             if [ "$OPT_VERBOSE" = "yes" ]; then
2935                 echo "    64-bit AMD 80x86 (x86_64)"
2936             fi
2937             CFG_HOST_ARCH=x86_64
2938         fi
2939         ;;
2940     *:*:ppc)
2941         if [ "$OPT_VERBOSE" = "yes" ]; then
2942             echo "    32-bit PowerPC (powerpc)"
2943         fi
2944         CFG_HOST_ARCH=powerpc
2945         ;;
2946     *:*:ppc64)
2947         if [ "$OPT_VERBOSE" = "yes" ]; then
2948             echo "    64-bit PowerPC (powerpc)"
2949         fi
2950         CFG_HOST_ARCH=powerpc
2951         ;;
2952     *:*:s390*)
2953         if [ "$OPT_VERBOSE" = "yes" ]; then
2954             echo "    IBM S/390 (s390)"
2955         fi
2956         CFG_HOST_ARCH=s390
2957         ;;
2958     *:*:arm*)
2959         if [ "$OPT_VERBOSE" = "yes" ]; then
2960             echo "    ARM (arm)"
2961         fi
2962         CFG_HOST_ARCH=arm
2963         ;;
2964     Linux:*:sparc*)
2965         if [ "$OPT_VERBOSE" = "yes" ]; then
2966             echo "    Linux on SPARC"
2967         fi
2968         CFG_HOST_ARCH=sparc
2969         ;;
2970     QNX:*:*)
2971         case "$UNAME_MACHINE" in
2972         x86pc)
2973             if [ "$OPT_VERBOSE" = "yes" ]; then
2974                 echo "    QNX on Intel 80x86 (i386)"
2975             fi
2976             CFG_HOST_ARCH=i386
2977             ;;
2978         esac
2979         ;;
2980     *:*:*)
2981         if [ "$OPT_VERBOSE" = "yes" ]; then
2982             echo "    Trying '$UNAME_MACHINE'..."
2983         fi
2984         CFG_HOST_ARCH="$UNAME_MACHINE"
2985         ;;
2986     esac
2987 fi
2988
2989 if [ "$PLATFORM" != "$XPLATFORM" -a "$CFG_EMBEDDED" != "no" ]; then
2990     if [ -n "$CFG_ARCH" ]; then
2991         CFG_EMBEDDED=$CFG_ARCH
2992     fi
2993
2994     case "$CFG_EMBEDDED" in
2995     x86)
2996         CFG_ARCH=i386
2997         ;;
2998     x86_64)
2999         CFG_ARCH=x86_64
3000         ;;
3001     ipaq|sharp)
3002         CFG_ARCH=arm
3003         ;;
3004     dm7000)
3005         CFG_ARCH=powerpc
3006         ;;
3007     dm800)
3008         CFG_ARCH=mips
3009         ;;
3010     sh4al)
3011         CFG_ARCH=sh4a
3012         ;;
3013     *)
3014         CFG_ARCH="$CFG_EMBEDDED"
3015         ;;
3016     esac
3017 elif [ "$XPLATFORM_MINGW" = "yes" ]; then
3018     [ -z "$CFG_ARCH" ] && CFG_ARCH="windows"
3019 elif [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
3020     CFG_ARCH=symbian
3021 elif [ "$PLATFORM_MAC" = "yes" ] || [ -z "$CFG_ARCH" ]; then
3022     CFG_ARCH=$CFG_HOST_ARCH
3023 fi
3024
3025 if [ -d "$relpath/src/corelib/arch/$CFG_ARCH" ]; then
3026     if [ "$OPT_VERBOSE" = "yes" ]; then
3027         echo "    '$CFG_ARCH' is supported"
3028     fi
3029 else
3030     if [ "$OPT_VERBOSE" = "yes" ]; then
3031         echo "    '$CFG_ARCH' is unsupported, using 'generic'"
3032     fi
3033     CFG_ARCH=generic
3034 fi
3035 if [ "$CFG_HOST_ARCH" != "$CFG_ARCH" ]; then
3036     if [ -d "$relpath/src/corelib/arch/$CFG_HOST_ARCH" ]; then
3037         if [ "$OPT_VERBOSE" = "yes" ]; then
3038             echo "    '$CFG_HOST_ARCH' is supported"
3039         fi
3040     else
3041         if [ "$OPT_VERBOSE" = "yes" ]; then
3042             echo "    '$CFG_HOST_ARCH' is unsupported, using 'generic'"
3043         fi
3044         CFG_HOST_ARCH=generic
3045     fi
3046 fi
3047
3048 if [ "$OPT_VERBOSE" = "yes" ]; then
3049     echo "System architecture: '$CFG_ARCH'"
3050     if [ "$PLATFORM_QWS" = "yes" ]; then
3051         echo "Host architecture: '$CFG_HOST_ARCH'"
3052     fi
3053 fi
3054
3055 #-------------------------------------------------------------------------------
3056 # tests that don't need qmake (must be run before displaying help)
3057 #-------------------------------------------------------------------------------
3058
3059 if [ -z "$PKG_CONFIG" ]; then
3060     # See if PKG_CONFIG is set in the mkspec:
3061     PKG_CONFIG=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%PKG_CONFIG[^_].*=%%p' | tr '\n' ' '`
3062 fi
3063 if [ -z "$PKG_CONFIG" ]; then
3064     PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null`
3065 fi
3066
3067 # Work out if we can use pkg-config
3068 if [ "$QT_CROSS_COMPILE" = "yes" ]; then
3069     if [ "$QT_FORCE_PKGCONFIG" = "yes" ]; then
3070         echo >&2 ""
3071         echo >&2 "You have asked to use pkg-config and are cross-compiling."
3072         echo >&2 "Please make sure you have a correctly set-up pkg-config"
3073         echo >&2 "environment!"
3074         echo >&2 ""
3075         if [ -z "$PKG_CONFIG_PATH" ]; then
3076             echo >&2 ""
3077             echo >&2 "Warning: PKG_CONFIG_PATH has not been set.  This could mean"
3078             echo >&2 "the host compiler's .pc files will be used. This is probably"
3079             echo >&2 "not what you want."
3080             echo >&2 ""
3081         elif [ -z "$PKG_CONFIG_SYSROOT" ] && [ -z "$PKG_CONFIG_SYSROOT_DIR" ]; then
3082             echo >&2 ""
3083             echo >&2 "Warning: PKG_CONFIG_SYSROOT/PKG_CONFIG_SYSROOT_DIR has not"
3084             echo >&2 "been set. This means your toolchain's .pc files must contain"
3085             echo >&2 "the paths to the toolchain's libraries & headers. If configure"
3086             echo >&2 "tests are failing, please check these files."
3087             echo >&2 ""
3088         fi
3089     else
3090         echo >&2 ""
3091         echo >&2 "You have not explicitly asked to use pkg-config and are cross-compiling."
3092         echo >&2 "pkg-config will not be used to automatically query cflag/lib parameters for"
3093         echo >&2 "dependencies"
3094         echo >&2 ""
3095         PKG_CONFIG=""
3096     fi
3097 fi
3098
3099 # process CFG_MAC_ARCHS
3100 if [ "$PLATFORM_MAC" = "yes" ]; then
3101 #   check -arch arguments for validity.
3102     ALLOWED="x86 ppc x86_64 ppc64 i386"
3103     # Save the list so we can re-write it using only valid values
3104     CFG_MAC_ARCHS_IN="$CFG_MAC_ARCHS"
3105     CFG_MAC_ARCHS=
3106     for i in $CFG_MAC_ARCHS_IN
3107     do 
3108         if echo "$ALLOWED" | grep -w -v "$i" > /dev/null 2>&1; then
3109             echo "Unknown architecture: \"$i\". Supported architectures: x86[i386] ppc x86_64 ppc64";
3110             exit 2;
3111         fi
3112         if [ "$i" = "i386" -o "$i" = "x86" ]; then
3113             # These are synonymous values
3114             # CFG_MAC_ARCHS requires x86 while GCC requires i386
3115             CFG_MAC_ARCHS="$CFG_MAC_ARCHS x86"
3116             MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -arch i386"
3117         else
3118             CFG_MAC_ARCHS="$CFG_MAC_ARCHS $i"
3119             MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -arch $i"
3120         fi
3121     done
3122 fi
3123
3124 # pass on $CFG_SDK to the configure tests.
3125 if [ '!' -z "$CFG_SDK" ]; then
3126     MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -sdk $CFG_SDK"
3127 fi
3128
3129 # find the default framework value
3130 if [ "$PLATFORM_MAC" = "yes" ] && [ "$PLATFORM" != "macx-xlc" ]; then
3131     if [ "$CFG_FRAMEWORK" = "auto" ]; then
3132         CFG_FRAMEWORK="$CFG_SHARED"
3133     elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
3134         echo
3135         echo "WARNING: Using static linking will disable the use of Mac frameworks."
3136         echo
3137         CFG_FRAMEWORK="no"
3138     fi
3139 else
3140     CFG_FRAMEWORK=no
3141 fi
3142
3143 QMAKE_CONF_COMPILER=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_CXX[^_A-Z0-9]" | sed "s,.* *= *\(.*\)$,\1," | tail -1`
3144 TEST_COMPILER="$CXX"
3145
3146 [ -z "$TEST_COMPILER" ] && TEST_COMPILER=$QMAKE_CONF_COMPILER
3147 if [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then
3148     #for Symbian we don't need this checking
3149     if [ -z "$TEST_COMPILER" ]; then
3150         echo "ERROR: Cannot set the compiler for the configuration tests"
3151         exit 1
3152     fi
3153 fi
3154
3155
3156 # auto-detect precompiled header support
3157 if [ "$CFG_PRECOMPILE" = "auto" ]; then
3158     if [ `echo "$CFG_MAC_ARCHS" | wc -w` -gt 1 ]; then
3159        CFG_PRECOMPILE=no
3160     elif "$unixtests/precomp.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
3161        CFG_PRECOMPILE=no
3162     else
3163        CFG_PRECOMPILE=yes
3164     fi
3165 elif [ "$CFG_PRECOMPILE" = "yes" ] && [ `echo "$CFG_MAC_ARCHS" | wc -w` -gt 1 ]; then
3166     echo
3167     echo "WARNING: Using universal binaries disables precompiled headers."
3168     echo
3169     CFG_PRECOMPILE=no
3170 fi
3171
3172 #auto-detect DWARF2 on the mac
3173 if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "auto" ]; then
3174     if "$mactests/dwarf2.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
3175         CFG_MAC_DWARF2=no
3176     else
3177         CFG_MAC_DWARF2=yes
3178     fi
3179 fi
3180
3181 # auto-detect support for -Xarch on the mac
3182 if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" = "auto" ]; then
3183     if "$mactests/xarch.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
3184         CFG_MAC_XARCH=no
3185     else
3186         CFG_MAC_XARCH=yes
3187     fi
3188 fi
3189
3190 # don't autodetect support for separate debug info on objcopy when
3191 # cross-compiling as lots of toolchains seems to have problems with this
3192 if [ "$QT_CROSS_COMPILE" = "yes" ] && [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
3193     CFG_SEPARATE_DEBUG_INFO="no"
3194 fi
3195
3196 # auto-detect support for separate debug info in objcopy
3197 if [ "$CFG_SEPARATE_DEBUG_INFO" != "no" ] && [ "$CFG_SHARED" = "yes" ]; then
3198     TEST_COMPILER_CFLAGS=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%QMAKE_CFLAGS[^_=]*[+*]*=%%p' | tr '\n' ' '`
3199     TEST_COMPILER_CXXFLAGS=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%QMAKE_CXXFLAGS[^_=]*[+*]*=%%p' | tr '\n' ' '`
3200     TEST_OBJCOPY=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_OBJCOPY" | sed "s%.* *= *\(.*\)$%\1%" | tail -1`
3201     COMPILER_WITH_FLAGS="$TEST_COMPILER $TEST_COMPILER_CXXFLAGS"
3202     COMPILER_WITH_FLAGS=`echo "$COMPILER_WITH_FLAGS" | sed -e "s%\\$\\$QMAKE_CFLAGS%$TEST_COMPILER_CFLAGS%g"`
3203     if "$unixtests/objcopy.test" "$COMPILER_WITH_FLAGS" "$TEST_OBJCOPY" "$OPT_VERBOSE"; then
3204        CFG_SEPARATE_DEBUG_INFO=no
3205     else
3206        case "$PLATFORM" in
3207        hpux-*)
3208            # binutils on HP-UX is buggy; default to no.
3209            CFG_SEPARATE_DEBUG_INFO=no
3210            ;;
3211        *)
3212            CFG_SEPARATE_DEBUG_INFO=yes
3213            ;;
3214        esac
3215     fi
3216 fi
3217
3218 # auto-detect -fvisibility support
3219 if [ "$CFG_REDUCE_EXPORTS" = "auto" ]; then
3220     if "$unixtests/fvisibility.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
3221        CFG_REDUCE_EXPORTS=no
3222     else
3223        CFG_REDUCE_EXPORTS=yes
3224     fi
3225 fi
3226
3227 # detect the availability of the -Bsymbolic-functions linker optimization
3228 if [ "$CFG_REDUCE_RELOCATIONS" != "no" ]; then
3229     if "$unixtests/bsymbolic_functions.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
3230         CFG_REDUCE_RELOCATIONS=no
3231     else
3232         CFG_REDUCE_RELOCATIONS=yes
3233     fi
3234 fi
3235
3236 # auto-detect GNU make support
3237 if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2>&1; then
3238    CFG_USE_GNUMAKE=yes
3239 fi
3240
3241 # If -opengl wasn't specified, don't try to auto-detect
3242 if [ "$PLATFORM_QWS" = "yes" ] && [ "$CFG_OPENGL" = "auto" ]; then
3243         CFG_OPENGL=no
3244 fi
3245
3246 # mac
3247 if [ "$PLATFORM_MAC" = "yes" ] && [ "$XPLATFORM_SYMBIAN" = "no" ]; then
3248     if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
3249         CFG_OPENGL=desktop
3250     fi
3251 fi
3252
3253 # find the default framework value
3254 if [ "$PLATFORM_MAC" = "yes" ] && [ "$PLATFORM" != "macx-xlc" ]; then
3255     if [ "$CFG_FRAMEWORK" = "auto" ]; then
3256         CFG_FRAMEWORK="$CFG_SHARED"
3257     elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
3258         echo
3259         echo "WARNING: Using static linking will disable the use of Mac frameworks."
3260         echo
3261         CFG_FRAMEWORK="no"
3262     fi
3263 else
3264     CFG_FRAMEWORK=no
3265 fi
3266
3267 # Print a warning if configure was called with the 10.4u SDK option on Snow Leopard
3268 # with the default mkspec. The 10.4u SDK does not support gcc 4.2.
3269 if [ "$PLATFORM_MAC" = "yes" ] && [ '!' -z "$CFG_SDK" ]; then
3270     # get the darwin version. 10.0.0 and up means snow leopard.
3271     VERSION=`uname -r | tr '.' ' ' | awk '{print $1}'`
3272     if [ "$VERSION" -gt 9 ] && [ "$CFG_SDK" == "/Developer/SDKs/MacOSX10.4u.sdk/" ] && [ "$PLATFORM" == "macx-g++" ]; then
3273         echo
3274         echo "WARNING: The 10.4u SDK does not support gcc 4.2. Configure with -platform macx-g++40. "
3275         echo
3276     fi
3277 fi
3278
3279 # x11 tests are done after qmake is built
3280
3281
3282 #setup the build parts
3283 if [ -z "$CFG_BUILD_PARTS" ]; then
3284     CFG_BUILD_PARTS="$QT_DEFAULT_BUILD_PARTS"
3285
3286     # don't build tools by default when cross-compiling
3287     if [ "$PLATFORM" != "$XPLATFORM" ]; then
3288         CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, tools,,g"`
3289     fi
3290 fi
3291 for nobuild in $CFG_NOBUILD_PARTS; do
3292     CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, $nobuild,,g"`
3293 done
3294 if echo $CFG_BUILD_PARTS | grep -v libs >/dev/null 2>&1; then
3295 #    echo
3296 #    echo "WARNING: libs is a required part of the build."
3297 #    echo
3298     CFG_BUILD_PARTS="$CFG_BUILD_PARTS libs"
3299 fi
3300
3301 #-------------------------------------------------------------------------------
3302 # post process QT_INSTALL_* variables
3303 #-------------------------------------------------------------------------------
3304
3305 #prefix
3306 if [ -z "$QT_INSTALL_PREFIX" ]; then
3307     if [ "$CFG_DEV" = "yes" ]; then
3308         QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default
3309     elif [ "$PLATFORM_QWS" = "yes" ]; then
3310         QT_INSTALL_PREFIX="/usr/local/Trolltech/QtEmbedded-${QT_VERSION}"
3311         if [ "$PLATFORM" != "$XPLATFORM" ]; then
3312             QT_INSTALL_PREFIX="${QT_INSTALL_PREFIX}-${CFG_ARCH}"
3313         fi
3314     elif [ -d "$EPOCROOT" ]; then
3315         if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
3316             QT_INSTALL_PREFIX="$EPOCROOT/epoc32/"
3317             QT_INSTALL_LIBS="$EPOCROOT/epoc32/release/armv5/lib/"
3318         fi
3319     else
3320         QT_INSTALL_PREFIX="/usr/local/Trolltech/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Trolltech/Qt-$QT_VERSION
3321     fi
3322 fi
3323 QT_INSTALL_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PREFIX"`
3324
3325 if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
3326     [ -z "$QT_HOST_PREFIX" ] && QT_HOST_PREFIX="$QT_INSTALL_PREFIX"
3327     [ -z "$QT_INSTALL_DOCS" ] && QT_INSTALL_DOCS=
3328     [ -z "$QT_INSTALL_HEADERS" ] && QT_INSTALL_HEADERS=
3329     [ -z "$QT_INSTALL_LIBS" ] && QT_INSTALL_LIBS=
3330     [ -z "$QT_INSTALL_BINS" ] && QT_INSTALL_BINS=
3331     [ -z "$QT_INSTALL_PLUGINS" ] && QT_INSTALL_PLUGINS="\\\\resource\\\\qt$QT_LIBINFIX\\\\plugins"
3332     [ -z "$QT_INSTALL_IMPORTS" ] && QT_INSTALL_IMPORTS="\\\\resource\\\\qt$QT_LIBINFIX\\\\imports"
3333     [ -z "$QT_INSTALL_DATA" ] && QT_INSTALL_DATA=
3334     [ -z "$QT_INSTALL_TRANSLATIONS" ] && QT_INSTALL_TRANSLATIONS="\\\\resource\\\\qt$QT_LIBINFIX\\\\translations"
3335     [ -z "$QT_INSTALL_SETTINGS" ] && QT_INSTALL_SETTINGS=
3336     [ -z "$QT_INSTALL_EXAMPLES" ] && QT_INSTALL_EXAMPLES=
3337     [ -z "$QT_INSTALL_DEMOS" ] && QT_INSTALL_DEMOS=
3338 else
3339     #docs
3340     if [ -z "$QT_INSTALL_DOCS" ]; then #default
3341         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3342             if [ "$PLATFORM_MAC" = "yes" ]; then
3343                 QT_INSTALL_DOCS="/Developer/Documentation/Qt"
3344             fi
3345         fi
3346         [ -z "$QT_INSTALL_DOCS" ] && QT_INSTALL_DOCS="$QT_INSTALL_PREFIX/doc" #fallback
3347
3348     fi
3349     QT_INSTALL_DOCS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DOCS"`
3350
3351     #headers
3352     if [ -z "$QT_INSTALL_HEADERS" ]; then #default
3353         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3354             if [ "$PLATFORM_MAC" = "yes" ]; then
3355                 if [ "$CFG_FRAMEWORK" = "yes" ]; then
3356                     QT_INSTALL_HEADERS=
3357                 fi
3358             fi
3359         fi
3360         [ -z "$QT_INSTALL_HEADERS" ] && QT_INSTALL_HEADERS="$QT_INSTALL_PREFIX/include"
3361
3362     fi
3363     QT_INSTALL_HEADERS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_HEADERS"`
3364
3365     #libs
3366     if [ -z "$QT_INSTALL_LIBS" ]; then #default
3367         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3368             if [ "$PLATFORM_MAC" = "yes" ]; then
3369                 if [ "$CFG_FRAMEWORK" = "yes" ]; then
3370                     QT_INSTALL_LIBS="/Libraries/Frameworks"
3371                 fi
3372             fi
3373         fi
3374         [ -z "$QT_INSTALL_LIBS" ] && QT_INSTALL_LIBS="$QT_INSTALL_PREFIX/lib" #fallback
3375     fi
3376     QT_INSTALL_LIBS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_LIBS"`
3377
3378     #bins
3379     if [ -z "$QT_INSTALL_BINS" ]; then #default
3380         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3381             if [ "$PLATFORM_MAC" = "yes" ]; then
3382                 QT_INSTALL_BINS="/Developer/Applications/Qt"
3383             fi
3384         fi
3385         [ -z "$QT_INSTALL_BINS" ] && QT_INSTALL_BINS="$QT_INSTALL_PREFIX/bin" #fallback
3386
3387     fi
3388     QT_INSTALL_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_BINS"`
3389
3390     #plugins
3391     if [ -z "$QT_INSTALL_PLUGINS" ]; then #default
3392         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3393             if [ "$PLATFORM_MAC" = "yes" ]; then
3394                 QT_INSTALL_PLUGINS="/Developer/Applications/Qt/plugins"
3395             fi
3396         fi
3397         [ -z "$QT_INSTALL_PLUGINS" ] && QT_INSTALL_PLUGINS="$QT_INSTALL_PREFIX/plugins" #fallback
3398     fi
3399     QT_INSTALL_PLUGINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PLUGINS"`
3400
3401     #imports
3402     if [ -z "$QT_INSTALL_IMPORTS" ]; then #default
3403         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3404             if [ "$PLATFORM_MAC" = "yes" ]; then
3405                 QT_INSTALL_IMPORTS="/Developer/Applications/Qt/imports"
3406             fi
3407         fi
3408         [ -z "$QT_INSTALL_IMPORTS" ] && QT_INSTALL_IMPORTS="$QT_INSTALL_PREFIX/imports" #fallback
3409     fi
3410     QT_INSTALL_IMPORTS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_IMPORTS"`
3411
3412     #data
3413     if [ -z "$QT_INSTALL_DATA" ]; then #default
3414         QT_INSTALL_DATA="$QT_INSTALL_PREFIX"
3415     fi
3416     QT_INSTALL_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DATA"`
3417
3418     #translations
3419     if [ -z "$QT_INSTALL_TRANSLATIONS" ]; then #default
3420         QT_INSTALL_TRANSLATIONS="$QT_INSTALL_PREFIX/translations"
3421     fi
3422     QT_INSTALL_TRANSLATIONS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TRANSLATIONS"`
3423
3424     #settings
3425     if [ -z "$QT_INSTALL_SETTINGS" ]; then #default
3426         if [ "$PLATFORM_MAC" = "yes" ]; then
3427             QT_INSTALL_SETTINGS=/Library/Preferences/Qt
3428         else
3429             QT_INSTALL_SETTINGS=/etc/xdg
3430         fi
3431     fi
3432     QT_INSTALL_SETTINGS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_SETTINGS"`
3433
3434     #examples
3435     if [ -z "$QT_INSTALL_EXAMPLES" ]; then #default
3436         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3437             if [ "$PLATFORM_MAC" = "yes" ]; then
3438                 QT_INSTALL_EXAMPLES="/Developer/Examples/Qt"
3439             fi
3440         fi
3441         [ -z "$QT_INSTALL_EXAMPLES" ] && QT_INSTALL_EXAMPLES="$QT_INSTALL_PREFIX/examples" #fallback
3442     fi
3443     QT_INSTALL_EXAMPLES=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_EXAMPLES"`
3444
3445     #demos
3446     if [ -z "$QT_INSTALL_DEMOS" ]; then #default
3447         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3448             if [ "$PLATFORM_MAC" = "yes" ]; then
3449                 QT_INSTALL_DEMOS="/Developer/Examples/Qt/Demos"
3450             fi
3451         fi
3452         [ -z "$QT_INSTALL_DEMOS" ] && QT_INSTALL_DEMOS="$QT_INSTALL_PREFIX/demos"
3453     fi
3454     QT_INSTALL_DEMOS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DEMOS"`
3455 fi
3456
3457 #-------------------------------------------------------------------------------
3458 # help - interactive parts of the script _after_ this section please
3459 #-------------------------------------------------------------------------------
3460
3461 # next, emit a usage message if something failed.
3462 if [ "$OPT_HELP" = "yes" ]; then
3463     [ "x$ERROR" = "xyes" ] && echo
3464     if [ "$CFG_NIS" = "no" ]; then
3465         NSY=" "
3466         NSN="*"
3467     else
3468         NSY="*"
3469         NSN=" "
3470     fi
3471     if [ "$CFG_CUPS" = "no" ]; then
3472         CUY=" "
3473         CUN="*"
3474     else
3475         CUY="*"
3476         CUN=" "
3477     fi
3478     if [ "$CFG_ICONV" = "no" ]; then
3479         CIY=" "
3480         CIN="*"
3481     else
3482         CIY="*"
3483         CIN=" "
3484     fi
3485     if [ "$CFG_LARGEFILE" = "no" ]; then
3486         LFSY=" "
3487         LFSN="*"
3488     else
3489         LFSY="*"
3490         LFSN=" "
3491     fi
3492     if [ "$CFG_STL" = "auto" ] || [ "$CFG_STL" = "yes" ]; then
3493         SHY="*"
3494         SHN=" "
3495     else
3496         SHY=" "
3497         SHN="*"
3498     fi
3499     if [ "$CFG_IPV6" = "auto" ]; then
3500         I6Y="*"
3501         I6N=" "
3502     fi
3503     if [ "$CFG_PRECOMPILE" = "auto" ] || [ "$CFG_PRECOMPILE" = "no" ]; then
3504         PHY=" "
3505         PHN="*"
3506     else
3507         PHY="*"
3508         PHN=" "
3509     fi
3510
3511     cat <<EOF
3512 Usage:  $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>]
3513         [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-importdir <dir>] [-datadir <dir>]
3514         [-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>]
3515         [-demosdir <dir>] [-buildkey <key>] [-release] [-debug]
3516         [-debug-and-release] [-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile]
3517         [-largefile] [-no-exceptions] [-exceptions] [-no-accessibility]
3518         [-accessibility] [-no-stl] [-stl] [-no-sql-<driver>] [-sql-<driver>]
3519         [-plugin-sql-<driver>] [-system-sqlite] [-no-qt3support] [-qt3support]
3520         [-platform] [-D <string>] [-I <string>] [-L <string>] [-help]
3521         [-qt-zlib] [-system-zlib] [-no-gif] [-qt-gif] [-no-libtiff] [-qt-libtiff] [-system-libtiff]
3522         [-no-libpng] [-qt-libpng] [-system-libpng] [-no-libmng] [-qt-libmng]
3523         [-system-libmng] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>]
3524         [-nomake <part>] [-R <string>]  [-l <string>] [-no-rpath]  [-rpath] [-continue]
3525         [-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [-no-iconv]
3526         [-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked] [-no-gui]
3527         [-no-separate-debug-info] [-no-mmx] [-no-3dnow] [-no-sse] [-no-sse2]
3528         [-no-sse3] [-no-ssse3] [-no-sse4.1] [-no-sse4.2] [-no-avx] [-no-neon]
3529         [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info] [-armfpa]
3530         [-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns]
3531         [-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend]
3532         [-no-media-backend] [-media-backend] [-no-audio-backend] [-audio-backend] 
3533         [-no-openssl] [-openssl] [-openssl-linked]
3534         [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-webkit-debug]
3535         [-no-javascript-jit] [-javascript-jit]
3536         [-no-script] [-script] [-no-scripttools] [-scripttools] 
3537         [-no-declarative] [-declarative] [-no-declarative-debug] [-declarative-debug]
3538         [additional platform specific options (see below)]
3539
3540
3541 Installation options:
3542
3543  These are optional, but you may specify install directories.
3544
3545     -prefix <dir> ...... This will install everything relative to <dir>
3546                          (default $QT_INSTALL_PREFIX)
3547 EOF
3548 if [ "$PLATFORM_QWS" = "yes" ]; then
3549 cat <<EOF
3550
3551     -hostprefix [dir] .. Tools and libraries needed when developing
3552                          applications are installed in [dir]. If [dir] is
3553                          not given, the current build directory will be used.
3554 EOF
3555 fi
3556 cat <<EOF
3557
3558   * -prefix-install .... Force a sandboxed "local" installation of
3559                          Qt. This will install into
3560                          $QT_INSTALL_PREFIX, if this option is
3561                          disabled then some platforms will attempt a
3562                          "system" install by placing default values to
3563                          be placed in a system location other than
3564                          PREFIX.
3565
3566  You may use these to separate different parts of the install:
3567
3568     -bindir <dir> ......... Executables will be installed to <dir>
3569                             (default PREFIX/bin)
3570     -libdir <dir> ......... Libraries will be installed to <dir>
3571                             (default PREFIX/lib)
3572     -docdir <dir> ......... Documentation will be installed to <dir>
3573                             (default PREFIX/doc)
3574     -headerdir <dir> ...... Headers will be installed to <dir>
3575                             (default PREFIX/include)
3576     -plugindir <dir> ...... Plugins will be installed to <dir>
3577                             (default PREFIX/plugins)
3578     -importdir <dir> ...... Imports for QML will be installed to <dir>
3579                             (default PREFIX/imports)
3580     -datadir <dir> ........ Data used by Qt programs will be installed to <dir>
3581                             (default PREFIX)
3582     -translationdir <dir> . Translations of Qt programs will be installed to <dir>
3583                             (default PREFIX/translations)
3584     -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir>
3585                             (default PREFIX/etc/settings)
3586     -examplesdir <dir> .... Examples will be installed to <dir>
3587                             (default PREFIX/examples)
3588     -demosdir <dir> ....... Demos will be installed to <dir>
3589                             (default PREFIX/demos)
3590
3591  You may use these options to turn on strict plugin loading.
3592
3593     -buildkey <key> .... Build the Qt library and plugins using the specified
3594                          <key>.  When the library loads plugins, it will only
3595                          load those that have a matching key.
3596
3597 Configure options:
3598
3599  The defaults (*) are usually acceptable. A plus (+) denotes a default value
3600  that needs to be evaluated. If the evaluation succeeds, the feature is
3601  included. Here is a short explanation of each option:
3602
3603  *  -release ........... Compile and link Qt with debugging turned off.
3604     -debug ............. Compile and link Qt with debugging turned on.
3605     -debug-and-release . Compile and link two versions of Qt, with and without
3606                          debugging turned on (Mac only).
3607
3608     -developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting)
3609
3610     -opensource ........ Compile and link the Open-Source Edition of Qt.
3611     -commercial ........ Compile and link the Commercial Edition of Qt.
3612
3613
3614  *  -shared ............ Create and use shared Qt libraries.
3615     -static ............ Create and use static Qt libraries.
3616
3617  *  -no-fast ........... Configure Qt normally by generating Makefiles for all
3618                          project files.
3619     -fast .............. Configure Qt quickly by generating Makefiles only for
3620                          library and subdirectory targets.  All other Makefiles
3621                          are created as wrappers, which will in turn run qmake.
3622
3623     -no-largefile ...... Disables large file support.
3624  +  -largefile ......... Enables Qt to access files larger than 4 GB.
3625
3626 EOF
3627 if [ "$PLATFORM_QWS" = "yes" ]; then
3628     EXCN="*"
3629     EXCY=" "
3630 else
3631     EXCN=" "
3632     EXCY="*"
3633 fi
3634 if [ "$CFG_DBUS" = "no" ]; then
3635     DBY=" "
3636     DBN="+"
3637 else
3638     DBY="+"
3639     DBN=" "
3640 fi
3641
3642     cat << EOF
3643  $EXCN  -no-exceptions ..... Disable exceptions on compilers that support it.
3644  $EXCY  -exceptions ........ Enable exceptions on compilers that support it.
3645
3646     -no-accessibility .. Do not compile Accessibility support.
3647  *  -accessibility ..... Compile Accessibility support.
3648
3649  $SHN  -no-stl ............ Do not compile STL support.
3650  $SHY  -stl ............... Compile STL support.
3651
3652     -no-sql-<driver> ... Disable SQL <driver> entirely.
3653     -qt-sql-<driver> ... Enable a SQL <driver> in the QtSql library, by default
3654                          none are turned on.
3655     -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to
3656                          at run time.
3657
3658                          Possible values for <driver>:
3659                          [ $CFG_SQL_AVAILABLE ]
3660
3661     -system-sqlite ..... Use sqlite from the operating system.
3662
3663     -no-qt3support ..... Disables the Qt 3 support functionality.
3664  *  -qt3support ........ Enables the Qt 3 support functionality.
3665
3666     -no-xmlpatterns .... Do not build the QtXmlPatterns module.
3667  +  -xmlpatterns ....... Build the QtXmlPatterns module.
3668                          QtXmlPatterns is built if a decent C++ compiler
3669                          is used and exceptions are enabled.
3670
3671     -no-multimedia ..... Do not build the QtMultimedia module.
3672  +  -multimedia ........ Build the QtMultimedia module.
3673
3674     -no-audio-backend .. Do not build the platform audio backend into QtMultimedia.
3675  +  -audio-backend ..... Build the platform audio backend into QtMultimedia if available.
3676
3677     -no-phonon ......... Do not build the Phonon module.
3678  +  -phonon ............ Build the Phonon module.
3679                          Phonon is built if a decent C++ compiler is used.
3680     -no-phonon-backend.. Do not build the platform phonon plugin.
3681  +  -phonon-backend..... Build the platform phonon plugin.
3682
3683     -no-svg ............ Do not build the SVG module.
3684  +  -svg ............... Build the SVG module.
3685
3686     -no-webkit ......... Do not build the WebKit module.
3687  +  -webkit ............ Build the WebKit module.
3688                          WebKit is built if a decent C++ compiler is used.
3689     -webkit-debug ...... Build the WebKit module with debug symbols.
3690
3691     -no-javascript-jit . Do not build the JavaScriptCore JIT compiler.
3692  +  -javascript-jit .... Build the JavaScriptCore JIT compiler.
3693
3694     -no-script ......... Do not build the QtScript module.
3695  +  -script ............ Build the QtScript module.
3696
3697     -no-scripttools .... Do not build the QtScriptTools module.
3698  +  -scripttools ....... Build the QtScriptTools module.
3699
3700     -no-declarative ..... Do not build the declarative module.
3701  +  -declarative ....... Build the declarative module.
3702
3703     -no-declarative-debug ..... Do not build the declarative debugging support.
3704  +  -declarative-debug ....... Build the declarative debugging support.
3705
3706     -platform target ... The operating system and compiler you are building
3707                          on ($PLATFORM).
3708
3709                          See the README file for a list of supported
3710                          operating systems and compilers.
3711 EOF
3712 if [ "${PLATFORM_QWS}" != "yes" ]; then
3713 cat << EOF
3714     -graphicssystem <sys> Sets an alternate graphics system. Available options are:
3715                            raster - Software rasterizer
3716                            opengl - Rendering via OpenGL, Experimental!
3717                            openvg - Rendering via OpenVG, Experimental!
3718
3719 EOF
3720 fi
3721 cat << EOF
3722
3723     -no-mmx ............ Do not compile with use of MMX instructions.
3724     -no-3dnow .......... Do not compile with use of 3DNOW instructions.
3725     -no-sse ............ Do not compile with use of SSE instructions.
3726     -no-sse2 ........... Do not compile with use of SSE2 instructions.
3727     -no-sse3 ........... Do not compile with use of SSE3 instructions.
3728     -no-ssse3 .......... Do not compile with use of SSSE3 instructions.
3729     -no-sse4.1.......... Do not compile with use of SSE4.1 instructions.
3730     -no-sse4.2.......... Do not compile with use of SSE4.2 instructions.
3731     -no-avx ............ Do not compile with use of AVX instructions.
3732     -no-neon ........... Do not compile with use of NEON instructions.
3733
3734     -qtnamespace <name>  Wraps all Qt library code in 'namespace <name> {...}'.
3735     -qtlibinfix <infix>  Renames all libQt*.so to libQt*<infix>.so.
3736
3737     -D <string> ........ Add an explicit define to the preprocessor.
3738     -I <string> ........ Add an explicit include path.
3739     -L <string> ........ Add an explicit library path.
3740
3741     -help, -h .......... Display this information.
3742
3743 Third Party Libraries:
3744
3745     -qt-zlib ........... Use the zlib bundled with Qt.
3746  +  -system-zlib ....... Use zlib from the operating system.
3747                          See http://www.gzip.org/zlib
3748
3749     -no-gif ............ Do not compile GIF reading support.
3750  *  -qt-gif ............ Compile GIF reading support.
3751                          See also src/gui/image/qgifhandler_p.h
3752
3753     -no-libtiff ........ Do not compile TIFF support.
3754     -qt-libtiff ........ Use the libtiff bundled with Qt.
3755  +  -system-libtiff .... Use libtiff from the operating system.
3756                          See http://www.libtiff.org
3757
3758     -no-libpng ......... Do not compile PNG support.
3759     -qt-libpng ......... Use the libpng bundled with Qt.
3760  +  -system-libpng ..... Use libpng from the operating system.
3761                          See http://www.libpng.org/pub/png
3762
3763     -no-libmng ......... Do not compile MNG support.
3764     -qt-libmng ......... Use the libmng bundled with Qt.
3765  +  -system-libmng ..... Use libmng from the operating system.
3766                          See http://www.libmng.com
3767
3768     -no-libjpeg ........ Do not compile JPEG support.
3769     -qt-libjpeg ........ Use the libjpeg bundled with Qt.
3770  +  -system-libjpeg .... Use libjpeg from the operating system.
3771                          See http://www.ijg.org
3772
3773     -no-openssl ........ Do not compile support for OpenSSL.
3774  +  -openssl ........... Enable run-time OpenSSL support.
3775     -openssl-linked .... Enabled linked OpenSSL support.
3776
3777     -ptmalloc .......... Override the system memory allocator with ptmalloc.
3778                          (Experimental.)
3779
3780 Additional options:
3781
3782     -make <part> ....... Add part to the list of parts to be built at make time.
3783                          ($QT_DEFAULT_BUILD_PARTS)
3784     -nomake <part> ..... Exclude part from the list of parts to be built.
3785
3786     -R <string> ........ Add an explicit runtime library path to the Qt
3787                          libraries.
3788     -l <string> ........ Add an explicit library.
3789
3790     -no-rpath .......... Do not use the library install path as a runtime
3791                          library path.
3792  +  -rpath ............. Link Qt libraries and executables using the library
3793                          install path as a runtime library path. Equivalent
3794                          to -R install_libpath
3795
3796     -continue .......... Continue as far as possible if an error occurs.
3797
3798     -verbose, -v ....... Print verbose information about each step of the
3799                          configure process.
3800
3801     -silent ............ Reduce the build output so that warnings and errors
3802                          can be seen more easily.
3803
3804  *  -no-optimized-qmake ... Do not build qmake optimized.
3805     -optimized-qmake ...... Build qmake optimized.
3806
3807     -no-gui ............ Don't build the Qt GUI library
3808
3809  $NSN  -no-nis ............ Do not compile NIS support.
3810  $NSY  -nis ............... Compile NIS support.
3811
3812  $CUN  -no-cups ........... Do not compile CUPS support.
3813  $CUY  -cups .............. Compile CUPS support.
3814                          Requires cups/cups.h and libcups.so.2.
3815
3816  $CIN  -no-iconv .......... Do not compile support for iconv(3).
3817  $CIY  -iconv ............. Compile support for iconv(3).
3818
3819  $PHN  -no-pch ............ Do not use precompiled header support.
3820  $PHY  -pch ............... Use precompiled header support.
3821
3822  $DBN  -no-dbus ........... Do not compile the QtDBus module.
3823  $DBY  -dbus .............. Compile the QtDBus module and dynamically load libdbus-1.
3824     -dbus-linked ....... Compile the QtDBus module and link to libdbus-1.
3825
3826     -reduce-relocations ..... Reduce relocations in the libraries through extra
3827                               linker optimizations (Qt/X11 and Qt for Embedded Linux only;
3828                               experimental; needs GNU ld >= 2.18).
3829 EOF
3830
3831 if [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
3832     if [ "$QT_CROSS_COMPILE" = "yes" ]; then
3833         SBY=""
3834         SBN="*"
3835     else
3836         SBY="*"
3837         SBN=" "
3838     fi
3839 elif [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
3840     SBY="*"
3841     SBN=" "
3842 else
3843     SBY=" "
3844     SBN="*"
3845 fi
3846
3847 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then
3848
3849     cat << EOF
3850
3851  $SBN  -no-separate-debug-info . Do not store debug information in a separate file.
3852  $SBY  -separate-debug-info .... Strip debug information into a separate .debug file.
3853
3854 EOF
3855
3856 fi # X11/QWS
3857
3858 if [ "$PLATFORM_X11" = "yes" ]; then
3859     if [ "$CFG_SM" = "no" ]; then
3860         SMY=" "
3861         SMN="*"
3862     else
3863         SMY="*"
3864         SMN=" "
3865     fi
3866     if [ "$CFG_XSHAPE" = "no" ]; then
3867         SHY=" "
3868         SHN="*"
3869     else
3870         SHY="*"
3871         SHN=" "
3872     fi
3873     if [ "$CFG_XVIDEO" = "no" ]; then
3874         XVY=" "
3875         XVN="*"
3876     else
3877         XVY="*"
3878         XVN=" "
3879     fi
3880     if [ "$CFG_XINERAMA" = "no" ]; then
3881         XAY=" "
3882         XAN="*"
3883     else
3884         XAY="*"
3885         XAN=" "
3886     fi
3887     if [ "$CFG_FONTCONFIG" = "no" ]; then
3888         FCGY=" "
3889         FCGN="*"
3890     else
3891         FCGY="*"
3892         FCGN=" "
3893     fi
3894     if [ "$CFG_XCURSOR" = "no" ]; then
3895         XCY=" "
3896         XCN="*"
3897     else
3898         XCY="*"
3899         XCN=" "
3900     fi
3901     if [ "$CFG_XFIXES" = "no" ]; then
3902         XFY=" "
3903         XFN="*"
3904     else
3905         XFY="*"
3906         XFN=" "
3907     fi
3908     if [ "$CFG_XRANDR" = "no" ]; then
3909         XZY=" "
3910         XZN="*"
3911     else
3912         XZY="*"
3913         XZN=" "
3914     fi
3915     if [ "$CFG_XRENDER" = "no" ]; then
3916         XRY=" "
3917         XRN="*"
3918     else
3919         XRY="*"
3920         XRN=" "
3921     fi
3922     if [ "$CFG_MITSHM" = "no" ]; then
3923         XMY=" "
3924         XMN="*"
3925     else
3926         XMY="*"
3927         XMN=" "
3928