Don't build plugins with SONAME. Make them plain *.so.
[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], [0])
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], [0])
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 Check for tools
69 AC_PROG_CC
70 AM_PROG_CC_C_O
71 AC_PROG_LIBTOOL
72
73 AC_ARG_ENABLE(glx,
74     AC_HELP_STRING([--enable-glx],
75                    [enable OpenGL/X11 @<:@default=yes@:>@]),
76     [], [enable_glx="yes"])
77
78 AC_ARG_ENABLE(vaapi-glx,
79     AC_HELP_STRING([--enable-vaapi-glx],
80                    [enable VA/GLX extensions @<:@default=yes@:>@]),
81     [], [enable_vaapi_glx="yes"])
82
83 AC_ARG_ENABLE(vaapisink-glx,
84     AC_HELP_STRING([--enable-vaapisink-glx],
85                    [enable OpenGL/X11 to vaapisink @<:@default=yes@:>@]),
86     [], [enable_vaapisink_glx="no"])
87
88 dnl Check for __attribute__((visibility()))
89 AC_CACHE_CHECK([whether __attribute__((visibility())) is supported],
90   vaapi_cv_visibility_attribute,
91   [cat > conftest.c <<EOF
92 int foo __attribute__ ((visibility ("hidden"))) = 1;
93 int bar __attribute__ ((visibility ("protected"))) = 1;
94 EOF
95   vaapi_cv_visibility_attribute=no
96   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
97     if grep '\.hidden.*foo' conftest.s >/dev/null; then
98       if grep '\.protected.*bar' conftest.s >/dev/null; then
99         vaapi_cv_visibility_attribute=yes
100       fi
101     fi
102   fi
103   rm -f conftest.[cs]
104 ])
105 if test $vaapi_cv_visibility_attribute = yes; then
106   vaapi_cv_visibility_attribute_hidden="__attribute__((visibility(\"hidden\")))"
107 else
108   vaapi_cv_visibility_attribute_hidden=""
109 fi
110 AC_DEFINE_UNQUOTED([attribute_hidden],
111                    [$vaapi_cv_visibility_attribute_hidden],
112                    [Define the "hidden" visibility attribute])
113
114 dnl Check for basic libraries
115 AC_CHECK_LIB(m, tan)
116
117 dnl Check for Gtk doc
118 GTKDOC_VERSION=gtkdoc_version
119 GTK_DOC_CHECK([$GTKDOC_VERSION])
120 AM_CONDITIONAL([BUILD_GTK_DOC], [test "x$enable_gtk_doc" = "xyes"])
121 AC_SUBST(GTKDOC_VERSION)
122
123 dnl Check for GLib
124 AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
125 PKG_CHECK_MODULES([GLIB], [glib-2.0])
126 AC_SUBST(GLIB_CFLAGS)
127 AC_SUBST(GLIB_LIBS)
128
129 dnl Check for GStreamer
130 PKG_CHECK_MODULES([GST],
131     [gstreamer-$GST_MAJORMINOR >= $GST_VERSION_REQUIRED]
132 )
133 AC_SUBST(GST_CFLAGS)
134 AC_SUBST(GST_LIBS)
135
136 dnl Check for GStreamer plugins-base
137 PKG_CHECK_MODULES([GST_PLUGINS_BASE],
138     [gstreamer-plugins-base-$GST_MAJORMINOR >= $GST_PLUGINS_BASE_VERSION_REQUIRED]
139 )
140 AC_SUBST(GST_PLUGINS_BASE_CFLAGS)
141 AC_SUBST(GST_PLUGINS_BASE_LIBS)
142
143 dnl Check for GStreamer base
144 PKG_CHECK_MODULES([GST_BASE],
145     [gstreamer-base-$GST_MAJORMINOR >= $GST_VERSION_REQUIRED]
146 )
147 AC_SUBST(GST_BASE_CFLAGS)
148 AC_SUBST(GST_BASE_LIBS)
149
150 dnl Check for GStreamer video
151 PKG_CHECK_MODULES([GST_VIDEO],
152     [gstreamer-video-$GST_MAJORMINOR >= $GST_VERSION_REQUIRED]
153 )
154 AC_SUBST(GST_VIDEO_CFLAGS)
155 AC_SUBST(GST_VIDEO_LIBS)
156
157 dnl GST_ALL_LDFLAGS:
158 dnl LDFLAGS really should only contain flags, not libs - they get added before
159 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
160 GST_ALL_LDFLAGS="-no-undefined"
161 AC_SUBST(GST_ALL_LDFLAGS)
162
163 dnl GST_PLUGIN_LDFLAGS:
164 dnl this really should only contain flags, not libs - they get added before
165 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
166 GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^([_]*gst_plugin_desc|gst_.*_get_type)\$\$' $GST_ALL_LDFLAGS"
167 AC_SUBST(GST_PLUGIN_LDFLAGS)
168
169 dnl Check for the GStreamer plugins directory
170 AC_MSG_CHECKING([for GStreamer plugins directory])
171 GST_PLUGINS_DIR=`$PKG_CONFIG gstreamer-$GST_MAJORMINOR --variable pluginsdir`
172 if test -z "$GST_PLUGINS_DIR"; then
173     echo "FAIL FAIL FAIL"
174     GST_PLUGINS_DIR="\$(libdir)/gstreamer-$GST_MAJORMINOR"
175 fi
176 AC_MSG_RESULT([$GST_PLUGINS_DIR])
177 plugindir="$GST_PLUGINS_DIR"
178 AC_SUBST(plugindir)
179
180 dnl Check for X11
181 PKG_CHECK_MODULES(X11, [x11])
182
183 dnl Check for OpenGL
184 USE_GLX=1
185 if test "$enable_glx" != "yes"; then
186     USE_GLX=0
187 fi
188 GLX_CFLAGS=""
189 GLX_LIBS=""
190 AC_CHECK_HEADERS([GL/gl.h GL/glext.h GL/glx.h], [], [USE_GLX=0], [
191 #ifdef HAVE_GL_GL_H
192 # include <GL/gl.h>
193 #endif
194 ])
195 AC_CHECK_LIB(GL, glXCreateContext, [GLX_LIBS="-lGL"], [USE_GLX=0])
196 AC_SUBST(GLX_CFLAGS)
197 AC_SUBST(GLX_LIBS)
198
199 dnl Check for VA-API
200 LIBVA_PKGNAME="libva"
201 PKG_CHECK_MODULES(LIBVA, [$LIBVA_PKGNAME])
202 AC_SUBST(LIBVA_PKGNAME)
203
204 dnl ... original VA-API 0.29
205 AC_CACHE_CHECK([for old VA-API 0.29],
206     ac_cv_have_vaapi_old, [
207     saved_CFLAGS="$CFLAGS"
208     CFLAGS="$CFLAGS $LIBVA_CFLAGS"
209     saved_LIBS="$LIBS"
210     LIBS="$LIBS $LIBVA_LIBS"
211     AC_TRY_LINK(
212     [#include <va_x11.h>],
213     [vaGetDisplay(NULL)],
214     [ac_cv_have_vaapi_old="yes"],
215     [ac_cv_have_vaapi_old="no"])
216     CFLAGS="$saved_CFLAGS"
217     LIBS="$saved_LIBS"
218 ])
219 if test "$ac_cv_have_vaapi_old" = "yes"; then
220     LIBVA_EXTRA_CFLAGS="$LIBVA_CFLAGS -DGST_VAAPI_USE_OLD_VAAPI_0_29"
221 fi
222
223 dnl ... VA-API >= 0.31 or -sds
224 LIBVA_X11_PKGNAME="libva-x11"
225 PKG_CHECK_MODULES(LIBVA_X11, [$LIBVA_X11_PKGNAME],
226     [ac_cv_have_vaapi_x11="yes"],
227     [ac_cv_have_vaapi_x11="no"]
228 )
229 if test "$ac_cv_have_vaapi_x11" = "no"; then
230     if test "$ac_cv_have_vaapi_old" = "yes"; then
231         LIBVA_X11_PKGNAME="libva"
232         CFLAGS="$CFLAGS $LIBVA_EXTRA_CFLAGS"
233         LIBS="$LIBS $LIBVA_EXTRA_LIBS"
234     else
235         AC_MSG_ERROR([could not find VA-API])
236     fi
237 fi
238 AC_SUBST(LIBVA_X11_PKGNAME)
239
240 dnl ... VA-API >= 0.31 or -sds (VA/GLX extensions)
241 USE_VAAPI_GLX=0
242 if test $USE_GLX -eq 1; then
243     if test "$enable_vaapi_glx" = "yes"; then
244         LIBVA_GLX_PKGNAME="libva-glx"
245         PKG_CHECK_MODULES(LIBVA_GLX, [$LIBVA_GLX_PKGNAME],
246             [ac_cv_have_vaapi_glx="yes" USE_VAAPI_GLX=1],
247             [ac_cv_have_vaapi_glx="no"]
248         )
249     fi
250     if test $USE_VAAPI_GLX -eq 0; then
251         AC_MSG_WARN([VA/GLX not found or disabled. Fallbacking to TFP+FBO])
252         LIBVA_GLX_PKGNAME="$LIBVA_X11_PKGNAME"
253     fi
254 fi
255 AC_SUBST(LIBVA_GLX_PKGNAME)
256
257 AC_SUBST(LIBVA_EXTRA_CFLAGS)
258 AC_SUBST(LIBVA_EXTRA_LIBS)
259
260 dnl Check for OpenGL support to vaapisink
261 if test "$enable_vaapisink_glx:$USE_GLX" = "yes:1"; then
262     USE_VAAPISINK_GLX=1
263 else
264     USE_VAAPISINK_GLX=0
265 fi
266
267 dnl Check for FFmpeg
268 PKG_CHECK_MODULES(LIBAVFORMAT, [libavformat])
269 AC_CHECK_HEADERS([libavformat/avformat.h])
270
271 PKG_CHECK_MODULES(LIBAVCODEC, [libavcodec])
272 AC_CHECK_HEADERS([libavcodec/avcodec.h])
273 AC_CHECK_HEADERS([libavcodec/vaapi.h], [],
274     AC_MSG_ERROR([The system FFmpeg headers do not support VA-API]))
275
276 AC_DEFINE_UNQUOTED(USE_GLX, $USE_GLX,
277     [Defined to 1 if GLX is enabled])
278 AM_CONDITIONAL(USE_GLX, test $USE_GLX -eq 1)
279
280 AC_DEFINE_UNQUOTED(USE_VAAPI_GLX, $USE_VAAPI_GLX,
281     [Defined to 1 if VA/GLX is enabled])
282 AM_CONDITIONAL(USE_VAAPI_GLX, test $USE_VAAPI_GLX -eq 1)
283
284 AC_DEFINE_UNQUOTED(USE_VAAPISINK_GLX, $USE_VAAPISINK_GLX,
285     [Defined to 1 to enable GLX support to vaapisink])
286 AM_CONDITIONAL(USE_VAAPISINK_GLX, test $USE_VAAPISINK_GLX -eq 1)
287
288 VA_VERSION=`$PKG_CONFIG --modversion libva`
289 VA_MAJOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f1`
290 VA_MINOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f2`
291 VA_MICRO_VERSION=`echo "$VA_VERSION" | cut -d'.' -f3`
292 VA_SDS_VERSION=`$PKG_CONFIG libva --variable sdsversion`
293
294 VA_VERSION_STR="$VA_VERSION"
295 if test -n "$VA_SDS_VERSION"; then
296     VA_VERSION_STR="$VA_VERSION_STR-sds$VA_SDS_VERSION"
297 fi
298
299 pkgconfigdir=${libdir}/pkgconfig
300 AC_SUBST(pkgconfigdir)
301
302 AC_OUTPUT([
303     Makefile
304     debian.upstream/Makefile
305     debian.upstream/changelog
306     debian.upstream/control
307     debian.upstream/gstreamer$GST_MAJORMINOR-vaapi.install:\
308 debian.upstream/gstreamer-vaapi.install.in
309     debian.upstream/gstreamer$GST_MAJORMINOR-vaapi-doc.install:\
310 debian.upstream/gstreamer-vaapi-doc.install.in
311     debian.upstream/libgstvaapi$GST_VAAPI_MAJOR_VERSION.install:\
312 debian.upstream/libgstvaapi.install.in
313     debian.upstream/libgstvaapi-dev.install
314     debian.upstream/libgstvaapi-x11-$GST_VAAPI_MAJOR_VERSION.install:\
315 debian.upstream/libgstvaapi-x11.install.in
316     debian.upstream/libgstvaapi-glx-$GST_VAAPI_MAJOR_VERSION.install:\
317 debian.upstream/libgstvaapi-glx.install.in
318     docs/Makefile
319     docs/reference/Makefile
320     docs/reference/libs/Makefile
321     docs/reference/libs/libs-docs.xml
322     docs/reference/plugins/Makefile
323     docs/reference/plugins/plugins-docs.xml
324     gst-libs/Makefile
325     gst-libs/gst/Makefile
326     gst-libs/gst/vaapi/Makefile
327     pkgconfig/Makefile
328     pkgconfig/gstreamer-vaapi-$GST_MAJORMINOR.pc:\
329 pkgconfig/gstreamer-vaapi.pc.in
330     pkgconfig/gstreamer-vaapi-glx-$GST_MAJORMINOR.pc:\
331 pkgconfig/gstreamer-vaapi-glx.pc.in
332     pkgconfig/gstreamer-vaapi-x11-$GST_MAJORMINOR.pc:\
333 pkgconfig/gstreamer-vaapi-x11.pc.in
334     gst/Makefile
335     gst/vaapiconvert/Makefile
336     gst/vaapidecode/Makefile
337     gst/vaapisink/Makefile
338     tests/Makefile
339 ])
340
341 dnl Print summary
342 yesno() {
343     test $1 -eq 1 && echo yes || echo no
344 }
345
346 echo
347 echo $PACKAGE configuration summary:
348 echo
349 echo VA-API version ................... : $VA_VERSION_STR
350 echo GLX support ...................... : $(yesno $USE_GLX)
351 echo VA/GLX support ................... : $(yesno $USE_VAAPI_GLX)
352 echo VaapiSink/GL ..................... : $(yesno $USE_VAAPISINK_GLX)
353 echo