Bump version for development.
[vaapi:stormers-gstreamer-vaapi.git] / configure.ac
1 # gstreamer-vaapi package version number
2 m4_define([gst_vaapi_major_version], [0])
3 m4_define([gst_vaapi_minor_version], [2])
4 m4_define([gst_vaapi_micro_version], [7])
5 m4_define([gst_vaapi_version],
6           [gst_vaapi_major_version.gst_vaapi_minor_version.gst_vaapi_micro_version])
7
8 # gst version number
9 m4_define([gst_major_version], [0])
10 m4_define([gst_minor_version], [10])
11 m4_define([gst_micro_version], [10])
12 m4_define([gst_major_minor_version],
13           [gst_major_version.gst_minor_version])
14 m4_define([gst_version],
15           [gst_major_version.gst_minor_version.gst_micro_version])
16
17 # gst plugins-base version number
18 m4_define([gst_plugins_base_major_version], [0])
19 m4_define([gst_plugins_base_minor_version], [10])
20 m4_define([gst_plugins_base_micro_version], [16])
21 m4_define([gst_plugins_base_version],
22           [gst_plugins_base_major_version.gst_plugins_base_minor_version.gst_plugins_base_micro_version])
23
24 # libva package version number
25 m4_define([libva_sds_version_0_29], [8])
26 m4_define([libva_sds_package_version_0_29], [0.29-2+sds11])
27 m4_define([libva_sds_version_0_30], [1])
28 m4_define([libva_sds_package_version_0_30], [0.30-1+sds1])
29 m4_define([libva_glx_sds_version_0_30], [5])
30 m4_define([libva_glx_sds_package_version_0_30], [0.30.4-1+sds6])
31 m4_define([libva_glx_sds_version_0_31], [1])
32 m4_define([libva_glx_sds_package_version_0_31], [0.31.0-1+sds1])
33 m4_define([libva_sds_version], [libva_glx_sds_version_0_31])
34 m4_define([libva_sds_package_version], [libva_glx_sds_package_version_0_31])
35
36 # gtk-doc version number
37 # XXX: introspection annotations require gtk-doc >= 1.12
38 m4_define([gtkdoc_major_version], [1])
39 m4_define([gtkdoc_minor_version], [9])
40 m4_define([gtkdoc_version], [gtkdoc_major_version.gtkdoc_minor_version])
41
42 AC_PREREQ([2.57])
43 AC_INIT([gst_vaapi], [gst_vaapi_version],
44     [gbeauchesne@splitted-desktop.com],
45     [gstreamer-vaapi])
46 AC_CONFIG_SRCDIR([Makefile.am])
47 AC_CANONICAL_TARGET
48 AM_INIT_AUTOMAKE
49 AM_CONFIG_HEADER([config.h])
50
51 TODAY="`LC_ALL=C date +'%a, %d %b %Y %X %z'`"
52 AC_SUBST(TODAY)
53
54 GST_VAAPI_MAJOR_VERSION=gst_vaapi_major_version
55 AC_SUBST(GST_VAAPI_MAJOR_VERSION)
56
57 LIBVA_SDS_PACKAGE_VERSION=libva_sds_package_version
58 AC_SUBST(LIBVA_SDS_PACKAGE_VERSION)
59
60 dnl Versions for GStreamer and plugins-base
61 GST_MAJORMINOR=gst_major_minor_version
62 GST_VERSION_REQUIRED=gst_version
63 GST_PLUGINS_BASE_VERSION_REQUIRED=gst_plugins_base_version
64 AC_SUBST(GST_MAJORMINOR)
65 AC_SUBST(GST_VERSION_REQUIRED)
66 AC_SUBST(GST_PLUGINS_BASE_VERSION_REQUIRED)
67
68 dnl Use pretty build output with automake >= 1.11
69 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [
70   AM_DEFAULT_VERBOSITY=1
71   AC_SUBST(AM_DEFAULT_VERBOSITY)
72 ])
73
74 dnl Check for tools
75 AC_PROG_CC
76 AM_PROG_CC_C_O
77 AC_PROG_LIBTOOL
78
79 AC_ARG_ENABLE(glx,
80     AC_HELP_STRING([--enable-glx],
81                    [enable OpenGL/X11 @<:@default=yes@:>@]),
82     [], [enable_glx="yes"])
83
84 AC_ARG_ENABLE(vaapi-glx,
85     AC_HELP_STRING([--enable-vaapi-glx],
86                    [enable VA/GLX extensions @<:@default=yes@:>@]),
87     [], [enable_vaapi_glx="yes"])
88
89 AC_ARG_ENABLE(vaapisink-glx,
90     AC_HELP_STRING([--enable-vaapisink-glx],
91                    [enable OpenGL/X11 to vaapisink @<:@default=yes@:>@]),
92     [], [enable_vaapisink_glx="no"])
93
94 dnl Check for __attribute__((visibility()))
95 AC_CACHE_CHECK([whether __attribute__((visibility())) is supported],
96   vaapi_cv_visibility_attribute,
97   [cat > conftest.c <<EOF
98 int foo __attribute__ ((visibility ("hidden"))) = 1;
99 int bar __attribute__ ((visibility ("protected"))) = 1;
100 EOF
101   vaapi_cv_visibility_attribute=no
102   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
103     if grep '\.hidden.*foo' conftest.s >/dev/null; then
104       if grep '\.protected.*bar' conftest.s >/dev/null; then
105         vaapi_cv_visibility_attribute=yes
106       fi
107     fi
108   fi
109   rm -f conftest.[cs]
110 ])
111 if test $vaapi_cv_visibility_attribute = yes; then
112   vaapi_cv_visibility_attribute_hidden="__attribute__((visibility(\"hidden\")))"
113 else
114   vaapi_cv_visibility_attribute_hidden=""
115 fi
116 AC_DEFINE_UNQUOTED([attribute_hidden],
117                    [$vaapi_cv_visibility_attribute_hidden],
118                    [Define the "hidden" visibility attribute])
119
120 dnl Check for basic libraries
121 AC_CHECK_LIB(m, tan)
122
123 dnl Check for Gtk doc
124 GTKDOC_VERSION=gtkdoc_version
125 GTK_DOC_CHECK([$GTKDOC_VERSION])
126 AM_CONDITIONAL([BUILD_GTK_DOC], [test "x$enable_gtk_doc" = "xyes"])
127 AC_SUBST(GTKDOC_VERSION)
128
129 dnl Check for GLib
130 AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
131 PKG_CHECK_MODULES([GLIB], [glib-2.0])
132 AC_SUBST(GLIB_CFLAGS)
133 AC_SUBST(GLIB_LIBS)
134
135 dnl Check for GStreamer
136 PKG_CHECK_MODULES([GST],
137     [gstreamer-$GST_MAJORMINOR >= $GST_VERSION_REQUIRED]
138 )
139 AC_SUBST(GST_CFLAGS)
140 AC_SUBST(GST_LIBS)
141
142 dnl Check for GStreamer plugins-base
143 PKG_CHECK_MODULES([GST_PLUGINS_BASE],
144     [gstreamer-plugins-base-$GST_MAJORMINOR >= $GST_PLUGINS_BASE_VERSION_REQUIRED]
145 )
146 AC_SUBST(GST_PLUGINS_BASE_CFLAGS)
147 AC_SUBST(GST_PLUGINS_BASE_LIBS)
148
149 dnl Check for GStreamer base
150 PKG_CHECK_MODULES([GST_BASE],
151     [gstreamer-base-$GST_MAJORMINOR >= $GST_VERSION_REQUIRED]
152 )
153 AC_SUBST(GST_BASE_CFLAGS)
154 AC_SUBST(GST_BASE_LIBS)
155
156 dnl Check for GStreamer video
157 PKG_CHECK_MODULES([GST_VIDEO],
158     [gstreamer-video-$GST_MAJORMINOR >= $GST_VERSION_REQUIRED]
159 )
160 AC_SUBST(GST_VIDEO_CFLAGS)
161 AC_SUBST(GST_VIDEO_LIBS)
162
163 dnl Check for GStreamer interfaces
164 PKG_CHECK_MODULES([GST_INTERFACES],
165     [gstreamer-interfaces-$GST_MAJORMINOR >= $GST_PLUGINS_BASE_VERSION_REQUIRED]
166 )
167 AC_SUBST(GST_INTERFACES_CFLAGS)
168 AC_SUBST(GST_INTERFACES_LIBS)
169
170 dnl GST_ALL_LDFLAGS:
171 dnl LDFLAGS really should only contain flags, not libs - they get added before
172 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
173 GST_ALL_LDFLAGS="-no-undefined"
174 AC_SUBST(GST_ALL_LDFLAGS)
175
176 dnl GST_PLUGIN_LDFLAGS:
177 dnl this really should only contain flags, not libs - they get added before
178 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
179 GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^([_]*gst_plugin_desc|gst_.*_get_type)\$\$' $GST_ALL_LDFLAGS"
180 AC_SUBST(GST_PLUGIN_LDFLAGS)
181
182 dnl Check for the GStreamer plugins directory
183 AC_MSG_CHECKING([for GStreamer plugins directory])
184 GST_PLUGINS_DIR=`$PKG_CONFIG gstreamer-$GST_MAJORMINOR --variable pluginsdir`
185 if test -z "$GST_PLUGINS_DIR"; then
186     echo "FAIL FAIL FAIL"
187     GST_PLUGINS_DIR="\$(libdir)/gstreamer-$GST_MAJORMINOR"
188 fi
189 AC_MSG_RESULT([$GST_PLUGINS_DIR])
190 plugindir="$GST_PLUGINS_DIR"
191 AC_SUBST(plugindir)
192
193 dnl Check for X11
194 PKG_CHECK_MODULES(X11, [x11])
195
196 dnl Check for OpenGL
197 USE_GLX=1
198 if test "$enable_glx" != "yes"; then
199     USE_GLX=0
200 fi
201 GLX_CFLAGS=""
202 GLX_LIBS=""
203 AC_CHECK_HEADERS([GL/gl.h GL/glext.h GL/glx.h], [], [USE_GLX=0], [
204 #ifdef HAVE_GL_GL_H
205 # include <GL/gl.h>
206 #endif
207 ])
208 AC_CHECK_LIB(GL, glXCreateContext, [GLX_LIBS="-lGL"], [USE_GLX=0])
209 AC_SUBST(GLX_CFLAGS)
210 AC_SUBST(GLX_LIBS)
211
212 dnl Check for VA-API
213 LIBVA_PKGNAME="libva"
214 PKG_CHECK_MODULES(LIBVA, [$LIBVA_PKGNAME])
215 AC_SUBST(LIBVA_PKGNAME)
216
217 dnl ... original VA-API 0.29
218 AC_CACHE_CHECK([for old VA-API 0.29],
219     ac_cv_have_vaapi_old, [
220     saved_CFLAGS="$CFLAGS"
221     CFLAGS="$CFLAGS $LIBVA_CFLAGS"
222     saved_LIBS="$LIBS"
223     LIBS="$LIBS $LIBVA_LIBS"
224     AC_TRY_LINK(
225     [#include <va_x11.h>],
226     [vaGetDisplay(NULL)],
227     [ac_cv_have_vaapi_old="yes"],
228     [ac_cv_have_vaapi_old="no"])
229     CFLAGS="$saved_CFLAGS"
230     LIBS="$saved_LIBS"
231 ])
232 if test "$ac_cv_have_vaapi_old" = "yes"; then
233     LIBVA_EXTRA_CFLAGS="$LIBVA_CFLAGS -DGST_VAAPI_USE_OLD_VAAPI_0_29"
234 fi
235
236 dnl ... VA-API >= 0.31 or -sds
237 LIBVA_X11_PKGNAME="libva-x11"
238 PKG_CHECK_MODULES(LIBVA_X11, [$LIBVA_X11_PKGNAME],
239     [ac_cv_have_vaapi_x11="yes"],
240     [ac_cv_have_vaapi_x11="no"]
241 )
242 if test "$ac_cv_have_vaapi_x11" = "no"; then
243     if test "$ac_cv_have_vaapi_old" = "yes"; then
244         LIBVA_X11_PKGNAME="libva"
245         CFLAGS="$CFLAGS $LIBVA_EXTRA_CFLAGS"
246         LIBS="$LIBS $LIBVA_EXTRA_LIBS"
247     else
248         AC_MSG_ERROR([could not find VA-API])
249     fi
250 fi
251 AC_SUBST(LIBVA_X11_PKGNAME)
252
253 dnl ... VA-API >= 0.31 or -sds (VA/GLX extensions)
254 USE_VAAPI_GLX=0
255 if test $USE_GLX -eq 1; then
256     if test "$enable_vaapi_glx" = "yes"; then
257         LIBVA_GLX_PKGNAME="libva-glx"
258         PKG_CHECK_MODULES(LIBVA_GLX, [$LIBVA_GLX_PKGNAME],
259             [ac_cv_have_vaapi_glx="yes" USE_VAAPI_GLX=1],
260             [ac_cv_have_vaapi_glx="no"]
261         )
262     fi
263     if test $USE_VAAPI_GLX -eq 0; then
264         AC_MSG_WARN([VA/GLX not found or disabled. Fallbacking to TFP+FBO])
265         LIBVA_GLX_PKGNAME="$LIBVA_X11_PKGNAME"
266     fi
267 fi
268 AC_SUBST(LIBVA_GLX_PKGNAME)
269
270 AC_SUBST(LIBVA_EXTRA_CFLAGS)
271 AC_SUBST(LIBVA_EXTRA_LIBS)
272
273 dnl Check for OpenGL support to vaapisink
274 if test "$enable_vaapisink_glx:$USE_GLX" = "yes:1"; then
275     USE_VAAPISINK_GLX=1
276 else
277     USE_VAAPISINK_GLX=0
278 fi
279
280 dnl Check for FFmpeg
281 PKG_CHECK_MODULES(LIBAVCODEC, [libavcodec])
282 AC_CHECK_HEADERS([libavcodec/avcodec.h ffmpeg/avcodec.h])
283 AC_CHECK_HEADERS([libavcodec/vaapi.h ffmpeg/vaapi.h], [break],
284     AC_MSG_ERROR([The system FFmpeg headers do not support VA-API]))
285
286 AC_DEFINE_UNQUOTED(USE_GLX, $USE_GLX,
287     [Defined to 1 if GLX is enabled])
288 AM_CONDITIONAL(USE_GLX, test $USE_GLX -eq 1)
289
290 AC_DEFINE_UNQUOTED(USE_VAAPI_GLX, $USE_VAAPI_GLX,
291     [Defined to 1 if VA/GLX is enabled])
292 AM_CONDITIONAL(USE_VAAPI_GLX, test $USE_VAAPI_GLX -eq 1)
293
294 AC_DEFINE_UNQUOTED(USE_VAAPISINK_GLX, $USE_VAAPISINK_GLX,
295     [Defined to 1 to enable GLX support to vaapisink])
296 AM_CONDITIONAL(USE_VAAPISINK_GLX, test $USE_VAAPISINK_GLX -eq 1)
297
298 VA_VERSION=`$PKG_CONFIG --modversion libva`
299 VA_MAJOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f1`
300 VA_MINOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f2`
301 VA_MICRO_VERSION=`echo "$VA_VERSION" | cut -d'.' -f3`
302 VA_SDS_VERSION=`$PKG_CONFIG libva --variable sdsversion`
303
304 VA_VERSION_STR="$VA_VERSION"
305 if test -n "$VA_SDS_VERSION"; then
306     VA_VERSION_STR="$VA_VERSION_STR-sds$VA_SDS_VERSION"
307 fi
308
309 pkgconfigdir=${libdir}/pkgconfig
310 AC_SUBST(pkgconfigdir)
311
312 AC_OUTPUT([
313     Makefile
314     debian.upstream/Makefile
315     debian.upstream/changelog
316     debian.upstream/control
317     debian.upstream/gstreamer$GST_MAJORMINOR-vaapi.install:\
318 debian.upstream/gstreamer-vaapi.install.in
319     debian.upstream/gstreamer$GST_MAJORMINOR-vaapi-doc.install:\
320 debian.upstream/gstreamer-vaapi-doc.install.in
321     debian.upstream/libgstvaapi$GST_VAAPI_MAJOR_VERSION.install:\
322 debian.upstream/libgstvaapi.install.in
323     debian.upstream/libgstvaapi-dev.install
324     debian.upstream/libgstvaapi-x11-$GST_VAAPI_MAJOR_VERSION.install:\
325 debian.upstream/libgstvaapi-x11.install.in
326     debian.upstream/libgstvaapi-glx-$GST_VAAPI_MAJOR_VERSION.install:\
327 debian.upstream/libgstvaapi-glx.install.in
328     docs/Makefile
329     docs/reference/Makefile
330     docs/reference/libs/Makefile
331     docs/reference/libs/libs-docs.xml
332     docs/reference/plugins/Makefile
333     docs/reference/plugins/plugins-docs.xml
334     gst-libs/Makefile
335     gst-libs/gst/Makefile
336     gst-libs/gst/vaapi/Makefile
337     pkgconfig/Makefile
338     pkgconfig/gstreamer-vaapi-$GST_MAJORMINOR.pc:\
339 pkgconfig/gstreamer-vaapi.pc.in
340     pkgconfig/gstreamer-vaapi-glx-$GST_MAJORMINOR.pc:\
341 pkgconfig/gstreamer-vaapi-glx.pc.in
342     pkgconfig/gstreamer-vaapi-x11-$GST_MAJORMINOR.pc:\
343 pkgconfig/gstreamer-vaapi-x11.pc.in
344     gst/Makefile
345     gst/vaapiconvert/Makefile
346     gst/vaapidecode/Makefile
347     gst/vaapisink/Makefile
348     tests/Makefile
349 ])
350
351 dnl Print summary
352 yesno() {
353     test $1 -eq 1 && echo yes || echo no
354 }
355
356 echo
357 echo $PACKAGE configuration summary:
358 echo
359 echo VA-API version ................... : $VA_VERSION_STR
360 echo GLX support ...................... : $(yesno $USE_GLX)
361 echo VA/GLX support ................... : $(yesno $USE_VAAPI_GLX)
362 echo VaapiSink/GL ..................... : $(yesno $USE_VAAPISINK_GLX)
363 echo