config.m4 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. PHP_ARG_WITH([tidy],
  2. [for TIDY support],
  3. [AS_HELP_STRING([[--with-tidy[=DIR]]],
  4. [Include TIDY support])])
  5. if test "$PHP_TIDY" != "no"; then
  6. if test "$PHP_TIDY" != "yes"; then
  7. TIDY_SEARCH_DIRS=$PHP_TIDY
  8. else
  9. TIDY_SEARCH_DIRS="/usr/local /usr"
  10. fi
  11. for i in $TIDY_SEARCH_DIRS; do
  12. for j in tidy tidyp; do
  13. if test -f $i/include/$j/$j.h; then
  14. TIDY_DIR=$i
  15. TIDY_INCDIR=$i/include/$j
  16. TIDY_LIB_NAME=$j
  17. break
  18. elif test -f $i/include/$j.h; then
  19. TIDY_DIR=$i
  20. TIDY_INCDIR=$i/include
  21. TIDY_LIB_NAME=$j
  22. break
  23. fi
  24. done
  25. done
  26. if test -z "$TIDY_DIR"; then
  27. AC_MSG_ERROR(Cannot find libtidy)
  28. else
  29. dnl Check for tidybuffio.h (as opposed to simply buffio.h) which indicates
  30. dnl that we are building against tidy-html5 and not the legacy htmltidy. The
  31. dnl two are compatible, except for with regard to this header file.
  32. if test -f "$TIDY_INCDIR/tidybuffio.h"; then
  33. AC_DEFINE(HAVE_TIDYBUFFIO_H,1,[defined if tidybuffio.h exists])
  34. fi
  35. fi
  36. TIDY_LIBDIR=$TIDY_DIR/$PHP_LIBDIR
  37. if test "$TIDY_LIB_NAME" == 'tidyp'; then
  38. AC_DEFINE(HAVE_TIDYP_H,1,[defined if tidyp.h exists])
  39. else
  40. AC_DEFINE(HAVE_TIDY_H,1,[defined if tidy.h exists])
  41. fi
  42. PHP_CHECK_LIBRARY($TIDY_LIB_NAME,tidyOptGetDoc,
  43. [
  44. AC_DEFINE(HAVE_TIDYOPTGETDOC,1,[ ])
  45. ],[
  46. PHP_CHECK_LIBRARY(tidy5,tidyOptGetDoc,
  47. [
  48. TIDY_LIB_NAME=tidy5
  49. AC_DEFINE(HAVE_TIDYOPTGETDOC,1,[ ])
  50. ], [], [])
  51. ],[])
  52. PHP_CHECK_LIBRARY($TIDY_LIB_NAME,tidyReleaseDate,
  53. [
  54. AC_DEFINE(HAVE_TIDYRELEASEDATE,1,[ ])
  55. ], [], [])
  56. PHP_ADD_LIBRARY_WITH_PATH($TIDY_LIB_NAME, $TIDY_LIBDIR, TIDY_SHARED_LIBADD)
  57. PHP_ADD_INCLUDE($TIDY_INCDIR)
  58. dnl Add -Wno-ignored-qualifiers as this is an issue upstream
  59. TIDY_COMPILER_FLAGS="$TIDY_CFLAGS -Wno-ignored-qualifiers -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
  60. PHP_NEW_EXTENSION(tidy, tidy.c, $ext_shared,, $TIDY_COMPILER_FLAGS)
  61. PHP_SUBST(TIDY_SHARED_LIBADD)
  62. AC_DEFINE(HAVE_TIDY,1,[ ])
  63. fi