1 # Try to configure the SDL2 client (gui-sdl2)
4 dnl Test for SDL and needed libraries for gui-sdl2
6 AC_DEFUN([FC_SDL2_CLIENT],
8 if test "x$gui_sdl2" = "xyes" || test "x$client" = "xall" ||
9 test "x$client" = "xauto" ; then
10 if test "x$SDL_mixer" = "xsdl" ; then
11 if test "x$gui_sdl2" = "xyes"; then
12 AC_MSG_ERROR([specified client 'sdl2' not configurable (cannot use SDL_mixer with it))])
16 AM_PATH_SDL2([2.0.0], [sdl2_found="yes"], [sdl2_found="no"])
18 if test "$sdl2_found" = yes; then
19 gui_sdl2_cflags="$SDL2_CFLAGS"
20 gui_sdl2_libs="$SDL2_LIBS"
21 FC_SDL2_PROJECT([SDL2_image], [IMG_Load], [SDL_image.h])
22 if test "x$sdl2_h_found" = "xyes" ; then
23 FC_SDL2_PROJECT([SDL2_ttf], [TTF_OpenFont], [SDL_ttf.h])
25 missing_2_project="SDL2_image"
27 if test "x$sdl2_h_found" = "xyes" ; then
28 FC_SDL2_PROJECT([SDL2_gfx], [rotozoomSurface], [SDL2_rotozoom.h])
29 elif test "x$missing_2_project" = "x" ; then
30 missing_2_project="SDL2_ttf"
32 if test "x$sdl2_h_found" = "xyes" ; then
33 PKG_CHECK_MODULES([FT2], [freetype2 >= 2.1.3], [freetype_found="yes"], [freetype_found="no"])
34 if test "$freetype_found" = yes; then
35 gui_sdl2_cflags="$gui_sdl2_cflags $FT2_CFLAGS"
36 gui_sdl2_libs="$gui_sdl2_libs $FT2_LIBS"
38 elif test "x$gui_sdl2" = "xyes"; then
39 AC_MSG_ERROR([specified client 'sdl2' not configurable (FreeType2 >= 2.1.3 is needed (www.freetype.org))])
41 elif test "x$gui_sdl2" = "xyes"; then
42 if test "x$missing_2_project" = "x" ; then
43 missing_2_project="SDL2_gfx"
45 if test "x$sdl2_lib_found" = "xyes" ; then
50 AC_MSG_ERROR([specified client 'sdl2' not configurable (${missing_2_project}${missing_type} is needed (www.libsdl.org))])
54 if test "$found_sdl2_client" = yes; then
56 if test "x$client" = "xauto" ; then
60 dnl Check for libiconv (which is usually included in glibc, but may
61 dnl be distributed separately).
65 gui_sdl2_libs="$LIBICONV $gui_sdl2_libs"
67 dnl Check for some other libraries - needed under BeOS for instance.
68 dnl These should perhaps be checked for in all cases?
69 AC_CHECK_LIB(socket, connect, gui_sdl2_libs="-lsocket $gui_sdl2_libs")
70 AC_CHECK_LIB(bind, gethostbyaddr, gui_sdl2_libs="-lbind $gui_sdl2_libs")
72 elif test "x$gui_sdl2" = "xyes"; then
73 AC_MSG_ERROR([specified client 'sdl2' not configurable (SDL2 >= 2.0.0 is needed (www.libsdl.org))])
78 AC_DEFUN([FC_SDL2_PROJECT],
80 ac_save_CPPFLAGS="$CPPFLAGS"
81 ac_save_CFLAGS="$CFLAGS"
83 CPPFLAGS="$CPPFLAGS $SDL2_CFLAGS"
84 CFLAGS="$CFLAGS $SDL2_CFLAGS"
85 LIBS="$LIBS $SDL2_LIBS"
86 AC_CHECK_LIB([$1], [$2],
87 [sdl2_lib_found="yes"], [sdl2_lib_found="no"
89 if test "x$sdl2_lib_found" = "xyes" ; then
91 if test x$sdl_headers_without_path != xyes ; then
92 AC_CHECK_HEADER([SDL2/$3],
94 gui_sdl2_libs="${gui_sdl2_libs} -l$1"], [])
96 if test x$sdl2_h_found = xno ; then
97 AC_CHECK_HEADER([$3], [sdl2_h_found="yes"
98 gui_sdl2_libs="${gui_sdl2_libs} -l$1"
99 if test x$sdl_headers_without_path != xyes ; then
100 AC_DEFINE([SDL2_PLAIN_INCLUDE], [1], [sdl2 headers must be included without path])
101 sdl_headers_without_path=yes
105 CPPFLAGS="$ac_save_CPPFLAGS"
106 CFLAGS="$ac_save_CFLAGS"