1
#!/bin/sh
2
#############################################################################
3
##
4
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5
## All rights reserved.
6
## Contact: Nokia Corporation (qt-info@nokia.com)
7
##
8
## This file is part of the Qt Mobility Components.
9
##
10
## $QT_BEGIN_LICENSE:LGPL$
11
## GNU Lesser General Public License Usage
12
## This file may be used under the terms of the GNU Lesser General Public
13
## License version 2.1 as published by the Free Software Foundation and
14
## appearing in the file LICENSE.LGPL included in the packaging of this
15
## file. Please review the following information to ensure the GNU Lesser
16
## General Public License version 2.1 requirements will be met:
17
## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18
##
19
## In addition, as a special exception, Nokia gives you certain additional
20
## rights. These rights are described in the Nokia Qt LGPL Exception
21
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22
##
23
## GNU General Public License Usage
24
## Alternatively, this file may be used under the terms of the GNU General
25
## Public License version 3.0 as published by the Free Software Foundation
26
## and appearing in the file LICENSE.GPL included in the packaging of this
27
## file. Please review the following information to ensure the GNU General
28
## Public License version 3.0 requirements will be met:
29
## http://www.gnu.org/copyleft/gpl.html.
30
##
31
## Other Usage
32
## Alternatively, this file may be used in accordance with the terms and
33
## conditions contained in a signed written agreement between you and Nokia.
34
##
35
##
36
##
37
##
38
##
39
## $QT_END_LICENSE$
40
##
41
#############################################################################
42
43
# return status of 1 if absolute path as first argument
44
# also prints the return status
45
isAbsPath() {
46
    slash=$(echo $1 | cut -c 1)
47
    if [ "$slash" != "/" ]; then
48
        echo 0
49
        return 0
50
    fi
51
    echo 1
52
    return 1
53
}
54
55
# Returns the absolute path for $1 for target $2
56
# as an example $2 might have value "maemo5".
57
# This is required because when building in scratchbox for
58
# maemo we do not want to follow symbolic links that are
59
# introduced by scratchbox
60
absPath() {
61
    if [ "$2" = "maemo5" -o "$2" = "maemo6" -o "$2" = "meego" ]; then
62
        if [ `isAbsPath $1` = '1' ]; then
63
            echo $1;
64
        else
65
            echo >&2 "Relative prefix/bin/lib/header/plugin paths are not supported for Maemo"
66
            exit 1;
67
        fi
68
    else
69
        PATH=`$relpath/bin/pathhelper $1`
70
        echo $PATH
71
    fi
72
}
73
74
75
# the current directory (shadow build dir)
76
shadowpath=`/bin/pwd`
77
# the name of this script
78
relconf=`basename $0`
79
# the directory of this script is the "source tree"
80
relpath=`dirname $0`
81
relpath=`(cd "$relpath"; /bin/pwd)`
82
83
CONFIG_IN="$shadowpath/config.in"
84
QT_MOBILITY_PREFIX=$shadowpath/install
85
QT_MOBILITY_INCLUDE=
86
QT_MOBILITY_LIB=
87
QT_MOBILITY_BIN=
88
QT_MOBILITY_PLUGINS=
89
QT_MOBILITY_EXAMPLES=
90
QT_MOBILITY_DEMOS=
91
BUILD_UNITTESTS=
92
BUILD_PUBLIC_UNITTESTS=
93
BUILD_EXAMPLES=
94
BUILD_DEMOS=
95
BUILD_DOCS=yes
96
BUILD_TOOLS=yes
97
RELEASEMODE=
98
BUILD_SILENT=
99
LINUX_TARGET=
100
LANGUAGES=
101
QMAKE_CACHE="$shadowpath/.qmake.cache"
102
QMAKE_EXEC=qmake
103
LIB_PATH="lib"
104
BIN_PATH="bin"
105
PLUGIN_PATH="plugins"
106
PLATFORM_CONFIG=
107
MAC_SDK=
108
MOBILITY_MODULES="bearer location contacts multimedia publishsubscribe versit messaging systeminfo serviceframework sensors gallery organizer feedback connectivity"
109
MOBILITY_MODULES_UNPARSED=
110
QMKSPEC=
111
OS="other"
112
# By default, all modules are requested.  Reset this later if -modules is supplied
113
ORGANIZER_REQUESTED=yes
114
TEST_USE_SIMULATOR=
115
NFC_SYMBIAN=auto
116
MAC_DEPLOY=
117
118
usage() 
119
{
120
    echo "Usage: configure [-prefix <dir>] [headerdir <dir>] [libdir <dir>]"
121
    echo "                 [-bindir <dir>] [-tests] [-examples] [-no-docs]"
122
    echo "                 [-no-tools] [-debug] [-release] [-silent]"
123
    echo "                 [-modules <list>]"
124
    echo
125
    echo "Options:"
126
    echo
127
    echo "-prefix <dir> ..... This will install everything relative to <dir>"
128
    echo "                    (default prefix: $shadowpath/install)"
129
    echo "-headerdir <dir> .. Header files will be installed to <dir>"
130
    echo "                    (default prefix: PREFIX/include)"
131
    echo "-libdir <dir> ..... Libraries will be installed to <dir>"
132
    echo "                    (default: PREFIX/lib)"
133
    echo "-bindir <dir> ..... Executables will be installed to <dir>"
134
    echo "                    (default: PREFIX/bin)"
135
    echo "-plugindir <dir> .. Plug-ins will be installed to <dir>"
136
    echo "                    (default: PREFIX/plugins)"
137
    echo "-demosdir <dir> ... Demos will be installed to <dir>"
138
    echo "                    (default: PREFIX/bin)"
139
    echo "-examplesdir <dir>  Examples will be installed to <dir>"
140
    echo "                    (default PREFIX/bin)"
141
    echo "-debug ............ Build with debugging symbols"
142
    echo "-release .......... Build without debugging symbols"
143
    echo "-silent ........... Reduces build output"
144
    echo "-tests ............ Build unit tests (not build by default)"
145
    echo "                    Note, this adds test symbols to all libraries"
146
    echo "                    and should not be used for release builds."
147
    echo "-examples ......... Build example applications"
148
    echo "-demos ............ Build demo applications"
149
    echo "-no-docs .......... Do not build documentation (build by default)"
150
    echo "-no-tools ......... Do not build tools (build by default)"
151
    echo "-modules <list> ... Restrict list of modules to build (default all supported)"
152
    echo "                    Choose from: bearer contacts gallery location publishsubscribe"
153
    echo "                    messaging multimedia systeminfo serviceframework"
154
    echo "                    sensors versit organizer feedback connectivity"
155
    echo "                    Modules should be separated by a space and surrounded"
156
    echo "                    by double quotation. If a selected module depends on other modules"
157
    echo "                    those modules (and their dependencies) will automatically be enabled."
158
    echo "-maemo6 ........... Build Qt Mobility for Maemo6 (Harmattan)."
159
    echo "-maemo5 ........... Build Qt Mobility for Maemo5 (Fremantle)."
160
    echo "-meego  ........... Build Qt Mobility for MeeGo."
161
    echo "-sdk <sdk> ........ Build using Apple provided SDK <path/to/sdk>."
162
    echo "                    example: -sdk /Developer/SDKs/MacOSX10.6.sdk"
163
    echo "-languages ........ Languages/translations to be installed (e.g.: \"ar de ko\")."
164
    echo "                    (default is empty)"
165
    echo "-qmake-exec <name>  Sets custom binary name for qmake binary"
166
    echo "                    (default: qmake)"
167
    echo "-no-nfc-symbian     Disables the NFC Sybmian backend."
168
#    echo "-test-sim           Use simulator backend for testing systeminfo"
169
#    echo "-staticconfig <name>"
170
#    echo "                    Avoids running of configuration tests. The default"
171
#    echo "                    values are sourced from features/platformconfig/<name>.pri"
172
    echo "-mac-deploy ....    Use this option for deploying QtMobility into Qt for use with macdeployqt tool"
173
    echo "                    This overrides any -prefix that may be set."
174
    echo
175
    
176
    rm -f "$CONFIG_IN"
177
    exit 1
178
}
179
180
rm -rf "$QMAKE_CACHE"
181
CONFIG_LOG="$shadowpath/config.log"
182
rm -rf "$CONFIG_LOG"
183
184
while [ "$#" -gt 0 ]; do
185
    case "$1" in 
186
        -h|-help|--help)
187
            usage
188
            ;;
189
        -headerdir)
190
            QT_MOBILITY_INCLUDE="$2"
191
            shift
192
            ;;
193
        -libdir)
194
            QT_MOBILITY_LIB="$2"
195
            shift
196
            ;;
197
        --prefix|-prefix)
198
            QT_MOBILITY_PREFIX="$2"
199
            shift
200
            ;;
201
        -bindir)
202
            QT_MOBILITY_BIN="$2"
203
            shift
204
            ;;
205
        -plugindir)
206
            QT_MOBILITY_PLUGINS="$2"
207
            shift
208
            ;;
209
        -examplesdir)
210
            QT_MOBILITY_EXAMPLES="$2"
211
            shift
212
            ;;
213
        -demosdir)
214
            QT_MOBILITY_DEMOS="$2"
215
            shift
216
            ;;
217
        -tests)
218
            BUILD_UNITTESTS="yes"
219
            ;;
220
        -public-tests-only)
221
            BUILD_PUBLIC_UNITTESTS="yes"
222
            ;;
223
        -demos)
224
            BUILD_DEMOS="yes"
225
            ;;
226
        -examples)
227
            BUILD_EXAMPLES="yes"
228
            ;;
229
        -no-docs)
230
            BUILD_DOCS=
231
            ;;
232
        -no-tools)
233
            BUILD_TOOLS=
234
            ;;
235
        -debug)
236
            RELEASEMODE=debug
237
            ;;
238
        -release)
239
            RELEASEMODE=release
240
            ;;
241
        -silent)
242
            BUILD_SILENT=yes
243
            ;;
244
        -maemo5)
245
            LINUX_TARGET=maemo5
246
            ;;
247
        -maemo6)
248
            LINUX_TARGET=maemo6
249
            ;;
250
        -meego)
251
            LINUX_TARGET=meego
252
            ;;
253
        -sdk)
254
            MAC_SDK="$2"
255
            shift
256
            ;;
257
        -qmake-exec)
258
            QMAKE_EXEC="$2"
259
            shift
260
            ;;
261
        -modules)
262
            MOBILITY_MODULES_UNPARSED=$2
263
            ORGANIZER_REQUESTED=
264
            #reset default selection
265
            MOBILITY_MODULES=
266
            for m in $MOBILITY_MODULES_UNPARSED; do
267
                case "$m" in
268
                    bearer|contacts|location|messaging|multimedia|publishsubscribe|serviceframework|systeminfo|sensors|gallery|versit|feedback|connectivity)
269
                        MOBILITY_MODULES="$MOBILITY_MODULES $m";
270
                        ;;
271
                    organizer)
272
                        MOBILITY_MODULES="$MOBILITY_MODULES $m";
273
                        ORGANIZER_REQUESTED=yes
274
                        ;;
275
                    *)
276
                        echo "Unknown module: $m"
277
                        echo
278
                        usage
279
                        ;;
280
281
                esac
282
            done
283
            if [ -z "$MOBILITY_MODULES" ]; then
284
                echo "List of selected modules is empty."
285
                echo 
286
                usage
287
            fi
288
            shift
289
            ;;
290
        -staticconfig)
291
            PLATFORM_CONFIG=$2
292
            shift
293
            ;;
294
        -languages)
295
            LANGUAGES=$2
296
            shift
297
            ;;
298
        -test-sim)
299
            TEST_USE_SIMULATOR="yes"
300
            ;; 
301
        -no-nfc-symbian)
302
            NFC_SYMBIAN=no
303
            ;;
304
        -mac-deploy)
305
            MAC_DEPLOY='yes'
306
            shift
307
            ;;
308
        *)
309
            echo "Unknown option: $1"
310
            usage
311
            ;;
312
    esac
313
    shift
314
done
315
316
if [ -z "$RELEASEMODE" ]; then
317
    RELEASEMODE="debug"
318
fi
319
echo "CONFIG += $RELEASEMODE" > "$CONFIG_IN"
320
321
322
if [ -n "$BUILD_SILENT" ]; then
323
    echo "CONFIG += silent"  >> "$CONFIG_IN"
324
fi
325
326
checkostype()
327
{
328
    match="Darwin"
329
    if [ `uname -s` = "${match}" ]; then
330
        OS="darwin"
331
        QMKSPEC="-spec macx-g++"
332
        if [[ `gcc --version` =~ .*llvm.* ]]; then
333
            QMKSPEC="-spec macx-llvm"
334
        else
335
           QMKSPEC="-spec macx-g++"
336
        fi
337
        echo "QMAKESPEC = "$QMKSPEC >> "$CONFIG_IN"
338
    fi
339
}
340
341
checkostype
342
343
findUniversal()
344
{
345
    if [ -e "mac.inc" ]; then
346
        rm mac.inc
347
    fi
348
    echo "contains(QT_CONFIG,x86): system(echo CONFIG+=x86 >> mac.inc)" > 2.pro
349
    echo "contains(QT_CONFIG,ppc): system(echo CONFIG+=ppc >> mac.inc)" >> 2.pro
350
    echo "contains(QT_CONFIG,ppc64): system(echo CONFIG+=ppc64 >> mac.inc)" >> 2.pro
351
    echo "contains(QT_CONFIG,x86_64): system(echo CONFIG+=x86_64 >> mac.inc)" >> 2.pro
352
    SOMETIME=`$QMAKE_EXEC $QMKSPEC 2.pro 2>&1`
353
    rm 2.pro
354
    if [ -e "mac.inc" ]; then
355
         echo "exists(mac.inc): include(mac.inc)" >> "$CONFIG_IN"
356
    fi
357
}
358
359
if [ "$OS" = "darwin" ] ; then
360
    findUniversal
361
fi
362
363
364
#do we build for Maemo?
365
if [ -n "$LINUX_TARGET" ]; then
366
    if [ "$LINUX_TARGET" = "maemo5" ]; then
367
        echo "CONFIG+=maemo5" >> "$CONFIG_IN"
368
    elif [ "$LINUX_TARGET" = "maemo6" ]; then
369
        echo "CONFIG+=maemo6" >> "$CONFIG_IN"
370
    elif [ "$LINUX_TARGET" = "meego" ]; then
371
        echo "CONFIG+=meego" >> "$CONFIG_IN"
372
    fi
373
fi
374
375
376
if [ -n "$MAC_DEPLOY" ]; then
377
    QT_MOBILITY_PREFIX=`$QMAKE_EXEC -query QT_INSTALL_PREFIX`
378
    echo "QT_MOBILITY_PREFIX = $QT_MOBILITY_PREFIX" >> "$CONFIG_IN"
379
    QT_MOBILITY_INCLUDE=`$QMAKE_EXEC -query QT_INSTALL_HEADERS`
380
    echo "QT_MOBILITY_INCLUDE = $QT_MOBILITY_INCLUDE" >> "$CONFIG_IN"
381
    QT_MOBILITY_LIB=`$QMAKE_EXEC -query QT_INSTALL_LIBS`
382
    echo "QT_MOBILITY_LIB = $QT_MOBILITY_LIB" >> "$CONFIG_IN"
383
    QT_MOBILITY_BIN=`$QMAKE_EXEC -query QT_INSTALL_BINS`
384
    echo "QT_MOBILITY_BIN = $QT_MOBILITY_BIN" >> "$CONFIG_IN"
385
    QT_MOBILITY_PLUGINS=`$QMAKE_EXEC -query QT_INSTALL_PLUGINS`
386
    echo "QT_MOBILITY_PLUGINS = $QT_MOBILITY_PLUGINS" >> "$CONFIG_IN"
387
    QT_MOBILITY_EXAMPLES=`$QMAKE_EXEC -query QT_INSTALL_EXAMPLES`
388
    echo "QT_MOBILITY_EXAMPLES = $QT_MOBILITY_EXAMPLES" >> "$CONFIG_IN"
389
    QT_MOBILITY_DEMOS=`$QMAKE_EXEC -query QT_INSTALL_DEMOS`
390
    echo "QT_MOBILITY_DEMOS = $QT_MOBILITY_DEMOS" >> "$CONFIG_IN"
391
392
else
393
394
#process PREFIX
395
QT_MOBILITY_PREFIX=`absPath $QT_MOBILITY_PREFIX $LINUX_TARGET`
396
if [ "$?" -eq "1" ]; then
397
    exit 1
398
fi
399
echo "QT_MOBILITY_PREFIX = $QT_MOBILITY_PREFIX" >> "$CONFIG_IN"
400
401
#process include path
402
if [ -z "$QT_MOBILITY_INCLUDE" ]; then
403
    QT_MOBILITY_INCLUDE="$QT_MOBILITY_PREFIX/include"
404
else
405
    QT_MOBILITY_INCLUDE=`absPath $QT_MOBILITY_INCLUDE $LINUX_TARGET`
406
    if [ "$?" -eq "1" ]; then
407
        exit 1
408
    fi
409
fi
410
echo "QT_MOBILITY_INCLUDE = $QT_MOBILITY_INCLUDE" >> "$CONFIG_IN"
411
412
413
#process library path
414
if [ -z "$QT_MOBILITY_LIB" ]; then
415
    QT_MOBILITY_LIB="$QT_MOBILITY_PREFIX/$LIB_PATH"
416
else
417
    QT_MOBILITY_LIB=`absPath $QT_MOBILITY_LIB $LINUX_TARGET`
418
    if [ "$?" -eq "1" ]; then
419
        exit 1
420
    fi
421
fi
422
echo "QT_MOBILITY_LIB = $QT_MOBILITY_LIB" >> "$CONFIG_IN"
423
424
#process bin path
425
if [ -z "$QT_MOBILITY_BIN" ]; then
426
    QT_MOBILITY_BIN="$QT_MOBILITY_PREFIX/$BIN_PATH"
427
else
428
    QT_MOBILITY_BIN=`absPath $QT_MOBILITY_BIN $LINUX_TARGET`
429
    if [ "$?" -eq "1" ]; then
430
        exit 1
431
    fi
432
fi
433
echo "QT_MOBILITY_BIN = $QT_MOBILITY_BIN" >> "$CONFIG_IN"
434
435
#process plugin path
436
if [ -z "$QT_MOBILITY_PLUGINS" ]; then
437
    QT_MOBILITY_PLUGINS="$QT_MOBILITY_PREFIX/$PLUGIN_PATH"
438
else
439
    QT_MOBILITY_PLUGINS=`absPath $QT_MOBILITY_PLUGINS $LINUX_TARGET`
440
    if [ "$?" -eq "1" ]; then
441
        exit 1
442
    fi
443
fi
444
echo "QT_MOBILITY_PLUGINS = $QT_MOBILITY_PLUGINS" >> "$CONFIG_IN"
445
446
#process examples path
447
if [ -z "$QT_MOBILITY_EXAMPLES" ]; then
448
    QT_MOBILITY_EXAMPLES="$QT_MOBILITY_PREFIX/$BIN_PATH"
449
else
450
    QT_MOBILITY_EXAMPLES=`absPath $QT_MOBILITY_EXAMPLES $LINUX_TARGET`
451
    if [ "$?" -eq "1" ]; then
452
        exit 1
453
    fi
454
fi
455
echo "QT_MOBILITY_EXAMPLES = $QT_MOBILITY_EXAMPLES" >> "$CONFIG_IN"
456
457
#process demos path
458
if [ -z "$QT_MOBILITY_DEMOS" ]; then
459
    QT_MOBILITY_DEMOS="$QT_MOBILITY_PREFIX/$BIN_PATH"
460
else
461
    QT_MOBILITY_DEMOS=`absPath $QT_MOBILITY_DEMOS $LINUX_TARGET`
462
    if [ "$?" -eq "1" ]; then
463
        exit 1
464
    fi
465
fi
466
echo "QT_MOBILITY_DEMOS = $QT_MOBILITY_DEMOS" >> "$CONFIG_IN"
467
fi
468
469
echo "QT_MOBILITY_SOURCE_TREE = $relpath" >> "$QMAKE_CACHE"
470
echo "QT_MOBILITY_BUILD_TREE = $shadowpath" >> "$QMAKE_CACHE"
471
472
if [ -n "$MAC_SDK" ]; then
473
    QMAKE_MAC_SDK="$MAC_SDK"
474
   echo "QMAKE_MAC_SDK = $QMAKE_MAC_SDK" >> "$CONFIG_IN"
475
fi
476
477
if [ -z "$BUILD_UNITTESTS" ]; then
478
    echo "build_unit_tests = no" >> "$CONFIG_IN"
479
else
480
    echo "build_unit_tests = yes" >> "$CONFIG_IN"
481
fi
482
483
if [ -z "$BUILD_PUBLIC_UNITTESTS" ]; then
484
    echo "build_public_unit_tests = no" >> "$CONFIG_IN"
485
else
486
    echo "build_public_unit_tests = yes" >> "$CONFIG_IN"
487
fi
488
489
if [ -z "$BUILD_EXAMPLES" ]; then
490
    echo "build_examples = no" >> "$CONFIG_IN"
491
else
492
    echo "build_examples = yes" >> "$CONFIG_IN"
493
fi
494
495
if [ -z "$BUILD_DEMOS" ]; then
496
    echo "build_demos = no" >> "$CONFIG_IN"
497
else
498
    echo "build_demos = yes" >> "$CONFIG_IN"
499
fi
500
501
if [ -z "$BUILD_DOCS" ]; then
502
    echo "build_docs = no" >> "$CONFIG_IN"
503
else
504
    echo "build_docs = yes" >> "$CONFIG_IN"
505
fi
506
507
if [ -z "$BUILD_TOOLS" ]; then
508
    echo "build_tools = no" >> "$CONFIG_IN"
509
else
510
    echo "build_tools = yes" >> "$CONFIG_IN"
511
fi
512
513
if [ -z "$TEST_USE_SIMULATOR" ]; then
514
    echo "test_use_sim = no" >> "$CONFIG_IN"
515
else
516
    echo "test_use_sim = yes" >> "$CONFIG_IN"
517
fi
518
519
#process languages
520
if [ -z "LANGUAGES" ]; then
521
    echo "selected_languages =" >> "$CONFIG_IN"
522
else
523
    echo "selected_languages = $LANGUAGES" >> "$CONFIG_IN"
524
fi
525
526
527
echo "Configuring Qt Mobility"
528
echo 
529
530
WHICH="$relpath/config.tests/tools/which.test"
531
532
printf "Checking available Qt"
533
if ! "$WHICH" $QMAKE_EXEC 2>/dev/null 1>&2; then
534
    QMAKE_EXEC_ALTERNATIVE=
535
    if "$WHICH" qmake4 2>/dev/null 1>&2; then
536
        QMAKE_EXEC_ALTERNATIVE=qmake4
537
    elif "$WHICH" qmake-qt4 2>/dev/null 1>&2; then
538
        QMAKE_EXEC_ALTERNATIVE=qmake-qt4
539
    fi
540
541
    if [ -z "$QMAKE_EXEC_ALTERNATIVE" ]; then
542
        printf " ... Not found\n\n" >&2
543
        echo >&2 "Cannot find "$QMAKE_EXEC" in your PATH.";
544
        echo >&2 "Aborting."
545
        exit 1
546
    else
547
        QMAKE_EXEC="$QMAKE_EXEC_ALTERNATIVE"
548
    fi
549
fi
550
551
#we found a qmake binary
552
printf " ... "
553
$QMAKE_EXEC -query QT_VERSION
554
555
# find out which make we want to use
556
MAKE=
557
for m in make gmake; do
558
    if "$WHICH" $m >/dev/null 2>&1; then
559
        MAKE=`$WHICH $m`
560
        break
561
    fi
562
done
563
if [ -z "$MAKE" ]; then
564
    echo >&2 "Cannot find 'make' or 'gmake' in your PATH";
565
    echo >&2 "Aborting."
566
    exit 1
567
fi
568
569
compileTest()
570
{
571
    printf "Checking $1"
572
    CURRENT_PWD=`pwd`
573
    
574
    if [ "$shadowpath" = "$relpath" ]; then 
575
        #doing source tree build
576
        cd "$relpath/config.tests/$2"
577
        rm -rf ./$2
578
    else
579
        #using shadow build
580
        rm -rf config.tests/$2
581
        mkdir -p config.tests/$2
582
        cd config.tests/$2
583
    fi
584
585
    $QMAKE_EXEC $QMKSPEC "$relpath/config.tests/$2/$2.pro" 2>> "$CONFIG_LOG" >> "$CONFIG_LOG"
586
    printf  " ."
587
    "$MAKE" clean >> "$CONFIG_LOG"
588
    printf "."
589
    "$MAKE" >> "$CONFIG_LOG" 2>&1
590
    printf ". "
591
    if [ -e ./$2 ]; then
592
        echo "OK"
593
        echo "$2_enabled = yes" >> "$CONFIG_IN"
594
    else
595
        echo "Not Found"
596
        echo "$2_enabled = no" >> "$CONFIG_IN"
597
    fi
598
    cd "$CURRENT_PWD"
599
}
600
601
if [ -z "$PLATFORM_CONFIG" ]; then
602
#compile tests
603
    compileTest QMF qmf
604
    compileTest NetworkManager networkmanager
605
    compileTest "CoreWLAN (MacOS >= 10.6)" corewlan
606
    compileTest Immersion immersion
607
    compileTest "MeegoTouch Feedback" meegotouchfeedback
608
    compileTest "Maemo ICD" maemo-icd
609
    compileTest "Maemo ICD WLAN" maemo-icd-network-wlan
610
    compileTest "Maemo5 contacts dependencies" maemo5-contacts
611
    compileTest "Maemo5 organizer dependencies" maemo5-calendar
612
    compileTest "Maemo6 landmarks dependencies" maemo6-landmarks
613
    compileTest "Bluez" bluez
614
    compileTest "Proj.4" proj
615
    compileTest "Gstreamer Photography" gstreamer-photography
616
    compileTest "Gstreamer AppSrc" gstreamer-appsrc
617
    compileTest "Blkid" blkid
618
    compileTest "Pulse Audio" pulseaudio
619
    compileTest "udev" udev
620
    compileTest "Maemo Heartbeat" iphb
621
622
    if [ "$NFC_SYMBIAN" = auto ]; then
623
        compileTest "Symbian NFC" nfc_symbian
624
    else
625
        echo "nfc_symbian_enabled = no" >> "$CONFIG_IN"
626
    fi
627
628
    if [ "$LINUX_TARGET" = maemo6 ] || [ "$LINUX_TARGET" = meego ]; then
629
        compileTest sensord sensord
630
    else
631
        echo "sensord_enabled = no" >> "$CONFIG_IN"
632
    fi
633
634
    if [ "$LINUX_TARGET" = meego ]; then
635
        compileTest "Location GeoClue master provider" geoclue-master
636
        compileTest "Location Gypsy provider" gypsy
637
    else
638
        echo "geoclue-master_enabled = no" >> "$CONFIG_IN"
639
        echo "gypsy_enabled = no" >> "$CONFIG_IN"
640
    fi
641
else
642
    echo "Skipping configure tests"
643
    echo "Loading ... features/platformconfig/$PLATFORM_CONFIG.pri"
644
    if [ ! -f "$relpath/features/platformconfig/$PLATFORM_CONFIG.pri" ]; then
645
        echo "Invalid platform configuration $PLATFORM_CONFIG.pri"
646
        exit 1;
647
    else
648
        echo "include(\$\${QT_MOBILITY_SOURCE_TREE}/features/platformconfig/$PLATFORM_CONFIG.pri)" >> "$CONFIG_IN"
649
    fi
650
fi
651
# It's a lot easier to make qmake do the dependency checking...
652
echo "mobility_modules = $MOBILITY_MODULES" >> "$CONFIG_IN"
653
echo "contains(mobility_modules,versit): mobility_modules *= contacts" >> "$CONFIG_IN"
654
echo "symbian:contains(nfc_symbian_enabled,yes):contains(mobility_modules,connectivity): mobility_modules *= serviceframework" >> "$CONFIG_IN"
655
echo "maemo5|maemo6:contains(maemo-icd_enabled, no): mobility_modules -= bearer" >> "$CONFIG_IN"
656
# Mobility doesn't support Bearer on MeeGo -> Use Qt 4.7 Bearer instead
657
echo "meego:contains(mobility_modules, bearer) { " >> "$CONFIG_IN"
658
#echo "    message(Bearer module not supported on MeeGo)" >> "$CONFIG_IN"
659
echo "    mobility_modules -= bearer" >> "$CONFIG_IN"
660
echo "}" >> "$CONFIG_IN"
661
662
echo "isEmpty(mobility_modules):error(No module selected. Aborting...)" >> "$CONFIG_IN"
663
664
# If libicd-network-wlan-dev.h is not present, use own copy.
665
# At time of writing, libicd-network-wlan-dev is not released for maemo5.
666
echo "maemo5:contains(maemo-icd-network-wlan_enabled, no): INCLUDEPATH += $relpath/src/3rdparty/icd-network-wlan" >> "$CONFIG_IN"
667
668
echo "Generating Mobility Headers..."
669
#remove old headers
670
rm -rf $shadowpath/include
671
mkdir $shadowpath/include
672
673
$relpath/bin/syncheaders $shadowpath/include/QtMobility $relpath/src/global
674
for module in $MOBILITY_MODULES; do
675
    case "$module" in 
676
        bearer)
677
            $relpath/bin/syncheaders $shadowpath/include/QtBearer $relpath/src/bearer
678
            ;;
679
        publishsubscribe)
680
            $relpath/bin/syncheaders $shadowpath/include/QtPublishSubscribe $relpath/src/publishsubscribe
681
            ;;
682
        location)
683
            $relpath/bin/syncheaders $shadowpath/include/QtLocation $relpath/src/location
684
            $relpath/bin/syncheaders $shadowpath/include/QtLocation $relpath/src/location/landmarks
685
            $relpath/bin/syncheaders $shadowpath/include/QtLocation $relpath/src/location/maps
686
            $relpath/bin/syncheaders $shadowpath/include/QtLocation $relpath/src/location/maps/tiled
687
            ;;
688
        serviceframework)
689
            $relpath/bin/syncheaders $shadowpath/include/QtServiceFramework $relpath/src/serviceframework
690
            ;;
691
        systeminfo)
692
            $relpath/bin/syncheaders $shadowpath/include/QtSystemInfo $relpath/src/systeminfo
693
            ;;
694
        contacts)
695
            $relpath/bin/syncheaders $shadowpath/include/QtContacts $relpath/src/contacts
696
            $relpath/bin/syncheaders $shadowpath/include/QtContacts $relpath/src/contacts/details
697
            $relpath/bin/syncheaders $shadowpath/include/QtContacts $relpath/src/contacts/requests
698
            $relpath/bin/syncheaders $shadowpath/include/QtContacts $relpath/src/contacts/filters
699
            ;;
700
        multimedia)
701
            $relpath/bin/syncheaders $shadowpath/include/QtMultimediaKit $relpath/src/multimedia
702
            $relpath/bin/syncheaders $shadowpath/include/QtMultimediaKit $relpath/src/multimedia/audio
703
            $relpath/bin/syncheaders $shadowpath/include/QtMultimediaKit $relpath/src/multimedia/video
704
            ;;
705
        messaging)
706
            $relpath/bin/syncheaders $shadowpath/include/QtMessaging $relpath/src/messaging
707
            ;;
708
        versit)
709
            #versit implies contacts.  organizer includes might also be necessary
710
            $relpath/bin/syncheaders $shadowpath/include/QtVersit $relpath/src/versit
711
            $relpath/bin/syncheaders $shadowpath/include/QtContacts $relpath/src/contacts
712
            $relpath/bin/syncheaders $shadowpath/include/QtContacts $relpath/src/contacts/details
713
            $relpath/bin/syncheaders $shadowpath/include/QtContacts $relpath/src/contacts/requests
714
            $relpath/bin/syncheaders $shadowpath/include/QtContacts $relpath/src/contacts/filters
715
            if [ -n "$ORGANIZER_REQUESTED" ]; then
716
                $relpath/bin/syncheaders $shadowpath/include/QtVersitOrganizer $relpath/src/versitorganizer
717
            fi
718
            ;;
719
        sensors)
720
            $relpath/bin/syncheaders $shadowpath/include/QtSensors $relpath/src/sensors
721
            ;;
722
        feedback)
723
            $relpath/bin/syncheaders $shadowpath/include/QtFeedback $relpath/src/feedback
724
            ;;
725
        gallery)
726
            $relpath/bin/syncheaders $shadowpath/include/QtGallery $relpath/src/gallery
727
            ;;
728
        organizer)
729
            $relpath/bin/syncheaders $shadowpath/include/QtOrganizer $relpath/src/organizer
730
            $relpath/bin/syncheaders $shadowpath/include/QtOrganizer $relpath/src/organizer/items
731
            $relpath/bin/syncheaders $shadowpath/include/QtOrganizer $relpath/src/organizer/requests
732
            $relpath/bin/syncheaders $shadowpath/include/QtOrganizer $relpath/src/organizer/filters
733
            $relpath/bin/syncheaders $shadowpath/include/QtOrganizer $relpath/src/organizer/details
734
            ;;
735
        connectivity)
736
            #connectivity implies serviceframework
737
            $relpath/bin/syncheaders $shadowpath/include/QtConnectivity $relpath/src/connectivity
738
            $relpath/bin/syncheaders $shadowpath/include/QtConnectivity $relpath/src/connectivity/nfc
739
            $relpath/bin/syncheaders $shadowpath/include/QtConnectivity $relpath/src/connectivity/bluetooth
740
            $relpath/bin/syncheaders $shadowpath/include/QtServiceFramework $relpath/src/serviceframework
741
            ;;
742
        *)
743
            echo "Cannot generate headers for $module"
744
            ;;
745
    esac
746
done
747
748
mv "$CONFIG_IN" config.pri
749
mkdir -p "$shadowpath/features"
750
if [ "$shadowpath" != "$relpath" ]; then
751
    cp -f "$relpath/features/strict_flags.prf" "$shadowpath/features"
752
fi
753
754
echo "Running $QMAKE_EXEC..."
755
if $QMAKE_EXEC -makefile $QMKSPEC -recursive "$relpath/qtmobility.pro"; then
756
    echo ""
757
    echo "configure has finished. You may run make or gmake to build the project now."
758
    echo ""
759
    echo "QT_MOBILITY_PREFIX = $QT_MOBILITY_PREFIX"
760
    echo "QT_MOBILITY_INCLUDE = $QT_MOBILITY_INCLUDE"
761
    echo "QT_MOBILITY_LIB = $QT_MOBILITY_LIB"
762
    echo "QT_MOBILITY_BIN = $QT_MOBILITY_BIN"
763
    echo "QT_MOBILITY_PLUGINS = $QT_MOBILITY_PLUGINS"
764
    echo "QT_MOBILITY_EXAMPLES = $QT_MOBILITY_EXAMPLES"
765
    echo "QT_MOBILITY_DEMOS = $QT_MOBILITY_DEMOS"
766
767
else
768
    echo ""
769
    echo "configure failed."
770
    exit 1
771
fi