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