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