configure.in
changeset 7498 bda3639deecc
parent 7494 25575b2a188f
child 7507 885b4aab4190
     1.1 --- a/configure.in	Sun Jul 21 22:09:00 2013 +0200
     1.2 +++ b/configure.in	Sun Jul 21 23:01:01 2013 -0700
     1.3 @@ -70,15 +70,29 @@
     1.4      separate directory so you don't clobber SDL_config.h, SDL_revision.h
     1.5  ])
     1.6  fi
     1.7 +BASE_CFLAGS=""
     1.8 +BASE_LDFLAGS=""
     1.9  case "$host" in
    1.10      *-*-cygwin*)
    1.11          # We build SDL on cygwin without the UNIX emulation layer
    1.12 -        BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
    1.13 -        BASE_LDFLAGS="-mno-cygwin"
    1.14 -        ;;
    1.15 -    *)
    1.16 -        BASE_CFLAGS=""
    1.17 -        BASE_LDFLAGS=""
    1.18 +        save_CFLAGS="$CFLAGS"
    1.19 +        have_no_cygwin=no
    1.20 +        AC_MSG_CHECKING(for GCC -mno-cygwin option)
    1.21 +        CFLAGS="$save_CFLAGS -mno-cygwin"
    1.22 +
    1.23 +        AC_TRY_COMPILE([
    1.24 +        ],[
    1.25 +        ],[
    1.26 +        have_no_cygwin=yes
    1.27 +        ])
    1.28 +        AC_MSG_RESULT($have_no_cygwin)
    1.29 +        CFLAGS="$save_CFLAGS"
    1.30 +
    1.31 +        if test x$have_no_cygwin = xyes; then
    1.32 +            BASE_CFLAGS="-mno-cygwin"
    1.33 +            BASE_LDFLAGS="-mno-cygwin"
    1.34 +        fi
    1.35 +        BASE_CFLAGS="$BASE_CFLAGS -I/usr/include/mingw"
    1.36          ;;
    1.37  esac
    1.38  # Uncomment the following line if you want to force SDL and applications
    1.39 @@ -2511,7 +2525,16 @@
    1.40          VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
    1.41          SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
    1.42          SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
    1.43 -        SDL_LIBS="-lmingw32 -lSDL2main $SDL_LIBS -mwindows"
    1.44 +        SDL_LIBS="-lSDL2main $SDL_LIBS -mwindows"
    1.45 +
    1.46 +        # Check to see if this is a mingw or cygwin build
    1.47 +        have_mingw32=
    1.48 +        AC_CHECK_LIB(mingw32, main, [have_mingw32=yes])
    1.49 +        if test x$have_mingw32 = xyes; then
    1.50 +            SDL_LIBS="-lmingw32 $SDL_LIBS"
    1.51 +        else
    1.52 +            SDL_LIBS="-lcygwin $SDL_LIBS"
    1.53 +        fi
    1.54          ;;
    1.55      *-*-beos* | *-*-haiku*)
    1.56          ARCH=beos