1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(README)
3
4dnl Detect the canonical build and host environments
5AC_CONFIG_AUX_DIRS($srcdir/../build-scripts)
6AC_CANONICAL_HOST
7
8dnl Check for tools
9
10AC_PROG_CC
11
12dnl Check for compiler environment
13
14AC_C_CONST
15
16dnl Figure out which math library to use
17case "$host" in
18    *-*-cygwin* | *-*-mingw32*)
19        EXE=".exe"
20        MATHLIB=""
21        SYS_GL_LIBS="-lopengl32"
22        ;;
23    *-*-beos* | *-*-haiku*)
24        EXE=""
25        MATHLIB=""
26        SYS_GL_LIBS="-lGL"
27        ;;
28    *-*-darwin* )
29        EXE=""
30        MATHLIB=""
31        SYS_GL_LIBS="-Wl,-framework,OpenGL"
32        ;;
33    *-*-aix*)
34        EXE=""
35        if test x$ac_cv_prog_gcc = xyes; then
36            CFLAGS="-mthreads"
37        fi
38        SYS_GL_LIBS=""
39        ;;
40    *-*-mint*)
41        EXE=""
42        MATHLIB=""
43        AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
44        if test "x$OSMESA_CONFIG" = "xyes"; then
45            OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
46            OSMESA_LIBS=`$OSMESA_CONFIG --libs`
47            CFLAGS="$CFLAGS $OSMESA_CFLAGS"
48            SYS_GL_LIBS="$OSMESA_LIBS"
49        else
50            SYS_GL_LIBS="-lOSMesa"
51        fi
52		;;
53    *)
54        EXE=""
55        MATHLIB="-lm"
56        SYS_GL_LIBS="-lGL"
57        ;;
58esac
59AC_SUBST(EXE)
60AC_SUBST(MATHLIB)
61
62dnl Check for SDL
63SDL_VERSION=1.2.10
64AM_PATH_SDL($SDL_VERSION,
65            :,
66	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
67)
68CFLAGS="$CFLAGS $SDL_CFLAGS"
69LIBS="$LIBS $SDL_LIBS"
70
71dnl Check for X11 path, needed for OpenGL on some systems
72AC_PATH_X
73if test x$have_x = xyes; then
74    if test x$ac_x_includes = xno || test x$ac_x_includes = x; then
75        :
76    else
77        CFLAGS="$CFLAGS -I$ac_x_includes"
78    fi
79    if test x$ac_x_libraries = xno || test x$ac_x_libraries = x; then
80        :
81    else
82        XPATH="-L$ac_x_libraries"
83    fi
84fi
85
86dnl Check for OpenGL
87AC_MSG_CHECKING(for OpenGL support)
88have_opengl=no
89AC_TRY_COMPILE([
90 #include "SDL_opengl.h"
91],[
92],[
93have_opengl=yes
94])
95AC_MSG_RESULT($have_opengl)
96if test x$have_opengl = xyes; then
97    CFLAGS="$CFLAGS -DHAVE_OPENGL"
98    GLLIB="$XPATH $SYS_GL_LIBS"
99else
100    GLLIB=""
101fi
102AC_SUBST(GLLIB)
103
104dnl Finally create all the generated files
105AC_OUTPUT([Makefile])
106