Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

configure.ac 8.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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. #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. if test "${ac_cv_my_have_ffmpeg}" != "no"; then
  208. AC_DEFINE(USE_FFMPEG, 1, Define to 1 to use FFmpeg)
  209. fi
  210. AM_CONDITIONAL(USE_FFMPEG, test "${ac_cv_my_have_ffmpeg}" = "yes")
  211. # Build CGAL stuff?
  212. ac_cv_my_have_cgal="no"
  213. AC_LANG_PUSH(C++)
  214. AC_CHECK_HEADERS(CGAL/version.h,
  215. [ac_cv_my_have_cgal="yes"],
  216. [ac_cv_my_have_cgal="no"])
  217. AC_LANG_POP(C++)
  218. if test "${ac_cv_my_have_cgal}" != "no"; then
  219. AC_DEFINE(USE_CGAL, 1, Define to 1 to use CGAL)
  220. fi
  221. AM_CONDITIONAL(USE_CGAL, test "${ac_cv_my_have_cgal}" = "yes")
  222. # Build The Pimp?
  223. ac_cv_my_have_gtksharp="${ac_cv_my_have_csharp}"
  224. PKG_CHECK_MODULES([GLIB_SHARP_20], [glib-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
  225. PKG_CHECK_MODULES([GTK_SHARP_20], [gtk-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
  226. AM_CONDITIONAL(USE_GTKSHARP, test "${ac_cv_my_have_gtksharp}" != no)
  227. AC_CONFIG_FILES([
  228. Makefile
  229. pipi/Makefile
  230. src/Makefile
  231. genethumb/Makefile
  232. examples/Makefile
  233. test/Makefile
  234. pipi-sharp/Makefile
  235. ThePimp/Makefile
  236. win32/Makefile
  237. ])
  238. AC_CONFIG_FILES([
  239. pipi/pipi_types.h
  240. pipi/pipi.pc
  241. pipi-sharp/pipi-sharp.pc
  242. pipi-sharp/pipi-sharp.dll.config
  243. ])
  244. AC_CONFIG_FILES([ThePimp/pimp], [chmod +x ThePimp/pimp])
  245. AC_OUTPUT