emotion: make v4l2 optionnal.
authorcedric <cedric>
Tue, 9 Aug 2011 09:15:56 +0000 (09:15 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 9 Aug 2011 09:15:56 +0000 (09:15 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/emotion@62243 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

configure.ac
src/lib/emotion_main.c

index 13b8ed6..3015c30 100644 (file)
@@ -206,6 +206,25 @@ setxattr("/", "user.ethumb.md5", NULL, 0, 0);
 AC_MSG_CHECKING([for Xattr])
 AC_MSG_RESULT([${have_xattr}])
 
+### Check for video4linux
+
+AC_COMPILE_IFELSE(
+   [AC_LANG_PROGRAM(
+       [[
+#include <stdio.h>
+#include <linux/videodev2.h>
+       ]],
+       [[
+fprintf(stdout, "%i\n", V4L2_CAP_VIDEO_CAPTURE);
+       ]])],
+   [
+     AC_DEFINE(HAVE_V4L2, 1, [Define to 1 if you have Video4Linux 2 available])
+     have_v4l2="yes"
+   ],
+   [have_v4l2="no"])
+AC_MSG_CHECKING([for V4L2])
+AC_MSG_RESULT([${have_v4l2}])
+
 ### Modules
 
 EMOTION_CHECK_MODULE([Xine], [${want_xine}])
@@ -283,6 +302,7 @@ echo "  Edje EXTERNAL support: ${have_edje_external}"
 echo
 echo "  Xattr................: ${have_xattr}"
 echo "  Eio..................: ${have_eio}"
+echo "  V4L2.................: ${have_v4l2}"
 echo
 echo "Documentation..........: ${build_doc}"
 echo "Examples.............: ${enable_build_examples}"
index f25fa37..80c7ed7 100644 (file)
@@ -6,7 +6,9 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 # include <sys/ioctl.h>
-# include <linux/videodev2.h>
+# ifdef HAVE_V4L2
+#  include <linux/videodev2.h>
+# endif
 
 # include <Ecore.h>
 # include <Eeze.h>
@@ -144,12 +146,15 @@ emotion_webcam_destroy(Emotion_Webcam *ew)
 static void
 _emotion_check_device(Emotion_Webcam *ew)
 {
+#ifdef HAVE_V4L2
    Emotion_Webcam *check;
    Eina_List *l;
    struct v4l2_capability caps;
    int fd;
+#endif
 
    if (!ew) return ;
+#ifdef HAVE_V4L2
    if (!ew->device) goto on_error;
 
    fd = open(ew->filename, O_RDONLY);
@@ -175,6 +180,7 @@ _emotion_check_device(Emotion_Webcam *ew)
    return ;
 
  on_error:
+#endif
    fprintf(stderr, "'%s' is not a webcam ['%s']\n", ew->name, strerror(errno));
    eina_stringshare_del(ew->syspath);
    eina_stringshare_del(ew->device);