AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([inc/config.h])
+AC_ARG_ENABLE([debug],
+ [AS_HELP_STRING([--enable-debug],
+ [enable debugging])],
+ [enable_debug=$enableval],
+ [enable_debug=no])
+
+AC_ARG_ENABLE([memcheck],
+ [AS_HELP_STRING([--disable-memcheck],
+ [disable memcheck with valgrind (enabled by default)])],
+ [enable_memcheck=$enableval],
+ [enable_memcheck=yes])
+
+AC_PATH_PROG([VALGRIND], [valgrind])
+AM_CONDITIONAL([HAVE_VALGRIND], [test -n "$VALGRIND"])
+
+AC_MSG_CHECKING([if debugging])
+if test x$enable_debug != xno; then
+ AC_MSG_RESULT(yes)
+ CFLAGS="-ggdb3 -O0"
+else
+ AC_MSG_RESULT(no)
+fi
+
+AM_CONDITIONAL([ENABLE_DEBUG],[test x$enable_debug != xno])
+
+dnl disable memcheck if valgrind not found
+if test "x$enable_memcheck" != "xno"; then
+ if test -z "$VALGRIND"; then
+ enable_memcheck=no
+ fi
+fi
+
+AC_MSG_CHECKING([if memcheck should be enabled])
+if test x$enable_memcheck != xno; then
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+fi
+
+AM_CONDITIONAL([ENABLE_MEMCHECK],[test x$enable_memcheck = xyes])
+
# Checks for programs.
AC_PROG_CC
#include<main.h>
int main(int argc, char **argv) {
- struct udev *monitor;
+ struct udev *monitor; //, *dev;
+ struct udev_enumerate *enumerate;
+ struct udev_list_entry *devices, *dev_list_entry;
+ const char *path;
monitor = udev_new();
if(NULL==monitor) { return EXIT_FAILURE; }
+
+ enumerate = udev_enumerate_new(monitor);
+
+ udev_enumerate_add_match_subsystem(enumerate, "usb");
+ udev_enumerate_add_nomatch_sysattr(enumerate, "bDeviceClass", "09");
+ udev_enumerate_add_nomatch_sysattr(enumerate, "bInterfaceNumber", NULL);
+ udev_enumerate_scan_devices(enumerate);
+
+ devices = udev_enumerate_get_list_entry(enumerate);
+
+ udev_list_entry_foreach(dev_list_entry, devices) {
+ path = udev_list_entry_get_name(dev_list_entry);
+// dev = udev_device_new_from_syspath(monitor, path);
+
+ printf("found: %s\n",path);
+ }
udev_unref(monitor);