🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

204 lines
4.5 KiB

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