summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/x11/detect.py18
-rw-r--r--platform/x11/joystick_linux.cpp2
-rw-r--r--platform/x11/joystick_linux.h2
-rw-r--r--platform/x11/os_x11.cpp6
-rw-r--r--platform/x11/os_x11.h2
5 files changed, 18 insertions, 12 deletions
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index c93905ed3c..0226c8b8c0 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -45,10 +45,6 @@ def can_build():
print("xinerama not found.. x11 disabled.")
return False
- x11_error=os.system("pkg-config libevdev --modversion > /dev/null ")
- if (x11_error):
- print("evdev not found.. x11 disabled.")
- return False
return True # X11 enabled
@@ -133,7 +129,6 @@ def configure(env):
env.ParseConfig('pkg-config x11 --cflags --libs')
env.ParseConfig('pkg-config xinerama --cflags --libs')
env.ParseConfig('pkg-config xcursor --cflags --libs')
- env.ParseConfig('pkg-config libevdev --cflags --libs')
if (env["openssl"]=="yes"):
env.ParseConfig('pkg-config openssl --cflags --libs')
@@ -155,7 +150,18 @@ def configure(env):
env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED'])
if platform.system() == 'Linux':
env.Append(CPPFLAGS=["-DALSA_ENABLED"])
- env.Append(LIBS=['asound', 'udev'])
+ env.Append(LIBS=['asound'])
+
+ if not os.system("pkg-config --exists libudev"):
+ if not os.system("pkg-config --exists libevdev"):
+ print("Enabling udev/evdev")
+ env.Append(CPPFLAGS=["-DJOYDEV_ENABLED"])
+ env.ParseConfig('pkg-config libudev --cflags --libs')
+ env.ParseConfig('pkg-config libevdev --cflags --libs')
+ else:
+ print("libevdev development libraries not found, disabling gamepad support")
+ else:
+ print("libudev development libraries not found, disabling gamepad support")
if (env["pulseaudio"]=="yes"):
if not os.system("pkg-config --exists libpulse-simple"):
diff --git a/platform/x11/joystick_linux.cpp b/platform/x11/joystick_linux.cpp
index e50916d2c2..cc806f6f78 100644
--- a/platform/x11/joystick_linux.cpp
+++ b/platform/x11/joystick_linux.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
//author: Andreas Haas <hondres, liugam3@gmail.com>
-#ifdef __linux__
+#ifdef JOYDEV_ENABLED
#include "joystick_linux.h"
#include "print_string.h"
diff --git a/platform/x11/joystick_linux.h b/platform/x11/joystick_linux.h
index 339a5f239d..1064a6f841 100644
--- a/platform/x11/joystick_linux.h
+++ b/platform/x11/joystick_linux.h
@@ -30,7 +30,7 @@
//author: Andreas Haas <hondres, liugam3@gmail.com>
#ifndef JOYSTICK_LINUX_H
#define JOYSTICK_LINUX_H
-#ifdef __linux__
+#ifdef JOYDEV_ENABLED
#include "main/input_default.h"
#include "os/thread.h"
#include "os/mutex.h"
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index d23994edd7..0afab6442b 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -426,7 +426,7 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
physics_2d_server->init();
input = memnew( InputDefault );
-#ifdef __linux__
+#ifdef JOYDEV_ENABLED
joystick = memnew( joystick_linux(input));
#endif
_ensure_data_dir();
@@ -461,7 +461,7 @@ void OS_X11::finalize() {
physics_2d_server->finish();
memdelete(physics_2d_server);
-#ifdef __linux__
+#ifdef JOYDEV_ENABLED
memdelete(joystick);
#endif
memdelete(input);
@@ -1753,7 +1753,7 @@ void OS_X11::run() {
while (!force_quit) {
process_xevents(); // get rid of pending events
-#ifdef __linux__
+#ifdef JOYDEV_ENABLED
event_id = joystick->process_joysticks(event_id);
#endif
if (Main::iteration()==true)
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index 02518189e0..eee3e40136 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -126,7 +126,7 @@ class OS_X11 : public OS_Unix {
InputDefault *input;
-#ifdef __linux__
+#ifdef JOYDEV_ENABLED
joystick_linux *joystick;
#endif