Skip to content

Autotools: Sync CS in ext/tidy #15561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 23 additions & 28 deletions ext/tidy/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,35 @@ PHP_ARG_WITH([tidy],
[Include TIDY support])])

if test "$PHP_TIDY" != "no"; then

if test "$PHP_TIDY" != "yes"; then
TIDY_SEARCH_DIRS=$PHP_TIDY
else
TIDY_SEARCH_DIRS="/usr/local /usr"
fi
AS_VAR_IF([PHP_TIDY], [yes],
[TIDY_SEARCH_DIRS="/usr/local /usr"],
[TIDY_SEARCH_DIRS=$PHP_TIDY])

for i in $TIDY_SEARCH_DIRS; do
for j in tidy tidyp; do
if test -f $i/include/$j/$j.h; then
TIDY_DIR=$i
TIDY_INCDIR=$i/include/$j
TIDY_LIB_NAME=$j
break
elif test -f $i/include/$j.h; then
TIDY_DIR=$i
TIDY_INCDIR=$i/include
TIDY_LIB_NAME=$j
break
fi
AS_IF([test -f $i/include/$j/$j.h], [
TIDY_DIR=$i
TIDY_INCDIR=$i/include/$j
TIDY_LIB_NAME=$j
break 2
],
[test -f $i/include/$j.h], [
TIDY_DIR=$i
TIDY_INCDIR=$i/include
TIDY_LIB_NAME=$j
break 2
])
done
done

if test -z "$TIDY_DIR"; then
AC_MSG_ERROR([Cannot find libtidy])
else
dnl Check for tidybuffio.h (as opposed to simply buffio.h) which indicates
dnl that we are building against tidy-html5 and not the legacy htmltidy. The
dnl two are compatible, except for with regard to this header file.
if test -f "$TIDY_INCDIR/tidybuffio.h"; then
AC_DEFINE([HAVE_TIDYBUFFIO_H], [1],
[Define to 1 if you have the <tidybuffio.h> header file.])
fi
fi
AS_VAR_IF([TIDY_DIR],, [AC_MSG_ERROR([Cannot find libtidy])])

dnl Check for tidybuffio.h (as opposed to simply buffio.h) which indicates
dnl that we are building against tidy-html5 and not the legacy htmltidy. The
dnl two are compatible, except for with regard to this header file.
AS_IF([test -f "$TIDY_INCDIR/tidybuffio.h"],
[AC_DEFINE([HAVE_TIDYBUFFIO_H], [1],
[Define to 1 if you have the <tidybuffio.h> header file.])])

TIDY_LIBDIR=$TIDY_DIR/$PHP_LIBDIR
AS_VAR_IF([TIDY_LIB_NAME], [tidyp],
Expand Down
Loading