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

215 lines
5.3 KiB

  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_INIT
  3. AC_CONFIG_SRCDIR([loopwave.c])
  4. dnl Detect the canonical build and host environments
  5. AC_CONFIG_AUX_DIR([../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. ISOS2="false"
  18. dnl Figure out which math library to use
  19. case "$host" in
  20. *-*-cygwin* | *-*-mingw*)
  21. ISWINDOWS="true"
  22. EXE=".exe"
  23. MATHLIB=""
  24. SYS_GL_LIBS="-lopengl32"
  25. ;;
  26. *-*-haiku*)
  27. EXE=""
  28. MATHLIB=""
  29. SYS_GL_LIBS="-lGL"
  30. ;;
  31. *-*-darwin*)
  32. ISMACOSX="true"
  33. EXE=""
  34. MATHLIB=""
  35. SYS_GL_LIBS="-Wl,-framework,OpenGL"
  36. ;;
  37. *-*-aix*)
  38. ISUNIX="true"
  39. EXE=""
  40. if test x$ac_cv_c_compiler_gnu = xyes; then
  41. CFLAGS="-mthreads"
  42. fi
  43. SYS_GL_LIBS=""
  44. ;;
  45. *-*-mint*)
  46. EXE=""
  47. MATHLIB=""
  48. AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
  49. if test "x$OSMESA_CONFIG" = "xyes"; then
  50. OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
  51. OSMESA_LIBS=`$OSMESA_CONFIG --libs`
  52. CFLAGS="$CFLAGS $OSMESA_CFLAGS"
  53. SYS_GL_LIBS="$OSMESA_LIBS"
  54. else
  55. SYS_GL_LIBS="-lOSMesa"
  56. fi
  57. ;;
  58. *-*-qnx*)
  59. EXE=""
  60. MATHLIB=""
  61. SYS_GL_LIBS="-lGLES_CM"
  62. ;;
  63. *-*-emscripten*)
  64. dnl This should really be .js, but we need to specify extra flags when compiling to js
  65. EXE=".bc"
  66. MATHLIB=""
  67. SYS_GL_LIBS=""
  68. ;;
  69. *-*-riscos*)
  70. EXE=",e1f"
  71. MATHLIB=""
  72. SYS_GL_LIBS=""
  73. ;;
  74. *-*-os2*)
  75. ISOS2="true"
  76. EXE=".exe"
  77. MATHLIB=""
  78. SYS_GL_LIBS=""
  79. ;;
  80. *)
  81. dnl Oh well, call it Unix...
  82. ISUNIX="true"
  83. EXE=""
  84. MATHLIB="-lm"
  85. dnl Use the new libOpenGL if present.
  86. AC_CHECK_LIB(OpenGL, glBegin,
  87. [SYS_GL_LIBS="-lOpenGL"],[SYS_GL_LIBS="-lGL"])
  88. ;;
  89. esac
  90. AC_SUBST(EXE)
  91. AC_SUBST(MATHLIB)
  92. AC_SUBST(ISMACOSX)
  93. AC_SUBST(ISWINDOWS)
  94. AC_SUBST(ISUNIX)
  95. AC_SUBST(ISOS2)
  96. dnl Check for SDL
  97. SDL_VERSION=2.0.18
  98. AM_PATH_SDL2($SDL_VERSION,
  99. :,
  100. AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
  101. )
  102. CFLAGS="$CFLAGS $SDL_CFLAGS"
  103. LIBS="$LIBS -lSDL2_test $SDL_LIBS"
  104. dnl Check for X11 path, needed for OpenGL on some systems
  105. AC_PATH_X
  106. if test x$have_x = xyes; then
  107. if test x$ac_x_includes = xno || test "x$ac_x_includes" = xNone || test "x$ac_x_includes" = x; then
  108. :
  109. else
  110. CFLAGS="$CFLAGS -I$ac_x_includes"
  111. fi
  112. if test x$ac_x_libraries = xno || test "x$ac_x_libraries" = xNone; then
  113. :
  114. else
  115. if test "x$ac_x_libraries" = x; then
  116. XPATH=""
  117. XLIB="-lX11"
  118. else
  119. XPATH="-L$ac_x_libraries"
  120. XLIB="-L$ac_x_libraries -lX11"
  121. fi
  122. fi
  123. fi
  124. dnl Check for OpenGL
  125. AC_MSG_CHECKING(for OpenGL support)
  126. have_opengl=no
  127. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  128. #include "SDL_opengl.h"
  129. #ifndef SDL_VIDEO_OPENGL
  130. #error SDL_VIDEO_OPENGL
  131. #endif
  132. ]],[])], [have_opengl=yes],[])
  133. AC_MSG_RESULT($have_opengl)
  134. dnl Check for OpenGL ES
  135. AC_MSG_CHECKING(for OpenGL ES support)
  136. have_opengles=no
  137. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  138. #include "SDL_opengles.h"
  139. #ifndef SDL_VIDEO_OPENGL_ES
  140. #error SDL_VIDEO_OPENGL_ES
  141. #endif
  142. ]],[])] ,[have_opengles=yes],[])
  143. AC_MSG_RESULT($have_opengles)
  144. dnl Check for OpenGL ES2
  145. AC_MSG_CHECKING(for OpenGL ES2 support)
  146. have_opengles2=no
  147. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  148. #include "SDL_opengles2.h"
  149. #ifndef SDL_VIDEO_OPENGL_ES2
  150. #error SDL_VIDEO_OPENGL_ES2
  151. #endif
  152. ]],[])], [have_opengles2=yes],[])
  153. AC_MSG_RESULT($have_opengles2)
  154. GLLIB=""
  155. GLESLIB=""
  156. GLES2LIB=""
  157. OPENGLES1_TARGETS="UNUSED"
  158. OPENGLES2_TARGETS="UNUSED"
  159. OPENGL_TARGETS="UNUSED"
  160. if test x$have_opengles = xyes; then
  161. CFLAGS="$CFLAGS -DHAVE_OPENGLES"
  162. GLESLIB="$XPATH -lGLESv1_CM"
  163. OPENGLES1_TARGETS="TARGETS"
  164. fi
  165. if test x$have_opengles2 = xyes; then
  166. CFLAGS="$CFLAGS -DHAVE_OPENGLES2"
  167. #GLES2LIB="$XPATH -lGLESv2"
  168. OPENGLES2_TARGETS="TARGETS"
  169. fi
  170. if test x$have_opengl = xyes; then
  171. CFLAGS="$CFLAGS -DHAVE_OPENGL"
  172. GLLIB="$XPATH $SYS_GL_LIBS"
  173. OPENGL_TARGETS="TARGETS"
  174. fi
  175. AC_SUBST(OPENGLES1_TARGETS)
  176. AC_SUBST(OPENGLES2_TARGETS)
  177. AC_SUBST(OPENGL_TARGETS)
  178. AC_SUBST(GLLIB)
  179. AC_SUBST(GLESLIB)
  180. AC_SUBST(GLES2LIB)
  181. AC_SUBST(XLIB)
  182. dnl Check for SDL_ttf
  183. AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes)
  184. if test x$have_SDL_ttf = xyes; then
  185. CFLAGS="$CFLAGS -DHAVE_SDL_TTF"
  186. SDL_TTF_LIB="-lSDL2_ttf"
  187. fi
  188. AC_SUBST(SDL_TTF_LIB)
  189. dnl Really, SDL2_test should be linking against libunwind (if it found
  190. dnl libunwind.h when configured), but SDL2_test is a static library, so
  191. dnl there's no way for it to link against it. We could make SDL2 depend on
  192. dnl it, but we don't want all SDL2 build to suddenly gain an extra dependency,
  193. dnl so just assume that if it's here now, SDL2_test was probably built with it.
  194. PKG_CHECK_MODULES(LIBUNWIND, libunwind, have_libunwind=yes, have_libunwind=no)
  195. if test x$have_libunwind = xyes ; then
  196. LIBS="$LIBS $LIBUNWIND_LIBS"
  197. fi
  198. dnl Finally create all the generated files
  199. AC_CONFIG_FILES([Makefile])
  200. AC_OUTPUT