Commit eb5eb0465213a8acb55d1402ceb0223ce9b3ee4e

Sam Lantinga 2014-02-22T15:34:31

Fixed bug 2298 - undefined reference to `IID_IUnknown' on cygwin Brian Minton When building static or shared libraries on cygwin 1.7.25 on Windows 7 (32-bit), I get the following link errors: build/.libs/SDL_windowskeyboard.o: In function `UIElementSink_QueryInterface@12': /home/c-bminton/src/SDL/src/video/windows/SDL_windowskeyboard.c:995: undefined reference to `IID_IUnknown' build/.libs/SDL_windowskeyboard.o: In function `IPPASink_QueryInterface@12': /home/c-bminton/src/SDL/src/video/windows/SDL_windowskeyboard.c:1101: undefined reference to `IID_IUnknown' collect2: error: ld returned 1 exit status Makefile:126: recipe for target 'build/libSDL2.la' failed make: *** [build/libSDL2.la] Error 1 -- The libuuid from e2fsprogs is completely unrelated to the w32api UUID.DLL implib. FWIW, any *NIX software that I've seen obviously wants the e2fsprogs version, but if libuuid-devel is installed (in /usr/lib) then you can't link against the w32api implib with a simple -luuid.

diff --git a/configure b/configure
index ccb585e..be56484 100755
--- a/configure
+++ b/configure
@@ -22808,7 +22808,12 @@ $as_echo "#define SDL_LOADSO_WINDOWS 1" >>confdefs.h
             have_loadso=yes
         fi
         # Set up the system libraries we need
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -XCClinker -static-libgcc"
+        if  -f /lib/w32api/libuuid.a ; then
+            LIBUUID=/lib/w32api/libuuid.a
+        else
+            LIBUUID=-luuid
+        fi
+        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion $LIBUUID -XCClinker -static-libgcc"
         # The Windows platform requires special setup
         VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
         SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
diff --git a/configure.in b/configure.in
index 3c7adcb..2decb13 100644
--- a/configure.in
+++ b/configure.in
@@ -2860,7 +2860,12 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
             have_loadso=yes
         fi
         # Set up the system libraries we need
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -XCClinker -static-libgcc"
+        if [ -f /lib/w32api/libuuid.a ]; then
+            LIBUUID=/lib/w32api/libuuid.a
+        else
+            LIBUUID=-luuid
+        fi
+        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion $LIBUUID -XCClinker -static-libgcc"
         # The Windows platform requires special setup
         VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
         SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"