configure.in 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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_BUILD
  36. AC_CANONICAL_HOST
  37. AC_CANONICAL_TARGET
  38. dnl Setup for automake
  39. AM_CONFIG_HEADER(config.h)
  40. AM_INIT_AUTOMAKE(physfs, $VERSION)
  41. dnl ---------------------------------------------------------------------
  42. dnl Compilers and other tools
  43. dnl ---------------------------------------------------------------------
  44. AC_PROG_CC
  45. AC_PROG_CXX
  46. AC_PROG_INSTALL
  47. AC_PROG_LN_S
  48. AC_LIBTOOL_WIN32_DLL
  49. AC_PROG_LIBTOOL
  50. AC_CHECK_PROG(we_have_sed, sed, yes, no)
  51. dnl ---------------------------------------------------------------------
  52. dnl Debug mode?
  53. dnl ---------------------------------------------------------------------
  54. AC_ARG_ENABLE(debug,
  55. [ --enable-debug enable debug mode [default=yes]],
  56. , enable_debug=yes)
  57. if test x$enable_debug = xyes; then
  58. if test x$ac_cv_prog_cc_g = xyes; then
  59. CFLAGS="-g -O0"
  60. else
  61. CFLAGS="-O0"
  62. fi
  63. CFLAGS="$CFLAGS -Werror -Wall"
  64. AC_DEFINE(DEBUG)
  65. AC_DEFINE(DEBUG_CHATTER)
  66. else
  67. CFLAGS="-O2"
  68. AC_DEFINE(NDEBUG)
  69. fi
  70. dnl ---------------------------------------------------------------------
  71. dnl Build test program?
  72. dnl ---------------------------------------------------------------------
  73. AC_ARG_ENABLE(testprog,
  74. [ --enable-testprog build test program [default=yes]],
  75. , enable_testprog=yes)
  76. dnl ---------------------------------------------------------------------
  77. dnl Checks for libraries.
  78. dnl ---------------------------------------------------------------------
  79. dnl !!! FIXME: Not sure how to detect this...
  80. dnl check for 64-bit llseek()...
  81. dnl AC_CHECK_LIB(c, llseek, have_llseek=yes)
  82. if test x$have_llseek = xyes; then
  83. AC_DEFINE(PHYSFS_HAVE_LLSEEK)
  84. fi
  85. require_zlib="no"
  86. dnl Check for zip archiver inclusion...
  87. AC_ARG_ENABLE(zip,
  88. [ --enable-zip enable ZIP support [default=yes]],
  89. , enable_zip=yes)
  90. if test x$enable_zip = xyes; then
  91. AC_DEFINE(PHYSFS_SUPPORTS_ZIP)
  92. require_zlib="yes"
  93. fi
  94. dnl Check for zip archiver inclusion...
  95. AC_ARG_ENABLE(grp,
  96. [ --enable-grp enable Build Engine GRP support [default=yes]],
  97. , enable_grp=yes)
  98. if test x$enable_grp = xyes; then
  99. AC_DEFINE(PHYSFS_SUPPORTS_GRP)
  100. fi
  101. AC_ARG_ENABLE(internal-zlib,
  102. [ --enable-internal-zlib use included zlib [default=only if needed]],
  103. , enable_internal_zlib=maybe)
  104. dnl Check for zlib if needed.
  105. have_external_zlib="no"
  106. if test x$enable_internal_zlib != xyes; then
  107. if test x$require_zlib = xyes; then
  108. AC_CHECK_HEADER(zlib.h, have_zlib_hdr=yes)
  109. AC_CHECK_LIB(z, zlibVersion, have_zlib_lib=yes)
  110. if test x$have_zlib_hdr = xyes -a x$have_zlib_lib = xyes; then
  111. have_external_zlib="yes"
  112. fi
  113. fi
  114. fi
  115. AC_MSG_CHECKING([what zlib to use])
  116. dnl no zlib is needed at all if we aren't supporting ZIP files.
  117. if test x$require_zlib = xno; then
  118. enable_internal_zlib="no"
  119. enable_external_zlib="no"
  120. AC_MSG_RESULT([no zlib needed])
  121. else
  122. if test x$enable_internal_zlib = xmaybe; then
  123. if test x$have_external_zlib = xyes; then
  124. enable_internal_zlib="no"
  125. enable_external_zlib="yes"
  126. else
  127. enable_internal_zlib="yes"
  128. enable_external_zlib="no"
  129. fi
  130. else
  131. if test x$enable_internal_zlib = xno -a x$have_external_zlib = xyes; then
  132. enable_internal_zlib="no"
  133. enable_external_zlib="yes"
  134. fi
  135. fi
  136. if test x$enable_internal_zlib = xyes; then
  137. AC_MSG_RESULT([internal zlib])
  138. else
  139. if test x$enable_external_zlib = xyes; then
  140. AC_MSG_RESULT([external zlib])
  141. LIBS="$LIBS -lz"
  142. else
  143. AC_MSG_ERROR([Need zlib, but you disabled our copy and have no system lib])
  144. fi
  145. fi
  146. fi
  147. dnl determine if we should include readline support...
  148. AC_ARG_ENABLE(readline,
  149. [ --enable-readline use GNU readline in test program [default=yes]],
  150. , enable_readline=yes)
  151. if test x$enable_readline = xyes; then
  152. AC_CHECK_HEADER(readline/readline.h, have_readline_hdr=yes)
  153. AC_CHECK_LIB(readline, readline, have_readline_lib=yes, , -lcurses)
  154. AC_CHECK_HEADER(readline/history.h, have_history_hdr=yes)
  155. AC_CHECK_LIB(readline, add_history, have_history_lib=yes, , -lcurses)
  156. if test x$have_readline_hdr = xyes -a x$have_readline_lib = xyes; then
  157. if test x$have_history_hdr = xyes -a x$have_history_lib = xyes; then
  158. AC_DEFINE(PHYSFS_HAVE_READLINE)
  159. LIBS="$LIBS -lreadline -lcurses"
  160. fi
  161. fi
  162. fi
  163. dnl AC_CHECK_HEADER(be/kernel/OS.h, this_is_beos=yes)
  164. AC_MSG_CHECKING([if this is BeOS])
  165. if test x$build_os = xbeos; then
  166. this_is_beos=yes
  167. LIBS="$LIBS -lroot -lbe"
  168. else
  169. this_is_beos=no
  170. fi
  171. AC_MSG_RESULT([$this_is_beos])
  172. this_is_macosx=no
  173. if test x$we_have_sed = xyes; then
  174. AC_MSG_CHECKING([if this is MacOS X])
  175. x=`echo $build_os |sed "s/darwin.*/darwin/"`
  176. if test x$x = xdarwin -a x$build_vendor = xapple; then
  177. this_is_macosx=yes
  178. fi
  179. AC_MSG_RESULT([$this_is_macosx])
  180. fi
  181. # Checks for header files.
  182. AC_HEADER_STDC
  183. AC_CHECK_HEADERS([stdlib.h string.h])
  184. # Checks for typedefs, structures, and compiler characteristics.
  185. dnl AC_C_CONST
  186. dnl AC_TYPE_SIZE_T
  187. # Checks for library functions.
  188. # This is only in the bleeding edge autoconf distro...
  189. #AC_FUNC_MALLOC
  190. AC_FUNC_MEMCMP
  191. AC_CHECK_FUNCS([memset strrchr])
  192. dnl Add Makefile conditionals
  193. AM_CONDITIONAL(BUILD_ZLIB, test x$enable_internal_zlib = xyes)
  194. AM_CONDITIONAL(BUILD_TEST_PHYSFS, test x$enable_testprog = xyes)
  195. AM_CONDITIONAL(BUILD_BEOS_CPP, test x$this_is_beos = xyes)
  196. AM_CONDITIONAL(BUILD_MACOSX, test x$this_is_macosx = xyes)
  197. LDFLAGS="$LDFLAGS -no-undefined"
  198. AC_OUTPUT([
  199. Makefile
  200. archivers/Makefile
  201. platform/Makefile
  202. zlib114/Makefile
  203. test/Makefile
  204. extras/Makefile
  205. ])
  206. dnl end of configure.in ...