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