We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 403

Summary: --disable-joystick causes undefined symbols
Product: SDL Reporter: Tim Wojtulewicz <timwoj>
Component: joystickAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: sol11x86
Version: HG 1.2   
Hardware: Other   
OS: Solaris   

Description Tim Wojtulewicz 2007-02-28 17:36:57 UTC
Passing --disable-joystick causes a few undefined symbols to be left in the resulting libSDL.so.  A quick fix is to modify the configure script to add src/joystick/dummy/*.c to SOURCES whenever the joystick is disabled.

It looks like this might occur in other places too, CDROM being one of them.
Comment 1 Ben Taylor 2007-03-04 09:08:38 UTC
In addition, if --enable-joystick is configured, and there are no
platform specific backend, IE, it defaults to the src/joystick/dummy/*.c
files, the define SDL_JOYSTICK_DUMMY should be configured.
Comment 2 Ben Taylor 2007-03-04 09:23:07 UTC
This patch has been tested on Solaris 10/U3 x86 with both
--enable-joystick and --disable-joystick.  The problems
with symbols not found has been resolved.

--- configure.in.ORIG   2007-03-04 10:02:00.000000000 -0500
+++ configure.in        2007-03-04 12:07:33.145203000 -0500
@@ -227,6 +227,7 @@
               , enable_joystick=yes)
 if test x$enable_joystick != xyes; then
     AC_DEFINE(SDL_JOYSTICK_DISABLED)
+    SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
 fi
 AC_ARG_ENABLE(cdrom,
 AC_HELP_STRING([--enable-cdrom], [Enable the cdrom subsystem [[default=yes]]]),
@@ -2576,7 +2577,8 @@
 if test x$enable_joystick = xyes; then
   if test x$have_joystick != xyes; then
     # Wants joystick subsystem, but doesn't have a platform-specific backend...
-    SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
+    AC_DEFINE(SDL_JOYSTICK_DUMMY)
+    SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
   fi
 fi
 if test x$have_cdrom != xyes; then

Comment 3 Ryan C. Gordon 2007-03-04 11:58:30 UTC
(Reopening bug so I remember to apply this patch...)

--ryan.

Comment 4 Tim Wojtulewicz 2007-03-04 16:23:09 UTC
You might also duplicate that patch for the other dummy backends
Comment 5 Ryan C. Gordon 2007-04-04 03:39:26 UTC
I took a slightly different approach here...instead of forcing the dummy driver to resolve symbols the higher level needs, I changed the configure script to not compile the higher level if built with --disable-joystick...in which case SDL_Init() will just fail if you try to init the joystick subsystem, as it should (and does with other subsystems).

The reason --disable-audio, etc doesn't have this problem is because it expects to have multiple drivers, so it can handle zero drivers. The joystick subsystem expects one implementation per platform, so it threw up when it found none.

This should be done for other subsystems, since there's no sense in including the audio mixers if you don't want the audio subsystem, etc, but since I expect that will cause havoc, I'm just changing the joysticks for now. When my OLPC prototype shows up, I'll revisit the other subsystems.

The SDL_JOYSTICK_DUMMY define is a good fix though, I put that part of the patch in.

Fixed in svn revision #3011 for the 1.2 branch, and #3013 for the 1.3 branch.

Thanks!

--ryan.