configure.ac 111 KB
Newer Older
1
AC_PREREQ([2.69])
2

3 4
dnl initialize autoconf
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
Sebastian Dröge's avatar
Sebastian Dröge committed
6
AC_INIT([GStreamer Bad Plug-ins],[1.11.1],[http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer],[gst-plugins-bad])
7

8 9
AG_GST_INIT

10
dnl initialize automake
11
AM_INIT_AUTOMAKE([-Wno-portability 1.14 no-dist-gzip dist-xz tar-ustar subdir-objects])
12 13 14 15 16

dnl define PACKAGE_VERSION_* variables
AS_VERSION

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 ?
Jan Schmidt's avatar
Jan Schmidt committed
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 29
dnl sets host_* variables
AC_CANONICAL_HOST
30

31 32 33 34 35
dnl use pretty build output with automake >= 1.11
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],
  [AM_DEFAULT_VERBOSITY=1
   AC_SUBST(AM_DEFAULT_VERBOSITY)])

36 37 38
dnl PKG_CONFIG_SYSROOT_DIR is a valid environment variable
m4_pattern_allow(PKG_CONFIG_SYSROOT_DIR)

39 40 41 42 43 44
dnl our libraries and install dirs use GST_API_VERSION in the filename
dnl to allow side-by-side installation of different API versions
GST_API_VERSION=1.0
AC_SUBST(GST_API_VERSION)
AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION",
  [GStreamer API Version])
45

46 47
AG_GST_LIBTOOL_PREPARE

48 49 50 51 52 53
dnl CURRENT, REVISION, AGE
dnl - library source changed -> increment REVISION
dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
dnl - interfaces added -> increment AGE
dnl - interfaces removed -> AGE = 0
dnl sets GST_LT_LDFLAGS
Sebastian Dröge's avatar
Sebastian Dröge committed
54
AS_LIBTOOL(GST, 1101, 0, 1101)
55

56
dnl *** required versions of GStreamer stuff ***
Sebastian Dröge's avatar
Sebastian Dröge committed
57 58
GST_REQ=1.11.1
GSTPB_REQ=1.11.1
59

60
dnl *** autotools stuff ****
61

62 63 64 65 66
dnl allow for different autotools
AS_AUTOTOOLS_ALTERNATE

dnl Add parameters for aclocal
AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I common/m4")
67

Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
68 69
dnl set up gettext
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
AG_GST_ARG_ENABLE_EXTRA_CHECKS
78

79 80 81 82
AG_GST_ARG_DEBUG
AG_GST_ARG_PROFILING
AG_GST_ARG_VALGRIND
AG_GST_ARG_GCOV
83

84
AG_GST_ARG_EXAMPLES
85

86 87 88
AG_GST_ARG_WITH_PKG_CONFIG_PATH
AG_GST_ARG_WITH_PACKAGE_NAME
AG_GST_ARG_WITH_PACKAGE_ORIGIN
89

90
AG_GST_ARG_WITH_PLUGINS
91

92
AG_GST_ARG_ENABLE_EXTERNAL
93

94
AG_GST_ARG_ENABLE_EXPERIMENTAL
95

96 97
AG_GST_PKG_CONFIG_PATH

98
dnl *** checks for platform ***
99
AG_GST_PLATFORM
100

101
dnl * hardware/architecture *
102

103 104
dnl common/m4/gst-arch.m4
dnl check CPU type
105
AG_GST_ARCH
106

107 108
dnl Determine endianness
AC_C_BIGENDIAN
109

110
dnl *** checks for programs ***
111

112 113
dnl find a compiler
AC_PROG_CC
114
AC_PROG_CC_STDC
115

116 117 118 119 120
dnl determine c++ compiler
AC_PROG_CXX
dnl determine if c++ is available on this system
AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)

121
AC_PROG_OBJC
122

123 124 125
dnl check if the compiler supports '-c' and '-o' options
AM_PROG_CC_C_O

126 127 128
dnl check if the compiler supports do while(0) macros
AG_GST_CHECK_DOWHILE_MACROS

129 130
AC_PATH_PROG(VALGRIND_PATH, valgrind, no)
AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")
131

132 133 134
dnl check for gobject-introspection
GOBJECT_INTROSPECTION_CHECK([1.31.1])

135
dnl check for documentation tools
136
GTK_DOC_CHECK([1.12])
137
AG_GST_PLUGIN_DOCS([1.12])
138

139
dnl *** checks for libraries ***
140

141
dnl check for libm, for sin() etc.
142
LT_LIB_M
143 144
AC_SUBST(LIBM)

145 146
AC_FUNC_MMAP

147
dnl check for pthreads
148
AX_PTHREAD
149

150
dnl *** checks for header files ***
151

152 153 154 155 156 157 158
AC_CHECK_HEADERS([unistd.h], HAVE_UNISTD_H=yes)
AM_CONDITIONAL(HAVE_UNISTD_H, test "x$HAVE_UNISTD_H" = "xyes")

if test "x$HAVE_UNISTD_H" != "xyes"; then
  GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | $SED -e s/festival//`
fi

159 160
AC_CHECK_HEADERS([sys/time.h])

161 162 163
dnl used by ext/dts
AX_CREATE_STDINT_H

164 165 166
AC_CHECK_HEADERS([pthread.h], HAVE_PTHREAD_H=yes)
AM_CONDITIONAL(HAVE_PTHREAD_H, test "x$HAVE_PTHREAD_H" = "xyes")

167
dnl *** checks for types/defines ***
168

169
dnl *** checks for structures ***
170

171
dnl *** checks for compiler characteristics ***
172

173
dnl *** checks for library functions ***
Sebastian Dröge's avatar
Sebastian Dröge committed
174 175 176 177
AC_CHECK_FUNCS([gmtime_r])

dnl *** checks for headers ***
AC_CHECK_HEADERS([sys/utsname.h])
178

179
dnl *** checks for dependency libraries ***
David Schleef's avatar
David Schleef committed
180

181 182 183 184
dnl *** checks for socket and nsl libraries ***
AC_CHECK_FUNC(socket,,[AC_CHECK_LIB(socket,socket)])
AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])

185
dnl GLib is required
186
GLIB_REQ=2.40.0
187 188
AG_GST_GLIB_CHECK([$GLIB_REQ])

189 190
dnl checks for gstreamer
dnl uninstalled is selected preferentially -- see pkg-config(1)
191 192 193 194
AG_GST_CHECK_GST($GST_API_VERSION, [$GST_REQ], yes)
AG_GST_CHECK_GST_BASE($GST_API_VERSION, [$GST_REQ], yes)
AG_GST_CHECK_GST_CHECK($GST_API_VERSION, [$GST_REQ], no)
AG_GST_CHECK_GST_CONTROLLER($GST_API_VERSION, [$GST_REQ], yes)
195
AG_GST_CHECK_GST_NET($GST_API_VERSION, [$GST_REQ], yes)
196 197 198 199
AG_GST_PKG_CHECK_MODULES(GST_VIDEO, gstreamer-video-[$GST_API_VERSION], [$GST_REQ], yes)
AG_GST_PKG_CHECK_MODULES(GST_AUDIO, gstreamer-audio-[$GST_API_VERSION], [$GST_REQ], yes)
AG_GST_PKG_CHECK_MODULES(GST_PBUTILS, gstreamer-pbutils-[$GST_API_VERSION], [$GST_REQ], yes)

200 201
AM_CONDITIONAL(HAVE_GST_CHECK, test "x$HAVE_GST_CHECK" = "xyes")

202
AG_GST_CHECK_GST_PLUGINS_BASE($GST_API_VERSION, [$GSTPB_REQ], yes)
203 204

dnl check for uninstalled plugin directories for unit tests
205
AG_GST_CHECK_UNINSTALLED_SETUP([
206 207
  AG_GST_CHECK_GST_PLUGINS_GOOD($GST_API_VERSION, [0.11.0])
  AG_GST_CHECK_GST_PLUGINS_UGLY($GST_API_VERSION, [0.11.0])
208
  AG_GST_CHECK_GST_PLUGINS_LIBAV($GST_API_VERSION, [0.11.0])
209
])
210

211 212
dnl Check for documentation xrefs
GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
213 214
GST_PREFIX="`$PKG_CONFIG --variable=prefix gstreamer-$GST_API_VERSION`"
GSTPB_PREFIX="`$PKG_CONFIG --variable=prefix gstreamer-plugins-base-$GST_API_VERSION`"
215 216 217 218
AC_SUBST(GLIB_PREFIX)
AC_SUBST(GST_PREFIX)
AC_SUBST(GSTPB_PREFIX)

219 220
dnl GTK is optional and used in examples
HAVE_GTK=NO
221 222
GTK2_REQ=2.14.0
GTK3_REQ=2.91.3
223 224 225
if test "x$BUILD_EXAMPLES" = "xyes"; then
  AC_MSG_CHECKING([which gtk+ version to compile examples against (optional)])
  AC_ARG_WITH([gtk],
226
    AS_HELP_STRING([--with-gtk=3.0|2.0],[which gtk+ version to compile against (default: 2.0)]),
227
    [case "$with_gtk" in
228 229
        2.0) GTK_REQ=$GTK2_REQ ;;
        3.0) GTK_REQ=$GTK3_REQ ;;
230 231
        *) AC_MSG_ERROR([invalid gtk+ version specified]);;
    esac],
232 233 234 235 236 237
    [with_gtk=2.0
     GTK_REQ=$GTK2_REQ])
  AC_MSG_RESULT([$with_gtk (>= $GTK_REQ)])
  PKG_CHECK_MODULES(GTK, gtk+-x11-$with_gtk >= $GTK_REQ, HAVE_GTK=yes, HAVE_GTK=no)
  AC_SUBST(GTK_LIBS)
  AC_SUBST(GTK_CFLAGS)
238
fi
239
AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
240

241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
dnl Check for -Bsymbolic-functions linker flag used to avoid
dnl intra-library PLT jumps, if available.
AC_ARG_ENABLE(Bsymbolic,
              [AS_HELP_STRING([--disable-Bsymbolic],[avoid linking with -Bsymbolic])],,
              [SAVED_LDFLAGS="${LDFLAGS}" SAVED_LIBS="${LIBS}"
               AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
               LDFLAGS=-Wl,-Bsymbolic-functions
               LIBS=
               AC_TRY_LINK([], [return 0],
                           AC_MSG_RESULT(yes)
                           enable_Bsymbolic=yes,
                           AC_MSG_RESULT(no)
                           enable_Bsymbolic=no)
               LDFLAGS="${SAVED_LDFLAGS}" LIBS="${SAVED_LIBS}"])

dnl *** set variables based on configure arguments ***
257

258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
dnl GTK is optional and used in examples
HAVE_GTK3=NO
if test "x$BUILD_EXAMPLES" = "xyes"; then
  PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.4, HAVE_GTK3=yes, HAVE_GTK3=no)
  if test "x$HAVE_GTK3" = "xyes"; then
    HAVE_GTK=yes
    GTK_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`
    AC_SUBST(GTK_VERSION)
    GTK_PREFIX=`$PKG_CONFIG --variable=prefix gdk-pixbuf-2.0`
    AC_SUBST(GTK_BASE_DIR)
  fi
fi
AC_SUBST(GTK3_LIBS)
AC_SUBST(GTK3_CFLAGS)
AC_SUBST(HAVE_GTK3)
AM_CONDITIONAL(HAVE_GTK3, test "x$HAVE_GTK3" = "xyes")

dnl clutter is optional and used in examples
HAVE_CLUTTER=no
HAVE_CLUTTER_X11=no
HAVE_CLUTTER_GLX=no
if test "x$BUILD_EXAMPLES" = "xyes"; then
  PKG_CHECK_MODULES(CLUTTER, clutter-1.0 >= 1.8, HAVE_CLUTTER=yes, HAVE_CLUTTER=no)
  AC_SUBST(CLUTTER_LIBS)
  AC_SUBST(CLUTTER_CFLAGS)
  AC_SUBST(HAVE_CLUTTER)

  PKG_CHECK_MODULES(CLUTTER_GLX, clutter-glx-1.0 >= 1.8, HAVE_CLUTTER_GLX=yes, HAVE_CLUTTER_GLX=no)
  AC_SUBST(CLUTTER_GLX_LIBS)
  AC_SUBST(CLUTTER_GLX_CFLAGS)
  AC_SUBST(HAVE_CLUTTER_GLX)

  PKG_CHECK_MODULES(CLUTTER_X11, clutter-x11-1.0 >= 1.8, HAVE_CLUTTER_X11=yes, HAVE_CLUTTER_X11=no)
  AC_SUBST(CLUTTER_X11_LIBS)
  AC_SUBST(CLUTTER_X11_CFLAGS)
  AC_SUBST(HAVE_CLUTTER_X11)
fi
AM_CONDITIONAL(HAVE_CLUTTER, test "x$HAVE_CLUTTER" = "xyes")
AM_CONDITIONAL(HAVE_CLUTTER_GLX, test "x$HAVE_CLUTTER_GLX" = "xyes")
AM_CONDITIONAL(HAVE_CLUTTER_X11, test "x$HAVE_CLUTTER_X11" = "xyes")

dnl used in the gl/clutteractor example
if test "x$BUILD_EXAMPLES" = "xyes"; then
  PKG_CHECK_MODULES(XCOMPOSITE, xcomposite, HAVE_XCOMPOSITE=yes, HAVE_XCOMPOSITE=no)
  AC_SUBST(XCOMPOSITE_CFLAGS)
  AC_SUBST(XCOMPOSITE_LIBS)
fi
AM_CONDITIONAL(HAVE_XCOMPOSITE, test "x$HAVE_XCOMPOSITE" = "xyes")

307 308
dnl graphene-1.0 is optional and used in gltransformation
HAVE_GRAPHENE=NO
309
PKG_CHECK_MODULES(GRAPHENE, graphene-1.0 >= 1.4.0, HAVE_GRAPHENE=yes, HAVE_GRAPHENE=no)
310 311 312 313 314 315 316 317 318
if test "x$HAVE_GRAPHENE" = "xyes"; then
  AC_DEFINE(HAVE_GRAPHENE, [1] , [Use graphene])
fi
AC_SUBST(HAVE_GRAPHENE)
AC_SUBST(GRAPHENE_LIBS)
AC_SUBST(GRAPHENE_CFLAGS)
AM_CONDITIONAL(HAVE_GRAPHENE, test "x$HAVE_GRAPHENE" = "xyes")


319 320 321 322 323 324 325 326 327 328
dnl sdl is optional and used in examples
HAVE_SDL=NO
if test "x$BUILD_EXAMPLES" = "xyes"; then
  PKG_CHECK_MODULES(SDL, sdl >= 1.2.0, HAVE_SDL=yes, HAVE_SDL=no)
  AC_SUBST(SDL_LIBS)
  AC_SUBST(SDL_CFLAGS)
  AC_SUBST(SDL_CLUTTER)
fi
AM_CONDITIONAL(HAVE_SDL, test "x$HAVE_SDL" = "xyes")

329

330 331 332
dnl Needed for GtkBuilder to autoconnect signals
PKG_CHECK_MODULES(GMODULE_EXPORT, gmodule-export-2.0, HAVE_GMODULE_EXPORT=yes, HAVE_GMODULE_EXPORT=no)

333 334 335
dnl Needed by plugins that use g_module_*() API
PKG_CHECK_MODULES(GMODULE_NO_EXPORT, gmodule-no-export-2.0)

336
dnl x11 is optional for librfb
337 338 339 340 341 342 343 344 345 346
HAVE_X11=NO
PKG_CHECK_MODULES(X11, x11, HAVE_X11=yes, HAVE_X11=no)
AC_SUBST(X11_LIBS)
AC_SUBST(X11_CFLAGS)
AC_SUBST(HAVE_X11)
AM_CONDITIONAL(HAVE_X11, test "x$HAVE_X11" = "xyes")
if test "x$HAVE_X11" = "xyes"; then
  AC_DEFINE(HAVE_X11, 1, [Define if you have X11 library])
fi

347 348 349 350 351 352
dnl exif (used on jifmux tests) ****
PKG_CHECK_MODULES(EXIF, libexif >= 0.6.16, HAVE_EXIF="yes", HAVE_EXIF="no")
AC_SUBST(EXIF_LIBS)
AC_SUBST(EXIF_CFLAGS)
AM_CONDITIONAL(USE_EXIF, test "x$HAVE_EXIF" = "xyes")

353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369
AG_GST_CHECK_FEATURE(IQA, [iqa], iqa , [
  PKG_CHECK_MODULES(DSSIM, dssim, [
    HAVE_DSSIM="yes"
    HAVE_IQA="yes"
  ], [
    HAVE_DSSIM="no"
    HAVE_IQA="no"
  ])

  AM_CONDITIONAL(HAVE_DSSIM, test "x$HAVE_DSSIM" = "xyes")
  if test "x$HAVE_DSSIM" = "xyes"; then
    AC_DEFINE(HAVE_DSSIM, 1, [Define if you have dssim library])
  fi
  AC_SUBST(DSSIM_LIBS)
  AC_SUBST(DSSIM_CFLAGS)
])

David Schleef's avatar
David Schleef committed
370
dnl Orc
371
ORC_CHECK([0.4.17])
David Schleef's avatar
David Schleef committed
372

373 374 375 376
dnl set license and copyright notice
GST_LICENSE="LGPL"
AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer license])
AC_SUBST(GST_LICENSE)
377

378 379 380 381
dnl define LIBDIR so we can inform people where we live
AS_AC_EXPAND(LIBDIR, $libdir)
AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [library dir])

382
dnl set location of plugin directory
383
AG_GST_SET_PLUGINDIR
384

385 386 387 388 389
dnl set release date/time
AG_GST_SET_PACKAGE_RELEASE_DATETIME_WITH_NANO([$PACKAGE_VERSION_NANO],
  ["${srcdir}/gst-plugins-bad.doap"],
  [$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_MICRO])

390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411
dnl build static plugins or not
AC_MSG_CHECKING([whether to build static plugins or not])
AC_ARG_ENABLE(
  static-plugins,
  AC_HELP_STRING(
    [--enable-static-plugins],
    [build static plugins @<:@default=no@:>@]),
  [AS_CASE(
    [$enableval], [no], [], [yes], [],
    [AC_MSG_ERROR([bad value "$enableval" for --enable-static-plugins])])],
  [enable_static_plugins=no])
AC_MSG_RESULT([$enable_static_plugins])
if test "x$enable_static_plugins" = xyes; then
  AC_DEFINE(GST_PLUGIN_BUILD_STATIC, 1,
    [Define if static plugins should be built])
  GST_PLUGIN_LIBTOOLFLAGS=""
else
  GST_PLUGIN_LIBTOOLFLAGS="--tag=disable-static"
fi
AC_SUBST(GST_PLUGIN_LIBTOOLFLAGS)
AM_CONDITIONAL(GST_PLUGIN_BUILD_STATIC, test "x$enable_static_plugins" = "xyes")

412 413 414 415 416 417
dnl If only building static libraries, define GST_STATIC_COMPILATION. This is
dnl needed only on Windows, but it doesn't hurt to have it everywhere.
if test x$enable_static = xyes -a x$enable_shared = xno; then
  GST_STATIC_CFLAGS="-DGST_STATIC_COMPILATION"
fi

418 419 420 421 422 423 424 425 426 427 428
AC_ARG_WITH([player-tests],
  AS_HELP_STRING([--with-player-tests],[Enable GstPlayer tests that need network access (default: no)]))
if test x$with_player_tests = xyes; then
  AC_PATH_PROG([WGET], [wget], no)
  if test x$WGET = xno; then
    AC_MSG_WARN([wget required for GstPlayer tests but not found - disabling])
    with_player_tests=no
  fi
fi
AM_CONDITIONAL(WITH_GST_PLAYER_TESTS, test "x$with_player_tests" = "xyes")

429 430 431 432 433
# set by AG_GST_PARSE_SUBSYSTEM_DISABLES above
dnl make sure it doesn't complain about unused variables if debugging is disabled
NO_WARNINGS=""
AG_GST_CHECK_GST_DEBUG_DISABLED([NO_WARNINGS="-Wno-unused"], [NO_WARNINGS=""])

434
dnl define an ERROR_CFLAGS Makefile variable
435
dnl -Waggregate-return - libexif returns aggregates
436
dnl -Wundef - Windows headers check _MSC_VER unconditionally
437 438 439 440 441
AG_GST_SET_ERROR_CFLAGS($FATAL_WARNINGS, [
    -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls
    -Wwrite-strings -Wformat-security -Wold-style-definition
    -Winit-self -Wmissing-include-dirs -Waddress -Wno-multichar
    -Wnested-externs $NO_WARNINGS])
442

443
dnl define an ERROR_CXXFLAGS Makefile variable
444
AG_GST_SET_ERROR_CXXFLAGS($FATAL_WARNINGS, [
445
    -Wmissing-declarations -Wredundant-decls
446
    -Wwrite-strings -Wformat-nonliteral -Wformat-security
447
    -Winit-self -Wmissing-include-dirs -Waddress -Wno-multichar $NO_WARNINGS])
448

449 450 451 452 453 454
dnl define an ERROR_OBJCFLAGS Makefile variable
AG_GST_SET_ERROR_OBJCFLAGS($FATAL_WARNINGS, [
    -Wmissing-declarations -Wredundant-decls
    -Wwrite-strings -Wformat-nonliteral -Wformat-security
    -Winit-self -Wmissing-include-dirs -Wno-multichar $NO_WARNINGS])

455
dnl define correct level for debugging messages
456
AG_GST_SET_LEVEL_DEFAULT($GST_GIT)
457

458 459 460
dnl used in examples
AG_GST_DEFAULT_ELEMENTS

461 462 463
dnl *** plug-ins to include ***

dnl these are all the gst plug-ins, compilable without additional libs
464
AG_GST_CHECK_PLUGIN(accurip)
465
AG_GST_CHECK_PLUGIN(adpcmdec)
466
AG_GST_CHECK_PLUGIN(adpcmenc)
467
AG_GST_CHECK_PLUGIN(aiff)
468
AG_GST_CHECK_PLUGIN(videoframe_audiolevel)
469
AG_GST_CHECK_PLUGIN(asfmux)
470
AG_GST_CHECK_PLUGIN(audiobuffersplit)
471
AG_GST_CHECK_PLUGIN(audiofxbad)
472
AG_GST_CHECK_PLUGIN(audiomixer)
473
AG_GST_CHECK_PLUGIN(compositor)
474
AG_GST_CHECK_PLUGIN(audiovisualizers)
475
AG_GST_CHECK_PLUGIN(autoconvert)
476
AG_GST_CHECK_PLUGIN(bayer)
477
AG_GST_CHECK_PLUGIN(camerabin2)
478
AG_GST_CHECK_PLUGIN(coloreffects)
479
AG_GST_CHECK_PLUGIN(debugutils)
480
AG_GST_CHECK_PLUGIN(dvbsuboverlay)
481 482
AG_GST_CHECK_PLUGIN(dvdspu)
AG_GST_CHECK_PLUGIN(festival)
483
AG_GST_CHECK_PLUGIN(fieldanalysis)
484
AG_GST_CHECK_PLUGIN(freeverb)
485
AG_GST_CHECK_PLUGIN(frei0r)
486
AG_GST_CHECK_PLUGIN(gaudieffects)
487
AG_GST_CHECK_PLUGIN(geometrictransform)
488
AG_GST_CHECK_PLUGIN(gdp)
489
AG_GST_CHECK_PLUGIN(id3tag)
490
AG_GST_CHECK_PLUGIN(inter)
David Schleef's avatar
David Schleef committed
491
AG_GST_CHECK_PLUGIN(interlace)
492
AG_GST_CHECK_PLUGIN(ivfparse)
493
AG_GST_CHECK_PLUGIN(ivtc)
494
AG_GST_CHECK_PLUGIN(jp2kdecimator)
495
AG_GST_CHECK_PLUGIN(jpegformat)
496
AG_GST_CHECK_PLUGIN(librfb)
497
AG_GST_CHECK_PLUGIN(midi)
498
AG_GST_CHECK_PLUGIN(mpegdemux)
499
AG_GST_CHECK_PLUGIN(mpegtsdemux)
500
AG_GST_CHECK_PLUGIN(mpegtsmux)
Lin Yang's avatar
Lin Yang committed
501
AG_GST_CHECK_PLUGIN(mpegpsmux)
502
AG_GST_CHECK_PLUGIN(mxf)
503
AG_GST_CHECK_PLUGIN(netsim)
504
AG_GST_CHECK_PLUGIN(onvif)
505
AG_GST_CHECK_PLUGIN(pcapparse)
506
AG_GST_CHECK_PLUGIN(pnm)
507
AG_GST_CHECK_PLUGIN(rawparse)
508
AG_GST_CHECK_PLUGIN(removesilence)
509
AG_GST_CHECK_PLUGIN(sdp)
510
AG_GST_CHECK_PLUGIN(segmentclip)
511
AG_GST_CHECK_PLUGIN(siren)
Stefan Sauer's avatar
Stefan Sauer committed
512
AG_GST_CHECK_PLUGIN(smooth)
513
AG_GST_CHECK_PLUGIN(speed)
514
AG_GST_CHECK_PLUGIN(subenc)
515
AG_GST_CHECK_PLUGIN(stereo)
516
AG_GST_CHECK_PLUGIN(timecode)
David Schleef's avatar
David Schleef committed
517
AG_GST_CHECK_PLUGIN(videofilters)
518
AG_GST_CHECK_PLUGIN(videoparsers)
519 520
AG_GST_CHECK_PLUGIN(videosignal)
AG_GST_CHECK_PLUGIN(vmnc)
David Schleef's avatar
David Schleef committed
521
AG_GST_CHECK_PLUGIN(y4m)
522
AG_GST_CHECK_PLUGIN(yadif)
523

524 525
dnl *** plug-ins to exclude ***

526
AC_CHECK_HEADER(AVFoundation/AVFoundation.h, HAVE_AVFOUNDATION="yes", HAVE_AVFOUNDATION="no", [-])
527
AC_CHECK_HEADER(MobileCoreServices/MobileCoreServices.h, HAVE_IOS="yes", HAVE_IOS="no", [-])
528
AC_CHECK_HEADER(VideoToolbox/VideoToolbox.h, HAVE_VIDEOTOOLBOX="yes", HAVE_VIDEOTOOLBOX="no", [-])
529
AC_CHECK_HEADER(QTKit/QTKit.h, HAVE_QTKIT="yes", HAVE_QTKIT="no", [-])
530

531 532 533 534 535 536 537 538 539 540
if test "x$HAVE_VIDEOTOOLBOX" = "xyes"; then
  old_LIBS=$LIBS
  LIBS="$LIBS -framework VideoToolbox"
  AC_CHECK_FUNC(VTCompressionSessionPrepareToEncodeFrames, [
    AC_DEFINE(HAVE_VIDEOTOOLBOX_10_9_6, 1, [Define if building with VideoToolbox >= 10.9.6])
  ], [
  ])
  LIBS=$old_LIBS
fi

541 542 543 544 545
AM_CONDITIONAL(HAVE_AVFOUNDATION, test "x$HAVE_AVFOUNDATION" = "xyes")
if test "x$HAVE_AVFOUNDATION" = "xyes"; then
  AC_DEFINE(HAVE_AVFOUNDATION, 1, [Define if building with AVFoundation])
fi

546 547 548 549 550
AM_CONDITIONAL(HAVE_IOS, test "x$HAVE_IOS" = "xyes")
if test "x$HAVE_IOS" = "xyes"; then
  AC_DEFINE(HAVE_IOS, 1, [Define if building for Apple iOS])
fi

551
AM_CONDITIONAL(HAVE_VIDEOTOOLBOX, test "x$HAVE_VIDEOTOOLBOX" = "xyes")
552 553 554 555
if test "x$HAVE_VIDEOTOOLBOX" = "xyes"; then
  AC_DEFINE(HAVE_VIDEOTOOLBOX, 1, [Define if building with VideoToolbox])
fi

556 557 558 559
AM_CONDITIONAL(HAVE_QTKIT, test "x$HAVE_QTKIT" = "xyes")
if test "x$HAVE_QTKIT" = "xyes"; then
  AC_DEFINE(HAVE_QTKIT, 1, [Define if building with QTKit])
fi
560
dnl disable gst plugins we might not be able to build on this
561
dnl platform: (ugly but minimally invasive)
562 563 564 565
dnl FIXME: maybe move to sys, or make work with winsock2
AC_CHECK_HEADERS([sys/socket.h], HAVE_SYS_SOCKET_H=yes)
AC_CHECK_HEADERS([winsock2.h], HAVE_WINSOCK2_H=yes)

566
if test "x$HAVE_WINSOCK2_H" = "xyes"; then
567 568
  WINSOCK2_LIBS="-lws2_32"
  AC_SUBST(WINSOCK2_LIBS)
LRN's avatar
LRN committed
569 570
fi

571 572 573 574 575 576 577 578 579 580
dnl *** opengl ***
AC_ARG_ENABLE([opengl],
     [  --enable-opengl         Enable Desktop OpenGL support @<:@default=auto@:>@],
     [case "${enableval}" in
       yes)  NEED_GL=yes ;;
       no)   NEED_GL=no ;;
       auto) NEED_GL=auto ;;
       *) AC_MSG_ERROR([bad value ${enableval} for --enable-opengl]) ;;
     esac],[NEED_GL=auto])

581 582 583 584 585 586
AC_ARG_WITH([opengl-module-name],
  AS_HELP_STRING([--with-opengl-module-name],[library module name for OpenGL (default: libGL)]))
if test x$with_opengl_module_name != x; then
  AC_DEFINE_UNQUOTED(GST_GL_LIBGL_MODULE_NAME, "$with_opengl_module_name", [OpenGL module name])
fi

587 588 589 590 591 592 593 594 595
AC_ARG_ENABLE([gles2],
     [  --enable-gles2          Enable OpenGL|ES 2.0 support @<:@default=auto@:>@],
     [case "${enableval}" in
       yes)  NEED_GLES2=yes ;;
       no)   NEED_GLES2=no ;;
       auto) NEED_GLES2=auto ;;
       *) AC_MSG_ERROR([bad value ${enableval} for --enable-gles2]) ;;
     esac],[NEED_GLES2=auto])

596 597 598 599 600 601
AC_ARG_WITH([gles2-module-name],
  AS_HELP_STRING([--with-gles2-module-name],[library module name for GLES2 (default: libGLESv2)]))
if test x$with_gles2_module_name != x; then
  AC_DEFINE_UNQUOTED(GST_GL_LIBGLESV2_MODULE_NAME, "$with_gles2_module_name", [GLES2 module name])
fi

602 603 604 605 606 607 608 609 610
AC_ARG_ENABLE([egl],
     [  --enable-egl            Enable EGL support @<:@default=auto@:>@],
     [case "${enableval}" in
       yes)  NEED_EGL=yes ;;
       no)   NEED_EGL=no ;;
       auto) NEED_EGL=auto ;;
       *) AC_MSG_ERROR([bad value ${enableval} for --enable-egl]) ;;
     esac],[NEED_EGL=auto])

611 612 613 614 615 616
AC_ARG_WITH([egl-module-name],
  AS_HELP_STRING([--with-egl-module-name],[library module name for EGL (default: libEGL)]))
if test x$with_egl_module_name != x; then
  AC_DEFINE_UNQUOTED(GST_GL_LIBEGL_MODULE_NAME, "$with_egl_module_name", [EGL module name])
fi

617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635
AC_ARG_ENABLE([wgl],
     [  --enable-wgl            Enable WGL support @<:@default=auto@:>@],
     [case "${enableval}" in
       yes)  NEED_WGL=yes ;;
       no)   NEED_WGL=no ;;
       auto) NEED_WGL=auto ;;
       *) AC_MSG_ERROR([bad value ${enableval} for --enable-wgl]) ;;
     esac],[NEED_WGL=auto])

AC_ARG_ENABLE([glx],
     [  --enable-glx            Enable GLX support @<:@default=auto@:>@],
     [case "${enableval}" in
       yes)  NEED_GLX=yes ;;
       no)   NEED_GLX=no ;;
       auto) NEED_GLX=auto ;;
       *) AC_MSG_ERROR([bad value ${enableval} for --enable-glx]) ;;
     esac],[NEED_GLX=auto])

AC_ARG_ENABLE([cocoa],
636
     [  --enable-cocoa          Enable Cocoa support @<:@default=auto@:>@],
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670
     [case "${enableval}" in
       yes)  NEED_COCOA=yes ;;
       no)   NEED_COCOA=no ;;
       auto) NEED_COCOA=auto ;;
       *) AC_MSG_ERROR([bad value ${enableval} for --enable-cocoa]) ;;
     esac],[NEED_COCOA=auto])

AC_ARG_ENABLE([x11],
     [  --enable-x11            Enable x11 support @<:@default=auto@:>@],
     [case "${enableval}" in
       yes)  NEED_X11=yes ;;
       no)   NEED_X11=no ;;
       auto) NEED_X11=auto ;;
       *) AC_MSG_ERROR([bad value ${enableval} for --enable-x11]) ;;
     esac],[NEED_X11=auto])

AC_ARG_ENABLE([wayland],
     [  --enable-wayland        Enable Wayland support (requires EGL) @<:@default=auto@:>@],
     [case "${enableval}" in
       yes)  NEED_WAYLAND_EGL=yes ;;
       no)   NEED_WAYLAND_EGL=no ;;
       auto) NEED_WAYLAND_EGL=auto ;;
       *) AC_MSG_ERROR([bad value ${enableval} for --enable-wayland]) ;;
     esac],[NEED_WAYLAND_EGL=auto])

AC_ARG_ENABLE([dispmanx],
     [  --enable-dispmanx        Enable Dispmanx support (requires EGL) @<:@default=auto@:>@],
     [case "${enableval}" in
       yes)  NEED_DISPMANX=yes ;;
       no)   NEED_DISPMANX=no ;;
       auto) NEED_DISPMANX=auto ;;
       *) AC_MSG_ERROR([bad value ${enableval} for --enable-dispmanx]) ;;
     esac],[NEED_DISPMANX=auto])

671
AG_GST_PKG_CHECK_MODULES(X11_XCB, x11-xcb)
672 673 674 675 676
save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS"

HAVE_GL=no
HAVE_GLES2=no
677
HAVE_GLES3_H=no
678
HAVE_WAYLAND_EGL=no
679

680
HAVE_EGL_RPI=no
681 682 683 684 685

case $host in
  *-mingw32* )
    LIBS="$LIBS -lgdi32"
    AG_GST_CHECK_LIBHEADER(GL, opengl32, glTexImage2D,, GL/gl.h)
686
    AC_CHECK_HEADER(GL/wglext.h, HAVE_WGLEXT="yes", HAVE_WGLEXT="no", [#include <GL/gl.h>])
687
    if test "x$HAVE_WGLEXT" = "xyes"; then
688
      HAVE_WGL=yes
689 690
      HAVE_GL=yes
    fi
691 692
  ;;
  *)
693
    if test "x$NEED_GL" != "xno"; then
694 695 696 697
      AG_GST_PKG_CHECK_MODULES(GL, gl)
      if test "x$HAVE_GL" != "xyes"; then
        AG_GST_CHECK_LIBHEADER(GL, GL, glTexImage2D,, GL/gl.h)
      fi
698 699
    fi
    if test "x$NEED_GLES2" != "xno"; then
700 701 702 703
      AG_GST_PKG_CHECK_MODULES(GLES2, glesv2)
      if test "x$HAVE_GLES2" != "xyes"; then
        AG_GST_CHECK_LIBHEADER(GLES2, GLESv2, glTexImage2D,, GLES2/gl2.h)
      fi
704
      AC_CHECK_HEADER([GLES3/gl3.h], [HAVE_GLES3_H=yes])
705 706
    fi
    if test "x$NEED_EGL" != "xno"; then
707 708 709 710
      AG_GST_PKG_CHECK_MODULES(EGL, egl)
      if test "x$HAVE_EGL" != "xyes"; then
        AG_GST_CHECK_LIBHEADER(EGL, EGL, eglGetError,, EGL/egl.h)
      fi
711
    fi
712

713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776
    old_LIBS=$LIBS
    old_CFLAGS=$CFLAGS

    dnl FIXME: Mali EGL depends on GLESv1 or GLESv2
    AC_CHECK_HEADER([EGL/fbdev_window.h],
      [
        LIBS="$LIBS -lUMP"
        AC_CHECK_LIB([Mali], [mali_image_create],
          [
            LIBS="$LIBS -lMali"
            AC_CHECK_LIB([GLESv2], [glEnable],
              [
                AC_CHECK_HEADER([GLES2/gl2.h],
                  [
                    AC_CHECK_LIB([EGL], [eglGetProcAddress],
                      [
                        AC_CHECK_HEADER([EGL/egl.h],
                          [
                            HAVE_EGL=yes
                            HAVE_GLES2=yes
                            EGL_LIBS="-lMali -lUMP"
                            EGL_CFLAGS=""
                            AC_DEFINE(USE_EGL_MALI_FB, [1], [Use Mali FB EGL platform])
                          ])
                      ])
                  ])
              ])
          ])
      ])

    dnl FIXME: EGL of RPi depends on GLESv1 or GLESv2
    dnl FIXME: GLESv2 of RPi depends on EGL... WTF!
    LIBS="$LIBS -lvcos -lvchiq_arm"
    AC_CHECK_LIB([bcm_host], [bcm_host_init],
      [
        LIBS="$LIBS -lbcm_host"
        AC_CHECK_HEADER(bcm_host.h,
          [
            LIBS="$LIBS -lGLESv2"
            AC_CHECK_LIB([EGL], [eglGetProcAddress],
              [
                LIBS="$LIBS -lEGL"
                AC_CHECK_HEADER([EGL/egl.h],
                  [
                    AC_CHECK_LIB([GLESv2], [glEnable],
                      [
                        AC_CHECK_HEADER([GLES2/gl2.h],
                          [
                            HAVE_EGL=yes
                            HAVE_GLES2=yes
                            HAVE_EGL_RPI=yes
                            EGL_LIBS="-lbcm_host -lvcos -lvchiq_arm"
                            EGL_CFLAGS=""
                            AC_DEFINE(USE_EGL_RPI, [1], [Use RPi platform])
                          ])
                      ])
                  ])
              ])
          ])
      ])

    LIBS=$old_LIBS
    CFLAGS=$old_CFLAGS

777
    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)
778 779 780 781 782 783 784 785 786 787 788

    # OS X and iOS always have GL available
    case $host in
      *-darwin*)
        if test "x$HAVE_IOS" = "xyes"; then
          HAVE_GLES2=yes
        else
          HAVE_GL=yes
        fi
      ;;
    esac
789 790 791 792 793 794 795 796 797 798 799 800
  ;;
esac

CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS"

USE_OPENGL=no
USE_GLES2=no
USE_GLX=no
USE_COCOA=no
USE_WGL=no
USE_X11=no
801
USE_EAGL=no
802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825
GL_LIBS=
GL_CFLAGS=
GL_OBJCFLAGS=

dnl Check for what the user asked for and what we could find
if test "x$HAVE_EGL" = "xno"; then
  if test "x$NEED_EGL" = "xyes"; then
    AC_MSG_ERROR([Could not find the required EGL libraries])
  fi
fi

if test "x$HAVE_GL" = "xno"; then
  if test "x$NEED_GL" = "xyes"; then
    AC_MSG_ERROR([Could not find the required OpenGL libraries])
  fi
fi

if test "x$HAVE_GLES2" = "xno"; then
  if test "x$NEED_GLES2" = "xyes"; then
    AC_MSG_ERROR([Could not find the required OpenGL|ES 2.0 libraries])
  fi
fi

dnl X, GLX and OpenGL
826
if test "x$HAVE_X11_XCB" = "xno"; then
827 828 829 830 831 832 833 834 835 836 837 838 839
  if test "x$NEED_GLX" = "xyes"; then
    AC_MSG_ERROR([Building the GLX backend without X11 is unsupported])
  fi
  if test "x$NEED_X11" = "xyes"; then
    AC_MSG_ERROR([Could not find X11 development libraries])
  fi
else
  if test "x$NEED_GL" != "xno"; then
    if test "x$HAVE_GL" = "xno"; then
      if test "x$NEED_GLX" = "xyes"; then
        AC_MSG_ERROR([Building the GLX backend without the OpenGL backend is unsupported])
      fi
    else dnl HAVE_GL=yes
840 841 842
      USE_OPENGL=yes
      if test "x$NEED_GLX" != "xno"; then
        USE_GLX=yes
843 844 845 846 847
      fi
    fi
  fi
fi

848 849 850 851 852 853 854 855 856
dnl check for DMABUF support
HAVE_DRM_FOURCC_HEADER=no
AC_CHECK_HEADER(libdrm/drm_fourcc.h,
  HAVE_DRM_FOURCC_HEADER=yes, )

HAVE_GST_ALLOCATORS=no
PKG_CHECK_MODULES(GST_ALLOCATORS, gstreamer-allocators-1.0,
  HAVE_GST_ALLOCATORS=yes, )

857
GST_GL_HAVE_DMABUF=0
858 859 860
if test "x$HAVE_DRM_FOURCC_HEADER" = "xyes" -a \
        "x$HAVE_GST_ALLOCATORS" = "xyes" -a \
        "x$HAVE_EGL" = "xyes"; then
861
          GST_GL_HAVE_DMABUF=1
862 863
fi

864
dnl check if we can include both GL and GLES2 at the same time
865
if test "x$HAVE_GL" = "xyes" -a "x$HAVE_GLES2" = "xyes"; then
866 867 868 869
  GLES3_H_DEFINE=0
  if test "x$HAVE_GLES3_H" == "xyes"; then
    GLES3_H_DEFINE=1
  fi
870
  GL_INCLUDES="
871 872 873 874
#ifdef __GNUC__
#  pragma GCC diagnostic push
#  pragma GCC diagnostic ignored \"-Wredundant-decls\"
#endif
875 876 877
#ifndef GL_GLEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES 1
#endif
878
# ifdef HAVE_IOS
879 880 881
#  include <OpenGLES/ES2/gl.h>
#  include <OpenGLES/ES2/glext.h>
# else
882
#  if $GLES3_H_DEFINE
883 884
#   include <GLES3/gl3.h>
#   include <GLES3/gl3ext.h>
885 886 887
#  else
#   include <GLES2/gl2.h>
#   include <GLES2/gl2ext.h>
888
#  endif
889
# endif
890
# ifdef __APPLE__
891 892
#  include <OpenGL/OpenGL.h>
#  include <OpenGL/gl.h>
893
#  if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
894 895 896
#   define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
#   include <OpenGL/gl3.h>
#  endif
897 898 899 900 901 902
# else
#  include <GL/gl.h>
#  if __WIN32__ || _WIN32
#   include <GL/glext.h>
#  endif
# endif
903
int main (int argc, char **argv) { return 0; }
904 905
"
  AC_MSG_CHECKING([whether it is possible to include both GL and GLES2 headers])
906 907 908
  save_CFLAGS="$CFLAGS"
  CFLAGS="$CFLAGS $GL_CFLAGS $GLES2_CFLAGS $WARNING_CFLAGS $ERROR_CFLAGS"
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[$GL_INCLUDES]], [[
909 910 911 912 913 914
    #if !defined(GL_FALSE)
    #error Failed to include GL headers
    #endif
    ]])],[ AC_MSG_RESULT(yes)
    ],[AC_MSG_RESULT(no)
    if test "x$NEED_GLES2" = "xyes"; then
915
      if test "x$NEED_GL" = "xyes"; then
916 917 918
        AC_MSG_ERROR([Cannot seem to include both GL and GLES2 headers. Try disabling one API])
      fi
      AC_MSG_WARN([Disabling Desktop GL support])
919
      HAVE_GL=no
920
      USE_OPENGL=no
921 922 923
    else
      AC_MSG_WARN([Disabling GL|ES 2.0 support])
      HAVE_GLES2=no
924
      HAVE_GLES3_H=no
925 926
    fi
  ])
927
  CFLAGS="$save_CFLAGS"
928 929
fi

930
#dnl Check for OpenGL
931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980
echo host is $host
case $host in
  *-android*)
    if test "x$NEED_WGL" = "xyes"; then
      AC_MSG_ERROR([WGL is not available on Android])
    fi
    if test "x$NEED_GLX" = "xyes"; then
      AC_MSG_ERROR([GLX is not available on Android])
    fi
    if test "x$NEED_GL" = "xyes"; then
      AC_MSG_ERROR([GL is not available on Android])
    fi
    if test "x$NEED_X11" = "xyes"; then
      AC_MSG_ERROR([X11 is not available on Android])
    fi
    if test "x$NEED_COCOA" = "xyes"; then
      AC_MSG_ERROR([Cocoa is not available on Android])
    fi

    dnl OpenGL|ES 2.0
    if test "x$HAVE_GLES2" = "xyes"; then
      if test "x$NEED_GLES2" != "xno"; then
        GL_LIBS="$GL_LIBS -lGLESv2"
        USE_GLES2=yes
      fi
    fi

    dnl EGL
    if test "x$HAVE_EGL" = "xyes"; then
      if test "x$NEED_EGL" != "xno"; then
        GL_LIBS="$GL_LIBS -lEGL"
        USE_EGL=yes
      fi
    fi

    if test "x$USE_EGL" != "xyes"; then
      AC_MSG_ERROR([Need EGL on Android])
    fi

    if test "x$USE_GLES2" != "xyes"; then
      AC_MSG_ERROR([Need OpenGL|ES 2.0 on Android])
    fi

    HAVE_WINDOW_ANDROID=yes
    ;;
  *-linux* | *-cygwin* | *-solaris* | *-netbsd* | *-freebsd* | *-openbsd* | *-kfreebsd* | *-dragonflybsd* | *-gnu* )
    if test "x$NEED_WGL" = "xyes"; then
      AC_MSG_ERROR([WGL is not available on unix])
    fi

981
    if test "x$HAVE_X11_XCB" = "xno"; then
982
      if test "x$HAVE_WAYLAND_EGL" = "xno"; then
983
        AC_MSG_WARN([X or Wayland is required for OpenGL support])
984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001
      fi
    fi

    dnl check Desktop OpenGL
    if test "x$HAVE_GL" = "xyes"; then
      if test "x$NEED_GL" != "xno"; then
        GL_LIBS="$GL_LIBS -lGL"
      fi
    fi

    dnl OpenGL|ES 2.0
    if test "x$HAVE_GLES2" = "xyes"; then
      if test "x$NEED_GLES2" != "xno"; then
        GL_LIBS="$GL_LIBS -lGLESv2"
        USE_GLES2=yes
      fi
    fi

1002
    if test "x$HAVE_X11_XCB" = "xyes" -a "x$HAVE_EGL_RPI" = "xno"; then
1003
      if test "x$NEED_X11" != "xno"; then
1004 1005
        GL_LIBS="$GL_LIBS $X11_XCB_LIBS"
        GL_CFLAGS="$GL_CFLAGS $X11_XCB_CFLAGS"
1006 1007 1008 1009 1010 1011
        HAVE_WINDOW_X11=yes
      fi
    fi

    if test "x$HAVE_WAYLAND_EGL" = "xyes"; then
      if test "x$NEED_EGL" = "xno" -o "x$HAVE_EGL" = "xno"; then
1012
        AC_MSG_WARN([EGL is required by the Wayland backend for OpenGL support])
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031
      else
        if test "x$NEED_WAYLAND_EGL" != "xno"; then
          HAVE_WINDOW_WAYLAND=yes
          GL_LIBS="$GL_LIBS $WAYLAND_EGL_LIBS"
          GL_CFLAGS="$GL_CFLAGS $WAYLAND_EGL_CFLAGS"
        fi
      fi
    fi

    if test "x$HAVE_EGL_RPI" = "xyes"; then
      if test "x$NEED_DISPMANX" != "xno"; then
        HAVE_WINDOW_DISPMANX=yes
        USE_EGL=yes
      fi
    fi

    dnl EGL
    if test "x$HAVE_EGL" = "xno"; then
      if test "x$HAVE_GL" = "xno"; then
1032
        AC_MSG_WARN([Building requires either EGL or GLX for OpenGL support])
1033 1034 1035 1036
      fi
    else
      if test "x$NEED_EGL" != "xno"; then
        if test "x$HAVE_WINDOW_WAYLAND" = "xyes" -o "x$HAVE_WINDOW_X11" = "xyes" -o "x$HAVE_WINDOW_DISPMANX" = "xyes"; then
1037
          GL_LIBS="$GL_LIBS -lEGL $EGL_LIBS"
1038
          GL_CFLAGS="$GL_CFLAGS $EGL_CFLAGS"
1039 1040 1041 1042 1043
          USE_EGL=yes
        fi
      fi
    fi
    ;;
1044 1045
  *-darwin*)
    if test "x$HAVE_IOS" = "xyes"; then
1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073
      if test "x$NEED_WGL" = "xyes"; then
        AC_MSG_ERROR([WGL is not available on iOS])
      fi
      if test "x$NEED_GLX" = "xyes"; then
        AC_MSG_ERROR([GLX is not available on iOS])
      fi
      if test "x$NEED_GL" = "xyes"; then
        AC_MSG_ERROR([GL is not available on iOS])
      fi
      if test "x$NEED_X11" = "xyes"; then
        AC_MSG_ERROR([X11 is not available on iOS])
      fi
      if test "x$NEED_COCOA" = "xyes"; then
        AC_MSG_ERROR([Cocoa is not available on iOS])
      fi
      if test "x$NEED_EGL" = "xyes"; then
        AC_MSG_ERROR([EGL is not available on iOS])
      fi

      GL_LIBS="$LIBS -framework OpenGLES -framework QuartzCore -framework UIKit -framework CoreGraphics -framework CoreFoundation -framework Foundation"
      GL_CFLAGS="$GL_CFLAGS"
      USE_GLES2=yes
      USE_EAGL=yes
      HAVE_WINDOW_EAGL=yes

      ac_cv_type_GLsizeiptr=yes
      ac_cv_type_GLintptr=yes
      ac_cv_type_GLchar=yes
1074 1075 1076 1077 1078
    else
      dnl Only osx supports cocoa.
      if test "x$NEED_WGL" = "xyes"; then
        AC_MSG_ERROR([WGL is not available on Mac OS X])
      fi
1079

1080
      if test "x$NEED_COCOA" != "xno"; then
1081
        GL_LIBS="$LIBS -framework OpenGL -framework Cocoa -framework QuartzCore -framework CoreFoundation"
1082 1083 1084 1085
        GL_CFLAGS="$GL_CFLAGS"
        USE_COCOA=yes
        HAVE_WINDOW_COCOA=yes
        USE_OPENGL=yes
1086 1087
      fi

1088
      if test "x$USE_GLX" = "xyes"; then
1089
        if test "x$HAVE_X11_XCB" = "xyes"; then
1090
          if test "x$NEED_X11" != "xno"; then
1091 1092
            GL_LIBS="$GL_LIBS $X11_XCB_LIBS"
            GL_CFLAGS="$GL_CFLAGS $X11_XCB_CFLAGS"
1093 1094
            HAVE_WINDOW_X11=yes
          fi
1095
        fi
1096 1097 1098 1099 1100 1101

        if test "x$HAVE_GL" = "xyes"; then
          if test "x$NEED_GL" != "xno"; then
            GL_LIBS="$GL_LIBS -lGL"
          fi
          USE_OPENGL=yes
1102 1103
        fi
      fi
1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121

      if test "x$HAVE_EGL" = "xyes"; then
        if test "x$NEED_EGL" != "xno"; then
          if test "x$HAVE_WINDOW_X11" = "xyes"; then
            GL_LIBS="$GL_LIBS -lEGL $EGL_LIBS"
            GL_CFLAGS="$GL_CFLAGS $EGL_CFLAGS"
            USE_EGL=yes
          fi
        fi
      fi

      dnl OpenGL|ES 2.0
      if test "x$HAVE_GLES2" = "xyes"; then
        if test "x$NEED_GLES2" != "xno"; then
          GL_LIBS="$GL_LIBS -lGLESv2"
          USE_GLES2=yes
        fi
      fi
1122 1123 1124 1125 1126 1127 1128 1129 1130 1131
    fi
    ;;
  *-mingw32*)
    if test "x$NEED_GLX" = "xyes"; then
      AC_MSG_ERROR([GLX is not available on Windows])
    fi
    if test "x$NEED_GLES2" = "xyes"; then
      AC_MSG_ERROR([OpenGL|ES 2.0 is not supported on your platform yet])
    fi

1132
    if test "x$HAVE_GL" = "xyes"; then
1133
      if test "x$NEED_GL" != "xno"; then
1134 1135
        if test "x$HAVE_WGL" = "xyes"; then
          if test "$NEED_WGL" != "xno"; then
1136
            GL_LIBS="$GL_LIBS -lgdi32 -lopengl32"
1137 1138 1139 1140 1141 1142 1143
            HAVE_WINDOW_WIN32=yes
            USE_OPENGL=yes
            USE_WGL=yes
          fi
        fi
      fi
    fi
1144 1145
    ;;
  *)
1146
    AC_MSG_WARN([Don't know how to check for OpenGL on your platform.])
1147 1148 1149 1150 1151 1152 1153 1154 1155
    ;;
esac

GL_PLATFORMS=
GL_WINDOWS=
GL_APIS=
GL_CONFIG_DEFINES=

dnl APIs
1156 1157 1158 1159 1160

GST_GL_HAVE_OPENGL=0
GST_GL_HAVE_GLES2=0
GST_GL_HAVE_GLES3=0

1161 1162
if test "x$USE_OPENGL" = "xyes"; then
  GL_APIS="gl $GL_APIS"
1163
  GST_GL_HAVE_OPENGL=1
1164 1165 1166
fi
if test "x$USE_GLES2" = "xyes"; then
  GL_APIS="gles2 $GL_APIS"
1167
  GST_GL_HAVE_GLES2=1
1168 1169 1170
  if test "x$HAVE_GLES3_H" = "xyes"; then
    GST_GL_HAVE_GLES3=1
  fi
1171 1172
fi

1173 1174 1175 1176 1177 1178
GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
#define GST_GL_HAVE_OPENGL $GST_GL_HAVE_OPENGL
#define GST_GL_HAVE_GLES2 $GST_GL_HAVE_GLES2
#define GST_GL_HAVE_GLES3 $GST_GL_HAVE_GLES3
"

1179
dnl WINDOW's
1180 1181 1182 1183 1184 1185

GST_GL_HAVE_WINDOW_X11=0
GST_GL_HAVE_WINDOW_COCOA=0
GST_GL_HAVE_WINDOW_WIN32=0
GST_GL_HAVE_WINDOW_WAYLAND=0
GST_GL_HAVE_WINDOW_ANDROID=0
1186
GST_GL_HAVE_WINDOW_DISPMANX=0
1187
GST_GL_HAVE_WINDOW_EAGL=0
1188

1189 1190
if test "x$HAVE_WINDOW_X11" = "xyes"; then
  GL_WINDOWS="x11 $GL_WINDOWS"
1191
  GST_GL_HAVE_WINDOW_X11=1
1192 1193 1194
fi
if test "x$HAVE_WINDOW_COCOA" = "xyes"; then
  GL_WINDOWS="cocoa $GL_WINDOWS"
1195
  GST_GL_HAVE_WINDOW_COCOA=1
1196 1197 1198
fi
if test "x$HAVE_WINDOW_WIN32" = "xyes"; then
  GL_WINDOWS="win32 $GL_WINDOWS"
1199
  GST_GL_HAVE_WINDOW_WIN32=1
1200 1201 1202
fi
if test "x$HAVE_WINDOW_WAYLAND" = "xyes"; then
  GL_WINDOWS="wayland $GL_WINDOWS"
1203
  GST_GL_HAVE_WINDOW_WAYLAND=1
1204 1205 1206
fi
if test "x$HAVE_WINDOW_ANDROID" = "xyes"; then
  GL_WINDOWS="android $GL_WINDOWS"
1207
  GST_GL_HAVE_WINDOW_ANDROID=1
1208 1209 1210
fi
if test "x$HAVE_WINDOW_DISPMANX" = "xyes"; then
  GL_WINDOWS="dispmanx $GL_WINDOWS"
1211
  GST_GL_HAVE_WINDOW_DISPMANX=1
1212
fi
1213 1214 1215 1216
if test "x$HAVE_WINDOW_EAGL" = "xyes"; then
  GL_WINDOWS="eagl $GL_WINDOWS"
  GST_GL_HAVE_WINDOW_EAGL=1
fi
1217

1218 1219 1220 1221 1222 1223 1224
GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
#define GST_GL_HAVE_WINDOW_X11 $GST_GL_HAVE_WINDOW_X11
#define GST_GL_HAVE_WINDOW_COCOA $GST_GL_HAVE_WINDOW_COCOA
#define GST_GL_HAVE_WINDOW_WIN32 $GST_GL_HAVE_WINDOW_WIN32
#define GST_GL_HAVE_WINDOW_WAYLAND $GST_GL_HAVE_WINDOW_WAYLAND
#define GST_GL_HAVE_WINDOW_ANDROID $GST_GL_HAVE_WINDOW_ANDROID
#define GST_GL_HAVE_WINDOW_DISPMANX $GST_GL_HAVE_WINDOW_DISPMANX
1225
#define GST_GL_HAVE_WINDOW_EAGL $GST_GL_HAVE_WINDOW_EAGL
1226 1227
"

1228
dnl PLATFORM's
1229 1230 1231 1232

GST_GL_HAVE_PLATFORM_EGL=0
GST_GL_HAVE_PLATFORM_GLX=0
GST_GL_HAVE_PLATFORM_WGL=0
1233
GST_GL_HAVE_PLATFORM_CGL=0
1234
GST_GL_HAVE_PLATFORM_EAGL=0
1235

1236 1237
if test "x$USE_EGL" = "xyes"; then
  GL_PLATFORMS="egl $GL_PLATFORMS"
1238
  GST_GL_HAVE_PLATFORM_EGL=1
1239 1240 1241
fi
if test "x$USE_GLX" = "xyes"; then
  GL_PLATFORMS="glx $GL_PLATFORMS"
1242
  GST_GL_HAVE_PLATFORM_GLX=1
1243 1244 1245
fi
if test "x$USE_WGL" = "xyes"; then
  GL_PLATFORMS="wgl $GL_PLATFORMS"
1246
  GST_GL_HAVE_PLATFORM_WGL=1
1247 1248
fi
if test "x$USE_COCOA" = "xyes"; then
1249 1250
  GL_PLATFORMS="cgl $GL_PLATFORMS"
  GST_GL_HAVE_PLATFORM_CGL=1
1251
fi
1252 1253 1254 1255
if test "x$USE_EAGL" = "xyes"; then
  GL_PLATFORMS="eagl $GL_PLATFORMS"
  GST_GL_HAVE_PLATFORM_EAGL=1
fi
1256

1257 1258 1259 1260
GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
#define GST_GL_HAVE_PLATFORM_EGL $GST_GL_HAVE_PLATFORM_EGL
#define GST_GL_HAVE_PLATFORM_GLX $GST_GL_HAVE_PLATFORM_GLX
#define GST_GL_HAVE_PLATFORM_WGL $GST_GL_HAVE_PLATFORM_WGL
1261
#define GST_GL_HAVE_PLATFORM_CGL $GST_GL_HAVE_PLATFORM_CGL
1262
#define GST_GL_HAVE_PLATFORM_EAGL $GST_GL_HAVE_PLATFORM_EAGL
1263 1264
"

1265 1266 1267 1268
GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
#define GST_GL_HAVE_DMABUF $GST_GL_HAVE_DMABUF
"

1269 1270
dnl Check for no platforms/window systems
if test "x$GL_APIS" = "x"; then
1271
  AC_MSG_WARN([Either OpenGL or OpenGL|ES is required for OpenGL support])
1272 1273
fi
if test "x$GL_PLATFORMS" = "x"; then
1274
  AC_MSG_WARN([Could not find any OpenGL platforms to use such as CGL, WGL or GLX])
1275 1276
fi
if test "x$GL_WINDOWS" = "x"; then
1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289
  AC_MSG_WARN([Could not find any window systems to use such as Cocoa, Win32API or X11])
fi

if test "x$GL_APIS" = "x" -o "x$GL_PLATFORMS" = "x" -o "x$GL_WINDOWS" = "x"; then
  GL_LIBS=
  GL_CFLAGS=
  GL_OBJCFLAGS=
  USE_OPENGL=no
  USE_GLES2=no
  USE_GLX=no
  USE_EGL=no
  USE_WGL=no
  USE_COCOA=no
1290
  USE_EGL_MALI=no
1291
  USE_EGL_RPI=no
1292
  USE_EAGL=no
1293 1294 1295 1296 1297 1298

  HAVE_WINDOW_X11=no
  HAVE_WINDOW_WIN32=no
  HAVE_WINDOW_DISPMANX=no
  HAVE_WINDOW_WAYLAND=no
  HAVE_WINDOW_ANDROID=no
1299 1300
  HAVE_WINDOW_COCOA=no
  HAVE_WINDOW_EAGL=no
1301 1302
fi

1303 1304 1305
AC_SUBST(GL_APIS)
AC_SUBST(GL_PLATFORMS)
AC_SUBST(GL_WINDOWS)
1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317
AC_SUBST(GL_LIBS)
AC_SUBST(GL_CFLAGS)
AC_SUBST(GL_OBJCFLAGS)
AC_SUBST(USE_OPENGL)
AC_SUBST(USE_GLES2)

AM_CONDITIONAL(HAVE_WINDOW_X11, test "x$HAVE_WINDOW_X11" = "xyes")
AM_CONDITIONAL(HAVE_WINDOW_COCOA, test "x$HAVE_WINDOW_COCOA" = "xyes")
AM_CONDITIONAL(HAVE_WINDOW_WIN32, test "x$HAVE_WINDOW_WIN32" = "xyes")
AM_CONDITIONAL(HAVE_WINDOW_DISPMANX, test "x$HAVE_WINDOW_DISPMANX" = "xyes")
AM_CONDITIONAL(HAVE_WINDOW_WAYLAND, test "x$HAVE_WINDOW_WAYLAND" = "xyes")
AM_CONDITIONAL(HAVE_WINDOW_ANDROID, test "x$HAVE_WINDOW_ANDROID" = "xyes")
1318
AM_CONDITIONAL(HAVE_WINDOW_EAGL, test "x$HAVE_WINDOW_EAGL" = "xyes")
1319 1320 1321 1322 1323 1324 1325

AM_CONDITIONAL(USE_OPENGL, test "x$USE_OPENGL" = "xyes")
AM_CONDITIONAL(USE_GLES2, test "x$USE_GLES2" = "xyes")
AM_CONDITIONAL(USE_GLX, test "x$USE_GLX" = "xyes")
AM_CONDITIONAL(USE_EGL, test "x$USE_EGL" = "xyes")
AM_CONDITIONAL(USE_WGL, test "x$USE_WGL" = "xyes")
AM_CONDITIONAL(USE_COCOA, test "x$USE_COCOA" = "xyes")
1326
AM_CONDITIONAL(USE_EGL_MALI, test "x$USE_EGL_MALI" = "xyes")
1327
AM_CONDITIONAL(USE_EGL_RPI, test "x$USE_EGL_RPI" = "xyes")
1328
AM_CONDITIONAL(USE_EAGL, test "x$USE_EAGL" = "xyes")
1329

1330 1331
AM_CONDITIONAL(HAVE_GST_GL, test "x$USE_OPENGL" = "xyes" -o "x$USE_GLES2" = "xyes")

1332 1333 1334 1335
dnl Check for some types that are not always present
GL_INCLUDES=""
if test "x$USE_GLES2" = "xyes"; then
  GL_INCLUDES="$GL_INCLUDES
1336 1337 1338
#ifndef GL_GLEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES 1
#endif
1339
# ifdef HAVE_IOS
1340 1341 1342
#  include <OpenGLES/ES2/gl.h>
#  include <OpenGLES/ES2/glext.h>
# else
1343
#  if $GST_GL_HAVE_GLES3
1344 1345
#   include <GLES3/gl3.h>
#   include <GLES3/gl3ext.h>
1346 1347 1348
#  else
#   include <GLES2/gl2.h>
#   include <GLES2/gl2ext.h>
1349
#  endif
1350
# endif
1351 1352 1353 1354 1355
"
fi

if test "x$USE_OPENGL" = "xyes"; then
  GL_INCLUDES="$GL_INCLUDES
1356
# ifdef __APPLE__
1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367
#  include <OpenGL/OpenGL.h>
#  include <OpenGL/gl.h>
# else
#  include <GL/gl.h>
#  if __WIN32__ || _WIN32
#   include <GL/glext.h>
#  endif
# endif
"
fi

1368 1369 1370 1371
GST_GL_HAVE_GLEGLIMAGEOES=0
GST_GL_HAVE_GLCHAR=0
GST_GL_HAVE_GLSIZEIPTR=0
GST_GL_HAVE_GLINTPTR=0
1372
GST_GL_HAVE_GLSYNC=0
1373
GST_GL_HAVE_GLUINT64=0
1374
GST_GL_HAVE_GLINT64=0
1375
GST_GL_HAVE_EGLATTRIB=0
1376

1377 1378 1379
old_CFLAGS=$CFLAGS
CFLAGS="$GL_CFLAGS $CFLAGS"

1380 1381
AC_CHECK_TYPES(GLeglImageOES, [], [], [[$GL_INCLUDES]])
if test "x$ac_cv_type_GLeglImageOES" = "xyes"; then
1382
  GST_GL_HAVE_GLEGLIMAGEOES=1
1383 1384 1385 1386
fi

AC_CHECK_TYPES(GLchar, [], [], [[$GL_INCLUDES]])
if test "x$ac_cv_type_GLchar" = "xyes"; then
1387
  GST_GL_HAVE_GLCHAR=1
1388 1389 1390 1391
fi

AC_CHECK_TYPES(GLsizeiptr, [], [], [[$GL_INCLUDES]])
if test "x$ac_cv_type_GLsizeiptr" = "xyes"; then
1392
  GST_GL_HAVE_GLSIZEIPTR=1
1393 1394 1395 1396
fi

AC_CHECK_TYPES(GLintptr, [], [], [[$GL_INCLUDES]])
if test "x$ac_cv_type_GLintptr" = "xyes"; then
1397
  GST_GL_HAVE_GLINTPTR=1
1398 1399
fi

1400 1401 1402 1403 1404
AC_CHECK_TYPES(GLsync, [], [], [[$GL_INCLUDES]])
if test "x$ac_cv_type_GLsync" = "xyes"; then
  GST_GL_HAVE_GLSYNC=1
fi

1405 1406 1407 1408 1409
AC_CHECK_TYPES(GLuint64, [], [], [[$GL_INCLUDES]])
if test "x$ac_cv_type_GLuint64" = "xyes"; then
  GST_GL_HAVE_GLUINT64=1
fi

1410 1411 1412 1413 1414
AC_CHECK_TYPES(GLint64, [], [], [[$GL_INCLUDES]])
if test "x$ac_cv_type_GLint64" = "xyes"; then
  GST_GL_HAVE_GLINT64=1
fi

1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425
if test "x$USE_EGL" = "xyes"; then
  EGL_INCLUDES="$GL_INCLUDES
  #include <EGL/egl.h>
  #include <EGL/eglext.h>
  "
  AC_CHECK_TYPES(EGLAttrib, [], [], [[$EGL_INCLUDES]])
  if test "x$ac_cv_type_EGLAttrib" = "xyes"; then
    GST_GL_HAVE_EGLATTRIB=1
  fi
fi

1426 1427
CFLAGS=$old_CFLAGS

1428 1429 1430 1431 1432
GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
#define GST_GL_HAVE_GLEGLIMAGEOES $GST_GL_HAVE_GLEGLIMAGEOES
#define GST_GL_HAVE_GLCHAR $GST_GL_HAVE_GLCHAR
#define GST_GL_HAVE_GLSIZEIPTR $GST_GL_HAVE_GLSIZEIPTR
#define GST_GL_HAVE_GLINTPTR $GST_GL_HAVE_GLINTPTR
1433
#define GST_GL_HAVE_GLSYNC $GST_GL_HAVE_GLSYNC
1434
#define GST_GL_HAVE_GLUINT64 $GST_GL_HAVE_GLUINT64
1435
#define GST_GL_HAVE_GLINT64 $GST_GL_HAVE_GLINT64
1436
#define GST_GL_HAVE_EGLATTRIB $GST_GL_HAVE_EGLATTRIB
1437 1438
"

1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511
AC_CONFIG_COMMANDS([gst-libs/gst/gl/gstglconfig.h], [
	outfile=gstglconfig.h-tmp
	cat > $outfile <<\_______EOF
/* gstglconfig.h
 *
 * This is a generated file.  Please modify `configure.ac'
 */

#ifndef __GST_GL_CONFIG_H__
#define __GST_GL_CONFIG_H__

#include <gst/gst.h>

G_BEGIN_DECLS

_______EOF

	cat >>$outfile <<_______EOF
$gl_config_defines
_______EOF

	cat >>$outfile <<_______EOF

G_END_DECLS

#endif  /* __GST_GL_CONFIG_H__ */
_______EOF


	if cmp -s $outfile gst-libs/gst/gl/gstglconfig.h; then
          AC_MSG_NOTICE([gst-libs/gst/gl/gstglconfig.h is unchanged])
	  rm -f $outfile
	else
	  mv $outfile gst-libs/gst/gl/gstglconfig.h
	fi
],[
gl_config_defines='$GL_CONFIG_DEFINES'
])

dnl libpng is optional
PKG_CHECK_MODULES(LIBPNG, libpng >= 1.0, HAVE_PNG=yes, HAVE_PNG=no)
if test "x$HAVE_PNG" = "xyes"; then
  AC_DEFINE(HAVE_PNG, [1] , [Use libpng])
fi
AC_SUBST(HAVE_PNG)
AC_SUBST(LIBPNG_LIBS)
AC_SUBST(LIBPNG_CFLAGS)
AM_CONDITIONAL(HAVE_PNG, test "x$HAVE_PNG" = "xyes")

dnl libjpeg is optional
AC_ARG_WITH(jpeg-mmx, [  --with-jpeg-mmx, path to MMX'ified JPEG library])
OLD_LIBS="$LIBS"
if test x$with_jpeg_mmx != x; then
  LIBS="$LIBS -L$with_jpeg_mmx"
fi
AC_CHECK_LIB(jpeg-mmx, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
JPEG_LIBS="$LIBS -ljpeg-mmx"
LIBS="$OLD_LIBS"
if test x$HAVE_JPEG != xyes; then
  JPEG_LIBS="-ljpeg"
  AC_CHECK_LIB(jpeg, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
fi

if test x$HAVE_JPEG = xyes; then
  AC_DEFINE(HAVE_JPEG, [1], [Use libjpeg])
else
  AC_DEFINE(HAVE_JPEG, [0], [Use libjpeg])
  JPEG_LIBS=
fi
AC_SUBST(JPEG_LIBS)
AC_SUBST(HAVE_JPEG)
AM_CONDITIONAL(HAVE_JPEG, test "x$HAVE_JPEG" = "xyes")

1512
dnl Vulkan
1513 1514
PKG_CHECK_MODULES(XCB, xcb >= 1.10, GST_VULKAN_HAVE_WINDOW_XCB=1, GST_VULKAN_HAVE_WINDOW_XCB=0)
AM_CONDITIONAL(USE_XCB, test "x$GST_VULKAN_HAVE_WINDOW_XCB" = "x1")
1515

1516
PKG_CHECK_MODULES(VULKAN_WAYLAND, wayland-client >= 1.4, GST_VULKAN_HAVE_WINDOW_WAYLAND=1, GST_VULKAN_HAVE_WINDOW_WAYLAND=0)
1517 1518 1519 1520
AM_CONDITIONAL(USE_WAYLAND, test "x$GST_VULKAN_HAVE_WINDOW_WAYLAND" = "x1")
VULKAN_CONFIG_DEFINES="
#define GST_VULKAN_HAVE_WINDOW_XCB $GST_VULKAN_HAVE_WINDOW_XCB
#define GST_VULKAN_HAVE_WINDOW_WAYLAND $GST_VULKAN_HAVE_WINDOW_WAYLAND"
1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559

AC_CONFIG_COMMANDS([ext/vulkan/vkconfig.h], [
	outfile=vkconfig.h-tmp
	cat > $outfile <<\_______EOF
/* vkconfig.h
 *
 * This is a generated file.  Please modify `configure.ac'
 */

#ifndef __GST_VULKAN_CONFIG_H__
#define __GST_VULKAN_CONFIG_H__

#include <gst/gst.h>

G_BEGIN_DECLS

_______EOF

	cat >>$outfile <<_______EOF
$vulkan_config_defines
_______EOF

	cat >>$outfile <<_______EOF

G_END_DECLS

#endif  /* __GST_VULKAN_CONFIG_H__ */
_______EOF


	if cmp -s $outfile ext/vulkan/vkconfig.h; then
          AC_MSG_NOTICE([ext/vulkan/vkconfig.h is unchanged])
	  rm -f $outfile
	else
	  mv $outfile ext/vulkan/vkconfig.h
	fi
],[
vulkan_config_defines='$VULKAN_CONFIG_DEFINES'
])
1560

1561
dnl *** sys plug-ins ***
1562

1563 1564
dnl DirectSound
translit(dnm, m, l) AM_CONDITIONAL(USE_DIRECTSOUND, true)
1565 1566 1567 1568 1569 1570 1571
AG_GST_CHECK_FEATURE(DIRECTSOUND, [DirectSound], directsoundsrc, [
  HAVE_DIRECTSOUND="no"
  save_CFLAGS="$CFLAGS"
  save_LDFLAGS="$LDFLAGS"
  save_LIBS="$LIBS"
  CFLAGS="$CFLAGS $DIRECTX_CFLAGS"
  LDFLAGS="$LDFLAGS $DIRECTX_LDFLAGS"
1572
  LIBS="$LIBS -lwinmm -ldsound -ldxerr9 -luser32"
1573
  AC_MSG_CHECKING(for DirectSound LDFLAGS)
1574
  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1575 1576 1577
#include <windows.h>
#include <dxerr9.h>
#include <dsound.h>
1578
#include <mmsystem.h>
1579
]], [[
1580 1581
  DXGetErrorString9 (0);
  DirectSoundCreate(NULL, NULL, NULL);
1582
]])],
1583 1584 1585 1586 1587 1588 1589 1590 1591
    [HAVE_DIRECTSOUND="yes"],
    [HAVE_DIRECTSOUND="no"])
  AC_MSG_RESULT($HAVE_DIRECTSOUND)
  CFLAGS=$save_CFLAGS
  LDFLAGS=$save_LDFLAGS
  LIBS=$save_LIBS

  if test "x$HAVE_DIRECTSOUND" = "xyes";  then
    dnl this is much more than we want
1592
    DIRECTSOUND_LIBS="-lwinmm -ldsound -ldxerr9 -luser32"
1593 1594 1595 1596 1597 1598
    AC_SUBST(DIRECTX_CFLAGS)
    AC_SUBST(DIRECTX_LDFLAGS)
    AC_SUBST(DIRECTSOUND_LIBS)
  fi
  AC_SUBST(HAVE_DIRECTSOUND)
])
1599

1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610
dnl WASAPI
translit(dnm, m, l) AM_CONDITIONAL(USE_WASAPI, true)
AG_GST_CHECK_FEATURE(WASAPI, [WASAPI plug-in], wasapi, [
  HAVE_WASAPI="no"
  save_CFLAGS="$CFLAGS"
  save_LDFLAGS="$LDFLAGS"
  save_LIBS="$LIBS"
  CFLAGS="$CFLAGS $DIRECTX_CFLAGS"
  LDFLAGS="$LDFLAGS $DIRECTX_LDFLAGS"
  LIBS="$LIBS -lole32 -lwinmm -lksuser"
  AC_MSG_CHECKING(for WASAPI LDFLAGS)
1611
  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1612 1613 1614 1615
#include <windows.h>
#include <stdio.h>
#include <mmsystem.h>
#include <mmdeviceapi.h>
1616
]], [[
1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628
int main ()
{
    HRESULT hr = S_OK;

    hr = CoInitialize(NULL);
    if (FAILED(hr)) {
        printf("CoInitialize failed: hr = 0x%08x", hr);
        return __LINE__;
    }

	int result = 0;
    // result = do_everything(argc, argv);
1629

1630 1631 1632
    CoUninitialize();
    return result;
}
1633
]])],
1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647
    [HAVE_WASAPI="yes"],
    [HAVE_WASAPI="no"])
  AC_MSG_RESULT($HAVE_WASAPI)
  CFLAGS=$save_CFLAGS
  LDFLAGS=$save_LDFLAGS
  LIBS=$save_LIBS

  if test "x$HAVE_WASAPI" = "xyes";  then
    WASAPI_LIBS="-lole32 -lwinmm -lksuser"
    AC_SUBST(WASAPI_LIBS)
  fi
  AC_SUBST(HAVE_WASAPI)
])

David Schleef's avatar
David Schleef committed
1648 1649 1650 1651 1652 1653 1654 1655 1656
dnl Direct3D
translit(dnm, m, l) AM_CONDITIONAL(USE_DIRECT3D, true)
AG_GST_CHECK_FEATURE(DIRECT3D, [Direct3D plug-in], direct3dsink, [
  HAVE_DIRECT3D="no"
  save_CFLAGS="$CFLAGS"
  save_LDFLAGS="$LDFLAGS"
  save_LIBS="$LIBS"
  CFLAGS="$CFLAGS $DIRECTX_CFLAGS"
  LDFLAGS="$LDFLAGS $DIRECTX_LDFLAGS"
1657
  LIBS="$LIBS -ld3d9 -lgdi32"
David Schleef's avatar
David Schleef committed
1658
  AC_MSG_CHECKING(for Direct3D LDFLAGS)
1659
  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
David Schleef's avatar
David Schleef committed
1660
#include <windows.h>
1661
#include <d3d9.h>
1662
]], [[