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