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