utils: use klogctl only if available
authorGregor Jasny <gjasny@googlemail.com>
Tue, 14 Feb 2012 19:25:52 +0000 (20:25 +0100)
committerGregor Jasny <gjasny@googlemail.com>
Tue, 14 Feb 2012 19:42:37 +0000 (20:42 +0100)
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
config.h.in
configure.ac
utils/v4l2-compliance/v4l2-compliance.cpp
utils/v4l2-compliance/v4l2-test-debug.cpp
utils/v4l2-ctl/cx18-ctl.c
utils/v4l2-ctl/ivtv-ctl.c
utils/v4l2-ctl/v4l2-ctl.cpp
utils/v4l2-dbg/v4l2-dbg.cpp

index c8337f6..dcfb5eb 100644 (file)
@@ -9,6 +9,9 @@
 /* whether we use libjpeg */
 #undef HAVE_JPEG
 
+/* Define to 1 if you have the `klogctl' function. */
+#undef HAVE_KLOGCTL
+
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
@@ -24,6 +27,9 @@
 /* Define to 1 if you have the <string.h> header file. */
 #undef HAVE_STRING_H
 
+/* Define to 1 if you have the <sys/klog.h> header file. */
+#undef HAVE_SYS_KLOG_H
+
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
index 568a2fc..2a90bb9 100644 (file)
@@ -50,6 +50,9 @@ AC_PROG_LIBTOOL
 #AC_PROG_MKDIR_P
 gl_PROMOTED_TYPE_MODE_T
 
+AC_CHECK_HEADERS([sys/klog.h])
+AC_CHECK_FUNCS([klogctl])
+
 # Check host os
 case "$host_os" in
   linux*)
index b7fe3e8..857d236 100644 (file)
@@ -32,7 +32,6 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include <math.h>
-#include <sys/klog.h>
 #include <sys/utsname.h>
 
 #include "v4l2-compliance.h"
index 074b975..55d0631 100644 (file)
@@ -32,7 +32,6 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include <math.h>
-#include <sys/klog.h>
 #include "v4l2-compliance.h"
 
 int testChipIdent(struct node *node)
index 761cb0a..56192a8 100644 (file)
@@ -36,7 +36,6 @@
 #include <sys/time.h>
 #include <math.h>
 #include <linux/types.h>
-#include <sys/klog.h>
 
 #include <linux/videodev2.h>
 
index 3340418..d8865ae 100644 (file)
@@ -35,7 +35,6 @@
 #include <sys/time.h>
 #include <math.h>
 #include <linux/types.h>
-#include <sys/klog.h>
 
 #include <linux/videodev2.h>
 #include <linux/dvb/video.h>
index a45d799..9324309 100644 (file)
 #include <sys/time.h>
 #include <dirent.h>
 #include <math.h>
+
+#ifdef HAVE_SYS_KLOG_H
 #include <sys/klog.h>
+#endif
 
 #include <linux/videodev2.h>
 #include <libv4l2.h>
@@ -3547,11 +3550,13 @@ int main(int argc, char **argv)
 
        if (options[OptLogStatus]) {
                static char buf[40960];
-               int len;
+               int len = -1;
 
                if (doioctl(fd, VIDIOC_LOG_STATUS, NULL) == 0) {
                        printf("\nStatus Log:\n\n");
+#ifdef HAVE_KLOGCTL
                        len = klogctl(3, buf, sizeof(buf) - 1);
+#endif
                        if (len >= 0) {
                                char *p = buf;
                                char *q;
index e573b69..0f15520 100644 (file)
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include <math.h>
+
+#ifdef HAVE_SYS_KLOG_H
 #include <sys/klog.h>
+#endif
 
 #include <linux/videodev2.h>
 #include <media/v4l2-chip-ident.h>
@@ -765,11 +768,13 @@ list_done:
 
        if (options[OptLogStatus]) {
                static char buf[40960];
-               int len;
+               int len = -1;
 
                if (doioctl(fd, VIDIOC_LOG_STATUS, NULL, "VIDIOC_LOG_STATUS") == 0) {
                        printf("\nStatus Log:\n\n");
+#ifdef HAVE_KLOGCTL
                        len = klogctl(3, buf, sizeof(buf) - 1);
+#endif
                        if (len >= 0) {
                                char *p = buf;
                                char *q;