BUILD: Tie the SDL_net version to the SDL version

This means that when using SDL 1.2 we use SDL_net 1.2, but when
using SDL 2 we now use SLD_net 2 as well. Both versions work
properly and there is not code change needed in ScummVM.

This change is because SDL_net depends on SDL, and using
SDL_net 1.2 with SDL 2 means we can end up needing to link with
both the SDL and SDL2 libraries.
This commit is contained in:
Thierry Crozat 2016-09-03 23:06:42 +01:00
parent 8e6cc9f777
commit a2a985368c
4 changed files with 24 additions and 24 deletions

View file

@ -25,7 +25,7 @@
#include "backends/networking/sdl_net/client.h" #include "backends/networking/sdl_net/client.h"
#include "backends/networking/sdl_net/localwebserver.h" #include "backends/networking/sdl_net/localwebserver.h"
#include "common/memstream.h" #include "common/memstream.h"
#include <SDL/SDL_net.h> #include <SDL_net.h>
namespace Networking { namespace Networking {

View file

@ -29,7 +29,7 @@
#include "common/system.h" #include "common/system.h"
#include "common/timer.h" #include "common/timer.h"
#include "common/translation.h" #include "common/translation.h"
#include <SDL/SDL_net.h> #include <SDL_net.h>
#include <common/config-manager.h> #include <common/config-manager.h>
#ifdef POSIX #ifdef POSIX

View file

@ -61,12 +61,11 @@
#endif #endif
#ifdef USE_SDL_NET #ifdef USE_SDL_NET
#include <SDL/SDL_net.h> #include <SDL_net.h>
#endif #endif
#if SDL_VERSION_ATLEAST(2, 0, 0) #if SDL_VERSION_ATLEAST(2, 0, 0)
#include <SDL2/SDL.h> #include <SDL_clipboard.h>
#include <SDL2/SDL_clipboard.h>
#endif #endif
OSystem_SDL::OSystem_SDL() OSystem_SDL::OSystem_SDL()

39
configure vendored
View file

@ -3355,10 +3355,30 @@ case $_backend in
case $_sdlversion in case $_sdlversion in
2.0.*) 2.0.*)
add_line_to_config_mk "USE_SDL2 = 1" add_line_to_config_mk "USE_SDL2 = 1"
append_var SDL_NET_LIBS "-lSDL2_net"
;; ;;
*) *)
append_var SDL_NET_LIBS "-lSDL_net"
;; ;;
esac esac
# Check for SDL_Net
echocheck "SDL_Net"
if test "$_sdlnet" = auto ; then
_sdlnet=no
cat > $TMPC << EOF
#include "SDL_net.h"
int main(int argc, char *argv[]) { SDLNet_Init(); return 0; }
EOF
cc_check $LIBS $INCLUDES $SDL_NET_CFLAGS $SDL_NET_LIBS && _sdlnet=yes
fi
if test "$_sdlnet" = yes ; then
append_var LIBS "$SDL_NET_LIBS"
append_var INCLUDES "$SDL_NET_CFLAGS"
fi
define_in_config_if_yes "$_sdlnet" 'USE_SDL_NET'
echo "$_sdlnet"
;; ;;
esac esac
@ -4134,25 +4154,6 @@ EOF
;; ;;
esac esac
#
# Check for SDL_Net
#
echocheck "SDL_Net"
if test "$_sdlnet" = auto ; then
_sdlnet=no
cat > $TMPC << EOF
#include "SDL/SDL_net.h"
int main(int argc, char *argv[]) { SDLNet_Init(); return 0; }
EOF
cc_check $LIBS $INCLUDES $SDL_NET_CFLAGS $SDL_NET_LIBS -lSDL_net && _sdlnet=yes
fi
if test "$_sdlnet" = yes ; then
append_var LIBS "$SDL_NET_LIBS -lSDL_net"
append_var INCLUDES "$SDL_NET_CFLAGS"
fi
define_in_config_if_yes "$_sdlnet" 'USE_SDL_NET'
echo "$_sdlnet"
# #
# Check for libcurl to be present # Check for libcurl to be present
# #