25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

281 lines
8.8 KiB

  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([subdir-objects no-define tar-ustar silent-rules])
  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. #FIXME: check for highgui, too.
  108. PKG_CHECK_MODULES(OPENCV, opencv,
  109. [save_CPPFLAGS="${CPPFLAGS}"
  110. CPPFLAGS="${CPPFLAGS} ${OPENCV_CFLAGS}"
  111. AC_CHECK_HEADERS(highgui.h,
  112. [ac_cv_my_have_opencv="yes"],
  113. [:])
  114. CPPFLAGS="${save_CPPFLAGS}"],
  115. [:])
  116. if test "${ac_cv_my_have_opencv}" != "no"; then
  117. AC_DEFINE(USE_OPENCV, 1, Define to 1 to use OpenCV)
  118. fi
  119. AM_CONDITIONAL(USE_OPENCV, test "${ac_cv_my_have_opencv}" = "yes")
  120. # Use Imlib2?
  121. ac_cv_my_have_imlib2="no"
  122. IMLIB2="no"
  123. PKG_CHECK_MODULES(IMLIB2, imlib2, [ac_cv_my_have_imlib2="yes"], [:])
  124. if test "${ac_cv_my_have_imlib2}" != "no"; then
  125. AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2)
  126. fi
  127. AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes")
  128. # Use Windows GDI?
  129. ac_cv_my_have_gdi="no"
  130. GDI="no"
  131. AC_CHECK_HEADERS(windows.h,
  132. [ac_cv_my_have_gdi="yes"],
  133. [ac_cv_my_have_gdi="no"])
  134. if test "${ac_cv_my_have_gdi}" != "no"; then
  135. AC_DEFINE(USE_GDI, 1, Define to 1 to use GDI)
  136. fi
  137. AM_CONDITIONAL(USE_GDI, test "${ac_cv_my_have_gdi}" = "yes")
  138. # Use Windows GDI+?
  139. ac_cv_my_have_gdiplus="no"
  140. AC_LANG_PUSH(C++)
  141. AC_CHECK_HEADERS(Gdiplus.h,
  142. [ac_cv_my_have_gdiplus="yes"],
  143. [ac_cv_my_have_gdiplus="no"],
  144. [#include <windows.h>])
  145. AC_LANG_POP(C++)
  146. if test "${ac_cv_my_have_gdiplus}" != "no"; then
  147. AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+)
  148. fi
  149. AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes")
  150. # Use Cocoa?
  151. ac_cv_my_have_cocoa="no"
  152. AC_CHECK_HEADERS(/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h,
  153. [
  154. MACOSX_SDK_FRAMEWORKS="-F${MACOSX_SDK}/System/Library/Frameworks"
  155. CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
  156. CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
  157. CXXFLAGS="${CXXFLAGS} ${MACOSX_SDK_CXXFLAGS}"
  158. OBJCFLAGS="${OBJCFLAGS} ${MACOSX_SDK_CFLAGS}"
  159. LDFLAGS="${ARCH} ${MACOSX_SDK_LDFLAGS} ${LDFLAGS}"
  160. AC_DEFINE(USE_COCOA, 1, Define to 1 to activate the Cocoa backend driver)
  161. # CACA_LIBS="${CACA_LIBS} -Wl,-syslibroot,${MACOSX_SDK},-framework,Cocoa"
  162. # CACA_DRIVERS="${CACA_DRIVERS} cocoa"
  163. ac_cv_my_have_cocoa="yes"],
  164. [ac_cv_my_have_cocoa="no"]
  165. )
  166. AM_CONDITIONAL(USE_COCOA, test "${ac_cv_my_have_cocoa}" = "yes")
  167. # Use libjpeg?
  168. ac_cv_my_have_jpeg="no"
  169. AC_CHECK_HEADERS(jpeglib.h,
  170. [ac_cv_my_have_jpeg="yes"],
  171. [ac_cv_my_have_jpeg="no"])
  172. if test "${ac_cv_my_have_jpeg}" != "no"; then
  173. AC_DEFINE(USE_JPEG, 1, Define to 1 to use libjpeg)
  174. fi
  175. AM_CONDITIONAL(USE_JPEG, test "${ac_cv_my_have_jpeg}" = "yes")
  176. 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
  177. AC_MSG_ERROR([[cannot find GDI+, SDL_Image, Imlib2, Cocoa or OpenCV, please install one of them]])
  178. fi
  179. if test "${enable_debug}" = "yes"; then
  180. AC_DEFINE(DEBUG, 1, Define to 1 to activate debug)
  181. fi
  182. if test "${enable_tiles}" = "yes"; then
  183. AC_DEFINE(USE_TILES, 1, Define to 1 to activate experimental tiles)
  184. fi
  185. AC_SUBST(MATH_LIBS)
  186. # Build the .NET bindings?
  187. ac_cv_my_have_csharp="no"
  188. if test "${enable_csharp}" != "no"; then
  189. AC_PATH_PROG(GMCS, gmcs, no)
  190. AC_PATH_PROG(GACUTIL, gacutil, no)
  191. if test "${GMCS}" != "no" -a "${GACUTIL}" != "no"; then
  192. ac_cv_my_have_csharp="yes"
  193. fi
  194. fi
  195. AM_CONDITIONAL(USE_CSHARP, test "${ac_cv_my_have_csharp}" = "yes")
  196. # Build the movie thumbnailer?
  197. ac_cv_my_have_ffmpeg="yes"
  198. PKG_CHECK_MODULES([LIBAVCODEC], [libavcodec-uninstalled], [:], [ac_cv_my_have_ffmpeg=no])
  199. PKG_CHECK_MODULES([LIBAVFORMAT], [libavformat-uninstalled], [:], [ac_cv_my_have_ffmpeg=no])
  200. PKG_CHECK_MODULES([LIBSWSCALE], [libswscale-uninstalled], [:], [ac_cv_my_have_ffmpeg=no])
  201. if test "${ac_cv_my_have_ffmpeg}" = "no"; then
  202. ac_cv_my_have_ffmpeg="yes"
  203. PKG_CHECK_MODULES([LIBAVCODEC], [libavcodec], [:], [ac_cv_my_have_ffmpeg=no])
  204. PKG_CHECK_MODULES([LIBAVFORMAT], [libavformat], [:], [ac_cv_my_have_ffmpeg=no])
  205. PKG_CHECK_MODULES([LIBSWSCALE], [libswscale], [:], [ac_cv_my_have_ffmpeg=no])
  206. fi
  207. # Disable for now
  208. ac_cv_my_have_ffmpeg="no"
  209. if test "${ac_cv_my_have_ffmpeg}" != "no"; then
  210. AC_DEFINE(USE_FFMPEG, 1, Define to 1 to use FFmpeg)
  211. fi
  212. AM_CONDITIONAL(USE_FFMPEG, test "${ac_cv_my_have_ffmpeg}" = "yes")
  213. # Build CGAL stuff?
  214. ac_cv_my_have_cgal="no"
  215. AC_LANG_PUSH(C++)
  216. AC_CHECK_HEADERS(CGAL/version.h,
  217. [ac_cv_my_have_cgal="yes"],
  218. [ac_cv_my_have_cgal="no"])
  219. AC_LANG_POP(C++)
  220. if test "${ac_cv_my_have_cgal}" != "no"; then
  221. AC_DEFINE(USE_CGAL, 1, Define to 1 to use CGAL)
  222. fi
  223. AM_CONDITIONAL(USE_CGAL, test "${ac_cv_my_have_cgal}" = "yes")
  224. # Build The Pimp?
  225. ac_cv_my_have_gtksharp="${ac_cv_my_have_csharp}"
  226. PKG_CHECK_MODULES([GLIB_SHARP_20], [glib-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
  227. PKG_CHECK_MODULES([GTK_SHARP_20], [gtk-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
  228. AM_CONDITIONAL(USE_GTKSHARP, test "${ac_cv_my_have_gtksharp}" != no)
  229. AC_CONFIG_FILES([
  230. Makefile
  231. pipi/Makefile
  232. src/Makefile
  233. genethumb/Makefile
  234. examples/Makefile
  235. test/Makefile
  236. pipi-sharp/Makefile
  237. ThePimp/Makefile
  238. win32/Makefile
  239. ])
  240. AC_CONFIG_FILES([
  241. pipi/pipi_types.h
  242. pipi/pipi.pc
  243. pipi-sharp/pipi-sharp.pc
  244. pipi-sharp/pipi-sharp.dll.config
  245. ])
  246. AC_CONFIG_FILES([ThePimp/pimp], [chmod +x ThePimp/pimp])
  247. AC_OUTPUT