Skip to content

Commit 207ae12

Browse files
authored
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
1 parent c5bce0d commit 207ae12

File tree

1 file changed

+23
-28
lines changed

1 file changed

+23
-28
lines changed

ext/tidy/config.m4

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,35 @@ PHP_ARG_WITH([tidy],
44
[Include TIDY support])])
55

66
if 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
7+
AS_VAR_IF([PHP_TIDY], [yes],
8+
[TIDY_SEARCH_DIRS="/usr/local /usr"],
9+
[TIDY_SEARCH_DIRS=$PHP_TIDY])
1310

1411
for i in $TIDY_SEARCH_DIRS; do
1512
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
13+
AS_IF([test -f $i/include/$j/$j.h], [
14+
TIDY_DIR=$i
15+
TIDY_INCDIR=$i/include/$j
16+
TIDY_LIB_NAME=$j
17+
break 2
18+
],
19+
[test -f $i/include/$j.h], [
20+
TIDY_DIR=$i
21+
TIDY_INCDIR=$i/include
22+
TIDY_LIB_NAME=$j
23+
break 2
24+
])
2725
done
2826
done
2927

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) which indicates
34-
dnl that we are building against tidy-html5 and not the legacy htmltidy. The
35-
dnl two are compatible, except for with regard to this header file.
36-
if test -f "$TIDY_INCDIR/tidybuffio.h"; then
37-
AC_DEFINE([HAVE_TIDYBUFFIO_H], [1],
38-
[Define to 1 if you have the <tidybuffio.h> header file.])
39-
fi
40-
fi
28+
AS_VAR_IF([TIDY_DIR],, [AC_MSG_ERROR([Cannot find libtidy])])
29+
30+
dnl Check for tidybuffio.h (as opposed to simply buffio.h) which indicates
31+
dnl that we are building against tidy-html5 and not the legacy htmltidy. The
32+
dnl two are compatible, except for with regard to this header file.
33+
AS_IF([test -f "$TIDY_INCDIR/tidybuffio.h"],
34+
[AC_DEFINE([HAVE_TIDYBUFFIO_H], [1],
35+
[Define to 1 if you have the <tidybuffio.h> header file.])])
4136

4237
TIDY_LIBDIR=$TIDY_DIR/$PHP_LIBDIR
4338
AS_VAR_IF([TIDY_LIB_NAME], [tidyp],

0 commit comments

Comments
 (0)