blob: 65d191a3966bcf4a76aaa9a10477d24201e08eda [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 092aadfc1df69c46d920b0cd39f98d363d6988b3 Mon Sep 17 00:00:00 2001
2From: Carlos Rafael Giani <dv@pseudoterminal.org>
3Date: Thu, 19 Jul 2018 11:16:05 +0200
4Subject: [PATCH] gl: Add switches for explicitely enabling/disabling PNG and
5 JPEG support
6
7Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=796833]
8
9Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org>
10---
11 m4/gst-gl.m4 | 66 ++++++++++++++++++++++++++++++++++++----------------
12 1 file changed, 46 insertions(+), 20 deletions(-)
13
14diff --git a/m4/gst-gl.m4 b/m4/gst-gl.m4
15index 20b2233de..f8809981c 100644
16--- a/m4/gst-gl.m4
17+++ b/m4/gst-gl.m4
18@@ -126,6 +126,24 @@ AC_ARG_ENABLE([gbm],
19 *) AC_MSG_ERROR([bad value ${enableval} for --enable-gbm]) ;;
20 esac],[NEED_GBM=auto])
21
22+AC_ARG_ENABLE([png],
23+ [ --enable-png Enable libpng support @<:@default=auto@:>@],
24+ [case "${enableval}" in
25+ yes) NEED_PNG=yes ;;
26+ no) NEED_PNG=no ;;
27+ auto) NEED_PNG=auto ;;
28+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-png]) ;;
29+ esac],[NEED_PNG=auto])
30+
31+AC_ARG_ENABLE([jpeg],
32+ [ --enable-jpeg Enable libjpeg support @<:@default=auto@:>@],
33+ [case "${enableval}" in
34+ yes) NEED_JPEG=yes ;;
35+ no) NEED_JPEG=no ;;
36+ auto) NEED_JPEG=auto ;;
37+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-jpeg]) ;;
38+ esac],[NEED_JPEG=auto])
39+
40 AG_GST_PKG_CHECK_MODULES(X11_XCB, x11-xcb)
41 save_CPPFLAGS="$CPPFLAGS"
42 save_LIBS="$LIBS"
43@@ -1043,9 +1061,13 @@ dnl Needed by plugins that use g_module_*() API
44 PKG_CHECK_MODULES(GMODULE_NO_EXPORT, gmodule-no-export-2.0)
45
46 dnl libpng is optional
47-PKG_CHECK_MODULES(LIBPNG, libpng >= 1.0, HAVE_PNG=yes, HAVE_PNG=no)
48-if test "x$HAVE_PNG" = "xyes"; then
49- AC_DEFINE(HAVE_PNG, [1] , [Use libpng])
50+if test "x$NEED_PNG" != "xno"; then
51+ PKG_CHECK_MODULES(LIBPNG, libpng >= 1.0, HAVE_PNG=yes, HAVE_PNG=no)
52+ if test "x$HAVE_PNG" = "xyes"; then
53+ AC_DEFINE(HAVE_PNG, [1] , [Use libpng])
54+ elif test "x$NEED_PNG" = "xyes"; then
55+ AC_MSG_ERROR([libpng support requested but libpng is not available])
56+ fi
57 fi
58 AC_SUBST(HAVE_PNG)
59 AC_SUBST(LIBPNG_LIBS)
60@@ -1053,25 +1075,29 @@ AC_SUBST(LIBPNG_CFLAGS)
61
62 dnl libjpeg is optional
63 AC_ARG_WITH(jpeg-mmx, [ --with-jpeg-mmx, path to MMX'ified JPEG library])
64-OLD_LIBS="$LIBS"
65-if test x$with_jpeg_mmx != x; then
66- LIBS="$LIBS -L$with_jpeg_mmx"
67-fi
68-AC_CHECK_LIB(jpeg-mmx, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
69-JPEG_LIBS="$LIBS -ljpeg-mmx"
70-LIBS="$OLD_LIBS"
71-if test x$HAVE_JPEG != xyes; then
72- JPEG_LIBS="-ljpeg"
73- AC_CHECK_LIB(jpeg, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
74-fi
75+if test "x$NEED_JPEG" != "xno"; then
76+ OLD_LIBS="$LIBS"
77+ if test x$with_jpeg_mmx != x; then
78+ LIBS="$LIBS -L$with_jpeg_mmx"
79+ fi
80+ AC_CHECK_LIB(jpeg-mmx, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
81+ JPEG_LIBS="$LIBS -ljpeg-mmx"
82+ LIBS="$OLD_LIBS"
83+ if test x$HAVE_JPEG != xyes; then
84+ JPEG_LIBS="-ljpeg"
85+ AC_CHECK_LIB(jpeg, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
86+ fi
87
88-if test x$HAVE_JPEG = xyes; then
89- AC_DEFINE(HAVE_JPEG, [1], [Use libjpeg])
90-else
91- JPEG_LIBS=
92+ if test x$HAVE_JPEG = xyes; then
93+ AC_DEFINE(HAVE_JPEG, [1], [Use libjpeg])
94+ elif test "x$NEED_JPEG" = "xyes"; then
95+ AC_MSG_ERROR([libjpeg support requested but libjpeg is not available])
96+ else
97+ JPEG_LIBS=
98+ fi
99+ AC_SUBST(JPEG_LIBS)
100+ AC_SUBST(HAVE_JPEG)
101 fi
102-AC_SUBST(JPEG_LIBS)
103-AC_SUBST(HAVE_JPEG)
104 ])
105
106 dnl --------------------------------------------------------------------------
107--
1082.17.1
109