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