configure.in
changeset 12088 399cc39583cc
parent 12081 277e57c09ff4
child 12130 24142c5073a4
     1.1 --- a/configure.in	Wed Aug 08 15:39:20 2018 -0400
     1.2 +++ b/configure.in	Thu Aug 09 16:00:17 2018 -0700
     1.3 @@ -285,7 +285,7 @@
     1.4  
     1.5      AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include <signal.h>])
     1.6  
     1.7 -	dnl Check for additional non-standard headers
     1.8 +    dnl Check for additional non-standard headers
     1.9      AC_CHECK_HEADERS(libunwind.h)
    1.10  fi
    1.11  
    1.12 @@ -963,7 +963,7 @@
    1.13          AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
    1.14          AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
    1.15          if test x$PKG_CONFIG != xno; then
    1.16 -        if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
    1.17 +            if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
    1.18                  PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
    1.19                  PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
    1.20                  audio_pulseaudio=yes
    1.21 @@ -1748,7 +1748,7 @@
    1.22              AC_MSG_CHECKING([for XGenericEvent])
    1.23              have_XGenericEvent=no
    1.24              AC_TRY_COMPILE([
    1.25 -              	#include <X11/Xlib.h>
    1.26 +                #include <X11/Xlib.h>
    1.27              ],[
    1.28  Display *display;
    1.29  XEvent event;
    1.30 @@ -1862,20 +1862,20 @@
    1.31                  SUMMARY_video_x11="${SUMMARY_video_x11} xinput2"
    1.32                  AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2, 1, [ ])
    1.33                  AC_MSG_CHECKING(for xinput2 multitouch)
    1.34 -            	have_xinput2_multitouch=no
    1.35 -            	AC_TRY_COMPILE([
    1.36 -              		#include <X11/Xlib.h>
    1.37 -             		#include <X11/Xproto.h>
    1.38 -			#include <X11/extensions/XInput2.h>
    1.39 -            	],[
    1.40 +                have_xinput2_multitouch=no
    1.41 +                AC_TRY_COMPILE([
    1.42 +                    #include <X11/Xlib.h>
    1.43 +                    #include <X11/Xproto.h>
    1.44 +                    #include <X11/extensions/XInput2.h>
    1.45 +                    ],[
    1.46  int event_type = XI_TouchBegin;
    1.47  XITouchClassInfo *t;
    1.48 -            	],[
    1.49 -            	have_xinput2_multitouch=yes
    1.50 -            	AC_DEFINE([SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH], 1, [])
    1.51 -                SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
    1.52 -            	])
    1.53 -            	AC_MSG_RESULT($have_xinput2_multitouch)
    1.54 +                    ],[
    1.55 +                    have_xinput2_multitouch=yes
    1.56 +                    AC_DEFINE([SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH], 1, [])
    1.57 +                    SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
    1.58 +                    ])
    1.59 +                AC_MSG_RESULT($have_xinput2_multitouch)
    1.60              fi
    1.61              AC_ARG_ENABLE(video-x11-xrandr,
    1.62  AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
    1.63 @@ -3265,6 +3265,41 @@
    1.64      esac
    1.65  }
    1.66  
    1.67 +dnl Check for HIDAPI joystick drivers
    1.68 +CheckHIDAPI()
    1.69 +{
    1.70 +    # The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers,
    1.71 +    # so we'll just use libusb when it's available.
    1.72 +    #
    1.73 +    # Except that libusb requires root permissions to open devices, so that's not generally useful, and we'll disable this by default.
    1.74 +    AC_ARG_ENABLE(hidapi,
    1.75 +AC_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=no]]]),
    1.76 +                  , enable_hidapi=no)
    1.77 +    if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then
    1.78 +        hidapi_support=no
    1.79 +        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
    1.80 +        if test x$PKG_CONFIG != xno; then
    1.81 +            LIBUSB_CFLAGS=`$PKG_CONFIG --cflags libusb-1.0`
    1.82 +            LIBUSB_LDFLAGS=`$PKG_CONFIG --libs libusb-1.0`
    1.83 +            save_CFLAGS="$CFLAGS"
    1.84 +            CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS"
    1.85 +            AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
    1.86 +            CFLAGS="$save_CFLAGS"
    1.87 +        fi
    1.88 +        if test x$have_libusb_h = xyes; then
    1.89 +            hidapi_support=yes
    1.90 +            AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
    1.91 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
    1.92 +            SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
    1.93 +            SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
    1.94 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
    1.95 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LDFLAGS"
    1.96 +        fi
    1.97 +        AC_MSG_CHECKING(for hidapi support)
    1.98 +        AC_MSG_RESULT($hidapi_support)
    1.99 +    fi
   1.100 +}
   1.101 +
   1.102  dnl Check for clock_gettime()
   1.103  CheckClockGettime()
   1.104  {
   1.105 @@ -3386,6 +3421,7 @@
   1.106          esac
   1.107          CheckTslib
   1.108          CheckUSBHID
   1.109 +        CheckHIDAPI
   1.110          CheckPTHREAD
   1.111          CheckClockGettime
   1.112          CheckLinuxVersion
   1.113 @@ -3811,7 +3847,11 @@
   1.114          # Set up files for the joystick library
   1.115          if test x$enable_joystick = xyes; then
   1.116              AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
   1.117 +            AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
   1.118              SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
   1.119 +            SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
   1.120 +            SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
   1.121 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
   1.122              have_joystick=yes
   1.123          fi
   1.124          # Set up files for the haptic library