1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(TestGfxPrimitives.c)
3AC_CONFIG_MACRO_DIR([m4])
4
5dnl Detect the canonical host and target build environment
6AC_CANONICAL_HOST
7AC_CANONICAL_TARGET
8
9dnl Setup for automake
10AM_INIT_AUTOMAKE(TestGfxPrimitives, 1.0)
11
12dnl SDL version required
13SDL_VERSION=1.2.0
14
15dnl Check for compilers
16AC_LIBTOOL_WIN32_DLL
17AM_PROG_LIBTOOL
18AC_PROG_MAKE_SET
19AC_PROG_CC
20AC_PROG_CXX
21AC_PROG_INSTALL
22
23dnl Check for compiler environment
24AC_C_CONST
25
26dnl Set for C compiler by default
27AC_LANG_C
28
29dnl Setup target flagsw
30case "$target" in
31    *-*-cygwin* | *-*-mingw32*)
32	CFLAGS="$CFLAGS -DWIN32"
33        if test "$build" != "$target"; then # cross-compiling
34            ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
35        fi
36        ;;
37    *)
38	dnl nothing to do
39        ;;
40esac
41
42dnl Figure out which math library to use
43case "$target" in
44    *-*-cygwin* | *-*-mingw32*)
45        MATHLIB=""
46        ;;
47    *-*-beos* | *-*-haiku*)
48        MATHLIB=""
49        ;;
50    *-*-darwin*)
51        MATHLIB=""
52        ;;
53    *-*-aix*)
54	MATHLIB="-lm"
55        if test x$ac_cv_prog_gcc = xyes; then
56            CFLAGS="-mthreads"
57	fi
58        ;;
59    *)
60        MATHLIB="-lm"
61        ;;
62esac
63AC_SUBST(MATHLIB)
64LIBS="$LIBS $MATHLIB"
65
66dnl Check for SDL
67
68AM_PATH_SDL($SDL_VERSION,
69            :,
70	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
71)
72CFLAGS="$CFLAGS $SDL_CFLAGS"
73LIBS="$LIBS $SDL_LIBS"
74
75dnl Check for the SDL_gfx lib
76have_sdlgfx=no
77AC_CHECK_LIB(SDL_gfx, pixelColor , have_sdlgfx=yes)
78if test x$have_sdlgfx = xyes; then
79    LIBS="$LIBS -lSDL_gfx"
80else
81    AC_MSG_ERROR([
82*** Unable to find SDL_gfx library
83])
84fi
85
86# Finally create all the generated files
87AC_OUTPUT([Makefile])
88