All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] v4l-utils: new configure options
@ 2015-09-03 15:23 Hans Verkuil
  2015-09-03 15:23 ` [PATCH 1/2] v4l2-ctl/compliance: add configure option to disable libv4l use Hans Verkuil
  2015-09-14  7:19 ` [PATCH 0/2] v4l-utils: new configure options Gregor Jasny
  0 siblings, 2 replies; 5+ messages in thread
From: Hans Verkuil @ 2015-09-03 15:23 UTC (permalink / raw)
  To: linux-media; +Cc: gjasny

Gregor,

Can you take a look at this to see if I did this correctly? I'm no
autoconf hero, so before I push I'd like some feedback.

The main reason for these changes is that I need to build v4l2-ctl for
an embedded system and rather than having to hack on my side, I prefer
to add configure options that do what I (and probably others) want.

Regards,

        Hans


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] v4l2-ctl/compliance: add configure option to disable libv4l use
  2015-09-03 15:23 [PATCH 0/2] v4l-utils: new configure options Hans Verkuil
@ 2015-09-03 15:23 ` Hans Verkuil
  2015-09-03 15:23   ` [PATCH 2/2] v4l-utils: allow building even if argp.h is not present Hans Verkuil
  2015-09-14  7:19 ` [PATCH 0/2] v4l-utils: new configure options Gregor Jasny
  1 sibling, 1 reply; 5+ messages in thread
From: Hans Verkuil @ 2015-09-03 15:23 UTC (permalink / raw)
  To: linux-media; +Cc: gjasny, Hans Verkuil

From: Hans Verkuil <hansverk@cisco.com>

Sometimes you want to compile these two utilities without the libv4l2 wrapper.
This patch adds new configure options to do this:

--disable-v4l2-compliance-libv4l
--disable-v4l2-ctl-libv4l

This is useful when building for an embedded system where you do not want
to use the libv4l2 wrapper library.

The capability to do this was already available, but not hooked up to
the configure system.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
---
 configure.ac                      | 18 ++++++++++++++++++
 utils/v4l2-compliance/Makefile.am |  8 +++++++-
 utils/v4l2-ctl/Makefile.am        |  8 +++++++-
 3 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 53cbc8d..13df263 100644
--- a/configure.ac
+++ b/configure.ac
@@ -359,6 +359,22 @@ AC_ARG_ENABLE(v4l-utils,
    esac]
 )
 
+AC_ARG_ENABLE(v4l2-compliance-libv4l,
+  AS_HELP_STRING([--disable-v4l2-compliance-libv4l], [disable use of libv4l in v4l2-compliance]),
+  [case "${enableval}" in
+     yes | no ) ;;
+     *) AC_MSG_ERROR(bad value ${enableval} for --disable-v4l2-compliance-libv4l) ;;
+   esac]
+)
+
+AC_ARG_ENABLE(v4l2-ctl-libv4l,
+  AS_HELP_STRING([--disable-v4l2-ctl-libv4l], [disable use of libv4l in v4l2-ctl]),
+  [case "${enableval}" in
+     yes | no ) ;;
+     *) AC_MSG_ERROR(bad value ${enableval} for --disable-v4l2-ctl-libv4l) ;;
+   esac]
+)
+
 AC_ARG_ENABLE(qv4l2,
   AS_HELP_STRING([--disable-qv4l2], [disable qv4l2 compilation]),
   [case "${enableval}" in
@@ -383,6 +399,8 @@ AM_CONDITIONAL([WITH_V4L_PLUGINS],  [test x$enable_libv4l != xno -a x$enable_sha
 AM_CONDITIONAL([WITH_V4L_WRAPPERS], [test x$enable_libv4l != xno -a x$enable_shared != xno])
 AM_CONDITIONAL([WITH_QTGL],	    [test ${qt_pkgconfig_gl} = true])
 AM_CONDITIONAL([WITH_GCONV],        [test x${enable_gconv} = xyes])
+AM_CONDITIONAL([WITH_V4L2_CTL_LIBV4L], [test x${enable_v4l2_ctl_libv4l} != xno])
+AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_LIBV4L], [test x${enable_v4l2_compliance_libv4l} != xno])
 
 # append -static to libtool compile and link command to enforce static libs
 AS_IF([test x$enable_libdvbv5 = xno], [AC_SUBST([ENFORCE_LIBDVBV5_STATIC], ["-static"])])
diff --git a/utils/v4l2-compliance/Makefile.am b/utils/v4l2-compliance/Makefile.am
index 3ffc5bd..e7bfc8a 100644
--- a/utils/v4l2-compliance/Makefile.am
+++ b/utils/v4l2-compliance/Makefile.am
@@ -1,10 +1,16 @@
 bin_PROGRAMS = v4l2-compliance
 man_MANS = v4l2-compliance.1
+DEFS :=
 
 v4l2_compliance_SOURCES = v4l2-compliance.cpp v4l2-test-debug.cpp v4l2-test-input-output.cpp \
 	v4l2-test-controls.cpp v4l2-test-io-config.cpp v4l2-test-formats.cpp v4l2-test-buffers.cpp \
 	v4l2-test-codecs.cpp v4l2-test-colors.cpp v4l2-compliance.h cv4l-helpers.h v4l-helpers.h
-v4l2_compliance_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la
 v4l2_compliance_LDFLAGS = -lrt
 
+if WITH_V4L2_COMPLIANCE_LIBV4L
+v4l2_compliance_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la
+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 af7111e..932499c 100644
--- a/utils/v4l2-ctl/Makefile.am
+++ b/utils/v4l2-ctl/Makefile.am
@@ -1,12 +1,18 @@
 bin_PROGRAMS = v4l2-ctl
 man_MANS = v4l2-ctl.1
+DEFS :=
 
 v4l2_ctl_SOURCES = v4l2-ctl.cpp v4l2-ctl.h v4l2-ctl-common.cpp v4l2-ctl-tuner.cpp \
 	v4l2-ctl-io.cpp v4l2-ctl-stds.cpp v4l2-ctl-vidcap.cpp v4l2-ctl-vidout.cpp \
 	v4l2-ctl-overlay.cpp v4l2-ctl-vbi.cpp v4l2-ctl-selection.cpp v4l2-ctl-misc.cpp \
 	v4l2-ctl-streaming.cpp v4l2-ctl-sdr.cpp v4l2-ctl-edid.cpp v4l2-ctl-modes.cpp \
 	vivid-tpg-colors.c vivid-tpg.c
-v4l2_ctl_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la
 v4l2_ctl_LDFLAGS = -lrt
 
+if WITH_V4L2_CTL_LIBV4L
+v4l2_ctl_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la
+else
+DEFS += -DNO_LIBV4L2
+endif
+
 EXTRA_DIST = Android.mk vivid-tpg.h.patch v4l2-ctl.1
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] v4l-utils: allow building even if argp.h is not present
  2015-09-03 15:23 ` [PATCH 1/2] v4l2-ctl/compliance: add configure option to disable libv4l use Hans Verkuil
@ 2015-09-03 15:23   ` Hans Verkuil
  2015-09-03 17:40     ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Verkuil @ 2015-09-03 15:23 UTC (permalink / raw)
  To: linux-media; +Cc: gjasny, Hans Verkuil

From: Hans Verkuil <hansverk@cisco.com>

The argp.h functionality is not always available on embedded systems
(android!). A number of utilities depend on this and running configure
will fail if argp.h is missing.

Add a new configure option --without-argp to disable that argp.h check
and instead skip any utilities that use argp.h.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
---
 configure.ac             | 22 ++++++++++++++++------
 contrib/test/Makefile.am |  7 ++++++-
 utils/Makefile.am        | 11 +++++++----
 3 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/configure.ac b/configure.ac
index 13df263..d645386 100644
--- a/configure.ac
+++ b/configure.ac
@@ -270,14 +270,24 @@ dl_saved_libs=$LIBS
   AC_SUBST([DLOPEN_LIBS])
 LIBS=$dl_saved_libs
 
-AC_CHECK_HEADER([argp.h],,AC_MSG_ERROR(Cannot continue: argp.h not found))
+AC_ARG_WITH([argp],
+            AS_HELP_STRING([--without-argp], [Do not use argp.h]),
+            [],
+            [with_argp=yes])
+
 argp_saved_libs=$LIBS
-  AC_SEARCH_LIBS([argp_parse],
-                 [argp],
-                 [test "$ac_cv_search_argp_parse" = "none required" || ARGP_LIBS=$ac_cv_search_argp_parse],
-                 [AC_MSG_ERROR([unable to find the argp_parse() function])])
-  AC_SUBST([ARGP_LIBS])
+AS_IF([test "x$with_argp" != xno],
+      [
+          AC_CHECK_HEADER([argp.h],,AC_MSG_ERROR(Cannot continue: argp.h not found))]
+	  AC_SEARCH_LIBS([argp_parse],
+			 [argp],
+			 [test "$ac_cv_search_argp_parse" = "none required" || ARGP_LIBS=$ac_cv_search_argp_parse],
+			 [AC_MSG_ERROR([unable to find the argp_parse() function])])
+	  AC_SUBST([ARGP_LIBS])
+      ],
+      )
 LIBS=$argp_saved_libs
+AM_CONDITIONAL([HAVE_ARGP], [test "x$with_argp" != xno])
 
 AC_CHECK_HEADER([linux/i2c-dev.h], [linux_i2c_dev=yes], [linux_i2c_dev=no])
 AM_CONDITIONAL([HAVE_LINUX_I2C_DEV], [test x$linux_i2c_dev = xyes])
diff --git a/contrib/test/Makefile.am b/contrib/test/Makefile.am
index 7f84435..f223f68 100644
--- a/contrib/test/Makefile.am
+++ b/contrib/test/Makefile.am
@@ -2,7 +2,6 @@ noinst_PROGRAMS = \
 	ioctl-test		\
 	sliced-vbi-test		\
 	sliced-vbi-detect	\
-	v4l2grab		\
 	driver-test		\
 	stress-buffer		\
 	capture-example
@@ -12,8 +11,14 @@ noinst_PROGRAMS += pixfmt-test
 endif
 
 if HAVE_GLU
+if HAVE_ARGP
 noinst_PROGRAMS += v4l2gl
 endif
+endif
+
+if HAVE_ARGP
+noinst_PROGRAMS += v4l2grab
+endif
 
 driver_test_SOURCES = driver-test.c
 driver_test_LDADD = ../../utils/libv4l2util/libv4l2util.la
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 5674c16..5645d55 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -1,16 +1,12 @@
 SUBDIRS = \
-	dvb \
 	libv4l2util \
 	libmedia_dev \
-	decode_tm6000 \
 	ivtv-ctl \
 	cx18-ctl \
-	keytable \
 	media-ctl \
 	v4l2-compliance \
 	v4l2-ctl \
 	v4l2-dbg \
-	v4l2-sysfs-path \
 	rds-ctl
 
 if LINUX_OS
@@ -27,3 +23,10 @@ if WITH_QV4L2
 SUBDIRS += qv4l2
 endif
 
+if HAVE_ARGP
+SUBDIRS += \
+	dvb \
+	keytable \
+	decode_tm6000 \
+	v4l2-sysfs-path
+endif
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] v4l-utils: allow building even if argp.h is not present
  2015-09-03 15:23   ` [PATCH 2/2] v4l-utils: allow building even if argp.h is not present Hans Verkuil
@ 2015-09-03 17:40     ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2015-09-03 17:40 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: linux-media, gjasny, Hans Verkuil

Em Thu,  3 Sep 2015 17:23:16 +0200
Hans Verkuil <hverkuil@xs4all.nl> escreveu:

> From: Hans Verkuil <hansverk@cisco.com>
> 
> The argp.h functionality is not always available on embedded systems
> (android!). A number of utilities depend on this and running configure
> will fail if argp.h is missing.
> 
> Add a new configure option --without-argp to disable that argp.h check
> and instead skip any utilities that use argp.h.

Not sure about this patch. Maybe the better would be to see if we could
add a poor man's argp, instead, for those broken userspace systems.

Weird enough, a quick search on Google for "argp replacement android"
actually showed an argp.h at some android source:
	https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6/+/jb-dev/sysroot/usr/include/argp.h

This site has an standalone argp imported from glibc-2.2, according
with its ChangeLog:
	https://github.com/jahrome/argp-standalone

Static linking an standalone version is a little ugly. So, wee can do
something simpler than that, as there is just one important function at
argp: the one that calls a callback that will handle the command line
options (argp_parse). This can be trivial to be implemented, specially 
if it would handle just the one letter parameters, as it would be just
a callback.

It can just ignore the help message functions like argp_help(), 
giving some error message and giving up.

Eventually, just a small set of inline functions, plus adding the
argp structures on a header would be enough.

Regards,
Mauro

> 
> Signed-off-by: Hans Verkuil <hansverk@cisco.com>
> ---
>  configure.ac             | 22 ++++++++++++++++------
>  contrib/test/Makefile.am |  7 ++++++-
>  utils/Makefile.am        | 11 +++++++----
>  3 files changed, 29 insertions(+), 11 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 13df263..d645386 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -270,14 +270,24 @@ dl_saved_libs=$LIBS
>    AC_SUBST([DLOPEN_LIBS])
>  LIBS=$dl_saved_libs
>  
> -AC_CHECK_HEADER([argp.h],,AC_MSG_ERROR(Cannot continue: argp.h not found))
> +AC_ARG_WITH([argp],
> +            AS_HELP_STRING([--without-argp], [Do not use argp.h]),
> +            [],
> +            [with_argp=yes])
> +
>  argp_saved_libs=$LIBS
> -  AC_SEARCH_LIBS([argp_parse],
> -                 [argp],
> -                 [test "$ac_cv_search_argp_parse" = "none required" || ARGP_LIBS=$ac_cv_search_argp_parse],
> -                 [AC_MSG_ERROR([unable to find the argp_parse() function])])
> -  AC_SUBST([ARGP_LIBS])
> +AS_IF([test "x$with_argp" != xno],
> +      [
> +          AC_CHECK_HEADER([argp.h],,AC_MSG_ERROR(Cannot continue: argp.h not found))]
> +	  AC_SEARCH_LIBS([argp_parse],
> +			 [argp],
> +			 [test "$ac_cv_search_argp_parse" = "none required" || ARGP_LIBS=$ac_cv_search_argp_parse],
> +			 [AC_MSG_ERROR([unable to find the argp_parse() function])])
> +	  AC_SUBST([ARGP_LIBS])
> +      ],
> +      )
>  LIBS=$argp_saved_libs
> +AM_CONDITIONAL([HAVE_ARGP], [test "x$with_argp" != xno])
>  
>  AC_CHECK_HEADER([linux/i2c-dev.h], [linux_i2c_dev=yes], [linux_i2c_dev=no])
>  AM_CONDITIONAL([HAVE_LINUX_I2C_DEV], [test x$linux_i2c_dev = xyes])
> diff --git a/contrib/test/Makefile.am b/contrib/test/Makefile.am
> index 7f84435..f223f68 100644
> --- a/contrib/test/Makefile.am
> +++ b/contrib/test/Makefile.am
> @@ -2,7 +2,6 @@ noinst_PROGRAMS = \
>  	ioctl-test		\
>  	sliced-vbi-test		\
>  	sliced-vbi-detect	\
> -	v4l2grab		\
>  	driver-test		\
>  	stress-buffer		\
>  	capture-example
> @@ -12,8 +11,14 @@ noinst_PROGRAMS += pixfmt-test
>  endif
>  
>  if HAVE_GLU
> +if HAVE_ARGP
>  noinst_PROGRAMS += v4l2gl
>  endif
> +endif
> +
> +if HAVE_ARGP
> +noinst_PROGRAMS += v4l2grab
> +endif
>  
>  driver_test_SOURCES = driver-test.c
>  driver_test_LDADD = ../../utils/libv4l2util/libv4l2util.la
> diff --git a/utils/Makefile.am b/utils/Makefile.am
> index 5674c16..5645d55 100644
> --- a/utils/Makefile.am
> +++ b/utils/Makefile.am
> @@ -1,16 +1,12 @@
>  SUBDIRS = \
> -	dvb \
>  	libv4l2util \
>  	libmedia_dev \
> -	decode_tm6000 \
>  	ivtv-ctl \
>  	cx18-ctl \
> -	keytable \
>  	media-ctl \
>  	v4l2-compliance \
>  	v4l2-ctl \
>  	v4l2-dbg \
> -	v4l2-sysfs-path \
>  	rds-ctl
>  
>  if LINUX_OS
> @@ -27,3 +23,10 @@ if WITH_QV4L2
>  SUBDIRS += qv4l2
>  endif
>  
> +if HAVE_ARGP
> +SUBDIRS += \
> +	dvb \
> +	keytable \
> +	decode_tm6000 \
> +	v4l2-sysfs-path
> +endif

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] v4l-utils: new configure options
  2015-09-03 15:23 [PATCH 0/2] v4l-utils: new configure options Hans Verkuil
  2015-09-03 15:23 ` [PATCH 1/2] v4l2-ctl/compliance: add configure option to disable libv4l use Hans Verkuil
@ 2015-09-14  7:19 ` Gregor Jasny
  1 sibling, 0 replies; 5+ messages in thread
From: Gregor Jasny @ 2015-09-14  7:19 UTC (permalink / raw)
  To: Hans Verkuil, linux-media

Hi,

On 03/09/15 17:23, Hans Verkuil wrote:
> Gregor,
>
> Can you take a look at this to see if I did this correctly? I'm no
> autoconf hero, so before I push I'd like some feedback.
>
> The main reason for these changes is that I need to build v4l2-ctl for
> an embedded system and rather than having to hack on my side, I prefer
> to add configure options that do what I (and probably others) want.

sorry for the delay. I will take a look at these patches this week.

Thanks,
Gregor

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-14  7:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-03 15:23 [PATCH 0/2] v4l-utils: new configure options Hans Verkuil
2015-09-03 15:23 ` [PATCH 1/2] v4l2-ctl/compliance: add configure option to disable libv4l use Hans Verkuil
2015-09-03 15:23   ` [PATCH 2/2] v4l-utils: allow building even if argp.h is not present Hans Verkuil
2015-09-03 17:40     ` Mauro Carvalho Chehab
2015-09-14  7:19 ` [PATCH 0/2] v4l-utils: new configure options Gregor Jasny

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.