2
1

0011-configure.ac-drop-disable-libv4l-disable-plugin-supp.patch 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. From 305ae25455b1f19ad2eda92523bd553fd8bc72fd Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Sun, 20 Aug 2017 23:58:44 +0200
  4. Subject: [PATCH] configure.ac: drop --disable-libv4l, disable plugin support
  5. instead
  6. In commit 2e604dfbcd09b93f0808cedb2a0b324c5569a599 ("configure.ac: add
  7. --disable-libv4l option"), an option --disable-libv4l was added. As
  8. part of this, libv4l is no longer built at all in static linking
  9. configurations, just because libv4l uses dlopen() for plugin support.
  10. However, plugin support is only a side feature of libv4l, and one may
  11. need to use libv4l in static configurations, just without plugin
  12. support.
  13. Therefore, this commit:
  14. - Essentially reverts 2e604dfbcd09b93f0808cedb2a0b324c5569a599, so
  15. that libv4l can be built in static linking configurations again.
  16. - Adjusts the compilation of libv4l2 so that the plugin support is
  17. not compiled in when dlopen() in static linking configuration
  18. (dlopen is not available).
  19. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  20. Submitted-upstream: https://www.mail-archive.com/linux-media@vger.kernel.org/msg117449.html
  21. ---
  22. Makefile.am | 11 ++---------
  23. configure.ac | 15 +++------------
  24. lib/libv4l2/Makefile.am | 6 +++++-
  25. lib/libv4l2/libv4l2-priv.h | 14 ++++++++++++++
  26. utils/Makefile.am | 6 +-----
  27. utils/v4l2-compliance/Makefile.am | 4 ----
  28. utils/v4l2-ctl/Makefile.am | 4 ----
  29. 7 files changed, 25 insertions(+), 35 deletions(-)
  30. diff --git a/Makefile.am b/Makefile.am
  31. index 07c3ef8..e603472 100644
  32. --- a/Makefile.am
  33. +++ b/Makefile.am
  34. @@ -1,17 +1,10 @@
  35. AUTOMAKE_OPTIONS = foreign
  36. ACLOCAL_AMFLAGS = -I m4
  37. -SUBDIRS = v4l-utils-po libdvbv5-po
  38. -
  39. -if WITH_LIBV4L
  40. -SUBDIRS += lib
  41. -endif
  42. +SUBDIRS = v4l-utils-po libdvbv5-po lib
  43. if WITH_V4LUTILS
  44. -SUBDIRS += utils
  45. -if WITH_LIBV4L
  46. -SUBDIRS += contrib
  47. -endif
  48. +SUBDIRS += utils contrib
  49. endif
  50. EXTRA_DIST = android-config.h bootstrap.sh doxygen_libdvbv5.cfg include COPYING.libv4l \
  51. diff --git a/configure.ac b/configure.ac
  52. index 58fb688..2ecb4a1 100644
  53. --- a/configure.ac
  54. +++ b/configure.ac
  55. @@ -374,14 +374,6 @@ AC_ARG_ENABLE(libdvbv5,
  56. esac]
  57. )
  58. -AC_ARG_ENABLE(libv4l,
  59. - AS_HELP_STRING([--disable-libv4l], [disable libv4l compilation]),
  60. - [case "${enableval}" in
  61. - yes | no ) ;;
  62. - *) AC_MSG_ERROR(bad value ${enableval} for --disable-libv4l) ;;
  63. - esac]
  64. -)
  65. -
  66. AC_ARG_ENABLE(dyn-libv4l,
  67. AS_HELP_STRING([--disable-dyn-libv4l], [disable dynamic libv4l support]),
  68. [case "${enableval}" in
  69. @@ -439,7 +431,6 @@ AM_CONDITIONAL([WITH_LIBDVBV5], [test x$enable_libdvbv5 != xno -a x$have_li
  70. AM_CONDITIONAL([WITH_DVBV5_REMOTE], [test x$enable_libdvbv5 != xno -a x$have_libudev = xyes -a x$have_pthread = xyes])
  71. AM_CONDITIONAL([WITH_DYN_LIBV4L], [test x$enable_dyn_libv4l != xno])
  72. -AM_CONDITIONAL([WITH_LIBV4L], [test x$enable_libv4l != xno -a x$enable_shared != xno])
  73. AM_CONDITIONAL([WITH_V4LUTILS], [test x$enable_v4l_utils != xno -a x$linux_os = xyes])
  74. AM_CONDITIONAL([WITH_QV4L2], [test x${qt_pkgconfig} = xtrue -a x$enable_qv4l2 != xno])
  75. AM_CONDITIONAL([WITH_V4L_PLUGINS], [test x$enable_dyn_libv4l != xno -a x$enable_shared != xno])
  76. @@ -467,11 +458,12 @@ AM_COND_IF([WITH_LIBDVBV5], [USE_LIBDVBV5="yes"], [USE_LIBDVBV5="no"])
  77. AM_COND_IF([WITH_DVBV5_REMOTE], [USE_DVBV5_REMOTE="yes"
  78. AC_DEFINE([HAVE_DVBV5_REMOTE], [1], [Usage of DVBv5 remote enabled])],
  79. [USE_DVBV5_REMOTE="no"])
  80. -AM_COND_IF([WITH_LIBV4L], [USE_LIBV4L="yes"], [USE_LIBV4L="no"])
  81. AM_COND_IF([WITH_DYN_LIBV4L], [USE_DYN_LIBV4L="yes"], [USE_DYN_LIBV4L="no"])
  82. AM_COND_IF([WITH_V4LUTILS], [USE_V4LUTILS="yes"], [USE_V4LUTILS="no"])
  83. AM_COND_IF([WITH_QV4L2], [USE_QV4L2="yes"], [USE_QV4L2="no"])
  84. -AM_COND_IF([WITH_V4L_PLUGINS], [USE_V4L_PLUGINS="yes"], [USE_V4L_PLUGINS="no"])
  85. +AM_COND_IF([WITH_V4L_PLUGINS], [USE_V4L_PLUGINS="yes"
  86. + AC_DEFINE([HAVE_V4L_PLUGINS], [1], [V4L plugin support enabled])],
  87. + [USE_V4L_PLUGINS="no"])
  88. AM_COND_IF([WITH_V4L_WRAPPERS], [USE_V4L_WRAPPERS="yes"], [USE_V4L_WRAPPERS="no"])
  89. AM_COND_IF([WITH_GCONV], [USE_GCONV="yes"], [USE_GCONV="no"])
  90. AM_COND_IF([WITH_V4L2_CTL_LIBV4L], [USE_V4L2_CTL_LIBV4L="yes"], [USE_V4L2_CTL_LIBV4L="no"])
  91. @@ -503,7 +495,6 @@ compile time options summary
  92. gconv : $USE_GCONV
  93. - libv4l : $USE_LIBV4L
  94. dynamic libv4l : $USE_DYN_LIBV4L
  95. v4l_plugins : $USE_V4L_PLUGINS
  96. v4l_wrappers : $USE_V4L_WRAPPERS
  97. diff --git a/lib/libv4l2/Makefile.am b/lib/libv4l2/Makefile.am
  98. index 811c45c..3a1bb90 100644
  99. --- a/lib/libv4l2/Makefile.am
  100. +++ b/lib/libv4l2/Makefile.am
  101. @@ -15,7 +15,11 @@ else
  102. noinst_LTLIBRARIES = libv4l2.la
  103. endif
  104. -libv4l2_la_SOURCES = libv4l2.c v4l2-plugin.c log.c libv4l2-priv.h
  105. +libv4l2_la_SOURCES = libv4l2.c log.c libv4l2-priv.h
  106. +if WITH_V4L_PLUGINS
  107. +libv4l2_la_SOURCES += v4l2-plugin.c
  108. +endif
  109. +
  110. libv4l2_la_CPPFLAGS = $(CFLAG_VISIBILITY) $(ENFORCE_LIBV4L_STATIC)
  111. libv4l2_la_LDFLAGS = $(LIBV4L2_VERSION) -lpthread $(DLOPEN_LIBS) $(ENFORCE_LIBV4L_STATIC)
  112. libv4l2_la_LIBADD = ../libv4lconvert/libv4lconvert.la
  113. diff --git a/lib/libv4l2/libv4l2-priv.h b/lib/libv4l2/libv4l2-priv.h
  114. index 343db5e..1924c91 100644
  115. --- a/lib/libv4l2/libv4l2-priv.h
  116. +++ b/lib/libv4l2/libv4l2-priv.h
  117. @@ -107,10 +107,24 @@ struct v4l2_dev_info {
  118. };
  119. /* From v4l2-plugin.c */
  120. +#if defined(HAVE_V4L_PLUGINS)
  121. void v4l2_plugin_init(int fd, void **plugin_lib_ret, void **plugin_priv_ret,
  122. const struct libv4l_dev_ops **dev_ops_ret);
  123. void v4l2_plugin_cleanup(void *plugin_lib, void *plugin_priv,
  124. const struct libv4l_dev_ops *dev_ops);
  125. +#else
  126. +static inline void v4l2_plugin_init(int fd, void **plugin_lib_ret, void **plugin_priv_ret,
  127. + const struct libv4l_dev_ops **dev_ops_ret)
  128. +{
  129. + *dev_ops_ret = v4lconvert_get_default_dev_ops();
  130. + *plugin_lib_ret = NULL;
  131. + *plugin_priv_ret = NULL;
  132. +}
  133. +static inline void v4l2_plugin_cleanup(void *plugin_lib, void *plugin_priv,
  134. + const struct libv4l_dev_ops *dev_ops)
  135. +{
  136. +}
  137. +#endif /* WITH_V4L_PLUGINS */
  138. /* From log.c */
  139. extern const char *v4l2_ioctls[];
  140. diff --git a/utils/Makefile.am b/utils/Makefile.am
  141. index ce710c2..d7708cc 100644
  142. --- a/utils/Makefile.am
  143. +++ b/utils/Makefile.am
  144. @@ -13,12 +13,8 @@ SUBDIRS = \
  145. v4l2-sysfs-path \
  146. cec-ctl \
  147. cec-compliance \
  148. - cec-follower
  149. -
  150. -if WITH_LIBV4L
  151. -SUBDIRS += \
  152. + cec-follower \
  153. rds-ctl
  154. -endif
  155. if WITH_LIBDVBV5
  156. SUBDIRS += \
  157. diff --git a/utils/v4l2-compliance/Makefile.am b/utils/v4l2-compliance/Makefile.am
  158. index 0240a50..c2b5919 100644
  159. --- a/utils/v4l2-compliance/Makefile.am
  160. +++ b/utils/v4l2-compliance/Makefile.am
  161. @@ -7,16 +7,12 @@ v4l2_compliance_SOURCES = v4l2-compliance.cpp v4l2-test-debug.cpp v4l2-test-inpu
  162. v4l2-test-codecs.cpp v4l2-test-colors.cpp v4l2-compliance.h
  163. v4l2_compliance_CPPFLAGS = -I../common
  164. -if WITH_LIBV4L
  165. if WITH_V4L2_COMPLIANCE_LIBV4L
  166. v4l2_compliance_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la -lrt -lpthread
  167. else
  168. v4l2_compliance_LDADD = -lrt -lpthread
  169. DEFS += -DNO_LIBV4L2
  170. endif
  171. -else
  172. -DEFS += -DNO_LIBV4L2
  173. -endif
  174. EXTRA_DIST = Android.mk fixme.txt v4l2-compliance.1
  175. diff --git a/utils/v4l2-ctl/Makefile.am b/utils/v4l2-ctl/Makefile.am
  176. index 4475aed..955647d 100644
  177. --- a/utils/v4l2-ctl/Makefile.am
  178. +++ b/utils/v4l2-ctl/Makefile.am
  179. @@ -9,14 +9,10 @@ v4l2_ctl_SOURCES = v4l2-ctl.cpp v4l2-ctl.h v4l2-ctl-common.cpp v4l2-ctl-tuner.cp
  180. v4l2-tpg-colors.c v4l2-tpg-core.c v4l-stream.c
  181. v4l2_ctl_CPPFLAGS = -I../common
  182. -if WITH_LIBV4L
  183. if WITH_V4L2_CTL_LIBV4L
  184. v4l2_ctl_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la -lrt -lpthread
  185. else
  186. DEFS += -DNO_LIBV4L2
  187. endif
  188. -else
  189. -DEFS += -DNO_LIBV4L2
  190. -endif
  191. EXTRA_DIST = Android.mk v4l2-ctl.1
  192. --
  193. 2.9.4