Fixed building with cygwin
authorSam Lantinga <slouken@libsdl.org>
Thu, 16 Feb 2006 20:17:43 +0000
changeset 1363 dc623bb58c9a
parent 1362 88ddeb76c9c1
child 1364 4214be2b8d77
Fixed building with cygwin
configure.in
--- a/configure.in	Thu Feb 16 10:22:28 2006 +0000
+++ b/configure.in	Thu Feb 16 20:17:43 2006 +0000
@@ -49,6 +49,20 @@
     AC_DEFINE(SDL_BYTEORDER, 1234)
 fi
 
+dnl Set up the base CFLAGS and LIBS
+case "$target" in
+    *-*-cygwin*)
+        # We build SDL on cygwin without the UNIX emulation layer
+        BASE_CFLAGS="-I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
+        BASE_LIBS="-mno-cygwin"
+        ;;
+    *)
+        BASE_CFLAGS="-D_GNU_SOURCE=1"
+        BASE_LIBS=""
+        ;;
+esac
+CFLAGS="$CFLAGS $BASE_CFLAGS"
+
 dnl Check for tools
 #AC_LIBTOOL_DLOPEN
 AC_LIBTOOL_WIN32_DLL
@@ -144,7 +158,7 @@
 if test x$srcdir != x.; then
     INCLUDE="-Iinclude $INCLUDE"
 fi
-BUILD_CFLAGS='-D_GNU_SOURCE=1 $(INCLUDE)'
+BUILD_CFLAGS="$BASE_CFLAGS \$(INCLUDE)"
 
 # Standard C sources
 SOURCES="$SOURCES $srcdir/src/*.c"
@@ -160,15 +174,13 @@
 SOURCES="$SOURCES $srcdir/src/video/*.c"
 
 # Set up the build libraries needed
-BUILD_LIBS=""
+BUILD_LIBS="$BASE_LIBS"
 
-dnl Initialize the compiler and linker flags for SDL applications
-
-SDL_CFLAGS=""
-SDL_LIBS="-lSDL"
+# Set up the compiler and linker flags for SDL applications
+SDL_CFLAGS="$BASE_CFLAGS"
+SDL_LIBS="$BASE_LIBS -lSDL"
 
 dnl Add the math library for the new gamma correction support
-
 case "$target" in
     *-*-cygwin* | *-*-mingw32*)
         MATHLIB=""
@@ -2123,17 +2135,7 @@
         fi
         # The Win32 platform requires special setup
         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
-        case "$target" in
-            *-*-cygwin*)
-                BUILD_CFLAGS="$BUILD_CFLAGS -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
-                SDL_CFLAGS="$SDL_CFLAGS -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
-                BUILD_LIBS="$BUILD_LIBS -mno-cygwin"
-                SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows -mno-cygwin"
-                ;;
-            *-*-mingw32*)
-                SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
-                ;;
-        esac
+        SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
         ;;
     *-*-beos*)
         ARCH=beos