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