1
0
Fork 0

Update buildsystem to target SDL2

Replace sdl-config with sdl2-config, and add few smaller changes.
This commit is contained in:
Patryk Obara 2019-12-22 04:06:28 +01:00 committed by Patryk Obara
parent a06035a35e
commit 185c8af6f5
2 changed files with 18 additions and 32 deletions

View file

@ -3,7 +3,7 @@ dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
dnl
AC_DEFUN([AM_PATH_SDL],
[dnl
dnl Get the cflags and libraries from the sdl-config script
dnl Get the cflags and libraries from the sdl2-config script
dnl
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
sdl_prefix="$withval", sdl_prefix="")
@ -15,17 +15,17 @@ AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run
if test x$sdl_exec_prefix != x ; then
sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
if test x${SDL_CONFIG+set} != xset ; then
SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
SDL_CONFIG=$sdl_exec_prefix/bin/sdl2-config
fi
fi
if test x$sdl_prefix != x ; then
sdl_args="$sdl_args --prefix=$sdl_prefix"
if test x${SDL_CONFIG+set} != xset ; then
SDL_CONFIG=$sdl_prefix/bin/sdl-config
SDL_CONFIG=$sdl_prefix/bin/sdl2-config
fi
fi
AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
AC_PATH_PROG(SDL_CONFIG, sdl2-config, no)
min_sdl_version=ifelse([$1], ,0.11.0,$1)
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
no_sdl=""
@ -48,7 +48,7 @@ AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run
LIBS="$LIBS $SDL_LIBS"
dnl
dnl Now check if the installed SDL is sufficiently new. (Also sanity
dnl checks the results of sdl-config to some extent
dnl checks the results of sdl2-config to some extent
dnl
rm -f conf.sdltest
AC_TRY_RUN([
@ -98,11 +98,11 @@ int main (int argc, char *argv[])
}
else
{
printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro);
printf("*** best to upgrade to the required version.\n");
printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
printf("*** to point to the correct copy of sdl-config, and remove the file\n");
printf("*** If sdl2-config was wrong, set the environment variable SDL_CONFIG\n");
printf("*** to point to the correct copy of sdl2-config, and remove the file\n");
printf("*** config.cache before re-running configure\n");
return 1;
}
@ -119,10 +119,10 @@ int main (int argc, char *argv[])
else
AC_MSG_RESULT(no)
if test "$SDL_CONFIG" = "no" ; then
echo "*** The sdl-config script installed by SDL could not be found"
echo "*** The sdl2-config script installed by SDL could not be found"
echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the SDL_CONFIG environment variable to the"
echo "*** full path to sdl-config."
echo "*** full path to sdl2-config."
else
if test -f conf.sdltest ; then
:
@ -146,7 +146,7 @@ int main (int argc, char *argv[])
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occurred. This usually means SDL was incorrectly installed"
echo "*** or that you have moved SDL since it was installed. In the latter case, you"
echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
echo "*** may want to edit the sdl2-config script: $SDL_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi

View file

@ -24,7 +24,7 @@ AC_PROG_INSTALL
AC_PROG_RANLIB
dnl Check for SDL
SDL_VERSION=1.2.0
SDL_VERSION=2.0.0
AM_PATH_SDL($SDL_VERSION,
:,
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
@ -32,20 +32,6 @@ AM_PATH_SDL($SDL_VERSION,
LIBS="$LIBS $SDL_LIBS"
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
dnl Check if SDL is 1.2.x (1.3 not supported)
AC_MSG_CHECKING([SDL version only being 1.2.X])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include "SDL.h"
void blah(){
#if SDL_MINOR_VERSION != 2
#error "Only SDL 1.2 supported"
#endif
;
}
])],AC_MSG_RESULT([yes]),[
AC_MSG_RESULT([no])
AC_MSG_ERROR([Only libSDL 1.2.X supported])])
dnl Checks for header files.
dnl Checks for typedefs, structures, and compiler characteristics.
@ -452,13 +438,13 @@ else
AC_MSG_RESULT([no])
fi
AH_TEMPLATE(C_MODEM,[Define to 1 to enable internal modem support, requires SDL_net])
AH_TEMPLATE(C_IPX,[Define to 1 to enable IPX over Internet networking, requires SDL_net])
AH_TEMPLATE(C_MODEM,[Define to 1 to enable internal modem support, requires SDL2_net])
AH_TEMPLATE(C_IPX,[Define to 1 to enable IPX over Internet networking, requires SDL2_net])
AC_CHECK_HEADER(SDL_net.h,have_sdl_net_h=yes,)
AC_CHECK_LIB(SDL_net, SDLNet_Init, have_sdl_net_lib=yes, , )
AC_CHECK_LIB(SDL2_net, SDLNet_Init, have_sdl_net_lib=yes, , )
if test x$have_sdl_net_lib = xyes -a x$have_sdl_net_h = xyes ; then
LIBS="$LIBS -lSDL_net"
LIBS="$LIBS -lSDL2_net"
AC_DEFINE(C_MODEM,1)
AC_DEFINE(C_IPX,1)
else
@ -492,7 +478,7 @@ if test x$enable_opengl = xyes; then
case "$host" in
*-*-darwin*)
AC_MSG_RESULT(yes)
LIBS="$LIBS -framework OpenGL"
LIBS="$LIBS -framework OpenGL -framework CoreFoundation"
AC_DEFINE(C_OPENGL,1)
;;
*)