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