1 # Try to configure the SDL client (gui-sdl)
4 dnl Test for SDL and needed libraries for gui-sdl
6 AC_DEFUN([FC_SDL_CLIENT],
8 if test "x$gui_sdl" = "xyes" || test "x$client" = "xall" ||
9 test "x$client" = "xauto" ; then
10 if test "x$SDL_mixer" = "xsdl2" ; then
11 if test "x$gui_sdl" = "xyes"; then
12 AC_MSG_ERROR([specified client 'sdl' not configurable (cannot use SDL2_mixer with it))])
16 AM_PATH_SDL([1.1.4], [sdl_found="yes"], [sdl_found="no"])
18 if test "$sdl_found" = yes; then
19 gui_sdl_cflags="$SDL_CFLAGS"
20 gui_sdl_libs="$SDL_LIBS"
21 FC_SDL_PROJECT([SDL_image], [IMG_Load], [SDL_image.h])
22 if test "x$sdl_h_found" = "xyes" ; then
23 FC_SDL_PROJECT([SDL_gfx], [rotozoomSurface], [SDL_rotozoom.h])
25 missing_project="SDL_image"
27 if test "x$sdl_h_found" = "xyes" ; then
28 FC_SDL_PROJECT([SDL_ttf], [TTF_OpenFont], [SDL_ttf.h])
29 elif test "x$missing_project" = "x" ; then
30 missing_project="SDL_gfx"
32 if test "x$sdl_h_found" = "xyes" ; then
33 AC_CHECK_FT2([2.1.3], [freetype_found="yes"], [freetype_found="no"])
34 if test "$freetype_found" = yes; then
35 gui_sdl_cflags="$gui_sdl_cflags $FT2_CFLAGS"
36 gui_sdl_libs="$gui_sdl_libs $FT2_LIBS"
38 elif test "x$gui_sdl" = "xyes"; then
39 AC_MSG_ERROR([specified client 'sdl' not configurable (FreeType2 >= 2.1.3 is needed (www.freetype.org))])
41 elif test "x$gui_sdl" = "xyes"; then
42 if test "x$missing_project" = "x" ; then
43 missing_project="SDL_ttf"
45 if test "x$sdl_lib_found" = "xyes" ; then
50 AC_MSG_ERROR([specified client 'sdl' not configurable (${missing_project}${missing_type} is needed (www.libsdl.org))])
54 if test "$found_sdl_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_sdl_libs="$LIBICONV $gui_sdl_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_sdl_libs="-lsocket $gui_sdl_libs")
70 AC_CHECK_LIB(bind, gethostbyaddr, gui_sdl_libs="-lbind $gui_sdl_libs")
72 elif test "x$gui_sdl" = "xyes"; then
73 AC_MSG_ERROR([specified client 'sdl' not configurable (SDL >= 1.1.4 is needed (www.libsdl.org))])
78 AC_DEFUN([FC_SDL_PROJECT],
80 ac_save_CPPFLAGS="$CPPFLAGS"
81 ac_save_CFLAGS="$CFLAGS"
83 CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
84 CFLAGS="$CFLAGS $SDL_CFLAGS"
85 LIBS="$LIBS $SDL_LIBS"
86 AC_CHECK_LIB([$1], [$2],
87 [sdl_lib_found="yes"], [sdl_lib_found="no"
89 if test "x$sdl_lib_found" = "xyes" ; then
90 AC_CHECK_HEADER([SDL/$3],
92 gui_sdl_libs="${gui_sdl_libs} -l$1"], [sdl_h_found="no"])
94 CPPFLAGS="$ac_save_CPPFLAGS"
95 CFLAGS="$ac_save_CFLAGS"