1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(XGalaga-SDL, 2.1.1.0-sdl)
3AM_INIT_AUTOMAKE
4
5dnl Checks for programs.
6AC_PROG_CC
7AM_PROG_CC_C_O
8
9# Enable compilation warnings if gcc is used.
10if test "${ac_cv_c_compiler_gnu}" = "yes"; then
11  CFLAGS="$CFLAGS \
12    -ggdb \
13    -Wall \
14	-W \
15    -Wcast-align \
16    -Wcast-qual \
17    -Wmissing-declarations \
18    -Wmissing-prototypes \
19    -Wpointer-arith \
20    -Wreturn-type \
21    -Wstrict-prototypes \
22    "
23fi # ac_cv_c_compiler_gnu
24
25# Silent rules; but check if supported.
26m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
27
28# Check for SDL libraries
29saved_LIBS=$LIBS
30AC_CHECK_PROG(HAVE_SDL_CONFIG, sdl-config, yes, no)
31if test "$HAVE_SDL_CONFIG" = no; then
32AC_MSG_ERROR(sdl-config doesn't exist. Try to check the PATH enviroment.)
33fi
34
35AC_CHECK_LIB(SDL, SDL_Init,,AC_MSG_ERROR([SDL library not found.]))
36AC_CHECK_LIB(SDL_mixer,main,,AC_MSG_ERROR([SDL_mixer library not found.]))
37AC_CHECK_LIB(SDL_image,IMG_Load,,AC_MSG_ERROR([SDL_image library not found.]))
38AC_CHECK_LIB(SDL_gfx,SDL_framerateDelay,,AC_MSG_ERROR([SDL_gfx library not found.]))
39
40
41AC_ARG_ENABLE(ttf,
42  AS_HELP_STRING([--disable-ttf],[disable use of ttf fonts]),
43  [ if test x"$enableval" = xyes; then
44    with_ttf="yes, check"
45  else
46    with_ttf="no"
47    problem_ttf=": Explicitly disabled"
48  fi ],
49  [ with_ttf="not specified, check" ]
50)
51if ! test x"$with_ttf" = xno; then
52   AC_CHECK_LIB(SDL_ttf,TTF_Init,,AC_MSG_ERROR([SDL_ttf library not found.]))
53fi
54
55SDL_CPPFLAGS=`sdl-config --cflags`
56SDL_LIBS="`sdl-config --libs` $LIBS"
57LIBS=$saved_LIBS
58
59dnl Checks for header files.
60AC_HEADER_STDC
61AC_CHECK_HEADERS(fcntl.h malloc.h strings.h unistd.h)
62
63dnl Checks for library functions.
64AC_CHECK_FUNCS(random lrand48)
65
66AC_SUBST(SDL_LIBS)
67AC_SUBST(SDL_CPPFLAGS)
68AC_SUBST(datadir)
69
70AC_CONFIG_HEADERS([src/config.h])
71
72AC_OUTPUT(Makefile src/Makefile)
73