1 dnl AC_INIT does not take a macro as a version nr: set it separately! - Bram
2 AC_INIT([ODE],[0.12],[ode@ode.org])
6 # Those are instructions from the Libtool manual:
7 # 1. Start with version information of `0:0:0' for each libtool library.
9 # 2. Update the version information only immediately before a public
10 # release of your software. More frequent updates are unnecessary,
11 # and only guarantee that the current interface number gets larger
14 # 3. If the library source code has changed at all since the last
15 # update, then increment REVISION (`C:R:A' becomes `C:r+1:A').
17 # 4. If any interfaces have been added, removed, or changed since the
18 # last update, increment CURRENT, and set REVISION to 0.
20 # 5. If any interfaces have been added since the last public release,
23 # 6. If any interfaces have been removed since the last public release,
29 AC_ARG_ENABLE(version-info,
30 AS_HELP_STRING([--disable-version-info],
31 [don't encode version information in the generated library]),
32 version_info=$enableval,
34 if test x$version_info = xyes
36 ODE_VERSION_INFO="-version-info $CURRENT:$REVISION:$AGE"
38 ODE_VERSION_INFO="-avoid-version"
40 AC_SUBST(ODE_VERSION_INFO)
43 AC_CONFIG_SRCDIR([ode/src/ode.cpp])
44 AC_CONFIG_MACRO_DIR([m4])
48 AM_INIT_AUTOMAKE(1.10 foreign)
49 AC_CONFIG_HEADERS([ode/src/config.h])
51 dnl This is needed because we have subdirectories
62 LT_INIT([disable-shared win32-dll])
63 AC_CHECK_TOOLS([WINDRES], [windres])
71 dnl this may NOT be the machine on which the code is going to run in,
72 dnl so allow users to compile programs for their target machine.
78 AC_DEFINE(PENTIUM,1,[compiling for a pentium on a gcc-based platform?])
83 AC_DEFINE(X86_64_SYSTEM,1,[compiling for a X86_64 system on a gcc-based platform?])
87 AM_CONDITIONAL(X86_64_SYSTEM, test x$cpu64 = xyes)
94 dnl check for required headers
95 AC_CHECK_HEADERS( [alloca.h stdio.h inttypes.h stdint.h stdlib.h math.h \
96 string.h stdarg.h malloc.h float.h time.h sys/time.h \
102 AC_ARG_WITH(trimesh, AS_HELP_STRING([--with-trimesh=[opcode|gimpact|none]],
103 [use the specified system for trimesh support @<:@default=opcode@:>@]),
104 trimesh=$withval,trimesh=opcode
106 if test "$trimesh" = opcode
110 if test "$trimesh" = gimpact
115 AM_CONDITIONAL(OPCODE, test $opcode = yes)
116 AM_CONDITIONAL(GIMPACT, test $gimpact = yes)
117 AM_CONDITIONAL(TRIMESH, test $opcode = yes -o $gimpact = yes)
120 AC_MSG_CHECKING(if double precision is requested)
121 AC_ARG_ENABLE(double-precision,
122 AS_HELP_STRING([--enable-double-precision],
123 [Configure ODE to work with double precision, if not specified, single precision is used]
125 precision=$enableval,precision=no)
126 AC_MSG_RESULT([$precision])
127 if test "$precision" = yes;
129 ODE_PRECISION=-DdDOUBLE
131 ODE_PRECISION=-DdSINGLE
134 CPPFLAGS="$CPPFLAGS $ODE_PRECISION"
135 AC_SUBST(ODE_PRECISION)
138 AC_ARG_WITH([drawstuff],
139 AS_HELP_STRING([--with-drawstuff=X11|Win32|OSX|none],
140 [force a particular drawstuff implementation or disable it.[default=autodetect]]),
141 [drawstuff=$withval],[drawstuff=])
143 dnl Set some Platform Specific Variables
144 EXTRA_LIBTOOL_LDFLAGS=
147 if test "x$drawstuff" = x
149 drawstuff="Win32" # if in a Windows enviroment
151 EXTRA_LIBTOOL_LDFLAGS="-no-undefined"
153 *apple* | *darwin*) # For Mac OS X
154 if test "x$drawstuff" = x
158 dnl We need to use C++ compilation and linking for ode on Mac
159 dnl Might as well do it for all code.
164 if test "x$drawstuff" = x
166 drawstuff="X11" # if anything else default to X11
170 AC_SUBST(EXTRA_LIBTOOL_LDFLAGS)
173 dnl Set Drawstuff variables
174 AC_MSG_CHECKING([which drawstuff lib to build])
175 AC_MSG_RESULT($drawstuff)
177 if test "x$drawstuff" = "xX11"
179 # The built-in macro, X_PATH, causes too many problems, these days everyone uses Xorg,
180 # so we can ask pkg-config to find it for us.
181 PKG_CHECK_MODULES(X11, x11, [], [drawstuff="none"])
185 if test "x$drawstuff" = "xOSX"; then
186 AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1],
187 [Use the Apple OpenGL framework.])
188 GL_LIBS="-framework OpenGL -framework GLUT"
189 elif test "x$drawstuff" != "xnone"; then
191 AC_CHECK_HEADERS(GL/gl.h GL/glu.h GL/glext.h, ,
192 [have_gl_headers=no],
205 TEMP_LDFLAGS="$LDFLAGS"
206 AC_CHECK_LIB(GL, main, [GL_LIBS="-lGL"; have_gl=yes])
207 AC_CHECK_LIB(GLU, main, [GL_LIBS="-lGLU $GL_LIBS"; have_glu=yes], , -lGL)
208 AC_CHECK_LIB(opengl32, main, [GL_LIBS="-lopengl32"; have_gl=yes])
209 AC_CHECK_LIB(glu32, main, [GL_LIBS="-lglu32 $GL_LIBS"; have_glu=yes], , -lopengl32)
210 LDFLAGS="$TEMP_LDFLAGS"
211 if test $have_gl = no -o $have_glu = no -o $have_gl_headers = no; then
218 AM_CONDITIONAL(WIN32, test x$drawstuff = xWin32)
219 AM_CONDITIONAL(X11, test x$drawstuff = xX11)
220 AM_CONDITIONAL(OSX, test x$drawstuff = xOSX)
221 AM_CONDITIONAL(ENABLE_DRAWSTUFF, test x$drawstuff != xnone)
223 dnl Check if we want to build demos
224 AC_MSG_CHECKING(if demos should be built)
226 AS_HELP_STRING([--disable-demos], [don't build demos]),
227 enable_demos=$enableval,enable_demos=yes)
228 if test x$drawstuff = xnone -a x$enable_demos = xyes ; then
230 AC_MSG_RESULT($enable_demos)
231 AC_MSG_WARN([Demos will not be built because OpenGL doesn't seem to work. See `config.log' for details.])
233 AC_MSG_RESULT($enable_demos)
237 dnl stdc++ is required when linking C programs against ode
238 AC_CHECK_LIB(stdc++,main,[LIBSTDCXX="-lstdc++"],[LIBSTDCXX=])
240 AC_CHECK_LIB(pthread,main,[LIBS="$LIBS -lpthread"])
243 dnl test if we will build demos
244 AM_CONDITIONAL(ENABLE_DEMOS, test x$enable_demos = xyes)
247 dnl Check if the user wants the old timesh collider
249 AC_ARG_ENABLE([old-trimesh], AS_HELP_STRING([--enable-old-trimesh],[enable use of the old trimesh collider]),
250 [old_trimesh=$enableval]
252 if test x$old_trimesh = xyes -a $trimesh = opcode; then
253 AC_DEFINE(dTRIMESH_OPCODE_USE_OLD_TRIMESH_TRIMESH_COLLIDER, 1,
254 [Use the old trimesh-trimesh collider])
260 dnl Check if the user wants to profile ODE using gprof
261 AC_MSG_CHECKING(for gprof)
262 AC_ARG_ENABLE([gprof],
263 AS_HELP_STRING([--enable-gprof],[enable profiling with gprof]),
266 if test "$gprof" != no
269 CXXFLAGS="-pg $CXXFLAGS"
270 AC_MSG_RESULT(enabled)
271 AC_CHECK_LIB(gmon, main,[LIBS="$LIBS -lgmon"])
276 # Checks for typedefs, structures, and compiler characteristics.
284 dnl Check for autoscan sugested functions
285 AC_CHECK_LIB(m, [main])
286 AC_CHECK_LIB(sunmath, [main])
287 AC_CHECK_FUNCS([floor memmove memset sqrt sqrtf sinf cosf fabsf atan2f fmodf copysignf copysign snprintf vsnprintf gettimeofday isnan isnanf _isnan _isnanf __isnan __isnanf strchr strstr pthread_attr_setstacklazy])
292 AS_HELP_STRING([--enable-ou],
293 [use TLS for global caches (allows threaded collision checks for separated spaces)]
295 use_ou_tls=$enableval,use_ou_tls=no)
296 if test x$use_ou = xyes
299 AC_CONFIG_COMMANDS_POST([export OU_NAMESPACE=odeou])
300 AC_DEFINE([_OU_NAMESPACE],[odeou],[libou namespace for ODE])
301 AC_DEFINE([dOU_ENABLED],[1],[Generic OU features are enabled])
302 AC_DEFINE([dATOMICS_ENABLED],[1],[Atomic API of OU is enabled])
303 if test x$use_ou_tls = xyes
305 AC_DEFINE([dTLS_ENABLED],[1],[Thread Local Storage API of OU is enabled])
310 targetos=_OU_TARGET_OS_WINDOWS
313 targetos=_OU_TARGET_OS_QNX
316 targetos=_OU_TARGET_OS_MAC
319 targetos=_OU_TARGET_OS_SUNOS
322 targetos=_OU_TARGET_OS_AIX
325 targetos=_OU_TARGET_OS_GENUNIX
329 if test $targetos = _OU_TARGET_OS_MAC
331 MAC_OS_X_VERSION=1000
332 AC_CHECK_FUNC([OSAtomicAdd32Barrier], [MAC_OS_X_VERSION=1040])
333 AC_CHECK_FUNC([OSAtomicAnd32OrigBarrier], [MAC_OS_X_VERSION=1050])
334 AC_DEFINE_UNQUOTED(MAC_OS_X_VERSION, $MAC_OS_X_VERSION, [Mac OS X version setting for OU Library])
337 if test $targetos = _OU_TARGET_OS_SUNOS
339 AC_CHECK_FUNC(atomic_inc_32_nv, [],
340 [targetos=_OU_TARGET_OS_GENUNIX])
343 AC_DEFINE_UNQUOTED(_OU_TARGET_OS, $targetos, [Target OS setting for OU Library])
345 AC_CONFIG_SUBDIRS([ou])
346 AM_CONDITIONAL(ENABLE_OU, test x$use_ou = xyes)
348 AC_ARG_ENABLE([builtin-threading-impl],
349 AS_HELP_STRING([--enable-builtin-threading-impl],
350 [include built-in multithreaded threading implementation (still must be created and assigned to be used)]
352 use_builtin_threading_impl=$enableval,use_builtin_threading_impl=no)
353 if test x$use_builtin_threading_impl = xyes
355 AC_DEFINE([dBUILTIN_THREADING_IMPL_ENABLED],[1],[Built-in multithreaded threading implementation included])
358 col_cylinder_cylinder=none
359 col_box_cylinder=default
360 col_capsule_cylinder=none
362 col_convex_capsule=none
363 col_convex_cylinder=none
364 col_convex_sphere=default
365 col_convex_convex=default
370 AC_ARG_ENABLE(libccd, AS_HELP_STRING([--enable-libccd],
371 [enable all libccd colliders (except box-cylinder)]),
372 libccd_all=$enableval)
373 if test x$libccd_all = xyes
375 col_cylinder_cylinder=libccd
376 col_capsule_cylinder=libccd
377 col_convex_box=libccd
378 col_convex_capsule=libccd
379 col_convex_cylinder=libccd
380 col_convex_sphere=libccd
381 col_convex_convex=libccd
386 AC_ARG_WITH([cylinder-cylinder], AS_HELP_STRING([--with-cylinder-cylinder=@<:@none,libccd@:>@], [use specific collider for cylinder-cylinder]),
387 col_cylinder_cylinder=$withval)
389 AC_ARG_WITH([box-cylinder],
390 AS_HELP_STRING([--with-box-cylinder=@<:@default,libccd@:>@], [use specific collider for box-cylinder]),
391 col_box_cylinder=$withval)
393 AC_ARG_WITH([capsule-cylinder], AS_HELP_STRING([--with-capsule-cylinder=@<:@none,libccd@:>@], [use specific collider for capsule-cylinder]),
394 col_capsule_cylinder=$withval)
396 AC_ARG_WITH([convex-box], AS_HELP_STRING([--with-convex-box=@<:@none,libccd@:>@], [use specific collider for convex-box]),
397 col_convex_box=$withval)
399 AC_ARG_WITH([convex-capsule], AS_HELP_STRING([--with-convex-capsule=@<:@none,libccd@:>@], [use specific collider for convex-capsule]),
400 col_convex_capsule=$withval)
402 AC_ARG_WITH([convex-cylinder], AS_HELP_STRING([--with-convex-cylinder=@<:@none,libccd@:>@], [use specific collider for convex-cylinder]),
403 col_convex_cylinder=$withval)
405 AC_ARG_WITH([convex-sphere], AS_HELP_STRING([--with-convex-sphere=@<:@default,libccd@:>@], [use specific collider for convex-sphere]),
406 col_convex_sphere=$withval)
408 AC_ARG_WITH([convex-convex], AS_HELP_STRING([--with-convex-convex=@<:@default,libccd@:>@], [use specific collider for convex-convex]),
409 col_convex_convex=$withval)
411 if test x$col_cylinder_cylinder = xlibccd -o \
412 x$col_box_cylinder = xlibccd -o \
413 x$col_capsule_cylinder = xlibccd -o \
414 x$col_convex_box = xlibccd -o \
415 x$col_convex_capsule = libccd -o \
416 x$col_convex_cylinder = xlibccd -o \
417 x$col_convex_sphere = libccd -o \
418 x$col_convex_convex = libccd
423 AC_CONFIG_SUBDIRS([libccd])
425 AM_CONDITIONAL(LIBCCD, test x$libccd != xno)
426 AM_CONDITIONAL(LIBCCD_BOX_CYL, test x$col_box_cylinder = xlibccd)
427 AM_CONDITIONAL(LIBCCD_CYL_CYL, test x$col_cylinder_cylinder = xlibccd)
428 AM_CONDITIONAL(LIBCCD_CAP_CYL, test x$col_capsule_cylinder = xlibccd)
429 AM_CONDITIONAL(LIBCCD_CONVEX_BOX, test x$col_convex_box = xlibccd)
430 AM_CONDITIONAL(LIBCCD_CONVEX_CAP, test x$col_convex_capsule = xlibccd)
431 AM_CONDITIONAL(LIBCCD_CONVEX_CYL, test x$col_convex_cylinder = xlibccd)
432 AM_CONDITIONAL(LIBCCD_CONVEX_SPHERE, test x$col_convex_sphere = xlibccd)
433 AM_CONDITIONAL(LIBCCD_CONVEX_CONVEX, test x$col_convex_convex = xlibccd)
437 AC_ARG_ENABLE([asserts],
438 AS_HELP_STRING([--disable-asserts],
439 [disables debug error checking]),
440 asserts=$enableval,asserts=yes)
441 if test x$asserts = xno
443 CPPFLAGS="$CPPFLAGS -DdNODEBUG"
444 if test x$use_ou = xyes
446 CPPFLAGS="$CPPFLAGS -DNDEBUG"
451 dnl include found system headers into config.h
467 #ifdef HAVE_INTTYPES_H
468 #include <inttypes.h>
471 /* an integer type that we can safely cast a pointer to and
472 * from without loss of bits.
474 typedef uintptr_t intP;
478 #define dEpsilon FLT_EPSILON
480 #define dEpsilon DBL_EPSILON
484 #endif /* #define ODE_CONFIG_H */
487 dnl Finally write our Makefiles
492 include/drawstuff/Makefile
495 ode/src/joints/Makefile
497 drawstuff/src/Makefile
498 drawstuff/dstest/Makefile
503 GIMPACT/include/Makefile
504 GIMPACT/include/GIMPACT/Makefile
507 tests/UnitTest++/Makefile
508 tests/UnitTest++/src/Makefile
509 tests/UnitTest++/src/Posix/Makefile
510 tests/UnitTest++/src/Win32/Makefile
520 dnl Print some useful information
521 echo "Configuration:"
522 echo " Build system type: $build"
523 echo " Host system type: $host"
524 echo " Use double precision: $precision"
525 echo " Use drawstuff: $drawstuff"
526 echo " Demos enabled: $enable_demos"
527 echo " Use OPCODE: $opcode"
528 echo " Use GIMPACT: $gimpact"
529 echo " Custom colliders:"
530 echo " cylinder-cylinder: $col_cylinder_cylinder"
531 echo " box-cylinder: $col_box_cylinder"
532 echo " capsule-cylinder: $col_capsule_cylinder"
533 echo " convex-box: $col_convex_box"
534 echo " convex-capsule: $col_convex_capsule"
535 echo " convex-cylinder: $col_convex_cylinder"
536 echo " convex-sphere: $col_convex_sphere"
537 echo " convex-convex: $col_convex_convex"
538 echo " Is target a Pentium: $pentium"
539 echo " Is target x86-64: $cpu64"
540 echo " Use old opcode trimesh collider: $old_trimesh"
541 echo " TLS for global caches: $use_ou_tls"
542 echo " Built-in threading included: $use_builtin_threading_impl"
543 echo " Enable debug error check: $asserts"
544 echo " Headers will be installed in $includedir/ode"
545 echo " Libraries will be installed in $libdir"
546 echo " Building in directory $BUILDDIR"