Use deviced instead of USB Security Daemon
[platform/upstream/libusb.git] / configure.ac
index 399f397..c822e5b 100644 (file)
@@ -27,15 +27,15 @@ lt_age="1"
 LTLDFLAGS="-version-info ${lt_current}:${lt_revision}:${lt_age}"
 
 AM_INIT_AUTOMAKE
-AM_MAINTAINER_MODE
 
 AC_CONFIG_SRCDIR([libusb/core.c])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config.h])
 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
 
-AC_PREREQ([2.50])
+AC_PREREQ([2.69])
 AC_PROG_CC
+AC_PROG_CXX
 LT_INIT
 LT_LANG([Windows Resource])
 AC_C_INLINE
@@ -77,7 +77,7 @@ case $host in
        backend="netbsd"
        threads="posix"
        ;;
-*-mingw*)
+*-mingw* | *msys*)
        AC_MSG_RESULT([Windows])
        backend="windows"
        threads="windows"
@@ -91,18 +91,32 @@ case $host in
        ;;
 *-haiku*)
        AC_MSG_RESULT([Haiku])
-       AC_CONFIG_SUBDIRS([libusb/os/haiku])
        backend="haiku"
        threads="posix"
        ;;
+*-solaris*)
+       AC_MSG_RESULT([SunOS])
+       backend="sunos"
+       threads="posix"
+       ;;
 *)
-       AC_MSG_ERROR([unsupported operating system])
+       AC_MSG_ERROR([unsupported operating system $host])
 esac
 
 case $backend in
 linux)
        AC_DEFINE(OS_LINUX, 1, [Linux backend])
        AC_SUBST(OS_LINUX)
+       AC_ARG_ENABLE([deviced],
+               [AC_HELP_STRING([--enable-deviced], [Use deviced to obtain dev node fds [default=no]])],
+               [], [enable_deviced="no"])
+       if test "x$enable_deviced" = "xyes"; then
+          PKG_CHECK_MODULES([DEVICED], [deviced])
+          AC_DEFINE(USE_DEVICED, 1, [Use deviced to obtain dev node fds])
+       fi
+
+       AC_SUBST(USE_DEVICED)
+
        AC_SEARCH_LIBS(clock_gettime, rt, [], [], -pthread)
        AC_ARG_ENABLE([udev],
                [AC_HELP_STRING([--enable-udev], [use udev for device enumeration and hotplug support (recommended) [default=yes]])],
@@ -113,23 +127,18 @@ linux)
                        AC_CHECK_LIB([udev], [udev_new], [], [AC_ERROR(["udev support requested but libudev not installed"])])
                        AC_DEFINE(USE_UDEV, 1, [Use udev for device enumeration/hotplug])
                else
-                       AC_CHECK_HEADERS([asm/types.h sys/socket.h], [], [])
-                       AC_CHECK_HEADERS([linux/netlink.h linux/filter.h], [], [AC_ERROR(["Linux netlink headers not found"])], [
+                       AC_CHECK_HEADERS([asm/types.h], [], [])
+                       AC_CHECK_HEADERS([sys/socket.h linux/netlink.h], [], [AC_ERROR(["Linux netlink headers not found"])], [
 #ifdef HAVE_ASM_TYPES_H
 #include <asm/types.h>
 #endif
-#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
-#endif
 ])
                fi
                AC_SUBST(USE_UDEV)
 
 case $is_backend_android in
 yes)
-       dnl some pthread functions is in libc
-       THREAD_CFLAGS="-c"
-       LIBS="${LIBS} -c"
        dnl there are gettimeofday function but configure doesn't seem to be able to find it.
        AC_DEFINE([HAVE_GETTIMEOFDAY], [1], [Define if you have gettimeofday])
        ;;
@@ -160,6 +169,14 @@ openbsd)
        AC_CHECK_HEADERS([poll.h])
        AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
        ;;
+sunos)
+       AC_DEFINE(OS_SUNOS, 1, [SunOS backend])
+       AC_SUBST(OS_SUNOS)
+       THREAD_CFLAGS="-pthread"
+       LIBS="-pthread -ldevinfo"
+       AC_CHECK_HEADERS([poll.h])
+       AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
+       ;;
 netbsd)
        AC_DEFINE(OS_NETBSD, 1, [NetBSD backend])
        AC_SUBST(OS_NETBSD)
@@ -175,6 +192,14 @@ windows)
        LTLDFLAGS="${LTLDFLAGS} -avoid-version -Wl,--add-stdcall-alias"
        AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])
        AC_DEFINE([WINVER], 0x0501, [Oldest Windows version supported])
+
+       AC_ARG_ENABLE([usbdk],
+               [AC_HELP_STRING([--enable-usbdk], [use UsbDk Windows backend [default=no]])],
+               [], [enable_usbdk="no"])
+               if test "x$enable_usbdk" = "xyes" ; then
+                   AC_DEFINE(USE_USBDK, 1, [Use UsbDk Windows backend])
+               fi
+               AC_SUBST(USE_USBDK)
        ;;
 haiku)
        AC_DEFINE(OS_HAIKU, 1, [Haiku backend])
@@ -190,12 +215,15 @@ AC_SUBST(LIBS)
 AM_CONDITIONAL(OS_LINUX, test "x$backend" = xlinux)
 AM_CONDITIONAL(OS_DARWIN, test "x$backend" = xdarwin)
 AM_CONDITIONAL(OS_OPENBSD, test "x$backend" = xopenbsd)
+AM_CONDITIONAL(OS_SUNOS, test "x$backend" = xsunos)
 AM_CONDITIONAL(OS_NETBSD, test "x$backend" = xnetbsd)
 AM_CONDITIONAL(OS_WINDOWS, test "x$backend" = xwindows)
 AM_CONDITIONAL(OS_HAIKU, test "x$backend" = xhaiku)
 AM_CONDITIONAL(THREADS_POSIX, test "x$threads" = xposix)
 AM_CONDITIONAL(CREATE_IMPORT_LIB, test "x$create_import_lib" = "xyes")
 AM_CONDITIONAL(USE_UDEV, test "x$enable_udev" = xyes)
+AM_CONDITIONAL(USE_USBDK, test "x$enable_usbdk" = xyes)
+AM_CONDITIONAL(USE_DEVICED, test "x$enable_deviced" = xyes)
 if test "$threads" = posix; then
        AC_DEFINE(THREADS_POSIX, 1, [Use POSIX Threads])
 fi