1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(README)
3
4dnl Set various version strings - taken gratefully from the GTk sources
5
6# Making releases:
7#   MICRO_VERSION += 1;
8#   INTERFACE_AGE += 1;
9#   BINARY_AGE += 1;
10# if any functions have been added, set INTERFACE_AGE to 0.
11# if backwards compatibility has been broken,
12# set BINARY_AGE and INTERFACE_AGE to 0.
13
14MAJOR_VERSION=2
15MINOR_VERSION=0
16MICRO_VERSION=11
17INTERFACE_AGE=1
18BINARY_AGE=11
19VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
20
21AC_SUBST(MAJOR_VERSION)
22AC_SUBST(MINOR_VERSION)
23AC_SUBST(MICRO_VERSION)
24AC_SUBST(INTERFACE_AGE)
25AC_SUBST(BINARY_AGE)
26AC_SUBST(VERSION)
27
28# libtool versioning
29LT_INIT([win32-dll])
30
31LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
32LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
33LT_REVISION=$INTERFACE_AGE
34LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
35
36AC_SUBST(LT_RELEASE)
37AC_SUBST(LT_CURRENT)
38AC_SUBST(LT_REVISION)
39AC_SUBST(LT_AGE)
40
41dnl Detect the canonical build and host environments
42AC_CANONICAL_HOST
43
44dnl Setup for automake
45AM_INIT_AUTOMAKE(SDL_ttf, $VERSION)
46
47dnl Check for tools
48AC_PROG_LIBTOOL
49AC_PROG_CC
50AC_PROG_INSTALL
51AC_PROG_MAKE_SET
52if test -z "$host_alias"; then
53    hostaliaswindres=
54else
55    hostaliaswindres="$host_alias-windres"
56fi
57AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres])
58
59case "$host" in
60    *-*-cygwin* | *-*-mingw32*)
61	;;
62    *)
63	AC_FUNC_ALLOCA
64	;;
65esac
66
67
68dnl Check for iconv (character conversion library; see iconv.m4)
69dnl This isn't available on many systems
70dnl AM_ICONV
71
72case "$host" in
73    *-*-beos*)
74        ac_default_prefix=/boot/develop/tools/gnupro
75        ;;
76    *-*-cygwin* | *-*-mingw32*)
77        if test "$build" != "$host"; then # cross-compiling
78            # Default cross-compile location
79            ac_default_prefix=/usr/local/cross-tools/i386-mingw32
80        else
81            # Look for the location of the tools and install there
82            if test "$BUILD_PREFIX" != ""; then
83                ac_default_prefix=$BUILD_PREFIX
84            fi
85        fi
86        if test x$WINDRES != x; then
87            use_version_rc=true
88        fi
89        ;;
90esac
91AM_CONDITIONAL(USE_VERSION_RC, test x$use_version_rc = xtrue)
92
93dnl Check for the FreeType 2 library
94dnl
95dnl Get the cflags and libraries from the freetype-config script
96dnl
97AC_ARG_WITH(freetype-prefix,[  --with-freetype-prefix=PFX   Prefix where FREETYPE is
98installed (optional)],
99            freetype_prefix="$withval", freetype_prefix="")
100AC_ARG_WITH(freetype-exec-prefix,[  --with-freetype-exec-prefix=PFX Exec prefix
101where FREETYPE is installed (optional)],
102            freetype_exec_prefix="$withval", freetype_exec_prefix="")
103
104if test x$freetype_exec_prefix != x ; then
105     freetype_args="$freetype_args --exec-prefix=$freetype_exec_prefix"
106     if test x${FREETYPE_CONFIG+set} != xset ; then
107        FREETYPE_CONFIG=$freetype_exec_prefix/bin/freetype-config
108     fi
109fi
110if test x$freetype_prefix != x ; then
111     freetype_args="$freetype_args --prefix=$freetype_prefix"
112     if test x${FREETYPE_CONFIG+set} != xset ; then
113        FREETYPE_CONFIG=$freetype_prefix/bin/freetype-config
114     fi
115fi
116AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
117no_freetype=""
118if test "$FREETYPE_CONFIG" = "no" ; then
119    AC_MSG_ERROR([
120*** Unable to find FreeType2 library (http://www.freetype.org/)
121])
122else
123    CFLAGS="$CFLAGS `$FREETYPE_CONFIG $freetypeconf_args --cflags`"
124    LIBS="$LIBS `$FREETYPE_CONFIG $freetypeconf_args --libs`"
125fi
126
127dnl Check for SDL
128SDL_VERSION=1.2.4
129AC_SUBST(SDL_VERSION)
130AM_PATH_SDL($SDL_VERSION,
131            :,
132	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
133)
134CFLAGS="$CFLAGS $SDL_CFLAGS"
135LIBS="$LIBS $SDL_LIBS"
136
137dnl Check for OpenGL
138case "$host" in
139    *-*-cygwin* | *-*-mingw32*)
140        MATHLIB=""
141        SYS_GL_LIBS="-lopengl32"
142        ;;
143    *-*-beos*)
144        MATHLIB=""
145        SYS_GL_LIBS="-lGL"
146        ;;
147    *-*-darwin*)
148        MATHLIB=""
149        SYS_GL_LIBS="-Wl,-framework,OpenGL"
150        ;;
151    *-*-aix*)
152        if test x$ac_cv_prog_gcc = xyes; then
153            CFLAGS="-mthreads"
154	fi
155        SYS_GL_LIBS=""
156        ;;
157    *)
158        MATHLIB="-lm"
159        AC_PATH_X
160        AC_PATH_XTRA
161        if test x$have_x = xyes; then
162            CFLAGS="$CFLAGS $X_CFLAGS"
163            SYS_GL_LIBS="$X_LIBS -lGL"
164        else
165            SYS_GL_LIBS="-lGL"
166        fi
167        ;;
168esac
169AC_MSG_CHECKING(for OpenGL support)
170have_opengl=no
171AC_TRY_COMPILE([
172 #include "SDL_opengl.h"
173],[
174 GLuint texture;
175],[
176have_opengl=yes
177])
178AC_MSG_RESULT($have_opengl)
179if test x$have_opengl = xyes; then
180    CFLAGS="$CFLAGS -DHAVE_OPENGL"
181    GL_LIBS="$SYS_GL_LIBS"
182else
183    GL_LIBS=""
184fi
185AC_SUBST([GL_LIBS])
186AC_SUBST([MATHLIB])
187AC_SUBST([WINDRES])
188
189# Finally create all the generated files
190AC_OUTPUT([
191Makefile
192SDL_ttf.spec
193SDL_ttf.pc
194])
195