Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. # $Id$
  2. AC_INIT(libpipi, 0.0)
  3. AC_PREREQ(2.50)
  4. AC_CONFIG_AUX_DIR(.auto)
  5. AC_CANONICAL_SYSTEM
  6. AM_INIT_AUTOMAKE([no-define tar-ustar])
  7. dnl AM_MAINTAINER_MODE
  8. AM_CONFIG_HEADER(config.h)
  9. LT_MAJOR="0"
  10. LT_MINOR="0"
  11. LT_MICRO="0"
  12. AC_SUBST(LT_MAJOR)
  13. AC_SUBST(LT_MINOR)
  14. AC_SUBST(LT_MICRO)
  15. LT_VERSION="$LT_MAJOR:$LT_MINOR:$LT_MICRO"
  16. AC_SUBST(LT_VERSION)
  17. AM_PROG_CC_C_O
  18. AC_PROG_CPP
  19. AC_PROG_CXX
  20. AC_PROG_CXXCPP
  21. AC_PROG_OBJC
  22. _AM_DEPENDENCIES([OBJC])
  23. OBJC="${CC}"
  24. AC_SUBST(OBJC)
  25. AC_SUBST(OBJCFLAGS)
  26. AC_LIBTOOL_WIN32_DLL
  27. AM_PROG_LIBTOOL
  28. AC_LIBTOOL_CXX
  29. AC_C_CONST
  30. AC_C_INLINE
  31. dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
  32. dnl now otherwise it might be set in an obscure if statement. Same thing for
  33. dnl PKG_PROG_PKG_CONFIG which needs to be called first.
  34. AC_EGREP_CPP(yes, foo)
  35. PKG_PROG_PKG_CONFIG()
  36. m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
  37. if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
  38. export PKG_CONFIG_LIBDIR=/dev/null
  39. fi
  40. AC_MSG_CHECKING(for library suffix)
  41. LT_SUFFIX="`./libtool -n --tag CC --mode=link gcc -o libTEST.la -no-undefined -version-number 123:666:999 -rpath / | xargs -n 1 | sed -ne 's/.*libTEST\(@<:@^, ()0-9@:>@*\)123\(@<:@^, ()0-9@:>@*\).*/\1'$LT_MAJOR'\2/p' | grep -v '\.$' | head -n 1`"
  42. if test "$LT_SUFFIX" = ""; then
  43. LT_SUFFIX=".so.$LT_MAJOR"
  44. AC_MSG_RESULT([unknown, defaulting to $LT_SUFFIX])
  45. else
  46. AC_MSG_RESULT($LT_SUFFIX)
  47. fi
  48. AC_SUBST(LT_SUFFIX)
  49. dnl language bindings
  50. AC_ARG_ENABLE(csharp,
  51. [ --enable-csharp C# bindings (autodetected)])
  52. dnl conditional builds
  53. AC_ARG_ENABLE(debug,
  54. [ --enable-debug build debug versions of the library (default no)])
  55. AC_ARG_ENABLE(tiles,
  56. [ --enable-tiles experimental tiles support (default no)])
  57. AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h)
  58. ac_cv_have_getopt_long="no"
  59. AC_CHECK_FUNCS(getopt_long,
  60. [ac_cv_have_getopt_long="yes"],
  61. [AC_CHECK_LIB(gnugetopt, getopt_long,
  62. [ac_cv_have_getopt_long="yes"
  63. GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
  64. if test "$ac_cv_have_getopt_long" != "no"; then
  65. AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the ‘getopt_long’ function.)
  66. fi
  67. AM_CONDITIONAL(NEED_GETOPT_LONG, test "$ac_cv_have_getopt_long" = "no")
  68. AC_SUBST(GETOPT_LIBS)
  69. # How to get the C99 types. See pipi/pipi_types.h.in for details about
  70. # the PIPI_TYPES variable
  71. if test "${ac_cv_my_have_vga}" = "yes"; then
  72. PIPI_TYPES=0
  73. else
  74. AC_CHECK_HEADERS(stdint.h,
  75. [PIPI_TYPES=1],
  76. [AC_CHECK_HEADERS(inttypes.h,
  77. [PIPI_TYPES=2],
  78. [AC_CHECK_HEADERS(windows.h,
  79. [PIPI_TYPES=3],
  80. [PIPI_TYPES=0])])])
  81. fi
  82. AC_SUBST(PIPI_TYPES)
  83. # Optimizations
  84. CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
  85. # Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  86. CFLAGS="${CFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
  87. CXXFLAGS="${CXXFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wsign-compare"
  88. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  89. # Use SDL?
  90. ac_cv_my_have_sdl="no"
  91. save_CPPFLAGS="${CPPFLAGS}"
  92. AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  93. if test "${SDL_CONFIG}" != "no"; then
  94. CPPFLAGS="${CPPFLAGS} `sdl-config --cflags`"
  95. fi
  96. AC_CHECK_HEADERS(SDL_image.h,
  97. [ac_cv_my_have_sdl="yes"],
  98. [ac_cv_my_have_sdl="no"])
  99. CPPFLAGS="${save_CPPFLAGS}"
  100. if test "${ac_cv_my_have_sdl}" != "no"; then
  101. AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL_image)
  102. fi
  103. AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
  104. # Use OpenCV?
  105. ac_cv_my_have_opencv="no"
  106. OPENCV="no"
  107. PKG_CHECK_MODULES(OPENCV, opencv, [ac_cv_my_have_opencv="yes"], [:])
  108. if test "${ac_cv_my_have_opencv}" != "no"; then
  109. AC_DEFINE(USE_OPENCV, 1, Define to 1 to use OpenCV)
  110. fi
  111. AM_CONDITIONAL(USE_OPENCV, test "${ac_cv_my_have_opencv}" = "yes")
  112. # Use Imlib2?
  113. ac_cv_my_have_imlib2="no"
  114. IMLIB2="no"
  115. PKG_CHECK_MODULES(IMLIB2, imlib2, [ac_cv_my_have_imlib2="yes"], [:])
  116. if test "${ac_cv_my_have_imlib2}" != "no"; then
  117. AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2)
  118. fi
  119. AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes")
  120. # Use Windows GDI?
  121. ac_cv_my_have_gdi="no"
  122. GDI="no"
  123. AC_CHECK_HEADERS(windows.h,
  124. [ac_cv_my_have_gdi="yes"],
  125. [ac_cv_my_have_gdi="no"])
  126. if test "${ac_cv_my_have_gdi}" != "no"; then
  127. AC_DEFINE(USE_GDI, 1, Define to 1 to use GDI)
  128. fi
  129. AM_CONDITIONAL(USE_GDI, test "${ac_cv_my_have_gdi}" = "yes")
  130. # Use Windows GDI+?
  131. ac_cv_my_have_gdiplus="no"
  132. AC_LANG_PUSH(C++)
  133. AC_CHECK_HEADERS(Gdiplus.h,
  134. [ac_cv_my_have_gdiplus="yes"],
  135. [ac_cv_my_have_gdiplus="no"],
  136. [#include <windows.h>])
  137. AC_LANG_POP(C++)
  138. if test "${ac_cv_my_have_gdiplus}" != "no"; then
  139. AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+)
  140. fi
  141. AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes")
  142. # Use Cocoa?
  143. ac_cv_my_have_cocoa="no"
  144. AC_CHECK_HEADERS(/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h,
  145. [
  146. MACOSX_SDK_FRAMEWORKS="-F${MACOSX_SDK}/System/Library/Frameworks"
  147. CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
  148. CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
  149. CXXFLAGS="${CXXFLAGS} ${MACOSX_SDK_CXXFLAGS}"
  150. OBJCFLAGS="${OBJCFLAGS} ${MACOSX_SDK_CFLAGS}"
  151. LDFLAGS="${ARCH} ${MACOSX_SDK_LDFLAGS} ${LDFLAGS}"
  152. AC_DEFINE(USE_COCOA, 1, Define to 1 to activate the Cocoa backend driver)
  153. # CACA_LIBS="${CACA_LIBS} -Wl,-syslibroot,${MACOSX_SDK},-framework,Cocoa"
  154. # CACA_DRIVERS="${CACA_DRIVERS} cocoa"
  155. ac_cv_my_have_cocoa="yes"],
  156. [ac_cv_my_have_cocoa="no"]
  157. )
  158. AM_CONDITIONAL(USE_COCOA, test "${ac_cv_my_have_cocoa}" = "yes")
  159. # Use libjpeg?
  160. ac_cv_my_have_jpeg="no"
  161. AC_CHECK_HEADERS(jpeglib.h,
  162. [ac_cv_my_have_jpeg="yes"],
  163. [ac_cv_my_have_jpeg="no"])
  164. if test "${ac_cv_my_have_jpeg}" != "no"; then
  165. AC_DEFINE(USE_JPEG, 1, Define to 1 to use libjpeg)
  166. fi
  167. AM_CONDITIONAL(USE_JPEG, test "${ac_cv_my_have_jpeg}" = "yes")
  168. if test "${ac_cv_my_have_sdl}" = "no" -a "${ac_cv_my_have_imlib2}" = "no" -a "${ac_cv_my_have_opencv}" = "no" -a "${ac_cv_my_have_cocoa}" = "no" -a "${ac_cv_my_have_jpeg}" = "no" -a "${ac_cv_my_have_gdiplus}" = "no"; then
  169. AC_MSG_ERROR([[cannot find GDI+, SDL_Image, Imlib2, Cocoa or OpenCV, please install one of them]])
  170. fi
  171. if test "${enable_debug}" = "yes"; then
  172. AC_DEFINE(DEBUG, 1, Define to 1 to activate debug)
  173. fi
  174. if test "${enable_tiles}" = "yes"; then
  175. AC_DEFINE(USE_TILES, 1, Define to 1 to activate experimental tiles)
  176. fi
  177. AC_SUBST(MATH_LIBS)
  178. # Build the .NET bindings?
  179. ac_cv_my_have_csharp="no"
  180. if test "${enable_csharp}" != "no"; then
  181. AC_PATH_PROG(GMCS, gmcs, no)
  182. AC_PATH_PROG(GACUTIL, gacutil, no)
  183. if test "${GMCS}" != "no" -a "${GACUTIL}" != "no"; then
  184. ac_cv_my_have_csharp="yes"
  185. fi
  186. fi
  187. AM_CONDITIONAL(USE_CSHARP, test "${ac_cv_my_have_csharp}" = "yes")
  188. # Build the movie thumbnailer?
  189. ac_cv_my_have_ffmpeg="yes"
  190. PKG_CHECK_MODULES([LIBAVCODEC], [libavcodec-uninstalled], [:], [ac_cv_my_have_ffmpeg=no])
  191. PKG_CHECK_MODULES([LIBAVFORMAT], [libavformat-uninstalled], [:], [ac_cv_my_have_ffmpeg=no])
  192. PKG_CHECK_MODULES([LIBSWSCALE], [libswscale-uninstalled], [:], [ac_cv_my_have_ffmpeg=no])
  193. if test "${ac_cv_my_have_ffmpeg}" = "no"; then
  194. ac_cv_my_have_ffmpeg="yes"
  195. PKG_CHECK_MODULES([LIBAVCODEC], [libavcodec], [:], [ac_cv_my_have_ffmpeg=no])
  196. PKG_CHECK_MODULES([LIBAVFORMAT], [libavformat], [:], [ac_cv_my_have_ffmpeg=no])
  197. PKG_CHECK_MODULES([LIBSWSCALE], [libswscale], [:], [ac_cv_my_have_ffmpeg=no])
  198. fi
  199. if test "${ac_cv_my_have_ffmpeg}" != "no"; then
  200. AC_DEFINE(USE_FFMPEG, 1, Define to 1 to use FFmpeg)
  201. fi
  202. AM_CONDITIONAL(USE_FFMPEG, test "${ac_cv_my_have_ffmpeg}" = "yes")
  203. # Build CGAL stuff?
  204. ac_cv_my_have_cgal="no"
  205. AC_LANG_PUSH(C++)
  206. AC_CHECK_HEADERS(CGAL/version.h,
  207. [ac_cv_my_have_cgal="yes"],
  208. [ac_cv_my_have_cgal="no"])
  209. AC_LANG_POP(C++)
  210. if test "${ac_cv_my_have_cgal}" != "no"; then
  211. AC_DEFINE(USE_CGAL, 1, Define to 1 to use CGAL)
  212. fi
  213. AM_CONDITIONAL(USE_CGAL, test "${ac_cv_my_have_cgal}" = "yes")
  214. # Build The Pimp?
  215. ac_cv_my_have_gtksharp="${ac_cv_my_have_csharp}"
  216. PKG_CHECK_MODULES([GLIB_SHARP_20], [glib-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
  217. PKG_CHECK_MODULES([GTK_SHARP_20], [gtk-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
  218. AM_CONDITIONAL(USE_GTKSHARP, test "${ac_cv_my_have_gtksharp}" != no)
  219. AC_CONFIG_FILES([
  220. Makefile
  221. pipi/Makefile
  222. src/Makefile
  223. genethumb/Makefile
  224. examples/Makefile
  225. test/Makefile
  226. pipi-sharp/Makefile
  227. ThePimp/Makefile
  228. win32/Makefile
  229. ])
  230. AC_CONFIG_FILES([
  231. pipi/pipi_types.h
  232. pipi/pipi.pc
  233. pipi-sharp/pipi-sharp.pc
  234. pipi-sharp/pipi-sharp.dll.config
  235. ])
  236. AC_CONFIG_FILES([ThePimp/pimp], [chmod +x ThePimp/pimp])
  237. AC_OUTPUT