joystick: Fix up Linux joystick code to (mostly) compile on FreeBSD.
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
diff --git a/configure b/configure
index 68425f0..cbbe981 100755
--- a/configure
+++ b/configure
@@ -768,7 +768,6 @@ infodir
docdir
oldincludedir
includedir
-runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -978,7 +977,6 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE}'
@@ -1231,15 +1229,6 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
- -runstatedir | --runstatedir | --runstatedi | --runstated \
- | --runstate | --runstat | --runsta | --runst | --runs \
- | --run | --ru | --r)
- ac_prev=runstatedir ;;
- -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
- | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
- | --run=* | --ru=* | --r=*)
- runstatedir=$ac_optarg ;;
-
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1377,7 +1366,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir runstatedir
+ libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1530,7 +1519,6 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -22724,9 +22712,35 @@ $as_echo "#define SDL_VIDEO_VULKAN 1" >>confdefs.h
CheckInputEvents()
{
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux 2.4 unified input interface" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux 2.4 unified input interface" >&5
$as_echo_n "checking for Linux 2.4 unified input interface... " >&6; }
- use_input_events=no
+ use_input_events=no
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include <dev/evdev/input.h>
+
+int
+main ()
+{
+
+ #ifndef EVIOCGNAME
+ #error EVIOCGNAME() ioctl not available
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ use_input_events=yes
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+ if test x$use_input_events = xno; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -22750,14 +22764,16 @@ if ac_fn_c_try_compile "$LINENO"; then :
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_input_events" >&5
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_input_events" >&5
$as_echo "$use_input_events" >&6; }
- if test x$use_input_events = xyes; then
+ if test x$use_input_events = xyes; then
$as_echo "#define SDL_INPUT_LINUXEV 1" >>confdefs.h
- SUMMARY_input="${SUMMARY_input} linuxev"
- fi
+ SUMMARY_input="${SUMMARY_input} linuxev"
+ fi
}
CheckInputKD()
diff --git a/configure.ac b/configure.ac
index 2c83fd4..d9b1e3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2603,8 +2603,22 @@ dnl See if we can use the new unified event interface in Linux 2.4
CheckInputEvents()
{
dnl Check for Linux 2.4 unified input event interface support
- AC_MSG_CHECKING(for Linux 2.4 unified input interface)
- use_input_events=no
+ AC_MSG_CHECKING(for Linux 2.4 unified input interface)
+ use_input_events=no
+
+ dnl FreeBSD puts this in /usr/include/dev/evdev/input.h ...
+ AC_TRY_COMPILE([
+ #include <dev/evdev/input.h>
+ ],[
+ #ifndef EVIOCGNAME
+ #error EVIOCGNAME() ioctl not available
+ #endif
+ ],[
+ use_input_events=yes
+ ])
+
+ dnl And Linux of course puts it in linux/input.h ...
+ if test x$use_input_events = xno; then
AC_TRY_COMPILE([
#include <linux/input.h>
],[
@@ -2614,11 +2628,13 @@ CheckInputEvents()
],[
use_input_events=yes
])
- AC_MSG_RESULT($use_input_events)
- if test x$use_input_events = xyes; then
- AC_DEFINE(SDL_INPUT_LINUXEV, 1, [ ])
- SUMMARY_input="${SUMMARY_input} linuxev"
- fi
+ fi
+
+ AC_MSG_RESULT($use_input_events)
+ if test x$use_input_events = xyes; then
+ AC_DEFINE(SDL_INPUT_LINUXEV, 1, [ ])
+ SUMMARY_input="${SUMMARY_input} linuxev"
+ fi
}
dnl See if we can use the kernel kd.h header
diff --git a/src/joystick/linux/SDL_sysjoystick_c.h b/src/joystick/linux/SDL_sysjoystick_c.h
index bcbc255..897c925 100644
--- a/src/joystick/linux/SDL_sysjoystick_c.h
+++ b/src/joystick/linux/SDL_sysjoystick_c.h
@@ -22,7 +22,11 @@
#ifndef SDL_sysjoystick_c_h_
#define SDL_sysjoystick_c_h_
+#ifdef __linux__
#include <linux/input.h>
+#else /* FreeBSD (and maybe others) */
+#include <dev/evdev/input.h>
+#endif
struct SDL_joylist_item;