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.

250 lines
8.0 KiB

25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
27 years ago
  1. dnl
  2. dnl $Id$
  3. dnl
  4. AC_DEFUN(PHP_GD_JPEG,[
  5. PHP_ARG_WITH(jpeg-dir, for the location of libjpeg,
  6. [ --with-jpeg-dir=DIR GD: Set the path to libjpeg install prefix.])
  7. if test "$PHP_JPEG_DIR" != "no"; then
  8. for i in /usr /usr/local $PHP_JPEG_DIR; do
  9. test -f "$i/lib/libjpeg.s?" -o -f "$i/lib/libjpeg.a" && GD_JPEG_DIR=$i
  10. done
  11. PHP_CHECK_LIBRARY(jpeg,jpeg_read_header,
  12. [
  13. PHP_ADD_LIBRARY_WITH_PATH(jpeg, $GD_JPEG_DIR/lib, GD_SHARED_LIBADD)
  14. ],[
  15. AC_MSG_ERROR(Problem with libjpeg.(a|so). Please check config.log for more information.)
  16. ],[
  17. -L$GD_JPEG_DIR/lib
  18. ])
  19. else
  20. AC_MSG_RESULT(If configure fails try --with-jpeg-dir=<DIR>)
  21. fi
  22. ])
  23. AC_DEFUN(PHP_GD_PNG,[
  24. PHP_ARG_WITH(png-dir, for the location of libpng,
  25. [ --with-png-dir=DIR GD: Set the path to libpng install prefix.])
  26. if test "$PHP_PNG_DIR" != "no"; then
  27. for i in /usr /usr/local $PHP_PNG_DIR; do
  28. test -f "$i/lib/libpng.s?" -o -f "$i/lib/libpng.a" && GD_PNG_DIR=$i
  29. done
  30. if test "$PHP_ZLIB_DIR" = "no"; then
  31. AC_MSG_ERROR(PNG support requires ZLIB. Use --with-zlib-dir=<DIR>)
  32. fi
  33. PHP_CHECK_LIBRARY(png,png_info_init,
  34. [
  35. PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/lib, GD_SHARED_LIBADD)
  36. PHP_ADD_LIBRARY_WITH_PATH(png, $GD_PNG_DIR/lib, GD_SHARED_LIBADD)
  37. ],[
  38. AC_MSG_ERROR(Problem with libpng.(a|so) or libz.(a|so). Please check config.log for more information.)
  39. ],[
  40. -L$PHP_ZLIB_DIR/lib -lz -L$GD_PNG_DIR/lib
  41. ])
  42. else
  43. AC_MSG_RESULT(If configure fails try --with-png-dir=<DIR> and --with-zlib-dir=<DIR>)
  44. fi
  45. ])
  46. AC_DEFUN(PHP_GD_XPM,[
  47. PHP_ARG_WITH(xpm-dir, for the location of libXpm,
  48. [ --with-xpm-dir=DIR GD: Set the path to libXpm install prefix.])
  49. if test "$PHP_XPM_DIR" != "no"; then
  50. for i in /usr /usr/local /usr/X11R6 $PHP_XPM_DIR; do
  51. test -f "$i/lib/libXpm.s?" -o -f "$i/lib/libXpm.a" && GD_XPM_DIR=$i
  52. done
  53. PHP_CHECK_LIBRARY(Xpm,XpmFreeXpmImage,
  54. [
  55. PHP_ADD_LIBRARY_WITH_PATH(Xpm, $GD_XPM_DIR/lib, GD_SHARED_LIBADD)
  56. PHP_ADD_LIBRARY_WITH_PATH(X11, $GD_XPM_DIR/lib, GD_SHARED_LIBADD)
  57. ],[
  58. AC_MSG_ERROR(Problem with libXpm.(a|so) or libX11.(a|so). Please check config.log for more information.)
  59. ],[
  60. -L$GD_XPM_DIR/lib -lX11
  61. ])
  62. else
  63. AC_MSG_RESULT(If configure fails try --with-xpm-dir=<DIR>)
  64. fi
  65. ])
  66. AC_DEFUN(PHP_GD_FREETYPE1,[
  67. PHP_ARG_WITH(ttf,whether to include include FreeType 1.x support,
  68. [ --with-ttf[=DIR] GD: Include FreeType 1.x support])
  69. if test "$PHP_TTF" != "no"; then
  70. if test "$PHP_FREETYPE_DIR" = "no" -o "$PHP_FREETYPE_DIR" = ""; then
  71. if test -n "$PHP_TTF" ; then
  72. for i in /usr /usr/local $PHP_TTF; do
  73. if test -f "$i/include/freetype.h" ; then
  74. TTF_DIR=$i
  75. unset TTF_INC_DIR
  76. fi
  77. if test -f "$i/include/freetype/freetype.h"; then
  78. TTF_DIR=$i
  79. TTF_INC_DIR=$i/include/freetype
  80. fi
  81. done
  82. fi
  83. if test -n "$TTF_DIR" ; then
  84. AC_DEFINE(HAVE_LIBTTF,1,[ ])
  85. PHP_ADD_LIBRARY_WITH_PATH(ttf, $TTF_DIR/lib, GD_SHARED_LIBADD)
  86. fi
  87. if test -z "$TTF_INC_DIR"; then
  88. TTF_INC_DIR=$TTF_DIR/include
  89. fi
  90. PHP_ADD_INCLUDE($TTF_INC_DIR)
  91. else
  92. AC_MSG_RESULT(no - FreeType 2.x is to be used instead)
  93. fi
  94. fi
  95. ])
  96. AC_DEFUN(PHP_GD_FREETYPE2,[
  97. PHP_ARG_WITH(freetype-dir, for freetype(2),
  98. [ --with-freetype-dir=DIR GD: Set the path to freetype2 install prefix.])
  99. if test "$PHP_FREETYPE_DIR" != "no"; then
  100. for i in /usr /usr/local $PHP_FREETYPE_DIR; do
  101. if test -f "$i/include/freetype2/freetype/freetype.h"; then
  102. FREETYPE2_DIR=$i
  103. FREETYPE2_INC_DIR=$i/include/freetype2/freetype
  104. fi
  105. done
  106. if test -n "$FREETYPE2_DIR" ; then
  107. PHP_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE2_DIR/lib, GD_SHARED_LIBADD)
  108. PHP_ADD_INCLUDE($FREETYPE2_INC_DIR)
  109. AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
  110. AC_DEFINE(HAVE_LIBFREETYPE,1,[ ])
  111. else
  112. AC_MSG_ERROR(freetype2 not found!)
  113. fi
  114. else
  115. AC_MSG_RESULT(If configure fails try --with-freetype-dir=<DIR>)
  116. fi
  117. ])
  118. AC_DEFUN(PHP_GD_T1LIB,[
  119. PHP_ARG_WITH(t1lib, whether to include T1lib support,
  120. [ --with-t1lib[=DIR] GD: Include T1lib support.])
  121. if test "$PHP_T1LIB" != "no"; then
  122. for i in /usr /usr/local $PHP_T1LIB; do
  123. test -f "$i/include/t1lib.h" && T1_DIR=$i
  124. done
  125. if test -n "$T1_DIR"; then
  126. PHP_CHECK_LIBRARY(t1, T1_LoadFont,
  127. [
  128. AC_DEFINE(HAVE_LIBT1,1,[ ])
  129. PHP_ADD_INCLUDE("$T1_DIR/include")
  130. PHP_ADD_LIBRARY_WITH_PATH(t1, "$T1_DIR/lib", GD_SHARED_LIBADD)
  131. ],[
  132. AC_MSG_ERROR(Problem with libt1.(a|so). Please check config.log for more information.)
  133. ],[
  134. -L$T1_DIR/lib
  135. ])
  136. else
  137. AC_MSG_ERROR(Your t1lib distribution is not installed correctly. Please reinstall it.)
  138. fi
  139. fi
  140. ])
  141. AC_DEFUN(PHP_GD_TTSTR,[
  142. PHP_ARG_ENABLE(gd-native-ttf, whether to enable truetype string function in gd,
  143. [ --enable-gd-native-ttf GD: Enable TrueType string function in gd])
  144. if test "$PHP_GD_NATIVE_TTF" = "yes"; then
  145. AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
  146. fi
  147. ])
  148. AC_DEFUN(PHP_GD_CHECK_VERSION,[
  149. AC_CHECK_LIB(gd, gdImageString16, [AC_DEFINE(HAVE_LIBGD13, 1, [ ])])
  150. AC_CHECK_LIB(gd, gdImagePaletteCopy, [AC_DEFINE(HAVE_LIBGD15, 1, [ ])])
  151. AC_CHECK_LIB(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1, [ ])])
  152. AC_CHECK_LIB(gd, gdImageCreateFromGif, [AC_DEFINE(HAVE_GD_GIF_READ, 1, [ ])])
  153. AC_CHECK_LIB(gd, gdImageGif, [AC_DEFINE(HAVE_GD_GIF_CREATE, 1, [ ])])
  154. AC_CHECK_LIB(gd, gdImageWBMP, [AC_DEFINE(HAVE_GD_WBMP, 1, [ ])])
  155. AC_CHECK_LIB(gd, gdImageCreateFromJpeg, [AC_DEFINE(HAVE_GD_JPG, 1, [ ])])
  156. AC_CHECK_LIB(gd, gdImageCreateFromXpm, [AC_DEFINE(HAVE_GD_XPM, 1, [ ])])
  157. AC_CHECK_LIB(gd, gdImageCreateFromGd2, [AC_DEFINE(HAVE_GD_GD2, 1, [ ])])
  158. AC_CHECK_LIB(gd, gdImageCreateTrueColor, [AC_DEFINE(HAVE_LIBGD20, 1, [ ])])
  159. AC_CHECK_LIB(gd, gdImageSetTile, [AC_DEFINE(HAVE_GD_IMAGESETTILE, 1, [ ])])
  160. AC_CHECK_LIB(gd, gdImageSetBrush, [AC_DEFINE(HAVE_GD_IMAGESETBRUSH, 1, [ ])])
  161. AC_CHECK_LIB(gd, gdImageStringFTEx, [AC_DEFINE(HAVE_GD_STRINGFTEX, 1, [ ])])
  162. AC_CHECK_LIB(gd, gdImageColorClosestHWB, [AC_DEFINE(HAVE_COLORCLOSESTHWB, 1, [ ])])
  163. AC_CHECK_LIB(gd, gdImageColorResolve, [AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE, 1, [ ])])
  164. AC_CHECK_LIB(gd, gdImageGifCtx, [AC_DEFINE(HAVE_GD_GIF_CTX, 1, [ ])])
  165. ])
  166. PHP_ARG_WITH(gd, whether to include GD support,
  167. [ --with-gd[=DIR] Include GD support (DIR is GD's install dir).
  168. Set DIR to "shared" to build as a dl, or
  169. "shared,DIR" to build as a dl and still specify DIR.])
  170. if test "$PHP_GD" != "no"; then
  171. PHP_EXTENSION(gd, $ext_shared)
  172. PHP_SUBST(GD_SHARED_LIBADD)
  173. dnl Various checks for GD features
  174. PHP_GD_TTSTR
  175. PHP_GD_JPEG
  176. PHP_GD_PNG
  177. PHP_GD_XPM
  178. PHP_GD_FREETYPE2
  179. PHP_GD_FREETYPE1
  180. PHP_GD_T1LIB
  181. case $PHP_GD in
  182. yes)
  183. PHP_ADD_LIBRARY(gd,, GD_SHARED_LIBADD)
  184. PHP_GD_CHECK_VERSION
  185. AC_DEFINE(HAVE_LIBGD,1,[ ])
  186. ;;
  187. *)
  188. dnl A whole whack of possible places where these might be
  189. for i in include/gd1.3 include/gd include gd1.3 gd ""; do
  190. test -f $PHP_GD/$i/gd.h && GD_INCLUDE=$PHP_GD/$i
  191. done
  192. for i in lib/gd1.3 lib/gd lib gd1.3 gd ""; do
  193. test -f $PHP_GD/$i/libgd.s? -o -f $PHP_GD/$i/libgd.a && GD_LIB=$PHP_GD/$i
  194. done
  195. if test -n "$GD_INCLUDE" && test -n "$GD_LIB" ; then
  196. PHP_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB, GD_SHARED_LIBADD)
  197. AC_DEFINE(HAVE_LIBGD,1,[ ])
  198. PHP_GD_CHECK_VERSION
  199. else
  200. AC_MSG_ERROR([Unable to find libgd.(a|so) anywhere under $withval])
  201. fi
  202. ;;
  203. esac
  204. dnl NetBSD package structure
  205. if test -f /usr/pkg/include/gd/gd.h -a -z "$GD_INCLUDE" ; then
  206. GD_INCLUDE=/usr/pkg/include/gd
  207. fi
  208. dnl SuSE 6.x package structure
  209. if test -f /usr/include/gd/gd.h -a -z "$GD_INCLUDE" ; then
  210. GD_INCLUDE=/usr/include/gd
  211. fi
  212. PHP_EXPAND_PATH($GD_INCLUDE, GD_INCLUDE)
  213. PHP_ADD_INCLUDE($GD_INCLUDE)
  214. fi