Skip to content

Autotools: Improve --with-mm configure option check #15212

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

Merged
merged 2 commits into from
Aug 4, 2024
Merged
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
46 changes: 25 additions & 21 deletions ext/session/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,36 @@ if test "$PHP_SESSION" != "no"; then
[mod_user_class.c session.c mod_files.c mod_mm.c mod_user.c],
[$ext_shared],,
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])

dnl https://bugs.php.net/53141
PHP_ADD_EXTENSION_DEP(session, spl, true)

PHP_SUBST([SESSION_SHARED_LIBADD])
PHP_INSTALL_HEADERS([ext/session], [php_session.h mod_files.h mod_user.h])
AC_DEFINE([HAVE_PHP_SESSION], [1],
[Define to 1 if the PHP extension 'session' is available.])
fi

if test "$PHP_MM" != "no"; then
for i in $PHP_MM /usr/local /usr; do
test -f "$i/include/mm.h" && MM_DIR=$i && break
done

if test -z "$MM_DIR" ; then
AC_MSG_ERROR([cannot find mm library])
fi

if test "$PHP_THREAD_SAFETY" = "yes"; then
dnl The mm library is not thread-safe, and mod_mm.c refuses to compile.
AC_MSG_ERROR([--with-mm cannot be combined with --enable-zts])
fi

PHP_ADD_LIBRARY_WITH_PATH([mm],
[$MM_DIR/$PHP_LIBDIR],
[SESSION_SHARED_LIBADD])
PHP_ADD_INCLUDE([$MM_DIR/include])
PHP_INSTALL_HEADERS([ext/session], [mod_mm.h])
AC_DEFINE([HAVE_LIBMM], [1], [Define to 1 if the system has the 'mm' library.])
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])
PHP_INSTALL_HEADERS([ext/session], [mod_mm.h])
AC_DEFINE([HAVE_LIBMM], [1],
[Define to 1 if the system has the 'mm' library.])
])
fi