configure.ac 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. dnl ===========================================================================
  2. dnl "configure.in"
  3. dnl
  4. dnl current contact:
  5. dnl SuperTux development team
  6. dnl
  7. dnl original author:
  8. dnl Duong-Khang NGUYEN
  9. dnl neoneurone@users.sf.net
  10. dnl ===========================================================================
  11. dnl Process this file with autoconf to produce a configure script.
  12. AC_PREREQ([2.54])
  13. AC_INIT(SuperTux-Milestone1, 0.1.4)
  14. AC_CONFIG_SRCDIR([src/supertux.cpp])
  15. AC_CANONICAL_TARGET
  16. AM_INIT_AUTOMAKE(dist-bzip2)
  17. SDL_VERSION=1.2.4
  18. AC_PROG_CC
  19. AC_PROG_CXX
  20. AC_PROG_INSTALL
  21. dnl Checks for header files.
  22. AC_HEADER_DIRENT
  23. AC_HEADER_STDC
  24. AC_CHECK_HEADERS(unistd.h)
  25. dnl Checks for typedefs, structures, and compiler characteristics.
  26. AC_C_CONST
  27. dnl ===========================================================================
  28. dnl Give advanced users some options to play with
  29. AC_MSG_CHECKING(for gprof mode)
  30. AC_ARG_ENABLE(gprof,
  31. AC_HELP_STRING([--enable-gprof], [enable GNU profiling support]),
  32. [enable_gprof="$enableval"],
  33. [enable_gprof="no"])
  34. if test "x${enable_gprof}" != "xno"; then
  35. CXXFLAGS="$CXXFLAGS -pg"
  36. AC_MSG_RESULT([enabled])
  37. else
  38. AC_MSG_RESULT([disabled])
  39. fi
  40. AC_MSG_CHECKING(for debug mode)
  41. AC_ARG_ENABLE(debug,
  42. AC_HELP_STRING([--enable-debug], [enable debugging mode]),
  43. [enable_debug="$enableval"],
  44. [enable_debug="no"])
  45. if test "x${enable_debug}" != "xno"; then
  46. CXXFLAGS="$CXXFLAGS -Wall -W -DDEBUG -O0 -g3"
  47. AC_MSG_RESULT([enabled])
  48. else
  49. AC_MSG_RESULT([disabled])
  50. fi
  51. AC_MSG_CHECKING(wether OpenGL should be used)
  52. AC_ARG_ENABLE(opengl,
  53. AC_HELP_STRING([--disable-opengl], [disable OpenGL support]),, enable_opengl="yes")
  54. if test "x${enable_opengl}" != "xno"; then
  55. AC_MSG_RESULT([yes])
  56. else
  57. AC_MSG_RESULT([no])
  58. fi
  59. dnl ===========================================================================
  60. dnl Check for SDL
  61. PKG_CHECK_MODULES([SDL], [sdl >= $SDL_VERSION],,
  62. AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
  63. CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
  64. CFLAGS="$CFLAGS $SDL_CFLAGS"
  65. LIBS="$LIBS $SDL_LIBS"
  66. dnl Checks for additional libraries.
  67. #AC_CHECK_LIB(smpeg, SMPEG_status)
  68. AC_ARG_ENABLE(silence,
  69. [ --enable-silence no sound [default=no]],
  70. , enable_silence=no)
  71. if test x$enable_silence = xyes; then
  72. CXXFLAGS="$CXXFLAGS -DNOSOUND"
  73. else
  74. PKG_CHECK_MODULES([SDL_MIXER], [SDL_mixer], ,
  75. AC_MSG_ERROR([SDL_mixer library required]))
  76. CXXFLAGS="$CXXFLAGS $SDL_MIXER_CFLAGS"
  77. CFLAGS="$CFLAGS $SDL_MIXER_CFLAGS"
  78. LIBS="$LIBS $SDL_MIXER_LIBS"
  79. AC_DEFINE(HAVE_SOUND, 1, [Compile with sound support])
  80. fi
  81. AM_CONDITIONAL(HAVE_SOUND, test "x$enable_silence" != "xyes")
  82. # compile for the gp2x
  83. AC_ARG_ENABLE(gp2x,
  84. [ --enable-gp2x Build the gp2x version [default=no]],
  85. , enable_gp2x=no)
  86. if test x$enable_gp2x = xyes; then
  87. CXXFLAGS="$CXXFLAGS -DGP2X"
  88. if test x$enable_silence = xno; then
  89. AM_PATH_LIBMIKMOD(,:,AC_MSG_ERROR([*** mikmod not found!]))
  90. CXXFLAGS="$CXXFLAGS $LIBMIKMOD_CFLAGS"
  91. CFLAGS="$CFLAGS $LIBMIKMOD_CFLAGS"
  92. LIBS="$LIBS $LIBMIKMOD_LIBS"
  93. AC_CHECK_LIB(mikmod, MikMod_Init)
  94. fi
  95. AC_CHECK_LIB(SDL_gfx, rotozoomSurface,,
  96. AC_MSG_ERROR([SDL_gfx library required]))
  97. fi
  98. # compile for the testing the 320x240 resolution
  99. AC_ARG_ENABLE(320x240,
  100. [ --enable-320x240 Test the 320x240 resolution [default=no]],
  101. , enable_320x240=no)
  102. if test x$enable_320x240 = xyes; then
  103. CXXFLAGS="$CXXFLAGS -DRES320X240"
  104. fi
  105. # Enable touchscreen controls
  106. AC_ARG_ENABLE(touchscreen,
  107. [ --enable-touchscreen Touchscreen Controls [default=no]],
  108. , enable_touchscreen=no)
  109. if test x$enable_touchscreen = xyes; then
  110. CXXFLAGS="$CXXFLAGS -DTSCONTROL"
  111. fi
  112. AC_CHECK_LIB(jpeg,jpeg_abort)
  113. AC_CHECK_LIB(png,png_free)
  114. PKG_CHECK_MODULES([SDL_IMAGE], [SDL_image], ,
  115. AC_MSG_ERROR([SDL_image library required]))
  116. CXXFLAGS="$CXXFLAGS $SDL_IMAGE_CFLAGS"
  117. CFLAGS="$CFLAGS $SDL_IMAGE_CFLAGS"
  118. LIBS="$LIBS $SDL_IMAGE_LIBS"
  119. if test "x${enable_opengl}" != "xno"; then
  120. AX_CHECK_GL
  121. fi
  122. if test "x$no_gl" = "xyes" -o "x$enable_opengl" = "xno"; then
  123. CXXFLAGS="$CXXFLAGS -DNOOPENGL"
  124. enable_opengl="no"
  125. else
  126. CFLAGS="$CFLAGS $GL_CFLAGS"
  127. CXXFLAGS="$CXXFLAGS $GL_CFLAGS"
  128. LIBS="$LIBS $GL_LIBS"
  129. fi
  130. AC_CHECK_LIB(z, gzopen,, AC_MSG_ERROR([*** zlib is missing]))
  131. # compile static
  132. AC_ARG_ENABLE(static,
  133. [ --enable-static Build the static version [default=no]],
  134. , enable_static=no)
  135. if test x$enable_static = xyes; then
  136. CXXFLAGS="$CXXFLAGS -static"
  137. fi
  138. CXXFLAGS="$CXXFLAGS -DDATA_PREFIX='\"$datadir/supertux-milestone1\"'"
  139. dnl Checks for library functions.
  140. AC_CHECK_FUNCS(mkdir strdup strstr)
  141. AC_OUTPUT(Makefile src/Makefile data/Makefile)
  142. echo ""
  143. echo "Features:"
  144. echo "========="
  145. echo " Profile Mode: $enable_gprof"
  146. echo " Debug Mode: $enable_debug"
  147. echo " OpenGL Support: $enable_opengl"
  148. echo " 320x240: $enable_320x240"
  149. echo " GP2X Build: $enable_gp2x"
  150. echo " Static Build: $enable_static"
  151. echo " Silence: $enable_silence"
  152. echo " Touchscreen: $enable_touchscreen"
  153. echo ""
  154. # EOF #