Commit 282558379ee328b4815b1e6983314301c2ffdba8

Ozkan Sezer 2021-01-19T14:55:20

fix AC_CHECK_HEADER for libusb.h

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