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