source: branches/vendor/trolltech/qt/current/configure @ 2

Last change on this file since 2 was 2, checked in by Dmitry A. Kuminov, 12 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

  • Property svn:executable set to *
File size: 247.0 KB
Line 
1#!/bin/sh
2#
3# Configures to build the Qt library
4#
5# Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
6# Contact: Qt Software Information (qt-info@nokia.com)
7#
8# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10#
11
12#-------------------------------------------------------------------------------
13# script initialization
14#-------------------------------------------------------------------------------
15
16# the name of this script
17relconf=`basename $0`
18# the directory of this script is the "source tree"
19relpath=`dirname $0`
20relpath=`(cd "$relpath"; /bin/pwd)`
21# the current directory is the "build tree" or "object tree"
22outpath=`/bin/pwd`
23
24#license file location
25LICENSE_FILE="$QT_LICENSE_FILE"
26[ -z "$LICENSE_FILE" ] && LICENSE_FILE="$HOME/.qt-license"
27if [ -f "$LICENSE_FILE" ]; then
28    tr -d '\r' <"$LICENSE_FILE" >"${LICENSE_FILE}.tmp"
29    diff "${LICENSE_FILE}.tmp" "${LICENSE_FILE}" >/dev/null 2>&1 || LICENSE_FILE="${LICENSE_FILE}.tmp"
30fi
31
32# later cache the command line in config.status
33OPT_CMDLINE=`echo $@ | sed "s,-v ,,g; s,-v$,,g"`
34
35# initialize global variables
36QMAKE_SWITCHES=
37QMAKE_VARS=
38QMAKE_CONFIG=
39QTCONFIG_CONFIG=
40QT_CONFIG=
41SUPPORTED=
42QMAKE_VARS_FILE=.qmake.vars
43
44:> "$QMAKE_VARS_FILE"
45
46#-------------------------------------------------------------------------------
47# utility functions
48#-------------------------------------------------------------------------------
49
50# Adds a new qmake variable to the cache
51# Usage: QMakeVar mode varname contents
52#   where mode is one of: set, add, del
53QMakeVar()
54{
55    case "$1" in
56        set)
57            eq="="
58            ;;
59        add)
60            eq="+="
61            ;;
62        del)
63            eq="-="
64            ;;
65        *)
66            echo >&2 "BUG: wrong command to QMakeVar: $1"
67            ;;
68    esac
69
70    echo "$2" "$eq" "$3" >> "$QMAKE_VARS_FILE"
71}
72
73# relies on $QMAKESPEC being set correctly. parses include statements in
74# qmake.conf and prints out the expanded file
75getQMakeConf()
76{
77    tmpSPEC="$QMAKESPEC"
78    if [ -n "$1" ]; then
79        tmpSPEC="$1"
80    fi
81    $AWK -v "QMAKESPEC=$tmpSPEC" '
82/^include\(.+\)$/{
83    fname = QMAKESPEC "/" substr($0, 9, length($0) - 9)
84    while ((getline line < fname) > 0)
85        print line
86    close(fname)
87    next
88}
89{ print }' "$tmpSPEC/qmake.conf"
90}
91
92#-------------------------------------------------------------------------------
93# operating system detection
94#-------------------------------------------------------------------------------
95
96# need that throughout the script
97UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
98UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
99UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
100UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
101
102
103#-------------------------------------------------------------------------------
104# window system detection
105#-------------------------------------------------------------------------------
106
107PLATFORM_X11=no
108PLATFORM_MAC=no
109PLATFORM_QWS=no
110
111if [ -f "$relpath"/src/gui/kernel/qapplication_mac.mm ] && [ -d /System/Library/Frameworks/Carbon.framework ]; then
112    # Qt/Mac
113    # ~ the Carbon SDK exists
114    # ~ src/gui/base/qapplication_mac.cpp is present
115    # ~ this is the internal edition and Qt/Mac sources exist
116    PLATFORM_MAC=maybe
117elif [ -f "$relpath"/src/gui/kernel/qapplication_qws.cpp ]; then
118    # Qt Embedded
119    # ~ src/gui/base/qapplication_qws.cpp is present
120    # ~ this is the free or commercial edition
121    # ~ this is the internal edition and Qt Embedded is explicitly enabled
122    if [ -f "$relpath"/src/gui/kernel/qapplication_mac.mm ]; then
123        # This is a depot build, or an all-platforms package
124        PLATFORM_QWS=maybe
125    else
126        # This must be the embedded package, since the Qt/Mac source files are not present
127        PLATFORM_QWS=yes
128    fi
129fi
130
131#-----------------------------------------------------------------------------
132# Qt version detection
133#-----------------------------------------------------------------------------
134QT_VERSION=`grep '^# *define *QT_VERSION_STR' "$relpath"/src/corelib/global/qglobal.h`
135QT_MAJOR_VERSION=
136QT_MINOR_VERSION=0
137QT_PATCH_VERSION=0
138if [ -n "$QT_VERSION" ]; then
139   QT_VERSION=`echo $QT_VERSION | sed 's,^# *define *QT_VERSION_STR *"*\([^ ]*\)"$,\1,'`
140   MAJOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'`
141   if [ -n "$MAJOR" ]; then
142     MINOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'`
143      PATCH=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'`
144      QT_MAJOR_VERSION="$MAJOR"
145      [ -z "$MINOR" ] || QT_MINOR_VERSION="$MINOR"
146      [ -z "$PATCH" ] || QT_PATCH_VERSION="$PATCH"
147   fi
148fi
149if [ -z "$QT_MAJOR_VERSION" ]; then
150   echo "Cannot process version from qglobal.h: $QT_VERSION"
151   echo "Cannot proceed."
152   exit 1
153fi
154
155QT_PACKAGEDATE=`grep '^# *define *QT_PACKAGEDATE_STR' "$relpath"/src/corelib/global/qglobal.h | sed -e 's,^# *define *QT_PACKAGEDATE_STR *"\([^ ]*\)"$,\1,' -e s,-,,g`
156if [ -z "$QT_PACKAGEDATE" ]; then
157   echo "Unable to determine package date from qglobal.h: '$QT_PACKAGEDATE'"
158   echo "Cannot proceed"
159   exit 1
160fi
161
162#-------------------------------------------------------------------------------
163# check the license
164#-------------------------------------------------------------------------------
165COMMERCIAL_USER=ask
166CFG_DEV=no
167CFG_NOKIA=no
168CFG_EMBEDDED=no
169EditionString=Commercial
170
171earlyArgParse()
172{
173    # parse the arguments, setting things to "yes" or "no"
174    while [ "$#" -gt 0 ]; do
175        CURRENT_OPT="$1"
176        UNKNOWN_ARG=no
177        case "$1" in
178        #Autoconf style options
179        --enable-*)
180            VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"`
181            VAL=yes
182            ;;
183        --disable-*)
184            VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"`
185            VAL=no
186            ;;
187        --*=*)
188            VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"`
189            VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"`
190            ;;
191        --no-*)
192            VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
193            VAL=no
194            ;;
195        -embedded)
196            VAR=embedded
197            # this option may or may not be followed by an argument
198            if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
199                VAL=auto
200            else
201                shift;
202                VAL=$1
203            fi
204            ;;
205        h|help|--help|-help)
206            if [ "$VAL" = "yes" ]; then
207                OPT_HELP="$VAL"
208                COMMERCIAL_USER="no" #doesn't matter we will display the help
209            else
210                UNKNOWN_OPT=yes
211                COMMERCIAL_USER="no" #doesn't matter we will display the help
212            fi
213            ;;
214        --*)
215            VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
216            VAL=yes
217            ;;
218        -*)
219            VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
220            VAL="unknown"
221            ;;
222        *)
223            UNKNOWN_ARG=yes
224            ;;
225        esac
226        if [ "$UNKNOWN_ARG" = "yes" ]; then
227            shift
228            continue
229        fi
230        shift
231
232        UNKNOWN_OPT=no
233        case "$VAR" in
234        embedded)
235            CFG_EMBEDDED="$VAL"
236            if [ "$PLATFORM_QWS" != "no" ]; then
237                if [ "$PLATFORM_QWS" = "maybe" ]; then
238                    PLATFORM_X11=no
239                    PLATFORM_MAC=no
240                    PLATFORM_QWS=yes
241                fi
242            else
243                echo "No license exists to enable Qt for Embedded Linux. Disabling."
244                CFG_EMBEDDED=no
245            fi
246            ;;
247        developer-build)
248            CFG_DEV="yes"
249            ;;
250        nokia-developer)
251            CFG_DEV="yes"
252            CFG_NOKIA="yes"
253            COMMERCIAL_USER="no"
254            ;;
255        commercial)
256            COMMERCIAL_USER="yes"
257            ;;
258        opensource)
259            COMMERCIAL_USER="no"
260            ;;
261        *)
262            UNKNOWN_OPT=yes
263            ;;
264        esac
265    done
266}
267
268earlyArgParse "$@"
269
270if [ "$COMMERCIAL_USER" = "ask" ]; then
271    while true; do
272        echo "Which edition of Qt do you want to use ?"
273        echo
274        echo "Type 'c' if you want to use the Commercial Edition."
275        echo "Type 'o' if you want to use the Open Source Edition."
276        echo
277        read commercial
278        echo
279        if [ "$commercial" = "c" ]; then
280            COMMERCIAL_USER="yes"
281            break
282        else [ "$commercial" = "o" ];
283            COMMERCIAL_USER="no"
284            break
285        fi
286    done
287fi
288
289if [ "$CFG_NOKIA" = "yes" ]; then
290    Licensee="Nokia"
291    Edition="NokiaInternalBuild"
292    EditionString="Nokia Internal Build"
293    QT_EDITION="QT_EDITION_OPENSOURCE"
294    [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
295elif [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ]; then
296    # Commercial preview release
297    [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
298    Licensee="Preview"
299    Edition="Preview"
300    QT_EDITION="QT_EDITION_DESKTOP"
301    LicenseType="Technology Preview"
302elif [ $COMMERCIAL_USER = "yes" ]; then
303    # one of commercial editions
304    [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
305    [ "$PLATFORM_QWS" = "maybe" ] && PLATFORM_QWS=yes
306
307    # read in the license file
308    if [ -f "$LICENSE_FILE" ]; then
309        . "$LICENSE_FILE" >/dev/null 2>&1
310        if [ -z "$LicenseKeyExt" ]; then
311            echo
312            echo "You are using an old license file."
313            echo
314            echo "Please install the license file supplied by Qt Software,"
315            echo "or install the Qt Open Source Edition if you intend to"
316            echo "develop free software."
317            exit 1
318        fi
319        if [ -z "$Licensee" ]; then
320            echo
321            echo "Invalid license key. Please check the license key."
322            exit 1
323        fi
324    else
325        if [ -z "$LicenseKeyExt" ]; then
326            echo
327            if echo '\c' | grep '\c' >/dev/null; then
328                echo -n "Please enter your license key: "
329            else
330                echo "Please enter your license key: \c"
331            fi
332            read LicenseKeyExt
333            Licensee="Unknown user"
334        fi
335    fi
336
337    # Key verification
338    echo "$LicenseKeyExt" | grep ".....*-....*-....*-....*-.....*-.....*-...." >/dev/null 2>&1 \
339        && LicenseValid="yes" \
340        || LicenseValid="no"
341    if [ "$LicenseValid" != "yes" ]; then
342        echo
343        echo "Invalid license key. Please check the license key."
344        exit 1
345    fi
346    ProductCode=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1`
347    PlatformCode=`echo $LicenseKeyExt | cut -f 2 -d - | cut -b 1`
348    LicenseTypeCode=`echo $LicenseKeyExt | cut -f 3 -d -`
349    LicenseFeatureCode=`echo $LicenseKeyExt | cut -f 4 -d - | cut -b 1`
350
351    # determine which edition we are licensed to use
352    case "$LicenseTypeCode" in
353    F4M)
354        LicenseType="Commercial"
355        case $ProductCode in
356        F)
357            Edition="Universal"
358            QT_EDITION="QT_EDITION_UNIVERSAL"
359            ;;
360        B)
361            Edition="FullFramework"
362            EditionString="Full Framework"
363            QT_EDITION="QT_EDITION_DESKTOP"
364            ;;
365        L)
366            Edition="GUIFramework"
367            EditionString="GUI Framework"
368            QT_EDITION="QT_EDITION_DESKTOPLIGHT"
369            ;;
370        esac
371        ;;
372    Z4M|R4M|Q4M)
373        LicenseType="Evaluation"
374        case $ProductCode in
375         B)
376            Edition="Evaluation"
377            QT_EDITION="QT_EDITION_EVALUATION"
378            ;;
379        esac
380        ;;
381    esac
382    if [ -z "$LicenseType" -o -z "$Edition" -o -z "$QT_EDITION" ]; then
383        echo
384        echo "Invalid license key. Please check the license key."
385        exit 1
386    fi
387
388    # verify that we are licensed to use Qt on this platform
389    LICENSE_EXTENSION=
390    if [ "$PlatformCode" = "X" ]; then
391        # Qt All-OS
392        LICENSE_EXTENSION="-ALLOS"
393    elif [ "$PLATFORM_QWS" = "yes" ]; then
394        case $PlatformCode in
395        2|4|8|A|B|E|G|J|K|P|Q|S|U|V|W)
396            # Qt for Embedded Linux
397            LICENSE_EXTENSION="-EMBEDDED"
398            ;;
399        *)
400            echo
401            echo "You are not licensed for Qt for Embedded Linux."
402            echo
403            echo "Please contact sales@trolltech.com to upgrade your license"
404            echo "to include Qt for Embedded Linux, or install the"
405            echo "Qt Open Source Edition if you intend to develop free software."
406            exit 1
407            ;;
408        esac
409    elif [ "$PLATFORM_MAC" = "yes" ]; then
410        case $PlatformCode in
411        2|4|5|7|9|B|C|E|F|G|L|M|U|W|Y)
412            # Qt/Mac
413            LICENSE_EXTENSION="-DESKTOP"
414            ;;
415        3|6|8|A|D|H|J|K|P|Q|S|V)
416            # Embedded no-deploy
417            LICENSE_EXTENSION="-EMBEDDED"
418            ;;
419        *)
420            echo
421            echo "You are not licensed for the Qt/Mac platform."
422            echo
423            echo "Please contact sales@trolltech.com to upgrade your license"
424            echo "to include the Qt/Mac platform."
425            exit 1
426            ;;
427        esac
428     else
429         case $PlatformCode in
430         2|3|4|5|7|D|E|F|J|M|Q|S|T|V|Z)
431             # Qt/X11
432             LICENSE_EXTENSION="-DESKTOP"
433             ;;
434         6|8|9|A|B|C|G|H|K|P|U|W)
435             # Embedded no-deploy
436             LICENSE_EXTENSION="-EMBEDDED"
437             ;;
438         *)
439             echo
440             echo "You are not licensed for the Qt/X11 platform."
441             echo
442             echo "Please contact sales@trolltech.com to upgrade your license to"
443             echo "include the Qt/X11 platform, or install the Qt Open Source Edition"
444             echo "if you intend to develop free software."
445             exit 1
446             ;;
447        esac
448    fi
449
450    if test -r "$relpath/.LICENSE"; then
451        # Generic, non-final license
452        LICENSE_EXTENSION=""
453        line=`sed 'y/a-z/A-Z/;q' "$relpath"/.LICENSE`
454        case "$line" in
455            *BETA*)
456                Edition=Beta
457                ;;
458            *TECHNOLOGY?PREVIEW*)
459                Edition=Preview
460                ;;
461            *EVALUATION*)
462                Edition=Evaluation
463                ;;
464            *)
465                echo >&2 "Invalid license files; cannot continue"
466                exit 1
467                ;;
468        esac
469        Licensee="$Edition"
470        EditionString="$Edition"
471        QT_EDITION="QT_EDITION_DESKTOP"
472    fi
473
474    case "$LicenseFeatureCode" in
475    G|L)
476        # US
477        case "$LicenseType" in
478        Commercial)
479            cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}-US" "$outpath/LICENSE"
480            ;;
481        Evaluation)
482            cp -f "$relpath/.LICENSE-EVALUATION-US" "$outpath/LICENSE"
483            ;;
484        esac
485        ;;
486    2|5)
487        # non-US
488        case "$LicenseType" in
489        Commercial)
490            cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}" "$outpath/LICENSE"
491            ;;
492        Evaluation)
493            cp -f "$relpath/.LICENSE-EVALUATION" "$outpath/LICENSE"
494            ;;
495        esac
496        ;;
497    *)
498        echo
499        echo "Invalid license key. Please check the license key."
500        exit 1
501        ;;
502    esac
503    if [ '!' -f "$outpath/LICENSE" ]; then
504        echo "The LICENSE, LICENSE.GPL3 LICENSE.LGPL file shipped with"
505        echo "this software has disappeared."
506        echo
507        echo "Sorry, you are not licensed to use this software."
508        echo "Try re-installing."
509        echo
510        exit 1
511    fi
512elif [ $COMMERCIAL_USER = "no" ]; then
513    # Open Source edition - may only be used under the terms of the GPL or LGPL.
514    [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
515    Licensee="Open Source"
516    Edition="OpenSource"
517    EditionString="Open Source"
518    QT_EDITION="QT_EDITION_OPENSOURCE"
519fi
520
521#-------------------------------------------------------------------------------
522# initalize variables
523#-------------------------------------------------------------------------------
524
525SYSTEM_VARIABLES="CC CXX CFLAGS CXXFLAGS LDFLAGS"
526for varname in $SYSTEM_VARIABLES; do
527    qmakevarname="${varname}"
528    # use LDFLAGS for autoconf compat, but qmake uses QMAKE_LFLAGS
529    if [ "${varname}" = "LDFLAGS" ]; then
530        qmakevarname="LFLAGS"
531    fi
532    cmd=`echo \
533'if [ -n "\$'${varname}'" ]; then
534    QMakeVar set QMAKE_'${qmakevarname}' "\$'${varname}'"
535fi'`
536    eval "$cmd"
537done
538# Use CC/CXX to run config.tests
539mkdir -p "$outpath/config.tests"
540rm -f "$outpath/config.tests/.qmake.cache"
541cp "$QMAKE_VARS_FILE" "$outpath/config.tests/.qmake.cache"
542
543QMakeVar add styles "cde mac motif plastique cleanlooks windows"
544QMakeVar add decorations "default windows styled"
545QMakeVar add gfx-drivers "linuxfb"
546QMakeVar add kbd-drivers "tty"
547QMakeVar add mouse-drivers "pc linuxtp"
548
549if [ "$CFG_DEV" = "yes" ]; then
550    QMakeVar add kbd-drivers "um"
551fi
552
553# QTDIR may be set and point to an old or system-wide Qt installation
554unset QTDIR
555
556# the minimum version of libdbus-1 that we require:
557MIN_DBUS_1_VERSION=0.62
558
559# initalize internal variables
560CFG_CONFIGURE_EXIT_ON_ERROR=yes
561CFG_PROFILE=no
562CFG_EXCEPTIONS=unspecified
563CFG_SCRIPTTOOLS=auto # (yes|no|auto)
564CFG_XMLPATTERNS=auto # (yes|no|auto)
565CFG_INCREMENTAL=auto
566CFG_QCONFIG=full
567CFG_DEBUG=auto
568CFG_MYSQL_CONFIG=
569CFG_DEBUG_RELEASE=no
570CFG_SHARED=yes
571CFG_SM=auto
572CFG_XSHAPE=auto
573CFG_XINERAMA=runtime
574CFG_XFIXES=runtime
575CFG_ZLIB=auto
576CFG_SQLITE=qt
577CFG_GIF=auto
578CFG_TIFF=auto
579CFG_LIBTIFF=auto
580CFG_PNG=yes
581CFG_LIBPNG=auto
582CFG_JPEG=auto
583CFG_LIBJPEG=auto
584CFG_MNG=auto
585CFG_LIBMNG=auto
586CFG_XCURSOR=runtime
587CFG_XRANDR=runtime
588CFG_XRENDER=auto
589CFG_MITSHM=auto
590CFG_OPENGL=auto
591CFG_SSE=auto
592CFG_FONTCONFIG=auto
593CFG_QWS_FREETYPE=auto
594CFG_LIBFREETYPE=auto
595CFG_SQL_AVAILABLE=
596QT_DEFAULT_BUILD_PARTS="libs tools examples demos docs translations"
597CFG_BUILD_PARTS=""
598CFG_NOBUILD_PARTS=""
599CFG_RELEASE_QMAKE=no
600CFG_PHONON=auto
601CFG_PHONON_BACKEND=yes
602CFG_SVG=yes
603CFG_WEBKIT=auto # (yes|no|auto)
604
605CFG_GFX_AVAILABLE="linuxfb transformed qvfb vnc multiscreen"
606CFG_GFX_ON="linuxfb multiscreen"
607CFG_GFX_PLUGIN_AVAILABLE=
608CFG_GFX_PLUGIN=
609CFG_GFX_OFF=
610CFG_KBD_AVAILABLE="tty usb sl5000 yopy vr41xx qvfb"
611CFG_KBD_ON="tty"    #default, see QMakeVar above
612CFG_MOUSE_AVAILABLE="pc bus linuxtp yopy vr41xx tslib qvfb"
613CFG_MOUSE_ON="pc linuxtp"   #default, see QMakeVar above
614
615CFG_ARCH=
616CFG_HOST_ARCH=
617CFG_KBD_PLUGIN_AVAILABLE=
618CFG_KBD_PLUGIN=
619CFG_KBD_OFF=
620CFG_MOUSE_PLUGIN_AVAILABLE=
621CFG_MOUSE_PLUGIN=
622CFG_MOUSE_OFF=
623CFG_USE_GNUMAKE=no
624CFG_IM=yes
625CFG_DECORATION_AVAILABLE="styled windows default"
626CFG_DECORATION_ON="${CFG_DECORATION_AVAILABLE}" # all on by default
627CFG_DECORATION_PLUGIN_AVAILABLE=
628CFG_DECORATION_PLUGIN=
629CFG_XINPUT=runtime
630CFG_XKB=auto
631CFG_NIS=auto
632CFG_CUPS=auto
633CFG_ICONV=auto
634CFG_DBUS=auto
635CFG_GLIB=auto
636CFG_GSTREAMER=auto
637CFG_QGTKSTYLE=auto
638CFG_LARGEFILE=auto
639CFG_OPENSSL=auto
640CFG_PTMALLOC=no
641CFG_STL=auto
642CFG_PRECOMPILE=auto
643CFG_SEPARATE_DEBUG_INFO=auto
644CFG_REDUCE_EXPORTS=auto
645CFG_MMX=auto
646CFG_3DNOW=auto
647CFG_SSE=auto
648CFG_SSE2=auto
649CFG_REDUCE_RELOCATIONS=no
650CFG_IPV6=auto
651CFG_NAS=no
652CFG_QWS_DEPTHS=all
653CFG_USER_BUILD_KEY=
654CFG_ACCESSIBILITY=auto
655CFG_QT3SUPPORT=yes
656CFG_ENDIAN=auto
657CFG_HOST_ENDIAN=auto
658CFG_DOUBLEFORMAT=auto
659CFG_ARMFPA=auto
660CFG_IWMMXT=no
661CFG_CLOCK_GETTIME=auto
662CFG_CLOCK_MONOTONIC=auto
663CFG_MREMAP=auto
664CFG_GETADDRINFO=auto
665CFG_IPV6IFNAME=auto
666CFG_GETIFADDRS=auto
667CFG_INOTIFY=auto
668CFG_RPATH=yes
669CFG_FRAMEWORK=auto
670CFG_MAC_ARCHS=
671CFG_MAC_DWARF2=auto
672CFG_MAC_XARCH=auto
673CFG_MAC_CARBON=yes
674CFG_MAC_COCOA=auto
675COMMANDLINE_MAC_COCOA=no
676CFG_SXE=no
677CFG_PREFIX_INSTALL=yes
678CFG_SDK=
679D_FLAGS=
680I_FLAGS=
681L_FLAGS=
682RPATH_FLAGS=
683l_FLAGS=
684QCONFIG_FLAGS=
685XPLATFORM=              # This seems to be the QMAKESPEC, like "linux-g++"
686PLATFORM=$QMAKESPEC
687QT_CROSS_COMPILE=no
688OPT_CONFIRM_LICENSE=no
689OPT_SHADOW=maybe
690OPT_FAST=auto
691OPT_VERBOSE=no
692OPT_HELP=
693CFG_SILENT=no
694CFG_GRAPHICS_SYSTEM=default
695
696# initalize variables used for installation
697QT_INSTALL_PREFIX=
698QT_INSTALL_DOCS=
699QT_INSTALL_HEADERS=
700QT_INSTALL_LIBS=
701QT_INSTALL_BINS=
702QT_INSTALL_PLUGINS=
703QT_INSTALL_DATA=
704QT_INSTALL_TRANSLATIONS=
705QT_INSTALL_SETTINGS=
706QT_INSTALL_EXAMPLES=
707QT_INSTALL_DEMOS=
708QT_HOST_PREFIX=
709
710#flags for SQL drivers
711QT_CFLAGS_PSQL=
712QT_LFLAGS_PSQL=
713QT_CFLAGS_MYSQL=
714QT_LFLAGS_MYSQL=
715QT_LFLAGS_MYSQL_R=
716QT_CFLAGS_SQLITE=
717QT_LFLAGS_SQLITE=
718
719# flags for libdbus-1
720QT_CFLAGS_DBUS=
721QT_LIBS_DBUS=
722
723# flags for Glib (X11 only)
724QT_CFLAGS_GLIB=
725QT_LIBS_GLIB=
726
727# flags for GStreamer (X11 only)
728QT_CFLAGS_GSTREAMER=
729QT_LIBS_GSTREAMER=
730
731#-------------------------------------------------------------------------------
732# check SQL drivers, mouse drivers and decorations available in this package
733#-------------------------------------------------------------------------------
734
735# opensource version removes some drivers, so force them to be off
736CFG_SQL_tds=no
737CFG_SQL_oci=no
738CFG_SQL_db2=no
739
740CFG_SQL_AVAILABLE=
741if [ -d "$relpath/src/plugins/sqldrivers" ]; then
742  for a in "$relpath/src/plugins/sqldrivers/"*; do
743     if [ -d "$a" ]; then
744         base_a=`basename $a`
745         CFG_SQL_AVAILABLE="${CFG_SQL_AVAILABLE} ${base_a}"
746         eval "CFG_SQL_${base_a}=auto"
747     fi
748  done
749fi
750
751CFG_DECORATION_PLUGIN_AVAILABLE=
752if [ -d "$relpath/src/plugins/decorations" ]; then
753  for a in "$relpath/src/plugins/decorations/"*; do
754     if [ -d "$a" ]; then
755         base_a=`basename $a`
756         CFG_DECORATION_PLUGIN_AVAILABLE="${CFG_DECORATION_PLUGIN_AVAILABLE} ${base_a}"
757     fi
758  done
759fi
760
761CFG_KBD_PLUGIN_AVAILABLE=
762if [ -d "$relpath/src/plugins/kbddrivers" ]; then
763  for a in "$relpath/src/plugins/kbddrivers/"*; do
764     if [ -d "$a" ]; then
765         base_a=`basename $a`
766         CFG_KBD_PLUGIN_AVAILABLE="${CFG_KBD_PLUGIN_AVAILABLE} ${base_a}"
767     fi
768  done
769fi
770
771CFG_MOUSE_PLUGIN_AVAILABLE=
772if [ -d "$relpath/src/plugins/mousedrivers" ]; then
773  for a in "$relpath/src/plugins/mousedrivers/"*; do
774     if [ -d "$a" ]; then
775         base_a=`basename $a`
776         CFG_MOUSE_PLUGIN_AVAILABLE="${CFG_MOUSE_PLUGIN_AVAILABLE} ${base_a}"
777     fi
778  done
779fi
780
781CFG_GFX_PLUGIN_AVAILABLE=
782if [ -d "$relpath/src/plugins/gfxdrivers" ]; then
783  for a in "$relpath/src/plugins/gfxdrivers/"*; do
784     if [ -d "$a" ]; then
785         base_a=`basename $a`
786         CFG_GFX_PLUGIN_AVAILABLE="${CFG_GFX_PLUGIN_AVAILABLE} ${base_a}"
787     fi
788  done
789  CFG_GFX_OFF="$CFG_GFX_AVAILABLE" # assume all off
790fi
791
792#-------------------------------------------------------------------------------
793# parse command line arguments
794#-------------------------------------------------------------------------------
795
796# parse the arguments, setting things to "yes" or "no"
797while [ "$#" -gt 0 ]; do
798    CURRENT_OPT="$1"
799    UNKNOWN_ARG=no
800    case "$1" in
801    #Autoconf style options
802    --enable-*)
803        VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"`
804        VAL=yes
805        ;;
806    --disable-*)
807        VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"`
808        VAL=no
809        ;;
810    --*=*)
811        VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"`
812        VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"`
813        ;;
814    --no-*)
815        VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
816        VAL=no
817        ;;
818    --*)
819        VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
820        VAL=yes
821        ;;
822    #Qt plugin options
823    -no-*-*|-plugin-*-*|-qt-*-*)
824        VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
825        VAL=`echo $1 | sed "s,^-\([^-]*\).*,\1,"`
826        ;;
827    #Qt style no options
828    -no-*)
829        VAR=`echo $1 | sed "s,^-no-\(.*\),\1,"`
830        VAL=no
831        ;;
832    #Qt style yes options
833        -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-svg|-webkit|-scripttools|-rpath|-force-pkg-config)
834        VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
835        VAL=yes
836        ;;
837    #Qt style options that pass an argument
838    -qconfig)
839        if [ "$PLATFORM_QWS" = "yes" ]; then
840            CFG_QCONFIG="$VAL"
841            VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
842            shift
843            VAL=$1
844        else
845            UNKNOWN_ARG=yes
846        fi
847        ;;
848    -prefix|-docdir|-headerdir|-plugindir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-demosdir|-depths|-make|-nomake|-platform|-xplatform|-buildkey|-sdk|-arch|-host-arch|-mysql_config)
849        VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
850        shift
851        VAL="$1"
852        ;;
853    #Qt style complex options in one command
854    -enable-*|-disable-*)
855        VAR=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
856        VAL=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
857        ;;
858    #Qt Builtin/System style options
859    -no-*|-system-*|-qt-*)
860        VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
861        VAL=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
862        ;;
863    #Options that cannot be generalized
864    -k|-continue)
865        VAR=fatal_error
866        VAL=no
867        ;;
868    -embedded)
869        VAR=embedded
870        # this option may or may not be followed by an argument
871        if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
872            VAL=auto
873        else
874            shift;
875            VAL=$1
876        fi
877        ;;
878    -opengl)
879        VAR=opengl
880        # this option may or may not be followed by an argument
881        if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
882            VAL=yes
883        else
884            shift;
885            VAL=$1
886        fi
887        ;;
888    -hostprefix)
889        VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
890        # this option may or may not be followed by an argument
891        if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
892            VAL=$outpath
893        else
894            shift;
895            VAL=$1
896        fi
897        ;;
898    -host-*-endian)
899        VAR=host_endian
900        VAL=`echo $1 | sed "s,^-.*-\(.*\)-.*,\1,"`
901        ;;
902    -*-endian)
903        VAR=endian
904        VAL=`echo $1 | sed "s,^-\(.*\)-.*,\1,"`
905        ;;
906    -qtnamespace)
907        VAR="qtnamespace"
908        shift
909        VAL="$1"
910        ;;
911    -graphicssystem)
912        VAR="graphicssystem"
913        shift
914        VAL=$1
915        ;;
916    -qtlibinfix)
917        VAR="qtlibinfix"
918        shift
919        VAL="$1"
920        ;;
921    -D?*|-D)
922        VAR="add_define"
923        if [ "$1" = "-D" ]; then
924            shift
925            VAL="$1"
926        else
927            VAL=`echo $1 | sed 's,-D,,'`
928        fi
929        ;;
930    -I?*|-I)
931        VAR="add_ipath"
932        if [ "$1" = "-I" ]; then
933            shift
934            VAL="$1"
935        else
936            VAL=`echo $1 | sed 's,-I,,'`
937        fi
938        ;;
939    -L?*|-L)
940        VAR="add_lpath"
941        if [ "$1" = "-L" ]; then
942            shift
943            VAL="$1"
944        else
945            VAL=`echo $1 | sed 's,-L,,'`
946        fi
947        ;;
948    -R?*|-R)
949        VAR="add_rpath"
950        if [ "$1" = "-R" ]; then
951            shift
952            VAL="$1"
953        else
954            VAL=`echo $1 | sed 's,-R,,'`
955        fi
956        ;;
957    -l?*)
958        VAR="add_link"
959        VAL=`echo $1 | sed 's,-l,,'`
960        ;;
961    -F?*|-F)
962        VAR="add_fpath"
963        if [ "$1" = "-F" ]; then
964            shift
965            VAL="$1"
966        else
967            VAL=`echo $1 | sed 's,-F,,'`
968        fi
969        ;;
970    -fw?*|-fw)
971        VAR="add_framework"
972        if [ "$1" = "-fw" ]; then
973            shift
974            VAL="$1"
975        else
976            VAL=`echo $1 | sed 's,-fw,,'`
977        fi
978        ;;
979    -*)
980        VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
981        VAL="unknown"
982        ;;
983    *)
984        UNKNOWN_ARG=yes
985        ;;
986    esac
987    if [ "$UNKNOWN_ARG" = "yes" ]; then
988        echo "$1: unknown argument"
989        OPT_HELP=yes
990        ERROR=yes
991        shift
992        continue
993     fi
994    shift
995
996    UNKNOWN_OPT=no
997    case "$VAR" in
998    qt3support)
999        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1000            CFG_QT3SUPPORT="$VAL"
1001        else
1002            UNKNOWN_OPT=yes
1003        fi
1004        ;;
1005    accessibility)
1006        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1007            CFG_ACCESSIBILITY="$VAL"
1008        else
1009            UNKNOWN_OPT=yes
1010        fi
1011        ;;
1012    license)
1013        LICENSE_FILE="$VAL"
1014        ;;
1015    gnumake)
1016        CFG_USE_GNUMAKE="$VAL"
1017        ;;
1018    mysql_config)
1019        CFG_MYSQL_CONFIG="$VAL"
1020        ;;
1021    prefix)
1022        QT_INSTALL_PREFIX="$VAL"
1023        ;;
1024    hostprefix)
1025        QT_HOST_PREFIX="$VAL"
1026        ;;
1027    force-pkg-config)
1028        QT_FORCE_PKGCONFIG=yes
1029        ;;
1030    docdir)
1031        QT_INSTALL_DOCS="$VAL"
1032        ;;
1033    headerdir)
1034        QT_INSTALL_HEADERS="$VAL"
1035        ;;
1036    plugindir)
1037        QT_INSTALL_PLUGINS="$VAL"
1038        ;;
1039    datadir)
1040        QT_INSTALL_DATA="$VAL"
1041        ;;
1042    libdir)
1043        QT_INSTALL_LIBS="$VAL"
1044        ;;
1045    qtnamespace)
1046        QT_NAMESPACE="$VAL"
1047        ;;
1048    qtlibinfix)
1049        QT_LIBINFIX="$VAL"
1050        ;;
1051    translationdir)
1052        QT_INSTALL_TRANSLATIONS="$VAL"
1053        ;;
1054    sysconfdir|settingsdir)
1055        QT_INSTALL_SETTINGS="$VAL"
1056        ;;
1057    examplesdir)
1058        QT_INSTALL_EXAMPLES="$VAL"
1059        ;;
1060    demosdir)
1061        QT_INSTALL_DEMOS="$VAL"
1062        ;;
1063    qconfig)
1064        CFG_QCONFIG="$VAL"
1065        ;;
1066    bindir)
1067        QT_INSTALL_BINS="$VAL"
1068        ;;
1069    buildkey)
1070        CFG_USER_BUILD_KEY="$VAL"
1071        ;;
1072    sxe)
1073        CFG_SXE="$VAL"
1074        ;;
1075    embedded)
1076        CFG_EMBEDDED="$VAL"
1077        if [ "$PLATFORM_QWS" != "no" ]; then
1078            if [ "$PLATFORM_QWS" = "maybe" ]; then
1079                PLATFORM_X11=no
1080                PLATFORM_MAC=no
1081                PLATFORM_QWS=yes
1082            fi
1083        else
1084            echo "No license exists to enable Qt for Embedded Linux. Disabling."
1085            CFG_EMBEDDED=no
1086        fi
1087        ;;
1088    sse)
1089        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1090            CFG_SSE="$VAL"
1091        else
1092            UNKNOWN_OPT=yes
1093        fi
1094        ;;
1095    endian)
1096        if [ "$VAL" = "little" ]; then
1097            CFG_ENDIAN="Q_LITTLE_ENDIAN"
1098        elif [ "$VAL" = "big" ]; then
1099            CFG_ENDIAN="Q_BIG_ENDIAN"
1100        else
1101            UNKNOWN_OPT=yes
1102        fi
1103        ;;
1104    host_endian)
1105        if [ "$VAL" = "little" ]; then
1106            CFG_HOST_ENDIAN="Q_LITTLE_ENDIAN"
1107        elif [ "$VAL" = "big" ]; then
1108            CFG_HOST_ENDIAN="Q_BIG_ENDIAN"
1109        else
1110            UNKNOWN_OPT=yes
1111        fi
1112        ;;
1113    armfpa)
1114        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1115            CFG_ARMFPA="$VAL"
1116        else
1117            UNKNOWN_OPT=yes
1118        fi
1119        ;;
1120    depths)
1121        CFG_QWS_DEPTHS="$VAL"
1122        ;;
1123    opengl)
1124        if  [ "$VAL" = "auto" ] || [ "$VAL" = "desktop" ] ||
1125            [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] ||
1126            [ "$VAL" = "es1cl" ] || [ "$VAL" = "es1" ] || [ "$VAL" = "es2" ]; then
1127            CFG_OPENGL="$VAL"
1128        else
1129            UNKNOWN_OPT=yes
1130        fi
1131        ;;
1132    graphicssystem)
1133        if [ "$PLATFORM_QWS" = "yes" ]; then
1134            echo "Error: Graphics System plugins are not supported on QWS."
1135            echo "   On QWS, the graphics system API is part of the QScreen plugin architecture "
1136            echo "   rather than existing as a separate plugin."
1137            echo ""
1138            UNKNOWN_OPT=yes
1139        else
1140            if  [ "$VAL" = "opengl" ]; then
1141                CFG_GRAPHICS_SYSTEM="opengl"
1142            elif [ "$VAL" = "raster" ]; then
1143                CFG_GRAPHICS_SYSTEM="raster"
1144            else
1145                UNKNOWN_OPT=yes
1146            fi
1147        fi
1148        ;;
1149           
1150    qvfb) # left for commandline compatibility, not documented
1151        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1152            if [ "$VAL" = "yes" ]; then
1153                QMakeVar add gfx-drivers qvfb
1154                QMakeVar add kbd-drivers qvfb
1155                QMakeVar add mouse-drivers qvfb
1156                CFG_GFX_ON="$CFG_GFX_ON qvfb"
1157                CFG_KBD_ON="$CFG_KBD_ON qvfb"
1158                CFG_MOUSE_ON="$CFG_MOUSE_ON qvfb"
1159            fi
1160        else
1161            UNKNOWN_OPT=yes
1162        fi
1163        ;;
1164    nomake)
1165        CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS $VAL"
1166        ;;
1167    make)
1168        CFG_BUILD_PARTS="$CFG_BUILD_PARTS $VAL"
1169        ;;
1170    x11)
1171        if [ "$PLATFORM_MAC" = "yes" ]; then
1172            PLATFORM_MAC=no
1173        elif [ "$PLATFORM_QWS" = "yes" ]; then
1174            PLATFORM_QWS=no
1175        fi
1176        if [ "$CFG_FRAMEWORK" = "auto" ]; then
1177            CFG_FRAMEWORK=no
1178        fi
1179        PLATFORM_X11=yes
1180        ;;
1181    sdk)
1182        if [ "$PLATFORM_MAC" = "yes" ]; then
1183            CFG_SDK="$VAL"
1184        else
1185            UNKNOWN_OPT=yes
1186        fi
1187        ;;
1188     dwarf2)
1189        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1190            CFG_MAC_DWARF2="$VAL"
1191        else
1192            UNKNOWN_OPT=yes
1193        fi
1194        ;;
1195    arch)
1196        if [ "$PLATFORM_MAC" = "yes" ]; then
1197            CFG_MAC_ARCHS="$CFG_MAC_ARCHS $VAL"
1198        else
1199            CFG_ARCH=$VAL
1200        fi
1201        ;;
1202    host-arch)
1203        CFG_HOST_ARCH=$VAL
1204        ;;
1205    universal)
1206        if [ "$PLATFORM_MAC" = "yes" ] && [ "$VAL" = "yes" ]; then
1207            CFG_MAC_ARCHS="$CFG_MAC_ARCHS x86 ppc"
1208        else
1209            UNKNOWN_OPT=yes
1210        fi
1211        ;;
1212    cocoa)
1213        if [ "$PLATFORM_MAC" = "yes" ] && [ "$VAL" = "yes" ]; then
1214            CFG_MAC_COCOA="$VAL"
1215            COMMANDLINE_MAC_COCOA="$VAL"
1216        else
1217            UNKNOWN_OPT=yes
1218        fi
1219        ;;
1220    framework)
1221        if [ "$PLATFORM_MAC" = "yes" ]; then
1222            CFG_FRAMEWORK="$VAL"
1223        else
1224            UNKNOWN_OPT=yes
1225        fi
1226        ;;
1227    profile)
1228        if [ "$VAL" = "yes" ]; then
1229            CFG_PROFILE=yes
1230            QMakeVar add QMAKE_CFLAGS -pg
1231            QMakeVar add QMAKE_CXXFLAGS -pg
1232            QMakeVar add QMAKE_LFLAGS -pg
1233            QMAKE_VARS="$QMAKE_VARS CONFIG+=nostrip"
1234        else
1235            UNKNOWN_OPT=yes
1236        fi
1237        ;;
1238    exceptions|g++-exceptions)
1239        if [ "$VAL" = "no" ]; then
1240            CFG_EXCEPTIONS=no
1241        elif [ "$VAL" = "yes" ]; then
1242            CFG_EXCEPTIONS=yes
1243        else
1244            UNKNOWN_OPT=yes
1245        fi
1246        ;;
1247    platform)
1248        PLATFORM="$VAL"
1249        # keep compatibility with old platform names
1250        case $PLATFORM in
1251        aix-64)
1252            PLATFORM=aix-xlc-64
1253            ;;
1254        hpux-o64)
1255            PLATFORM=hpux-acc-o64
1256            ;;
1257        hpux-n64)
1258            PLATFORM=hpux-acc-64
1259            ;;
1260        hpux-acc-n64)
1261            PLATFORM=hpux-acc-64
1262            ;;
1263        irix-n32)
1264            PLATFORM=irix-cc
1265            ;;
1266        irix-64)
1267            PLATFORM=irix-cc-64
1268            ;;
1269        irix-cc-n64)
1270            PLATFORM=irix-cc-64
1271            ;;
1272        reliant-64)
1273            PLATFORM=reliant-cds-64
1274            ;;
1275        solaris-64)
1276            PLATFORM=solaris-cc-64
1277            ;;
1278        solaris-64)
1279            PLATFORM=solaris-cc-64
1280            ;;
1281        openunix-cc)
1282            PLATFORM=unixware-cc
1283            ;;
1284        openunix-g++)
1285            PLATFORM=unixware-g++
1286            ;;
1287        unixware7-cc)
1288            PLATFORM=unixware-cc
1289            ;;
1290        unixware7-g++)
1291            PLATFORM=unixware-g++
1292            ;;
1293        macx-g++-64)
1294            PLATFORM=macx-g++
1295            NATIVE_64_ARCH=
1296            case `uname -p` in
1297            i386) NATIVE_64_ARCH="x86_64" ;;
1298            powerpc) NATIVE_64_ARCH="ppc64" ;;
1299            *)   echo "WARNING: Can't detect CPU architecture for macx-g++-64" ;;
1300            esac
1301            if [ ! -z "$NATIVE_64_ARCH" ]; then
1302                QTCONFIG_CONFIG="$QTCONFIG_CONFIG $NATIVE_64_ARCH"
1303                CFG_MAC_ARCHS="$CFG_MAC_ARCHS $NATIVE_64_ARCH"
1304            fi
1305            ;;
1306        esac
1307        ;;
1308    xplatform)
1309        XPLATFORM="$VAL"
1310        ;;
1311    debug-and-release)
1312        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1313            CFG_DEBUG_RELEASE="$VAL"
1314        else
1315            UNKNOWN_OPT=yes
1316        fi
1317        ;;
1318    optimized-qmake)
1319        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1320            CFG_RELEASE_QMAKE="$VAL"
1321        else
1322            UNKNOWN_OPT=yes
1323        fi
1324        ;;
1325    release)
1326        if [ "$VAL" = "yes" ]; then
1327            CFG_DEBUG=no
1328        elif [ "$VAL" = "no" ]; then
1329            CFG_DEBUG=yes
1330        else
1331            UNKNOWN_OPT=yes
1332        fi
1333        ;;
1334    prefix-install)
1335        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1336            CFG_PREFIX_INSTALL="$VAL"
1337        else
1338            UNKNOWN_OPT=yes
1339        fi
1340        ;;
1341    debug)
1342        CFG_DEBUG="$VAL"
1343        ;;
1344    developer-build|commercial|opensource|nokia-developer)
1345        # These switches have been dealt with already
1346        ;;
1347    static)
1348        if [ "$VAL" = "yes" ]; then
1349            CFG_SHARED=no
1350        elif [ "$VAL" = "no" ]; then
1351            CFG_SHARED=yes
1352        else
1353            UNKNOWN_OPT=yes
1354        fi
1355        ;;
1356    incremental)
1357        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1358            CFG_INCREMENTAL="$VAL"
1359        else
1360            UNKNOWN_OPT=yes
1361        fi
1362        ;;
1363    fatal_error)
1364        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1365            CFG_CONFIGURE_EXIT_ON_ERROR="$VAL"
1366        else
1367            UNKNOWN_OPT=yes
1368        fi
1369        ;;
1370    feature-*)
1371        if [ "$PLATFORM_QWS" = "yes" ]; then
1372            FEATURE=`echo $VAR | sed "s,^[^-]*-\([^-]*\),\1," | tr 'abcdefghijklmnopqrstuvwxyz-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
1373            if [ "$VAL" = "no" ]; then
1374                QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_$FEATURE"
1375            elif [ "$VAL" = "yes" ] || [ "$VAL" = "unknown" ]; then
1376                QCONFIG_FLAGS="$QCONFIG_FLAGS QT_$FEATURE"
1377            else
1378                UNKNOWN_OPT=yes
1379            fi
1380        else
1381            UNKNOWN_OPT=yes
1382        fi
1383        ;;
1384    shared)
1385        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1386            CFG_SHARED="$VAL"
1387        else
1388            UNKNOWN_OPT=yes
1389        fi
1390        ;;
1391    gif)
1392        [ "$VAL" = "qt" ] && VAL=yes
1393        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1394            CFG_GIF="$VAL"
1395        else
1396            UNKNOWN_OPT=yes
1397        fi
1398        ;;
1399    sm)
1400        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1401            CFG_SM="$VAL"
1402        else
1403            UNKNOWN_OPT=yes
1404        fi
1405
1406        ;;
1407    xinerama)
1408        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1409            CFG_XINERAMA="$VAL"
1410        else
1411            UNKNOWN_OPT=yes
1412        fi
1413        ;;
1414    xshape)
1415        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1416            CFG_XSHAPE="$VAL"
1417        else
1418            UNKNOWN_OPT=yes
1419        fi
1420        ;;
1421    xinput)
1422        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1423            CFG_XINPUT="$VAL"
1424        else
1425            UNKNOWN_OPT=yes
1426        fi
1427        ;;
1428    stl)
1429        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1430            CFG_STL="$VAL"
1431        else
1432            UNKNOWN_OPT=yes
1433        fi
1434        ;;
1435    pch)
1436        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1437            CFG_PRECOMPILE="$VAL"
1438        else
1439            UNKNOWN_OPT=yes
1440        fi
1441        ;;
1442    separate-debug-info)
1443        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1444            CFG_SEPARATE_DEBUG_INFO="$VAL"
1445        else
1446            UNKNOWN_OPT=yes
1447        fi
1448        ;;
1449    reduce-exports)
1450        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1451            CFG_REDUCE_EXPORTS="$VAL"
1452        else
1453            UNKNOWN_OPT=yes
1454        fi
1455        ;;
1456    mmx)
1457        if [ "$VAL" = "no" ]; then
1458            CFG_MMX="$VAL"
1459        else
1460            UNKNOWN_OPT=yes
1461        fi
1462        ;;
1463    3dnow)
1464        if [ "$VAL" = "no" ]; then
1465            CFG_3DNOW="$VAL"
1466        else
1467            UNKNOWN_OPT=yes
1468        fi
1469        ;;
1470    sse)
1471        if [ "$VAL" = "no" ]; then
1472            CFG_SSE="$VAL"
1473        else
1474            UNKNOWN_OPT=yes
1475        fi
1476        ;;
1477    sse2)
1478        if [ "$VAL" = "no" ]; then
1479            CFG_SSE2="$VAL"
1480        else
1481            UNKNOWN_OPT=yes
1482        fi
1483        ;;
1484    iwmmxt)
1485        CFG_IWMMXT="yes"
1486        ;;
1487    reduce-relocations)
1488        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1489            CFG_REDUCE_RELOCATIONS="$VAL"
1490        else
1491            UNKNOWN_OPT=yes
1492        fi
1493        ;;
1494    freetype)
1495        [ "$VAL" = "qt" ] && VAL=yes
1496        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1497            CFG_QWS_FREETYPE="$VAL"
1498        else
1499            UNKNOWN_OPT=yes
1500        fi
1501        ;;
1502    zlib)
1503        [ "$VAL" = "qt" ] && VAL=yes
1504        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1505            CFG_ZLIB="$VAL"
1506        else
1507            UNKNOWN_OPT=yes
1508        fi
1509        # No longer supported:
1510        #[ "$VAL" = "no" ] && CFG_LIBPNG=no
1511        ;;
1512    sqlite)
1513        if [ "$VAL" = "system" ]; then
1514            CFG_SQLITE=system
1515        else
1516            UNKNOWN_OPT=yes
1517        fi
1518        ;;
1519    libpng)
1520        [ "$VAL" = "yes" ] && VAL=qt
1521        if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1522            CFG_LIBPNG="$VAL"
1523        else
1524            UNKNOWN_OPT=yes
1525        fi
1526        ;;
1527    libjpeg)
1528        [ "$VAL" = "yes" ] && VAL=qt
1529        if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1530            CFG_LIBJPEG="$VAL"
1531        else
1532            UNKNOWN_OPT=yes
1533        fi
1534        ;;
1535    libmng)
1536        [ "$VAL" = "yes" ] && VAL=qt
1537        if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1538            CFG_LIBMNG="$VAL"
1539        else
1540            UNKNOWN_OPT=yes
1541        fi
1542        ;;
1543    libtiff)
1544        [ "$VAL" = "yes" ] && VAL=qt
1545        if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1546            CFG_LIBTIFF="$VAL"
1547        else
1548            UNKNOWN_OPT=yes
1549        fi
1550        ;;
1551    nas-sound)
1552        if [ "$VAL" = "system" ] || [ "$VAL" = "no" ]; then
1553            CFG_NAS="$VAL"
1554        else
1555            UNKNOWN_OPT=yes
1556        fi
1557        ;;
1558    xcursor)
1559        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1560            CFG_XCURSOR="$VAL"
1561        else
1562            UNKNOWN_OPT=yes
1563        fi
1564        ;;
1565    xfixes)
1566        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1567            CFG_XFIXES="$VAL"
1568        else
1569            UNKNOWN_OPT=yes
1570        fi
1571        ;;
1572    xrandr)
1573        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1574            CFG_XRANDR="$VAL"
1575        else
1576            UNKNOWN_OPT=yes
1577        fi
1578        ;;
1579    xrender)
1580        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1581            CFG_XRENDER="$VAL"
1582        else
1583            UNKNOWN_OPT=yes
1584        fi
1585        ;;
1586    mitshm)
1587        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1588            CFG_MITSHM="$VAL"
1589        else
1590            UNKNOWN_OPT=yes
1591        fi
1592        ;;
1593    fontconfig)
1594        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1595            CFG_FONTCONFIG="$VAL"
1596        else
1597            UNKNOWN_OPT=yes
1598        fi
1599        ;;
1600    xkb)
1601        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1602            CFG_XKB="$VAL"
1603        else
1604            UNKNOWN_OPT=yes
1605        fi
1606        ;;
1607    cups)
1608        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1609            CFG_CUPS="$VAL"
1610        else
1611            UNKNOWN_OPT=yes
1612        fi
1613        ;;
1614    iconv)
1615        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1616            CFG_ICONV="$VAL"
1617        else
1618            UNKNOWN_OPT=yes
1619        fi
1620        ;;
1621    glib)
1622        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1623            CFG_GLIB="$VAL"
1624        else
1625            UNKNOWN_OPT=yes
1626        fi
1627        ;;
1628    gstreamer)
1629        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1630            CFG_GSTREAMER="$VAL"
1631        else
1632            UNKNOWN_OPT=yes
1633        fi
1634        ;;
1635    gtkstyle)
1636        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1637            CFG_QGTKSTYLE="$VAL"
1638        else
1639            UNKNOWN_OPT=yes
1640        fi
1641        ;;
1642    qdbus|dbus)
1643        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "linked" ]; then
1644            CFG_DBUS="$VAL"
1645        elif [ "$VAL" = "runtime" ]; then
1646            CFG_DBUS="yes"
1647        else
1648            UNKNOWN_OPT=yes
1649        fi
1650        ;;
1651    dbus-linked)
1652        if [ "$VAL" = "yes" ]; then
1653            CFG_DBUS="linked"
1654        else
1655            UNKNOWN_OPT=yes
1656        fi
1657        ;;
1658    nis)
1659        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1660            CFG_NIS="$VAL"
1661        else
1662            UNKNOWN_OPT=yes
1663        fi
1664        ;;
1665    largefile)
1666        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1667            CFG_LARGEFILE="$VAL"
1668        else
1669            UNKNOWN_OPT=yes
1670        fi
1671        ;;
1672    openssl)
1673        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1674            CFG_OPENSSL="$VAL"
1675        else
1676            UNKNOWN_OPT=yes
1677        fi
1678        ;;
1679    openssl-linked)
1680        if [ "$VAL" = "yes" ]; then
1681            CFG_OPENSSL="linked"
1682        else
1683            UNKNOWN_OPT=yes
1684        fi
1685        ;;
1686    ptmalloc)
1687        if [ "$VAL" = "yes" ]; then
1688            CFG_PTMALLOC="yes"
1689        else
1690            UNKNOWN_OPT=yes
1691        fi
1692        ;;
1693
1694    xmlpatterns)
1695        if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1696            CFG_XMLPATTERNS="yes"
1697        else
1698            if [ "$VAL" = "no" ]; then
1699                CFG_XMLPATTERNS="no"
1700            else
1701                UNKNOWN_OPT=yes
1702            fi
1703        fi
1704        ;;
1705    scripttools)
1706        if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1707            CFG_SCRIPTTOOLS="yes"
1708        else
1709            if [ "$VAL" = "no" ]; then
1710                CFG_SCRIPTTOOLS="no"
1711            else
1712                UNKNOWN_OPT=yes
1713            fi
1714        fi
1715        ;;
1716    svg)
1717        if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1718            CFG_SVG="yes"
1719        else
1720            if [ "$VAL" = "no" ]; then
1721                CFG_SVG="no"
1722            else
1723                UNKNOWN_OPT=yes
1724            fi
1725        fi
1726        ;;
1727    webkit)
1728        if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1729            CFG_WEBKIT="yes"
1730        else
1731            if [ "$VAL" = "no" ]; then
1732                CFG_WEBKIT="no"
1733            else
1734                UNKNOWN_OPT=yes
1735            fi
1736        fi
1737        ;;
1738    confirm-license)
1739        if [ "$VAL" = "yes" ]; then
1740            OPT_CONFIRM_LICENSE="$VAL"
1741        else
1742            UNKNOWN_OPT=yes
1743        fi
1744        ;;
1745    h|help)
1746        if [ "$VAL" = "yes" ]; then
1747            OPT_HELP="$VAL"
1748        else
1749            UNKNOWN_OPT=yes
1750        fi
1751        ;;
1752    sql-*|gfx-*|decoration-*|kbd-*|mouse-*)
1753        # if Qt style options were used, $VAL can be "no", "qt", or "plugin"
1754        # if autoconf style options were used, $VAL can be "yes" or "no"
1755        [ "$VAL" = "yes" ] && VAL=qt
1756        # now $VAL should be "no", "qt", or "plugin"... double-check
1757        if [ "$VAL" != "no" ] && [ "$VAL" != "qt" ] && [ "$VAL" != "plugin" ]; then
1758            UNKNOWN_OPT=yes
1759        fi
1760        # now $VAL is "no", "qt", or "plugin"
1761        OPT="$VAL"
1762        VAL=`echo $VAR | sed "s,^[^-]*-\([^-]*\).*,\1,"`
1763        VAR=`echo $VAR | sed "s,^\([^-]*\).*,\1,"`
1764
1765        # Grab the available values
1766        case "$VAR" in
1767        sql)
1768            avail="$CFG_SQL_AVAILABLE"
1769            ;;
1770        gfx)
1771            avail="$CFG_GFX_AVAILABLE"
1772            if [ "$OPT" = "plugin" ]; then
1773                avail="$CFG_GFX_PLUGIN_AVAILABLE"
1774            fi
1775            ;;
1776        decoration)
1777            avail="$CFG_DECORATION_AVAILABLE"
1778            if [ "$OPT" = "plugin" ]; then
1779                avail="$CFG_DECORATION_PLUGIN_AVAILABLE"
1780            fi
1781            ;;
1782        kbd)
1783            avail="$CFG_KBD_AVAILABLE"
1784            if [ "$OPT" = "plugin" ]; then
1785                avail="$CFG_KBD_PLUGIN_AVAILABLE"
1786            fi
1787            ;;
1788        mouse)
1789            avail="$CFG_MOUSE_AVAILABLE"
1790            if [ "$OPT" = "plugin" ]; then
1791                avail="$CFG_MOUSE_PLUGIN_AVAILABLE"
1792            fi
1793            ;;
1794        *)
1795            avail=""
1796            echo "BUG: Unhandled type $VAR used in $CURRENT_OPT"
1797            ;;
1798        esac
1799
1800        # Check that that user's value is available.
1801        found=no
1802        for d in $avail; do
1803            if [ "$VAL" = "$d" ]; then
1804                found=yes
1805                break
1806            fi
1807        done
1808        [ "$found" = yes ] || ERROR=yes
1809
1810        if [ "$VAR" = "sql" ]; then
1811            # set the CFG_SQL_driver
1812            eval "CFG_SQL_$VAL=\$OPT"
1813            continue
1814        fi
1815
1816        if [ "$OPT" = "plugin" ] || [ "$OPT" = "qt" ]; then
1817            if [ "$OPT" = "plugin" ]; then
1818                [ "$VAR" = "decoration" ] && QMakeVar del "${VAR}s" "$VAL"
1819                [ "$VAR" = "decoration" ] && CFG_DECORATION_ON=`echo "${CFG_DECORATION_ON} " | sed "s,${VAL} ,,g"` && CFG_DECORATION_PLUGIN="$CFG_DECORATION_PLUGIN ${VAL}"
1820                [ "$VAR" = "kbd" ] && QMakeVar del "${VAR}s" "$VAL"
1821                [ "$VAR" = "kbd" ] && CFG_KBD_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"` && CFG_KBD_PLUGIN="$CFG_KBD_PLUGIN ${VAL}"
1822                [ "$VAR" = "mouse" ] && QMakeVar del "${VAR}s" "$VAL"
1823                [ "$VAR" = "mouse" ] && CFG_MOUSE_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"` && CFG_MOUSE_PLUGIN="$CFG_MOUSE_PLUGIN ${VAL}"
1824                [ "$VAR" = "gfx" ] && QMakeVar del "${VAR}s" "$VAL"
1825                [ "$VAR" = "gfx" ] && CFG_GFX_ON=`echo "${CFG_GFX_ON} " | sed "s,${VAL} ,,g"` && CFG_GFX_PLUGIN="${CFG_GFX_PLUGIN} ${VAL}"
1826                VAR="${VAR}-${OPT}"
1827            else
1828                if [ "$VAR" = "gfx" ] || [ "$VAR" = "kbd" ] || [ "$VAR" = "decoration" ] || [ "$VAR" = "mouse" ]; then
1829                    [ "$VAR" = "gfx" ] && CFG_GFX_ON="$CFG_GFX_ON $VAL"
1830                    [ "$VAR" = "kbd" ] && CFG_KBD_ON="$CFG_KBD_ON $VAL"
1831                    [ "$VAR" = "decoration" ] && CFG_DECORATION_ON="$CFG_DECORATION_ON $VAL"
1832                    [ "$VAR" = "mouse" ] && CFG_MOUSE_ON="$CFG_MOUSE_ON $VAL"
1833                    VAR="${VAR}-driver"
1834                fi
1835            fi
1836            QMakeVar add "${VAR}s" "${VAL}"
1837        elif [ "$OPT" = "no" ]; then
1838            PLUG_VAR="${VAR}-plugin"
1839            if [ "$VAR" = "gfx" ] || [ "$VAR" = "kbd" ] || [ "$VAR" = "mouse" ]; then
1840                IN_VAR="${VAR}-driver"
1841            else
1842                IN_VAR="${VAR}"
1843            fi
1844            [ "$VAR" = "decoration" ] && CFG_DECORATION_ON=`echo "${CFG_DECORATION_ON} " | sed "s,${VAL} ,,g"`
1845            [ "$VAR" = "gfx" ] && CFG_GFX_ON=`echo "${CFG_GFX_ON} " | sed "s,${VAL} ,,g"`
1846            [ "$VAR" = "kbd" ] && CFG_KBD_ON=`echo "${CFG_KBD_ON} " | sed "s,${VAL} ,,g"`
1847            [ "$VAR" = "mouse" ] && CFG_MOUSE_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"`
1848            QMakeVar del "${IN_VAR}s" "$VAL"
1849            QMakeVar del "${PLUG_VAR}s" "$VAL"
1850        fi
1851        if [ "$ERROR" = "yes" ]; then
1852           echo "$CURRENT_OPT: unknown argument"
1853           OPT_HELP=yes
1854        fi
1855        ;;
1856    v|verbose)
1857        if [ "$VAL" = "yes" ]; then
1858            if [ "$OPT_VERBOSE" = "$VAL" ]; then            # takes two verboses to turn on qmake debugs
1859                QMAKE_SWITCHES="$QMAKE_SWITCHES -d"
1860            else
1861                OPT_VERBOSE=yes
1862            fi
1863        elif [ "$VAL" = "no" ]; then
1864            if [ "$OPT_VERBOSE" = "$VAL" ] && echo "$QMAKE_SWITCHES" | grep ' -d' >/dev/null 2>&1; then
1865                QMAKE_SWITCHES=`echo $QMAKE_SWITCHES | sed "s, -d,,"`
1866            else
1867                OPT_VERBOSE=no
1868            fi
1869        else
1870            UNKNOWN_OPT=yes
1871        fi
1872        ;;
1873    fast)
1874        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1875            OPT_FAST="$VAL"
1876        else
1877            UNKNOWN_OPT=yes
1878        fi
1879        ;;
1880    rpath)
1881        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1882            CFG_RPATH="$VAL"
1883        else
1884            UNKNOWN_OPT=yes
1885        fi
1886        ;;
1887    add_define)
1888        D_FLAGS="$D_FLAGS \"$VAL\""
1889        ;;
1890    add_ipath)
1891        I_FLAGS="$I_FLAGS -I\"${VAL}\""
1892        ;;
1893    add_lpath)
1894        L_FLAGS="$L_FLAGS -L\"${VAL}\""
1895        ;;
1896    add_rpath)
1897        RPATH_FLAGS="$RPATH_FLAGS \"${VAL}\""
1898        ;;
1899    add_link)
1900        l_FLAGS="$l_FLAGS -l\"${VAL}\""
1901        ;;
1902    add_fpath)
1903        if [ "$PLATFORM_MAC" = "yes" ]; then
1904            L_FLAGS="$L_FLAGS -F\"${VAL}\""
1905            I_FLAGS="$I_FLAGS -F\"${VAL}\""
1906        else
1907            UNKNOWN_OPT=yes
1908        fi
1909        ;;
1910    add_framework)
1911        if [ "$PLATFORM_MAC" = "yes" ]; then
1912            l_FLAGS="$l_FLAGS -framework \"${VAL}\""
1913        else
1914            UNKNOWN_OPT=yes
1915        fi
1916        ;;
1917    silent)
1918        CFG_SILENT="$VAL"
1919        ;;
1920    phonon)
1921        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1922            CFG_PHONON="$VAL"
1923        else
1924            UNKNOWN_OPT=yes
1925        fi
1926        ;;
1927    phonon-backend)
1928        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1929            CFG_PHONON_BACKEND="$VAL"
1930        else
1931            UNKNOWN_OPT=yes
1932        fi
1933        ;;
1934    *)
1935        UNKNOWN_OPT=yes
1936        ;;
1937    esac
1938    if [ "$UNKNOWN_OPT" = "yes" ]; then
1939        echo "${CURRENT_OPT}: invalid command-line switch"
1940        OPT_HELP=yes
1941        ERROR=yes
1942    fi
1943done
1944
1945if [ "$CFG_QCONFIG" != "full" ] && [ "$CFG_QT3SUPPORT" = "yes" ]; then
1946    echo "Warning: '-qconfig $CFG_QCONFIG' will disable the qt3support library."
1947    CFG_QT3SUPPORT="no"
1948fi
1949
1950# update QT_CONFIG to show our current predefined configuration
1951case "$CFG_QCONFIG" in
1952minimal|small|medium|large|full)
1953    # these are a sequence of increasing functionality
1954    for c in minimal small medium large full; do
1955        QT_CONFIG="$QT_CONFIG $c-config"
1956        [ "$CFG_QCONFIG" = $c ] && break
1957    done
1958    ;;
1959*)
1960    # not known to be sufficient for anything
1961    if [ '!' -f "$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h" ]; then
1962        echo >&2 "Error: configuration file not found:"
1963        echo >&2 $relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h"
1964        OPT_HELP=yes
1965    fi
1966esac
1967
1968#-------------------------------------------------------------------------------
1969# build tree initialization
1970#-------------------------------------------------------------------------------
1971
1972# where to find which..
1973unixtests="$relpath/config.tests/unix"
1974mactests="$relpath/config.tests/mac"
1975WHICH="$unixtests/which.test"
1976
1977PERL=`$WHICH perl 2>/dev/null`
1978
1979# find out which awk we want to use, prefer gawk, then nawk, then regular awk
1980AWK=
1981for e in gawk nawk awk; do
1982    if "$WHICH" $e >/dev/null 2>&1 && ( $e -f /dev/null /dev/null ) >/dev/null 2>&1; then
1983        AWK=$e
1984        break
1985    fi
1986done
1987
1988### skip this if the user just needs help...
1989if [ "$OPT_HELP" != "yes" ]; then
1990
1991# is this a shadow build?
1992if [ "$OPT_SHADOW" = "maybe" ]; then
1993    OPT_SHADOW=no
1994    if [ "$relpath" != "$outpath" ] && [ '!' -f "$outpath/configure" ]; then
1995        if [ -h "$outpath" ]; then
1996            [ "$relpath" -ef "$outpath" ] || OPT_SHADOW=yes
1997        else
1998            OPT_SHADOW=yes
1999        fi
2000    fi
2001fi
2002if [ "$OPT_SHADOW" = "yes" ]; then
2003    if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" ]; then
2004        echo >&2 "You cannot make a shadow build from a source tree containing a previous build."
2005        echo >&2 "Cannot proceed."
2006        exit 1
2007    fi
2008    [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..."
2009fi
2010
2011if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
2012    echo
2013    echo "WARNING: -debug-and-release is not supported anymore on Qt/X11 and Qt for Embedded Linux"
2014    echo "By default, Qt is built in release mode with separate debug information, so"
2015    echo "-debug-and-release is not necessary anymore"
2016    echo
2017fi
2018
2019# detect build style
2020if [ "$CFG_DEBUG" = "auto" ]; then
2021    if [ "$PLATFORM_MAC" = "yes" ]; then
2022        CFG_DEBUG_RELEASE=yes
2023        CFG_DEBUG=yes
2024    elif [ "$CFG_DEV" = "yes" ]; then
2025        CFG_DEBUG_RELEASE=no
2026        CFG_DEBUG=yes
2027    else
2028        CFG_DEBUG_RELEASE=no
2029        CFG_DEBUG=no
2030    fi
2031fi
2032if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
2033    QMAKE_CONFIG="$QMAKE_CONFIG build_all"
2034fi
2035
2036if [ "$CFG_SILENT" = "yes" ]; then
2037    QMAKE_CONFIG="$QMAKE_CONFIG silent"
2038fi
2039
2040# if the source tree is different from the build tree,
2041# symlink or copy part of the sources
2042if [ "$OPT_SHADOW" = "yes" ]; then
2043    echo "Preparing build tree..."
2044
2045    if [ -z "$PERL" ]; then
2046        echo
2047        echo "You need perl in your PATH to make a shadow build."
2048        echo "Cannot proceed."
2049        exit 1
2050    fi
2051
2052    [ -d "$outpath/bin" ] || mkdir -p "$outpath/bin"
2053
2054    # symlink the qmake directory
2055    find "$relpath/qmake" | while read a; do
2056        my_a=`echo "$a" | sed "s,^${relpath}/,${outpath}/,"`
2057        if [ '!' -f "$my_a" ]; then
2058            if [ -d "$a" ]; then
2059                # directories are created...
2060                mkdir -p "$my_a"
2061            else
2062                a_dir=`dirname "$my_a"`
2063                [ -d "$a_dir" ] || mkdir -p "$a_dir"
2064                # ... and files are symlinked
2065                case `basename "$a"` in
2066                *.o|*.d|GNUmakefile*|qmake)
2067                    ;;
2068                *)
2069                    rm -f "$my_a"
2070                    ln -s "$a" "$my_a"
2071                    ;;
2072                esac
2073            fi
2074        fi
2075    done
2076
2077    # make a syncqt script that can be used in the shadow
2078    rm -f "$outpath/bin/syncqt"
2079    if [ -x "$relpath/bin/syncqt" ]; then
2080        mkdir -p "$outpath/bin"
2081        echo "#!/bin/sh" >"$outpath/bin/syncqt"
2082        echo "QTDIR=\"$relpath\"; export QTDIR" >>"$outpath/bin/syncqt"
2083        echo "perl \"$relpath/bin/syncqt\" -outdir \"$outpath\" $*" >>"$outpath/bin/syncqt"
2084        chmod 755 "$outpath/bin/syncqt"
2085    fi
2086
2087    # symlink the mkspecs directory
2088    mkdir -p "$outpath/mkspecs"
2089    rm -f "$outpath"/mkspecs/*
2090    ln -s "$relpath"/mkspecs/* "$outpath/mkspecs"
2091    rm -f "$outpath/mkspecs/default"
2092
2093    # symlink the doc directory
2094    rm -rf "$outpath/doc"
2095    ln -s "$relpath/doc" "$outpath/doc"
2096
2097    # make sure q3porting.xml can be found
2098    mkdir -p "$outpath/tools/porting/src"
2099    rm -f "$outpath/tools/porting/src/q3porting.xml"
2100    ln -s "$relpath/tools/porting/src/q3porting.xml" "$outpath/tools/porting/src"
2101fi
2102
2103# symlink files from src/gui/embedded neccessary to build qvfb
2104if [ "$CFG_DEV" = "yes" ]; then
2105    for f in qvfbhdr.h qlock_p.h qlock.cpp qwssignalhandler_p.h qwssignalhandler.cpp; do
2106        dest="${relpath}/tools/qvfb/${f}"
2107        rm -f "$dest"
2108        ln -s "${relpath}/src/gui/embedded/${f}" "${dest}"
2109    done
2110fi
2111
2112# symlink fonts to be able to run application from build directory
2113if [ "$PLATFORM_QWS" = "yes" ] && [ ! -e "${outpath}/lib/fonts" ]; then
2114    if [ "$PLATFORM" = "$XPLATFORM" ]; then
2115        mkdir -p "${outpath}/lib"
2116        ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts"
2117    fi
2118fi
2119
2120if [ "$OPT_FAST" = "auto" ]; then
2121   if [ '!' -z "$AWK" ] && [ "$CFG_DEV" = "yes" ]; then
2122       OPT_FAST=yes
2123   else
2124       OPT_FAST=no
2125   fi
2126fi
2127
2128# find a make command
2129if [ -z "$MAKE" ]; then
2130    MAKE=
2131    for mk in gmake make; do
2132        if "$WHICH" $mk >/dev/null 2>&1; then
2133            MAKE=`$WHICH $mk`
2134            break
2135        fi
2136    done
2137    if [ -z "$MAKE" ]; then
2138        echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH."
2139        echo >&2 "Cannot proceed."
2140        exit 1
2141    fi
2142fi
2143
2144fi ### help
2145
2146#-------------------------------------------------------------------------------
2147# auto-detect all that hasn't been specified in the arguments
2148#-------------------------------------------------------------------------------
2149
2150[ "$PLATFORM_QWS" = "yes" -a "$CFG_EMBEDDED" = "no" ] && CFG_EMBEDDED=auto
2151if [ "$CFG_EMBEDDED" != "no" ]; then
2152    case "$UNAME_SYSTEM:$UNAME_RELEASE" in
2153    Darwin:*)
2154        [ -z "$PLATFORM" ] && PLATFORM=qws/macx-generic-g++
2155        if [ -z "$XPLATFORM" ]; then
2156            [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2157            XPLATFORM="qws/macx-$CFG_EMBEDDED-g++"
2158        fi
2159        ;;
2160    FreeBSD:*)
2161        [ -z "$PLATFORM" ] && PLATFORM=qws/freebsd-generic-g++
2162        if [ -z "$XPLATFORM" ]; then
2163            [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2164            XPLATFORM="qws/freebsd-$CFG_EMBEDDED-g++"
2165        fi
2166        ;;
2167    SunOS:5*)
2168        [ -z "$PLATFORM" ] && PLATFORM=qws/solaris-generic-g++
2169        if [ -z "$XPLATFORM" ]; then
2170            [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2171            XPLATFORM="qws/solaris-$CFG_EMBEDDED-g++"
2172        fi
2173        ;;
2174    Linux:*)
2175        if [ -z "$PLATFORM" ]; then
2176            case "$UNAME_MACHINE" in
2177            *86)
2178                PLATFORM=qws/linux-x86-g++
2179                ;;
2180            *86_64)
2181                PLATFORM=qws/linux-x86_64-g++
2182                ;;
2183            *ppc)
2184                PLATFORM=qws/linux-ppc-g++
2185                ;;
2186            *)
2187                PLATFORM=qws/linux-generic-g++
2188                ;;
2189            esac
2190        fi
2191        if [ -z "$XPLATFORM" ]; then
2192            if [ "$CFG_EMBEDDED" = "auto" ]; then
2193                if [ -n "$CFG_ARCH" ]; then
2194                    CFG_EMBEDDED=$CFG_ARCH
2195                else
2196                    case "$UNAME_MACHINE" in
2197                    *86)
2198                        CFG_EMBEDDED=x86
2199                        ;;
2200                    *86_64)
2201                        CFG_EMBEDDED=x86_64
2202                        ;;
2203                    *ppc)
2204                        CFG_EMBEDDED=ppc
2205                        ;;
2206                    *)
2207                        CFG_EMBEDDED=generic
2208                        ;;
2209                    esac
2210                fi
2211            fi
2212            XPLATFORM="qws/linux-$CFG_EMBEDDED-g++"
2213        fi
2214        ;;
2215    CYGWIN*:*)
2216        CFG_EMBEDDED=x86
2217        ;;
2218    *)
2219        echo "Qt for Embedded Linux is not supported on this platform. Disabling."
2220        CFG_EMBEDDED=no
2221        PLATFORM_QWS=no
2222        ;;
2223    esac
2224fi
2225if [ -z "$PLATFORM" ]; then
2226    PLATFORM_NOTES=
2227    case "$UNAME_SYSTEM:$UNAME_RELEASE" in
2228     Darwin:*)
2229        if [ "$PLATFORM_MAC" = "yes" ]; then
2230          PLATFORM=macx-g++
2231        # PLATFORM=macx-xcode
2232        else
2233          PLATFORM=darwin-g++
2234        fi
2235        ;;
2236     AIX:*)
2237        #PLATFORM=aix-g++
2238        #PLATFORM=aix-g++-64
2239        PLATFORM=aix-xlc
2240        #PLATFORM=aix-xlc-64
2241        PLATFORM_NOTES="
2242            - Also available for AIX: aix-g++ aix-g++-64 aix-xlc-64
2243        "
2244        ;;
2245     GNU:*)
2246        PLATFORM=hurd-g++
2247        ;;
2248     dgux:*)
2249        PLATFORM=dgux-g++
2250        ;;
2251#     DYNIX/ptx:4*)
2252#       PLATFORM=dynix-g++
2253#       ;;
2254     ULTRIX:*)
2255        PLATFORM=ultrix-g++
2256        ;;
2257     FreeBSD:*)
2258        PLATFORM=freebsd-g++
2259        PLATFORM_NOTES="
2260            - Also available for FreeBSD: freebsd-icc
2261        "
2262        ;;
2263     OpenBSD:*)
2264        PLATFORM=openbsd-g++
2265        ;;
2266     NetBSD:*)
2267        PLATFORM=netbsd-g++
2268        ;;
2269     BSD/OS:*|BSD/386:*)
2270        PLATFORM=bsdi-g++
2271        ;;
2272     IRIX*:*)
2273        #PLATFORM=irix-g++
2274        PLATFORM=irix-cc
2275        #PLATFORM=irix-cc-64
2276        PLATFORM_NOTES="
2277            - Also available for IRIX: irix-g++ irix-cc-64
2278        "
2279        ;;
2280     HP-UX:*)
2281        case "$UNAME_MACHINE" in
2282            ia64)
2283                #PLATFORM=hpuxi-acc-32
2284                PLATFORM=hpuxi-acc-64
2285                PLATFORM_NOTES="
2286                    - Also available for HP-UXi: hpuxi-acc-32
2287                "
2288            ;;
2289            *)
2290                #PLATFORM=hpux-g++
2291                PLATFORM=hpux-acc
2292                #PLATFORM=hpux-acc-64
2293                #PLATFORM=hpux-cc
2294                #PLATFORM=hpux-acc-o64
2295                PLATFORM_NOTES="
2296                    - Also available for HP-UX: hpux-g++ hpux-acc-64 hpux-acc-o64
2297                "
2298            ;;
2299        esac
2300        ;;
2301     OSF1:*)
2302        #PLATFORM=tru64-g++
2303        PLATFORM=tru64-cxx
2304        PLATFORM_NOTES="
2305            - Also available for Tru64: tru64-g++
2306        "
2307        ;;
2308     Linux:*)
2309        case "$UNAME_MACHINE" in
2310            x86_64|s390x|ppc64)
2311                PLATFORM=linux-g++-64
2312                ;;
2313            *)
2314                PLATFORM=linux-g++
2315                ;;
2316        esac
2317        PLATFORM_NOTES="
2318            - Also available for Linux: linux-kcc linux-icc linux-cxx
2319        "
2320        ;;
2321     SunOS:5*)
2322        #PLATFORM=solaris-g++
2323        PLATFORM=solaris-cc
2324        #PLATFORM=solaris-cc64
2325        PLATFORM_NOTES="
2326            - Also available for Solaris: solaris-g++ solaris-cc-64
2327        "
2328        ;;
2329     ReliantUNIX-*:*|SINIX-*:*)
2330        PLATFORM=reliant-cds
2331        #PLATFORM=reliant-cds-64
2332        PLATFORM_NOTES="
2333            - Also available for Reliant UNIX: reliant-cds-64
2334        "
2335        ;;
2336     CYGWIN*:*)
2337        PLATFORM=cygwin-g++
2338        ;;
2339     LynxOS*:*)
2340        PLATFORM=lynxos-g++
2341        ;;
2342     OpenUNIX:*)
2343        #PLATFORM=unixware-g++
2344        PLATFORM=unixware-cc
2345        PLATFORM_NOTES="
2346            - Also available for OpenUNIX: unixware-g++
2347        "
2348        ;;
2349     UnixWare:*)
2350        #PLATFORM=unixware-g++
2351        PLATFORM=unixware-cc
2352        PLATFORM_NOTES="
2353            - Also available for UnixWare: unixware-g++
2354        "
2355        ;;
2356     SCO_SV:*)
2357        #PLATFORM=sco-g++
2358        PLATFORM=sco-cc
2359        PLATFORM_NOTES="
2360            - Also available for SCO OpenServer: sco-g++
2361        "
2362        ;;
2363     UNIX_SV:*)
2364        PLATFORM=unixware-g++
2365        ;;
2366     *)
2367        if [ "$OPT_HELP" != "yes" ]; then
2368            echo
2369            for p in $PLATFORMS; do
2370                echo "    $relconf $* -platform $p"
2371            done
2372            echo >&2
2373            echo "   The build script does not currently recognize all" >&2
2374            echo "   platforms supported by Qt." >&2
2375            echo "   Rerun this script with a -platform option listed to" >&2
2376            echo "   set the system/compiler combination you use." >&2
2377            echo >&2
2378            exit 2
2379        fi
2380    esac
2381fi
2382
2383if [ "$PLATFORM_QWS" = "yes" ]; then
2384    CFG_SM=no
2385    PLATFORMS=`find "$relpath/mkspecs/qws" | sed "s,$relpath/mkspecs/qws/,,"`
2386else
2387    PLATFORMS=`find "$relpath/mkspecs/" -type f | grep -v qws | sed "s,$relpath/mkspecs/qws/,,"`
2388fi
2389
2390[ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM"
2391if [ -d "$PLATFORM" ]; then
2392  QMAKESPEC="$PLATFORM"
2393else
2394  QMAKESPEC="$relpath/mkspecs/${PLATFORM}"
2395fi
2396if [ -d "$XPLATFORM" ]; then
2397  XQMAKESPEC="$XPLATFORM"
2398else
2399  XQMAKESPEC="$relpath/mkspecs/${XPLATFORM}"
2400fi
2401if [ "$PLATFORM" != "$XPLATFORM" ]; then
2402    QT_CROSS_COMPILE=yes
2403    QMAKE_CONFIG="$QMAKE_CONFIG cross_compile"
2404fi
2405
2406if [ "$PLATFORM_MAC" = "yes" ]; then
2407   if [ `basename $QMAKESPEC` = "macx-xcode" ] || [ `basename $XQMAKESPEC` = "macx-xcode" ]; then
2408      echo >&2
2409      echo "   Platform 'macx-xcode' should not be used when building Qt/Mac." >&2
2410      echo "   Please build Qt/Mac with 'macx-g++', then if you would like to" >&2
2411      echo "   use mac-xcode on your application code it can link to a Qt/Mac" >&2
2412      echo "   built with 'macx-g++'" >&2
2413      echo >&2
2414      exit 2
2415    fi
2416fi
2417
2418# check specified platforms are supported
2419if [ '!' -d "$QMAKESPEC" ]; then
2420    echo
2421    echo "   The specified system/compiler is not supported:"
2422    echo
2423    echo "      $QMAKESPEC"
2424    echo
2425    echo "   Please see the README file for a complete list."
2426    echo
2427    exit 2
2428fi
2429if [ '!' -d "$XQMAKESPEC" ]; then
2430    echo
2431    echo "   The specified system/compiler is not supported:"
2432    echo
2433    echo "      $XQMAKESPEC"
2434    echo
2435    echo "   Please see the README file for a complete list."
2436    echo
2437    exit 2
2438fi
2439if [ '!' -f "${XQMAKESPEC}/qplatformdefs.h" ]; then
2440    echo
2441    echo "   The specified system/compiler port is not complete:"
2442    echo
2443    echo "      $XQMAKESPEC/qplatformdefs.h"
2444    echo
2445    echo "   Please contact qt-bugs@trolltech.com."
2446    echo
2447    exit 2
2448fi
2449
2450# now look at the configs and figure out what platform we are config'd for
2451[ "$CFG_EMBEDDED" = "no" ] \
2452  && [ '!' -z "`getQMakeConf \"$XQMAKESPEC\" | grep QMAKE_LIBS_X11 | awk '{print $3;}'`" ] \
2453  && PLATFORM_X11=yes
2454### echo "$XQMAKESPEC" | grep mkspecs/qws >/dev/null 2>&1 && PLATFORM_QWS=yes
2455
2456if [ "$UNAME_SYSTEM" = "SunOS" ]; then
2457    # Solaris 2.5 and 2.6 have libposix4, which was renamed to librt for Solaris 7 and up
2458    if echo $UNAME_RELEASE | grep "^5\.[5|6]" >/dev/null 2>&1; then
2459        sed -e "s,-lrt,-lposix4," "$XQMAKESPEC/qmake.conf" > "$XQMAKESPEC/qmake.conf.new"
2460        mv "$XQMAKESPEC/qmake.conf.new" "$XQMAKESPEC/qmake.conf"
2461    fi
2462fi
2463
2464#-------------------------------------------------------------------------------
2465# determine the system architecture
2466#-------------------------------------------------------------------------------
2467if [ "$OPT_VERBOSE" = "yes" ]; then
2468    echo "Determining system architecture... ($UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_MACHINE)"
2469fi
2470
2471if [ "$CFG_EMBEDDED" != "no" -a "$CFG_EMBEDDED" != "auto" ] && [ -n "$CFG_ARCH" ]; then
2472    if [ "$CFG_ARCH" != "$CFG_EMBEDDED" ]; then
2473        echo ""
2474        echo "You have specified a target architecture with -embedded and -arch."
2475        echo "The two architectures you have specified are different, so we can"
2476        echo "not proceed. Either set both to be the same, or only use -embedded."
2477        echo ""
2478        exit 1
2479    fi
2480fi
2481
2482if [ -z "${CFG_HOST_ARCH}" ]; then
2483    case "$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_MACHINE" in
2484    IRIX*:*:*)
2485        CFG_HOST_ARCH=`uname -p`
2486        if [ "$OPT_VERBOSE" = "yes" ]; then
2487            echo "    SGI ($CFG_HOST_ARCH)"
2488        fi
2489        ;;
2490    SunOS:5*:*)
2491        case "$UNAME_MACHINE" in
2492        sun4u*|sun4v*)
2493            if [ "$OPT_VERBOSE" = "yes" ]; then
2494                echo "    Sun SPARC (sparc)"
2495            fi
2496            CFG_HOST_ARCH=sparc
2497            ;;
2498        i86pc)
2499            case "$PLATFORM" in
2500            *-64)
2501                if [ "$OPT_VERBOSE" = "yes" ]; then
2502                    echo "    64-bit AMD 80x86 (x86_64)"
2503                fi
2504                CFG_HOST_ARCH=x86_64
2505                ;;
2506            *)
2507                if [ "$OPT_VERBOSE" = "yes" ]; then
2508                    echo "    32-bit Intel 80x86 (i386)"
2509                fi
2510                CFG_HOST_ARCH=i386
2511                ;;
2512            esac
2513        esac
2514        ;;
2515    Darwin:*:*)
2516        case "$UNAME_MACHINE" in
2517            Power?Macintosh)
2518                if [ "$OPT_VERBOSE" = "yes" ]; then
2519                    echo "    32-bit Apple PowerPC (powerpc)"
2520                fi
2521                ;;
2522            x86)
2523                if [ "$OPT_VERBOSE" = "yes" ]; then
2524                    echo "    32-bit Intel 80x86 (i386)"
2525                fi
2526                ;;
2527        esac
2528        CFG_HOST_ARCH=macosx
2529        ;;
2530    AIX:*:00????????00)
2531        if [ "$OPT_VERBOSE" = "yes" ]; then
2532        echo "    64-bit IBM PowerPC (powerpc)"
2533        fi
2534        CFG_HOST_ARCH=powerpc
2535        ;;
2536    HP-UX:*:9000*)
2537        if [ "$OPT_VERBOSE" = "yes" ]; then
2538            echo "    HP PA-RISC (parisc)"
2539        fi
2540        CFG_HOST_ARCH=parisc
2541        ;;
2542    *:*:i?86)
2543        if [ "$OPT_VERBOSE" = "yes" ]; then
2544            echo "    32-bit Intel 80x86 (i386)"
2545        fi
2546        CFG_HOST_ARCH=i386
2547        ;;
2548    *:*:x86_64|*:*:amd64)
2549        if [ "$PLATFORM" = "linux-g++-32" -o "$PLATFORM" = "linux-icc-32" ]; then
2550            if [ "$OPT_VERBOSE" = "yes" ]; then
2551                echo "    32 bit on 64-bit AMD 80x86 (i386)"
2552            fi
2553            CFG_HOST_ARCH=i386
2554        else
2555            if [ "$OPT_VERBOSE" = "yes" ]; then
2556                echo "    64-bit AMD 80x86 (x86_64)"
2557            fi
2558            CFG_HOST_ARCH=x86_64
2559        fi
2560        ;;
2561    *:*:ppc)
2562        if [ "$OPT_VERBOSE" = "yes" ]; then
2563            echo "    32-bit PowerPC (powerpc)"
2564        fi
2565        CFG_HOST_ARCH=powerpc
2566        ;;
2567    *:*:ppc64)
2568        if [ "$OPT_VERBOSE" = "yes" ]; then
2569            echo "    64-bit PowerPC (powerpc)"
2570        fi
2571        CFG_HOST_ARCH=powerpc
2572        ;;
2573    *:*:s390*)
2574        if [ "$OPT_VERBOSE" = "yes" ]; then
2575            echo "    IBM S/390 (s390)"
2576        fi
2577        CFG_HOST_ARCH=s390
2578        ;;
2579    *:*:arm*)
2580        if [ "$OPT_VERBOSE" = "yes" ]; then
2581            echo "    ARM (arm)"
2582        fi
2583        CFG_HOST_ARCH=arm
2584        ;;
2585    Linux:*:sparc*)
2586        if [ "$OPT_VERBOSE" = "yes" ]; then
2587            echo "    Linux on SPARC"
2588        fi
2589        CFG_HOST_ARCH=sparc
2590        ;;
2591    *:*:*)
2592        if [ "$OPT_VERBOSE" = "yes" ]; then
2593            echo "    Trying '$UNAME_MACHINE'..."
2594        fi
2595        CFG_HOST_ARCH="$UNAME_MACHINE"
2596        ;;
2597    esac
2598fi
2599
2600if [ "$PLATFORM" != "$XPLATFORM" -a "$CFG_EMBEDDED" != "no" ]; then
2601    if [ -n "$CFG_ARCH" ]; then
2602        CFG_EMBEDDED=$CFG_ARCH
2603    fi
2604
2605    case "$CFG_EMBEDDED" in
2606    x86)
2607        CFG_ARCH=i386
2608        ;;
2609    x86_64)
2610        CFG_ARCH=x86_64
2611        ;;
2612    ipaq|sharp)
2613        CFG_ARCH=arm
2614        ;;
2615    dm7000)
2616        CFG_ARCH=powerpc
2617        ;;
2618    dm800)
2619        CFG_ARCH=mips
2620        ;;
2621    sh4al)
2622        CFG_ARCH=sh4a
2623        ;;
2624    *)
2625        CFG_ARCH="$CFG_EMBEDDED"
2626        ;;
2627    esac
2628elif [ "$PLATFORM_MAC" = "yes" ] || [ -z "$CFG_ARCH" ]; then
2629    CFG_ARCH=$CFG_HOST_ARCH
2630fi
2631
2632if [ -d "$relpath/src/corelib/arch/$CFG_ARCH" ]; then
2633    if [ "$OPT_VERBOSE" = "yes" ]; then
2634        echo "    '$CFG_ARCH' is supported"
2635    fi
2636else
2637    if [ "$OPT_VERBOSE" = "yes" ]; then
2638        echo "    '$CFG_ARCH' is unsupported, using 'generic'"
2639    fi
2640    CFG_ARCH=generic
2641fi
2642if [ "$CFG_HOST_ARCH" != "$CFG_ARCH" ]; then
2643    if [ -d "$relpath/src/corelib/arch/$CFG_HOST_ARCH" ]; then
2644        if [ "$OPT_VERBOSE" = "yes" ]; then
2645            echo "    '$CFG_HOST_ARCH' is supported"
2646        fi
2647    else
2648        if [ "$OPT_VERBOSE" = "yes" ]; then
2649            echo "    '$CFG_HOST_ARCH' is unsupported, using 'generic'"
2650        fi
2651        CFG_HOST_ARCH=generic
2652    fi
2653fi
2654
2655if [ "$OPT_VERBOSE" = "yes" ]; then
2656    echo "System architecture: '$CFG_ARCH'"
2657    if [ "$PLATFORM_QWS" = "yes" ]; then
2658        echo "Host architecture: '$CFG_HOST_ARCH'"
2659    fi
2660fi
2661
2662#-------------------------------------------------------------------------------
2663# tests that don't need qmake (must be run before displaying help)
2664#-------------------------------------------------------------------------------
2665
2666if [ -z "$PKG_CONFIG" ]; then
2667    # See if PKG_CONFIG is set in the mkspec:
2668    PKG_CONFIG=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%PKG_CONFIG[^_].*=%%p' | tr '\n' ' '`
2669fi
2670if [ -z "$PKG_CONFIG" ]; then
2671    PKG_CONFIG=`$WHICH pkg-config 2>/dev/null`
2672fi
2673
2674# Work out if we can use pkg-config
2675if [ "$QT_CROSS_COMPILE" = "yes" ]; then
2676    if [ "$QT_FORCE_PKGCONFIG" = "yes" ]; then
2677        echo >&2 ""
2678        echo >&2 "You have asked to use pkg-config and are cross-compiling."
2679        echo >&2 "Please make sure you have a correctly set-up pkg-config"
2680        echo >&2 "environment!"
2681        echo >&2 ""
2682        if [ -z "$PKG_CONFIG_PATH" ]; then
2683            echo >&2 ""
2684            echo >&2 "Warning: PKG_CONFIG_PATH has not been set.  This could mean"
2685            echo >&2 "the host compiler's .pc files will be used. This is probably"
2686            echo >&2 "not what you want."
2687            echo >&2 ""
2688        elif [ -z "$PKG_CONFIG_SYSROOT" ] && [ -z "$PKG_CONFIG_SYSROOT_DIR" ]; then
2689            echo >&2 ""
2690            echo >&2 "Warning: PKG_CONFIG_SYSROOT/PKG_CONFIG_SYSROOT_DIR has not"
2691            echo >&2 "been set. This means your toolchain's .pc files must contain"
2692            echo >&2 "the paths to the toolchain's libraries & headers. If configure"
2693            echo >&2 "tests are failing, please check these files."
2694            echo >&2 ""
2695        fi
2696    else
2697        PKG_CONFIG=""
2698    fi
2699fi
2700
2701# check -arch arguments for validity.
2702if [ "$PLATFORM_MAC" = "yes" ]; then
2703    ALLOWED="x86 ppc x86_64 ppc64"
2704    for i in $CFG_MAC_ARCHS 
2705    do 
2706        if echo "$ALLOWED" | grep -w -v "$i" > /dev/null 2>&1; then
2707            echo "Unknown architecture: \"$i\". Supported architectures: x86 ppc x86_64 ppc64";
2708            exit 2;
2709        fi
2710    done
2711fi
2712
2713# find the default framework value
2714if [ "$PLATFORM_MAC" = "yes" ] && [ "$PLATFORM" != "macx-xlc" ]; then
2715    if [ "$CFG_FRAMEWORK" = "auto" ]; then
2716        CFG_FRAMEWORK="$CFG_SHARED"
2717    elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
2718        echo
2719        echo "WARNING: Using static linking will disable the use of Mac frameworks."
2720        echo
2721        CFG_FRAMEWORK="no"
2722    fi
2723else
2724    CFG_FRAMEWORK=no
2725fi
2726
2727QMAKE_CONF_COMPILER=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_CXX[^_A-Z0-9]" | sed "s,.* *= *\(.*\)$,\1," | tail -1`
2728TEST_COMPILER="$CC"
2729[ -z "$TEST_COMPILER" ] && TEST_COMPILER=$QMAKE_CONF_COMPILER
2730
2731# auto-detect precompiled header support
2732if [ "$CFG_PRECOMPILE" = "auto" ]; then
2733    if [ `echo "$CFG_MAC_ARCHS" | wc -w` -gt 1 ]; then
2734       CFG_PRECOMPILE=no
2735    elif "$unixtests/precomp.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
2736       CFG_PRECOMPILE=no
2737    else
2738       CFG_PRECOMPILE=yes
2739    fi
2740elif [ "$CFG_PRECOMPILE" = "yes" ] && [ `echo "$CFG_MAC_ARCHS" | wc -w` -gt 1 ]; then
2741    echo
2742    echo "WARNING: Using universal binaries disables precompiled headers."
2743    echo
2744    CFG_PRECOMPILE=no
2745fi
2746
2747#auto-detect DWARF2 on the mac
2748if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" == "auto" ]; then
2749    if "$mactests/dwarf2.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
2750        CFG_MAC_DWARF2=no
2751    else
2752        CFG_MAC_DWARF2=yes
2753    fi
2754fi
2755
2756# auto-detect support for -Xarch on the mac
2757if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" == "auto" ]; then
2758    if "$mactests/xarch.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
2759        CFG_MAC_XARCH=no
2760    else
2761        CFG_MAC_XARCH=yes
2762    fi
2763fi
2764
2765# don't autodetect support for separate debug info on objcopy when
2766# cross-compiling as lots of toolchains seems to have problems with this
2767if [ "$QT_CROSS_COMPILE" = "yes" ] && [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
2768    CFG_SEPARATE_DEBUG_INFO="no"
2769fi
2770
2771# auto-detect support for separate debug info in objcopy
2772if [ "$CFG_SEPARATE_DEBUG_INFO" != "no" ] && [ "$CFG_SHARED" = "yes" ]; then
2773    TEST_COMPILER_CFLAGS=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%QMAKE_CFLAGS[^_].*=%%p' | tr '\n' ' '`
2774    TEST_COMPILER_CXXFLAGS=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%QMAKE_CXXFLAGS[^_].*=%%p' | tr '\n' ' '`
2775    TEST_OBJCOPY=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_OBJCOPY" | sed "s%.* *= *\(.*\)$%\1%" | tail -1`
2776    COMPILER_WITH_FLAGS="$TEST_COMPILER $TEST_COMPILER_CXXFLAGS"
2777    COMPILER_WITH_FLAGS=`echo "$COMPILER_WITH_FLAGS" | sed -e "s%\\$\\$QMAKE_CFLAGS%$TEST_COMPILER_CFLAGS%g"`
2778    if "$unixtests/objcopy.test" "$COMPILER_WITH_FLAGS" "$TEST_OBJCOPY" "$OPT_VERBOSE"; then
2779       CFG_SEPARATE_DEBUG_INFO=no
2780    else
2781       case "$PLATFORM" in
2782       hpux-*)
2783           # binutils on HP-UX is buggy; default to no.
2784           CFG_SEPARATE_DEBUG_INFO=no
2785           ;;
2786       *)
2787           CFG_SEPARATE_DEBUG_INFO=yes
2788           ;;
2789       esac
2790    fi
2791fi
2792
2793# auto-detect -fvisibility support
2794if [ "$CFG_REDUCE_EXPORTS" = "auto" ]; then
2795    if "$unixtests/fvisibility.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
2796       CFG_REDUCE_EXPORTS=no
2797    else
2798       CFG_REDUCE_EXPORTS=yes
2799    fi
2800fi
2801
2802# detect the availability of the -Bsymbolic-functions linker optimization
2803if [ "$CFG_REDUCE_RELOCATIONS" != "no" ]; then
2804    if "$unixtests/bsymbolic_functions.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
2805        CFG_REDUCE_RELOCATIONS=no
2806    else
2807        CFG_REDUCE_RELOCATIONS=yes
2808    fi
2809fi
2810
2811# auto-detect GNU make support
2812if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2>&1; then
2813   CFG_USE_GNUMAKE=yes
2814fi
2815
2816# If -opengl wasn't specified, don't try to auto-detect
2817if [ "$PLATFORM_QWS" = "yes" ] && [ "$CFG_OPENGL" = "auto" ]; then
2818        CFG_OPENGL=no
2819fi
2820
2821# mac
2822if [ "$PLATFORM_MAC" = "yes" ]; then
2823    if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
2824        CFG_OPENGL=desktop
2825    fi
2826fi
2827
2828# find the default framework value
2829if [ "$PLATFORM_MAC" = "yes" ] && [ "$PLATFORM" != "macx-xlc" ]; then
2830    if [ "$CFG_FRAMEWORK" = "auto" ]; then
2831        CFG_FRAMEWORK="$CFG_SHARED"
2832    elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
2833        echo
2834        echo "WARNING: Using static linking will disable the use of Mac frameworks."
2835        echo
2836        CFG_FRAMEWORK="no"
2837    fi
2838else
2839    CFG_FRAMEWORK=no
2840fi
2841
2842# x11 tests are done after qmake is built
2843
2844
2845#setup the build parts
2846if [ -z "$CFG_BUILD_PARTS" ]; then
2847    CFG_BUILD_PARTS="$QT_DEFAULT_BUILD_PARTS"
2848
2849    # don't build tools by default when cross-compiling
2850    if [ "$PLATFORM" != "$XPLATFORM" ]; then
2851        CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, tools,,g"`
2852    fi
2853fi
2854for nobuild in $CFG_NOBUILD_PARTS; do
2855    CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, $nobuild,,g"`
2856done
2857if echo $CFG_BUILD_PARTS | grep -v libs >/dev/null 2>&1; then
2858#    echo
2859#    echo "WARNING: libs is a required part of the build."
2860#    echo
2861    CFG_BUILD_PARTS="$CFG_BUILD_PARTS libs"
2862fi
2863
2864#-------------------------------------------------------------------------------
2865# post process QT_INSTALL_* variables
2866#-------------------------------------------------------------------------------
2867
2868#prefix
2869if [ -z "$QT_INSTALL_PREFIX" ]; then
2870    if [ "$CFG_DEV" = "yes" ]; then
2871        QT_INSTALL_PREFIX="$outpath" # At Trolltech, we use sandboxed builds by default
2872    elif [ "$PLATFORM_QWS" = "yes" ]; then
2873        QT_INSTALL_PREFIX="/usr/local/Trolltech/QtEmbedded-${QT_VERSION}"
2874        if [ "$PLATFORM" != "$XPLATFORM" ]; then
2875            QT_INSTALL_PREFIX="${QT_INSTALL_PREFIX}-${CFG_ARCH}"
2876        fi
2877    else
2878        QT_INSTALL_PREFIX="/usr/local/Trolltech/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Trolltech/Qt-$QT_VERSION
2879    fi
2880fi
2881QT_INSTALL_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PREFIX"`
2882
2883#docs
2884if [ -z "$QT_INSTALL_DOCS" ]; then #default
2885    if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2886        if [ "$PLATFORM_MAC" = "yes" ]; then
2887            QT_INSTALL_DOCS="/Developer/Documentation/Qt"
2888        fi
2889    fi
2890    [ -z "$QT_INSTALL_DOCS" ] && QT_INSTALL_DOCS="$QT_INSTALL_PREFIX/doc" #fallback
2891
2892fi
2893QT_INSTALL_DOCS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DOCS"`
2894
2895#headers
2896if [ -z "$QT_INSTALL_HEADERS" ]; then #default
2897    if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2898        if [ "$PLATFORM_MAC" = "yes" ]; then
2899            if [ "$CFG_FRAMEWORK" = "yes" ]; then
2900                QT_INSTALL_HEADERS=
2901            fi
2902        fi
2903    fi
2904    [ -z "$QT_INSTALL_HEADERS" ] && QT_INSTALL_HEADERS="$QT_INSTALL_PREFIX/include"
2905
2906fi
2907QT_INSTALL_HEADERS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_HEADERS"`
2908
2909#libs
2910if [ -z "$QT_INSTALL_LIBS" ]; then #default
2911    if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2912        if [ "$PLATFORM_MAC" = "yes" ]; then
2913            if [ "$CFG_FRAMEWORK" = "yes" ]; then
2914                QT_INSTALL_LIBS="/Libraries/Frameworks"
2915            fi
2916        fi
2917    fi
2918    [ -z "$QT_INSTALL_LIBS" ] && QT_INSTALL_LIBS="$QT_INSTALL_PREFIX/lib" #fallback
2919fi
2920QT_INSTALL_LIBS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_LIBS"`
2921
2922#bins
2923if [ -z "$QT_INSTALL_BINS" ]; then #default
2924    if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2925        if [ "$PLATFORM_MAC" = "yes" ]; then
2926            QT_INSTALL_BINS="/Developer/Applications/Qt"
2927        fi
2928    fi
2929    [ -z "$QT_INSTALL_BINS" ] && QT_INSTALL_BINS="$QT_INSTALL_PREFIX/bin" #fallback
2930
2931fi
2932QT_INSTALL_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_BINS"`
2933
2934#plugins
2935if [ -z "$QT_INSTALL_PLUGINS" ]; then #default
2936    if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2937        if [ "$PLATFORM_MAC" = "yes" ]; then
2938            QT_INSTALL_PLUGINS="/Developer/Applications/Qt/plugins"
2939        fi
2940    fi
2941    [ -z "$QT_INSTALL_PLUGINS" ] && QT_INSTALL_PLUGINS="$QT_INSTALL_PREFIX/plugins" #fallback
2942fi
2943QT_INSTALL_PLUGINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PLUGINS"`
2944
2945#data
2946if [ -z "$QT_INSTALL_DATA" ]; then #default
2947    QT_INSTALL_DATA="$QT_INSTALL_PREFIX"
2948fi
2949QT_INSTALL_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DATA"`
2950
2951#translations
2952if [ -z "$QT_INSTALL_TRANSLATIONS" ]; then #default
2953    QT_INSTALL_TRANSLATIONS="$QT_INSTALL_PREFIX/translations"
2954fi
2955QT_INSTALL_TRANSLATIONS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TRANSLATIONS"`
2956
2957#settings
2958if [ -z "$QT_INSTALL_SETTINGS" ]; then #default
2959    if [ "$PLATFORM_MAC" = "yes" ]; then
2960        QT_INSTALL_SETTINGS=/Library/Preferences/Qt
2961    else
2962        QT_INSTALL_SETTINGS=/etc/xdg
2963    fi
2964fi
2965QT_INSTALL_SETTINGS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_SETTINGS"`
2966
2967#examples
2968if [ -z "$QT_INSTALL_EXAMPLES" ]; then #default
2969    if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2970        if [ "$PLATFORM_MAC" = "yes" ]; then
2971            QT_INSTALL_EXAMPLES="/Developer/Examples/Qt"
2972        fi
2973    fi
2974    [ -z "$QT_INSTALL_EXAMPLES" ] && QT_INSTALL_EXAMPLES="$QT_INSTALL_PREFIX/examples" #fallback
2975fi
2976QT_INSTALL_EXAMPLES=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_EXAMPLES"`
2977
2978#demos
2979if [ -z "$QT_INSTALL_DEMOS" ]; then #default
2980    if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
2981        if [ "$PLATFORM_MAC" = "yes" ]; then
2982            QT_INSTALL_DEMOS="/Developer/Examples/Qt/Demos"
2983        fi
2984    fi
2985    [ -z "$QT_INSTALL_DEMOS" ] && QT_INSTALL_DEMOS="$QT_INSTALL_PREFIX/demos"
2986fi
2987QT_INSTALL_DEMOS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DEMOS"`
2988
2989#-------------------------------------------------------------------------------
2990# help - interactive parts of the script _after_ this section please
2991#-------------------------------------------------------------------------------
2992
2993# next, emit a usage message if something failed.
2994if [ "$OPT_HELP" = "yes" ]; then
2995    [ "x$ERROR" = "xyes" ] && echo
2996    if [ "$CFG_NIS" = "no" ]; then
2997        NSY=" "
2998        NSN="*"
2999    else
3000        NSY="*"
3001        NSN=" "
3002    fi
3003    if [ "$CFG_CUPS" = "no" ]; then
3004        CUY=" "
3005        CUN="*"
3006    else
3007        CUY="*"
3008        CUN=" "
3009    fi
3010    if [ "$CFG_ICONV" = "no" ]; then
3011        CIY=" "
3012        CIN="*"
3013    else
3014        CIY="*"
3015        CIN=" "
3016    fi
3017    if [ "$CFG_LARGEFILE" = "no" ]; then
3018        LFSY=" "
3019        LFSN="*"
3020    else
3021        LFSY="*"
3022        LFSN=" "
3023    fi
3024    if [ "$CFG_STL" = "auto" ] || [ "$CFG_STL" = "yes" ]; then
3025        SHY="*"
3026        SHN=" "
3027    else
3028        SHY=" "
3029        SHN="*"
3030    fi
3031    if [ "$CFG_IPV6" = "auto" ]; then
3032        I6Y="*"
3033        I6N=" "
3034    fi
3035    if [ "$CFG_PRECOMPILE" = "auto" ] || [ "$CFG_PRECOMPILE" = "no" ]; then
3036        PHY=" "
3037        PHN="*"
3038    else
3039        PHY="*"
3040        PHN=" "
3041    fi
3042
3043    cat <<EOF
3044Usage:  $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>]
3045        [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-datadir <dir>]
3046        [-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>]
3047        [-demosdir <dir>] [-buildkey <key>] [-release] [-debug]
3048        [-debug-and-release] [-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile]
3049        [-largefile] [-no-exceptions] [-exceptions] [-no-accessibility]
3050        [-accessibility] [-no-stl] [-stl] [-no-sql-<driver>] [-sql-<driver>]
3051        [-plugin-sql-<driver>] [-system-sqlite] [-no-qt3support] [-qt3support]
3052        [-platform] [-D <string>] [-I <string>] [-L <string>] [-help]
3053        [-qt-zlib] [-system-zlib] [-no-gif] [-qt-gif] [-no-libtiff] [-qt-libtiff] [-system-libtiff]
3054        [-no-libpng] [-qt-libpng] [-system-libpng] [-no-libmng] [-qt-libmng]
3055        [-system-libmng] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>]
3056        [-no-make <part>] [-R <string>]  [-l <string>] [-no-rpath]  [-rpath] [-continue]
3057        [-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [-no-iconv]
3058        [-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked]
3059        [-no-separate-debug-info] [-no-mmx] [-no-3dnow] [-no-sse] [-no-sse2]
3060        [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info] [-armfpa]
3061        [-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns]
3062        [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend]
3063        [-no-openssl] [-openssl] [-openssl-linked]
3064        [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit]
3065        [-no-scripttools] [-scripttools]
3066
3067        [additional platform specific options (see below)]
3068
3069
3070Installation options:
3071
3072 These are optional, but you may specify install directories.
3073
3074    -prefix <dir> ...... This will install everything relative to <dir>
3075                         (default $QT_INSTALL_PREFIX)
3076EOF
3077if [ "$PLATFORM_QWS" = "yes" ]; then
3078cat <<EOF
3079
3080    -hostprefix [dir] .. Tools and libraries needed when developing
3081                         applications are installed in [dir]. If [dir] is
3082                         not given, the current build directory will be used.
3083EOF
3084fi
3085cat <<EOF
3086
3087  * -prefix-install .... Force a sandboxed "local" installation of
3088                         Qt. This will install into
3089                         $QT_INSTALL_PREFIX, if this option is
3090                         disabled then some platforms will attempt a
3091                         "system" install by placing default values to
3092                         be placed in a system location other than
3093                         PREFIX.
3094
3095 You may use these to separate different parts of the install:
3096
3097    -bindir <dir> ......... Executables will be installed to <dir>
3098                            (default PREFIX/bin)
3099    -libdir <dir> ......... Libraries will be installed to <dir>
3100                            (default PREFIX/lib)
3101    -docdir <dir> ......... Documentation will be installed to <dir>
3102                            (default PREFIX/doc)
3103    -headerdir <dir> ...... Headers will be installed to <dir>
3104                            (default PREFIX/include)
3105    -plugindir <dir> ...... Plugins will be installed to <dir>
3106                            (default PREFIX/plugins)
3107    -datadir <dir> ........ Data used by Qt programs will be installed to <dir>
3108                            (default PREFIX)
3109    -translationdir <dir> . Translations of Qt programs will be installed to <dir>
3110                            (default PREFIX/translations)
3111    -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir>
3112                            (default PREFIX/etc/settings)
3113    -examplesdir <dir> .... Examples will be installed to <dir>
3114                            (default PREFIX/examples)
3115    -demosdir <dir> ....... Demos will be installed to <dir>
3116                            (default PREFIX/demos)
3117
3118 You may use these options to turn on strict plugin loading.
3119
3120    -buildkey <key> .... Build the Qt library and plugins using the specified
3121                         <key>.  When the library loads plugins, it will only
3122                         load those that have a matching key.
3123
3124Configure options:
3125
3126 The defaults (*) are usually acceptable. A plus (+) denotes a default value
3127 that needs to be evaluated. If the evaluation succeeds, the feature is
3128 included. Here is a short explanation of each option:
3129
3130 *  -release ........... Compile and link Qt with debugging turned off.
3131    -debug ............. Compile and link Qt with debugging turned on.
3132    -debug-and-release . Compile and link two versions of Qt, with and without
3133                         debugging turned on (Mac only).
3134
3135    -developer-build.... Compile and link Qt with Qt developer options (including auto-tests exporting)
3136
3137    -opensource......... Compile and link the Open-Source Edition of Qt.
3138    -commercial......... Compile and link the Commercial Edition of Qt.
3139
3140
3141 *  -shared ............ Create and use shared Qt libraries.
3142    -static ............ Create and use static Qt libraries.
3143
3144 *  -no-fast ........... Configure Qt normally by generating Makefiles for all
3145                         project files.
3146    -fast .............. Configure Qt quickly by generating Makefiles only for
3147                         library and subdirectory targets.  All other Makefiles
3148                         are created as wrappers, which will in turn run qmake.
3149
3150    -no-largefile ...... Disables large file support.
3151 +  -largefile ......... Enables Qt to access files larger than 4 GB.
3152
3153EOF
3154if [ "$PLATFORM_QWS" = "yes" ]; then
3155    EXCN="*"
3156    EXCY=" "
3157else
3158    EXCN=" "
3159    EXCY="*"
3160fi
3161if [ "$CFG_DBUS" = "no" ]; then
3162    DBY=" "
3163    DBN="+"
3164else
3165    DBY="+"
3166    DBN=" "
3167fi
3168
3169    cat << EOF
3170 $EXCN  -no-exceptions ..... Disable exceptions on compilers that support it.
3171 $EXCY  -exceptions ........ Enable exceptions on compilers that support it.
3172
3173    -no-accessibility .. Do not compile Accessibility support.
3174 *  -accessibility ..... Compile Accessibility support.
3175
3176 $SHN  -no-stl ............ Do not compile STL support.
3177 $SHY  -stl ............... Compile STL support.
3178
3179    -no-sql-<driver> ... Disable SQL <driver> entirely.
3180    -qt-sql-<driver> ... Enable a SQL <driver> in the QtSql library, by default
3181                         none are turned on.
3182    -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to
3183                         at run time.
3184
3185                         Possible values for <driver>:
3186                         [ $CFG_SQL_AVAILABLE ]
3187
3188    -system-sqlite ..... Use sqlite from the operating system.
3189
3190    -no-qt3support ..... Disables the Qt 3 support functionality.
3191 *  -qt3support ........ Enables the Qt 3 support functionality.
3192
3193    -no-xmlpatterns .... Do not build the QtXmlPatterns module.
3194 +  -xmlpatterns ....... Build the QtXmlPatterns module.
3195                         QtXmlPatterns is built if a decent C++ compiler
3196                         is used and exceptions are enabled.
3197
3198    -no-phonon ......... Do not build the Phonon module.
3199 +  -phonon ............ Build the Phonon module.
3200                         Phonon is built if a decent C++ compiler is used.
3201    -no-phonon-backend.. Do not build the platform phonon plugin.
3202 +  -phonon-backend..... Build the platform phonon plugin.
3203
3204    -no-svg ............ Do not build the SVG module.
3205 +  -svg ............... Build the SVG module.
3206
3207    -no-webkit ......... Do not build the WebKit module.
3208 +  -webkit ............ Build the WebKit module.
3209                         WebKit is built if a decent C++ compiler is used.
3210
3211    -no-scripttools .... Do not build the QtScriptTools module.
3212 +  -scripttools ....... Build the QtScriptTools module.
3213
3214    -platform target ... The operating system and compiler you are building
3215                         on ($PLATFORM).
3216
3217                         See the README file for a list of supported
3218                         operating systems and compilers.
3219EOF
3220if [ "${PLATFORM_QWS}" != "yes" ]; then
3221cat << EOF
3222    -graphicssystem <sys> Sets an alternate graphics system. Available options are:
3223                           raster - Software rasterizer
3224                           opengl - Rendering via OpenGL, Experimental!
3225EOF
3226fi
3227cat << EOF
3228
3229    -no-mmx ............ Do not compile with use of MMX instructions.
3230    -no-3dnow .......... Do not compile with use of 3DNOW instructions.
3231    -no-sse ............ Do not compile with use of SSE instructions.
3232    -no-sse2 ........... Do not compile with use of SSE2 instructions.
3233
3234    -qtnamespace <name>  Wraps all Qt library code in 'namespace <name> {...}'.
3235    -qtlibinfix <infix>  Renames all libQt*.so to libQt*<infix>.so.
3236
3237    -D <string> ........ Add an explicit define to the preprocessor.
3238    -I <string> ........ Add an explicit include path.
3239    -L <string> ........ Add an explicit library path.
3240
3241    -help, -h .......... Display this information.
3242
3243Third Party Libraries:
3244
3245    -qt-zlib ........... Use the zlib bundled with Qt.
3246 +  -system-zlib ....... Use zlib from the operating system.
3247                         See http://www.gzip.org/zlib
3248
3249    -no-gif ............ Do not compile the plugin for GIF reading support.
3250 *  -qt-gif ............ Compile the plugin for GIF reading support.
3251                         See also src/plugins/imageformats/gif/qgifhandler.h
3252
3253    -no-libtiff ........ Do not compile the plugin for TIFF support.
3254    -qt-libtiff ........ Use the libtiff bundled with Qt.
3255 +  -system-libtiff .... Use libtiff from the operating system.
3256                         See http://www.libtiff.org
3257
3258    -no-libpng ......... Do not compile in PNG support.
3259    -qt-libpng ......... Use the libpng bundled with Qt.
3260 +  -system-libpng ..... Use libpng from the operating system.
3261                         See http://www.libpng.org/pub/png
3262
3263    -no-libmng ......... Do not compile the plugin for MNG support.
3264    -qt-libmng ......... Use the libmng bundled with Qt.
3265 +  -system-libmng ..... Use libmng from the operating system.
3266                         See http://www.libmng.com
3267
3268    -no-libjpeg ........ Do not compile the plugin for JPEG support.
3269    -qt-libjpeg ........ Use the libjpeg bundled with Qt.
3270 +  -system-libjpeg .... Use libjpeg from the operating system.
3271                         See http://www.ijg.org
3272
3273    -no-openssl ........ Do not compile support for OpenSSL.
3274 +  -openssl ........... Enable run-time OpenSSL support.
3275    -openssl-linked .... Enabled linked OpenSSL support.
3276
3277    -ptmalloc .......... Override the system memory allocator with ptmalloc.
3278                         (Experimental.)
3279
3280Additional options:
3281
3282    -make <part> ....... Add part to the list of parts to be built at make time.
3283                         ($QT_DEFAULT_BUILD_PARTS)
3284    -nomake <part> ..... Exclude part from the list of parts to be built.
3285
3286    -R <string> ........ Add an explicit runtime library path to the Qt
3287                         libraries.
3288    -l <string> ........ Add an explicit library.
3289
3290    -no-rpath .......... Do not use the library install path as a runtime
3291                         library path.
3292 +  -rpath ............. Link Qt libraries and executables using the library
3293                         install path as a runtime library path. Equivalent
3294                         to -R install_libpath
3295
3296    -continue .......... Continue as far as possible if an error occurs.
3297
3298    -verbose, -v ....... Print verbose information about each step of the
3299                         configure process.
3300
3301    -silent ............ Reduce the build output so that warnings and errors
3302                         can be seen more easily.
3303
3304 *  -no-optimized-qmake ... Do not build qmake optimized.
3305    -optimized-qmake ...... Build qmake optimized.
3306
3307 $NSN  -no-nis ............ Do not compile NIS support.
3308 $NSY  -nis ............... Compile NIS support.
3309
3310 $CUN  -no-cups ........... Do not compile CUPS support.
3311 $CUY  -cups .............. Compile CUPS support.
3312                         Requires cups/cups.h and libcups.so.2.
3313
3314 $CIN  -no-iconv .......... Do not compile support for iconv(3).
3315 $CIY  -iconv ............. Compile support for iconv(3).
3316
3317 $PHN  -no-pch ............ Do not use precompiled header support.
3318 $PHY  -pch ............... Use precompiled header support.
3319
3320 $DBN  -no-dbus ........... Do not compile the QtDBus module.
3321 $DBY  -dbus .............. Compile the QtDBus module and dynamically load libdbus-1.
3322    -dbus-linked ....... Compile the QtDBus module and link to libdbus-1.
3323
3324    -reduce-relocations ..... Reduce relocations in the libraries through extra
3325                              linker optimizations (Qt/X11 and Qt for Embedded Linux only;
3326                              experimental; needs GNU ld >= 2.18).
3327EOF
3328
3329if [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
3330    if [ "$QT_CROSS_COMPILE" = "yes" ]; then
3331        SBY=""
3332        SBN="*"
3333    else
3334        SBY="*"
3335        SBN=" "
3336    fi
3337elif [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
3338    SBY="*"
3339    SBN=" "
3340else
3341    SBY=" "
3342    SBN="*"
3343fi
3344
3345if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then
3346
3347    cat << EOF
3348
3349 $SBN  -no-separate-debug-info . Do not store debug information in a separate file.
3350 $SBY  -separate-debug-info .... Strip debug information into a separate .debug file.
3351
3352EOF
3353
3354fi # X11/QWS
3355
3356if [ "$PLATFORM_X11" = "yes" ]; then
3357    if [ "$CFG_SM" = "no" ]; then
3358        SMY=" "
3359        SMN="*"
3360    else
3361        SMY="*"
3362        SMN=" "
3363    fi
3364    if [ "$CFG_XSHAPE" = "no" ]; then
3365        SHY=" "
3366        SHN="*"
3367    else
3368        SHY="*"
3369        SHN=" "
3370    fi
3371    if [ "$CFG_XINERAMA" = "no" ]; then
3372        XAY=" "
3373        XAN="*"
3374    else
3375        XAY="*"
3376        XAN=" "
3377    fi
3378    if [ "$CFG_FONTCONFIG" = "no" ]; then
3379        FCGY=" "
3380        FCGN="*"
3381    else
3382        FCGY="*"
3383        FCGN=" "
3384    fi
3385    if [ "$CFG_XCURSOR" = "no" ]; then
3386        XCY=" "
3387        XCN="*"
3388    else
3389        XCY="*"
3390        XCN=" "
3391    fi
3392    if [ "$CFG_XFIXES" = "no" ]; then
3393        XFY=" "
3394        XFN="*"
3395    else
3396        XFY="*"
3397        XFN=" "
3398    fi
3399    if [ "$CFG_XRANDR" = "no" ]; then
3400        XZY=" "
3401        XZN="*"
3402    else
3403        XZY="*"
3404        XZN=" "
3405    fi
3406    if [ "$CFG_XRENDER" = "no" ]; then
3407        XRY=" "
3408        XRN="*"
3409    else
3410        XRY="*"
3411        XRN=" "
3412    fi
3413    if [ "$CFG_MITSHM" = "no" ]; then
3414        XMY=" "
3415        XMN="*"
3416    else
3417        XMY="*"
3418        XMN=" "
3419    fi
3420    if [ "$CFG_XINPUT" = "no" ]; then
3421        XIY=" "
3422        XIN="*"
3423    else
3424        XIY="*"
3425        XIN=" "
3426    fi
3427    if [ "$CFG_XKB" = "no" ]; then
3428        XKY=" "
3429        XKN="*"
3430    else
3431        XKY="*"
3432        XKN=" "
3433    fi
3434    if [ "$CFG_IM" = "no" ]; then
3435        IMY=" "
3436        IMN="*"
3437    else
3438        IMY="*"
3439        IMN=" "
3440    fi
3441    cat << EOF
3442
3443Qt/X11 only:
3444
3445    -no-gtkstyle ....... Do not build the GTK theme integration.
3446 +  -gtkstyle .......... Build the GTK theme integration.
3447
3448 *  -no-nas-sound ...... Do not compile in NAS sound support.
3449    -system-nas-sound .. Use NAS libaudio from the operating system.
3450                         See http://radscan.com/nas.html
3451
3452    -no-opengl ......... Do not support OpenGL.
3453 +  -opengl <api> ...... Enable OpenGL support.
3454                         With no parameter, this will auto-detect the "best"
3455                         OpenGL API to use. If desktop OpenGL is avaliable, it
3456                         will be used. Use desktop, es1, es1cl or es2 for <api>
3457                         to force the use of the Desktop (OpenGL 1.x or 2.x),
3458                         OpenGL ES 1.x Common profile, 1.x Common Lite profile
3459                         or 2.x APIs instead. On X11, the EGL API will be used
3460                         to manage GL contexts in the case of OpenGL ES.
3461
3462 $SMN  -no-sm ............. Do not support X Session Management.
3463 $SMY  -sm ................ Support X Session Management, links in -lSM -lICE.
3464
3465 $SHN  -no-xshape ......... Do not compile XShape support.
3466 $SHY  -xshape ............ Compile XShape support.
3467                         Requires X11/extensions/shape.h.
3468
3469 $XAN  -no-xinerama ....... Do not compile Xinerama (multihead) support.
3470 $XAY  -xinerama .......... Compile Xinerama support.
3471                         Requires X11/extensions/Xinerama.h and libXinerama.
3472                         By default, Xinerama support will be compiled if
3473                         available and the shared libraries are dynamically
3474                         loaded at runtime.
3475
3476 $XCN  -no-xcursor ........ Do not compile Xcursor support.
3477 $XCY  -xcursor ........... Compile Xcursor support.
3478                         Requires X11/Xcursor/Xcursor.h and libXcursor.
3479                         By default, Xcursor support will be compiled if
3480                         available and the shared libraries are dynamically
3481                         loaded at runtime.
3482
3483 $XFN  -no-xfixes ......... Do not compile Xfixes support.
3484 $XFY  -xfixes ............ Compile Xfixes support.
3485                         Requires X11/extensions/Xfixes.h and libXfixes.
3486                         By default, Xfixes support will be compiled if
3487                         available and the shared libraries are dynamically
3488                         loaded at runtime.
3489
3490 $XZN  -no-xrandr ......... Do not compile Xrandr (resize and rotate) support.
3491 $XZY  -xrandr ............ Compile Xrandr support.
3492                         Requires X11/extensions/Xrandr.h and libXrandr.
3493
3494 $XRN  -no-xrender ........ Do not compile Xrender support.
3495 $XRY  -xrender ........... Compile Xrender support.
3496                         Requires X11/extensions/Xrender.h and libXrender.
3497
3498 $XMN  -no-mitshm ......... Do not compile MIT-SHM support.
3499 $XMY  -mitshm ............ Compile MIT-SHM support.
3500                         Requires sys/ipc.h, sys/shm.h and X11/extensions/XShm.h
3501
3502 $FCGN  -no-fontconfig ..... Do not compile FontConfig (anti-aliased font) support.
3503 $FCGY  -fontconfig ........ Compile FontConfig support.
3504                         Requires fontconfig/fontconfig.h, libfontconfig,
3505                         freetype.h and libfreetype.
3506
3507 $XIN  -no-xinput.......... Do not compile Xinput support.
3508 $XIY  -xinput ............ Compile Xinput support. This also enabled tablet support
3509                         which requires IRIX with wacom.h and libXi or
3510                         XFree86 with X11/extensions/XInput.h and libXi.
3511
3512 $XKN  -no-xkb ............ Do not compile XKB (X KeyBoard extension) support.
3513 $XKY  -xkb ............... Compile XKB support.
3514
3515EOF
3516fi
3517
3518if [ "$PLATFORM_MAC" = "yes" ]; then
3519    cat << EOF
3520
3521Qt/Mac only:
3522
3523    -Fstring ........... Add an explicit framework path.
3524    -fw string ......... Add an explicit framework.
3525
3526    -cocoa ............. Build the Cocoa version of Qt. Note that -no-framework
3527                         and -static is not supported with -cocoa. Specifying
3528                         this option creates Qt binaries that requires Mac OS X
3529                         10.5 or higher.
3530
3531 *  -framework ......... Build Qt as a series of frameworks and
3532                         link tools against those frameworks.
3533    -no-framework ...... Do not build Qt as a series of frameworks.
3534
3535 *  -dwarf2 ............ Enable dwarf2 debugging symbols.
3536    -no-dwarf2 ......... Disable dwarf2 debugging symbols.
3537
3538    -universal ......... Equivalent to -arch "ppc x86"
3539
3540    -arch <arch> ....... Build Qt for <arch>
3541                         Example values for <arch>: x86 ppc x86_64 ppc64
3542                         Multiple -arch arguments can be specified, 64-bit archs
3543                         will be built with the Cocoa framework.
3544
3545    -sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. This option requires gcc 4.
3546                         To use a different SDK with gcc 3.3, set the SDKROOT environment variable.
3547
3548EOF
3549fi
3550
3551if [ "$PLATFORM_QWS" = "yes" ]; then
3552    cat << EOF
3553
3554Qt for Embedded Linux only:
3555
3556    -xplatform target ... The target platform when cross-compiling.
3557
3558    -no-feature-<feature> Do not compile in <feature>.
3559    -feature-<feature> .. Compile in <feature>. The available features
3560                          are described in src/corelib/global/qfeatures.txt
3561
3562    -embedded <arch> .... This will enable the embedded build, you must have a
3563                          proper license for this switch to work.
3564                          Example values for <arch>: arm mips x86 generic
3565
3566    -armfpa ............. Target platform is uses the ARM-FPA floating point format.
3567    -no-armfpa .......... Target platform does not use the ARM-FPA floating point format.
3568
3569                          The floating point format is usually autodetected by configure. Use this
3570                          to override the detected value.
3571
3572    -little-endian ...... Target platform is little endian (LSB first).
3573    -big-endian ......... Target platform is big endian (MSB first).
3574
3575    -host-little-endian . Host platform is little endian (LSB first).
3576    -host-big-endian .... Host platform is big endian (MSB first).
3577
3578                          You only need to specify the endianness when
3579                          cross-compiling, otherwise the host
3580                          endianness will be used.
3581
3582    -no-freetype ........ Do not compile in Freetype2 support.
3583    -qt-freetype ........ Use the libfreetype bundled with Qt.
3584 *  -system-freetype .... Use libfreetype from the operating system.
3585                          See http://www.freetype.org/
3586
3587    -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the
3588                          default ($CFG_QCONFIG).
3589
3590    -depths <list> ...... Comma-separated list of supported bit-per-pixel
3591                          depths, from: 1, 4, 8, 12, 15, 16, 18, 24, 32 and 'all'.
3592
3593    -qt-decoration-<style> ....Enable a decoration <style> in the QtGui library,
3594                               by default all available decorations are on.
3595                               Possible values for <style>: [ $CFG_DECORATION_AVAILABLE ]
3596    -plugin-decoration-<style> Enable decoration <style> as a plugin to be
3597                               linked to at run time.
3598                               Possible values for <style>: [ $CFG_DECORATION_PLUGIN_AVAILABLE ]
3599    -no-decoration-<style> ....Disable decoration <style> entirely.
3600                               Possible values for <style>: [ $CFG_DECORATION_AVAILABLE ]
3601
3602    -no-opengl .......... Do not support OpenGL.
3603    -opengl <api> ....... Enable OpenGL ES support
3604                          With no parameter, this will attempt to auto-detect OpenGL ES 1.x
3605                          or 2.x. Use es1, es1cl or es2 for <api> to override auto-detection.
3606
3607                          NOTE: A QGLScreen driver for the hardware is required to support
3608                                OpenGL ES on Qt for Embedded Linux.
3609
3610    -qt-gfx-<driver> ... Enable a graphics <driver> in the QtGui library.
3611                         Possible values for <driver>: [ $CFG_GFX_AVAILABLE ]
3612    -plugin-gfx-<driver> Enable graphics <driver> as a plugin to be
3613                         linked to at run time.
3614                         Possible values for <driver>: [ $CFG_GFX_PLUGIN_AVAILABLE ]
3615    -no-gfx-<driver> ... Disable graphics <driver> entirely.
3616                         Possible values for <driver>: [ $CFG_GFX_AVAILABLE ]
3617
3618    -qt-kbd-<driver> ... Enable a keyboard <driver> in the QtGui library.
3619                         Possible values for <driver>: [ $CFG_KBD_AVAILABLE ]
3620
3621    -plugin-kbd-<driver> Enable keyboard <driver> as a plugin to be linked to
3622                         at runtime.
3623                         Possible values for <driver>: [ $CFG_KBD_PLUGIN_AVAILABLE ]
3624
3625    -no-kbd-<driver> ... Disable keyboard <driver> entirely.
3626                         Possible values for <driver>: [ $CFG_KBD_AVAILABLE ]
3627
3628    -qt-mouse-<driver> ... Enable a mouse <driver> in the QtGui library.
3629                           Possible values for <driver>: [ $CFG_MOUSE_AVAILABLE ]
3630    -plugin-mouse-<driver> Enable mouse <driver> as a plugin to be linked to
3631                           at runtime.
3632                           Possible values for <driver>: [ $CFG_MOUSE_PLUGIN_AVAILABLE ]
3633    -no-mouse-<driver> ... Disable mouse <driver> entirely.
3634                           Possible values for <driver>: [ $CFG_MOUSE_AVAILABLE ]
3635
3636    -iwmmxt ............ Compile using the iWMMXt instruction set
3637                         (available on some XScale CPUs).
3638
3639EOF
3640fi
3641
3642
3643if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_X11" = "yes" ]; then
3644    if [ "$CFG_GLIB" = "no" ]; then
3645        GBY=" "
3646        GBN="+"
3647    else
3648        GBY="+"
3649        GBN=" "
3650    fi
3651    cat << EOF
3652 $GBN  -no-glib ........... Do not compile Glib support.
3653 $GBY  -glib .............. Compile Glib support.
3654
3655EOF
3656fi
3657
3658   [ "x$ERROR" = "xyes" ] && exit 1
3659   exit 0
3660fi # Help
3661
3662
3663# -----------------------------------------------------------------------------
3664# LICENSING, INTERACTIVE PART
3665# -----------------------------------------------------------------------------
3666
3667if [ "$PLATFORM_QWS" = "yes" ]; then
3668    Platform="Qt for Embedded Linux"
3669elif [ "$PLATFORM_MAC" = "yes" ]; then
3670    Platform="Qt/Mac"
3671else
3672    PLATFORM_X11=yes
3673    Platform="Qt/X11"
3674fi
3675
3676echo
3677echo "This is the $Platform ${EditionString} Edition."
3678echo
3679
3680if [ "$Edition" = "NokiaInternalBuild" ]; then
3681    echo "Detected -nokia-developer option"
3682    echo "Nokia employees and agents are allowed to use this software under"
3683    echo "the authority of Nokia Corporation and/or its subsidiary(-ies)"
3684elif [ "$Edition" = "OpenSource" ]; then
3685    while true; do
3686        echo "You are licensed to use this software under the terms of"
3687        echo "the GNU General Public License (GPL) versions 3."
3688        echo "You are also licensed to use this software under the terms of"
3689        echo "the Lesser GNU General Public License (LGPL) versions 2.1."
3690        echo
3691        affix="either"
3692        if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
3693            echo "You have already accepted the terms of the $LicenseType license."
3694            acceptance=yes
3695        else
3696            echo "Type '3' to view the GNU General Public License version 3."
3697            echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
3698            echo "Type 'yes' to accept this license offer."
3699            echo "Type 'no' to decline this license offer."
3700            echo
3701            if echo '\c' | grep '\c' >/dev/null; then
3702                echo -n "Do you accept the terms of $affix license? "
3703            else
3704                echo "Do you accept the terms of $affix license? \c"
3705            fi
3706            read acceptance
3707        fi
3708        echo
3709        if [ "$acceptance" = "yes" ]; then
3710            break
3711        elif [ "$acceptance" = "no" ]; then
3712            echo "You are not licensed to use this software."
3713            echo
3714            exit 1
3715        elif [ "$acceptance" = "3" ]; then
3716            more "$relpath/LICENSE.GPL3"
3717        elif [ "$acceptance" = "L" ]; then
3718            more "$relpath/LICENSE.LGPL"
3719        fi
3720    done
3721elif [ "$Edition" = "Preview" ]; then
3722    TheLicense=`head -n 1 "$relpath/LICENSE.PREVIEW.COMMERCIAL"`
3723    while true; do
3724
3725        if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
3726            echo "You have already accepted the terms of the $LicenseType license."
3727            acceptance=yes
3728        else
3729            echo "You are licensed to use this software under the terms of"
3730            echo "the $TheLicense"
3731            echo
3732            echo "Type '?' to read the Preview License."
3733            echo "Type 'yes' to accept this license offer."
3734            echo "Type 'no' to decline this license offer."
3735            echo
3736            if echo '\c' | grep '\c' >/dev/null; then
3737                echo -n "Do you accept the terms of the license? "
3738            else
3739                echo "Do you accept the terms of the license? \c"
3740            fi
3741            read acceptance
3742        fi
3743        echo
3744        if [ "$acceptance" = "yes" ]; then
3745            break
3746        elif [ "$acceptance" = "no" ] ;then
3747            echo "You are not licensed to use this software."
3748            echo
3749            exit 0
3750        elif [ "$acceptance" = "?" ]; then
3751            more "$relpath/LICENSE.PREVIEW.COMMERCIAL"
3752        fi
3753    done
3754elif [ "$Edition" != "OpenSource" ]; then
3755    if [ -n "$ExpiryDate" ]; then
3756        ExpiryDate=`echo $ExpiryDate | sed -e "s,-,,g" | tr -d "\n\r"`
3757        [ -z "$ExpiryDate" ] && ExpiryDate="0"
3758        Today=`date +%Y%m%d`
3759        if [ "$Today" -gt "$ExpiryDate" ]; then
3760            case "$LicenseType" in
3761            Commercial|Academic|Educational)
3762                if [ "$QT_PACKAGEDATE" -gt "$ExpiryDate" ]; then
3763                    echo
3764                    echo "NOTICE  NOTICE  NOTICE  NOTICE"
3765                    echo
3766                    echo "  Your support and upgrade period has expired."
3767                    echo
3768                    echo "  You are no longer licensed to use this version of Qt."
3769                    echo "  Please contact sales@trolltech.com to renew your support"
3770                    echo "  and upgrades for this license."
3771                    echo
3772                    echo "NOTICE  NOTICE  NOTICE  NOTICE"
3773                    echo
3774                    exit 1
3775                else
3776                    echo
3777                    echo "WARNING  WARNING  WARNING  WARNING"
3778                    echo
3779                    echo "  Your support and upgrade period has expired."
3780                    echo
3781                    echo "  You may continue to use your last licensed release"
3782                    echo "  of Qt under the terms of your existing license"
3783                    echo "  agreement. But you are not entitled to technical"
3784                    echo "  support, nor are you entitled to use any more recent"
3785                    echo "  Qt releases."
3786                    echo
3787                    echo "  Please contact sales@trolltech.com to renew your"
3788                    echo "  support and upgrades for this license."
3789                    echo
3790                    echo "WARNING  WARNING  WARNING  WARNING"
3791                    echo
3792                    sleep 3
3793                fi
3794                ;;
3795            Evaluation|*)
3796                echo
3797                echo "NOTICE  NOTICE  NOTICE  NOTICE"
3798                echo
3799                echo "  Your Evaluation license has expired."
3800                echo
3801                echo "  You are no longer licensed to use this software. Please"
3802                echo "  contact sales@trolltech.com to purchase license, or install"
3803                echo "  the Qt Open Source Edition if you intend to develop free"
3804                echo "  software."
3805                echo
3806                echo "NOTICE  NOTICE  NOTICE  NOTICE"
3807                echo
3808                exit 1
3809                ;;
3810            esac
3811        fi
3812    fi
3813    TheLicense=`head -n 1 "$outpath/LICENSE"`
3814    while true; do
3815        if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
3816            echo "You have already accepted the terms of the $TheLicense."
3817            acceptance=yes
3818        else
3819            echo "You are licensed to use this software under the terms of"
3820            echo "the $TheLicense."
3821            echo
3822            echo "Type '?' to view the $TheLicense."
3823            echo "Type 'yes' to accept this license offer."
3824            echo "Type 'no' to decline this license offer."
3825            echo
3826            if echo '\c' | grep '\c' >/dev/null; then
3827                echo -n "Do you accept the terms of the $TheLicense? "
3828            else
3829                echo "Do you accept the terms of the $TheLicense? \c"
3830            fi
3831            read acceptance
3832        fi
3833        echo
3834        if [ "$acceptance" = "yes" ]; then
3835            break
3836        elif [ "$acceptance" = "no" ]; then
3837            echo "You are not licensed to use this software."
3838            echo
3839            exit 1
3840        else [ "$acceptance" = "?" ]
3841            more "$outpath/LICENSE"
3842        fi
3843    done
3844fi
3845
3846# this should be moved somewhere else
3847case "$PLATFORM" in
3848aix-*)
3849    AIX_VERSION=`uname -v`
3850    if [ "$AIX_VERSION" -lt "5" ]; then
3851        QMakeVar add QMAKE_LIBS_X11 -lbind
3852    fi
3853    ;;
3854*)
3855    ;;
3856esac
3857
3858#-------------------------------------------------------------------------------
3859# generate qconfig.cpp
3860#-------------------------------------------------------------------------------
3861[ -d "$outpath/src/corelib/global" ] || mkdir -p "$outpath/src/corelib/global"
3862
3863LICENSE_USER_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_lcnsuser=$Licensee"`
3864LICENSE_PRODUCTS_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_lcnsprod=$Edition"`
3865PREFIX_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_prfxpath=$QT_INSTALL_PREFIX"`
3866DOCUMENTATION_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_docspath=$QT_INSTALL_DOCS"`
3867HEADERS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_hdrspath=$QT_INSTALL_HEADERS"`
3868LIBRARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_libspath=$QT_INSTALL_LIBS"`
3869BINARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_binspath=$QT_INSTALL_BINS"`
3870PLUGINS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_plugpath=$QT_INSTALL_PLUGINS"`
3871DATA_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_datapath=$QT_INSTALL_DATA"`
3872TRANSLATIONS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_trnspath=$QT_INSTALL_TRANSLATIONS"`
3873SETTINGS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_stngpath=$QT_INSTALL_SETTINGS"`
3874EXAMPLES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_xmplpath=$QT_INSTALL_EXAMPLES"`
3875DEMOS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_demopath=$QT_INSTALL_DEMOS"`
3876
3877cat > "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
3878/* License Info */
3879static const char qt_configure_licensee_str          [256 + 12] = "$LICENSE_USER_STR";
3880static const char qt_configure_licensed_products_str [256 + 12] = "$LICENSE_PRODUCTS_STR";
3881EOF
3882
3883if [ ! -z "$QT_HOST_PREFIX" ]; then
3884    HOSTPREFIX_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_prfxpath=$QT_HOST_PREFIX"`
3885    HOSTDOCUMENTATION_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_docspath=$QT_HOST_PREFIX/doc"`
3886    HOSTHEADERS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_hdrspath=$QT_HOST_PREFIX/include"`
3887    HOSTLIBRARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_libspath=$QT_HOST_PREFIX/lib"`
3888    HOSTBINARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_binspath=$QT_HOST_PREFIX/bin"`
3889    HOSTPLUGINS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_plugpath=$QT_HOST_PREFIX/plugins"`
3890    HOSTDATA_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_datapath=$QT_HOST_PREFIX"`
3891    HOSTTRANSLATIONS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_trnspath=$QT_HOST_PREFIX/translations"`
3892    HOSTSETTINGS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_stngpath=$QT_INSTALL_SETTINGS"`
3893    HOSTEXAMPLES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_xmplpath=$QT_INSTALL_EXAMPLES"`
3894    HOSTDEMOS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_demopath=$QT_INSTALL_DEMOS"`
3895
3896    cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
3897
3898#if defined(QT_BOOTSTRAPPED) || defined(QT_BUILD_QMAKE)
3899/* Installation Info */
3900static const char qt_configure_prefix_path_str       [256 + 12] = "$HOSTPREFIX_PATH_STR";
3901static const char qt_configure_documentation_path_str[256 + 12] = "$HOSTDOCUMENTATION_PATH_STR";
3902static const char qt_configure_headers_path_str      [256 + 12] = "$HOSTHEADERS_PATH_STR";
3903static const char qt_configure_libraries_path_str    [256 + 12] = "$HOSTLIBRARIES_PATH_STR";
3904static const char qt_configure_binaries_path_str     [256 + 12] = "$HOSTBINARIES_PATH_STR";
3905static const char qt_configure_plugins_path_str      [256 + 12] = "$HOSTPLUGINS_PATH_STR";
3906static const char qt_configure_data_path_str         [256 + 12] = "$HOSTDATA_PATH_STR";
3907static const char qt_configure_translations_path_str [256 + 12] = "$HOSTTRANSLATIONS_PATH_STR";
3908static const char qt_configure_settings_path_str     [256 + 12] = "$HOSTSETTINGS_PATH_STR";
3909static const char qt_configure_examples_path_str     [256 + 12] = "$HOSTEXAMPLES_PATH_STR";
3910static const char qt_configure_demos_path_str        [256 + 12] = "$HOSTDEMOS_PATH_STR";
3911#else // QT_BOOTSTRAPPED
3912EOF
3913fi
3914
3915cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
3916/* Installation Info */
3917static const char qt_configure_prefix_path_str       [256 + 12] = "$PREFIX_PATH_STR";
3918static const char qt_configure_documentation_path_str[256 + 12] = "$DOCUMENTATION_PATH_STR";
3919static const char qt_configure_headers_path_str      [256 + 12] = "$HEADERS_PATH_STR";
3920static const char qt_configure_libraries_path_str    [256 + 12] = "$LIBRARIES_PATH_STR";
3921static const char qt_configure_binaries_path_str     [256 + 12] = "$BINARIES_PATH_STR";
3922static const char qt_configure_plugins_path_str      [256 + 12] = "$PLUGINS_PATH_STR";
3923static const char qt_configure_data_path_str         [256 + 12] = "$DATA_PATH_STR";
3924static const char qt_configure_translations_path_str [256 + 12] = "$TRANSLATIONS_PATH_STR";
3925static const char qt_configure_settings_path_str     [256 + 12] = "$SETTINGS_PATH_STR";
3926static const char qt_configure_examples_path_str     [256 + 12] = "$EXAMPLES_PATH_STR";
3927static const char qt_configure_demos_path_str        [256 + 12] = "$DEMOS_PATH_STR";
3928EOF
3929
3930if [ ! -z "$QT_HOST_PREFIX" ]; then
3931    cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
3932#endif // QT_BOOTSTRAPPED
3933
3934EOF
3935fi
3936
3937cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
3938/* strlen( "qt_lcnsxxxx" ) == 12 */
3939#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;
3940#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;
3941#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12;
3942#define QT_CONFIGURE_DOCUMENTATION_PATH qt_configure_documentation_path_str + 12;
3943#define QT_CONFIGURE_HEADERS_PATH qt_configure_headers_path_str + 12;
3944#define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;
3945#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;
3946#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;
3947#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;
3948#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;
3949#define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;
3950#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;
3951#define QT_CONFIGURE_DEMOS_PATH qt_configure_demos_path_str + 12;
3952EOF
3953
3954# avoid unecessary rebuilds by copying only if qconfig.cpp has changed
3955if cmp -s "$outpath/src/corelib/global/qconfig.cpp" "$outpath/src/corelib/global/qconfig.cpp.new"; then
3956    rm -f "$outpath/src/corelib/global/qconfig.cpp.new"
3957else
3958    [ -f "$outpath/src/corelib/global/qconfig.cpp" ] && chmod +w "$outpath/src/corelib/global/qconfig.cpp"
3959    mv "$outpath/src/corelib/global/qconfig.cpp.new" "$outpath/src/corelib/global/qconfig.cpp"
3960    chmod -w "$outpath/src/corelib/global/qconfig.cpp"
3961fi
3962
3963# -----------------------------------------------------------------------------
3964# build qmake
3965# -----------------------------------------------------------------------------
3966
3967# symlink includes
3968if [ -n "$PERL" ] && [ -x "$relpath/bin/syncqt" ]; then
3969    SYNCQT_OPTS=
3970    [ "$CFG_DEV" = "yes" ] && SYNCQT_OPTS="$SYNCQT_OPTS -check-includes"
3971    if [ "$OPT_SHADOW" = "yes" ]; then
3972        "$outpath/bin/syncqt" $SYNCQT_OPTS
3973    elif [ "$CFG_DEV" = "yes" ]; then
3974        QTDIR="$relpath" perl "$outpath/bin/syncqt" $SYNCQT_OPTS
3975    fi
3976fi
3977
3978# $1: variable name
3979# $2: optional transformation
3980# relies on $QMAKESPEC, $COMPILER_CONF and $mkfile being set correctly, as the latter
3981# is where the resulting variable is written to
3982setBootstrapVariable()
3983{
3984    variableRegExp="^$1[^_A-Z0-9]"
3985    getQMakeConf | grep "$variableRegExp" | ( [ -n "$2" ] && sed "$2" ; [ -z "$2" ] && cat ) | $AWK '
3986{
3987    varLength = index($0, "=") - 1
3988    valStart = varLength + 2
3989    if (substr($0, varLength, 1) == "+") {
3990        varLength = varLength - 1
3991        valStart = valStart + 1
3992    }
3993    var = substr($0, 0, varLength)
3994    gsub("[ \t]+", "", var)
3995    val = substr($0, valStart)
3996    printf "%s_%s = %s\n", var, NR, val
3997}
3998END {
3999    if (length(var) > 0) {
4000        printf "%s =", var
4001        for (i = 1; i <= NR; ++i)
4002            printf " $(%s_%s)", var, i
4003        printf "\n"
4004    }
4005}' >> "$mkfile"
4006}
4007
4008# build qmake
4009if true; then ###[ '!' -f "$outpath/bin/qmake" ];
4010    echo "Creating qmake. Please wait..."
4011
4012    OLD_QCONFIG_H=
4013    QCONFIG_H="$outpath/src/corelib/global/qconfig.h"
4014    QMAKE_QCONFIG_H="${QCONFIG_H}.qmake"
4015    if [ -f "$QCONFIG_H" ]; then
4016         OLD_QCONFIG_H=$QCONFIG_H
4017         mv -f "$OLD_QCONFIG_H" "${OLD_QCONFIG_H}.old"
4018    fi
4019
4020    # create temporary qconfig.h for compiling qmake, if it doesn't exist
4021    # when building qmake, we use #defines for the install paths,
4022    # however they are real functions in the library
4023    if [ '!' -f "$QMAKE_QCONFIG_H" ]; then
4024        mkdir -p "$outpath/src/corelib/global"
4025        [ -f "$QCONFIG_H" ] && chmod +w "$QCONFIG_H"
4026        echo "/* All features enabled while building qmake */" >"$QMAKE_QCONFIG_H"
4027    fi
4028
4029    mv -f "$QMAKE_QCONFIG_H" "$QCONFIG_H"
4030    for conf in "$outpath/include/QtCore/qconfig.h" "$outpath/include/Qt/qconfig.h"; do
4031        if [ '!' -f "$conf" ]; then
4032            ln -s "$QCONFIG_H" "$conf"
4033        fi
4034    done
4035
4036    #mkspecs/default is used as a (gasp!) default mkspec so QMAKESPEC needn't be set once configured
4037    rm -f mkspecs/default
4038    ln -s `echo $XQMAKESPEC | sed "s,^${relpath}/mkspecs/,,"` mkspecs/default
4039    # fix makefiles
4040    for mkfile in GNUmakefile Makefile; do
4041        EXTRA_LFLAGS=
4042        EXTRA_CFLAGS=
4043        in_mkfile="${mkfile}.in"
4044        if [ "$mkfile" = "Makefile" ]; then
4045#           if which qmake >/dev/null 2>&1 && [ -f qmake/qmake.pro ]; then
4046#               (cd qmake && qmake) >/dev/null 2>&1 && continue
4047#           fi
4048            in_mkfile="${mkfile}.unix"
4049        fi
4050        in_mkfile="$relpath/qmake/$in_mkfile"
4051        mkfile="$outpath/qmake/$mkfile"
4052        if [ -f "$mkfile" ]; then
4053            [ "$CFG_DEV" = "yes" ] && "$WHICH" chflags >/dev/null 2>&1 && chflags nouchg "$mkfile"
4054            rm -f "$mkfile"
4055        fi
4056        [ -f "$in_mkfile" ] || continue
4057
4058        echo "########################################################################" >$mkfile
4059        echo "## This file was autogenerated by configure, all changes will be lost ##" >>$mkfile
4060        echo "########################################################################" >>$mkfile
4061        EXTRA_OBJS=
4062        EXTRA_SRCS=
4063        EXTRA_CFLAGS="\$(QMAKE_CFLAGS)"
4064        EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS)"
4065        EXTRA_LFLAGS="\$(QMAKE_LFLAGS)"
4066
4067        if [ "$PLATFORM" = "irix-cc" ] || [ "$PLATFORM" = "irix-cc-64" ]; then
4068            EXTRA_LFLAGS="$EXTRA_LFLAGS -lm"
4069        fi
4070
4071        [ -n "$CC" ] && echo "CC = $CC" >>$mkfile
4072        [ -n "$CXX" ] && echo "CXX = $CXX" >>$mkfile
4073        if [ "$CFG_SILENT" = "yes" ]; then
4074            [ -z "$CC" ] && setBootstrapVariable QMAKE_CC 's,QMAKE_CC.*=,CC=\@,'
4075            [ -z "$CXX" ] && setBootstrapVariable QMAKE_CXX 's,QMAKE_CXX.*=,CXX=\@,'
4076        else
4077            [ -z "$CC" ] && setBootstrapVariable QMAKE_CC 's,QMAKE_CC,CC,'
4078            [ -z "$CXX" ] && setBootstrapVariable QMAKE_CXX 's,QMAKE_CXX,CXX,'
4079        fi
4080        setBootstrapVariable QMAKE_CFLAGS
4081        setBootstrapVariable QMAKE_CXXFLAGS 's,\$\$QMAKE_CFLAGS,\$(QMAKE_CFLAGS),'
4082        setBootstrapVariable QMAKE_LFLAGS
4083
4084        if [ $QT_EDITION = "QT_EDITION_OPENSOURCE" ]; then
4085            EXTRA_CFLAGS="$EXTRA_CFLAGS -DQMAKE_OPENSOURCE_EDITION"
4086            EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -DQMAKE_OPENSOURCE_EDITION"
4087        fi
4088        if [ "$CFG_RELEASE_QMAKE" = "yes" ]; then
4089            setBootstrapVariable QMAKE_CFLAGS_RELEASE
4090            setBootstrapVariable QMAKE_CXXFLAGS_RELEASE 's,\$\$QMAKE_CFLAGS_RELEASE,\$(QMAKE_CFLAGS_RELEASE),'
4091            EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_RELEASE)"
4092            EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_RELEASE)"
4093        elif [ "$CFG_DEBUG" = "yes" ]; then
4094            setBootstrapVariable QMAKE_CFLAGS_DEBUG
4095            setBootstrapVariable QMAKE_CXXFLAGS_DEBUG 's,\$\$QMAKE_CFLAGS_DEBUG,\$(QMAKE_CFLAGS_DEBUG),'
4096            EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_DEBUG)"
4097            EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_DEBUG)"
4098        fi
4099
4100        if [ '!' -z "$RPATH_FLAGS" ] && [ '!' -z "`getQMakeConf \"$QMAKESPEC\" | grep QMAKE_RPATH | awk '{print $3;}'`" ]; then
4101            setBootstrapVariable QMAKE_RPATH 's,\$\$LITERAL_WHITESPACE, ,'
4102            for rpath in $RPATH_FLAGS; do
4103                EXTRA_LFLAGS="\$(QMAKE_RPATH)\"$rpath\" $EXTRA_LFLAGS"
4104            done
4105        fi
4106        if [ "$PLATFORM_MAC" = "yes" ]; then
4107            if [ "$PLATFORM" = "macx-icc" ]; then
4108                echo "export MACOSX_DEPLOYMENT_TARGET = 10.4" >>"$mkfile"
4109            else
4110                echo "export MACOSX_DEPLOYMENT_TARGET = 10.3" >>"$mkfile"
4111            fi
4112            echo "CARBON_LFLAGS =-framework ApplicationServices" >>"$mkfile"
4113            echo "CARBON_CFLAGS =-fconstant-cfstrings" >>"$mkfile"
4114            EXTRA_LFLAGS="$EXTRA_LFLAGS \$(CARBON_LFLAGS)"
4115            EXTRA_CFLAGS="$EXTRA_CFLAGS \$(CARBON_CFLAGS)"
4116            EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(CARBON_CFLAGS)"
4117            EXTRA_OBJS="qsettings_mac.o qcore_mac.o"
4118            EXTRA_SRCS="\"$relpath/src/corelib/io/qsettings_mac.cpp\" \"$relpath/src/corelib/kernel/qcore_mac.cpp\""
4119            if echo "$CFG_MAC_ARCHS" | grep x86 > /dev/null 2>&1; then
4120                X86_CFLAGS="-arch i386"
4121                X86_LFLAGS="-arch i386"
4122                EXTRA_CFLAGS="$X86_CFLAGS $EXTRA_CFLAGS"
4123                EXTRA_CXXFLAGS="$X86_CFLAGS $EXTRA_CXXFLAGS"
4124                EXTRA_LFLAGS="$EXTRA_LFLAGS $X86_LFLAGS"
4125            fi
4126            if echo "$CFG_MAC_ARCHS" | grep ppc > /dev/null 2>&1; then
4127                PPC_CFLAGS="-arch ppc"
4128                PPC_LFLAGS="-arch ppc"
4129                EXTRA_CFLAGS="$PPC_CFLAGS $EXTRA_CFLAGS"
4130                EXTRA_CXXFLAGS="$PPC_CFLAGS $EXTRA_CXXFLAGS"
4131                EXTRA_LFLAGS="$EXTRA_LFLAGS $PPC_LFLAGS"
4132            fi
4133            if [ '!' -z "$CFG_SDK" ]; then
4134                echo "SDK_LFLAGS =-Wl,-syslibroot,$CFG_SDK" >>"$mkfile"
4135                echo "SDK_CFLAGS =-isysroot $CFG_SDK" >>"$mkfile"
4136                EXTRA_CFLAGS="$EXTRA_CFLAGS \$(SDK_CFLAGS)"
4137                EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(SDK_CFLAGS)"
4138                EXTRA_LFLAGS="$EXTRA_LFLAGS \$(SDK_LFLAGS)"
4139            fi
4140        fi
4141        [ "$CFG_EMBEDDED" != "no" ] && EXTRA_CFLAGS="$EXTRA_CFLAGS -DQWS"
4142        if [ '!' -z "$D_FLAGS" ]; then
4143            for DEF in $D_FLAGS; do
4144                EXTRA_CFLAGS="$EXTRA_CFLAGS \"-D${DEF}\""
4145            done
4146        fi
4147        QMAKE_BIN_DIR="$QT_INSTALL_BINS"
4148        [ -z "$QMAKE_BIN_DIR" ] && QMAKE_BIN_DIR="${QT_INSTALL_PREFIX}/bin"
4149        QMAKE_DATA_DIR="$QT_INSTALL_DATA"
4150        [ -z "$QMAKE_DATA_DIR" ] && QMAKE_DATA_DIR="${QT_INSTALL_PREFIX}"
4151        echo >>"$mkfile"
4152        adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'`
4153        adjoutpath=`echo "$outpath" | sed 's/ /\\\\\\\\ /g'`
4154        sed -e "s,@SOURCE_PATH@,$adjrelpath,g" -e "s,@BUILD_PATH@,$adjoutpath,g" \
4155            -e "s,@QMAKE_CFLAGS@,$EXTRA_CFLAGS,g" -e "s,@QMAKE_LFLAGS@,$EXTRA_LFLAGS,g" \
4156            -e "s,@QMAKE_CXXFLAGS@,$EXTRA_CXXFLAGS,g" \
4157            -e "s,@QT_INSTALL_BINS@,\$(INSTALL_ROOT)$QMAKE_BIN_DIR,g" \
4158            -e "s,@QT_INSTALL_DATA@,\$(INSTALL_ROOT)$QMAKE_DATA_DIR,g" \
4159            -e "s,@QMAKE_QTOBJS@,$EXTRA_OBJS,g" -e "s,@QMAKE_QTSRCS@,$EXTRA_SRCS,g" \
4160            -e "s,@QMAKESPEC@,$QMAKESPEC,g" "$in_mkfile" >>"$mkfile"
4161
4162        if "$WHICH" makedepend >/dev/null 2>&1 && grep 'depend:' "$mkfile" >/dev/null 2>&1; then
4163            (cd "$outpath/qmake" && "$MAKE" -f "$mkfile" depend) >/dev/null 2>&1
4164            sed "s,^.*/\([^/]*.o\):,\1:,g" "$mkfile" >"${mkfile}.tmp"
4165            mv "${mkfile}.tmp" "${mkfile}"
4166        fi
4167    done
4168
4169    QMAKE_BUILD_ERROR=no
4170    (cd "$outpath/qmake"; "$MAKE") || QMAKE_BUILD_ERROR=yes
4171    [ '!' -z "$QCONFIG_H" ] && mv -f "$QCONFIG_H" "$QMAKE_QCONFIG_H" #move qmake's qconfig.h to qconfig.h.qmake
4172    [ '!' -z "$OLD_QCONFIG_H" ] && mv -f "${OLD_QCONFIG_H}.old" "$OLD_QCONFIG_H" #put back qconfig.h
4173    [ "$QMAKE_BUILD_ERROR" = "yes" ] && exit 2
4174fi # Build qmake
4175
4176#-------------------------------------------------------------------------------
4177# tests that need qmake
4178#-------------------------------------------------------------------------------
4179
4180# detect availability of float math.h functions
4181if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/floatmath "floatmath" $L_FLAGS $I_FLAGS $l_FLAGS; then
4182    CFG_USE_FLOATMATH=yes
4183else
4184    CFG_USE_FLOATMATH=no
4185fi
4186
4187# detect mmx support
4188if [ "${CFG_MMX}" = "auto" ]; then
4189    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mmx "mmx" $L_FLAGS $I_FLAGS $l_FLAGS "-mmmx"; then
4190        CFG_MMX=yes
4191    else
4192        CFG_MMX=no
4193    fi
4194fi
4195
4196# detect 3dnow support
4197if [ "${CFG_3DNOW}" = "auto" ]; then
4198    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/3dnow "3dnow" $L_FLAGS $I_FLAGS $l_FLAGS "-m3dnow"; then
4199        CFG_3DNOW=yes
4200    else
4201        CFG_3DNOW=no
4202    fi
4203fi
4204
4205# detect sse support
4206if [ "${CFG_SSE}" = "auto" ]; then
4207    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse "sse" $L_FLAGS $I_FLAGS $l_FLAGS "-msse"; then
4208        CFG_SSE=yes
4209    else
4210        CFG_SSE=no
4211    fi
4212fi
4213
4214# detect sse2 support
4215if [ "${CFG_SSE2}" = "auto" ]; then
4216    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse2 "sse2" $L_FLAGS $I_FLAGS $l_FLAGS "-msse2"; then
4217       CFG_SSE2=yes
4218    else
4219       CFG_SSE2=no
4220    fi
4221fi
4222
4223# check iWMMXt support
4224if [ "$CFG_IWMMXT" = "yes" ]; then
4225    if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iwmmxt "iwmmxt" $L_FLAGS $I_FLAGS $l_FLAGS "-mcpu=iwmmxt"; then
4226        echo "The iWMMXt functionality test failed!"
4227        echo " Please make sure your compiler supports iWMMXt intrinsics!"
4228        exit 1
4229    fi
4230fi
4231
4232# detect zlib
4233if [ "$CFG_ZLIB" = "no" ]; then
4234    # Note: Qt no longer support builds without zlib
4235    # So we force a "no" to be "auto" here.
4236    # If you REALLY really need no zlib support, you can still disable
4237    # it by doing the following:
4238    #   add "no-zlib" to mkspecs/qconfig.pri
4239    #   #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h)
4240    #
4241    # There's no guarantee that Qt will build under those conditions
4242
4243    CFG_ZLIB=auto
4244    ZLIB_FORCED=yes
4245fi
4246if [ "$CFG_ZLIB" = "auto" ]; then
4247    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/zlib "zlib" $L_FLAGS $I_FLAGS $l_FLAGS; then
4248       CFG_ZLIB=system
4249    else
4250       CFG_ZLIB=yes
4251    fi
4252fi
4253
4254# detect how jpeg should be built
4255if [ "$CFG_JPEG" = "auto" ]; then
4256    if [ "$CFG_SHARED" = "yes" ]; then
4257        CFG_JPEG=plugin
4258    else
4259        CFG_JPEG=yes
4260    fi
4261fi
4262# detect jpeg
4263if [ "$CFG_LIBJPEG" = "auto" ]; then
4264    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libjpeg "libjpeg" $L_FLAGS $I_FLAGS $l_FLAGS; then
4265       CFG_LIBJPEG=system
4266    else
4267       CFG_LIBJPEG=qt
4268    fi
4269fi
4270
4271# detect how gif should be built
4272if [ "$CFG_GIF" = "auto" ]; then
4273    if [ "$CFG_SHARED" = "yes" ]; then
4274        CFG_GIF=plugin
4275    else
4276        CFG_GIF=yes
4277    fi
4278fi
4279
4280# detect how tiff should be built
4281if [ "$CFG_TIFF" = "auto" ]; then
4282    if [ "$CFG_SHARED" = "yes" ]; then
4283        CFG_TIFF=plugin
4284    else
4285        CFG_TIFF=yes
4286    fi
4287fi
4288
4289# detect tiff
4290if [ "$CFG_LIBTIFF" = "auto" ]; then
4291    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libtiff "libtiff" $L_FLAGS $I_FLAGS $l_FLAGS; then
4292        CFG_LIBTIFF=system
4293    else
4294        CFG_LIBTIFF=qt
4295    fi
4296fi
4297
4298# detect how mng should be built
4299if [ "$CFG_MNG" = "auto" ]; then
4300    if [ "$CFG_SHARED" = "yes" ]; then
4301        CFG_MNG=plugin
4302    else
4303        CFG_MNG=yes
4304    fi
4305fi
4306# detect mng
4307if [ "$CFG_LIBMNG" = "auto" ]; then
4308    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libmng "libmng" $L_FLAGS $I_FLAGS $l_FLAGS; then
4309       CFG_LIBMNG=system
4310    else
4311       CFG_LIBMNG=qt
4312    fi
4313fi
4314
4315# detect png
4316if [ "$CFG_LIBPNG" = "auto" ]; then
4317    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libpng "libpng" $L_FLAGS $I_FLAGS $l_FLAGS; then
4318       CFG_LIBPNG=system
4319    else
4320       CFG_LIBPNG=qt
4321    fi
4322fi
4323
4324# detect accessibility
4325if [ "$CFG_ACCESSIBILITY" = "auto" ]; then
4326    CFG_ACCESSIBILITY=yes
4327fi
4328
4329# auto-detect SQL-modules support
4330for _SQLDR in $CFG_SQL_AVAILABLE; do
4331        case $_SQLDR in
4332        mysql)
4333            if [ "$CFG_SQL_mysql" != "no" ]; then
4334                [ -z "$CFG_MYSQL_CONFIG" ] && CFG_MYSQL_CONFIG=`$WHICH mysql_config`
4335                if [ -x "$CFG_MYSQL_CONFIG" ]; then
4336                    QT_CFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --include 2>/dev/null`
4337                    QT_LFLAGS_MYSQL_R=`$CFG_MYSQL_CONFIG --libs_r 2>/dev/null`
4338                    QT_LFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --libs 2>/dev/null`
4339                    QT_MYSQL_VERSION=`$CFG_MYSQL_CONFIG --version 2>/dev/null`
4340                    QT_MYSQL_VERSION_MAJOR=`echo $QT_MYSQL_VERSION | cut -d . -f 1`
4341                fi
4342                if [ -n "$QT_MYSQL_VERSION" ] && [ "$QT_MYSQL_VERSION_MAJOR" -lt 4 ]; then
4343                    if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4344                        echo "This version of MySql is not supported ($QT_MYSQL_VERSION)."
4345                        echo " You need MySql 4 or higher."
4346                        echo " If you believe this message is in error you may use the continue"
4347                        echo " switch (-continue) to $0 to continue."
4348                        exit 101
4349                    else
4350                        CFG_SQL_mysql="no"
4351                        QT_LFLAGS_MYSQL=""
4352                        QT_LFLAGS_MYSQL_R=""
4353                        QT_CFLAGS_MYSQL=""
4354                    fi
4355                else
4356                    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql_r "MySQL (thread-safe)" $QT_LFLAGS_MYSQL_R $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS; then
4357                        QMakeVar add CONFIG use_libmysqlclient_r
4358                        if [ "$CFG_SQL_mysql" = "auto" ]; then
4359                            CFG_SQL_mysql=plugin
4360                        fi
4361                        QT_LFLAGS_MYSQL="$QT_LFLAGS_MYSQL_R"
4362                    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql "MySQL (thread-unsafe)" $QT_LFLAGS_MYSQL $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS; then
4363                        if [ "$CFG_SQL_mysql" = "auto" ]; then
4364                            CFG_SQL_mysql=plugin
4365                        fi
4366                    else
4367                        if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4368                            echo "MySQL support cannot be enabled due to functionality tests!"
4369                            echo " Turn on verbose messaging (-v) to $0 to see the final report."
4370                            echo " If you believe this message is in error you may use the continue"
4371                            echo " switch (-continue) to $0 to continue."
4372                            exit 101
4373                        else
4374                            CFG_SQL_mysql=no
4375                            QT_LFLAGS_MYSQL=""
4376                            QT_LFLAGS_MYSQL_R=""
4377                            QT_CFLAGS_MYSQL=""
4378                        fi
4379                    fi
4380                fi
4381            fi
4382            ;;
4383        psql)
4384            if [ "$CFG_SQL_psql" != "no" ]; then
4385                if "$WHICH" pg_config >/dev/null 2>&1; then
4386                    QT_CFLAGS_PSQL=`pg_config --includedir 2>/dev/null`
4387                    QT_LFLAGS_PSQL=`pg_config --libdir 2>/dev/null`
4388                fi
4389                [ -z "$QT_CFLAGS_PSQL" ] || QT_CFLAGS_PSQL="-I$QT_CFLAGS_PSQL"
4390                [ -z "$QT_LFLAGS_PSQL" ] || QT_LFLAGS_PSQL="-L$QT_LFLAGS_PSQL"
4391                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/psql "PostgreSQL" $QT_LFLAGS_PSQL $L_FLAGS $QT_CFLAGS_PSQL $I_FLAGS $l_FLAGS; then
4392                    if [ "$CFG_SQL_psql" = "auto" ]; then
4393                        CFG_SQL_psql=plugin
4394                    fi
4395                else
4396                    if [ "$CFG_SQL_psql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4397                        echo "PostgreSQL support cannot be enabled due to functionality tests!"
4398                        echo " Turn on verbose messaging (-v) to $0 to see the final report."
4399                        echo " If you believe this message is in error you may use the continue"
4400                        echo " switch (-continue) to $0 to continue."
4401                        exit 101
4402                    else
4403                        CFG_SQL_psql=no
4404                        QT_CFLAGS_PSQL=""
4405                        QT_LFLAGS_PSQL=""
4406                    fi
4407                fi
4408            fi
4409        ;;
4410        odbc)
4411            if [ "$CFG_SQL_odbc" != "no" ]; then
4412                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/odbc "ODBC" $L_FLAGS $I_FLAGS $l_FLAGS; then
4413                    if [ "$CFG_SQL_odbc" = "auto" ]; then
4414                        CFG_SQL_odbc=plugin
4415                    fi
4416                else
4417                    if [ "$CFG_SQL_odbc" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4418                        echo "ODBC support cannot be enabled due to functionality tests!"
4419                        echo " Turn on verbose messaging (-v) to $0 to see the final report."
4420                        echo " If you believe this message is in error you may use the continue"
4421                        echo " switch (-continue) to $0 to continue."
4422                        exit 101
4423                    else
4424                        CFG_SQL_odbc=no
4425                    fi
4426                fi
4427            fi
4428            ;;
4429        oci)
4430            if [ "$CFG_SQL_oci" != "no" ]; then
4431                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/oci "OCI" $L_FLAGS $I_FLAGS $l_FLAGS; then
4432                    if [ "$CFG_SQL_oci" = "auto" ]; then
4433                        CFG_SQL_oci=plugin
4434                    fi
4435                else
4436                    if [ "$CFG_SQL_oci" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4437                        echo "Oracle (OCI) support cannot be enabled due to functionality tests!"
4438                        echo " Turn on verbose messaging (-v) to $0 to see the final report."
4439                        echo " If you believe this message is in error you may use the continue"
4440                        echo " switch (-continue) to $0 to continue."
4441                        exit 101
4442                    else
4443                        CFG_SQL_oci=no
4444                    fi
4445                fi
4446            fi
4447            ;;
4448        tds)
4449            if [ "$CFG_SQL_tds" != "no" ]; then
4450                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tds "TDS" $L_FLAGS $I_FLAGS $l_FLAGS; then
4451                    if [ "$CFG_SQL_tds" = "auto" ]; then
4452                        CFG_SQL_tds=plugin
4453                    fi
4454                else
4455                    if [ "$CFG_SQL_tds" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4456                        echo "TDS support cannot be enabled due to functionality tests!"
4457                        echo " Turn on verbose messaging (-v) to $0 to see the final report."
4458                        echo " If you believe this message is in error you may use the continue"
4459                        echo " switch (-continue) to $0 to continue."
4460                        exit 101
4461                    else
4462                        CFG_SQL_tds=no
4463                    fi
4464                fi
4465            fi
4466            ;;
4467        db2)
4468            if [ "$CFG_SQL_db2" != "no" ]; then
4469                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/db2 "DB2" $L_FLAGS $I_FLAGS $l_FLAGS; then
4470                    if [ "$CFG_SQL_db2" = "auto" ]; then
4471                        CFG_SQL_db2=plugin
4472                    fi
4473                else
4474                    if [ "$CFG_SQL_db2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4475                        echo "ODBC support cannot be enabled due to functionality tests!"
4476                        echo " Turn on verbose messaging (-v) to $0 to see the final report."
4477                        echo " If you believe this message is in error you may use the continue"
4478                        echo " switch (-continue) to $0 to continue."
4479                        exit 101
4480                    else
4481                        CFG_SQL_db2=no
4482                    fi
4483                fi
4484            fi
4485            ;;
4486        ibase)
4487            if [ "$CFG_SQL_ibase" != "no" ]; then
4488                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ibase "InterBase" $L_FLAGS $I_FLAGS $l_FLAGS; then
4489                    if [ "$CFG_SQL_ibase" = "auto" ]; then
4490                        CFG_SQL_ibase=plugin
4491                    fi
4492                else
4493                    if [ "$CFG_SQL_ibase" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4494                        echo "InterBase support cannot be enabled due to functionality tests!"
4495                        echo " Turn on verbose messaging (-v) to $0 to see the final report."
4496                        echo " If you believe this message is in error you may use the continue"
4497                        echo " switch (-continue) to $0 to continue."
4498                        exit 101
4499                    else
4500                        CFG_SQL_ibase=no
4501                    fi
4502                fi
4503            fi
4504            ;;
4505        sqlite2)
4506            if [ "$CFG_SQL_sqlite2" != "no" ]; then
4507                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite2 "SQLite2" $L_FLAGS $I_FLAGS $l_FLAGS; then
4508                    if [ "$CFG_SQL_sqlite2" = "auto" ]; then
4509                        CFG_SQL_sqlite2=plugin
4510                    fi
4511                else
4512                    if [ "$CFG_SQL_sqlite2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4513                        echo "SQLite2 support cannot be enabled due to functionality tests!"
4514                        echo " Turn on verbose messaging (-v) to $0 to see the final report."
4515                        echo " If you believe this message is in error you may use the continue"
4516                        echo " switch (-continue) to $0 to continue."
4517                        exit 101
4518                    else
4519                        CFG_SQL_sqlite2=no
4520                    fi
4521                fi
4522            fi
4523            ;;
4524        sqlite)
4525            if [ "$CFG_SQL_sqlite" != "no" ]; then
4526                SQLITE_AUTODETECT_FAILED="no"
4527                if [ "$CFG_SQLITE" = "system" ]; then
4528                    if [ -n "$PKG_CONFIG" ]; then
4529                        QT_CFLAGS_SQLITE=`$PKG_CONFIG --cflags sqlite3 2>/dev/null`
4530                        QT_LFLAGS_SQLITE=`$PKG_CONFIG --libs sqlite3 2>/dev/null`
4531                    fi
4532                    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite "SQLite" $QT_LFLAGS_SQLITE $L_FLAGS $QT_CFLAGS_SQLITE $I_FLAGS $l_FLAGS; then
4533                        if [ "$CFG_SQL_sqlite" = "auto" ]; then
4534                            CFG_SQL_sqlite=plugin
4535                        fi
4536                        QMAKE_CONFIG="$QMAKE_CONFIG system-sqlite"
4537                    else
4538                        SQLITE_AUTODETECT_FAILED="yes"
4539                        CFG_SQL_sqlite=no
4540                    fi
4541                elif [ -f "$relpath/src/3rdparty/sqlite/sqlite3.h" ]; then
4542                    if [ "$CFG_SQL_sqlite" = "auto" ]; then
4543                            CFG_SQL_sqlite=plugin
4544                    fi
4545                else
4546                    SQLITE_AUTODETECT_FAILED="yes"
4547                    CFG_SQL_sqlite=no
4548                fi
4549
4550                if [ "$SQLITE_AUTODETECT_FAILED" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4551                    echo "SQLite support cannot be enabled due to functionality tests!"
4552                    echo " Turn on verbose messaging (-v) to $0 to see the final report."
4553                    echo " If you believe this message is in error you may use the continue"
4554                    echo " switch (-continue) to $0 to continue."
4555                    exit 101
4556                fi
4557            fi
4558            ;;
4559        *)
4560            if [ "$OPT_VERBOSE" = "yes" ]; then
4561                echo "unknown SQL driver: $_SQLDR"
4562            fi
4563            ;;
4564        esac
4565done
4566
4567# auto-detect NIS support
4568if [ "$CFG_NIS" != "no" ]; then
4569    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/nis "NIS" $L_FLAGS $I_FLAGS $l_FLAGS; then
4570        CFG_NIS=yes
4571    else
4572        if [ "$CFG_NIS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4573            echo "NIS support cannot be enabled due to functionality tests!"
4574            echo " Turn on verbose messaging (-v) to $0 to see the final report."
4575            echo " If you believe this message is in error you may use the continue"
4576            echo " switch (-continue) to $0 to continue."
4577            exit 101
4578        else
4579            CFG_NIS=no
4580        fi
4581    fi
4582fi
4583
4584# auto-detect CUPS support
4585if [ "$CFG_CUPS" != "no" ]; then
4586    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/cups "Cups" $L_FLAGS $I_FLAGS $l_FLAGS; then
4587        CFG_CUPS=yes
4588    else
4589        if [ "$CFG_CUPS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4590            echo "Cups support cannot be enabled due to functionality tests!"
4591            echo " Turn on verbose messaging (-v) to $0 to see the final report."
4592            echo " If you believe this message is in error you may use the continue"
4593            echo " switch (-continue) to $0 to continue."
4594            exit 101
4595        else
4596            CFG_CUPS=no
4597        fi
4598    fi
4599fi
4600
4601# auto-detect iconv(3) support
4602if [ "$CFG_ICONV" != "no" ]; then
4603    if [ "$PLATFORM_QWS" = "yes" ]; then
4604        CFG_ICONV=no
4605    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/iconv" "POSIX iconv" $L_FLAGS $I_FLAGS $l_FLAGS; then
4606        CFG_ICONV=yes
4607    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/gnu-libiconv" "GNU libiconv" $L_FLAGS $I_FLAGS $l_FLAGS; then
4608        CFG_ICONV=gnu
4609    else
4610        if [ "$CFG_ICONV" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4611            echo "Iconv support cannot be enabled due to functionality tests!"
4612            echo " Turn on verbose messaging (-v) to $0 to see the final report."
4613            echo " If you believe this message is in error you may use the continue"
4614            echo " switch (-continue) to $0 to continue."
4615            exit 101
4616        else
4617            CFG_ICONV=no
4618        fi
4619    fi
4620fi
4621
4622# auto-detect libdbus-1 support
4623if [ "$CFG_DBUS" != "no" ]; then
4624    if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then
4625        QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null`
4626        QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null`
4627    fi
4628    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/dbus "D-Bus" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_DBUS $QT_LIBS_DBUS; then
4629        [ "$CFG_DBUS" = "auto" ] && CFG_DBUS=yes
4630        QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
4631        QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS"
4632    else
4633        if [ "$CFG_DBUS" = "auto" ]; then
4634            CFG_DBUS=no
4635        elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4636            # CFG_DBUS is "yes" or "linked" here
4637
4638            echo "The QtDBus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found."
4639            echo " Turn on verbose messaging (-v) to $0 to see the final report."
4640            echo " If you believe this message is in error you may use the continue"
4641            echo " switch (-continue) to $0 to continue."
4642            exit 101
4643        fi
4644    fi
4645fi
4646
4647# Generate a CRC of the namespace for using in constants for the Carbon port.
4648# This should mean that you really *can* load two Qt's and have our custom
4649# Carbon events work.
4650if [ "$PLATFORM_MAC" = "yes" -a ! -z "$QT_NAMESPACE" ]; then
4651    QT_NAMESPACE_MAC_CRC=`"$mactests/crc.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/mac/crc $QT_NAMESPACE $L_FLAGS $I_FLAGS $l_FLAGS`
4652fi
4653
4654if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then
4655    # auto-detect Glib support
4656    if [ "$CFG_GLIB" != "no" ]; then
4657        if [ -n "$PKG_CONFIG" ]; then
4658            QT_CFLAGS_GLIB=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0 2>/dev/null`
4659            QT_LIBS_GLIB=`$PKG_CONFIG --libs glib-2.0 gthread-2.0 2>/dev/null`
4660        fi
4661        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/glib "Glib" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_GLIB $QT_LIBS_GLIB $X11TESTS_FLAGS; then
4662            CFG_GLIB=yes
4663            QMakeVar set QT_CFLAGS_GLIB "$QT_CFLAGS_GLIB"
4664            QMakeVar set QT_LIBS_GLIB "$QT_LIBS_GLIB"
4665        else
4666            if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4667                echo "Glib support cannot be enabled due to functionality tests!"
4668                echo " Turn on verbose messaging (-v) to $0 to see the final report."
4669                echo " If you believe this message is in error you may use the continue"
4670                echo " switch (-continue) to $0 to continue."
4671                exit 101
4672            else
4673                CFG_GLIB=no
4674            fi
4675        fi
4676    fi
4677
4678    if [ "$CFG_PHONON" != "no" ]; then
4679        if [ "$CFG_PHONON_BACKEND" != "no" ]; then
4680            if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then
4681                if [ -n "$PKG_CONFIG" ]; then
4682                    QT_CFLAGS_GSTREAMER=`$PKG_CONFIG --cflags gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
4683                    QT_LIBS_GSTREAMER=`$PKG_CONFIG --libs gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
4684                fi
4685                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/gstreamer "GStreamer" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_GSTREAMER $QT_LIBS_GSTREAMER $X11TESTS_FLAGS; then
4686                    CFG_GSTREAMER=yes
4687                    QMakeVar set QT_CFLAGS_GSTREAMER "$QT_CFLAGS_GSTREAMER"
4688                    QMakeVar set QT_LIBS_GSTREAMER "$QT_LIBS_GSTREAMER"
4689                else
4690                    if [ "$CFG_GSTREAMER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4691                        echo "Gstreamer support cannot be enabled due to functionality tests!"
4692                        echo " Turn on verbose messaging (-v) to $0 to see the final report."
4693                        echo " If you believe this message is in error you may use the continue"
4694                        echo " switch (-continue) to $0 to continue."
4695                        exit 101
4696                    else
4697                        CFG_GSTREAMER=no
4698                    fi
4699                fi
4700            elif [ "$CFG_GLIB" = "no" ]; then
4701                CFG_GSTREAMER=no
4702            fi
4703
4704            if [ "$CFG_GSTREAMER" = "yes" ]; then
4705                CFG_PHONON=yes
4706            else
4707                if [ "$CFG_PHONON" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4708                    echo "Phonon support cannot be enabled due to functionality tests!"
4709                    echo " Turn on verbose messaging (-v) to $0 to see the final report."
4710                    echo " If you believe this message is in error you may use the continue"
4711                    echo " switch (-continue) to $0 to continue."
4712                    exit 101
4713                else
4714                    CFG_PHONON=no
4715                fi
4716            fi
4717        else
4718            CFG_PHONON=yes
4719        fi
4720    fi
4721fi # X11/QWS
4722
4723# x11
4724if [ "$PLATFORM_X11" = "yes" ]; then
4725    x11tests="$relpath/config.tests/x11"
4726    X11TESTS_FLAGS=
4727
4728    # work around broken X11 headers when using GCC 2.95 or later
4729    NOTYPE=no
4730    "$x11tests/notype.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" && NOTYPE=yes
4731    if [ $NOTYPE = "yes" ]; then
4732        QMakeVar add QMAKE_CXXFLAGS -fpermissive
4733        X11TESTS_FLAGS="$X11TESTS_FLAGS -fpermissive"
4734    fi
4735
4736    # Check we actually have X11 :-)
4737    if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
4738        echo "Basic XLib functionality test failed!"
4739        echo " You might need to modify the include and library search paths by editing"
4740        echo " QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in ${XQMAKESPEC}."
4741        exit 1
4742    fi
4743
4744    # auto-detect OpenGL support (es1 = OpenGL ES 1.x Common, es1cl = ES 1.x common lite, es2 = OpenGL ES 2.x)
4745    if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
4746        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
4747            CFG_OPENGL=desktop
4748        elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then
4749            CFG_OPENGL=es2
4750        elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS; then
4751            CFG_OPENGL=es1
4752        elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1cl "OpenGL ES 1.x Lite" $L_FLAGS $I_FLAGS $l_FLAGS; then
4753            CFG_OPENGL=es1cl
4754        else
4755            if [ "$CFG_OPENGL" = "yes" ]; then
4756                echo "All the OpenGL functionality tests failed!"
4757                echo " You might need to modify the include and library search paths by editing"
4758                echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
4759                echo " ${XQMAKESPEC}."
4760                exit 1
4761            fi
4762            CFG_OPENGL=no
4763        fi
4764       case "$PLATFORM" in
4765       hpux*)
4766           # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
4767           if [ "$CFG_OPENGL" = "desktop" ]; then
4768               if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
4769                   QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
4770               fi
4771           fi
4772           ;;
4773       *)
4774           ;;
4775       esac
4776    elif [ "$CFG_OPENGL" = "es1cl" ]; then
4777        # OpenGL ES 1.x common lite
4778        if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1cl "OpenGL ES 1.x Lite" $L_FLAGS $I_FLAGS $l_FLAGS; then
4779            echo "The OpenGL ES 1.x Common Lite Profile functionality test failed!"
4780            echo " You might need to modify the include and library search paths by editing"
4781            echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
4782            echo " ${XQMAKESPEC}."
4783            exit 1
4784        fi
4785    elif [ "$CFG_OPENGL" = "es1" ]; then
4786        # OpenGL ES 1.x
4787        if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS; then
4788            echo "The OpenGL ES 1.x functionality test failed!"
4789            echo " You might need to modify the include and library search paths by editing"
4790            echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
4791            echo " ${XQMAKESPEC}."
4792            exit 1
4793        fi
4794    elif [ "$CFG_OPENGL" = "es2" ]; then
4795        #OpenGL ES 2.x
4796        if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then
4797            echo "The OpenGL ES 2.0 functionality test failed!"
4798            echo " You might need to modify the include and library search paths by editing"
4799            echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
4800            echo " ${XQMAKESPEC}."
4801            exit 1
4802        fi
4803    elif [ "$CFG_OPENGL" = "desktop" ]; then
4804        # Desktop OpenGL support
4805        if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
4806            echo "The OpenGL functionality test failed!"
4807            echo " You might need to modify the include and library search paths by editing"
4808            echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
4809            echo " ${XQMAKESPEC}."
4810            exit 1
4811        fi
4812        case "$PLATFORM" in
4813        hpux*)
4814            # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
4815            if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
4816                QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
4817            fi
4818            ;;
4819        *)
4820            ;;
4821        esac
4822    fi
4823
4824    # if opengl is disabled and the user specified graphicssystem gl, disable it...
4825    if [ "$CFG_GRAPHICS_SYSTEM" = "opengl" ] && [ "$CFG_OPENGL" = "no" ]; then
4826        echo "OpenGL Graphics System is disabled due to missing OpenGL support..."
4827        CFG_GRAPHICS_SYSTEM=default
4828    fi
4829
4830    # auto-detect Xcursor support
4831    if [ "$CFG_XCURSOR" != "no" ]; then
4832        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xcursor "Xcursor" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
4833            if [ "$CFG_XCURSOR" != "runtime" ]; then
4834                CFG_XCURSOR=yes;
4835            fi
4836        else
4837            if [ "$CFG_XCURSOR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4838                echo "Xcursor support cannot be enabled due to functionality tests!"
4839                echo " Turn on verbose messaging (-v) to $0 to see the final report."
4840                echo " If you believe this message is in error you may use the continue"
4841                echo " switch (-continue) to $0 to continue."
4842                exit 101
4843            else
4844                CFG_XCURSOR=no
4845            fi
4846        fi
4847    fi
4848
4849    # auto-detect Xfixes support
4850    if [ "$CFG_XFIXES" != "no" ]; then
4851        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xfixes "Xfixes" $L_FLAGS $I_FLAGS $X11TESTS_FLAGS; then
4852            if [ "$CFG_XFIXES" != "runtime" ]; then
4853                CFG_XFIXES=yes;
4854            fi
4855        else
4856            if [ "$CFG_XFIXES" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4857                echo "Xfixes support cannot be enabled due to functionality tests!"
4858                echo " Turn on verbose messaging (-v) to $0 to see the final report."
4859                echo " If you believe this message is in error you may use the continue"
4860                echo " switch (-continue) to $0 to continue."
4861                exit 101
4862            else
4863                CFG_XFIXES=no
4864            fi
4865        fi
4866    fi
4867
4868    # auto-detect Xrandr support (resize and rotate extension)
4869    if [ "$CFG_XRANDR" != "no" ]; then
4870        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xrandr "Xrandr" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
4871            if [ "$CFG_XRANDR" != "runtime" ]; then
4872            CFG_XRANDR=yes
4873            fi
4874        else
4875            if [ "$CFG_XRANDR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4876                echo "Xrandr support cannot be enabled due to functionality tests!"
4877                echo " Turn on verbose messaging (-v) to $0 to see the final report."
4878                echo " If you believe this message is in error you may use the continue"
4879                echo " switch (-continue) to $0 to continue."
4880                exit 101
4881            else
4882                CFG_XRANDR=no
4883            fi
4884        fi
4885    fi
4886
4887    # auto-detect Xrender support
4888    if [ "$CFG_XRENDER" != "no" ]; then
4889        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xrender "Xrender" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
4890            CFG_XRENDER=yes
4891        else
4892            if [ "$CFG_XRENDER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4893                echo "Xrender support cannot be enabled due to functionality tests!"
4894                echo " Turn on verbose messaging (-v) to $0 to see the final report."
4895                echo " If you believe this message is in error you may use the continue"
4896                echo " switch (-continue) to $0 to continue."
4897                exit 101
4898            else
4899                CFG_XRENDER=no
4900            fi
4901        fi
4902    fi
4903
4904    # auto-detect MIT-SHM support
4905    if [ "$CFG_MITSHM" != "no" ]; then
4906        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/mitshm "mitshm" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
4907            CFG_MITSHM=yes
4908        else
4909            if [ "$CFG_MITSHM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4910                echo "MITSHM support cannot be enabled due to functionality tests!"
4911                echo " Turn on verbose messaging (-v) to $0 to see the final report."
4912                echo " If you believe this message is in error you may use the continue"
4913                echo " switch (-continue) to $0 to continue."
4914                exit 101
4915            else
4916                CFG_MITSHM=no
4917            fi
4918        fi
4919    fi
4920
4921    # auto-detect FontConfig support
4922    if [ "$CFG_FONTCONFIG" != "no" ]; then
4923    if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig 2>/dev/null; then
4924        QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig 2>/dev/null`
4925        QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig 2>/dev/null`
4926    else
4927        QT_CFLAGS_FONTCONFIG=
4928        QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig"
4929    fi
4930    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/fontconfig "FontConfig" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS $QT_CFLAGS_FONTCONFIG $QT_LIBS_FONTCONFIG; then
4931            CFG_FONTCONFIG=yes
4932        QMakeVar set QMAKE_CFLAGS_X11 "$QT_CFLAGS_FONTCONFIG \$\$QMAKE_CFLAGS_X11"
4933        QMakeVar set QMAKE_LIBS_X11 "$QT_LIBS_FONTCONFIG \$\$QMAKE_LIBS_X11"
4934            CFG_LIBFREETYPE=system
4935        else
4936            if [ "$CFG_FONTCONFIG" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4937                echo "FontConfig support cannot be enabled due to functionality tests!"
4938                echo " Turn on verbose messaging (-v) to $0 to see the final report."
4939                echo " If you believe this message is in error you may use the continue"
4940                echo " switch (-continue) to $0 to continue."
4941                exit 101
4942            else
4943                CFG_FONTCONFIG=no
4944            fi
4945        fi
4946    fi
4947
4948    # auto-detect Session Management support
4949    if [ "$CFG_SM" = "auto" ]; then
4950        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/sm "Session Management" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
4951            CFG_SM=yes
4952        else
4953            if [ "$CFG_SM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4954                echo "Session Management support cannot be enabled due to functionality tests!"
4955                echo " Turn on verbose messaging (-v) to $0 to see the final report."
4956                echo " If you believe this message is in error you may use the continue"
4957                echo " switch (-continue) to $0 to continue."
4958                exit 101
4959            else
4960                CFG_SM=no
4961            fi
4962        fi
4963    fi
4964
4965    # auto-detect SHAPE support
4966    if [ "$CFG_XSHAPE" != "no" ]; then
4967        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xshape "XShape" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
4968            CFG_XSHAPE=yes
4969        else
4970            if [ "$CFG_XSHAPE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4971                echo "XShape support cannot be enabled due to functionality tests!"
4972                echo " Turn on verbose messaging (-v) to $0 to see the final report."
4973                echo " If you believe this message is in error you may use the continue"
4974                echo " switch (-continue) to $0 to continue."
4975                exit 101
4976            else
4977                CFG_XSHAPE=no
4978            fi
4979        fi
4980    fi
4981
4982    # auto-detect Xinerama support
4983    if [ "$CFG_XINERAMA" != "no" ]; then
4984        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xinerama "Xinerama" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
4985            if [ "$CFG_XINERAMA" != "runtime" ]; then
4986                CFG_XINERAMA=yes
4987            fi
4988        else
4989            if [ "$CFG_XINERAMA" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4990                echo "Xinerama support cannot be enabled due to functionality tests!"
4991                echo " Turn on verbose messaging (-v) to $0 to see the final report."
4992                echo " If you believe this message is in error you may use the continue"
4993                echo " switch (-continue) to $0 to continue."
4994                exit 101
4995            else
4996                CFG_XINERAMA=no
4997            fi
4998        fi
4999    fi
5000
5001    # auto-detect Xinput support
5002    if [ "$CFG_XINPUT" != "no" ]; then
5003        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xinput "XInput" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
5004            if [ "$CFG_XINPUT" != "runtime" ]; then
5005                CFG_XINPUT=yes
5006            fi
5007        else
5008            if [ "$CFG_XINPUT" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5009                echo "Tablet and Xinput support cannot be enabled due to functionality tests!"
5010                echo " Turn on verbose messaging (-v) to $0 to see the final report."
5011                echo " If you believe this message is in error you may use the continue"
5012                echo " switch (-continue) to $0 to continue."
5013                exit 101
5014            else
5015                CFG_XINPUT=no
5016            fi
5017        fi
5018    fi
5019
5020    # auto-detect XKB support
5021    if [ "$CFG_XKB" != "no" ]; then
5022        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xkb "XKB" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
5023            CFG_XKB=yes
5024        else
5025            if [ "$CFG_XKB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5026                echo "XKB support cannot be enabled due to functionality tests!"
5027                echo " Turn on verbose messaging (-v) to $0 to see the final report."
5028                echo " If you believe this message is in error you may use the continue"
5029                echo " switch (-continue) to $0 to continue."
5030                exit 101
5031            else
5032                CFG_XKB=no
5033            fi
5034        fi
5035    fi
5036
5037    if [ "$CFG_GLIB" = "yes" -a "$CFG_QGTKSTYLE" != "no" ]; then
5038        if [ -n "$PKG_CONFIG" ]; then
5039            QT_CFLAGS_QGTKSTYLE=`$PKG_CONFIG --cflags gtk+-2.0 ">=" 2.10 atk 2>/dev/null`
5040            QT_LIBS_QGTKSTYLE=`$PKG_CONFIG --libs gobject-2.0 2>/dev/null`
5041        fi
5042        if [ -n "$QT_CFLAGS_QGTKSTYLE" ] ; then
5043            CFG_QGTKSTYLE=yes
5044            QMakeVar set QT_CFLAGS_QGTKSTYLE "$QT_CFLAGS_QGTKSTYLE"
5045            QMakeVar set QT_LIBS_QGTKSTYLE "$QT_LIBS_QGTKSTYLE"
5046        else
5047            if [ "$CFG_QGTKSTYLE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5048                echo "Gtk theme support cannot be enabled due to functionality tests!"
5049                echo " Turn on verbose messaging (-v) to $0 to see the final report."
5050                echo " If you believe this message is in error you may use the continue"
5051                echo " switch (-continue) to $0 to continue."
5052                exit 101
5053            else
5054                CFG_QGTKSTYLE=no
5055            fi
5056        fi
5057    elif [ "$CFG_GLIB" = "no" ]; then
5058        CFG_QGTKSTYLE=no
5059    fi
5060fi # X11
5061
5062
5063if [ "$PLATFORM_MAC" = "yes" ]; then
5064    if [ "$CFG_PHONON" != "no" ]; then
5065        # Always enable Phonon (unless it was explicitly disabled)
5066        CFG_PHONON=yes
5067    fi
5068fi
5069
5070# QWS
5071if [ "$PLATFORM_QWS" = "yes" ]; then
5072
5073    # auto-detect OpenGL support (es1 = OpenGL ES 1.x Common, es1cl = ES 1.x common lite, es2 = OpenGL ES 2.x)
5074    if [ "$CFG_OPENGL" = "yes" ]; then
5075        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then
5076            CFG_OPENGL=es2
5077        elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS; then
5078            CFG_OPENGL=es1
5079        elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1cl "OpenGL ES 1.x Lite" $L_FLAGS $I_FLAGS $l_FLAGS; then
5080            CFG_OPENGL=es1cl
5081        else
5082            echo "All the OpenGL ES functionality tests failed!"
5083            echo " You might need to modify the include and library search paths by editing"
5084            echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5085            echo " ${XQMAKESPEC}."
5086            exit 1
5087        fi
5088    elif [ "$CFG_OPENGL" = "es1" ]; then
5089        # OpenGL ES 1.x
5090        if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS; then
5091            echo "The OpenGL ES 1.x functionality test failed!"
5092            echo " You might need to modify the include and library search paths by editing"
5093            echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5094            echo " ${XQMAKESPEC}."
5095            exit 1
5096        fi
5097    elif [ "$CFG_OPENGL" = "es2" ]; then
5098        #OpenGL ES 2.x
5099        if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then
5100            echo "The OpenGL ES 2.0 functionality test failed!"
5101            echo " You might need to modify the include and library search paths by editing"
5102            echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5103            echo " ${XQMAKESPEC}."
5104            exit 1
5105        fi
5106    elif [ "$CFG_OPENGL" = "desktop" ]; then
5107        # Desktop OpenGL support
5108        echo "Desktop OpenGL support is not avaliable on Qt for Embedded Linux"
5109        exit 1
5110    fi
5111
5112    # screen drivers
5113    for screen in ${CFG_GFX_ON} ${CFG_GFX_PLUGIN}; do
5114       if [ "${screen}" = "ahi" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
5115           if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/ahi "Ahi" $L_FLAGS $I_FLAGS $l_FLAGS; then
5116               echo "The Ahi screen driver functionality test failed!"
5117               echo " You might need to modify the include and library search paths by editing"
5118               echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
5119               echo " ${XQMAKESPEC}."
5120               exit 1
5121           fi
5122       fi
5123
5124       if [ "${screen}" = "svgalib" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
5125           if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/svgalib "SVGAlib" $L_FLAGS $I_FLAGS $l_FLAGS; then
5126               echo "The SVGAlib screen driver functionality test failed!"
5127               echo " You might need to modify the include and library search paths by editing"
5128               echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
5129               echo " ${XQMAKESPEC}."
5130               exit 1
5131           fi
5132       fi
5133
5134       if [ "${screen}" = "directfb" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
5135           if [ -n "$PKG_CONFIG" ]; then
5136               if $PKG_CONFIG --exists directfb 2>/dev/null; then
5137                   QT_CFLAGS_DIRECTFB=`$PKG_CONFIG --cflags directfb 2>/dev/null`
5138                   QT_LIBS_DIRECTFB=`$PKG_CONFIG --libs directfb 2>/dev/null`
5139               elif directfb-config --version >/dev/null 2>&1; then
5140                   QT_CFLAGS_DIRECTFB=`directfb-config --cflags 2>/dev/null`
5141                   QT_LIBS_DIRECTFB=`directfb-config --libs 2>/dev/null`
5142               fi
5143           fi
5144
5145           # QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero.
5146           if [ -n "$QT_CFLAGS_DIRECTFB" ] || [ -n "$QT_LIBS_DIRECTFB" ]; then
5147               QMakeVar set QT_CFLAGS_DIRECTFB "$QT_CFLAGS_DIRECTFB"
5148               QMakeVar set QT_LIBS_DIRECTFB "$QT_LIBS_DIRECTFB"
5149           fi
5150
5151           if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/directfb "DirectFB" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_DIRECTFB $QT_LIBS_DIRECTFB; then
5152               echo "The DirectFB screen driver functionality test failed!"
5153               echo " You might need to modify the include and library search paths by editing"
5154               echo " QT_CFLAGS_DIRECTFB and QT_LIBS_DIRECTFB in"
5155               echo " ${XQMAKESPEC}."
5156               exit 1
5157           fi
5158       fi
5159
5160    done
5161
5162    # mouse drivers
5163    for mouse in ${CFG_MOUSE_ON} ${CFG_MOUSE_PLUGIN}; do
5164        if [ "${mouse}" = "tslib" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
5165            if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tslib "tslib" $L_FLAGS $I_FLAGS $l_FLAGS; then
5166               echo "The tslib functionality test failed!"
5167               echo " You might need to modify the include and library search paths by editing"
5168               echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
5169               echo " ${XQMAKESPEC}."
5170                exit 1
5171            fi
5172        fi
5173    done
5174
5175    CFG_QGTKSTYLE=no
5176
5177    # sound
5178    if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/sound "sound" $L_FLAGS $I_FLAGS $l_FLAGS; then
5179        QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SOUND"
5180    fi
5181
5182fi # QWS
5183
5184# freetype support
5185[ "x$CFG_EMBEDDED" != "xno" ] && CFG_LIBFREETYPE="$CFG_QWS_FREETYPE"
5186[ "x$PLATFORM_MAC" = "xyes" ] && CFG_LIBFREETYPE=no
5187if [ "$CFG_LIBFREETYPE" = "auto" ]; then
5188    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/freetype "FreeType" $L_FLAGS $I_FLAGS $l_FLAGS ; then
5189        CFG_LIBFREETYPE=system
5190    else
5191        CFG_LIBFREETYPE=yes
5192    fi
5193fi
5194
5195if [ "$CFG_ENDIAN" = "auto" ]; then
5196    if [ "$PLATFORM_MAC" = "yes" ]; then
5197        true #leave as auto
5198    else
5199        "$unixtests/endian.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
5200        F="$?"
5201        if [ "$F" -eq 0 ]; then
5202            CFG_ENDIAN="Q_LITTLE_ENDIAN"
5203        elif [ "$F" -eq 1 ]; then
5204            CFG_ENDIAN="Q_BIG_ENDIAN"
5205        else
5206            echo
5207            echo "The target system byte order could not be detected!"
5208            echo "Turn on verbose messaging (-v) to see the final report."
5209            echo "You can use the -little-endian or -big-endian switch to"
5210            echo "$0 to continue."
5211            exit 101
5212        fi
5213    fi
5214fi
5215
5216if [ "$CFG_HOST_ENDIAN" = "auto" ]; then
5217    if [ "$PLATFORM_MAC" = "yes" ]; then
5218        true #leave as auto
5219    else
5220        "$unixtests/endian.test" "$QMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
5221        F="$?"
5222        if [ "$F" -eq 0 ]; then
5223            CFG_HOST_ENDIAN="Q_LITTLE_ENDIAN"
5224        elif [ "$F" -eq 1 ]; then
5225            CFG_HOST_ENDIAN="Q_BIG_ENDIAN"
5226        else
5227            echo
5228            echo "The host system byte order could not be detected!"
5229            echo "Turn on verbose messaging (-v) to see the final report."
5230            echo "You can use the -host-little-endian or -host-big-endian switch to"
5231            echo "$0 to continue."
5232            exit 101
5233        fi
5234    fi
5235fi
5236
5237if [ "$CFG_ARMFPA" != "auto" ]; then
5238    if [ "$CFG_ARMFPA" = "yes" ]; then
5239        if [ "$CFG_ENDIAN" = "Q_LITTLE_ENDIAN" ]; then
5240            CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE_SWAPPED"
5241        else
5242            CFG_DOUBLEFORMAT="Q_DOUBLE_BIG_SWAPPED"
5243        fi
5244    else
5245        CFG_DOUBLEFORMAT="normal"
5246    fi
5247fi
5248
5249
5250if [ "$CFG_DOUBLEFORMAT" = "auto" ]; then
5251    if [ "$PLATFORM_QWS" != "yes" ]; then
5252        CFG_DOUBLEFORMAT=normal
5253    else
5254        "$unixtests/doubleformat.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
5255        F="$?"
5256        if [ "$F" -eq 10 ] && [ "$CFG_ENDIAN" = "Q_LITTLE_ENDIAN" ]; then
5257            CFG_DOUBLEFORMAT=normal
5258        elif [ "$F" -eq 11 ] && [ "$CFG_ENDIAN" = "Q_BIG_ENDIAN" ]; then
5259            CFG_DOUBLEFORMAT=normal
5260        elif [ "$F" -eq 10 ]; then
5261            CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE"
5262        elif [ "$F" -eq 11 ]; then
5263            CFG_DOUBLEFORMAT="Q_DOUBLE_BIG"
5264        elif [ "$F" -eq 12 ]; then
5265            CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE_SWAPPED"
5266            CFG_ARMFPA="yes"
5267        elif [ "$F" -eq 13 ]; then
5268            CFG_DOUBLEFORMAT="Q_DOUBLE_BIG_SWAPPED"
5269            CFG_ARMFPA="yes"
5270        else
5271            echo
5272            echo "The system floating point format could not be detected."
5273            echo "This may cause data to be generated in a wrong format"
5274            echo "Turn on verbose messaging (-v) to see the final report."
5275            # we do not fail on this since this is a new test, and if it fails,
5276            # the old behavior should be correct in most cases
5277            CFG_DOUBLEFORMAT=normal
5278        fi
5279    fi
5280fi
5281
5282HAVE_STL=no
5283if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stl "STL" $L_FLAGS $I_FLAGS $l_FLAGS; then
5284    HAVE_STL=yes
5285fi
5286
5287if [ "$CFG_STL" != "no" ]; then
5288    if [ "$HAVE_STL" = "yes" ]; then
5289        CFG_STL=yes
5290    else
5291        if [ "$CFG_STL" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5292            echo "STL support cannot be enabled due to functionality tests!"
5293            echo " Turn on verbose messaging (-v) to $0 to see the final report."
5294            echo " If you believe this message is in error you may use the continue"
5295            echo " switch (-continue) to $0 to continue."
5296            exit 101
5297        else
5298            CFG_STL=no
5299        fi
5300    fi
5301fi
5302
5303# find if the platform supports IPv6
5304if [ "$CFG_IPV6" != "no" ]; then
5305    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ipv6 "IPv6" $L_FLAGS $I_FLAGS $l_FLAGS; then
5306        CFG_IPV6=yes
5307    else
5308        if [ "$CFG_IPV6" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5309            echo "IPv6 support cannot be enabled due to functionality tests!"
5310            echo " Turn on verbose messaging (-v) to $0 to see the final report."
5311            echo " If you believe this message is in error you may use the continue"
5312            echo " switch (-continue) to $0 to continue."
5313            exit 101
5314        else
5315            CFG_IPV6=no
5316        fi
5317    fi
5318fi
5319
5320# detect POSIX clock_gettime()
5321if [ "$CFG_CLOCK_GETTIME" = "auto" ]; then
5322    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/clock-gettime "POSIX clock_gettime()" $L_FLAGS $I_FLAGS $l_FLAGS; then
5323        CFG_CLOCK_GETTIME=yes
5324    else
5325        CFG_CLOCK_GETTIME=no
5326    fi
5327fi
5328
5329# detect POSIX monotonic clocks
5330if [ "$CFG_CLOCK_GETTIME" = "yes" ] && [ "$CFG_CLOCK_MONOTONIC" = "auto" ]; then
5331    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/clock-monotonic "POSIX Monotonic Clock" $L_FLAGS $I_FLAGS $l_FLAGS; then
5332        CFG_CLOCK_MONOTONIC=yes
5333    else
5334        CFG_CLOCK_MONOTONIC=no
5335    fi
5336elif [ "$CFG_CLOCK_GETTIME" = "no" ]; then
5337    CFG_CLOCK_MONOTONIC=no
5338fi
5339
5340# detect mremap
5341if [ "$CFG_MREMAP" = "auto" ]; then
5342    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mremap "mremap" $L_FLAGS $I_FLAGS $l_FLAGS; then
5343        CFG_MREMAP=yes
5344    else
5345        CFG_MREMAP=no
5346    fi
5347fi
5348
5349# find if the platform provides getaddrinfo (ipv6 dns lookups)
5350if [ "$CFG_GETADDRINFO" != "no" ]; then
5351    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getaddrinfo "getaddrinfo" $L_FLAGS $I_FLAGS $l_FLAGS; then
5352        CFG_GETADDRINFO=yes
5353    else
5354        if [ "$CFG_GETADDRINFO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5355            echo "getaddrinfo support cannot be enabled due to functionality tests!"
5356            echo " Turn on verbose messaging (-v) to $0 to see the final report."
5357            echo " If you believe this message is in error you may use the continue"
5358            echo " switch (-continue) to $0 to continue."
5359            exit 101
5360        else
5361            CFG_GETADDRINFO=no
5362        fi
5363    fi
5364fi
5365
5366# find if the platform provides inotify
5367if [ "$CFG_INOTIFY" != "no" ]; then
5368    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/inotify "inotify" $L_FLAGS $I_FLAGS $l_FLAGS; then
5369        CFG_INOTIFY=yes
5370    else
5371        if [ "$CFG_INOTIFY" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5372            echo "inotify support cannot be enabled due to functionality tests!"
5373            echo " Turn on verbose messaging (-v) to $0 to see the final report."
5374            echo " If you believe this message is in error you may use the continue"
5375            echo " switch (-continue) to $0 to continue."
5376            exit 101
5377        else
5378            CFG_INOTIFY=no
5379        fi
5380    fi
5381fi
5382
5383# find if the platform provides if_nametoindex (ipv6 interface name support)
5384if [ "$CFG_IPV6IFNAME" != "no" ]; then
5385    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ipv6ifname "IPv6 interface name" $L_FLAGS $I_FLAGS $l_FLAGS; then
5386        CFG_IPV6IFNAME=yes
5387    else
5388        if [ "$CFG_IPV6IFNAME" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5389            echo "IPv6 interface name support cannot be enabled due to functionality tests!"
5390            echo " Turn on verbose messaging (-v) to $0 to see the final report."
5391            echo " If you believe this message is in error you may use the continue"
5392            echo " switch (-continue) to $0 to continue."
5393            exit 101
5394        else
5395            CFG_IPV6IFNAME=no
5396        fi
5397    fi
5398fi
5399
5400# find if the platform provides getifaddrs (network interface enumeration)
5401if [ "$CFG_GETIFADDRS" != "no" ]; then
5402    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getifaddrs "getifaddrs" $L_FLAGS $I_FLAGS $l_FLAGS; then
5403        CFG_GETIFADDRS=yes
5404    else
5405        if [ "$CFG_GETIFADDRS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5406            echo "getifaddrs support cannot be enabled due to functionality tests!"
5407            echo " Turn on verbose messaging (-v) to $0 to see the final report."
5408            echo " If you believe this message is in error you may use the continue"
5409            echo " switch (-continue) to $0 to continue."
5410            exit 101
5411        else
5412            CFG_GETIFADDRS=no
5413        fi
5414    fi
5415fi
5416
5417# find if the platform supports X/Open Large File compilation environment
5418if [ "$CFG_LARGEFILE" != "no" ]; then
5419    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/largefile "X/Open Large File" $L_FLAGS $I_FLAGS $l_FLAGS; then
5420        CFG_LARGEFILE=yes
5421    else
5422        if [ "$CFG_LARGEFILE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5423            echo "X/Open Large File support cannot be enabled due to functionality tests!"
5424            echo " Turn on verbose messaging (-v) to $0 to see the final report."
5425            echo " If you believe this message is in error you may use the continue"
5426            echo " switch (-continue) to $0 to continue."
5427            exit 101
5428        else
5429            CFG_LARGEFILE=no
5430        fi
5431    fi
5432fi
5433
5434# detect OpenSSL
5435if [ "$CFG_OPENSSL" != "no" ]; then
5436    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/openssl "OpenSSL" $L_FLAGS $I_FLAGS $l_FLAGS; then
5437        if [ "$CFG_OPENSSL" = "auto" ]; then
5438            CFG_OPENSSL=yes
5439        fi
5440    else
5441        if ( [ "$CFG_OPENSSL" = "yes" ] || [ "$CFG_OPENSSL" = "linked" ] ) && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5442            echo "OpenSSL support cannot be enabled due to functionality tests!"
5443            echo " Turn on verbose messaging (-v) to $0 to see the final report."
5444            echo " If you believe this message is in error you may use the continue"
5445            echo " switch (-continue) to $0 to continue."
5446            exit 101
5447        else
5448            CFG_OPENSSL=no
5449        fi
5450    fi
5451fi
5452
5453if [ "$CFG_PTMALLOC" != "no" ]; then
5454    # build ptmalloc, copy .a file to lib/
5455    echo "Building ptmalloc. Please wait..."
5456    (cd "$relpath/src/3rdparty/ptmalloc/"; "$MAKE" "clean" ; "$MAKE" "posix"
5457     mkdir "$outpath/lib/" ; cp "libptmalloc3.a" "$outpath/lib/")
5458
5459    QMakeVar add QMAKE_LFLAGS "$outpath/lib/libptmalloc3.a"
5460fi
5461
5462#-------------------------------------------------------------------------------
5463# ask for all that hasn't been auto-detected or specified in the arguments
5464#-------------------------------------------------------------------------------
5465
5466### fix this: user input should be validated in a loop
5467if [ "$CFG_QWS_DEPTHS" = "prompted" -a "$PLATFORM_QWS" = "yes" ]; then
5468    echo
5469    echo "Choose pixel-depths to support:"
5470    echo
5471    echo "   1. 1bpp, black/white"
5472    echo "   4. 4bpp, grayscale"
5473    echo "   8. 8bpp, paletted"
5474    echo "  12. 12bpp, rgb 4-4-4"
5475    echo "  15. 15bpp, rgb 5-5-5"
5476    echo "  16. 16bpp, rgb 5-6-5"
5477    echo "  18. 18bpp, rgb 6-6-6"
5478    echo "  24. 24bpp, rgb 8-8-8"
5479    echo "  32. 32bpp, argb 8-8-8-8 and rgb 8-8-8"
5480    echo " all. All supported depths"
5481    echo
5482    echo "Your choices (default 8,16,32):"
5483    read CFG_QWS_DEPTHS
5484    if [ -z "$CFG_QWS_DEPTHS" ] || [ "$CFG_QWS_DEPTHS" = "yes" ]; then
5485        CFG_QWS_DEPTHS=8,16,32
5486    fi
5487fi
5488if [ -n "$CFG_QWS_DEPTHS" -a "$PLATFORM_QWS" = "yes" ]; then
5489    if [ "$CFG_QWS_DEPTHS" = "all" ]; then
5490        CFG_QWS_DEPTHS="1 4 8 12 15 16 18 24 32 generic"
5491    fi
5492    for D in `echo "$CFG_QWS_DEPTHS" | sed -e 's/,/ /g'`; do
5493        case $D in
5494            1|4|8|12|15|16|18|24|32) QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QWS_DEPTH_$D";;
5495            generic) QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QWS_DEPTH_GENERIC";;
5496        esac
5497    done
5498fi
5499
5500# enable dwarf2 support on Mac
5501if [ "$CFG_MAC_DWARF2" = "yes" ]; then
5502    QT_CONFIG="$QT_CONFIG dwarf2"
5503fi
5504
5505# Set the default arch. Select 32-bit/carbon if nothing else has
5506# been specified on the configure line.
5507if [ "$PLATFORM_MAC" = "yes" ]  && [ "$CFG_MAC_ARCHS" == "" ]; then
5508    source "$mactests/defaultarch.test" "$TEST_COMPILER