Skip to content

Commit

Permalink
ext/session: start to implement GH-14019
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Jan 25, 2025
1 parent 6fc49ab commit f8bd3cf
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 181 deletions.
46 changes: 22 additions & 24 deletions ext/session/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ PHP_ARG_WITH([mm],
if test "$PHP_SESSION" != "no"; then
PHP_PWRITE_TEST
PHP_PREAD_TEST
PHP_NEW_EXTENSION([session],
[mod_user_class.c session.c mod_files.c mod_mm.c mod_user.c],
[$ext_shared],,
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
SESSION_CFLAGS="-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"

PHP_ADD_EXTENSION_DEP(session, date)
dnl https://bugs.php.net/53141
Expand All @@ -29,26 +26,27 @@ if test "$PHP_SESSION" != "no"; then
[Define to 1 if the PHP extension 'session' is available.])

AS_VAR_IF([PHP_MM], [no],, [
for i in $PHP_MM /usr/local /usr; do
AS_IF([test -f "$i/include/mm.h"], [MM_DIR=$i; break;])
done
AS_VAR_IF([MM_DIR],,
[AC_MSG_ERROR([Cannot find the 'mm' library, <mm.h> header file not found.])])
AS_VAR_IF([PHP_THREAD_SAFETY], [yes], [AC_MSG_ERROR(m4_text_wrap([
The configure option '--with-mm' cannot be combined with '--enable-zts'.
The mm library is not thread-safe, and mod_mm.c refuses to compile. Either
remove the '--with-mm' option, or build without thread safety (remove the
'--enable-zts' option).
]))])
PHP_ADD_LIBRARY_WITH_PATH([mm],
[$MM_DIR/$PHP_LIBDIR],
[SESSION_SHARED_LIBADD])
PHP_ADD_INCLUDE([$MM_DIR/include])
PKG_CHECK_MODULES([LIBGLIB], [glib-2.0 >= 2.0])
PHP_EVAL_INCLINE($[LIBGLIB_CFLAGS])
PHP_EVAL_LIBLINE($[LIBGLIB_LIBS], [GLIB_SHARED_LIBADD])
PHP_CHECK_LIBRARY([glib-2.0], [g_try_malloc],
[AC_DEFINE([HAVE_GLIB2], [1],
[Define to 1 if libglib-2.0 library has 'g_try_malloc' function.])],
[]
[$GLIB_LIBS])
SESSION_CFLAGS="$SESSION_CFLAGS $LIBGLIB_CFLAGS"
PHP_SUBST([GLIB_SHARED_LIBADD])
PHP_INSTALL_HEADERS([ext/session], [mod_mm.h])
AC_DEFINE([HAVE_LIBMM], [1],
[Define to 1 if the system has the 'mm' library.])
AC_DEFINE([HAVE_LIBGLIB], [1],
[Define to 1 if the system has the 'glib' library.])
])

PHP_NEW_EXTENSION([session],
[mod_user_class.c session.c mod_files.c mod_mm.c mod_user.c],
[$ext_shared],,
[$SESSION_CFLAGS])
fi
Loading

0 comments on commit f8bd3cf

Please sign in to comment.