summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-03-26 06:40:17 -0400
committerBent Bisballe Nyeng <deva@aasimon.org>2013-03-26 06:40:17 -0400
commit3f8cf55f143828a4ada0b2446ea6fcdcf595ed60 (patch)
tree56b5056a478525c015cc3ef8025081f7a72bb93f
parent42fb6a9474cb189d62d895bbc65185d7223ca564 (diff)
Fixed compilation with autotools.
-rw-r--r--.gitignore37
-rw-r--r--configure.in2
-rw-r--r--libusbhp/libusbhp.cc15
-rw-r--r--libusbhp/libusbhp.h8
-rw-r--r--test/Makefile.am3
5 files changed, 53 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index 8ab65e4..1ddc311 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,30 @@
-Debug
-test/Debug
-libusbhp/Debug
-libusbhp.sdf
-libusbhp.v11.suo
-*~
-*.o \ No newline at end of file
+Debug
+test/Debug
+libusbhp/Debug
+libusbhp.sdf
+libusbhp.v11.suo
+*~
+*.o
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache
+config.guess
+config.h
+config.h.in
+config.log
+config.status
+config.sub
+configure
+depcomp
+install-sh
+libtool
+libusbhp.pc
+.deps
+.libs
+*.la
+*.lo
+ltmain.sh
+missing
+stamp-h1
+test/test \ No newline at end of file
diff --git a/configure.in b/configure.in
index 1eb7256..45bd8ef 100644
--- a/configure.in
+++ b/configure.in
@@ -25,7 +25,7 @@ fi
dnl ======================
dnl Check for udev library
dnl ======================
-PKG_CHECK_MODULES(UDEV, udev >= 147)
+PKG_CHECK_MODULES(UDEV, libudev >= 147)
AC_PROG_CXX
diff --git a/libusbhp/libusbhp.cc b/libusbhp/libusbhp.cc
index 9e79220..4058c10 100644
--- a/libusbhp/libusbhp.cc
+++ b/libusbhp/libusbhp.cc
@@ -28,7 +28,6 @@
#ifdef __linux__
#include <poll.h>
-#include <libudev.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -53,7 +52,13 @@
#endif/*_WIN32*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#ifdef __linux__
+#include <libudev.h>
+
struct dev_list_t {
char *path;
unsigned short vid;
@@ -105,13 +110,13 @@ static void dev_list_add(struct libusbhp_t *h, const char *path,
static int dev_list_remove(struct libusbhp_t *h, const char *path)
{
struct dev_list_t *p = h->devlist;
- if(!p) return;
+ if(!p) return 1;
if(!strcmp(p->path, path)) {
h->devlist = p->next;
free(p->path);
free(p);
- return;
+ return 0;
}
while(p->next) {
@@ -438,3 +443,7 @@ void libusbhp_register_hotplug_listeners(struct libusbhp_t *handle,
handle->detach = disconnected_cb;
handle->user_data = user_data;
}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/libusbhp/libusbhp.h b/libusbhp/libusbhp.h
index ccf7125..7622576 100644
--- a/libusbhp/libusbhp.h
+++ b/libusbhp/libusbhp.h
@@ -41,6 +41,11 @@
#include <sys/time.h>
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
struct libusbhp_t;
struct libusbhp_device_t {
@@ -66,6 +71,9 @@ EXPORT
libusbhp_hotplug_cb_fn disconnected_cb,
void *user_data);
+#ifdef __cplusplus
+}
+#endif
/***
// Libusbx implementation:
diff --git a/test/Makefile.am b/test/Makefile.am
index 00229f7..43ad6b4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,6 +1,7 @@
bin_PROGRAMS = test
-test_LDADD = ../libusbhp/libusbhp.la
+test_LDADD = $(UDEV_LIBS) ../libusbhp/libusbhp.la
+test_CXXFLAGS = -I../libusbhp $(UDEV_CFLAGS)
test_SOURCES = \
test.cc