configure.in 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. dnl Process this file with autoconf to produce a configure script.
  2. dnl Set various version strings - taken gratefully from the GTk sources
  3. AC_INIT([SDL2_ttf], [2.0.14])
  4. AC_CONFIG_SRCDIR([README.txt])
  5. # Making releases:
  6. # MICRO_VERSION += 1;
  7. # INTERFACE_AGE += 1;
  8. # BINARY_AGE += 1;
  9. # if any functions have been added, set INTERFACE_AGE to 0.
  10. # if backwards compatibility has been broken,
  11. # set BINARY_AGE and INTERFACE_AGE to 0.
  12. MAJOR_VERSION=2
  13. MINOR_VERSION=0
  14. MICRO_VERSION=14
  15. INTERFACE_AGE=0
  16. BINARY_AGE=14
  17. VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
  18. AC_SUBST(MAJOR_VERSION)
  19. AC_SUBST(MINOR_VERSION)
  20. AC_SUBST(MICRO_VERSION)
  21. AC_SUBST(INTERFACE_AGE)
  22. AC_SUBST(BINARY_AGE)
  23. AC_SUBST(VERSION)
  24. # libtool versioning
  25. LT_INIT([win32-dll])
  26. LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
  27. LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
  28. LT_REVISION=$INTERFACE_AGE
  29. LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
  30. AC_SUBST(LT_RELEASE)
  31. AC_SUBST(LT_CURRENT)
  32. AC_SUBST(LT_REVISION)
  33. AC_SUBST(LT_AGE)
  34. dnl Detect the canonical build and host environments
  35. AC_CANONICAL_HOST
  36. dnl Setup for automake
  37. AM_INIT_AUTOMAKE([foreign])
  38. AM_MAINTAINER_MODE
  39. dnl Check for tools
  40. AC_PROG_LIBTOOL
  41. AC_PROG_CC
  42. AC_PROG_INSTALL
  43. AC_PROG_MAKE_SET
  44. if test -z "$host_alias"; then
  45. hostaliaswindres=
  46. else
  47. hostaliaswindres="$host_alias-windres"
  48. fi
  49. AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres])
  50. case "$host" in
  51. *-*-cygwin* | *-*-mingw32*)
  52. ;;
  53. *)
  54. AC_FUNC_ALLOCA
  55. ;;
  56. esac
  57. case "$host" in
  58. *-*-beos*)
  59. ac_default_prefix=/boot/develop/tools/gnupro
  60. ;;
  61. *-*-cygwin* | *-*-mingw32*)
  62. if test "$build" != "$host"; then # cross-compiling
  63. # Default cross-compile location
  64. ac_default_prefix=/usr/local/cross-tools/$host
  65. else
  66. # Look for the location of the tools and install there
  67. if test "$BUILD_PREFIX" != ""; then
  68. ac_default_prefix=$BUILD_PREFIX
  69. fi
  70. fi
  71. if test x$WINDRES != x; then
  72. use_version_rc=true
  73. fi
  74. ;;
  75. esac
  76. AM_CONDITIONAL(USE_VERSION_RC, test x$use_version_rc = xtrue)
  77. dnl Check for the FreeType 2 library
  78. dnl
  79. dnl Get the cflags and libraries from the freetype-config script
  80. dnl
  81. AC_ARG_WITH(freetype-prefix,[ --with-freetype-prefix=PFX Prefix where FREETYPE is
  82. installed (optional)],
  83. freetype_prefix="$withval", freetype_prefix="")
  84. AC_ARG_WITH(freetype-exec-prefix,[ --with-freetype-exec-prefix=PFX Exec prefix
  85. where FREETYPE is installed (optional)],
  86. freetype_exec_prefix="$withval", freetype_exec_prefix="")
  87. if test x$freetype_exec_prefix != x ; then
  88. freetype_args="$freetype_args --exec-prefix=$freetype_exec_prefix"
  89. if test x${FREETYPE_CONFIG+set} != xset ; then
  90. FREETYPE_CONFIG=$freetype_exec_prefix/bin/freetype-config
  91. fi
  92. fi
  93. if test x$freetype_prefix != x ; then
  94. freetype_args="$freetype_args --prefix=$freetype_prefix"
  95. if test x${FREETYPE_CONFIG+set} != xset ; then
  96. FREETYPE_CONFIG=$freetype_prefix/bin/freetype-config
  97. fi
  98. fi
  99. AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
  100. no_freetype=""
  101. if test "$FREETYPE_CONFIG" = "no" ; then
  102. AC_MSG_ERROR([
  103. *** Unable to find FreeType2 library (http://www.freetype.org/)
  104. ])
  105. else
  106. CFLAGS="$CFLAGS `$FREETYPE_CONFIG $freetypeconf_args --cflags`"
  107. LIBS="$LIBS `$FREETYPE_CONFIG $freetypeconf_args --libs`"
  108. fi
  109. dnl Check for the Raqm
  110. AC_ARG_WITH(raqm,
  111. [AS_HELP_STRING([--with-raqm],
  112. [with complex text layout support])],
  113. [with_raqm=$withval],
  114. [with_with='yes'])
  115. have_raqm=""
  116. if test "x$with_raqm" != 'xno'; then
  117. PKG_CHECK_MODULES(RAQM, raqm, have_raqm="yes", [])
  118. fi
  119. if test "x$have_raqm" == "xyes"; then
  120. AC_DEFINE(HAVE_RAQM)
  121. CFLAGS="$CFLAGS $RAQM_CFLAGS"
  122. LIBS="$LIBS $RAQM_LIBS"
  123. fi
  124. AM_CONDITIONAL(HAVE_RAQM, test "x$have_raqm" == "xyes")
  125. dnl Check for SDL
  126. SDL_VERSION=2.0.0
  127. AC_SUBST(SDL_VERSION)
  128. AM_PATH_SDL2($SDL_VERSION,
  129. :,
  130. AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
  131. )
  132. CFLAGS="$CFLAGS $SDL_CFLAGS"
  133. LIBS="$LIBS $SDL_LIBS"
  134. dnl Check for OpenGL
  135. case "$host" in
  136. *-*-cygwin* | *-*-mingw32*)
  137. MATHLIB=""
  138. SYS_GL_LIBS="-lopengl32"
  139. ;;
  140. *-*-beos*)
  141. MATHLIB=""
  142. SYS_GL_LIBS="-lGL"
  143. ;;
  144. *-*-darwin*)
  145. MATHLIB=""
  146. SYS_GL_LIBS="-Wl,-framework,OpenGL"
  147. ;;
  148. *-*-aix*)
  149. if test x$ac_cv_prog_gcc = xyes; then
  150. CFLAGS="-mthreads"
  151. fi
  152. SYS_GL_LIBS=""
  153. ;;
  154. *)
  155. MATHLIB="-lm"
  156. AC_PATH_X
  157. AC_PATH_XTRA
  158. if test x$have_x = xyes; then
  159. CFLAGS="$CFLAGS $X_CFLAGS"
  160. SYS_GL_LIBS="$X_LIBS -lGL"
  161. else
  162. SYS_GL_LIBS="-lGL"
  163. fi
  164. ;;
  165. esac
  166. AC_MSG_CHECKING(for OpenGL support)
  167. have_opengl=no
  168. save_LIBS="$LIBS"
  169. LIBS="$LIBS $SYS_GL_LIBS"
  170. AC_TRY_LINK([
  171. #include "SDL_opengl.h"
  172. ],[
  173. glOrtho( -2.0, 2.0, -2.0, 2.0, -20.0, 20.0 );
  174. ],[
  175. have_opengl=yes
  176. ])
  177. AC_MSG_RESULT($have_opengl)
  178. LIBS="$save_LIBS"
  179. if test x$have_opengl = xyes; then
  180. CFLAGS="$CFLAGS -DHAVE_OPENGL"
  181. GL_LIBS="$SYS_GL_LIBS"
  182. else
  183. GL_LIBS=""
  184. fi
  185. AC_SUBST([GL_LIBS])
  186. AC_SUBST([MATHLIB])
  187. AC_SUBST([WINDRES])
  188. # Finally create all the generated files
  189. AC_OUTPUT([
  190. Makefile
  191. SDL2_ttf.spec
  192. SDL2_ttf.pc
  193. ])