configure
changeset 12088 399cc39583cc
parent 12081 277e57c09ff4
child 12130 24142c5073a4
     1.1 --- a/configure	Wed Aug 08 15:39:20 2018 -0400
     1.2 +++ b/configure	Thu Aug 09 16:00:17 2018 -0700
     1.3 @@ -868,6 +868,7 @@
     1.4  enable_directx
     1.5  enable_wasapi
     1.6  enable_sdl_dlopen
     1.7 +enable_hidapi
     1.8  enable_clock_gettime
     1.9  enable_rpath
    1.10  enable_render_d3d
    1.11 @@ -1623,6 +1624,8 @@
    1.12    --enable-directx        use DirectX for Windows audio/video [[default=yes]]
    1.13    --enable-wasapi         use the Windows WASAPI audio driver [[default=yes]]
    1.14    --enable-sdl-dlopen     use dlopen for shared object loading [[default=yes]]
    1.15 +  --enable-hidapi         use HIDAPI for low level joystick drivers
    1.16 +                          [[default=no]]
    1.17    --enable-clock_gettime  use clock_gettime() instead of gettimeofday() on
    1.18                            UNIX [[default=yes]]
    1.19    --enable-rpath          use an rpath when linking SDL [[default=yes]]
    1.20 @@ -16773,7 +16776,7 @@
    1.21  fi
    1.22  
    1.23  
    1.24 -	    for ac_header in libunwind.h
    1.25 +        for ac_header in libunwind.h
    1.26  do :
    1.27    ac_fn_c_check_header_mongrel "$LINENO" "libunwind.h" "ac_cv_header_libunwind_h" "$ac_includes_default"
    1.28  if test "x$ac_cv_header_libunwind_h" = xyes; then :
    1.29 @@ -18377,7 +18380,7 @@
    1.30          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support" >&5
    1.31  $as_echo_n "checking for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support... " >&6; }
    1.32          if test x$PKG_CONFIG != xno; then
    1.33 -        if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
    1.34 +            if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
    1.35                  PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
    1.36                  PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
    1.37                  audio_pulseaudio=yes
    1.38 @@ -20463,7 +20466,7 @@
    1.39              cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1.40  /* end confdefs.h.  */
    1.41  
    1.42 -              	#include <X11/Xlib.h>
    1.43 +                #include <X11/Xlib.h>
    1.44  
    1.45  int
    1.46  main ()
    1.47 @@ -20807,13 +20810,13 @@
    1.48  
    1.49                  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xinput2 multitouch" >&5
    1.50  $as_echo_n "checking for xinput2 multitouch... " >&6; }
    1.51 -            	have_xinput2_multitouch=no
    1.52 -            	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1.53 -/* end confdefs.h.  */
    1.54 -
    1.55 -              		#include <X11/Xlib.h>
    1.56 -             		#include <X11/Xproto.h>
    1.57 -			#include <X11/extensions/XInput2.h>
    1.58 +                have_xinput2_multitouch=no
    1.59 +                cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1.60 +/* end confdefs.h.  */
    1.61 +
    1.62 +                    #include <X11/Xlib.h>
    1.63 +                    #include <X11/Xproto.h>
    1.64 +                    #include <X11/extensions/XInput2.h>
    1.65  
    1.66  int
    1.67  main ()
    1.68 @@ -20828,14 +20831,14 @@
    1.69  _ACEOF
    1.70  if ac_fn_c_try_compile "$LINENO"; then :
    1.71  
    1.72 -            	have_xinput2_multitouch=yes
    1.73 -            	$as_echo "#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1" >>confdefs.h
    1.74 -
    1.75 -                SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
    1.76 -
    1.77 -fi
    1.78 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    1.79 -            	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_xinput2_multitouch" >&5
    1.80 +                    have_xinput2_multitouch=yes
    1.81 +                    $as_echo "#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1" >>confdefs.h
    1.82 +
    1.83 +                    SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
    1.84 +
    1.85 +fi
    1.86 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    1.87 +                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_xinput2_multitouch" >&5
    1.88  $as_echo "$have_xinput2_multitouch" >&6; }
    1.89              fi
    1.90              # Check whether --enable-video-x11-xrandr was given.
    1.91 @@ -23728,6 +23731,93 @@
    1.92      esac
    1.93  }
    1.94  
    1.95 +CheckHIDAPI()
    1.96 +{
    1.97 +    # The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers,
    1.98 +    # so we'll just use libusb when it's available.
    1.99 +    #
   1.100 +    # Except that libusb requires root permissions to open devices, so that's not generally useful, and we'll disable this by default.
   1.101 +    # Check whether --enable-hidapi was given.
   1.102 +if test "${enable_hidapi+set}" = set; then :
   1.103 +  enableval=$enable_hidapi;
   1.104 +else
   1.105 +  enable_hidapi=no
   1.106 +fi
   1.107 +
   1.108 +    if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then
   1.109 +        hidapi_support=no
   1.110 +        # Extract the first word of "pkg-config", so it can be a program name with args.
   1.111 +set dummy pkg-config; ac_word=$2
   1.112 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
   1.113 +$as_echo_n "checking for $ac_word... " >&6; }
   1.114 +if ${ac_cv_path_PKG_CONFIG+:} false; then :
   1.115 +  $as_echo_n "(cached) " >&6
   1.116 +else
   1.117 +  case $PKG_CONFIG in
   1.118 +  [\\/]* | ?:[\\/]*)
   1.119 +  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
   1.120 +  ;;
   1.121 +  *)
   1.122 +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   1.123 +for as_dir in $PATH
   1.124 +do
   1.125 +  IFS=$as_save_IFS
   1.126 +  test -z "$as_dir" && as_dir=.
   1.127 +    for ac_exec_ext in '' $ac_executable_extensions; do
   1.128 +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
   1.129 +    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
   1.130 +    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   1.131 +    break 2
   1.132 +  fi
   1.133 +done
   1.134 +  done
   1.135 +IFS=$as_save_IFS
   1.136 +
   1.137 +  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
   1.138 +  ;;
   1.139 +esac
   1.140 +fi
   1.141 +PKG_CONFIG=$ac_cv_path_PKG_CONFIG
   1.142 +if test -n "$PKG_CONFIG"; then
   1.143 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
   1.144 +$as_echo "$PKG_CONFIG" >&6; }
   1.145 +else
   1.146 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   1.147 +$as_echo "no" >&6; }
   1.148 +fi
   1.149 +
   1.150 +
   1.151 +        if test x$PKG_CONFIG != xno; then
   1.152 +            LIBUSB_CFLAGS=`$PKG_CONFIG --cflags libusb-1.0`
   1.153 +            LIBUSB_LDFLAGS=`$PKG_CONFIG --libs libusb-1.0`
   1.154 +            save_CFLAGS="$CFLAGS"
   1.155 +            CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS"
   1.156 +            ac_fn_c_check_header_mongrel "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default"
   1.157 +if test "x$ac_cv_header_libusb_h" = xyes; then :
   1.158 +  have_libusb_h=yes
   1.159 +fi
   1.160 +
   1.161 +
   1.162 +            CFLAGS="$save_CFLAGS"
   1.163 +        fi
   1.164 +        if test x$have_libusb_h = xyes; then
   1.165 +            hidapi_support=yes
   1.166 +
   1.167 +$as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h
   1.168 +
   1.169 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
   1.170 +            SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
   1.171 +            SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
   1.172 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
   1.173 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LDFLAGS"
   1.174 +        fi
   1.175 +        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hidapi support" >&5
   1.176 +$as_echo_n "checking for hidapi support... " >&6; }
   1.177 +        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hidapi_support" >&5
   1.178 +$as_echo "$hidapi_support" >&6; }
   1.179 +    fi
   1.180 +}
   1.181 +
   1.182  CheckClockGettime()
   1.183  {
   1.184      # Check whether --enable-clock_gettime was given.
   1.185 @@ -23939,6 +24029,7 @@
   1.186          esac
   1.187          CheckTslib
   1.188          CheckUSBHID
   1.189 +        CheckHIDAPI
   1.190          CheckPTHREAD
   1.191          CheckClockGettime
   1.192          CheckLinuxVersion
   1.193 @@ -24514,7 +24605,13 @@
   1.194  
   1.195  $as_echo "#define SDL_JOYSTICK_IOKIT 1" >>confdefs.h
   1.196  
   1.197 +
   1.198 +$as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h
   1.199 +
   1.200              SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
   1.201 +            SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
   1.202 +            SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
   1.203 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
   1.204              have_joystick=yes
   1.205          fi
   1.206          # Set up files for the haptic library