| 1 | dnl Initial configure.in by Rodrigo Hernandez |
|---|
| 2 | dnl Modified in 26/10/2005 by Rodrigo Hernandez |
|---|
| 3 | |
|---|
| 4 | dnl AC_INIT does not take a macro as a version nr: set it separately! - Bram |
|---|
| 5 | AC_INIT(ODE,0.9.0,ode@ode.org) |
|---|
| 6 | |
|---|
| 7 | dnl When upgrading version nr, also change the AC_INIT line! - Bram |
|---|
| 8 | ODE_CURRENT=0 |
|---|
| 9 | ODE_REVISION=9 |
|---|
| 10 | ODE_AGE=0 |
|---|
| 11 | ODE_RELEASE=[$ODE_CURRENT].[$ODE_REVISION].[$ODE_AGE] |
|---|
| 12 | AC_CANONICAL_HOST |
|---|
| 13 | AC_CANONICAL_TARGET |
|---|
| 14 | |
|---|
| 15 | AM_INIT_AUTOMAKE(ODE,[$ODE_RELEASE]) |
|---|
| 16 | AM_CONFIG_HEADER(include/ode/config.h) |
|---|
| 17 | dnl Set CFLAGS to zero, so that we avoid getting the gratis -g -O2 |
|---|
| 18 | CFLAGS= |
|---|
| 19 | CXXFLAGS= |
|---|
| 20 | AC_C_BIGENDIAN |
|---|
| 21 | AC_PATH_X |
|---|
| 22 | AC_PATH_XTRA |
|---|
| 23 | |
|---|
| 24 | ODE_SONAME=libode.so.[$ODE_CURRENT] |
|---|
| 25 | |
|---|
| 26 | AC_SUBST(ODE_CURRENT) |
|---|
| 27 | AC_SUBST(ODE_REVISION) |
|---|
| 28 | AC_SUBST(ODE_AGE) |
|---|
| 29 | AC_SUBST(ODE_RELEASE) |
|---|
| 30 | AC_SUBST(ODE_SONAME) |
|---|
| 31 | |
|---|
| 32 | dnl This is needed because we have subdirectories |
|---|
| 33 | AC_PROG_MAKE_SET |
|---|
| 34 | |
|---|
| 35 | AC_PROG_CXX |
|---|
| 36 | AC_PROG_INSTALL |
|---|
| 37 | AC_CHECK_TOOLS([WINDRES], [windres]) |
|---|
| 38 | AC_C_CONST |
|---|
| 39 | AC_C_INLINE |
|---|
| 40 | AC_C_VOLATILE |
|---|
| 41 | AC_HEADER_STDBOOL |
|---|
| 42 | AC_PROG_RANLIB |
|---|
| 43 | AC_TYPE_SIZE_T |
|---|
| 44 | |
|---|
| 45 | dnl Check if using sonames is requested |
|---|
| 46 | dnl THIS IS TEMPORARY! |
|---|
| 47 | AC_MSG_CHECKING(if a soname should be set) |
|---|
| 48 | AC_ARG_ENABLE(soname,AC_HELP_STRING([--enable-soname], |
|---|
| 49 | [Configure ODE shared library to set the soname field on ELF files]), |
|---|
| 50 | use_soname=$enableval,use_soname=no) |
|---|
| 51 | AC_MSG_RESULT($use_soname) |
|---|
| 52 | AM_CONDITIONAL(USE_SONAME, test x$use_soname = xyes) |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | dnl Check if we want to build demos |
|---|
| 56 | AC_MSG_CHECKING(if tests should be built) |
|---|
| 57 | AC_ARG_ENABLE(demos,AC_HELP_STRING([--enable-demos], [build tests]), enable_demos=$enableval,enable_demos=yes) |
|---|
| 58 | AC_MSG_RESULT($enable_demos) |
|---|
| 59 | AM_CONDITIONAL(ENABLE_DEMOS, test x$enable_demos = xyes) |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | AC_ARG_WITH(arch,AC_HELP_STRING([--with-arch=[arch]], |
|---|
| 63 | [build for $arch, where arch is any of the -march flags passed to gcc, without the -march, for example --with-arch=pentium3]), |
|---|
| 64 | arch=$withval,arch=no) |
|---|
| 65 | ARCHFLAGS="" |
|---|
| 66 | if test "x$arch" != xno |
|---|
| 67 | then |
|---|
| 68 | ARCHFLAGS="-march=$arch" |
|---|
| 69 | fi |
|---|
| 70 | AC_SUBST(ARCHFLAGS) |
|---|
| 71 | |
|---|
| 72 | dnl Decide whether or not SSE is available |
|---|
| 73 | dnl Why dont we compile and run programs like we do to find out if |
|---|
| 74 | dnl this is a Pentium machine further down? simple! |
|---|
| 75 | dnl this may NOT be the machine on which the code is going to run in, |
|---|
| 76 | dnl so allow users to compile programs for their target machine. |
|---|
| 77 | case "$arch" in |
|---|
| 78 | pentium3 | pentium4 | athlon* ) |
|---|
| 79 | AC_DEFINE(HAVE_SSE,,[Use SSE Optimizations]) |
|---|
| 80 | ;; |
|---|
| 81 | dnl this space available for other architectures specific extensions and/or |
|---|
| 82 | dnl other Intel based extensions such as 3DNow, SSE2, MMX, etc. |
|---|
| 83 | esac |
|---|
| 84 | |
|---|
| 85 | dnl check for required headers |
|---|
| 86 | AC_CHECK_HEADERS( alloca.h ieeefp.h stdio.h stdlib.h math.h string.h stdarg.h malloc.h values.h float.h time.h sys/time.h ) |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | opcode=no |
|---|
| 90 | gimpact=no |
|---|
| 91 | AC_ARG_WITH(trimesh,AC_HELP_STRING([--with-trimesh=[opcode|gimpact|none]], |
|---|
| 92 | [use the specified system for trimesh support.]), |
|---|
| 93 | trimesh=$withval,trimesh=opcode |
|---|
| 94 | ) |
|---|
| 95 | if test "$trimesh" = opcode |
|---|
| 96 | then |
|---|
| 97 | opcode=yes |
|---|
| 98 | fi |
|---|
| 99 | if test "$trimesh" = gimpact |
|---|
| 100 | then |
|---|
| 101 | gimpact=yes |
|---|
| 102 | fi |
|---|
| 103 | |
|---|
| 104 | AM_CONDITIONAL(OPCODE, test $opcode = yes) |
|---|
| 105 | AM_CONDITIONAL(GIMPACT, test $gimpact = yes) |
|---|
| 106 | AM_CONDITIONAL(TRIMESH, test $opcode = yes -o $gimpact = yes) |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | AC_MSG_CHECKING(if gyroscopic term should be used) |
|---|
| 110 | AC_ARG_ENABLE(gyroscopic,AC_HELP_STRING([--disable-gyroscopic], |
|---|
| 111 | [Configure ODE to work without gyroscopic term (may improve stability)]), |
|---|
| 112 | gyroscopic=$enableval,gyroscopic=yes) |
|---|
| 113 | AC_MSG_RESULT($gyroscopic) |
|---|
| 114 | if test x"$gyroscopic" = xyes |
|---|
| 115 | then |
|---|
| 116 | AC_DEFINE(dGYROSCOPIC,,[Use gyroscopic terms]) |
|---|
| 117 | fi |
|---|
| 118 | |
|---|
| 119 | dnl Check Precision, define the dInfinity constant--------------------------/ |
|---|
| 120 | AC_MSG_CHECKING(if double precision is requested) |
|---|
| 121 | AC_ARG_ENABLE(double-precision,AC_HELP_STRING([--enable-double-precision], |
|---|
| 122 | [Configure ODE to work with double precision, if not specified, single precision is used]), |
|---|
| 123 | precision=$enableval,precision=no) |
|---|
| 124 | if test "$precision" != no |
|---|
| 125 | then |
|---|
| 126 | dnl DOUBLE was chosen |
|---|
| 127 | AC_DEFINE(dDOUBLE,,[Use double precision]) |
|---|
| 128 | dnl Check from lest likelly to more likelly. |
|---|
| 129 | if test "$build_os" == "$target_os" |
|---|
| 130 | then |
|---|
| 131 | AC_TRY_RUN([ |
|---|
| 132 | #define dInfinity 1e20 |
|---|
| 133 | int main() |
|---|
| 134 | { |
|---|
| 135 | if (dInfinity > 1e10 && -dInfinity < -1e10 && -dInfinity < dInfinity) |
|---|
| 136 | return 0; |
|---|
| 137 | else return -1; |
|---|
| 138 | } |
|---|
| 139 | ],dinfinity=1e20,,) |
|---|
| 140 | AC_TRY_RUN([ |
|---|
| 141 | #define dInfinity 1.7976931348623157e+308 |
|---|
| 142 | int main() |
|---|
| 143 | { |
|---|
| 144 | if (dInfinity > 1e10 && -dInfinity < -1e10 && -dInfinity < dInfinity) |
|---|
| 145 | return 0; |
|---|
| 146 | else return -1; |
|---|
| 147 | } |
|---|
| 148 | ],dinfinity=1.7976931348623157e+308,,) |
|---|
| 149 | AC_TRY_RUN([ |
|---|
| 150 | #include <float.h> |
|---|
| 151 | #define dInfinity HUGE_VAL |
|---|
| 152 | int main() |
|---|
| 153 | { |
|---|
| 154 | if (dInfinity > 1e10 && -dInfinity < -1e10 && -dInfinity < dInfinity) |
|---|
| 155 | return 0; |
|---|
| 156 | else return -1; |
|---|
| 157 | } |
|---|
| 158 | ],dinfinity=HUGE_VAL,,) |
|---|
| 159 | AC_TRY_RUN([ |
|---|
| 160 | #include <float.h> |
|---|
| 161 | #define dInfinity DBL_MAX |
|---|
| 162 | int main() |
|---|
| 163 | { |
|---|
| 164 | if (dInfinity > 1e10 && -dInfinity < -1e10 && -dInfinity < dInfinity) |
|---|
| 165 | return 0; |
|---|
| 166 | else return -1; |
|---|
| 167 | } |
|---|
| 168 | ],dinfinity=DBL_MAX,,) |
|---|
| 169 | else |
|---|
| 170 | #cross-compiling, use a reasonable value. We should add an option for setting this. |
|---|
| 171 | dinfinity=DBL_MAX |
|---|
| 172 | fi |
|---|
| 173 | else |
|---|
| 174 | dnl default to SINGLE. |
|---|
| 175 | AC_DEFINE(dSINGLE,,[Use single precision]) |
|---|
| 176 | dnl Check from lest likelly to more likelly. |
|---|
| 177 | if test "$build_os" == "$target_os" |
|---|
| 178 | then |
|---|
| 179 | AC_TRY_RUN([ |
|---|
| 180 | #define dInfinity 1e20f |
|---|
| 181 | int main() |
|---|
| 182 | { |
|---|
| 183 | if (dInfinity > 1e10f && -dInfinity < -1e10f && -dInfinity < dInfinity) |
|---|
| 184 | return 0; |
|---|
| 185 | else return -1; |
|---|
| 186 | } |
|---|
| 187 | ],dinfinity=1e20f,,) |
|---|
| 188 | AC_TRY_RUN([ |
|---|
| 189 | #define dInfinity 3.402823466e+38F |
|---|
| 190 | int main() |
|---|
| 191 | { |
|---|
| 192 | if (dInfinity > 1e10f && -dInfinity < -1e10f && -dInfinity < dInfinity) |
|---|
| 193 | return 0; |
|---|
| 194 | else return -1; |
|---|
| 195 | } |
|---|
| 196 | ],dinfinity=3.402823466e+38F,,) |
|---|
| 197 | AC_TRY_RUN([ |
|---|
| 198 | #include <float.h> |
|---|
| 199 | #define dInfinity HUGE_VALF |
|---|
| 200 | int main() |
|---|
| 201 | { |
|---|
| 202 | if (dInfinity > 1e10f && -dInfinity < -1e10f && -dInfinity < dInfinity) |
|---|
| 203 | return 0; |
|---|
| 204 | else return -1; |
|---|
| 205 | } |
|---|
| 206 | ],dinfinity=HUGE_VALF,,) |
|---|
| 207 | AC_TRY_RUN([ |
|---|
| 208 | #include <float.h> |
|---|
| 209 | #define dInfinity FLT_MAX |
|---|
| 210 | int main() |
|---|
| 211 | { |
|---|
| 212 | if (dInfinity > 1e10f && -dInfinity < -1e10f && -dInfinity < dInfinity) |
|---|
| 213 | return 0; |
|---|
| 214 | else return -1; |
|---|
| 215 | } |
|---|
| 216 | ],dinfinity=FLT_MAX,,) |
|---|
| 217 | #cross-compiling, use a reasonable value. We should add an option for setting this. |
|---|
| 218 | dinfinity=FLT_MAX |
|---|
| 219 | fi |
|---|
| 220 | fi |
|---|
| 221 | AC_MSG_RESULT($precision) |
|---|
| 222 | AC_DEFINE_UNQUOTED(dInfinity,${dinfinity},[dInfinity Constant]) |
|---|
| 223 | AC_MSG_CHECKING(for appropriate dInfinity constant) |
|---|
| 224 | AC_MSG_RESULT($dinfinity) |
|---|
| 225 | dnl --------------------------------------------------------------------------/ |
|---|
| 226 | |
|---|
| 227 | dnl Define dEpsilon |
|---|
| 228 | AC_CHECK_HEADER(float.h,[have_float_h=yes],[have_float_h=no]) |
|---|
| 229 | AC_MSG_CHECKING(for appropriate dEpsilon constant) |
|---|
| 230 | if test "x$have_float_h" == xyes |
|---|
| 231 | then |
|---|
| 232 | if test $precision == yes |
|---|
| 233 | then |
|---|
| 234 | dEpsilon=DBL_EPSILON |
|---|
| 235 | else |
|---|
| 236 | dEpsilon=FLT_EPSILON |
|---|
| 237 | fi |
|---|
| 238 | else |
|---|
| 239 | if test $precision == yes |
|---|
| 240 | then |
|---|
| 241 | dEpsilon=2.2204460492503131e-16 |
|---|
| 242 | else |
|---|
| 243 | dEpsilon=1.19209290e-07f |
|---|
| 244 | fi |
|---|
| 245 | fi |
|---|
| 246 | AC_DEFINE_UNQUOTED(dEpsilon,${dEpsilon},[dEpsilon Constant]) |
|---|
| 247 | AC_MSG_RESULT($dEpsilon) |
|---|
| 248 | |
|---|
| 249 | |
|---|
| 250 | dnl Check for PENTIUM |
|---|
| 251 | if test "$build_os" == "$target_os" |
|---|
| 252 | then |
|---|
| 253 | AC_MSG_CHECKING(for a Pentium CPU) |
|---|
| 254 | AC_TRY_RUN([ |
|---|
| 255 | int main() |
|---|
| 256 | { |
|---|
| 257 | asm ("mov \$0,%%eax;\n" |
|---|
| 258 | "cpuid\n" : : : "%eax"); |
|---|
| 259 | return 0; |
|---|
| 260 | }; |
|---|
| 261 | ],pentium=yes,pentium=no,) |
|---|
| 262 | else |
|---|
| 263 | pentium=no |
|---|
| 264 | fi |
|---|
| 265 | if test "x$pentium" == xyes |
|---|
| 266 | then |
|---|
| 267 | AC_DEFINE(PENTIUM,1,[is this a pentium on a gcc-based platform?]) |
|---|
| 268 | fi |
|---|
| 269 | AC_MSG_RESULT($pentium) |
|---|
| 270 | |
|---|
| 271 | dnl Check for 64bit CPU |
|---|
| 272 | AC_MSG_CHECKING(for a x86-64 CPU) |
|---|
| 273 | if test "$build_os" == "$target_os" |
|---|
| 274 | then |
|---|
| 275 | AC_TRY_RUN([ |
|---|
| 276 | int main() |
|---|
| 277 | { |
|---|
| 278 | int a = 0; |
|---|
| 279 | int * pa = &a; |
|---|
| 280 | asm ("mov %0,%%rax\n" |
|---|
| 281 | "movl (%%rax),%%eax\n" |
|---|
| 282 | : : "r"(pa) : "%rax"); |
|---|
| 283 | return 0; |
|---|
| 284 | }; |
|---|
| 285 | ],cpu64=yes,cpu64=no,) |
|---|
| 286 | else |
|---|
| 287 | cpu64=no |
|---|
| 288 | fi |
|---|
| 289 | if test "x$cpu64" == xyes |
|---|
| 290 | then |
|---|
| 291 | AC_DEFINE(X86_64_SYSTEM,1,[is this a X86_64 system on a gcc-based platform?]) |
|---|
| 292 | fi |
|---|
| 293 | AC_MSG_RESULT($cpu64) |
|---|
| 294 | AM_CONDITIONAL(X86_64_SYSTEM, test x$cpu64 = xyes) |
|---|
| 295 | |
|---|
| 296 | AC_MSG_CHECKING(if building a release library) |
|---|
| 297 | AC_ARG_ENABLE(release,AC_HELP_STRING([--enable-release], |
|---|
| 298 | [build a release library with -fomit-frame-pointer and -ffast-math]), |
|---|
| 299 | release=$enableval,release=no) |
|---|
| 300 | if test "x$release" == xyes |
|---|
| 301 | then |
|---|
| 302 | CFLAGS="$CFLAGS -fomit-frame-pointer -ffast-math" |
|---|
| 303 | CPPFLAGS="$CPPFLAGS -fomit-frame-pointer -ffast-math" |
|---|
| 304 | CXXFLAGS="$CXXFLAGS -fomit-frame-pointer -ffast-math" |
|---|
| 305 | AC_DEFINE(dNODEBUG,,[Disable debug output]) |
|---|
| 306 | fi |
|---|
| 307 | AC_MSG_RESULT($release) |
|---|
| 308 | |
|---|
| 309 | AC_MSG_CHECKING(if building a debug library) |
|---|
| 310 | AC_ARG_ENABLE(debug,AC_HELP_STRING([--enable-debug], |
|---|
| 311 | [Add debug symbols to the library with -g]), |
|---|
| 312 | debug=$enableval,debug=yes) |
|---|
| 313 | if test "x$debug" == xyes |
|---|
| 314 | then |
|---|
| 315 | CFLAGS="$CFLAGS -g" |
|---|
| 316 | CPPFLAGS="$CPPFLAGS -g" |
|---|
| 317 | CXXFLAGS="$CXXFLAGS -g" |
|---|
| 318 | fi |
|---|
| 319 | AC_MSG_RESULT($debug) |
|---|
| 320 | |
|---|
| 321 | |
|---|
| 322 | dnl Check variable type sizes |
|---|
| 323 | AC_CHECK_SIZEOF(char) |
|---|
| 324 | AC_CHECK_SIZEOF(int) |
|---|
| 325 | AC_CHECK_SIZEOF(short) |
|---|
| 326 | AC_CHECK_SIZEOF(long int) |
|---|
| 327 | AC_CHECK_SIZEOF(void*) |
|---|
| 328 | |
|---|
| 329 | dnl Set some Platform Specific Variables |
|---|
| 330 | case "$host_os" in |
|---|
| 331 | cygwin* | mingw*) |
|---|
| 332 | so_ext=".dll" |
|---|
| 333 | DLLDEFINE="-DODE_DLL" |
|---|
| 334 | SHARED_LDFLAGS="-shared" |
|---|
| 335 | drawstuff="Win32" # if in a Windows enviroment |
|---|
| 336 | ;; |
|---|
| 337 | *apple* | *darwin*) # For Mac OS X |
|---|
| 338 | so_ext=".dylib" |
|---|
| 339 | DLLDEFINE="" |
|---|
| 340 | SHARED_LDFLAGS="-dynamiclib" |
|---|
| 341 | drawstuff="OSX" |
|---|
| 342 | dnl We need to use C++ compilation and linking for ode on Mac |
|---|
| 343 | dnl Might as well do it for all code. |
|---|
| 344 | CC="$CXX" |
|---|
| 345 | LINK="$CXXLINK" |
|---|
| 346 | ;; |
|---|
| 347 | *) |
|---|
| 348 | drawstuff="X11" # if anything else default to X11 |
|---|
| 349 | if test x$use_soname = xyes; then |
|---|
| 350 | so_ext=".so.$ODE_RELEASE" |
|---|
| 351 | else |
|---|
| 352 | so_ext=".so" |
|---|
| 353 | fi |
|---|
| 354 | DLLDEFINE="" |
|---|
| 355 | SHARED_LDFLAGS="-shared" |
|---|
| 356 | ;; |
|---|
| 357 | esac |
|---|
| 358 | dnl Set Conditionals |
|---|
| 359 | AM_CONDITIONAL(WIN32, test x$drawstuff = xWin32) |
|---|
| 360 | AM_CONDITIONAL(X11, test x$drawstuff = xX11) |
|---|
| 361 | AM_CONDITIONAL(OSX, test x$drawstuff = xOSX) |
|---|
| 362 | dnl Set Drawstuff variables |
|---|
| 363 | AC_MSG_CHECKING(which drawstuff lib to build) |
|---|
| 364 | AC_MSG_RESULT($drawstuff) |
|---|
| 365 | AC_SUBST(DRAWSTUFF) |
|---|
| 366 | dnl Set shared library variables |
|---|
| 367 | AC_MSG_CHECKING(for the suffix of shared libraries) |
|---|
| 368 | AC_MSG_RESULT($so_ext) |
|---|
| 369 | AC_DEFINE_UNQUOTED(SO_EXT,"$so_ext",[The extension for shared libraries.]) |
|---|
| 370 | AC_SUBST(so_ext) |
|---|
| 371 | AC_SUBST(SHARED_LDFLAGS) |
|---|
| 372 | |
|---|
| 373 | dnl Check for AC_PATH_X variables |
|---|
| 374 | if test "X$x_includes" != "XNONE"; then |
|---|
| 375 | CFLAGS="$CFLAGS -I$x_includes" |
|---|
| 376 | CXXFLAGS="$CXXFLAGS -I$x_includes" |
|---|
| 377 | fi |
|---|
| 378 | if test "X$x_libraries" != "XNONE"; then |
|---|
| 379 | CFLAGS="$CFLAGS -L$x_libraries" |
|---|
| 380 | CXXFLAGS="$CXXFLAGS -L$x_libraries" |
|---|
| 381 | fi |
|---|
| 382 | |
|---|
| 383 | dnl Check for OpenGL |
|---|
| 384 | if test "x$drawstuff" = "xOSX"; then |
|---|
| 385 | AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1], |
|---|
| 386 | [Use the Apple OpenGL framework.]) |
|---|
| 387 | GL_LIBS="-framework OpenGL -framework Carbon -framework AGL" |
|---|
| 388 | else |
|---|
| 389 | AC_CHECK_HEADERS(GL/gl.h GL/glu.h GL/glext.h,,, |
|---|
| 390 | [[#if HAVE_GL_GL_H |
|---|
| 391 | #include <GL/gl.h> |
|---|
| 392 | #endif |
|---|
| 393 | #if HAVE_GL_GLU_H |
|---|
| 394 | #include <GL/glu.h> |
|---|
| 395 | #endif |
|---|
| 396 | ]]) |
|---|
| 397 | AC_CHECK_LIB(GL, main,[GL_LIBS="$GL_LIBS -lGL"]) |
|---|
| 398 | TEMP_LDFLAGS="$LDFLAGS" |
|---|
| 399 | LDFLAGS="$LDFLAGS $GL_LIBS" |
|---|
| 400 | AC_CHECK_LIB(GLU, main,[GL_LIBS="$GL_LIBS -lGLU"]) |
|---|
| 401 | LDFLAGS="$TEMP_LDFLAGS" |
|---|
| 402 | AC_CHECK_LIB(opengl32, main,[GL_LIBS="$GL_LIBS -lopengl32"]) |
|---|
| 403 | AC_CHECK_LIB(glu32, main,[GL_LIBS="$GL_LIBS -lglu32"]) |
|---|
| 404 | AC_CHECK_LIB(Xmu, main,[GL_LIBS="$GL_LIBS -lXmu"]) |
|---|
| 405 | AC_CHECK_LIB(Xi, main,[GL_LIBS="$GL_LIBS -lXi"]) |
|---|
| 406 | AC_CHECK_LIB(X, main,[GL_LIBS="$GL_LIBS -lX"]) |
|---|
| 407 | AC_CHECK_LIB(X11, main,[GL_LIBS="$GL_LIBS -lX11"]) |
|---|
| 408 | fi |
|---|
| 409 | AC_SUBST(GL_LIBS) |
|---|
| 410 | |
|---|
| 411 | dnl Add some Windows libraries if found |
|---|
| 412 | AC_CHECK_LIB(comctl32,main,[LIBS="$LIBS -lcomctl32"]) |
|---|
| 413 | AC_CHECK_LIB(kernel32,main,[LIBS="$LIBS -lkernel32"]) |
|---|
| 414 | AC_CHECK_LIB(user32,main,[LIBS="$LIBS -luser32"]) |
|---|
| 415 | AC_CHECK_LIB(gdi32,main,[LIBS="$LIBS -lgdi32"]) |
|---|
| 416 | AC_CHECK_LIB(winmm,main,[LIBS="$LIBS -lwinmm"]) |
|---|
| 417 | |
|---|
| 418 | dnl Add math and standard c++ lib just in case |
|---|
| 419 | AC_CHECK_LIB(stdc++,main,[LIBS="$LIBS -lstdc++"]) |
|---|
| 420 | AC_CHECK_LIB(m,main,[LIBS="$LIBS -lm"]) |
|---|
| 421 | AC_CHECK_LIB(pthread,main,[LIBS="$LIBS -lpthread"]) |
|---|
| 422 | |
|---|
| 423 | |
|---|
| 424 | TOPDIR=`cd $srcdir;pwd` |
|---|
| 425 | AC_SUBST(TOPDIR) |
|---|
| 426 | |
|---|
| 427 | dnl Check if the user wants to profile ODE using gprof |
|---|
| 428 | AC_MSG_CHECKING(for gprof) |
|---|
| 429 | AC_ARG_ENABLE(gprof, |
|---|
| 430 | AC_HELP_STRING([--enable-gprof],[enable profiling with gprof]), |
|---|
| 431 | gprof=$enableval,gprof=no) |
|---|
| 432 | if test "$gprof" != no |
|---|
| 433 | then |
|---|
| 434 | CFLAGS="-pg $CFLAGS" |
|---|
| 435 | CPPFLAGS="-pg $CPPFLAGS" |
|---|
| 436 | CXXFLAGS="-pg $CXXFLAGS" |
|---|
| 437 | AC_CHECK_LIB(gmon, main,[LIBS="$LIBS -lgmon"]) |
|---|
| 438 | AC_MSG_RESULT(enabled) |
|---|
| 439 | else |
|---|
| 440 | AC_MSG_RESULT(no) |
|---|
| 441 | fi |
|---|
| 442 | |
|---|
| 443 | dnl Check for autoscan sugested functions |
|---|
| 444 | 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]) |
|---|
| 445 | if test "$build_os" == "$target_os" |
|---|
| 446 | then |
|---|
| 447 | AC_FUNC_ALLOCA |
|---|
| 448 | AC_FUNC_MALLOC |
|---|
| 449 | AC_FUNC_OBSTACK |
|---|
| 450 | AC_FUNC_REALLOC |
|---|
| 451 | AC_FUNC_SELECT_ARGTYPES |
|---|
| 452 | AC_FUNC_VPRINTF |
|---|
| 453 | fi |
|---|
| 454 | |
|---|
| 455 | dnl include found system headers into config.h |
|---|
| 456 | AH_TOP([ |
|---|
| 457 | #ifndef ODE_CONFIG_H |
|---|
| 458 | #define ODE_CONFIG_H |
|---|
| 459 | ]) |
|---|
| 460 | AH_BOTTOM([ |
|---|
| 461 | |
|---|
| 462 | #ifdef HAVE_ALLOCA_H |
|---|
| 463 | #include <alloca.h> |
|---|
| 464 | #endif |
|---|
| 465 | #if defined(HAVE_IEEEFP_H) && !defined(__CYGWIN__) |
|---|
| 466 | // This header creates conflicts with math.h in Cygwin. |
|---|
| 467 | #include <ieeefp.h> |
|---|
| 468 | #endif |
|---|
| 469 | #ifdef HAVE_STDIO_H |
|---|
| 470 | #include <stdio.h> |
|---|
| 471 | #endif |
|---|
| 472 | #ifdef HAVE_STDLIB_H |
|---|
| 473 | #include <stdlib.h> |
|---|
| 474 | #endif |
|---|
| 475 | #ifdef HAVE_MATH_H |
|---|
| 476 | #include <math.h> |
|---|
| 477 | #endif |
|---|
| 478 | #ifdef HAVE_STRING_H |
|---|
| 479 | #include <string.h> |
|---|
| 480 | #endif |
|---|
| 481 | #ifdef HAVE_STDARG_H |
|---|
| 482 | #include <stdarg.h> |
|---|
| 483 | #endif |
|---|
| 484 | #ifdef HAVE_MALLOC_H |
|---|
| 485 | #include <malloc.h> |
|---|
| 486 | #endif |
|---|
| 487 | #ifdef HAVE_VALUES_H |
|---|
| 488 | #include <values.h> |
|---|
| 489 | #endif |
|---|
| 490 | #ifdef HAVE_FLOAT_H |
|---|
| 491 | #include <float.h> |
|---|
| 492 | #endif |
|---|
| 493 | #if SIZEOF_CHAR == 1 |
|---|
| 494 | typedef char int8; |
|---|
| 495 | typedef unsigned char uint8; |
|---|
| 496 | #else |
|---|
| 497 | #error "expecting sizeof(char) == 1" |
|---|
| 498 | #endif |
|---|
| 499 | #if SIZEOF_SHORT == 2 |
|---|
| 500 | typedef short int16; |
|---|
| 501 | typedef unsigned short uint16; |
|---|
| 502 | #else |
|---|
| 503 | #error "can not find 2 byte integer type" |
|---|
| 504 | #endif |
|---|
| 505 | /* integer types (we assume int >= 32 bits) */ |
|---|
| 506 | #if SIZEOF_INT == 4 |
|---|
| 507 | typedef short int32; |
|---|
| 508 | typedef unsigned short uint32; |
|---|
| 509 | #else |
|---|
| 510 | #error "can not find 4 byte integer type" |
|---|
| 511 | #endif |
|---|
| 512 | /* an integer type that we can safely cast a pointer to and |
|---|
| 513 | * from without loss of bits. |
|---|
| 514 | */ |
|---|
| 515 | #if SIZEOF_SHORT == SIZEOF_VOIDP |
|---|
| 516 | typedef unsigned short intP; |
|---|
| 517 | #elif SIZEOF_INT == SIZEOF_VOIDP |
|---|
| 518 | typedef unsigned int intP; |
|---|
| 519 | #elif SIZEOF_LONG_INT == SIZEOF_VOIDP |
|---|
| 520 | typedef unsigned long int intP; |
|---|
| 521 | #endif |
|---|
| 522 | |
|---|
| 523 | /* |
|---|
| 524 | Handle Windows DLL odities |
|---|
| 525 | Its easier to export all symbols using the -shared flag |
|---|
| 526 | for MinGW than differentiating with declspec, |
|---|
| 527 | so only do it for MSVC |
|---|
| 528 | */ |
|---|
| 529 | #if defined(ODE_DLL) && defined(WIN32) && defined(_MSC_VER) |
|---|
| 530 | #define ODE_API __declspec( dllexport ) |
|---|
| 531 | #elif !defined(ODE_DLL) && defined(WIN32) && defined(MSC_VER) |
|---|
| 532 | #define ODE_API __declspec( dllimport ) |
|---|
| 533 | #else |
|---|
| 534 | #define ODE_API |
|---|
| 535 | #endif |
|---|
| 536 | |
|---|
| 537 | #endif /* #define ODE_CONFIG_H */ |
|---|
| 538 | ]) |
|---|
| 539 | |
|---|
| 540 | |
|---|
| 541 | dnl Finally write our Makefiles |
|---|
| 542 | AC_OUTPUT([ |
|---|
| 543 | Makefile |
|---|
| 544 | include/Makefile |
|---|
| 545 | include/ode/Makefile |
|---|
| 546 | ode/Makefile |
|---|
| 547 | ode/src/Makefile |
|---|
| 548 | drawstuff/Makefile |
|---|
| 549 | drawstuff/src/Makefile |
|---|
| 550 | drawstuff/dstest/Makefile |
|---|
| 551 | ode/demo/Makefile |
|---|
| 552 | tests/Makefile |
|---|
| 553 | tests/CppTestHarness/Makefile |
|---|
| 554 | ode-config |
|---|
| 555 | ]) |
|---|
| 556 | |
|---|
| 557 | chmod +x ode-config |
|---|
| 558 | |
|---|
| 559 | dnl Print some useful information |
|---|
| 560 | echo "Configuration:" |
|---|
| 561 | echo " Target system type: $target" |
|---|
| 562 | echo " Build system type: $build" |
|---|
| 563 | echo " Host system type: $host" |
|---|
| 564 | echo " Use double precision: $precision" |
|---|
| 565 | echo " Use OPCODE: $opcode" |
|---|
| 566 | echo " Use GIMPACT: $gimpact" |
|---|
| 567 | echo " Use gyroscopic term: $gyroscopic" |
|---|
| 568 | echo " Is this a Pentium: $pentium" |
|---|
| 569 | echo " Is the CPU x86-64: $cpu64" |
|---|
| 570 | echo " Is this a release build: $release" |
|---|
| 571 | echo " Adding debug symbols: $debug" |
|---|
| 572 | echo " Using SONAME: $use_soname" |
|---|
| 573 | echo " Headers will be installed in $prefix/include/ode" |
|---|
| 574 | echo " Libraries will be installed in $prefix/lib" |
|---|
| 575 | |
|---|
| 576 | if test $gimpact = yes -a $precision = yes |
|---|
| 577 | then |
|---|
| 578 | echo "WARNING! Double precision not yet supported for GIMPACT" |
|---|
| 579 | fi |
|---|
| 580 | |
|---|