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