2
dnl Check the build plataform and try to use the native compiler
4
AC_DEFUN(FTGL_PROG_CXX,
9
dnl I really don't know how to handle the cross-compiling case
10
if test "$build" = "$host" ; then
13
if test -z "$CXX" ; then
16
if test -z "$CC" ; then
19
if test x$CXX = xCC -a -z "$CXXFLAGS" ; then
20
# It might be worthwhile to move this out of here, say
21
# EXTRA_CXXFLAGS. Forcing -n32 might cause trouble, too.
22
CXXFLAGS="-LANG:std -n32 -woff 1201 -O3"
30
# Configure paths for FreeType2
31
# Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor
33
dnl AC_CHECK_FT2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
34
dnl Test for FreeType2, and define FT2_CFLAGS and FT2_LIBS
36
AC_DEFUN(AC_CHECK_FT2,
38
dnl Get the cflags and libraries from the freetype-config script
40
AC_ARG_WITH(freetype-prefix,
41
[ --with-ft-prefix=PFX Prefix where FreeType is installed (optional)],
42
ft_config_prefix="$withval", ft_config_prefix="")
43
AC_ARG_WITH(freetype-exec-prefix,
44
[ --with-ft-exec-prefix=PFX Exec prefix where FreeType is installed (optional)],
45
ft_config_exec_prefix="$withval", ft_config_exec_prefix="")
46
AC_ARG_ENABLE(freetypetest, [ --disable-freetypetest Do not try to compile and run a test FreeType program],[],
49
if test x$ft_config_exec_prefix != x ; then
50
ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix"
51
if test x${FT2_CONFIG+set} != xset ; then
52
FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config
55
if test x$ft_config_prefix != x ; then
56
ft_config_args="$ft_config_args --prefix=$ft_config_prefix"
57
if test x${FT2_CONFIG+set} != xset ; then
58
FT2_CONFIG=$ft_config_prefix/bin/freetype-config
61
AC_PATH_PROG(FT2_CONFIG, freetype-config, no)
63
min_ft_version=ifelse([$1], ,6.1.0,$1)
64
AC_MSG_CHECKING(for FreeType - version >= $min_ft_version)
66
if test "$FT2_CONFIG" = "no" ; then
69
FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags`
70
FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs`
71
ft_config_version=`$FT2_CONFIG $ft_config_args --version`
72
ft_config_major_version=`echo $ft_config_version | cut -d . -f 1`
73
ft_config_minor_version=`echo $ft_config_version | cut -d . -f 2`
74
ft_config_micro_version=`echo $ft_config_version | cut -d . -f 3`
75
ft_min_major_version=`echo $min_ft_version | cut -d . -f 1`
76
ft_min_minor_version=`echo $min_ft_version | cut -d . -f 2`
77
ft_min_micro_version=`echo $min_ft_version | cut -d . -f 3`
78
if test "x$enable_fttest" = "xyes" ; then
79
ft_config_version=`expr $ft_config_major_version \* 10000 + $ft_config_minor_version \* 100 + $ft_config_micro_version`
80
ft_min_version=`expr $ft_min_major_version \* 10000 + $ft_min_minor_version \* 100 + $ft_min_micro_version`
81
if test $ft_config_version -lt $ft_min_version ; then
82
ifelse([$3], , :, [$3])
84
ac_save_CFLAGS="$CFLAGS"
86
CFLAGS="$CFLAGS $FT2_CFLAGS"
87
LIBS="$FT2_LIBS $LIBS"
89
dnl Sanity checks the results of freetype-config to some extent
93
#include FT_FREETYPE_H
103
error = FT_Init_FreeType( &library );
109
FT_Done_FreeType( library );
113
],, no_ft=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
114
CFLAGS="$ac_save_CFLAGS"
116
fi # test $ft_config_version -lt $ft_min_version
117
fi # test "x$enable_fttest" = "xyes"
118
fi # test "$FT2_CONFIG" = "no"
119
if test "x$no_ft" = x ; then
121
ifelse([$2], , :, [$2])
124
if test "$FT2_CONFIG" = "no" ; then
125
echo "*** The freetype-config script installed by FT2 could not be found"
126
echo "*** If FT2 was installed in PREFIX, make sure PREFIX/bin is in"
127
echo "*** your path, or set the FT2_CONFIG environment variable to the"
128
echo "*** full path to freetype-config."
130
echo "*** The FreeType test program failed to run. If your system uses"
131
echo "*** shared libraries and they are installed outside the normal"
132
echo "*** system library path, make sure the variable LD_LIBRARY_PATH"
133
echo "*** (or whatever is appropiate for your system) is correctly set."
137
ifelse([$3], , :, [$3])
143
dnl Check for OpenGL development environment and GLU >= 1.2
145
AC_DEFUN([FTGL_CHECK_GL],
147
AC_REQUIRE([AC_PROG_CC])
148
AC_REQUIRE([AC_PATH_X])
149
AC_REQUIRE([AC_PATH_XTRA])
151
AC_ARG_WITH([--with-gl-inc],
152
AC_HELP_STRING([--with-gl-inc=DIR],[Directory where GL/gl.h is installed]))
153
AC_ARG_WITH([--with-gl-lib],
154
AC_HELP_STRING([--with-gl-lib=DIR],[Directory where OpenGL libraries are installed]))
159
GL_SAVE_CPPFLAGS="$CPPFLAGS"
162
if test "x$no_x" != xyes ; then
163
GL_CFLAGS="$X_CFLAGS"
164
GL_X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu $X_EXTRA_LIBS"
167
if test "x$with_gl_inc" != "xnone" ; then
168
if test -d "$with_gl_inc" ; then
169
GL_CFLAGS="-I$with_gl_inc"
171
GL_CFLAGS="$with_gl_inc"
177
CPPFLAGS="$GL_CFLAGS"
178
AC_CHECK_HEADER([GL/gl.h], [], [AC_MSG_ERROR(GL/gl.h is needed, please specify its location with --with-gl-inc. If this still fails, please contact mmagallo@debian.org, include the string FTGL somewhere in the subject line and provide a copy of the config.log file that was left behind.)])
180
AC_MSG_CHECKING([for GL library])
181
if test "x$with_gl_lib" != "x" ; then
182
if test -d "$with_gl_lib" ; then
183
LIBS="-L$with_gl_lib -lGL"
190
AC_LINK_IFELSE([AC_LANG_CALL([],[glBegin])],[HAVE_GL=yes], [HAVE_GL=no])
191
if test "x$HAVE_GL" = xno ; then
192
if test "x$GL_X_LIBS" != x ; then
193
LIBS="-lGL $GL_X_LIBS"
194
AC_LINK_IFELSE([AC_LANG_CALL([],[glBegin])],[HAVE_GL=yes], [HAVE_GL=no])
197
if test "x$HAVE_GL" = xyes ; then
202
AC_MSG_ERROR([GL library could not be found, please specify its location with --with-gl-lib. If this still fails, please contact mmagallo@debian.org, include the string FTGL somewhere in the subject line and provide a copy of the config.log file that was left behind.])
205
AC_CHECK_HEADER([GL/glu.h])
206
AC_MSG_CHECKING([for GLU version >= 1.2])
207
AC_TRY_COMPILE([#include <GL/glu.h>], [
208
#if !defined(GLU_VERSION_1_2)
212
[AC_MSG_RESULT([yes])],
214
AC_MSG_ERROR([GLU >= 1.2 is needed to compile this library])
217
AC_MSG_CHECKING([for GLU library])
218
LIBS="-lGLU $GL_LIBS"
219
AC_LINK_IFELSE([AC_LANG_CALL([],[gluNewTess])],[HAVE_GLU=yes], [HAVE_GLU=no])
220
if test "x$HAVE_GLU" = xno ; then
221
if test "x$GL_X_LIBS" != x ; then
222
LIBS="-lGLU $GL_LIBS $GL_X_LIBS"
223
AC_LINK_IFELSE([AC_LANG_CALL([],[gluNewTess])],[HAVE_GLU=yes], [HAVE_GLU=no])
226
if test "x$HAVE_GLU" = xyes ; then
231
AC_MSG_ERROR([GLU library could not be found, please specify its location with --with-gl-lib. If this still fails, please contact mmagallo@debian.org, include the string FTGL somewhere in the subject line and provide a copy of the config.log file that was left behind.])
237
CPPFLAGS="$GL_SAVE_CPPFLAGS"
242
dnl FTGL_CHECK_GLUT()
243
dnl Check for GLUT development environment
245
AC_DEFUN([FTGL_CHECK_GLUT],
247
AC_REQUIRE([AC_PROG_CC])dnl
248
AC_REQUIRE([AC_PATH_X])dnl
249
AC_REQUIRE([AC_PATH_XTRA])dnl
250
AC_REQUIRE([FTGL_CHECK_GL])dnl
252
AC_ARG_WITH([--with-glut-inc],
253
AC_HELP_STRING([--with-glut-inc=DIR],[Directory where GL/glut.h is installed (optional)]))
254
AC_ARG_WITH([--with-glut-lib],
255
AC_HELP_STRING([--with-glut-lib=DIR],[Directory where GLUT libraries are installed (optional)]))
260
GLUT_SAVE_CPPFLAGS="$CPPFLAGS"
261
GLUT_SAVE_LIBS="$LIBS"
263
if test "x$no_x" != xyes ; then
264
GLUT_CFLAGS="$X_CFLAGS"
265
GLUT_X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu $X_EXTRA_LIBS"
268
if test "x$with_glut_inc" != "xnone" ; then
269
if test -d "$with_glut_inc" ; then
270
GLUT_CFLAGS="-I$with_glut_inc"
272
GLUT_CFLAGS="$with_glut_inc"
278
CPPFLAGS="$GLUT_CFLAGS"
279
AC_CHECK_HEADER([GL/glut.h], [HAVE_GLUT=yes], [HAVE_GLUT=no])
281
if test "x$HAVE_GLUT" = xno ; then
282
AC_MSG_WARN([GLUT headers not availabe, example program won't be compiled.])
285
# Check for GLUT libraries
287
AC_MSG_CHECKING([for GLUT library])
288
if test "x$with_glut_lib" != "x" ; then
289
if test -d "$with_glut_lib" ; then
290
LIBS="-L$with_glut_lib -lglut"
292
LIBS="$with_glut_lib"
298
[AC_LANG_CALL([],[glutInit])],
302
if test "x$HAVE_GLUT" = xno ; then
303
# Try again with the GL libs
304
LIBS="-lglut $GL_LIBS"
306
[AC_LANG_CALL([],[glutInit])],
311
if test "x$HAVE_GLUT" = xno && test "x$GLUT_X_LIBS" != x ; then
312
# Try again with the GL and X11 libs
313
LIBS="-lglut $GL_LIBS $GLUT_X_LIBS"
315
[AC_LANG_CALL([],[glutInit])],
320
if test "x$HAVE_GLUT" = xyes ; then
325
AC_MSG_WARN([GLUT libraries not availabe, example program won't be compiled.])
328
# End check for GLUT libraries
333
AC_SUBST(GLUT_CFLAGS)
337
CPPFLAGS="$GLUT_SAVE_CPPFLAGS"
338
LIBS="$GLUT_SAVE_LIBS"