Skip to content

Commit 1d2aca2

Browse files
committed
Autotools: Fix tidy library checks
When configuring with tidy library installed in non-standard paths, the library adding macro must be done before the PHP_CHECK_LIBRARY to be able to detect it. This fixes these edge cases. For example: ./configure --with-tidy=/path/to/custom-tidy-installation
1 parent 207ae12 commit 1d2aca2

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

ext/tidy/config.m4

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@ if test "$PHP_TIDY" != "no"; then
3434
[AC_DEFINE([HAVE_TIDYBUFFIO_H], [1],
3535
[Define to 1 if you have the <tidybuffio.h> header file.])])
3636

37-
TIDY_LIBDIR=$TIDY_DIR/$PHP_LIBDIR
3837
AS_VAR_IF([TIDY_LIB_NAME], [tidyp],
3938
[AC_DEFINE([HAVE_TIDYP_H], [1],
4039
[Define to 1 if you have the <tidyp.h> header file.])],
4140
[AC_DEFINE([HAVE_TIDY_H], [1],
4241
[Define to 1 if you have the <tidy.h> header file.])])
4342

43+
PHP_ADD_LIBRARY_WITH_PATH([$TIDY_LIB_NAME],
44+
[$TIDY_DIR/$PHP_LIBDIR],
45+
[TIDY_SHARED_LIBADD])
46+
PHP_ADD_INCLUDE([$TIDY_INCDIR])
47+
4448
PHP_CHECK_LIBRARY([$TIDY_LIB_NAME], [tidyOptGetDoc],
4549
[AC_DEFINE([HAVE_TIDYOPTGETDOC], [1],
4650
[Define to 1 if Tidy library has the 'tidyOptGetDoc' function.])],
@@ -52,11 +56,6 @@ if test "$PHP_TIDY" != "no"; then
5256
[AC_DEFINE([HAVE_TIDYRELEASEDATE], [1],
5357
[Define to 1 if Tidy library has the 'tidyReleaseDate' function.])])
5458

55-
PHP_ADD_LIBRARY_WITH_PATH([$TIDY_LIB_NAME],
56-
[$TIDY_LIBDIR],
57-
[TIDY_SHARED_LIBADD])
58-
PHP_ADD_INCLUDE([$TIDY_INCDIR])
59-
6059
dnl Add -Wno-ignored-qualifiers as this is an issue upstream
6160
TIDY_COMPILER_FLAGS="$TIDY_CFLAGS -Wno-ignored-qualifiers -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
6261
PHP_NEW_EXTENSION([tidy], [tidy.c], [$ext_shared],, [$TIDY_COMPILER_FLAGS])

0 commit comments

Comments
 (0)