summaryrefslogtreecommitdiffstats
path: root/package/libv4l/0011-configure.ac-drop-disable-libv4l-disable-plugin-supp.patch
blob: 22249197a150eb74f753f5ea551a6e7ad854b9e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
From 305ae25455b1f19ad2eda92523bd553fd8bc72fd Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Sun, 20 Aug 2017 23:58:44 +0200
Subject: [PATCH] configure.ac: drop --disable-libv4l, disable plugin support
 instead

In commit 2e604dfbcd09b93f0808cedb2a0b324c5569a599 ("configure.ac: add
--disable-libv4l option"), an option --disable-libv4l was added. As
part of this, libv4l is no longer built at all in static linking
configurations, just because libv4l uses dlopen() for plugin support.

However, plugin support is only a side feature of libv4l, and one may
need to use libv4l in static configurations, just without plugin
support.

Therefore, this commit:

 - Essentially reverts 2e604dfbcd09b93f0808cedb2a0b324c5569a599, so
   that libv4l can be built in static linking configurations again.

 - Adjusts the compilation of libv4l2 so that the plugin support is
   not compiled in when dlopen() in static linking configuration
   (dlopen is not available).

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Submitted-upstream: https://www.mail-archive.com/linux-media@vger.kernel.org/msg117449.html
---
 Makefile.am                       | 11 ++---------
 configure.ac                      | 15 +++------------
 lib/libv4l2/Makefile.am           |  6 +++++-
 lib/libv4l2/libv4l2-priv.h        | 14 ++++++++++++++
 utils/Makefile.am                 |  6 +-----
 utils/v4l2-compliance/Makefile.am |  4 ----
 utils/v4l2-ctl/Makefile.am        |  4 ----
 7 files changed, 25 insertions(+), 35 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 07c3ef8..e603472 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,17 +1,10 @@
 AUTOMAKE_OPTIONS = foreign
 ACLOCAL_AMFLAGS = -I m4
 
-SUBDIRS = v4l-utils-po libdvbv5-po
-
-if WITH_LIBV4L
-SUBDIRS += lib
-endif
+SUBDIRS = v4l-utils-po libdvbv5-po lib
 
 if WITH_V4LUTILS
-SUBDIRS += utils
-if WITH_LIBV4L
-SUBDIRS += contrib
-endif
+SUBDIRS += utils contrib
 endif
 
 EXTRA_DIST = android-config.h bootstrap.sh doxygen_libdvbv5.cfg include COPYING.libv4l \
diff --git a/configure.ac b/configure.ac
index 58fb688..2ecb4a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -374,14 +374,6 @@ AC_ARG_ENABLE(libdvbv5,
    esac]
 )
 
-AC_ARG_ENABLE(libv4l,
-  AS_HELP_STRING([--disable-libv4l], [disable libv4l compilation]),
-  [case "${enableval}" in
-     yes | no ) ;;
-     *) AC_MSG_ERROR(bad value ${enableval} for --disable-libv4l) ;;
-   esac]
-)
-
 AC_ARG_ENABLE(dyn-libv4l,
   AS_HELP_STRING([--disable-dyn-libv4l], [disable dynamic libv4l support]),
   [case "${enableval}" in
@@ -439,7 +431,6 @@ AM_CONDITIONAL([WITH_LIBDVBV5],     [test x$enable_libdvbv5  != xno -a x$have_li
 AM_CONDITIONAL([WITH_DVBV5_REMOTE], [test x$enable_libdvbv5  != xno -a x$have_libudev = xyes -a x$have_pthread = xyes])
 
 AM_CONDITIONAL([WITH_DYN_LIBV4L],   [test x$enable_dyn_libv4l != xno])
-AM_CONDITIONAL([WITH_LIBV4L],       [test x$enable_libv4l    != xno -a x$enable_shared != xno])
 AM_CONDITIONAL([WITH_V4LUTILS],	    [test x$enable_v4l_utils != xno -a x$linux_os = xyes])
 AM_CONDITIONAL([WITH_QV4L2],	    [test x${qt_pkgconfig} = xtrue -a x$enable_qv4l2 != xno])
 AM_CONDITIONAL([WITH_V4L_PLUGINS],  [test x$enable_dyn_libv4l != xno -a x$enable_shared != xno])
@@ -467,11 +458,12 @@ AM_COND_IF([WITH_LIBDVBV5], [USE_LIBDVBV5="yes"], [USE_LIBDVBV5="no"])
 AM_COND_IF([WITH_DVBV5_REMOTE], [USE_DVBV5_REMOTE="yes"
 				 AC_DEFINE([HAVE_DVBV5_REMOTE], [1], [Usage of DVBv5 remote enabled])],
 			        [USE_DVBV5_REMOTE="no"])
-AM_COND_IF([WITH_LIBV4L], [USE_LIBV4L="yes"], [USE_LIBV4L="no"])
 AM_COND_IF([WITH_DYN_LIBV4L], [USE_DYN_LIBV4L="yes"], [USE_DYN_LIBV4L="no"])
 AM_COND_IF([WITH_V4LUTILS], [USE_V4LUTILS="yes"], [USE_V4LUTILS="no"])
 AM_COND_IF([WITH_QV4L2], [USE_QV4L2="yes"], [USE_QV4L2="no"])
-AM_COND_IF([WITH_V4L_PLUGINS], [USE_V4L_PLUGINS="yes"], [USE_V4L_PLUGINS="no"])
+AM_COND_IF([WITH_V4L_PLUGINS], [USE_V4L_PLUGINS="yes"
+				AC_DEFINE([HAVE_V4L_PLUGINS], [1], [V4L plugin support enabled])],
+				[USE_V4L_PLUGINS="no"])
 AM_COND_IF([WITH_V4L_WRAPPERS], [USE_V4L_WRAPPERS="yes"], [USE_V4L_WRAPPERS="no"])
 AM_COND_IF([WITH_GCONV], [USE_GCONV="yes"], [USE_GCONV="no"])
 AM_COND_IF([WITH_V4L2_CTL_LIBV4L], [USE_V4L2_CTL_LIBV4L="yes"], [USE_V4L2_CTL_LIBV4L="no"])
@@ -503,7 +495,6 @@ compile time options summary
 
     gconv                      : $USE_GCONV
 
-    libv4l                     : $USE_LIBV4L
     dynamic libv4l             : $USE_DYN_LIBV4L
     v4l_plugins                : $USE_V4L_PLUGINS
     v4l_wrappers               : $USE_V4L_WRAPPERS
diff --git a/lib/libv4l2/Makefile.am b/lib/libv4l2/Makefile.am
index 811c45c..3a1bb90 100644
--- a/lib/libv4l2/Makefile.am
+++ b/lib/libv4l2/Makefile.am
@@ -15,7 +15,11 @@ else
 noinst_LTLIBRARIES = libv4l2.la
 endif
 
-libv4l2_la_SOURCES = libv4l2.c v4l2-plugin.c log.c libv4l2-priv.h
+libv4l2_la_SOURCES = libv4l2.c log.c libv4l2-priv.h
+if WITH_V4L_PLUGINS
+libv4l2_la_SOURCES += v4l2-plugin.c
+endif
+
 libv4l2_la_CPPFLAGS = $(CFLAG_VISIBILITY) $(ENFORCE_LIBV4L_STATIC)
 libv4l2_la_LDFLAGS = $(LIBV4L2_VERSION) -lpthread $(DLOPEN_LIBS) $(ENFORCE_LIBV4L_STATIC)
 libv4l2_la_LIBADD = ../libv4lconvert/libv4lconvert.la
diff --git a/lib/libv4l2/libv4l2-priv.h b/lib/libv4l2/libv4l2-priv.h
index 343db5e..1924c91 100644
--- a/lib/libv4l2/libv4l2-priv.h
+++ b/lib/libv4l2/libv4l2-priv.h
@@ -107,10 +107,24 @@ struct v4l2_dev_info {
 };
 
 /* From v4l2-plugin.c */
+#if defined(HAVE_V4L_PLUGINS)
 void v4l2_plugin_init(int fd, void **plugin_lib_ret, void **plugin_priv_ret,
 		      const struct libv4l_dev_ops **dev_ops_ret);
 void v4l2_plugin_cleanup(void *plugin_lib, void *plugin_priv,
 			 const struct libv4l_dev_ops *dev_ops);
+#else
+static inline void v4l2_plugin_init(int fd, void **plugin_lib_ret, void **plugin_priv_ret,
+				    const struct libv4l_dev_ops **dev_ops_ret)
+{
+	*dev_ops_ret = v4lconvert_get_default_dev_ops();
+	*plugin_lib_ret = NULL;
+	*plugin_priv_ret = NULL;
+}
+static inline void v4l2_plugin_cleanup(void *plugin_lib, void *plugin_priv,
+				       const struct libv4l_dev_ops *dev_ops)
+{
+}
+#endif /* WITH_V4L_PLUGINS */
 
 /* From log.c */
 extern const char *v4l2_ioctls[];
diff --git a/utils/Makefile.am b/utils/Makefile.am
index ce710c2..d7708cc 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -13,12 +13,8 @@ SUBDIRS = \
 	v4l2-sysfs-path \
 	cec-ctl \
 	cec-compliance \
-	cec-follower
-
-if WITH_LIBV4L
-SUBDIRS += \
+	cec-follower \
 	rds-ctl
-endif
 
 if WITH_LIBDVBV5
 SUBDIRS += \
diff --git a/utils/v4l2-compliance/Makefile.am b/utils/v4l2-compliance/Makefile.am
index 0240a50..c2b5919 100644
--- a/utils/v4l2-compliance/Makefile.am
+++ b/utils/v4l2-compliance/Makefile.am
@@ -7,16 +7,12 @@ v4l2_compliance_SOURCES = v4l2-compliance.cpp v4l2-test-debug.cpp v4l2-test-inpu
 	v4l2-test-codecs.cpp v4l2-test-colors.cpp v4l2-compliance.h
 v4l2_compliance_CPPFLAGS = -I../common
 
-if WITH_LIBV4L
 if WITH_V4L2_COMPLIANCE_LIBV4L
 v4l2_compliance_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la -lrt -lpthread
 else
 v4l2_compliance_LDADD = -lrt -lpthread
 DEFS += -DNO_LIBV4L2
 endif
-else
-DEFS += -DNO_LIBV4L2
-endif
 
 EXTRA_DIST = Android.mk fixme.txt v4l2-compliance.1
 
diff --git a/utils/v4l2-ctl/Makefile.am b/utils/v4l2-ctl/Makefile.am
index 4475aed..955647d 100644
--- a/utils/v4l2-ctl/Makefile.am
+++ b/utils/v4l2-ctl/Makefile.am
@@ -9,14 +9,10 @@ v4l2_ctl_SOURCES = v4l2-ctl.cpp v4l2-ctl.h v4l2-ctl-common.cpp v4l2-ctl-tuner.cp
 	v4l2-tpg-colors.c v4l2-tpg-core.c v4l-stream.c
 v4l2_ctl_CPPFLAGS = -I../common
 
-if WITH_LIBV4L
 if WITH_V4L2_CTL_LIBV4L
 v4l2_ctl_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la -lrt -lpthread
 else
 DEFS += -DNO_LIBV4L2
 endif
-else
-DEFS += -DNO_LIBV4L2
-endif
 
 EXTRA_DIST = Android.mk v4l2-ctl.1
-- 
2.9.4

OpenPOWER on IntegriCloud