1AC_INIT(src/flyhard.cpp)
2AM_INIT_AUTOMAKE(flyhard,0.42)
3AM_CONFIG_HEADER(config.h)
4
5AC_PROG_CXX
6AC_LANG_CPLUSPLUS
7
8AC_ARG_ENABLE(local-data-files,
9              [--enable-local-data-files  Look for data files in the current directory],
10              AC_DEFINE([LOCAL_DATA_FILES], [1], [Define to 1 to make flyhard look for data files in the current directory]))
11
12
13
14#libpng
15AC_CHECK_LIB(png, png_create_read_struct, ,[AC_MSG_ERROR([libpng not found, it is needed.  Get it from http://www.libpng.org])])
16AC_CHECK_HEADER(png.h, ,[AC_MSG_ERROR([png.h not found, although libpng was found.  Need to install libpng-devel?])])
17
18
19#SDL
20#evaulate sdl-config --libs in this file, because automake will spazz horribly if we try to use it as a LDFLAG
21#(but first, make sure we give a comprehensible error if it is not there)
22AC_CHECK_PROG(SDL_CONFIG, sdl-config, yes, no)
23if test "$SDL_CONFIG" = "no"; then
24  AC_MSG_ERROR([sdl-config not found; it is either not in your path or not anywhere.  This probably means you don't have libSDL (or you have binary SDL libs but don't have SDL development libs).   Get whatever is missing from http://www.libsdl.org])
25fi
26FH_SDL_LIBS=`sdl-config --libs`
27AC_SUBST([FH_SDL_LIBS])
28
29#Alas, we can't do this, because we don't want the side-effect of adding -lSDL to LDFLAGS,
30#because we're using sdl-config --libs for that
31#AC_CHECK_LIB(SDL, SDL_Init,               ,[AC_MSG_ERROR([libSDL not found, it is needed.  Get it from http://www.libsdl.org])])
32
33#SDL_mixer
34AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio,    ,[AC_MSG_ERROR([libSDL_mixer not found, it is needed.  Get it from http://www.libsdl.org/projects/SDL_mixer])])
35
36#find SDL headers, which may or may not be in include/SDL directory.  Geez...
37AC_CHECK_HEADERS(SDL/SDL.h SDL.h SDL/SDL_mixer.h SDL_mixer.h [], [])
38AC_CHECK_HEADER(SDL.h,       [], [AC_CHECK_HEADER(SDL/SDL.h, [],       [AC_MSG_ERROR([SDL.h not found, although libSDL was found. Need to install SDL development libs?])])])
39AC_CHECK_HEADER(SDL_mixer.h, [], [AC_CHECK_HEADER(SDL/SDL_mixer.h, [], [AC_MSG_ERROR([SDL_mixer.h not found, although libSDL_mixer was found. Need to install SDL_mixer development libs?])])])
40
41#Check boost headers.  We don't actually need the boost library.
42AC_CHECK_HEADER(boost/shared_ptr.hpp, [], [AC_MSG_ERROR([boost/shared_ptr.hpp not found.  Get it from http://www.boost.org])])
43AC_CHECK_HEADER(boost/weak_ptr.hpp, [], [AC_MSG_ERROR([boost/weak_ptr.hpp not found.  Get it from http://www.boost.org])])
44
45AC_OUTPUT(Makefile src/Makefile src/images/Makefile src/sounds/Makefile)
46
47