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.
 
 
 
 
 
 

251 righe
7.5 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([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. AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h)
  50. ac_cv_have_getopt_long="no"
  51. AC_CHECK_FUNCS(getopt_long,
  52. [ac_cv_have_getopt_long="yes"],
  53. [AC_CHECK_LIB(gnugetopt, getopt_long,
  54. [ac_cv_have_getopt_long="yes"
  55. GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
  56. if test "$ac_cv_have_getopt_long" != "no"; then
  57. AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)
  58. fi
  59. AM_CONDITIONAL(NEED_GETOPT_LONG, test "$ac_cv_have_getopt_long" = "no")
  60. AC_SUBST(GETOPT_LIBS)
  61. # How to get the C99 types. See pipi/pipi_types.h.in for details about
  62. # the PIPI_TYPES variable
  63. if test "${ac_cv_my_have_vga}" = "yes"; then
  64. PIPI_TYPES=0
  65. else
  66. AC_CHECK_HEADERS(stdint.h,
  67. [PIPI_TYPES=1],
  68. [AC_CHECK_HEADERS(inttypes.h,
  69. [PIPI_TYPES=2],
  70. [AC_CHECK_HEADERS(windows.h,
  71. [PIPI_TYPES=3],
  72. [PIPI_TYPES=0])])])
  73. fi
  74. AC_SUBST(PIPI_TYPES)
  75. # Optimizations
  76. CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
  77. # Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  78. CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
  79. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  80. # Use DevIL?
  81. #AC_CHECK_HEADERS(IL/il.h,
  82. # [ac_cv_my_have_il="yes"],
  83. # [ac_cv_my_have_il="no"])
  84. #CPPFLAGS="${save_CPPFLAGS}"
  85. #AM_CONDITIONAL(USE_IL, test "${ac_cv_my_have_il}" = "yes")
  86. # Use Windows?
  87. #AC_CHECK_HEADERS(olectl.h,
  88. # [ac_cv_my_have_ole="yes"],
  89. # [ac_cv_my_have_ole="no"])
  90. #CPPFLAGS="${save_CPPFLAGS}"
  91. #AM_CONDITIONAL(USE_OLE, test "${ac_cv_my_have_ole}" = "yes")
  92. # Use SDL?
  93. ac_cv_my_have_sdl="no"
  94. save_CPPFLAGS="${CPPFLAGS}"
  95. AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  96. if test "${SDL_CONFIG}" != "no"; then
  97. CPPFLAGS="${CPPFLAGS} `sdl-config --cflags`"
  98. fi
  99. AC_CHECK_HEADERS(SDL_image.h,
  100. [ac_cv_my_have_sdl="yes"],
  101. [ac_cv_my_have_sdl="no"])
  102. CPPFLAGS="${save_CPPFLAGS}"
  103. if test "${ac_cv_my_have_sdl}" != "no"; then
  104. AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL_image)
  105. fi
  106. AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
  107. # Use OpenCV?
  108. ac_cv_my_have_opencv="no"
  109. OPENCV="no"
  110. PKG_CHECK_MODULES(OPENCV, opencv, [ac_cv_my_have_opencv="yes"], [:])
  111. if test "${ac_cv_my_have_opencv}" != "no"; then
  112. AC_DEFINE(USE_OPENCV, 1, Define to 1 to use OpenCV)
  113. fi
  114. AM_CONDITIONAL(USE_OPENCV, test "${ac_cv_my_have_opencv}" = "yes")
  115. # Use Imlib2?
  116. ac_cv_my_have_imlib2="no"
  117. IMLIB2="no"
  118. PKG_CHECK_MODULES(IMLIB2, imlib2, [ac_cv_my_have_imlib2="yes"], [:])
  119. if test "${ac_cv_my_have_imlib2}" != "no"; then
  120. AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2)
  121. fi
  122. AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes")
  123. # Use Windows GDI?
  124. ac_cv_my_have_gdi="no"
  125. GDI="no"
  126. AC_CHECK_HEADERS(windows.h,
  127. [ac_cv_my_have_gdi="yes"],
  128. [ac_cv_my_have_gdi="no"])
  129. if test "${ac_cv_my_have_gdi}" != "no"; then
  130. AC_DEFINE(USE_GDI, 1, Define to 1 to use GDI)
  131. fi
  132. AM_CONDITIONAL(USE_GDI, test "${ac_cv_my_have_gdi}" = "yes")
  133. # Use Windows GDI+?
  134. ac_cv_my_have_gdiplus="no"
  135. AC_LANG_PUSH(C++)
  136. AC_CHECK_HEADERS(Gdiplus.h,
  137. [ac_cv_my_have_gdiplus="yes"],
  138. [ac_cv_my_have_gdiplus="no"],
  139. [#include <windows.h>])
  140. AC_LANG_POP(C++)
  141. if test "${ac_cv_my_have_gdiplus}" != "no"; then
  142. AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+)
  143. fi
  144. AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes")
  145. # Use Cocoa?
  146. ac_cv_my_have_cocoa="no"
  147. AC_CHECK_HEADERS(/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h,
  148. [
  149. MACOSX_SDK_FRAMEWORKS="-F${MACOSX_SDK}/System/Library/Frameworks"
  150. CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
  151. CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
  152. CXXFLAGS="${CXXFLAGS} ${MACOSX_SDK_CXXFLAGS}"
  153. OBJCFLAGS="${OBJCFLAGS} ${MACOSX_SDK_CFLAGS}"
  154. LDFLAGS="${ARCH} ${MACOSX_SDK_LDFLAGS} ${LDFLAGS}"
  155. AC_DEFINE(USE_COCOA, 1, Define to 1 to activate the Cocoa backend driver)
  156. # CACA_LIBS="${CACA_LIBS} -Wl,-syslibroot,${MACOSX_SDK},-framework,Cocoa"
  157. # CACA_DRIVERS="${CACA_DRIVERS} cocoa"
  158. ac_cv_my_have_cocoa="yes"],
  159. [ac_cv_my_have_cocoa="no"]
  160. )
  161. AM_CONDITIONAL(USE_COCOA, test "${ac_cv_my_have_cocoa}" = "yes")
  162. # Use Modular codecs ?
  163. MODULAR_CODEC=""
  164. ac_cv_my_have_modular="no"
  165. ac_cv_my_have_libjpeg="no"
  166. AC_CHECK_HEADERS(jpeglib.h,
  167. [ac_cv_my_have_libjpeg="yes"],
  168. [ac_cv_my_have_libjpeg="no"])
  169. if test "${ac_cv_my_have_libjpeg}" != "no"; then
  170. ac_cv_my_have_modular="yes"
  171. AC_DEFINE(USE_LIBJPEG, 1, Define to 1 to use libjpeg)
  172. AC_DEFINE(USE_MODULAR, 1, Define to 1 to use modular codecs)
  173. MODULAR_CODEC="${MODULAR_CODEC} libjpeg"
  174. fi
  175. AM_CONDITIONAL(USE_LIBJPEG, test "${ac_cv_my_have_libjpeg}" = "yes")
  176. AM_CONDITIONAL(USE_MODULAR, test "${ac_cv_my_have_modular}" = "yes")
  177. AC_MSG_CHECKING(valid modular codecs)
  178. if test -z "${MODULAR_CODEC}"; then
  179. AC_MSG_RESULT(none)
  180. else
  181. MODULAR_CODEC="${MODULAR_CODEC# *}"
  182. AC_MSG_RESULT([${MODULAR_CODEC}])
  183. fi
  184. if test "${ac_cv_my_have_il}" = "no" -a "${ac_cv_my_have_ole}" = "no" -a "${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_modular}" = "no"; then
  185. AC_MSG_ERROR([[cannot find DevIL, OLE, SDL_Image, Imlib2, Cocoa, or OpenCV, please install one of them]])
  186. fi
  187. AC_SUBST(MATH_LIBS)
  188. # Build pipi-sharp?
  189. AC_PATH_PROG(GMCS, gmcs, no)
  190. AC_PATH_PROG(GACUTIL, gacutil, no)
  191. AM_CONDITIONAL(USE_CSHARP, test "${GMCS}" != "no" -a "${GACUTIL}" != "no")
  192. # Build The Pimp?
  193. ac_cv_my_have_gtksharp=yes
  194. PKG_CHECK_MODULES([GLIB_SHARP_20], [glib-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
  195. PKG_CHECK_MODULES([GTK_SHARP_20], [gtk-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
  196. AM_CONDITIONAL(USE_GTKSHARP, test "${ac_cv_my_have_gtksharp}" != no)
  197. AC_CONFIG_FILES([
  198. Makefile
  199. pipi/Makefile
  200. src/Makefile
  201. genethumb/Makefile
  202. examples/Makefile
  203. test/Makefile
  204. pipi-sharp/Makefile
  205. ThePimp/Makefile
  206. win32/Makefile
  207. ])
  208. AC_CONFIG_FILES([
  209. pipi/pipi_types.h
  210. pipi/pipi.pc
  211. pipi-sharp/pipi-sharp.pc
  212. pipi-sharp/pipi-sharp.dll.config
  213. ])
  214. AC_CONFIG_FILES([ThePimp/pimp], [chmod +x ThePimp/pimp])
  215. AC_OUTPUT