assrender: render the subtitles with the proper aspect
[platform/upstream/gstreamer.git] / configure.ac
1 AC_PREREQ([2.69])
2
3 dnl initialize autoconf
4 dnl when going to/from release please set the nano (fourth number) right !
5 dnl releases only do Wall, git and prerelease does Werror too
6 AC_INIT([GStreamer Bad Plug-ins],[1.7.0.1],[http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer],[gst-plugins-bad])
7
8 AG_GST_INIT
9
10 dnl initialize automake
11 AM_INIT_AUTOMAKE([-Wno-portability 1.14 no-dist-gzip dist-xz tar-ustar subdir-objects])
12
13 dnl define PACKAGE_VERSION_* variables
14 AS_VERSION
15
16 dnl check if this is a release version
17 AS_NANO(GST_GIT="no", GST_GIT="yes")
18
19 dnl can autoconf find the source ?
20 AC_CONFIG_SRCDIR([docs/plugins/gst-plugins-bad-plugins-docs.sgml])
21
22 dnl define the output header for config
23 AC_CONFIG_HEADERS([config.h])
24
25 dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
26 AM_MAINTAINER_MODE([enable])
27
28 dnl sets host_* variables
29 AC_CANONICAL_HOST
30
31 dnl use pretty build output with automake >= 1.11
32 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],
33   [AM_DEFAULT_VERBOSITY=1
34    AC_SUBST(AM_DEFAULT_VERBOSITY)])
35
36 dnl PKG_CONFIG_SYSROOT_DIR is a valid environment variable
37 m4_pattern_allow(PKG_CONFIG_SYSROOT_DIR)
38
39 dnl our libraries and install dirs use GST_API_VERSION in the filename
40 dnl to allow side-by-side installation of different API versions
41 GST_API_VERSION=1.0
42 AC_SUBST(GST_API_VERSION)
43 AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION",
44   [GStreamer API Version])
45
46 AG_GST_LIBTOOL_PREPARE
47
48 dnl CURRENT, REVISION, AGE
49 dnl - library source changed -> increment REVISION
50 dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
51 dnl - interfaces added -> increment AGE
52 dnl - interfaces removed -> AGE = 0
53 dnl sets GST_LT_LDFLAGS
54 AS_LIBTOOL(GST, 700, 0, 700)
55
56 dnl *** required versions of GStreamer stuff ***
57 GST_REQ=1.7.0.1
58 GSTPB_REQ=1.7.0.1
59
60 dnl *** autotools stuff ****
61
62 dnl allow for different autotools
63 AS_AUTOTOOLS_ALTERNATE
64
65 dnl Add parameters for aclocal
66 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I common/m4")
67
68 dnl set up gettext
69 dnl the version check needs to stay here because autopoint greps for it
70 AM_GNU_GETTEXT_VERSION([0.17])
71 AM_GNU_GETTEXT([external])
72 AG_GST_GETTEXT([gst-plugins-bad-$GST_API_VERSION])
73
74 dnl *** check for arguments to configure ***
75
76 AG_GST_ARG_DISABLE_FATAL_WARNINGS
77
78 AG_GST_ARG_DEBUG
79 AG_GST_ARG_PROFILING
80 AG_GST_ARG_VALGRIND
81 AG_GST_ARG_GCOV
82
83 AG_GST_ARG_EXAMPLES
84
85 AG_GST_ARG_WITH_PKG_CONFIG_PATH
86 AG_GST_ARG_WITH_PACKAGE_NAME
87 AG_GST_ARG_WITH_PACKAGE_ORIGIN
88
89 AG_GST_ARG_WITH_PLUGINS
90
91 AG_GST_ARG_ENABLE_EXTERNAL
92
93 AG_GST_ARG_ENABLE_EXPERIMENTAL
94
95 AG_GST_PKG_CONFIG_PATH
96
97 dnl *** checks for platform ***
98 AG_GST_PLATFORM
99
100 dnl * hardware/architecture *
101
102 dnl common/m4/gst-arch.m4
103 dnl check CPU type
104 AG_GST_ARCH
105
106 dnl Determine endianness
107 AC_C_BIGENDIAN
108
109 dnl *** checks for programs ***
110
111 dnl find a compiler
112 AC_PROG_CC
113 AC_PROG_CC_STDC
114
115 dnl determine c++ compiler
116 AC_PROG_CXX
117 dnl determine if c++ is available on this system
118 AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
119
120 AC_PROG_OBJC
121
122 dnl check if the compiler supports '-c' and '-o' options
123 AM_PROG_CC_C_O
124
125 dnl check if the compiler supports do while(0) macros
126 AG_GST_CHECK_DOWHILE_MACROS
127
128 AC_PATH_PROG(VALGRIND_PATH, valgrind, no)
129 AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")
130
131 dnl check for gobject-introspection
132 GOBJECT_INTROSPECTION_CHECK([1.31.1])
133
134 dnl check for documentation tools
135 GTK_DOC_CHECK([1.12])
136 AG_GST_PLUGIN_DOCS([1.12])
137
138 dnl *** checks for libraries ***
139
140 dnl check for libm, for sin() etc.
141 LT_LIB_M
142 AC_SUBST(LIBM)
143
144 AC_FUNC_MMAP
145
146 dnl check for pthreads
147 AX_PTHREAD
148
149 dnl *** checks for header files ***
150
151 AC_CHECK_HEADERS([unistd.h], HAVE_UNISTD_H=yes)
152 AM_CONDITIONAL(HAVE_UNISTD_H, test "x$HAVE_UNISTD_H" = "xyes")
153
154 if test "x$HAVE_UNISTD_H" != "xyes"; then
155   GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | $SED -e s/festival//`
156 fi
157
158 AC_CHECK_HEADERS([sys/time.h])
159
160 dnl used by ext/dts
161 AX_CREATE_STDINT_H
162
163 AC_CHECK_HEADERS([pthread.h], HAVE_PTHREAD_H=yes)
164 AM_CONDITIONAL(HAVE_PTHREAD_H, test "x$HAVE_PTHREAD_H" = "xyes")
165
166 if test "x$HAVE_PTHREAD_H" != "xyes"; then
167   GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | $SED -e s/dccp//`
168 fi
169
170 dnl *** checks for types/defines ***
171
172 dnl Check for FIONREAD ioctl declaration
173 dnl used in gst/dccp
174 GST_CHECK_FIONREAD
175
176 dnl *** checks for structures ***
177
178 dnl *** checks for compiler characteristics ***
179
180 dnl *** checks for library functions ***
181 AC_CHECK_FUNCS([gmtime_r])
182
183 dnl *** checks for headers ***
184 AC_CHECK_HEADERS([sys/utsname.h])
185
186 dnl *** checks for dependency libraries ***
187
188 dnl *** checks for socket and nsl libraries ***
189 AC_CHECK_FUNC(socket,,[AC_CHECK_LIB(socket,socket)])
190 AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
191
192 dnl GLib is required
193 GLIB_REQ=2.32.0
194 AG_GST_GLIB_CHECK([$GLIB_REQ])
195
196 dnl checks for gstreamer
197 dnl uninstalled is selected preferentially -- see pkg-config(1)
198 AG_GST_CHECK_GST($GST_API_VERSION, [$GST_REQ], yes)
199 AG_GST_CHECK_GST_BASE($GST_API_VERSION, [$GST_REQ], yes)
200 AG_GST_CHECK_GST_CHECK($GST_API_VERSION, [$GST_REQ], no)
201 AG_GST_CHECK_GST_CONTROLLER($GST_API_VERSION, [$GST_REQ], yes)
202 AM_CONDITIONAL(HAVE_GST_CHECK, test "x$HAVE_GST_CHECK" = "xyes")
203
204 AG_GST_CHECK_GST_PLUGINS_BASE($GST_API_VERSION, [$GSTPB_REQ], yes)
205
206 dnl check for uninstalled plugin directories for unit tests
207 AG_GST_CHECK_UNINSTALLED_SETUP([
208   AG_GST_CHECK_GST_PLUGINS_GOOD($GST_API_VERSION, [0.11.0])
209   AG_GST_CHECK_GST_PLUGINS_UGLY($GST_API_VERSION, [0.11.0])
210   AG_GST_CHECK_GST_PLUGINS_LIBAV($GST_API_VERSION, [0.11.0])
211 ])
212
213 dnl Check for documentation xrefs
214 GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
215 GST_PREFIX="`$PKG_CONFIG --variable=prefix gstreamer-$GST_API_VERSION`"
216 GSTPB_PREFIX="`$PKG_CONFIG --variable=prefix gstreamer-plugins-base-$GST_API_VERSION`"
217 AC_SUBST(GLIB_PREFIX)
218 AC_SUBST(GST_PREFIX)
219 AC_SUBST(GSTPB_PREFIX)
220
221 dnl GTK is optional and used in examples
222 HAVE_GTK=NO
223 GTK2_REQ=2.14.0
224 GTK3_REQ=2.91.3
225 if test "x$BUILD_EXAMPLES" = "xyes"; then
226   AC_MSG_CHECKING([which gtk+ version to compile examples against (optional)])
227   AC_ARG_WITH([gtk],
228     AS_HELP_STRING([--with-gtk=3.0|2.0],[which gtk+ version to compile against (default: 2.0)]),
229     [case "$with_gtk" in
230         2.0) GTK_REQ=$GTK2_REQ ;;
231         3.0) GTK_REQ=$GTK3_REQ ;;
232         *) AC_MSG_ERROR([invalid gtk+ version specified]);;
233     esac],
234     [with_gtk=2.0
235      GTK_REQ=$GTK2_REQ])
236   AC_MSG_RESULT([$with_gtk (>= $GTK_REQ)])
237   PKG_CHECK_MODULES(GTK, gtk+-x11-$with_gtk >= $GTK_REQ, HAVE_GTK=yes, HAVE_GTK=no)
238   AC_SUBST(GTK_LIBS)
239   AC_SUBST(GTK_CFLAGS)
240 fi
241 AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
242
243
244 dnl GTK is optional and used in examples
245 HAVE_GTK3=NO
246 if test "x$BUILD_EXAMPLES" = "xyes"; then
247   PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.4, HAVE_GTK3=yes, HAVE_GTK3=no)
248   if test "x$HAVE_GTK3" = "xyes"; then
249     HAVE_GTK=yes
250     GTK_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`
251     AC_SUBST(GTK_VERSION)
252     GTK_PREFIX=`$PKG_CONFIG --variable=prefix gdk-pixbuf-2.0`
253     AC_SUBST(GTK_BASE_DIR)
254   fi
255 fi
256 AC_SUBST(GTK3_LIBS)
257 AC_SUBST(GTK3_CFLAGS)
258 AC_SUBST(HAVE_GTK3)
259 AM_CONDITIONAL(HAVE_GTK3, test "x$HAVE_GTK3" = "xyes")
260
261 dnl clutter is optional and used in examples
262 HAVE_CLUTTER=no
263 HAVE_CLUTTER_X11=no
264 HAVE_CLUTTER_GLX=no
265 if test "x$BUILD_EXAMPLES" = "xyes"; then
266   PKG_CHECK_MODULES(CLUTTER, clutter-1.0 >= 1.8, HAVE_CLUTTER=yes, HAVE_CLUTTER=no)
267   AC_SUBST(CLUTTER_LIBS)
268   AC_SUBST(CLUTTER_CFLAGS)
269   AC_SUBST(HAVE_CLUTTER)
270
271   PKG_CHECK_MODULES(CLUTTER_GLX, clutter-glx-1.0 >= 1.8, HAVE_CLUTTER_GLX=yes, HAVE_CLUTTER_GLX=no)
272   AC_SUBST(CLUTTER_GLX_LIBS)
273   AC_SUBST(CLUTTER_GLX_CFLAGS)
274   AC_SUBST(HAVE_CLUTTER_GLX)
275
276   PKG_CHECK_MODULES(CLUTTER_X11, clutter-x11-1.0 >= 1.8, HAVE_CLUTTER_X11=yes, HAVE_CLUTTER_X11=no)
277   AC_SUBST(CLUTTER_X11_LIBS)
278   AC_SUBST(CLUTTER_X11_CFLAGS)
279   AC_SUBST(HAVE_CLUTTER_X11)
280 fi
281 AM_CONDITIONAL(HAVE_CLUTTER, test "x$HAVE_CLUTTER" = "xyes")
282 AM_CONDITIONAL(HAVE_CLUTTER_GLX, test "x$HAVE_CLUTTER_GLX" = "xyes")
283 AM_CONDITIONAL(HAVE_CLUTTER_X11, test "x$HAVE_CLUTTER_X11" = "xyes")
284
285 dnl used in the gl/clutteractor example
286 if test "x$BUILD_EXAMPLES" = "xyes"; then
287   PKG_CHECK_MODULES(XCOMPOSITE, xcomposite, HAVE_XCOMPOSITE=yes, HAVE_XCOMPOSITE=no)
288   AC_SUBST(XCOMPOSITE_CFLAGS)
289   AC_SUBST(XCOMPOSITE_LIBS)
290 fi
291 AM_CONDITIONAL(HAVE_XCOMPOSITE, test "x$HAVE_XCOMPOSITE" = "xyes")
292
293 dnl graphene-1.0 is optional and used in gltransformation
294 HAVE_GRAPHENE=NO
295 PKG_CHECK_MODULES(GRAPHENE, graphene-1.0 >= 1.0.0, HAVE_GRAPHENE=yes, HAVE_GRAPHENE=no)
296 if test "x$HAVE_GRAPHENE" = "xyes"; then
297   AC_DEFINE(HAVE_GRAPHENE, [1] , [Use graphene])
298 fi
299 AC_SUBST(HAVE_GRAPHENE)
300 AC_SUBST(GRAPHENE_LIBS)
301 AC_SUBST(GRAPHENE_CFLAGS)
302 AM_CONDITIONAL(HAVE_GRAPHENE, test "x$HAVE_GRAPHENE" = "xyes")
303
304
305 dnl sdl is optional and used in examples
306 HAVE_SDL=NO
307 if test "x$BUILD_EXAMPLES" = "xyes"; then
308   PKG_CHECK_MODULES(SDL, sdl >= 1.2.0, HAVE_SDL=yes, HAVE_SDL=no)
309   AC_SUBST(SDL_LIBS)
310   AC_SUBST(SDL_CFLAGS)
311   AC_SUBST(SDL_CLUTTER)
312 fi
313 AM_CONDITIONAL(HAVE_SDL, test "x$HAVE_SDL" = "xyes")
314
315
316 dnl Needed for GtkBuilder to autoconnect signals
317 PKG_CHECK_MODULES(GMODULE_EXPORT, gmodule-export-2.0, HAVE_GMODULE_EXPORT=yes, HAVE_GMODULE_EXPORT=no)
318
319 dnl Needed by plugins that use g_module_*() API
320 PKG_CHECK_MODULES(GMODULE_NO_EXPORT, gmodule-no-export-2.0)
321
322 dnl x11 is optional for librfb
323 HAVE_X11=NO
324 PKG_CHECK_MODULES(X11, x11, HAVE_X11=yes, HAVE_X11=no)
325 AC_SUBST(X11_LIBS)
326 AC_SUBST(X11_CFLAGS)
327 AC_SUBST(HAVE_X11)
328 AM_CONDITIONAL(HAVE_X11, test "x$HAVE_X11" = "xyes")
329 if test "x$HAVE_X11" = "xyes"; then
330   AC_DEFINE(HAVE_X11, 1, [Define if you have X11 library])
331 fi
332
333 dnl exif (used on jifmux tests) ****
334 PKG_CHECK_MODULES(EXIF, libexif >= 0.6.16, HAVE_EXIF="yes", HAVE_EXIF="no")
335 AC_SUBST(EXIF_LIBS)
336 AC_SUBST(EXIF_CFLAGS)
337 AM_CONDITIONAL(USE_EXIF, test "x$HAVE_EXIF" = "xyes")
338
339 dnl Orc
340 ORC_CHECK([0.4.17])
341
342 dnl set license and copyright notice
343 GST_LICENSE="LGPL"
344 AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer license])
345 AC_SUBST(GST_LICENSE)
346
347 dnl define LIBDIR so we can inform people where we live
348 AS_AC_EXPAND(LIBDIR, $libdir)
349 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [library dir])
350
351 dnl set location of plugin directory
352 AG_GST_SET_PLUGINDIR
353
354 dnl set release date/time
355 AG_GST_SET_PACKAGE_RELEASE_DATETIME_WITH_NANO([$PACKAGE_VERSION_NANO],
356   ["${srcdir}/gst-plugins-bad.doap"],
357   [$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_MICRO])
358
359 dnl build static plugins or not
360 AC_MSG_CHECKING([whether to build static plugins or not])
361 AC_ARG_ENABLE(
362   static-plugins,
363   AC_HELP_STRING(
364     [--enable-static-plugins],
365     [build static plugins @<:@default=no@:>@]),
366   [AS_CASE(
367     [$enableval], [no], [], [yes], [],
368     [AC_MSG_ERROR([bad value "$enableval" for --enable-static-plugins])])],
369   [enable_static_plugins=no])
370 AC_MSG_RESULT([$enable_static_plugins])
371 if test "x$enable_static_plugins" = xyes; then
372   AC_DEFINE(GST_PLUGIN_BUILD_STATIC, 1,
373     [Define if static plugins should be built])
374   GST_PLUGIN_LIBTOOLFLAGS=""
375 else
376   GST_PLUGIN_LIBTOOLFLAGS="--tag=disable-static"
377 fi
378 AC_SUBST(GST_PLUGIN_LIBTOOLFLAGS)
379 AM_CONDITIONAL(GST_PLUGIN_BUILD_STATIC, test "x$enable_static_plugins" = "xyes")
380
381 # set by AG_GST_PARSE_SUBSYSTEM_DISABLES above
382 dnl make sure it doesn't complain about unused variables if debugging is disabled
383 NO_WARNINGS=""
384 AG_GST_CHECK_GST_DEBUG_DISABLED([NO_WARNINGS="-Wno-unused"], [NO_WARNINGS=""])
385
386 dnl define an ERROR_CFLAGS Makefile variable
387 dnl -Waggregate-return - libexif returns aggregates
388 dnl -Wundef - Windows headers check _MSC_VER unconditionally
389 AG_GST_SET_ERROR_CFLAGS($FATAL_WARNINGS, [
390     -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls
391     -Wwrite-strings -Wformat-security -Wold-style-definition
392     -Winit-self -Wmissing-include-dirs -Waddress -Wno-multichar
393     -Wnested-externs $NO_WARNINGS])
394
395 dnl define an ERROR_CXXFLAGS Makefile variable
396 AG_GST_SET_ERROR_CXXFLAGS($FATAL_WARNINGS, [
397     -Wmissing-declarations -Wredundant-decls
398     -Wwrite-strings -Wformat-nonliteral -Wformat-security
399     -Winit-self -Wmissing-include-dirs -Waddress -Wno-multichar $NO_WARNINGS])
400
401 dnl define an ERROR_OBJCFLAGS Makefile variable
402 AG_GST_SET_ERROR_OBJCFLAGS($FATAL_WARNINGS, [
403     -Wmissing-declarations -Wredundant-decls
404     -Wwrite-strings -Wformat-nonliteral -Wformat-security
405     -Winit-self -Wmissing-include-dirs -Wno-multichar $NO_WARNINGS])
406
407 dnl define correct level for debugging messages
408 AG_GST_SET_LEVEL_DEFAULT($GST_GIT)
409
410 dnl used in examples
411 AG_GST_DEFAULT_ELEMENTS
412
413 dnl *** plug-ins to include ***
414 dnl Non ported plugins (non-dependant, then dependant)
415 dnl Make sure you have a space before and after all plugins
416 GST_PLUGINS_NONPORTED=" cdxaparse \
417  dccp faceoverlay \
418  hdvparse \
419  mve nuvdemux \
420  patchdetect \
421  sdi tta \
422  videomeasure \
423  linsys \
424  apexsink dc1394 \
425  gsettings \
426  musepack nas sdl timidity \
427  acm wininet \
428  xvid lv2 teletextdec sndio libvisual"
429 AC_SUBST(GST_PLUGINS_NONPORTED)
430
431 dnl these are all the gst plug-ins, compilable without additional libs
432 AG_GST_CHECK_PLUGIN(accurip)
433 AG_GST_CHECK_PLUGIN(adpcmdec)
434 AG_GST_CHECK_PLUGIN(adpcmenc)
435 AG_GST_CHECK_PLUGIN(aiff)
436 AG_GST_CHECK_PLUGIN(asfmux)
437 AG_GST_CHECK_PLUGIN(audiofxbad)
438 AG_GST_CHECK_PLUGIN(audiomixer)
439 AG_GST_CHECK_PLUGIN(compositor)
440 AG_GST_CHECK_PLUGIN(audiovisualizers)
441 AG_GST_CHECK_PLUGIN(autoconvert)
442 AG_GST_CHECK_PLUGIN(bayer)
443 AG_GST_CHECK_PLUGIN(camerabin2)
444 AG_GST_CHECK_PLUGIN(cdxaparse)
445 AG_GST_CHECK_PLUGIN(coloreffects)
446 AG_GST_CHECK_PLUGIN(dataurisrc)
447 AG_GST_CHECK_PLUGIN(dccp)
448 AG_GST_CHECK_PLUGIN(debugutils)
449 AG_GST_CHECK_PLUGIN(dvbsuboverlay)
450 AG_GST_CHECK_PLUGIN(dvdspu)
451 AG_GST_CHECK_PLUGIN(faceoverlay)
452 AG_GST_CHECK_PLUGIN(festival)
453 AG_GST_CHECK_PLUGIN(fieldanalysis)
454 AG_GST_CHECK_PLUGIN(freeverb)
455 AG_GST_CHECK_PLUGIN(frei0r)
456 AG_GST_CHECK_PLUGIN(gaudieffects)
457 AG_GST_CHECK_PLUGIN(geometrictransform)
458 AG_GST_CHECK_PLUGIN(gdp)
459 AG_GST_CHECK_PLUGIN(hdvparse)
460 AG_GST_CHECK_PLUGIN(id3tag)
461 AG_GST_CHECK_PLUGIN(inter)
462 AG_GST_CHECK_PLUGIN(interlace)
463 AG_GST_CHECK_PLUGIN(ivfparse)
464 AG_GST_CHECK_PLUGIN(ivtc)
465 AG_GST_CHECK_PLUGIN(jp2kdecimator)
466 AG_GST_CHECK_PLUGIN(jpegformat)
467 AG_GST_CHECK_PLUGIN(librfb)
468 AG_GST_CHECK_PLUGIN(liveadder)
469 AG_GST_CHECK_PLUGIN(midi)
470 AG_GST_CHECK_PLUGIN(mpegdemux)
471 AG_GST_CHECK_PLUGIN(mpegtsdemux)
472 AG_GST_CHECK_PLUGIN(mpegtsmux)
473 AG_GST_CHECK_PLUGIN(mpegpsmux)
474 AG_GST_CHECK_PLUGIN(mve)
475 AG_GST_CHECK_PLUGIN(mxf)
476 AG_GST_CHECK_PLUGIN(nuvdemux)
477 AG_GST_CHECK_PLUGIN(onvif)
478 AG_GST_CHECK_PLUGIN(patchdetect)
479 AG_GST_CHECK_PLUGIN(pcapparse)
480 AG_GST_CHECK_PLUGIN(pnm)
481 AG_GST_CHECK_PLUGIN(rawparse)
482 AG_GST_CHECK_PLUGIN(removesilence)
483 AG_GST_CHECK_PLUGIN(rtp)
484 AG_GST_CHECK_PLUGIN(sdi)
485 AG_GST_CHECK_PLUGIN(sdp)
486 AG_GST_CHECK_PLUGIN(segmentclip)
487 AG_GST_CHECK_PLUGIN(siren)
488 AG_GST_CHECK_PLUGIN(smooth)
489 AG_GST_CHECK_PLUGIN(speed)
490 AG_GST_CHECK_PLUGIN(subenc)
491 AG_GST_CHECK_PLUGIN(stereo)
492 AG_GST_CHECK_PLUGIN(tta)
493 AG_GST_CHECK_PLUGIN(videofilters)
494 AG_GST_CHECK_PLUGIN(videomeasure)
495 AG_GST_CHECK_PLUGIN(videoparsers)
496 AG_GST_CHECK_PLUGIN(videosignal)
497 AG_GST_CHECK_PLUGIN(vmnc)
498 AG_GST_CHECK_PLUGIN(y4m)
499 AG_GST_CHECK_PLUGIN(yadif)
500
501 dnl *** plug-ins to exclude ***
502
503 AC_CHECK_HEADER(AVFoundation/AVFoundation.h, HAVE_AVFOUNDATION="yes", HAVE_AVFOUNDATION="no", [-])
504 AC_CHECK_HEADER(MobileCoreServices/MobileCoreServices.h, HAVE_IOS="yes", HAVE_IOS="no", [-])
505 AC_CHECK_HEADER(VideoToolbox/VideoToolbox.h, HAVE_VIDEOTOOLBOX="yes", HAVE_VIDEOTOOLBOX="no", [-])
506
507 if test "x$HAVE_VIDEOTOOLBOX" = "xyes"; then
508   old_LIBS=$LIBS
509   LIBS="$LIBS -framework VideoToolbox"
510   AC_CHECK_FUNC(VTCompressionSessionPrepareToEncodeFrames, [
511     AC_DEFINE(HAVE_VIDEOTOOLBOX_10_9_6, 1, [Define if building with VideoToolbox >= 10.9.6])
512   ], [
513   ])
514   LIBS=$old_LIBS
515 fi
516
517 AM_CONDITIONAL(HAVE_AVFOUNDATION, test "x$HAVE_AVFOUNDATION" = "xyes")
518 if test "x$HAVE_AVFOUNDATION" = "xyes"; then
519   AC_DEFINE(HAVE_AVFOUNDATION, 1, [Define if building with AVFoundation])
520 fi
521
522 AM_CONDITIONAL(HAVE_IOS, test "x$HAVE_IOS" = "xyes")
523 if test "x$HAVE_IOS" = "xyes"; then
524   AC_DEFINE(HAVE_IOS, 1, [Define if building for Apple iOS])
525 fi
526
527 AM_CONDITIONAL(HAVE_VIDEOTOOLBOX, test "x$HAVE_VIDEOTOOLBOX" = "xyes")
528 if test "x$HAVE_VIDEOTOOLBOX" = "xyes"; then
529   AC_DEFINE(HAVE_VIDEOTOOLBOX, 1, [Define if building with VideoToolbox])
530 fi
531
532 dnl disable gst plugins we might not be able to build on this
533 dnl platform: (ugly but minimally invasive)
534 dnl FIXME: maybe move to sys, or make work with winsock2
535 AC_CHECK_HEADERS([sys/socket.h], HAVE_SYS_SOCKET_H=yes)
536 AC_CHECK_HEADERS([winsock2.h], HAVE_WINSOCK2_H=yes)
537
538 if test "x$HAVE_WINSOCK2_H" = "xyes"; then
539   WINSOCK2_LIBS="-lws2_32"
540   AC_SUBST(WINSOCK2_LIBS)
541 fi
542
543 if test "x$HAVE_PTHREAD_H" = "xyes"; then
544   DCCP_LIBS="$DCCP_LIBS $PTHREAD_LIBS"
545   AC_SUBST(DCCP_LIBS)
546 else
547   AG_GST_DISABLE_PLUGIN(dccp)
548 fi
549
550 dnl *** opengl ***
551 AC_ARG_ENABLE([opengl],
552      [  --enable-opengl         Enable Desktop OpenGL support @<:@default=auto@:>@],
553      [case "${enableval}" in
554        yes)  NEED_GL=yes ;;
555        no)   NEED_GL=no ;;
556        auto) NEED_GL=auto ;;
557        *) AC_MSG_ERROR([bad value ${enableval} for --enable-opengl]) ;;
558      esac],[NEED_GL=auto])
559
560 AC_ARG_WITH([opengl-module-name],
561   AS_HELP_STRING([--with-opengl-module-name],[library module name for OpenGL (default: libGL)]))
562 if test x$with_opengl_module_name != x; then
563   AC_DEFINE_UNQUOTED(GST_GL_LIBGL_MODULE_NAME, "$with_opengl_module_name", [OpenGL module name])
564 fi
565
566 AC_ARG_ENABLE([gles2],
567      [  --enable-gles2          Enable OpenGL|ES 2.0 support @<:@default=auto@:>@],
568      [case "${enableval}" in
569        yes)  NEED_GLES2=yes ;;
570        no)   NEED_GLES2=no ;;
571        auto) NEED_GLES2=auto ;;
572        *) AC_MSG_ERROR([bad value ${enableval} for --enable-gles2]) ;;
573      esac],[NEED_GLES2=auto])
574
575 AC_ARG_WITH([gles2-module-name],
576   AS_HELP_STRING([--with-gles2-module-name],[library module name for GLES2 (default: libGLESv2)]))
577 if test x$with_gles2_module_name != x; then
578   AC_DEFINE_UNQUOTED(GST_GL_LIBGLESV2_MODULE_NAME, "$with_gles2_module_name", [GLES2 module name])
579 fi
580
581 AC_ARG_ENABLE([egl],
582      [  --enable-egl            Enable EGL support @<:@default=auto@:>@],
583      [case "${enableval}" in
584        yes)  NEED_EGL=yes ;;
585        no)   NEED_EGL=no ;;
586        auto) NEED_EGL=auto ;;
587        *) AC_MSG_ERROR([bad value ${enableval} for --enable-egl]) ;;
588      esac],[NEED_EGL=auto])
589
590 AC_ARG_WITH([egl-module-name],
591   AS_HELP_STRING([--with-egl-module-name],[library module name for EGL (default: libEGL)]))
592 if test x$with_egl_module_name != x; then
593   AC_DEFINE_UNQUOTED(GST_GL_LIBEGL_MODULE_NAME, "$with_egl_module_name", [EGL module name])
594 fi
595
596 AC_ARG_ENABLE([wgl],
597      [  --enable-wgl            Enable WGL support @<:@default=auto@:>@],
598      [case "${enableval}" in
599        yes)  NEED_WGL=yes ;;
600        no)   NEED_WGL=no ;;
601        auto) NEED_WGL=auto ;;
602        *) AC_MSG_ERROR([bad value ${enableval} for --enable-wgl]) ;;
603      esac],[NEED_WGL=auto])
604
605 AC_ARG_ENABLE([glx],
606      [  --enable-glx            Enable GLX support @<:@default=auto@:>@],
607      [case "${enableval}" in
608        yes)  NEED_GLX=yes ;;
609        no)   NEED_GLX=no ;;
610        auto) NEED_GLX=auto ;;
611        *) AC_MSG_ERROR([bad value ${enableval} for --enable-glx]) ;;
612      esac],[NEED_GLX=auto])
613
614 AC_ARG_ENABLE([cocoa],
615      [  --enable-cocoa          Enable Cocoa support @<:@default=auto@:>@],
616      [case "${enableval}" in
617        yes)  NEED_COCOA=yes ;;
618        no)   NEED_COCOA=no ;;
619        auto) NEED_COCOA=auto ;;
620        *) AC_MSG_ERROR([bad value ${enableval} for --enable-cocoa]) ;;
621      esac],[NEED_COCOA=auto])
622
623 AC_ARG_ENABLE([x11],
624      [  --enable-x11            Enable x11 support @<:@default=auto@:>@],
625      [case "${enableval}" in
626        yes)  NEED_X11=yes ;;
627        no)   NEED_X11=no ;;
628        auto) NEED_X11=auto ;;
629        *) AC_MSG_ERROR([bad value ${enableval} for --enable-x11]) ;;
630      esac],[NEED_X11=auto])
631
632 AC_ARG_ENABLE([wayland],
633      [  --enable-wayland        Enable Wayland support (requires EGL) @<:@default=auto@:>@],
634      [case "${enableval}" in
635        yes)  NEED_WAYLAND_EGL=yes ;;
636        no)   NEED_WAYLAND_EGL=no ;;
637        auto) NEED_WAYLAND_EGL=auto ;;
638        *) AC_MSG_ERROR([bad value ${enableval} for --enable-wayland]) ;;
639      esac],[NEED_WAYLAND_EGL=auto])
640
641 AC_ARG_ENABLE([dispmanx],
642      [  --enable-dispmanx        Enable Dispmanx support (requires EGL) @<:@default=auto@:>@],
643      [case "${enableval}" in
644        yes)  NEED_DISPMANX=yes ;;
645        no)   NEED_DISPMANX=no ;;
646        auto) NEED_DISPMANX=auto ;;
647        *) AC_MSG_ERROR([bad value ${enableval} for --enable-dispmanx]) ;;
648      esac],[NEED_DISPMANX=auto])
649
650 AG_GST_PKG_CHECK_MODULES(X, x11)
651 save_CPPFLAGS="$CPPFLAGS"
652 save_LIBS="$LIBS"
653
654 HAVE_GL=no
655 HAVE_GLES2=no
656 HAVE_WAYLAND_EGL=no
657
658 HAVE_EGL_RPI=no
659
660 case $host in
661   *-mingw32* )
662     LIBS="$LIBS -lgdi32"
663     AG_GST_CHECK_LIBHEADER(GL, opengl32, glTexImage2D,, GL/gl.h)
664     AC_CHECK_HEADER(GL/wglext.h, HAVE_WGLEXT="yes", HAVE_WGLEXT="no", [#include <GL/gl.h>])
665     if test "x$HAVE_WGLEXT" = "xyes"; then
666       HAVE_WGL=yes
667       HAVE_GL=yes
668     fi
669   ;;
670   *)
671     if test "x$NEED_GL" != "xno"; then
672       AG_GST_CHECK_LIBHEADER(GL, GL, glTexImage2D,, GL/gl.h)
673     fi
674     if test "x$NEED_GLES2" != "xno"; then
675       AG_GST_CHECK_LIBHEADER(GLES2, GLESv2, glTexImage2D,, GLES2/gl2.h)
676     fi
677     if test "x$NEED_EGL" != "xno"; then
678       AG_GST_CHECK_LIBHEADER(EGL, EGL, eglGetError,, EGL/egl.h)
679     fi
680
681     old_LIBS=$LIBS
682     old_CFLAGS=$CFLAGS
683
684     dnl FIXME: Mali EGL depends on GLESv1 or GLESv2
685     AC_CHECK_HEADER([EGL/fbdev_window.h],
686       [
687         LIBS="$LIBS -lUMP"
688         AC_CHECK_LIB([Mali], [mali_image_create],
689           [
690             LIBS="$LIBS -lMali"
691             AC_CHECK_LIB([GLESv2], [glEnable],
692               [
693                 AC_CHECK_HEADER([GLES2/gl2.h],
694                   [
695                     AC_CHECK_LIB([EGL], [eglGetProcAddress],
696                       [
697                         AC_CHECK_HEADER([EGL/egl.h],
698                           [
699                             HAVE_EGL=yes
700                             HAVE_GLES2=yes
701                             EGL_LIBS="-lMali -lUMP"
702                             EGL_CFLAGS=""
703                             AC_DEFINE(USE_EGL_MALI_FB, [1], [Use Mali FB EGL platform])
704                           ])
705                       ])
706                   ])
707               ])
708           ])
709       ])
710
711     dnl FIXME: EGL of RPi depends on GLESv1 or GLESv2
712     dnl FIXME: GLESv2 of RPi depends on EGL... WTF!
713     LIBS="$LIBS -lvcos -lvchiq_arm"
714     AC_CHECK_LIB([bcm_host], [bcm_host_init],
715       [
716         LIBS="$LIBS -lbcm_host"
717         AC_CHECK_HEADER(bcm_host.h,
718           [
719             LIBS="$LIBS -lGLESv2"
720             AC_CHECK_LIB([EGL], [eglGetProcAddress],
721               [
722                 LIBS="$LIBS -lEGL"
723                 AC_CHECK_HEADER([EGL/egl.h],
724                   [
725                     AC_CHECK_LIB([GLESv2], [glEnable],
726                       [
727                         AC_CHECK_HEADER([GLES2/gl2.h],
728                           [
729                             HAVE_EGL=yes
730                             HAVE_GLES2=yes
731                             HAVE_EGL_RPI=yes
732                             EGL_LIBS="-lbcm_host -lvcos -lvchiq_arm"
733                             EGL_CFLAGS=""
734                             AC_DEFINE(USE_EGL_RPI, [1], [Use RPi platform])
735                           ])
736                       ])
737                   ])
738               ])
739           ])
740       ])
741
742     LIBS=$old_LIBS
743     CFLAGS=$old_CFLAGS
744
745     PKG_CHECK_MODULES(WAYLAND_EGL, wayland-client >= 1.0 wayland-cursor >= 1.0 wayland-egl >= 9.0, HAVE_WAYLAND_EGL=yes, HAVE_WAYLAND_EGL=no)
746   ;;
747 esac
748
749 CPPFLAGS="$save_CPPFLAGS"
750 LIBS="$save_LIBS"
751
752 USE_OPENGL=no
753 USE_GLES2=no
754 USE_GLX=no
755 USE_COCOA=no
756 USE_WGL=no
757 USE_X11=no
758 USE_EAGL=no
759 GL_LIBS=
760 GL_CFLAGS=
761 GL_OBJCFLAGS=
762
763 dnl Check for what the user asked for and what we could find
764 if test "x$HAVE_EGL" = "xno"; then
765   if test "x$NEED_EGL" = "xyes"; then
766     AC_MSG_ERROR([Could not find the required EGL libraries])
767   fi
768 fi
769
770 if test "x$HAVE_GL" = "xno"; then
771   if test "x$NEED_GL" = "xyes"; then
772     AC_MSG_ERROR([Could not find the required OpenGL libraries])
773   fi
774 fi
775
776 if test "x$HAVE_GLES2" = "xno"; then
777   if test "x$NEED_GLES2" = "xyes"; then
778     AC_MSG_ERROR([Could not find the required OpenGL|ES 2.0 libraries])
779   fi
780 fi
781
782 dnl X, GLX and OpenGL
783 if test "x$HAVE_X" = "xno"; then
784   if test "x$NEED_GLX" = "xyes"; then
785     AC_MSG_ERROR([Building the GLX backend without X11 is unsupported])
786   fi
787   if test "x$NEED_X11" = "xyes"; then
788     AC_MSG_ERROR([Could not find X11 development libraries])
789   fi
790 else
791   if test "x$NEED_GL" != "xno"; then
792     if test "x$HAVE_GL" = "xno"; then
793       if test "x$NEED_GLX" = "xyes"; then
794         AC_MSG_ERROR([Building the GLX backend without the OpenGL backend is unsupported])
795       fi
796     else dnl HAVE_GL=yes
797       USE_OPENGL=yes
798       if test "x$NEED_GLX" != "xno"; then
799         USE_GLX=yes
800       fi
801     fi
802   fi
803 fi
804
805 dnl check if we can include both GL and GLES2 at the same time
806 if test "x$HAVE_GL" = "xyes" -a "x$HAVE_GLES2" = "xyes"; then
807   GL_INCLUDES="
808 #ifndef GL_GLEXT_PROTOTYPES
809 #define GL_GLEXT_PROTOTYPES 1
810 #endif
811 # ifdef HAVE_IOS
812 #  include <OpenGLES/ES2/gl.h>
813 #  include <OpenGLES/ES2/glext.h>
814 # else
815 #  include <GLES2/gl2.h>
816 #  include <GLES2/gl2ext.h>
817 # endif
818 # ifdef __APPLE__
819 #  include <OpenGL/OpenGL.h>
820 #  include <OpenGL/gl.h>
821 #  if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
822 #   define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
823 #   include <OpenGL/gl3.h>
824 #  endif
825 # else
826 #  include <GL/gl.h>
827 #  if __WIN32__ || _WIN32
828 #   include <GL/glext.h>
829 #  endif
830 # endif
831 "
832   AC_MSG_CHECKING([whether it is possible to include both GL and GLES2 headers])
833   save_CPPFLAGS="$CPPFLAGS"
834   CPPFLAGS="$CPPFLAGS $ERROR_CFLAGS"
835   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$GL_INCLUDES]], [[
836     #if !defined(GL_FALSE)
837     #error Failed to include GL headers
838     #endif
839     ]])],[ AC_MSG_RESULT(yes)
840     ],[AC_MSG_RESULT(no)
841     if test "x$NEED_GLES2" = "xyes"; then
842       if test "x$NEED_GL" = "xyes"; then
843         AC_MSG_ERROR([Cannot seem to include both GL and GLES2 headers. Try disabling one API])
844       fi
845       AC_MSG_WARN([Disabling Desktop GL support])
846       HAVE_GL=no
847       USE_OPENGL=no
848     else
849       AC_MSG_WARN([Disabling GL|ES 2.0 support])
850       HAVE_GLES2=no
851     fi
852   ])
853   CPPFLAGS="$save_CPPFLAGS"
854 fi
855
856 #dnl Check for OpenGL
857 echo host is $host
858 case $host in
859   *-android*)
860     if test "x$NEED_WGL" = "xyes"; then
861       AC_MSG_ERROR([WGL is not available on Android])
862     fi
863     if test "x$NEED_GLX" = "xyes"; then
864       AC_MSG_ERROR([GLX is not available on Android])
865     fi
866     if test "x$NEED_GL" = "xyes"; then
867       AC_MSG_ERROR([GL is not available on Android])
868     fi
869     if test "x$NEED_X11" = "xyes"; then
870       AC_MSG_ERROR([X11 is not available on Android])
871     fi
872     if test "x$NEED_COCOA" = "xyes"; then
873       AC_MSG_ERROR([Cocoa is not available on Android])
874     fi
875
876     dnl OpenGL|ES 2.0
877     if test "x$HAVE_GLES2" = "xyes"; then
878       if test "x$NEED_GLES2" != "xno"; then
879         GL_LIBS="$GL_LIBS -lGLESv2"
880         USE_GLES2=yes
881       fi
882     fi
883
884     dnl EGL
885     if test "x$HAVE_EGL" = "xyes"; then
886       if test "x$NEED_EGL" != "xno"; then
887         GL_LIBS="$GL_LIBS -lEGL"
888         USE_EGL=yes
889       fi
890     fi
891
892     if test "x$USE_EGL" != "xyes"; then
893       AC_MSG_ERROR([Need EGL on Android])
894     fi
895
896     if test "x$USE_GLES2" != "xyes"; then
897       AC_MSG_ERROR([Need OpenGL|ES 2.0 on Android])
898     fi
899
900     HAVE_WINDOW_ANDROID=yes
901     ;;
902   *-linux* | *-cygwin* | *-solaris* | *-netbsd* | *-freebsd* | *-openbsd* | *-kfreebsd* | *-dragonflybsd* | *-gnu* )
903     if test "x$NEED_WGL" = "xyes"; then
904       AC_MSG_ERROR([WGL is not available on unix])
905     fi
906
907     if test "x$HAVE_X" = "xno"; then
908       if test "x$HAVE_WAYLAND_EGL" = "xno"; then
909         AC_MSG_WARN([X or Wayland is required for OpenGL support])
910       fi
911     fi
912
913     dnl check Desktop OpenGL
914     if test "x$HAVE_GL" = "xyes"; then
915       if test "x$NEED_GL" != "xno"; then
916         GL_LIBS="$GL_LIBS -lGL"
917       fi
918     fi
919
920     dnl OpenGL|ES 2.0
921     if test "x$HAVE_GLES2" = "xyes"; then
922       if test "x$NEED_GLES2" != "xno"; then
923         GL_LIBS="$GL_LIBS -lGLESv2"
924         USE_GLES2=yes
925       fi
926     fi
927
928     if test "x$HAVE_X" = "xyes" -a "x$HAVE_EGL_RPI" = "xno"; then
929       if test "x$NEED_X11" != "xno"; then
930         GL_LIBS="$GL_LIBS $X_LIBS"
931         GL_CFLAGS="$GL_CFLAGS $X_CFLAGS"
932         HAVE_WINDOW_X11=yes
933       fi
934     fi
935
936     if test "x$HAVE_WAYLAND_EGL" = "xyes"; then
937       if test "x$NEED_EGL" = "xno" -o "x$HAVE_EGL" = "xno"; then
938         AC_MSG_WARN([EGL is required by the Wayland backend for OpenGL support])
939       else
940         if test "x$NEED_WAYLAND_EGL" != "xno"; then
941           HAVE_WINDOW_WAYLAND=yes
942           GL_LIBS="$GL_LIBS $WAYLAND_EGL_LIBS"
943           GL_CFLAGS="$GL_CFLAGS $WAYLAND_EGL_CFLAGS"
944         fi
945       fi
946     fi
947
948     if test "x$HAVE_EGL_RPI" = "xyes"; then
949       if test "x$NEED_DISPMANX" != "xno"; then
950         HAVE_WINDOW_DISPMANX=yes
951         USE_EGL=yes
952       fi
953     fi
954
955     dnl EGL
956     if test "x$HAVE_EGL" = "xno"; then
957       if test "x$HAVE_GL" = "xno"; then
958         AC_MSG_WARN([Building requires either EGL or GLX for OpenGL support])
959       fi
960     else
961       if test "x$NEED_EGL" != "xno"; then
962         if test "x$HAVE_WINDOW_WAYLAND" = "xyes" -o "x$HAVE_WINDOW_X11" = "xyes" -o "x$HAVE_WINDOW_DISPMANX" = "xyes"; then
963           GL_LIBS="$GL_LIBS -lEGL $EGL_LIBS"
964           GL_CFLAGS="$GL_CFLAGS $EGL_CFLAGS"
965           USE_EGL=yes
966         fi
967       fi
968     fi
969     ;;
970   *-darwin*)
971     if test "x$HAVE_IOS" = "xyes"; then
972       if test "x$NEED_WGL" = "xyes"; then
973         AC_MSG_ERROR([WGL is not available on iOS])
974       fi
975       if test "x$NEED_GLX" = "xyes"; then
976         AC_MSG_ERROR([GLX is not available on iOS])
977       fi
978       if test "x$NEED_GL" = "xyes"; then
979         AC_MSG_ERROR([GL is not available on iOS])
980       fi
981       if test "x$NEED_X11" = "xyes"; then
982         AC_MSG_ERROR([X11 is not available on iOS])
983       fi
984       if test "x$NEED_COCOA" = "xyes"; then
985         AC_MSG_ERROR([Cocoa is not available on iOS])
986       fi
987       if test "x$NEED_EGL" = "xyes"; then
988         AC_MSG_ERROR([EGL is not available on iOS])
989       fi
990
991       GL_LIBS="$LIBS -framework OpenGLES -framework QuartzCore -framework UIKit -framework CoreGraphics -framework CoreFoundation -framework Foundation"
992       GL_CFLAGS="$GL_CFLAGS"
993       USE_GLES2=yes
994       USE_EAGL=yes
995       HAVE_WINDOW_EAGL=yes
996
997       ac_cv_type_GLsizeiptr=yes
998       ac_cv_type_GLintptr=yes
999       ac_cv_type_GLchar=yes
1000     else
1001       dnl Only osx supports cocoa.
1002       if test "x$NEED_WGL" = "xyes"; then
1003         AC_MSG_ERROR([WGL is not available on Mac OS X])
1004       fi
1005
1006       if test "x$NEED_COCOA" != "xno"; then
1007         GL_LIBS="$LIBS -framework OpenGL -framework Cocoa -framework QuartzCore -framework CoreFoundation"
1008         GL_CFLAGS="$GL_CFLAGS"
1009         USE_COCOA=yes
1010         HAVE_WINDOW_COCOA=yes
1011         USE_OPENGL=yes
1012       fi
1013
1014       if test "x$USE_GLX" = "xyes"; then
1015         if test "x$HAVE_X" = "xyes"; then
1016           if test "x$NEED_X11" != "xno"; then
1017             GL_LIBS="$GL_LIBS $X_LIBS"
1018             GL_CFLAGS="$GL_CFLAGS $X_CFLAGS"
1019             HAVE_WINDOW_X11=yes
1020           fi
1021         fi
1022
1023         if test "x$HAVE_GL" = "xyes"; then
1024           if test "x$NEED_GL" != "xno"; then
1025             GL_LIBS="$GL_LIBS -lGL"
1026           fi
1027           USE_OPENGL=yes
1028         fi
1029       fi
1030
1031       if test "x$HAVE_EGL" = "xyes"; then
1032         if test "x$NEED_EGL" != "xno"; then
1033           if test "x$HAVE_WINDOW_X11" = "xyes"; then
1034             GL_LIBS="$GL_LIBS -lEGL $EGL_LIBS"
1035             GL_CFLAGS="$GL_CFLAGS $EGL_CFLAGS"
1036             USE_EGL=yes
1037           fi
1038         fi
1039       fi
1040
1041       dnl OpenGL|ES 2.0
1042       if test "x$HAVE_GLES2" = "xyes"; then
1043         if test "x$NEED_GLES2" != "xno"; then
1044           GL_LIBS="$GL_LIBS -lGLESv2"
1045           USE_GLES2=yes
1046         fi
1047       fi
1048     fi
1049     ;;
1050   *-mingw32*)
1051     if test "x$NEED_GLX" = "xyes"; then
1052       AC_MSG_ERROR([GLX is not available on Windows])
1053     fi
1054     if test "x$NEED_GLES2" = "xyes"; then
1055       AC_MSG_ERROR([OpenGL|ES 2.0 is not supported on your platform yet])
1056     fi
1057
1058     if test "x$HAVE_GL" = "xyes"; then
1059       if test "x$NEED_GL" != "xno"; then
1060         if test "x$HAVE_WGL" = "xyes"; then
1061           if test "$NEED_WGL" != "xno"; then
1062             GL_LIBS="$GL_LIBS -lgdi32 -lopengl32"
1063             HAVE_WINDOW_WIN32=yes
1064             USE_OPENGL=yes
1065             USE_WGL=yes
1066           fi
1067         fi
1068       fi
1069     fi
1070     ;;
1071   *)
1072     AC_MSG_WARN([Don't know how to check for OpenGL on your platform.])
1073     ;;
1074 esac
1075
1076 GL_PLATFORMS=
1077 GL_WINDOWS=
1078 GL_APIS=
1079 GL_CONFIG_DEFINES=
1080
1081 dnl APIs
1082
1083 GST_GL_HAVE_OPENGL=0
1084 GST_GL_HAVE_GLES2=0
1085 GST_GL_HAVE_GLES3=0
1086
1087 if test "x$USE_OPENGL" = "xyes"; then
1088   GL_APIS="gl $GL_APIS"
1089   GST_GL_HAVE_OPENGL=1
1090 fi
1091 if test "x$USE_GLES2" = "xyes"; then
1092   GL_APIS="gles2 $GL_APIS"
1093   GST_GL_HAVE_GLES2=1
1094 fi
1095
1096 GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
1097 #define GST_GL_HAVE_OPENGL $GST_GL_HAVE_OPENGL
1098 #define GST_GL_HAVE_GLES2 $GST_GL_HAVE_GLES2
1099 #define GST_GL_HAVE_GLES3 $GST_GL_HAVE_GLES3
1100 "
1101
1102 dnl WINDOW's
1103
1104 GST_GL_HAVE_WINDOW_X11=0
1105 GST_GL_HAVE_WINDOW_COCOA=0
1106 GST_GL_HAVE_WINDOW_WIN32=0
1107 GST_GL_HAVE_WINDOW_WAYLAND=0
1108 GST_GL_HAVE_WINDOW_ANDROID=0
1109 GST_GL_HAVE_WINDOW_DISPMANX=0
1110 GST_GL_HAVE_WINDOW_EAGL=0
1111
1112 if test "x$HAVE_WINDOW_X11" = "xyes"; then
1113   GL_WINDOWS="x11 $GL_WINDOWS"
1114   GST_GL_HAVE_WINDOW_X11=1
1115 fi
1116 if test "x$HAVE_WINDOW_COCOA" = "xyes"; then
1117   GL_WINDOWS="cocoa $GL_WINDOWS"
1118   GST_GL_HAVE_WINDOW_COCOA=1
1119 fi
1120 if test "x$HAVE_WINDOW_WIN32" = "xyes"; then
1121   GL_WINDOWS="win32 $GL_WINDOWS"
1122   GST_GL_HAVE_WINDOW_WIN32=1
1123 fi
1124 if test "x$HAVE_WINDOW_WAYLAND" = "xyes"; then
1125   GL_WINDOWS="wayland $GL_WINDOWS"
1126   GST_GL_HAVE_WINDOW_WAYLAND=1
1127 fi
1128 if test "x$HAVE_WINDOW_ANDROID" = "xyes"; then
1129   GL_WINDOWS="android $GL_WINDOWS"
1130   GST_GL_HAVE_WINDOW_ANDROID=1
1131 fi
1132 if test "x$HAVE_WINDOW_DISPMANX" = "xyes"; then
1133   GL_WINDOWS="dispmanx $GL_WINDOWS"
1134   GST_GL_HAVE_WINDOW_DISPMANX=1
1135 fi
1136 if test "x$HAVE_WINDOW_EAGL" = "xyes"; then
1137   GL_WINDOWS="eagl $GL_WINDOWS"
1138   GST_GL_HAVE_WINDOW_EAGL=1
1139 fi
1140
1141 GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
1142 #define GST_GL_HAVE_WINDOW_X11 $GST_GL_HAVE_WINDOW_X11
1143 #define GST_GL_HAVE_WINDOW_COCOA $GST_GL_HAVE_WINDOW_COCOA
1144 #define GST_GL_HAVE_WINDOW_WIN32 $GST_GL_HAVE_WINDOW_WIN32
1145 #define GST_GL_HAVE_WINDOW_WAYLAND $GST_GL_HAVE_WINDOW_WAYLAND
1146 #define GST_GL_HAVE_WINDOW_ANDROID $GST_GL_HAVE_WINDOW_ANDROID
1147 #define GST_GL_HAVE_WINDOW_DISPMANX $GST_GL_HAVE_WINDOW_DISPMANX
1148 #define GST_GL_HAVE_WINDOW_EAGL $GST_GL_HAVE_WINDOW_EAGL
1149 "
1150
1151 dnl PLATFORM's
1152
1153 GST_GL_HAVE_PLATFORM_EGL=0
1154 GST_GL_HAVE_PLATFORM_GLX=0
1155 GST_GL_HAVE_PLATFORM_WGL=0
1156 GST_GL_HAVE_PLATFORM_CGL=0
1157 GST_GL_HAVE_PLATFORM_EAGL=0
1158
1159 if test "x$USE_EGL" = "xyes"; then
1160   GL_PLATFORMS="egl $GL_PLATFORMS"
1161   GST_GL_HAVE_PLATFORM_EGL=1
1162 fi
1163 if test "x$USE_GLX" = "xyes"; then
1164   GL_PLATFORMS="glx $GL_PLATFORMS"
1165   GST_GL_HAVE_PLATFORM_GLX=1
1166 fi
1167 if test "x$USE_WGL" = "xyes"; then
1168   GL_PLATFORMS="wgl $GL_PLATFORMS"
1169   GST_GL_HAVE_PLATFORM_WGL=1
1170 fi
1171 if test "x$USE_COCOA" = "xyes"; then
1172   GL_PLATFORMS="cgl $GL_PLATFORMS"
1173   GST_GL_HAVE_PLATFORM_CGL=1
1174 fi
1175 if test "x$USE_EAGL" = "xyes"; then
1176   GL_PLATFORMS="eagl $GL_PLATFORMS"
1177   GST_GL_HAVE_PLATFORM_EAGL=1
1178 fi
1179
1180 GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
1181 #define GST_GL_HAVE_PLATFORM_EGL $GST_GL_HAVE_PLATFORM_EGL
1182 #define GST_GL_HAVE_PLATFORM_GLX $GST_GL_HAVE_PLATFORM_GLX
1183 #define GST_GL_HAVE_PLATFORM_WGL $GST_GL_HAVE_PLATFORM_WGL
1184 #define GST_GL_HAVE_PLATFORM_CGL $GST_GL_HAVE_PLATFORM_CGL
1185 #define GST_GL_HAVE_PLATFORM_EAGL $GST_GL_HAVE_PLATFORM_EAGL
1186 "
1187
1188 dnl Check for no platforms/window systems
1189 if test "x$GL_APIS" = "x"; then
1190   AC_MSG_WARN([Either OpenGL or OpenGL|ES is required for OpenGL support])
1191 fi
1192 if test "x$GL_PLATFORMS" = "x"; then
1193   AC_MSG_WARN([Could not find any OpenGL platforms to use such as CGL, WGL or GLX])
1194 fi
1195 if test "x$GL_WINDOWS" = "x"; then
1196   AC_MSG_WARN([Could not find any window systems to use such as Cocoa, Win32API or X11])
1197 fi
1198
1199 if test "x$GL_APIS" = "x" -o "x$GL_PLATFORMS" = "x" -o "x$GL_WINDOWS" = "x"; then
1200   GL_LIBS=
1201   GL_CFLAGS=
1202   GL_OBJCFLAGS=
1203   USE_OPENGL=no
1204   USE_GLES2=no
1205   USE_GLX=no
1206   USE_EGL=no
1207   USE_WGL=no
1208   USE_COCOA=no
1209   USE_EGL_MALI=no
1210   USE_EGL_RPI=no
1211   USE_EAGL=no
1212
1213   HAVE_WINDOW_X11=no
1214   HAVE_WINDOW_WIN32=no
1215   HAVE_WINDOW_DISPMANX=no
1216   HAVE_WINDOW_WAYLAND=no
1217   HAVE_WINDOW_ANDROID=no
1218   HAVE_WINDOW_COCOA=no
1219   HAVE_WINDOW_EAGL=no
1220 fi
1221
1222 AC_SUBST(GL_LIBS)
1223 AC_SUBST(GL_CFLAGS)
1224 AC_SUBST(GL_OBJCFLAGS)
1225 AC_SUBST(USE_OPENGL)
1226 AC_SUBST(USE_GLES2)
1227
1228 AM_CONDITIONAL(HAVE_WINDOW_X11, test "x$HAVE_WINDOW_X11" = "xyes")
1229 AM_CONDITIONAL(HAVE_WINDOW_COCOA, test "x$HAVE_WINDOW_COCOA" = "xyes")
1230 AM_CONDITIONAL(HAVE_WINDOW_WIN32, test "x$HAVE_WINDOW_WIN32" = "xyes")
1231 AM_CONDITIONAL(HAVE_WINDOW_DISPMANX, test "x$HAVE_WINDOW_DISPMANX" = "xyes")
1232 AM_CONDITIONAL(HAVE_WINDOW_WAYLAND, test "x$HAVE_WINDOW_WAYLAND" = "xyes")
1233 AM_CONDITIONAL(HAVE_WINDOW_ANDROID, test "x$HAVE_WINDOW_ANDROID" = "xyes")
1234 AM_CONDITIONAL(HAVE_WINDOW_EAGL, test "x$HAVE_WINDOW_EAGL" = "xyes")
1235
1236 AM_CONDITIONAL(USE_OPENGL, test "x$USE_OPENGL" = "xyes")
1237 AM_CONDITIONAL(USE_GLES2, test "x$USE_GLES2" = "xyes")
1238 AM_CONDITIONAL(USE_GLX, test "x$USE_GLX" = "xyes")
1239 AM_CONDITIONAL(USE_EGL, test "x$USE_EGL" = "xyes")
1240 AM_CONDITIONAL(USE_WGL, test "x$USE_WGL" = "xyes")
1241 AM_CONDITIONAL(USE_COCOA, test "x$USE_COCOA" = "xyes")
1242 AM_CONDITIONAL(USE_EGL_MALI, test "x$USE_EGL_MALI" = "xyes")
1243 AM_CONDITIONAL(USE_EGL_RPI, test "x$USE_EGL_RPI" = "xyes")
1244 AM_CONDITIONAL(USE_EAGL, test "x$USE_EAGL" = "xyes")
1245
1246 AM_CONDITIONAL(HAVE_GST_GL, test "x$USE_OPENGL" = "xyes" -o "x$USE_GLES2" = "xyes")
1247
1248 dnl Check for some types that are not always present
1249 GL_INCLUDES=""
1250 if test "x$USE_GLES2" = "xyes"; then
1251   GL_INCLUDES="$GL_INCLUDES
1252 #ifndef GL_GLEXT_PROTOTYPES
1253 #define GL_GLEXT_PROTOTYPES 1
1254 #endif
1255 # ifdef HAVE_IOS
1256 #  include <OpenGLES/ES2/gl.h>
1257 #  include <OpenGLES/ES2/glext.h>
1258 # else
1259 #  include <GLES2/gl2.h>
1260 #  include <GLES2/gl2ext.h>
1261 # endif
1262 "
1263 fi
1264
1265 if test "x$USE_OPENGL" = "xyes"; then
1266   GL_INCLUDES="$GL_INCLUDES
1267 # ifdef __APPLE__
1268 #  include <OpenGL/OpenGL.h>
1269 #  include <OpenGL/gl.h>
1270 # else
1271 #  include <GL/gl.h>
1272 #  if __WIN32__ || _WIN32
1273 #   include <GL/glext.h>
1274 #  endif
1275 # endif
1276 "
1277 fi
1278
1279 GST_GL_HAVE_GLEGLIMAGEOES=0
1280 GST_GL_HAVE_GLCHAR=0
1281 GST_GL_HAVE_GLSIZEIPTR=0
1282 GST_GL_HAVE_GLINTPTR=0
1283 GST_GL_HAVE_GLSYNC=0
1284 GST_GL_HAVE_GLUINT64=0
1285
1286 old_CFLAGS=$CFLAGS
1287 CFLAGS="$GL_CFLAGS $CFLAGS"
1288
1289 AC_CHECK_TYPES(GLeglImageOES, [], [], [[$GL_INCLUDES]])
1290 if test "x$ac_cv_type_GLeglImageOES" = "xyes"; then
1291   GST_GL_HAVE_GLEGLIMAGEOES=1
1292 fi
1293
1294 AC_CHECK_TYPES(GLchar, [], [], [[$GL_INCLUDES]])
1295 if test "x$ac_cv_type_GLchar" = "xyes"; then
1296   GST_GL_HAVE_GLCHAR=1
1297 fi
1298
1299 AC_CHECK_TYPES(GLsizeiptr, [], [], [[$GL_INCLUDES]])
1300 if test "x$ac_cv_type_GLsizeiptr" = "xyes"; then
1301   GST_GL_HAVE_GLSIZEIPTR=1
1302 fi
1303
1304 AC_CHECK_TYPES(GLintptr, [], [], [[$GL_INCLUDES]])
1305 if test "x$ac_cv_type_GLintptr" = "xyes"; then
1306   GST_GL_HAVE_GLINTPTR=1
1307 fi
1308
1309 AC_CHECK_TYPES(GLsync, [], [], [[$GL_INCLUDES]])
1310 if test "x$ac_cv_type_GLsync" = "xyes"; then
1311   GST_GL_HAVE_GLSYNC=1
1312 fi
1313
1314 AC_CHECK_TYPES(GLuint64, [], [], [[$GL_INCLUDES]])
1315 if test "x$ac_cv_type_GLuint64" = "xyes"; then
1316   GST_GL_HAVE_GLUINT64=1
1317 fi
1318
1319 CFLAGS=$old_CFLAGS
1320
1321 GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
1322 #define GST_GL_HAVE_GLEGLIMAGEOES $GST_GL_HAVE_GLEGLIMAGEOES
1323 #define GST_GL_HAVE_GLCHAR $GST_GL_HAVE_GLCHAR
1324 #define GST_GL_HAVE_GLSIZEIPTR $GST_GL_HAVE_GLSIZEIPTR
1325 #define GST_GL_HAVE_GLINTPTR $GST_GL_HAVE_GLINTPTR
1326 #define GST_GL_HAVE_GLSYNC $GST_GL_HAVE_GLSYNC
1327 #define GST_GL_HAVE_GLUINT64 $GST_GL_HAVE_GLUINT64
1328 "
1329
1330 AC_CONFIG_COMMANDS([gst-libs/gst/gl/gstglconfig.h], [
1331         outfile=gstglconfig.h-tmp
1332         cat > $outfile <<\_______EOF
1333 /* gstglconfig.h
1334  *
1335  * This is a generated file.  Please modify `configure.ac'
1336  */
1337
1338 #ifndef __GST_GL_CONFIG_H__
1339 #define __GST_GL_CONFIG_H__
1340
1341 #include <gst/gst.h>
1342
1343 G_BEGIN_DECLS
1344
1345 _______EOF
1346
1347         cat >>$outfile <<_______EOF
1348 $gl_config_defines
1349 _______EOF
1350
1351         cat >>$outfile <<_______EOF
1352
1353 G_END_DECLS
1354
1355 #endif  /* __GST_GL_CONFIG_H__ */
1356 _______EOF
1357
1358
1359         if cmp -s $outfile gst-libs/gst/gl/gstglconfig.h; then
1360           AC_MSG_NOTICE([gst-libs/gst/gl/gstglconfig.h is unchanged])
1361           rm -f $outfile
1362         else
1363           mv $outfile gst-libs/gst/gl/gstglconfig.h
1364         fi
1365 ],[
1366 gl_config_defines='$GL_CONFIG_DEFINES'
1367 ])
1368
1369 dnl libpng is optional
1370 PKG_CHECK_MODULES(LIBPNG, libpng >= 1.0, HAVE_PNG=yes, HAVE_PNG=no)
1371 if test "x$HAVE_PNG" = "xyes"; then
1372   AC_DEFINE(HAVE_PNG, [1] , [Use libpng])
1373 fi
1374 AC_SUBST(HAVE_PNG)
1375 AC_SUBST(LIBPNG_LIBS)
1376 AC_SUBST(LIBPNG_CFLAGS)
1377 AM_CONDITIONAL(HAVE_PNG, test "x$HAVE_PNG" = "xyes")
1378
1379 dnl libjpeg is optional
1380 AC_ARG_WITH(jpeg-mmx, [  --with-jpeg-mmx, path to MMX'ified JPEG library])
1381 OLD_LIBS="$LIBS"
1382 if test x$with_jpeg_mmx != x; then
1383   LIBS="$LIBS -L$with_jpeg_mmx"
1384 fi
1385 AC_CHECK_LIB(jpeg-mmx, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
1386 JPEG_LIBS="$LIBS -ljpeg-mmx"
1387 LIBS="$OLD_LIBS"
1388 if test x$HAVE_JPEG != xyes; then
1389   JPEG_LIBS="-ljpeg"
1390   AC_CHECK_LIB(jpeg, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
1391 fi
1392
1393 if test x$HAVE_JPEG = xyes; then
1394   AC_DEFINE(HAVE_JPEG, [1], [Use libjpeg])
1395 else
1396   AC_DEFINE(HAVE_JPEG, [0], [Use libjpeg])
1397   JPEG_LIBS=
1398 fi
1399 AC_SUBST(JPEG_LIBS)
1400 AC_SUBST(HAVE_JPEG)
1401 AM_CONDITIONAL(HAVE_JPEG, test "x$HAVE_JPEG" = "xyes")
1402
1403
1404 dnl *** sys plug-ins ***
1405
1406 dnl DirectSound
1407 translit(dnm, m, l) AM_CONDITIONAL(USE_DIRECTSOUND, true)
1408 AG_GST_CHECK_FEATURE(DIRECTSOUND, [DirectSound], directsoundsrc, [
1409   HAVE_DIRECTSOUND="no"
1410   save_CFLAGS="$CFLAGS"
1411   save_LDFLAGS="$LDFLAGS"
1412   save_LIBS="$LIBS"
1413   CFLAGS="$CFLAGS $DIRECTX_CFLAGS"
1414   LDFLAGS="$LDFLAGS $DIRECTX_LDFLAGS"
1415   LIBS="$LIBS -lwinmm -ldsound -ldxerr9 -luser32"
1416   AC_MSG_CHECKING(for DirectSound LDFLAGS)
1417   AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1418 #include <windows.h>
1419 #include <dxerr9.h>
1420 #include <dsound.h>
1421 #include <mmsystem.h>
1422 ]], [[
1423   DXGetErrorString9 (0);
1424   DirectSoundCreate(NULL, NULL, NULL);
1425 ]])],
1426     [HAVE_DIRECTSOUND="yes"],
1427     [HAVE_DIRECTSOUND="no"])
1428   AC_MSG_RESULT($HAVE_DIRECTSOUND)
1429   CFLAGS=$save_CFLAGS
1430   LDFLAGS=$save_LDFLAGS
1431   LIBS=$save_LIBS
1432
1433   if test "x$HAVE_DIRECTSOUND" = "xyes";  then
1434     dnl this is much more than we want
1435     DIRECTSOUND_LIBS="-lwinmm -ldsound -ldxerr9 -luser32"
1436     AC_SUBST(DIRECTX_CFLAGS)
1437     AC_SUBST(DIRECTX_LDFLAGS)
1438     AC_SUBST(DIRECTSOUND_LIBS)
1439   fi
1440   AC_SUBST(HAVE_DIRECTSOUND)
1441 ])
1442
1443 dnl WASAPI
1444 translit(dnm, m, l) AM_CONDITIONAL(USE_WASAPI, true)
1445 AG_GST_CHECK_FEATURE(WASAPI, [WASAPI plug-in], wasapi, [
1446   HAVE_WASAPI="no"
1447   save_CFLAGS="$CFLAGS"
1448   save_LDFLAGS="$LDFLAGS"
1449   save_LIBS="$LIBS"
1450   CFLAGS="$CFLAGS $DIRECTX_CFLAGS"
1451   LDFLAGS="$LDFLAGS $DIRECTX_LDFLAGS"
1452   LIBS="$LIBS -lole32 -lwinmm -lksuser"
1453   AC_MSG_CHECKING(for WASAPI LDFLAGS)
1454   AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1455 #include <windows.h>
1456 #include <stdio.h>
1457 #include <mmsystem.h>
1458 #include <mmdeviceapi.h>
1459 ]], [[
1460 int main ()
1461 {
1462     HRESULT hr = S_OK;
1463
1464     hr = CoInitialize(NULL);
1465     if (FAILED(hr)) {
1466         printf("CoInitialize failed: hr = 0x%08x", hr);
1467         return __LINE__;
1468     }
1469
1470         int result = 0;
1471     // result = do_everything(argc, argv);
1472
1473     CoUninitialize();
1474     return result;
1475 }
1476 ]])],
1477     [HAVE_WASAPI="yes"],
1478     [HAVE_WASAPI="no"])
1479   AC_MSG_RESULT($HAVE_WASAPI)
1480   CFLAGS=$save_CFLAGS
1481   LDFLAGS=$save_LDFLAGS
1482   LIBS=$save_LIBS
1483
1484   if test "x$HAVE_WASAPI" = "xyes";  then
1485     WASAPI_LIBS="-lole32 -lwinmm -lksuser"
1486     AC_SUBST(WASAPI_LIBS)
1487   fi
1488   AC_SUBST(HAVE_WASAPI)
1489 ])
1490
1491 dnl Direct3D
1492 translit(dnm, m, l) AM_CONDITIONAL(USE_DIRECT3D, true)
1493 AG_GST_CHECK_FEATURE(DIRECT3D, [Direct3D plug-in], direct3dsink, [
1494   HAVE_DIRECT3D="no"
1495   save_CFLAGS="$CFLAGS"
1496   save_LDFLAGS="$LDFLAGS"
1497   save_LIBS="$LIBS"
1498   CFLAGS="$CFLAGS $DIRECTX_CFLAGS"
1499   LDFLAGS="$LDFLAGS $DIRECTX_LDFLAGS"
1500   LIBS="$LIBS -ld3d9 -lgdi32"
1501   AC_MSG_CHECKING(for Direct3D LDFLAGS)
1502   AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1503 #include <windows.h>
1504 #include <d3d9.h>
1505 ]], [[
1506   Direct3DCreate9(D3D_SDK_VERSION);
1507 ]])],
1508     [HAVE_DIRECT3D="yes"],
1509     [HAVE_DIRECT3D="no"])
1510   AC_MSG_RESULT($HAVE_DIRECT3D)
1511   CFLAGS=$save_CFLAGS
1512   LDFLAGS=$save_LDFLAGS
1513   LIBS=$save_LIBS
1514
1515   if test "x$HAVE_DIRECT3D" = "xyes";  then
1516     DIRECT3D_LIBS="-ld3d9 -lgdi32"
1517     AC_SUBST(DIRECT3D_LIBS)
1518   fi
1519   AC_SUBST(HAVE_DIRECT3D)
1520 ])
1521
1522 dnl winscreencap
1523 translit(dnm, m, l) AM_CONDITIONAL(USE_WINSCREENCAP, true)
1524 AG_GST_CHECK_FEATURE(WINSCREENCAP, [winscreencap plug-in], winscreencap, [
1525   HAVE_WINSCREENCAP="no"
1526   save_CFLAGS="$CFLAGS"
1527   save_LDFLAGS="$LDFLAGS"
1528   save_LIBS="$LIBS"
1529   CFLAGS="$CFLAGS $DIRECTX_CFLAGS"
1530   LDFLAGS="$LDFLAGS $DIRECTX_LDFLAGS"
1531   LIBS="$LIBS -ld3d9 -lgdi32"
1532   AC_MSG_CHECKING(for Direct3D LDFLAGS)
1533   AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1534 #include <windows.h>
1535 #include <d3d9.h>
1536 ]], [[
1537   Direct3DCreate9(D3D_SDK_VERSION);
1538 ]])],
1539     [HAVE_WINSCREENCAP="yes"],
1540     [HAVE_WINSCREENCAP="no"])
1541   AC_MSG_RESULT($HAVE_WINSCREENCAP)
1542   CFLAGS=$save_CFLAGS
1543   LDFLAGS=$save_LDFLAGS
1544   LIBS=$save_LIBS
1545
1546   if test "x$HAVE_WINSCREENCAP" = "xyes";  then
1547     WINSCREENCAP_LIBS="-ld3d9 -lgdi32"
1548     AC_SUBST(WINSCREENCAP_LIBS)
1549   fi
1550   AC_SUBST(HAVE_WINSCREENCAP)
1551 ])
1552
1553 dnl winks
1554 translit(dnm, m, l) AM_CONDITIONAL(USE_WINKS, true)
1555 AG_GST_CHECK_FEATURE(WINKS, [Winks plug-in], winks, [
1556   HAVE_WINKS="no"
1557   save_CFLAGS="$CFLAGS"
1558   save_LDFLAGS="$LDFLAGS"
1559   save_LIBS="$LIBS"
1560   CFLAGS="$CFLAGS $DIRECTX_CFLAGS"
1561   LDFLAGS="$LDFLAGS $DIRECTX_LDFLAGS"
1562   LIBS="$LIBS -lole32 -luuid -lstrmiids"
1563   AC_MSG_CHECKING(for Winks LDFLAGS)
1564   AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1565 #include <windows.h>
1566 #include <strmif.h>
1567 #include <uuids.h>
1568 ]], [[
1569 int main () {
1570   IGraphBuilder *pGraph = NULL;
1571   HRESULT hr = CoInitialize(NULL);
1572   hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
1573                         &IID_IGraphBuilder, (void **)&pGraph);
1574
1575   return 0;
1576 }
1577 ]])],
1578     [HAVE_WINKS="yes"],
1579     [HAVE_WINKS="no"])
1580   AC_MSG_RESULT($HAVE_WINKS)
1581   CFLAGS=$save_CFLAGS
1582   LDFLAGS=$save_LDFLAGS
1583   LIBS=$save_LIBS
1584
1585   if test "x$HAVE_WINKS" = "xyes";  then
1586     dnl this is much more than we want
1587     WINKS_LIBS="-ldxguid -lole32 -luuid -lstrmiids -lksuser -lsetupapi"
1588     AC_SUBST(DIRECTX_CFLAGS)
1589     AC_SUBST(DIRECTX_LDFLAGS)
1590     AC_SUBST(WINKS_LIBS)
1591   fi
1592   AC_SUBST(HAVE_WINKS)
1593 ])
1594
1595 dnl *** Android Media ***
1596 translit(dnm, m, l) AM_CONDITIONAL(USE_ANDROID_MEDIA, true)
1597 HAVE_ANDROID_MEDIA="no"
1598 AG_GST_CHECK_FEATURE(ANDROID_MEDIA, [Android Media], androidmedia, [
1599   case "$host" in
1600     *android*)
1601       AC_CHECK_HEADER(jni.h, HAVE_ANDROID_MEDIA="yes", HAVE_ANDROID_MEDIA="no")
1602       ;;
1603     *)
1604       HAVE_ANDROID_MEDIA="no"
1605       ;;
1606   esac
1607 ])
1608
1609 dnl *** AppleMedia (OS X and iOS) ***
1610 translit(dnm, m, l) AM_CONDITIONAL(USE_APPLE_MEDIA, true)
1611 HAVE_APPLE_MEDIA="no"
1612 dnl SystemConfiguration.h is common to OS X and iOS, so we check for that
1613 AG_GST_CHECK_FEATURE(APPLE_MEDIA, [Apple video], applemedia, [
1614   AC_CHECK_HEADER(SystemConfiguration/SystemConfiguration.h, HAVE_APPLE_MEDIA="yes", HAVE_APPLE_MEDIA="no")
1615   dnl OSX 10.7 and earlier lack VideoToolbox/VideoToolbox.h
1616   if test "x$HAVE_IOS" = "xno"; then
1617     AC_CHECK_HEADER(VideoToolbox/VideoToolbox.h,, HAVE_APPLE_MEDIA="no")
1618   fi
1619 ])
1620
1621 dnl in case header SystemConfiguration/SystemConfiguration.h is found on other platforms
1622 case "$host" in
1623   *-*darwin*)
1624     ;;
1625   *)
1626     HAVE_APPLE_MEDIA="no"
1627     ;;
1628 esac
1629
1630 dnl *** bluez ***
1631 translit(dnm, m, l) AM_CONDITIONAL(USE_BLUEZ, true)
1632 AG_GST_CHECK_FEATURE(BLUEZ, [Bluez], bluez, [
1633   PKG_CHECK_MODULES([BLUEZ5], [bluez >= 5.0], [
1634     PKG_CHECK_MODULES([GIO_UNIX], gio-unix-2.0 > 2.24, [
1635       AC_CHECK_PROG([GDBUS_CODEGEN],[gdbus-codegen],[gdbus-codegen])
1636       HAVE_BLUEZ=yes
1637       AC_DEFINE(HAVE_BLUEZ5,[1],[Bluez5 detected])
1638     ], [
1639       HAVE_BLUEZ=no
1640     ])
1641   ], [
1642     HAVE_BLUEZ=no
1643   ])
1644 ])
1645
1646 dnl *** OS/X AVCVideoServices ***
1647 translit(dnm, m, l) AM_CONDITIONAL(USE_AVC, true)
1648 HAVE_AVC="no"
1649 AG_GST_CHECK_FEATURE(AVC, [AVC Video Services], avcsrc, [
1650   AC_LANG_PUSH([C++])
1651   save_CPPFLAGS="$CPPFLAGS"
1652   CPPFLAGS="$CPPFLAGS -framework AVCVideoServices -framework CoreFoundation"
1653   save_LIBS="$LIBS"
1654   LIBS="$LIBS -framework AVCVideoServices -framework CoreFoundation"
1655   AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[HAVE_AVC=yes],[HAVE_AVC=no])
1656   LIBS=$save_LIBS
1657   CPPFLAGS=$save_CPPFLAGS
1658   AC_LANG_POP([C++])
1659 ])
1660 dnl in case header AVCVideoServices/AVCVideoServices.h is found on other platforms
1661 case "$host" in
1662   *-*darwin*)
1663     ;;
1664   *)
1665     HAVE_AVC="no"
1666     ;;
1667 esac
1668
1669 dnl check for shm_open (for shm plugin)
1670 translit(dnm, m, l) AM_CONDITIONAL(USE_SHM, true)
1671 AG_GST_CHECK_FEATURE(SHM, [POSIX shared memory source and sink], shm, [
1672     if test "x$HAVE_SYS_SOCKET_H" = "xyes"; then
1673         case $host in
1674         *-darwin* | *-macos10*)
1675             AC_DEFINE(HAVE_OSX,[1],[Apple Mac OS X operating system detected])
1676             HAVE_SHM=yes
1677             ;;
1678         *)
1679             AC_CHECK_LIB([rt], [shm_open],
1680                 AC_CHECK_DECL([MSG_NOSIGNAL], HAVE_SHM=yes, HAVE_SHM=no, [
1681                 #include <sys/socket.h>
1682                     ]),
1683                 HAVE_SHM=no)
1684             AC_SUBST(SHM_LIBS, "-lrt")
1685             ;;
1686         esac
1687     else
1688         HAVE_SHM=no
1689     fi
1690 ])
1691
1692 dnl check for Video CD
1693 translit(dnm, m, l) AM_CONDITIONAL(USE_VCD, true)
1694 AG_GST_CHECK_FEATURE(VCD, [Video CD], vcdsrc, [
1695   AC_CHECK_HEADER(linux/cdrom.h, HAVE_VCD="yes", HAVE_VCD="no")
1696 ])
1697
1698 dnl check for OpenSL ES
1699 translit(dnm, m, l) AM_CONDITIONAL(USE_OPENSLES, true)
1700 AG_GST_CHECK_FEATURE(OPENSLES, [OpenSL ES], opensl, [
1701   AC_CHECK_HEADER(SLES/OpenSLES.h, HAVE_OPENSLES="yes", HAVE_OPENSLES="no")
1702 ])
1703
1704 dnl *** UVC H264 ***
1705 translit(dnm, m, l) AM_CONDITIONAL(USE_UVCH264, true)
1706 AG_GST_CHECK_FEATURE(UVCH264, [UVC H264], uvch264, [
1707   AC_CHECK_HEADER(linux/uvcvideo.h, HAVE_UVCVIDEO_H=yes, HAVE_UVCVIDEO_H=no)
1708   PKG_CHECK_MODULES(G_UDEV, gudev-1.0 , [
1709           AC_DEFINE([HAVE_GUDEV], 1, [Define if gudev is installed])
1710           HAVE_GUDEV="yes" ],
1711           [HAVE_GUDEV="no"])
1712   PKG_CHECK_MODULES(LIBUSB, libusb-1.0 , [
1713           AC_DEFINE([HAVE_LIBUSB], 1, [Define if libusb 1.x is installed])
1714           HAVE_LIBUSB="yes" ],
1715           [HAVE_LIBUSB="no"])
1716   if test "x$HAVE_UVCVIDEO_H" = "xyes" && \
1717      test "x$HAVE_GUDEV" = "xyes" && \
1718      test "x$HAVE_LIBUSB" = "xyes"; then
1719     HAVE_UVCH264=yes
1720   else
1721     HAVE_UVCH264=no
1722   fi
1723 ])
1724 AC_SUBST(LIBUDEV_CFLAGS)
1725 AC_SUBST(LIBUDEV_LIBS)
1726 AC_SUBST(LIBUSB_CFLAGS)
1727 AC_SUBST(LIBUSB_LIBS)
1728
1729 dnl *** NVENC ***
1730 translit(dnm, m, l) AM_CONDITIONAL(USE_NVENC, true)
1731 AG_GST_CHECK_FEATURE(NVENC, [NVIDIA Encode API], nvenc, [
1732   AG_GST_PKG_CHECK_MODULES(GST_VIDEO, gstreamer-video-1.0)
1733   AG_GST_PKG_CHECK_MODULES(GST_PBUTILS, gstreamer-pbutils-1.0)
1734   AC_ARG_WITH([cuda-prefix],
1735           AS_HELP_STRING([--with-cuda-prefix],
1736           [Use the provided prefix for detecting the cuda installation]),
1737           [AS_IF([test "x$with_cuda_prefix" != "x"],
1738                  [CUDA_PREFIX="$with_cuda_prefix"])],
1739           [CUDA_PREFIX=""])
1740
1741   HAVE_CUDA="yes"
1742   if test "x$CUDA_PREFIX" != "x"; then
1743     dnl only override if not already set
1744     if test "x$CUDA_CFLAGS" = "x" -a "x$CUDA_LIBS" = "x"; then
1745       dnl this is an educated guess, user can always override these
1746       CUDA_CFLAGS="-I$CUDA_PREFIX/include"
1747       CUDA_LIBS="-L$CUDA_PREFIX/lib -L$CUDA_PREFIX/lib64 -L$CUDA_PREFIX/lib/stubs -L$CUDA_PREFIX/lib64/stubs -lcuda -lcudart"
1748     fi
1749   else
1750     PKG_CHECK_MODULES([CUDA], [cuda-7.5 cudart-7.5],, [
1751       PKG_CHECK_MODULES([CUDA], [cuda-7.0 cudart-7.0],, [
1752         PKG_CHECK_MODULES([CUDA], [cuda-6.5 cudart-6.5],, [
1753           AC_MSG_WARN([Could not find cuda headers/libraries])])])])
1754   fi
1755
1756   HAVE_CUDA_H=no
1757   HAVE_CUDART_H=no
1758   save_CPPFLAGS="$CPPFLAGS"
1759   CPPFLAGS="$CUDA_CFLAGS $save_CPPFLAGS "
1760   AC_CHECK_HEADER([cuda.h], [HAVE_CUDA_H=yes],
1761       AC_MSG_WARN([Could not find cuda.h]))
1762   AC_CHECK_HEADER([cuda_runtime_api.h], [HAVE_CUDART_H=yes],
1763       AC_MSG_WARN([Could not find cuda_runtime_api.h]))
1764   CPPFLAGS=$save_CPPFLAGS
1765
1766   dnl libcuda and libcudart libraries
1767   save_LIBS="$LIBS"
1768   LIBS="$CUDA_LIBS $save_LIBS"
1769   HAVE_CUDART_LIB="no"
1770   AC_CHECK_LIB(cudart,cudaGetErrorString,[HAVE_CUDART_LIB="yes"], [
1771       AC_MSG_WARN([Could not find cudart library])])
1772   HAVE_CUDA_LIB="no"
1773   AC_CHECK_LIB(cuda,cuInit,[HAVE_CUDA_LIB="yes"], [
1774       AC_MSG_WARN([Could not find cuda library])])
1775   LIBS="$save_LIBS"
1776
1777   dnl nvEncodeAPI.h header
1778   HAVE_NVENCODEAPI_H=no
1779   AC_ARG_VAR(NVENCODE_CFLAGS, [C compiler flags for NvEncodeAPI.h])
1780   save_CPPFLAGS="$CPPFLAGS"
1781   CPPFLAGS="$NVENCODE_CFLAGS $save_CPPFLAGS"
1782   AC_CHECK_HEADER([nvEncodeAPI.h], [
1783       AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <nvEncodeAPI.h>
1784           #if NVENCAPI_MAJOR_VERSION < 5
1785           #error "Need nvEncodeAPI.h >= 5.0"
1786           #endif
1787           ]])], [
1788           HAVE_NVENCODEAPI_H=yes
1789           ], [
1790           AC_MSG_WARN([nvEncodeAPI.h must be >= 5.0])
1791           ])
1792       ],
1793       AC_MSG_WARN([Could not find nvEncodeAPI.h]))
1794   AC_SUBST(NVENCODE_CFLAGS)
1795   CPPFLAGS="$save_CPPFLAGS"
1796
1797   dnl libnvnidia-encode library
1798   HAVE_NVENCODE_LIB=no
1799   AC_ARG_VAR(NVENCODE_LIBS, [linker flags for nvidia-encode])
1800   saved_LIBS="$LIBS"
1801   LIBS="$NVENCODE_LIBS $saved_LIBS"
1802   AC_CHECK_LIB(nvidia-encode, NvEncodeAPICreateInstance, [HAVE_NVENCODE_LIB="yes"],
1803       AC_MSG_WARN([Could not find library nvidia-encode]))
1804   NVENCODE_LIBS="$NVENCODE_LIBS -lnvidia-encode"
1805   AC_SUBST(NVENCODE_LIBS)
1806   LIBS="$saved_LIBS"
1807
1808   USE_NVENC_GST_GL=no
1809   if test "x$HAVE_CUDA_H" = "xyes" \
1810       -a "x$HAVE_CUDART_H" = "xyes" \
1811       -a "x$HAVE_CUDA_LIB" = "xyes" \
1812       -a "x$HAVE_CUDART_LIB" = "xyes" \
1813       -a "x$HAVE_NVENCODEAPI_H" = "xyes" \
1814       -a "x$HAVE_NVENCODE_LIB" = "xyes"; then
1815     HAVE_NVENC="yes"
1816     if test x"$USE_OPENGL" = x"yes"; then
1817       dnl cuda-gl interop header
1818       save_CPPFLAGS="$CPPFLAGS"
1819       CPPFLAGS="$save_CPPFLAGS $CUDA_CFLAGS"
1820       AC_CHECK_HEADER([cuda_gl_interop.h], [
1821         USE_NVENC_GST_GL="yes"
1822         AC_DEFINE(HAVE_NVENC_GST_GL, [1] , [NVENC GStreamer OpenGL support available])
1823         ])
1824       CPPFLAGS="$save_CPPFLAGS"
1825     fi
1826   else
1827     HAVE_NVENC="no"
1828   fi
1829 ])
1830 AM_CONDITIONAL(USE_NVENC_GST_GL, test "x$USE_NVENC_GST_GL" = "xyes")
1831
1832 dnl *** ext plug-ins ***
1833 dnl keep this list sorted alphabetically !
1834
1835 if test "x$BUILD_EXTERNAL" = "xyes"; then
1836
1837 dnl *** assrender ***
1838 translit(dnm, m, l) AM_CONDITIONAL(USE_ASSRENDER, true)
1839 AG_GST_CHECK_FEATURE(ASSRENDER, [ASS/SSA renderer], assrender, [
1840   PKG_CHECK_MODULES(ASSRENDER, libass >= 0.10.2, [
1841     HAVE_ASSRENDER="yes" ], [
1842     HAVE_ASSRENDER="no"
1843   ])
1844 ])
1845 AC_SUBST(ASSRENDER_CFLAGS)
1846 AC_SUBST(ASSRENDER_LIBS)
1847
1848 dnl *** vo-amrwbenc ***
1849 translit(dnm, m, l) AM_CONDITIONAL(USE_VOAMRWBENC, true)
1850 AG_GST_CHECK_FEATURE(VOAMRWBENC, [vo-amrwbenc library], vo-amrwbenc, [
1851   AG_GST_PKG_CHECK_MODULES(VOAMRWBENC, vo-amrwbenc >= 0.1.0)
1852 ])
1853
1854 dnl *** vo-aacenc ***
1855 translit(dnm, m, l) AM_CONDITIONAL(USE_VOAACENC, true)
1856 AG_GST_CHECK_FEATURE(VOAACENC, [vo-aacenc library], vo-aacenc, [
1857   AG_GST_PKG_CHECK_MODULES(VOAACENC, vo-aacenc >= 0.1.0)
1858 ])
1859
1860 dnl *** apexsink ***
1861 translit(dnm, m, l) AM_CONDITIONAL(USE_APEXSINK, true)
1862 AG_GST_CHECK_FEATURE(APEXSINK, [AirPort Express Wireless sink], apexsink, [
1863   PKG_CHECK_MODULES(APEXSINK, [ openssl >= 0.9.5  libcrypto ], [
1864     HAVE_APEXSINK="yes"
1865     saved_LIBS="$LIBS"
1866     LIBS=""
1867     AC_SEARCH_LIBS(socket, [socket], [ ], [ APEXSINK="no" ])
1868     AC_SEARCH_LIBS(gethostbyname, [nsl], [ ], [ APEXSINK="no" ])
1869     APEXSINK_LIBS="$APEXSINK_LIBS $LIBS"
1870     LIBS="$saved_LIBS"
1871     AC_SUBST(APEXSINK_CFLAGS)
1872     AC_SUBST(APEXSINK_LIBS)
1873   ], [
1874     APEXSINK="no"
1875   ])
1876 ])
1877
1878 dnl *** bs2b ***
1879 translit(dnm, m, l) AM_CONDITIONAL(USE_BS2B, true)
1880 AG_GST_CHECK_FEATURE(BS2B, [bs2b], bs2b, [
1881   PKG_CHECK_MODULES(BS2B, libbs2b >= 3.1.0, HAVE_BS2B="yes", [
1882     HAVE_BS2B="no"
1883   ])
1884   AC_SUBST(BS2B_CFLAGS)
1885   AC_SUBST(BS2B_LIBS)
1886 ])
1887
1888 dnl *** BZ2 ***
1889 translit(dnm, m, l) AM_CONDITIONAL(USE_BZ2, true)
1890 AG_GST_CHECK_FEATURE(BZ2, [bz2 library], bz2, [
1891   save_LIBS=$LIBS
1892   LIBS="$LIBS -lbz2"
1893   AC_MSG_CHECKING([for BZ2_bzlibVersion in -lbz2])
1894   AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <bzlib.h>]], [[const char *version = BZ2_bzlibVersion ();]])],[HAVE_BZ2=yes],[HAVE_BZ2=no])
1895   AC_MSG_RESULT($HAVE_BZ2)
1896   LIBS=$save_LIBS
1897   if test "x$HAVE_BZ2" = "xyes"; then
1898     BZ2_LIBS="-lbz2"
1899   fi
1900   AC_SUBST(BZ2_LIBS)
1901
1902 ])
1903
1904 #dnl *** cairo ***
1905 #translit(dnm, m, l) AM_CONDITIONAL(USE_CAIRO, true)
1906 #AG_GST_CHECK_FEATURE(CAIRO, [cairo plug-in], cairo, [
1907 #  PKG_CHECK_MODULES(CAIRO, cairo >= 1.0 glitz-glx, HAVE_CAIRO=yes, [
1908 #    HAVE_CAIRO=no
1909 #  ])
1910 #  AC_SUBST(CAIRO_CFLAGS)
1911 #  AC_SUBST(CAIRO_LIBS)
1912 #])
1913
1914 dnl *** chromaprint ***
1915 translit(dnm, m, l) AM_CONDITIONAL(USE_CHROMAPRINT, true)
1916 AG_GST_CHECK_FEATURE(CHROMAPRINT, [chromaprint], chromaprint, [
1917   PKG_CHECK_MODULES(CHROMAPRINT, libchromaprint, HAVE_CHROMAPRINT="yes", [
1918     HAVE_CHROMAPRINT="no"
1919   ])
1920   AC_SUBST(CHROMAPRINT_CFLAGS)
1921   AC_SUBST(CHROMAPRINT_LIBS)
1922 ])
1923
1924 dnl *** Curl ***
1925 translit(dnm, m, l) AM_CONDITIONAL(USE_CURL, true)
1926 AG_GST_CHECK_FEATURE(CURL, [Curl plugin], curl, [
1927   PKG_CHECK_MODULES(CURL, libcurl >= 7.35.0, [
1928     HAVE_CURL="yes"
1929     AC_CHECK_HEADERS([unistd.h sys/socket.h sys/types.h netinet/in.h netinet/tcp.h fcntl.h], [ ], [
1930       AC_CHECK_HEADERS([unistd.h sys/types.h winsock2.h ws2tcpip.h fcntl.h], [ ], [HAVE_CURL="no"])
1931     ])
1932     AC_CHECK_HEADERS([netinet/ip.h], [], [HAVE_CURL="no"],
1933     [[#ifdef HAVE_SYS_TYPES_H
1934      # include <sys/types.h>
1935      #endif
1936      #ifdef HAVE_NETINET_IN_H
1937      # include <netinet/in.h>
1938      #endif
1939     ]])
1940     AC_MSG_CHECKING([for socket support needed by curlsink])
1941     AC_MSG_RESULT($HAVE_CURL)
1942   ], [
1943     HAVE_CURL="no"
1944   ])
1945   AC_SUBST(CURL_CFLAGS)
1946   AC_SUBST(CURL_LIBS)
1947   PKG_CHECK_MODULES(SSH2, libssh2 >= 1.4.3, [
1948     HAVE_SSH2="yes"
1949     AC_DEFINE(HAVE_SSH2, 1, [Define if libssh2 is available])
1950   ], [
1951     HAVE_SSH2="no"
1952   ])
1953   AM_CONDITIONAL(USE_SSH2, test "x$HAVE_SSH2" = "xyes")
1954   AC_SUBST(SSH2_CFLAGS)
1955   AC_SUBST(SSH2_LIBS)
1956 ],,,[AM_CONDITIONAL(USE_SSH2, false)])
1957
1958 dnl **** DASH ****
1959 translit(dnm, m, l) AM_CONDITIONAL(USE_DASH, true)
1960 AG_GST_CHECK_FEATURE(DASH, [DASH plug-in], dash, [
1961   PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= 2.8, [HAVE_LIBXML2="yes"
1962     HAVE_DASH="yes"], [HAVE_LIBXML2="no"
1963     HAVE_DASH="no"])
1964   AC_SUBST(LIBXML2_CFLAGS)
1965   AC_SUBST(LIBXML2_LIBS)
1966 ])
1967
1968 dnl *** dc1394  ***
1969 translit(dnm, m, l) AM_CONDITIONAL(USE_DC1394, true)
1970 AG_GST_CHECK_FEATURE(DC1394, [libdc1394], dc1394, [
1971    PKG_CHECK_MODULES(LIBDC1394, libdc1394-2 >= 2.0.0, [
1972         if test -z "`$PKG_CONFIG --modversion libdc1394-2 | grep 2.0.0-rc`"; then
1973                 HAVE_DC1394="yes"
1974         else
1975                 HAVE_DC1394="no"
1976         fi
1977    ], [
1978         HAVE_DC1394="no"
1979         AC_MSG_RESULT(no)
1980    ])
1981    AC_SUBST(LIBDC1394_CFLAGS)
1982    AC_SUBST(LIBDC1394_LIBS)
1983 ])
1984
1985 dnl *** decklink  ***
1986 translit(dnm, m, l) AM_CONDITIONAL(USE_DECKLINK, true)
1987 AG_GST_CHECK_FEATURE(DECKLINK, [decklink], decklink, [
1988    HAVE_DECKLINK=no
1989    case "$host" in
1990      *android*)
1991        HAVE_DECKLINK=no
1992        ;;
1993      *-*linux*)
1994        if test "x$HAVE_PTHREAD_H" = "xyes"; then
1995          AC_CHECK_LIB(dl, dlopen,
1996            [
1997             HAVE_DECKLINK=yes
1998             DECKLINK_CXXFLAGS=
1999             DECKLINK_LIBS="-lpthread -ldl"
2000            ])
2001        fi
2002        ;;
2003      *-*darwin*)
2004        if test "x$HAVE_PTHREAD_H" = "xyes"; then
2005          AC_CHECK_LIB(dl, dlopen,
2006            [
2007             HAVE_DECKLINK=yes
2008             DECKLINK_CXXFLAGS=
2009             DECKLINK_LIBS="-lpthread -ldl"
2010             HAVE_DECKLINK_OSX=yes
2011            ])
2012        fi
2013        ;;
2014      *)
2015        HAVE_DECKLINK=no
2016        ;;
2017    esac
2018
2019    AC_SUBST(DECKLINK_CXXFLAGS)
2020    AC_SUBST(DECKLINK_LIBS)
2021 ])
2022 AM_CONDITIONAL(DECKLINK_OSX, test "x$HAVE_DECKLINK_OSX" = xyes)
2023
2024 dnl **** DirectFB ****
2025 translit(dnm, m, l) AM_CONDITIONAL(USE_DIRECTFB, true)
2026 AG_GST_CHECK_FEATURE(DIRECTFB, [directfb], dfbvideosink , [
2027   PKG_CHECK_MODULES(DIRECTFB, directfb >= 0.9.24, HAVE_DIRECTFB="yes", [
2028     HAVE_DIRECTFB="no"
2029   ])
2030 ])
2031
2032 dnl **** Wayland ****
2033 translit(dnm, m, l) AM_CONDITIONAL(USE_WAYLAND, true)
2034 AG_GST_CHECK_FEATURE(WAYLAND, [wayland sink], wayland , [
2035   PKG_CHECK_MODULES(WAYLAND, wayland-client >= 1.4.0 wayland-scanner, [
2036     HAVE_WAYLAND="yes" ], [ HAVE_WAYLAND="no"
2037   ])
2038 ])
2039
2040 AC_PATH_PROG([wayland_scanner], [wayland-scanner])
2041
2042 dnl **** WebP ****
2043 translit(dnm, m, l) AM_CONDITIONAL(USE_WEBP, true)
2044 AG_GST_CHECK_FEATURE(WEBP, [WebP], webp , [
2045   PKG_CHECK_MODULES(WEBP, libwebp >= 0.2.1, [
2046     HAVE_WEBP="yes" ], [ HAVE_WEBP="no"
2047   ])
2048   AC_SUBST(WEBP_CFLAGS)
2049   AC_SUBST(WEBP_LIBS)
2050 ])
2051
2052 dnl *** Daala ***
2053 translit(dnm, m, l) AM_CONDITIONAL(USE_DAALA, true)
2054 AG_GST_CHECK_FEATURE(DAALA, [daala], daala, [
2055   if test "x$BUILD_EXPERIMENTAL" = "xyes"; then
2056     PKG_CHECK_MODULES(DAALA, daalaenc daaladec, [
2057             HAVE_DAALA="yes"
2058     ], [
2059             HAVE_DAALA="no"
2060     ])
2061     AC_SUBST(DAALA_CFLAGS)
2062     AC_SUBST(DAALA_LIBS)
2063   fi
2064 ])
2065
2066 dnl *** DTS ***
2067 translit(dnm, m, l) AM_CONDITIONAL(USE_DTS, true)
2068 AG_GST_CHECK_FEATURE(DTS, [dts library], dtsdec, [
2069   HAVE_DTS="yes"
2070   AG_GST_CHECK_LIBHEADER(DTS, dca, dca_init, $LIBM, dca.h,
2071     DTS_LIBS="-ldca $LIBM", HAVE_DTS="no")
2072   if test $HAVE_DTS = "no"; then
2073     AG_GST_CHECK_LIBHEADER(DTS, dts_pic, dts_init, $LIBM, dts.h,
2074       [ DTS_LIBS="-ldts_pic $LIBM"
2075         AC_DEFINE(DTS_OLD, 1, [Define if an old libdts is used])
2076       ])
2077   fi
2078   AC_SUBST(DTS_LIBS)
2079 ])
2080
2081 dnl *** resindvd ***
2082 translit(dnm, m, l) AM_CONDITIONAL(USE_RESINDVD, true)
2083 AG_GST_CHECK_FEATURE(RESINDVD, [resindvd plugin], resindvd, [
2084   PKG_CHECK_MODULES(DVDNAV, dvdnav >= 4.1.2 dvdread >= 4.1.2, HAVE_RESINDVD="yes", [
2085     HAVE_RESINDVD="no"
2086   ])
2087 ])
2088
2089 dnl **** Free AAC Encoder (FAAC) ****
2090 translit(dnm, m, l) AM_CONDITIONAL(USE_FAAC, true)
2091 AG_GST_CHECK_FEATURE(FAAC, [AAC encoder plug-in], faac, [
2092   AG_GST_CHECK_LIBHEADER(FAAC, faac, faacEncOpen, $LIBM, faac.h,
2093     FAAC_LIBS="-lfaac $LIBM")
2094   AC_SUBST(FAAC_LIBS)
2095 ])
2096
2097 dnl **** Free AAC Decoder (FAAD) ****
2098 translit(dnm, m, l) AM_CONDITIONAL(USE_FAAD, true)
2099 AG_GST_CHECK_FEATURE(FAAD, [AAC decoder plug-in], faad, [
2100   HAVE_FAAD="yes"
2101   faad_hdr=""
2102   AG_GST_CHECK_LIBHEADER(FAAD, faad, faacDecOpen, $LIBM, faad.h,
2103     FAAD_LIBS="-lfaad $LIBM", HAVE_FAAD="no")
2104   if test $HAVE_FAAD = "no"; then
2105     AG_GST_CHECK_LIBHEADER(FAAD, faad, NeAACDecOpen, $LIBM, neaacdec.h,
2106       [ FAAD_LIBS="-lfaad $LIBM"
2107         AC_DEFINE(FAAD_IS_NEAAC, 1, [Define if AAC is using new api prefix])
2108         faad_hdr="neaacdec.h"
2109       ], [
2110         HAVE_FAAD="no"
2111       ],)
2112   else
2113     faad_hdr="faad.h"
2114   fi
2115   if test $HAVE_FAAD = "yes"; then
2116     AC_MSG_CHECKING([Checking for FAAD >= 2.0])
2117     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <faad.h>]], [[
2118         #if !defined(FAAD2_VERSION) || !defined(FAAD_FMT_DOUBLE)
2119         #error Not faad2
2120         #else
2121         /* Release candidate of 2.0 is not good enough for us. This field
2122          * was added only in 2.0 final and does not exist in 2.0-RC3 */
2123         faacDecConfiguration conf; conf.dontUpSampleImplicitSBR = 1;
2124         #endif
2125     ]])],[
2126       HAVE_FAAD="yes"
2127
2128       AC_MSG_CHECKING([Checking FAAD2 version in $faad_hdr])
2129       for minor in 10 9 8 7 6 5 0; do
2130         if test x$faad2_minor_version = "x"; then
2131           AC_EGREP_CPP([\"2\.$minor\"$], [
2132               #include <$faad_hdr>
2133               FAAD2_VERSION
2134             ], [
2135               faad2_minor_version=$minor
2136             ])
2137         fi
2138       done
2139       if test x$faad2_minor_version = "x"; then
2140         AC_MSG_RESULT([no idea])
2141       else
2142         AC_MSG_RESULT([2.$faad2_minor_version])
2143         AC_DEFINE_UNQUOTED([FAAD2_MINOR_VERSION], [$faad2_minor_version], [The x in 2.x])
2144       fi
2145     ],[
2146       HAVE_FAAD="no"
2147     ])
2148   fi
2149   AC_SUBST(FAAD_LIBS)
2150   AC_SUBST(FAAD_IS_NEAAC)
2151 ])
2152
2153 dnl *** fbdev ***
2154 translit(dnm, m, l) AM_CONDITIONAL(USE_FBDEV, true)
2155 AG_GST_CHECK_FEATURE(FBDEV, [linux framebuffer], fbdevsink, [
2156   if test "x$HAVE_FBDEV" != "xyes"; then
2157     AC_CHECK_HEADER([linux/fb.h], HAVE_FBDEV=yes, HAVE_FBDEV=no)
2158   fi
2159 ])
2160
2161 dnl *** flite ***
2162 translit(dnm, m, l) AM_CONDITIONAL(USE_FLITE, true)
2163 AG_GST_CHECK_FEATURE(FLITE, [Flite plugin], flite, [
2164   AG_GST_CHECK_LIBHEADER(FLITE, flite, flite_init, $LIBM, flite/flite.h,
2165     FLITE_LIBS="-lflite -lflite_cmu_us_kal -lflite_usenglish -lflite_cmulex $LIBM")
2166
2167   AC_SUBST(FLITE_CFLAGS)
2168   AC_SUBST(FLITE_LIBS)
2169 ])
2170
2171 dnl *** gsm ***
2172 translit(dnm, m, l) AM_CONDITIONAL(USE_GSM, true)
2173 AG_GST_CHECK_FEATURE(GSM, [GSM library], gsmenc gsmdec, [
2174   AG_GST_CHECK_LIBHEADER(GSM, gsm, gsm_create, , gsm.h, GSM_LIBS="-lgsm")
2175   if test $HAVE_GSM != "yes"; then
2176     AG_GST_CHECK_LIBHEADER(GSM, gsm, gsm_create, , gsm/gsm.h, GSM_LIBS="-lgsm")
2177     if test $HAVE_GSM = "yes"; then
2178       AC_DEFINE(GSM_HEADER_IN_SUBDIR, 1, [Define if GSM header in gsm/ subdir])
2179     fi
2180   fi
2181   AC_SUBST(GSM_LIBS)
2182 ])
2183
2184 dnl *** fluidSynth ***
2185 translit(dnm, m, l) AM_CONDITIONAL(USE_FLUIDSYNTH, true)
2186 AG_GST_CHECK_FEATURE(FLUIDSYNTH, [fluidsynth], fluidsynth, [
2187   PKG_CHECK_MODULES(FLUIDSYNTH, fluidsynth >= 1.0, HAVE_FLUIDSYNTH="yes", [
2188     HAVE_FLUIDSYNTH="no"
2189   ])
2190 ])
2191
2192 dnl *** kate ***
2193 translit(dnm, m, l) AM_CONDITIONAL(USE_KATE, true)
2194 AG_GST_CHECK_FEATURE(KATE, [Kate], kate, [
2195   PKG_CHECK_MODULES(KATE, kate >= 0.1.7, HAVE_KATE="yes", [
2196     HAVE_KATE="no"
2197   ])
2198   AC_SUBST(KATE_CFLAGS)
2199   AC_SUBST(KATE_LIBS)
2200   PKG_CHECK_MODULES(TIGER, tiger >= 0.3.2,
2201     [
2202       HAVE_TIGER="yes"
2203       AC_DEFINE(HAVE_TIGER, 1, [Define if libtiger is available])
2204     ],
2205     [
2206       HAVE_TIGER="no"
2207     ]
2208   )
2209   AM_CONDITIONAL(USE_TIGER, test "x$HAVE_TIGER" = "xyes")
2210   AC_SUBST(TIGER_CFLAGS)
2211   AC_SUBST(TIGER_LIBS)
2212 ],,,[AM_CONDITIONAL(USE_TIGER, false)])
2213
2214 dnl *** ladspa ***
2215 translit(dnm, m, l) AM_CONDITIONAL(USE_LADSPA, true)
2216 AG_GST_CHECK_FEATURE(LADSPA, [ladspa], ladspa, [
2217   AC_CHECK_HEADER(ladspa.h, HAVE_LADSPA="yes", HAVE_LADSPA="no")
2218
2219   PKG_CHECK_MODULES(LRDF, lrdf, HAVE_LRDF=yes, HAVE_LRDF=no)
2220   if test $HAVE_LRDF = "yes"; then
2221     AC_DEFINE(HAVE_LRDF, 1, [Define if we have liblrdf])
2222   fi
2223   AC_SUBST(LRDF_LIBS)
2224   AC_SUBST(LRDF_CFLAGS)
2225 ])
2226
2227 dnl *** LV2 ***
2228 translit(dnm, m, l) AM_CONDITIONAL(USE_LV2, true)
2229 AG_GST_CHECK_FEATURE(LV2, [lv2], lv2, [
2230   PKG_CHECK_MODULES(SLV2, slv2 >= 0.6.6, HAVE_LV2="yes", HAVE_LV2="no")
2231   AC_SUBST(SLV2_CFLAGS)
2232   AC_SUBST(SLV2_LIBS)
2233 ])
2234
2235 dnl *** libde265 ***
2236 translit(dnm, m, l) AM_CONDITIONAL(USE_LIBDE265, true)
2237 AG_GST_CHECK_FEATURE(LIBDE265, [libde265 HEVC/H.265 decoder], libde265, [
2238   PKG_CHECK_MODULES(LIBDE265, libde265 >= 0.9, HAVE_LIBDE265="yes", HAVE_LIBDE265="no")
2239   AC_SUBST(LIBDE265_CFLAGS)
2240   AC_SUBST(LIBDE265_LIBS)
2241 ])
2242
2243 dnl *** libmms ***
2244 translit(dnm, m, l) AM_CONDITIONAL(USE_LIBMMS, true)
2245 AG_GST_CHECK_FEATURE(LIBMMS, [mms protocol library], libmms, [
2246   dnl check with pkg-config first
2247   PKG_CHECK_MODULES(LIBMMS, libmms >= 0.4, HAVE_LIBMMS="yes", [
2248     HAVE_LIBMMS="no"
2249   ])
2250 ])
2251 AC_SUBST(LIBMMS_LIBS)
2252
2253
2254 dnl *** libsrtp ***
2255 translit(dnm, m, l) AM_CONDITIONAL(USE_SRTP, true)
2256 AG_GST_CHECK_FEATURE(SRTP, [srtp library], srtp, [
2257   PKG_CHECK_MODULES(SRTP, libsrtp, HAVE_SRTP="yes",
2258     AG_GST_CHECK_LIBHEADER(SRTP, srtp, srtp_init, , srtp/srtp.h, SRTP_LIBS="-lsrtp")
2259   )
2260   AC_SUBST(SRTP_LIBS)
2261   AC_SUBST(SRTP_CFLAGS)
2262 ])
2263
2264 dnl *** dtls ***
2265 translit(dnm, m, l) AM_CONDITIONAL(USE_DTLS, true)
2266 AG_GST_CHECK_FEATURE(DTLS, [DTLS plugin], dtls, [
2267   PKG_CHECK_MODULES(DTLS, [ openssl >= 1.0.1  libcrypto ], [
2268     HAVE_DTLS="yes"
2269     AC_SUBST(DTLS_CFLAGS)
2270     AC_SUBST(DTLS_LIBS)
2271   ], [
2272     HAVE_DTLS="no"
2273   ])
2274 ])
2275
2276 dnl *** linsys ***
2277 translit(dnm, m, l) AM_CONDITIONAL(USE_LINSYS, true)
2278 AG_GST_CHECK_FEATURE(LINSYS, [Linear Systems SDI plugin], linsys, [
2279   case "$host" in
2280     *-*linux*)
2281       HAVE_LINSYS=yes
2282       ;;
2283     *)
2284       HAVE_LINSYS=no
2285       ;;
2286   esac
2287 ])
2288
2289 dnl *** modplug ***
2290 translit(dnm, m, l) AM_CONDITIONAL(USE_MODPLUG, true)
2291 AG_GST_CHECK_FEATURE(MODPLUG, modplug, modplug, [
2292   if test "x$HAVE_CXX" != "xyes"; then
2293     AC_MSG_WARN([Not compiling modplug plugin as it requires a C++ compiler])
2294     HAVE_MODPLUG="no"
2295   else
2296     PKG_CHECK_MODULES(MODPLUG, libmodplug, HAVE_MODPLUG="yes", HAVE_MODPLUG="no")
2297   fi
2298   AC_SUBST(MODPLUG_CFLAGS)
2299   AC_SUBST(MODPLUG_LIBS)
2300 ])
2301
2302 dnl *** mimic ***
2303 translit(dnm, m, l) AM_CONDITIONAL(USE_MIMIC, true)
2304 AG_GST_CHECK_FEATURE(MIMIC, [libmimic library], mimic, [
2305   MIMIC_REQUIRED=1.0
2306   PKG_CHECK_MODULES(MIMIC, libmimic >= $MIMIC_REQUIRED,
2307       HAVE_MIMIC=yes, HAVE_MIMIC=no)
2308   AC_SUBST(MIMIC_CFLAGS)
2309   AC_SUBST(MIMIC_LIBS)
2310 ])
2311
2312 dnl *** mjpegtools version info ***
2313 dnl some may prefer older version (given quirks above)
2314 dnl hm, no version info seems available within mjpegtools headers
2315 dnl and API really moves along
2316 echo
2317 PKG_CHECK_EXISTS(mjpegtools >= 1.6.1.93 mjpegtools < 1.8.0, [
2318   mjpegtools_api=10601
2319 ], [
2320   PKG_CHECK_EXISTS(mjpegtools >= 1.8.0 mjpegtools < 1.9.0, [
2321     mjpegtools_api=10800
2322   ], [
2323     PKG_CHECK_EXISTS(mjpegtools >= 2.0.0, [
2324       mjpegtools_api=20000
2325     ], [
2326       PKG_CHECK_MODULES(MJPEG, mjpegtools >= 1.9.0 mjpegtools < 2.0.0, [
2327         dnl logging API changed in release candidates
2328         OLD_CFLAGS="$CFLAGS"
2329         OLD_LIBS="$LIBS"
2330         CFLAGS="$MJPEG_CFLAGS"
2331         LIBS="$LIBS $MJPEG_LIBS -lmjpegutils $LIBM $PTHREAD_LIBS"
2332         AC_CHECK_FUNC(mjpeg_loglev_t, [
2333           mjpegtools_api=10903
2334           ], [
2335           mjpegtools_api=10900
2336           ])
2337         CFLAGS="$OLD_CFLAGS"
2338         LIBS="$OLD_LIBS"
2339       ], [
2340         mjpegtools_api=0
2341       ])
2342     ])
2343   ])
2344 ])
2345 AC_DEFINE_UNQUOTED(GST_MJPEGTOOLS_API, $mjpegtools_api,
2346   [mjpegtools API evolution])
2347
2348 dnl *** mpeg2enc ***
2349 translit(dnm, m, l) AM_CONDITIONAL(USE_MPEG2ENC, true)
2350 AG_GST_CHECK_FEATURE(MPEG2ENC, [mpeg2enc], mpeg2enc, [
2351   HAVE_MPEG2ENC="no"
2352   dnl we require a c++ compiler for this one
2353   if [ test x$HAVE_CXX = xyes ]; then
2354     dnl libmpeg2enc was first included in mjpegtools-1.6.2-rc3 (1.6.1.92)
2355     dnl since many distros include mjpegtools specifically without mplex
2356     dnl and mpeg2enc, we check for mpeg2enc on its own, too.
2357     PKG_CHECK_MODULES(MPEG2ENC, mjpegtools >= 1.6.1.93, [
2358       dnl HACK because mpeg2enc 1.8.0 header files have a spurious 'include config.h'
2359       touch config.h
2360       dnl switch over to c++ to test things
2361       AC_LANG([C++])
2362       OLD_CPPFLAGS="$CPPFLAGS"
2363       dnl HACK as above
2364       CPPFLAGS_GOOD="$CPPFLAGS $MPEG2ENC_CFLAGS"
2365       CPPFLAGS="$CPPFLAGS_GOOD -I."
2366       dnl check headers
2367       mpeg2enc_headers_ok=no
2368       AC_CHECK_HEADER([mpeg2encoder.hh], [
2369         MPEG2ENC_LIBS="$MPEG2ENC_LIBS -lmpeg2encpp $LIBM $PTHREAD_LIBS"
2370         OLD_LIBS="$LIBS"
2371         LIBS="$LIBS $MPEG2ENC_LIBS"
2372         AC_MSG_CHECKING([for valid mpeg2enc objects])
2373         AC_RUN_IFELSE([AC_LANG_SOURCE([[
2374           #include <mpeg2encoder.hh>
2375           #include <mpeg2encoptions.hh>
2376
2377           int
2378           main (int   argc,
2379                 char *argv[])
2380           {
2381             MPEG2EncOptions *options = new MPEG2EncOptions ();
2382             MPEG2Encoder *encoder = new MPEG2Encoder (*options);
2383             return 0;
2384           }
2385         ]])],[
2386           AC_MSG_RESULT(yes)
2387           dnl so far so good, let's check more things:
2388           dnl mjpegtools-1.8.0 does not install the required
2389           dnl mpeg2syntaxcodes.h header by default, and a new release
2390           dnl is not in sight, so check for this oversight in case
2391           dnl distros or folks have fixed this themselves
2392           if test "$mjpegtools_api" -ge "10800"; then
2393             AC_CHECK_HEADER([mpeg2syntaxcodes.h], [
2394                 mpeg2enc_headers_ok=yes
2395               ], [
2396                 mpeg2enc_headers_ok=no
2397               ])
2398           else
2399             mpeg2enc_headers_ok=yes
2400           fi
2401           if test "x$mpeg2enc_headers_ok" = "xyes"; then
2402             HAVE_MPEG2ENC="yes"
2403           fi
2404           CPPFLAGS="$CPPFLAGS_GOOD"
2405           AC_SUBST(MPEG2ENC_CFLAGS)
2406           AC_SUBST(MPEG2ENC_LIBS)
2407         ],[
2408           AC_MSG_RESULT(no)
2409         ],[])
2410         LIBS="$OLD_LIBS"
2411       ])
2412
2413       CPPFLAGS="$OLD_CPPFLAGS"
2414       AC_LANG([C])
2415     ], [
2416       HAVE_MPEG2ENC="no"
2417     ])
2418   fi
2419 ])
2420
2421 dnl *** mpg123 ***
2422 translit(dnm, m, l) AM_CONDITIONAL(USE_MPG123, true)
2423 AG_GST_CHECK_FEATURE(MPG123, [mpg123 audio decoder], mpg123, [
2424   PKG_CHECK_MODULES(MPG123, libmpg123 >= 1.13, HAVE_MPG123="yes", HAVE_MPG123="no")
2425   AC_SUBST(MPG123_CFLAGS)
2426   AC_SUBST(MPG123_LIBS)
2427 ])
2428
2429 dnl *** mplex ***
2430 translit(dnm, m, l) AM_CONDITIONAL(USE_MPLEX, true)
2431 AG_GST_CHECK_FEATURE(MPLEX, [mplex], mplex, [
2432   HAVE_MPLEX="no"
2433   dnl we require a c++ compiler for this one
2434   if [ test x$HAVE_CXX = xyes ]; then
2435     dnl libmplex was first included in mjpegtools-1.6.2-rc4 (1.6.1.93)
2436     dnl since many distros include mjpegtools specifically without mplex
2437     dnl and mpeg2enc, we check for mplex on its own, too.
2438     dnl libmplex < 1.9rc? has fuzzy ABI, valgrind and other problems
2439     PKG_CHECK_MODULES(MPLEX, mjpegtools >= 1.9.0, [
2440       dnl HACK because mplex 2.0.0 header files have a spurious 'include config.h'
2441       touch config.h
2442       dnl switch over to c++ to test things
2443       AC_LANG([C++])
2444       OLD_CPPFLAGS="$CPPFLAGS"
2445       dnl HACK as above
2446       CPPFLAGS_GOOD="$CPPFLAGS $MPLEX_CFLAGS"
2447       CPPFLAGS="$CPPFLAGS_GOOD -I."
2448       AC_CHECK_HEADER(interact.hpp, [
2449         MPLEX_LIBS="$MPLEX_LIBS -lmplex2 $LIBM"
2450         OLD_LIBS="$LIBS"
2451         LIBS="$LIBS $MPLEX_LIBS"
2452         OLD_LDFLAGS="$LDFLAGS"
2453         LDFLAGS="$LDFLAGS $MPLEX_LDFLAGS"
2454         dnl older libmplex uses off_t SegmentSize (), which leads to fuzzy ABI;
2455         dnl don't want this here
2456         AC_MSG_CHECKING([for valid mplex objects])
2457         AC_RUN_IFELSE([AC_LANG_SOURCE([[
2458
2459 #include <interact.hpp>
2460 #include <outputstrm.hpp>
2461 #include <multiplexor.hpp>
2462 int
2463 main (int   argc,
2464       char *argv[])
2465 {
2466   class TestOutputStream : public OutputStream {
2467   public:
2468     TestOutputStream () : OutputStream () { }
2469     void Write (uint8_t *a, unsigned int b) { }
2470     void NextSegment () { }
2471     uint64_t SegmentSize () { }
2472     void Close () { }
2473     int Open () { }
2474 };
2475   MultiplexJob *job = new MultiplexJob ();
2476   vector<IBitStream *> inputs;
2477   job->SetupInputStreams (inputs);
2478   TestOutputStream *out = new TestOutputStream ();
2479   Multiplexor *mux = new Multiplexor(*job, *out, NULL);
2480   return 0;
2481 }
2482         ]])],[
2483           HAVE_MPLEX="yes"
2484           CPPFLAGS="$CPPFLAGS_GOOD"
2485           AC_SUBST(MPLEX_CFLAGS)
2486           AC_SUBST(MPLEX_LIBS)
2487           AC_SUBST(MPLEX_LDFLAGS)
2488           AC_MSG_RESULT(yes)
2489         ],[AC_MSG_RESULT(no)],[])
2490         LIBS="$OLD_LIBS"
2491         LDFLAGS="$OLD_LDFLAGS"
2492       ])
2493       CPPFLAGS="$OLD_CPPFLAGS"
2494       AC_LANG([C])
2495     ], HAVE_MPLEX="no")
2496   fi
2497 ])
2498
2499 dnl *** musepack ***
2500 translit(dnm, m, l) AM_CONDITIONAL(USE_MUSEPACK, true)
2501 AG_GST_CHECK_FEATURE(MUSEPACK, [musepackdec], musepack, [
2502   AC_CHECK_HEADER([mpc/mpcdec.h], [
2503     HAVE_MUSEPACK="yes"
2504     MUSEPACK_LIBS="-lmpcdec"
2505     AC_SUBST(MUSEPACK_LIBS)
2506     ], [AC_CHECK_HEADER([mpcdec/mpcdec.h], [
2507       HAVE_MUSEPACK="yes"
2508       MUSEPACK_LIBS="-lmpcdec"
2509       AC_DEFINE(MPC_IS_OLD_API, 1, [Define if the old MusePack API is used])
2510       AC_SUBST(MUSEPACK_LIBS)
2511     ], [HAVE_MUSEPACK="no"])])
2512 ])
2513
2514 dnl *** nas ***
2515 translit(dnm, m, l) AM_CONDITIONAL(USE_NAS, true)
2516 AG_GST_CHECK_FEATURE(NAS, [nas plug-in], nassink, [
2517   HAVE_NAS="no"
2518   if test "x$HAVE_X" = "xyes"; then
2519     save_cppflags=$CFLAGS
2520     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2521     AG_GST_CHECK_LIBHEADER(NAS, audio, AuOpenServer, $X_LIBS, audio/audiolib.h,
2522       NAS_LIBS="$X_LIBS -laudio" NAS_CFLAGS="$X_CFLAGS")
2523     CPPFLAGS="$save_cppflags"
2524   fi
2525   AC_SUBST(NAS_CFLAGS)
2526   AC_SUBST(NAS_LIBS)
2527 ])
2528
2529 dnl *** neon ***
2530 translit(dnm, m, l) AM_CONDITIONAL(USE_NEON, true)
2531 AG_GST_CHECK_FEATURE(NEON, [neon http client plugins], neonhttpsrc, [
2532   PKG_CHECK_MODULES(NEON, neon >= 0.27.0  neon <= 0.30.99, HAVE_NEON="yes", [
2533     HAVE_NEON="no"
2534   ])
2535   AC_SUBST(NEON_CFLAGS)
2536   AC_SUBST(NEON_LIBS)
2537 ])
2538
2539 dnl *** ofa ***
2540 translit(dnm, m, l) AM_CONDITIONAL(USE_OFA, true)
2541 AG_GST_CHECK_FEATURE(OFA, [ofa plugins], ofa, [
2542   PKG_CHECK_MODULES(OFA, libofa >= 0.9.3, HAVE_OFA="yes", [
2543     HAVE_OFA="no"
2544   ])
2545   AC_SUBST(OFA_CFLAGS)
2546   AC_SUBST(OFA_LIBS)
2547 ])
2548
2549 dnl *** OpenAL ***
2550 translit(dnm, m, l) AM_CONDITIONAL(USE_OPENAL, true)
2551 AG_GST_CHECK_FEATURE(OPENAL, [OpenAL plugin], openal, [
2552   PKG_CHECK_MODULES(OPENAL, openal >= 1.14, HAVE_OPENAL="yes", [
2553     HAVE_OPENAL="no"
2554   ])
2555   AC_SUBST(OPENAL_CFLAGS)
2556   AC_SUBST(OPENAL_LIBS)
2557 ])
2558
2559 dnl *** opencv ***
2560 translit(dnm, m, l) AM_CONDITIONAL(USE_OPENCV, true)
2561 AG_GST_CHECK_FEATURE(OPENCV, [opencv plugins], opencv, [
2562   dnl we specify a max. version too because we set CV_NO_BACKWARD_COMPATIBILITY
2563   dnl and don't want the build to break when a new opencv version comes out.
2564   dnl Need to adjust this upwards once we know that our code compiles fine with
2565   dnl a new version and the no-backward-compatibility define. (There doesn't
2566   dnl seem to be a switch to suppress the warnings the cvcompat.h header
2567   dnl causes.)
2568   PKG_CHECK_MODULES(OPENCV, opencv >= 2.3.0 opencv < 2.5.0 , [
2569     AC_PROG_CXX
2570     AC_LANG([C++])
2571     OLD_CPPFLAGS=$CPPFLAGS
2572     CPPFLAGS=$OPENCV_CFLAGS
2573     something_not_found=no
2574     AC_CHECK_HEADERS([opencv2/contrib/contrib.hpp \
2575                       opencv2/core/core_c.h \
2576                       opencv2/core/types_c.h \
2577                       opencv2/core/version.hpp \
2578                       opencv2/highgui/highgui_c.h \
2579                       opencv2/imgproc/imgproc.hpp \
2580                       opencv2/imgproc/imgproc_c.h \
2581                       opencv2/legacy/compat.hpp \
2582                       opencv2/legacy/legacy.hpp \
2583                       opencv2/objdetect/objdetect.hpp \
2584                       opencv2/video/background_segm.hpp], [], [something_not_found=yes])
2585     CPPFLAGS=$OLD_CPPFLAGS
2586     AC_LANG([C])
2587
2588     if test $something_not_found = "yes"; then
2589       AC_MSG_RESULT([not all opencv2 headers were found])
2590       HAVE_OPENCV="no"
2591     else
2592       HAVE_OPENCV="yes"
2593     fi
2594   ], [
2595     HAVE_OPENCV="no"
2596   ])
2597   OPENCV_PREFIX="`$PKG_CONFIG --variable=prefix opencv`"
2598   AC_DEFINE_UNQUOTED(OPENCV_PREFIX, "$OPENCV_PREFIX", [opencv install prefix])
2599   AC_SUBST(OPENCV_PREFIX)
2600   AC_SUBST(OPENCV_CFLAGS)
2601   AC_SUBST(OPENCV_LIBS)
2602   dnl the OpenCV prefix is used at runtime for some object properties, and also
2603   dnl used here to detect which directory is the correct one. For the second
2604   dnl case, make sure the right sysroot is used, ensuring correct behavior
2605   dnl during cross compilation.
2606   if test -d "$PKG_CONFIG_SYSROOT_DIR/$OPENCV_PREFIX/share/opencv/"; then
2607     AC_DEFINE_UNQUOTED(OPENCV_PATH_NAME, ["opencv"], [OpenCV path name])
2608   else
2609     AC_DEFINE_UNQUOTED(OPENCV_PATH_NAME, ["OpenCV"], [OpenCV path name])
2610   fi
2611 ])
2612
2613 dnl *** OpenEXR ***
2614 translit(dnm, m, l) AM_CONDITIONAL(USE_OPENEXR, true)
2615 AG_GST_CHECK_FEATURE(OPENEXR, [openexr library], openexr, [
2616   AG_GST_PKG_CHECK_MODULES(OPENEXR, OpenEXR)
2617 ])
2618
2619 dnl *** openh264 ***
2620 translit(dnm, m, l) AM_CONDITIONAL(USE_OPENH264, true)
2621 AG_GST_CHECK_FEATURE(OPENH264, [openh264 library], openh264, [
2622   AG_GST_PKG_CHECK_MODULES(OPENH264, openh264 >= 1.3.0)
2623 ])
2624
2625 dnl *** OpenJPEG ***
2626 translit(dnm, m, l) AM_CONDITIONAL(USE_OPENJPEG, true)
2627 AG_GST_CHECK_FEATURE(OPENJPEG, [openjpeg library], openjpeg, [
2628   HAVE_OPENJPEG="no"
2629
2630   save_LIBS="$LIBS"
2631   save_CFLAGS="$CFLAGS"
2632   OPENJPEG_LIBS="-lopenjp2"
2633   LIBS="$LIBS $OPENJPEG_LIBS"
2634   CFLAGS="$CFLAGS $OPENJPEG_CFLAGS"
2635   AC_LINK_IFELSE([
2636     AC_LANG_PROGRAM([#include <openjpeg-2.0/openjpeg.h>],
2637                     [return (int) *opj_version ();])
2638                  ], [HAVE_OPENJPEG=yes], [HAVE_OPENJPEG=no])
2639   LIBS="$save_LIBS"
2640   CFLAGS="$save_CFLAGS"
2641
2642   if test x"$HAVE_OPENJPEG" = x"no"; then
2643     OPENJPEG_LIBS=""
2644     PKG_CHECK_MODULES(OPENJPEG, libopenjpeg1,
2645       HAVE_OPENJPEG="yes",
2646       AG_GST_CHECK_LIBHEADER(OPENJPEG, openjpeg, opj_version, , openjpeg.h, OPENJPEG_LIBS="-lopenjpeg")
2647     )
2648     if test x"$HAVE_OPENJPEG" = x"yes"; then
2649       AC_DEFINE([HAVE_OPENJPEG_1], 1, [Define if OpenJPEG 1 is used])
2650     fi
2651   fi
2652   AC_SUBST(OPENJPEG_CFLAGS)
2653   AC_SUBST(OPENJPEG_LIBS)
2654 ])
2655
2656 dnl *** OpenNI2 ***
2657 translit(dnm, m, l) AM_CONDITIONAL(USE_OPENNI2, true)
2658 AG_GST_CHECK_FEATURE(OPENNI2, [openni2 library], openni2, [
2659   PKG_CHECK_MODULES(OPENNI2, libopenni2 >= 0.26, HAVE_OPENNI2="yes", [ HAVE_OPENNI2="no" ] )
2660   AC_SUBST(OPENNI2_CFLAGS)
2661   AC_SUBST(OPENNI2_LIBS)
2662 ])
2663
2664 dnl *** Opus ***
2665 translit(dnm, m, l) AM_CONDITIONAL(USE_OPUS, true)
2666 AG_GST_CHECK_FEATURE(OPUS, [opus], opus, [
2667   PKG_CHECK_MODULES(OPUS, opus >= 0.9.4, [
2668           AC_DEFINE([HAVE_OPUS], 1, [Define if Opus >= 0.9.4 is installed])
2669           HAVE_OPUS="yes"
2670   ], [
2671           HAVE_OPUS="no"
2672   ])
2673   AC_SUBST(OPUS_CFLAGS)
2674   AC_SUBST(OPUS_LIBS)
2675 ])
2676
2677 dnl *** pvr ***
2678 translit(dnm, m, l) AM_CONDITIONAL(USE_PVR, true)
2679 AG_GST_CHECK_FEATURE(PVR, [pvrvideosink], pvr, [
2680   PKG_CHECK_MODULES([PVR], [libtimemmgr], HAVE_PVR=yes, HAVE_PVR=no)
2681   AC_SUBST(PVR_CFLAGS)
2682   AC_SUBST(PVR_LIBS)
2683 ])
2684
2685  AC_ARG_WITH([pvr-external-headers],
2686               AS_HELP_STRING([--with-pvr-external-headers],[Use system installed PVR2D headers]),
2687               [AS_IF([test "x$with_pvr_external_headers" = "xno"],
2688                      [PVR_CFLAGS="$PVR_CFLAGS -I\$(srcdir)/pvr_includes"])],
2689               [PVR_CFLAGS="$PVR_CFLAGS -I\$(srcdir)/pvr_includes"])
2690
2691 dnl *** rsvg ***
2692 translit(dnm, m, l) AM_CONDITIONAL(USE_RSVG, true)
2693 AG_GST_CHECK_FEATURE(RSVG, [rsvg decoder], rsvg, [
2694   PKG_CHECK_MODULES(RSVG, librsvg-2.0 >= 2.36 cairo, [
2695     HAVE_RSVG="yes"
2696     PKG_CHECK_MODULES(RSVG_2_36_2, librsvg-2.0 >= 2.36.2, HAVE_RSVG_2_36_2="yes", HAVE_RSVG_2_36_2="no")
2697     if test "x$HAVE_RSVG_2_36_2" = "xyes"; then
2698       AC_DEFINE(HAVE_RSVG_2_36_2, [1], [Have RSVG 2.36.2 or newer])
2699     fi
2700   ], [
2701     HAVE_RSVG="no"
2702   ])
2703   AC_SUBST(RSVG_CFLAGS)
2704   AC_SUBST(RSVG_LIBS)
2705 ])
2706
2707 dnl *** gl ***
2708 translit(dnm, m, l) AM_CONDITIONAL(USE_GL, true)
2709 AG_GST_CHECK_FEATURE(GL, [gl elements], gl, [
2710   HAVE_GL="no"
2711
2712   if test x"$USE_OPENGL" = x"yes" -o x"$USE_GLES2" = x"yes"; then
2713     HAVE_GL="yes"
2714   fi
2715 ])
2716
2717 dnl *** gtk+ ***
2718 HAVE_GTK3_GL="no"
2719 translit(dnm, m, l) AM_CONDITIONAL(USE_GTK3, true)
2720 AG_GST_CHECK_FEATURE(GTK3, [Gtk+ elements], gtk, [
2721   PKG_CHECK_MODULES(GTK3, gtk+-3.0, [
2722     AC_DEFINE([HAVE_GTK3], 1, [Define if Gtk+ 3.0 is installed])
2723     HAVE_GTK3="yes"
2724   ], [
2725     HAVE_GTK3="no"
2726   ])
2727   PKG_CHECK_MODULES(GTK3_GL, gtk+-3.0 >= 3.15.0, [
2728     GDK_WINDOWING="no"
2729     if test "x$GST_GL_HAVE_WINDOW_X11" = "x1" -a "x$GST_GL_HAVE_PLATFORM_GLX" = "x1"; then
2730       PKG_CHECK_MODULES(GTK3_X11, gtk+-x11-3.0, [
2731         GTK3_CFLAGS="$GTK3_CFLAGS $GTK3_X11_CFLAGS"
2732         GTK3_LIBS="$GTK3_LIBS $GTK3_X11_LIBS"
2733         GDK_WINDOWING="yes"
2734       ], [AC_MSG_NOTICE([Could not find Gtk X11 integration])])
2735     fi
2736     if test "x$GST_GL_HAVE_WINDOW_WAYLAND" = "x1" -a "x$GST_GL_HAVE_PLATFORM_EGL" = "x1"; then
2737       PKG_CHECK_MODULES(GTK3_WAYLAND, gtk+-wayland-3.0, [
2738         GTK3_CFLAGS="$GTK3_CFLAGS $GTK3_WAYLAND_CFLAGS"
2739         GTK3_LIBS="$GTK3_LIBS $GTK3_WAYLAND_LIBS"
2740         GDK_WINDOWING="yes"
2741       ], [AC_MSG_NOTICE([Could not find Gtk Wayland integration])])
2742     fi
2743     if test "x$GDK_WINDOWING" = "xyes"; then
2744       AC_DEFINE([HAVE_GTK3_GL], 1, [Define if Gtk+ 3.0 GL is installed])
2745       HAVE_GTK3_GL="yes"
2746     fi
2747   ], [
2748       HAVE_GTK3_GL="no"
2749   ])
2750 ])
2751 AM_CONDITIONAL(USE_GTK3_GL, test "x$HAVE_GTK3_GL" = "xyes")
2752
2753 dnl *** Qt ***
2754 translit(dnm, m, l) AM_CONDITIONAL(USE_QT, true)
2755 AG_GST_CHECK_FEATURE(QT, [Qt elements], qt, [
2756   PKG_CHECK_MODULES(QT, Qt5Core Qt5Gui Qt5Qml Qt5Quick >= 5.4.0, [
2757       QT_PATH=`$PKG_CONFIG --variable=exec_prefix Qt5Core`
2758       QT_HOST_PATH=`$PKG_CONFIG --variable=host_bins Qt5Core`
2759       AC_PATH_PROGS(MOC, [moc-qt5 moc], moc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
2760       AC_PATH_PROGS(RCC, [rcc-qt5 rcc], rcc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
2761       AC_PATH_PROGS(UIC, [uic-qt5 uic], uic, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
2762       if test "x$MOC" = "x" || test "x$UIC" = "x" || test "x$RCC" = "x"; then
2763         AC_MSG_WARN([One of the required qt build programs was not found])
2764         HAVE_QT="no"
2765       else
2766         HAVE_QT="yes"
2767         HAVE_QT_WINDOWING="no"
2768         if test "x$GST_GL_HAVE_WINDOW_X11" = "x1" -a "x$GST_GL_HAVE_PLATFORM_GLX" = "x1"; then
2769           PKG_CHECK_MODULES(QT_X11, Qt5X11Extras, [
2770             AC_DEFINE([HAVE_QT_X11], [], [Define if Qt X11 integration is installed])
2771             QT_CFLAGS="$QT_CFLAGS $QT_X11_CFLAGS"
2772             QT_LIBS="$QT_LIBS $QT_X11_LIBS"
2773             HAVE_QT_WINDOWING="yes"
2774           ], [AC_MSG_NOTICE([Could not find Qt X11 integration])])
2775         fi
2776         if test "x$GST_GL_HAVE_WINDOW_WAYLAND" = "x1" -a "x$GST_GL_HAVE_PLATFORM_EGL" = "x1"; then
2777           PKG_CHECK_MODULES(QT_WAYLAND, Qt5WaylandClient, [
2778             AC_DEFINE([HAVE_QT_WAYLAND], [],
2779                 [Define if Qt Wayland integration is installed])
2780             QT_CFLAGS="$QT_CFLAGS $QT_WAYLAND_CFLAGS"
2781             QT_LIBS="$QT_LIBS $QT_WAYLAND_LIBS"
2782             HAVE_QT_WINDOWING="yes"
2783           ], [AC_MSG_NOTICE([Could not find Qt Wayland integration])])
2784         fi
2785         if test "x$GST_GL_HAVE_WINDOW_ANDROID" = "x1" -a "x$GST_GL_HAVE_PLATFORM_EGL" = "x1"; then
2786           PKG_CHECK_MODULES(QT_ANDROID, Qt5AndroidExtras, [
2787             # c++ on android requires a standard library and there are multiple
2788             # choices.  cerbero provides a pkg-config file the describes a choice
2789             # so try to use that.  Outside cerbero one has to pass these flags
2790             # manually for the library one is using
2791             PKG_CHECK_MODULES(GNUSTL, gnustl, [
2792               QT_CFLAGS="$QT_CFLAGS $GNUSTL_CFLAGS"
2793               QT_LIBS="$QT_CFLAGS $GNUSTL_LIBS"
2794               ], [
2795               AC_MSG_NOTICE([Could not find Standard C++ library])])
2796
2797             AC_DEFINE([HAVE_QT_ANDROID], [],
2798                 [Define if Qt Android integration is installed])
2799             QT_CFLAGS="$QT_CFLAGS $QT_ANDROID_CFLAGS"
2800             QT_LIBS="$QT_LIBS $QT_ANDROID_LIBS"
2801             HAVE_QT_WINDOWING="yes"
2802           ], [AC_MSG_NOTICE([Could not find Qt Android integration])])
2803         fi
2804         if test "x$GST_GL_HAVE_WINDOW_COCOA" = "x1" -a "x$GST_GL_HAVE_PLATFORM_CGL" = "x1"; then
2805           PKG_CHECK_MODULES(QT_MAC, Qt5MacExtras, [
2806             AC_DEFINE([HAVE_QT_MAC], [],
2807                 [Define if Qt Mac integration is installed])
2808             QT_LIBDIR=`$PKG_CONFIG --variable=libdir Qt5Core`
2809             QT_CFLAGS="$QT_CFLAGS $QT_MAC_CFLAGS -F$QT_LIBDIR -framework QtCore -framework QtGui -framework QtQuick -framework QtQml -framework QtMacExtras"
2810             QT_LIBS="$QT_LIBS $QT_MAC_LIBS"
2811             HAVE_QT_WINDOWING="yes"
2812           ], [AC_MSG_NOTICE([Could not find Qt Mac integration])])
2813         fi
2814         if test "x$GST_GL_HAVE_WINDOW_EAGL" = "x1" -a "x$GST_GL_HAVE_PLATFORM_EAGL" = "x1"; then
2815           if test "x$HAVE_IOS" = "xyes"; then
2816             # iOS doesn't have its own extras package so if we have the core
2817             # modules we are good to go
2818             AC_DEFINE([HAVE_QT_IOS], [],
2819                 [Define if Qt iOS integration is installed])
2820             HAVE_QT_WINDOWING="yes"
2821           fi
2822         fi
2823         if test "x$HAVE_QT_WINDOWING" = "xno"; then
2824           AC_MSG_WARN([Could not find any Qt Windowing integration])
2825           HAVE_QT="no"
2826         fi
2827         AC_SUBST([QT_CFLAGS])
2828         AC_SUBST([QT_LIBS])
2829       fi
2830   ], [
2831       HAVE_QT="no"
2832   ])
2833 ])
2834
2835 dnl *** libvisual ***
2836 translit(dnm, m, l) AM_CONDITIONAL(USE_LIBVISUAL, true)
2837 AG_GST_CHECK_FEATURE(LIBVISUAL, [libvisual visualization library], libvisual, [
2838   AG_GST_PKG_CHECK_MODULES(LIBVISUAL, libvisual-0.4 >= 0.4.0)
2839   if test x$HAVE_LIBVISUAL = xyes; then
2840     LIBVIS_PLUGINSDIR="`$PKG_CONFIG --variable=pluginsbasedir libvisual-0.4`"
2841   fi
2842   AC_MSG_NOTICE([libvisual pluginsdir: $LIBVIS_PLUGINSDIR])
2843   if test x$LIBVIS_PLUGINSDIR != x; then
2844     AC_DEFINE_UNQUOTED(LIBVISUAL_PLUGINSBASEDIR,
2845         "$LIBVIS_PLUGINSDIR",
2846         [directory in which the detected libvisual's plugins are located])
2847   fi
2848 ])
2849
2850 dnl *** timidity ***
2851 translit(dnm, m, l) AM_CONDITIONAL(USE_TIMIDITY, true)
2852 AG_GST_CHECK_FEATURE(TIMIDITY, [timidity midi soft synth plugin], timidity, [
2853   PKG_CHECK_MODULES(TIMIDITY, libtimidity, [
2854     HAVE_TIMIDITY="yes",
2855         AC_MSG_CHECKING([for timidity.cfg])
2856         timidity_cfg=""
2857         if test -r /etc/timidity.cfg; then
2858           timidity_cfg=/etc/timidity.cfg
2859         elif test -r /etc/timidity/timidity.cfg; then
2860           timidity_cfg=/etc/timidity/timidity.cfg
2861         elif test -r /usr/share/timidity/timidity.cfg; then
2862           timidity_cfg=/usr/share/timidity/timidity.cfg
2863         elif test -r /usr/local/share/timidity/timidity.cfg; then
2864           timidity_cfg=/usr/local/share/timidity/timidity.cfg
2865         fi
2866         if test "x$timidity_cfg" != "x"; then
2867           AC_MSG_RESULT($timidity_cfg)
2868       AC_DEFINE_UNQUOTED(TIMIDITY_CFG, "$timidity_cfg", [Define location of timidity.cfg])
2869         else
2870           AC_MSG_RESULT([not found])
2871         fi
2872   ], [
2873     HAVE_TIMIDITY="no"
2874   ])
2875   AC_SUBST(TIMIDITY_CFLAGS)
2876   AC_SUBST(TIMIDITY_LIBS)
2877 ])
2878
2879 dnl *** teletextdec ***
2880 translit(dnm, m, l) AM_CONDITIONAL(USE_TELETEXTDEC, true)
2881 AG_GST_CHECK_FEATURE(TELETEXTDEC, [Teletext decoder], teletextdec, [
2882   AG_GST_PKG_CHECK_MODULES(TELETEXTDEC, zvbi-0.2)
2883  ])
2884
2885 dnl *** wildmidi ***
2886 translit(dnm, m, l) AM_CONDITIONAL(USE_WILDMIDI, true)
2887 AG_GST_CHECK_FEATURE(WILDMIDI, [wildmidi midi soft synth plugin], wildmidi, [
2888   AG_GST_CHECK_LIBHEADER(WILDMIDI, WildMidi,
2889                          WildMidi_Init, ,
2890                          wildmidi_lib.h,
2891                          WILDMIDI_LIBS="-lWildMidi")
2892   AC_CHECK_LIB(WildMidi, WildMidi_LoadSamples, AC_DEFINE(HAVE_WILDMIDI_0_2_2, [1], [Have WildMidi 0.2.2 or earlier library]))
2893
2894   if test "x$HAVE_WILDMIDI" = "xyes"; then
2895          WILDMIDI_CFLAGS=
2896          WILDMIDI_LIBS=-lWildMidi
2897          AC_MSG_NOTICE(compiling gstWildMidi)
2898   else
2899          WILDMIDI_CFLAGS=
2900          WILDMIDI_LIBS=
2901          AC_MSG_WARN(no WildMidi library found (libWildMidi))
2902   fi
2903   AC_SUBST(WILDMIDI_CFLAGS)
2904   AC_SUBST(WILDMIDI_LIBS)
2905 ])
2906
2907 dnl *** SDL ***
2908 translit(dnm, m, l) AM_CONDITIONAL(USE_SDL, true)
2909 AG_GST_CHECK_FEATURE(SDL, [SDL plug-in], sdlvideosink sdlaudiosink, [
2910     AM_PATH_SDL(, HAVE_SDL=yes, HAVE_SDL=no)
2911 ])
2912
2913 dnl **** Smooth Streaming ****
2914 translit(dnm, m, l) AM_CONDITIONAL(USE_SMOOTHSTREAMING, true)
2915 AG_GST_CHECK_FEATURE(SMOOTHSTREAMING, [Smooth Streaming plug-in], smoothstreaming, [
2916   PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= 2.4,
2917     [HAVE_LIBXML2="yes"
2918      HAVE_SMOOTHSTREAMING="yes"],
2919     [HAVE_LIBXML2="no"
2920      HAVE_SMOOTHSTREAMING="no"])
2921   AC_SUBST(LIBXML2_CFLAGS)
2922   AC_SUBST(LIBXML2_LIBS)
2923 ])
2924
2925 dnl *** sndfile ***
2926 translit(dnm, m, l) AM_CONDITIONAL(USE_SNDFILE, true)
2927 AG_GST_CHECK_FEATURE(SNDFILE, [sndfile plug-in], sfdec sfenc, [
2928   PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.16, HAVE_SNDFILE="yes", HAVE_SNDFILE="no")
2929   AC_SUBST(SNDFILE_CFLAGS)
2930   AC_SUBST(SNDFILE_LIBS)
2931 ])
2932
2933 dnl *** soundtouch ***
2934 translit(dnm, m, l) AM_CONDITIONAL(USE_SOUNDTOUCH, true)
2935 AG_GST_CHECK_FEATURE(SOUNDTOUCH, [soundtouch plug-in], soundtouch, [
2936   dnl We only need -lBPM on soundtouch < 1.4
2937   dnl We check for libSoundTouch since Debian used it before upstream
2938   dnl added a pkgconfig file.
2939   HAVE_SOUNDTOUCH_1_4=yes
2940   PKG_CHECK_MODULES(SOUNDTOUCH, soundtouch,
2941     [HAVE_SOUNDTOUCH=yes],
2942     [PKG_CHECK_MODULES(SOUNDTOUCH, soundtouch-1.4,
2943       [HAVE_SOUNDTOUCH=yes],
2944       [PKG_CHECK_MODULES(SOUNDTOUCH, soundtouch-1.0,
2945         [HAVE_SOUNDTOUCH=yes
2946           HAVE_SOUNDTOUCH_1_4=no
2947           SOUNDTOUCH_LIBS="$SOUNDTOUCH_LIBS -lBPM"],
2948         [PKG_CHECK_MODULES(SOUNDTOUCH, libSoundTouch >= 1.4,
2949           [HAVE_SOUNDTOUCH=yes],
2950           [PKG_CHECK_MODULES(SOUNDTOUCH, libSoundTouch,
2951             [HAVE_SOUNDTOUCH=yes
2952               HAVE_SOUNDTOUCH_1_4=no
2953               SOUNDTOUCH_LIBS="$SOUNDTOUCH_LIBS -lBPM"],
2954             HAVE_SOUNDTOUCH=no)])])])])
2955   AC_SUBST(SOUNDTOUCH_CFLAGS)
2956   AC_SUBST(SOUNDTOUCH_LIBS)
2957   if test "x$HAVE_CXX" != "xyes"; then
2958     USE_SOUNDTOUCH=false
2959     AC_MSG_NOTICE([Not building soundtouch plugin: no C++ compiler found])
2960   fi
2961   if test "x$HAVE_SOUNDTOUCH" = "xyes" -a "x$HAVE_SOUNDTOUCH_1_4" = "xyes"; then
2962      AC_DEFINE([HAVE_SOUNDTOUCH_1_4], [1],
2963          [Defined if the available libSoundTouch is >= 1.4])
2964   fi
2965 ])
2966
2967 dnl *** spc ***
2968 translit(dnm, m, l) AM_CONDITIONAL(USE_SPC, true)
2969 AG_GST_CHECK_FEATURE(SPC, [spc decoder], spc, [
2970   AC_CHECK_HEADER(openspc.h, [
2971     AC_CHECK_LIB(openspc, OSPC_Init, [
2972       SPC_LIBS="-lopenspc"
2973       AC_SUBST(SPC_LIBS)
2974       HAVE_SPC=yes
2975     ], [
2976       HAVE_SPC=no
2977     ])
2978   ], [
2979     HAVE_SPC=no
2980   ])
2981 ])
2982
2983 dnl *** gme ***
2984 translit(dnm, m, l) AM_CONDITIONAL(USE_GME, true)
2985 AG_GST_CHECK_FEATURE(GME, [gme decoder], gme, [
2986   AC_CHECK_HEADER(gme/gme.h, [
2987     AC_CHECK_LIB(gme, gme_new_emu, [
2988       GME_LIBS="-lgme"
2989       AC_SUBST(GME_LIBS)
2990       HAVE_GME=yes
2991     ], [
2992       HAVE_GME=no
2993     ])
2994   ], [
2995     HAVE_GME=no
2996   ])
2997
2998   if test "x$HAVE_GME" = "xyes"; then
2999     AC_CHECK_LIB(gme, gme_enable_accuracy, [
3000       AC_DEFINE(HAVE_LIBGME_ACCURACY, 1, [Define if gme 0.5.6 or newer is available])
3001       ])
3002   fi
3003 ])
3004
3005 dnl *** XVID ***
3006 translit(dnm, m, l) AM_CONDITIONAL(USE_XVID, true)
3007 AG_GST_CHECK_FEATURE(XVID, [xvid plugins], xvid, [
3008   HAVE_XVID=no
3009   AC_CHECK_HEADER(xvid.h, [
3010     OLD_LIBS="$LIBS"
3011     LIBS="$PTHREAD_LIBS $LIBM"
3012     AC_CHECK_LIB(xvidcore, xvid_encore, [
3013       AC_CHECK_LIB(xvidcore, xvid_decore, [
3014         AC_CHECK_LIB(xvidcore, xvid_global, [
3015           AC_MSG_CHECKING([for up-to-date XviD API version])
3016           AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <xvid.h>]], [[
3017               #if XVID_API_MAJOR(XVID_API) != 4
3018               #error "Incompatible XviD API version"
3019               #endif
3020               #if XVID_API_MAJOR(XVID_API) == 4 && XVID_API_MINOR(XVID_API) < 3
3021               #error "Incompatible XviD API version"
3022               #endif
3023           ]])],[ AC_MSG_RESULT(yes)
3024             XVID_LIBS="-lxvidcore $LIBM"
3025             AC_SUBST(XVID_LIBS)
3026             HAVE_XVID=yes
3027           ],[AC_MSG_RESULT(no) ])
3028         ], )
3029       ], )
3030     ], )
3031     LIBS="$OLD_LIBS"
3032   ], )
3033 ])
3034
3035 dnl *** dvb ***
3036 translit(dnm, m, l) AM_CONDITIONAL(USE_DVB, true)
3037 AG_GST_CHECK_FEATURE(DVB, [DVB Source], dvb, [
3038   AC_MSG_CHECKING([Checking for up to date dvb installation])
3039   AC_CHECK_HEADER(linux/dvb/version.h, [
3040     AC_MSG_CHECKING([for up-to-date dvb API])
3041     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <linux/dvb/version.h>]], [[
3042         #if DVB_API_VERSION < 5 || (DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR <= 4)
3043         #error "Incompatible dvb API"
3044         #endif
3045     ]])], [ AC_MSG_RESULT(yes)
3046       HAVE_DVB="yes"
3047     ], [ AC_MSG_RESULT(no)
3048       HAVE_DVB="no"
3049     ])
3050   ], [HAVE_DVB="no"])
3051 ])
3052
3053 dnl *** wininet ***
3054 translit(dnm, m, l) AM_CONDITIONAL(USE_WININET, true)
3055 AG_GST_CHECK_FEATURE(WININET, [Windows internet library], wininet, [
3056   AC_MSG_CHECKING([Checking for windows internet support])
3057   AC_CHECK_HEADERS([windows.h wininet.h],
3058       [HAVE_WININET="yes"], [HAVE_WININET="no"],
3059       [AC_INCLUDES_DEFAULT
3060 #include <windows.h>])
3061 ])
3062
3063 dnl *** acm ***
3064 translit(dnm, m, l) AM_CONDITIONAL(USE_ACM, true)
3065 AG_GST_CHECK_FEATURE(ACM, [Windows ACM library], acm, [
3066   AC_MSG_CHECKING([Checking for ACM support])
3067   AC_CHECK_HEADERS([windows.h msacm.h],
3068       [HAVE_ACM="yes"
3069        AC_SUBST(ACMENC_CFLAGS)
3070        AC_SUBST(ACMMP3DEC_CFLAGS)
3071       ], [HAVE_ACM="no"],
3072       [AC_INCLUDES_DEFAULT
3073 #include <windows.h>])
3074 ])
3075
3076 dnl *** vdpau ***
3077 translit(dnm, m, l) AM_CONDITIONAL(USE_VDPAU, true)
3078 AG_GST_CHECK_FEATURE(VDPAU, [VDPAU], vdpau, [
3079   VDPAU_CFLAGS=
3080   VDPAU_LIBS=-lvdpau
3081   HAVE_VDPAU=no
3082
3083   PKG_CHECK_MODULES(VDPAU, vdpau, [HAVE_VDPAU="yes"],
3084   [
3085     if test "$HAVE_VDPAU" = "no"; then
3086       saved_CPPFLAGS="$CPPFLAGS"
3087       AC_CHECK_HEADER([vdpau/vdpau.h], [HAVE_VDPAU_H=yes])
3088
3089       if test -z "$HAVE_VDPAU_H"; then
3090         dnl Didn't find VDPAU header straight away.
3091         dnl Try /usr/include/nvidia. Need to clear caching vars first
3092         AC_MSG_NOTICE([VDPAU header not in standard path. Checking /usr/include/nvidia])
3093         unset ac_cv_header_vdpau_vdpau_h
3094         unset ac_cv_header_vdpau_vdpau_x11_h
3095         VDPAU_CFLAGS="-I/usr/include/nvidia"
3096         VDPAU_LIBS="-L/usr/lib/nvidia -lvdpau"
3097         CPPFLAGS="$VDPAU_CFLAGS $saved_CPPFLAGS"
3098         AC_CHECK_HEADER([vdpau/vdpau.h], [HAVE_VDPAU_H=yes])
3099       fi
3100
3101       AC_CHECK_HEADER([vdpau/vdpau_x11.h], [HAVE_VDPAU_X11_H=yes])
3102
3103       if test "x$HAVE_VDPAU_H" = "xyes" -a "x$HAVE_VDPAU_X11_H" = "xyes"; then
3104         dnl Found the headers - look for the lib
3105         AC_MSG_NOTICE([VDPAU headers found. Checking libraries])
3106         saved_LIBS="$LIBS"
3107         LIBS="$VDPAU_LIBS $saved_LIBS"
3108         AC_CHECK_LIB(vdpau,vdp_device_create_x11,[HAVE_VDPAU="yes"])
3109         LIBS="$saved_LIBS"
3110       fi
3111     fi
3112   ])
3113
3114   if test "$HAVE_VDPAU" = "yes"; then
3115     AC_MSG_NOTICE([Found up to date VDPAU installation])
3116     AC_SUBST(VDPAU_CFLAGS)
3117     AC_SUBST(VDPAU_LIBS)
3118   fi
3119 ])
3120
3121 dnl *** sbc ***
3122 translit(dnm, m, l) AM_CONDITIONAL(USE_SBC, true)
3123 AG_GST_CHECK_FEATURE(SBC, [SBC bluetooth audio codec], sbc, [
3124   AG_GST_PKG_CHECK_MODULES(SBC, [sbc >= 1.0])
3125 ])
3126
3127 dnl *** schroedinger ***
3128 translit(dnm, m, l) AM_CONDITIONAL(USE_SCHRO, true)
3129 AG_GST_CHECK_FEATURE(SCHRO, [Schroedinger video codec], schro, [
3130   AG_GST_PKG_CHECK_MODULES(SCHRO, schroedinger-1.0 >= 1.0.10)
3131 ])
3132
3133 dnl *** zbar ***
3134 translit(dnm, m, l) AM_CONDITIONAL(USE_ZBAR, true)
3135 AG_GST_CHECK_FEATURE(ZBAR, [ZBar barcode detector], zbar, [
3136   AG_GST_PKG_CHECK_MODULES(ZBAR, zbar >= 0.9)
3137 ])
3138
3139 dnl *** rtmp ***
3140 translit(dnm, m, l) AM_CONDITIONAL(USE_RTMP, true)
3141 AG_GST_CHECK_FEATURE(RTMP, [rtmp library], rtmp, [
3142   AG_GST_PKG_CHECK_MODULES(RTMP, librtmp)
3143 ])
3144
3145 dnl *** spandsp ***
3146 translit(dnm, m, l) AM_CONDITIONAL(USE_SPANDSP, true)
3147 AG_GST_CHECK_FEATURE(SPANDSP, [Spandsp], spandsp, [
3148   PKG_CHECK_MODULES(SPANDSP, spandsp >= 0.0.6, [
3149     HAVE_SPANDSP="yes" ], [
3150     HAVE_SPANDSP="no"
3151   ])
3152 ])
3153 AC_SUBST(SPANDSP_CFLAGS)
3154 AC_SUBST(SPANDSP_LIBS)
3155
3156 dnl *** GSettings ***
3157 translit(dnm, m, l) AM_CONDITIONAL(USE_GSETTINGS, true)
3158 AG_GST_CHECK_FEATURE(GSETTINGS, [GSettings plugin], gsettings, [
3159   AG_GST_PKG_CHECK_MODULES(GSETTINGS, gio-2.0 >= 2.25.0)
3160   if test "x$HAVE_GSETTINGS" = "xyes"; then
3161     GLIB_GSETTINGS
3162   fi
3163 ])
3164
3165 dnl *** sndio ***
3166 translit(dnm, m, l) AM_CONDITIONAL(USE_SNDIO, true)
3167 AG_GST_CHECK_FEATURE(SNDIO, [sndio audio], sndio, [
3168   AC_CHECK_HEADER(sndio.h, HAVE_SNDIO="yes", HAVE_SNDIO="no")
3169   if test "x$HAVE_SNDIO" = "xyes"; then
3170     AC_CHECK_LIB(sndio, sio_open, HAVE_SNDIO="yes", HAVE_SNDIO="no")
3171     if test "x$HAVE_SNDIO" = "xyes"; then
3172       SNDIO_LIBS=-lsndio
3173       AC_SUBST(SNDIO_LIBS)
3174     fi
3175   fi
3176 ])
3177
3178 dnl *** hls ***
3179 translit(dnm, m, l) AM_CONDITIONAL(USE_HLS, true)
3180 AG_GST_CHECK_FEATURE(HLS, [http live streaming plugin], hls, [
3181   PKG_CHECK_MODULES(NETTLE, nettle,
3182   [
3183     AC_DEFINE(HAVE_NETTLE, 1, [Define if nettle is available])
3184     HAVE_HLS="yes"
3185   ], [
3186     AM_PATH_LIBGCRYPT([1.2.0],
3187     [
3188       AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define if libgcrypt is available])
3189       HAVE_HLS="yes"
3190     ], [
3191       PKG_CHECK_MODULES(OPENSSL, openssl,
3192       [
3193         AC_DEFINE(HAVE_OPENSSL, 1, [Define if openssl is available])
3194         HAVE_HLS="yes"
3195       ], [
3196         HAVE_HLS="no"
3197       ])
3198     ])
3199   ])
3200 ])
3201
3202 dnl *** x265 (H.265/HEVC encoder) ***
3203 translit(dnm, m, l) AM_CONDITIONAL(USE_X265, true)
3204 AG_GST_CHECK_FEATURE(X265, [x265 plug-in], x265, [
3205   AG_GST_PKG_CHECK_MODULES(X265, x265)
3206 ])
3207
3208 else
3209
3210 dnl not building plugins with external dependencies,
3211 dnl but we still need to set the conditionals
3212
3213 AM_CONDITIONAL(USE_ASSRENDER, false)
3214 AM_CONDITIONAL(USE_VOAMRWBENC, false)
3215 AM_CONDITIONAL(USE_VOAACENC, false)
3216 AM_CONDITIONAL(USE_APEXSINK, false)
3217 AM_CONDITIONAL(USE_BS2B, false)
3218 AM_CONDITIONAL(USE_BZ2, false)
3219 AM_CONDITIONAL(USE_CHROMAPRINT, false)
3220 AM_CONDITIONAL(USE_CURL, false)
3221 AM_CONDITIONAL(USE_SSH2, false)
3222 AM_CONDITIONAL(USE_DASH, false)
3223 AM_CONDITIONAL(USE_DC1394, false)
3224 AM_CONDITIONAL(USE_DECKLINK, false)
3225 AM_CONDITIONAL(DECKLINK_OSX, false)
3226 AM_CONDITIONAL(USE_DIRECTFB, false)
3227 AM_CONDITIONAL(USE_WAYLAND, false)
3228 AM_CONDITIONAL(USE_DAALA, false)
3229 AM_CONDITIONAL(USE_DTS, false)
3230 AM_CONDITIONAL(USE_EXIF, false)
3231 AM_CONDITIONAL(USE_RESINDVD, false)
3232 AM_CONDITIONAL(USE_FAAC, false)
3233 AM_CONDITIONAL(USE_FAAD, false)
3234 AM_CONDITIONAL(USE_FBDEV, false)
3235 AM_CONDITIONAL(USE_FLITE, false)
3236 AM_CONDITIONAL(USE_FLUIDSYNTH, false)
3237 AM_CONDITIONAL(USE_GL, false)
3238 AM_CONDITIONAL(USE_GSM, false)
3239 AM_CONDITIONAL(USE_GTK3, false)
3240 AM_CONDITIONAL(USE_GTK3_GL, false)
3241 AM_CONDITIONAL(USE_HLS, false)
3242 AM_CONDITIONAL(USE_KATE, false)
3243 AM_CONDITIONAL(USE_TIGER, false)
3244 AM_CONDITIONAL(USE_LADSPA, false)
3245 AM_CONDITIONAL(USE_LV2, false)
3246 AM_CONDITIONAL(USE_LIBDE265, false)
3247 AM_CONDITIONAL(USE_LIBMMS, false)
3248 AM_CONDITIONAL(USE_LINSYS, false)
3249 AM_CONDITIONAL(USE_MODPLUG, false)
3250 AM_CONDITIONAL(USE_MIMIC, false)
3251 AM_CONDITIONAL(USE_MPEG2ENC, false)
3252 AM_CONDITIONAL(USE_MPG123, false)
3253 AM_CONDITIONAL(USE_MPLEX, false)
3254 AM_CONDITIONAL(USE_MUSEPACK, false)
3255 AM_CONDITIONAL(USE_NAS, false)
3256 AM_CONDITIONAL(USE_NEON, false)
3257 AM_CONDITIONAL(USE_OFA, false)
3258 AM_CONDITIONAL(USE_OPENAL, false)
3259 AM_CONDITIONAL(USE_OPENCV, false)
3260 AM_CONDITIONAL(USE_OPENEXR, false)
3261 AM_CONDITIONAL(USE_OPENJPEG, false)
3262 AM_CONDITIONAL(USE_OPENNI2, false)
3263 AM_CONDITIONAL(USE_OPUS, false)
3264 AM_CONDITIONAL(USE_PVR, false)
3265 AM_CONDITIONAL(USE_QT, false)
3266 AM_CONDITIONAL(USE_LIBVISUAL, false)
3267 AM_CONDITIONAL(USE_TIMIDITY, false)
3268 AM_CONDITIONAL(USE_WILDMIDI, false)
3269 AM_CONDITIONAL(USE_SDL, false)
3270 AM_CONDITIONAL(USE_SMOOTHSTREAMING, false)
3271 AM_CONDITIONAL(USE_SNDFILE, false)
3272 AM_CONDITIONAL(USE_SOUNDTOUCH, false)
3273 AM_CONDITIONAL(USE_SPANDSP, false)
3274 AM_CONDITIONAL(USE_SPC, false)
3275 AM_CONDITIONAL(USE_SRTP, false)
3276 AM_CONDITIONAL(USE_GME, false)
3277 AM_CONDITIONAL(USE_GSETTINGS, false)
3278 AM_CONDITIONAL(USE_XVID, false)
3279 AM_CONDITIONAL(USE_DVB, false)
3280 AM_CONDITIONAL(USE_WININET, false)
3281 AM_CONDITIONAL(USE_ACM, false)
3282 AM_CONDITIONAL(USE_VDPAU, false)
3283 AM_CONDITIONAL(USE_SBC, false)
3284 AM_CONDITIONAL(USE_SCHRO, false)
3285 AM_CONDITIONAL(USE_ZBAR, false)
3286 AM_CONDITIONAL(USE_RSVG, false)
3287 AM_CONDITIONAL(USE_RTMP, false)
3288 AM_CONDITIONAL(USE_TELETEXTDEC, false)
3289 AM_CONDITIONAL(USE_SNDIO, false)
3290 AM_CONDITIONAL(USE_UVCH264, false)
3291 AM_CONDITIONAL(USE_WEBP, false)
3292 AM_CONDITIONAL(USE_OPENH264, false)
3293 AM_CONDITIONAL(USE_X265, false)
3294 AM_CONDITIONAL(USE_DTLS, false)
3295
3296 fi dnl of EXT plugins
3297
3298 dnl *** finalize CFLAGS, LDFLAGS, LIBS
3299
3300 dnl Overview:
3301 dnl GST_OPTION_CFLAGS:  common flags for profiling, debugging, errors, ...
3302 dnl GST_*:              flags shared by built objects to link against GStreamer
3303 dnl GST_ALL_LDFLAGS:    linker flags shared by all
3304 dnl GST_LIB_LDFLAGS:    additional linker flags for all libaries
3305 dnl GST_LT_LDFLAGS:     library versioning of our libraries
3306 dnl GST_PLUGIN_LDFLAGS: flags to be used for all plugins
3307
3308 dnl GST_OPTION_CFLAGS
3309 if test "x$USE_DEBUG" = xyes; then
3310    PROFILE_CFLAGS="-g"
3311 fi
3312 AC_SUBST(PROFILE_CFLAGS)
3313
3314 if test "x$PACKAGE_VERSION_NANO" = "x1"; then
3315   dnl Define _only_ during CVS (not pre-releases or releases)
3316   DEPRECATED_CFLAGS="-DGST_DISABLE_DEPRECATED"
3317 else
3318   DEPRECATED_CFLAGS=""
3319 fi
3320 AC_SUBST(DEPRECATED_CFLAGS)
3321
3322 dnl every flag in GST_OPTION_CFLAGS and GST_OPTION_CXXFLAGS can be overridden
3323 dnl at make time with e.g. make ERROR_CFLAGS=""
3324 GST_OPTION_CFLAGS="\$(WARNING_CFLAGS) \$(ERROR_CFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
3325 GST_OPTION_CXXFLAGS="\$(WARNING_CXXFLAGS) \$(ERROR_CXXFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
3326 GST_OPTION_OBJCFLAGS="\$(WARNING_OBJCFLAGS) \$(ERROR_OBJCFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
3327 AC_SUBST(GST_OPTION_CFLAGS)
3328 AC_SUBST(GST_OPTION_CXXFLAGS)
3329 AC_SUBST(GST_OPTION_OBJCFLAGS)
3330
3331 dnl FIXME: do we want to rename to GST_ALL_* ?
3332 dnl prefer internal headers to already installed ones
3333 dnl also add builddir include for enumtypes and marshal
3334 dnl add GST_OPTION_CFLAGS, but overridable
3335 GST_CFLAGS="$GST_CFLAGS -DGST_USE_UNSTABLE_API"
3336 GST_CXXFLAGS="$GST_CFLAGS $GLIB_EXTRA_CFLAGS \$(GST_OPTION_CXXFLAGS)"
3337 GST_OBJCFLAGS="$GST_CFLAGS $GLIB_EXTRA_CFLAGS \$(GST_OPTION_OBJCFLAGS)"
3338 GST_CFLAGS="$GST_CFLAGS $GLIB_EXTRA_CFLAGS \$(GST_OPTION_CFLAGS)"
3339 AC_SUBST(GST_CFLAGS)
3340 AC_SUBST(GST_CXXFLAGS)
3341 AC_SUBST(GST_OBJCFLAGS)
3342 AC_SUBST(GST_LIBS)
3343 GST_PLUGINS_BAD_CXXFLAGS="-I\$(top_srcdir)/gst-libs -I\$(top_builddir)/gst-libs"
3344 GST_PLUGINS_BAD_OBJCFLAGS="-I\$(top_srcdir)/gst-libs -I\$(top_builddir)/gst-libs"
3345 GST_PLUGINS_BAD_CFLAGS="-I\$(top_srcdir)/gst-libs -I\$(top_builddir)/gst-libs"
3346 AC_SUBST(GST_PLUGINS_BAD_CFLAGS)
3347 AC_SUBST(GST_PLUGINS_BAD_CXXFLAGS)
3348 AC_SUBST(GST_PLUGINS_BAD_OBJCFLAGS)
3349
3350 dnl LDFLAGS really should only contain flags, not libs - they get added before
3351 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
3352 GST_ALL_LDFLAGS="-no-undefined"
3353 AC_SUBST(GST_ALL_LDFLAGS)
3354
3355 dnl GST_LIB_LDFLAGS
3356 dnl linker flags shared by all libraries
3357 dnl LDFLAGS modifier defining exported symbols from built libraries
3358 dnl (export _gst_foo but not __gst_foo)
3359 GST_LIB_LDFLAGS="-export-symbols-regex ^_?\(gst_\|Gst\|GST_\).*"
3360 AC_SUBST(GST_LIB_LDFLAGS)
3361
3362 dnl this really should only contain flags, not libs - they get added before
3363 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
3364 GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^[_]*gst_plugin_.*' $GST_ALL_LDFLAGS"
3365 AC_SUBST(GST_PLUGIN_LDFLAGS)
3366
3367 dnl *** output files ***
3368
3369 $MKDIR_P tests/check/orc
3370
3371 dnl po/Makefile.in
3372
3373 AC_CONFIG_FILES(
3374 Makefile
3375 common/Makefile
3376 common/m4/Makefile
3377 gst-plugins-bad.spec
3378 gst/Makefile
3379 gst/accurip/Makefile
3380 gst/adpcmdec/Makefile
3381 gst/adpcmenc/Makefile
3382 gst/aiff/Makefile
3383 gst/asfmux/Makefile
3384 gst/audiofxbad/Makefile
3385 gst/audiomixer/Makefile
3386 gst/audiovisualizers/Makefile
3387 gst/autoconvert/Makefile
3388 gst/bayer/Makefile
3389 gst/camerabin2/Makefile
3390 gst/cdxaparse/Makefile
3391 gst/coloreffects/Makefile
3392 gst/dataurisrc/Makefile
3393 gst/dccp/Makefile
3394 gst/debugutils/Makefile
3395 gst/dvbsuboverlay/Makefile
3396 gst/dvdspu/Makefile
3397 gst/faceoverlay/Makefile
3398 gst/festival/Makefile
3399 gst/fieldanalysis/Makefile
3400 gst/freeverb/Makefile
3401 gst/frei0r/Makefile
3402 gst/gaudieffects/Makefile
3403 gst/geometrictransform/Makefile
3404 gst/gdp/Makefile
3405 gst/hdvparse/Makefile
3406 gst/id3tag/Makefile
3407 gst/inter/Makefile
3408 gst/interlace/Makefile
3409 gst/ivfparse/Makefile
3410 gst/ivtc/Makefile
3411 gst/jp2kdecimator/Makefile
3412 gst/jpegformat/Makefile
3413 gst/librfb/Makefile
3414 gst/liveadder/Makefile
3415 gst/midi/Makefile
3416 gst/mpegdemux/Makefile
3417 gst/mpegtsdemux/Makefile
3418 gst/mpegtsmux/Makefile
3419 gst/mpegtsmux/tsmux/Makefile
3420 gst/mpegpsmux/Makefile
3421 gst/mve/Makefile
3422 gst/mxf/Makefile
3423 gst/nuvdemux/Makefile
3424 gst/onvif/Makefile
3425 gst/patchdetect/Makefile
3426 gst/pcapparse/Makefile
3427 gst/pnm/Makefile
3428 gst/rawparse/Makefile
3429 gst/removesilence/Makefile
3430 gst/rtp/Makefile
3431 gst/sdi/Makefile
3432 gst/sdp/Makefile
3433 gst/segmentclip/Makefile
3434 gst/siren/Makefile
3435 gst/smooth/Makefile
3436 gst/speed/Makefile
3437 gst/subenc/Makefile
3438 gst/stereo/Makefile
3439 gst/tta/Makefile
3440 gst/videofilters/Makefile
3441 gst/videomeasure/Makefile
3442 gst/videoparsers/Makefile
3443 gst/videosignal/Makefile
3444 gst/vmnc/Makefile
3445 gst/y4m/Makefile
3446 gst/yadif/Makefile
3447 gst/compositor/Makefile
3448 gst-libs/Makefile
3449 gst-libs/gst/Makefile
3450 gst-libs/gst/adaptivedemux/Makefile
3451 gst-libs/gst/basecamerabinsrc/Makefile
3452 gst-libs/gst/gl/Makefile
3453 gst-libs/gst/gl/android/Makefile
3454 gst-libs/gst/gl/cocoa/Makefile
3455 gst-libs/gst/gl/dispmanx/Makefile
3456 gst-libs/gst/gl/glprototypes/Makefile
3457 gst-libs/gst/gl/eagl/Makefile
3458 gst-libs/gst/gl/egl/Makefile
3459 gst-libs/gst/gl/wayland/Makefile
3460 gst-libs/gst/gl/win32/Makefile
3461 gst-libs/gst/gl/x11/Makefile
3462 gst-libs/gst/insertbin/Makefile
3463 gst-libs/gst/interfaces/Makefile
3464 gst-libs/gst/codecparsers/Makefile
3465 gst-libs/gst/mpegts/Makefile
3466 gst-libs/gst/uridownloader/Makefile
3467 gst-libs/gst/wayland/Makefile
3468 gst-libs/gst/base/Makefile
3469 gst-libs/gst/video/Makefile
3470 sys/Makefile
3471 sys/dshowdecwrapper/Makefile
3472 sys/acmenc/Makefile
3473 sys/acmmp3dec/Makefile
3474 sys/androidmedia/Makefile
3475 sys/applemedia/Makefile
3476 sys/applemedia-nonpublic/Makefile
3477 sys/avc/Makefile
3478 sys/bluez/Makefile
3479 sys/d3dvideosink/Makefile
3480 sys/decklink/Makefile
3481 sys/directsound/Makefile
3482 sys/dshowsrcwrapper/Makefile
3483 sys/dshowvideosink/Makefile
3484 sys/dvb/Makefile
3485 sys/fbdev/Makefile
3486 sys/linsys/Makefile
3487 sys/nvenc/Makefile
3488 sys/opensles/Makefile
3489 sys/shm/Makefile
3490 sys/uvch264/Makefile
3491 sys/vcd/Makefile
3492 sys/vdpau/Makefile
3493 sys/pvr2d/Makefile
3494 sys/wasapi/Makefile
3495 sys/wininet/Makefile
3496 sys/winks/Makefile
3497 sys/winscreencap/Makefile
3498 tests/Makefile
3499 tests/check/Makefile
3500 tests/files/Makefile
3501 tests/examples/Makefile
3502 tests/examples/avsamplesink/Makefile
3503 tests/examples/camerabin2/Makefile
3504 tests/examples/codecparsers/Makefile
3505 tests/examples/directfb/Makefile
3506 tests/examples/gl/Makefile
3507 tests/examples/gl/cocoa/Makefile
3508 tests/examples/gl/clutter/Makefile
3509 tests/examples/gl/generic/Makefile
3510 tests/examples/gl/generic/cube/Makefile
3511 tests/examples/gl/generic/cubeyuv/Makefile
3512 tests/examples/gl/generic/doublecube/Makefile
3513 tests/examples/gl/generic/recordgraphic/Makefile
3514 tests/examples/gl/gtk/Makefile
3515 tests/examples/gl/gtk/gtkvideooverlay/Makefile
3516 tests/examples/gl/gtk/3dvideo/Makefile
3517 tests/examples/gl/gtk/filternovideooverlay/Makefile
3518 tests/examples/gl/gtk/filtervideooverlay/Makefile
3519 tests/examples/gl/gtk/fxtest/Makefile
3520 tests/examples/gl/gtk/switchvideooverlay/Makefile
3521 tests/examples/gl/qt/Makefile
3522 tests/examples/gl/sdl/Makefile
3523 tests/examples/gtk/Makefile
3524 tests/examples/mpegts/Makefile
3525 tests/examples/mxf/Makefile
3526 tests/examples/opencv/Makefile
3527 tests/examples/uvch264/Makefile
3528 tests/icles/Makefile
3529 ext/voamrwbenc/Makefile
3530 ext/voaacenc/Makefile
3531 ext/assrender/Makefile
3532 ext/apexsink/Makefile
3533 ext/bs2b/Makefile
3534 ext/bz2/Makefile
3535 ext/chromaprint/Makefile
3536 ext/curl/Makefile
3537 ext/dash/Makefile
3538 ext/dc1394/Makefile
3539 ext/directfb/Makefile
3540 ext/wayland/Makefile
3541 ext/daala/Makefile
3542 ext/dts/Makefile
3543 ext/gl/Makefile
3544 ext/gtk/Makefile
3545 ext/faac/Makefile
3546 ext/faad/Makefile
3547 ext/flite/Makefile
3548 ext/fluidsynth/Makefile
3549 ext/gsm/Makefile
3550 ext/hls/Makefile
3551 ext/kate/Makefile
3552 ext/ladspa/Makefile
3553 ext/lv2/Makefile
3554 ext/libde265/Makefile
3555 ext/libmms/Makefile
3556 ext/libvisual/Makefile
3557 ext/Makefile
3558 ext/modplug/Makefile
3559 ext/mpeg2enc/Makefile
3560 ext/mpg123/Makefile
3561 ext/mimic/Makefile
3562 ext/mplex/Makefile
3563 ext/musepack/Makefile
3564 ext/nas/Makefile
3565 ext/neon/Makefile
3566 ext/ofa/Makefile
3567 ext/openal/Makefile
3568 ext/opencv/Makefile
3569 ext/openexr/Makefile
3570 ext/openh264/Makefile
3571 ext/openjpeg/Makefile
3572 ext/openni2/Makefile
3573 ext/opus/Makefile
3574 ext/qt/Makefile
3575 ext/rsvg/Makefile
3576 ext/resindvd/Makefile
3577 ext/rtmp/Makefile
3578 ext/sbc/Makefile
3579 ext/schroedinger/Makefile
3580 ext/sdl/Makefile
3581 ext/smoothstreaming/Makefile
3582 ext/sndfile/Makefile
3583 ext/soundtouch/Makefile
3584 ext/spandsp/Makefile
3585 ext/sndio/Makefile
3586 ext/srtp/Makefile
3587 ext/teletextdec/Makefile
3588 ext/gme/Makefile
3589 ext/gsettings/Makefile
3590 ext/gsettings/org.freedesktop.gstreamer.default-elements.gschema.xml
3591 ext/spc/Makefile
3592 ext/timidity/Makefile
3593 ext/webp/Makefile
3594 ext/x265/Makefile
3595 ext/xvid/Makefile
3596 ext/zbar/Makefile
3597 ext/dtls/Makefile
3598 po/Makefile.in
3599 docs/Makefile
3600 docs/plugins/Makefile
3601 docs/libs/Makefile
3602 docs/version.entities
3603 pkgconfig/Makefile
3604 pkgconfig/gstreamer-plugins-bad.pc
3605 pkgconfig/gstreamer-plugins-bad-uninstalled.pc
3606 pkgconfig/gstreamer-codecparsers.pc
3607 pkgconfig/gstreamer-codecparsers-uninstalled.pc
3608 pkgconfig/gstreamer-insertbin.pc
3609 pkgconfig/gstreamer-insertbin-uninstalled.pc
3610 pkgconfig/gstreamer-gl.pc
3611 pkgconfig/gstreamer-gl-uninstalled.pc
3612 pkgconfig/gstreamer-mpegts.pc
3613 pkgconfig/gstreamer-mpegts-uninstalled.pc
3614 pkgconfig/gstreamer-wayland.pc
3615 pkgconfig/gstreamer-wayland-uninstalled.pc
3616 pkgconfig/gstreamer-bad-base.pc
3617 pkgconfig/gstreamer-bad-base-uninstalled.pc
3618 pkgconfig/gstreamer-bad-video.pc
3619 pkgconfig/gstreamer-bad-video-uninstalled.pc
3620 tools/Makefile
3621 m4/Makefile
3622 )
3623
3624 dnl Create the config.h file for Visual Studio builds
3625 dnl Beware of spaces and /'s in some of the shell variable contents.
3626 sed \
3627     -e 's/.*config.h.in.*autoheader.*/\/* Autogenerated config.h created for win32 Visual Studio builds *\/\n\n\/* PREFIX -- specifically added for Windows for easier moving *\/\n#define PREFIX "C:\\\\gstreamer"/' \
3628     -e 's/.* GETTEXT_PACKAGE$/#define GETTEXT_PACKAGE "'$GETTEXT_PACKAGE'"/' \
3629     -e 's/.* GST_DATADIR$/#define GST_DATADIR PREFIX "\\\\share"/' \
3630     -e 's/.* GST_LEVEL_DEFAULT$/#define GST_LEVEL_DEFAULT GST_LEVEL_ERROR/' \
3631     -e 's/.* GST_LICENSE$/#define GST_LICENSE "'$GST_LICENSE'"/' \
3632     -e 's/.* GST_API_VERSION$/#define GST_API_VERSION "'$GST_API_VERSION'"/' \
3633     -e "s,.* GST_PACKAGE_NAME$,#define GST_PACKAGE_NAME \"${GST_PACKAGE_NAME}\"," \
3634     -e 's/.* GST_PACKAGE_ORIGIN$/#define GST_PACKAGE_ORIGIN "Unknown package origin"/' \
3635     -e "s,.* GST_PACKAGE_RELEASE_DATETIME$,#define GST_PACKAGE_RELEASE_DATETIME \"${GST_PACKAGE_RELEASE_DATETIME}\"," \
3636     -e 's/.* HAVE_CPU_I386$/#define HAVE_CPU_I386 1/' \
3637     -e 's/.* HAVE_STDLIB_H$/#define HAVE_STDLIB_H 1/' \
3638     -e 's/.* HAVE_STRING_H$/#define HAVE_STRING_H 1/' \
3639     -e 's/.* HAVE_SYS_STAT_H$/#define HAVE_SYS_STAT_H 1/' \
3640     -e 's/.* HAVE_SYS_TYPES_H$/#define HAVE_SYS_TYPES_H 1/' \
3641     -e 's/.* HAVE_WIN32$/#define HAVE_WIN32 1/' \
3642     -e 's/.* HOST_CPU$/#define HOST_CPU "i686"/' \
3643     -e 's/.* LIBDIR$/#ifdef _DEBUG\n#  define LIBDIR PREFIX "\\\\debug\\\\lib"\n#else\n#  define LIBDIR PREFIX "\\\\lib"\n#endif/' \
3644     -e 's/.* LOCALEDIR$/#define LOCALEDIR PREFIX "\\\\share\\\\locale"/' \
3645     -e "s/.* PACKAGE$/#define PACKAGE \"$PACKAGE\"/" \
3646     -e 's/.* PACKAGE_BUGREPORT$/#define PACKAGE_BUGREPORT "http:\/\/bugzilla.gnome.org\/enter_bug.cgi?product=GStreamer"/' \
3647     -e "s/.* PACKAGE_NAME$/#define PACKAGE_NAME \"$PACKAGE_NAME\"/" \
3648     -e "s/.* PACKAGE_STRING$/#define PACKAGE_STRING \"$PACKAGE_STRING\"/" \
3649     -e 's/.* PACKAGE_TARNAME$/#define PACKAGE_TARNAME "'$PACKAGE_TARNAME'"/' \
3650     -e 's/.* PACKAGE_VERSION$/#define PACKAGE_VERSION "'$PACKAGE_VERSION'"/' \
3651     -e 's/.* PLUGINDIR$/#ifdef _DEBUG\n#  define PLUGINDIR PREFIX "\\\\debug\\\\lib\\\\gstreamer-0.11"\n#else\n#  define PLUGINDIR PREFIX "\\\\lib\\\\gstreamer-0.11"\n#endif/' \
3652     -e 's/.* VERSION$/#define VERSION "'$VERSION'"/' \
3653     -e "s/.* DEFAULT_AUDIOSINK$/#define DEFAULT_AUDIOSINK \"directsoundsink\"/" \
3654     -e "s/.* DEFAULT_AUDIOSRC$/#define DEFAULT_AUDIOSRC \"audiotestsrc\"/" \
3655     -e "s/.* DEFAULT_VIDEOSRC$/#define DEFAULT_VIDEOSRC \"videotestsrc\"/" \
3656     -e "s/.* DEFAULT_VISUALIZER$/#define DEFAULT_VISUALIZER \"goom\"/" \
3657     -e 's/.* HAVE_WINDOWS_H$/#define HAVE_WINDOWS_H 1/' \
3658     -e 's/.* HAVE_WININET_H$/#define HAVE_WININET_H 1/' \
3659     -e 's/.* HAVE_WINSOCK2_H$/#define HAVE_WINSOCK2_H 1/' \
3660     -e 's/.* HAVE_WS2TCPIP_H$/#define HAVE_WS2TCPIP_H 1/' \
3661     config.h.in >win32/common/config.h-new
3662
3663 AC_OUTPUT
3664
3665 AG_GST_OUTPUT_PLUGINS
3666 ORC_OUTPUT
3667