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