1
#!/bin/sh
2
#############################################################################
3
##
4
## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
5
## All rights reserved.
6
## Contact: Nokia Corporation (qt-info@nokia.com)
7
##
8
## This file is the build configuration utility of the Qt Toolkit.
9
##
10
## $QT_BEGIN_LICENSE:LGPL$
11
## No Commercial Usage
12
## This file contains pre-release code and may not be distributed.
13
## You may use this file in accordance with the terms and conditions
14
## contained in the Technology Preview License Agreement accompanying
15
## this package.
16
##
17
## GNU Lesser General Public License Usage
18
## Alternatively, this file may be used under the terms of the GNU Lesser
19
## General Public License version 2.1 as published by the Free Software
20
## Foundation and appearing in the file LICENSE.LGPL included in the
21
## packaging of this file.  Please review the following information to
22
## ensure the GNU Lesser General Public License version 2.1 requirements
23
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24
##
25
## In addition, as a special exception, Nokia gives you certain additional
26
## rights.  These rights are described in the Nokia Qt LGPL Exception
27
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28
##
29
## If you have questions regarding the use of this file, please contact
30
## Nokia at qt-info@nokia.com.
31
##
32
##
33
##
34
##
35
##
36
##
37
##
38
##
39
## $QT_END_LICENSE$
40
##
41
#############################################################################
42
43
#-------------------------------------------------------------------------------
44
# script initialization
45
#-------------------------------------------------------------------------------
46
47
# the name of this script
48
relconf=`basename $0`
49
# the directory of this script is the "source tree"
50
relpath=`dirname $0`
51
relpath=`(cd "$relpath"; /bin/pwd)`
52
# the current directory is the "build tree" or "object tree"
53
outpath=`/bin/pwd`
54
55
#license file location
56
LICENSE_FILE="$QT_LICENSE_FILE"
57
[ -z "$LICENSE_FILE" ] && LICENSE_FILE="$HOME/.qt-license"
58
if [ -f "$LICENSE_FILE" ]; then
59
    tr -d '\r' <"$LICENSE_FILE" >"${LICENSE_FILE}.tmp"
60
    diff "${LICENSE_FILE}.tmp" "${LICENSE_FILE}" >/dev/null 2>&1 || LICENSE_FILE="${LICENSE_FILE}.tmp"
61
fi
62
63
# later cache the command line in config.status
64
OPT_CMDLINE=`echo $@ | sed "s,-v ,,g; s,-v$,,g"`
65
66
# initialize global variables
67
QMAKE_SWITCHES=
68
QMAKE_VARS=
69
QMAKE_CONFIG=
70
QTCONFIG_CONFIG=
71
QT_CONFIG=
72
SUPPORTED=
73
QMAKE_VARS_FILE=.qmake.vars
74
75
:> "$QMAKE_VARS_FILE"
76
77
#-------------------------------------------------------------------------------
78
# utility functions
79
#-------------------------------------------------------------------------------
80
81
shellEscape()
82
{
83
    echo "$@" | sed 's/ /\ /g'
84
}
85
86
# Adds a new qmake variable to the cache
87
# Usage: QMakeVar mode varname contents
88
#   where mode is one of: set, add, del
89
QMakeVar()
90
{
91
    case "$1" in
92
	set)
93
	    eq="="
94
	    ;;
95
	add)
96
	    eq="+="
97
	    ;;
98
	del)
99
	    eq="-="
100
	    ;;
101
	*)
102
	    echo >&2 "BUG: wrong command to QMakeVar: $1"
103
	    ;;
104
    esac
105
106
    echo "$2" "$eq" "$3" >> "$QMAKE_VARS_FILE"
107
}
108
109
# relies on $QMAKESPEC being set correctly. parses include statements in
110
# qmake.conf and prints out the expanded file
111
getQMakeConf()
112
{
113
    tmpSPEC="$QMAKESPEC"
114
    if [ -n "$1" ]; then
115
        tmpSPEC="$1"
116
    fi
117
    $AWK -v "QMAKESPEC=$tmpSPEC" '
118
/^include\(.+\)$/{
119
    fname = QMAKESPEC "/" substr($0, 9, length($0) - 9)
120
    while ((getline line < fname) > 0)
121
        print line
122
    close(fname)
123
    next
124
}
125
{ print }' "$tmpSPEC/qmake.conf"
126
}
127
128
# relies on $TEST_COMPILER being set correctly
129
compilerSupportsFlag()
130
{
131
    cat >conftest.cpp <<EOF
132
int main() { return 0; }
133
EOF
134
    "$TEST_COMPILER" "$@" -o /dev/null conftest.cpp
135
    ret=$?
136
    rm -f conftest.cpp conftest.o
137
    return $ret
138
}
139
140
# relies on $TEST_COMPILER being set correctly
141
linkerSupportsFlag()
142
{
143
    lflags=-Wl
144
    for flag
145
    do
146
	safe_flag=`shellEscape "$flag"`
147
	lflags=$lflags,$safe_flag
148
    done
149
    compilerSupportsFlag "$lflags" >/dev/null 2>&1
150
}
151
152
#-------------------------------------------------------------------------------
153
# operating system detection
154
#-------------------------------------------------------------------------------
155
156
# need that throughout the script
157
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
158
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
159
UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
160
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
161
162
163
#-------------------------------------------------------------------------------
164
# window system detection
165
#-------------------------------------------------------------------------------
166
167
PLATFORM_X11=no
168
PLATFORM_MAC=no
169
PLATFORM_QWS=no
170
171
if [ -f "$relpath"/src/gui/kernel/qapplication_mac.mm ] && [ -d /System/Library/Frameworks/Carbon.framework ]; then
172
    # Qt/Mac
173
    # ~ the Carbon SDK exists
174
    # ~ src/gui/base/qapplication_mac.cpp is present
175
    # ~ this is the internal edition and Qt/Mac sources exist
176
    PLATFORM_MAC=maybe
177
elif [ -f "$relpath"/src/gui/kernel/qapplication_qws.cpp ]; then
178
    # Qt Embedded
179
    # ~ src/gui/base/qapplication_qws.cpp is present
180
    # ~ this is the free or commercial edition
181
    # ~ this is the internal edition and Qt Embedded is explicitly enabled
182
    if [ -f "$relpath"/src/gui/kernel/qapplication_mac.mm ]; then
183
        # This is a depot build, or an all-platforms package
184
        PLATFORM_QWS=maybe
185
    else
186
        # This must be the embedded package, since the Qt/Mac source files are not present
187
	PLATFORM_QWS=yes
188
    fi
189
fi
190
191
#-----------------------------------------------------------------------------
192
# Qt version detection
193
#-----------------------------------------------------------------------------
194
QT_VERSION=`grep '^# *define *QT_VERSION_STR' "$relpath"/src/corelib/global/qglobal.h`
195
QT_MAJOR_VERSION=
196
QT_MINOR_VERSION=0
197
QT_PATCH_VERSION=0
198
if [ -n "$QT_VERSION" ]; then
199
   QT_VERSION=`echo $QT_VERSION | sed 's,^# *define *QT_VERSION_STR *"*\([^ ]*\)"$,\1,'`
200
   MAJOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'`
201
   if [ -n "$MAJOR" ]; then
202
     MINOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'`
203
      PATCH=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'`
204
      QT_MAJOR_VERSION="$MAJOR"
205
      [ -z "$MINOR" ] || QT_MINOR_VERSION="$MINOR"
206
      [ -z "$PATCH" ] || QT_PATCH_VERSION="$PATCH"
207
   fi
208
fi
209
if [ -z "$QT_MAJOR_VERSION" ]; then
210
   echo "Cannot process version from qglobal.h: $QT_VERSION"
211
   echo "Cannot proceed."
212
   exit 1
213
fi
214
215
QT_PACKAGEDATE=`grep '^# *define *QT_PACKAGEDATE_STR' "$relpath"/src/corelib/global/qglobal.h | sed -e 's,^# *define *QT_PACKAGEDATE_STR *"\([^ ]*\)"$,\1,' -e s,-,,g`
216
if [ -z "$QT_PACKAGEDATE" ]; then
217
   echo "Unable to determine package date from qglobal.h: '$QT_PACKAGEDATE'"
218
   echo "Cannot proceed"
219
   exit 1
220
fi
221
222
#-------------------------------------------------------------------------------
223
# check the license
224
#-------------------------------------------------------------------------------
225
COMMERCIAL_USER=ask
226
CFG_DEV=no
227
CFG_NOKIA=no
228
CFG_EMBEDDED=no
229
EditionString=Commercial
230
231
earlyArgParse()
232
{
233
    # parse the arguments, setting things to "yes" or "no"
234
    while [ "$#" -gt 0 ]; do
235
        CURRENT_OPT="$1"
236
        UNKNOWN_ARG=no
237
        case "$1" in
238
        #Autoconf style options
239
        --enable-*)
240
            VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"`
241
            VAL=yes
242
            ;;
243
        --disable-*)
244
            VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"`
245
            VAL=no
246
            ;;
247
        --*=*)
248
            VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"`
249
            VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"`
250
            ;;
251
        --no-*)
252
            VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
253
            VAL=no
254
            ;;
255
        -embedded)
256
            VAR=embedded
257
            # this option may or may not be followed by an argument
258
            if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
259
                VAL=auto
260
            else
261
                shift;
262
                VAL=$1
263
            fi
264
            ;;
265
        -h|help|--help|-help)
266
            if [ "$VAL" = "yes" ]; then
267
                OPT_HELP="$VAL"
268
                COMMERCIAL_USER="no" #doesn't matter we will display the help
269
            else
270
                UNKNOWN_OPT=yes
271
                COMMERCIAL_USER="no" #doesn't matter we will display the help
272
            fi
273
            ;;
274
        --*)
275
            VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
276
            VAL=yes
277
            ;;
278
        -*)
279
            VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
280
            VAL="unknown"
281
            ;;
282
        *)
283
            UNKNOWN_ARG=yes
284
            ;;
285
        esac
286
        if [ "$UNKNOWN_ARG" = "yes" ]; then
287
            shift
288
            continue
289
        fi
290
        shift
291
292
        UNKNOWN_OPT=no
293
        case "$VAR" in
294
        embedded)
295
            CFG_EMBEDDED="$VAL"
296
            if [ "$PLATFORM_QWS" != "no" ]; then
297
                if [ "$PLATFORM_QWS" = "maybe" ]; then
298
                    PLATFORM_X11=no
299
                    PLATFORM_MAC=no
300
                    PLATFORM_QWS=yes
301
                fi
302
            else
303
                echo "No license exists to enable Qt for Embedded Linux. Disabling."
304
                CFG_EMBEDDED=no
305
            fi
306
            ;;
307
        developer-build)
308
            CFG_DEV="yes"
309
            ;;
310
        nokia-developer)
311
            CFG_DEV="yes"
312
            CFG_NOKIA="yes"
313
            COMMERCIAL_USER="no"
314
            ;;
315
        commercial)
316
            COMMERCIAL_USER="yes"
317
            ;;
318
        opensource)
319
            COMMERCIAL_USER="no"
320
            ;;
321
        *)
322
            UNKNOWN_OPT=yes
323
            ;;
324
        esac
325
    done
326
}
327
328
earlyArgParse "$@"
329
330
if [ "$COMMERCIAL_USER" = "ask" ]; then
331
    while true; do
332
        echo "Which edition of Qt do you want to use ?"
333
        echo
334
        echo "Type 'c' if you want to use the Commercial Edition."
335
        echo "Type 'o' if you want to use the Open Source Edition."
336
        echo
337
        read commercial
338
        echo
339
        if [ "$commercial" = "c" ]; then
340
            COMMERCIAL_USER="yes"
341
            break
342
        elif [ "$commercial" = "o" ]; then
343
            COMMERCIAL_USER="no"
344
            break
345
        fi
346
    done
347
fi
348
349
if [ "$CFG_NOKIA" = "yes" ]; then
350
    Licensee="Nokia"
351
    Edition="NokiaInternalBuild"
352
    EditionString="Nokia Internal Build"
353
    QT_EDITION="QT_EDITION_OPENSOURCE"
354
    [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
355
elif [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ]; then
356
    # Commercial preview release
357
    [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
358
    Licensee="Preview"
359
    Edition="Preview"
360
    QT_EDITION="QT_EDITION_DESKTOP"
361
    LicenseType="Technology Preview"
362
elif [ $COMMERCIAL_USER = "yes" ]; then
363
    # one of commercial editions
364
    [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
365
    [ "$PLATFORM_QWS" = "maybe" ] && PLATFORM_QWS=no
366
367
    # read in the license file
368
    if [ -f "$LICENSE_FILE" ]; then
369
        . "$LICENSE_FILE" >/dev/null 2>&1
370
        if [ -z "$LicenseKeyExt" ]; then
371
            echo
372
            echo "You are using an old license file."
373
            echo
374
            echo "Please install the license file supplied by Nokia,"
375
            echo "or install the Qt Open Source Edition if you intend to"
376
            echo "develop free software."
377
            exit 1
378
        fi
379
	if [ -z "$Licensee" ]; then
380
	    echo
381
	    echo "Invalid license key. Please check the license key."
382
	    exit 1
383
	fi
384
    else
385
        if [ -z "$LicenseKeyExt" ]; then
386
            echo
387
            if echo '\c' | grep '\c' >/dev/null; then
388
                echo -n "Please enter your license key: "
389
            else
390
                echo "Please enter your license key: \c"
391
            fi
392
            read LicenseKeyExt
393
            Licensee="Unknown user"
394
        fi
395
    fi
396
397
    # Key verification
398
    echo "$LicenseKeyExt" | grep ".....*-....*-....*-....*-.....*-.....*-...." >/dev/null 2>&1 \
399
        && LicenseValid="yes" \
400
        || LicenseValid="no"
401
    if [ "$LicenseValid" != "yes" ]; then
402
        echo
403
        echo "Invalid license key. Please check the license key."
404
        exit 1
405
    fi
406
    ProductCode=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1`
407
    PlatformCode=`echo $LicenseKeyExt | cut -f 2 -d - | cut -b 1`
408
    LicenseTypeCode=`echo $LicenseKeyExt | cut -f 3 -d -`
409
    LicenseFeatureCode=`echo $LicenseKeyExt | cut -f 4 -d - | cut -b 1`
410
411
    # determine which edition we are licensed to use
412
    case "$LicenseTypeCode" in
413
    F4M)
414
        LicenseType="Commercial"
415
        case $ProductCode in
416
        F)
417
            Edition="Universal"
418
            QT_EDITION="QT_EDITION_UNIVERSAL"
419
            ;;
420
        B)
421
            Edition="FullFramework"
422
            EditionString="Full Framework"
423
            QT_EDITION="QT_EDITION_DESKTOP"
424
            ;;
425
        L)
426
            Edition="GUIFramework"
427
            EditionString="GUI Framework"
428
            QT_EDITION="QT_EDITION_DESKTOPLIGHT"
429
            ;;
430
        esac
431
        ;;
432
    Z4M|R4M|Q4M)
433
        LicenseType="Evaluation"
434
        QMakeVar add DEFINES QT_EVAL
435
        case $ProductCode in
436
         B)
437
            Edition="Evaluation"
438
            QT_EDITION="QT_EDITION_EVALUATION"
439
            ;;
440
        esac
441
        ;;
442
    esac
443
    if [ -z "$LicenseType" -o -z "$Edition" -o -z "$QT_EDITION" ]; then
444
        echo
445
        echo "Invalid license key. Please check the license key."
446
        exit 1
447
    fi
448
449
    # verify that we are licensed to use Qt on this platform
450
    LICENSE_EXTENSION=
451
    if [ "$PlatformCode" = "X" ]; then
452
	# Qt All-OS
453
	LICENSE_EXTENSION="-ALLOS"
454
    elif [ "$PLATFORM_QWS" = "yes" ]; then
455
        case $PlatformCode in
456
        2|4|8|A|B|E|G|J|K|P|Q|S|U|V|W)
457
            # Qt for Embedded Linux
458
            LICENSE_EXTENSION="-EMBEDDED"
459
            ;;
460
        *)
461
            echo
462
            echo "You are not licensed for Qt for Embedded Linux."
463
            echo
464
            echo "Please contact qt-info@nokia.com to upgrade your license"
465
            echo "to include Qt for Embedded Linux, or install the"
466
            echo "Qt Open Source Edition if you intend to develop free software."
467
            exit 1
468
            ;;
469
        esac
470
    elif [ "$PLATFORM_MAC" = "yes" ]; then
471
        case $PlatformCode in
472
        2|4|5|7|9|B|C|E|F|G|L|M|U|W|Y)
473
            # Qt/Mac
474
            LICENSE_EXTENSION="-DESKTOP"
475
            ;;
476
        3|6|8|A|D|H|J|K|P|Q|S|V)
477
            # Embedded no-deploy
478
            LICENSE_EXTENSION="-EMBEDDED"
479
	    ;;
480
        *)
481
            echo
482
            echo "You are not licensed for the Qt/Mac platform."
483
            echo
484
            echo "Please contact qt-info@nokia.com to upgrade your license"
485
            echo "to include the Qt/Mac platform."
486
            exit 1
487
            ;;
488
        esac
489
     else
490
         case $PlatformCode in
491
         2|3|4|5|7|D|E|F|J|M|Q|S|T|V|Z)
492
             # Qt/X11
493
             LICENSE_EXTENSION="-DESKTOP"
494
             ;;
495
         6|8|9|A|B|C|G|H|K|P|U|W)
496
             # Embedded no-deploy
497
             LICENSE_EXTENSION="-EMBEDDED"
498
             ;;
499
         *)
500
             echo
501
             echo "You are not licensed for the Qt/X11 platform."
502
             echo
503
             echo "Please contact qt-info@nokia.com to upgrade your license to"
504
             echo "include the Qt/X11 platform, or install the Qt Open Source Edition"
505
             echo "if you intend to develop free software."
506
             exit 1
507
             ;;
508
        esac
509
    fi
510
511
    if test -r "$relpath/.LICENSE"; then
512
	# Generic, non-final license
513
	LICENSE_EXTENSION=""
514
	line=`sed 'y/a-z/A-Z/;q' "$relpath"/.LICENSE`
515
	case "$line" in
516
	    *BETA*)
517
		Edition=Beta
518
		;;
519
	    *TECHNOLOGY?PREVIEW*)
520
		Edition=Preview
521
		;;
522
	    *EVALUATION*)
523
		Edition=Evaluation
524
		;;
525
	    *)
526
		echo >&2 "Invalid license files; cannot continue"
527
		exit 1
528
		;;
529
	esac
530
	Licensee="$Edition"
531
	EditionString="$Edition"
532
	QT_EDITION="QT_EDITION_DESKTOP"
533
    fi
534
535
    case "$LicenseFeatureCode" in
536
    G|L)
537
        # US
538
        case "$LicenseType" in
539
        Commercial)
540
            cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}-US" "$outpath/LICENSE"
541
            ;;
542
        Evaluation)
543
            cp -f "$relpath/.LICENSE-EVALUATION-US" "$outpath/LICENSE"
544
            ;;
545
        esac
546
        ;;
547
    2|5)
548
        # non-US
549
        case "$LicenseType" in
550
        Commercial)
551
            cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}" "$outpath/LICENSE"
552
            ;;
553
        Evaluation)
554
            cp -f "$relpath/.LICENSE-EVALUATION" "$outpath/LICENSE"
555
            ;;
556
        esac
557
        ;;
558
    *)
559
        echo
560
        echo "Invalid license key. Please check the license key."
561
        exit 1
562
        ;;
563
    esac
564
    if [ '!' -f "$outpath/LICENSE" ]; then
565
        echo "The LICENSE, LICENSE.GPL3 LICENSE.LGPL file shipped with"
566
        echo "this software has disappeared."
567
        echo
568
        echo "Sorry, you are not licensed to use this software."
569
        echo "Try re-installing."
570
        echo
571
        exit 1
572
    fi
573
elif [ $COMMERCIAL_USER = "no" ]; then
574
    # Open Source edition - may only be used under the terms of the GPL or LGPL.
575
    [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
576
    Licensee="Open Source"
577
    Edition="OpenSource"
578
    EditionString="Open Source"
579
    QT_EDITION="QT_EDITION_OPENSOURCE"
580
fi
581
582
#-------------------------------------------------------------------------------
583
# initalize variables
584
#-------------------------------------------------------------------------------
585
586
SYSTEM_VARIABLES="CC CXX CFLAGS CXXFLAGS LDFLAGS"
587
for varname in $SYSTEM_VARIABLES; do
588
    qmakevarname="${varname}"
589
    # use LDFLAGS for autoconf compat, but qmake uses QMAKE_LFLAGS
590
    if [ "${varname}" = "LDFLAGS" ]; then
591
        qmakevarname="LFLAGS"
592
    fi
593
    cmd=`echo \
594
'if [ -n "\$'${varname}'" ]; then
595
    QMakeVar set QMAKE_'${qmakevarname}' "\$'${varname}'"
596
fi'`
597
    eval "$cmd"
598
done
599
# Use CC/CXX to run config.tests
600
mkdir -p "$outpath/config.tests"
601
rm -f "$outpath/config.tests/.qmake.cache"
602
cp "$QMAKE_VARS_FILE" "$outpath/config.tests/.qmake.cache"
603
604
QMakeVar add styles "cde mac motif plastique cleanlooks windows"
605
QMakeVar add decorations "default windows styled"
606
QMakeVar add mouse-drivers "pc"
607
if [ "$UNAME_SYSTEM" = "Linux" ] ; then
608
    QMakeVar add gfx-drivers "linuxfb"
609
    QMakeVar add mouse-drivers "linuxtp"
610
fi
611
QMakeVar add kbd-drivers "tty"
612
613
if [ "$CFG_DEV" = "yes" ]; then
614
    QMakeVar add kbd-drivers "um"
615
fi
616
617
# QTDIR may be set and point to an old or system-wide Qt installation
618
unset QTDIR
619
620
# the minimum version of libdbus-1 that we require:
621
MIN_DBUS_1_VERSION=0.93
622
623
# initalize internal variables
624
CFG_CONFIGURE_EXIT_ON_ERROR=yes
625
CFG_PROFILE=no
626
CFG_EXCEPTIONS=unspecified
627
CFG_SCRIPT=auto # (yes|no|auto)
628
CFG_SCRIPTTOOLS=auto # (yes|no|auto)
629
CFG_XMLPATTERNS=auto # (yes|no|auto)
630
CFG_INCREMENTAL=auto
631
CFG_QCONFIG=full
632
CFG_DEBUG=auto
633
CFG_MYSQL_CONFIG=
634
CFG_DEBUG_RELEASE=no
635
CFG_SHARED=yes
636
CFG_SM=auto
637
CFG_XSHAPE=auto
638
CFG_XSYNC=auto
639
CFG_XINERAMA=runtime
640
CFG_XFIXES=runtime
641
CFG_ZLIB=auto
642
CFG_SQLITE=qt
643
CFG_GIF=auto
644
CFG_TIFF=auto
645
CFG_LIBTIFF=auto
646
CFG_PNG=yes
647
CFG_LIBPNG=auto
648
CFG_JPEG=auto
649
CFG_LIBJPEG=auto
650
CFG_MNG=auto
651
CFG_LIBMNG=auto
652
CFG_XCURSOR=runtime
653
CFG_XRANDR=runtime
654
CFG_XRENDER=auto
655
CFG_MITSHM=auto
656
CFG_OPENGL=auto
657
CFG_OPENVG=no
658
CFG_OPENVG_LC_INCLUDES=no
659
CFG_OPENVG_SHIVA=no
660
CFG_OPENVG_ON_OPENGL=no
661
CFG_EGL=no
662
CFG_EGL_GLES_INCLUDES=no
663
CFG_SSE=auto
664
CFG_FONTCONFIG=auto
665
CFG_QWS_FREETYPE=auto
666
CFG_LIBFREETYPE=auto
667
CFG_SQL_AVAILABLE=
668
QT_DEFAULT_BUILD_PARTS="libs tools examples demos docs translations"
669
CFG_BUILD_PARTS=""
670
CFG_NOBUILD_PARTS=""
671
CFG_RELEASE_QMAKE=no
672
CFG_PHONON=auto
673
CFG_PHONON_BACKEND=yes
674
CFG_MULTIMEDIA=yes
675
CFG_SVG=yes
676
CFG_DECLARATIVE=auto
677
CFG_WEBKIT=auto # (yes|no|auto)
678
CFG_JAVASCRIPTCORE_JIT=auto
679
680
CFG_GFX_AVAILABLE="linuxfb transformed qvfb vnc multiscreen directfb"
681
CFG_GFX_ON="linuxfb multiscreen"
682
CFG_GFX_PLUGIN_AVAILABLE=
683
CFG_GFX_PLUGIN=
684
CFG_GFX_OFF=
685
CFG_KBD_AVAILABLE="tty linuxinput qvfb"
686
CFG_KBD_ON="tty"    #default, see QMakeVar above
687
CFG_MOUSE_AVAILABLE="pc linuxtp linuxinput tslib qvfb"
688
CFG_MOUSE_ON="pc linuxtp"   #default, see QMakeVar above
689
690
if [ -f "$relpath/src/gui/embedded/qscreenqnx_qws.cpp" ]; then
691
    CFG_KBD_AVAILABLE="${CFG_KBD_AVAILABLE} qnx"
692
    CFG_MOUSE_AVAILABLE="${CFG_MOUSE_AVAILABLE} qnx"
693
    CFG_GFX_AVAILABLE="${CFG_GFX_AVAILABLE} qnx"
694
fi
695
696
CFG_ARCH=
697
CFG_HOST_ARCH=
698
CFG_KBD_PLUGIN_AVAILABLE=
699
CFG_KBD_PLUGIN=
700
CFG_KBD_OFF=
701
CFG_MOUSE_PLUGIN_AVAILABLE=
702
CFG_MOUSE_PLUGIN=
703
CFG_MOUSE_OFF=
704
CFG_USE_GNUMAKE=no
705
CFG_IM=yes
706
CFG_DECORATION_AVAILABLE="styled windows default"
707
CFG_DECORATION_ON="${CFG_DECORATION_AVAILABLE}" # all on by default
708
CFG_DECORATION_PLUGIN_AVAILABLE=
709
CFG_DECORATION_PLUGIN=
710
CFG_XINPUT=runtime
711
CFG_XKB=auto
712
CFG_NIS=auto
713
CFG_CUPS=auto
714
CFG_ICONV=auto
715
CFG_DBUS=auto
716
CFG_GLIB=auto
717
CFG_GSTREAMER=auto
718
CFG_QGTKSTYLE=auto
719
CFG_LARGEFILE=auto
720
CFG_OPENSSL=auto
721
CFG_PTMALLOC=no
722
CFG_STL=auto
723
CFG_PRECOMPILE=auto
724
CFG_SEPARATE_DEBUG_INFO=auto
725
CFG_REDUCE_EXPORTS=auto
726
CFG_MMX=auto
727
CFG_3DNOW=auto
728
CFG_SSE=auto
729
CFG_SSE2=auto
730
CFG_REDUCE_RELOCATIONS=no
731
CFG_IPV6=auto
732
CFG_NAS=no
733
CFG_QWS_DEPTHS=all
734
CFG_USER_BUILD_KEY=
735
CFG_ACCESSIBILITY=auto
736
CFG_QT3SUPPORT=yes
737
CFG_ENDIAN=auto
738
CFG_HOST_ENDIAN=auto
739
CFG_DOUBLEFORMAT=auto
740
CFG_ARMFPA=auto
741
CFG_IWMMXT=no
742
CFG_CLOCK_GETTIME=auto
743
CFG_CLOCK_MONOTONIC=auto
744
CFG_MREMAP=auto
745
CFG_GETADDRINFO=auto
746
CFG_IPV6IFNAME=auto
747
CFG_GETIFADDRS=auto
748
CFG_INOTIFY=auto
749
CFG_RPATH=yes
750
CFG_FRAMEWORK=auto
751
CFG_MAC_ARCHS=
752
MAC_CONFIG_TEST_COMMANDLINE=  # used to make the configure tests run with the correct arch's and SDK settings
753
CFG_MAC_DWARF2=auto
754
CFG_MAC_XARCH=auto
755
CFG_MAC_CARBON=yes
756
CFG_MAC_COCOA=auto
757
COMMANDLINE_MAC_COCOA=no
758
CFG_SXE=no
759
CFG_PREFIX_INSTALL=yes
760
CFG_SDK=
761
D_FLAGS=
762
I_FLAGS=
763
L_FLAGS=
764
RPATH_FLAGS=
765
l_FLAGS=
766
QCONFIG_FLAGS=
767
XPLATFORM=              # This seems to be the QMAKESPEC, like "linux-g++"
768
PLATFORM=$QMAKESPEC
769
QT_CROSS_COMPILE=no
770
OPT_CONFIRM_LICENSE=no
771
OPT_SHADOW=maybe
772
OPT_FAST=auto
773
OPT_VERBOSE=no
774
OPT_HELP=
775
CFG_SILENT=no
776
CFG_GRAPHICS_SYSTEM=default
777
CFG_ALSA=auto
778
779
# initalize variables used for installation
780
QT_INSTALL_PREFIX=
781
QT_INSTALL_DOCS=
782
QT_INSTALL_HEADERS=
783
QT_INSTALL_LIBS=
784
QT_INSTALL_BINS=
785
QT_INSTALL_PLUGINS=
786
QT_INSTALL_DATA=
787
QT_INSTALL_TRANSLATIONS=
788
QT_INSTALL_SETTINGS=
789
QT_INSTALL_EXAMPLES=
790
QT_INSTALL_DEMOS=
791
QT_HOST_PREFIX=
792
793
#flags for SQL drivers
794
QT_CFLAGS_PSQL=
795
QT_LFLAGS_PSQL=
796
QT_CFLAGS_MYSQL=
797
QT_LFLAGS_MYSQL=
798
QT_LFLAGS_MYSQL_R=
799
QT_CFLAGS_SQLITE=
800
QT_LFLAGS_SQLITE=
801
QT_LFLAGS_ODBC="-lodbc"
802
803
# flags for libdbus-1
804
QT_CFLAGS_DBUS=
805
QT_LIBS_DBUS=
806
807
# flags for Glib (X11 only)
808
QT_CFLAGS_GLIB=
809
QT_LIBS_GLIB=
810
811
# flags for GStreamer (X11 only)
812
QT_CFLAGS_GSTREAMER=
813
QT_LIBS_GSTREAMER=
814
815
#-------------------------------------------------------------------------------
816
# check SQL drivers, mouse drivers and decorations available in this package
817
#-------------------------------------------------------------------------------
818
819
# opensource version removes some drivers, so force them to be off
820
CFG_SQL_tds=no
821
CFG_SQL_oci=no
822
CFG_SQL_db2=no
823
824
CFG_SQL_AVAILABLE=
825
if [ -d "$relpath/src/plugins/sqldrivers" ]; then
826
  for a in "$relpath/src/plugins/sqldrivers/"*; do
827
     if [ -d "$a" ]; then
828
	 base_a=`basename "$a"`
829
  	 CFG_SQL_AVAILABLE="${CFG_SQL_AVAILABLE} ${base_a}"
830
	 eval "CFG_SQL_${base_a}=auto"
831
     fi
832
  done
833
fi
834
835
CFG_DECORATION_PLUGIN_AVAILABLE=
836
if [ -d "$relpath/src/plugins/decorations" ]; then
837
  for a in "$relpath/src/plugins/decorations/"*; do
838
     if [ -d "$a" ]; then
839
	 base_a=`basename "$a"`
840
  	 CFG_DECORATION_PLUGIN_AVAILABLE="${CFG_DECORATION_PLUGIN_AVAILABLE} ${base_a}"
841
     fi
842
  done
843
fi
844
845
CFG_KBD_PLUGIN_AVAILABLE=
846
if [ -d "$relpath/src/plugins/kbddrivers" ]; then
847
  for a in "$relpath/src/plugins/kbddrivers/"*; do
848
     if [ -d "$a" ]; then
849
	 base_a=`basename "$a"`
850
  	 CFG_KBD_PLUGIN_AVAILABLE="${CFG_KBD_PLUGIN_AVAILABLE} ${base_a}"
851
     fi
852
  done
853
fi
854
855
CFG_MOUSE_PLUGIN_AVAILABLE=
856
if [ -d "$relpath/src/plugins/mousedrivers" ]; then
857
  for a in "$relpath/src/plugins/mousedrivers/"*; do
858
     if [ -d "$a" ]; then
859
	 base_a=`basename "$a"`
860
  	 CFG_MOUSE_PLUGIN_AVAILABLE="${CFG_MOUSE_PLUGIN_AVAILABLE} ${base_a}"
861
     fi
862
  done
863
fi
864
865
CFG_GFX_PLUGIN_AVAILABLE=
866
if [ -d "$relpath/src/plugins/gfxdrivers" ]; then
867
  for a in "$relpath/src/plugins/gfxdrivers/"*; do
868
     if [ -d "$a" ]; then
869
	 base_a=`basename "$a"`
870
  	 CFG_GFX_PLUGIN_AVAILABLE="${CFG_GFX_PLUGIN_AVAILABLE} ${base_a}"
871
     fi
872
  done
873
  CFG_GFX_OFF="$CFG_GFX_AVAILABLE" # assume all off
874
fi
875
876
#-------------------------------------------------------------------------------
877
# parse command line arguments
878
#-------------------------------------------------------------------------------
879
880
# parse the arguments, setting things to "yes" or "no"
881
while [ "$#" -gt 0 ]; do
882
    CURRENT_OPT="$1"
883
    UNKNOWN_ARG=no
884
    case "$1" in
885
    #Autoconf style options
886
    --enable-*)
887
        VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"`
888
        VAL=yes
889
        ;;
890
    --disable-*)
891
        VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"`
892
        VAL=no
893
        ;;
894
    --*=*)
895
        VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"`
896
        VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"`
897
        ;;
898
    --no-*)
899
        VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
900
        VAL=no
901
        ;;
902
    --*)
903
        VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
904
        VAL=yes
905
        ;;
906
    #Qt plugin options
907
    -no-*-*|-plugin-*-*|-qt-*-*)
908
        VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
909
        VAL=`echo $1 | sed "s,^-\([^-]*\).*,\1,"`
910
        ;;
911
    #Qt style no options
912
    -no-*)
913
        VAR=`echo $1 | sed "s,^-no-\(.*\),\1,"`
914
        VAL=no
915
        ;;
916
    #Qt style yes options
917
        -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-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|-multimedia|-svg|-declarative|-webkit|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config)
918
        VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
919
        VAL=yes
920
        ;;
921
    #Qt style options that pass an argument
922
    -qconfig)
923
        if [ "$PLATFORM_QWS" != "yes" ]; then
924
            echo
925
            echo "WARNING: -qconfig is only tested and supported on Qt for Embedded Linux."
926
            echo
927
        fi
928
        CFG_QCONFIG="$VAL"
929
        VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
930
        shift
931
        VAL=$1
932
        ;;
933
    -prefix|-docdir|-headerdir|-plugindir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-demosdir|-depths|-make|-nomake|-platform|-xplatform|-buildkey|-sdk|-arch|-host-arch|-mysql_config)
934
        VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
935
        shift
936
        VAL="$1"
937
        ;;
938
    #Qt style complex options in one command
939
    -enable-*|-disable-*)
940
        VAR=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
941
        VAL=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
942
        ;;
943
    #Qt Builtin/System style options
944
    -no-*|-system-*|-qt-*)
945
        VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
946
        VAL=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
947
        ;;
948
    #Options that cannot be generalized
949
    -k|-continue)
950
        VAR=fatal_error
951
        VAL=no
952
        ;;
953
    -embedded)
954
        VAR=embedded
955
        # this option may or may not be followed by an argument
956
        if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
957
            VAL=auto
958
        else
959
            shift;
960
            VAL=$1
961
        fi
962
	;;
963
    -opengl)
964
        VAR=opengl
965
        # this option may or may not be followed by an argument
966
        if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
967
            VAL=yes
968
        else
969
            shift;
970
            VAL=$1
971
        fi
972
	;;
973
    -openvg)
974
        VAR=openvg
975
        # this option may or may not be followed by an argument
976
        if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
977
            VAL=yes
978
        else
979
            shift;
980
            VAL=$1
981
        fi
982
	;;
983
    -hostprefix)
984
        VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
985
        # this option may or may not be followed by an argument
986
        if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
987
            VAL=$outpath
988
        else
989
            shift;
990
            VAL=$1
991
        fi
992
        ;;
993
    -host-*-endian)
994
        VAR=host_endian
995
        VAL=`echo $1 | sed "s,^-.*-\(.*\)-.*,\1,"`
996
        ;;
997
    -*-endian)
998
        VAR=endian
999
        VAL=`echo $1 | sed "s,^-\(.*\)-.*,\1,"`
1000
        ;;
1001
    -qtnamespace)
1002
        VAR="qtnamespace"
1003
        shift
1004
        VAL="$1"
1005
        ;;
1006
    -graphicssystem)
1007
	VAR="graphicssystem"
1008
	shift
1009
	VAL=$1
1010
	;;
1011
    -qtlibinfix)
1012
        VAR="qtlibinfix"
1013
        shift
1014
        VAL="$1"
1015
        ;;
1016
    -D?*|-D)
1017
        VAR="add_define"
1018
        if [ "$1" = "-D" ]; then
1019
            shift
1020
            VAL="$1"
1021
        else
1022
            VAL=`echo $1 | sed 's,-D,,'`
1023
        fi
1024
        ;;
1025
    -I?*|-I)
1026
        VAR="add_ipath"
1027
        if [ "$1" = "-I" ]; then
1028
            shift
1029
            VAL="$1"
1030
        else
1031
            VAL=`echo $1 | sed 's,-I,,'`
1032
        fi
1033
        ;;
1034
    -L?*|-L)
1035
        VAR="add_lpath"
1036
        if [ "$1" = "-L" ]; then
1037
            shift
1038
            VAL="$1"
1039
        else
1040
            VAL=`echo $1 | sed 's,-L,,'`
1041
        fi
1042
        ;;
1043
    -R?*|-R)
1044
        VAR="add_rpath"
1045
        if [ "$1" = "-R" ]; then
1046
            shift
1047
            VAL="$1"
1048
        else
1049
            VAL=`echo $1 | sed 's,-R,,'`
1050
        fi
1051
        ;;
1052
    -l?*)
1053
        VAR="add_link"
1054
        VAL=`echo $1 | sed 's,-l,,'`
1055
        ;;
1056
    -F?*|-F)
1057
        VAR="add_fpath"
1058
        if [ "$1" = "-F" ]; then
1059
            shift
1060
            VAL="$1"
1061
        else
1062
            VAL=`echo $1 | sed 's,-F,,'`
1063
        fi
1064
        ;;
1065
    -fw?*|-fw)
1066
        VAR="add_framework"
1067
        if [ "$1" = "-fw" ]; then
1068
            shift
1069
            VAL="$1"
1070
        else
1071
            VAL=`echo $1 | sed 's,-fw,,'`
1072
        fi
1073
        ;;
1074
    -*)
1075
        VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
1076
        VAL="unknown"
1077
        ;;
1078
    *)
1079
        UNKNOWN_ARG=yes
1080
        ;;
1081
    esac
1082
    if [ "$UNKNOWN_ARG" = "yes" ]; then
1083
        echo "$1: unknown argument"
1084
        OPT_HELP=yes
1085
        ERROR=yes
1086
        shift
1087
        continue
1088
     fi
1089
    shift
1090
1091
    UNKNOWN_OPT=no
1092
    case "$VAR" in
1093
    qt3support)
1094
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1095
            CFG_QT3SUPPORT="$VAL"
1096
        else
1097
            UNKNOWN_OPT=yes
1098
        fi
1099
        ;;
1100
    accessibility)
1101
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1102
            CFG_ACCESSIBILITY="$VAL"
1103
        else
1104
            UNKNOWN_OPT=yes
1105
        fi
1106
        ;;
1107
    license)
1108
	LICENSE_FILE="$VAL"
1109
	;;
1110
    gnumake)
1111
        CFG_USE_GNUMAKE="$VAL"
1112
        ;;
1113
    mysql_config)
1114
	CFG_MYSQL_CONFIG="$VAL"
1115
	;;
1116
    prefix)
1117
        QT_INSTALL_PREFIX="$VAL"
1118
        ;;
1119
    hostprefix)
1120
	QT_HOST_PREFIX="$VAL"
1121
	;;
1122
    force-pkg-config)
1123
        QT_FORCE_PKGCONFIG=yes
1124
        ;;
1125
    docdir)
1126
        QT_INSTALL_DOCS="$VAL"
1127
        ;;
1128
    headerdir)
1129
        QT_INSTALL_HEADERS="$VAL"
1130
        ;;
1131
    plugindir)
1132
        QT_INSTALL_PLUGINS="$VAL"
1133
        ;;
1134
    datadir)
1135
        QT_INSTALL_DATA="$VAL"
1136
        ;;
1137
    libdir)
1138
        QT_INSTALL_LIBS="$VAL"
1139
        ;;
1140
    qtnamespace)
1141
        QT_NAMESPACE="$VAL"
1142
        ;;
1143
    qtlibinfix)
1144
        QT_LIBINFIX="$VAL"
1145
        ;;
1146
    translationdir)
1147
        QT_INSTALL_TRANSLATIONS="$VAL"
1148
        ;;
1149
    sysconfdir|settingsdir)
1150
        QT_INSTALL_SETTINGS="$VAL"
1151
        ;;
1152
    examplesdir)
1153
        QT_INSTALL_EXAMPLES="$VAL"
1154
        ;;
1155
    demosdir)
1156
        QT_INSTALL_DEMOS="$VAL"
1157
        ;;
1158
    qconfig)
1159
        CFG_QCONFIG="$VAL"
1160
        ;;
1161
    bindir)
1162
        QT_INSTALL_BINS="$VAL"
1163
        ;;
1164
    buildkey)
1165
        CFG_USER_BUILD_KEY="$VAL"
1166
        ;;
1167
    sxe)
1168
	CFG_SXE="$VAL"
1169
        ;;
1170
    embedded)
1171
        CFG_EMBEDDED="$VAL"
1172
        if [ "$PLATFORM_QWS" != "no" ]; then
1173
            if [ "$PLATFORM_QWS" = "maybe" ]; then
1174
                PLATFORM_X11=no
1175
                PLATFORM_MAC=no
1176
                PLATFORM_QWS=yes
1177
            fi
1178
        else
1179
            echo "No license exists to enable Qt for Embedded Linux. Disabling."
1180
            CFG_EMBEDDED=no
1181
        fi
1182
        ;;
1183
    sse)
1184
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1185
            CFG_SSE="$VAL"
1186
        else
1187
            UNKNOWN_OPT=yes
1188
        fi
1189
	;;
1190
    endian)
1191
        if [ "$VAL" = "little" ]; then
1192
            CFG_ENDIAN="Q_LITTLE_ENDIAN"
1193
        elif [ "$VAL" = "big" ]; then
1194
            CFG_ENDIAN="Q_BIG_ENDIAN"
1195
        else
1196
            UNKNOWN_OPT=yes
1197
        fi
1198
        ;;
1199
    host_endian)
1200
        if [ "$VAL" = "little" ]; then
1201
            CFG_HOST_ENDIAN="Q_LITTLE_ENDIAN"
1202
        elif [ "$VAL" = "big" ]; then
1203
            CFG_HOST_ENDIAN="Q_BIG_ENDIAN"
1204
        else
1205
            UNKNOWN_OPT=yes
1206
        fi
1207
        ;;
1208
    armfpa)
1209
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1210
            CFG_ARMFPA="$VAL"
1211
        else
1212
            UNKNOWN_OPT=yes
1213
        fi
1214
        ;;
1215
    depths)
1216
        CFG_QWS_DEPTHS="$VAL"
1217
        ;;
1218
    opengl)
1219
        if  [ "$VAL" = "auto" ] || [ "$VAL" = "desktop" ] ||
1220
            [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] ||
1221
            [ "$VAL" = "es1cl" ] || [ "$VAL" = "es1" ] || [ "$VAL" = "es2" ]; then
1222
            CFG_OPENGL="$VAL"
1223
        else
1224
            UNKNOWN_OPT=yes
1225
        fi
1226
        ;;
1227
    openvg)
1228
        if [ "$VAL" = "auto" ] || [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1229
            CFG_OPENVG="$VAL"
1230
        else
1231
            UNKNOWN_OPT=yes
1232
        fi
1233
        ;;
1234
    graphicssystem)
1235
        if [ "$PLATFORM_QWS" = "yes" ]; then
1236
            echo "Error: Graphics System plugins are not supported on QWS."
1237
            echo "   On QWS, the graphics system API is part of the QScreen plugin architecture "
1238
            echo "   rather than existing as a separate plugin."
1239
            echo ""
1240
            UNKNOWN_OPT=yes
1241
        else
1242
            if  [ "$VAL" = "opengl" ]; then
1243
                CFG_GRAPHICS_SYSTEM="opengl"
1244
            elif [ "$VAL" = "openvg" ]; then
1245
                CFG_GRAPHICS_SYSTEM="openvg"
1246
            elif [ "$VAL" = "raster" ]; then
1247
                CFG_GRAPHICS_SYSTEM="raster"
1248
            else
1249
                UNKNOWN_OPT=yes
1250
            fi
1251
        fi
1252
	;;
1253
1254
    qvfb) # left for commandline compatibility, not documented
1255
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1256
            if [ "$VAL" = "yes" ]; then
1257
		QMakeVar add gfx-drivers qvfb
1258
		QMakeVar add kbd-drivers qvfb
1259
		QMakeVar add mouse-drivers qvfb
1260
                CFG_GFX_ON="$CFG_GFX_ON qvfb"
1261
                CFG_KBD_ON="$CFG_KBD_ON qvfb"
1262
                CFG_MOUSE_ON="$CFG_MOUSE_ON qvfb"
1263
            fi
1264
        else
1265
            UNKNOWN_OPT=yes
1266
        fi
1267
        ;;
1268
    nomake)
1269
	CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS $VAL"
1270
        ;;
1271
    make)
1272
	CFG_BUILD_PARTS="$CFG_BUILD_PARTS $VAL"
1273
        ;;
1274
    x11)
1275
        if [ "$PLATFORM_MAC" = "yes" ]; then
1276
            PLATFORM_MAC=no
1277
        elif [ "$PLATFORM_QWS" = "yes" ]; then
1278
            PLATFORM_QWS=no
1279
        fi
1280
        if [ "$CFG_FRAMEWORK" = "auto" ]; then
1281
            CFG_FRAMEWORK=no
1282
        fi
1283
        PLATFORM_X11=yes
1284
        ;;
1285
    sdk)
1286
        if [ "$PLATFORM_MAC" = "yes" ]; then
1287
            CFG_SDK="$VAL"
1288
        else
1289
            UNKNOWN_OPT=yes
1290
        fi
1291
	;;
1292
     dwarf2)
1293
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1294
            CFG_MAC_DWARF2="$VAL"
1295
        else
1296
            UNKNOWN_OPT=yes
1297
        fi
1298
	;;
1299
    arch)
1300
        if [ "$PLATFORM_MAC" = "yes" ]; then
1301
            CFG_MAC_ARCHS="$CFG_MAC_ARCHS $VAL"
1302
        else
1303
            CFG_ARCH=$VAL
1304
        fi
1305
        ;;
1306
    host-arch)
1307
        CFG_HOST_ARCH=$VAL
1308
        ;;
1309
    universal)
1310
        if [ "$PLATFORM_MAC" = "yes" ] && [ "$VAL" = "yes" ]; then
1311
            CFG_MAC_ARCHS="$CFG_MAC_ARCHS x86 ppc"
1312
        else
1313
            UNKNOWN_OPT=yes
1314
        fi
1315
        ;;
1316
    cocoa)
1317
        if [ "$PLATFORM_MAC" = "yes" ] && [ "$VAL" = "yes" ]; then
1318
            CFG_MAC_COCOA="$VAL"
1319
            COMMANDLINE_MAC_COCOA="$VAL"
1320
        else
1321
            UNKNOWN_OPT=yes
1322
        fi
1323
        ;;
1324
    framework)
1325
        if [ "$PLATFORM_MAC" = "yes" ]; then
1326
            CFG_FRAMEWORK="$VAL"
1327
        else
1328
            UNKNOWN_OPT=yes
1329
        fi
1330
        ;;
1331
    profile)
1332
        if [ "$VAL" = "yes" ]; then
1333
            CFG_PROFILE=yes
1334
	    QMakeVar add QMAKE_CFLAGS -pg
1335
	    QMakeVar add QMAKE_CXXFLAGS -pg
1336
	    QMakeVar add QMAKE_LFLAGS -pg
1337
            QMAKE_VARS="$QMAKE_VARS CONFIG+=nostrip"
1338
        else
1339
            UNKNOWN_OPT=yes
1340
        fi
1341
        ;;
1342
    exceptions|g++-exceptions)
1343
        if [ "$VAL" = "no" ]; then
1344
            CFG_EXCEPTIONS=no
1345
        elif [ "$VAL" = "yes" ]; then
1346
            CFG_EXCEPTIONS=yes
1347
        else
1348
            UNKNOWN_OPT=yes
1349
        fi
1350
        ;;
1351
    platform)
1352
        PLATFORM="$VAL"
1353
        # keep compatibility with old platform names
1354
        case $PLATFORM in
1355
        aix-64)
1356
            PLATFORM=aix-xlc-64
1357
            ;;
1358
        hpux-o64)
1359
            PLATFORM=hpux-acc-o64
1360
            ;;
1361
        hpux-n64)
1362
            PLATFORM=hpux-acc-64
1363
            ;;
1364
        hpux-acc-n64)
1365
            PLATFORM=hpux-acc-64
1366
            ;;
1367
        irix-n32)
1368
            PLATFORM=irix-cc
1369
            ;;
1370
        irix-64)
1371
            PLATFORM=irix-cc-64
1372
            ;;
1373
        irix-cc-n64)
1374
            PLATFORM=irix-cc-64
1375
            ;;
1376
        reliant-64)
1377
            PLATFORM=reliant-cds-64
1378
            ;;
1379
        solaris-64)
1380
            PLATFORM=solaris-cc-64
1381
            ;;
1382
        solaris-64)
1383
            PLATFORM=solaris-cc-64
1384
            ;;
1385
        openunix-cc)
1386
            PLATFORM=unixware-cc
1387
            ;;
1388
        openunix-g++)
1389
            PLATFORM=unixware-g++
1390
            ;;
1391
        unixware7-cc)
1392
            PLATFORM=unixware-cc
1393
            ;;
1394
        unixware7-g++)
1395
            PLATFORM=unixware-g++
1396
            ;;
1397
        macx-g++-64)
1398
            PLATFORM=macx-g++
1399
	    NATIVE_64_ARCH=
1400
            case `uname -p` in
1401
            i386) NATIVE_64_ARCH="x86_64" ;;
1402
            powerpc) NATIVE_64_ARCH="ppc64" ;;
1403
            *)   echo "WARNING: Can't detect CPU architecture for macx-g++-64" ;;
1404
            esac
1405
	    if [ ! -z "$NATIVE_64_ARCH" ]; then
1406
		QTCONFIG_CONFIG="$QTCONFIG_CONFIG $NATIVE_64_ARCH"
1407
		CFG_MAC_ARCHS="$CFG_MAC_ARCHS $NATIVE_64_ARCH"
1408
            fi
1409
            ;;
1410
        esac
1411
        ;;
1412
    xplatform)
1413
        XPLATFORM="$VAL"
1414
        ;;
1415
    debug-and-release)
1416
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1417
            CFG_DEBUG_RELEASE="$VAL"
1418
        else
1419
            UNKNOWN_OPT=yes
1420
        fi
1421
        ;;
1422
    optimized-qmake)
1423
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1424
            CFG_RELEASE_QMAKE="$VAL"
1425
        else
1426
            UNKNOWN_OPT=yes
1427
        fi
1428
        ;;
1429
    release)
1430
        if [ "$VAL" = "yes" ]; then
1431
            CFG_DEBUG=no
1432
        elif [ "$VAL" = "no" ]; then
1433
            CFG_DEBUG=yes
1434
        else
1435
            UNKNOWN_OPT=yes
1436
        fi
1437
        ;;
1438
    prefix-install)
1439
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1440
	    CFG_PREFIX_INSTALL="$VAL"
1441
        else
1442
            UNKNOWN_OPT=yes
1443
        fi
1444
	;;
1445
    debug)
1446
        CFG_DEBUG="$VAL"
1447
        ;;
1448
    developer-build|commercial|opensource|nokia-developer)
1449
        # These switches have been dealt with already
1450
        ;;
1451
    static)
1452
        if [ "$VAL" = "yes" ]; then
1453
            CFG_SHARED=no
1454
        elif [ "$VAL" = "no" ]; then
1455
            CFG_SHARED=yes
1456
        else
1457
            UNKNOWN_OPT=yes
1458
        fi
1459
        ;;
1460
    incremental)
1461
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1462
            CFG_INCREMENTAL="$VAL"
1463
        else
1464
            UNKNOWN_OPT=yes
1465
        fi
1466
        ;;
1467
    fatal_error)
1468
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1469
            CFG_CONFIGURE_EXIT_ON_ERROR="$VAL"
1470
        else
1471
            UNKNOWN_OPT=yes
1472
        fi
1473
        ;;
1474
    feature-*)
1475
        if [ "$PLATFORM_QWS" = "yes" ]; then
1476
            FEATURE=`echo $VAR | sed "s,^[^-]*-\([^-]*\),\1," | tr 'abcdefghijklmnopqrstuvwxyz-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
1477
            if [ "$VAL" = "no" ]; then
1478
                QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_$FEATURE"
1479
            elif [ "$VAL" = "yes" ] || [ "$VAL" = "unknown" ]; then
1480
                QCONFIG_FLAGS="$QCONFIG_FLAGS QT_$FEATURE"
1481
            else
1482
                UNKNOWN_OPT=yes
1483
            fi
1484
        else
1485
            UNKNOWN_OPT=yes
1486
        fi
1487
        ;;
1488
    shared)
1489
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1490
            CFG_SHARED="$VAL"
1491
        else
1492
            UNKNOWN_OPT=yes
1493
        fi
1494
        ;;
1495
    gif)
1496
        [ "$VAL" = "qt" ] && VAL=yes
1497
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1498
            CFG_GIF="$VAL"
1499
        else
1500
            UNKNOWN_OPT=yes
1501
        fi
1502
        ;;
1503
    sm)
1504
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1505
            CFG_SM="$VAL"
1506
        else
1507
            UNKNOWN_OPT=yes
1508
        fi
1509
1510
        ;;
1511
    xinerama)
1512
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1513
            CFG_XINERAMA="$VAL"
1514
        else
1515
            UNKNOWN_OPT=yes
1516
        fi
1517
        ;;
1518
    xshape)
1519
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1520
            CFG_XSHAPE="$VAL"
1521
        else
1522
            UNKNOWN_OPT=yes
1523
        fi
1524
        ;;
1525
    xsync)
1526
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1527
            CFG_XSYNC="$VAL"
1528
        else
1529
            UNKNOWN_OPT=yes
1530
        fi
1531
        ;;
1532
    xinput)
1533
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1534
            CFG_XINPUT="$VAL"
1535
        else
1536
            UNKNOWN_OPT=yes
1537
        fi
1538
        ;;
1539
    stl)
1540
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1541
            CFG_STL="$VAL"
1542
        else
1543
            UNKNOWN_OPT=yes
1544
        fi
1545
        ;;
1546
    pch)
1547
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1548
            CFG_PRECOMPILE="$VAL"
1549
        else
1550
            UNKNOWN_OPT=yes
1551
        fi
1552
        ;;
1553
    separate-debug-info)
1554
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1555
            CFG_SEPARATE_DEBUG_INFO="$VAL"
1556
        else
1557
            UNKNOWN_OPT=yes
1558
        fi
1559
        ;;
1560
    reduce-exports)
1561
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1562
            CFG_REDUCE_EXPORTS="$VAL"
1563
        else
1564
            UNKNOWN_OPT=yes
1565
        fi
1566
        ;;
1567
    mmx)
1568
        if [ "$VAL" = "no" ]; then
1569
            CFG_MMX="$VAL"
1570
        else
1571
            UNKNOWN_OPT=yes
1572
        fi
1573
        ;;
1574
    3dnow)
1575
        if [ "$VAL" = "no" ]; then
1576
            CFG_3DNOW="$VAL"
1577
        else
1578
            UNKNOWN_OPT=yes
1579
        fi
1580
        ;;
1581
    sse)
1582
        if [ "$VAL" = "no" ]; then
1583
            CFG_SSE="$VAL"
1584
        else
1585
            UNKNOWN_OPT=yes
1586
        fi
1587
        ;;
1588
    sse2)
1589
        if [ "$VAL" = "no" ]; then
1590
            CFG_SSE2="$VAL"
1591
        else
1592
            UNKNOWN_OPT=yes
1593
        fi
1594
        ;;
1595
    iwmmxt)
1596
	CFG_IWMMXT="yes"
1597
	;;
1598
    reduce-relocations)
1599
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1600
            CFG_REDUCE_RELOCATIONS="$VAL"
1601
        else
1602
            UNKNOWN_OPT=yes
1603
        fi
1604
        ;;
1605
    freetype)
1606
        [ "$VAL" = "qt" ] && VAL=yes
1607
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1608
            CFG_QWS_FREETYPE="$VAL"
1609
        else
1610
            UNKNOWN_OPT=yes
1611
        fi
1612
        ;;
1613
    zlib)
1614
        [ "$VAL" = "qt" ] && VAL=yes
1615
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1616
            CFG_ZLIB="$VAL"
1617
        else
1618
            UNKNOWN_OPT=yes
1619
        fi
1620
        # No longer supported:
1621
        #[ "$VAL" = "no" ] && CFG_LIBPNG=no
1622
        ;;
1623
    sqlite)
1624
        if [ "$VAL" = "system" ]; then
1625
            CFG_SQLITE=system
1626
        else
1627
            UNKNOWN_OPT=yes
1628
        fi
1629
        ;;
1630
    libpng)
1631
        [ "$VAL" = "yes" ] && VAL=qt
1632
        if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1633
            CFG_LIBPNG="$VAL"
1634
        else
1635
            UNKNOWN_OPT=yes
1636
        fi
1637
        ;;
1638
    libjpeg)
1639
        [ "$VAL" = "yes" ] && VAL=qt
1640
        if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1641
            CFG_LIBJPEG="$VAL"
1642
        else
1643
            UNKNOWN_OPT=yes
1644
        fi
1645
        ;;
1646
    libmng)
1647
        [ "$VAL" = "yes" ] && VAL=qt
1648
        if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1649
            CFG_LIBMNG="$VAL"
1650
        else
1651
            UNKNOWN_OPT=yes
1652
        fi
1653
        ;;
1654
    libtiff)
1655
        [ "$VAL" = "yes" ] && VAL=qt
1656
        if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
1657
            CFG_LIBTIFF="$VAL"
1658
        else
1659
            UNKNOWN_OPT=yes
1660
        fi
1661
        ;;
1662
    nas-sound)
1663
        if [ "$VAL" = "system" ] || [ "$VAL" = "no" ]; then
1664
            CFG_NAS="$VAL"
1665
        else
1666
            UNKNOWN_OPT=yes
1667
        fi
1668
        ;;
1669
    xcursor)
1670
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1671
            CFG_XCURSOR="$VAL"
1672
        else
1673
            UNKNOWN_OPT=yes
1674
        fi
1675
        ;;
1676
    xfixes)
1677
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1678
            CFG_XFIXES="$VAL"
1679
        else
1680
            UNKNOWN_OPT=yes
1681
        fi
1682
        ;;
1683
    xrandr)
1684
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
1685
            CFG_XRANDR="$VAL"
1686
        else
1687
            UNKNOWN_OPT=yes
1688
        fi
1689
        ;;
1690
    xrender)
1691
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1692
            CFG_XRENDER="$VAL"
1693
        else
1694
            UNKNOWN_OPT=yes
1695
        fi
1696
        ;;
1697
    mitshm)
1698
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1699
            CFG_MITSHM="$VAL"
1700
        else
1701
            UNKNOWN_OPT=yes
1702
        fi
1703
        ;;
1704
    fontconfig)
1705
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1706
            CFG_FONTCONFIG="$VAL"
1707
        else
1708
            UNKNOWN_OPT=yes
1709
        fi
1710
        ;;
1711
    xkb)
1712
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1713
            CFG_XKB="$VAL"
1714
        else
1715
            UNKNOWN_OPT=yes
1716
        fi
1717
        ;;
1718
    cups)
1719
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1720
            CFG_CUPS="$VAL"
1721
        else
1722
            UNKNOWN_OPT=yes
1723
        fi
1724
        ;;
1725
    iconv)
1726
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1727
            CFG_ICONV="$VAL"
1728
        else
1729
            UNKNOWN_OPT=yes
1730
        fi
1731
        ;;
1732
    glib)
1733
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1734
            CFG_GLIB="$VAL"
1735
        else
1736
            UNKNOWN_OPT=yes
1737
        fi
1738
        ;;
1739
    gstreamer)
1740
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1741
            CFG_GSTREAMER="$VAL"
1742
        else
1743
            UNKNOWN_OPT=yes
1744
        fi
1745
        ;;
1746
    gtkstyle)
1747
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1748
            CFG_QGTKSTYLE="$VAL"
1749
        else
1750
            UNKNOWN_OPT=yes
1751
        fi
1752
        ;;
1753
    qdbus|dbus)
1754
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "linked" ]; then
1755
            CFG_DBUS="$VAL"
1756
	elif [ "$VAL" = "runtime" ]; then
1757
	    CFG_DBUS="yes"
1758
        else
1759
            UNKNOWN_OPT=yes
1760
        fi
1761
        ;;
1762
    dbus-linked)
1763
        if [ "$VAL" = "yes" ]; then
1764
	    CFG_DBUS="linked"
1765
	else
1766
            UNKNOWN_OPT=yes
1767
        fi
1768
        ;;
1769
    nis)
1770
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1771
            CFG_NIS="$VAL"
1772
        else
1773
            UNKNOWN_OPT=yes
1774
        fi
1775
        ;;
1776
    largefile)
1777
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1778
            CFG_LARGEFILE="$VAL"
1779
        else
1780
            UNKNOWN_OPT=yes
1781
        fi
1782
        ;;
1783
    openssl)
1784
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
1785
            CFG_OPENSSL="$VAL"
1786
        else
1787
            UNKNOWN_OPT=yes
1788
        fi
1789
        ;;
1790
    openssl-linked)
1791
        if [ "$VAL" = "yes" ]; then
1792
            CFG_OPENSSL="linked"
1793
        else
1794
            UNKNOWN_OPT=yes
1795
        fi
1796
        ;;
1797
    ptmalloc)
1798
        if [ "$VAL" = "yes" ]; then
1799
            CFG_PTMALLOC="yes"
1800
        else
1801
            UNKNOWN_OPT=yes
1802
        fi
1803
        ;;
1804
1805
    xmlpatterns)
1806
        if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1807
            CFG_XMLPATTERNS="yes"
1808
        else
1809
            if [ "$VAL" = "no" ]; then
1810
                CFG_XMLPATTERNS="no"
1811
            else
1812
                UNKNOWN_OPT=yes
1813
            fi
1814
        fi
1815
        ;;
1816
    script)
1817
        if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1818
            CFG_SCRIPT="yes"
1819
        else
1820
            if [ "$VAL" = "no" ]; then
1821
                CFG_SCRIPT="no"
1822
            else
1823
                UNKNOWN_OPT=yes
1824
            fi
1825
        fi
1826
        ;;
1827
    scripttools)
1828
        if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1829
            CFG_SCRIPTTOOLS="yes"
1830
        else
1831
            if [ "$VAL" = "no" ]; then
1832
                CFG_SCRIPTTOOLS="no"
1833
            else
1834
                UNKNOWN_OPT=yes
1835
            fi
1836
        fi
1837
        ;;
1838
    svg)
1839
        if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1840
            CFG_SVG="yes"
1841
        else
1842
            if [ "$VAL" = "no" ]; then
1843
                CFG_SVG="no"
1844
            else
1845
                UNKNOWN_OPT=yes
1846
            fi
1847
        fi
1848
        ;;
1849
    declarative)
1850
        if [ "$VAL" = "yes" ]; then
1851
            CFG_DECLARATIVE="yes"
1852
        else
1853
            if [ "$VAL" = "no" ]; then
1854
                CFG_DECLARATIVE="no"
1855
            else
1856
                UNKNOWN_OPT=yes
1857
            fi
1858
        fi
1859
	;;
1860
    webkit)
1861
        if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
1862
            CFG_WEBKIT="yes"
1863
        else
1864
            if [ "$VAL" = "no" ]; then
1865
                CFG_WEBKIT="no"
1866
            else
1867
                UNKNOWN_OPT=yes
1868
            fi
1869
        fi
1870
        ;;
1871
    javascript-jit)
1872
        if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then 
1873
            CFG_JAVASCRIPTCORE_JIT="$VAL"
1874
        else
1875
            UNKNOWN_OPT=yes
1876
        fi
1877
        ;;
1878
    confirm-license)
1879
        if [ "$VAL" = "yes" ]; then
1880
            OPT_CONFIRM_LICENSE="$VAL"
1881
        else
1882
            UNKNOWN_OPT=yes
1883
        fi
1884
        ;;
1885
    h|help)
1886
        if [ "$VAL" = "yes" ]; then
1887
            OPT_HELP="$VAL"
1888
        else
1889
            UNKNOWN_OPT=yes
1890
        fi
1891
        ;;
1892
    sql-*|gfx-*|decoration-*|kbd-*|mouse-*)
1893
        # if Qt style options were used, $VAL can be "no", "qt", or "plugin"
1894
        # if autoconf style options were used, $VAL can be "yes" or "no"
1895
        [ "$VAL" = "yes" ] && VAL=qt
1896
        # now $VAL should be "no", "qt", or "plugin"... double-check
1897
        if [ "$VAL" != "no" ] && [ "$VAL" != "qt" ] && [ "$VAL" != "plugin" ]; then
1898
            UNKNOWN_OPT=yes
1899
        fi
1900
        # now $VAL is "no", "qt", or "plugin"
1901
        OPT="$VAL"
1902
        VAL=`echo $VAR | sed "s,^[^-]*-\([^-]*\).*,\1,"`
1903
        VAR=`echo $VAR | sed "s,^\([^-]*\).*,\1,"`
1904
1905
        # Grab the available values
1906
        case "$VAR" in
1907
        sql)
1908
            avail="$CFG_SQL_AVAILABLE"
1909
            ;;
1910
        gfx)
1911
            avail="$CFG_GFX_AVAILABLE"
1912
	    if [ "$OPT" = "plugin" ]; then
1913
		avail="$CFG_GFX_PLUGIN_AVAILABLE"
1914
	    fi
1915
            ;;
1916
        decoration)
1917
            avail="$CFG_DECORATION_AVAILABLE"
1918
	    if [ "$OPT" = "plugin" ]; then
1919
		avail="$CFG_DECORATION_PLUGIN_AVAILABLE"
1920
	    fi
1921
            ;;
1922
        kbd)
1923
            avail="$CFG_KBD_AVAILABLE"
1924
	    if [ "$OPT" = "plugin" ]; then
1925
		avail="$CFG_KBD_PLUGIN_AVAILABLE"
1926
	    fi
1927
            ;;
1928
        mouse)
1929
            avail="$CFG_MOUSE_AVAILABLE"
1930
	    if [ "$OPT" = "plugin" ]; then
1931
		avail="$CFG_MOUSE_PLUGIN_AVAILABLE"
1932
	    fi
1933
            ;;
1934
        *)
1935
            avail=""
1936
            echo "BUG: Unhandled type $VAR used in $CURRENT_OPT"
1937
            ;;
1938
        esac
1939
1940
        # Check that that user's value is available.
1941
        found=no
1942
        for d in $avail; do
1943
            if [ "$VAL" = "$d" ]; then
1944
                found=yes
1945
                break
1946
            fi
1947
        done
1948
        [ "$found" = yes ] || ERROR=yes
1949
1950
        if [ "$VAR" = "sql" ]; then
1951
            # set the CFG_SQL_driver
1952
            eval "CFG_SQL_$VAL=\$OPT"
1953
            continue
1954
        fi
1955
1956
        if [ "$OPT" = "plugin" ] || [ "$OPT" = "qt" ]; then
1957
            if [ "$OPT" = "plugin" ]; then
1958
                [ "$VAR" = "decoration" ] && QMakeVar del "${VAR}s" "$VAL"
1959
                [ "$VAR" = "decoration" ] && CFG_DECORATION_ON=`echo "${CFG_DECORATION_ON} " | sed "s,${VAL} ,,g"` && CFG_DECORATION_PLUGIN="$CFG_DECORATION_PLUGIN ${VAL}"
1960
                [ "$VAR" = "kbd" ] && QMakeVar del "${VAR}s" "$VAL"
1961
                [ "$VAR" = "kbd" ] && CFG_KBD_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"` && CFG_KBD_PLUGIN="$CFG_KBD_PLUGIN ${VAL}"
1962
                [ "$VAR" = "mouse" ] && QMakeVar del "${VAR}s" "$VAL"
1963
                [ "$VAR" = "mouse" ] && CFG_MOUSE_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"` && CFG_MOUSE_PLUGIN="$CFG_MOUSE_PLUGIN ${VAL}"
1964
                [ "$VAR" = "gfx" ] && QMakeVar del "${VAR}s" "$VAL"
1965
                [ "$VAR" = "gfx" ] && CFG_GFX_ON=`echo "${CFG_GFX_ON} " | sed "s,${VAL} ,,g"` && CFG_GFX_PLUGIN="${CFG_GFX_PLUGIN} ${VAL}"
1966
                VAR="${VAR}-${OPT}"
1967
            else
1968
                if [ "$VAR" = "gfx" ] || [ "$VAR" = "kbd" ] || [ "$VAR" = "decoration" ] || [ "$VAR" = "mouse" ]; then
1969
                    [ "$VAR" = "gfx" ] && CFG_GFX_ON="$CFG_GFX_ON $VAL"
1970
                    [ "$VAR" = "kbd" ] && CFG_KBD_ON="$CFG_KBD_ON $VAL"
1971
		    [ "$VAR" = "decoration" ] && CFG_DECORATION_ON="$CFG_DECORATION_ON $VAL"
1972
                    [ "$VAR" = "mouse" ] && CFG_MOUSE_ON="$CFG_MOUSE_ON $VAL"
1973
                    VAR="${VAR}-driver"
1974
                fi
1975
            fi
1976
	    QMakeVar add "${VAR}s" "${VAL}"
1977
        elif [ "$OPT" = "no" ]; then
1978
            PLUG_VAR="${VAR}-plugin"
1979
            if [ "$VAR" = "gfx" ] || [ "$VAR" = "kbd" ] || [ "$VAR" = "mouse" ]; then
1980
                IN_VAR="${VAR}-driver"
1981
            else
1982
                IN_VAR="${VAR}"
1983
            fi
1984
            [ "$VAR" = "decoration" ] && CFG_DECORATION_ON=`echo "${CFG_DECORATION_ON} " | sed "s,${VAL} ,,g"`
1985
            [ "$VAR" = "gfx" ] && CFG_GFX_ON=`echo "${CFG_GFX_ON} " | sed "s,${VAL} ,,g"`
1986
            [ "$VAR" = "kbd" ] && CFG_KBD_ON=`echo "${CFG_KBD_ON} " | sed "s,${VAL} ,,g"`
1987
            [ "$VAR" = "mouse" ] && CFG_MOUSE_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"`
1988
	    QMakeVar del "${IN_VAR}s" "$VAL"
1989
	    QMakeVar del "${PLUG_VAR}s" "$VAL"
1990
        fi
1991
        if [ "$ERROR" = "yes" ]; then
1992
           echo "$CURRENT_OPT: unknown argument"
1993
           OPT_HELP=yes
1994
        fi
1995
        ;;
1996
    v|verbose)
1997
        if [ "$VAL" = "yes" ]; then
1998
            if [ "$OPT_VERBOSE" = "$VAL" ]; then            # takes two verboses to turn on qmake debugs
1999
                QMAKE_SWITCHES="$QMAKE_SWITCHES -d"
2000
            else
2001
                OPT_VERBOSE=yes
2002
            fi
2003
        elif [ "$VAL" = "no" ]; then
2004
            if [ "$OPT_VERBOSE" = "$VAL" ] && echo "$QMAKE_SWITCHES" | grep ' -d' >/dev/null 2>&1; then
2005
                QMAKE_SWITCHES=`echo $QMAKE_SWITCHES | sed "s, -d,,"`
2006
            else
2007
                OPT_VERBOSE=no
2008
            fi
2009
        else
2010
            UNKNOWN_OPT=yes
2011
        fi
2012
        ;;
2013
    fast)
2014
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2015
            OPT_FAST="$VAL"
2016
        else
2017
            UNKNOWN_OPT=yes
2018
        fi
2019
        ;;
2020
    rpath)
2021
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2022
            CFG_RPATH="$VAL"
2023
        else
2024
            UNKNOWN_OPT=yes
2025
        fi
2026
        ;;
2027
    add_define)
2028
        D_FLAGS="$D_FLAGS \"$VAL\""
2029
        ;;
2030
    add_ipath)
2031
        I_FLAGS="$I_FLAGS -I\"${VAL}\""
2032
        ;;
2033
    add_lpath)
2034
        L_FLAGS="$L_FLAGS -L\"${VAL}\""
2035
        ;;
2036
    add_rpath)
2037
        RPATH_FLAGS="$RPATH_FLAGS \"${VAL}\""
2038
        ;;
2039
    add_link)
2040
        l_FLAGS="$l_FLAGS -l\"${VAL}\""
2041
        ;;
2042
    add_fpath)
2043
        if [ "$PLATFORM_MAC" = "yes" ]; then
2044
            L_FLAGS="$L_FLAGS -F\"${VAL}\""
2045
            I_FLAGS="$I_FLAGS -F\"${VAL}\""
2046
        else
2047
            UNKNOWN_OPT=yes
2048
        fi
2049
        ;;
2050
    add_framework)
2051
        if [ "$PLATFORM_MAC" = "yes" ]; then
2052
            l_FLAGS="$l_FLAGS -framework \"${VAL}\""
2053
        else
2054
            UNKNOWN_OPT=yes
2055
        fi
2056
        ;;
2057
    silent)
2058
        CFG_SILENT="$VAL"
2059
        ;;
2060
    phonon)
2061
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2062
            CFG_PHONON="$VAL"
2063
        else
2064
            UNKNOWN_OPT=yes
2065
        fi
2066
        ;;
2067
    phonon-backend)
2068
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2069
            CFG_PHONON_BACKEND="$VAL"
2070
        else
2071
            UNKNOWN_OPT=yes
2072
        fi
2073
        ;;
2074
    multimedia)
2075
        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
2076
            CFG_MULTIMEDIA="$VAL"
2077
        else
2078
            UNKNOWN_OPT=yes
2079
        fi
2080
        ;;
2081
    *)
2082
        UNKNOWN_OPT=yes
2083
        ;;
2084
    esac
2085
    if [ "$UNKNOWN_OPT" = "yes" ]; then
2086
        echo "${CURRENT_OPT}: invalid command-line switch"
2087
        OPT_HELP=yes
2088
        ERROR=yes
2089
    fi
2090
done
2091
2092
if [ "$CFG_QCONFIG" != "full" ] && [ "$CFG_QT3SUPPORT" = "yes" ]; then
2093
    echo "Warning: '-qconfig $CFG_QCONFIG' will disable the qt3support library."
2094
    CFG_QT3SUPPORT="no"
2095
fi
2096
2097
# update QT_CONFIG to show our current predefined configuration
2098
case "$CFG_QCONFIG" in
2099
minimal|small|medium|large|full)
2100
    # these are a sequence of increasing functionality
2101
    for c in minimal small medium large full; do
2102
        QT_CONFIG="$QT_CONFIG $c-config"
2103
        [ "$CFG_QCONFIG" = $c ] && break
2104
    done
2105
    ;;
2106
*)
2107
    # not known to be sufficient for anything
2108
    if [ '!' -f "$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h" ]; then
2109
        echo >&2 "Error: configuration file not found:"
2110
        echo >&2 "  $relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h"
2111
        OPT_HELP=yes
2112
    fi
2113
esac
2114
2115
#-------------------------------------------------------------------------------
2116
# build tree initialization
2117
#-------------------------------------------------------------------------------
2118
2119
# where to find which..
2120
unixtests="$relpath/config.tests/unix"
2121
mactests="$relpath/config.tests/mac"
2122
WHICH="$unixtests/which.test"
2123
2124
PERL=`$WHICH perl 2>/dev/null`
2125
2126
# find out which awk we want to use, prefer gawk, then nawk, then regular awk
2127
AWK=
2128
for e in gawk nawk awk; do
2129
    if "$WHICH" $e >/dev/null 2>&1 && ( $e -f /dev/null /dev/null ) >/dev/null 2>&1; then
2130
        AWK=$e
2131
        break
2132
    fi
2133
done
2134
2135
# find perl
2136
PERL="/usr/bin/perl"
2137
if "$WHICH" perl >/dev/null 2>&1 && ( perl /dev/null ) >/dev/null 2>&1; then
2138
    PERL=`$WHICH perl`
2139
fi
2140
2141
### skip this if the user just needs help...
2142
if [ "$OPT_HELP" != "yes" ]; then
2143
2144
# is this a shadow build?
2145
if [ "$OPT_SHADOW" = "maybe" ]; then
2146
    OPT_SHADOW=no
2147
    if [ "$relpath" != "$outpath" ] && [ '!' -f "$outpath/configure" ]; then
2148
        if [ -h "$outpath" ]; then
2149
            [ "$relpath" -ef "$outpath" ] || OPT_SHADOW=yes
2150
        else
2151
            OPT_SHADOW=yes
2152
        fi
2153
    fi
2154
fi
2155
if [ "$OPT_SHADOW" = "yes" ]; then
2156
    if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" -o -f "$relpath/src/corelib/global/qconfig.cpp" ]; then
2157
        echo >&2 "You cannot make a shadow build from a source tree containing a previous build."
2158
        echo >&2 "Cannot proceed."
2159
        exit 1
2160
    fi
2161
    [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..."
2162
fi
2163
2164
if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
2165
    echo
2166
    echo "WARNING: -debug-and-release is not supported anymore on Qt/X11 and Qt for Embedded Linux"
2167
    echo "By default, Qt is built in release mode with separate debug information, so"
2168
    echo "-debug-and-release is not necessary anymore"
2169
    echo
2170
fi
2171
2172
# detect build style
2173
if [ "$CFG_DEBUG" = "auto" ]; then
2174
    if [ "$PLATFORM_MAC" = "yes" ]; then
2175
        CFG_DEBUG_RELEASE=yes
2176
        CFG_DEBUG=yes
2177
    elif [ "$CFG_DEV" = "yes" ]; then
2178
        CFG_DEBUG_RELEASE=no
2179
        CFG_DEBUG=yes
2180
    else
2181
        CFG_DEBUG_RELEASE=no
2182
        CFG_DEBUG=no
2183
    fi
2184
fi
2185
if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
2186
    QMAKE_CONFIG="$QMAKE_CONFIG build_all"
2187
fi
2188
2189
if [ "$CFG_SILENT" = "yes" ]; then
2190
    QMAKE_CONFIG="$QMAKE_CONFIG silent"
2191
fi
2192
2193
# if the source tree is different from the build tree,
2194
# symlink or copy part of the sources
2195
if [ "$OPT_SHADOW" = "yes" ]; then
2196
    echo "Preparing build tree..."
2197
2198
    if [ -z "$PERL" ]; then
2199
        echo
2200
        echo "You need perl in your PATH to make a shadow build."
2201
        echo "Cannot proceed."
2202
        exit 1
2203
    fi
2204
2205
    [ -d "$outpath/bin" ] || mkdir -p "$outpath/bin"
2206
2207
    # symlink the qmake directory
2208
    find "$relpath/qmake" | while read a; do
2209
        my_a=`echo "$a" | sed "s,^${relpath}/,${outpath}/,"`
2210
        if [ '!' -f "$my_a" ]; then
2211
            if [ -d "$a" ]; then
2212
                # directories are created...
2213
                mkdir -p "$my_a"
2214
            else
2215
                a_dir=`dirname "$my_a"`
2216
                [ -d "$a_dir" ] || mkdir -p "$a_dir"
2217
                # ... and files are symlinked
2218
                case `basename "$a"` in
2219
                *.o|*.d|GNUmakefile*|qmake)
2220
                    ;;
2221
                *)
2222
                    rm -f "$my_a"
2223
                    ln -s "$a" "$my_a"
2224
                    ;;
2225
                esac
2226
            fi
2227
        fi
2228
    done
2229
2230
    # make a syncqt script that can be used in the shadow
2231
    rm -f "$outpath/bin/syncqt"
2232
    if [ -x "$relpath/bin/syncqt" ]; then
2233
        mkdir -p "$outpath/bin"
2234
        echo "#!/bin/sh" >"$outpath/bin/syncqt"
2235
        echo "QTDIR=\"$relpath\"; export QTDIR" >>"$outpath/bin/syncqt"
2236
        echo "perl \"$relpath/bin/syncqt\" -outdir \"$outpath\" $*" >>"$outpath/bin/syncqt"
2237
        chmod 755 "$outpath/bin/syncqt"
2238
    fi
2239
2240
    # symlink the mkspecs directory
2241
    mkdir -p "$outpath/mkspecs"
2242
    rm -f "$outpath"/mkspecs/*
2243
    ln -s "$relpath"/mkspecs/* "$outpath/mkspecs"
2244
    rm -f "$outpath/mkspecs/default"
2245
2246
    # symlink the doc directory
2247
    rm -rf "$outpath/doc"
2248
    ln -s "$relpath/doc" "$outpath/doc"
2249
2250
    # make sure q3porting.xml can be found
2251
    mkdir -p "$outpath/tools/porting/src"
2252
    rm -f "$outpath/tools/porting/src/q3porting.xml"
2253
    ln -s "$relpath/tools/porting/src/q3porting.xml" "$outpath/tools/porting/src"
2254
fi
2255
2256
# symlink fonts to be able to run application from build directory
2257
if [ "$PLATFORM_QWS" = "yes" ] && [ ! -e "${outpath}/lib/fonts" ]; then
2258
    if [ "$PLATFORM" = "$XPLATFORM" ]; then
2259
        mkdir -p "${outpath}/lib"
2260
        ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts"
2261
    fi
2262
fi
2263
2264
if [ "$OPT_FAST" = "auto" ]; then
2265
   if [ '!' -z "$AWK" ] && [ "$CFG_DEV" = "yes" ]; then
2266
       OPT_FAST=yes
2267
   else
2268
       OPT_FAST=no
2269
   fi
2270
fi
2271
2272
# find a make command
2273
if [ -z "$MAKE" ]; then
2274
    MAKE=
2275
    for mk in gmake make; do
2276
        if "$WHICH" $mk >/dev/null 2>&1; then
2277
            MAKE=`"$WHICH" $mk`
2278
            break
2279
        fi
2280
    done
2281
    if [ -z "$MAKE" ]; then
2282
        echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH."
2283
        echo >&2 "Cannot proceed."
2284
        exit 1
2285
    fi
2286
    # export MAKE, we need it later in the config.tests
2287
    export MAKE
2288
fi
2289
2290
fi ### help
2291
2292
#-------------------------------------------------------------------------------
2293
# auto-detect all that hasn't been specified in the arguments
2294
#-------------------------------------------------------------------------------
2295
2296
[ "$PLATFORM_QWS" = "yes" -a "$CFG_EMBEDDED" = "no" ] && CFG_EMBEDDED=auto
2297
if [ "$CFG_EMBEDDED" != "no" ]; then
2298
    case "$UNAME_SYSTEM:$UNAME_RELEASE" in
2299
    Darwin:*)
2300
        [ -z "$PLATFORM" ] && PLATFORM=qws/macx-generic-g++
2301
        if [ -z "$XPLATFORM" ]; then
2302
            [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2303
            XPLATFORM="qws/macx-$CFG_EMBEDDED-g++"
2304
        fi
2305
        ;;
2306
    FreeBSD:*)
2307
        [ -z "$PLATFORM" ] && PLATFORM=qws/freebsd-generic-g++
2308
        if [ -z "$XPLATFORM" ]; then
2309
            [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2310
            XPLATFORM="qws/freebsd-$CFG_EMBEDDED-g++"
2311
        fi
2312
        ;;
2313
    SunOS:5*)
2314
        [ -z "$PLATFORM" ] && PLATFORM=qws/solaris-generic-g++
2315
        if [ -z "$XPLATFORM" ]; then
2316
            [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2317
            XPLATFORM="qws/solaris-$CFG_EMBEDDED-g++"
2318
        fi
2319
        ;;
2320
    Linux:*)
2321
        if [ -z "$PLATFORM" ]; then
2322
            case "$UNAME_MACHINE" in
2323
            *86)
2324
                PLATFORM=qws/linux-x86-g++
2325
                ;;
2326
            *86_64)
2327
                PLATFORM=qws/linux-x86_64-g++
2328
                ;;
2329
            *)
2330
                PLATFORM=qws/linux-generic-g++
2331
                ;;
2332
            esac
2333
        fi
2334
        if [ -z "$XPLATFORM" ]; then
2335
            if [ "$CFG_EMBEDDED" = "auto" ]; then
2336
                if [ -n "$CFG_ARCH" ]; then
2337
                    CFG_EMBEDDED=$CFG_ARCH
2338
                else
2339
                    case "$UNAME_MACHINE" in
2340
                    *86)
2341
                        CFG_EMBEDDED=x86
2342
                        ;;
2343
                    *86_64)
2344
                        CFG_EMBEDDED=x86_64
2345
                        ;;
2346
                    *)
2347
                        CFG_EMBEDDED=generic
2348
                        ;;
2349
                    esac
2350
                fi
2351
            fi
2352
            XPLATFORM="qws/linux-$CFG_EMBEDDED-g++"
2353
        fi
2354
        ;;
2355
    QNX:*)
2356
        [ -z "$PLATFORM" ] && PLATFORM=unsupported/qws/qnx-generic-g++
2357
        if [ -z "$XPLATFORM" ]; then
2358
            [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
2359
            XPLATFORM="unsupported/qws/qnx-$CFG_EMBEDDED-g++"
2360
        fi
2361
        ;;
2362
    CYGWIN*:*)
2363
	CFG_EMBEDDED=x86
2364
	;;
2365
    *)
2366
        echo "Qt for Embedded Linux is not supported on this platform. Disabling."
2367
        CFG_EMBEDDED=no
2368
        PLATFORM_QWS=no
2369
        ;;
2370
    esac
2371
fi
2372
if [ -z "$PLATFORM" ]; then
2373
    PLATFORM_NOTES=
2374
    case "$UNAME_SYSTEM:$UNAME_RELEASE" in
2375
     Darwin:*)
2376
        if [ "$PLATFORM_MAC" = "yes" ]; then
2377
          PLATFORM=macx-g++
2378
        # PLATFORM=macx-xcode
2379
        else
2380
          PLATFORM=darwin-g++
2381
        fi
2382
        ;;
2383
     AIX:*)
2384
        #PLATFORM=aix-g++
2385
        #PLATFORM=aix-g++-64
2386
        PLATFORM=aix-xlc
2387
        #PLATFORM=aix-xlc-64
2388
        PLATFORM_NOTES="
2389
            - Also available for AIX: aix-g++ aix-g++-64 aix-xlc-64
2390
        "
2391
        ;;
2392
     GNU:*)
2393
        PLATFORM=hurd-g++
2394
        ;;
2395
     dgux:*)
2396
        PLATFORM=dgux-g++
2397
        ;;
2398
#     DYNIX/ptx:4*)
2399
#       PLATFORM=dynix-g++
2400
#       ;;
2401
     ULTRIX:*)
2402
        PLATFORM=ultrix-g++
2403
        ;;
2404
     FreeBSD:*)
2405
        PLATFORM=freebsd-g++
2406
        PLATFORM_NOTES="
2407
            - Also available for FreeBSD: freebsd-icc
2408
        "
2409
        ;;
2410
     OpenBSD:*)
2411
        PLATFORM=openbsd-g++
2412
        ;;
2413
     NetBSD:*)
2414
        PLATFORM=netbsd-g++
2415
        ;;
2416
     BSD/OS:*|BSD/386:*)
2417
        PLATFORM=bsdi-g++
2418
        ;;
2419
     IRIX*:*)
2420
        #PLATFORM=irix-g++
2421
        PLATFORM=irix-cc
2422
        #PLATFORM=irix-cc-64
2423
        PLATFORM_NOTES="
2424
            - Also available for IRIX: irix-g++ irix-cc-64
2425
        "
2426
        ;;
2427
     HP-UX:*)
2428
        case "$UNAME_MACHINE" in
2429
            ia64)
2430
                #PLATFORM=hpuxi-acc-32
2431
                PLATFORM=hpuxi-acc-64
2432
                PLATFORM_NOTES="
2433
                    - Also available for HP-UXi: hpuxi-acc-32
2434
                "
2435
            ;;
2436
            *)
2437
                #PLATFORM=hpux-g++
2438
                PLATFORM=hpux-acc
2439
                #PLATFORM=hpux-acc-64
2440
                #PLATFORM=hpux-cc
2441
                #PLATFORM=hpux-acc-o64
2442
                PLATFORM_NOTES="
2443
                    - Also available for HP-UX: hpux-g++ hpux-acc-64 hpux-acc-o64
2444
                "
2445
            ;;
2446
        esac
2447
        ;;
2448
     OSF1:*)
2449
        #PLATFORM=tru64-g++
2450
        PLATFORM=tru64-cxx
2451
        PLATFORM_NOTES="
2452
            - Also available for Tru64: tru64-g++
2453
        "
2454
        ;;
2455
     Linux:*)
2456
        case "$UNAME_MACHINE" in
2457
            x86_64|s390x|ppc64)
2458
                PLATFORM=linux-g++-64
2459
                ;;
2460
            *)
2461
                PLATFORM=linux-g++
2462
                ;;
2463
        esac
2464
        PLATFORM_NOTES="
2465
            - Also available for Linux: linux-kcc linux-icc linux-cxx
2466
        "
2467
        ;;
2468
     SunOS:5*)
2469
        #PLATFORM=solaris-g++
2470
        PLATFORM=solaris-cc
2471
        #PLATFORM=solaris-cc64
2472
        PLATFORM_NOTES="
2473
            - Also available for Solaris: solaris-g++ solaris-cc-64
2474
        "
2475
        ;;
2476
     ReliantUNIX-*:*|SINIX-*:*)
2477
        PLATFORM=reliant-cds
2478
        #PLATFORM=reliant-cds-64
2479
        PLATFORM_NOTES="
2480
            - Also available for Reliant UNIX: reliant-cds-64
2481
        "
2482
        ;;
2483
     CYGWIN*:*)
2484
        PLATFORM=cygwin-g++
2485
        ;;
2486
     LynxOS*:*)
2487
        PLATFORM=lynxos-g++
2488
        ;;
2489
     OpenUNIX:*)
2490
        #PLATFORM=unixware-g++
2491
        PLATFORM=unixware-cc
2492
        PLATFORM_NOTES="
2493
            - Also available for OpenUNIX: unixware-g++
2494
        "
2495
        ;;
2496
     UnixWare:*)
2497
        #PLATFORM=unixware-g++
2498
        PLATFORM=unixware-cc
2499
        PLATFORM_NOTES="
2500
            - Also available for UnixWare: unixware-g++
2501
        "
2502
        ;;
2503
     SCO_SV:*)
2504
        #PLATFORM=sco-g++
2505
        PLATFORM=sco-cc
2506
        PLATFORM_NOTES="
2507
            - Also available for SCO OpenServer: sco-g++
2508
        "
2509
        ;;
2510
     UNIX_SV:*)
2511
        PLATFORM=unixware-g++
2512
        ;;
2513
     QNX:*)
2514
        PLATFORM=unsupported/qnx-g++
2515
        ;;
2516
     *)
2517
        if [ "$OPT_HELP" != "yes" ]; then
2518
            echo
2519
            for p in $PLATFORMS; do
2520
                echo "    $relconf $* -platform $p"
2521
            done
2522
            echo >&2
2523
            echo "   The build script does not currently recognize all" >&2
2524
            echo "   platforms supported by Qt." >&2
2525
            echo "   Rerun this script with a -platform option listed to" >&2
2526
            echo "   set the system/compiler combination you use." >&2
2527
            echo >&2
2528
            exit 2
2529
        fi
2530
    esac
2531
fi
2532
2533
if [ "$PLATFORM_QWS" = "yes" ]; then
2534
    CFG_SM=no
2535
    PLATFORMS=`find "$relpath/mkspecs/qws" | sed "s,$relpath/mkspecs/qws/,,"`
2536
else
2537
    PLATFORMS=`find "$relpath/mkspecs/" -type f | grep -v qws | sed "s,$relpath/mkspecs/qws/,,"`
2538
fi
2539
2540
[ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM"
2541
if [ -d "$PLATFORM" ]; then
2542
  QMAKESPEC="$PLATFORM"
2543
else
2544
  QMAKESPEC="$relpath/mkspecs/${PLATFORM}"
2545
fi
2546
if [ -d "$XPLATFORM" ]; then
2547
  XQMAKESPEC="$XPLATFORM"
2548
else
2549
  XQMAKESPEC="$relpath/mkspecs/${XPLATFORM}"
2550
fi
2551
if [ "$PLATFORM" != "$XPLATFORM" ]; then
2552
    QT_CROSS_COMPILE=yes
2553
    QMAKE_CONFIG="$QMAKE_CONFIG cross_compile"
2554
fi
2555
2556
if [ "$PLATFORM_MAC" = "yes" ]; then
2557
   if [ `basename $QMAKESPEC` = "macx-xcode" ] || [ `basename $XQMAKESPEC` = "macx-xcode" ]; then
2558
      echo >&2
2559
      echo "   Platform 'macx-xcode' should not be used when building Qt/Mac." >&2
2560
      echo "   Please build Qt/Mac with 'macx-g++', then if you would like to" >&2
2561
      echo "   use mac-xcode on your application code it can link to a Qt/Mac" >&2
2562
      echo "   built with 'macx-g++'" >&2
2563
      echo >&2
2564
      exit 2
2565
    fi
2566
fi
2567
2568
# check specified platforms are supported
2569
if [ '!' -d "$QMAKESPEC" ]; then
2570
    echo
2571
    echo "   The specified system/compiler is not supported:"
2572
    echo
2573
    echo "      $QMAKESPEC"
2574
    echo
2575
    echo "   Please see the README file for a complete list."
2576
    echo
2577
    exit 2
2578
fi
2579
if [ '!' -d "$XQMAKESPEC" ]; then
2580
    echo
2581
    echo "   The specified system/compiler is not supported:"
2582
    echo
2583
    echo "      $XQMAKESPEC"
2584
    echo
2585
    echo "   Please see the README file for a complete list."
2586
    echo
2587
    exit 2
2588
fi
2589
if [ '!' -f "${XQMAKESPEC}/qplatformdefs.h" ]; then
2590
    echo
2591
    echo "   The specified system/compiler port is not complete:"
2592
    echo
2593
    echo "      $XQMAKESPEC/qplatformdefs.h"
2594
    echo
2595
    echo "   Please contact qt-bugs@trolltech.com."
2596
    echo
2597
    exit 2
2598
fi
2599
2600
# now look at the configs and figure out what platform we are config'd for
2601
[ "$CFG_EMBEDDED" = "no" ] \
2602
  && [ '!' -z "`getQMakeConf \"$XQMAKESPEC\" | grep QMAKE_LIBS_X11 | awk '{print $3;}'`" ] \
2603
  && PLATFORM_X11=yes
2604
### echo "$XQMAKESPEC" | grep mkspecs/qws >/dev/null 2>&1 && PLATFORM_QWS=yes
2605
2606
if [ "$UNAME_SYSTEM" = "SunOS" ]; then
2607
    # Solaris 2.5 and 2.6 have libposix4, which was renamed to librt for Solaris 7 and up
2608
    if echo $UNAME_RELEASE | grep "^5\.[5|6]" >/dev/null 2>&1; then
2609
        sed -e "s,-lrt,-lposix4," "$XQMAKESPEC/qmake.conf" > "$XQMAKESPEC/qmake.conf.new"
2610
        mv "$XQMAKESPEC/qmake.conf.new" "$XQMAKESPEC/qmake.conf"
2611
    fi
2612
fi
2613
2614
#-------------------------------------------------------------------------------
2615
# determine the system architecture
2616
#-------------------------------------------------------------------------------
2617
if [ "$OPT_VERBOSE" = "yes" ]; then
2618
    echo "Determining system architecture... ($UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_MACHINE)"
2619
fi
2620
2621
if [ "$CFG_EMBEDDED" != "no" -a "$CFG_EMBEDDED" != "auto" ] && [ -n "$CFG_ARCH" ]; then
2622
    if [ "$CFG_ARCH" != "$CFG_EMBEDDED" ]; then
2623
        echo ""
2624
        echo "You have specified a target architecture with -embedded and -arch."
2625
        echo "The two architectures you have specified are different, so we can"
2626
        echo "not proceed. Either set both to be the same, or only use -embedded."
2627
        echo ""
2628
        exit 1
2629
    fi
2630
fi
2631
2632
if [ -z "${CFG_HOST_ARCH}" ]; then
2633
    case "$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_MACHINE" in
2634
    IRIX*:*:*)
2635
        CFG_HOST_ARCH=`uname -p`
2636
        if [ "$OPT_VERBOSE" = "yes" ]; then
2637
            echo "    SGI ($CFG_HOST_ARCH)"
2638
        fi
2639
        ;;
2640
    SunOS:5*:*)
2641
        case "$UNAME_MACHINE" in
2642
	sun4u*|sun4v*)
2643
            if [ "$OPT_VERBOSE" = "yes" ]; then
2644
                echo "    Sun SPARC (sparc)"
2645
            fi
2646
            CFG_HOST_ARCH=sparc
2647
            ;;
2648
        i86pc)
2649
	    case "$PLATFORM" in
2650
	    *-64)
2651
                if [ "$OPT_VERBOSE" = "yes" ]; then
2652
	            echo "    64-bit AMD 80x86 (x86_64)"
2653
                fi
2654
                CFG_HOST_ARCH=x86_64
2655
                ;;
2656
	    *)
2657
                if [ "$OPT_VERBOSE" = "yes" ]; then
2658
	            echo "    32-bit Intel 80x86 (i386)"
2659
                fi
2660
                CFG_HOST_ARCH=i386
2661
                ;;
2662
            esac
2663
        esac
2664
        ;;
2665
    Darwin:*:*)
2666
        case "$UNAME_MACHINE" in
2667
            Power?Macintosh)
2668
                if [ "$OPT_VERBOSE" = "yes" ]; then
2669
                    echo "    32-bit Apple PowerPC (powerpc)"
2670
                fi
2671
                ;;
2672
            x86)
2673
                if [ "$OPT_VERBOSE" = "yes" ]; then
2674
                    echo "    32-bit Intel 80x86 (i386)"
2675
                fi
2676
                ;;
2677
        esac
2678
        CFG_HOST_ARCH=macosx
2679
        ;;
2680
    AIX:*:00????????00)
2681
        if [ "$OPT_VERBOSE" = "yes" ]; then
2682
        echo "    64-bit IBM PowerPC (powerpc)"
2683
        fi
2684
        CFG_HOST_ARCH=powerpc
2685
        ;;
2686
    HP-UX:*:9000*)
2687
        if [ "$OPT_VERBOSE" = "yes" ]; then
2688
            echo "    HP PA-RISC (parisc)"
2689
        fi
2690
        CFG_HOST_ARCH=parisc
2691
        ;;
2692
    *:*:i?86)
2693
        if [ "$OPT_VERBOSE" = "yes" ]; then
2694
            echo "    32-bit Intel 80x86 (i386)"
2695
        fi
2696
        CFG_HOST_ARCH=i386
2697
        ;;
2698
    *:*:x86_64|*:*:amd64)
2699
        if [ "$PLATFORM" = "linux-g++-32" -o "$PLATFORM" = "linux-icc-32" ]; then
2700
            if [ "$OPT_VERBOSE" = "yes" ]; then
2701
                echo "    32 bit on 64-bit AMD 80x86 (i386)"
2702
            fi
2703
            CFG_HOST_ARCH=i386
2704
        else
2705
            if [ "$OPT_VERBOSE" = "yes" ]; then
2706
                echo "    64-bit AMD 80x86 (x86_64)"
2707
            fi
2708
            CFG_HOST_ARCH=x86_64
2709
        fi
2710
        ;;
2711
    *:*:ppc)
2712
        if [ "$OPT_VERBOSE" = "yes" ]; then
2713
            echo "    32-bit PowerPC (powerpc)"
2714
        fi
2715
        CFG_HOST_ARCH=powerpc
2716
        ;;
2717
    *:*:ppc64)
2718
        if [ "$OPT_VERBOSE" = "yes" ]; then
2719
            echo "    64-bit PowerPC (powerpc)"
2720
        fi
2721
        CFG_HOST_ARCH=powerpc
2722
        ;;
2723
    *:*:s390*)
2724
    	if [ "$OPT_VERBOSE" = "yes" ]; then
2725
    	    echo "    IBM S/390 (s390)"
2726
    	fi
2727
    	CFG_HOST_ARCH=s390
2728
    	;;
2729
    *:*:arm*)
2730
        if [ "$OPT_VERBOSE" = "yes" ]; then
2731
            echo "    ARM (arm)"
2732
        fi
2733
        CFG_HOST_ARCH=arm
2734
        ;;
2735
    Linux:*:sparc*)
2736
        if [ "$OPT_VERBOSE" = "yes" ]; then
2737
            echo "    Linux on SPARC"
2738
        fi
2739
        CFG_HOST_ARCH=sparc
2740
        ;;
2741
    QNX:*:*)
2742
        case "$UNAME_MACHINE" in
2743
        x86pc)
2744
            if [ "$OPT_VERBOSE" = "yes" ]; then
2745
                echo "    QNX on Intel 80x86 (i386)"
2746
            fi
2747
            CFG_HOST_ARCH=i386
2748
            ;;
2749
        esac
2750
        ;;
2751
    *:*:*)
2752
        if [ "$OPT_VERBOSE" = "yes" ]; then
2753
            echo "    Trying '$UNAME_MACHINE'..."
2754
        fi
2755
        CFG_HOST_ARCH="$UNAME_MACHINE"
2756
        ;;
2757
    esac
2758
fi
2759
2760
if [ "$PLATFORM" != "$XPLATFORM" -a "$CFG_EMBEDDED" != "no" ]; then
2761
    if [ -n "$CFG_ARCH" ]; then
2762
        CFG_EMBEDDED=$CFG_ARCH
2763
    fi
2764
2765
    case "$CFG_EMBEDDED" in
2766
    x86)
2767
        CFG_ARCH=i386
2768
        ;;
2769
    x86_64)
2770
        CFG_ARCH=x86_64
2771
        ;;
2772
    ipaq|sharp)
2773
        CFG_ARCH=arm
2774
        ;;
2775
    dm7000)
2776
        CFG_ARCH=powerpc
2777
        ;;
2778
    dm800)
2779
        CFG_ARCH=mips
2780
        ;;
2781
    sh4al)
2782
        CFG_ARCH=sh4a
2783
        ;;
2784
    *)
2785
        CFG_ARCH="$CFG_EMBEDDED"
2786
        ;;
2787
    esac
2788
elif [ "$PLATFORM_MAC" = "yes" ] || [ -z "$CFG_ARCH" ]; then
2789
    CFG_ARCH=$CFG_HOST_ARCH
2790
fi
2791
2792
if [ -d "$relpath/src/corelib/arch/$CFG_ARCH" ]; then
2793
    if [ "$OPT_VERBOSE" = "yes" ]; then
2794
        echo "    '$CFG_ARCH' is supported"
2795
    fi
2796
else
2797
    if [ "$OPT_VERBOSE" = "yes" ]; then
2798
        echo "    '$CFG_ARCH' is unsupported, using 'generic'"
2799
    fi
2800
    CFG_ARCH=generic
2801
fi
2802
if [ "$CFG_HOST_ARCH" != "$CFG_ARCH" ]; then
2803
    if [ -d "$relpath/src/corelib/arch/$CFG_HOST_ARCH" ]; then
2804
        if [ "$OPT_VERBOSE" = "yes" ]; then
2805
            echo "    '$CFG_HOST_ARCH' is supported"
2806
        fi
2807
    else
2808
        if [ "$OPT_VERBOSE" = "yes" ]; then
2809
            echo "    '$CFG_HOST_ARCH' is unsupported, using 'generic'"
2810
        fi
2811
        CFG_HOST_ARCH=generic
2812
    fi
2813
fi
2814
2815
if [ "$OPT_VERBOSE" = "yes" ]; then
2816
    echo "System architecture: '$CFG_ARCH'"
2817
    if [ "$PLATFORM_QWS" = "yes" ]; then
2818
	echo "Host architecture: '$CFG_HOST_ARCH'"
2819
    fi
2820
fi
2821
2822
#-------------------------------------------------------------------------------
2823
# tests that don't need qmake (must be run before displaying help)
2824
#-------------------------------------------------------------------------------
2825
2826
if [ -z "$PKG_CONFIG" ]; then
2827
    # See if PKG_CONFIG is set in the mkspec:
2828
    PKG_CONFIG=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%PKG_CONFIG[^_].*=%%p' | tr '\n' ' '`
2829
fi
2830
if [ -z "$PKG_CONFIG" ]; then
2831
    PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null`
2832
fi
2833
2834
# Work out if we can use pkg-config
2835
if [ "$QT_CROSS_COMPILE" = "yes" ]; then
2836
    if [ "$QT_FORCE_PKGCONFIG" = "yes" ]; then
2837
        echo >&2 ""
2838
        echo >&2 "You have asked to use pkg-config and are cross-compiling."
2839
        echo >&2 "Please make sure you have a correctly set-up pkg-config"
2840
        echo >&2 "environment!"
2841
        echo >&2 ""
2842
        if [ -z "$PKG_CONFIG_PATH" ]; then
2843
            echo >&2 ""
2844
            echo >&2 "Warning: PKG_CONFIG_PATH has not been set.  This could mean"
2845
            echo >&2 "the host compiler's .pc files will be used. This is probably"
2846
            echo >&2 "not what you want."
2847
            echo >&2 ""
2848
        elif [ -z "$PKG_CONFIG_SYSROOT" ] && [ -z "$PKG_CONFIG_SYSROOT_DIR" ]; then
2849
            echo >&2 ""
2850
            echo >&2 "Warning: PKG_CONFIG_SYSROOT/PKG_CONFIG_SYSROOT_DIR has not"
2851
            echo >&2 "been set. This means your toolchain's .pc files must contain"
2852
            echo >&2 "the paths to the toolchain's libraries & headers. If configure"
2853
            echo >&2 "tests are failing, please check these files."
2854
            echo >&2 ""
2855
        fi
2856
    else
2857
        echo >&2 ""
2858
        echo >&2 "You have not explicitly asked to use pkg-config and are cross-compiling."
2859
        echo >&2 "pkg-config will not be used to automatically query cflag/lib parameters for"
2860
        echo >&2 "dependencies"
2861
        echo >&2 ""
2862
        PKG_CONFIG=""
2863
    fi
2864
fi
2865
2866
# process CFG_MAC_ARCHS
2867
if [ "$PLATFORM_MAC" = "yes" ]; then
2868
#   check -arch arguments for validity.
2869
    ALLOWED="x86 ppc x86_64 ppc64 i386"
2870
    # Save the list so we can re-write it using only valid values
2871
    CFG_MAC_ARCHS_IN="$CFG_MAC_ARCHS"
2872
    CFG_MAC_ARCHS=
2873
    for i in $CFG_MAC_ARCHS_IN
2874
    do 
2875
        if echo "$ALLOWED" | grep -w -v "$i" > /dev/null 2>&1; then
2876
            echo "Unknown architecture: \"$i\". Supported architectures: x86[i386] ppc x86_64 ppc64";
2877
            exit 2;
2878
        fi
2879
        if [ "$i" = "i386" -o "$i" = "x86" ]; then
2880
            # These are synonymous values
2881
            # CFG_MAC_ARCHS requires x86 while GCC requires i386
2882
            CFG_MAC_ARCHS="$CFG_MAC_ARCHS x86"
2883
            MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -arch i386"
2884
        else
2885
            CFG_MAC_ARCHS="$CFG_MAC_ARCHS $i"
2886
            MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -arch $i"
2887
        fi
2888
    done
2889
fi
2890
2891
# pass on $CFG_SDK to the configure tests.
2892
if [ '!' -z "$CFG_SDK" ]; then
2893
    MAC_CONFIG_TEST_COMMANDLINE="-sdk $CFG_SDK"
2894
fi
2895
2896
# find the default framework value
2897
if [ "$PLATFORM_MAC" = "yes" ] && [ "$PLATFORM" != "macx-xlc" ]; then
2898
    if [ "$CFG_FRAMEWORK" = "auto" ]; then
2899
        CFG_FRAMEWORK="$CFG_SHARED"
2900
    elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
2901
	echo
2902
	echo "WARNING: Using static linking will disable the use of Mac frameworks."
2903
	echo
2904
        CFG_FRAMEWORK="no"
2905
    fi
2906
else
2907
    CFG_FRAMEWORK=no
2908
fi
2909
2910
QMAKE_CONF_COMPILER=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_CXX[^_A-Z0-9]" | sed "s,.* *= *\(.*\)$,\1," | tail -1`
2911
TEST_COMPILER="$CC"
2912
[ -z "$TEST_COMPILER" ] && TEST_COMPILER=$QMAKE_CONF_COMPILER
2913
2914
# auto-detect precompiled header support
2915
if [ "$CFG_PRECOMPILE" = "auto" ]; then
2916
    if [ `echo "$CFG_MAC_ARCHS" | wc -w` -gt 1 ]; then
2917
       CFG_PRECOMPILE=no
2918
    elif "$unixtests/precomp.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
2919
       CFG_PRECOMPILE=no
2920
    else
2921
       CFG_PRECOMPILE=yes
2922
    fi
2923
elif [ "$CFG_PRECOMPILE" = "yes" ] && [ `echo "$CFG_MAC_ARCHS" | wc -w` -gt 1 ]; then
2924
    echo
2925
    echo "WARNING: Using universal binaries disables precompiled headers."
2926
    echo
2927
    CFG_PRECOMPILE=no
2928
fi
2929
2930
#auto-detect DWARF2 on the mac
2931
if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "auto" ]; then
2932
    if "$mactests/dwarf2.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
2933
        CFG_MAC_DWARF2=no
2934
    else
2935
        CFG_MAC_DWARF2=yes
2936
    fi
2937
fi
2938
2939
# auto-detect support for -Xarch on the mac
2940
if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" = "auto" ]; then
2941
    if "$mactests/xarch.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
2942
        CFG_MAC_XARCH=no
2943
    else
2944
        CFG_MAC_XARCH=yes
2945
    fi
2946
fi
2947
2948
# don't autodetect support for separate debug info on objcopy when
2949
# cross-compiling as lots of toolchains seems to have problems with this
2950
if [ "$QT_CROSS_COMPILE" = "yes" ] && [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
2951
    CFG_SEPARATE_DEBUG_INFO="no"
2952
fi
2953
2954
# auto-detect support for separate debug info in objcopy
2955
if [ "$CFG_SEPARATE_DEBUG_INFO" != "no" ] && [ "$CFG_SHARED" = "yes" ]; then
2956
    TEST_COMPILER_CFLAGS=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%QMAKE_CFLAGS[^_].*=%%p' | tr '\n' ' '`
2957
    TEST_COMPILER_CXXFLAGS=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%QMAKE_CXXFLAGS[^_].*=%%p' | tr '\n' ' '`
2958
    TEST_OBJCOPY=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_OBJCOPY" | sed "s%.* *= *\(.*\)$%\1%" | tail -1`
2959
    COMPILER_WITH_FLAGS="$TEST_COMPILER $TEST_COMPILER_CXXFLAGS"
2960
    COMPILER_WITH_FLAGS=`echo "$COMPILER_WITH_FLAGS" | sed -e "s%\\$\\$QMAKE_CFLAGS%$TEST_COMPILER_CFLAGS%g"`
2961
    if "$unixtests/objcopy.test" "$COMPILER_WITH_FLAGS" "$TEST_OBJCOPY" "$OPT_VERBOSE"; then
2962
       CFG_SEPARATE_DEBUG_INFO=no
2963
    else
2964
       case "$PLATFORM" in
2965
       hpux-*)
2966
           # binutils on HP-UX is buggy; default to no.
2967
           CFG_SEPARATE_DEBUG_INFO=no
2968
           ;;
2969
       *)
2970
           CFG_SEPARATE_DEBUG_INFO=yes
2971
           ;;
2972
       esac
2973
    fi
2974
fi
2975
2976
# auto-detect -fvisibility support
2977
if [ "$CFG_REDUCE_EXPORTS" = "auto" ]; then
2978
    if "$unixtests/fvisibility.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
2979
       CFG_REDUCE_EXPORTS=no
2980
    else
2981
       CFG_REDUCE_EXPORTS=yes
2982
    fi
2983
fi
2984
2985
# detect the availability of the -Bsymbolic-functions linker optimization
2986
if [ "$CFG_REDUCE_RELOCATIONS" != "no" ]; then
2987
    if "$unixtests/bsymbolic_functions.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
2988
        CFG_REDUCE_RELOCATIONS=no
2989
    else
2990
        CFG_REDUCE_RELOCATIONS=yes
2991
    fi
2992
fi
2993
2994
# auto-detect GNU make support
2995
if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2>&1; then
2996
   CFG_USE_GNUMAKE=yes
2997
fi
2998
2999
# If -opengl wasn't specified, don't try to auto-detect
3000
if [ "$PLATFORM_QWS" = "yes" ] && [ "$CFG_OPENGL" = "auto" ]; then
3001
        CFG_OPENGL=no
3002
fi
3003
3004
# mac
3005
if [ "$PLATFORM_MAC" = "yes" ]; then
3006
    if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
3007
        CFG_OPENGL=desktop
3008
    fi
3009
fi
3010
3011
# find the default framework value
3012
if [ "$PLATFORM_MAC" = "yes" ] && [ "$PLATFORM" != "macx-xlc" ]; then
3013
    if [ "$CFG_FRAMEWORK" = "auto" ]; then
3014
        CFG_FRAMEWORK="$CFG_SHARED"
3015
    elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
3016
	echo
3017
	echo "WARNING: Using static linking will disable the use of Mac frameworks."
3018
	echo
3019
        CFG_FRAMEWORK="no"
3020
    fi
3021
else
3022
    CFG_FRAMEWORK=no
3023
fi
3024
3025
# Print a warning if configure was called with the 10.4u SDK option on Snow Leopard
3026
# with the default mkspec. The 10.4u SDK does not support gcc 4.2.
3027
if [ "$PLATFORM_MAC" = "yes" ] && [ '!' -z "$CFG_SDK" ]; then
3028
    # get the darwin version. 10.0.0 and up means snow leopard.
3029
    VERSION=`uname -r | tr '.' ' ' | awk '{print $1}'`
3030
    if [ "$VERSION" -gt 9 ] && [ "$CFG_SDK" == "/Developer/SDKs/MacOSX10.4u.sdk/" ] && [ "$PLATFORM" == "macx-g++" ]; then
3031
        echo
3032
        echo "WARNING: The 10.4u SDK does not support gcc 4.2. Configure with -platform macx-g++40. "
3033
        echo
3034
    fi
3035
fi
3036
3037
# x11 tests are done after qmake is built
3038
3039
3040
#setup the build parts
3041
if [ -z "$CFG_BUILD_PARTS" ]; then
3042
    CFG_BUILD_PARTS="$QT_DEFAULT_BUILD_PARTS"
3043
3044
    # don't build tools by default when cross-compiling
3045
    if [ "$PLATFORM" != "$XPLATFORM" ]; then
3046
	CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, tools,,g"`
3047
    fi
3048
fi
3049
for nobuild in $CFG_NOBUILD_PARTS; do
3050
    CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, $nobuild,,g"`
3051
done
3052
if echo $CFG_BUILD_PARTS | grep -v libs >/dev/null 2>&1; then
3053
#    echo
3054
#    echo "WARNING: libs is a required part of the build."
3055
#    echo
3056
    CFG_BUILD_PARTS="$CFG_BUILD_PARTS libs"
3057
fi
3058
3059
#-------------------------------------------------------------------------------
3060
# post process QT_INSTALL_* variables
3061
#-------------------------------------------------------------------------------
3062
3063
#prefix
3064
if [ -z "$QT_INSTALL_PREFIX" ]; then
3065
    if [ "$CFG_DEV" = "yes" ]; then
3066
	QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default
3067
    elif [ "$PLATFORM_QWS" = "yes" ]; then
3068
        QT_INSTALL_PREFIX="/usr/local/Trolltech/QtEmbedded-${QT_VERSION}"
3069
        if [ "$PLATFORM" != "$XPLATFORM" ]; then
3070
            QT_INSTALL_PREFIX="${QT_INSTALL_PREFIX}-${CFG_ARCH}"
3071
        fi
3072
    else
3073
        QT_INSTALL_PREFIX="/usr/local/Trolltech/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Trolltech/Qt-$QT_VERSION
3074
    fi
3075
fi
3076
QT_INSTALL_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PREFIX"`
3077
3078
#docs
3079
if [ -z "$QT_INSTALL_DOCS" ]; then #default
3080
    if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3081
	if [ "$PLATFORM_MAC" = "yes" ]; then
3082
	    QT_INSTALL_DOCS="/Developer/Documentation/Qt"
3083
        fi
3084
    fi
3085
    [ -z "$QT_INSTALL_DOCS" ] && QT_INSTALL_DOCS="$QT_INSTALL_PREFIX/doc" #fallback
3086
3087
fi
3088
QT_INSTALL_DOCS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DOCS"`
3089
3090
#headers
3091
if [ -z "$QT_INSTALL_HEADERS" ]; then #default
3092
    if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3093
	if [ "$PLATFORM_MAC" = "yes" ]; then
3094
	    if [ "$CFG_FRAMEWORK" = "yes" ]; then
3095
		QT_INSTALL_HEADERS=
3096
            fi
3097
        fi
3098
    fi
3099
    [ -z "$QT_INSTALL_HEADERS" ] && QT_INSTALL_HEADERS="$QT_INSTALL_PREFIX/include"
3100
3101
fi
3102
QT_INSTALL_HEADERS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_HEADERS"`
3103
3104
#libs
3105
if [ -z "$QT_INSTALL_LIBS" ]; then #default
3106
    if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3107
	if [ "$PLATFORM_MAC" = "yes" ]; then
3108
	    if [ "$CFG_FRAMEWORK" = "yes" ]; then
3109
		QT_INSTALL_LIBS="/Libraries/Frameworks"
3110
            fi
3111
        fi
3112
    fi
3113
    [ -z "$QT_INSTALL_LIBS" ] && QT_INSTALL_LIBS="$QT_INSTALL_PREFIX/lib" #fallback
3114
fi
3115
QT_INSTALL_LIBS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_LIBS"`
3116
3117
#bins
3118
if [ -z "$QT_INSTALL_BINS" ]; then #default
3119
    if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3120
	if [ "$PLATFORM_MAC" = "yes" ]; then
3121
	    QT_INSTALL_BINS="/Developer/Applications/Qt"
3122
        fi
3123
    fi
3124
    [ -z "$QT_INSTALL_BINS" ] && QT_INSTALL_BINS="$QT_INSTALL_PREFIX/bin" #fallback
3125
3126
fi
3127
QT_INSTALL_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_BINS"`
3128
3129
#plugins
3130
if [ -z "$QT_INSTALL_PLUGINS" ]; then #default
3131
    if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3132
	if [ "$PLATFORM_MAC" = "yes" ]; then
3133
	    QT_INSTALL_PLUGINS="/Developer/Applications/Qt/plugins"
3134
        fi
3135
    fi
3136
    [ -z "$QT_INSTALL_PLUGINS" ] && QT_INSTALL_PLUGINS="$QT_INSTALL_PREFIX/plugins" #fallback
3137
fi
3138
QT_INSTALL_PLUGINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PLUGINS"`
3139
3140
#data
3141
if [ -z "$QT_INSTALL_DATA" ]; then #default
3142
    QT_INSTALL_DATA="$QT_INSTALL_PREFIX"
3143
fi
3144
QT_INSTALL_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DATA"`
3145
3146
#translations
3147
if [ -z "$QT_INSTALL_TRANSLATIONS" ]; then #default
3148
    QT_INSTALL_TRANSLATIONS="$QT_INSTALL_PREFIX/translations"
3149
fi
3150
QT_INSTALL_TRANSLATIONS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TRANSLATIONS"`
3151
3152
#settings
3153
if [ -z "$QT_INSTALL_SETTINGS" ]; then #default
3154
    if [ "$PLATFORM_MAC" = "yes" ]; then
3155
	QT_INSTALL_SETTINGS=/Library/Preferences/Qt
3156
    else
3157
	QT_INSTALL_SETTINGS=/etc/xdg
3158
    fi
3159
fi
3160
QT_INSTALL_SETTINGS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_SETTINGS"`
3161
3162
#examples
3163
if [ -z "$QT_INSTALL_EXAMPLES" ]; then #default
3164
    if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3165
	if [ "$PLATFORM_MAC" = "yes" ]; then
3166
	    QT_INSTALL_EXAMPLES="/Developer/Examples/Qt"
3167
        fi
3168
    fi
3169
    [ -z "$QT_INSTALL_EXAMPLES" ] && QT_INSTALL_EXAMPLES="$QT_INSTALL_PREFIX/examples" #fallback
3170
fi
3171
QT_INSTALL_EXAMPLES=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_EXAMPLES"`
3172
3173
#demos
3174
if [ -z "$QT_INSTALL_DEMOS" ]; then #default
3175
    if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
3176
	if [ "$PLATFORM_MAC" = "yes" ]; then
3177
	    QT_INSTALL_DEMOS="/Developer/Examples/Qt/Demos"
3178
        fi
3179
    fi
3180
    [ -z "$QT_INSTALL_DEMOS" ] && QT_INSTALL_DEMOS="$QT_INSTALL_PREFIX/demos"
3181
fi
3182
QT_INSTALL_DEMOS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DEMOS"`
3183
3184
#-------------------------------------------------------------------------------
3185
# help - interactive parts of the script _after_ this section please
3186
#-------------------------------------------------------------------------------
3187
3188
# next, emit a usage message if something failed.
3189
if [ "$OPT_HELP" = "yes" ]; then
3190
    [ "x$ERROR" = "xyes" ] && echo
3191
    if [ "$CFG_NIS" = "no" ]; then
3192
        NSY=" "
3193
        NSN="*"
3194
    else
3195
        NSY="*"
3196
        NSN=" "
3197
    fi
3198
    if [ "$CFG_CUPS" = "no" ]; then
3199
        CUY=" "
3200
        CUN="*"
3201
    else
3202
        CUY="*"
3203
        CUN=" "
3204
    fi
3205
    if [ "$CFG_ICONV" = "no" ]; then
3206
        CIY=" "
3207
        CIN="*"
3208
    else
3209
        CIY="*"
3210
        CIN=" "
3211
    fi
3212
    if [ "$CFG_LARGEFILE" = "no" ]; then
3213
        LFSY=" "
3214
        LFSN="*"
3215
    else
3216
        LFSY="*"
3217
        LFSN=" "
3218
    fi
3219
    if [ "$CFG_STL" = "auto" ] || [ "$CFG_STL" = "yes" ]; then
3220
        SHY="*"
3221
        SHN=" "
3222
    else
3223
        SHY=" "
3224
        SHN="*"
3225
    fi
3226
    if [ "$CFG_IPV6" = "auto" ]; then
3227
        I6Y="*"
3228
        I6N=" "
3229
    fi
3230
    if [ "$CFG_PRECOMPILE" = "auto" ] || [ "$CFG_PRECOMPILE" = "no" ]; then
3231
        PHY=" "
3232
        PHN="*"
3233
    else
3234
        PHY="*"
3235
        PHN=" "
3236
    fi
3237
3238
    cat <<EOF
3239
Usage:  $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>]
3240
        [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-datadir <dir>]
3241
        [-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>]
3242
        [-demosdir <dir>] [-buildkey <key>] [-release] [-debug]
3243
        [-debug-and-release] [-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile]
3244
        [-largefile] [-no-exceptions] [-exceptions] [-no-accessibility]
3245
        [-accessibility] [-no-stl] [-stl] [-no-sql-<driver>] [-sql-<driver>]
3246
        [-plugin-sql-<driver>] [-system-sqlite] [-no-qt3support] [-qt3support]
3247
        [-platform] [-D <string>] [-I <string>] [-L <string>] [-help]
3248
        [-qt-zlib] [-system-zlib] [-no-gif] [-qt-gif] [-no-libtiff] [-qt-libtiff] [-system-libtiff]
3249
        [-no-libpng] [-qt-libpng] [-system-libpng] [-no-libmng] [-qt-libmng]
3250
        [-system-libmng] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>]
3251
        [-nomake <part>] [-R <string>]  [-l <string>] [-no-rpath]  [-rpath] [-continue]
3252
        [-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [-no-iconv]
3253
        [-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked]
3254
        [-no-separate-debug-info] [-no-mmx] [-no-3dnow] [-no-sse] [-no-sse2]
3255
        [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info] [-armfpa]
3256
        [-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns]
3257
        [-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend]
3258
        [-no-openssl] [-openssl] [-openssl-linked]
3259
        [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-no-javascript-jit] [-javascript-jit]
3260
        [-no-script] [-script] [-no-scripttools] [-scripttools] [-no-declarative] [-declarative]
3261
3262
        [additional platform specific options (see below)]
3263
3264
3265
Installation options:
3266
3267
 These are optional, but you may specify install directories.
3268
3269
    -prefix <dir> ...... This will install everything relative to <dir>
3270
                         (default $QT_INSTALL_PREFIX)
3271
EOF
3272
if [ "$PLATFORM_QWS" = "yes" ]; then
3273
cat <<EOF
3274
3275
    -hostprefix [dir] .. Tools and libraries needed when developing
3276
                         applications are installed in [dir]. If [dir] is
3277
                         not given, the current build directory will be used.
3278
EOF
3279
fi
3280
cat <<EOF
3281
3282
  * -prefix-install .... Force a sandboxed "local" installation of
3283
                         Qt. This will install into
3284
                         $QT_INSTALL_PREFIX, if this option is
3285
                         disabled then some platforms will attempt a
3286
                         "system" install by placing default values to
3287
                         be placed in a system location other than
3288
                         PREFIX.
3289
3290
 You may use these to separate different parts of the install:
3291
3292
    -bindir <dir> ......... Executables will be installed to <dir>
3293
                            (default PREFIX/bin)
3294
    -libdir <dir> ......... Libraries will be installed to <dir>
3295
                            (default PREFIX/lib)
3296
    -docdir <dir> ......... Documentation will be installed to <dir>
3297
                            (default PREFIX/doc)
3298
    -headerdir <dir> ...... Headers will be installed to <dir>
3299
                            (default PREFIX/include)
3300
    -plugindir <dir> ...... Plugins will be installed to <dir>
3301
                            (default PREFIX/plugins)
3302
    -datadir <dir> ........ Data used by Qt programs will be installed to <dir>
3303
                            (default PREFIX)
3304
    -translationdir <dir> . Translations of Qt programs will be installed to <dir>
3305
                            (default PREFIX/translations)
3306
    -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir>
3307
                            (default PREFIX/etc/settings)
3308
    -examplesdir <dir> .... Examples will be installed to <dir>
3309
                            (default PREFIX/examples)
3310
    -demosdir <dir> ....... Demos will be installed to <dir>
3311
                            (default PREFIX/demos)
3312
3313
 You may use these options to turn on strict plugin loading.
3314
3315
    -buildkey <key> .... Build the Qt library and plugins using the specified
3316
                         <key>.  When the library loads plugins, it will only
3317
                         load those that have a matching key.
3318
3319
Configure options:
3320
3321
 The defaults (*) are usually acceptable. A plus (+) denotes a default value
3322
 that needs to be evaluated. If the evaluation succeeds, the feature is
3323
 included. Here is a short explanation of each option:
3324
3325
 *  -release ........... Compile and link Qt with debugging turned off.
3326
    -debug ............. Compile and link Qt with debugging turned on.
3327
    -debug-and-release . Compile and link two versions of Qt, with and without
3328
                         debugging turned on (Mac only).
3329
3330
    -developer-build.... Compile and link Qt with Qt developer options (including auto-tests exporting)
3331
3332
    -opensource......... Compile and link the Open-Source Edition of Qt.
3333
    -commercial......... Compile and link the Commercial Edition of Qt.
3334
3335
3336
 *  -shared ............ Create and use shared Qt libraries.
3337
    -static ............ Create and use static Qt libraries.
3338
3339
 *  -no-fast ........... Configure Qt normally by generating Makefiles for all
3340
                         project files.
3341
    -fast .............. Configure Qt quickly by generating Makefiles only for
3342
                         library and subdirectory targets.  All other Makefiles
3343
                         are created as wrappers, which will in turn run qmake.
3344
3345
    -no-largefile ...... Disables large file support.
3346
 +  -largefile ......... Enables Qt to access files larger than 4 GB.
3347
3348
EOF
3349
if [ "$PLATFORM_QWS" = "yes" ]; then
3350
    EXCN="*"
3351
    EXCY=" "
3352
else
3353
    EXCN=" "
3354
    EXCY="*"
3355
fi
3356
if [ "$CFG_DBUS" = "no" ]; then
3357
    DBY=" "
3358
    DBN="+"
3359
else
3360
    DBY="+"
3361
    DBN=" "
3362
fi
3363
3364
    cat << EOF
3365
 $EXCN  -no-exceptions ..... Disable exceptions on compilers that support it.
3366
 $EXCY  -exceptions ........ Enable exceptions on compilers that support it.
3367
3368
    -no-accessibility .. Do not compile Accessibility support.
3369
 *  -accessibility ..... Compile Accessibility support.
3370
3371
 $SHN  -no-stl ............ Do not compile STL support.
3372
 $SHY  -stl ............... Compile STL support.
3373
3374
    -no-sql-<driver> ... Disable SQL <driver> entirely.
3375
    -qt-sql-<driver> ... Enable a SQL <driver> in the QtSql library, by default
3376
                         none are turned on.
3377
    -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to
3378
                         at run time.
3379
3380
                         Possible values for <driver>:
3381
                         [ $CFG_SQL_AVAILABLE ]
3382
3383
    -system-sqlite ..... Use sqlite from the operating system.
3384
3385
    -no-qt3support ..... Disables the Qt 3 support functionality.
3386
 *  -qt3support ........ Enables the Qt 3 support functionality.
3387
3388
    -no-xmlpatterns .... Do not build the QtXmlPatterns module.
3389
 +  -xmlpatterns ....... Build the QtXmlPatterns module.
3390
                         QtXmlPatterns is built if a decent C++ compiler
3391
                         is used and exceptions are enabled.
3392
3393
    -no-multimedia ..... Do not build the QtMultimedia module.
3394
 +  -multimedia ........ Build the QtMultimedia module.
3395
3396
    -no-phonon ......... Do not build the Phonon module.
3397
 +  -phonon ............ Build the Phonon module.
3398
                         Phonon is built if a decent C++ compiler is used.
3399
    -no-phonon-backend.. Do not build the platform phonon plugin.
3400
 +  -phonon-backend..... Build the platform phonon plugin.
3401
3402
    -no-svg ............ Do not build the SVG module.
3403
 +  -svg ............... Build the SVG module.
3404
3405
    -no-webkit ......... Do not build the WebKit module.
3406
 +  -webkit ............ Build the WebKit module.
3407
                         WebKit is built if a decent C++ compiler is used.
3408
3409
    -no-javascript-jit . Do not build the JavaScriptCore JIT compiler.
3410
 +  -javascript-jit .... Build the JavaScriptCore JIT compiler.
3411
3412
    -no-script ......... Do not build the QtScript module.
3413
 +  -script ............ Build the QtScript module.
3414
3415
    -no-scripttools .... Do not build the QtScriptTools module.
3416
 +  -scripttools ....... Build the QtScriptTools module.
3417
3418
 +  -no-declarative .....Do not build the declarative module.
3419
    -declarative ....... Build the declarative module.
3420
3421
    -platform target ... The operating system and compiler you are building
3422
                         on ($PLATFORM).
3423
3424
                         See the README file for a list of supported
3425
                         operating systems and compilers.
3426
EOF
3427
if [ "${PLATFORM_QWS}" != "yes" ]; then
3428
cat << EOF
3429
    -graphicssystem <sys> Sets an alternate graphics system. Available options are:
3430
                           raster - Software rasterizer
3431
                           opengl - Rendering via OpenGL, Experimental!
3432
EOF
3433
fi
3434
cat << EOF
3435
3436
    -no-mmx ............ Do not compile with use of MMX instructions.
3437
    -no-3dnow .......... Do not compile with use of 3DNOW instructions.
3438
    -no-sse ............ Do not compile with use of SSE instructions.
3439
    -no-sse2 ........... Do not compile with use of SSE2 instructions.
3440
3441
    -qtnamespace <name>  Wraps all Qt library code in 'namespace <name> {...}'.
3442
    -qtlibinfix <infix>  Renames all libQt*.so to libQt*<infix>.so.
3443
3444
    -D <string> ........ Add an explicit define to the preprocessor.
3445
    -I <string> ........ Add an explicit include path.
3446
    -L <string> ........ Add an explicit library path.
3447
3448
    -help, -h .......... Display this information.
3449
3450
Third Party Libraries:
3451
3452
    -qt-zlib ........... Use the zlib bundled with Qt.
3453
 +  -system-zlib ....... Use zlib from the operating system.
3454
                         See http://www.gzip.org/zlib
3455
3456
    -no-gif ............ Do not compile the plugin for GIF reading support.
3457
 *  -qt-gif ............ Compile the plugin for GIF reading support.
3458
                         See also src/plugins/imageformats/gif/qgifhandler.h
3459
3460
    -no-libtiff ........ Do not compile the plugin for TIFF support.
3461
    -qt-libtiff ........ Use the libtiff bundled with Qt.
3462
 +  -system-libtiff .... Use libtiff from the operating system.
3463
                         See http://www.libtiff.org
3464
3465
    -no-libpng ......... Do not compile in PNG support.
3466
    -qt-libpng ......... Use the libpng bundled with Qt.
3467
 +  -system-libpng ..... Use libpng from the operating system.
3468
                         See http://www.libpng.org/pub/png
3469
3470
    -no-libmng ......... Do not compile the plugin for MNG support.
3471
    -qt-libmng ......... Use the libmng bundled with Qt.
3472
 +  -system-libmng ..... Use libmng from the operating system.
3473
                         See http://www.libmng.com
3474
3475
    -no-libjpeg ........ Do not compile the plugin for JPEG support.
3476
    -qt-libjpeg ........ Use the libjpeg bundled with Qt.
3477
 +  -system-libjpeg .... Use libjpeg from the operating system.
3478
                         See http://www.ijg.org
3479
3480
    -no-openssl ........ Do not compile support for OpenSSL.
3481
 +  -openssl ........... Enable run-time OpenSSL support.
3482
    -openssl-linked .... Enabled linked OpenSSL support.
3483
3484
    -ptmalloc .......... Override the system memory allocator with ptmalloc.
3485
                         (Experimental.)
3486
3487
Additional options:
3488
3489
    -make <part> ....... Add part to the list of parts to be built at make time.
3490
                         ($QT_DEFAULT_BUILD_PARTS)
3491
    -nomake <part> ..... Exclude part from the list of parts to be built.
3492
3493
    -R <string> ........ Add an explicit runtime library path to the Qt
3494
                         libraries.
3495
    -l <string> ........ Add an explicit library.
3496
3497
    -no-rpath .......... Do not use the library install path as a runtime
3498
                         library path.
3499
 +  -rpath ............. Link Qt libraries and executables using the library
3500
                         install path as a runtime library path. Equivalent
3501
                         to -R install_libpath
3502
3503
    -continue .......... Continue as far as possible if an error occurs.
3504
3505
    -verbose, -v ....... Print verbose information about each step of the
3506
                         configure process.
3507
3508
    -silent ............ Reduce the build output so that warnings and errors
3509
                         can be seen more easily.
3510
3511
 *  -no-optimized-qmake ... Do not build qmake optimized.
3512
    -optimized-qmake ...... Build qmake optimized.
3513
3514
 $NSN  -no-nis ............ Do not compile NIS support.
3515
 $NSY  -nis ............... Compile NIS support.
3516
3517
 $CUN  -no-cups ........... Do not compile CUPS support.
3518
 $CUY  -cups .............. Compile CUPS support.
3519
                         Requires cups/cups.h and libcups.so.2.
3520
3521
 $CIN  -no-iconv .......... Do not compile support for iconv(3).
3522
 $CIY  -iconv ............. Compile support for iconv(3).
3523
3524
 $PHN  -no-pch ............ Do not use precompiled header support.
3525
 $PHY  -pch ............... Use precompiled header support.
3526
3527
 $DBN  -no-dbus ........... Do not compile the QtDBus module.
3528
 $DBY  -dbus .............. Compile the QtDBus module and dynamically load libdbus-1.
3529
    -dbus-linked ....... Compile the QtDBus module and link to libdbus-1.
3530
3531
    -reduce-relocations ..... Reduce relocations in the libraries through extra
3532
                              linker optimizations (Qt/X11 and Qt for Embedded Linux only;
3533
                              experimental; needs GNU ld >= 2.18).
3534
EOF
3535
3536
if [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
3537
    if [ "$QT_CROSS_COMPILE" = "yes" ]; then
3538
        SBY=""
3539
        SBN="*"
3540
    else
3541
        SBY="*"
3542
        SBN=" "
3543
    fi
3544
elif [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
3545
    SBY="*"
3546
    SBN=" "
3547
else
3548
    SBY=" "
3549
    SBN="*"
3550
fi
3551
3552
if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then
3553
3554
    cat << EOF
3555
3556
 $SBN  -no-separate-debug-info . Do not store debug information in a separate file.
3557
 $SBY  -separate-debug-info .... Strip debug information into a separate .debug file.
3558
3559
EOF
3560
3561
fi # X11/QWS
3562
3563
if [ "$PLATFORM_X11" = "yes" ]; then
3564
    if [ "$CFG_SM" = "no" ]; then
3565
        SMY=" "
3566
        SMN="*"
3567
    else
3568
        SMY="*"
3569
        SMN=" "
3570
    fi
3571
    if [ "$CFG_XSHAPE" = "no" ]; then
3572
        SHY=" "
3573
        SHN="*"
3574
    else
3575
        SHY="*"
3576
        SHN=" "
3577
    fi
3578
    if [ "$CFG_XINERAMA" = "no" ]; then
3579
        XAY=" "
3580
        XAN="*"
3581
    else
3582
        XAY="*"
3583
        XAN=" "
3584
    fi
3585
    if [ "$CFG_FONTCONFIG" = "no" ]; then
3586
        FCGY=" "
3587
        FCGN="*"
3588
    else
3589
        FCGY="*"
3590
        FCGN=" "
3591
    fi
3592
    if [ "$CFG_XCURSOR" = "no" ]; then
3593
        XCY=" "
3594
        XCN="*"
3595
    else
3596
        XCY="*"
3597
        XCN=" "
3598
    fi
3599
    if [ "$CFG_XFIXES" = "no" ]; then
3600
        XFY=" "
3601
        XFN="*"
3602
    else
3603
        XFY="*"
3604
        XFN=" "
3605
    fi
3606
    if [ "$CFG_XRANDR" = "no" ]; then
3607
        XZY=" "
3608
        XZN="*"
3609
    else
3610
        XZY="*"
3611
        XZN=" "
3612
    fi
3613
    if [ "$CFG_XRENDER" = "no" ]; then
3614
        XRY=" "
3615
        XRN="*"
3616
    else
3617
        XRY="*"
3618
        XRN=" "
3619
    fi
3620
    if [ "$CFG_MITSHM" = "no" ]; then
3621
        XMY=" "
3622
        XMN="*"
3623
    else
3624
        XMY="*"
3625
        XMN=" "
3626
    fi
3627
    if [ "$CFG_XINPUT" = "no" ]; then
3628
        XIY=" "
3629
        XIN="*"
3630
    else
3631
        XIY="*"
3632
        XIN=" "
3633
    fi
3634
    if [ "$CFG_XKB" = "no" ]; then
3635
        XKY=" "
3636
        XKN="*"
3637
    else
3638
        XKY="*"
3639
        XKN=" "
3640
    fi
3641
    if [ "$CFG_IM" = "no" ]; then
3642
        IMY=" "
3643
        IMN="*"
3644
    else
3645
        IMY="*"
3646
        IMN=" "
3647
    fi
3648
    cat << EOF
3649
3650
Qt/X11 only:
3651
3652
    -no-gtkstyle ....... Do not build the GTK theme integration.
3653
 +  -gtkstyle .......... Build the GTK theme integration.
3654
3655
 *  -no-nas-sound ...... Do not compile in NAS sound support.
3656
    -system-nas-sound .. Use NAS libaudio from the operating system.
3657
                         See http://radscan.com/nas.html
3658
3659
    -no-opengl ......... Do not support OpenGL.
3660
 +  -opengl <api> ...... Enable OpenGL support.
3661
                         With no parameter, this will auto-detect the "best"
3662
                         OpenGL API to use. If desktop OpenGL is avaliable, it
3663
                         will be used. Use desktop, es1, es1cl or es2 for <api>
3664
                         to force the use of the Desktop (OpenGL 1.x or 2.x),
3665
                         OpenGL ES 1.x Common profile, 1.x Common Lite profile
3666
                         or 2.x APIs instead. On X11, the EGL API will be used
3667
                         to manage GL contexts in the case of OpenGL ES
3668
3669
     -no-openvg ........ Do not support OpenVG.
3670
 +   -openvg ........... Enable OpenVG support.
3671
                         Requires EGL support, typically supplied by an OpenGL
3672
                         or other graphics implementation.
3673
3674
 $SMN  -no-sm ............. Do not support X Session Management.
3675
 $SMY  -sm ................ Support X Session Management, links in -lSM -lICE.
3676
3677
 $SHN  -no-xshape ......... Do not compile XShape support.
3678
 $SHY  -xshape ............ Compile XShape support.
3679
                         Requires X11/extensions/shape.h.
3680
3681
 $SHN  -no-xsync .......... Do not compile XSync support.
3682
 $SHY  -xsync ............. Compile XSync support.
3683
                         Requires X11/extensions/sync.h.
3684
3685
 $XAN  -no-xinerama ....... Do not compile Xinerama (multihead) support.
3686
 $XAY  -xinerama .......... Compile Xinerama support.
3687
                         Requires X11/extensions/Xinerama.h and libXinerama.
3688
			 By default, Xinerama support will be compiled if
3689
                         available and the shared libraries are dynamically
3690
                         loaded at runtime.
3691
3692
 $XCN  -no-xcursor ........ Do not compile Xcursor support.
3693
 $XCY  -xcursor ........... Compile Xcursor support.
3694
                         Requires X11/Xcursor/Xcursor.h and libXcursor.
3695
			 By default, Xcursor support will be compiled if
3696
                         available and the shared libraries are dynamically
3697
                         loaded at runtime.
3698
3699
 $XFN  -no-xfixes ......... Do not compile Xfixes support.
3700
 $XFY  -xfixes ............ Compile Xfixes support.
3701
                         Requires X11/extensions/Xfixes.h and libXfixes.
3702
			 By default, Xfixes support will be compiled if
3703
                         available and the shared libraries are dynamically
3704
                         loaded at runtime.
3705
3706
 $XZN  -no-xrandr ......... Do not compile Xrandr (resize and rotate) support.
3707
 $XZY  -xrandr ............ Compile Xrandr support.
3708
                         Requires X11/extensions/Xrandr.h and libXrandr.
3709
3710
 $XRN  -no-xrender ........ Do not compile Xrender support.
3711
 $XRY  -xrender ........... Compile Xrender support.
3712
                         Requires X11/extensions/Xrender.h and libXrender.
3713
3714
 $XMN  -no-mitshm ......... Do not compile MIT-SHM support.
3715
 $XMY  -mitshm ............ Compile MIT-SHM support.
3716
                         Requires sys/ipc.h, sys/shm.h and X11/extensions/XShm.h
3717
3718
 $FCGN  -no-fontconfig ..... Do not compile FontConfig (anti-aliased font) support.
3719
 $FCGY  -fontconfig ........ Compile FontConfig support.
3720
                         Requires fontconfig/fontconfig.h, libfontconfig,
3721
                         freetype.h and libfreetype.
3722
3723
 $XIN  -no-xinput.......... Do not compile Xinput support.
3724
 $XIY  -xinput ............ Compile Xinput support. This also enabled tablet support
3725
                         which requires IRIX with wacom.h and libXi or
3726
                         XFree86 with X11/extensions/XInput.h and libXi.
3727
3728
 $XKN  -no-xkb ............ Do not compile XKB (X KeyBoard extension) support.
3729
 $XKY  -xkb ............... Compile XKB support.
3730
3731
EOF
3732
fi
3733
3734
if [ "$PLATFORM_MAC" = "yes" ]; then
3735
    cat << EOF
3736
3737
Qt/Mac only:
3738
3739
    -Fstring ........... Add an explicit framework path.
3740
    -fw string ......... Add an explicit framework.
3741
3742
    -cocoa ............. Build the Cocoa version of Qt. Note that -no-framework
3743
                         and -static is not supported with -cocoa. Specifying
3744
                         this option creates Qt binaries that requires Mac OS X
3745
                         10.5 or higher.
3746
3747
 *  -framework ......... Build Qt as a series of frameworks and
3748
                         link tools against those frameworks.
3749
    -no-framework ...... Do not build Qt as a series of frameworks.
3750
3751
 *  -dwarf2 ............ Enable dwarf2 debugging symbols.
3752
    -no-dwarf2 ......... Disable dwarf2 debugging symbols.
3753
3754
    -universal ......... Equivalent to -arch "ppc x86"
3755
3756
    -arch <arch> ....... Build Qt for <arch>
3757
                         Example values for <arch>: x86 ppc x86_64 ppc64
3758
                         Multiple -arch arguments can be specified, 64-bit archs
3759
                         will be built with the Cocoa framework.
3760
3761
    -sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. This option requires gcc 4.
3762
                         To use a different SDK with gcc 3.3, set the SDKROOT environment variable.
3763
3764
EOF
3765
fi
3766
3767
if [ "$PLATFORM_QWS" = "yes" ]; then
3768
    cat << EOF
3769
3770
Qt for Embedded Linux only:
3771
3772
    -xplatform target ... The target platform when cross-compiling.
3773
3774
    -no-feature-<feature> Do not compile in <feature>.
3775
    -feature-<feature> .. Compile in <feature>. The available features
3776
                          are described in src/corelib/global/qfeatures.txt
3777
3778
    -embedded <arch> .... This will enable the embedded build, you must have a
3779
                          proper license for this switch to work.
3780
                          Example values for <arch>: arm mips x86 generic
3781
3782
    -armfpa ............. Target platform uses the ARM-FPA floating point format.
3783
    -no-armfpa .......... Target platform does not use the ARM-FPA floating point format.
3784
3785
                          The floating point format is usually autodetected by configure. Use this
3786
                          to override the detected value.
3787
3788
    -little-endian ...... Target platform is little endian (LSB first).
3789
    -big-endian ......... Target platform is big endian (MSB first).
3790
3791
    -host-little-endian . Host platform is little endian (LSB first).
3792
    -host-big-endian .... Host platform is big endian (MSB first).
3793
3794
                          You only need to specify the endianness when
3795
                          cross-compiling, otherwise the host
3796
                          endianness will be used.
3797
3798
    -no-freetype ........ Do not compile in Freetype2 support.
3799
    -qt-freetype ........ Use the libfreetype bundled with Qt.
3800
 *  -system-freetype .... Use libfreetype from the operating system.
3801
                          See http://www.freetype.org/
3802
3803
    -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the
3804
                          default ($CFG_QCONFIG).
3805
3806
    -depths <list> ...... Comma-separated list of supported bit-per-pixel
3807
                          depths, from: 1, 4, 8, 12, 15, 16, 18, 24, 32 and 'all'.
3808
3809
    -qt-decoration-<style> ....Enable a decoration <style> in the QtGui library,
3810
                               by default all available decorations are on.
3811
			       Possible values for <style>: [ $CFG_DECORATION_AVAILABLE ]
3812
    -plugin-decoration-<style> Enable decoration <style> as a plugin to be
3813
                               linked to at run time.
3814
			       Possible values for <style>: [ $CFG_DECORATION_PLUGIN_AVAILABLE ]
3815
    -no-decoration-<style> ....Disable decoration <style> entirely.
3816
                               Possible values for <style>: [ $CFG_DECORATION_AVAILABLE ]
3817
3818
    -no-opengl .......... Do not support OpenGL.
3819
    -opengl <api> ....... Enable OpenGL ES support
3820
                          With no parameter, this will attempt to auto-detect OpenGL ES 1.x
3821
                          or 2.x. Use es1, es1cl or es2 for <api> to override auto-detection.
3822
3823
                          NOTE: A QGLScreen driver for the hardware is required to support
3824
                                OpenGL ES on Qt for Embedded Linux.
3825
3826
    -qt-gfx-<driver> ... Enable a graphics <driver> in the QtGui library.
3827
                         Possible values for <driver>: [ $CFG_GFX_AVAILABLE ]
3828
    -plugin-gfx-<driver> Enable graphics <driver> as a plugin to be
3829
                         linked to at run time.
3830
                         Possible values for <driver>: [ $CFG_GFX_PLUGIN_AVAILABLE ]
3831
    -no-gfx-<driver> ... Disable graphics <driver> entirely.
3832
                         Possible values for <driver>: [ $CFG_GFX_AVAILABLE ]
3833
3834
    -qt-kbd-<driver> ... Enable a keyboard <driver> in the QtGui library.
3835
                         Possible values for <driver>: [ $CFG_KBD_AVAILABLE ]
3836
3837
    -plugin-kbd-<driver> Enable keyboard <driver> as a plugin to be linked to
3838
                         at runtime.
3839
                         Possible values for <driver>: [ $CFG_KBD_PLUGIN_AVAILABLE ]
3840
3841
    -no-kbd-<driver> ... Disable keyboard <driver> entirely.
3842
                         Possible values for <driver>: [ $CFG_KBD_AVAILABLE ]
3843
3844
    -qt-mouse-<driver> ... Enable a mouse <driver> in the QtGui library.
3845
                           Possible values for <driver>: [ $CFG_MOUSE_AVAILABLE ]
3846
    -plugin-mouse-<driver> Enable mouse <driver> as a plugin to be linked to
3847
                           at runtime.
3848
                           Possible values for <driver>: [ $CFG_MOUSE_PLUGIN_AVAILABLE ]
3849
    -no-mouse-<driver> ... Disable mouse <driver> entirely.
3850
                           Possible values for <driver>: [ $CFG_MOUSE_AVAILABLE ]
3851
3852
    -iwmmxt ............ Compile using the iWMMXt instruction set
3853
                         (available on some XScale CPUs).
3854
3855
EOF
3856
fi
3857
3858
3859
if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_X11" = "yes" ]; then
3860
    if [ "$CFG_GLIB" = "no" ]; then
3861
        GBY=" "
3862
        GBN="+"
3863
    else
3864
        GBY="+"
3865
        GBN=" "
3866
    fi
3867
    cat << EOF
3868
 $GBN  -no-glib ........... Do not compile Glib support.
3869
 $GBY  -glib .............. Compile Glib support.
3870
3871
EOF
3872
fi
3873
3874
   [ "x$ERROR" = "xyes" ] && exit 1
3875
   exit 0
3876
fi # Help
3877
3878
3879
# -----------------------------------------------------------------------------
3880
# LICENSING, INTERACTIVE PART
3881
# -----------------------------------------------------------------------------
3882
3883
if [ "$PLATFORM_QWS" = "yes" ]; then
3884
    Platform="Qt for Embedded Linux"
3885
elif [ "$PLATFORM_MAC" = "yes" ]; then
3886
    Platform="Qt/Mac"
3887
else
3888
    PLATFORM_X11=yes
3889
    Platform="Qt/X11"
3890
fi
3891
3892
echo
3893
echo "This is the $Platform ${EditionString} Edition."
3894
echo
3895
3896
if [ "$Edition" = "NokiaInternalBuild" ]; then
3897
    echo "Detected -nokia-developer option"
3898
    echo "Nokia employees and agents are allowed to use this software under"
3899
    echo "the authority of Nokia Corporation and/or its subsidiary(-ies)"
3900
elif [ "$Edition" = "OpenSource" ]; then
3901
    while true; do
3902
        echo "You are licensed to use this software under the terms of"
3903
        echo "the Lesser GNU General Public License (LGPL) versions 2.1."
3904
        if [ -f "$relpath/LICENSE.GPL3" ]; then
3905
            echo "You are also licensed to use this software under the terms of"
3906
            echo "the GNU General Public License (GPL) versions 3."
3907
            affix="either"
3908
        else
3909
            affix="the"
3910
        fi
3911
        echo
3912
        if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
3913
            echo "You have already accepted the terms of the $LicenseType license."
3914
            acceptance=yes
3915
        else
3916
            if [ -f "$relpath/LICENSE.GPL3" ]; then
3917
                echo "Type '3' to view the GNU General Public License version 3."
3918
            fi
3919
            echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
3920
            echo "Type 'yes' to accept this license offer."
3921
            echo "Type 'no' to decline this license offer."
3922
            echo
3923
            if echo '\c' | grep '\c' >/dev/null; then
3924
                echo -n "Do you accept the terms of $affix license? "
3925
            else
3926
                echo "Do you accept the terms of $affix license? \c"
3927
            fi
3928
            read acceptance
3929
        fi
3930
        echo
3931
        if [ "$acceptance" = "yes" ] || [ "$acceptance" = "y" ]; then
3932
            break
3933
        elif [ "$acceptance" = "no" ]; then
3934
            echo "You are not licensed to use this software."
3935
            echo
3936
            exit 1
3937
        elif [ "$acceptance" = "3" ]; then
3938
            more "$relpath/LICENSE.GPL3"
3939
        elif [ "$acceptance" = "L" ]; then
3940
            more "$relpath/LICENSE.LGPL"
3941
        fi
3942
    done
3943
elif [ "$Edition" = "Preview" ]; then
3944
    TheLicense=`head -n 1 "$relpath/LICENSE.PREVIEW.COMMERCIAL"`
3945
    while true; do
3946
3947
        if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
3948
            echo "You have already accepted the terms of the $LicenseType license."
3949
            acceptance=yes
3950
        else
3951
            echo "You are licensed to use this software under the terms of"
3952
            echo "the $TheLicense"
3953
            echo
3954
            echo "Type '?' to read the Preview License."
3955
            echo "Type 'yes' to accept this license offer."
3956
            echo "Type 'no' to decline this license offer."
3957
            echo
3958
            if echo '\c' | grep '\c' >/dev/null; then
3959
                echo -n "Do you accept the terms of the license? "
3960
            else
3961
                echo "Do you accept the terms of the license? \c"
3962
            fi
3963
            read acceptance
3964
        fi
3965
        echo
3966
        if [ "$acceptance" = "yes" ]; then
3967
            break
3968
        elif [ "$acceptance" = "no" ] ;then
3969
            echo "You are not licensed to use this software."
3970
            echo
3971
            exit 0
3972
        elif [ "$acceptance" = "?" ]; then
3973
            more "$relpath/LICENSE.PREVIEW.COMMERCIAL"
3974
        fi
3975
    done
3976
elif [ "$Edition" != "OpenSource" ]; then
3977
    if [ -n "$ExpiryDate" ]; then
3978
        ExpiryDate=`echo $ExpiryDate | sed -e "s,-,,g" | tr -d "\n\r"`
3979
        [ -z "$ExpiryDate" ] && ExpiryDate="0"
3980
        Today=`date +%Y%m%d`
3981
        if [ "$Today" -gt "$ExpiryDate" ]; then
3982
            case "$LicenseType" in
3983
            Commercial|Academic|Educational)
3984
                if [ "$QT_PACKAGEDATE" -gt "$ExpiryDate" ]; then
3985
                    echo
3986
                    echo "NOTICE  NOTICE  NOTICE  NOTICE"
3987
                    echo
3988
                    echo "  Your support and upgrade period has expired."
3989
                    echo
3990
                    echo "  You are no longer licensed to use this version of Qt."
3991
                    echo "  Please contact qt-info@nokia.com to renew your support"
3992
                    echo "  and upgrades for this license."
3993
                    echo
3994
                    echo "NOTICE  NOTICE  NOTICE  NOTICE"
3995
                    echo
3996
                    exit 1
3997
                else
3998
                    echo
3999
                    echo "WARNING  WARNING  WARNING  WARNING"
4000
                    echo
4001
                    echo "  Your support and upgrade period has expired."
4002
                    echo
4003
                    echo "  You may continue to use your last licensed release"
4004
                    echo "  of Qt under the terms of your existing license"
4005
                    echo "  agreement. But you are not entitled to technical"
4006
                    echo "  support, nor are you entitled to use any more recent"
4007
                    echo "  Qt releases."
4008
                    echo
4009
                    echo "  Please contact qt-info@nokia.com to renew your"
4010
                    echo "  support and upgrades for this license."
4011
                    echo
4012
                    echo "WARNING  WARNING  WARNING  WARNING"
4013
                    echo
4014
                    sleep 3
4015
                fi
4016
                ;;
4017
            Evaluation|*)
4018
                echo
4019
                echo "NOTICE  NOTICE  NOTICE  NOTICE"
4020
                echo
4021
                echo "  Your Evaluation license has expired."
4022
                echo
4023
                echo "  You are no longer licensed to use this software. Please"
4024
                echo "  contact qt-info@nokia.com to purchase license, or install"
4025
                echo "  the Qt Open Source Edition if you intend to develop free"
4026
                echo "  software."
4027
                echo
4028
                echo "NOTICE  NOTICE  NOTICE  NOTICE"
4029
                echo
4030
                exit 1
4031
                ;;
4032
            esac
4033
        fi
4034
    fi
4035
    TheLicense=`head -n 1 "$outpath/LICENSE"`
4036
    while true; do
4037
        if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
4038
	    echo "You have already accepted the terms of the $TheLicense."
4039
            acceptance=yes
4040
        else
4041
            echo "You are licensed to use this software under the terms of"
4042
            echo "the $TheLicense."
4043
            echo
4044
            echo "Type '?' to view the $TheLicense."
4045
            echo "Type 'yes' to accept this license offer."
4046
            echo "Type 'no' to decline this license offer."
4047
            echo
4048
            if echo '\c' | grep '\c' >/dev/null; then
4049
                echo -n "Do you accept the terms of the $TheLicense? "
4050
            else
4051
                echo "Do you accept the terms of the $TheLicense? \c"
4052
            fi
4053
            read acceptance
4054
        fi
4055
        echo
4056
        if [ "$acceptance" = "yes" ]; then
4057
            break
4058
        elif [ "$acceptance" = "no" ]; then
4059
            echo "You are not licensed to use this software."
4060
            echo
4061
            exit 1
4062
        else [ "$acceptance" = "?" ]
4063
            more "$outpath/LICENSE"
4064
        fi
4065
    done
4066
fi
4067
4068
# this should be moved somewhere else
4069
case "$PLATFORM" in
4070
aix-*)
4071
    AIX_VERSION=`uname -v`
4072
    if [ "$AIX_VERSION" -lt "5" ]; then
4073
	QMakeVar add QMAKE_LIBS_X11 -lbind
4074
    fi
4075
    ;;
4076
*)
4077
    ;;
4078
esac
4079
4080
#-------------------------------------------------------------------------------
4081
# generate qconfig.cpp
4082
#-------------------------------------------------------------------------------
4083
[ -d "$outpath/src/corelib/global" ] || mkdir -p "$outpath/src/corelib/global"
4084
4085
LICENSE_USER_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_lcnsuser=$Licensee"`
4086
LICENSE_PRODUCTS_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_lcnsprod=$Edition"`
4087
PREFIX_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_prfxpath=$QT_INSTALL_PREFIX"`
4088
DOCUMENTATION_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_docspath=$QT_INSTALL_DOCS"`
4089
HEADERS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_hdrspath=$QT_INSTALL_HEADERS"`
4090
LIBRARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_libspath=$QT_INSTALL_LIBS"`
4091
BINARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_binspath=$QT_INSTALL_BINS"`
4092
PLUGINS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_plugpath=$QT_INSTALL_PLUGINS"`
4093
DATA_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_datapath=$QT_INSTALL_DATA"`
4094
TRANSLATIONS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_trnspath=$QT_INSTALL_TRANSLATIONS"`
4095
SETTINGS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_stngpath=$QT_INSTALL_SETTINGS"`
4096
EXAMPLES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_xmplpath=$QT_INSTALL_EXAMPLES"`
4097
DEMOS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_demopath=$QT_INSTALL_DEMOS"`
4098
4099
TODAY=`date +%Y-%m-%d`
4100
cat > "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
4101
/* License Info */
4102
static const char qt_configure_licensee_str          [256 + 12] = "$LICENSE_USER_STR";
4103
static const char qt_configure_licensed_products_str [256 + 12] = "$LICENSE_PRODUCTS_STR";
4104
4105
/* Installation date */
4106
static const char qt_configure_installation          [12+11]    = "qt_instdate=$TODAY";
4107
EOF
4108
4109
4110
if [ ! -z "$QT_HOST_PREFIX" ]; then
4111
    HOSTPREFIX_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_prfxpath=$QT_HOST_PREFIX"`
4112
    HOSTDOCUMENTATION_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_docspath=$QT_HOST_PREFIX/doc"`
4113
    HOSTHEADERS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_hdrspath=$QT_HOST_PREFIX/include"`
4114
    HOSTLIBRARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_libspath=$QT_HOST_PREFIX/lib"`
4115
    HOSTBINARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_binspath=$QT_HOST_PREFIX/bin"`
4116
    HOSTPLUGINS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_plugpath=$QT_HOST_PREFIX/plugins"`
4117
    HOSTDATA_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_datapath=$QT_HOST_PREFIX"`
4118
    HOSTTRANSLATIONS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_trnspath=$QT_HOST_PREFIX/translations"`
4119
    HOSTSETTINGS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_stngpath=$QT_INSTALL_SETTINGS"`
4120
    HOSTEXAMPLES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_xmplpath=$QT_INSTALL_EXAMPLES"`
4121
    HOSTDEMOS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_demopath=$QT_INSTALL_DEMOS"`
4122
4123
    cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
4124
4125
#if defined(QT_BOOTSTRAPPED) || defined(QT_BUILD_QMAKE)
4126
/* Installation Info */
4127
static const char qt_configure_prefix_path_str       [256 + 12] = "$HOSTPREFIX_PATH_STR";
4128
static const char qt_configure_documentation_path_str[256 + 12] = "$HOSTDOCUMENTATION_PATH_STR";
4129
static const char qt_configure_headers_path_str      [256 + 12] = "$HOSTHEADERS_PATH_STR";
4130
static const char qt_configure_libraries_path_str    [256 + 12] = "$HOSTLIBRARIES_PATH_STR";
4131
static const char qt_configure_binaries_path_str     [256 + 12] = "$HOSTBINARIES_PATH_STR";
4132
static const char qt_configure_plugins_path_str      [256 + 12] = "$HOSTPLUGINS_PATH_STR";
4133
static const char qt_configure_data_path_str         [256 + 12] = "$HOSTDATA_PATH_STR";
4134
static const char qt_configure_translations_path_str [256 + 12] = "$HOSTTRANSLATIONS_PATH_STR";
4135
static const char qt_configure_settings_path_str     [256 + 12] = "$HOSTSETTINGS_PATH_STR";
4136
static const char qt_configure_examples_path_str     [256 + 12] = "$HOSTEXAMPLES_PATH_STR";
4137
static const char qt_configure_demos_path_str        [256 + 12] = "$HOSTDEMOS_PATH_STR";
4138
#else // QT_BOOTSTRAPPED
4139
EOF
4140
fi
4141
4142
cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
4143
/* Installation Info */
4144
static const char qt_configure_prefix_path_str       [256 + 12] = "$PREFIX_PATH_STR";
4145
static const char qt_configure_documentation_path_str[256 + 12] = "$DOCUMENTATION_PATH_STR";
4146
static const char qt_configure_headers_path_str      [256 + 12] = "$HEADERS_PATH_STR";
4147
static const char qt_configure_libraries_path_str    [256 + 12] = "$LIBRARIES_PATH_STR";
4148
static const char qt_configure_binaries_path_str     [256 + 12] = "$BINARIES_PATH_STR";
4149
static const char qt_configure_plugins_path_str      [256 + 12] = "$PLUGINS_PATH_STR";
4150
static const char qt_configure_data_path_str         [256 + 12] = "$DATA_PATH_STR";
4151
static const char qt_configure_translations_path_str [256 + 12] = "$TRANSLATIONS_PATH_STR";
4152
static const char qt_configure_settings_path_str     [256 + 12] = "$SETTINGS_PATH_STR";
4153
static const char qt_configure_examples_path_str     [256 + 12] = "$EXAMPLES_PATH_STR";
4154
static const char qt_configure_demos_path_str        [256 + 12] = "$DEMOS_PATH_STR";
4155
EOF
4156
4157
if [ ! -z "$QT_HOST_PREFIX" ]; then
4158
    cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
4159
#endif // QT_BOOTSTRAPPED
4160
4161
EOF
4162
fi
4163
4164
cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
4165
/* strlen( "qt_lcnsxxxx" ) == 12 */
4166
#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;
4167
#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;
4168
#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12;
4169
#define QT_CONFIGURE_DOCUMENTATION_PATH qt_configure_documentation_path_str + 12;
4170
#define QT_CONFIGURE_HEADERS_PATH qt_configure_headers_path_str + 12;
4171
#define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;
4172
#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;
4173
#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;
4174
#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;
4175
#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;
4176
#define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;
4177
#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;
4178
#define QT_CONFIGURE_DEMOS_PATH qt_configure_demos_path_str + 12;
4179
EOF
4180
4181
# avoid unecessary rebuilds by copying only if qconfig.cpp has changed
4182
if cmp -s "$outpath/src/corelib/global/qconfig.cpp" "$outpath/src/corelib/global/qconfig.cpp.new"; then
4183
    rm -f "$outpath/src/corelib/global/qconfig.cpp.new"
4184
else
4185
    [ -f "$outpath/src/corelib/global/qconfig.cpp" ] && chmod +w "$outpath/src/corelib/global/qconfig.cpp"
4186
    mv "$outpath/src/corelib/global/qconfig.cpp.new" "$outpath/src/corelib/global/qconfig.cpp"
4187
    chmod -w "$outpath/src/corelib/global/qconfig.cpp"
4188
fi
4189
4190
# -----------------------------------------------------------------------------
4191
if [ "$LicenseType" = "Evaluation" ]; then
4192
    EVALKEY=`"$relpath/config.tests/unix/padstring" 524 "qt_qevalkey=$LicenseKeyExt"`
4193
elif echo "$D_FLAGS" | grep QT_EVAL >/dev/null 2>&1; then
4194
    EVALKEY=`"$relpath/config.tests/unix/padstring" 524 "qt_qevalkey="`
4195
fi
4196
4197
if [ -n "$EVALKEY" ]; then
4198
    rm -f "$outpath/src/corelib/global/qconfig_eval.cpp"
4199
    cat > "$outpath/src/corelib/global/qconfig_eval.cpp" <<EOF
4200
/* Evaluation license key */
4201
static const char qt_eval_key_data                   [512 + 12] = "$EVALKEY";
4202
EOF
4203
    chmod -w "$outpath/src/corelib/global/qconfig_eval.cpp"
4204
fi
4205
4206
4207
# -----------------------------------------------------------------------------
4208
# build qmake
4209
# -----------------------------------------------------------------------------
4210
4211
# symlink includes
4212
if [ -n "$PERL" ] && [ -x "$relpath/bin/syncqt" ]; then
4213
    SYNCQT_OPTS=
4214
    [ "$CFG_DEV" = "yes" ] && SYNCQT_OPTS="$SYNCQT_OPTS -check-includes"
4215
    if [ "$OPT_SHADOW" = "yes" ]; then
4216
        "$outpath/bin/syncqt" $SYNCQT_OPTS
4217
    elif [ "$CFG_DEV" = "yes" ] || [ ! -d $relpath/include ]; then
4218
        QTDIR="$relpath" perl "$outpath/bin/syncqt" $SYNCQT_OPTS
4219
    fi
4220
fi
4221
4222
# $1: variable name
4223
# $2: optional transformation
4224
# relies on $QMAKESPEC, $COMPILER_CONF and $mkfile being set correctly, as the latter
4225
# is where the resulting variable is written to
4226
setBootstrapVariable()
4227
{
4228
    variableRegExp="^$1[^_A-Z0-9]"
4229
    getQMakeConf | grep "$variableRegExp" | ( [ -n "$2" ] && sed "$2" ; [ -z "$2" ] && cat ) | $AWK '
4230
{
4231
    varLength = index($0, "=") - 1
4232
    valStart = varLength + 2
4233
    if (substr($0, varLength, 1) == "+") {
4234
        varLength = varLength - 1
4235
        valStart = valStart + 1
4236
    }
4237
    var = substr($0, 0, varLength)
4238
    gsub("[ \t]+", "", var)
4239
    val = substr($0, valStart)
4240
    printf "%s_%s = %s\n", var, NR, val
4241
}
4242
END {
4243
    if (length(var) > 0) {
4244
        printf "%s =", var
4245
        for (i = 1; i <= NR; ++i)
4246
            printf " $(%s_%s)", var, i
4247
        printf "\n"
4248
    }
4249
}' >> "$mkfile"
4250
}
4251
4252
# build qmake
4253
if true; then ###[ '!' -f "$outpath/bin/qmake" ];
4254
    echo "Creating qmake. Please wait..."
4255
4256
    OLD_QCONFIG_H=
4257
    QCONFIG_H="$outpath/src/corelib/global/qconfig.h"
4258
    QMAKE_QCONFIG_H="${QCONFIG_H}.qmake"
4259
    if [ -f "$QCONFIG_H" ]; then
4260
         OLD_QCONFIG_H=$QCONFIG_H
4261
         mv -f "$OLD_QCONFIG_H" "${OLD_QCONFIG_H}.old"
4262
    fi
4263
4264
    # create temporary qconfig.h for compiling qmake, if it doesn't exist
4265
    # when building qmake, we use #defines for the install paths,
4266
    # however they are real functions in the library
4267
    if [ '!' -f "$QMAKE_QCONFIG_H" ]; then
4268
        mkdir -p "$outpath/src/corelib/global"
4269
        [ -f "$QCONFIG_H" ] && chmod +w "$QCONFIG_H"
4270
        echo "/* All features enabled while building qmake */" >"$QMAKE_QCONFIG_H"
4271
    fi
4272
4273
    mv -f "$QMAKE_QCONFIG_H" "$QCONFIG_H"
4274
    for conf in "$outpath/include/QtCore/qconfig.h" "$outpath/include/Qt/qconfig.h"; do
4275
        if [ '!' -f "$conf" ]; then
4276
            ln -s "$QCONFIG_H" "$conf"
4277
        fi
4278
    done
4279
4280
    #mkspecs/default is used as a (gasp!) default mkspec so QMAKESPEC needn't be set once configured
4281
    rm -f mkspecs/default
4282
    ln -s `echo $XQMAKESPEC | sed "s,^${relpath}/mkspecs/,,"` mkspecs/default
4283
    # fix makefiles
4284
    for mkfile in GNUmakefile Makefile; do
4285
        EXTRA_LFLAGS=
4286
        EXTRA_CFLAGS=
4287
        in_mkfile="${mkfile}.in"
4288
        if [ "$mkfile" = "Makefile" ]; then
4289
#           if which qmake >/dev/null 2>&1 && [ -f qmake/qmake.pro ]; then
4290
#               (cd qmake && qmake) >/dev/null 2>&1 && continue
4291
#           fi
4292
            in_mkfile="${mkfile}.unix"
4293
        fi
4294
        in_mkfile="$relpath/qmake/$in_mkfile"
4295
        mkfile="$outpath/qmake/$mkfile"
4296
        if [ -f "$mkfile" ]; then
4297
            [ "$CFG_DEV" = "yes" ] && "$WHICH" chflags >/dev/null 2>&1 && chflags nouchg "$mkfile"
4298
            rm -f "$mkfile"
4299
        fi
4300
        [ -f "$in_mkfile" ] || continue
4301
4302
        echo "########################################################################" > "$mkfile"
4303
        echo "## This file was autogenerated by configure, all changes will be lost ##" >> "$mkfile"
4304
        echo "########################################################################" >> "$mkfile"
4305
        EXTRA_OBJS=
4306
        EXTRA_SRCS=
4307
        EXTRA_CFLAGS="\$(QMAKE_CFLAGS)"
4308
        EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS)"
4309
        EXTRA_LFLAGS="\$(QMAKE_LFLAGS)"
4310
4311
        if [ "$PLATFORM" = "irix-cc" ] || [ "$PLATFORM" = "irix-cc-64" ]; then
4312
	    EXTRA_LFLAGS="$EXTRA_LFLAGS -lm"
4313
        fi
4314
4315
	[ -n "$CC" ] && echo "CC = $CC" >> "$mkfile"
4316
	[ -n "$CXX" ] && echo "CXX = $CXX" >> "$mkfile"
4317
        if [ "$CFG_SILENT" = "yes" ]; then
4318
            [ -z "$CC" ] && setBootstrapVariable QMAKE_CC 's,QMAKE_CC.*=,CC=\@,'
4319
            [ -z "$CXX" ] && setBootstrapVariable QMAKE_CXX 's,QMAKE_CXX.*=,CXX=\@,'
4320
        else
4321
            [ -z "$CC" ] && setBootstrapVariable QMAKE_CC 's,QMAKE_CC,CC,'
4322
            [ -z "$CXX" ] && setBootstrapVariable QMAKE_CXX 's,QMAKE_CXX,CXX,'
4323
        fi
4324
        setBootstrapVariable QMAKE_CFLAGS
4325
        setBootstrapVariable QMAKE_CXXFLAGS 's,\$\$QMAKE_CFLAGS,\$(QMAKE_CFLAGS),'
4326
        setBootstrapVariable QMAKE_LFLAGS
4327
4328
        if [ $QT_EDITION = "QT_EDITION_OPENSOURCE" ]; then
4329
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DQMAKE_OPENSOURCE_EDITION"
4330
            EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -DQMAKE_OPENSOURCE_EDITION"
4331
        fi
4332
        if [ "$CFG_RELEASE_QMAKE" = "yes" ]; then
4333
            setBootstrapVariable QMAKE_CFLAGS_RELEASE
4334
            setBootstrapVariable QMAKE_CXXFLAGS_RELEASE 's,\$\$QMAKE_CFLAGS_RELEASE,\$(QMAKE_CFLAGS_RELEASE),'
4335
            EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_RELEASE)"
4336
            EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_RELEASE)"
4337
        elif [ "$CFG_DEBUG" = "yes" ]; then
4338
            setBootstrapVariable QMAKE_CFLAGS_DEBUG
4339
            setBootstrapVariable QMAKE_CXXFLAGS_DEBUG 's,\$\$QMAKE_CFLAGS_DEBUG,\$(QMAKE_CFLAGS_DEBUG),'
4340
            EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_DEBUG)"
4341
            EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_DEBUG)"
4342
        fi
4343
4344
	if [ '!' -z "$RPATH_FLAGS" ] && [ '!' -z "`getQMakeConf \"$QMAKESPEC\" | grep QMAKE_RPATH | awk '{print $3;}'`" ]; then
4345
  	    setBootstrapVariable QMAKE_RPATH 's,\$\$LITERAL_WHITESPACE, ,'
4346
	    for rpath in $RPATH_FLAGS; do
4347
		EXTRA_LFLAGS="\$(QMAKE_RPATH)\"$rpath\" $EXTRA_LFLAGS"
4348
            done
4349
        fi
4350
        if [ "$PLATFORM_MAC" = "yes" ]; then
4351
            echo "export MACOSX_DEPLOYMENT_TARGET = 10.4" >> "$mkfile"
4352
            echo "CARBON_LFLAGS =-framework ApplicationServices" >>"$mkfile"
4353
            echo "CARBON_CFLAGS =-fconstant-cfstrings" >>"$mkfile"
4354
            EXTRA_LFLAGS="$EXTRA_LFLAGS \$(CARBON_LFLAGS)"
4355
            EXTRA_CFLAGS="$EXTRA_CFLAGS \$(CARBON_CFLAGS)"
4356
            EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(CARBON_CFLAGS)"
4357
            EXTRA_OBJS="qsettings_mac.o qcore_mac.o"
4358
            EXTRA_SRCS="\"$relpath/src/corelib/io/qsettings_mac.cpp\" \"$relpath/src/corelib/kernel/qcore_mac.cpp\""
4359
	    if echo "$CFG_MAC_ARCHS" | grep x86 > /dev/null 2>&1; then # matches both x86 and x86_64
4360
		X86_CFLAGS="-arch i386"
4361
		X86_LFLAGS="-arch i386"
4362
		EXTRA_CFLAGS="$X86_CFLAGS $EXTRA_CFLAGS"
4363
		EXTRA_CXXFLAGS="$X86_CFLAGS $EXTRA_CXXFLAGS"
4364
                EXTRA_LFLAGS="$EXTRA_LFLAGS $X86_LFLAGS"
4365
            fi
4366
	    if echo "$CFG_MAC_ARCHS" | grep ppc > /dev/null 2>&1; then # matches both ppc and ppc64
4367
		PPC_CFLAGS="-arch ppc"
4368
		PPC_LFLAGS="-arch ppc"
4369
		EXTRA_CFLAGS="$PPC_CFLAGS $EXTRA_CFLAGS"
4370
		EXTRA_CXXFLAGS="$PPC_CFLAGS $EXTRA_CXXFLAGS"
4371
                EXTRA_LFLAGS="$EXTRA_LFLAGS $PPC_LFLAGS"
4372
            fi
4373
	    if [ '!' -z "$CFG_SDK" ]; then
4374
		echo "SDK_LFLAGS =-Wl,-syslibroot,$CFG_SDK" >>"$mkfile"
4375
		echo "SDK_CFLAGS =-isysroot $CFG_SDK" >>"$mkfile"
4376
		EXTRA_CFLAGS="$EXTRA_CFLAGS \$(SDK_CFLAGS)"
4377
		EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(SDK_CFLAGS)"
4378
		EXTRA_LFLAGS="$EXTRA_LFLAGS \$(SDK_LFLAGS)"
4379
            fi
4380
        fi
4381
        [ "$CFG_EMBEDDED" != "no" ] && EXTRA_CFLAGS="$EXTRA_CFLAGS -DQWS"
4382
        if [ '!' -z "$D_FLAGS" ]; then
4383
            for DEF in $D_FLAGS; do
4384
                EXTRA_CFLAGS="$EXTRA_CFLAGS \"-D${DEF}\""
4385
            done
4386
        fi
4387
        QMAKE_BIN_DIR="$QT_INSTALL_BINS"
4388
        [ -z "$QMAKE_BIN_DIR" ] && QMAKE_BIN_DIR="${QT_INSTALL_PREFIX}/bin"
4389
        QMAKE_DATA_DIR="$QT_INSTALL_DATA"
4390
        [ -z "$QMAKE_DATA_DIR" ] && QMAKE_DATA_DIR="${QT_INSTALL_PREFIX}"
4391
        echo >>"$mkfile"
4392
	adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'`
4393
	adjoutpath=`echo "$outpath" | sed 's/ /\\\\\\\\ /g'`
4394
	adjqmakespec=`echo "$QMAKESPEC" | sed 's/ /\\\\\\\\ /g'`
4395
        sed -e "s,@SOURCE_PATH@,$adjrelpath,g" -e "s,@BUILD_PATH@,$adjoutpath,g" \
4396
            -e "s,@QMAKE_CFLAGS@,$EXTRA_CFLAGS,g" -e "s,@QMAKE_LFLAGS@,$EXTRA_LFLAGS,g" \
4397
            -e "s,@QMAKE_CXXFLAGS@,$EXTRA_CXXFLAGS,g" \
4398
            -e "s,@QT_INSTALL_BINS@,\$(INSTALL_ROOT)$QMAKE_BIN_DIR,g" \
4399
            -e "s,@QT_INSTALL_DATA@,\$(INSTALL_ROOT)$QMAKE_DATA_DIR,g" \
4400
            -e "s,@QMAKE_QTOBJS@,$EXTRA_OBJS,g" -e "s,@QMAKE_QTSRCS@,$EXTRA_SRCS,g" \
4401
	    -e "s,@QMAKESPEC@,$adjqmakespec,g" "$in_mkfile" >>"$mkfile"
4402
4403
        if "$WHICH" makedepend >/dev/null 2>&1 && grep 'depend:' "$mkfile" >/dev/null 2>&1; then
4404
            (cd "$outpath/qmake" && "$MAKE" -f "$mkfile" depend) >/dev/null 2>&1
4405
	    sed "s,^.*/\([^/]*.o\):,\1:,g" "$mkfile" >"$mkfile.tmp"
4406
	    sed "s,$outpath,$adjoutpath,g" "$mkfile.tmp" >"$mkfile"
4407
	    rm "$mkfile.tmp"
4408
        fi
4409
    done
4410
4411
    QMAKE_BUILD_ERROR=no
4412
    (cd "$outpath/qmake"; "$MAKE") || QMAKE_BUILD_ERROR=yes
4413
    [ '!' -z "$QCONFIG_H" ] && mv -f "$QCONFIG_H" "$QMAKE_QCONFIG_H" #move qmake's qconfig.h to qconfig.h.qmake
4414
    [ '!' -z "$OLD_QCONFIG_H" ] && mv -f "${OLD_QCONFIG_H}.old" "$OLD_QCONFIG_H" #put back qconfig.h
4415
    [ "$QMAKE_BUILD_ERROR" = "yes" ] && exit 2
4416
fi # Build qmake
4417
4418
#-------------------------------------------------------------------------------
4419
# tests that need qmake
4420
#-------------------------------------------------------------------------------
4421
4422
# detect availability of float math.h functions
4423
if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/floatmath "floatmath" $L_FLAGS $I_FLAGS $l_FLAGS; then
4424
    CFG_USE_FLOATMATH=yes
4425
else
4426
    CFG_USE_FLOATMATH=no
4427
fi
4428
4429
# detect mmx support
4430
if [ "${CFG_MMX}" = "auto" ]; then
4431
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mmx "mmx" $L_FLAGS $I_FLAGS $l_FLAGS "-mmmx"; then
4432
	CFG_MMX=yes
4433
    else
4434
	CFG_MMX=no
4435
    fi
4436
fi
4437
4438
# detect 3dnow support
4439
if [ "${CFG_3DNOW}" = "auto" ]; then
4440
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/3dnow "3dnow" $L_FLAGS $I_FLAGS $l_FLAGS "-m3dnow"; then
4441
	CFG_3DNOW=yes
4442
    else
4443
	CFG_3DNOW=no
4444
    fi
4445
fi
4446
4447
# detect sse support
4448
if [ "${CFG_SSE}" = "auto" ]; then
4449
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse "sse" $L_FLAGS $I_FLAGS $l_FLAGS "-msse"; then
4450
	CFG_SSE=yes
4451
    else
4452
	CFG_SSE=no
4453
    fi
4454
fi
4455
4456
# detect sse2 support
4457
if [ "${CFG_SSE2}" = "auto" ]; then
4458
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse2 "sse2" $L_FLAGS $I_FLAGS $l_FLAGS "-msse2"; then
4459
       CFG_SSE2=yes
4460
    else
4461
       CFG_SSE2=no
4462
    fi
4463
fi
4464
4465
# check iWMMXt support
4466
if [ "$CFG_IWMMXT" = "yes" ]; then
4467
    "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iwmmxt "iwmmxt" $L_FLAGS $I_FLAGS $l_FLAGS "-mcpu=iwmmxt"
4468
    if [ $? != "0" ]; then
4469
        echo "The iWMMXt functionality test failed!"
4470
	echo " Please make sure your compiler supports iWMMXt intrinsics!"
4471
	exit 1
4472
    fi
4473
fi
4474
4475
# detect zlib
4476
if [ "$CFG_ZLIB" = "no" ]; then
4477
    # Note: Qt no longer support builds without zlib
4478
    # So we force a "no" to be "auto" here.
4479
    # If you REALLY really need no zlib support, you can still disable
4480
    # it by doing the following:
4481
    #   add "no-zlib" to mkspecs/qconfig.pri
4482
    #   #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h)
4483
    #
4484
    # There's no guarantee that Qt will build under those conditions
4485
4486
    CFG_ZLIB=auto
4487
    ZLIB_FORCED=yes
4488
fi
4489
if [ "$CFG_ZLIB" = "auto" ]; then
4490
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/zlib "zlib" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
4491
       CFG_ZLIB=system
4492
    else
4493
       CFG_ZLIB=yes
4494
    fi
4495
fi
4496
4497
# detect how jpeg should be built
4498
if [ "$CFG_JPEG" = "auto" ]; then
4499
    if [ "$CFG_SHARED" = "yes" ]; then
4500
        CFG_JPEG=plugin
4501
    else
4502
        CFG_JPEG=yes
4503
    fi
4504
fi
4505
# detect jpeg
4506
if [ "$CFG_LIBJPEG" = "auto" ]; then
4507
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libjpeg "libjpeg" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
4508
       CFG_LIBJPEG=system
4509
    else
4510
       CFG_LIBJPEG=qt
4511
    fi
4512
fi
4513
4514
# detect how gif should be built
4515
if [ "$CFG_GIF" = "auto" ]; then
4516
    if [ "$CFG_SHARED" = "yes" ]; then
4517
        CFG_GIF=plugin
4518
    else
4519
        CFG_GIF=yes
4520
    fi
4521
fi
4522
4523
# detect how tiff should be built
4524
if [ "$CFG_TIFF" = "auto" ]; then
4525
    if [ "$CFG_SHARED" = "yes" ]; then
4526
        CFG_TIFF=plugin
4527
    else
4528
        CFG_TIFF=yes
4529
    fi
4530
fi
4531
4532
# detect tiff
4533
if [ "$CFG_LIBTIFF" = "auto" ]; then
4534
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libtiff "libtiff" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
4535
        CFG_LIBTIFF=system
4536
    else
4537
        CFG_LIBTIFF=qt
4538
    fi
4539
fi
4540
4541
# detect how mng should be built
4542
if [ "$CFG_MNG" = "auto" ]; then
4543
    if [ "$CFG_SHARED" = "yes" ]; then
4544
        CFG_MNG=plugin
4545
    else
4546
        CFG_MNG=yes
4547
    fi
4548
fi
4549
# detect mng
4550
if [ "$CFG_LIBMNG" = "auto" ]; then
4551
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libmng "libmng" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
4552
       CFG_LIBMNG=system
4553
    else
4554
       CFG_LIBMNG=qt
4555
    fi
4556
fi
4557
4558
# detect png
4559
if [ "$CFG_LIBPNG" = "auto" ]; then
4560
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libpng "libpng" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
4561
       CFG_LIBPNG=system
4562
    else
4563
       CFG_LIBPNG=qt
4564
    fi
4565
fi
4566
4567
# detect accessibility
4568
if [ "$CFG_ACCESSIBILITY" = "auto" ]; then
4569
    CFG_ACCESSIBILITY=yes
4570
fi
4571
4572
# auto-detect SQL-modules support
4573
for _SQLDR in $CFG_SQL_AVAILABLE; do
4574
        case $_SQLDR in
4575
        mysql)
4576
            if [ "$CFG_SQL_mysql" != "no" ]; then
4577
		[ -z "$CFG_MYSQL_CONFIG" ] && CFG_MYSQL_CONFIG=`"$WHICH" mysql_config`
4578
                if [ -x "$CFG_MYSQL_CONFIG" ]; then
4579
                    QT_CFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --include 2>/dev/null`
4580
                    QT_LFLAGS_MYSQL_R=`$CFG_MYSQL_CONFIG --libs_r 2>/dev/null`
4581
                    QT_LFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --libs 2>/dev/null`
4582
		    QT_MYSQL_VERSION=`$CFG_MYSQL_CONFIG --version 2>/dev/null`
4583
                    QT_MYSQL_VERSION_MAJOR=`echo $QT_MYSQL_VERSION | cut -d . -f 1`
4584
                fi
4585
                if [ -n "$QT_MYSQL_VERSION" ] && [ "$QT_MYSQL_VERSION_MAJOR" -lt 4 ]; then
4586
                    if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4587
                        echo "This version of MySql is not supported ($QT_MYSQL_VERSION)."
4588
                        echo " You need MySql 4 or higher."
4589
                        echo " If you believe this message is in error you may use the continue"
4590
                        echo " switch (-continue) to $0 to continue."
4591
                        exit 101
4592
                    else
4593
                        CFG_SQL_mysql="no"
4594
			QT_LFLAGS_MYSQL=""
4595
			QT_LFLAGS_MYSQL_R=""
4596
			QT_CFLAGS_MYSQL=""
4597
                    fi
4598
                else
4599
                    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 $MAC_CONFIG_TEST_COMMANDLINE; then
4600
                        QMakeVar add CONFIG use_libmysqlclient_r
4601
                        if [ "$CFG_SQL_mysql" = "auto" ]; then
4602
                            CFG_SQL_mysql=plugin
4603
                        fi
4604
                        QT_LFLAGS_MYSQL="$QT_LFLAGS_MYSQL_R"
4605
                    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 $MAC_CONFIG_TEST_COMMANDLINE; then
4606
                        if [ "$CFG_SQL_mysql" = "auto" ]; then
4607
                            CFG_SQL_mysql=plugin
4608
                        fi
4609
                    else
4610
                        if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4611
                            echo "MySQL 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_SQL_mysql=no
4618
			    QT_LFLAGS_MYSQL=""
4619
			    QT_LFLAGS_MYSQL_R=""
4620
			    QT_CFLAGS_MYSQL=""
4621
                        fi
4622
                    fi
4623
                fi
4624
            fi
4625
            ;;
4626
        psql)
4627
            if [ "$CFG_SQL_psql" != "no" ]; then
4628
                if "$WHICH" pg_config >/dev/null 2>&1; then
4629
                    QT_CFLAGS_PSQL=`pg_config --includedir 2>/dev/null`
4630
                    QT_LFLAGS_PSQL=`pg_config --libdir 2>/dev/null`
4631
                fi
4632
                [ -z "$QT_CFLAGS_PSQL" ] || QT_CFLAGS_PSQL="-I$QT_CFLAGS_PSQL"
4633
                [ -z "$QT_LFLAGS_PSQL" ] || QT_LFLAGS_PSQL="-L$QT_LFLAGS_PSQL"
4634
                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 $MAC_CONFIG_TEST_COMMANDLINE; then
4635
                    if [ "$CFG_SQL_psql" = "auto" ]; then
4636
                        CFG_SQL_psql=plugin
4637
                    fi
4638
                else
4639
                    if [ "$CFG_SQL_psql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4640
                        echo "PostgreSQL support cannot be enabled due to functionality tests!"
4641
                        echo " Turn on verbose messaging (-v) to $0 to see the final report."
4642
                        echo " If you believe this message is in error you may use the continue"
4643
                        echo " switch (-continue) to $0 to continue."
4644
                        exit 101
4645
                    else
4646
                        CFG_SQL_psql=no
4647
                        QT_CFLAGS_PSQL=""
4648
                        QT_LFLAGS_PSQL=""
4649
                    fi
4650
                fi
4651
            fi
4652
        ;;
4653
        odbc)
4654
            if [ "$CFG_SQL_odbc" != "no" ]; then
4655
                if [ "$PLATFORM_MAC" != "yes" ] && "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/odbc "ODBC" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
4656
                    if [ "$CFG_SQL_odbc" = "auto" ]; then
4657
                        CFG_SQL_odbc=plugin
4658
                    fi
4659
                else
4660
                    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iodbc "iODBC" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
4661
                        QT_LFLAGS_ODBC="-liodbc"
4662
                        if [ "$CFG_SQL_odbc" = "auto" ]; then
4663
                            CFG_SQL_odbc=plugin
4664
                        fi
4665
                    else
4666
                        if [ "$CFG_SQL_odbc" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4667
                            echo "ODBC 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_SQL_odbc=no
4674
                        fi
4675
                    fi
4676
                fi
4677
            fi
4678
            ;;
4679
        oci)
4680
            if [ "$CFG_SQL_oci" != "no" ]; then
4681
                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/oci "OCI" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
4682
                    if [ "$CFG_SQL_oci" = "auto" ]; then
4683
                        CFG_SQL_oci=plugin
4684
                    fi
4685
                else
4686
                    if [ "$CFG_SQL_oci" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4687
                        echo "Oracle (OCI) support cannot be enabled due to functionality tests!"
4688
                        echo " Turn on verbose messaging (-v) to $0 to see the final report."
4689
                        echo " If you believe this message is in error you may use the continue"
4690
                        echo " switch (-continue) to $0 to continue."
4691
                        exit 101
4692
                    else
4693
                        CFG_SQL_oci=no
4694
                    fi
4695
                fi
4696
            fi
4697
            ;;
4698
        tds)
4699
            if [ "$CFG_SQL_tds" != "no" ]; then
4700
                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tds "TDS" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
4701
                    if [ "$CFG_SQL_tds" = "auto" ]; then
4702
                        CFG_SQL_tds=plugin
4703
                    fi
4704
                else
4705
                    if [ "$CFG_SQL_tds" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4706
                        echo "TDS support cannot be enabled due to functionality tests!"
4707
                        echo " Turn on verbose messaging (-v) to $0 to see the final report."
4708
                        echo " If you believe this message is in error you may use the continue"
4709
                        echo " switch (-continue) to $0 to continue."
4710
                        exit 101
4711
                    else
4712
                        CFG_SQL_tds=no
4713
                    fi
4714
                fi
4715
            fi
4716
            ;;
4717
        db2)
4718
            if [ "$CFG_SQL_db2" != "no" ]; then
4719
                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/db2 "DB2" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
4720
                    if [ "$CFG_SQL_db2" = "auto" ]; then
4721
                        CFG_SQL_db2=plugin
4722
                    fi
4723
                else
4724
                    if [ "$CFG_SQL_db2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4725
                        echo "ODBC support cannot be enabled due to functionality tests!"
4726
                        echo " Turn on verbose messaging (-v) to $0 to see the final report."
4727
                        echo " If you believe this message is in error you may use the continue"
4728
                        echo " switch (-continue) to $0 to continue."
4729
                        exit 101
4730
                    else
4731
                        CFG_SQL_db2=no
4732
                    fi
4733
                fi
4734
            fi
4735
            ;;
4736
        ibase)
4737
            if [ "$CFG_SQL_ibase" != "no" ]; then
4738
                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ibase "InterBase" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
4739
                    if [ "$CFG_SQL_ibase" = "auto" ]; then
4740
                        CFG_SQL_ibase=plugin
4741
                    fi
4742
                else
4743
                    if [ "$CFG_SQL_ibase" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4744
                        echo "InterBase support cannot be enabled due to functionality tests!"
4745
                        echo " Turn on verbose messaging (-v) to $0 to see the final report."
4746
                        echo " If you believe this message is in error you may use the continue"
4747
                        echo " switch (-continue) to $0 to continue."
4748
                        exit 101
4749
                    else
4750
                        CFG_SQL_ibase=no
4751
                    fi
4752
                fi
4753
            fi
4754
            ;;
4755
        sqlite2)
4756
            if [ "$CFG_SQL_sqlite2" != "no" ]; then
4757
                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite2 "SQLite2" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
4758
                    if [ "$CFG_SQL_sqlite2" = "auto" ]; then
4759
                        CFG_SQL_sqlite2=plugin
4760
                    fi
4761
                else
4762
                    if [ "$CFG_SQL_sqlite2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4763
                        echo "SQLite2 support cannot be enabled due to functionality tests!"
4764
                        echo " Turn on verbose messaging (-v) to $0 to see the final report."
4765
                        echo " If you believe this message is in error you may use the continue"
4766
                        echo " switch (-continue) to $0 to continue."
4767
                        exit 101
4768
                    else
4769
                        CFG_SQL_sqlite2=no
4770
                    fi
4771
                fi
4772
            fi
4773
            ;;
4774
        sqlite)
4775
            if [ "$CFG_SQL_sqlite" != "no" ]; then
4776
                SQLITE_AUTODETECT_FAILED="no"
4777
                if [ "$CFG_SQLITE" = "system" ]; then
4778
                    if [ -n "$PKG_CONFIG" ]; then
4779
                        QT_CFLAGS_SQLITE=`$PKG_CONFIG --cflags sqlite3 2>/dev/null`
4780
                        QT_LFLAGS_SQLITE=`$PKG_CONFIG --libs sqlite3 2>/dev/null`
4781
                    fi
4782
                    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 $MAC_CONFIG_TEST_COMMANDLINE; then
4783
                        if [ "$CFG_SQL_sqlite" = "auto" ]; then
4784
                            CFG_SQL_sqlite=plugin
4785
                        fi
4786
                        QMAKE_CONFIG="$QMAKE_CONFIG system-sqlite"
4787
                    else
4788
                        SQLITE_AUTODETECT_FAILED="yes"
4789
                        CFG_SQL_sqlite=no
4790
                    fi
4791
                elif [ -f "$relpath/src/3rdparty/sqlite/sqlite3.h" ]; then
4792
                    if [ "$CFG_SQL_sqlite" = "auto" ]; then
4793
                            CFG_SQL_sqlite=plugin
4794
                    fi
4795
                else
4796
                    SQLITE_AUTODETECT_FAILED="yes"
4797
                    CFG_SQL_sqlite=no
4798
                fi
4799
4800
                if [ "$SQLITE_AUTODETECT_FAILED" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4801
                    echo "SQLite support cannot be enabled due to functionality tests!"
4802
                    echo " Turn on verbose messaging (-v) to $0 to see the final report."
4803
                    echo " If you believe this message is in error you may use the continue"
4804
                    echo " switch (-continue) to $0 to continue."
4805
                    exit 101
4806
                fi
4807
            fi
4808
            ;;
4809
        *)
4810
            if [ "$OPT_VERBOSE" = "yes" ]; then
4811
                echo "unknown SQL driver: $_SQLDR"
4812
            fi
4813
            ;;
4814
        esac
4815
done
4816
4817
# auto-detect NIS support
4818
if [ "$CFG_NIS" != "no" ]; then
4819
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/nis "NIS" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
4820
        CFG_NIS=yes
4821
    else
4822
        if [ "$CFG_NIS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4823
            echo "NIS support cannot be enabled due to functionality tests!"
4824
            echo " Turn on verbose messaging (-v) to $0 to see the final report."
4825
            echo " If you believe this message is in error you may use the continue"
4826
            echo " switch (-continue) to $0 to continue."
4827
            exit 101
4828
        else
4829
            CFG_NIS=no
4830
        fi
4831
    fi
4832
fi
4833
4834
# auto-detect CUPS support
4835
if [ "$CFG_CUPS" != "no" ]; then
4836
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/cups "Cups" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
4837
        CFG_CUPS=yes
4838
    else
4839
        if [ "$CFG_CUPS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4840
            echo "Cups support cannot be enabled due to functionality tests!"
4841
            echo " Turn on verbose messaging (-v) to $0 to see the final report."
4842
            echo " If you believe this message is in error you may use the continue"
4843
            echo " switch (-continue) to $0 to continue."
4844
            exit 101
4845
        else
4846
            CFG_CUPS=no
4847
        fi
4848
    fi
4849
fi
4850
4851
# auto-detect iconv(3) support
4852
if [ "$CFG_ICONV" != "no" ]; then
4853
    if [ "$PLATFORM_QWS" = "yes" ]; then
4854
	CFG_ICONV=no
4855
    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/iconv" "POSIX iconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
4856
        CFG_ICONV=yes
4857
    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/gnu-libiconv" "GNU libiconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
4858
        CFG_ICONV=gnu
4859
    else
4860
        if [ "$CFG_ICONV" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4861
            echo "Iconv support cannot be enabled due to functionality tests!"
4862
            echo " Turn on verbose messaging (-v) to $0 to see the final report."
4863
            echo " If you believe this message is in error you may use the continue"
4864
            echo " switch (-continue) to $0 to continue."
4865
            exit 101
4866
        else
4867
            CFG_ICONV=no
4868
        fi
4869
    fi
4870
fi
4871
4872
# auto-detect libdbus-1 support
4873
if [ "$CFG_DBUS" != "no" ]; then
4874
    if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then
4875
        QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null`
4876
        QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null`
4877
    fi
4878
    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 $MAC_CONFIG_TEST_COMMANDLINE; then
4879
        [ "$CFG_DBUS" = "auto" ] && CFG_DBUS=yes
4880
        QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
4881
        QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS"
4882
    else
4883
        if [ "$CFG_DBUS" = "auto" ]; then
4884
            CFG_DBUS=no
4885
        elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4886
            # CFG_DBUS is "yes" or "linked" here
4887
4888
            echo "The QtDBus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found."
4889
            echo " Turn on verbose messaging (-v) to $0 to see the final report."
4890
            echo " If you believe this message is in error you may use the continue"
4891
            echo " switch (-continue) to $0 to continue."
4892
            exit 101
4893
        fi
4894
    fi
4895
fi
4896
4897
# Generate a CRC of the namespace for using in constants for the Carbon port.
4898
# This should mean that you really *can* load two Qt's and have our custom
4899
# Carbon events work.
4900
if [ "$PLATFORM_MAC" = "yes" -a ! -z "$QT_NAMESPACE" ]; then
4901
    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`
4902
fi
4903
4904
if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then
4905
4906
    # detect EGL support
4907
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/egl" "EGL (EGL/egl.h)" $L_FLAGS $I_FLAGS $l_FLAGS; then
4908
        # EGL specified by QMAKE_*_EGL, included with <EGL/egl.h>
4909
        CFG_EGL=yes
4910
        CFG_EGL_GLES_INCLUDES=no
4911
    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/egl4gles1" "EGL (GLES/egl.h)" $L_FLAGS $I_FLAGS $l_FLAGS; then
4912
        # EGL specified by QMAKE_*_EGL, included with <GLES/egl.h>
4913
        CFG_EGL=yes
4914
        CFG_EGL_GLES_INCLUDES=yes
4915
    fi
4916
    if ( [ "$CFG_OPENGL" = "es1" ] || [ "$CFG_OPENGL" = "es1cl" ] || [ "$CFG_OPENGL" = "es2" ] ) && [ "$CFG_EGL" != "yes" ]; then
4917
        echo "The EGL functionality test failed!"
4918
        echo " EGL is required for OpenGL ES to manage contexts & surfaces."
4919
        echo " You might need to modify the include and library search paths by editing"
4920
        echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in"
4921
        echo " ${XQMAKESPEC}."
4922
        exit 1
4923
    fi
4924
4925
4926
    # auto-detect Glib support
4927
    if [ "$CFG_GLIB" != "no" ]; then
4928
        if [ -n "$PKG_CONFIG" ]; then
4929
            QT_CFLAGS_GLIB=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0 2>/dev/null`
4930
            QT_LIBS_GLIB=`$PKG_CONFIG --libs glib-2.0 gthread-2.0 2>/dev/null`
4931
        fi
4932
        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
4933
            CFG_GLIB=yes
4934
            QMakeVar set QT_CFLAGS_GLIB "$QT_CFLAGS_GLIB"
4935
            QMakeVar set QT_LIBS_GLIB "$QT_LIBS_GLIB"
4936
        else
4937
            if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4938
                echo "Glib support cannot be enabled due to functionality tests!"
4939
                echo " Turn on verbose messaging (-v) to $0 to see the final report."
4940
                echo " If you believe this message is in error you may use the continue"
4941
                echo " switch (-continue) to $0 to continue."
4942
                exit 101
4943
            else
4944
                CFG_GLIB=no
4945
            fi
4946
        fi
4947
    fi
4948
4949
    if [ "$CFG_PHONON" != "no" ]; then
4950
        if [ "$CFG_PHONON_BACKEND" != "no" ]; then
4951
            if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then
4952
                if [ -n "$PKG_CONFIG" ]; then
4953
                    QT_CFLAGS_GSTREAMER=`$PKG_CONFIG --cflags gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
4954
                    QT_LIBS_GSTREAMER=`$PKG_CONFIG --libs gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
4955
                fi
4956
                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
4957
                    CFG_GSTREAMER=yes
4958
                    QMakeVar set QT_CFLAGS_GSTREAMER "$QT_CFLAGS_GSTREAMER"
4959
                    QMakeVar set QT_LIBS_GSTREAMER "$QT_LIBS_GSTREAMER"
4960
                else
4961
                    if [ "$CFG_GSTREAMER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4962
                        echo "Gstreamer support cannot be enabled due to functionality tests!"
4963
                        echo " Turn on verbose messaging (-v) to $0 to see the final report."
4964
                        echo " If you believe this message is in error you may use the continue"
4965
                        echo " switch (-continue) to $0 to continue."
4966
                        exit 101
4967
                    else
4968
                        CFG_GSTREAMER=no
4969
                    fi
4970
                fi
4971
            elif [ "$CFG_GLIB" = "no" ]; then
4972
                CFG_GSTREAMER=no
4973
            fi
4974
4975
            if [ "$CFG_GSTREAMER" = "yes" ]; then
4976
                CFG_PHONON=yes
4977
            else
4978
                if [ "$CFG_PHONON" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
4979
                    echo "Phonon support cannot be enabled due to functionality tests!"
4980
                    echo " Turn on verbose messaging (-v) to $0 to see the final report."
4981
                    echo " If you believe this message is in error you may use the continue"
4982
                    echo " switch (-continue) to $0 to continue."
4983
                    exit 101
4984
                else
4985
                    CFG_PHONON=no
4986
                fi
4987
            fi
4988
        else
4989
            CFG_PHONON=yes
4990
        fi
4991
    fi
4992
fi # X11/QWS
4993
4994
# x11
4995
if [ "$PLATFORM_X11" = "yes" ]; then
4996
    x11tests="$relpath/config.tests/x11"
4997
    X11TESTS_FLAGS=
4998
4999
    # work around broken X11 headers when using GCC 2.95 or later
5000
    NOTYPE=no
5001
    "$x11tests/notype.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" && NOTYPE=yes
5002
    if [ $NOTYPE = "yes" ]; then
5003
	QMakeVar add QMAKE_CXXFLAGS -fpermissive
5004
        X11TESTS_FLAGS="$X11TESTS_FLAGS -fpermissive"
5005
    fi
5006
5007
    # Check we actually have X11 :-)
5008
    "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
5009
    if [ $? != "0" ]; then
5010
        echo "Basic XLib functionality test failed!"
5011
        echo " You might need to modify the include and library search paths by editing"
5012
        echo " QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in ${XQMAKESPEC}."
5013
        exit 1
5014
    fi
5015
5016
    # auto-detect OpenGL support (es1 = OpenGL ES 1.x Common, es1cl = ES 1.x common lite, es2 = OpenGL ES 2.x)
5017
    if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
5018
        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
5019
            CFG_OPENGL=desktop
5020
        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
5021
            CFG_OPENGL=es2
5022
	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
5023
            CFG_OPENGL=es1
5024
	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
5025
            CFG_OPENGL=es1cl
5026
        else
5027
            if [ "$CFG_OPENGL" = "yes" ]; then
5028
                echo "All the OpenGL functionality tests failed!"
5029
                echo " You might need to modify the include and library search paths by editing"
5030
                echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5031
                echo " ${XQMAKESPEC}."
5032
                exit 1
5033
            fi
5034
            CFG_OPENGL=no
5035
        fi
5036
       case "$PLATFORM" in
5037
       hpux*)
5038
           # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
5039
           if [ "$CFG_OPENGL" = "desktop" ]; then
5040
               "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
5041
               if [ $? != "0" ]; then
5042
                   QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
5043
               fi
5044
           fi
5045
	   ;;
5046
       *)
5047
           ;;
5048
       esac
5049
    elif [ "$CFG_OPENGL" = "es1cl" ]; then
5050
        # OpenGL ES 1.x common lite
5051
	"$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
5052
        if [ $? != "0" ]; then
5053
	    echo "The OpenGL ES 1.x Common Lite Profile functionality test failed!"
5054
            echo " You might need to modify the include and library search paths by editing"
5055
            echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5056
            echo " ${XQMAKESPEC}."
5057
            exit 1
5058
        fi
5059
    elif [ "$CFG_OPENGL" = "es1" ]; then
5060
        # OpenGL ES 1.x
5061
	"$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS
5062
        if [ $? != "0" ]; then
5063
	    echo "The OpenGL ES 1.x functionality test failed!"
5064
            echo " You might need to modify the include and library search paths by editing"
5065
            echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5066
            echo " ${XQMAKESPEC}."
5067
            exit 1
5068
        fi
5069
    elif [ "$CFG_OPENGL" = "es2" ]; then
5070
        #OpenGL ES 2.x
5071
	"$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS
5072
        if [ $? != "0" ]; then
5073
	    echo "The OpenGL ES 2.0 functionality test failed!"
5074
            echo " You might need to modify the include and library search paths by editing"
5075
            echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5076
            echo " ${XQMAKESPEC}."
5077
            exit 1
5078
        fi
5079
    elif [ "$CFG_OPENGL" = "desktop" ]; then
5080
        # Desktop OpenGL support
5081
        "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
5082
        if [ $? != "0" ]; then
5083
	    echo "The OpenGL functionality test failed!"
5084
            echo " You might need to modify the include and library search paths by editing"
5085
            echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5086
            echo " ${XQMAKESPEC}."
5087
            exit 1
5088
        fi
5089
        case "$PLATFORM" in
5090
        hpux*)
5091
            # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
5092
            "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
5093
            if [ $? != "0" ]; then
5094
                QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
5095
            fi
5096
	    ;;
5097
        *)
5098
            ;;
5099
        esac
5100
    fi
5101
5102
    # if opengl is disabled and the user specified graphicssystem gl, disable it...
5103
    if [ "$CFG_GRAPHICS_SYSTEM" = "opengl" ] && [ "$CFG_OPENGL" = "no" ]; then
5104
	echo "OpenGL Graphics System is disabled due to missing OpenGL support..."
5105
	CFG_GRAPHICS_SYSTEM=default
5106
    fi
5107
5108
    # auto-detect Xcursor support
5109
    if [ "$CFG_XCURSOR" != "no" ]; then
5110
	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
5111
	    if [ "$CFG_XCURSOR" != "runtime" ]; then
5112
		CFG_XCURSOR=yes;
5113
	    fi
5114
	else
5115
	    if [ "$CFG_XCURSOR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5116
		echo "Xcursor support cannot be enabled due to functionality tests!"
5117
		echo " Turn on verbose messaging (-v) to $0 to see the final report."
5118
		echo " If you believe this message is in error you may use the continue"
5119
		echo " switch (-continue) to $0 to continue."
5120
		exit 101
5121
	    else
5122
		CFG_XCURSOR=no
5123
	    fi
5124
	fi
5125
    fi
5126
5127
    # auto-detect Xfixes support
5128
    if [ "$CFG_XFIXES" != "no" ]; then
5129
	if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xfixes "Xfixes" $L_FLAGS $I_FLAGS $X11TESTS_FLAGS; then
5130
	    if [ "$CFG_XFIXES" != "runtime" ]; then
5131
		CFG_XFIXES=yes;
5132
	    fi
5133
	else
5134
	    if [ "$CFG_XFIXES" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5135
		echo "Xfixes support cannot be enabled due to functionality tests!"
5136
		echo " Turn on verbose messaging (-v) to $0 to see the final report."
5137
		echo " If you believe this message is in error you may use the continue"
5138
		echo " switch (-continue) to $0 to continue."
5139
		exit 101
5140
	    else
5141
		CFG_XFIXES=no
5142
	    fi
5143
	fi
5144
    fi
5145
5146
    # auto-detect Xrandr support (resize and rotate extension)
5147
    if [ "$CFG_XRANDR" != "no" ]; then
5148
	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
5149
            if [ "$CFG_XRANDR" != "runtime" ]; then
5150
	    CFG_XRANDR=yes
5151
            fi
5152
	else
5153
	    if [ "$CFG_XRANDR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5154
		echo "Xrandr support cannot be enabled due to functionality tests!"
5155
		echo " Turn on verbose messaging (-v) to $0 to see the final report."
5156
		echo " If you believe this message is in error you may use the continue"
5157
		echo " switch (-continue) to $0 to continue."
5158
		exit 101
5159
	    else
5160
		CFG_XRANDR=no
5161
	    fi
5162
	fi
5163
    fi
5164
5165
    # auto-detect Xrender support
5166
    if [ "$CFG_XRENDER" != "no" ]; then
5167
	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
5168
	    CFG_XRENDER=yes
5169
	else
5170
	    if [ "$CFG_XRENDER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5171
		echo "Xrender support cannot be enabled due to functionality tests!"
5172
		echo " Turn on verbose messaging (-v) to $0 to see the final report."
5173
		echo " If you believe this message is in error you may use the continue"
5174
		echo " switch (-continue) to $0 to continue."
5175
		exit 101
5176
	    else
5177
		CFG_XRENDER=no
5178
	    fi
5179
	fi
5180
    fi
5181
5182
    # auto-detect MIT-SHM support
5183
    if [ "$CFG_MITSHM" != "no" ]; then
5184
	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
5185
	    CFG_MITSHM=yes
5186
	else
5187
	    if [ "$CFG_MITSHM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5188
		echo "MITSHM support cannot be enabled due to functionality tests!"
5189
		echo " Turn on verbose messaging (-v) to $0 to see the final report."
5190
		echo " If you believe this message is in error you may use the continue"
5191
		echo " switch (-continue) to $0 to continue."
5192
		exit 101
5193
	    else
5194
		CFG_MITSHM=no
5195
	    fi
5196
	fi
5197
    fi
5198
5199
    # auto-detect FontConfig support
5200
    if [ "$CFG_FONTCONFIG" != "no" ]; then
5201
    if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
5202
        QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
5203
        QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null`
5204
    else
5205
        QT_CFLAGS_FONTCONFIG=
5206
        QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig"
5207
    fi
5208
    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
5209
	    CFG_FONTCONFIG=yes
5210
        QMakeVar set QMAKE_CFLAGS_X11 "$QT_CFLAGS_FONTCONFIG \$\$QMAKE_CFLAGS_X11"
5211
        QMakeVar set QMAKE_LIBS_X11 "$QT_LIBS_FONTCONFIG \$\$QMAKE_LIBS_X11"
5212
	    CFG_LIBFREETYPE=system
5213
	else
5214
	    if [ "$CFG_FONTCONFIG" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5215
		echo "FontConfig support cannot be enabled due to functionality tests!"
5216
		echo " Turn on verbose messaging (-v) to $0 to see the final report."
5217
		echo " If you believe this message is in error you may use the continue"
5218
		echo " switch (-continue) to $0 to continue."
5219
		exit 101
5220
	    else
5221
		CFG_FONTCONFIG=no
5222
	    fi
5223
	fi
5224
    fi
5225
5226
    # auto-detect Session Management support
5227
    if [ "$CFG_SM" = "auto" ]; then
5228
	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
5229
	    CFG_SM=yes
5230
	else
5231
	    if [ "$CFG_SM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5232
		echo "Session Management support cannot be enabled due to functionality tests!"
5233
		echo " Turn on verbose messaging (-v) to $0 to see the final report."
5234
		echo " If you believe this message is in error you may use the continue"
5235
		echo " switch (-continue) to $0 to continue."
5236
		exit 101
5237
	    else
5238
		CFG_SM=no
5239
	    fi
5240
	fi
5241
    fi
5242
5243
    # auto-detect SHAPE support
5244
    if [ "$CFG_XSHAPE" != "no" ]; then
5245
	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
5246
	    CFG_XSHAPE=yes
5247
	else
5248
	    if [ "$CFG_XSHAPE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5249
		echo "XShape support cannot be enabled due to functionality tests!"
5250
		echo " Turn on verbose messaging (-v) to $0 to see the final report."
5251
		echo " If you believe this message is in error you may use the continue"
5252
		echo " switch (-continue) to $0 to continue."
5253
		exit 101
5254
	    else
5255
		CFG_XSHAPE=no
5256
	    fi
5257
	fi
5258
    fi
5259
5260
    # auto-detect XSync support
5261
    if [ "$CFG_XSYNC" != "no" ]; then
5262
	if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xsync "XSync" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
5263
	    CFG_XSYNC=yes
5264
	else
5265
	    if [ "$CFG_XSYNC" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5266
		echo "XSync support cannot be enabled due to functionality tests!"
5267
		echo " Turn on verbose messaging (-v) to $0 to see the final report."
5268
		echo " If you believe this message is in error you may use the continue"
5269
		echo " switch (-continue) to $0 to continue."
5270
		exit 101
5271
	    else
5272
		CFG_XSYNC=no
5273
	    fi
5274
	fi
5275
    fi
5276
5277
    # auto-detect Xinerama support
5278
    if [ "$CFG_XINERAMA" != "no" ]; then
5279
	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
5280
	    if [ "$CFG_XINERAMA" != "runtime" ]; then
5281
		CFG_XINERAMA=yes
5282
	    fi
5283
	else
5284
	    if [ "$CFG_XINERAMA" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5285
		echo "Xinerama support cannot be enabled due to functionality tests!"
5286
		echo " Turn on verbose messaging (-v) to $0 to see the final report."
5287
		echo " If you believe this message is in error you may use the continue"
5288
		echo " switch (-continue) to $0 to continue."
5289
		exit 101
5290
	    else
5291
		CFG_XINERAMA=no
5292
	    fi
5293
	fi
5294
    fi
5295
5296
    # auto-detect Xinput support
5297
    if [ "$CFG_XINPUT" != "no" ]; then
5298
        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
5299
	    if [ "$CFG_XINPUT" != "runtime" ]; then
5300
		CFG_XINPUT=yes
5301
	    fi
5302
        else
5303
            if [ "$CFG_XINPUT" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5304
                echo "Tablet and Xinput support cannot be enabled due to functionality tests!"
5305
                echo " Turn on verbose messaging (-v) to $0 to see the final report."
5306
                echo " If you believe this message is in error you may use the continue"
5307
                echo " switch (-continue) to $0 to continue."
5308
                exit 101
5309
            else
5310
                CFG_XINPUT=no
5311
            fi
5312
        fi
5313
    fi
5314
5315
    # auto-detect XKB support
5316
    if [ "$CFG_XKB" != "no" ]; then
5317
        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
5318
            CFG_XKB=yes
5319
        else
5320
            if [ "$CFG_XKB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5321
                echo "XKB support cannot be enabled due to functionality tests!"
5322
                echo " Turn on verbose messaging (-v) to $0 to see the final report."
5323
                echo " If you believe this message is in error you may use the continue"
5324
                echo " switch (-continue) to $0 to continue."
5325
                exit 101
5326
            else
5327
                CFG_XKB=no
5328
            fi
5329
        fi
5330
    fi
5331
5332
    if [ "$CFG_GLIB" = "yes" -a "$CFG_QGTKSTYLE" != "no" ]; then
5333
        if [ -n "$PKG_CONFIG" ]; then
5334
            QT_CFLAGS_QGTKSTYLE=`$PKG_CONFIG --cflags gtk+-2.0 ">=" 2.10 atk 2>/dev/null`
5335
            QT_LIBS_QGTKSTYLE=`$PKG_CONFIG --libs gobject-2.0 2>/dev/null`
5336
        fi
5337
        if [ -n "$QT_CFLAGS_QGTKSTYLE" ] ; then
5338
            CFG_QGTKSTYLE=yes
5339
            QMakeVar set QT_CFLAGS_QGTKSTYLE "$QT_CFLAGS_QGTKSTYLE"
5340
            QMakeVar set QT_LIBS_QGTKSTYLE "$QT_LIBS_QGTKSTYLE"
5341
        else
5342
            if [ "$CFG_QGTKSTYLE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5343
                echo "Gtk theme support cannot be enabled due to functionality tests!"
5344
                echo " Turn on verbose messaging (-v) to $0 to see the final report."
5345
                echo " If you believe this message is in error you may use the continue"
5346
                echo " switch (-continue) to $0 to continue."
5347
                exit 101
5348
            else
5349
                CFG_QGTKSTYLE=no
5350
            fi
5351
        fi
5352
    elif [ "$CFG_GLIB" = "no" ]; then
5353
        CFG_QGTKSTYLE=no
5354
    fi
5355
fi # X11
5356
5357
5358
if [ "$PLATFORM_MAC" = "yes" ]; then
5359
    if [ "$CFG_PHONON" != "no" ]; then
5360
        # Always enable Phonon (unless it was explicitly disabled)
5361
        CFG_PHONON=yes
5362
    fi
5363
fi
5364
5365
# QWS
5366
if [ "$PLATFORM_QWS" = "yes" ]; then
5367
5368
    # auto-detect OpenGL support (es1 = OpenGL ES 1.x Common, es1cl = ES 1.x common lite, es2 = OpenGL ES 2.x)
5369
    if [ "$CFG_OPENGL" = "yes" ]; then
5370
        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
5371
            CFG_OPENGL=es2
5372
	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
5373
            CFG_OPENGL=es1
5374
	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
5375
            CFG_OPENGL=es1cl
5376
        else
5377
            echo "All the OpenGL ES functionality tests failed!"
5378
            echo " You might need to modify the include and library search paths by editing"
5379
            echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5380
            echo " ${XQMAKESPEC}."
5381
            exit 1
5382
        fi
5383
    elif [ "$CFG_OPENGL" = "es1" ]; then
5384
        # OpenGL ES 1.x
5385
	"$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS
5386
        if [ $? != "0" ]; then
5387
	    echo "The OpenGL ES 1.x functionality test failed!"
5388
            echo " You might need to modify the include and library search paths by editing"
5389
	    echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5390
	    echo " ${XQMAKESPEC}."
5391
            exit 1
5392
        fi
5393
    elif [ "$CFG_OPENGL" = "es2" ]; then
5394
        #OpenGL ES 2.x
5395
	"$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS
5396
        if [ $? != "0" ]; then
5397
	    echo "The OpenGL ES 2.0 functionality test failed!"
5398
            echo " You might need to modify the include and library search paths by editing"
5399
	    echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
5400
	    echo " ${XQMAKESPEC}."
5401
            exit 1
5402
        fi
5403
    elif [ "$CFG_OPENGL" = "desktop" ]; then
5404
        # Desktop OpenGL support
5405
        echo "Desktop OpenGL support is not avaliable on Qt for Embedded Linux"
5406
        exit 1
5407
    fi
5408
5409
    # screen drivers
5410
    for screen in ${CFG_GFX_ON} ${CFG_GFX_PLUGIN}; do
5411
       if [ "${screen}" = "ahi" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
5412
           "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/ahi "Ahi" $L_FLAGS $I_FLAGS $l_FLAGS
5413
           if [ $? != "0" ]; then
5414
               echo "The Ahi screen driver functionality test failed!"
5415
               echo " You might need to modify the include and library search paths by editing"
5416
               echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
5417
               echo " ${XQMAKESPEC}."
5418
               exit 1
5419
           fi
5420
       fi
5421
5422
       if [ "${screen}" = "svgalib" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
5423
           "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/svgalib "SVGAlib" $L_FLAGS $I_FLAGS $l_FLAGS
5424
           if [ $? != "0" ]; then
5425
               echo "The SVGAlib screen driver functionality test failed!"
5426
               echo " You might need to modify the include and library search paths by editing"
5427
               echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
5428
               echo " ${XQMAKESPEC}."
5429
               exit 1
5430
           fi
5431
       fi
5432
5433
       if [ "${screen}" = "directfb" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
5434
           if [ -n "$PKG_CONFIG" ]; then
5435
               if $PKG_CONFIG --exists directfb 2>/dev/null; then
5436
                   QT_CFLAGS_DIRECTFB=`$PKG_CONFIG --cflags directfb 2>/dev/null`
5437
                   QT_LIBS_DIRECTFB=`$PKG_CONFIG --libs directfb 2>/dev/null`
5438
               elif directfb-config --version >/dev/null 2>&1; then
5439
                   QT_CFLAGS_DIRECTFB=`directfb-config --cflags 2>/dev/null`
5440
                   QT_LIBS_DIRECTFB=`directfb-config --libs 2>/dev/null`
5441
               fi
5442
           fi
5443
5444
           # QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero.
5445
           if [ -n "$QT_CFLAGS_DIRECTFB" ] || [ -n "$QT_LIBS_DIRECTFB" ]; then
5446
               QMakeVar set QT_CFLAGS_DIRECTFB "$QT_CFLAGS_DIRECTFB"
5447
               QMakeVar set QT_LIBS_DIRECTFB "$QT_LIBS_DIRECTFB"
5448
           fi
5449
           if [ "$CFG_QT3SUPPORT" = "yes" ]; then
5450
               QMakeVar set QT_DEFINES_DIRECTFB "QT3_SUPPORT"
5451
           fi
5452
5453
           "$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
5454
           if [ $? != "0" ]; then
5455
               echo "The DirectFB screen driver functionality test failed!"
5456
               echo " You might need to modify the include and library search paths by editing"
5457
               echo " QT_CFLAGS_DIRECTFB and QT_LIBS_DIRECTFB in"
5458
               echo " ${XQMAKESPEC}."
5459
               exit 1
5460
           fi
5461
       fi
5462
5463
    done
5464
5465
    # mouse drivers
5466
    for mouse in ${CFG_MOUSE_ON} ${CFG_MOUSE_PLUGIN}; do
5467
	if [ "${mouse}" = "tslib" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
5468
	    "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tslib "tslib" $L_FLAGS $I_FLAGS $l_FLAGS
5469
            if [ $? != "0" ]; then
5470
               echo "The tslib functionality test failed!"
5471
               echo " You might need to modify the include and library search paths by editing"
5472
               echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
5473
               echo " ${XQMAKESPEC}."
5474
		exit 1
5475
	    fi
5476
	fi
5477
    done
5478
5479
    CFG_QGTKSTYLE=no
5480
5481
    # sound
5482
    "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/sound "sound" $L_FLAGS $I_FLAGS $l_FLAGS
5483
    if [ $? != "0" ]; then
5484
        QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SOUND"
5485
    fi
5486
5487
fi # QWS
5488
5489
# freetype support
5490
[ "x$CFG_EMBEDDED" != "xno" ] && CFG_LIBFREETYPE="$CFG_QWS_FREETYPE"
5491
[ "x$PLATFORM_MAC" = "xyes" ] && CFG_LIBFREETYPE=no
5492
if [ "$CFG_LIBFREETYPE" = "auto" ]; then
5493
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/freetype "FreeType" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5494
        CFG_LIBFREETYPE=system
5495
    else
5496
        CFG_LIBFREETYPE=yes
5497
    fi
5498
fi
5499
5500
if [ "$CFG_ENDIAN" = "auto" ]; then
5501
    if [ "$PLATFORM_MAC" = "yes" ]; then
5502
	true #leave as auto
5503
    else
5504
        "$unixtests/endian.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
5505
	F="$?"
5506
        if [ "$F" -eq 0 ]; then
5507
            CFG_ENDIAN="Q_LITTLE_ENDIAN"
5508
        elif [ "$F" -eq 1 ]; then
5509
            CFG_ENDIAN="Q_BIG_ENDIAN"
5510
        else
5511
            echo
5512
	    echo "The target system byte order could not be detected!"
5513
	    echo "Turn on verbose messaging (-v) to see the final report."
5514
	    echo "You can use the -little-endian or -big-endian switch to"
5515
	    echo "$0 to continue."
5516
            exit 101
5517
        fi
5518
    fi
5519
fi
5520
5521
if [ "$CFG_HOST_ENDIAN" = "auto" ]; then
5522
    if [ "$PLATFORM_MAC" = "yes" ]; then
5523
	true #leave as auto
5524
    else
5525
        "$unixtests/endian.test" "$QMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
5526
	F="$?"
5527
        if [ "$F" -eq 0 ]; then
5528
            CFG_HOST_ENDIAN="Q_LITTLE_ENDIAN"
5529
        elif [ "$F" -eq 1 ]; then
5530
            CFG_HOST_ENDIAN="Q_BIG_ENDIAN"
5531
        else
5532
            echo
5533
	    echo "The host system byte order could not be detected!"
5534
	    echo "Turn on verbose messaging (-v) to see the final report."
5535
	    echo "You can use the -host-little-endian or -host-big-endian switch to"
5536
	    echo "$0 to continue."
5537
            exit 101
5538
        fi
5539
    fi
5540
fi
5541
5542
if [ "$CFG_ARMFPA" != "auto" ]; then
5543
    if [ "$CFG_ARMFPA" = "yes" ]; then
5544
        if [ "$CFG_ENDIAN" = "Q_LITTLE_ENDIAN" ]; then
5545
            CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE_SWAPPED"
5546
        else
5547
            CFG_DOUBLEFORMAT="Q_DOUBLE_BIG_SWAPPED"
5548
        fi
5549
    else
5550
        CFG_DOUBLEFORMAT="normal"
5551
    fi
5552
fi
5553
5554
5555
if [ "$CFG_DOUBLEFORMAT" = "auto" ]; then
5556
    if [ "$PLATFORM_QWS" != "yes" ]; then
5557
        CFG_DOUBLEFORMAT=normal
5558
    else
5559
        "$unixtests/doubleformat.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
5560
	F="$?"
5561
        if [ "$F" -eq 10 ] && [ "$CFG_ENDIAN" = "Q_LITTLE_ENDIAN" ]; then
5562
            CFG_DOUBLEFORMAT=normal
5563
        elif [ "$F" -eq 11 ] && [ "$CFG_ENDIAN" = "Q_BIG_ENDIAN" ]; then
5564
            CFG_DOUBLEFORMAT=normal
5565
        elif [ "$F" -eq 10 ]; then
5566
            CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE"
5567
        elif [ "$F" -eq 11 ]; then
5568
            CFG_DOUBLEFORMAT="Q_DOUBLE_BIG"
5569
        elif [ "$F" -eq 12 ]; then
5570
            CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE_SWAPPED"
5571
            CFG_ARMFPA="yes"
5572
        elif [ "$F" -eq 13 ]; then
5573
            CFG_DOUBLEFORMAT="Q_DOUBLE_BIG_SWAPPED"
5574
            CFG_ARMFPA="yes"
5575
        else
5576
            echo
5577
	    echo "The system floating point format could not be detected."
5578
	    echo "This may cause data to be generated in a wrong format"
5579
	    echo "Turn on verbose messaging (-v) to see the final report."
5580
	    # we do not fail on this since this is a new test, and if it fails,
5581
	    # the old behavior should be correct in most cases
5582
            CFG_DOUBLEFORMAT=normal
5583
        fi
5584
    fi
5585
fi
5586
5587
HAVE_STL=no
5588
if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stl "STL" $L_FLAGS $I_FLAGS $l_FLAGS; then
5589
    HAVE_STL=yes
5590
fi
5591
5592
if [ "$CFG_STL" != "no" ]; then
5593
    if [ "$HAVE_STL" = "yes" ]; then
5594
        CFG_STL=yes
5595
    else
5596
        if [ "$CFG_STL" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5597
            echo "STL support cannot be enabled due to functionality tests!"
5598
            echo " Turn on verbose messaging (-v) to $0 to see the final report."
5599
            echo " If you believe this message is in error you may use the continue"
5600
            echo " switch (-continue) to $0 to continue."
5601
            exit 101
5602
        else
5603
            CFG_STL=no
5604
        fi
5605
    fi
5606
fi
5607
5608
# find if the platform supports IPv6
5609
if [ "$CFG_IPV6" != "no" ]; then
5610
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ipv6 "IPv6" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5611
        CFG_IPV6=yes
5612
    else
5613
        if [ "$CFG_IPV6" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5614
            echo "IPv6 support cannot be enabled due to functionality tests!"
5615
            echo " Turn on verbose messaging (-v) to $0 to see the final report."
5616
            echo " If you believe this message is in error you may use the continue"
5617
            echo " switch (-continue) to $0 to continue."
5618
            exit 101
5619
        else
5620
            CFG_IPV6=no
5621
        fi
5622
    fi
5623
fi
5624
5625
# detect POSIX clock_gettime()
5626
if [ "$CFG_CLOCK_GETTIME" = "auto" ]; then
5627
    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
5628
	CFG_CLOCK_GETTIME=yes
5629
    else
5630
	CFG_CLOCK_GETTIME=no
5631
    fi
5632
fi
5633
5634
# detect POSIX monotonic clocks
5635
if [ "$CFG_CLOCK_GETTIME" = "yes" ] && [ "$CFG_CLOCK_MONOTONIC" = "auto" ]; then
5636
    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
5637
	CFG_CLOCK_MONOTONIC=yes
5638
    else
5639
	CFG_CLOCK_MONOTONIC=no
5640
    fi
5641
elif [ "$CFG_CLOCK_GETTIME" = "no" ]; then
5642
    CFG_CLOCK_MONOTONIC=no
5643
fi
5644
5645
# detect mremap
5646
if [ "$CFG_MREMAP" = "auto" ]; then
5647
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mremap "mremap" $L_FLAGS $I_FLAGS $l_FLAGS; then
5648
	CFG_MREMAP=yes
5649
    else
5650
	CFG_MREMAP=no
5651
    fi
5652
fi
5653
5654
# find if the platform provides getaddrinfo (ipv6 dns lookups)
5655
if [ "$CFG_GETADDRINFO" != "no" ]; then
5656
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getaddrinfo "getaddrinfo" $L_FLAGS $I_FLAGS $l_FLAGS; then
5657
        CFG_GETADDRINFO=yes
5658
    else
5659
	if [ "$CFG_GETADDRINFO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5660
            echo "getaddrinfo support cannot be enabled due to functionality tests!"
5661
            echo " Turn on verbose messaging (-v) to $0 to see the final report."
5662
            echo " If you believe this message is in error you may use the continue"
5663
            echo " switch (-continue) to $0 to continue."
5664
            exit 101
5665
	else
5666
	    CFG_GETADDRINFO=no
5667
	fi
5668
    fi
5669
fi
5670
5671
# find if the platform provides inotify
5672
if [ "$CFG_INOTIFY" != "no" ]; then
5673
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/inotify "inotify" $L_FLAGS $I_FLAGS $l_FLAGS; then
5674
        CFG_INOTIFY=yes
5675
    else
5676
	if [ "$CFG_INOTIFY" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5677
            echo "inotify support cannot be enabled due to functionality tests!"
5678
            echo " Turn on verbose messaging (-v) to $0 to see the final report."
5679
            echo " If you believe this message is in error you may use the continue"
5680
            echo " switch (-continue) to $0 to continue."
5681
            exit 101
5682
	else
5683
	    CFG_INOTIFY=no
5684
	fi
5685
    fi
5686
fi
5687
5688
# find if the platform provides if_nametoindex (ipv6 interface name support)
5689
if [ "$CFG_IPV6IFNAME" != "no" ]; then
5690
    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
5691
        CFG_IPV6IFNAME=yes
5692
    else
5693
        if [ "$CFG_IPV6IFNAME" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5694
            echo "IPv6 interface name support cannot be enabled due to functionality tests!"
5695
            echo " Turn on verbose messaging (-v) to $0 to see the final report."
5696
            echo " If you believe this message is in error you may use the continue"
5697
            echo " switch (-continue) to $0 to continue."
5698
            exit 101
5699
        else
5700
	    CFG_IPV6IFNAME=no
5701
	fi
5702
    fi
5703
fi
5704
5705
# find if the platform provides getifaddrs (network interface enumeration)
5706
if [ "$CFG_GETIFADDRS" != "no" ]; then
5707
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getifaddrs "getifaddrs" $L_FLAGS $I_FLAGS $l_FLAGS; then
5708
        CFG_GETIFADDRS=yes
5709
    else
5710
        if [ "$CFG_GETIFADDRS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5711
            echo "getifaddrs support cannot be enabled due to functionality tests!"
5712
            echo " Turn on verbose messaging (-v) to $0 to see the final report."
5713
            echo " If you believe this message is in error you may use the continue"
5714
            echo " switch (-continue) to $0 to continue."
5715
            exit 101
5716
        else
5717
	    CFG_GETIFADDRS=no
5718
	fi
5719
    fi
5720
fi
5721
5722
# find if the platform supports X/Open Large File compilation environment
5723
if [ "$CFG_LARGEFILE" != "no" ]; then
5724
    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
5725
        CFG_LARGEFILE=yes
5726
    else
5727
        if [ "$CFG_LARGEFILE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5728
            echo "X/Open Large File support cannot be enabled due to functionality tests!"
5729
            echo " Turn on verbose messaging (-v) to $0 to see the final report."
5730
            echo " If you believe this message is in error you may use the continue"
5731
            echo " switch (-continue) to $0 to continue."
5732
            exit 101
5733
        else
5734
            CFG_LARGEFILE=no
5735
        fi
5736
    fi
5737
fi
5738
5739
# detect OpenSSL
5740
if [ "$CFG_OPENSSL" != "no" ]; then
5741
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/openssl "OpenSSL" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
5742
        if [ "$CFG_OPENSSL" = "auto" ]; then
5743
            CFG_OPENSSL=yes
5744
        fi
5745
    else
5746
        if ( [ "$CFG_OPENSSL" = "yes" ] || [ "$CFG_OPENSSL" = "linked" ] ) && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5747
            echo "OpenSSL support cannot be enabled due to functionality tests!"
5748
            echo " Turn on verbose messaging (-v) to $0 to see the final report."
5749
            echo " If you believe this message is in error you may use the continue"
5750
            echo " switch (-continue) to $0 to continue."
5751
            exit 101
5752
        else
5753
            CFG_OPENSSL=no
5754
        fi
5755
    fi
5756
fi
5757
5758
# detect OpenVG support
5759
if [ "$CFG_OPENVG" != "no" ]; then
5760
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/openvg" "OpenVG" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then
5761
        if [ "$CFG_OPENVG" = "auto" ]; then
5762
            CFG_OPENVG=yes
5763
        fi
5764
    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG openvg_on_opengl" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/openvg" "OpenVG" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then
5765
        if [ "$CFG_OPENVG" = "auto" ]; then
5766
            CFG_OPENVG=yes
5767
        fi
5768
        CFG_OPENVG_ON_OPENGL=yes
5769
    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG lower_case_includes" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/openvg" "OpenVG (lc includes)" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then
5770
        if [ "$CFG_OPENVG" = "auto" ]; then
5771
            CFG_OPENVG=yes
5772
        fi
5773
        CFG_OPENVG_LC_INCLUDES=yes
5774
    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG openvg_on_opengl lower_case_includes" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/openvg" "OpenVG (lc includes)" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then
5775
        if [ "$CFG_OPENVG" = "auto" ]; then
5776
            CFG_OPENVG=yes
5777
        fi
5778
        CFG_OPENVG_LC_INCLUDES=yes
5779
        CFG_OPENVG_ON_OPENGL=yes
5780
    else
5781
        if [ "$CFG_OPENVG" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
5782
            echo "$CFG_OPENVG was specified for OpenVG but cannot be enabled due to functionality tests!"
5783
            echo " Turn on verbose messaging (-v) to $0 to see the final report."
5784
            echo " If you believe this message is in error you may use the continue"
5785
            echo " switch (-continue) to $0 to continue."
5786
            exit 101
5787
        else
5788
            CFG_OPENVG=no
5789
        fi
5790
    fi
5791
    if [ "$CFG_OPENVG" = "yes" ] && "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/shivavg" "ShivaVG" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then
5792
        CFG_OPENVG_SHIVA=yes
5793
    fi
5794
fi
5795
5796
# if openvg is disabled and the user specified graphicssystem vg, disable it...
5797
if [ "$CFG_GRAPHICS_SYSTEM" = "openvg" ] && [ "$CFG_OPENVG" = "no" ]; then
5798
    echo "OpenVG Graphics System is disabled due to missing OpenVG support..."
5799
    CFG_GRAPHICS_SYSTEM=default
5800
fi
5801
5802
if [ "$CFG_PTMALLOC" != "no" ]; then
5803
    # build ptmalloc, copy .a file to lib/
5804
    echo "Building ptmalloc. Please wait..."
5805
    (cd "$relpath/src/3rdparty/ptmalloc/"; "$MAKE" "clean" ; "$MAKE" "posix"
5806
     mkdir "$outpath/lib/" ; cp "libptmalloc3.a" "$outpath/lib/")
5807
5808
    QMakeVar add QMAKE_LFLAGS "$outpath/lib/libptmalloc3.a"
5809
fi
5810
5811
if [ "$CFG_ALSA" = "auto" ]; then
5812
    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/alsa "alsa" $L_FLAGS $I_FLAGS $l_FLAGS; then
5813
        CFG_ALSA=yes
5814
    else
5815
        CFG_ALSA=no
5816
    fi
5817
fi
5818
5819
if [ -f "$relpath/src/declarative/declarative.pro" ]; then
5820
    if [ "$CFG_DECLARATIVE" = "auto" ]; then
5821
        CFG_DECLARATIVE=yes
5822
    fi
5823
else
5824
    if [ "$CFG_DECLARATIVE" = "auto" ] || [ "$CFG_DECLARATIVE" = "no" ]; then
5825
        CFG_DECLARATIVE=no
5826
    else
5827
        echo "Error: Unable to locate the qt-declarative package. Refer to the documentation on how to build the package."
5828
        exit 1
5829
    fi
5830
fi
5831
5832
if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ] || [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then 
5833
    if [ "$CFG_ARCH" = "arm" ] || [ "$CFG_ARCH" = "armv6" ]; then
5834
       "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/javascriptcore-jit "javascriptcore-jit" $L_FLAGS $I_FLAGS $l_FLAGS
5835
        if [ $? != "0" ]; then
5836
           CFG_JAVASCRIPTCORE_JIT=no
5837
        fi
5838
    fi
5839
fi
5840
5841
if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ]; then
5842
    QMakeVar set JAVASCRIPTCORE_JIT yes
5843
elif [ "$CFG_JAVASCRIPTCORE_JIT" = "no" ]; then
5844
    QMakeVar set JAVASCRIPTCORE_JIT no
5845
fi
5846
5847
#-------------------------------------------------------------------------------
5848
# ask for all that hasn't been auto-detected or specified in the arguments
5849
#-------------------------------------------------------------------------------
5850
5851
### fix this: user input should be validated in a loop
5852
if [ "$CFG_QWS_DEPTHS" = "prompted" -a "$PLATFORM_QWS" = "yes" ]; then
5853
    echo
5854
    echo "Choose pixel-depths to support:"
5855
    echo
5856
    echo "   1. 1bpp, black/white"
5857
    echo "   4. 4bpp, grayscale"
5858
    echo "   8. 8bpp, paletted"
5859
    echo "  12. 12bpp, rgb 4-4-4"
5860
    echo "  15. 15bpp, rgb 5-5-5"
5861
    echo "  16. 16bpp, rgb 5-6-5"
5862
    echo "  18. 18bpp, rgb 6-6-6"
5863
    echo "  24. 24bpp, rgb 8-8-8"
5864
    echo "  32. 32bpp, argb 8-8-8-8 and rgb 8-8-8"
5865
    echo " all. All supported depths"
5866
    echo
5867
    echo "Your choices (default 8,16,32):"
5868
    read CFG_QWS_DEPTHS
5869
    if [ -z "$CFG_QWS_DEPTHS" ] || [ "$CFG_QWS_DEPTHS" = "yes" ]; then
5870
        CFG_QWS_DEPTHS=8,16,32
5871
    fi
5872
fi
5873
if [ -n "$CFG_QWS_DEPTHS" -a "$PLATFORM_QWS" = "yes" ]; then
5874
    if [ "$CFG_QWS_DEPTHS" = "all" ]; then
5875
        CFG_QWS_DEPTHS="1 4 8 12 15 16 18 24 32 generic"
5876
    fi
5877
    for D in `echo "$CFG_QWS_DEPTHS" | sed -e 's/,/ /g'`; do
5878
	case $D in
5879
	    1|4|8|12|15|16|18|24|32) QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QWS_DEPTH_$D";;
5880
	    generic) QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QWS_DEPTH_GENERIC";;
5881
	esac
5882
    done
5883
fi
5884
5885
# enable dwarf2 support on Mac
5886
if [ "$CFG_MAC_DWARF2" = "yes" ]; then
5887
    QT_CONFIG="$QT_CONFIG dwarf2"
5888
fi
5889
5890
# Set the default arch.
5891
# Carbon builds: 32 bit x86/ppc.
5892
# For "-cocoa" builds on snow leopard : compiler default (64-bit).
5893
# For "-cocoa" builds on leopard : compiler default (32-bit).
5894
if [ "$PLATFORM_MAC" = "yes" ]  && [ "$CFG_MAC_ARCHS" = "" ]; then
5895
    source "$mactests/defaultarch.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests"
5896
5897
	if [ "$CFG_MAC_COCOA" != "yes" ]; then
5898
		if [ "$QT_MAC_DEFAULT_ARCH" = "x86_64" ]; then
5899
			CFG_MAC_ARCHS=" x86"
5900
		elif [ "$QT_MAC_DEFAULT_ARCH" = "ppc64" ]; then
5901
			CFG_MAC_ARCHS=" ppc"
5902
		else
5903
			CFG_MAC_ARCHS=" $QT_MAC_DEFAULT_ARCH"
5904
		fi
5905
	else
5906
		CFG_MAC_ARCHS=" $QT_MAC_DEFAULT_ARCH"
5907
    fi
5908
5909
    [ "$OPT_VERBOSE" = "yes" ] && echo "Setting Mac architechture to$CFG_MAC_ARCHS."
5910
fi
5911
5912
# enable cocoa and/or carbon on Mac
5913
if [ "$CFG_MAC_COCOA" = "yes" ]; then
5914
#   -cocoa on the command line disables carbon completely (i.e. use cocoa for 32-bit as well)
5915
    CFG_MAC_CARBON="no"
5916
else
5917
#   check which archs are in use, enable cocoa if we find a 64-bit one
5918
    if echo "$CFG_MAC_ARCHS" | grep 64 > /dev/null 2>&1; then
5919
        CFG_MAC_COCOA="yes";
5920
        CFG_MAC_CARBON="no";
5921
        if echo "$CFG_MAC_ARCHS" | grep -w ppc > /dev/null 2>&1; then
5922
            CFG_MAC_CARBON="yes";
5923
        fi
5924
        if echo "$CFG_MAC_ARCHS" | grep -w x86 > /dev/null 2>&1; then
5925
            CFG_MAC_CARBON="yes";
5926
        fi
5927
    else
5928
#       no 64-bit archs found.
5929
        CFG_MAC_COCOA="no"
5930
    fi
5931
fi;
5932
5933
# set the global Mac deployment target. This is overridden on an arch-by-arch basis
5934
# in some cases, see code further down
5935
case "$PLATFORM,$CFG_MAC_COCOA" in
5936
    macx*,yes)
5937
	# Cocoa
5938
	QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.5
5939
	;;
5940
    macx*,no)
5941
	# gcc, Carbon
5942
	QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.4
5943
	;;
5944
esac
5945
5946
# disable Qt 3 support on VxWorks
5947
case "$XPLATFORM" in
5948
    unsupported/vxworks*)
5949
	CFG_QT3SUPPORT="no"
5950
    ;;
5951
esac
5952
5953
# enable Qt 3 support functionality
5954
if [ "$CFG_QT3SUPPORT" = "yes" ]; then
5955
    QT_CONFIG="$QT_CONFIG qt3support"
5956
fi
5957
5958
# enable Phonon
5959
if [ "$CFG_PHONON" = "yes" ]; then
5960
    QT_CONFIG="$QT_CONFIG phonon"
5961
    if [ "$CFG_PHONON_BACKEND" = "yes" ]; then
5962
        QT_CONFIG="$QT_CONFIG phonon-backend"
5963
    fi
5964
else
5965
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_PHONON"
5966
fi
5967
5968
# disable accessibility
5969
if [ "$CFG_ACCESSIBILITY" = "no" ]; then
5970
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ACCESSIBILITY"
5971
else
5972
    QT_CONFIG="$QT_CONFIG accessibility"
5973
fi
5974
5975
# enable egl
5976
if [ "$CFG_EGL" = "no" ]; then
5977
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGL"
5978
else
5979
    QT_CONFIG="$QT_CONFIG egl"
5980
    if [ "$CFG_EGL_GLES_INCLUDES" = "yes" ]; then
5981
        QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GLES_EGL"
5982
    fi
5983
fi
5984
5985
# enable openvg
5986
if [ "$CFG_OPENVG" = "no" ]; then
5987
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENVG"
5988
else
5989
    QT_CONFIG="$QT_CONFIG openvg"
5990
    if [ "$CFG_OPENVG_LC_INCLUDES" = "yes" ]; then
5991
        QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LOWER_CASE_VG_INCLUDES"
5992
    fi
5993
    if [ "$CFG_OPENVG_ON_OPENGL" = "yes" ]; then
5994
        QT_CONFIG="$QT_CONFIG openvg_on_opengl"
5995
    fi
5996
    if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
5997
        QT_CONFIG="$QT_CONFIG shivavg"
5998
        QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SHIVAVG"
5999
    fi
6000
fi
6001
6002
# enable opengl
6003
if [ "$CFG_OPENGL" = "no" ]; then
6004
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENGL"
6005
else
6006
    QT_CONFIG="$QT_CONFIG opengl"
6007
fi
6008
6009
if [ "$CFG_OPENGL" = "es1" ] || [ "$CFG_OPENGL" = "es1cl" ] || [ "$CFG_OPENGL" = "es2" ]; then
6010
    if [ "$PLATFORM_QWS" = "yes" ]; then
6011
	QCONFIG_FLAGS="$QCONFIG_FLAGS Q_BACKINGSTORE_SUBSURFACES"
6012
	QCONFIG_FLAGS="$QCONFIG_FLAGS Q_USE_EGLWINDOWSURFACE"
6013
    fi
6014
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES"
6015
fi
6016
6017
if [ "$CFG_OPENGL" = "es1" ]; then
6018
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_1"
6019
    QT_CONFIG="$QT_CONFIG opengles1"
6020
fi
6021
6022
if [ "$CFG_OPENGL" = "es1cl" ]; then
6023
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_1_CL"
6024
    QT_CONFIG="$QT_CONFIG opengles1cl"
6025
fi
6026
6027
if [ "$CFG_OPENGL" = "es2" ]; then
6028
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_2"
6029
    QT_CONFIG="$QT_CONFIG opengles2"
6030
fi
6031
6032
# safe execution environment
6033
if [ "$CFG_SXE" != "no" ]; then
6034
    QT_CONFIG="$QT_CONFIG sxe"
6035
fi
6036
6037
# build up the variables for output
6038
if [ "$CFG_DEBUG" = "yes" ]; then
6039
    QMAKE_OUTDIR="${QMAKE_OUTDIR}debug"
6040
    QMAKE_CONFIG="$QMAKE_CONFIG debug"
6041
elif [ "$CFG_DEBUG" = "no" ]; then
6042
    QMAKE_OUTDIR="${QMAKE_OUTDIR}release"
6043
    QMAKE_CONFIG="$QMAKE_CONFIG release"
6044
fi
6045
if [ "$CFG_SHARED" = "yes" ]; then
6046
    QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared"
6047
    QMAKE_CONFIG="$QMAKE_CONFIG shared dll"
6048
elif [ "$CFG_SHARED" = "no" ]; then
6049
    QMAKE_OUTDIR="${QMAKE_OUTDIR}-static"
6050
    QMAKE_CONFIG="$QMAKE_CONFIG static"
6051
fi
6052
if [ "$PLATFORM_QWS" = "yes" ]; then
6053
    QMAKE_OUTDIR="${QMAKE_OUTDIR}-emb-$CFG_EMBEDDED"
6054
    QMAKE_CONFIG="$QMAKE_CONFIG embedded"
6055
    QT_CONFIG="$QT_CONFIG embedded"
6056
    rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
6057
fi
6058
QMakeVar set PRECOMPILED_DIR ".pch/$QMAKE_OUTDIR"
6059
QMakeVar set OBJECTS_DIR ".obj/$QMAKE_OUTDIR"
6060
QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR"
6061
QMakeVar set RCC_DIR ".rcc/$QMAKE_OUTDIR"
6062
QMakeVar set UI_DIR ".uic/$QMAKE_OUTDIR"
6063
if [ "$CFG_LARGEFILE" = "yes" ]; then
6064
    QMAKE_CONFIG="$QMAKE_CONFIG largefile"
6065
fi
6066
if [ "$CFG_STL" = "no" ]; then
6067
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STL"
6068
else
6069
    QMAKE_CONFIG="$QMAKE_CONFIG stl"
6070
fi
6071
if [ "$CFG_USE_GNUMAKE" = "yes" ]; then
6072
    QMAKE_CONFIG="$QMAKE_CONFIG GNUmake"
6073
fi
6074
[ "$CFG_REDUCE_EXPORTS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_exports"
6075
[ "$CFG_REDUCE_RELOCATIONS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_relocations"
6076
[ "$CFG_PRECOMPILE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG precompile_header"
6077
if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
6078
    QMakeVar add QMAKE_CFLAGS -g
6079
    QMakeVar add QMAKE_CXXFLAGS -g
6080
    QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info"
6081
fi
6082
[ "$CFG_MMX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mmx"
6083
[ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow"
6084
[ "$CFG_SSE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse"
6085
[ "$CFG_SSE2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse2"
6086
[ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt"
6087
[ "$PLATFORM_MAC" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG $CFG_MAC_ARCHS"
6088
if [ "$CFG_IPV6" = "yes" ]; then
6089
    QT_CONFIG="$QT_CONFIG ipv6"
6090
fi
6091
if [ "$CFG_CLOCK_GETTIME" = "yes" ]; then
6092
    QT_CONFIG="$QT_CONFIG clock-gettime"
6093
fi
6094
if [ "$CFG_CLOCK_MONOTONIC" = "yes" ]; then
6095
    QT_CONFIG="$QT_CONFIG clock-monotonic"
6096
fi
6097
if [ "$CFG_MREMAP" = "yes" ]; then
6098
    QT_CONFIG="$QT_CONFIG mremap"
6099
fi
6100
if [ "$CFG_GETADDRINFO" = "yes" ]; then
6101
    QT_CONFIG="$QT_CONFIG getaddrinfo"
6102
fi
6103
if [ "$CFG_IPV6IFNAME" = "yes" ]; then
6104
    QT_CONFIG="$QT_CONFIG ipv6ifname"
6105
fi
6106
if [ "$CFG_GETIFADDRS" = "yes" ]; then
6107
    QT_CONFIG="$QT_CONFIG getifaddrs"
6108
fi
6109
if [ "$CFG_INOTIFY" = "yes" ]; then
6110
    QT_CONFIG="$QT_CONFIG inotify"
6111
fi
6112
if [ "$CFG_LIBJPEG" = "no" ]; then
6113
    CFG_JPEG="no"
6114
elif [ "$CFG_LIBJPEG" = "system" ]; then
6115
    QT_CONFIG="$QT_CONFIG system-jpeg"
6116
fi
6117
if [ "$CFG_JPEG" = "no" ]; then
6118
    QT_CONFIG="$QT_CONFIG no-jpeg"
6119
elif [ "$CFG_JPEG" = "yes" ]; then
6120
    QT_CONFIG="$QT_CONFIG jpeg"
6121
fi
6122
if [ "$CFG_LIBMNG" = "no" ]; then
6123
    CFG_MNG="no"
6124
elif [ "$CFG_LIBMNG" = "system" ]; then
6125
    QT_CONFIG="$QT_CONFIG system-mng"
6126
fi
6127
if [ "$CFG_MNG" = "no" ]; then
6128
    QT_CONFIG="$QT_CONFIG no-mng"
6129
elif [ "$CFG_MNG" = "yes" ]; then
6130
    QT_CONFIG="$QT_CONFIG mng"
6131
fi
6132
if [ "$CFG_LIBPNG" = "no" ]; then
6133
    CFG_PNG="no"
6134
fi
6135
if [ "$CFG_LIBPNG" = "system" ]; then
6136
    QT_CONFIG="$QT_CONFIG system-png"
6137
fi
6138
if [ "$CFG_PNG" = "no" ]; then
6139
    QT_CONFIG="$QT_CONFIG no-png"
6140
elif [ "$CFG_PNG" = "yes" ]; then
6141
    QT_CONFIG="$QT_CONFIG png"
6142
fi
6143
if [ "$CFG_GIF" = "no" ]; then
6144
    QT_CONFIG="$QT_CONFIG no-gif"
6145
elif [ "$CFG_GIF" = "yes" ]; then
6146
    QT_CONFIG="$QT_CONFIG gif"
6147
fi
6148
if [ "$CFG_LIBTIFF" = "no" ]; then
6149
    CFG_TIFF="no"
6150
elif [ "$CFG_LIBTIFF" = "system" ]; then
6151
    QT_CONFIG="$QT_CONFIG system-tiff"
6152
fi
6153
if [ "$CFG_TIFF" = "no" ]; then
6154
    QT_CONFIG="$QT_CONFIG no-tiff"
6155
elif [ "$CFG_TIFF" = "yes" ]; then
6156
    QT_CONFIG="$QT_CONFIG tiff"
6157
fi
6158
if [ "$CFG_LIBFREETYPE" = "no" ]; then
6159
    QT_CONFIG="$QT_CONFIG no-freetype"
6160
elif [ "$CFG_LIBFREETYPE" = "system" ]; then
6161
    QT_CONFIG="$QT_CONFIG system-freetype"
6162
else
6163
    QT_CONFIG="$QT_CONFIG freetype"
6164
fi
6165
6166
if [ "x$PLATFORM_MAC" = "xyes" ]; then
6167
    #On Mac we implicitly link against libz, so we
6168
    #never use the 3rdparty stuff.
6169
    [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system"
6170
fi
6171
if [ "$CFG_ZLIB" = "yes" ]; then
6172
    QT_CONFIG="$QT_CONFIG zlib"
6173
elif [ "$CFG_ZLIB" = "system" ]; then
6174
    QT_CONFIG="$QT_CONFIG system-zlib"
6175
fi
6176
6177
[ "$CFG_NIS" = "yes" ] && QT_CONFIG="$QT_CONFIG nis"
6178
[ "$CFG_CUPS" = "yes" ] && QT_CONFIG="$QT_CONFIG cups"
6179
[ "$CFG_ICONV" = "yes" ] && QT_CONFIG="$QT_CONFIG iconv"
6180
[ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv"
6181
[ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib"
6182
[ "$CFG_GSTREAMER" = "yes" ] && QT_CONFIG="$QT_CONFIG gstreamer"
6183
[ "$CFG_DBUS" = "yes" ] && QT_CONFIG="$QT_CONFIG dbus"
6184
[ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus dbus-linked"
6185
[ "$CFG_NAS" = "system" ] && QT_CONFIG="$QT_CONFIG nas"
6186
[ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl"
6187
[ "$CFG_OPENSSL" = "linked" ] && QT_CONFIG="$QT_CONFIG openssl-linked"
6188
6189
if [ "$PLATFORM_X11" = "yes" ]; then
6190
    [ "$CFG_SM" = "yes" ] && QT_CONFIG="$QT_CONFIG x11sm"
6191
6192
    # for some reason, the following libraries are not always built shared,
6193
    # so *every* program/lib (including Qt) has to link against them
6194
    if [ "$CFG_XSHAPE" = "yes" ]; then
6195
        QT_CONFIG="$QT_CONFIG xshape"
6196
    fi
6197
    if [ "$CFG_XSYNC" = "yes" ]; then
6198
        QT_CONFIG="$QT_CONFIG xsync"
6199
    fi
6200
    if [ "$CFG_XINERAMA" = "yes" ]; then
6201
        QT_CONFIG="$QT_CONFIG xinerama"
6202
	QMakeVar set QMAKE_LIBS_X11 '-lXinerama $$QMAKE_LIBS_X11'
6203
    fi
6204
    if [ "$CFG_XCURSOR" = "yes" ]; then
6205
        QT_CONFIG="$QT_CONFIG xcursor"
6206
	QMakeVar set QMAKE_LIBS_X11 '-lXcursor $$QMAKE_LIBS_X11'
6207
    fi
6208
    if [ "$CFG_XFIXES" = "yes" ]; then
6209
        QT_CONFIG="$QT_CONFIG xfixes"
6210
	QMakeVar set QMAKE_LIBS_X11 '-lXfixes $$QMAKE_LIBS_X11'
6211
    fi
6212
    if [ "$CFG_XRANDR" = "yes" ]; then
6213
        QT_CONFIG="$QT_CONFIG xrandr"
6214
        if [ "$CFG_XRENDER" != "yes" ]; then
6215
            # libXrandr uses 1 function from libXrender, so we always have to have it :/
6216
	    QMakeVar set QMAKE_LIBS_X11 '-lXrandr -lXrender $$QMAKE_LIBS_X11'
6217
        else
6218
	    QMakeVar set QMAKE_LIBS_X11 '-lXrandr $$QMAKE_LIBS_X11'
6219
        fi
6220
    fi
6221
    if [ "$CFG_XRENDER" = "yes" ]; then
6222
        QT_CONFIG="$QT_CONFIG xrender"
6223
	QMakeVar set QMAKE_LIBS_X11 '-lXrender $$QMAKE_LIBS_X11'
6224
    fi
6225
    if [ "$CFG_MITSHM" = "yes" ]; then
6226
        QT_CONFIG="$QT_CONFIG mitshm"
6227
    fi
6228
    if [ "$CFG_FONTCONFIG" = "yes" ]; then
6229
        QT_CONFIG="$QT_CONFIG fontconfig"
6230
    fi
6231
    if [ "$CFG_XINPUT" = "yes" ]; then
6232
	QMakeVar set QMAKE_LIBS_X11 '-lXi $$QMAKE_LIBS_X11'
6233
    fi
6234
    if [ "$CFG_XINPUT" = "yes" ]; then
6235
        QT_CONFIG="$QT_CONFIG xinput tablet"
6236
    fi
6237
    if [ "$CFG_XKB" = "yes" ]; then
6238
        QT_CONFIG="$QT_CONFIG xkb"
6239
    fi
6240
fi
6241
6242
[ '!' -z "$D_FLAGS" ] && QMakeVar add DEFINES "$D_FLAGS"
6243
[ '!' -z "$L_FLAGS" ] && QMakeVar add QMAKE_LIBDIR_FLAGS "$L_FLAGS"
6244
[ '!' -z "$l_FLAGS" ] && QMakeVar add LIBS "$l_FLAGS"
6245
6246
if [ "$PLATFORM_MAC" = "yes" ]; then
6247
    if [ "$CFG_RPATH" = "yes" ]; then
6248
       QMAKE_CONFIG="$QMAKE_CONFIG absolute_library_soname"
6249
    fi
6250
elif [ -z "`getQMakeConf \"$XQMAKESPEC\" | grep QMAKE_RPATH | awk '{print $3;}'`" ]; then
6251
    if [ -n "$RPATH_FLAGS" ]; then
6252
        echo
6253
        echo "ERROR: -R cannot be used on this platform as \$QMAKE_RPATH is"
6254
        echo "       undefined."
6255
        echo
6256
        exit 1
6257
    elif [ "$CFG_RPATH" = "yes" ]; then
6258
        RPATH_MESSAGE="        NOTE: This platform does not support runtime library paths, using -no-rpath."
6259
        CFG_RPATH=no
6260
    fi
6261
else
6262
    if [ "$CFG_RPATH" = "yes" ]; then
6263
        # set the default rpath to the library installation directory
6264
        RPATH_FLAGS="\"$QT_INSTALL_LIBS\" $RPATH_FLAGS"
6265
    fi
6266
    if [ -n "$RPATH_FLAGS" ]; then
6267
        # add the user defined rpaths
6268
	QMakeVar add QMAKE_RPATHDIR "$RPATH_FLAGS"
6269
    fi
6270
fi
6271
6272
if [ '!' -z "$I_FLAGS" ]; then
6273
    # add the user define include paths
6274
    QMakeVar add QMAKE_CFLAGS "$I_FLAGS"
6275
    QMakeVar add QMAKE_CXXFLAGS "$I_FLAGS"
6276
fi
6277
6278
# turn off exceptions for the compilers that support it
6279
if [ "$PLATFORM_QWS" = "yes" ]; then
6280
    COMPILER=`echo $XPLATFORM | cut -f 3- -d-`
6281
else
6282
    COMPILER=`echo $PLATFORM | cut -f 2- -d-`
6283
fi
6284
if [ "$CFG_EXCEPTIONS" = "unspecified" -a "$PLATFORM_QWS" = "yes" ]; then
6285
    CFG_EXCEPTIONS=no
6286
fi
6287
6288
if [ "$CFG_EXCEPTIONS" != "no" ]; then
6289
    QTCONFIG_CONFIG="$QTCONFIG_CONFIG exceptions"
6290
fi
6291
6292
if [ "$CFG_ALSA" = "yes" ]; then
6293
    QT_CONFIG="$QT_CONFIG alsa"
6294
fi
6295
6296
#
6297
# Some Qt modules are too advanced in C++ for some old compilers
6298
# Detect here the platforms where they are known to work.
6299
#
6300
# See Qt documentation for more information on which features are
6301
# supported and on which compilers.
6302
#
6303
canBuildQtXmlPatterns="yes"
6304
canBuildWebKit="$HAVE_STL"
6305
canBuildQtConcurrent="yes"
6306
6307
# WebKit requires stdint.h
6308
"$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stdint "Stdint" $L_FLAGS $I_FLAGS $l_FLAGS
6309
if [ $? != "0" ]; then
6310
    canBuildWebKit="no"
6311
fi
6312
6313
case "$XPLATFORM" in
6314
    hpux-g++*)
6315
	# PA-RISC's assembly is too limited
6316
	# gcc 3.4 on that platform can't build QtXmlPatterns
6317
	# the assembly it generates cannot be compiled
6318
6319
	# Check gcc's version
6320
	case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
6321
	    4*)
6322
		;;
6323
	    3.4*)
6324
		canBuildQtXmlPatterns="no"
6325
		;;
6326
	    *)
6327
		canBuildWebKit="no"
6328
		canBuildQtXmlPatterns="no"
6329
		;;
6330
	esac
6331
	;;
6332
    unsupported/vxworks-*-g++*)
6333
	canBuildWebKit="no"
6334
	;;
6335
    unsupported/vxworks-*-dcc*)
6336
	canBuildWebKit="no"
6337
	canBuildQtXmlPatterns="no"
6338
	;;
6339
    *-g++*)
6340
	# Check gcc's version
6341
	case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
6342
	    4*|3.4*)
6343
		;;
6344
            3.3*)
6345
                canBuildWebKit="no"
6346
                ;;
6347
	    *)
6348
		canBuildWebKit="no"
6349
		canBuildQtXmlPatterns="no"
6350
		;;
6351
	esac
6352
	;;
6353
    solaris-cc*)
6354
        # Check the compiler version
6355
        case `${QMAKE_CONF_COMPILER} -V 2>&1 | awk '{print $4}'` in
6356
            5.[012345678])
6357
                canBuildWebKit="no"
6358
                canBuildQtXmlPatterns="no"
6359
                canBuildQtConcurrent="no"
6360
                ;;
6361
            5.9)
6362
                canBuildWebKit="no"
6363
                canBuildQtConcurrent="no"
6364
                ;;
6365
        esac
6366
        ;;
6367
    hpux-acc*)
6368
	canBuildWebKit="no"
6369
	canBuildQtXmlPatterns="no"
6370
        canBuildQtConcurrent="no"
6371
	;;
6372
    hpuxi-acc*)
6373
	canBuildWebKit="no"
6374
	;;
6375
    aix-xlc*)
6376
        # Get the xlC version
6377
        cat > xlcver.c <<EOF
6378
#include <stdio.h>
6379
int main()
6380
{
6381
    printf("%d.%d\n", __xlC__ >> 8, __xlC__ & 0xFF);
6382
    return 0;
6383
}
6384
EOF
6385
        xlcver=
6386
        if ${QMAKE_CONF_COMPILER} -o xlcver xlcver.c >/dev/null 2>/dev/null; then
6387
            xlcver=`./xlcver 2>/dev/null`
6388
            rm -f ./xlcver
6389
        fi
6390
        if [ "$OPT_VERBOSE" = "yes" ]; then
6391
            if [ -n "$xlcver" ]; then
6392
                echo Found IBM xlC version: $xlcver.
6393
            else
6394
                echo Could not determine IBM xlC version, assuming oldest supported.
6395
            fi
6396
        fi
6397
6398
        case "$xlcver" in
6399
            [123456].*)
6400
                canBuildWebKit="no"
6401
                canBuildQtXmlPatterns="no"
6402
                canBuildQtConcurrent="no"
6403
                ;;
6404
            *)
6405
                canBuildWebKit="no"
6406
                canBuildQtConcurrent="no"
6407
                ;;
6408
        esac
6409
        ;;
6410
    irix-cc*)
6411
        canBuildWebKit="no"
6412
        canBuildQtConcurrent="no"
6413
	;;
6414
esac
6415
6416
CFG_CONCURRENT="yes"
6417
if [ "$canBuildQtConcurrent" = "no" ]; then
6418
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT"
6419
    CFG_CONCURRENT="no"
6420
fi
6421
6422
if [ "$CFG_XMLPATTERNS" = "yes" -a "$CFG_EXCEPTIONS" = "no" ]; then
6423
    echo "QtXmlPatterns was requested, but it can't be built due to exceptions being disabled."
6424
    exit 1
6425
fi
6426
if [ "$CFG_XMLPATTERNS" = "auto" -a "$CFG_EXCEPTIONS" != "no" ]; then
6427
    CFG_XMLPATTERNS="$canBuildQtXmlPatterns"
6428
elif [ "$CFG_EXCEPTIONS" = "no" ]; then
6429
    CFG_XMLPATTERNS="no"
6430
fi
6431
if [ "$CFG_XMLPATTERNS" = "yes" ]; then
6432
    QT_CONFIG="$QT_CONFIG xmlpatterns"
6433
else
6434
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XMLPATTERNS"
6435
fi
6436
6437
if [ "$CFG_MULTIMEDIA" = "no" ]; then
6438
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MULTIMEDIA"
6439
else
6440
    QT_CONFIG="$QT_CONFIG multimedia"
6441
fi
6442
6443
if [ "$CFG_SVG" = "yes" ]; then
6444
    QT_CONFIG="$QT_CONFIG svg"
6445
else
6446
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SVG"
6447
fi
6448
6449
if [ "$CFG_DECLARATIVE" = "yes" ]; then
6450
    QT_CONFIG="$QT_CONFIG declarative"
6451
else
6452
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DECLARATIVE"
6453
fi
6454
6455
if [ "$CFG_WEBKIT" = "auto" ]; then
6456
    CFG_WEBKIT="$canBuildWebKit"
6457
fi
6458
6459
if [ "$CFG_WEBKIT" = "yes" ]; then
6460
    QT_CONFIG="$QT_CONFIG webkit"
6461
    # The reason we set CFG_WEBKIT, is such that the printed overview of what will be enabled, shows correctly.
6462
    CFG_WEBKIT="yes"
6463
else
6464
    CFG_WEBKIT="no"
6465
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_WEBKIT"
6466
fi
6467
6468
if [ "$CFG_SCRIPT" = "auto" ]; then
6469
    CFG_SCRIPT="yes"
6470
fi
6471
6472
if [ "$CFG_SCRIPT" = "yes" ]; then
6473
    QT_CONFIG="$QT_CONFIG script"
6474
else
6475
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SCRIPT"
6476
fi
6477
6478
if [ "$CFG_SCRIPTTOOLS" = "yes" -a "$CFG_SCRIPT" = "no" ]; then
6479
    echo "QtScriptTools was requested, but it can't be built due to QtScript being disabled."
6480
    exit 1
6481
fi
6482
if [ "$CFG_SCRIPTTOOLS" = "auto" -a "$CFG_SCRIPT" != "no" ]; then
6483
    CFG_SCRIPTTOOLS="yes"
6484
elif [ "$CFG_SCRIPT" = "no" ]; then
6485
    CFG_SCRIPTTOOLS="no"
6486
fi
6487
6488
if [ "$CFG_SCRIPTTOOLS" = "yes" ]; then
6489
    QT_CONFIG="$QT_CONFIG scripttools"
6490
else
6491
    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SCRIPTTOOLS"
6492
fi
6493
6494
if [ "$CFG_EXCEPTIONS" = "no" ]; then
6495
    case "$COMPILER" in
6496
    g++*)
6497
	QMakeVar add QMAKE_CFLAGS -fno-exceptions
6498
	QMakeVar add QMAKE_CXXFLAGS -fno-exceptions
6499
	QMakeVar add QMAKE_LFLAGS -fno-exceptions
6500
        ;;
6501
    cc*)
6502
        case "$PLATFORM" in
6503
        irix-cc*)
6504
	    QMakeVar add QMAKE_CFLAGS -LANG:exceptions=off
6505
	    QMakeVar add QMAKE_CXXFLAGS -LANG:exceptions=off
6506
	    QMakeVar add QMAKE_LFLAGS -LANG:exceptions=off
6507
            ;;
6508
        *) ;;
6509
        esac
6510
        ;;
6511
    *) ;;
6512
    esac
6513
    QMAKE_CONFIG="$QMAKE_CONFIG exceptions_off"
6514
fi
6515
6516
# On Mac, set the minimum deployment target for the different architechtures 
6517
# using the Xarch compiler option when supported (10.5 and up).  On 10.4 the
6518
# deployment version is set to 10.4 globally using the QMAKE_MACOSX_DEPLOYMENT_TARGET
6519
# env. variable. "-cocoa" on the command line means Cocoa is used in 32-bit mode also,
6520
# in this case fall back on QMAKE_MACOSX_DEPLOYMENT_TARGET which will be set to 10.5.
6521
if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" != "no" ] && [ "$COMMANDLINE_MAC_COCOA" != "yes" ]; then
6522
    if echo "$CFG_MAC_ARCHS" | grep '\<x86\>' > /dev/null 2>&1; then
6523
        QMakeVar add QMAKE_CFLAGS "-Xarch_i386 -mmacosx-version-min=10.4"
6524
        QMakeVar add QMAKE_CXXFLAGS "-Xarch_i386 -mmacosx-version-min=10.4"
6525
        QMakeVar add QMAKE_LFLAGS "-Xarch_i386 -mmacosx-version-min=10.4"
6526
        QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86 "-arch i386 -Xarch_i386 -mmacosx-version-min=10.4"
6527
    fi
6528
    if echo "$CFG_MAC_ARCHS" | grep '\<ppc\>' > /dev/null 2>&1; then
6529
        QMakeVar add QMAKE_CFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
6530
        QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
6531
        QMakeVar add QMAKE_LFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
6532
        QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC "-arch ppc -Xarch_ppc -mmacosx-version-min=10.4"
6533
    fi
6534
    if echo "$CFG_MAC_ARCHS" | grep '\<x86_64\>' > /dev/null 2>&1; then
6535
        QMakeVar add QMAKE_CFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
6536
        QMakeVar add QMAKE_CXXFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
6537
        QMakeVar add QMAKE_LFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
6538
        QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86_64 "-arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5"
6539
    fi
6540
    if echo "$CFG_MAC_ARCHS" | grep '\<ppc64\>' > /dev/null 2>&1; then
6541
        QMakeVar add QMAKE_CFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5"
6542
        QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5"
6543
        QMakeVar add QMAKE_LFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5"
6544
        QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC_64 "-arch ppc64 -Xarch_ppc64 -mmacosx-version-min=10.5"
6545
    fi
6546
fi
6547
6548
#-------------------------------------------------------------------------------
6549
# generate QT_BUILD_KEY
6550
#-------------------------------------------------------------------------------
6551
6552
# some compilers generate binary incompatible code between different versions,
6553
# so we need to generate a build key that is different between these compilers
6554
case "$COMPILER" in
6555
g++*)
6556
    # GNU C++
6557
    COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -dumpversion 2>/dev/null`
6558
6559
    case "$COMPILER_VERSION" in
6560
    *.*.*)
6561
        QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'`
6562
        QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'`
6563
        QT_GCC_PATCH_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'`
6564
        ;;
6565
    *.*)
6566
        QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\1,'`
6567
        QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\2,'`
6568
        QT_GCC_PATCH_VERSION=0
6569
        ;;
6570
    esac
6571
6572
    case "$COMPILER_VERSION" in
6573
    2.95.*)
6574
        COMPILER_VERSION="2.95.*"
6575
        ;;
6576
    3.*)
6577
        COMPILER_VERSION="3.*"
6578
        ;;
6579
    4.*)
6580
        COMPILER_VERSION="4"
6581
        ;;
6582
    *)
6583
        ;;
6584
    esac
6585
    [ '!' -z "$COMPILER_VERSION" ] && COMPILER="g++-${COMPILER_VERSION}"
6586
    ;;
6587
*)
6588
    #
6589
    ;;
6590
esac
6591
6592
# QT_CONFIG can contain the following:
6593
#
6594
# Things that affect the Qt API/ABI:
6595
#
6596
#   Options:
6597
#     minimal-config small-config medium-config large-config full-config
6598
#
6599
#   Different edition modules:
6600
#     network canvas table xml opengl sql
6601
#
6602
# Things that do not affect the Qt API/ABI:
6603
#     stl
6604
#     system-jpeg no-jpeg jpeg
6605
#     system-mng no-mng mng
6606
#     system-png no-png png
6607
#     system-zlib no-zlib zlib
6608
#     system-libtiff no-libtiff
6609
#     no-gif gif
6610
#     debug release
6611
#     dll staticlib
6612
#
6613
#     nocrosscompiler
6614
#     GNUmake
6615
#     largefile
6616
#     nis
6617
#     nas
6618
#     tablet
6619
#     ipv6
6620
#
6621
#     X11     : x11sm xinerama xcursor xfixes xrandr xrender mitshm fontconfig xkb
6622
#     Embedded: embedded freetype
6623
#
6624
ALL_OPTIONS=
6625
BUILD_CONFIG=
6626
BUILD_OPTIONS=
6627
6628
# determine the build options
6629
for config_option in $QMAKE_CONFIG $QT_CONFIG; do
6630
    SKIP="yes"
6631
    case "$config_option" in
6632
    *-config)
6633
        # take the last *-config setting.  this is the highest config being used,
6634
        # and is the one that we will use for tagging plugins
6635
        BUILD_CONFIG="$config_option"
6636
        ;;
6637
6638
    *) # skip all other options since they don't affect the Qt API/ABI.
6639
        ;;
6640
    esac
6641
6642
    if [ "$SKIP" = "no" ]; then
6643
        BUILD_OPTIONS="$BUILD_OPTIONS $config_option"
6644
    fi
6645
done
6646
6647
# put the options that we are missing into .options
6648
rm -f .options
6649
for opt in `echo $ALL_OPTIONS`; do
6650
    SKIP="no"
6651
    if echo $BUILD_OPTIONS | grep $opt >/dev/null 2>&1; then
6652
        SKIP="yes"
6653
    fi
6654
    if [ "$SKIP" = "no" ]; then
6655
        echo "$opt" >> .options
6656
    fi
6657
done
6658
6659
# reconstruct BUILD_OPTIONS with a sorted negative feature list
6660
# (ie. only things that are missing are will be put into the build key)
6661
BUILD_OPTIONS=
6662
if [ -f .options ]; then
6663
    for opt in `sort -f .options | uniq`; do
6664
        BUILD_OPTIONS="$BUILD_OPTIONS no-$opt"
6665
    done
6666
fi
6667
rm -f .options
6668
6669
# QT_NO* defines affect the Qt API (and binary compatibility).  they need
6670
# to be included in the build key
6671
for build_option in $D_FLAGS; do
6672
    build_option=`echo $build_option | cut -d \" -f 2 -`
6673
    case "$build_option" in
6674
    QT_NO*)
6675
        echo "$build_option" >> .options
6676
        ;;
6677
    *)
6678
        # skip all other compiler defines
6679
        ;;
6680
    esac
6681
done
6682
6683
# sort the compile time defines (helps ensure that changes in this configure
6684
# script don't affect the QT_BUILD_KEY generation)
6685
if [ -f .options ]; then
6686
    for opt in `sort -f .options | uniq`; do
6687
        BUILD_OPTIONS="$BUILD_OPTIONS $opt"
6688
    done
6689
fi
6690
rm -f .options
6691
6692
BUILD_OPTIONS="$BUILD_CONFIG $BUILD_OPTIONS"
6693
# extract the operating system from the XPLATFORM
6694
TARGET_OPERATING_SYSTEM=`echo $XPLATFORM | cut -f 2- -d/ | cut -f -1 -d-`
6695
6696
# when cross-compiling, don't include build-host information (build key is target specific)
6697
QT_BUILD_KEY="$CFG_USER_BUILD_KEY $CFG_ARCH $TARGET_OPERATING_SYSTEM $COMPILER $BUILD_OPTIONS"
6698
if [ -n "$QT_NAMESPACE" ]; then
6699
    QT_BUILD_KEY="$QT_BUILD_KEY $QT_NAMESPACE"
6700
fi
6701
MAC_NEED_TWO_BUILD_KEYS="no"
6702
if [ "$PLATFORM_MAC" = "yes" -a "$CFG_MAC_COCOA" = "yes" ]; then
6703
    QT_BUILD_KEY_CARBON=$QT_BUILD_KEY
6704
    TARGET_OPERATING_SYSTEM="$TARGET_OPERATING_SYSTEM-cocoa"
6705
    QT_BUILD_KEY_COCOA="$CFG_USER_BUILD_KEY $CFG_ARCH $TARGET_OPERATING_SYSTEM $COMPILER $BUILD_OPTIONS"
6706
    if [ "$CFG_MAC_CARBON" = "no" ]; then
6707
        QT_BUILD_KEY=$QT_BUILD_KEY_COCOA
6708
    else
6709
        MAC_NEED_TWO_BUILD_KEYS="yes"
6710
    fi
6711
fi
6712
# don't break loading plugins build with an older version of Qt
6713
QT_BUILD_KEY_COMPAT=
6714
if [ "$QT_CROSS_COMPILE" = "no" ]; then
6715
    # previous versions of Qt used a build key built from the uname
6716
    QT_BUILD_KEY_COMPAT="$CFG_USER_BUILD_KEY $UNAME_MACHINE $UNAME_SYSTEM $COMPILER $BUILD_OPTIONS"
6717
    if [ -n "$QT_NAMESPACE" ]; then
6718
        QT_BUILD_KEY_COMPAT="$QT_BUILD_KEY_COMPAT $QT_NAMESPACE"
6719
    fi
6720
fi
6721
# strip out leading/trailing/extra whitespace
6722
QT_BUILD_KEY=`echo $QT_BUILD_KEY | sed -e "s,  *, ,g" -e "s,^  *,," -e "s,  *$,,"`
6723
QT_BUILD_KEY_COMPAT=`echo $QT_BUILD_KEY_COMPAT | sed -e "s,  *, ,g" -e "s,^  *,," -e "s,  *$,,"`
6724
6725
#-------------------------------------------------------------------------------
6726
# part of configuration information goes into qconfig.h
6727
#-------------------------------------------------------------------------------
6728
6729
case "$CFG_QCONFIG" in
6730
full)
6731
    echo "/* Everything */" >"$outpath/src/corelib/global/qconfig.h.new"
6732
    ;;
6733
*)
6734
    tmpconfig="$outpath/src/corelib/global/qconfig.h.new"
6735
    echo "#ifndef QT_BOOTSTRAPPED" >"$tmpconfig"
6736
    cat "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" >>"$tmpconfig"
6737
    echo "#endif" >>"$tmpconfig"
6738
    ;;
6739
esac
6740
6741
cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6742
6743
/* Qt Edition */
6744
#ifndef QT_EDITION
6745
#  define QT_EDITION $QT_EDITION
6746
#endif
6747
6748
/* Machine byte-order */
6749
#define Q_BIG_ENDIAN 4321
6750
#define Q_LITTLE_ENDIAN 1234
6751
EOF
6752
6753
if [ "$MAC_NEED_TWO_BUILD_KEYS" = "no" ]; then
6754
    echo "#define QT_BUILD_KEY \"$QT_BUILD_KEY\"" \
6755
        >> "$outpath/src/corelib/global/qconfig.h.new"
6756
else
6757
    cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6758
6759
#define QT_BUILD_KEY_CARBON "$QT_BUILD_KEY_CARBON"
6760
#define QT_BUILD_KEY_COCOA "$QT_BUILD_KEY_COCOA"
6761
EOF
6762
fi
6763
6764
if [ -n "$QT_BUILD_KEY_COMPAT" ]; then
6765
    echo "#define QT_BUILD_KEY_COMPAT \"$QT_BUILD_KEY_COMPAT\"" \
6766
        >> "$outpath/src/corelib/global/qconfig.h.new"
6767
fi
6768
echo "" >>"$outpath/src/corelib/global/qconfig.h.new"
6769
6770
echo "#ifdef QT_BOOTSTRAPPED" >>"$outpath/src/corelib/global/qconfig.h.new"
6771
if [ "$CFG_HOST_ENDIAN" = "auto" ]; then
6772
    cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6773
#if defined(__BIG_ENDIAN__)
6774
# define Q_BYTE_ORDER Q_BIG_ENDIAN
6775
#elif defined(__LITTLE_ENDIAN__)
6776
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
6777
#else
6778
# error "Unable to determine byte order!"
6779
#endif
6780
EOF
6781
else
6782
    echo "#define Q_BYTE_ORDER $CFG_HOST_ENDIAN" >>"$outpath/src/corelib/global/qconfig.h.new"
6783
fi
6784
echo "#else" >>"$outpath/src/corelib/global/qconfig.h.new"
6785
if [ "$CFG_ENDIAN" = "auto" ]; then
6786
    cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6787
#if defined(__BIG_ENDIAN__)
6788
# define Q_BYTE_ORDER Q_BIG_ENDIAN
6789
#elif defined(__LITTLE_ENDIAN__)
6790
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
6791
#else
6792
# error "Unable to determine byte order!"
6793
#endif
6794
EOF
6795
else
6796
    echo "#define Q_BYTE_ORDER $CFG_ENDIAN" >>"$outpath/src/corelib/global/qconfig.h.new"
6797
fi
6798
echo "#endif" >>"$outpath/src/corelib/global/qconfig.h.new"
6799
6800
if [ "$CFG_DOUBLEFORMAT" != "normal" ]; then
6801
    cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6802
/* Non-IEEE double format */
6803
#define Q_DOUBLE_LITTLE "01234567"
6804
#define Q_DOUBLE_BIG "76543210"
6805
#define Q_DOUBLE_LITTLE_SWAPPED "45670123"
6806
#define Q_DOUBLE_BIG_SWAPPED "32107654"
6807
#define Q_DOUBLE_FORMAT $CFG_DOUBLEFORMAT
6808
EOF
6809
fi
6810
if [ "$CFG_ARMFPA" = "yes" ]; then
6811
    if [ "$CFG_ARCH" != "$CFG_HOST_ARCH" ]; then
6812
	cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6813
#ifndef QT_BOOTSTRAPPED
6814
# define QT_ARMFPA
6815
#endif
6816
EOF
6817
    else
6818
	echo "#define QT_ARMFPA" >>"$outpath/src/corelib/global/qconfig.h.new"
6819
    fi
6820
fi
6821
6822
CFG_ARCH_STR=`echo $CFG_ARCH | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
6823
CFG_HOST_ARCH_STR=`echo $CFG_HOST_ARCH | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
6824
cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6825
/* Machine Architecture */
6826
#ifndef QT_BOOTSTRAPPED
6827
# define QT_ARCH_${CFG_ARCH_STR}
6828
#else
6829
# define QT_ARCH_${CFG_HOST_ARCH_STR}
6830
#endif
6831
EOF
6832
6833
echo '/* Compile time features */' >>"$outpath/src/corelib/global/qconfig.h.new"
6834
[ '!' -z "$LicenseKeyExt" ] && echo "#define QT_PRODUCT_LICENSEKEY \"$LicenseKeyExt\"" >>"$outpath/src/corelib/global/qconfig.h.new"
6835
6836
if [ "$CFG_LARGEFILE" = "yes" ]; then
6837
    echo "#define QT_LARGEFILE_SUPPORT 64" >>"$outpath/src/corelib/global/qconfig.h.new"
6838
fi
6839
6840
# if both carbon and cocoa are specified, enable the autodetection code.
6841
if [ "$CFG_MAC_COCOA" = "yes" -a "$CFG_MAC_CARBON" = "yes" ]; then
6842
    echo "#define AUTODETECT_COCOA 1" >>"$outpath/src/corelib/global/qconfig.h.new"
6843
elif [ "$CFG_MAC_COCOA" = "yes" ]; then
6844
    echo "#define QT_MAC_USE_COCOA 1" >>"$outpath/src/corelib/global/qconfig.h.new"
6845
fi
6846
6847
if [ "$CFG_FRAMEWORK" = "yes" ]; then
6848
    echo "#define QT_MAC_FRAMEWORK_BUILD" >>"$outpath/src/corelib/global/qconfig.h.new"
6849
fi
6850
6851
if [ "$PLATFORM_MAC" = "yes" ]; then
6852
    cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
6853
#if defined(__LP64__)
6854
# define QT_POINTER_SIZE 8
6855
#else
6856
# define QT_POINTER_SIZE 4
6857
#endif
6858
EOF
6859
else
6860
    "$unixtests/ptrsize.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
6861
    echo "#define QT_POINTER_SIZE $?" >>"$outpath/src/corelib/global/qconfig.h.new"
6862
fi
6863
6864
6865
echo "" >>"$outpath/src/corelib/global/qconfig.h.new"
6866
6867
if [ "$CFG_DEV" = "yes" ]; then
6868
    echo "#define QT_BUILD_INTERNAL" >>"$outpath/src/corelib/global/qconfig.h.new"
6869
fi
6870
6871
# Embedded compile time options
6872
if [ "$PLATFORM_QWS" = "yes" ]; then
6873
    # Add QWS to config.h
6874
    QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QWS"
6875
6876
    # Add excluded decorations to $QCONFIG_FLAGS
6877
    decors=`grep '^decorations -= ' "$QMAKE_VARS_FILE" | ${AWK} '{print $3}'`
6878
    for decor in $decors; do
6879
        NODECORATION=`echo $decor | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
6880
        QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_NO_QWS_DECORATION_${NODECORATION}"
6881
    done
6882
6883
    # Figure which embedded drivers which are turned off
6884
    CFG_GFX_OFF="$CFG_GFX_AVAILABLE"
6885
    for ADRIVER in $CFG_GFX_ON; do
6886
        CFG_GFX_OFF=`echo "${CFG_GFX_OFF} " | sed "s,${ADRIVER} ,,g"`
6887
    done
6888
6889
    CFG_KBD_OFF="$CFG_KBD_AVAILABLE"
6890
    # the um driver is currently not in the available list for external builds
6891
    if [ "$CFG_DEV" = "no" ]; then
6892
	CFG_KBD_OFF="$CFG_KBD_OFF um"
6893
    fi
6894
    for ADRIVER in $CFG_KBD_ON; do
6895
        CFG_KBD_OFF=`echo "${CFG_KBD_OFF} " | sed "s,${ADRIVER} ,,g"`
6896
    done
6897
6898
    CFG_MOUSE_OFF="$CFG_MOUSE_AVAILABLE"
6899
    for ADRIVER in $CFG_MOUSE_ON; do
6900
        CFG_MOUSE_OFF=`echo "${CFG_MOUSE_OFF} " | sed "s,${ADRIVER} ,,g"`
6901
    done
6902
6903
    for DRIVER in $CFG_GFX_OFF; do
6904
        NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
6905
        QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_$NODRIVER"
6906
    done
6907
6908
    for DRIVER in $CFG_KBD_OFF; do
6909
        NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
6910
        QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_KBD_$NODRIVER"
6911
    done
6912
6913
    for DRIVER in $CFG_MOUSE_OFF; do
6914
        NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
6915
        QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_MOUSE_$NODRIVER"
6916
    done
6917
fi # QWS
6918
6919
if [ "${CFG_USE_FLOATMATH}" = "yes" ]; then
6920
    QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_USE_MATH_H_FLOATS"
6921
fi
6922
6923
# Add turned on SQL drivers
6924
for DRIVER in $CFG_SQL_AVAILABLE; do
6925
    eval "VAL=\$CFG_SQL_$DRIVER"
6926
    case "$VAL" in
6927
    qt)
6928
        ONDRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
6929
        QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SQL_$ONDRIVER"
6930
        SQL_DRIVERS="$SQL_DRIVERS $DRIVER"
6931
    ;;
6932
    plugin)
6933
        SQL_PLUGINS="$SQL_PLUGINS $DRIVER"
6934
    ;;
6935
    esac
6936
done
6937
6938
6939
QMakeVar set sql-drivers "$SQL_DRIVERS"
6940
QMakeVar set sql-plugins "$SQL_PLUGINS"
6941
6942
# Add other configuration options to the qconfig.h file
6943
[ "$CFG_GIF" = "yes" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_BUILTIN_GIF_READER=1"
6944
[ "$CFG_TIFF" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_TIFF"
6945
[ "$CFG_PNG" != "yes" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_PNG"
6946
[ "$CFG_JPEG" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_JPEG"
6947
[ "$CFG_MNG" != "yes" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_MNG"
6948
[ "$CFG_ZLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ZLIB"
6949
[ "$CFG_EXCEPTIONS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EXCEPTIONS"
6950
[ "$CFG_IPV6" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IPV6"
6951
[ "$CFG_SXE" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SXE"
6952
[ "$CFG_DBUS" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS"
6953
6954
if [ "$PLATFORM_QWS" != "yes" ]; then
6955
    [ "$CFG_GRAPHICS_SYSTEM" = "raster" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_RASTER"
6956
    [ "$CFG_GRAPHICS_SYSTEM" = "opengl" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_OPENGL"
6957
    [ "$CFG_GRAPHICS_SYSTEM" = "openvg" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_OPENVG"
6958
fi
6959
6960
# X11/Unix/Mac only configs
6961
[ "$CFG_CUPS" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CUPS"
6962
[ "$CFG_ICONV" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ICONV"
6963
[ "$CFG_GLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GLIB"
6964
[ "$CFG_GSTREAMER" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GSTREAMER"
6965
[ "$CFG_QGTKSTYLE" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STYLE_GTK"
6966
[ "$CFG_CLOCK_MONOTONIC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CLOCK_MONOTONIC"
6967
[ "$CFG_MREMAP" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MREMAP"
6968
[ "$CFG_GETADDRINFO" = "no" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETADDRINFO"
6969
[ "$CFG_IPV6IFNAME" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IPV6IFNAME"
6970
[ "$CFG_GETIFADDRS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETIFADDRS"
6971
[ "$CFG_INOTIFY" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_INOTIFY"
6972
[ "$CFG_NAS" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NAS"
6973
[ "$CFG_NIS" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NIS"
6974
[ "$CFG_OPENSSL" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENSSL"
6975
[ "$CFG_OPENSSL" = "linked" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LINKED_OPENSSL"
6976
6977
[ "$CFG_SM" = "no" ]         && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SESSIONMANAGER"
6978
[ "$CFG_XCURSOR" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XCURSOR"
6979
[ "$CFG_XFIXES" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XFIXES"
6980
[ "$CFG_FONTCONFIG" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FONTCONFIG"
6981
[ "$CFG_XINERAMA" = "no" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINERAMA"
6982
[ "$CFG_XKB" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XKB"
6983
[ "$CFG_XRANDR" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRANDR"
6984
[ "$CFG_XRENDER" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRENDER"
6985
[ "$CFG_MITSHM" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MITSHM"
6986
[ "$CFG_XSHAPE" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SHAPE"
6987
[ "$CFG_XSYNC" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XSYNC"
6988
[ "$CFG_XINPUT" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINPUT QT_NO_TABLET"
6989
6990
[ "$CFG_XCURSOR" = "runtime" ]   && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XCURSOR"
6991
[ "$CFG_XINERAMA" = "runtime" ]  && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINERAMA"
6992
[ "$CFG_XFIXES" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XFIXES"
6993
[ "$CFG_XRANDR" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XRANDR"
6994
[ "$CFG_XINPUT" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINPUT"
6995
[ "$CFG_ALSA" = "no" ]           && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ALSA"
6996
6997
# sort QCONFIG_FLAGS for neatness if we can
6998
[ '!' -z "$AWK" ] && QCONFIG_FLAGS=`echo $QCONFIG_FLAGS | $AWK '{ gsub(" ", "\n"); print }' | sort | uniq`
6999
QCONFIG_FLAGS=`echo $QCONFIG_FLAGS`
7000
7001
if [ -n "$QCONFIG_FLAGS" ]; then
7002
    for cfg in $QCONFIG_FLAGS; do
7003
        cfgd=`echo $cfg | sed 's/=.*$//'` # trim pushed 'Foo=Bar' defines
7004
        cfg=`echo $cfg | sed 's/=/ /'`    # turn first '=' into a space
7005
        # figure out define logic, so we can output the correct
7006
        # ifdefs to override the global defines in a project
7007
        cfgdNeg=
7008
        if [ true ] && echo "$cfgd" | grep 'QT_NO_' >/dev/null 2>&1; then
7009
            # QT_NO_option can be forcefully turned on by QT_option
7010
            cfgdNeg=`echo $cfgd | sed "s,QT_NO_,QT_,"`
7011
        elif [ true ] && echo "$cfgd" | grep 'QT_' >/dev/null 2>&1; then
7012
            # QT_option can be forcefully turned off by QT_NO_option
7013
            cfgdNeg=`echo $cfgd | sed "s,QT_,QT_NO_,"`
7014
        fi
7015
7016
        if [ -z $cfgdNeg ]; then
7017
cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
7018
#ifndef $cfgd
7019
# define $cfg
7020
#endif
7021
7022
EOF
7023
        else
7024
cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
7025
#if defined($cfgd) && defined($cfgdNeg)
7026
# undef $cfgd
7027
#elif !defined($cfgd) && !defined($cfgdNeg)
7028
# define $cfg
7029
#endif
7030
7031
EOF
7032
        fi
7033
    done
7034
fi
7035
7036
if [ "$CFG_REDUCE_EXPORTS" = "yes" ]; then
7037
cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF
7038
#define QT_VISIBILITY_AVAILABLE
7039
7040
EOF
7041
fi
7042
7043
# avoid unecessary rebuilds by copying only if qconfig.h has changed
7044
if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then
7045
    rm -f "$outpath/src/corelib/global/qconfig.h.new"
7046
else
7047
    [ -f "$outpath/src/corelib/global/qconfig.h" ] && chmod +w "$outpath/src/corelib/global/qconfig.h"
7048
    mv "$outpath/src/corelib/global/qconfig.h.new" "$outpath/src/corelib/global/qconfig.h"
7049
    chmod -w "$outpath/src/corelib/global/qconfig.h"
7050
    for conf in "$outpath/include/QtCore/qconfig.h" "$outpath/include/Qt/qconfig.h"; do
7051
        if [ '!' -f "$conf" ]; then
7052
            ln -s "$outpath/src/corelib/global/qconfig.h" "$conf"
7053
        fi
7054
    done
7055
fi
7056
7057
#-------------------------------------------------------------------------------
7058
# save configuration into qconfig.pri
7059
#-------------------------------------------------------------------------------
7060
7061
QTCONFIG="$outpath/mkspecs/qconfig.pri"
7062
QTCONFIG_CONFIG="$QTCONFIG_CONFIG no_mocdepend"
7063
[ -f "$QTCONFIG.tmp" ] && rm -f "$QTCONFIG.tmp"
7064
if [ "$CFG_DEBUG" = "yes" ]; then
7065
    QTCONFIG_CONFIG="$QTCONFIG_CONFIG debug"
7066
    if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
7067
        QT_CONFIG="$QT_CONFIG release"
7068
    fi
7069
    QT_CONFIG="$QT_CONFIG debug"
7070
elif [ "$CFG_DEBUG" = "no" ]; then
7071
    QTCONFIG_CONFIG="$QTCONFIG_CONFIG release"
7072
    if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
7073
        QT_CONFIG="$QT_CONFIG debug"
7074
    fi
7075
    QT_CONFIG="$QT_CONFIG release"
7076
fi
7077
if [ "$CFG_STL" = "yes" ]; then
7078
    QTCONFIG_CONFIG="$QTCONFIG_CONFIG stl"
7079
fi
7080
if [ "$CFG_FRAMEWORK" = "no" ]; then
7081
    QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_no_framework"
7082
else
7083
    QT_CONFIG="$QT_CONFIG qt_framework"
7084
    QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_framework"
7085
fi
7086
if [ "$PLATFORM_MAC" = "yes" ]; then
7087
    QT_CONFIG="$QT_CONFIG $CFG_MAC_ARCHS"
7088
fi
7089
if [ "$CFG_DEV" = "yes" ]; then
7090
    QT_CONFIG="$QT_CONFIG private_tests"
7091
fi
7092
7093
# Make the application arch follow the Qt arch for single arch builds.
7094
# (for multiple-arch builds, set CONFIG manually in the application .pro file)
7095
if [ `echo "$CFG_MAC_ARCHS" | wc -w` -eq 1 ]; then
7096
    QTCONFIG_CONFIG="$QTCONFIG_CONFIG $CFG_MAC_ARCHS"
7097
fi
7098
7099
cat >>"$QTCONFIG.tmp" <<EOF
7100
#configuration
7101
CONFIG += $QTCONFIG_CONFIG
7102
QT_ARCH = $CFG_ARCH
7103
QT_EDITION = $Edition
7104
QT_CONFIG += $QT_CONFIG
7105
7106
#versioning
7107
QT_VERSION = $QT_VERSION
7108
QT_MAJOR_VERSION = $QT_MAJOR_VERSION
7109
QT_MINOR_VERSION = $QT_MINOR_VERSION
7110
QT_PATCH_VERSION = $QT_PATCH_VERSION
7111
7112
#namespaces
7113
QT_LIBINFIX = $QT_LIBINFIX
7114
QT_NAMESPACE = $QT_NAMESPACE
7115
QT_NAMESPACE_MAC_CRC = $QT_NAMESPACE_MAC_CRC
7116
7117
EOF
7118
if [ "$CFG_RPATH" = "yes" ]; then
7119
    echo "QMAKE_RPATHDIR += \"$QT_INSTALL_LIBS\"" >> "$QTCONFIG.tmp"
7120
fi
7121
if [ -n "$QT_GCC_MAJOR_VERSION" ]; then
7122
    echo "QT_GCC_MAJOR_VERSION = $QT_GCC_MAJOR_VERSION" >> "$QTCONFIG.tmp"
7123
    echo "QT_GCC_MINOR_VERSION = $QT_GCC_MINOR_VERSION" >> "$QTCONFIG.tmp"
7124
    echo "QT_GCC_PATCH_VERSION = $QT_GCC_PATCH_VERSION" >> "$QTCONFIG.tmp"
7125
fi
7126
# replace qconfig.pri if it differs from the newly created temp file
7127
if cmp -s "$QTCONFIG.tmp" "$QTCONFIG"; then
7128
    rm -f "$QTCONFIG.tmp"
7129
else
7130
    mv -f "$QTCONFIG.tmp" "$QTCONFIG"
7131
fi
7132
7133
#-------------------------------------------------------------------------------
7134
# save configuration into .qmake.cache
7135
#-------------------------------------------------------------------------------
7136
7137
CACHEFILE="$outpath/.qmake.cache"
7138
[ -f "$CACHEFILE.tmp" ] && rm -f "$CACHEFILE.tmp"
7139
cat >>"$CACHEFILE.tmp" <<EOF
7140
CONFIG += $QMAKE_CONFIG dylib create_prl link_prl depend_includepath fix_output_dirs QTDIR_build
7141
QT_SOURCE_TREE = \$\$quote($relpath)
7142
QT_BUILD_TREE = \$\$quote($outpath)
7143
QT_BUILD_PARTS = $CFG_BUILD_PARTS
7144
QMAKE_ABSOLUTE_SOURCE_ROOT = \$\$QT_SOURCE_TREE
7145
QMAKE_MOC_SRC    = \$\$QT_BUILD_TREE/src/moc
7146
7147
#local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR
7148
QMAKE_MOC        = \$\$QT_BUILD_TREE/bin/moc
7149
QMAKE_UIC        = \$\$QT_BUILD_TREE/bin/uic
7150
QMAKE_UIC3       = \$\$QT_BUILD_TREE/bin/uic3
7151
QMAKE_RCC        = \$\$QT_BUILD_TREE/bin/rcc
7152
QMAKE_QDBUSXML2CPP = \$\$QT_BUILD_TREE/bin/qdbusxml2cpp
7153
QMAKE_INCDIR_QT  = \$\$QT_BUILD_TREE/include
7154
QMAKE_LIBDIR_QT  = \$\$QT_BUILD_TREE/lib
7155
7156
EOF
7157
7158
# Ensure we can link to uninistalled libraries
7159
if linkerSupportsFlag -rpath-link "$outpath/lib"; then
7160
    echo "QMAKE_LFLAGS    += -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib" >> "$CACHEFILE.tmp"
7161
fi
7162
7163
if [ -n "$QT_CFLAGS_PSQL" ]; then
7164
    echo "QT_CFLAGS_PSQL   = $QT_CFLAGS_PSQL" >> "$CACHEFILE.tmp"
7165
fi
7166
if [ -n "$QT_LFLAGS_PSQL" ]; then
7167
    echo "QT_LFLAGS_PSQL   = $QT_LFLAGS_PSQL" >> "$CACHEFILE.tmp"
7168
fi
7169
if [ -n "$QT_CFLAGS_MYSQL" ]; then
7170
    echo "QT_CFLAGS_MYSQL   = $QT_CFLAGS_MYSQL" >> "$CACHEFILE.tmp"
7171
fi
7172
if [ -n "$QT_LFLAGS_MYSQL" ]; then
7173
    echo "QT_LFLAGS_MYSQL   = $QT_LFLAGS_MYSQL" >> "$CACHEFILE.tmp"
7174
fi
7175
if [ -n "$QT_CFLAGS_SQLITE" ]; then
7176
    echo "QT_CFLAGS_SQLITE   = $QT_CFLAGS_SQLITE" >> "$CACHEFILE.tmp"
7177
fi
7178
if [ -n "$QT_LFLAGS_SQLITE" ]; then
7179
    echo "QT_LFLAGS_SQLITE   = $QT_LFLAGS_SQLITE" >> "$CACHEFILE.tmp"
7180
fi
7181
if [ -n "$QT_LFLAGS_ODBC" ]; then
7182
    echo "QT_LFLAGS_ODBC   = $QT_LFLAGS_ODBC" >> "$CACHEFILE.tmp"
7183
fi
7184
7185
if [ "$QT_EDITION" != "QT_EDITION_OPENSOURCE" ]; then
7186
    echo "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" >> "$CACHEFILE.tmp"
7187
fi
7188
7189
#dump in the OPENSSL_LIBS info
7190
if [ '!' -z "$OPENSSL_LIBS" ]; then
7191
    echo "OPENSSL_LIBS = $OPENSSL_LIBS" >> "$CACHEFILE.tmp"
7192
elif [ "$CFG_OPENSSL" = "linked" ]; then
7193
    echo "OPENSSL_LIBS = -lssl -lcrypto" >> "$CACHEFILE.tmp"
7194
fi
7195
7196
#dump in the SDK info
7197
if [ '!' -z "$CFG_SDK" ]; then
7198
   echo "QMAKE_MAC_SDK = $CFG_SDK" >> "$CACHEFILE.tmp"
7199
fi
7200
7201
# mac gcc -Xarch support
7202
if [ "$CFG_MAC_XARCH" = "no" ]; then
7203
   echo "QMAKE_MAC_XARCH = no" >> "$CACHEFILE.tmp"
7204
fi
7205
7206
#dump the qmake spec
7207
if [ -d "$outpath/mkspecs/$XPLATFORM" ]; then
7208
   echo "QMAKESPEC = \$\$QT_BUILD_TREE/mkspecs/$XPLATFORM" >> "$CACHEFILE.tmp"
7209
else
7210
   echo "QMAKESPEC = $XPLATFORM" >> "$CACHEFILE.tmp"
7211
fi
7212
7213
# cmdline args
7214
cat "$QMAKE_VARS_FILE" >> "$CACHEFILE.tmp"
7215
rm -f "$QMAKE_VARS_FILE" 2>/dev/null
7216
7217
# incrementals
7218
INCREMENTAL=""
7219
[ "$CFG_INCREMENTAL" = "auto" ] && "$WHICH" p4 >/dev/null 2>&1 && [ "$CFG_DEV" = "yes" ] && CFG_INCREMENTAL="yes"
7220
if [ "$CFG_INCREMENTAL" = "yes" ]; then
7221
    find "$relpath" -perm u+w -mtime -3 | grep 'cpp$' | while read f; do
7222
        # don't need to worry about generated files
7223
        [ -r `echo $f | sed "s,cpp$,ui,"` ] && continue
7224
        basename "$f" | grep '^moc_' >/dev/null 2>&1 && continue
7225
        # done
7226
        INCREMENTAL="$INCREMENTAL `basename \"$f\" | sed 's,.cpp,.o,'`"
7227
    done
7228
    [ '!' -z "$INCREMENTAL" ] && echo "QMAKE_INCREMENTAL += $INCREMENTAL" >> "$CACHEFILE.tmp"
7229
    [ -r "$outpath/.qmake.incremental" ] && echo "include($outpath/.qmake.incremental)" >> "$CACHEFILE.tmp"
7230
fi
7231
7232
# replace .qmake.cache if it differs from the newly created temp file
7233
if cmp -s "$CACHEFILE.tmp" "$CACHEFILE"; then
7234
    rm -f "$CACHEFILE.tmp"
7235
else
7236
    mv -f "$CACHEFILE.tmp" "$CACHEFILE"
7237
fi
7238
7239
#-------------------------------------------------------------------------------
7240
# give feedback on configuration
7241
#-------------------------------------------------------------------------------
7242
7243
case "$COMPILER" in
7244
g++*)
7245
    if [ "$CFG_EXCEPTIONS" != "no" ]; then
7246
        cat <<EOF
7247
7248
        This target is using the GNU C++ compiler ($PLATFORM).
7249
7250
        Recent versions of this compiler automatically include code for
7251
        exceptions, which increase both the size of the Qt libraries and
7252
        the amount of memory taken by your applications.
7253
7254
        You may choose to re-run `basename $0` with the -no-exceptions
7255
        option to compile Qt without exceptions. This is completely binary
7256
        compatible, and existing applications will continue to work.
7257
7258
EOF
7259
    fi
7260
    ;;
7261
cc*)
7262
    case "$PLATFORM" in
7263
    irix-cc*)
7264
        if [ "$CFG_EXCEPTIONS" != "no" ]; then
7265
            cat <<EOF
7266
7267
        This target is using the MIPSpro C++ compiler ($PLATFORM).
7268
7269
        You may choose to re-run `basename $0` with the -no-exceptions
7270
        option to compile Qt without exceptions. This will make the
7271
        size of the Qt library smaller and reduce the amount of memory
7272
        taken by your applications.
7273
7274
EOF
7275
        fi
7276
        ;;
7277
    *) ;;
7278
    esac
7279
    ;;
7280
*) ;;
7281
esac
7282
7283
if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "no" ]  && [ "$CFG_WEBKIT" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
7284
    cat <<EOF
7285
        WARNING: DWARF2 debug symbols are not enabled. Linking webkit
7286
        in debug mode will run out of memory on systems with 2GB or less.
7287
        Install Xcode 2.4.1 or higher to enable DWARF2, or configure with
7288
         -no-webkit or -release to skip webkit debug.
7289
EOF
7290
fi
7291
7292
echo
7293
if [ "$XPLATFORM" = "$PLATFORM" ]; then
7294
    echo "Build type:    $PLATFORM"
7295
else
7296
    echo "Building on:   $PLATFORM"
7297
    echo "Building for:  $XPLATFORM"
7298
fi
7299
7300
if [ "$PLATFORM_MAC" = "yes" ]; then
7301
    echo "Architecture:  $CFG_ARCH ($CFG_MAC_ARCHS )"
7302
else
7303
    echo "Architecture:  $CFG_ARCH"
7304
fi
7305
7306
if [ "$PLATFORM_QWS" = "yes" ]; then
7307
    echo "Host architecture: $CFG_HOST_ARCH"
7308
fi
7309
7310
if [ "$PLATFORM_MAC" = "yes" ]; then
7311
    if [ "$CFG_MAC_COCOA" = "yes" ]; then
7312
        if [ "$CFG_MAC_CARBON" = "yes" ]; then
7313
            echo "Using framework: Carbon for 32-bit, Cocoa for 64-bit"
7314
        else
7315
            echo "Using framework: Cocoa"
7316
        fi
7317
    else
7318
        echo "Using framework: Carbon"
7319
    fi
7320
fi
7321
7322
if [ -n "$PLATFORM_NOTES" ]; then
7323
    echo "Platform notes:"
7324
    echo "$PLATFORM_NOTES"
7325
else
7326
    echo
7327
fi
7328
7329
if [ "$OPT_VERBOSE" = "yes" ]; then
7330
    if echo '\c' | grep '\c' >/dev/null; then
7331
        echo -n "qmake vars .......... "
7332
    else
7333
        echo "qmake vars .......... \c"
7334
    fi
7335
    cat "$QMAKE_VARS_FILE" | tr '\n' ' '
7336
    echo "qmake switches ...... $QMAKE_SWITCHES"
7337
fi
7338
7339
[ "$CFG_INCREMENTAL" = "yes" ] && [ '!' -z "$INCREMENTAL" ] && echo "Incremental ......... $INCREMENTAL"
7340
echo "Build ............... $CFG_BUILD_PARTS"
7341
echo "Configuration ....... $QMAKE_CONFIG $QT_CONFIG"
7342
if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
7343
   echo "Debug ............... yes (combined)"
7344
   if [ "$CFG_DEBUG" = "yes" ]; then
7345
       echo "Default Link ........ debug"
7346
   else
7347
       echo "Default Link ........ release"
7348
   fi
7349
else
7350
   echo "Debug ............... $CFG_DEBUG"
7351
fi
7352
echo "Qt 3 compatibility .. $CFG_QT3SUPPORT"
7353
[ "$CFG_DBUS" = "no" ]     && echo "QtDBus module ....... no"
7354
[ "$CFG_DBUS" = "yes" ]    && echo "QtDBus module ....... yes (run-time)"
7355
[ "$CFG_DBUS" = "linked" ] && echo "QtDBus module ....... yes (linked)"
7356
echo "QtConcurrent code.... $CFG_CONCURRENT"
7357
echo "QtScript module ..... $CFG_SCRIPT"
7358
echo "QtScriptTools module  $CFG_SCRIPTTOOLS"
7359
echo "QtXmlPatterns module  $CFG_XMLPATTERNS"
7360
echo "Phonon module ....... $CFG_PHONON"
7361
echo "Multimedia module ... $CFG_MULTIMEDIA"
7362
echo "SVG module .......... $CFG_SVG"
7363
echo "WebKit module ....... $CFG_WEBKIT"
7364
if [ "$CFG_WEBKIT" = "yes" ]; then 
7365
    if [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
7366
        echo "JavaScriptCore JIT .. To be decided by JavaScriptCore"
7367
    else
7368
        echo "JavaScriptCore JIT .. $CFG_JAVASCRIPTCORE_JIT"
7369
    fi
7370
fi
7371
echo "Declarative module .. $CFG_DECLARATIVE"
7372
echo "STL support ......... $CFG_STL"
7373
echo "PCH support ......... $CFG_PRECOMPILE"
7374
echo "MMX/3DNOW/SSE/SSE2..  ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}"
7375
if [ "${CFG_ARCH}" = "arm" ]; then
7376
    echo "iWMMXt support ...... ${CFG_IWMMXT}"
7377
fi
7378
[ "${PLATFORM_QWS}" != "yes" ] && echo "Graphics System ..... $CFG_GRAPHICS_SYSTEM"
7379
echo "IPv6 support ........ $CFG_IPV6"
7380
echo "IPv6 ifname support . $CFG_IPV6IFNAME"
7381
echo "getaddrinfo support . $CFG_GETADDRINFO"
7382
echo "getifaddrs support .. $CFG_GETIFADDRS"
7383
echo "Accessibility ....... $CFG_ACCESSIBILITY"
7384
echo "NIS support ......... $CFG_NIS"
7385
echo "CUPS support ........ $CFG_CUPS"
7386
echo "Iconv support ....... $CFG_ICONV"
7387
echo "Glib support ........ $CFG_GLIB"
7388
echo "GStreamer support ... $CFG_GSTREAMER"
7389
echo "Large File support .. $CFG_LARGEFILE"
7390
echo "GIF support ......... $CFG_GIF"
7391
if [ "$CFG_TIFF" = "no" ]; then
7392
    echo "TIFF support ........ $CFG_TIFF"
7393
else
7394
    echo "TIFF support ........ $CFG_TIFF ($CFG_LIBTIFF)"
7395
fi
7396
if [ "$CFG_JPEG" = "no" ]; then
7397
    echo "JPEG support ........ $CFG_JPEG"
7398
else
7399
    echo "JPEG support ........ $CFG_JPEG ($CFG_LIBJPEG)"
7400
fi
7401
if [ "$CFG_PNG" = "no" ]; then
7402
    echo "PNG support ......... $CFG_PNG"
7403
else
7404
    echo "PNG support ......... $CFG_PNG ($CFG_LIBPNG)"
7405
fi
7406
if [ "$CFG_MNG" = "no" ]; then
7407
    echo "MNG support ......... $CFG_MNG"
7408
else
7409
    echo "MNG support ......... $CFG_MNG ($CFG_LIBMNG)"
7410
fi
7411
echo "zlib support ........ $CFG_ZLIB"
7412
echo "Session management .. $CFG_SM"
7413
if [ "$PLATFORM_QWS" = "yes" ]; then
7414
    echo "Embedded support .... $CFG_EMBEDDED"
7415
    if [ "$CFG_QWS_FREETYPE" = "auto" ]; then
7416
	echo "Freetype2 support ... $CFG_QWS_FREETYPE ($CFG_LIBFREETYPE)"
7417
    else
7418
	echo "Freetype2 support ... $CFG_QWS_FREETYPE"
7419
    fi
7420
    # Normalize the decoration output first
7421
    CFG_GFX_ON=`echo ${CFG_GFX_ON}`
7422
    CFG_GFX_PLUGIN=`echo ${CFG_GFX_PLUGIN}`
7423
    echo "Graphics (qt) ....... ${CFG_GFX_ON}"
7424
    echo "Graphics (plugin) ... ${CFG_GFX_PLUGIN}"
7425
    CFG_DECORATION_ON=`echo ${CFG_DECORATION_ON}`
7426
    CFG_DECORATION_PLUGIN=`echo ${CFG_DECORATION_PLUGIN}`
7427
    echo "Decorations (qt) .... $CFG_DECORATION_ON"
7428
    echo "Decorations (plugin)  $CFG_DECORATION_PLUGIN"
7429
    CFG_KBD_ON=`echo ${CFG_KBD_ON}`
7430
    CFG_KBD_PLUGIN=`echo ${CFG_KBD_PLUGIN}`
7431
    echo "Keyboard driver (qt). ${CFG_KBD_ON}"
7432
    echo "Keyboard driver (plugin) ${CFG_KBD_PLUGIN}"
7433
    CFG_MOUSE_ON=`echo ${CFG_MOUSE_ON}`
7434
    CFG_MOUSE_PLUGIN=`echo ${CFG_MOUSE_PLUGIN}`
7435
    echo "Mouse driver (qt) ... $CFG_MOUSE_ON"
7436
    echo "Mouse driver (plugin) $CFG_MOUSE_PLUGIN"
7437
fi
7438
if [ "$CFG_OPENGL" = "desktop" ]; then
7439
    echo "OpenGL support ...... yes (Desktop OpenGL)"
7440
elif [ "$CFG_OPENGL" = "es1" ]; then
7441
    echo "OpenGL support ...... yes (OpenGL ES 1.x Common profile)"
7442
elif [ "$CFG_OPENGL" = "es1cl" ]; then
7443
    echo "OpenGL support ...... yes (OpenGL ES 1.x Common Lite profile)"
7444
elif [ "$CFG_OPENGL" = "es2" ]; then
7445
    echo "OpenGL support ...... yes (OpenGL ES 2.x)"
7446
else
7447
    echo "OpenGL support ...... no"
7448
fi
7449
if [ "$CFG_EGL" != "no" ]; then
7450
    if [ "$CFG_EGL_GLES_INCLUDES" != "no" ]; then
7451
        echo "EGL support ......... yes <GLES/egl.h>"
7452
    else
7453
        echo "EGL support ......... yes <EGL/egl.h>"
7454
    fi
7455
fi
7456
if [ "$CFG_OPENVG" ]; then
7457
    if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
7458
        echo "OpenVG support ...... ShivaVG"
7459
    else
7460
        echo "OpenVG support ...... $CFG_OPENVG"
7461
    fi
7462
fi
7463
if [ "$PLATFORM_X11" = "yes" ]; then
7464
    echo "NAS sound support ... $CFG_NAS"
7465
    echo "XShape support ...... $CFG_XSHAPE"
7466
    echo "XSync support ....... $CFG_XSYNC"
7467
    echo "Xinerama support .... $CFG_XINERAMA"
7468
    echo "Xcursor support ..... $CFG_XCURSOR"
7469
    echo "Xfixes support ...... $CFG_XFIXES"
7470
    echo "Xrandr support ...... $CFG_XRANDR"
7471
    echo "Xrender support ..... $CFG_XRENDER"
7472
    echo "Xi support .......... $CFG_XINPUT"
7473
    echo "MIT-SHM support ..... $CFG_MITSHM"
7474
    echo "FontConfig support .. $CFG_FONTCONFIG"
7475
    echo "XKB Support ......... $CFG_XKB"
7476
    echo "immodule support .... $CFG_IM"
7477
    echo "GTK theme support ... $CFG_QGTKSTYLE"
7478
fi
7479
[ "$CFG_SQL_mysql" != "no" ] && echo "MySQL support ....... $CFG_SQL_mysql"
7480
[ "$CFG_SQL_psql" != "no" ] && echo "PostgreSQL support .. $CFG_SQL_psql"
7481
[ "$CFG_SQL_odbc" != "no" ] && echo "ODBC support ........ $CFG_SQL_odbc"
7482
[ "$CFG_SQL_oci" != "no" ] && echo "OCI support ......... $CFG_SQL_oci"
7483
[ "$CFG_SQL_tds" != "no" ] && echo "TDS support ......... $CFG_SQL_tds"
7484
[ "$CFG_SQL_db2" != "no" ] && echo "DB2 support ......... $CFG_SQL_db2"
7485
[ "$CFG_SQL_ibase" != "no" ] && echo "InterBase support ... $CFG_SQL_ibase"
7486
[ "$CFG_SQL_sqlite2" != "no" ] && echo "SQLite 2 support .... $CFG_SQL_sqlite2"
7487
[ "$CFG_SQL_sqlite" != "no" ] && echo "SQLite support ...... $CFG_SQL_sqlite ($CFG_SQLITE)"
7488
7489
OPENSSL_LINKAGE=""
7490
if [ "$CFG_OPENSSL" = "yes" ]; then
7491
    OPENSSL_LINKAGE="(run-time)"
7492
elif [ "$CFG_OPENSSL" = "linked" ]; then
7493
    OPENSSL_LINKAGE="(linked)"
7494
fi
7495
echo "OpenSSL support ..... $CFG_OPENSSL $OPENSSL_LINKAGE"
7496
7497
[ "$CFG_PTMALLOC" != "no" ] && echo "Use ptmalloc ........ $CFG_PTMALLOC"
7498
7499
# complain about not being able to use dynamic plugins if we are using a static build
7500
if [ "$CFG_SHARED" = "no" ]; then
7501
    echo
7502
    echo "WARNING: Using static linking will disable the use of dynamically"
7503
    echo "loaded plugins. Make sure to import all needed static plugins,"
7504
    echo "or compile needed modules into the library."
7505
    echo
7506
fi
7507
if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then
7508
    echo
7509
    echo "NOTE: When linking against OpenSSL, you can override the default"
7510
    echo "library names through OPENSSL_LIBS."
7511
    echo "For example:"
7512
    echo "    ./configure -openssl-linked OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto'"
7513
    echo
7514
fi
7515
if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then
7516
    echo
7517
    echo "NOTE: Mac OS X frameworks implicitly build debug and release Qt libraries."
7518
    echo
7519
fi
7520
echo "alsa support ........ $CFG_ALSA"
7521
echo
7522
7523
sepath=`echo "$relpath" | sed -e 's/\\./\\\\./g'`
7524
PROCS=1
7525
EXEC=""
7526
7527
7528
#-------------------------------------------------------------------------------
7529
# build makefiles based on the configuration
7530
#-------------------------------------------------------------------------------
7531
7532
echo "Finding project files. Please wait..."
7533
"$outpath/bin/qmake" -prl -r "${relpath}/projects.pro"
7534
if [ -f "${relpath}/projects.pro" ]; then
7535
    mkfile="${outpath}/Makefile"
7536
    [ -f "$mkfile" ] && chmod +w "$mkfile"
7537
    QTDIR="$outpath" "$outpath/bin/qmake" -spec "$XQMAKESPEC" "${relpath}/projects.pro" -o "$mkfile"
7538
fi
7539
7540
# .projects      -> projects to process
7541
# .projects.1    -> qt and moc
7542
# .projects.2    -> subdirs and libs
7543
# .projects.3    -> the rest
7544
rm -f .projects .projects.1 .projects.2 .projects.3
7545
7546
QMAKE_PROJECTS=`find "$relpath/." -name '*.pro' -print | sed 's-/\./-/-'`
7547
if [ -z "$AWK" ]; then
7548
    for p in `echo $QMAKE_PROJECTS`; do
7549
        echo "$p" >> .projects
7550
    done
7551
else
7552
    cat >projects.awk <<EOF
7553
BEGIN {
7554
    files = 0
7555
    target_file = ""
7556
    input_file = ""
7557
7558
    first = "./.projects.1.tmp"
7559
    second = "./.projects.2.tmp"
7560
    third = "./.projects.3.tmp"
7561
}
7562
7563
FNR == 1 {
7564
    if ( input_file ) {
7565
        if ( ! target_file )
7566
            target_file = third
7567
        print input_file >target_file
7568
    }
7569
7570
    matched_target = 0
7571
    template_lib = 0
7572
    input_file = FILENAME
7573
    target_file = ""
7574
}
7575
7576
/^(TARGET.*=)/ {
7577
    if ( \$3 == "moc" || \$3 ~ /^Qt/ ) {
7578
        target_file = first
7579
        matched_target = 1
7580
    }
7581
}
7582
7583
matched_target == 0 && /^(TEMPLATE.*=)/ {
7584
    if ( \$3 == "subdirs" )
7585
        target_file = second
7586
    else if ( \$3 == "lib" )
7587
        template_lib = 1
7588
    else
7589
        target_file = third
7590
}
7591
7592
matched_target == 0 && template_lib == 1 && /^(CONFIG.*=)/ {
7593
    if ( \$0 ~ /plugin/ )
7594
        target_file = third
7595
    else
7596
        target_file = second
7597
}
7598
7599
END {
7600
    if ( input_file ) {
7601
        if ( ! target_file )
7602
            target_file = third
7603
        print input_file >>target_file
7604
    }
7605
}
7606
7607
EOF
7608
7609
    rm -f .projects.all
7610
    for p in `echo $QMAKE_PROJECTS`; do
7611
       echo "$p" >> .projects.all
7612
    done
7613
7614
    # if you get errors about the length of the command line to awk, change the -l arg
7615
    # to split below
7616
    split -l 100 .projects.all .projects.all.
7617
    for p in .projects.all.*; do
7618
       "$AWK" -f projects.awk `cat $p`
7619
       [ -f .projects.1.tmp ] && cat .projects.1.tmp >> .projects.1
7620
       [ -f .projects.2.tmp ] && cat .projects.2.tmp >> .projects.2
7621
       [ -f .projects.3.tmp ] && cat .projects.3.tmp >> .projects.3
7622
       rm -f .projects.1.tmp .projects.2.tmp .projects.3.tmp $p
7623
    done
7624
    rm -f .projects.all* projects.awk
7625
7626
    [ -f .projects.1 ] && cat .projects.1 >>.projects
7627
    [ -f .projects.2 ] && cat .projects.2 >>.projects
7628
    rm -f .projects.1 .projects.2
7629
    if [ -f .projects.3 ] && [ "$OPT_FAST" = "no" ]; then
7630
       cat .projects.3 >>.projects
7631
       rm -f .projects.3
7632
    fi
7633
fi
7634
# don't sort Qt and MOC in with the other project files
7635
# also work around a segfaulting uniq(1)
7636
if [ -f .sorted.projects.2 ]; then
7637
    sort .sorted.projects.2 > .sorted.projects.2.new
7638
    mv -f .sorted.projects.2.new .sorted.projects.2
7639
    cat .sorted.projects.2 >> .sorted.projects.1
7640
fi
7641
[ -f .sorted.projects.1 ] && sort .sorted.projects.1 >> .sorted.projects
7642
rm -f .sorted.projects.2 .sorted.projects.1
7643
7644
NORM_PROJECTS=0
7645
FAST_PROJECTS=0
7646
if [ -f .projects ]; then
7647
   uniq .projects >.tmp
7648
   mv -f .tmp .projects
7649
   NORM_PROJECTS=`cat .projects | wc -l | sed -e "s, ,,g"`
7650
fi
7651
if [ -f .projects.3 ]; then
7652
   uniq .projects.3 >.tmp
7653
   mv -f .tmp .projects.3
7654
   FAST_PROJECTS=`cat .projects.3 | wc -l | sed -e "s, ,,g"`
7655
fi
7656
echo "  `expr $NORM_PROJECTS + $FAST_PROJECTS` projects found."
7657
echo
7658
7659
PART_ROOTS=
7660
for part in $CFG_BUILD_PARTS; do
7661
    case "$part" in
7662
    tools) PART_ROOTS="$PART_ROOTS tools" ;;
7663
    libs) PART_ROOTS="$PART_ROOTS src" ;;
7664
    examples) PART_ROOTS="$PART_ROOTS examples demos" ;;
7665
    *) ;;
7666
    esac
7667
done
7668
7669
if [ "$CFG_DEV" = "yes" ]; then
7670
    PART_ROOTS="$PART_ROOTS tests"
7671
fi
7672
7673
echo "Creating makefiles. Please wait..."
7674
for file in .projects .projects.3; do
7675
    [ '!' -f "$file" ] && continue
7676
    for a in `cat $file`; do
7677
        IN_ROOT=no
7678
	for r in $PART_ROOTS; do
7679
	    if echo "$a" | grep "^$r" >/dev/null 2>&1 || echo "$a" | grep "^$relpath/$r" >/dev/null 2>&1; then
7680
		IN_ROOT=yes
7681
		break
7682
            fi
7683
	done
7684
        [ "$IN_ROOT" = "no" ] && continue
7685
7686
        case $a in
7687
        *winmain/winmain.pro) continue ;;
7688
        *s60main/s60main.pro) continue ;;
7689
        *examples/activeqt/*) continue ;;
7690
        */qmake/qmake.pro) continue ;;
7691
        *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*) SPEC=$QMAKESPEC ;;
7692
        *) SPEC=$XQMAKESPEC ;;
7693
        esac
7694
        dir=`dirname "$a" | sed -e "s;$sepath;.;g"`
7695
        test -d "$dir" || mkdir -p "$dir"
7696
        OUTDIR="$outpath/$dir"
7697
        if [ -f "${OUTDIR}/Makefile" ] && [ "$OPT_FAST" = "yes" ]; then
7698
            # fast configure - the makefile exists, skip it
7699
            # since the makefile exists, it was generated by qmake, which means we
7700
            # can skip it, since qmake has a rule to regenerate the makefile if the .pro
7701
            # file changes...
7702
            [ "$OPT_VERBOSE" = "yes" ] && echo "  skipping $a"
7703
            continue;
7704
        fi
7705
        QMAKE_SPEC_ARGS="-spec $SPEC"
7706
        if echo '\c' | grep '\c' >/dev/null; then
7707
            echo -n "  for $a"
7708
        else
7709
            echo "  for $a\c"
7710
        fi
7711
7712
        QMAKE="$outpath/bin/qmake"
7713
	QMAKE_ARGS="$QMAKE_SWITCHES $QMAKE_SPEC_ARGS"
7714
        if [ "$file" = ".projects.3" ]; then
7715
            if echo '\c' | grep '\c' >/dev/null; then
7716
                echo -n " (fast)"
7717
            else
7718
                echo " (fast)\c"
7719
            fi
7720
            echo
7721
7722
            cat >"${OUTDIR}/Makefile" <<EOF
7723
# ${OUTDIR}/Makefile: generated by configure
7724
#
7725
# WARNING: This makefile will be replaced with a real makefile.
7726
# All changes made to this file will be lost.
7727
EOF
7728
            [ "$CFG_DEBUG_RELEASE" = "no" ] && echo "first_target: first" >>${OUTDIR}/Makefile
7729
7730
            cat >>"${OUTDIR}/Makefile" <<EOF
7731
QMAKE = "$QMAKE"
7732
all clean install qmake first Makefile: FORCE
7733
	\$(QMAKE) $QMAKE_ARGS -o "$OUTDIR" "$a"
7734
	cd "$OUTDIR"
7735
	\$(MAKE) \$@
7736
7737
FORCE:
7738
7739
EOF
7740
        else
7741
            if [ "$OPT_VERBOSE" = "yes" ]; then
7742
                echo " (`basename $SPEC`)"
7743
                echo "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
7744
	    else
7745
		echo
7746
            fi
7747
7748
            [ -f "${OUTDIR}/Makefile" ] && chmod +w "${OUTDIR}/Makefile"
7749
            QTDIR="$outpath" "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
7750
       fi
7751
    done
7752
done
7753
rm -f .projects .projects.3
7754
7755
#-------------------------------------------------------------------------------
7756
# XShape is important, DnD in the Designer doens't work without it
7757
#-------------------------------------------------------------------------------
7758
if [ "$PLATFORM_X11" = "yes" ] && [ "$CFG_XSHAPE" = "no" ]; then
7759
    cat <<EOF
7760
7761
	NOTICE: Qt will not be built with XShape support.
7762
7763
	As a result, drag-and-drop in the Qt Designer will NOT
7764
	work. We recommend that you enable XShape support by passing
7765
	the -xshape switch to $0.
7766
EOF
7767
fi
7768
7769
#-------------------------------------------------------------------------------
7770
# check for platforms that we don't yet know about
7771
#-------------------------------------------------------------------------------
7772
if [ "$CFG_ARCH" = "generic" ]; then
7773
cat <<EOF
7774
7775
        NOTICE: Atomic operations are not yet supported for this
7776
        architecture.
7777
7778
        Qt will use the 'generic' architecture instead, which uses a
7779
        single pthread_mutex_t to protect all atomic operations. This
7780
        implementation is the slow (but safe) fallback implementation
7781
        for architectures Qt does not yet support.
7782
EOF
7783
fi
7784
7785
#-------------------------------------------------------------------------------
7786
# check if the user passed the -no-zlib option, which is no longer supported
7787
#-------------------------------------------------------------------------------
7788
if [ -n "$ZLIB_FORCED" ]; then
7789
    which_zlib="supplied"
7790
    if [ "$CFG_ZLIB" = "system" ]; then
7791
	which_zlib="system"
7792
    fi
7793
7794
cat <<EOF
7795
7796
        NOTICE: The -no-zlib option was supplied but is no longer
7797
        supported.
7798
7799
        Qt now requires zlib support in all builds, so the -no-zlib
7800
        option was ignored. Qt will be built using the $which_zlib
7801
        zlib.
7802
EOF
7803
fi
7804
7805
#-------------------------------------------------------------------------------
7806
# finally save the executed command to another script
7807
#-------------------------------------------------------------------------------
7808
if [ `basename $0` != "config.status" ]; then
7809
    CONFIG_STATUS="$relpath/$relconf $OPT_CMDLINE"
7810
7811
    # add the system variables
7812
    for varname in $SYSTEM_VARIABLES; do
7813
        cmd=`echo \
7814
'if [ -n "\$'${varname}'" ]; then
7815
    CONFIG_STATUS="'${varname}'='"'\\\$${varname}'"' \$CONFIG_STATUS"
7816
fi'`
7817
	eval "$cmd"
7818
    done
7819
7820
    echo "$CONFIG_STATUS" | grep '\-confirm\-license' >/dev/null 2>&1 || CONFIG_STATUS="$CONFIG_STATUS -confirm-license"
7821
7822
    [ -f "$outpath/config.status" ] && rm -f "$outpath/config.status"
7823
    echo "#!/bin/sh" > "$outpath/config.status"
7824
    echo "if [ \"\$#\" -gt 0 ]; then" >> "$outpath/config.status"
7825
    echo "  $CONFIG_STATUS \"\$@\"" >> "$outpath/config.status"
7826
    echo "else" >> "$outpath/config.status"
7827
    echo "  $CONFIG_STATUS" >> "$outpath/config.status"
7828
    echo "fi" >> "$outpath/config.status"
7829
    chmod +x "$outpath/config.status"
7830
fi
7831
7832
if [ -n "$RPATH_MESSAGE" ]; then
7833
    echo
7834
    echo "$RPATH_MESSAGE"
7835
fi
7836
7837
MAKE=`basename "$MAKE"`
7838
echo
7839
echo Qt is now configured for building. Just run \'$MAKE\'.
7840
if [ "$relpath" = "$QT_INSTALL_PREFIX" ]; then
7841
    echo Once everything is built, Qt is installed.
7842
    echo You should not run \'$MAKE install\'.
7843
else
7844
    echo Once everything is built, you must run \'$MAKE install\'.
7845
    echo Qt will be installed into $QT_INSTALL_PREFIX
7846
fi
7847
echo
7848
echo To reconfigure, run \'$MAKE confclean\' and \'configure\'.
7849
echo