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
|
# xvba_video package version number
m4_define([xvba_video_major_version], [0])
m4_define([xvba_video_minor_version], [8])
m4_define([xvba_video_micro_version], [0])
m4_define([xvba_video_pre_version], [0])
m4_define([xvba_video_version],
[xvba_video_major_version.xvba_video_minor_version.xvba_video_micro_version])
m4_if(xvba_video_pre_version, [0], [], [
m4_append([xvba_video_version], xvba_video_pre_version, [.pre])
])
# libva package version number
m4_define([libva_sds_version_0_29], [8])
m4_define([libva_sds_package_version_0_29], [0.29-2+sds11])
m4_define([libva_sds_version_0_30], [1])
m4_define([libva_sds_package_version_0_30], [0.30-1+sds1])
m4_define([libva_glx_sds_version_0_30], [5])
m4_define([libva_glx_sds_package_version_0_30], [0.30.4-1+sds6])
m4_define([libva_glx_sds_version_0_31], [1])
m4_define([libva_glx_sds_package_version_0_31], [0.31.0-1+sds1])
m4_define([libva_sds_version], [libva_glx_sds_version_0_31])
m4_define([libva_sds_package_version], [libva_glx_sds_package_version_0_31])
AC_PREREQ([2.57])
AC_INIT([xvba_video], [xvba_video_version], [gbeauchesne@splitted-desktop.com], [xvba-video])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER([src/config.h])
LIBVA_SDS_VERSION_0_29=libva_sds_version_0_29
LIBVA_SDS_VERSION_0_30=libva_sds_version_0_30
LIBVA_GLX_SDS_VERSION_0_30=libva_glx_sds_version_0_30
LIBVA_GLX_SDS_VERSION_0_31=libva_glx_sds_version_0_31
LIBVA_SDS_VERSION=libva_sds_version
LIBVA_SDS_PACKAGE_VERSION=libva_sds_package_version
AC_SUBST(LIBVA_SDS_PACKAGE_VERSION)
XVBA_VIDEO_MAJOR_VERSION=xvba_video_major_version
XVBA_VIDEO_MINOR_VERSION=xvba_video_minor_version
XVBA_VIDEO_MICRO_VERSION=xvba_video_micro_version
AC_DEFINE([XVBA_VIDEO_MAJOR_VERSION], [xvba_video_major_version], [Major version of the driver])
AC_DEFINE([XVBA_VIDEO_MINOR_VERSION], [xvba_video_minor_version], [Minor version of the driver])
AC_DEFINE([XVBA_VIDEO_MICRO_VERSION], [xvba_video_micro_version], [Micro version of the driver])
AC_DEFINE([XVBA_VIDEO_PRE_VERSION], [xvba_video_pre_version], [Preversion of the driver])
XVBA_VIDEO_LT_LDFLAGS="-avoid-version"
AC_SUBST(XVBA_VIDEO_LT_LDFLAGS)
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_PROG_CC
AC_CHECK_LIB(m, sqrt)
AC_HEADER_STDC
AC_SYS_LARGEFILE
dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
HAVE_PTHREADS=yes
AC_CHECK_LIB(pthread, pthread_create, , [
AC_CHECK_LIB(c_r, pthread_create, , [
AC_CHECK_LIB(PTL, pthread_create, , [
HAVE_PTHREADS=no
])
])
])
if test "x$HAVE_PTHREADS" = "xyes"; then
AC_DEFINE(HAVE_PTHREADS, 1, [Defined if pthreads are available])
fi
dnl Checks for libraries.
AC_CHECK_LIB(rt, timer_create)
dnl Checks for library functions.
AC_CHECK_FUNCS(clock_gettime)
dnl Check for Cg compiler
AC_CHECK_PROG(CGC, [cgc], [cgc], [no])
have_cgc="no"
if test "x$CGC" != "xno"; then
have_cgc="yes"
fi
AM_CONDITIONAL(HAVE_CGC, [test "x$have_cgc" = "xyes"])
dnl Check for python (pso2h.py needs it)
AC_CHECK_PROG(PYTHON, [python], [python], [no])
have_python="no"
if test "x$PYTHON" != "xno"; then
have_python="yes"
fi
AM_CONDITIONAL(HAVE_PYTHON, [test "x$have_python" = "xyes"])
TARGET_ARCH="$target_cpu"
AC_SUBST(TARGET_ARCH)
AC_DEFUN([AC_DEFINE_01], [
if test "$2" = "yes" -o "$2" = "guessing yes"; then
AC_DEFINE($1, 1, $3)
else
AC_DEFINE($1, 0, $3)
fi
])
AC_ARG_ENABLE(glx,
AC_HELP_STRING([--enable-glx],
[enable OpenGL/X11 @<:@default=yes@:>@]),
[], [enable_glx="yes"])
AC_ARG_ENABLE(libxvba-dlopen,
AC_HELP_STRING([--enable-libxvba-dlopen],
[enable libXvBAW.so.1 to be dlopen()'ed]),
[], [enable_libxvba_dlopen="yes"])
AC_DEFINE_01(USE_DLOPEN, "$enable_libxvba_dlopen",
[Define to enable libXvBAW.so.1 to be dlopen()'ed])
AC_ARG_ENABLE(valgrind,
AC_HELP_STRING([--enable-valgrind],
[enable runtime detection of valgrind]),
[], [PKG_CHECK_EXISTS(valgrind, [enable_valgrind="yes"], [enable_valgrind="no"])])
AC_DEFINE_01(USE_VALGRIND, "$enable_valgrind",
[Define to enable run-time detection of Valgrind])
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
[enable debugging information]),
[], [enable_debug="yes"])
AC_DEFINE_01(USE_DEBUG, "$enable_debug",
[Enable debugging information])
AC_ARG_ENABLE(tracer,
AC_HELP_STRING([--enable-tracer],
[enable XvBA tracer]),
[], [enable_tracer="yes"])
AC_DEFINE_01(USE_TRACER, "$enable_tracer",
[Enable XvBA tracer])
dnl Check for __attribute__((visibility()))
AC_CACHE_CHECK([whether __attribute__((visibility())) is supported],
xvba_cv_visibility_attribute,
[cat > conftest.c <<EOF
int foo __attribute__ ((visibility ("hidden"))) = 1;
int bar __attribute__ ((visibility ("protected"))) = 1;
EOF
xvba_cv_visibility_attribute=no
if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
if grep '\.hidden.*foo' conftest.s >/dev/null; then
if grep '\.protected.*bar' conftest.s >/dev/null; then
xvba_cv_visibility_attribute=yes
fi
fi
fi
rm -f conftest.[cs]
])
if test $xvba_cv_visibility_attribute = yes; then
AC_DEFINE([HAVE_VISIBILITY_ATTRIBUTE], 1, [Define to use the __attribute__((visibility())) extension])
fi
dnl Check for OpenGL
USE_GLX=1
if test "$enable_glx" != "yes"; then
USE_GLX=0
fi
GL_DEPS_CFLAGS=""
GL_DEPS_LIBS=""
AC_CHECK_HEADERS([GL/gl.h GL/glext.h GL/glx.h], [], [USE_GLX=0], [
#ifdef HAVE_GL_GL_H
# include <GL/gl.h>
#endif
])
AC_CHECK_LIB(GL, glXCreateContext, [GL_DEPS_LIBS="-lGL -ldl"], [USE_GLX=0])
AC_SUBST(GL_DEPS_CFLAGS)
AC_SUBST(GL_DEPS_LIBS)
dnl Check for VA-API
PKG_CHECK_MODULES(LIBVA_DEPS, [libva])
PKG_CHECK_MODULES(LIBVA_X11_DEPS, [libva-x11])
PKG_CHECK_MODULES(LIBVA_GLX_DEPS, [libva-glx], [], [USE_GLX=0])
dnl Check for SDS extensions to VA-API
AC_CACHE_CHECK([for VA-API],
ac_cv_libva_sds_extensions, [
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $LIBVA_DEPS_CFLAGS"
AC_TRY_COMPILE([
#include <va/va_version.h>
#if VA_MAJOR_VERSION == 0 && VA_MINOR_VERSION == 29
# if !defined(VA_SDS_VERSION) || (VA_SDS_VERSION < $LIBVA_SDS_VERSION_0_29)
# error "VA-API version >= 0.29.0-sds$LIBVA_SDS_VERSION_0_29 is required"
# endif
#elif VA_MAJOR_VERSION == 0 && VA_MINOR_VERSION == 30
# if !defined(VA_SDS_VERSION) || (VA_SDS_VERSION < $LIBVA_SDS_VERSION_0_30)
# error "VA-API version >= 0.30.0-sds$LIBVA_SDS_VERSION_0_30 is required"
# endif
#elif !VA_CHECK_VERSION(0,31,0)
# error "VA-API version >= 0.31 is required"
#endif
], [],
[ac_cv_libva_sds_extensions="yes"],
[ac_cv_libva_sds_extensions="no"])
CFLAGS="$saved_CFLAGS"
])
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_SDS_VERSION=`$PKG_CONFIG libva --variable sdsversion`
VA_VERSION_STR="$VA_VERSION"
if test -n "$VA_SDS_VERSION"; then
VA_VERSION_STR="$VA_VERSION_STR-sds$VA_SDS_VERSION"
fi
va_full_version_int=`expr ${VA_MAJOR_VERSION:-0} "*" 1000000 + \
${VA_MINOR_VERSION:-0} "*" 10000 + \
${VA_MICRO_VERSION:-0} "*" 100 + \
${VA_SDS_VERSION:-0}`
VA_DRIVER_INIT_FUNC="__vaDriverInit_${VA_MAJOR_VERSION}_${VA_MINOR_VERSION}"
if test $va_full_version_int -ge 00310005; then
VA_DRIVER_INIT_FUNC="${VA_DRIVER_INIT_FUNC}_${VA_MICRO_VERSION}_sds${VA_SDS_VERSION}"
else
VA_DRIVER_INIT_FUNC="${VA_DRIVER_INIT_FUNC}_sds"
fi
if test "$ac_cv_libva_sds_extensions" = "yes"; then
AC_DEFINE_UNQUOTED([VA_DRIVER_INIT_FUNC], [$VA_DRIVER_INIT_FUNC], [Define driver entry-point])
else
AC_MSG_ERROR([Your VA-API SDK does not include SDS extensions])
fi
dnl Check for OpenGL rendering extensions to VA-API
AC_CACHE_CHECK([for VA-API (GLX extensions)],
ac_cv_libva_glx_extensions, [
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $LIBVA_DEPS_CFLAGS"
AC_TRY_COMPILE([
#include <va/va_version.h>
#if VA_MAJOR_VERSION == 0 && VA_MINOR_VERSION == 30
# if !defined(VA_SDS_VERSION) || (VA_SDS_VERSION < $LIBVA_GLX_SDS_VERSION_0_30)
# error "VA-API version >= 0.30.0-sds$LIBVA_GLX_SDS_VERSION_0_30 is required"
# endif
#elif VA_MAJOR_VERSION == 0 && VA_MINOR_VERSION == 31
# if !defined(VA_SDS_VERSION) || (VA_SDS_VERSION < $LIBVA_GLX_SDS_VERSION_0_31)
# error "VA-API version >= 0.31.0-sds$LIBVA_GLX_SDS_VERSION_0_31 is required"
# endif
#elif VA_MAJOR_VERSION == 0 && VA_MINOR_VERSION >= 32
#else
# error "This version of VA-API is not supported for OpenGL rendering"
#endif
], [],
[ac_cv_libva_glx_extensions="yes"],
[ac_cv_libva_glx_extensions="no" USE_GLX=0])
CFLAGS="$saved_CFLAGS"
])
dnl Check for VA-API drivers path
AC_MSG_CHECKING([for VA drivers path])
LIBVA_DRIVERS_PATH=`$PKG_CONFIG libva --variable driverdir`
if test -z "$LIBVA_DRIVERS_PATH"; then
LIBVA_DRIVERS_PATH="/usr/lib/xorg/modules/drivers"
fi
AC_MSG_RESULT([$LIBVA_DRIVERS_PATH])
AC_SUBST(LIBVA_DRIVERS_PATH)
dnl Check for XvBA
AC_CACHE_CHECK([for XvBA],
ac_cv_have_xvba, [
saved_LIBS="$LIBS"
LIBS="$LIBS -lXvBAW"
LIBS="$LIBS -lX11 -lXext -lGL -ldl" # XXX: help broken XvBA libraries...
AC_TRY_LINK(
[
#include <X11/Xlib.h>
#include <amdxvba.h>
],
[XVBAQueryExtension(0,0)],
[ac_cv_have_xvba="yes" HAVE_XVBA=1],
[ac_cv_have_xvba="no" HAVE_XVBA=0])
LIBS="$saved_LIBS"
])
if test "$ac_cv_have_xvba" = "no"; then
AC_MSG_ERROR([you need XvBA to build this package])
fi
AC_DEFINE_UNQUOTED(USE_GLX, $USE_GLX, [Defined to 1 if GLX is enabled])
AM_CONDITIONAL(USE_GLX, test $USE_GLX -eq 1)
PKG_CHECK_MODULES(DRM_DEPS, [libdrm])
XVBA_VIDEO_CFLAGS="$LIBVA_DEPS_CFLAGS $DRM_DEPS_CFLAGS"
XVBA_VIDEO_LIBS=""
if test "$enable_libxvba_dlopen" = "yes"; then
XVBA_VIDEO_LIBS="$XVBA_VIDEO_LIBS -ldl"
else
XVBA_VIDEO_LIBS="$XVBA_VIDEO_LIBS -lXvBAW -lXext -lGL"
fi
if test $USE_GLX -eq 1; then
XVBA_VIDEO_CFLAGS="$XVBA_VIDEO_CFLAGS $GL_DEPS_CFLAGS"
XVBA_VIDEO_LIBS="$XVBA_VIDEO_LIBS $GL_DEPS_LIBS"
fi
if test "$enable_valgrind" = "yes"; then
PKG_CHECK_MODULES(VALGRIND_DEPS, [valgrind])
XVBA_VIDEO_CFLAGS="$XVBA_VIDEO_CFLAGS $VALGRIND_DEPS_CFLAGS"
fi
AC_SUBST(XVBA_VIDEO_CFLAGS)
AC_SUBST(XVBA_VIDEO_LIBS)
AC_OUTPUT([
Makefile
debian.upstream/Makefile
src/Makefile
src/shaders/Makefile
])
dnl Print summary
echo
echo xvba-video configuration summary:
echo
echo VA-API version ................... : $VA_VERSION_STR
echo GLX support ...................... : $(test $USE_GLX -eq 1 && echo yes || echo no)
echo Cg compiler ...................... : $CGC
echo Enable debugging information ..... : $enable_debug
echo Enable XvBA tracer ............... : $enable_tracer
|