🛠️🐜 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.

200 lines
4.4 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. *)
  68. dnl Oh well, call it Unix...
  69. ISUNIX="true"
  70. EXE=""
  71. MATHLIB="-lm"
  72. SYS_GL_LIBS="-lGL"
  73. ;;
  74. esac
  75. AC_SUBST(EXE)
  76. AC_SUBST(MATHLIB)
  77. AC_SUBST(ISMACOSX)
  78. AC_SUBST(ISWINDOWS)
  79. AC_SUBST(ISUNIX)
  80. dnl Check for SDL
  81. SDL_VERSION=2.0.0
  82. AM_PATH_SDL2($SDL_VERSION,
  83. :,
  84. AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
  85. )
  86. CFLAGS="$CFLAGS $SDL_CFLAGS"
  87. LIBS="$LIBS -lSDL2_test $SDL_LIBS"
  88. dnl Check for X11 path, needed for OpenGL on some systems
  89. AC_PATH_X
  90. if test x$have_x = xyes; then
  91. if test x$ac_x_includes = xno || test "x$ac_x_includes" = xNone || test "x$ac_x_includes" = x; then
  92. :
  93. else
  94. CFLAGS="$CFLAGS -I$ac_x_includes"
  95. fi
  96. if test x$ac_x_libraries = xno || test "x$ac_x_libraries" = xNone; then
  97. :
  98. else
  99. if test "x$ac_x_libraries" = x; then
  100. XPATH=""
  101. XLIB="-lX11"
  102. else
  103. XPATH="-L$ac_x_libraries"
  104. XLIB="-L$ac_x_libraries -lX11"
  105. fi
  106. fi
  107. fi
  108. dnl Check for OpenGL
  109. AC_MSG_CHECKING(for OpenGL support)
  110. have_opengl=no
  111. AC_TRY_COMPILE([
  112. #include "SDL_opengl.h"
  113. ],[
  114. ],[
  115. have_opengl=yes
  116. ])
  117. AC_MSG_RESULT($have_opengl)
  118. dnl Check for OpenGL ES
  119. AC_MSG_CHECKING(for OpenGL ES support)
  120. have_opengles=no
  121. AC_TRY_COMPILE([
  122. #if defined (__IPHONEOS__)
  123. #include <OpenGLES/ES1/gl.h>
  124. #else
  125. #include <GLES/gl.h>
  126. #endif /* __QNXNTO__ */
  127. ],[
  128. ],[
  129. have_opengles=yes
  130. ])
  131. AC_MSG_RESULT($have_opengles)
  132. dnl Check for OpenGL ES2
  133. AC_MSG_CHECKING(for OpenGL ES2 support)
  134. have_opengles2=no
  135. AC_TRY_COMPILE([
  136. #if defined (__IPHONEOS__)
  137. #include <OpenGLES/ES2/gl.h>
  138. #include <OpenGLES/ES2/glext.h>
  139. #else
  140. #include <GLES2/gl2.h>
  141. #include <GLES2/gl2ext.h>
  142. #endif
  143. ],[
  144. ],[
  145. have_opengles2=yes
  146. ])
  147. AC_MSG_RESULT($have_opengles2)
  148. GLLIB=""
  149. GLESLIB=""
  150. GLES2LIB=""
  151. OPENGLES1_TARGETS="UNUSED"
  152. OPENGLES2_TARGETS="UNUSED"
  153. OPENGL_TARGETS="UNUSED"
  154. if test x$have_opengles = xyes; then
  155. CFLAGS="$CFLAGS -DHAVE_OPENGLES"
  156. GLESLIB="$XPATH -lGLESv1_CM"
  157. OPENGLES1_TARGETS="TARGETS"
  158. fi
  159. if test x$have_opengles2 = xyes; then
  160. CFLAGS="$CFLAGS -DHAVE_OPENGLES2"
  161. #GLES2LIB="$XPATH -lGLESv2"
  162. OPENGLES2_TARGETS="TARGETS"
  163. fi
  164. if test x$have_opengl = xyes; then
  165. CFLAGS="$CFLAGS -DHAVE_OPENGL"
  166. GLLIB="$XPATH $SYS_GL_LIBS"
  167. OPENGL_TARGETS="TARGETS"
  168. fi
  169. AC_SUBST(OPENGLES1_TARGETS)
  170. AC_SUBST(OPENGLES2_TARGETS)
  171. AC_SUBST(OPENGL_TARGETS)
  172. AC_SUBST(GLLIB)
  173. AC_SUBST(GLESLIB)
  174. AC_SUBST(GLES2LIB)
  175. AC_SUBST(XLIB)
  176. dnl Check for SDL_ttf
  177. AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes)
  178. if test x$have_SDL_ttf = xyes; then
  179. CFLAGS="$CFLAGS -DHAVE_SDL_TTF"
  180. SDL_TTF_LIB="-lSDL2_ttf"
  181. fi
  182. AC_SUBST(SDL_TTF_LIB)
  183. dnl Finally create all the generated files
  184. AC_OUTPUT([Makefile])