configure.ac 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. #----------------------------------------------------------------------------
  2. # Autoconf input script. Invoke the ./autogen.sh script to generate a
  3. # configure script from this file.
  4. #----------------------------------------------------------------------------
  5. AC_PREREQ([2.54])
  6. #----------------------------------------------------------------------------
  7. # Initialize Autoconf.
  8. #----------------------------------------------------------------------------
  9. AC_INIT(
  10. [bullet],
  11. [2.81],
  12. [[email protected]])
  13. AC_CANONICAL_HOST
  14. AC_CONFIG_SRCDIR([configure.ac])
  15. AM_INIT_AUTOMAKE
  16. AM_PROG_CC_C_O
  17. AC_PROG_CXX
  18. AC_PROG_LIBTOOL
  19. case "$host" in
  20. *-*-mingw*|*-*-cygwin*)
  21. AC_DEFINE(PLATFORM_WIN32, 1, [Platform is Win32])
  22. opengl_LIBS="-lunsupported_platform"
  23. PLATFORM_STRING="Win32"
  24. ;;
  25. *-*-linux*)
  26. AC_DEFINE(PLATFORM_LINUX, 1, [Platform is Linux])
  27. opengl_LIBS="-lGL -lGLU -lglut"
  28. PLATFORM_STRING="Linux"
  29. ;;
  30. *-*-darwin*)
  31. AC_MSG_WARN([Hello])
  32. AC_DEFINE(PLATFORM_APPLE, 1, [Platform is Apple])
  33. opengl_LIBS="-framework AGL -framework OpenGL -framework GLUT"
  34. PLATFORM_STRING="Apple"
  35. ;;
  36. *)
  37. AC_MSG_WARN([*** Please add $host to configure.ac checks!])
  38. ;;
  39. esac
  40. AC_SUBST(opengl_LIBS)
  41. case "$host" in
  42. i?86-* | k?-* | athlon-* | pentium*-)
  43. AC_DEFINE(ARCH_X86, 1, [Architecture is x86])
  44. ARCH_SPECIFIC_CFLAGS=""
  45. ARCH_STRING="X86"
  46. ;;
  47. x86_64-*)
  48. AC_DEFINE(ARCH_X86_64, 1, [Architecture is x86-64])
  49. ARCH_SPECIFIC_CFLAGS="-DUSE_ADDR64"
  50. ARCH_STRING="X86-64"
  51. ;;
  52. ppc-* | powerpc-*)
  53. AC_MSG_WARN([HI THERE!])
  54. AC_DEFINE(ARCH_PPC, 1, [Architecture is PowerPC])
  55. ARCH_SPECIFIC_CFLAGS=""
  56. ARCH_STRING="PowerPC"
  57. ;;
  58. *)
  59. AC_MSG_ERROR([Unknown Architecture])
  60. ;;
  61. esac
  62. AC_C_BIGENDIAN
  63. #----------------------------------------------------------------------------
  64. # Setup for the configuration header.
  65. #----------------------------------------------------------------------------
  66. AC_CONFIG_HEADERS([config.h])
  67. #----------------------------------------------------------------------------
  68. # Package configuration switches.
  69. #----------------------------------------------------------------------------
  70. AC_ARG_ENABLE([multithreaded],
  71. [AC_HELP_STRING([--enable-multithreaded],
  72. [build BulletMultiThreaded (default NO)])],
  73. [disable_multithreaded=no], [disable_multithreaded=yes])
  74. AC_MSG_CHECKING([BulletMultiThreaded])
  75. AS_IF([test "$disable_multithreaded" = yes], [build_multithreaded=no], [build_multithreaded=yes])
  76. AC_MSG_RESULT([$build_multithreaded])
  77. AM_CONDITIONAL([CONDITIONAL_BUILD_MULTITHREADED], [test "$build_multithreaded" = yes])
  78. AC_ARG_ENABLE([demos],
  79. [AS_HELP_STRING([--disable-demos],
  80. [disable Bullet demos])],
  81. [],
  82. [enable_demos=yes])
  83. AM_CONDITIONAL([CONDITIONAL_BUILD_DEMOS], [false])
  84. dnl Check for OpenGL and GLUT
  85. case "$host" in
  86. *-*-darwin*)
  87. AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1],
  88. [Use the Apple OpenGL framework.])
  89. GL_LIBS="-framework GLUT -framework OpenGL -framework Carbon -framework AGL"
  90. have_glut=yes
  91. have_glu=yes
  92. have_gl=yes
  93. ;;
  94. *)
  95. have_gl_headers=yes
  96. AC_CHECK_HEADERS(GL/gl.h GL/glu.h GL/glext.h GL/glut.h, ,
  97. [have_gl_headers=no],
  98. [[#ifdef WIN32
  99. #include <windows.h>
  100. #endif
  101. #if HAVE_GL_GL_H
  102. #include <GL/gl.h>
  103. #endif
  104. #if HAVE_GL_GLU_H
  105. #include <GL/glu.h>
  106. #endif
  107. ]])
  108. have_gl=no
  109. have_glu=no
  110. have_glut=no
  111. TEMP_LDFLAGS="$LDFLAGS"
  112. AC_CHECK_LIB(GL, main, [GL_LIBS="-lGL"; have_gl=yes])
  113. AC_CHECK_LIB(GLU, main, [GL_LIBS="-lGLU $GL_LIBS"; have_glu=yes], , -lGL)
  114. AC_CHECK_LIB(GLUT, main, [GL_LIBS="-lGLUT -LGLU $GL_LIBS"; have_glut=yes], ,-lGLUT)
  115. AC_CHECK_LIB(opengl32, main, [GL_LIBS="-lopengl32"; have_gl=yes])
  116. AC_CHECK_LIB(glu32, main, [GL_LIBS="-lglu32 $GL_LIBS"; have_glu=yes], , -lopengl32)
  117. LDFLAGS="$TEMP_LDFLAGS"
  118. if test $have_gl = no -o $have_glu = no -o $have_gl_headers = no; then
  119. if test x$enable_demos = xyes; then
  120. AC_MSG_WARN([Demos and Extras will not be built because OpenGL and GLUT doesn't seem to work. See `config.log' for details.])
  121. fi
  122. enable_demos=no
  123. else
  124. AC_MSG_NOTICE([Found OpenGL])
  125. fi
  126. ;;
  127. esac
  128. AC_SUBST(GL_LIBS)
  129. if test "x$enable_demos" != xno; then
  130. AC_MSG_NOTICE([Building Bullet demos])
  131. AM_CONDITIONAL([CONDITIONAL_BUILD_DEMOS],[true])
  132. fi
  133. AC_ARG_ENABLE([debug],
  134. [AC_HELP_STRING([--enable-debug],
  135. [build with debugging information (default NO)])],
  136. [], [enable_debug=no])
  137. AC_MSG_CHECKING([build mode])
  138. AS_IF([test $enable_debug = yes], [build_mode=debug], [build_mode=optimize])
  139. AC_MSG_RESULT([$build_mode])
  140. CFLAGS="$ARCH_SPECIFIC_CFLAGS $CFLAGS"
  141. CXXFLAGS="$ARCH_SPECIFIC_CFLAGS $CXXFLAGS $CFLAGS"
  142. #----------------------------------------------------------------------------
  143. # Emit generated files.
  144. #----------------------------------------------------------------------------
  145. AC_CONFIG_FILES([bullet.pc Makefile Demos/Makefile Demos/SoftDemo/Makefile Demos/AllBulletDemos/Makefile Demos/MultiThreadedDemo/Makefile Demos/OpenGL/Makefile Demos/BasicDemo/Makefile Demos/CcdPhysicsDemo/Makefile Demos/VehicleDemo/Makefile Demos/TerrainDemo/Makefile src/Makefile Extras/Makefile])
  146. AC_OUTPUT
  147. AC_MSG_NOTICE([
  148. Please type 'make' to build Bullet
  149. ])