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

289 lines
7.6 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_MSG_CHECKING(for GCC -Wformat)
  176. have_wformat=no
  177. save_CFLAGS="$CFLAGS"
  178. CFLAGS="$save_CFLAGS -Wformat"
  179. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int x = 0;]],[])],
  180. [have_wformat=yes], [])
  181. AC_MSG_RESULT($have_wformat)
  182. CFLAGS="$save_CFLAGS"
  183. if test x$have_wformat = xyes; then
  184. CFLAGS="$CFLAGS -DHAVE_WFORMAT"
  185. fi
  186. AC_MSG_CHECKING(for GCC -Wformat-overflow)
  187. have_wformat_overflow=no
  188. save_CFLAGS="$CFLAGS"
  189. CFLAGS="$save_CFLAGS -Wformat-overflow"
  190. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int x = 0;]],[])],
  191. [have_wformat_overflow=yes], [])
  192. AC_MSG_RESULT($have_wformat_overflow)
  193. CFLAGS="$save_CFLAGS"
  194. if test x$have_wformat_overflow = xyes; then
  195. CFLAGS="$CFLAGS -DHAVE_WFORMAT_OVERFLOW"
  196. fi
  197. AC_MSG_CHECKING(for GCC -Wformat-extra-args)
  198. have_wformat_extra_args=no
  199. save_CFLAGS="$CFLAGS"
  200. CFLAGS="$save_CFLAGS -Wformat-extra-args"
  201. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int x = 0;]],[])],
  202. [have_wformat_extra_args=yes], [])
  203. AC_MSG_RESULT($have_wformat_extra_args)
  204. CFLAGS="$save_CFLAGS"
  205. if test x$have_wformat_extra_args = xyes; then
  206. CFLAGS="$CFLAGS -DHAVE_WFORMAT_EXTRA_ARGS"
  207. fi
  208. AC_ARG_ENABLE(werror,
  209. [AS_HELP_STRING([--enable-werror], [treat warnings as errors [default=no]])],
  210. enable_werror=$enableval, enable_werror=no)
  211. if test x$enable_werror = xyes; then
  212. AC_MSG_CHECKING(for GCC -Werror option)
  213. have_gcc_werror=no
  214. save_CFLAGS="$CFLAGS"
  215. CFLAGS="$save_CFLAGS -Werror"
  216. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int x = 0;]],[])],
  217. [have_gcc_werror=yes], [])
  218. AC_MSG_RESULT($have_gcc_werror)
  219. CFLAGS="$save_CFLAGS"
  220. if test x$have_gcc_werror = xyes; then
  221. CFLAGS="$CFLAGS -Werror"
  222. fi
  223. fi
  224. case "$host" in
  225. *-ios-*|*-*-darwin* )
  226. AC_MSG_CHECKING(for GCC -Wno-error=deprecated-declarations option)
  227. have_gcc_wno_error_deprecated_declarations=no
  228. save_CFLAGS="$CFLAGS"
  229. CFLAGS="$save_CFLAGS -Wno-error=deprecated-declarations"
  230. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  231. int x = 0;
  232. ]],[])], [have_gcc_wno_error_deprecated_declarations=yes],[])
  233. AC_MSG_RESULT($have_gcc_werror)
  234. CFLAGS="$save_CFLAGS"
  235. if test x$have_gcc_wno_error_deprecated_declarations = xyes; then
  236. EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-error=deprecated-declarations"
  237. fi
  238. ;;
  239. esac
  240. AC_SUBST(OPENGLES1_TARGETS)
  241. AC_SUBST(OPENGLES2_TARGETS)
  242. AC_SUBST(OPENGL_TARGETS)
  243. AC_SUBST(GLLIB)
  244. AC_SUBST(GLESLIB)
  245. AC_SUBST(GLES2LIB)
  246. AC_SUBST(XLIB)
  247. dnl Check for SDL_ttf
  248. AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes)
  249. if test x$have_SDL_ttf = xyes; then
  250. CFLAGS="$CFLAGS -DHAVE_SDL_TTF"
  251. SDL_TTF_LIB="-lSDL2_ttf"
  252. fi
  253. AC_SUBST(SDL_TTF_LIB)
  254. dnl Really, SDL2_test should be linking against libunwind (if it found
  255. dnl libunwind.h when configured), but SDL2_test is a static library, so
  256. dnl there's no way for it to link against it. We could make SDL2 depend on
  257. dnl it, but we don't want all SDL2 build to suddenly gain an extra dependency,
  258. dnl so just assume that if it's here now, SDL2_test was probably built with it.
  259. PKG_CHECK_MODULES(LIBUNWIND, libunwind, have_libunwind=yes, have_libunwind=no)
  260. if test x$have_libunwind = xyes ; then
  261. LIBS="$LIBS $LIBUNWIND_LIBS"
  262. fi
  263. dnl Finally create all the generated files
  264. AC_CONFIG_FILES([Makefile])
  265. AC_OUTPUT