~diresu/blender/blender-command-port

« back to all changes in this revision

Viewing changes to extern/bFTGL/unix/acinclude.m4

  • Committer: theeth
  • Date: 2008-10-14 16:52:04 UTC
  • Revision ID: vcs-imports@canonical.com-20081014165204-r32w2gm6s0osvdhn
copy back trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl FTGL_PROG_CXX()
 
2
dnl Check the build plataform and try to use the native compiler
 
3
dnl
 
4
AC_DEFUN(FTGL_PROG_CXX,
 
5
[dnl
 
6
AC_CANONICAL_BUILD
 
7
AC_CANONICAL_HOST
 
8
 
 
9
dnl I really don't know how to handle the cross-compiling case
 
10
if test "$build" = "$host" ; then
 
11
    case "$build" in
 
12
        *-*-irix*)
 
13
            if test -z "$CXX" ; then
 
14
                CXX=CC
 
15
            fi
 
16
            if test -z "$CC" ; then
 
17
                CC=cc
 
18
            fi
 
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"
 
23
            fi
 
24
        ;;
 
25
    esac
 
26
fi
 
27
 
 
28
AC_PROG_CXX
 
29
])
 
30
# Configure paths for FreeType2
 
31
# Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor
 
32
 
 
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
 
35
dnl
 
36
AC_DEFUN(AC_CHECK_FT2,
 
37
[dnl
 
38
dnl Get the cflags and libraries from the freetype-config script
 
39
dnl
 
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],[],
 
47
              enable_fttest=yes)
 
48
 
 
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
 
53
  fi
 
54
fi
 
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
 
59
  fi
 
60
fi
 
61
AC_PATH_PROG(FT2_CONFIG, freetype-config, no)
 
62
 
 
63
min_ft_version=ifelse([$1], ,6.1.0,$1)
 
64
AC_MSG_CHECKING(for FreeType - version >= $min_ft_version)
 
65
no_ft=""
 
66
if test "$FT2_CONFIG" = "no" ; then
 
67
  no_ft=yes
 
68
else
 
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])
 
83
    else
 
84
      ac_save_CFLAGS="$CFLAGS"
 
85
      ac_save_LIBS="$LIBS"
 
86
      CFLAGS="$CFLAGS $FT2_CFLAGS"
 
87
      LIBS="$FT2_LIBS $LIBS"
 
88
dnl
 
89
dnl Sanity checks the results of freetype-config to some extent
 
90
dnl
 
91
      AC_TRY_RUN([
 
92
#include <ft2build.h>
 
93
#include FT_FREETYPE_H
 
94
#include <stdio.h>
 
95
#include <stdlib.h>
 
96
 
 
97
int 
 
98
main ()
 
99
{
 
100
    FT_Library library;
 
101
    FT_Error error;
 
102
 
 
103
    error = FT_Init_FreeType( &library );
 
104
 
 
105
    if ( error )
 
106
    {
 
107
        return 1;
 
108
    } else {
 
109
        FT_Done_FreeType( library );
 
110
        return 0;
 
111
    }
 
112
}
 
113
],, no_ft=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
 
114
      CFLAGS="$ac_save_CFLAGS"
 
115
      LIBS="$ac_save_LIBS"
 
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
 
120
   AC_MSG_RESULT(yes)
 
121
   ifelse([$2], , :, [$2])     
 
122
else
 
123
   AC_MSG_RESULT(no)
 
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."
 
129
   else
 
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."
 
134
   fi
 
135
   FT2_CFLAGS=""
 
136
   FT2_LIBS=""
 
137
   ifelse([$3], , :, [$3])
 
138
fi
 
139
AC_SUBST(FT2_CFLAGS)
 
140
AC_SUBST(FT2_LIBS)
 
141
])
 
142
dnl FTGL_CHECK_GL()
 
143
dnl Check for OpenGL development environment and GLU >= 1.2
 
144
dnl
 
145
AC_DEFUN([FTGL_CHECK_GL],
 
146
[dnl
 
147
AC_REQUIRE([AC_PROG_CC])
 
148
AC_REQUIRE([AC_PATH_X])
 
149
AC_REQUIRE([AC_PATH_XTRA])
 
150
 
 
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]))
 
155
 
 
156
AC_LANG_SAVE
 
157
AC_LANG_C
 
158
 
 
159
GL_SAVE_CPPFLAGS="$CPPFLAGS"
 
160
GL_SAVE_LIBS="$LIBS"
 
161
 
 
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"
 
165
fi
 
166
 
 
167
if test "x$with_gl_inc" != "xnone" ; then
 
168
    if test -d "$with_gl_inc" ; then
 
169
        GL_CFLAGS="-I$with_gl_inc"
 
170
    else
 
171
        GL_CFLAGS="$with_gl_inc"
 
172
    fi
 
173
else
 
174
    GL_CFLAGS=
 
175
fi
 
176
 
 
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.)])
 
179
 
 
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"
 
184
    else
 
185
        LIBS="$with_gl_lib"
 
186
    fi
 
187
else
 
188
    LIBS="-lGL"
 
189
fi
 
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])
 
195
    fi
 
196
fi
 
197
if test "x$HAVE_GL" = xyes ; then
 
198
    AC_MSG_RESULT([yes])
 
199
    GL_LIBS=$LIBS
 
200
else
 
201
    AC_MSG_RESULT([no])
 
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.])
 
203
fi
 
204
 
 
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)
 
209
#error GLU too old
 
210
#endif
 
211
               ],
 
212
               [AC_MSG_RESULT([yes])],
 
213
               [AC_MSG_RESULT([no])
 
214
                AC_MSG_ERROR([GLU >= 1.2 is needed to compile this library])
 
215
               ])
 
216
 
 
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])
 
224
    fi
 
225
fi
 
226
if test "x$HAVE_GLU" = xyes ; then
 
227
    AC_MSG_RESULT([yes])
 
228
    GL_LIBS="$LIBS"
 
229
else
 
230
    AC_MSG_RESULT([no])
 
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.])
 
232
fi
 
233
 
 
234
AC_SUBST(GL_CFLAGS)
 
235
AC_SUBST(GL_LIBS)
 
236
 
 
237
CPPFLAGS="$GL_SAVE_CPPFLAGS"
 
238
LIBS="$GL_SAVE_LIBS"
 
239
AC_LANG_RESTORE
 
240
GL_X_LIBS=""
 
241
])
 
242
dnl FTGL_CHECK_GLUT()
 
243
dnl Check for GLUT development environment
 
244
dnl
 
245
AC_DEFUN([FTGL_CHECK_GLUT],
 
246
[dnl
 
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
 
251
 
 
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)]))
 
256
 
 
257
AC_LANG_SAVE
 
258
AC_LANG_C
 
259
 
 
260
GLUT_SAVE_CPPFLAGS="$CPPFLAGS"
 
261
GLUT_SAVE_LIBS="$LIBS"
 
262
 
 
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"
 
266
fi
 
267
 
 
268
if test "x$with_glut_inc" != "xnone" ; then
 
269
    if test -d "$with_glut_inc" ; then
 
270
        GLUT_CFLAGS="-I$with_glut_inc"
 
271
    else
 
272
        GLUT_CFLAGS="$with_glut_inc"
 
273
    fi
 
274
else
 
275
    GLUT_CFLAGS=
 
276
fi
 
277
 
 
278
CPPFLAGS="$GLUT_CFLAGS"
 
279
AC_CHECK_HEADER([GL/glut.h], [HAVE_GLUT=yes], [HAVE_GLUT=no])
 
280
 
 
281
if test "x$HAVE_GLUT" = xno ; then
 
282
    AC_MSG_WARN([GLUT headers not availabe, example program won't be compiled.])
 
283
else
 
284
 
 
285
# Check for GLUT libraries
 
286
 
 
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"
 
291
        else
 
292
            LIBS="$with_glut_lib"
 
293
        fi
 
294
    else
 
295
        LIBS="-lglut"
 
296
    fi
 
297
    AC_LINK_IFELSE(
 
298
        [AC_LANG_CALL([],[glutInit])],
 
299
        [HAVE_GLUT=yes],
 
300
        [HAVE_GLUT=no])
 
301
 
 
302
    if test "x$HAVE_GLUT" = xno ; then
 
303
        # Try again with the GL libs
 
304
        LIBS="-lglut $GL_LIBS"
 
305
        AC_LINK_IFELSE(
 
306
            [AC_LANG_CALL([],[glutInit])],
 
307
            [HAVE_GLUT=yes],
 
308
            [HAVE_GLUT=no])
 
309
    fi
 
310
 
 
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"
 
314
        AC_LINK_IFELSE(
 
315
            [AC_LANG_CALL([],[glutInit])],
 
316
            [HAVE_GLUT=yes],
 
317
            [HAVE_GLUT=no])
 
318
    fi
 
319
 
 
320
    if test "x$HAVE_GLUT" = xyes ; then
 
321
        AC_MSG_RESULT([yes])
 
322
        GLUT_LIBS=$LIBS
 
323
    else
 
324
        AC_MSG_RESULT([no])
 
325
        AC_MSG_WARN([GLUT libraries not availabe, example program won't be compiled.])
 
326
    fi
 
327
 
 
328
# End check for GLUT libraries
 
329
 
 
330
fi
 
331
 
 
332
AC_SUBST(HAVE_GLUT)
 
333
AC_SUBST(GLUT_CFLAGS)
 
334
AC_SUBST(GLUT_LIBS)
 
335
AC_LANG_RESTORE
 
336
 
 
337
CPPFLAGS="$GLUT_SAVE_CPPFLAGS"
 
338
LIBS="$GLUT_SAVE_LIBS"
 
339
GLUT_X_CFLAGS=
 
340
GLUT_X_LIBS=
 
341
])