You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

210 lines
6.4 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_OBJC
  20. _AM_DEPENDENCIES([OBJC])
  21. OBJC="${CC}"
  22. AC_SUBST(OBJC)
  23. AC_SUBST(OBJCFLAGS)
  24. AC_LIBTOOL_WIN32_DLL
  25. AM_PROG_LIBTOOL
  26. AC_LIBTOOL_CXX
  27. AC_C_CONST
  28. AC_C_INLINE
  29. dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
  30. dnl now otherwise it might be set in an obscure if statement. Same thing for
  31. dnl PKG_PROG_PKG_CONFIG which needs to be called first.
  32. AC_EGREP_CPP(yes, foo)
  33. PKG_PROG_PKG_CONFIG()
  34. m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
  35. if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
  36. export PKG_CONFIG_LIBDIR=/dev/null
  37. fi
  38. AC_MSG_CHECKING(for library suffix)
  39. 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`"
  40. if test "$LT_SUFFIX" = ""; then
  41. LT_SUFFIX=".so.$LT_MAJOR"
  42. AC_MSG_RESULT([unknown, defaulting to $LT_SUFFIX])
  43. else
  44. AC_MSG_RESULT($LT_SUFFIX)
  45. fi
  46. AC_SUBST(LT_SUFFIX)
  47. AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h)
  48. ac_cv_have_getopt_long="no"
  49. AC_CHECK_FUNCS(getopt_long,
  50. [ac_cv_have_getopt_long="yes"],
  51. [AC_CHECK_LIB(gnugetopt, getopt_long,
  52. [ac_cv_have_getopt_long="yes"
  53. GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
  54. if test "$ac_cv_have_getopt_long" != "no"; then
  55. AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)
  56. fi
  57. AM_CONDITIONAL(NEED_GETOPT_LONG, test "$ac_cv_have_getopt_long" = "no")
  58. AC_SUBST(GETOPT_LIBS)
  59. # How to get the C99 types. See pipi/pipi_types.h.in for details about
  60. # the PIPI_TYPES variable
  61. if test "${ac_cv_my_have_vga}" = "yes"; then
  62. PIPI_TYPES=0
  63. else
  64. AC_CHECK_HEADERS(stdint.h,
  65. [PIPI_TYPES=1],
  66. [AC_CHECK_HEADERS(inttypes.h,
  67. [PIPI_TYPES=2],
  68. [AC_CHECK_HEADERS(windows.h,
  69. [PIPI_TYPES=3],
  70. [PIPI_TYPES=0])])])
  71. fi
  72. AC_SUBST(PIPI_TYPES)
  73. # Optimizations
  74. CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
  75. # Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  76. CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
  77. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  78. # Use DevIL?
  79. #AC_CHECK_HEADERS(IL/il.h,
  80. # [ac_cv_my_have_il="yes"],
  81. # [ac_cv_my_have_il="no"])
  82. #CPPFLAGS="${save_CPPFLAGS}"
  83. #AM_CONDITIONAL(USE_IL, test "${ac_cv_my_have_il}" = "yes")
  84. # Use Windows?
  85. #AC_CHECK_HEADERS(olectl.h,
  86. # [ac_cv_my_have_ole="yes"],
  87. # [ac_cv_my_have_ole="no"])
  88. #CPPFLAGS="${save_CPPFLAGS}"
  89. #AM_CONDITIONAL(USE_OLE, test "${ac_cv_my_have_ole}" = "yes")
  90. # Use SDL?
  91. ac_cv_my_have_sdl="no"
  92. save_CPPFLAGS="${CPPFLAGS}"
  93. AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  94. if test "${SDL_CONFIG}" != "no"; then
  95. CPPFLAGS="${CPPFLAGS} `sdl-config --cflags`"
  96. fi
  97. AC_CHECK_HEADERS(SDL_image.h,
  98. [ac_cv_my_have_sdl="yes"],
  99. [ac_cv_my_have_sdl="no"])
  100. CPPFLAGS="${save_CPPFLAGS}"
  101. if test "${ac_cv_my_have_sdl}" != "no"; then
  102. AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL_image)
  103. fi
  104. AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
  105. # Use OpenCV?
  106. ac_cv_my_have_opencv="no"
  107. OPENCV="no"
  108. PKG_CHECK_MODULES(OPENCV, opencv, [ac_cv_my_have_opencv="yes"], [:])
  109. if test "${ac_cv_my_have_opencv}" != "no"; then
  110. AC_DEFINE(USE_OPENCV, 1, Define to 1 to use OpenCV)
  111. fi
  112. AM_CONDITIONAL(USE_OPENCV, test "${ac_cv_my_have_opencv}" = "yes")
  113. # Use Imlib2?
  114. ac_cv_my_have_imlib2="no"
  115. IMLIB2="no"
  116. PKG_CHECK_MODULES(IMLIB2, imlib2, [ac_cv_my_have_imlib2="yes"], [:])
  117. if test "${ac_cv_my_have_imlib2}" != "no"; then
  118. AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2)
  119. fi
  120. AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes")
  121. # Use Windows GDI?
  122. ac_cv_my_have_gdi="no"
  123. GDI="no"
  124. AC_CHECK_HEADERS(windows.h,
  125. [ac_cv_my_have_gdi="yes"],
  126. [ac_cv_my_have_gdi="no"])
  127. if test "${ac_cv_my_have_gdi}" != "no"; then
  128. AC_DEFINE(USE_GDI, 1, Define to 1 to use GDI)
  129. fi
  130. AM_CONDITIONAL(USE_GDI, test "${ac_cv_my_have_gdi}" = "yes")
  131. # Use Cocoa?
  132. ac_cv_my_have_cocoa="no"
  133. AC_CHECK_HEADERS(/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h,
  134. [
  135. MACOSX_SDK_FRAMEWORKS="-F${MACOSX_SDK}/System/Library/Frameworks"
  136. CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
  137. CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
  138. CXXFLAGS="${CXXFLAGS} ${MACOSX_SDK_CXXFLAGS}"
  139. OBJCFLAGS="${OBJCFLAGS} ${MACOSX_SDK_CFLAGS}"
  140. LDFLAGS="${ARCH} ${MACOSX_SDK_LDFLAGS} ${LDFLAGS}"
  141. AC_DEFINE(USE_COCOA, 1, Define to 1 to activate the Cocoa backend driver)
  142. # CACA_LIBS="${CACA_LIBS} -Wl,-syslibroot,${MACOSX_SDK},-framework,Cocoa"
  143. # CACA_DRIVERS="${CACA_DRIVERS} cocoa"
  144. ac_cv_my_have_cocoa="yes"],
  145. [ac_cv_my_have_cocoa="no"]
  146. )
  147. AM_CONDITIONAL(USE_COCOA, test "${ac_cv_my_have_cocoa}" = "yes")
  148. 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"; then
  149. AC_MSG_ERROR([[cannot find DevIL, OLE, SDL_Image, Imlib2, Cocoa, or OpenCV, please install one of them]])
  150. fi
  151. AC_SUBST(MATH_LIBS)
  152. # Build pipi-sharp?
  153. AC_PATH_PROG(GMCS, gmcs, no)
  154. AC_PATH_PROG(GACUTIL, gacutil, no)
  155. AM_CONDITIONAL(USE_CSHARP, test "${GMCS}" != "no" -a "${GACUTIL}" != "no")
  156. # Build The Pimp?
  157. ac_cv_my_have_gtksharp=yes
  158. PKG_CHECK_MODULES([GLADE_SHARP_20], [glade-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
  159. PKG_CHECK_MODULES([GLIB_SHARP_20], [glib-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
  160. PKG_CHECK_MODULES([GTK_SHARP_20], [gtk-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
  161. AM_CONDITIONAL(USE_GTKSHARP, test "${ac_cv_my_have_gtksharp}" != no)
  162. AC_CONFIG_FILES([
  163. Makefile
  164. pipi/Makefile
  165. src/Makefile
  166. genethumb/Makefile
  167. examples/Makefile
  168. test/Makefile
  169. pipi-sharp/Makefile
  170. ThePimp/Makefile
  171. win32/Makefile
  172. ])
  173. AC_CONFIG_FILES([
  174. pipi/pipi_types.h
  175. pipi/pipi.pc
  176. pipi-sharp/pipi-sharp.pc
  177. pipi-sharp/pipi-sharp.dll.config
  178. ])
  179. AC_CONFIG_FILES([ThePimp/pimp], [chmod +x ThePimp/pimp])
  180. AC_OUTPUT