25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

configure.ac 7.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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 -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
  87. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  88. # Use SDL?
  89. ac_cv_my_have_sdl="no"
  90. save_CPPFLAGS="${CPPFLAGS}"
  91. AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  92. if test "${SDL_CONFIG}" != "no"; then
  93. CPPFLAGS="${CPPFLAGS} `sdl-config --cflags`"
  94. fi
  95. AC_CHECK_HEADERS(SDL_image.h,
  96. [ac_cv_my_have_sdl="yes"],
  97. [ac_cv_my_have_sdl="no"])
  98. CPPFLAGS="${save_CPPFLAGS}"
  99. if test "${ac_cv_my_have_sdl}" != "no"; then
  100. AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL_image)
  101. fi
  102. AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
  103. # Use OpenCV?
  104. ac_cv_my_have_opencv="no"
  105. OPENCV="no"
  106. PKG_CHECK_MODULES(OPENCV, opencv, [ac_cv_my_have_opencv="yes"], [:])
  107. if test "${ac_cv_my_have_opencv}" != "no"; then
  108. AC_DEFINE(USE_OPENCV, 1, Define to 1 to use OpenCV)
  109. fi
  110. AM_CONDITIONAL(USE_OPENCV, test "${ac_cv_my_have_opencv}" = "yes")
  111. # Use Imlib2?
  112. ac_cv_my_have_imlib2="no"
  113. IMLIB2="no"
  114. PKG_CHECK_MODULES(IMLIB2, imlib2, [ac_cv_my_have_imlib2="yes"], [:])
  115. if test "${ac_cv_my_have_imlib2}" != "no"; then
  116. AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2)
  117. fi
  118. AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes")
  119. # Use Windows GDI?
  120. ac_cv_my_have_gdi="no"
  121. GDI="no"
  122. AC_CHECK_HEADERS(windows.h,
  123. [ac_cv_my_have_gdi="yes"],
  124. [ac_cv_my_have_gdi="no"])
  125. if test "${ac_cv_my_have_gdi}" != "no"; then
  126. AC_DEFINE(USE_GDI, 1, Define to 1 to use GDI)
  127. fi
  128. AM_CONDITIONAL(USE_GDI, test "${ac_cv_my_have_gdi}" = "yes")
  129. # Use Windows GDI+?
  130. ac_cv_my_have_gdiplus="no"
  131. AC_LANG_PUSH(C++)
  132. AC_CHECK_HEADERS(Gdiplus.h,
  133. [ac_cv_my_have_gdiplus="yes"],
  134. [ac_cv_my_have_gdiplus="no"],
  135. [#include <windows.h>])
  136. AC_LANG_POP(C++)
  137. if test "${ac_cv_my_have_gdiplus}" != "no"; then
  138. AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+)
  139. fi
  140. AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes")
  141. # Use Cocoa?
  142. ac_cv_my_have_cocoa="no"
  143. AC_CHECK_HEADERS(/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h,
  144. [
  145. MACOSX_SDK_FRAMEWORKS="-F${MACOSX_SDK}/System/Library/Frameworks"
  146. CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
  147. CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
  148. CXXFLAGS="${CXXFLAGS} ${MACOSX_SDK_CXXFLAGS}"
  149. OBJCFLAGS="${OBJCFLAGS} ${MACOSX_SDK_CFLAGS}"
  150. LDFLAGS="${ARCH} ${MACOSX_SDK_LDFLAGS} ${LDFLAGS}"
  151. AC_DEFINE(USE_COCOA, 1, Define to 1 to activate the Cocoa backend driver)
  152. # CACA_LIBS="${CACA_LIBS} -Wl,-syslibroot,${MACOSX_SDK},-framework,Cocoa"
  153. # CACA_DRIVERS="${CACA_DRIVERS} cocoa"
  154. ac_cv_my_have_cocoa="yes"],
  155. [ac_cv_my_have_cocoa="no"]
  156. )
  157. AM_CONDITIONAL(USE_COCOA, test "${ac_cv_my_have_cocoa}" = "yes")
  158. # Use libjpeg?
  159. ac_cv_my_have_jpeg="no"
  160. AC_CHECK_HEADERS(jpeglib.h,
  161. [ac_cv_my_have_jpeg="yes"],
  162. [ac_cv_my_have_jpeg="no"])
  163. if test "${ac_cv_my_have_jpeg}" != "no"; then
  164. AC_DEFINE(USE_JPEG, 1, Define to 1 to use libjpeg)
  165. fi
  166. AM_CONDITIONAL(USE_JPEG, test "${ac_cv_my_have_jpeg}" = "yes")
  167. 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"; then
  168. AC_MSG_ERROR([[cannot find GDI+, SDL_Image, Imlib2, Cocoa or OpenCV, please install one of them]])
  169. fi
  170. if test "${enable_debug}" = "yes"; then
  171. AC_DEFINE(DEBUG, 1, Define to 1 to activate debug)
  172. fi
  173. if test "${enable_tiles}" = "yes"; then
  174. AC_DEFINE(USE_TILES, 1, Define to 1 to activate experimental tiles)
  175. fi
  176. AC_SUBST(MATH_LIBS)
  177. # Build the .NET bindings?
  178. ac_cv_my_have_csharp="no"
  179. if test "${enable_csharp}" != "no"; then
  180. AC_PATH_PROG(GMCS, gmcs, no)
  181. AC_PATH_PROG(GACUTIL, gacutil, no)
  182. if test "${GMCS}" != "no" -a "${GACUTIL}" != "no"; then
  183. ac_cv_my_have_csharp="yes"
  184. fi
  185. fi
  186. AM_CONDITIONAL(USE_CSHARP, test "${ac_cv_my_have_csharp}" = "yes")
  187. # Build the movie thumbnailer?
  188. ac_cv_my_have_ffmpeg="yes"
  189. PKG_CHECK_MODULES([LIBAVCODEC], [libavcodec], [:], [ac_cv_my_have_ffmpeg=no])
  190. PKG_CHECK_MODULES([LIBAVFORMAT], [libavformat], [:], [ac_cv_my_have_ffmpeg=no])
  191. PKG_CHECK_MODULES([LIBSWSCALE], [libswscale], [:], [ac_cv_my_have_ffmpeg=no])
  192. AM_CONDITIONAL(USE_FFMPEG, test "${ac_cv_my_have_ffmpeg}" = "yes")
  193. # Build The Pimp?
  194. ac_cv_my_have_gtksharp="${ac_cv_my_have_csharp}"
  195. PKG_CHECK_MODULES([GLIB_SHARP_20], [glib-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
  196. PKG_CHECK_MODULES([GTK_SHARP_20], [gtk-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
  197. AM_CONDITIONAL(USE_GTKSHARP, test "${ac_cv_my_have_gtksharp}" != no)
  198. AC_CONFIG_FILES([
  199. Makefile
  200. pipi/Makefile
  201. src/Makefile
  202. genethumb/Makefile
  203. examples/Makefile
  204. test/Makefile
  205. pipi-sharp/Makefile
  206. ThePimp/Makefile
  207. win32/Makefile
  208. ])
  209. AC_CONFIG_FILES([
  210. pipi/pipi_types.h
  211. pipi/pipi.pc
  212. pipi-sharp/pipi-sharp.pc
  213. pipi-sharp/pipi-sharp.dll.config
  214. ])
  215. AC_CONFIG_FILES([ThePimp/pimp], [chmod +x ThePimp/pimp])
  216. AC_OUTPUT