Do not return NULL as boolean from wonder_is_lost() nor wonder_is_built()
[freeciv.git] / m4 / sdl-client.m4
blobeb2acce2101ab165ddf9b0dc3ad3de43abdc3a32
1 # Try to configure the SDL client (gui-sdl)
3 dnl FC_SDL_CLIENT
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))])
13       fi
14       sdl_found=no
15     else
16       AM_PATH_SDL([1.1.4], [sdl_found="yes"], [sdl_found="no"])
17     fi
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])
24       else
25         missing_project="SDL_image"
26       fi
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"
31       fi
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"
37           found_sdl_client=yes
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))])
40         fi
41       elif test "x$gui_sdl" = "xyes"; then
42         if test "x$missing_project" = "x" ; then
43           missing_project="SDL_ttf"
44         fi
45         if test "x$sdl_lib_found" = "xyes" ; then
46           missing_type="-devel"
47         else
48           missing_type=""
49         fi
50         AC_MSG_ERROR([specified client 'sdl' not configurable (${missing_project}${missing_type} is needed (www.libsdl.org))])
51       fi
52     fi
54     if test "$found_sdl_client" = yes; then
55       gui_sdl=yes
56       if test "x$client" = "xauto" ; then
57         client=yes
58       fi
60       dnl Check for libiconv (which is usually included in glibc, but may
61       dnl be distributed separately).
62       AM_ICONV
63       FC_LIBCHARSET
64       AM_LANGINFO_CODESET
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))])
74     fi
75   fi
78 AC_DEFUN([FC_SDL_PROJECT],
80   ac_save_CPPFLAGS="$CPPFLAGS"
81   ac_save_CFLAGS="$CFLAGS"
82   ac_save_LIBS="$LIBS"
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"
88 sdl_h_found="no"])
89   if test "x$sdl_lib_found" = "xyes" ; then
90     AC_CHECK_HEADER([SDL/$3],
91                     [sdl_h_found="yes"
92 gui_sdl_libs="${gui_sdl_libs} -l$1"], [sdl_h_found="no"])
93   fi
94   CPPFLAGS="$ac_save_CPPFLAGS"
95   CFLAGS="$ac_save_CFLAGS"
96   LIBS="$ac_save_LIBS"