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