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