1 dnl Initial configure.in by Rodrigo Hernandez
2 dnl Modified in 26/10/2005 by Rodrigo Hernandez
3 dnl Modified in 19/11/2007 by Rodrigo Hernandez
5 dnl AC_INIT does not take a macro as a version nr: set it separately! - Bram
6 AC_INIT(ODE,0.9.0,ode@ode.org)
8 dnl When upgrading version nr, also change the AC_INIT line! - Bram
12 ODE_RELEASE=[$ODE_CURRENT].[$ODE_REVISION].[$ODE_AGE]
13 dnl Libtool release is an interface id,
14 dnl don't change unless the ode API is no longer backward compatible
18 AM_INIT_AUTOMAKE(1.10 foreign)
19 AC_CONFIG_HEADER(ode/src/config.h)
21 dnl This is needed because we have subdirectories
34 AC_CHECK_TOOLS([WINDRES], [windres])
36 AC_SUBST(LIBTOOL_DEPS)
40 AC_SUBST(ODE_REVISION)
44 AC_SUBST(LIBTOOL_RELEASE)
54 dnl Check if we want to build demos
55 AC_MSG_CHECKING(if demos should be built)
56 AC_ARG_ENABLE(demos,AC_HELP_STRING([--enable-demos], [build demos]), enable_demos=$enableval,enable_demos=yes)
57 AC_MSG_RESULT($enable_demos)
61 dnl this may NOT be the machine on which the code is going to run in,
62 dnl so allow users to compile programs for their target machine.
68 AC_DEFINE(PENTIUM,1,[compiling for a pentium on a gcc-based platform?])
73 AC_DEFINE(X86_64_SYSTEM,1,[compiling for a X86_64 system on a gcc-based platform?])
77 AM_CONDITIONAL(X86_64_SYSTEM, test x$cpu64 = xyes)
84 dnl check for required headers
85 AC_CHECK_HEADERS( alloca.h stdio.h stdint.h stdlib.h math.h string.h stdarg.h malloc.h float.h time.h sys/time.h )
90 AC_ARG_WITH(trimesh,AC_HELP_STRING([--with-trimesh=[opcode|gimpact|none]],
91 [use the specified system for trimesh support.]),
92 trimesh=$withval,trimesh=opcode
94 if test "$trimesh" = opcode
98 if test "$trimesh" = gimpact
103 AM_CONDITIONAL(OPCODE, test $opcode = yes)
104 AM_CONDITIONAL(GIMPACT, test $gimpact = yes)
105 AM_CONDITIONAL(TRIMESH, test $opcode = yes -o $gimpact = yes)
108 AC_MSG_CHECKING(if double precision is requested)
109 AC_ARG_ENABLE(double-precision,
110 AC_HELP_STRING([--enable-double-precision],
111 [Configure ODE to work with double precision, if not specified, single precision is used]
113 precision=$enableval,precision=no)
114 AC_MSG_RESULT([$precision])
115 if test "$precision" = yes;
117 ODE_PRECISION=-DdDOUBLE
119 ODE_PRECISION=-DdSINGLE
122 CPPFLAGS+=" $ODE_PRECISION"
123 AC_SUBST(ODE_PRECISION)
126 AC_MSG_CHECKING(if gyroscopic term should be used)
127 AC_ARG_ENABLE(gyroscopic, AC_HELP_STRING([--disable-gyroscopic],
128 [Configure ODE to work without gyroscopic term (may improve stability)]),
129 gyroscopic=$enableval,gyroscopic=yes)
130 AC_MSG_RESULT($gyroscopic)
131 if test x"$gyroscopic" = xyes
133 AC_DEFINE(dGYROSCOPIC,,[Use gyroscopic terms])
138 dnl Set some Platform Specific Variables
139 EXTRA_LIBTOOL_LDFLAGS=
143 DLLDEFINE="-DODE_DLL"
144 drawstuff="Win32" # if in a Windows enviroment
145 EXTRA_LIBTOOL_LDFLAGS="-no-undefined"
147 *apple* | *darwin*) # For Mac OS X
150 SHARED_LDFLAGS="-dynamiclib"
152 dnl We need to use C++ compilation and linking for ode on Mac
153 dnl Might as well do it for all code.
158 drawstuff="X11" # if anything else default to X11
159 if test x$use_soname = xyes; then
160 so_ext=".so.$ODE_RELEASE"
165 SHARED_LDFLAGS="-shared"
168 AC_SUBST(EXTRA_LIBTOOL_LDFLAGS)
170 AM_CONDITIONAL(WIN32, test x$drawstuff = xWin32)
171 AM_CONDITIONAL(X11, test x$drawstuff = xX11)
172 AM_CONDITIONAL(OSX, test x$drawstuff = xOSX)
173 dnl Set Drawstuff variables
174 AC_MSG_CHECKING(which drawstuff lib to build)
175 AC_MSG_RESULT($drawstuff)
177 dnl Set shared library variables
178 AC_MSG_CHECKING(for the suffix of shared libraries)
179 AC_MSG_RESULT($so_ext)
180 AC_DEFINE_UNQUOTED(SO_EXT,"$so_ext",[The extension for shared libraries.])
182 AC_SUBST(SHARED_LDFLAGS)
189 if test "x$drawstuff" = "xOSX"; then
190 AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1],
191 [Use the Apple OpenGL framework.])
192 GL_LIBS="-framework OpenGL -framework Carbon -framework AGL"
194 AC_CHECK_HEADERS(GL/gl.h GL/glu.h GL/glext.h,,
205 TEMP_LDFLAGS="$LDFLAGS"
206 AC_CHECK_LIB(GL, main,[GL_LIBS="$GL_LIBS -lGL"],have_gl=yes)
207 AC_CHECK_LIB(GLU, main,[GL_LIBS="$GL_LIBS -lGLU"],have_glu=yes)
208 AC_CHECK_LIB(opengl32, main,[GL_LIBS="$GL_LIBS -lopengl32"],have_gl=yes)
209 AC_CHECK_LIB(glu32, main,[GL_LIBS="$GL_LIBS -lglu32"],have_glu=yes)
210 LDFLAGS="$TEMP_LDFLAGS"
211 if test $have_gl = no -o $have_glu = no; then
218 dnl stdc++ is required when linking C programs against ode
219 AC_CHECK_LIB(stdc++,main,[LIBSTDCXX="-lstdc++"],[LIBSTDCXX=])
221 AC_CHECK_LIB(pthread,main,[LIBS="$LIBS -lpthread"])
224 dnl test if we will build demos
225 AM_CONDITIONAL(ENABLE_DEMOS, test x$enable_demos = xyes)
228 dnl Check if the user wants the new timesh collider
230 AC_ARG_ENABLE([new-trimesh], AC_HELP_STRING([--enable-new-trimesh],[enable use of the new trimesh collider]),
231 [new_trimesh=$enableval]
233 if test x$new_trimesh = xyes -a $trimesh = opcode; then
234 AC_DEFINE(dTRIMESH_OPCODE_USE_NEW_TRIMESH_TRIMESH_COLLIDER, 1,
235 [Use an alternative trimesh-trimesh collider which should yield better results])
241 dnl Check if the user wants to profile ODE using gprof
242 AC_MSG_CHECKING(for gprof)
243 AC_ARG_ENABLE([gprof],[AC_HELP_STRING([--enable-gprof],[enable profiling with gprof])],gprof=$enableval,gprof=no)
244 if test "$gprof" != no
247 CPPFLAGS="-pg $CPPFLAGS"
248 CXXFLAGS="-pg $CXXFLAGS"
249 AC_MSG_RESULT(enabled)
250 AC_CHECK_LIB(gmon, main,[LIBS="$LIBS -lgmon"])
255 dnl Check for autoscan sugested functions
256 AC_CHECK_LIB(m, [main])
257 AC_CHECK_LIB(sunmath, [main])
258 AC_CHECK_FUNCS([floor memmove memset select sqrt sqrtf sinf cosf fabsf atan2f fmodf copysignf copysign snprintf vsnprintf gettimeofday isnan isnanf _isnan _isnanf __isnan __isnanf])
263 AC_FUNC_SELECT_ARGTYPES
266 AC_MSG_CHECKING(if alloca should be emulated by malloc)
267 AC_ARG_ENABLE([malloc],
268 [AC_HELP_STRING([--enable-malloc],[use malloc to emulate alloca (more portable but slower)])],
269 usemalloc=$enableval,usemalloc=no)
270 if test "$usemalloc" != no
272 AC_DEFINE(dUSE_MALLOC_FOR_ALLOCA)
273 AC_MSG_RESULT($usemalloc)
280 AC_HELP_STRING([--enable-ou],
281 [EXPERIMENTAL: use TLS for global variables to allow for running ODE in multiple threads simultaneously]
283 use_ou=yes,use_ou=no)
284 if test x$use_ou = xyes
287 AC_CONFIG_COMMANDS_POST([export OU_NAMESPACE=odeou])
288 AC_CONFIG_SUBDIRS([ou])
289 AC_DEFINE([_OU_NAMESPACE],[odeou],[libou namespace for ODE])
290 AC_DEFINE([dOU_ENABLED],[1],[Generic OU features are enabled])
291 AC_DEFINE([dATOMICS_ENABLED],[1],[Atomic API of OU is enabled])
292 AC_DEFINE([dTLS_ENABLED],[1],[Thread Local Storage API of OU is enabled])
294 AM_CONDITIONAL(ENABLE_OU, test x$use_ou = xyes)
297 dnl include found system headers into config.h
314 /* an integer type that we can safely cast a pointer to and
315 * from without loss of bits.
317 typedef uintptr_t intP;
320 // Use the error-checking memory allocation system. Because this system uses heap
321 // (malloc) instead of stack (alloca), it is slower. However, it allows you to
322 // simulate larger scenes, as well as handle out-of-memory errors in a somewhat
325 #ifdef dUSE_MALLOC_FOR_ALLOCA
327 d_MEMORY_OK = 0, /* no memory errors */
328 d_MEMORY_OUT_OF_MEMORY /* malloc failed due to out of memory error */
333 #define dEpsilon FLT_EPSILON
335 #define dEpsilon DBL_EPSILON
339 #endif /* #define ODE_CONFIG_H */
343 dnl Finally write our Makefiles
348 include/drawstuff/Makefile
352 drawstuff/src/Makefile
353 drawstuff/dstest/Makefile
358 GIMPACT/include/Makefile
359 GIMPACT/include/GIMPACT/Makefile
368 dnl Print some useful information
369 echo "Configuration:"
370 echo " Build system type: $build"
371 echo " Host system type: $host"
372 echo " Use double precision: $precision"
373 echo " Use OPCODE: $opcode"
374 echo " Use GIMPACT: $gimpact"
375 echo " Use gyroscopic term: $gyroscopic"
376 echo " Is target a Pentium: $pentium"
377 echo " Is target x86-64: $cpu64"
378 echo " Use new opcode trimesh collider: $new_trimesh"
379 echo " Headers will be installed in $prefix/include/ode"
380 echo " Libraries will be installed in $prefix/lib"
381 echo " Building in directory $BUILDDIR"