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