source: OGRE/trunk/ogrenew/acinclude.m4 @ 692

Revision 692, 15.8 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

Line 
1# Configure paths for FreeType2
2# Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor
3
4dnl AC_CHECK_FT2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
5dnl Test for FreeType2, and define FT2_CFLAGS and FT2_LIBS
6dnl
7AC_DEFUN([AC_CHECK_FT2],
8[dnl
9dnl Get the cflags and libraries from the freetype-config script
10dnl
11AC_ARG_WITH(ft-prefix,
12[  --with-ft-prefix=PREFIX
13                          Prefix where FreeType is installed (optional)],
14            ft_config_prefix="$withval", ft_config_prefix="")
15AC_ARG_WITH(ft-exec-prefix,
16[  --with-ft-exec-prefix=PREFIX
17                          Exec prefix where FreeType is installed (optional)],
18            ft_config_exec_prefix="$withval", ft_config_exec_prefix="")
19AC_ARG_ENABLE(freetypetest,
20[  --disable-freetypetest  Do not try to compile and run
21                          a test FreeType program],
22              [], enable_fttest=yes)
23
24if test x$ft_config_exec_prefix != x ; then
25  ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix"
26  if test x${FT2_CONFIG+set} != xset ; then
27    FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config
28  fi
29fi
30if test x$ft_config_prefix != x ; then
31  ft_config_args="$ft_config_args --prefix=$ft_config_prefix"
32  if test x${FT2_CONFIG+set} != xset ; then
33    FT2_CONFIG=$ft_config_prefix/bin/freetype-config
34  fi
35fi
36AC_PATH_PROG(FT2_CONFIG, freetype-config, no)
37
38min_ft_version=ifelse([$1], ,9.1.0,$1)
39AC_MSG_CHECKING(for FreeType - version >= $min_ft_version)
40no_ft=""
41if test "$FT2_CONFIG" = "no" ; then
42  no_ft=yes
43else
44  FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags`
45  FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs`
46  ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \
47         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
48  ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \
49         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
50  ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \
51         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
52  ft_min_major_version=`echo $min_ft_version | \
53         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
54  ft_min_minor_version=`echo $min_ft_version | \
55         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
56  ft_min_micro_version=`echo $min_ft_version | \
57         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
58  if test x$enable_fttest = xyes ; then
59    ft_config_is_lt=""
60    if test $ft_config_major_version -lt $ft_min_major_version ; then
61      ft_config_is_lt=yes
62    else
63      if test $ft_config_major_version -eq $ft_min_major_version ; then
64        if test $ft_config_minor_version -lt $ft_min_minor_version ; then
65          ft_config_is_lt=yes
66        else
67          if test $ft_config_minor_version -eq $ft_min_minor_version ; then
68            if test $ft_config_micro_version -lt $ft_min_micro_version ; then
69              ft_config_is_lt=yes
70            fi
71          fi
72        fi
73      fi
74    fi
75    if test x$ft_config_is_lt = xyes ; then
76      no_ft=yes
77    else
78      ac_save_CFLAGS="$CFLAGS"
79      ac_save_LIBS="$LIBS"
80      CFLAGS="$CFLAGS $FT2_CFLAGS"
81      LIBS="$FT2_LIBS $LIBS"
82dnl
83dnl Sanity checks for the results of freetype-config to some extent
84dnl
85      AC_TRY_RUN([
86#include <ft2build.h>
87#include FT_FREETYPE_H
88#include <stdio.h>
89#include <stdlib.h>
90
91int
92main()
93{
94  FT_Library library;
95  FT_Error error;
96
97  error = FT_Init_FreeType(&library);
98
99  if (error)
100    return 1;
101  else
102  {
103    FT_Done_FreeType(library);
104    return 0;
105  }
106}
107],, no_ft=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
108      CFLAGS="$ac_save_CFLAGS"
109      LIBS="$ac_save_LIBS"
110    fi             # test $ft_config_version -lt $ft_min_version
111  fi               # test x$enable_fttest = xyes
112fi                 # test "$FT2_CONFIG" = "no"
113if test x$no_ft = x ; then
114   AC_MSG_RESULT(yes)
115   ifelse([$2], , :, [$2])
116else
117   AC_MSG_RESULT(no)
118   if test "$FT2_CONFIG" = "no" ; then
119     echo "*** The freetype-config script installed by FreeType 2 could not be found."
120     echo "*** If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in"
121     echo "*** your path, or set the FT2_CONFIG environment variable to the"
122     echo "*** full path to freetype-config."
123   else
124     if test x$ft_config_is_lt = xyes ; then
125       echo "*** Your installed version of the FreeType 2 library is too old."
126       echo "*** If you have different versions of FreeType 2, make sure that"
127       echo "*** correct values for --with-ft-prefix or --with-ft-exec-prefix"
128       echo "*** are used, or set the FT2_CONFIG environment variable to the"
129       echo "*** full path to freetype-config."
130     else
131       echo "*** The FreeType test program failed to run.  If your system uses"
132       echo "*** shared libraries and they are installed outside the normal"
133       echo "*** system library path, make sure the variable LD_LIBRARY_PATH"
134       echo "*** (or whatever is appropiate for your system) is correctly set."
135     fi
136   fi
137   FT2_CFLAGS=""
138   FT2_LIBS=""
139   ifelse([$3], , :, [$3])
140fi
141AC_SUBST(FT2_CFLAGS)
142AC_SUBST(FT2_LIBS)
143])
144
145AC_DEFUN([OGRE_USE_STLPORT],
146[AC_ARG_WITH(stlport,
147             AC_HELP_STRING([--with-stlport=PATH],
148                           [the path to STLPort.]),
149             ac_cv_use_stlport=$withval,
150             ac_cv_use_stlport=no)
151 AC_CACHE_CHECK([whether to use STLPort], ac_cv_use_stlport,
152                ac_cv_use_stlport=no)
153 if test x$ac_cv_use_stlport != xno; then
154     STLPORT_CFLAGS="-I$ac_cv_use_stlport/stlport"
155     STLPORT_LIBS="-L$ac_cv_use_stlport/lib -lstlport"
156 fi
157 AC_SUBST(STLPORT_CFLAGS)
158 AC_SUBST(STLPORT_LIBS)
159])
160
161AC_DEFUN([OGRE_GET_CONFIG_TOOLKIT],
162[OGRE_CFGTK=cli
163 AC_ARG_WITH(cfgtk,
164             AC_HELP_STRING([--with-cfgtk=TOOLKIT],
165                            [the toolkit for the config gui, currently cli or gtk]),
166             OGRE_CFGTK=$withval,
167             OGRE_CFGTK=cli)
168
169 
170  CFGTK_DEPS_CFLAGS=""
171  CFGTK_DEPS_LIBS=""
172
173  dnl Do the extra checks per type here
174  case $OGRE_CFGTK in
175    gtk)
176      PKG_CHECK_MODULES(CFGTK_DEPS, gtkmm-2.4 libglademm-2.4);;
177  esac
178
179  AC_SUBST(CFGTK_DEPS_CFLAGS)
180  AC_SUBST(CFGTK_DEPS_LIBS)
181  AC_SUBST(OGRE_CFGTK)
182])
183
184AC_DEFUN([OGRE_GET_PLATFORM],
185[OGRE_PLATFORM=GLX
186 AC_ARG_WITH(platform,
187             AC_HELP_STRING([--with-platform=PLATFORM],
188                            [the platform to build, currently SDL, GLX, Win32 or gtk]),
189             OGRE_PLATFORM=$withval,
190             OGRE_PLATFORM=GLX)
191
192 
193  if test ! -d ${srcdir}/PlatformManagers/$OGRE_PLATFORM; then
194    OGRE_PLATFORM=SDL
195  fi
196
197  PLATFORM_CFLAGS=""
198  PLATFORM_LIBS=""
199
200  dnl Do the extra checks per type here
201  case $OGRE_PLATFORM in
202    SDL)
203      AM_PATH_SDL(1.2.6,,[AC_MSG_ERROR("--with-platform: SDL > 1.2.6 not found")])
204      PLATFORM_CFLAGS=$SDL_CFLAGS
205      PLATFORM_LIBS=$SDL_LIBS
206      ;;
207    gtk)
208      PKG_CHECK_MODULES(PLATFORM, gtkglextmm-1.0 libglademm-2.4);;
209    GLX)
210      AC_CHECK_HEADERS([X11/Intrinsic.h],, [AC_MSG_ERROR("libxt headers not found")])
211      AC_CHECK_HEADERS([X11/Xaw/Command.h],, [AC_MSG_ERROR("libxaw headers not found")])
212      AC_CHECK_HEADERS([X11/extensions/Xrandr.h],, [AC_MSG_ERROR("libxrandr headers not found")],[#include <X11/Xlib.h>])
213      PLATFORM_CFLAGS="-I/usr/X11R6/include"
214      PLATFORM_LIBS="-L/usr/X11R6/lib -lX11 -lXaw"
215    ;;
216    Win32)
217      PLATFORM_CFLAGS=""
218      PLATFORM_LIBS="-lgdi32 -lwinmm -ldinput8 -ldxguid"
219    ;;
220  esac
221
222  AC_SUBST(PLATFORM_CFLAGS)
223  AC_SUBST(PLATFORM_LIBS)
224  AC_SUBST(OGRE_PLATFORM)
225])
226
227AC_DEFUN([OGRE_GET_GLSUPPORT],
228[OGRE_GLSUPPORT=none
229 AC_ARG_WITH(gl-support,
230             AC_HELP_STRING([--with-gl-support=PLATFORM],
231                            [ The GLsupport to build (SDL, GLX, Win32 or gtk). Defaults to the platform. Only set this if you know what you are doing. Use --with-platform otherwise.]),
232             OGRE_GLSUPPORT=$withval,
233             OGRE_GLSUPPORT=none)
234
235  if test "$OGRE_GLSUPPORT" = "none" ; then
236    OGRE_GLSUPPORT="$OGRE_PLATFORM"
237    AC_MSG_NOTICE([setting gl-support to platform: $OGRE_GLSUPPORT])
238  fi
239  if test "$OGRE_GLSUPPORT" = "Win32" ; then
240    # Uppercase/lowercase
241    OGRE_GLSUPPORT=win32
242  fi
243  if test ! -d ${srcdir}/RenderSystems/GL/src/$OGRE_GLSUPPORT; then
244    OGRE_GLSUPPORT=SDL
245  fi
246
247  GLSUPPORT_CFLAGS=""
248  GLSUPPORT_LIBS=""
249
250  dnl Do the extra checks per type here
251  case $OGRE_GLSUPPORT in
252    SDL) AM_PATH_SDL(1.2.6,,[AC_MSG_ERROR("--with-gl-support: SDL > 1.2.6 not found")])
253      GLSUPPORT_CFLAGS=$SDL_CFLAGS
254      GLSUPPORT_LIBS=$SDL_LIBS;;
255    gtk)
256        PKG_CHECK_MODULES(GLSUPPORT, gtkglextmm-1.0)
257        GLSUPPORT_LIBS="$GLSUPPORT_LIBS"
258    ;;
259    GLX)
260        GLSUPPORT_CFLAGS="-I/usr/X11R6/include"
261        GLSUPPORT_LIBS="-L/usr/X11R6/lib -lX11 -lXext -lGL -lXrandr"
262    ;;
263    win32)
264        GLSUPPORT_CFLAGS=""
265        GLSUPPORT_LIBS="-lgdi32 -lwinmm"
266    ;;
267  esac
268
269  AC_SUBST(GLSUPPORT_CFLAGS)
270  AC_SUBST(GLSUPPORT_LIBS)
271  AC_SUBST(OGRE_GLSUPPORT)
272  AC_CONFIG_FILES([RenderSystems/GL/src/gtk/Makefile
273                   RenderSystems/GL/src/SDL/Makefile
274                   RenderSystems/GL/src/GLX/Makefile
275                   RenderSystems/GL/src/win32/Makefile])
276])
277
278AC_DEFUN([OGRE_SETUP_FOR_TARGET],
279[case $host in
280*-*-cygwin* | *-*-mingw* | *-*-pw32*)
281        AC_SUBST(SHARED_FLAGS, "-shared -no-undefined -Xlinker --export-all-symbols")
282        AC_SUBST(PLUGIN_FLAGS, "-shared -no-undefined -avoid-version")
283        AC_SUBST(GL_LIBS, "-lopengl32 -lglu32")
284        AC_CHECK_TOOL(RC, windres)
285        nt=true
286;;
287*-*-darwin*)
288        AC_SUBST(SHARED_FLAGS, "-shared")
289        AC_SUBST(PLUGIN_FLAGS, "-shared -avoid-version")
290        AC_SUBST(GL_LIBS, "-lGL -lGLU")
291        osx=true
292;;
293 *) dnl default to standard linux
294        AC_SUBST(SHARED_FLAGS, "-shared")
295        AC_SUBST(PLUGIN_FLAGS, "-shared -avoid-version")
296        AC_SUBST(GL_LIBS, "-lGL -lGLU")
297        linux=true
298;;
299esac
300dnl you must arrange for every AM_conditional to run every time configure runs
301AM_CONDITIONAL(OGRE_NT, test x$nt = xtrue)
302AM_CONDITIONAL(OGRE_LINUX, test x$linux = xtrue)
303AM_CONDITIONAL(OGRE_OSX,test x$osx = xtrue )
304])
305
306
307AC_DEFUN([OGRE_DETECT_ENDIAN],
308[AC_TRY_RUN([
309                int main()
310                {
311                        short s = 1;
312                        short* ptr = &s;
313                        unsigned char c = *((char*)ptr);
314                        return c;
315                }
316        ]
317        ,[AC_DEFINE(CONFIG_BIG_ENDIAN,,[Big endian machine])]
318        ,[AC_DEFINE(CONFIG_LITTLE_ENDIAN,,[Little endian machine])])
319])
320
321AC_DEFUN([OGRE_CHECK_OPENEXR],
322[AC_ARG_ENABLE(openexr,
323              AC_HELP_STRING([--enable-openexr],
324                             [Build the OpenEXR plugin]),
325              [build_exr=$enableval],
326              [build_exr=no])
327
328if test "x$build_exr" = "xyes" ; then
329        PKG_CHECK_MODULES(OPENEXR, OpenEXR, [build_exr=yes], [build_exr=no])
330
331        if test "x$build_exr" = "xyes" ; then
332                AC_CONFIG_FILES([ PlugIns/EXRCodec/Makefile \
333                                         PlugIns/EXRCodec/src/Makefile \
334                                         PlugIns/EXRCodec/include/Makefile])
335                AC_SUBST(OPENEXR_CFLAGS)
336                AC_SUBST(OPENEXR_LIBS)
337
338        fi
339
340fi
341
342AM_CONDITIONAL(BUILD_EXRPLUGIN, test x$build_exr = xyes)
343
344])
345
346AC_DEFUN([OGRE_CHECK_CG],
347[AC_ARG_ENABLE(cg,
348              AC_HELP_STRING([--disable-cg],
349                             [Do not build the Cg plugin (recommended you do so!)]),
350              [build_cg=$enableval],
351              [build_cg=yes])
352
353if test "x$build_cg" = "xyes" ; then
354        AC_CHECK_LIB(Cg, cgCreateProgram,,AC_MSG_ERROR([
355        ****************************************************************
356        * You do not have the nVidia Cg libraries installed.           *
357        * Go to http://developer.nvidia.com/object/cg_toolkit.html     *
358        * (Click on Cg_Linux.tar.gz).                                  *
359        * You can disable the building of Cg support by providing      *       
360        * --disable-cg to this configure script but this is highly     *
361        * discouraged as this breaks many of the examples.             *
362        ****************************************************************])
363        )
364fi
365
366AM_CONDITIONAL(BUILD_CGPLUGIN, test x$build_cg = xyes)
367
368])
369
370AC_DEFUN([OGRE_CHECK_CPPUNIT],
371[
372AM_PATH_CPPUNIT([1.10.0], [build_unit_tests=true])
373AM_CONDITIONAL([BUILD_UNIT_TESTS], [test x$build_unit_tests = xtrue])
374])
375
376
377AC_DEFUN([OGRE_CHECK_DX9],
378[AC_ARG_ENABLE(direct3d,
379              AC_HELP_STRING([--enable-direct3d],
380                             [Build the DirectX 9 Render System]),
381              [build_dx9=$enableval],
382              [build_dx9=no])
383
384AM_CONDITIONAL(BUILD_DX9RENDERSYSTEM, test x$build_dx9 = xyes)
385
386])
387
388AC_DEFUN([OGRE_CHECK_DEVIL],
389[AC_ARG_ENABLE(devil,
390              AC_HELP_STRING([--disable-devil],
391                             [Don't use DevIL for image loading. This is not recommended unless you provide your own image loading codecs.]),
392              [build_il=$enableval],
393              [build_il=yes])
394
395AM_CONDITIONAL(USE_DEVIL, test x$build_il = xyes)
396
397if test "x$build_il" = "xyes" ; then
398        AC_CHECK_LIB(IL, ilInit,,AC_MSG_ERROR([
399****************************************************************
400* You do not have DevIL installed.  This is required to build. *
401* You may find it at http://openil.sourceforge.net/.           *
402* Note: You can also provide --disable-devil to the build      *
403* process to build without DevIL. This is an advanced option   *
404* useful only if you provide your own image loading codecs.    *
405****************************************************************]))
406        AC_CHECK_LIB(ILU, iluFlipImage)
407        AC_DEFINE([OGRE_NO_DEVIL], [0], [Build devil])
408else
409        AC_DEFINE([OGRE_NO_DEVIL], [1], [Build devil])
410fi
411
412
413])
414
415
416AC_DEFUN([OGRE_CHECK_PIC],
417[
418AC_MSG_CHECKING([whether -fPIC is needed])
419    case $host in
420        x86_64-*)
421            CXXFLAGS="$CXXFLAGS -fPIC"
422            AC_MSG_RESULT(yes)
423        ;;
424        *)
425            AC_MSG_RESULT(no)
426        ;;
427    esac
428])
429
430AC_DEFUN([OGRE_CHECK_CEGUI], [
431    PKG_CHECK_MODULES(CEGUI, CEGUI >= 0.3.0,
432            [build_cegui_sample=true], [build_cegui_sample=false])
433    if test x$build_cegui_sample = xtrue; then
434        AC_CONFIG_FILES([Samples/Common/CEGUIRenderer/Makefile \
435                         Samples/Common/CEGUIRenderer/CEGUI-OGRE.pc
436                         Samples/Common/CEGUIRenderer/src/Makefile \
437                         Samples/Common/CEGUIRenderer/include/Makefile \
438                         Samples/Gui/Makefile \
439                         Samples/Gui/src/Makefile])
440        AC_SUBST(CEGUI_CFLAGS)
441        AC_SUBST(CEGUI_LIBS)
442        AC_MSG_RESULT([CEGUI available, Gui and FacialAnimation samples will be built])
443    else
444        AC_MSG_RESULT([CEGUI not available, Gui and FacialAnimation samples will not be built])
445    fi
446    AM_CONDITIONAL([HAVE_CEGUI], [test x$build_cegui_sample = xtrue])
447])
448
449AC_DEFUN([OGRE_CHECK_DOUBLE],
450[
451AC_ARG_ENABLE(double,
452              AC_HELP_STRING([--enable-double],
453                             [Build OGRE in double floating point precision mode. This is not recommended for normal use as it is slower.]),
454              [build_double=$enableval],
455              [build_double=no])
456AC_MSG_CHECKING([whether to use double floating point precision])
457        case $build_double in
458        yes)
459                        AC_DEFINE([OGRE_DOUBLE_PRECISION], [1], [Build with double precision])
460                        AC_MSG_RESULT(yes)
461        ;;
462        *)
463                        AC_DEFINE([OGRE_DOUBLE_PRECISION], [0], [Build with double precision])
464            AC_MSG_RESULT(no)
465        ;;
466    esac
467])
468
469AC_DEFUN([OGRE_CHECK_THREADING],
470[
471AC_ARG_ENABLE(threading,
472              AC_HELP_STRING([--enable-threading],
473                             [Indicate general support for multithreading. This will enable threading support in certain parts of the engine, mainly resource loading and SharedPtr handling. WARNING: highly experimental, use with caution.]),
474              [build_threads=$enableval],
475              [build_threads=no])
476AC_MSG_CHECKING([whether to use threaded resource loading])
477        case $build_threads in
478        yes)
479            CXXFLAGS="$CXXFLAGS -pthread"
480            OGRE_THREAD_LIBS="-lboost_thread-mt"
481                        AC_DEFINE([OGRE_THREAD_SUPPORT], [1], [Build with thread support])
482            AC_CHECK_LIB([boost_thread-mt], [main],, AC_MSG_ERROR([cannot find boost_thread-mt library]))
483            AC_MSG_RESULT(yes)
484        ;;
485        *)
486            OGRE_THREAD_LIBS=""
487                        AC_DEFINE([OGRE_THREAD_SUPPORT], [0], [Build with thread support])
488            AC_MSG_RESULT(no)
489        ;;
490    esac
491    AC_SUBST(OGRE_THREAD_LIBS)
492])
Note: See TracBrowser for help on using the repository browser.