Cosmetic: A reference to namespace std eliminated. Some types usage corrected.
[ode.git] / configure.ac
blobafbe7fcad4a939d0e11eea0e0f9ea0a06b0cfd4f
1 dnl AC_INIT does not take a macro as a version nr: set it separately! - Bram
2 AC_INIT([ODE],[0.13],[ode@ode.org])
3 ODE_VERSION=0.13
4 AC_SUBST(ODE_VERSION)
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
12 #     faster.
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,
21 #     then increment AGE.
23 #  6. If any interfaces have been removed since the last public release,
24 #     then set AGE to 0.
25 CURRENT=4
26 REVISION=0
27 AGE=1
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,
33         version_info=yes)
34 if test x$version_info = xyes
35 then
36     ODE_VERSION_INFO="-version-info $CURRENT:$REVISION:$AGE"
37 else
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])
46 AC_CANONICAL_HOST
48 AM_INIT_AUTOMAKE([1.10 foreign])
49 AC_CONFIG_HEADERS([ode/src/config.h])
51 dnl This is needed because we have subdirectories
52 AC_PROG_MAKE_SET
53 AC_PROG_CXX
54 AC_PROG_CC
55 AM_PROG_CC_C_O
56 AC_PROG_CPP
57 AC_PROG_AWK
58 AC_PROG_INSTALL
59 AC_PROG_LN_S
60 AC_PROG_MKDIR_P
61 LT_INIT([disable-shared win32-dll])
62 AC_CHECK_TOOLS([WINDRES], [windres])
64 AC_C_BIGENDIAN
65 AC_C_INLINE
66 AC_C_VOLATILE
67 PKG_PROG_PKG_CONFIG
70 dnl this may NOT be the machine on which the code is going to run in,
71 dnl so allow users to compile programs for their target machine.
72 pentium=no
73 cpu64=no
74 case "$host_cpu" in
75   i586 | i686 | i786 )
76         pentium=yes
77         AC_DEFINE(PENTIUM,1,[compiling for a pentium on a gcc-based platform?])
78     ;;
79   x86_64* )
80         pentium=yes
81         cpu64=yes
82         AC_DEFINE(X86_64_SYSTEM,1,[compiling for a X86_64 system on a gcc-based platform?])
83     ;;
84 esac
86 AM_CONDITIONAL(X86_64_SYSTEM, test x$cpu64 = xyes)
93 dnl check for required headers
94 AC_CHECK_HEADERS( [alloca.h stdio.h inttypes.h stdint.h stdlib.h math.h \
95                   string.h stdarg.h malloc.h float.h time.h sys/time.h \
96                   limits.h stddef.h])
99 opcode=no
100 gimpact=no
101 AC_ARG_WITH(trimesh, AS_HELP_STRING([--with-trimesh=[opcode|gimpact|none]],
102         [use the specified system for trimesh support @<:@default=opcode@:>@]),
103         trimesh=$withval,trimesh=opcode
105 if test "$trimesh" = opcode
106 then
107   opcode=yes
109 if test "$trimesh" = gimpact
110 then
111   gimpact=yes
114 AM_CONDITIONAL(OPCODE,  test $opcode  = yes)
115 AM_CONDITIONAL(GIMPACT, test $gimpact = yes)
116 AM_CONDITIONAL(TRIMESH, test $opcode = yes -o $gimpact = yes)
119 AC_MSG_CHECKING(if double precision is requested)
120 AC_ARG_ENABLE(double-precision,
121         AS_HELP_STRING([--enable-double-precision],
122         [Configure ODE to work with double precision, if not specified, single precision is used @<:@default=no@:>@]),
123         usedouble=$enableval,usedouble=no)
124 AC_MSG_RESULT([$usedouble])
125 if test "$usedouble" = yes;
126 then
127         ODE_PRECISION=dDOUBLE
128 else
129         ODE_PRECISION=dSINGLE
131 AC_SUBST(ODE_PRECISION)
134 AC_ARG_WITH([drawstuff],
135     AS_HELP_STRING([--with-drawstuff=X11|Win32|OSX|none],
136         [force a particular drawstuff implementation or disable it.[default=autodetect]]),
137     [drawstuff=$withval],[drawstuff=])
139 dnl Set some Platform Specific Variables
140 EXTRA_LIBTOOL_LDFLAGS=
141 case "$host_os" in
142   cygwin* | mingw*)
143     if test "x$drawstuff" = x
144     then
145        drawstuff="Win32" # if in a Windows enviroment
146     fi
147     EXTRA_LIBTOOL_LDFLAGS="-no-undefined"
148     ;;
149   *apple* | *darwin*) # For Mac OS X
150     if test "x$drawstuff" = x
151     then
152        drawstuff="OSX"
153     fi
154     dnl We need to use C++ compilation and linking for ode on Mac
155     dnl Might as well do it for all code.
156     CC="$CXX"
157     LINK="$CXXLINK"
158     ;;
159   *)
160     if test "x$drawstuff" = x
161     then
162        drawstuff="X11" # if anything else default to X11
163     fi
164     ;;
165 esac
166 AC_SUBST(EXTRA_LIBTOOL_LDFLAGS)
169 dnl Set Drawstuff variables
170 AC_MSG_CHECKING([which drawstuff lib to build])
171 AC_MSG_RESULT($drawstuff)
173 if test "x$drawstuff" = "xX11"
174 then
175     # The built-in macro, X_PATH, causes too many problems, these days everyone uses Xorg,
176     # so we can ask pkg-config to find it for us.
177     PKG_CHECK_MODULES(X11, x11, [], [drawstuff="none"])
180 dnl Check for OpenGL
181 if test "x$drawstuff" = "xOSX"; then
182   AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1],
183             [Use the Apple OpenGL framework.])
184   GL_LIBS="-framework OpenGL -framework GLUT"
185 elif test "x$drawstuff" != "xnone"; then
186   have_gl_headers=yes
187   AC_CHECK_HEADERS(GL/gl.h GL/glu.h GL/glext.h, ,
188         [have_gl_headers=no],
189        [[#ifdef WIN32
190          #include <windows.h>
191          #endif
192          #if HAVE_GL_GL_H
193          #include <GL/gl.h>
194          #endif
195              #if HAVE_GL_GLU_H
196          #include <GL/glu.h>
197          #endif
198        ]])
199   have_gl=no
200   have_glu=no
201   TEMP_LDFLAGS="$LDFLAGS"
202   AC_CHECK_LIB(GL, main, [GL_LIBS="-lGL"; have_gl=yes])
203   AC_CHECK_LIB(GLU, main, [GL_LIBS="-lGLU $GL_LIBS"; have_glu=yes], , -lGL)
204   AC_CHECK_LIB(opengl32, main, [GL_LIBS="-lopengl32"; have_gl=yes])
205   AC_CHECK_LIB(glu32, main, [GL_LIBS="-lglu32 $GL_LIBS"; have_glu=yes], , -lopengl32)
206   LDFLAGS="$TEMP_LDFLAGS"
207   if test $have_gl = no -o $have_glu = no -o $have_gl_headers = no; then
208     drawstuff="none"
209   fi
211 AC_SUBST(GL_LIBS)
213 dnl Set Conditionals
214 AM_CONDITIONAL(WIN32, test x$drawstuff = xWin32)
215 AM_CONDITIONAL(X11, test x$drawstuff = xX11)
216 AM_CONDITIONAL(OSX, test x$drawstuff = xOSX)
217 AM_CONDITIONAL(ENABLE_DRAWSTUFF, test x$drawstuff != xnone)
219 dnl Check if we want to build demos
220 AC_MSG_CHECKING(if demos should be built)
221 AC_ARG_ENABLE(demos,
222         AS_HELP_STRING([--disable-demos], [don't build demos]),
223         enable_demos=$enableval,enable_demos=yes)
224 if test x$drawstuff = xnone -a x$enable_demos = xyes ; then
225     enable_demos=no
226     AC_MSG_RESULT($enable_demos)
227     AC_MSG_WARN([Demos will not be built because OpenGL doesn't seem to work. See `config.log' for details.])
228 else
229     AC_MSG_RESULT($enable_demos)
233 dnl stdc++ is required when linking C programs against ode
234 AC_CHECK_LIB(stdc++,main,[LIBSTDCXX="-lstdc++"],[LIBSTDCXX=])
235 AC_SUBST(LIBSTDCXX)
236 AC_CHECK_LIB(pthread,main,[LIBS="$LIBS -lpthread"])
239 dnl test if we will build demos
240 AM_CONDITIONAL(ENABLE_DEMOS, test x$enable_demos = xyes)
243 dnl Check if the user wants the old timesh collider
244 old_trimesh=no
245 AC_ARG_ENABLE([old-trimesh], AS_HELP_STRING([--enable-old-trimesh],[enable use of the old trimesh collider]),
246         [old_trimesh=$enableval]
247         )
248 if test x$old_trimesh = xyes -a $trimesh = opcode; then
249         AC_DEFINE(dTRIMESH_OPCODE_USE_OLD_TRIMESH_TRIMESH_COLLIDER, 1,
250                 [Use the old trimesh-trimesh collider])
251 else
252         old_trimesh=no
256 dnl Check if the user wants to profile ODE using gprof
257 AC_MSG_CHECKING(for gprof)
258 AC_ARG_ENABLE([gprof],
259         AS_HELP_STRING([--enable-gprof],[enable profiling with gprof]),
260         gprof=$enableval,
261         gprof=no)
262 if test "$gprof" != no
263 then
264     CFLAGS="-pg $CFLAGS"
265     CXXFLAGS="-pg $CXXFLAGS"
266     AC_MSG_RESULT(enabled)
267     AC_CHECK_LIB(gmon, main,[LIBS="$LIBS -lgmon"])
268 else
269     AC_MSG_RESULT(no)
272 # Checks for typedefs, structures, and compiler characteristics.
273 AC_HEADER_STDBOOL
274 AC_C_INLINE
275 AC_TYPE_INT32_T
276 AC_FUNC_OBSTACK
277 AC_TYPE_SIZE_T
278 AC_TYPE_UINT32_T
280 dnl Check for autoscan sugested functions
281 AC_CHECK_LIB(m, [main])
282 AC_CHECK_LIB(sunmath, [main])
283 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])
284 AC_FUNC_ALLOCA 
286 AC_ARG_ENABLE([threading-intf],
287         AS_HELP_STRING([--disable-threading-intf],
288             [disable threading interface support (external implementations may not be assigned; overrides --enable-builtin-threading-impl)]
289         ),
290         threading_intf=$enableval,threading_intf=yes)
291 AC_ARG_ENABLE([ou],
292         AS_HELP_STRING([--enable-ou],
293             [use TLS for global caches (allows threaded collision checks for isolated spaces)]
294         ),
295         use_ou_tls=$enableval,use_ou_tls=no)
296 use_ou="no"
297 if test x$use_ou_tls = xyes -o x$threading_intf = xyes
298 then
299     use_ou="yes"
301 if test x$use_ou = xyes
302 then
303     OU_NAMESPACE=odeou
304     AC_CONFIG_COMMANDS_POST([export OU_NAMESPACE=odeou])
305     AC_DEFINE([_OU_NAMESPACE],[odeou],[libou namespace for ODE])
306     AC_DEFINE([dOU_ENABLED],[1],[Generic OU features are enabled])
307     AC_DEFINE([dATOMICS_ENABLED],[1],[Atomic API of OU is enabled])
308     if test x$use_ou_tls = xyes
309     then
310       AC_DEFINE([dTLS_ENABLED],[1],[Thread Local Storage API of OU is enabled])
311     fi
313     case "$host_os" in
314       cygwin* | mingw*)
315         targetos=_OU_TARGET_OS_WINDOWS
316         ;;
317       *qnx*)
318         targetos=_OU_TARGET_OS_QNX
319         ;;
320       *apple* | *darwin*)
321         targetos=_OU_TARGET_OS_MAC
322         ;;
323       *sunos*)
324         targetos=_OU_TARGET_OS_SUNOS
325         ;;
326       *aix*)
327         targetos=_OU_TARGET_OS_AIX
328         ;;
329       *)
330         targetos=_OU_TARGET_OS_GENUNIX
331         ;;
332     esac
334     if test $targetos = _OU_TARGET_OS_MAC
335     then
336         MAC_OS_X_VERSION=1000
337         AC_CHECK_FUNC([OSAtomicAdd32Barrier], [MAC_OS_X_VERSION=1040])
338         AC_CHECK_FUNC([OSAtomicAnd32OrigBarrier], [MAC_OS_X_VERSION=1050])
339         AC_DEFINE_UNQUOTED(MAC_OS_X_VERSION, $MAC_OS_X_VERSION, [Mac OS X version setting for OU Library])
340     fi
341     
342     if test $targetos = _OU_TARGET_OS_SUNOS
343     then
344         AC_CHECK_FUNC(atomic_inc_32_nv, [],
345             [targetos=_OU_TARGET_OS_GENUNIX])
346     fi
347     
348     AC_DEFINE_UNQUOTED(_OU_TARGET_OS, $targetos, [Target OS setting for OU Library])
350 AC_CONFIG_SUBDIRS([ou])
351 AM_CONDITIONAL(ENABLE_OU, test x$use_ou = xyes)
353 if test x$threading_intf = xyes
354 then
355     AC_ARG_ENABLE([builtin-threading-impl],
356         AS_HELP_STRING([--enable-builtin-threading-impl],
357             [include built-in multithreaded threading implementation (still must be created and assigned to be used)]
358         ),
359         use_builtin_threading_impl=$enableval,use_builtin_threading_impl=no)
360     if test x$use_builtin_threading_impl = xyes
361     then
362         AC_DEFINE([dBUILTIN_THREADING_IMPL_ENABLED],[1],[Built-in multithreaded threading implementation included])
363     fi
364 else
365     AC_DEFINE([dTHREADING_INTF_DISABLED],[1],[Threading interface is disabled])
366     use_builtin_threading_impl=no
369 col_cylinder_cylinder=none
370 col_box_cylinder=default
371 col_capsule_cylinder=none
372 col_convex_box=none
373 col_convex_capsule=none
374 col_convex_cylinder=none
375 col_convex_sphere=default
376 col_convex_convex=default
379 libccd=no
380 libccd_all=no
381 AC_ARG_ENABLE(libccd, AS_HELP_STRING([--enable-libccd],
382             [enable all libccd colliders (except box-cylinder)]),
383             libccd_all=$enableval)
384 if test x$libccd_all = xyes
385 then
386     col_cylinder_cylinder=libccd
387     col_capsule_cylinder=libccd
388     col_convex_box=libccd
389     col_convex_capsule=libccd
390     col_convex_cylinder=libccd
391     col_convex_sphere=libccd
392     col_convex_convex=libccd
393     libccd=yes
397 AC_ARG_WITH([cylinder-cylinder], AS_HELP_STRING([--with-cylinder-cylinder=@<:@none,libccd@:>@], [use specific collider for cylinder-cylinder]),
398             col_cylinder_cylinder=$withval)
400 AC_ARG_WITH([box-cylinder],
401         AS_HELP_STRING([--with-box-cylinder=@<:@default,libccd@:>@], [use specific collider for box-cylinder]),
402             col_box_cylinder=$withval)
404 AC_ARG_WITH([capsule-cylinder], AS_HELP_STRING([--with-capsule-cylinder=@<:@none,libccd@:>@], [use specific collider for capsule-cylinder]),
405             col_capsule_cylinder=$withval)
407 AC_ARG_WITH([convex-box], AS_HELP_STRING([--with-convex-box=@<:@none,libccd@:>@], [use specific collider for convex-box]),
408             col_convex_box=$withval)
410 AC_ARG_WITH([convex-capsule], AS_HELP_STRING([--with-convex-capsule=@<:@none,libccd@:>@], [use specific collider for convex-capsule]),
411             col_convex_capsule=$withval)
413 AC_ARG_WITH([convex-cylinder], AS_HELP_STRING([--with-convex-cylinder=@<:@none,libccd@:>@], [use specific collider for convex-cylinder]),
414             col_convex_cylinder=$withval)
416 AC_ARG_WITH([convex-sphere], AS_HELP_STRING([--with-convex-sphere=@<:@default,libccd@:>@], [use specific collider for convex-sphere]),
417             col_convex_sphere=$withval)
419 AC_ARG_WITH([convex-convex], AS_HELP_STRING([--with-convex-convex=@<:@default,libccd@:>@], [use specific collider for convex-convex]),
420             col_convex_convex=$withval)
422 if test x$col_cylinder_cylinder = xlibccd -o \
423     x$col_box_cylinder = xlibccd -o \
424     x$col_capsule_cylinder = xlibccd -o \
425     x$col_convex_box = xlibccd -o \
426     x$col_convex_capsule = libccd -o \
427     x$col_convex_cylinder = xlibccd -o \
428     x$col_convex_sphere = libccd -o \
429     x$col_convex_convex = libccd
430 then
431     libccd=yes
434 AC_CONFIG_SUBDIRS([libccd])
436 AM_CONDITIONAL(LIBCCD, test x$libccd != xno)
437 AM_CONDITIONAL(LIBCCD_BOX_CYL,          test x$col_box_cylinder = xlibccd)
438 AM_CONDITIONAL(LIBCCD_CYL_CYL,          test x$col_cylinder_cylinder = xlibccd)
439 AM_CONDITIONAL(LIBCCD_CAP_CYL,          test x$col_capsule_cylinder = xlibccd)
440 AM_CONDITIONAL(LIBCCD_CONVEX_BOX,       test x$col_convex_box = xlibccd)
441 AM_CONDITIONAL(LIBCCD_CONVEX_CAP,       test x$col_convex_capsule = xlibccd)
442 AM_CONDITIONAL(LIBCCD_CONVEX_CYL,       test x$col_convex_cylinder = xlibccd)
443 AM_CONDITIONAL(LIBCCD_CONVEX_SPHERE,    test x$col_convex_sphere = xlibccd)
444 AM_CONDITIONAL(LIBCCD_CONVEX_CONVEX,    test x$col_convex_convex = xlibccd)
448 AC_ARG_ENABLE([asserts],
449         AS_HELP_STRING([--disable-asserts],
450             [disables debug error checking]),
451         asserts=$enableval,asserts=yes)
452 if test x$asserts = xno
453 then
454     CPPFLAGS="$CPPFLAGS -DdNODEBUG"
455     if test x$use_ou = xyes
456     then
457         CPPFLAGS="$CPPFLAGS -DNDEBUG"
458     fi
462 dnl include found system headers into config.h
463 AH_TOP([
464 #ifndef ODE_CONFIG_H
465 #define ODE_CONFIG_H
467 AH_BOTTOM([
469 #ifdef HAVE_ALLOCA_H
470 #include <alloca.h>
471 #endif
472 #ifdef HAVE_MALLOC_H
473 #include <malloc.h>
474 #endif
475 #ifdef HAVE_STDINT_H
476 #include <stdint.h>
477 #endif
478 #ifdef HAVE_INTTYPES_H
479 #include <inttypes.h>
480 #endif
482 /* an integer type that we can safely cast a pointer to and
483  * from without loss of bits.
484  */
485 typedef uintptr_t intP;
488 #ifdef dSINGLE
489        #define dEpsilon  FLT_EPSILON
490 #else
491        #define dEpsilon  DBL_EPSILON
492 #endif
495 #include "typedefs.h"
498 #endif /* #define ODE_CONFIG_H */
501 dnl Finally write our Makefiles
502 AC_CONFIG_FILES([
503  Makefile
504  drawstuff/Makefile
505  drawstuff/src/Makefile
506  drawstuff/dstest/Makefile
507  include/Makefile
508  include/drawstuff/Makefile
509  include/ode/Makefile
510  include/ode/precision.h
511  ode/Makefile
512  ode/src/Makefile
513  ode/src/joints/Makefile
514  ode/demo/Makefile
515  OPCODE/Makefile
516  OPCODE/Ice/Makefile
517  GIMPACT/Makefile
518  GIMPACT/include/Makefile
519  GIMPACT/include/GIMPACT/Makefile
520  GIMPACT/src/Makefile
521  tests/Makefile
522  tests/joints/Makefile
523  tests/UnitTest++/Makefile
524  tests/UnitTest++/src/Makefile
525  tests/UnitTest++/src/Posix/Makefile
526  tests/UnitTest++/src/Win32/Makefile
527  ode-config
528  ode.pc
529  ])
530 AC_OUTPUT
532 chmod +x ode-config
534 BUILDDIR=`pwd`
536 dnl Print some useful information
537 echo "Configuration:"
538 echo "  Build  system type:      $build"
539 echo "  Host   system type:      $host"
540 echo "  Use double precision:    $usedouble"
541 echo "  Use drawstuff:           $drawstuff"
542 echo "  Demos enabled:           $enable_demos"
543 echo "  Use OPCODE:              $opcode"
544 echo "  Use GIMPACT:             $gimpact"
545 echo "  Custom colliders:"
546 echo "        cylinder-cylinder: $col_cylinder_cylinder"
547 echo "        box-cylinder:      $col_box_cylinder"
548 echo "        capsule-cylinder:  $col_capsule_cylinder"
549 echo "        convex-box:        $col_convex_box"
550 echo "        convex-capsule:    $col_convex_capsule"
551 echo "        convex-cylinder:   $col_convex_cylinder"
552 echo "        convex-sphere:     $col_convex_sphere"
553 echo "        convex-convex:     $col_convex_convex"
554 echo "  Is target a Pentium:     $pentium"
555 echo "  Is target x86-64:        $cpu64"
556 echo "  Use old opcode trimesh collider: $old_trimesh"
557 echo "  TLS for global caches:   $use_ou_tls"
558 echo "  Threading intf enabled:  $threading_intf"
559 echo "  Built-in threading included: $use_builtin_threading_impl"
560 echo "  Enable debug error check: $asserts"
561 echo "  Headers will be installed in $includedir/ode"
562 echo "  Libraries will be installed in $libdir"
563 echo "  Building in directory    $BUILDDIR"