--- kdeaddons/noatun-plugins/configure.in.in
+++ kdeaddons/noatun-plugins/configure.in.in
@@ -5,8 +5,13 @@
 # stolen from Manish Singh
 # Shamelessly stolen from Owen Taylor
 
+# hacked on by Branden Robinson and Eric Gillespie, Jr. to add
+# SDL_LIBS_FOR_LIBS variable, because it is not legal to link static
+# objects into shared ones on several architectures, including PowerPC,
+# PA-RISC, IA64, MIPS, ...
+
 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
-dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
+dnl Test for SDL, and define SDL_CFLAGS, SDL_LIBS, and SDL_LIBS_FOR_LIBS
 dnl
 AC_DEFUN(NOATUN_PATH_SDL,
 [
@@ -42,6 +47,8 @@
   else
     SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
     SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
+    SDL_LIBS_FOR_LIBS=`$SDL_CONFIG $sdlconf_args --library-libs`
+    SDL_LIBS_FOR_PLUGINS=`$SDL_CONFIG $sdlconf_args --plugin-libs`
 
     sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
@@ -141,6 +148,11 @@
           AC_TRY_LINK([
 #include <stdio.h>
 #include "SDL.h"
+
+int main(int argc, char *argv[])
+{ return 0; }
+#undef  main
+#define main K_and_R_C_main
 ],      [ return 0; ],
         [ echo "*** The test program compiled, but did not run. This usually means"
           echo "*** that the run-time linker is not finding SDL or finding the wrong"
@@ -165,6 +177,8 @@
   fi
   AC_SUBST(SDL_CFLAGS)
   AC_SUBST(SDL_LIBS)
+  AC_SUBST(SDL_LIBS_FOR_LIBS)
+  AC_SUBST(SDL_LIBS_FOR_PLUGINS)
   rm -f conf.sdltest
 ])
 
