virtual joysticks: add autotools-build support (Bug 5028)
authorDavid Ludwig <dludwig@pobox.com>
Mon, 16 Mar 2020 00:21:22 -0400
changeset 1363249320151ca4d
parent 13631 4ee09b18876b
child 13633 340324c76848
virtual joysticks: add autotools-build support (Bug 5028)

Autotools support for virtual-joysticks turns it OFF by default. To turn it
on, pass the following into configure: --enable-joystick-virtual
configure
configure.ac
include/SDL_config.h.in
     1.1 --- a/configure	Sun Mar 15 16:01:19 2020 -0400
     1.2 +++ b/configure	Mon Mar 16 00:21:22 2020 -0400
     1.3 @@ -899,6 +899,7 @@
     1.4  enable_rpath
     1.5  enable_backgrounding_signal
     1.6  enable_foregrounding_signal
     1.7 +enable_joystick_virtual
     1.8  enable_render_d3d
     1.9  enable_sdl2_config
    1.10  '
    1.11 @@ -1691,6 +1692,8 @@
    1.12    --enable-foregrounding-signal
    1.13                            number to use for magic foregrounding signal or 'no'
    1.14                            [[default=no]]
    1.15 +  --enable-joystick-virtual
    1.16 +                          enable virtual joystick APIs [[default=no]]
    1.17    --enable-render-d3d     enable the Direct3D render driver [[default=yes]]
    1.18    --enable-sdl2-config    Install sdl2-config [default=yes]
    1.19  
    1.20 @@ -24531,6 +24534,24 @@
    1.21      fi
    1.22  }
    1.23  
    1.24 +CheckVirtualJoystick()
    1.25 +{
    1.26 +    # Check whether --enable-joystick-virtual was given.
    1.27 +if test "${enable_joystick_virtual+set}" = set; then :
    1.28 +  enableval=$enable_joystick_virtual;
    1.29 +else
    1.30 +  enable_joystick_virtual=no
    1.31 +fi
    1.32 +
    1.33 +    if test x$enable_joystick = xyes -a x$enable_joystick_virtual = xyes; then
    1.34 +
    1.35 +$as_echo "#define SDL_JOYSTICK_VIRTUAL 1" >>confdefs.h
    1.36 +
    1.37 +        SOURCES="$SOURCES $srcdir/src/joystick/virtual/*.c"
    1.38 +        have_joystick_virtual=yes
    1.39 +    fi
    1.40 +}
    1.41 +
    1.42  
    1.43  
    1.44  CheckWarnAll
    1.45 @@ -25390,6 +25411,8 @@
    1.46          ;;
    1.47  esac
    1.48  
    1.49 +CheckVirtualJoystick
    1.50 +
    1.51  # Check whether to install sdl2-config
    1.52  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install sdl2-config" >&5
    1.53  $as_echo_n "checking whether to install sdl2-config... " >&6; }
    1.54 @@ -25650,6 +25673,11 @@
    1.55      SUMMARY="${SUMMARY}X11 libraries   :${SUMMARY_video_x11}\n"
    1.56  fi
    1.57  SUMMARY="${SUMMARY}Input drivers   :${SUMMARY_input}\n"
    1.58 +if test x$have_joystick_virtual = xyes; then
    1.59 +    SUMMARY="${SUMMARY}Enable virtual joystick APIs : YES\n"
    1.60 +else
    1.61 +    SUMMARY="${SUMMARY}Enable virtual joystick APIs : NO\n"
    1.62 +fi
    1.63  if test x$have_samplerate_h_hdr = xyes; then
    1.64      SUMMARY="${SUMMARY}Using libsamplerate : YES\n"
    1.65  else
     2.1 --- a/configure.ac	Sun Mar 15 16:01:19 2020 -0400
     2.2 +++ b/configure.ac	Mon Mar 16 00:21:22 2020 -0400
     2.3 @@ -3410,6 +3410,19 @@
     2.4      fi
     2.5  }
     2.6  
     2.7 +dnl Set up the Virtual joystick driver.
     2.8 +CheckVirtualJoystick()
     2.9 +{
    2.10 +    AC_ARG_ENABLE(joystick-virtual,
    2.11 +AS_HELP_STRING([--enable-joystick-virtual], [enable virtual joystick APIs [[default=no]]]),
    2.12 +                  , enable_joystick_virtual=no)
    2.13 +    if test x$enable_joystick = xyes -a x$enable_joystick_virtual = xyes; then
    2.14 +        AC_DEFINE(SDL_JOYSTICK_VIRTUAL, 1, [ ])
    2.15 +        SOURCES="$SOURCES $srcdir/src/joystick/virtual/*.c"
    2.16 +        have_joystick_virtual=yes
    2.17 +    fi
    2.18 +}
    2.19 +
    2.20  
    2.21  
    2.22  dnl Do this on all platforms, before everything else (other things might want to override it).
    2.23 @@ -4092,6 +4105,9 @@
    2.24          ;;
    2.25  esac
    2.26  
    2.27 +dnl Permit use of virtual joystick APIs on any platform (subject to configure options)
    2.28 +CheckVirtualJoystick
    2.29 +
    2.30  # Check whether to install sdl2-config
    2.31  AC_MSG_CHECKING(whether to install sdl2-config)
    2.32  AC_ARG_ENABLE([sdl2-config],
    2.33 @@ -4315,6 +4331,11 @@
    2.34      SUMMARY="${SUMMARY}X11 libraries   :${SUMMARY_video_x11}\n"
    2.35  fi
    2.36  SUMMARY="${SUMMARY}Input drivers   :${SUMMARY_input}\n"
    2.37 +if test x$have_joystick_virtual = xyes; then
    2.38 +    SUMMARY="${SUMMARY}Enable virtual joystick APIs : YES\n"
    2.39 +else
    2.40 +    SUMMARY="${SUMMARY}Enable virtual joystick APIs : NO\n"
    2.41 +fi
    2.42  if test x$have_samplerate_h_hdr = xyes; then
    2.43      SUMMARY="${SUMMARY}Using libsamplerate : YES\n"
    2.44  else
     3.1 --- a/include/SDL_config.h.in	Sun Mar 15 16:01:19 2020 -0400
     3.2 +++ b/include/SDL_config.h.in	Mon Mar 16 00:21:22 2020 -0400
     3.3 @@ -290,6 +290,7 @@
     3.4  #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
     3.5  #undef SDL_JOYSTICK_HIDAPI
     3.6  #undef SDL_JOYSTICK_EMSCRIPTEN
     3.7 +#undef SDL_JOYSTICK_VIRTUAL
     3.8  #undef SDL_HAPTIC_DUMMY
     3.9  #undef SDL_HAPTIC_ANDROID
    3.10  #undef SDL_HAPTIC_LINUX