1
0

configure.in 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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 (BeOS, 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. *-*-beos* | *-*-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 = 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 = x; then
  91. :
  92. else
  93. XPATH="-L$ac_x_libraries"
  94. XLIB="-L$ac_x_libraries -lX11"
  95. fi
  96. fi
  97. dnl Check for OpenGL
  98. AC_MSG_CHECKING(for OpenGL support)
  99. have_opengl=no
  100. AC_TRY_COMPILE([
  101. #include "SDL_opengl.h"
  102. ],[
  103. ],[
  104. have_opengl=yes
  105. ])
  106. AC_MSG_RESULT($have_opengl)
  107. dnl Check for OpenGL ES
  108. AC_MSG_CHECKING(for OpenGL ES support)
  109. have_opengles=no
  110. AC_TRY_COMPILE([
  111. #if defined (__IPHONEOS__)
  112. #include <OpenGLES/ES1/gl.h>
  113. #else
  114. #include <GLES/gl.h>
  115. #endif /* __QNXNTO__ */
  116. ],[
  117. ],[
  118. have_opengles=yes
  119. ])
  120. AC_MSG_RESULT($have_opengles)
  121. GLLIB=""
  122. if test x$have_opengles = xyes; then
  123. CFLAGS="$CFLAGS -DHAVE_OPENGLES"
  124. GLLIB="$XPATH -lGLESv1_CM"
  125. elif test x$have_opengl = xyes; then
  126. CFLAGS="$CFLAGS -DHAVE_OPENGL"
  127. GLLIB="$XPATH $SYS_GL_LIBS"
  128. else
  129. GLLIB=""
  130. fi
  131. AC_SUBST(GLLIB)
  132. AC_SUBST(XLIB)
  133. dnl Check for SDL_ttf
  134. AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes)
  135. if test x$have_SDL_ttf = xyes; then
  136. CFLAGS="$CFLAGS -DHAVE_SDL_TTF"
  137. SDL_TTF_LIB="-lSDL2_ttf"
  138. fi
  139. AC_SUBST(SDL_TTF_LIB)
  140. dnl Finally create all the generated files
  141. AC_OUTPUT([Makefile])