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