-
Notifications
You must be signed in to change notification settings - Fork 31
/
configure.ac
388 lines (340 loc) · 11.8 KB
/
configure.ac
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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# FFmpeg/vaapi demo player
m4_define([ffva_major_version], [0])
m4_define([ffva_minor_version], [1])
m4_define([ffva_micro_version], [0])
m4_define([ffva_pre_version], [1])
m4_define([ffva_version],
[ffva_major_version.ffva_minor_version.ffva_micro_version])
m4_if(ffva_pre_version, [0], [], [
m4_append([ffva_version], ffva_pre_version, [.pre])
])
# Configure defaults
m4_define([default_renderer], [x11])
m4_define([default_glapi], [gles])
m4_define([default_glesapi], [2])
m4_define([default_builtin_ffmpeg], [yes])
# FFmpeg version number
m4_define([libavutil_version], [51.22.1])
m4_define([libavformat_version], [53.21.1])
m4_define([libavcodec_version], [53.35.0])
# VA-API minimum version number
m4_define([va_api_version], [0.30.4])
m4_define([va_api_drm_version], [0.33.0])
m4_define([va_api_x11_version], [0.31.0])
# libva package version number
m4_define([libva_drm_package_version], [1.1.0])
m4_define([libva_x11_package_version], [1.0.3])
AC_PREREQ([2.66])
AC_INIT([ffvademo], [ffva_version],
[gwenole.beauchesne@intel.com],
[ffvademo])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([1.11 tar-ustar no-dist-gzip dist-bzip2])
TODAY="`LC_ALL=C date +'%a, %d %b %Y %X %z'`"
AC_SUBST([TODAY])
LIBVA_PACKAGE_VERSION=libva_x11_package_version
AC_SUBST([LIBVA_PACKAGE_VERSION])
TARGET_ARCH="$target_cpu"
AC_SUBST([TARGET_ARCH])
dnl Use pretty build output with automake >= 1.11
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [
AM_DEFAULT_VERBOSITY=1
AC_SUBST(AM_DEFAULT_VERBOSITY)
])
dnl Configure options
AC_ARG_ENABLE([builtin-ffmpeg],
AS_HELP_STRING([--enable-builtin-ffmpeg],
[build built-in FFmpeg module @<:@default=default_builtin_ffmpeg@:>@]),
[], [enable_builtin_ffmpeg=default_builtin_ffmpeg])
AC_ARG_WITH([renderer],
AS_HELP_STRING([--with-renderer=TARGET],
[build with the specified rendering TARGET
@<:@default=default_renderer@:>@]),
[FFVA_RENDERER="$with_renderer"], [FFVA_RENDERER=default_renderer])
AC_ARG_WITH([glapi],
AS_HELP_STRING([--with-glapi=API],
[build with the specified OpenGL API @<:@default=default_glapi@:>@]),
[FFVA_GLAPI="$with_glapi"], [FFVA_GLAPI=default_glapi])
dnl Resolve dependencies
if test "$enable_builtin_ffmpeg" = "yes"; then
needs_yasm="yes"
fi
dnl Check for tools
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CXX
PKG_PROG_PKG_CONFIG
AC_ARG_VAR([YASM], [Path to yasm program, if any])
AC_PATH_PROG([YASM], [yasm])
if test "$needs_yasm" = "yes" -a -z "$YASM"; then
AC_MSG_ERROR([yasm is needed to build FFmpeg sources])
fi
AC_C_BIGENDIAN
AC_CHECK_LIB([m], [log10])
dnl Initialize libtool
LT_PREREQ([2.2])
LT_INIT
dnl FFVA_LT_LDFLAGS:
FFVA_LT_CURRENT="$FFVA_MAJOR_VERSION"
FFVA_LT_REV=ffva_lt_revision
FFVA_LT_AGE=ffva_lt_age
FFVA_LT_VERSION="$FFVA_LT_CURRENT:$FFVA_LT_REV:$FFVA_LT_AGE"
FFVA_LT_LDFLAGS="-version-info $FFVA_LT_VERSION"
AC_SUBST([FFVA_LT_VERSION])
AC_SUBST([FFVA_LT_LDFLAGS])
dnl ---------------------------------------------------------------------------
dnl -- Renderers --
dnl ---------------------------------------------------------------------------
dnl Renderer
DEFAULT_RENDERER=default_renderer
case "$FFVA_RENDERER" in
egl) FFVA_RENDERER="${FFVA_RENDERER}_${DEFAULT_RENDERER}";;
esac
case "$FFVA_RENDERER" in
drm) FFVA_RENDERER_NAME="DRM";;
x11) FFVA_RENDERER_NAME="X11";;
egl_x11) FFVA_RENDERER_NAME="EGL/X11";;
*) AC_MSG_ERROR([Unsupported renderer $FFVA_RENDERER]);;
esac
AC_SUBST([FFVA_RENDERER])
dnl Check for DRM
USE_DRM=0
case "$FFVA_RENDERER" in
(*drm*)
PKG_CHECK_MODULES([DRM], [libdrm])
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $DRM_CFLAGS"
AC_CHECK_HEADERS([xf86drm.h],
[USE_DRM=1], [AC_MSG_ERROR([incomplete libdrm-dev (headers) package])])
CPPFLAGS="$saved_CPPFLAGS"
;;
esac
AC_DEFINE_UNQUOTED([USE_DRM], [$USE_DRM],
[Defined to 1 if DRM renderer is enabled])
AM_CONDITIONAL([USE_DRM], [test $USE_DRM -eq 1])
dnl Check for X11
USE_X11=0
case "$FFVA_RENDERER" in
(*x11*)
PKG_CHECK_MODULES([X11], [x11])
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $X11_CFLAGS"
AC_CHECK_HEADERS([X11/Xlib.h X11/Xutil.h X11/Xatom.h],
[USE_X11=1], [AC_MSG_ERROR([incomplete libx11-dev (headers) package])])
CPPFLAGS="$saved_CPPFLAGS"
;;
esac
AC_DEFINE_UNQUOTED([USE_X11], [$USE_X11],
[Defined to 1 if X11 renderer is enabled])
AM_CONDITIONAL([USE_X11], [test $USE_X11 -eq 1])
dnl Check for EGL
USE_EGL=0
case "$FFVA_RENDERER" in
(*egl*)
PKG_CHECK_MODULES([EGL], [egl])
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $EGL_CFLAGS"
AC_CHECK_HEADERS([EGL/egl.h],
[USE_EGL=1], [AC_MSG_ERROR([incomplete libegl-dev (headers) package])])
CPPFLAGS="$saved_CPPFLAGS"
;;
esac
AC_DEFINE_UNQUOTED([USE_EGL], [$USE_EGL],
[Defined to 1 if EGL renderer is enabled])
AM_CONDITIONAL([USE_EGL], [test $USE_EGL -eq 1])
dnl OpenGL API
DEFAULT_GLESAPI=default_glesapi
case "$FFVA_GLAPI" in
gles) FFVA_GLAPI="${FFVA_GLAPI}${DEFAULT_GLESAPI}";;
esac
case "$FFVA_GLAPI" in
gl) FFVA_GLAPI_NAME="OpenGL";;
gles1) FFVA_GLAPI_NAME="OpenGL|ES";;
gles2) FFVA_GLAPI_NAME="OpenGL|ESv2";;
gles3) FFVA_GLAPI_NAME="OpenGL|ESv3";;
*) AC_MSG_ERROR([Unsupported OpenGL API $FFVA_GLAPI]);;
esac
AC_SUBST([FFVA_GLAPI])
dnl Check for OpenGL
case "$FFVA_GLAPI" in
(gl)
PKG_CHECK_MODULES([GLAPI], [gl])
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $GLAPI_CFLAGS"
AC_CHECK_HEADERS([GL/gl.h GL/glext.h],
[USE_GLES_VERSION=0],
[AC_MSG_ERROR([incomplete libgl-dev (headers) package])], [
#ifdef HAVE_GL_GL_H
# include <GL/gl.h>
#endif
])
CPPFLAGS="$saved_CPPFLAGS"
;;
esac
dnl Check for OpenGL|ES
case "$FFVA_GLAPI" in
(gles1)
PKG_CHECK_MODULES([GLAPI], [glesv1_cm])
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $GLAPI_CFLAGS"
AC_CHECK_HEADERS([GLES/gl.h GLES/glext.h],
[USE_GLES_VERSION=1],
[AC_MSG_ERROR([incomplete libgles1-dev (headers) package])], [
#ifdef HAVE_GLES_GL_H
# include <GLES/gl.h>
#endif
])
;;
esac
dnl Check for OpenGL|ESv2
case "$FFVA_GLAPI" in
(gles2)
PKG_CHECK_MODULES([GLAPI], [glesv2])
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $GLAPI_CFLAGS"
AC_CHECK_HEADERS([GLES2/gl2.h GLES2/gl2ext.h],
[USE_GLES_VERSION=2],
[AC_MSG_ERROR([incomplete libgles2-dev (headers) package])], [
#ifdef HAVE_GLES2_GL2_H
# include <GLES2/gl2.h>
#endif
])
;;
esac
dnl Check for OpenGL|ESv3
case "$FFVA_GLAPI" in
(gles3)
PKG_CHECK_MODULES([GLAPI], [glesv2])
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $GLAPI_CFLAGS"
AC_CHECK_HEADERS([GLES3/gl3.h GLES3/gl3ext.h GLES2/gl2ext.h],
[USE_GLES_VERSION=3],
[AC_MSG_ERROR([incomplete libgles3-dev (headers) package])], [
#ifdef HAVE_GLES3_GL3_H
# include <GLES3/gl3.h>
#endif
])
;;
esac
AC_DEFINE_UNQUOTED([USE_GLES_VERSION], [$USE_GLES_VERSION],
[Defined to the OpenGL|ES version to use (0:OpenGL)])
dnl ---------------------------------------------------------------------------
dnl -- VA-API --
dnl ---------------------------------------------------------------------------
dnl Core API
LIBVA_PKGNAME="libva"
PKG_CHECK_MODULES([LIBVA], [$LIBVA_PKGNAME >= va_api_version])
AC_SUBST([LIBVA_PKGNAME])
VA_VERSION=`$PKG_CONFIG --modversion libva`
VA_MAJOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f1`
VA_MINOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f2`
VA_MICRO_VERSION=`echo "$VA_VERSION" | cut -d'.' -f3`
VA_VERSION_STR="$VA_VERSION"
dnl VA/DRM API
USE_VA_DRM=0
if test $USE_DRM -eq 1; then
PKG_CHECK_MODULES([LIBVA_DRM], [libva-drm >= va_api_drm_version])
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$LIBVA_DRM_CFLAGS"
AC_CHECK_HEADERS([va/va_drm.h], [USE_VA_DRM=1],
[AC_MSG_ERROR([incomplete libva-dev (headers) package])])
CPPFLAGS="$saved_CPPFLAGS"
fi
AC_DEFINE_UNQUOTED([USE_VA_DRM], [$USE_VA_DRM],
[Defined to 1 if libva (DRM) backend is enabled])
AM_CONDITIONAL([USE_VA_DRM], [test $USE_VA_DRM -eq 1])
dnl VA/X11 API
USE_VA_X11=0
if test $USE_X11 -eq 1; then
PKG_CHECK_MODULES([LIBVA_X11], [libva-x11 >= va_api_x11_version])
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$LIBVA_X11_CFLAGS"
AC_CHECK_HEADERS([va/va_x11.h], [USE_VA_X11=1],
[AC_MSG_ERROR([incomplete libva-dev (headers) package])])
CPPFLAGS="$saved_CPPFLAGS"
fi
AC_DEFINE_UNQUOTED([USE_VA_X11], [$USE_VA_X11],
[Defined to 1 if libva (X11) backend is enabled])
AM_CONDITIONAL([USE_VA_X11], [test $USE_VA_X11 -eq 1])
dnl Check for vpp (video post-processing) support
USE_VA_VPP=0
AC_CACHE_CHECK([for video post-postprocessing API],
ac_cv_have_va_vpp_api, [
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $LIBVA_CFLAGS"
saved_LIBS="$LIBS"
LIBS="$LIBS $LIBVA_LIBS"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <va/va.h>
#include <va/va_vpp.h>]],
[[VADisplay va_dpy;
VAContextID vpp_ctx;
VAProcFilterType filters[VAProcFilterCount];
unsigned int num_filters = VAProcFilterCount;
vaQueryVideoProcFilters(va_dpy, vpp_ctx, filters, &num_filters);
]])],
[ac_cv_have_va_vpp_api="yes" USE_VA_VPP=1],
[ac_cv_have_va_vpp_api="no"]
)
CPPFLAGS="$saved_CPPFLAGS"
LIBS="$saved_LIBS"
])
AC_DEFINE_UNQUOTED([USE_VA_VPP], [$USE_VA_VPP],
[Defined to 1 if video post-processing is used])
AM_CONDITIONAL([USE_VA_VPP], [test $USE_VA_VPP -eq 1])
dnl ---------------------------------------------------------------------------
dnl -- FFmpeg --
dnl ---------------------------------------------------------------------------
dnl Check for libavutil
if test "$enable_builtin_ffmpeg" != "yes"; then
PKG_CHECK_MODULES([LIBAVUTIL], [libavutil >= libavutil_version])
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $LIBAVUTIL_CFLAGS"
AC_CHECK_HEADERS([libavutil/pixfmt.h libavutil/pixdesc.h],
[], [AC_MSG_ERROR([incomplete libavutil-dev (headers) package])])
CPPFLAGS="$saved_CPPFLAGS"
fi
dnl Check for libavformat
if test "$enable_builtin_ffmpeg" != "yes"; then
PKG_CHECK_MODULES([LIBAVFORMAT], [libavformat >= libavformat_version])
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $LIBAVFORMAT_CFLAGS"
AC_CHECK_HEADERS([libavformat/avformat.h],
[], [AC_MSG_ERROR([incomplete libavformat-dev (headers) package])])
CPPFLAGS="$saved_CPPFLAGS"
fi
dnl Check for libavcodec
if test "$enable_builtin_ffmpeg" != "yes"; then
PKG_CHECK_MODULES([LIBAVCODEC], [libavcodec >= libavcodec_version])
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $LIBAVCODEC_CFLAGS"
AC_CHECK_HEADERS([libavcodec/avcodec.h],
[], [AC_MSG_ERROR([incomplete libavcodec-dev (headers) package])])
CPPFLAGS="$saved_CPPFLAGS"
fi
dnl ---------------------------------------------------------------------------
dnl -- Generate files and summary --
dnl ---------------------------------------------------------------------------
AM_CONDITIONAL([ENABLE_BUILTIN_FFMPEG], [test "$enable_builtin_ffmpeg" = "yes"])
AC_CONFIG_FILES([
Makefile
ext/Makefile
ext/ffmpeg/Makefile
src/Makefile
])
AC_OUTPUT
dnl Print summary
FFVA_RENDERER_STRING="$FFVA_RENDERER_NAME"
case "$FFVA_RENDERER" in (*egl*)
FFVA_RENDERER_STRING="$FFVA_RENDERER_STRING ($FFVA_GLAPI_NAME)";;
esac
echo
echo $PACKAGE configuration summary:
echo
echo Renderer ......................... : $FFVA_RENDERER_STRING
echo VA-API version ................... : $VA_VERSION_STR