summaryrefslogtreecommitdiff
path: root/Tools/qmake/mkspecs/features/features.prf
blob: 31180e0b32e4b96cfe2c6b398b8e0cd9995d6d8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# -------------------------------------------------------------------
# This file does basic 'configure' style checks to determine the
# set of ENABLE_FOO defines and their values.
#
# See 'Tools/qmake/README' for an overview of the build system
# -------------------------------------------------------------------

# Since features.prf is currently loaded from .pro/.pri files, not
# defaults_pre.prf, we have at this point parsed any optional command
# line arguments to qmake (eg qmake DEFINES+=ENABLE_VIDEO=0), that are
# intended to override default values (static or dynamic) of the
# feature defines.
#
# This is why the checks below look for !contains(DEFINES, ENABLE_FOO=.)
# so that the static or dynamic defaults will only be set if the user did
# not make an explicit choice by passing an argument to qmake/build-webkit.

# ------------- Prepare for feature detection -------------

## load mobilityconfig if mobility is available
load(mobilityconfig, true)

# Try to locate sqlite3 source
SQLITE3SRCDIR = $$(SQLITE3SRCDIR)
isEmpty(SQLITE3SRCDIR) {
    SQLITE3SRCDIR = $$[QT_INSTALL_PREFIX]/src/3rdparty/sqlite/
}

# ---------- Dynamically detect optional features -------------
#
# Please note, static feature defaults go in features.pri
#
# Do not add new CONFIG options, but use the existing patterns
# of WTF_USE, ENABLE_, etc, and detect the precense of those
# defines in the relevant target files. You do not need to have
# a fallback in your logic for the disabling feature, that's handled
# by having the feature disabled in features.pri. Nor do you have to
# unset the opposite value, that's handled automatically for you.

# For Mac we do not rely on QT_CONFIG, because icu is not officially supported for all of qt.
haveQt(5):if(contains(QT_CONFIG,icu)|mac) {
    DEFINES += WTF_USE_ICU_UNICODE=1
    DEFINES -= WTF_USE_QT4_UNICODE=1
} else {
    DEFINES += WTF_USE_QT4_UNICODE=1
    DEFINES -= WTF_USE_ICU_UNICODE=1
}

!contains(DEFINES, HAVE_QRAWFONT=.) {
    # Use of QRawFont in Qt 5:
    haveQt(5): DEFINES += HAVE_QRAWFONT=1
}

# We need fontconfig to set up the test fonts for DumpRenderTree and WebKitTestRunner.
haveQt(5) {
    contains(config_test_fontconfig, yes):!mac {
        DEFINES += HAVE_FONTCONFIG=1
    }
} else {
    # Qt 4
    unix:!mac:!embedded {
        DEFINES += HAVE_FONTCONFIG=1
    }
}

# We need libxml2 config test to determine to use libxml2 or not
!contains(DEFINES, WTF_USE_LIBXML2=.) {
    haveQt(5):contains(config_test_libxml2, yes): DEFINES += WTF_USE_LIBXML2=1
}

# We need libxslt config test to determine to use libxslt or not
!contains(DEFINES, ENABLE_XSLT=.) {
    haveQt(5):contains(config_test_libxslt, yes): DEFINES += ENABLE_XSLT=1
}

!contains(DEFINES, WTF_USE_QT_IMAGE_DECODER=.): DEFINES += WTF_USE_QT_IMAGE_DECODER=1

# Tiled Backing Store support
!contains(DEFINES, WTF_USE_TILED_BACKING_STORE=.): DEFINES += WTF_USE_TILED_BACKING_STORE=1

# Turn on legacy viewport adaption
!contains(DEFINES, WTF_USE_LEGACY_VIEWPORT_ADAPTION=.): DEFINES += WTF_USE_LEGACY_VIEWPORT_ADAPTION=1

# Nescape plugins support (NPAPI)
!contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=.) {
    haveQt(5):xlibAvailable() {
        DEFINES += ENABLE_NETSCAPE_PLUGIN_API=1
        CONFIG += plugin_backend_xlib
    } else: unix|win32-*:!embedded:!wince* {
        DEFINES += ENABLE_NETSCAPE_PLUGIN_API=1
    }
}

# Netscape plugins support for WebKit2
!contains(DEFINES, PLUGIN_ARCHITECTURE_UNSUPPORTED=.) {
    no_webkit2 {
        DEFINES += PLUGIN_ARCHITECTURE_UNSUPPORTED=1
    } else {
        contains(QT_CONFIG, xcb-xlib) {
            CONFIG += plugin_backend_xlib
            DEFINES += PLUGIN_ARCHITECTURE_X11=1 \
                       PLUGIN_ARCHITECTURE_UNSUPPORTED=0 \
                       ENABLE_PLUGIN_PROCESS=1
        } else {
            DEFINES += PLUGIN_ARCHITECTURE_UNSUPPORTED=1
        }
    }
}

# QStyle detection
haveQt(4)|!isEmpty(QT.widgets.name): DEFINES += HAVE_QSTYLE=1

# WebGL support
!contains(DEFINES, ENABLE_WEBGL=.) {
    contains(QT_CONFIG, opengl):!win32-*: DEFINES += ENABLE_WEBGL=1
}

!contains(DEFINES, ENABLE_XSLT=.) {
    # Using QtXmlPatterns
    contains(QT_CONFIG, xmlpatterns): DEFINES += ENABLE_XSLT=1

    # Or libxml2 -- experimental and only works on Linux so far
    contains(DEFINES, WTF_USE_LIBXML2=1): DEFINES += ENABLE_XSLT=1
}

# Geolocation support if QtMobility exists
!contains(DEFINES, ENABLE_GEOLOCATION=.) {
    contains(MOBILITY_CONFIG, location)|contains(QT_CONFIG, location) {
       DEFINES += ENABLE_GEOLOCATION=1
    }
}

# orientation support
haveQt(5) {
    !isEmpty(QT.sensors.name) {
        !contains(DEFINES, ENABLE_ORIENTATION_EVENTS=.): DEFINES += ENABLE_ORIENTATION_EVENTS=1
        !contains(DEFINES, ENABLE_DEVICE_ORIENTATION=.): DEFINES += ENABLE_DEVICE_ORIENTATION=1
    }
} else {
    # Qt 4 with Qt Mobility
    contains(MOBILITY_CONFIG, sensors) {
        !contains(DEFINES, ENABLE_ORIENTATION_EVENTS=.): DEFINES += ENABLE_ORIENTATION_EVENTS=1
        !contains(DEFINES, ENABLE_DEVICE_ORIENTATION=.): DEFINES += ENABLE_DEVICE_ORIENTATION=1

        # FIXME: These should not be here, but in the target that needs them
        CONFIG *= mobility
        MOBILITY *= sensors
    }
}

# HTML5 Media Support
!contains(DEFINES, ENABLE_VIDEO=.) {
    mac:!contains(DEFINES, USE_QTMULTIMEDIA=1) {
        DEFINES += ENABLE_VIDEO=1
        DEFINES += WTF_USE_QTKIT=1
    } else: linux-*:!contains(DEFINES, USE_QTMULTIMEDIA=1) {
        !contains(QT_CONFIG, no-pkg-config):system(pkg-config --exists glib-2.0 gio-2.0 \'gstreamer-0.10 >= 0.10.30\' \'gstreamer-plugins-base-0.10 >= 0.10.30\'): {
            DEFINES += ENABLE_VIDEO=1
            DEFINES += WTF_USE_GSTREAMER=1
        } else {
            root_project_file: message("Missing GLib/Gio/GStreamer, disabling media element support")
        }
    } else: contains(MOBILITY_CONFIG, multimedia) {
        DEFINES += ENABLE_VIDEO=1
        DEFINES += WTF_USE_QT_MULTIMEDIA=1
    }
}

!contains(DEFINES, ENABLE_FULLSCREEN_API=.) {
    !no_webkit2: DEFINES += ENABLE_FULLSCREEN_API=1
}

haveQt(4) {
    haveQtModule(declarative): DEFINES += HAVE_QQUICK1=1
} else {
    # FIXME: Add Qt 5 QQuick1 support once QDeclarativeEngine in QQuick2
    # is called QmlEngine and it is safe for us to use QQuick1 again.
}

!contains(DEFINES, WTF_USE_GRAPHICS_SURFACE=.) {
    haveQt(5):mac: DEFINES += WTF_USE_GRAPHICS_SURFACE=1
}

# -------------- Fill in static defaults --------------
#
# Only applies to features that don't have a dynamic default
# or have been overriden on the command line.

include(features.pri)

for(feature, FEATURE_DEFAULTS) {
    anyFeatureDefine = $$replace(feature, =.$, =.)
    !contains(DEFINES, $$anyFeatureDefine) {
        DEFINES += $$feature
    }
}

# ---------------- Sanitize defines -------------------

# Disable SVG fonts if SVG is disabled or we don't have raw fonts
contains(DEFINES, ENABLE_SVG=0)|!contains(DEFINES, HAVE_QRAWFONT=1): DEFINES += ENABLE_SVG_FONTS=0

# JavaScript debugger requires the inspector
contains(DEFINES, ENABLE_INSPECTOR=0): DEFINES += ENABLE_JAVASCRIPT_DEBUGGER=0

# Remove conflicting defines. The preprocessor would take care of this
# anyways, but doing it here makes for nicer command lines when building.
for(define, DEFINES) {
    parts = $$split(define, =)
    value = $$member(parts, 1, 1)
    isEmpty(value): next()

    equals(value, 1): opposite = $$replace(define, =1$, =0)
    equals(value, 0): opposite = $$replace(define, =0$, =1)

    # Is there a later define that overrides this one?
    contains(DEFINES, $$opposite): DEFINES -= $$define
}

# --------- Make features available to JSC ------------

## Forward enabled feature macros to JavaScript enabled features macros
FEATURE_DEFINES_JAVASCRIPT = LANGUAGE_JAVASCRIPT=1
v8: FEATURE_DEFINES_JAVASCRIPT += V8_BINDING=1

for(define, DEFINES) {
    enabled_feature_define = $$find(define, ^ENABLE_.+=1$)
    isEmpty(enabled_feature_define): next()

    FEATURE_DEFINES_JAVASCRIPT += $$enabled_feature_define
}

# ---------------------- The end ----------------------

# Used to compute defaults for the build-webkit script
# Don't place anything after this!
CONFIG(compute_defaults) {
    message($$DEFINES)
    error("Done computing defaults")
}