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