mirror of
https://github.com/php/php-src.git
synced 2025-08-17 22:48:57 +02:00
Tidy extension update to be able to either use tidy or tidyp at configure time
This commit is contained in:
parent
93185218e1
commit
e7da9685cf
3 changed files with 38 additions and 9 deletions
|
@ -14,13 +14,19 @@ if test "$PHP_TIDY" != "no"; then
|
|||
fi
|
||||
|
||||
for i in $TIDY_SEARCH_DIRS; do
|
||||
if test -f $i/include/tidy/tidy.h; then
|
||||
TIDY_DIR=$i
|
||||
TIDY_INCDIR=$i/include/tidy
|
||||
elif test -f $i/include/tidy.h; then
|
||||
TIDY_DIR=$i
|
||||
TIDY_INCDIR=$i/include
|
||||
fi
|
||||
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
|
||||
done
|
||||
done
|
||||
|
||||
if test -z "$TIDY_DIR"; then
|
||||
|
@ -36,9 +42,14 @@ if test "$PHP_TIDY" != "no"; then
|
|||
fi
|
||||
|
||||
TIDY_LIBDIR=$TIDY_DIR/$PHP_LIBDIR
|
||||
if test "$TIDY_LIB_NAME" == 'tidyp'; then
|
||||
AC_DEFINE(HAVE_TIDYP_H,1,[defined if tidyp.h exists])
|
||||
else
|
||||
AC_DEFINE(HAVE_TIDY_H,1,[defined if tidy.h exists])
|
||||
fi
|
||||
|
||||
TIDY_LIB_NAME=tidy
|
||||
PHP_CHECK_LIBRARY(tidy,tidyOptGetDoc,
|
||||
|
||||
PHP_CHECK_LIBRARY($TIDY_LIB_NAME,tidyOptGetDoc,
|
||||
[
|
||||
AC_DEFINE(HAVE_TIDYOPTGETDOC,1,[ ])
|
||||
],[
|
||||
|
@ -49,6 +60,11 @@ if test "$PHP_TIDY" != "no"; then
|
|||
], [], [])
|
||||
],[])
|
||||
|
||||
PHP_CHECK_LIBRARY($TIDY_LIB_NAME,tidyReleaseDate,
|
||||
[
|
||||
AC_DEFINE(HAVE_TIDYRELEASEDATE,1,[ ])
|
||||
], [], [])
|
||||
|
||||
PHP_ADD_LIBRARY_WITH_PATH($TIDY_LIB_NAME, $TIDY_LIBDIR, TIDY_SHARED_LIBADD)
|
||||
PHP_ADD_INCLUDE($TIDY_INCDIR)
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ if (PHP_TIDY != "no") {
|
|||
|
||||
EXTENSION("tidy", "tidy.c");
|
||||
AC_DEFINE('HAVE_TIDY', 1, 'Have TIDY library');
|
||||
AC_DEFINE('HAVE_TIDY_H', 1, "tidy include header")
|
||||
ADD_FLAG('CFLAGS_TIDY', '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
|
||||
if (!PHP_TIDY_SHARED) {
|
||||
ADD_DEF_FILE("ext\\tidy\\php_tidy.def");
|
||||
|
|
|
@ -30,7 +30,11 @@
|
|||
#include "php_ini.h"
|
||||
#include "ext/standard/info.h"
|
||||
|
||||
#if HAVE_TIDY_H
|
||||
#include "tidy.h"
|
||||
#elif HAVE_TIDYP_H
|
||||
#include "tidyp.h"
|
||||
#endif
|
||||
|
||||
#if HAVE_TIDYBUFFIO_H
|
||||
#include "tidybuffio.h"
|
||||
|
@ -1073,8 +1077,12 @@ static PHP_MINFO_FUNCTION(tidy)
|
|||
php_info_print_table_header(2, "Tidy support", "enabled");
|
||||
#if HAVE_TIDYBUFFIO_H
|
||||
php_info_print_table_row(2, "libTidy Version", (char *)tidyLibraryVersion());
|
||||
#elif HAVE_TIDYP_H
|
||||
php_info_print_table_row(2, "libTidy Version", (char *)tidyVersion());
|
||||
#endif
|
||||
#if HAVE_TIDYRELEASEDATE
|
||||
php_info_print_table_row(2, "libTidy Release", (char *)tidyReleaseDate());
|
||||
#endif
|
||||
php_info_print_table_row(2, "Extension Version", PHP_TIDY_VERSION " ($Id$)");
|
||||
php_info_print_table_end();
|
||||
|
||||
|
@ -1342,7 +1350,11 @@ static PHP_FUNCTION(tidy_get_release)
|
|||
return;
|
||||
}
|
||||
|
||||
#if HAVE_TIDYRELEASEDATE
|
||||
RETURN_STRING((char *)tidyReleaseDate());
|
||||
#else
|
||||
RETURN_STRING((char *)"unknown");
|
||||
#endif
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue