Line 0
Link Here
|
|
|
1 |
--- ./configure.ac.orig 2014-05-17 12:08:57.000000000 +0200 |
2 |
+++ ./configure.ac 2014-05-17 12:12:55.000000000 +0200 |
3 |
@@ -4,6 +4,7 @@ |
4 |
AC_INIT([lcdproc], [0.5.7], [lcdproc@lists.omnipotent.net]) |
5 |
AC_CONFIG_SRCDIR([clients/lcdproc/batt.c]) |
6 |
AM_INIT_AUTOMAKE |
7 |
+PKG_PROG_PKG_CONFIG() |
8 |
|
9 |
AC_CONFIG_HEADERS(config.h) |
10 |
|
11 |
@@ -255,26 +256,62 @@ |
12 |
|
13 |
dnl ###################################################################### |
14 |
dnl libusb support |
15 |
+dnl Stolen from the gnupg project and modified for LCDproc''s need. |
16 |
+dnl |
17 |
+dnl Copyright (C) 2004, 2005 Free Software Foundation, Inc. |
18 |
dnl ###################################################################### |
19 |
AC_MSG_CHECKING([if libusb support has been enabled]); |
20 |
-AC_ARG_ENABLE(libusb, |
21 |
- [AS_HELP_STRING([--disable-libusb],[disable USB support using libusb])], |
22 |
- [ if test "$enableval" != "no"; then |
23 |
- enable_libusb=yes |
24 |
- fi ], |
25 |
- [ enable_libusb=yes ] |
26 |
-) |
27 |
-AC_MSG_RESULT($enable_libusb) |
28 |
+AC_ARG_WITH(libusb, |
29 |
+ AC_HELP_STRING([--with-libusb=DIR], |
30 |
+ [look for the libusb library in DIR]), |
31 |
+ [_do_libusb=$withval],[_do_libusb=yes]) |
32 |
+AC_MSG_RESULT($_do_libusb) |
33 |
|
34 |
-if test "$enable_libusb" = "yes"; then |
35 |
- ifdef([PKG_CHECK_MODULES], |
36 |
- [PKG_CHECK_MODULES(LIBUSB, libusb, |
37 |
- [AC_DEFINE(HAVE_LIBUSB, [1], [Define to 1 if you have libusb])], |
38 |
- [ enable_libusb=no ])], |
39 |
- [AC_MSG_WARN([pkg-config not (fully) installed; drivers requiring libusb may not be built])]) |
40 |
+if test "$_do_libusb" != "no" ; then |
41 |
+ if test -d "$withval" ; then |
42 |
+ CPPFLAGS="${CPPFLAGS} -I$withval/include" |
43 |
+ LDFLAGS="${LDFLAGS} -L$withval/lib" |
44 |
+ AC_PATH_PROG([_usb_config],["$_do_libusb/bin/libusb-config"]) |
45 |
+ else |
46 |
+ AC_PATH_PROG([_usb_config],[libusb-config]) |
47 |
+ fi |
48 |
+ |
49 |
+ _libusb_save_libs=$LIBS |
50 |
+ _libusb_save_cflags=$CFLAGS |
51 |
+ |
52 |
+ if test x$_usb_config != "x" ; then |
53 |
+ _libusb_try_libs=`$_usb_config --libs` |
54 |
+ _libusb_try_cflags=`$_usb_config --cflags` |
55 |
+ else |
56 |
+ _libusb_try_libs="-lusb" |
57 |
+ _libusb_try_cflags="" |
58 |
+ fi |
59 |
+ |
60 |
+ LIBS="$LIBS $_libusb_try_libs" |
61 |
+ CFLAGS="$CFLAGS $_libusb_try_cflags" |
62 |
+ |
63 |
+ AC_MSG_CHECKING([whether libusb is present and sane]) |
64 |
+ |
65 |
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <usb.h>],[ |
66 |
+ usb_interrupt_write(NULL,0,NULL,0,0); |
67 |
+ ])],enable_libusb=yes,enable_libusb=no) |
68 |
+ |
69 |
+ AC_MSG_RESULT([$enable_libusb]) |
70 |
+ |
71 |
+ if test "$enable_libusb" = "yes" ; then |
72 |
+ AC_DEFINE(HAVE_LIBUSB, [1], [Define to 1 if you have libusb]) |
73 |
+ AC_SUBST(LIBUSB_CFLAGS, $_libusb_try_cflags) |
74 |
+ AC_SUBST(LIBUSB_LIBS, $_libusb_try_libs) |
75 |
+ fi |
76 |
+ |
77 |
+ LIBS=$_libusb_save_libs |
78 |
+ CFLAGS=$_libusb_save_cflags |
79 |
+ |
80 |
+ unset _libusb_save_libs |
81 |
+ unset _libusb_save_cflags |
82 |
+ unset _libusb_try_libs |
83 |
+ unset _libusb_try_cflags |
84 |
fi |
85 |
-AC_SUBST(LIBUSB_LIBS) |
86 |
-AC_SUBST(LIBUSB_CFLAGS) |
87 |
|
88 |
dnl ###################################################################### |
89 |
dnl libusb-1.0 support |