Autotools: Sync CS in ext/tidy (#15561)

- AS_* macros used
- When TIDY_DIR is not set error out in its own "if" sentence
- break 2 used instead of break to exit also the first for loop
This commit is contained in:
Peter Kokot 2024-08-24 23:17:22 +02:00 committed by GitHub
parent c5bce0d8a2
commit 207ae12f59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,40 +4,35 @@ PHP_ARG_WITH([tidy],
[Include TIDY support])]) [Include TIDY support])])
if test "$PHP_TIDY" != "no"; then if test "$PHP_TIDY" != "no"; then
AS_VAR_IF([PHP_TIDY], [yes],
if test "$PHP_TIDY" != "yes"; then [TIDY_SEARCH_DIRS="/usr/local /usr"],
TIDY_SEARCH_DIRS=$PHP_TIDY [TIDY_SEARCH_DIRS=$PHP_TIDY])
else
TIDY_SEARCH_DIRS="/usr/local /usr"
fi
for i in $TIDY_SEARCH_DIRS; do for i in $TIDY_SEARCH_DIRS; do
for j in tidy tidyp; do for j in tidy tidyp; do
if test -f $i/include/$j/$j.h; then AS_IF([test -f $i/include/$j/$j.h], [
TIDY_DIR=$i TIDY_DIR=$i
TIDY_INCDIR=$i/include/$j TIDY_INCDIR=$i/include/$j
TIDY_LIB_NAME=$j TIDY_LIB_NAME=$j
break break 2
elif test -f $i/include/$j.h; then ],
[test -f $i/include/$j.h], [
TIDY_DIR=$i TIDY_DIR=$i
TIDY_INCDIR=$i/include TIDY_INCDIR=$i/include
TIDY_LIB_NAME=$j TIDY_LIB_NAME=$j
break break 2
fi ])
done done
done done
if test -z "$TIDY_DIR"; then AS_VAR_IF([TIDY_DIR],, [AC_MSG_ERROR([Cannot find libtidy])])
AC_MSG_ERROR([Cannot find libtidy])
else
dnl Check for tidybuffio.h (as opposed to simply buffio.h) which indicates 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 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. dnl two are compatible, except for with regard to this header file.
if test -f "$TIDY_INCDIR/tidybuffio.h"; then AS_IF([test -f "$TIDY_INCDIR/tidybuffio.h"],
AC_DEFINE([HAVE_TIDYBUFFIO_H], [1], [AC_DEFINE([HAVE_TIDYBUFFIO_H], [1],
[Define to 1 if you have the <tidybuffio.h> header file.]) [Define to 1 if you have the <tidybuffio.h> header file.])])
fi
fi
TIDY_LIBDIR=$TIDY_DIR/$PHP_LIBDIR TIDY_LIBDIR=$TIDY_DIR/$PHP_LIBDIR
AS_VAR_IF([TIDY_LIB_NAME], [tidyp], AS_VAR_IF([TIDY_LIB_NAME], [tidyp],