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