summaryrefslogtreecommitdiffstats
path: root/Tools/qmake/mkspecs/features/features.prf
blob: f267014dca949b0a0c6b8bde0fdbfc9757699447 (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
241
242
243
244
245
246
247
248
249
250
# -------------------------------------------------------------------
# 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)

# ---------- 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.

DEFINES += WTF_USE_ICU_UNICODE=1
DEFINES -= WTF_USE_QT4_UNICODE=1

# We need fontconfig to set up the test fonts for DumpRenderTree and WebKitTestRunner.
config_fontconfig:!mac {
    DEFINES += HAVE_FONTCONFIG=1
}

!contains(DEFINES, HAVE_QTQUICK=.) {
    haveQtModule(quick): DEFINES += HAVE_QTQUICK=1
}

!contains(DEFINES, HAVE_QTPRINTSUPPORT=.) {
    haveQtModule(printsupport): DEFINES += HAVE_QTPRINTSUPPORT=1
}

!contains(DEFINES, HAVE_QTTESTLIB=.) {
    haveQtModule(testlib) {
        DEFINES += HAVE_QTTESTLIB=1
    } else {
        message("Missing QtTest module, disabling DumpRenderTree, WebKitTestRunner and tests")
    }
}

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

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

# We need libzlib config test to determine to use enable websocket extension or not
!contains(DEFINES, WTF_USE_ZLIB=.) {
    config_libzlib: DEFINES += WTF_USE_ZLIB=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, ENABLE_LEGACY_VIEWPORT_ADAPTION=.): DEFINES += ENABLE_LEGACY_VIEWPORT_ADAPTION=1

# Nescape plugins support (NPAPI)
!contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=.) {
    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
haveQtModule(widgets): DEFINES += HAVE_QSTYLE=1

# Enable the USE(3D_GRAPHICS) flag when QtOpenGL is enabled.
!contains(DEFINES, WTF_USE_3D_GRAPHICS=.):contains(QT_CONFIG, opengl) {
    # Disable USE(3D_GRAPHICS) on Windows temporarily, see https://bugs.webkit.org/show_bug.cgi?id=90850 for details.
    # Also disable on QNX, see https://bugs.webkit.org/show_bug.cgi?id=93278
    !win32-*:!qnx {
        DEFINES += WTF_USE_3D_GRAPHICS=1
    }
}

# WebGL support - only enabled if we can use 3D graphics
!contains(DEFINES, ENABLE_WEBGL=.):contains(DEFINES, WTF_USE_3D_GRAPHICS=1) {
    DEFINES += ENABLE_WEBGL=1
}

# CSS Shaders support
!contains(DEFINES, ENABLE_CSS_SHADERS=.) {
    # Enable CSS shaders when CSS filters and WebGL are enabled.
    contains(DEFINES, ENABLE_CSS_FILTERS=1):contains(DEFINES, ENABLE_WEBGL=1): DEFINES += ENABLE_CSS_SHADERS=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
haveQtModule(sensors) {
    !contains(DEFINES, ENABLE_ORIENTATION_EVENTS=.): DEFINES += ENABLE_ORIENTATION_EVENTS=1
    !contains(DEFINES, ENABLE_DEVICE_ORIENTATION=.): DEFINES += ENABLE_DEVICE_ORIENTATION=1
}

# HTML5 Media Support
!contains(DEFINES, ENABLE_VIDEO=.) {
    mac:!contains(DEFINES, USE_QTMULTIMEDIA=1) {
        DARWIN_VERSION = $$split(QMAKE_HOST.version, ".")
        DARWIN_MAJOR_VERSION = $$first(DARWIN_VERSION)
        # QTKIT support requires 10.7 or newer
        greaterThan(DARWIN_MAJOR_VERSION, 10) {
            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
}

# Gamepad API Support
linux-*:!contains(DEFINES, ENABLE_GAMEPAD=.) {
    packagesExist(libudev): DEFINES += ENABLE_GAMEPAD=1
}

# Xcomposite Support
linux-*:config_libXcomposite: DEFINES += HAVE_XCOMPOSITE=1

# Xrender Support
haveQt(5):linux-*:config_libXrender: DEFINES += HAVE_XRENDER=1

# GLX Support
haveQt(5):linux-*:config_glx:!contains(QT_CONFIG, opengles2): DEFINES += HAVE_GLX=1

# Support for Graphics Surface
!contains(DEFINES, WTF_USE_GRAPHICS_SURFACE=.) {
    mac: DEFINES += WTF_USE_GRAPHICS_SURFACE=1
    # On linux we require GLX, libXcomposite and libXrender to enable graphics surface.
    linux-*:contains(DEFINES, HAVE_GLX=1):contains(DEFINES, HAVE_XCOMPOSITE=1):contains(DEFINES, HAVE_XRENDER=1): 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
contains(DEFINES, ENABLE_SVG=0): DEFINES += ENABLE_SVG_FONTS=0

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

# Disable animated smooth scrolling if request-animation-frame is disabled
contains(DEFINES, ENABLE_REQUEST_ANIMATION_FRAME=0): DEFINES += ENABLE_SMOOTH_SCROLLING=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
}

contains(DEFINES, ENABLE_GAMEPAD=1) {
    !packagesExist(libudev) {
        error("Gamepad API requires libudev to build. Please install libudev development files, or build WebKit without gamepad.")
    } else:!linux-* {
        error("Currently the Gamepad API is supported only on Linux, build WebKit without gamepad.")
    }
}

# Slider Touch is sensible to use when compiling WebKit2
haveQt(5):contains(DEFINES, ENABLE_TOUCH_EVENTS=1) {
    DEFINES += ENABLE_TOUCH_SLIDER=1
}