fix AC_CHECK_HEADER for libusb.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
diff --git a/configure b/configure
index 8ea32a1..2342af7 100755
--- a/configure
+++ b/configure
@@ -24574,15 +24574,17 @@ else
$as_echo "yes" >&6; }
have_libusb=yes
fi
- save_CFLAGS="$CFLAGS"
- CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS"
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$save_CPPFLAGS $LIBUSB_CFLAGS"
ac_fn_c_check_header_mongrel "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default"
if test "x$ac_cv_header_libusb_h" = xyes; then :
have_libusb_h=yes
+else
+ have_libusb_h=no
fi
- CFLAGS="$save_CFLAGS"
+ CPPFLAGS="$save_CPPFLAGS"
if test x$have_libusb_h = xno && test x$require_hidapi_libusb = xyes; then
hidapi_support=no
fi
diff --git a/configure.ac b/configure.ac
index f9a8802..e563c83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3415,10 +3415,10 @@ AS_HELP_STRING([--enable-hidapi-libusb], [use libusb for low level joystick driv
hidapi_support=yes
if test x$enable_hidapi_libusb = xyes; then
PKG_CHECK_MODULES([LIBUSB], [libusb-1.0], have_libusb=yes, have_libusb=no)
- save_CFLAGS="$CFLAGS"
- CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS"
- AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
- CFLAGS="$save_CFLAGS"
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$save_CPPFLAGS $LIBUSB_CFLAGS"
+ AC_CHECK_HEADER(libusb.h, have_libusb_h=yes, have_libusb_h=no)
+ CPPFLAGS="$save_CPPFLAGS"
if test x$have_libusb_h = xno && test x$require_hidapi_libusb = xyes; then
hidapi_support=no
fi