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