xref: /PHP-7.1/ext/tidy/config.m4 (revision ddbac6d7)
1dnl
2dnl $Id$
3dnl
4
5PHP_ARG_WITH(tidy,for TIDY support,
6[  --with-tidy[=DIR]         Include TIDY support])
7
8if test "$PHP_TIDY" != "no"; then
9
10  if test "$PHP_TIDY" != "yes"; then
11    TIDY_SEARCH_DIRS=$PHP_TIDY
12  else
13    TIDY_SEARCH_DIRS="/usr/local /usr"
14  fi
15
16  for i in $TIDY_SEARCH_DIRS; do
17    if test -f $i/include/tidy/tidy.h; then
18      TIDY_DIR=$i
19      TIDY_INCDIR=$i/include/tidy
20    elif test -f $i/include/tidy.h; then
21      TIDY_DIR=$i
22      TIDY_INCDIR=$i/include
23    fi
24  done
25
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)
30    dnl which indicates that we are building against tidy-html5
31    dnl and not the legacy htmltidy. The two are compatible,
32    dnl except for with regard to this header file.
33    if test -f "$TIDY_INCDIR/tidybuffio.h"; then
34      AC_DEFINE(HAVE_TIDYBUFFIO_H,1,[defined if tidybuffio.h exists])
35    fi
36  fi
37
38  TIDY_LIBDIR=$TIDY_DIR/$PHP_LIBDIR
39
40  TIDY_LIB_NAME=tidy
41  PHP_CHECK_LIBRARY(tidy,tidyOptGetDoc,
42  [
43    AC_DEFINE(HAVE_TIDYOPTGETDOC,1,[ ])
44  ],[
45    PHP_CHECK_LIBRARY(tidy5,tidyOptGetDoc,
46    [
47      TIDY_LIB_NAME=tidy5
48      AC_DEFINE(HAVE_TIDYOPTGETDOC,1,[ ])
49    ], [], [])
50  ],[])
51
52  PHP_ADD_LIBRARY_WITH_PATH($TIDY_LIB_NAME, $TIDY_LIBDIR, TIDY_SHARED_LIBADD)
53  PHP_ADD_INCLUDE($TIDY_INCDIR)
54
55
56  PHP_NEW_EXTENSION(tidy, tidy.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
57  PHP_SUBST(TIDY_SHARED_LIBADD)
58  AC_DEFINE(HAVE_TIDY,1,[ ])
59fi
60