configure.in 4.0 KB

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