1
0

configure.ac 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_INIT
  3. AC_CONFIG_SRCDIR([README])
  4. dnl Detect the canonical build and host environments
  5. AC_CONFIG_AUX_DIRS($srcdir/../build-scripts)
  6. AC_CANONICAL_HOST
  7. dnl Check for tools
  8. AC_PROG_CC
  9. dnl Check for compiler environment
  10. AC_C_CONST
  11. dnl We only care about this for building testnative at the moment, so these
  12. dnl values shouldn't be considered absolute truth.
  13. dnl (Haiku, for example, sets none of these.)
  14. ISUNIX="false"
  15. ISWINDOWS="false"
  16. ISMACOSX="false"
  17. dnl Figure out which math library to use
  18. case "$host" in
  19. *-*-cygwin* | *-*-mingw32*)
  20. ISWINDOWS="true"
  21. EXE=".exe"
  22. MATHLIB=""
  23. SYS_GL_LIBS="-lopengl32"
  24. ;;
  25. *-*-haiku*)
  26. EXE=""
  27. MATHLIB=""
  28. SYS_GL_LIBS="-lGL"
  29. ;;
  30. *-*-darwin* )
  31. ISMACOSX="true"
  32. EXE=""
  33. MATHLIB=""
  34. SYS_GL_LIBS="-Wl,-framework,OpenGL"
  35. ;;
  36. *-*-aix*)
  37. ISUNIX="true"
  38. EXE=""
  39. if test x$ac_cv_c_compiler_gnu = xyes; then
  40. CFLAGS="-mthreads"
  41. fi
  42. SYS_GL_LIBS=""
  43. ;;
  44. *-*-mint*)
  45. EXE=""
  46. MATHLIB=""
  47. AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
  48. if test "x$OSMESA_CONFIG" = "xyes"; then
  49. OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
  50. OSMESA_LIBS=`$OSMESA_CONFIG --libs`
  51. CFLAGS="$CFLAGS $OSMESA_CFLAGS"
  52. SYS_GL_LIBS="$OSMESA_LIBS"
  53. else
  54. SYS_GL_LIBS="-lOSMesa"
  55. fi
  56. ;;
  57. *-*-qnx*)
  58. EXE=""
  59. MATHLIB=""
  60. SYS_GL_LIBS="-lGLES_CM"
  61. ;;
  62. *-*-emscripten* )
  63. dnl This should really be .js, but we need to specify extra flags when compiling to js
  64. EXE=".bc"
  65. MATHLIB=""
  66. SYS_GL_LIBS=""
  67. ;;
  68. *-*-riscos* )
  69. EXE=",e1f"
  70. MATHLIB=""
  71. SYS_GL_LIBS=""
  72. ;;
  73. *)
  74. dnl Oh well, call it Unix...
  75. ISUNIX="true"
  76. EXE=""
  77. MATHLIB="-lm"
  78. SYS_GL_LIBS="-lGL"
  79. ;;
  80. esac
  81. AC_SUBST(EXE)
  82. AC_SUBST(MATHLIB)
  83. AC_SUBST(ISMACOSX)
  84. AC_SUBST(ISWINDOWS)
  85. AC_SUBST(ISUNIX)
  86. dnl Check for SDL
  87. SDL_VERSION=2.0.0
  88. AM_PATH_SDL2($SDL_VERSION,
  89. :,
  90. AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
  91. )
  92. CFLAGS="$CFLAGS $SDL_CFLAGS"
  93. LIBS="$LIBS -lSDL2_test $SDL_LIBS"
  94. dnl Check for X11 path, needed for OpenGL on some systems
  95. AC_PATH_X
  96. if test x$have_x = xyes; then
  97. if test x$ac_x_includes = xno || test "x$ac_x_includes" = xNone || test "x$ac_x_includes" = x; then
  98. :
  99. else
  100. CFLAGS="$CFLAGS -I$ac_x_includes"
  101. fi
  102. if test x$ac_x_libraries = xno || test "x$ac_x_libraries" = xNone; then
  103. :
  104. else
  105. if test "x$ac_x_libraries" = x; then
  106. XPATH=""
  107. XLIB="-lX11"
  108. else
  109. XPATH="-L$ac_x_libraries"
  110. XLIB="-L$ac_x_libraries -lX11"
  111. fi
  112. fi
  113. fi
  114. dnl Check for OpenGL
  115. AC_MSG_CHECKING(for OpenGL support)
  116. have_opengl=no
  117. AC_TRY_COMPILE([
  118. #include "SDL_opengl.h"
  119. #ifndef SDL_VIDEO_OPENGL
  120. #error SDL_VIDEO_OPENGL
  121. #endif
  122. ],[
  123. ],[
  124. have_opengl=yes
  125. ])
  126. AC_MSG_RESULT($have_opengl)
  127. dnl Check for OpenGL ES
  128. AC_MSG_CHECKING(for OpenGL ES support)
  129. have_opengles=no
  130. AC_TRY_COMPILE([
  131. #include "SDL_opengles.h"
  132. #ifndef SDL_VIDEO_OPENGL_ES
  133. #error SDL_VIDEO_OPENGL_ES
  134. #endif
  135. ],[
  136. ],[
  137. have_opengles=yes
  138. ])
  139. AC_MSG_RESULT($have_opengles)
  140. dnl Check for OpenGL ES2
  141. AC_MSG_CHECKING(for OpenGL ES2 support)
  142. have_opengles2=no
  143. AC_TRY_COMPILE([
  144. #include "SDL_opengles2.h"
  145. #ifndef SDL_VIDEO_OPENGL_ES2
  146. #error SDL_VIDEO_OPENGL_ES2
  147. #endif
  148. ],[
  149. ],[
  150. have_opengles2=yes
  151. ])
  152. AC_MSG_RESULT($have_opengles2)
  153. GLLIB=""
  154. GLESLIB=""
  155. GLES2LIB=""
  156. OPENGLES1_TARGETS="UNUSED"
  157. OPENGLES2_TARGETS="UNUSED"
  158. OPENGL_TARGETS="UNUSED"
  159. if test x$have_opengles = xyes; then
  160. CFLAGS="$CFLAGS -DHAVE_OPENGLES"
  161. GLESLIB="$XPATH -lGLESv1_CM"
  162. OPENGLES1_TARGETS="TARGETS"
  163. fi
  164. if test x$have_opengles2 = xyes; then
  165. CFLAGS="$CFLAGS -DHAVE_OPENGLES2"
  166. #GLES2LIB="$XPATH -lGLESv2"
  167. OPENGLES2_TARGETS="TARGETS"
  168. fi
  169. if test x$have_opengl = xyes; then
  170. CFLAGS="$CFLAGS -DHAVE_OPENGL"
  171. GLLIB="$XPATH $SYS_GL_LIBS"
  172. OPENGL_TARGETS="TARGETS"
  173. fi
  174. AC_SUBST(OPENGLES1_TARGETS)
  175. AC_SUBST(OPENGLES2_TARGETS)
  176. AC_SUBST(OPENGL_TARGETS)
  177. AC_SUBST(GLLIB)
  178. AC_SUBST(GLESLIB)
  179. AC_SUBST(GLES2LIB)
  180. AC_SUBST(XLIB)
  181. dnl Check for SDL_ttf
  182. AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes)
  183. if test x$have_SDL_ttf = xyes; then
  184. CFLAGS="$CFLAGS -DHAVE_SDL_TTF"
  185. SDL_TTF_LIB="-lSDL2_ttf"
  186. fi
  187. AC_SUBST(SDL_TTF_LIB)
  188. dnl Finally create all the generated files
  189. AC_CONFIG_FILES([Makefile])
  190. AC_OUTPUT