configure.in 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. # Process this file with autoconf to produce a configure script.
  2. AC_INIT(physfs.c)
  3. dnl ---------------------------------------------------------------------
  4. dnl System/version info
  5. dnl ---------------------------------------------------------------------
  6. # Making releases:
  7. # MICRO_VERSION += 1;
  8. # INTERFACE_AGE += 1;
  9. # BINARY_AGE += 1;
  10. # if any functions have been added, set INTERFACE_AGE to 0.
  11. # if backwards compatibility has been broken,
  12. # set BINARY_AGE and INTERFACE_AGE to 0.
  13. MAJOR_VERSION=0
  14. MINOR_VERSION=1
  15. MICRO_VERSION=6
  16. INTERFACE_AGE=0
  17. BINARY_AGE=0
  18. VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
  19. AC_SUBST(MAJOR_VERSION)
  20. AC_SUBST(MINOR_VERSION)
  21. AC_SUBST(MICRO_VERSION)
  22. AC_SUBST(INTERFACE_AGE)
  23. AC_SUBST(BINARY_AGE)
  24. AC_SUBST(VERSION)
  25. # libtool versioning
  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 host and target build environment
  35. AC_CANONICAL_HOST
  36. AC_CANONICAL_TARGET
  37. dnl Setup for automake
  38. AM_CONFIG_HEADER(config.h)
  39. AM_INIT_AUTOMAKE(physfs, $VERSION)
  40. dnl ---------------------------------------------------------------------
  41. dnl Compilers and other tools
  42. dnl ---------------------------------------------------------------------
  43. AC_PROG_CC
  44. AC_PROG_CXX
  45. AC_PROG_INSTALL
  46. AC_PROG_LN_S
  47. AC_PROG_LIBTOOL
  48. dnl ---------------------------------------------------------------------
  49. dnl Debug mode?
  50. dnl ---------------------------------------------------------------------
  51. AC_ARG_ENABLE(debug,
  52. [ --enable-debug enable debug mode [default=yes]],
  53. , enable_debug=yes)
  54. if test x$enable_debug = xyes; then
  55. if test x$ac_cv_prog_cc_g = xyes; then
  56. CFLAGS="-g -O0"
  57. else
  58. CFLAGS="-O0"
  59. fi
  60. CFLAGS="$CFLAGS -Werror -Wall"
  61. AC_DEFINE(DEBUG)
  62. AC_DEFINE(DEBUG_CHATTER)
  63. else
  64. CFLAGS="-O2"
  65. AC_DEFINE(NDEBUG)
  66. fi
  67. dnl ---------------------------------------------------------------------
  68. dnl Build test program?
  69. dnl ---------------------------------------------------------------------
  70. AC_ARG_ENABLE(testprog,
  71. [ --enable-testprog build test program [default=yes]],
  72. , enable_testprog=yes)
  73. dnl ---------------------------------------------------------------------
  74. dnl Checks for libraries.
  75. dnl ---------------------------------------------------------------------
  76. dnl !!! FIXME: Not sure how to detect this...
  77. dnl check for 64-bit llseek()...
  78. dnl AC_CHECK_LIB(c, llseek, have_llseek=yes)
  79. if test x$have_llseek = xyes; then
  80. AC_DEFINE(PHYSFS_HAVE_LLSEEK)
  81. fi
  82. require_zlib="no"
  83. dnl Check for zip archiver inclusion...
  84. AC_ARG_ENABLE(zip,
  85. [ --enable-zip enable ZIP support [default=yes]],
  86. , enable_zip=yes)
  87. if test x$enable_zip = xyes; then
  88. AC_DEFINE(PHYSFS_SUPPORTS_ZIP)
  89. require_zlib="yes"
  90. fi
  91. dnl Check for zip archiver inclusion...
  92. AC_ARG_ENABLE(grp,
  93. [ --enable-grp enable Build Engine GRP support [default=yes]],
  94. , enable_grp=yes)
  95. if test x$enable_grp = xyes; then
  96. AC_DEFINE(PHYSFS_SUPPORTS_GRP)
  97. fi
  98. AC_ARG_ENABLE(internal-zlib,
  99. [ --enable-internal-zlib use included zlib [default=only if needed]],
  100. , enable_internal_zlib=maybe)
  101. dnl Check for zlib if needed.
  102. have_external_zlib="no"
  103. if test x$enable_internal_zlib != xyes; then
  104. if test x$require_zlib = xyes; then
  105. AC_CHECK_HEADER(zlib.h, have_zlib_hdr=yes)
  106. AC_CHECK_LIB(z, zlibVersion, have_zlib_lib=yes)
  107. if test x$have_zlib_hdr = xyes -a x$have_zlib_lib = xyes; then
  108. have_external_zlib="yes"
  109. fi
  110. fi
  111. fi
  112. AC_MSG_CHECKING([what zlib to use])
  113. dnl no zlib is needed at all if we aren't supporting ZIP files.
  114. if test x$require_zlib = xno; then
  115. enable_internal_zlib="no"
  116. enable_external_zlib="no"
  117. AC_MSG_RESULT([no zlib needed])
  118. else
  119. if test x$enable_internal_zlib = xmaybe; then
  120. if test x$have_external_zlib = xyes; then
  121. enable_internal_zlib="no"
  122. enable_external_zlib="yes"
  123. else
  124. enable_internal_zlib="yes"
  125. enable_external_zlib="no"
  126. fi
  127. else
  128. if test x$enable_internal_zlib = xno -a x$have_external_zlib = xyes; then
  129. enable_internal_zlib="no"
  130. enable_external_zlib="yes"
  131. fi
  132. fi
  133. if test x$enable_internal_zlib = xyes; then
  134. AC_MSG_RESULT([internal zlib])
  135. else
  136. if test x$enable_external_zlib = xyes; then
  137. AC_MSG_RESULT([external zlib])
  138. LIBS="$LIBS -lz"
  139. else
  140. AC_MSG_ERROR([Need zlib, but you disabled our copy and have no system lib])
  141. fi
  142. fi
  143. fi
  144. dnl determine if we should include readline support...
  145. AC_ARG_ENABLE(readline,
  146. [ --enable-readline use GNU readline in test program [default=yes]],
  147. , enable_readline=yes)
  148. if test x$enable_readline = xyes; then
  149. AC_CHECK_HEADER(readline/readline.h, have_readline_hdr=yes)
  150. AC_CHECK_LIB(readline, readline, have_readline_lib=yes, , -lcurses)
  151. AC_CHECK_HEADER(readline/history.h, have_history_hdr=yes)
  152. AC_CHECK_LIB(readline, add_history, have_history_lib=yes, , -lcurses)
  153. if test x$have_readline_hdr = xyes -a x$have_readline_lib = xyes; then
  154. if test x$have_history_hdr = xyes -a x$have_history_lib = xyes; then
  155. AC_DEFINE(PHYSFS_HAVE_READLINE)
  156. LIBS="$LIBS -lreadline -lcurses"
  157. fi
  158. fi
  159. fi
  160. AC_CHECK_HEADER(be/kernel/OS.h, this_is_beos=yes)
  161. if test x$this_is_beos = xyes; then
  162. LIBS="$LIBS -lroot -lbe"
  163. fi
  164. # Checks for header files.
  165. AC_HEADER_STDC
  166. AC_CHECK_HEADERS([stdlib.h string.h])
  167. # Checks for typedefs, structures, and compiler characteristics.
  168. dnl AC_C_CONST
  169. dnl AC_TYPE_SIZE_T
  170. # Checks for library functions.
  171. # This is only in the bleeding edge autoconf distro...
  172. #AC_FUNC_MALLOC
  173. AC_FUNC_MEMCMP
  174. AC_CHECK_FUNCS([memset strrchr])
  175. dnl Add Makefile conditionals
  176. AM_CONDITIONAL(BUILD_ZLIB, test x$enable_internal_zlib = xyes)
  177. AM_CONDITIONAL(BUILD_TEST_PHYSFS, test x$enable_testprog = xyes)
  178. AM_CONDITIONAL(BUILD_BEOS_CPP, test x$this_is_beos = xyes)
  179. AC_OUTPUT([
  180. Makefile
  181. platform/Makefile
  182. archivers/Makefile
  183. test/Makefile
  184. zlib114/Makefile
  185. extras/Makefile
  186. ])