File: configure.in

package info (click to toggle)
ode 2%3A0.11.1-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 9,340 kB
  • ctags: 8,459
  • sloc: cpp: 76,353; sh: 10,289; ansic: 5,222; makefile: 667; python: 44
file content (457 lines) | stat: -rw-r--r-- 12,401 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
dnl AC_INIT does not take a macro as a version nr: set it separately! - Bram
AC_INIT([ODE],[0.11.1],[ode@ode.org])
# AC_CONFIG_SRCDIR([ode/src/ode.cpp])
ODE_RELEASE=0.11.1
AC_SUBST(ODE_RELEASE)

# Those are instructions from the Libtool manual:
#  1. Start with version information of `0:0:0' for each libtool library.
#
#  2. Update the version information only immediately before a public
#     release of your software.  More frequent updates are unnecessary,
#     and only guarantee that the current interface number gets larger
#     faster.
#
#  3. If the library source code has changed at all since the last
#     update, then increment REVISION (`C:R:A' becomes `C:r+1:A').
#
#  4. If any interfaces have been added, removed, or changed since the
#     last update, increment CURRENT, and set REVISION to 0.
#
#  5. If any interfaces have been added since the last public release,
#     then increment AGE.
#
#  6. If any interfaces have been removed since the last public release,
#     then set AGE to 0.
CURRENT=2
REVISION=1
AGE=1

AC_ARG_ENABLE(version-info,
        AS_HELP_STRING([--disable-version-info],
                [don't encode version information in the generated library]),
        version_info=$enableval,
        version_info=yes)
if test x$version_info = xyes
then
    ODE_VERSION_INFO="-version-info $CURRENT:$REVISION:$AGE"
else
    ODE_VERSION_INFO="-avoid-version"
fi
AC_SUBST(ODE_VERSION_INFO)



AC_CANONICAL_HOST

AM_INIT_AUTOMAKE(1.10 foreign)
AC_CONFIG_HEADERS([ode/src/config.h])

dnl This is needed because we have subdirectories
AC_PROG_MAKE_SET
AC_PROG_CXX
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_DISABLE_SHARED
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_CHECK_TOOLS([WINDRES], [windres])

AC_C_BIGENDIAN
AC_C_INLINE
AC_C_VOLATILE
AC_HEADER_STDBOOL
AC_TYPE_SIZE_T

dnl Check if we want to build demos
AC_MSG_CHECKING(if demos should be built)
AC_ARG_ENABLE(demos,
        AS_HELP_STRING([--disable-demos], [don't build demos]),
        enable_demos=$enableval,enable_demos=yes)
AC_MSG_RESULT($enable_demos)



dnl this may NOT be the machine on which the code is going to run in,
dnl so allow users to compile programs for their target machine.
pentium=no
cpu64=no
case "$host_cpu" in
  i586 | i686 | i786 )
        pentium=yes
        AC_DEFINE(PENTIUM,1,[compiling for a pentium on a gcc-based platform?])
    ;;
  x86_64* )
        pentium=yes
        cpu64=yes
        AC_DEFINE(X86_64_SYSTEM,1,[compiling for a X86_64 system on a gcc-based platform?])
    ;;
esac

AM_CONDITIONAL(X86_64_SYSTEM, test x$cpu64 = xyes)






dnl check for required headers
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 )


opcode=no
gimpact=no
AC_ARG_WITH(trimesh, AS_HELP_STRING([--with-trimesh=[opcode|gimpact|none]],
        [use the specified system for trimesh support @<:@default=opcode@:>@]),
        trimesh=$withval,trimesh=opcode
)
if test "$trimesh" = opcode
then
  opcode=yes
fi
if test "$trimesh" = gimpact
then
  gimpact=yes
fi

AM_CONDITIONAL(OPCODE,  test $opcode  = yes)
AM_CONDITIONAL(GIMPACT, test $gimpact = yes)
AM_CONDITIONAL(TRIMESH, test $opcode = yes -o $gimpact = yes)


AC_MSG_CHECKING(if double precision is requested)
AC_ARG_ENABLE(double-precision,
        AS_HELP_STRING([--enable-double-precision],
        [Configure ODE to work with double precision, if not specified, single precision is used]
        ),
        precision=$enableval,precision=no)
AC_MSG_RESULT([$precision])
if test "$precision" = yes;
then
        ODE_PRECISION=-DdDOUBLE
else
        ODE_PRECISION=-DdSINGLE
fi

CPPFLAGS+=" $ODE_PRECISION"
AC_SUBST(ODE_PRECISION)


AC_ARG_WITH([drawstuff],AS_HELP_STRING([--with-drawstuff=X11|Win32|OSX|none],[force a particular drawstuff implementation or disable it.]),
        [drawstuff=$withval],[drawstuff=])

dnl Set some Platform Specific Variables
EXTRA_LIBTOOL_LDFLAGS=
case "$host_os" in
  cygwin* | mingw*)
    if test x"$drawstuff" = x
    then
       drawstuff="Win32" # if in a Windows enviroment
    fi
    EXTRA_LIBTOOL_LDFLAGS="-no-undefined"
    ;;
  *apple* | *darwin*) # For Mac OS X
    if test x"$drawstuff" = x
    then
       drawstuff="OSX"
    fi
    dnl We need to use C++ compilation and linking for ode on Mac
    dnl Might as well do it for all code.
    CC="$CXX"
    LINK="$CXXLINK"
    ;;
  *)
    if test x"$drawstuff" = x
    then
       drawstuff="X11" # if anything else default to X11
    fi
    ;;
esac
AC_SUBST(EXTRA_LIBTOOL_LDFLAGS)
AM_CONDITIONAL(ENABLE_DRAWSTUFF, test x$drawstuff != xnone)


dnl Set Conditionals
AM_CONDITIONAL(WIN32, test x$drawstuff = xWin32)
AM_CONDITIONAL(X11, test x$drawstuff = xX11)
AM_CONDITIONAL(OSX, test x$drawstuff = xOSX)
dnl Set Drawstuff variables
AC_MSG_CHECKING(which drawstuff lib to build)
AC_MSG_RESULT($drawstuff)

if test "x$drawstuff" = "xX11"
then
    AC_PATH_XTRA
fi

dnl Check for OpenGL
if test "x$drawstuff" = "xOSX"; then
  AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1],
            [Use the Apple OpenGL framework.])
  GL_LIBS="-framework OpenGL -framework Carbon -framework AGL"
else
  have_gl_headers=yes
  AC_CHECK_HEADERS(GL/gl.h GL/glu.h GL/glext.h, ,
        [have_gl_headers=no],
       [[#ifdef WIN32
         #include <windows.h>
         #endif
         #if HAVE_GL_GL_H
         #include <GL/gl.h>
         #endif
  	     #if HAVE_GL_GLU_H
         #include <GL/glu.h>
         #endif
       ]])
  have_gl=no
  have_glu=no
  TEMP_LDFLAGS="$LDFLAGS"
  AC_CHECK_LIB(GL, main, [GL_LIBS="-lGL"; have_gl=yes])
  AC_CHECK_LIB(GLU, main, [GL_LIBS="-lGLU $GL_LIBS"; have_glu=yes], , -lGL)
  AC_CHECK_LIB(opengl32, main, [GL_LIBS="-lopengl32"; have_gl=yes])
  AC_CHECK_LIB(glu32, main, [GL_LIBS="-lglu32 $GL_LIBS"; have_glu=yes], , -lopengl32)
  LDFLAGS="$TEMP_LDFLAGS"
  if test $have_gl = no -o $have_glu = no -o $have_gl_headers = no; then
    if test x$enable_demos = xyes; then
      AC_MSG_WARN([Demos will not be built because OpenGL doesn't seem to work. See `config.log' for details.])
    fi
    enable_demos=no
  fi
fi
AC_SUBST(GL_LIBS)


dnl stdc++ is required when linking C programs against ode
AC_CHECK_LIB(stdc++,main,[LIBSTDCXX="-lstdc++"],[LIBSTDCXX=])
AC_SUBST(LIBSTDCXX)
AC_CHECK_LIB(pthread,main,[LIBS="$LIBS -lpthread"])


dnl test if we will build demos
AM_CONDITIONAL(ENABLE_DEMOS, test x$enable_demos = xyes)


dnl Check if the user wants the old timesh collider
old_trimesh=no
AC_ARG_ENABLE([old-trimesh], AS_HELP_STRING([--enable-old-trimesh],[enable use of the old trimesh collider]),
        [old_trimesh=$enableval]
        )
if test x$old_trimesh = xyes -a $trimesh = opcode; then
        AC_DEFINE(dTRIMESH_OPCODE_USE_OLD_TRIMESH_TRIMESH_COLLIDER, 1,
                [Use the old trimesh-trimesh collider])
else
        old_trimesh=no
fi


dnl Check if the user wants to profile ODE using gprof
AC_MSG_CHECKING(for gprof)
AC_ARG_ENABLE([gprof],
        AS_HELP_STRING([--enable-gprof],[enable profiling with gprof]),
        gprof=$enableval,
        gprof=no)
if test "$gprof" != no
then
    CFLAGS="-pg $CFLAGS"
    CXXFLAGS="-pg $CXXFLAGS"
    AC_MSG_RESULT(enabled)
    AC_CHECK_LIB(gmon, main,[LIBS="$LIBS -lgmon"])
else
    AC_MSG_RESULT(no)
fi

dnl Check for autoscan sugested functions
AC_CHECK_LIB(m, [main])
AC_CHECK_LIB(sunmath, [main])
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])
AC_FUNC_ALLOCA 
AC_FUNC_MALLOC
AC_FUNC_OBSTACK 
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_VPRINTF

AC_MSG_CHECKING(if alloca should be emulated by malloc)
AC_ARG_ENABLE([malloc],
        AS_HELP_STRING([--enable-malloc],
            [use malloc to emulate alloca (more portable but slower)]
        ),
        usemalloc=$enableval, usemalloc=no)
if test "$usemalloc" != no
then
    AC_DEFINE([dUSE_MALLOC_FOR_ALLOCA],[1],[use malloc() instead of alloca()])
    AC_MSG_RESULT($usemalloc)
else
    AC_MSG_RESULT(no)
fi

AC_ARG_ENABLE([ou],
        AS_HELP_STRING([--enable-ou],
            [EXPERIMENTAL: use TLS for global variables to allow for running ODE in multiple threads simultaneously]
        ),
        use_ou=$enableval,use_ou=no)
if test x$use_ou = xyes
then
    OU_NAMESPACE=odeou
    AC_CONFIG_COMMANDS_POST([export OU_NAMESPACE=odeou])
    AC_DEFINE([_OU_NAMESPACE],[odeou],[libou namespace for ODE])
    AC_DEFINE([dOU_ENABLED],[1],[Generic OU features are enabled])
    AC_DEFINE([dATOMICS_ENABLED],[1],[Atomic API of OU is enabled])
    AC_DEFINE([dTLS_ENABLED],[1],[Thread Local Storage API of OU is enabled])

    case "$host_os" in
      cygwin* | mingw*)
        targetos=_OU_TARGET_OS_WINDOWS
        ;;
      *qnx*)
        targetos=_OU_TARGET_OS_QNX
        ;;
      *apple* | *darwin*)
        targetos=_OU_TARGET_OS_MAC
        ;;
      *sunos*)
        targetos=_OU_TARGET_OS_SUNOS
        ;;
      *aix*)
        targetos=_OU_TARGET_OS_AIX
        ;;
      *)
        targetos=_OU_TARGET_OS_GENUNIX
        ;;
    esac

    if test $targetos = _OU_TARGET_OS_MAC
    then
        MAC_OS_X_VERSION=1000
        AC_CHECK_FUNC([OSAtomicAdd32Barrier], [MAC_OS_X_VERSION=1040])
        AC_CHECK_FUNC([OSAtomicAnd32OrigBarrier], [MAC_OS_X_VERSION=1050])
        AC_DEFINE_UNQUOTED(MAC_OS_X_VERSION, $MAC_OS_X_VERSION, [Mac OS X version setting for OU Library])
    fi
    
    if test $targetos = _OU_TARGET_OS_SUNOS
    then
        AC_CHECK_FUNC(atomic_inc_32_nv, [],
            [targetos=_OU_TARGET_OS_GENUNIX])
    fi
    
    AC_DEFINE_UNQUOTED(_OU_TARGET_OS, $targetos, [Target OS setting for OU Library])
fi
AC_CONFIG_SUBDIRS([ou])
AM_CONDITIONAL(ENABLE_OU, test x$use_ou = xyes)


AC_ARG_ENABLE([asserts],
        AS_HELP_STRING([--disable-asserts],
            [disables debug error checking]),
        asserts=$enableval,asserts=yes)
if test x$asserts = xno
then
    CPPFLAGS="$CPPFLAGS -DdNODEBUG"
    if test x$use_ou = xyes
    then
        CPPFLAGS="$CPPFLAGS -DNDEBUG"
    fi
fi


dnl include found system headers into config.h
AH_TOP([
#ifndef ODE_CONFIG_H
#define ODE_CONFIG_H
])
AH_BOTTOM([

#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif

/* an integer type that we can safely cast a pointer to and
 * from without loss of bits.
 */
typedef uintptr_t intP;


// Use the error-checking memory allocation system.  Because this system uses heap
//  (malloc) instead of stack (alloca), it is slower.  However, it allows you to
//  simulate larger scenes, as well as handle out-of-memory errors in a somewhat
//  graceful manner

#ifdef dUSE_MALLOC_FOR_ALLOCA
enum {
  d_MEMORY_OK = 0,              /* no memory errors */
  d_MEMORY_OUT_OF_MEMORY        /* malloc failed due to out of memory error */
};
#endif

#ifdef dSINGLE
       #define dEpsilon  FLT_EPSILON
#else
       #define dEpsilon  DBL_EPSILON
#endif


#endif /* #define ODE_CONFIG_H */
])

dnl Finally write our Makefiles
AC_CONFIG_FILES([
 Makefile
 include/Makefile
 include/ode/Makefile
 include/drawstuff/Makefile
 ode/Makefile
 ode/src/Makefile
 ode/src/joints/Makefile
 drawstuff/Makefile
 drawstuff/src/Makefile
 drawstuff/dstest/Makefile
 ode/demo/Makefile
 OPCODE/Makefile
 OPCODE/Ice/Makefile
 GIMPACT/Makefile
 GIMPACT/include/Makefile
 GIMPACT/include/GIMPACT/Makefile
 GIMPACT/src/Makefile
 tests/Makefile
 tests/UnitTest++/Makefile
 tests/UnitTest++/src/Makefile
 tests/UnitTest++/src/Posix/Makefile
 tests/UnitTest++/src/Win32/Makefile
 ode-config
 ode.pc
 ])
AC_OUTPUT

chmod +x ode-config

BUILDDIR=`pwd`

dnl Print some useful information
echo "Configuration:"
echo "  Build  system type:      $build"
echo "  Host   system type:      $host"
echo "  Use double precision:    $precision"
echo "  Use drawstuff:           $drawstuff"
echo "  Demos enabled:           $enable_demos"
echo "  Use OPCODE:              $opcode"
echo "  Use GIMPACT:             $gimpact"
echo "  Is target a Pentium:     $pentium"
echo "  Is target x86-64:        $cpu64"
echo "  Use old opcode trimesh collider: $old_trimesh"
echo "  TLS for global data:     $use_ou"
echo "  Enable debug error check: $asserts"
echo "  Headers will be installed in $includedir/ode"
echo "  Libraries will be installed in $libdir"
echo "  Building in directory    $BUILDDIR"