Skip to content

Refactor ext/mbstring/libmbfl/config.h usage #13713

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,6 @@ AC_CHECK_HEADERS(m4_normalize([
pty.h
pwd.h
resolv.h
strings.h
syslog.h
sysexits.h
sys/ioctl.h
Expand Down Expand Up @@ -579,7 +578,6 @@ AC_CHECK_FUNCS(m4_normalize([
statfs
statvfs
std_syslog
strcasecmp
strnlen
strptime
strtok_r
Expand Down
25 changes: 13 additions & 12 deletions ext/mbstring/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,15 @@ AC_DEFUN([PHP_MBSTRING_SETUP_MBREGEX], [
PHP_INSTALL_HEADERS([ext/mbstring], [php_mbregex.h php_onig_compat.h])
])

dnl
dnl PHP_MBSTRING_SETUP_LIBMBFL
dnl
dnl Configure bundled libmbfl. It is required and cannot be disabled.
dnl
AC_DEFUN([PHP_MBSTRING_SETUP_LIBMBFL], [
dnl
dnl Bundled libmbfl is required and can not be disabled
dnl
AC_CHECK_HEADERS([strings.h])
AC_CHECK_FUNCS([strcasecmp])

PHP_MBSTRING_ADD_BUILD_DIR([libmbfl])
PHP_MBSTRING_ADD_BUILD_DIR([libmbfl/mbfl])
PHP_MBSTRING_ADD_BUILD_DIR([libmbfl/filters])
Expand Down Expand Up @@ -144,7 +149,6 @@ if test "$PHP_MBSTRING" != "no"; then

AS_VAR_IF([PHP_MBREGEX], [yes], [PHP_MBSTRING_SETUP_MBREGEX])

dnl libmbfl is required
PHP_MBSTRING_SETUP_LIBMBFL

PHP_NEW_EXTENSION([mbstring],
Expand All @@ -159,18 +163,15 @@ if test "$PHP_MBSTRING" != "no"; then
done

for dir in $PHP_MBSTRING_EXTRA_INCLUDES; do
PHP_ADD_INCLUDE([$ext_srcdir/$dir])
PHP_ADD_INCLUDE([$ext_builddir/$dir])
PHP_ADD_INCLUDE([$ext_srcdir/$dir])
done

out="php_config.h"

if test "$ext_shared" != "no" && test -f "$ext_builddir/config.h.in"; then
out="$abs_builddir/config.h"
fi

cat > $ext_builddir/libmbfl/config.h <<EOF
#include "$out"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <php_config.h>
EOF

PHP_INSTALL_HEADERS([ext/mbstring], [mbstring.h])
Expand Down
9 changes: 6 additions & 3 deletions ext/mbstring/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ if (PHP_MBSTRING != "no") {
STDOUT.WriteLine("Using bundled libmbfl...");

ADD_FLAG("CFLAGS_MBSTRING", "-Iext/mbstring -Iext/mbstring/libmbfl -Iext/mbstring/libmbfl/mbfl \
/D HAVE_STRICMP /D MBFL_DLL_EXPORT=1 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1")
/D MBFL_DLL_EXPORT=1 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1")

ADD_FLAG("CFLAGS_BD_EXT_MBSTRING", "/utf-8")

FSO.CopyFile("ext\\mbstring\\libmbfl\\config.h.w32",
"ext\\mbstring\\libmbfl\\config.h", true);
var mbfl_config = FSO.CreateTextFile("ext/mbstring/libmbfl/config.h", true);
mbfl_config.WriteLine("#define HAVE_STRCASECMP 1");
mbfl_config.WriteLine("#define HAVE_STRICMP 1");
mbfl_config.WriteLine("#include <config.w32.h>");
mbfl_config.Close();

ADD_SOURCES("ext/mbstring/libmbfl/filters", "html_entities.c \
mbfilter_7bit.c mbfilter_base64.c \
Expand Down
1 change: 0 additions & 1 deletion ext/mbstring/libmbfl/config.h.w32

This file was deleted.

1 change: 0 additions & 1 deletion win32/build/config.w32.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
#define HAVE_STRUCT_STAT_ST_RDEV 1
#define HAVE_GETLOGIN 1
#define HAVE_SHUTDOWN 1
#define HAVE_STRCASECMP 1
#define HAVE_UTIME 1
#undef HAVE_DIRENT_H
#define HAVE_FCNTL_H 1
Expand Down
Loading