summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Drake <dan@reactivated.net>2010-07-29 12:42:25 +0100
committerDaniel Drake <dan@reactivated.net>2010-07-29 12:42:25 +0100
commit435760539ee5277bc31aa12fb6dbe685d055963b (patch)
treee93e9a0d8fa32a801fafad351dfa077fc4d57467
parent1867c7103b51e21432a11df8893050a4fe60ba42 (diff)
downloadlibusb-435760539ee5277bc31aa12fb6dbe685d055963b.tar.gz
bring autoconf/automake in line with official
-rw-r--r--configure.ac21
-rw-r--r--examples/Makefile.am18
-rw-r--r--libusb/Makefile.am29
3 files changed, 40 insertions, 28 deletions
diff --git a/configure.ac b/configure.ac
index 81a090f..70a7e45 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,22 +28,24 @@ case $host in
*-linux*)
AC_DEFINE(OS_LINUX, [], [Linux backend])
AC_SUBST(OS_LINUX)
+ AC_DEFINE([THREADS_POSIX], [], [Use Posix Threads])
AC_MSG_RESULT([Linux])
backend="linux"
- AC_DEFINE([POSIX_THREADS], [], [Posix Threads])
- threads="posix"
AC_CHECK_LIB(rt, clock_gettime)
+ threads="posix"
+ THREAD_CFLAGS="-pthread"
AM_CFLAGS="-Wshadow"
AM_LDFLAGS=""
;;
*-darwin*)
AC_DEFINE(OS_DARWIN, [], [Darwin backend])
AC_SUBST(OS_DARWIN)
+ AC_DEFINE([THREADS_POSIX], [], [Use Posix Threads])
AC_DEFINE(USBI_OS_HANDLES_TIMEOUT, [], [Backend handles timeout])
AC_MSG_RESULT([Darwin/MacOS X])
backend="darwin"
- AC_DEFINE([POSIX_THREADS], [], [Posix Threads])
threads="posix"
+ THREAD_CFLAGS="-pthread"
AM_CFLAGS="-Wshadow"
AM_LDFLAGS="-Wl,-framework -Wl,IOKit -Wl,-framework -Wl,CoreFoundation -Wl,-prebind -no-undefined"
;;
@@ -55,15 +57,16 @@ case $host in
threads="windows"
LIBS="-lsetupapi -lole32 -ladvapi32"
AM_CFLAGS="-Wshadow"
+ # -avoid-version to avoid a naming scheme such as libusb-0.dll
AM_LDFLAGS="-no-undefined -avoid-version"
AC_CHECK_TOOL(RC, windres, no)
;;
*-cygwin*)
AC_DEFINE(OS_WINDOWS, [], [Windows backend])
AC_SUBST(OS_WINDOWS)
+ AC_DEFINE([THREADS_POSIX], [], [Use Posix Threads])
AC_MSG_RESULT([Windows])
backend="windows"
- AC_DEFINE([POSIX_THREADS], [], [Posix Threads])
threads="posix"
LIBS="-lsetupapi -lole32 -ladvapi32"
AM_CFLAGS=""
@@ -77,7 +80,7 @@ esac
AM_CONDITIONAL([OS_LINUX], [test "x$backend" == "xlinux"])
AM_CONDITIONAL([OS_DARWIN], [test "x$backend" == "xdarwin"])
AM_CONDITIONAL([OS_WINDOWS], [test "x$backend" == "xwindows"])
-AM_CONDITIONAL([POSIX_THREADS], [test "x$threads" == "xposix"])
+AM_CONDITIONAL([THREADS_POSIX], [test "x$threads" == "xposix"])
# timerfd
AC_CHECK_HEADER([sys/timerfd.h], [timerfd_h=1], [timerfd_h=0])
@@ -167,6 +170,13 @@ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),
nopointersign_cflags="-Wno-pointer-sign", nopointersign_cflags="")
CFLAGS="$saved_cflags"
+# sigaction not available on MinGW
+AC_CHECK_FUNC([sigaction], [have_sigaction=yes], [have_sigaction=no])
+AM_CONDITIONAL([HAVE_SIGACTION], [test "x$have_sigaction" = "xyes"])
+
+# headers not available on all platforms but required on others
+AC_CHECK_HEADERS([sys/time.h])
+
# check if -pthread is supported (some environments like cygwin don't support it)
AC_MSG_CHECKING([whether compiler supports the -pthread option])
if $CC -pthread 2>&1 | grep -q 'unrecognized option.*pthread'; then
@@ -186,4 +196,3 @@ AC_SUBST(AM_LDFLAGS)
AC_CONFIG_FILES([libusb-1.0.pc] [Makefile] [libusb/Makefile] [libusb/libusb-1.0.rc] [examples/Makefile] [doc/Makefile] [doc/doxygen.cfg])
AC_OUTPUT
-
diff --git a/examples/Makefile.am b/examples/Makefile.am
index a5512cb..06af0bc 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,12 +1,5 @@
INCLUDES = -I$(top_srcdir)
-
-if POSIX_THREADS
-DPFP_SRC = dpfp dpfp_threaded
-else
-DPFP_SRC = dpfp
-endif
-
-noinst_PROGRAMS = xusb lsusb $(DPFP_SRC)
+noinst_PROGRAMS = xusb lsusb
lsusb_SOURCES = lsusb.c
lsusb_LDADD = ../libusb/libusb-1.0.la -lusb-1.0
@@ -14,10 +7,17 @@ lsusb_LDADD = ../libusb/libusb-1.0.la -lusb-1.0
xusb_SOURCES = xusb.c
xusb_LDADD = ../libusb/libusb-1.0.la -lusb-1.0
+if HAVE_SIGACTION
dpfp_SOURCES = dpfp.c
dpfp_LDADD = ../libusb/libusb-1.0.la -lusb-1.0
+noinst_PROGRAMS += dpfp
+endif
+if THREADS_POSIX
+if HAVE_SIGACTION
dpfp_threaded_SOURCES = dpfp_threaded.c
dpfp_threaded_CFLAGS = $(THREAD_CFLAGS) $(AM_CFLAGS)
dpfp_threaded_LDADD = ../libusb/libusb-1.0.la -lusb-1.0
-
+noinst_PROGRAMS += dpfp_threaded
+endif
+endif
diff --git a/libusb/Makefile.am b/libusb/Makefile.am
index 24ab9dc..a71922f 100644
--- a/libusb/Makefile.am
+++ b/libusb/Makefile.am
@@ -1,16 +1,11 @@
lib_LTLIBRARIES = libusb-1.0.la
-if POSIX_THREADS
-THREADS_SRC = os/threads_posix.h
-else
-THREADS_SRC = os/threads_windows.h os/threads_windows.c
-endif
-
-LINUX_USBFS_SRC = $(THREADS_SRC) os/poll_posix.h os/linux_usbfs.h os/linux_usbfs.c
-DARWIN_USB_SRC = $(THREADS_SRC) os/poll_posix.h os/darwin_usb.h os/darwin_usb.c
-WINDOWS_USB_SRC = $(THREADS_SRC) os/poll_windows.h os/poll_windows.c os/windows_usb.h os/windows_usb.c libusb-1.0.rc
+LINUX_USBFS_SRC = os/linux_usbfs.c
+DARWIN_USB_SRC = os/darwin_usb.c
+WINDOWS_USB_SRC = os/poll_windows.c os/windows_usb.c libusb-1.0.rc
-EXTRA_DIST = $(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) $(WINDOWS_USB_SRC)
+EXTRA_DIST = $(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) $(WINDOWS_USB_SRC) \
+ os/threads_windows.c
if OS_LINUX
OS_SRC = $(LINUX_USBFS_SRC)
@@ -23,12 +18,20 @@ endif
if OS_WINDOWS
OS_SRC = $(WINDOWS_USB_SRC)
+
+if !THREADS_POSIX
+OS_SRC += os/threads_windows.c
+endif
+
.rc.lo:
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) $(RCFLAGS) -i $< -o $@
endif
-libusb_1_0_la_CFLAGS = $(VISIBILITY_CFLAGS) $(THREAD_CFLAGS) $(AM_CFLAGS)
-libusb_1_0_la_SOURCES = libusbi.h core.c descriptor.c io.c sync.c $(OS_SRC)
+libusb_1_0_la_CFLAGS = $(VISIBILITY_CFLAGS) $(AM_CFLAGS) $(THREAD_CFLAGS)
+libusb_1_0_la_SOURCES = libusbi.h core.c descriptor.c io.c sync.c $(OS_SRC) \
+ os/linux_usbfs.h os/darwin_usb.h os/windows_usb.h \
+ os/threads_posix.h os/threads_windows.h \
+ os/poll_posix.h os/poll_windows.h
hdrdir = $(includedir)/libusb-1.0
-hdr_HEADERS = libusb.h
+hdr_HEADERS = libusb.h \ No newline at end of file