a0f208bdfd96eb51f95293031f6c1f6c2cdd7f16
[platform/upstream/gstreamer.git] / configure.ac
1 # gstreamer-vaapi package version number
2 m4_define([gst_vaapi_major_version], [1])
3 m4_define([gst_vaapi_minor_version], [17])
4 m4_define([gst_vaapi_micro_version], [0])
5 m4_define([gst_vaapi_nano_version], [1])
6 m4_define([gst_vaapi_version],
7           [gst_vaapi_major_version.gst_vaapi_minor_version.gst_vaapi_micro_version])
8 m4_if(gst_vaapi_nano_version, [0], [],
9   [m4_append([gst_vaapi_version], gst_vaapi_nano_version, [.])])
10
11 # Configure defaults
12 m4_define([default_glapi],              [any])
13
14 dnl - library source changed -> increment REVISION
15 dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
16 dnl - interfaces added -> increment AGE
17 dnl - interfaces removed -> AGE = 0
18 # gstreamer-vaapi library (libtool) version number
19 m4_define([gst_vaapi_lt_current],       [1700])
20 m4_define([gst_vaapi_lt_revision],      [0])
21 m4_define([gst_vaapi_lt_age],           [1700])
22
23 # glib version number
24 m4_define([glib_version], [2.40])
25
26 # gstreamer version number
27 m4_define([gst_version],                [1.17.0.1])
28 m4_define([gst_plugins_base_version],   [1.17.0.1])
29 m4_define([gst_plugins_bad_version],    [1.17.0.1])
30
31 # Wayland minimum version number
32 m4_define([wayland_api_version], [1.11.0])
33
34 # VA-API minimum version number
35 m4_define([va_api_version],     [0.39.0])
36
37 # gtk-doc version number
38 # XXX: introspection annotations require gtk-doc >= 1.12
39 m4_define([gtkdoc_version], [1.12])
40
41 AC_PREREQ([2.69])
42 AC_INIT([GStreamer VA-API Plug-ins], [gst_vaapi_version],
43   [http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer],
44   [gstreamer-vaapi])
45
46 dnl define the output header for config
47 AC_CONFIG_HEADERS([config.h])
48 AC_CONFIG_SRCDIR([Makefile.am])
49 AC_CONFIG_MACRO_DIR([m4])
50 AC_CONFIG_AUX_DIR([build-aux])
51
52 AG_GST_INIT
53
54 dnl initialize automake
55 AM_INIT_AUTOMAKE([-Wno-portability 1.14 no-dist-gzip dist-xz tar-ustar subdir-objects])
56
57 dnl define PACKAGE_VERSION_* variables
58 AS_VERSION
59
60 dnl check if this is a release version
61 AS_NANO(GST_GIT="no", GST_GIT="yes")
62
63 dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
64 AM_MAINTAINER_MODE([enable])
65
66 dnl use pretty build output by default
67 AM_SILENT_RULES([yes])
68
69 dnl our libraries and install dirs use GST_API_VERSION in the filename
70 dnl to allow side-by-side installation of different API versions
71 GST_API_VERSION=1.0
72 AC_SUBST([GST_API_VERSION])
73 AC_DEFINE_UNQUOTED([GST_API_VERSION], ["$GST_API_VERSION"],
74   [GStreamer API Version])
75
76 AG_GST_LIBTOOL_PREPARE
77
78 dnl CURRENT, REVISION, AGE
79 dnl sets GST_LT_LDFLAGS
80 AS_LIBTOOL(GST, gst_vaapi_lt_current, gst_vaapi_lt_revision, gst_vaapi_lt_age)
81
82 dnl *** required versions of GStreamer stuff ***
83 GLIB_REQ=glib_version
84 GST_REQ=gst_version
85 GST_PBREQ=gst_plugins_base_version
86 GST_PBADREQ=gst_plugins_bad_version
87 WAYLAND_REQ=wayland_api_version
88 GTKDOC_REQ=gtkdoc_version
89
90 dnl *** required versions of VA-API stuff ***
91 VAAPI_REQ=va_api_version
92
93 dnl *** autotools stuff ****
94
95 dnl allow for different autotools
96 AS_AUTOTOOLS_ALTERNATE
97
98 dnl Add parameters for aclocal
99 AC_SUBST([ACLOCAL_AMFLAGS], ["-I m4 -I common/m4"])
100
101 dnl *** check for arguments to configure ***
102
103 AG_GST_ARG_DISABLE_FATAL_WARNINGS
104 AG_GST_ARG_ENABLE_EXTRA_CHECKS
105 AG_GST_ARG_DEBUG
106
107 AG_GST_ARG_EXAMPLES
108
109 AG_GST_ARG_WITH_PKG_CONFIG_PATH
110
111 AG_GST_SET_PACKAGE_RELEASE_DATETIME_WITH_NANO([$PACKAGE_VERSION_NANO],
112   ["${srcdir}/gstreamer-vaapi.doap"],
113   [$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_MICRO])
114
115 AC_ARG_ENABLE([encoders],
116   AS_HELP_STRING([--enable-encoders],
117     [enable video encoders @<:@default=yes@:>@]),
118   [], [enable_encoders="yes"])
119
120 AC_ARG_ENABLE([drm],
121   AS_HELP_STRING([--enable-drm],
122     [enable DRM backend @<:@default=yes@:>@]),
123   [], [enable_drm="yes"])
124
125 AC_ARG_ENABLE([x11],
126   AS_HELP_STRING([--enable-x11],
127     [enable X11 output @<:@default=yes@:>@]),
128   [], [enable_x11="yes"])
129
130 AC_ARG_ENABLE([glx],
131   AS_HELP_STRING([--enable-glx],
132     [enable OpenGL/X11 output @<:@default=yes@:>@]),
133   [], [enable_glx="yes"])
134
135 AC_ARG_ENABLE([wayland],
136   AC_HELP_STRING([--enable-wayland],
137     [enable Wayland output @<:@default=yes@:>@]),
138   [], [enable_wayland="yes"])
139
140 AC_ARG_ENABLE([egl],
141   AS_HELP_STRING([--enable-egl],
142     [enable EGL output @<:@default=yes@:>@]),
143   [], [enable_egl="yes"])
144
145 AC_ARG_WITH([glapi],
146   AS_HELP_STRING([--with-glapi=APIs],
147     [build with the specified OpenGL APIs @<:@default=default_glapi@:>@]),
148   [GLAPI="$with_glapi"], [GLAPI=default_glapi])
149
150 AC_ARG_WITH([gtk],
151   [AS_HELP_STRING([--with-gtk],
152     [compile GTK3 based test apps @<:@default=check@:>@])],
153   [], [with_gtk="check"])
154
155 dnl *** checks for platform ***
156
157 dnl * hardware/architecture *
158
159 dnl check CPU type
160 AG_GST_ARCH
161
162 dnl *** checks for programs ***
163
164 dnl find a compiler
165 AC_PROG_CC
166 AC_PROG_CC_STDC
167
168 dnl check if the compiler supports '-c' and '-o' options
169 AM_PROG_CC_C_O
170
171 dnl check for documentation tools
172 GTK_DOC_CHECK([$GTKDOC_REQ])
173 AG_GST_PLUGIN_DOCS([$GTKDOC_REQ])
174
175 dnl *** checks for libraries ***
176 dnl check for libm, for sin() etc.
177 AC_CHECK_LIB([m], [tan])
178
179 dnl Check to see if dlopen/dlsym is in default libraries (like
180 dnl Solaris, which has it in libc), or if libdl is needed to get it.
181 AC_CHECK_FUNC([dlopen], [], [
182   AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
183 AC_SUBST([DLOPEN_LIBS])
184
185 dnl define LIBDIR so we can inform people where we live
186 AS_AC_EXPAND([LIBDIR], [$libdir])
187 AC_DEFINE_UNQUOTED([LIBDIR], ["$LIBDIR"], [library dir])
188
189 dnl set location of plugin directory
190 AG_GST_SET_PLUGINDIR
191
192 dnl *** checks for header files ***
193
194 dnl *** checks for types/defines ***
195
196 dnl *** checks for structures ***
197
198 dnl *** checks for compiler characteristics ***
199
200 dnl *** checks for library functions ***
201
202 dnl *** checks for headers ***
203
204 dnl *** checks for dependency libraries ***
205
206 dnl ---------------------------------------------------------------------------
207 dnl -- GStreamer                                                             --
208 dnl ---------------------------------------------------------------------------
209 dnl GLib is required
210 AG_GST_GLIB_CHECK([$GLIB_REQ])
211
212 dnl checks for gstreamer
213 dnl uninstalled is selected preferentially -- see pkg-config(1)
214 AG_GST_CHECK_GST([$GST_API_VERSION], [$GST_REQ], [yes])
215
216 dnl back compatibility
217 AC_MSG_CHECKING([for GStreamer API version])
218 gst_api_version=`$PKG_CONFIG --modversion "gstreamer-$GST_API_VERSION"`
219 gst_major_version=`echo "$gst_api_version" | cut -d'.' -f1`
220 gst_minor_version=`echo "$gst_api_version" | cut -d'.' -f2`
221 GST_VERSION="${gst_major_version}.${gst_minor_version}"
222 AC_MSG_RESULT([$GST_VERSION])
223 AC_DEFINE_UNQUOTED([GST_API_VERSION_S], ["$GST_VERSION"],
224   [Defined to the string representation of GStreamer version])
225
226 AG_GST_CHECK_GST_BASE([$GST_API_VERSION], [$GST_REQ], [yes])
227 AG_GST_CHECK_GST_PLUGINS_BASE([$GST_API_VERSION], [$GST_PBREQ], [yes])
228
229 dnl gst_dmabuf_memory_get_fd (gstreamer-allocators)
230 AG_GST_CHECK_MODULES([GST_ALLOCATORS],
231   [gstreamer-allocators-$GST_API_VERSION], [$GST_PBREQ], [yes])
232
233 dnl GstVideoOverlayComposition (gstreamer-video)
234 AG_GST_CHECK_MODULES([GST_VIDEO],
235   [gstreamer-video-$GST_API_VERSION], [$GST_PBREQ], [yes])
236
237 dnl ... GStreamer base utils (gstreamer-pbutils)
238 AG_GST_CHECK_MODULES([GST_PBUTILS],
239   [gstreamer-pbutils-$GST_API_VERSION], [$GST_PBREQ], [yes])
240
241 dnl bitstream parsers (gstreamer-codecparsers)
242 AG_GST_CHECK_MODULES([GST_CODEC_PARSERS],
243   [gstreamer-codecparsers-$GST_API_VERSION], [$GST_PBADREQ], [yes])
244
245 AS_IF([test "x$enable_glx" = "xyes" -o "x$enable_egl" = "xyes"],
246   [enable_opengl="yes"], [enable_opengl="no"])
247
248 dnl ... opengl helper libraries
249 HAVE_GSTGL=0
250 if test "x$enable_opengl" = "xyes"; then
251   PKG_CHECK_MODULES([GST_GL],
252     [gstreamer-gl-$GST_API_VERSION >= $GST_PBADREQ],
253     [
254       HAVE_GSTGL=1
255       AC_CACHE_CHECK([for GStreamer OpenGL helper libraries],
256         [ac_cv_have_gst_gl_helpers],
257         [
258           saved_CPPFLAGS="$CPPFLAGS"
259           CPPFLAGS="$CPPFLAGS $GST_GL_CFLAGS $GST_VIDEO_CFLAGS"
260           saved_LIBS="$LIBS"
261           LIBS="$saved_LIBS"
262           AC_CHECK_HEADERS([gst/gl/gl.h], [], [HAVE_GSTGL=0])
263           AC_COMPILE_IFELSE(
264             [
265               AC_LANG_PROGRAM(
266                 [[
267 #include <gst/gl/gl.h>
268                 ]],
269                 [[
270 GstGLContext gl_context;
271                 ]])
272             ],
273             [ac_cv_have_gst_gl_helpers="yes"],
274             [ac_cv_have_gst_gl_helpers="no"])
275           CPPFLAGS="$saved_CPPFLAGS"
276           LIBS="$saved_LIBS"
277         ])
278     ], [:])
279 fi
280 AS_IF([test "x$ac_cv_have_gst_gl_helpers" = "xno"], [HAVE_GSTGL=0])
281 AM_CONDITIONAL([USE_GST_GL_HELPERS], [test $HAVE_GSTGL -eq 1])
282 AC_DEFINE_UNQUOTED([USE_GST_GL_HELPERS], [$HAVE_GSTGL],
283   [Defined to 1 if GStreamer OpenGL helper libraries are available])
284
285 if test "x$enable_egl" = "xyes" -a $HAVE_GSTGL -ne 1; then
286   AC_MSG_WARN([GStreamer/GL helper libraries not found, disabling EGL support])
287   enable_egl="no"
288 fi
289
290 dnl ---------------------------------------------------------------------------
291 dnl -- Renderers                                                             --
292 dnl ---------------------------------------------------------------------------
293
294 dnl Check for DRM/libudev
295 USE_DRM=0
296 if test "x$enable_drm" = "xyes"; then
297   PKG_CHECK_MODULES([DRM], [libdrm libudev],
298     [
299       USE_DRM=1
300       saved_CPPFLAGS="$CPPFLAGS"
301       CPPFLAGS="$CPPFLAGS $DRM_CFLAGS"
302       AC_CHECK_HEADERS([drm_fourcc.h], [], [USE_DRM=0])
303       CPPFLAGS="$saved_CPPFLAGS"
304     ], [:])
305 fi
306
307 dnl Check for X11
308 USE_X11=0
309 if test "x$enable_x11" = "xyes"; then
310   PKG_CHECK_MODULES([X11], [x11],
311     [
312       USE_X11=1
313       saved_CPPFLAGS="$CPPFLAGS"
314       CPPFLAGS="$CPPFLAGS $X11_CFLAGS"
315       AC_CHECK_HEADERS([X11/Xlib.h X11/Xutil.h X11/Xatom.h], [], [USE_X11=0])
316       CPPFLAGS="$saved_CPPFLAGS"
317     ], [:])
318 fi
319
320 HAVE_XKBLIB=0
321 HAVE_XRANDR=0
322 HAVE_XRENDER=0
323 if test $USE_X11 -eq 1; then
324   dnl Check for XKB library
325   HAVE_XKBLIB=1
326   saved_CPPFLAGS="$CPPFLAGS"
327   CPPFLAGS="$CPPFLAGS $X11_CFLAGS"
328   AC_CHECK_HEADERS([X11/XKBlib.h], [], [HAVE_XKBLIB=0])
329   CPPFLAGS="$saved_CPPFLAGS"
330
331   dnl Check for XRandR
332   PKG_CHECK_MODULES([XRANDR], [xrandr],
333     [
334       HAVE_XRANDR=1
335       saved_CPPFLAGS="$CPPFLAGS"
336       CPPFLAGS="$CPPFLAGS $XRANDR_CFLAGS"
337       AC_CHECK_HEADERS([X11/extensions/Xrandr.h], [], [HAVE_XRANDR=0])
338       CPPFLAGS="$saved_CPPFLAGS"
339     ], [:])
340
341   dnl Check for XRender
342   PKG_CHECK_MODULES([XRENDER], [xrender],
343     [
344       HAVE_XRENDER=1
345       saved_CPPFLAGS="$CPPFLAGS"
346       CPPFLAGS="$CPPFLAGS $XRENDER_CFLAGS"
347       AC_CHECK_HEADERS([X11/extensions/Xrender.h], [], [HAVE_XRENDER=0])
348       CPPFLAGS="$saved_CPPFLAGS"
349     ], [:])
350 fi
351
352 AC_DEFINE_UNQUOTED([HAVE_XKBLIB], [$HAVE_XKBLIB],
353   [Defined to 1 if the XKB extension exists.])
354 AC_DEFINE_UNQUOTED([HAVE_XRANDR], [$HAVE_XRANDR],
355   [Defined to 1 if the XRandR extension exists.])
356 AC_DEFINE_UNQUOTED([HAVE_XRENDER], [$HAVE_XRENDER],
357   [Defined to 1 if the XRender extension exists.])
358
359 dnl OpenGL
360 GLES_VERSION_MASK=0
361
362 HAVE_GL=0
363 HAVE_GLESv2=0
364 HAVE_GLESv3=0
365 if test "x$enable_opengl" = "xyes"; then
366   dnl OpenGL
367   case ",$GLAPI," in
368     (*,any,*|*,gl,*)
369       HAVE_GL=1
370       PKG_CHECK_MODULES([GL], [gl],
371         [
372           saved_CPPFLAGS="$CPPFLAGS"
373           CPPFLAGS="$CPPFLAGS $GL_CFLAGS"
374           AC_CHECK_HEADERS([GL/gl.h GL/glext.h], [], [HAVE_GL=0],
375             [
376 #ifdef HAVE_GL_GL_H
377 # include <GL/gl.h>
378 #endif
379             ])
380           CPPFLAGS="$saved_CPPFLAGS"
381         ], [HAVE_GL=0])
382       GLES_VERSION_MASK=`expr $GLES_VERSION_MASK "+" $HAVE_GL "*" 1`
383     ;;
384   esac
385
386   dnl OpenGL|ESv2
387   case ",$GLAPI," in
388     (*,any,*|*,gles2,*)
389       HAVE_GLESv2=1
390       PKG_CHECK_MODULES([GLES2], [glesv2],
391         [
392           saved_CPPFLAGS="$CPPFLAGS"
393           CPPFLAGS="$CPPFLAGS $GLES2_CFLAGS"
394           AC_CHECK_HEADERS([GLES2/gl2.h GLES2/gl2ext.h], [], [HAVE_GLESv2=0],
395             [
396 #ifdef HAVE_GLES2_GL2_H
397 # include <GLES2/gl2.h>
398 #endif
399             ])
400           CPPFLAGS="$saved_CPPFLAGS"
401         ], [HAVE_GLESv2=0])
402       GLES_VERSION_MASK=`expr $GLES_VERSION_MASK "+" $HAVE_GLESv2 "*" 4`
403     ;;
404   esac
405
406   dnl OpenGL|ESv3
407   case ",$GLAPI," in
408     (*,any,*|*,gles3,*)
409       HAVE_GLESv3=1
410       PKG_CHECK_MODULES([GLES3], [glesv2],
411         [
412           saved_CPPFLAGS="$CPPFLAGS"
413           CPPFLAGS="$CPPFLAGS $GLES3_CFLAGS"
414           AC_CHECK_HEADERS([GLES3/gl3.h GLES3/gl3ext.h GLES2/gl2ext.h], [],
415             [HAVE_GLESv3=0],
416             [
417 #ifdef HAVE_GLES3_GL3_H
418 # include <GLES3/gl3.h>
419 #endif
420             ])
421           CPPFLAGS="$saved_CPPFLAGS"
422         ], [HAVE_GLESv3=0])
423       GLES_VERSION_MASK=`expr $GLES_VERSION_MASK "+" $HAVE_GLESv3 "*" 8`
424     ;;
425   esac
426 fi
427
428 dnl ... GLX
429 USE_GLX=0
430 if test "x$enable_glx" = "xyes" -a $HAVE_GL -eq 1 -a $USE_X11 -eq 1; then
431   USE_GLX=1
432
433   saved_CPPFLAGS="$CPPFLAGS"
434   saved_LIBS="$LIBS"
435   CPPFLAGS="$CPPFLAGS $GL_CFLAGS"
436   LIBS="$LIBS $GL_LIBS"
437   AC_CHECK_HEADERS([GL/glx.h], [], [USE_GLX=0],
438     [
439 #ifdef HAVE_GL_GL_H
440 # include <GL/gl.h>
441 #endif
442     ])
443   AC_CHECK_LIB([GL], [glXCreateContext], [], [USE_GLX=0])
444   CPPFLAGS="$saved_CPPFLAGS"
445   LIBS="$saved_LIBS"
446 fi
447
448 dnl ... EGL
449 USE_EGL=0
450 if test "x$enable_egl" = "xyes" -a $GLES_VERSION_MASK -ne 0; then
451   PKG_CHECK_MODULES([EGL], [egl],
452     [
453       USE_EGL=1
454
455       saved_CPPFLAGS="$CPPFLAGS"
456       saved_LIBS="$LIBS"
457       CPPFLAGS="$CPPFLAGS $EGL_CFLAGS"
458       LIBS="$LIBS $EGL_LIBS"
459       AC_CHECK_HEADERS([EGL/egl.h], [], [USE_EGL=0])
460       AC_CHECK_LIB([EGL], [eglGetDisplay], [], [USE_EGL=0])
461       CPPFLAGS="$saved_CPPFLAGS"
462       LIBS="$saved_LIBS"
463     ], [:])
464 fi
465
466 dnl Check for Wayland
467 USE_WAYLAND=0
468 if test "x$enable_wayland" = "xyes"; then
469   PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQ, wayland-protocols >= 1.15],
470     [
471       USE_WAYLAND=1
472       saved_CPPFLAGS="$CPPFLAGS"
473       CPPFLAGS="$CPPFLAGS $WAYLAND_CFLAGS"
474       AC_CHECK_HEADERS([wayland-client.h], [], [USE_WAYLAND=0])
475       CPPFLAGS="$saved_CPPFLAGS"
476
477       AC_CHECK_PROGS(WAYLAND_SCANNER, wayland-scanner, [USE_WAYLAND=0])
478
479       WAYLAND_PROTOCOLS_DATADIR="`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`"
480       AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $WAYLAND_PROTOCOLS_DATADIR)
481     ], [:])
482 fi
483
484 dnl Check for GTK for tests
485 USE_GTK=0
486 AS_IF([test "x$BUILD_EXAMPLES" = "xyes" -a $USE_X11 -eq 1],
487   [AS_CASE([$with_gtk],
488     [yes], [PKG_CHECK_MODULES([GTK3], [gtk+-3.0], [USE_GTK=1])],
489     [no], [],
490     [PKG_CHECK_MODULES([GTK3], [gtk+-3.0], [USE_GTK=1], [USE_GTK=0])])])
491 AS_IF([test $USE_GTK -eq 1],
492   [
493     saved_CPPFLAGS="$CPPFLAGS"
494     CPPFLAGS="$CPPFLAGS $GTK3_CFLAGS"
495     AC_CHECK_HEADERS([gtk/gtk.h], [], [USE_GTK=0])
496     CPPFLAGS="$saved_CPPFLAGS"
497   ])
498 dnl USE_GTK conditional is delayed after being sure to handle X11
499
500 dnl ---------------------------------------------------------------------------
501 dnl -- VA-API                                                                --
502 dnl ---------------------------------------------------------------------------
503
504 dnl Core API
505 PKG_CHECK_MODULES([LIBVA], [libva >= $VAAPI_REQ libva != 0.99.0])
506 VA_VERSION_STR=`$PKG_CONFIG --modversion libva`
507 VA_DRIVERS_PATH=`$PKG_CONFIG --variable=driverdir libva`
508 AC_DEFINE_UNQUOTED([VA_DRIVERS_PATH], ["$VA_DRIVERS_PATH"],
509   [VA drivers path])
510
511 dnl VA/DRM API
512 if test $USE_DRM -eq 1; then
513   PKG_CHECK_MODULES([LIBVA_DRM], [libva-drm >= $VAAPI_REQ],
514     [
515       saved_CPPFLAGS="$CPPFLAGS"
516       CPPFLAGS="$CPPFLAGS $LIBVA_DRM_CFLAGS"
517       AC_CHECK_HEADERS([va/va_drm.h], [], [USE_DRM=0])
518       CPPFLAGS="$saved_CPPFLAGS"
519     ], [USE_DRM=0])
520 fi
521
522 dnl VA/X11 API
523 if test $USE_X11 -eq 1; then
524   PKG_CHECK_MODULES(LIBVA_X11, [libva-x11 >= $VAAPI_REQ],
525     [], [
526       USE_X11=0
527       USE_GLX=0
528     ])
529 fi
530
531 dnl export USE_GTK after being sure to handle X11
532 AM_CONDITIONAL([USE_GTK], [test $USE_X11 -eq 1 -a $USE_GTK -eq 1])
533
534 dnl Check for encoding support
535 USE_ENCODERS=0
536 if test "x$enable_encoders" = "xyes"; then
537   USE_ENCODERS=1
538 fi
539
540 USE_VP9_ENCODER=0
541 USE_H264_FEI_ENCODER=0
542
543 if test $USE_ENCODERS -eq 1; then
544   saved_CPPFLAGS="$CPPFLAGS"
545   CPPFLAGS="$CPPFLAGS $LIBVA_CFLAGS"
546
547   dnl Check for VP9 Encoding API (0.39.1+)
548   AC_CHECK_HEADERS([va/va_enc_vp9.h], [], [],
549     [
550 #include <va/va.h>
551     ])
552   AC_CACHE_CHECK([for VP9 encoding API],
553     [ac_cv_have_vp9_encoding_api],
554     [
555       saved_LIBS="$LIBS"
556       LIBS="$LIBS $LIBVA_LIBS"
557       AC_COMPILE_IFELSE(
558         [
559           AC_LANG_PROGRAM(
560             [[
561 #include <va/va.h>
562 #ifdef HAVE_VA_VA_ENC_VP9_H
563 # include <va/va_enc_vp9.h>
564 #endif
565             ]],
566             [[
567 VAEncSequenceParameterBufferVP9 seq_param;
568 VAEncPictureParameterBufferVP9 pic_param;
569 VAEncSegParamVP9 seg_param;
570 VAEncMiscParameterTypeVP9PerSegmantParam misc_param;
571             ]])
572         ],
573         [ac_cv_have_vp9_encoding_api="yes"],
574         [ac_cv_have_vp9_encoding_api="no"])
575       LIBS="$saved_LIBS"
576     ])
577   AS_IF([test "x$ac_cv_have_vp9_encoding_api" = "xyes"], [USE_VP9_ENCODER=1])
578
579   dnl Check for H264 FEI Encoding API
580   AC_CHECK_HEADERS([va/va_fei_h264.h], [], [],
581     [
582 #include <va/va.h>
583     ])
584   AC_CACHE_CHECK([for H264_FEI encoding API],
585     [ac_cv_have_h264_fei_encoding_api],
586     [
587       saved_CPPFLAGS="$CPPFLAGS"
588       CPPFLAGS="$CPPFLAGS $LIBVA_CFLAGS"
589       saved_LIBS="$LIBS"
590       LIBS="$LIBS $LIBVA_LIBS"
591       AC_COMPILE_IFELSE(
592         [
593           AC_LANG_PROGRAM(
594             [[
595 #include <va/va.h>
596 #ifdef HAVE_VA_VA_FEI_H264_H
597 # include <va/va_fei_h264.h>
598 #endif
599             ]],
600             [[
601 VAEncMiscParameterFEIFrameControlH264 framectl;
602 VAEncFEIMBControlH264 mbcntrl;
603 VAEncFEIMVPredictorH264 mvpred;
604 VAEncFEIMBCodeH264 mbcode;
605 VAEncFEIDistortionH264 dist;
606             ]])
607         ],
608         [ac_cv_have_h264_fei_encoding_api="yes"],
609         [ac_cv_have_h264_fei_encoding_api="no"])
610       CPPFLAGS="$saved_CPPFLAGS"
611       LIBS="$saved_LIBS"
612     ])
613   AS_IF([test "x$ac_cv_have_h264_fei_encoding_api" = "xyes"], [USE_H264_FEI_ENCODER=1])
614   CPPFLAGS="$saved_CPPFLAGS"
615 fi
616
617 dnl VA/Wayland API
618 if test $USE_WAYLAND -eq 1; then
619   PKG_CHECK_MODULES([LIBVA_WAYLAND], [libva-wayland >= $VAAPI_REQ],
620     [], [USE_WAYLAND=0])
621 fi
622
623 dnl *** finalize CFLAGS, LDFLAGS, LIBS
624
625 # set by AG_GST_PARSE_SUBSYSTEM_DISABLES above
626 dnl make sure it doesn't complain about unused variables if debugging is disabled
627 AG_GST_CHECK_GST_DEBUG_DISABLED([NO_WARNINGS="-Wno-unused"], [NO_WARNINGS=""])
628
629 dnl define an ERROR_CFLAGS Makefile variable
630 dnl FIXME Add -Wredundant-decls again if considered useful and warnings are fixed
631 AG_GST_SET_ERROR_CFLAGS([$FATAL_WARNINGS], [-Wmissing-declarations -Wmissing-prototypes -Wwrite-strings -Wformat-security -Wold-style-definition -Winit-self -Wmissing-include-dirs -Waddress -Wno-multichar -Wnested-externs $NO_WARNINGS])
632
633 dnl define correct level for debugging messages
634 AG_GST_SET_LEVEL_DEFAULT([$GST_GIT])
635
636 dnl Overview:
637 dnl GST_OPTION_CFLAGS:  common flags for profiling, debugging, errors, ...
638 dnl GST_*:              flags shared by built objects to link against GStreamer
639 dnl GST_ALL_LDFLAGS:    linker flags shared by all
640 dnl GST_LIB_LDFLAGS:    additional linker flags for all libaries
641 dnl GST_LT_LDFLAGS:     library versioning of our libraries
642 dnl GST_PLUGIN_LDFLAGS: flags to be used for all plugins
643
644 dnl GST_OPTION_CFLAGS
645 if test "x$USE_DEBUG" = xyes; then
646    PROFILE_CFLAGS="-g"
647 fi
648 AC_SUBST([PROFILE_CFLAGS])
649
650 if test "x$GST_GIT" = "xyes"; then
651   DEPRECATED_CFLAGS="-DGST_DISABLE_DEPRECATED"
652 else
653   DEPRECATED_CFLAGS=""
654 fi
655 AC_SUBST([DEPRECATED_CFLAGS])
656
657 dnl disable strict aliasing
658 AS_COMPILER_FLAG([-fno-strict-aliasing], [EXTRA_CFLAGS="-fno-strict-aliasing"])
659 AC_SUBST(EXTRA_CFLAGS)
660
661 dnl every flag in GST_OPTION_CFLAGS and GST_OPTION_CXXFLAGS can be overridden
662 dnl at make time with e.g. make ERROR_CFLAGS=""
663 GST_OPTION_CFLAGS="\$(WARNING_CFLAGS) \$(ERROR_CFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(DEPRECATED_CFLAGS)"
664 AC_SUBST([GST_OPTION_CFLAGS])
665
666 dnl FIXME: do we want to rename to GST_ALL_* ?
667 dnl prefer internal headers to already installed ones
668 dnl also add builddir include for enumtypes and marshal
669 dnl add GST_OPTION_CFLAGS, but overridable
670 GST_CFLAGS="$GST_CFLAGS -DGST_USE_UNSTABLE_API"
671 GST_CFLAGS="$GST_CFLAGS $EXTRA_CFLAGS $GLIB_EXTRA_CFLAGS \$(GST_OPTION_CFLAGS)"
672 AC_SUBST([GST_CFLAGS])
673
674 dnl LDFLAGS really should only contain flags, not libs - they get added before
675 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
676 GST_ALL_LDFLAGS="-no-undefined"
677 if test "x${enable_Bsymbolic}" = "xyes"; then
678   GST_ALL_LDFLAGS="$GST_ALL_LDFLAGS -Wl,-Bsymbolic-functions"
679 fi
680 AC_SUBST([GST_ALL_LDFLAGS])
681
682 dnl GST_LIB_LDFLAGS
683 dnl linker flags shared by all libraries
684 dnl LDFLAGS modifier defining exported symbols from built libraries
685 dnl (export _gst_foo but not __gst_foo)
686 GST_LIB_LDFLAGS="-export-symbols-regex ^_?\(gst_\|Gst\|GST_\).*"
687 AC_SUBST([GST_LIB_LDFLAGS])
688
689 dnl this really should only contain flags, not libs - they get added before
690 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
691 GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^[_]*gst_plugin_.*' $GST_ALL_LDFLAGS"
692 AC_SUBST([GST_PLUGIN_LDFLAGS])
693
694 dnl ---------------------------------------------------------------------------
695 dnl -- Generate files and summary                                            --
696 dnl ---------------------------------------------------------------------------
697
698 case ":$USE_X11:$USE_GLX:$USE_EGL:$USE_WAYLAND:$USE_DRM:" in
699 *:1:*) ;;
700 *) AC_MSG_ERROR([No renderer is enabled]) ;;
701 esac
702
703 AC_DEFINE_UNQUOTED([USE_ENCODERS], [$USE_ENCODERS],
704   [Defined to 1 if video encoders are used])
705 AM_CONDITIONAL([USE_ENCODERS], [test $USE_ENCODERS -eq 1])
706
707 AC_DEFINE_UNQUOTED([USE_VP9_ENCODER], [$USE_VP9_ENCODER],
708   [Defined to 1 if VP9 encoder is used])
709 AM_CONDITIONAL([USE_VP9_ENCODER], [test $USE_VP9_ENCODER -eq 1])
710
711 AC_DEFINE_UNQUOTED([USE_H264_FEI_ENCODER], [$USE_H264_FEI_ENCODER],
712   [Defined to 1 if H264_FEI encoder is used])
713 AM_CONDITIONAL([USE_H264_FEI_ENCODER], [test $USE_H264_FEI_ENCODER -eq 1])
714
715 AC_DEFINE_UNQUOTED([USE_DRM], [$USE_DRM],
716   [Defined to 1 if DRM is enabled])
717 AM_CONDITIONAL([USE_DRM], [test $USE_DRM -eq 1])
718
719 AC_DEFINE_UNQUOTED([USE_X11], [$USE_X11],
720   [Defined to 1 if X11 is enabled])
721 AM_CONDITIONAL([USE_X11], [test $USE_X11 -eq 1])
722
723 AC_DEFINE_UNQUOTED([USE_GLX], [$USE_GLX],
724   [Defined to 1 if GLX is enabled])
725 AM_CONDITIONAL([USE_GLX], [test $USE_GLX -eq 1])
726
727 AC_DEFINE_UNQUOTED([USE_EGL], [$USE_EGL],
728   [Defined to 1 if EGL is enabled])
729 AM_CONDITIONAL([USE_EGL], [test $USE_EGL -eq 1])
730
731 AC_DEFINE_UNQUOTED([USE_GLES_VERSION_MASK], [$GLES_VERSION_MASK],
732   [Defined to the set of enabled OpenGL ES APIs])
733
734 AC_DEFINE_UNQUOTED([USE_WAYLAND], [$USE_WAYLAND],
735   [Defined to 1 if WAYLAND is enabled])
736 AM_CONDITIONAL([USE_WAYLAND], [test $USE_WAYLAND -eq 1])
737
738 dnl @TODO hack for egl's dynamic module loading. remove it!
739 AC_DEFINE_UNQUOTED([GST_VAAPI_MAJOR_VERSION_S], ["0"],
740   [Defined to the string representation of gstreamer-vaapi major version])
741
742 AC_CONFIG_FILES([
743     Makefile
744     common/Makefile
745     common/m4/Makefile
746     m4/Makefile
747     docs/Makefile
748     docs/version.entities
749     docs/plugins/Makefile
750     docs/plugins/gstreamer-vaapi-plugins-docs.xml
751     gst-libs/Makefile
752     gst-libs/gst/Makefile
753     gst-libs/gst/vaapi/Makefile
754     gst/Makefile
755     gst/vaapi/Makefile
756     tests/Makefile
757     tests/elements/Makefile
758 ])
759 AC_OUTPUT
760
761 dnl Print summary
762 yesno() {
763   test $1 -eq 1 && echo yes || echo no
764 }
765
766 VIDEO_OUTPUTS=""
767 AS_IF([test $USE_DRM -eq 1], [VIDEO_OUTPUTS="$VIDEO_OUTPUTS drm"])
768 AS_IF([test $USE_X11 -eq 1], [VIDEO_OUTPUTS="$VIDEO_OUTPUTS x11"])
769 AS_IF([test $USE_GLX -eq 1], [VIDEO_OUTPUTS="$VIDEO_OUTPUTS glx"])
770 AS_IF([test $USE_EGL -eq 1], [VIDEO_OUTPUTS="$VIDEO_OUTPUTS egl"])
771 AS_IF([test $USE_WAYLAND -eq 1], [VIDEO_OUTPUTS="$VIDEO_OUTPUTS wayland"])
772
773 echo
774 echo $PACKAGE configuration summary:
775 echo
776 echo Installation Prefix .............. : ${prefix}
777 echo GStreamer API version ............ : $GST_VERSION
778 echo VA-API version ................... : $VA_VERSION_STR
779 echo Video encoding ................... : $(yesno $USE_ENCODERS)
780 echo Video outputs .................... : $VIDEO_OUTPUTS
781 echo