@@ -14,10 +14,7 @@ PHP_ARG_WITH([mm],
1414if test "$PHP_SESSION" != "no"; then
1515 PHP_PWRITE_TEST
1616 PHP_PREAD_TEST
17- PHP_NEW_EXTENSION([ session] ,
18- [ mod_user_class.c session.c mod_files.c mod_mm.c mod_user.c] ,
19- [ $ext_shared] ,,
20- [ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1] )
17+ SESSION_CFLAGS="-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
2118
2219 PHP_ADD_EXTENSION_DEP(session, date)
2320 dnl https://bugs.php.net/53141
@@ -29,26 +26,27 @@ if test "$PHP_SESSION" != "no"; then
2926 [ Define to 1 if the PHP extension 'session' is available.] )
3027
3128 AS_VAR_IF ( [ PHP_MM] , [ no] ,, [
32- for i in $PHP_MM /usr/local /usr; do
33- AS_IF ( [ test -f "$i/include/mm.h"] , [ MM_DIR=$i; break;] )
34- done
35-
36- AS_VAR_IF ( [ MM_DIR] ,,
37- [ AC_MSG_ERROR ( [ Cannot find the 'mm' library, <mm.h> header file not found.] ) ] )
38-
39- AS_VAR_IF ( [ PHP_THREAD_SAFETY] , [ yes] , [ AC_MSG_ERROR ( m4_text_wrap ( [
40- The configure option '--with-mm' cannot be combined with '--enable-zts'.
41- The mm library is not thread-safe, and mod_mm.c refuses to compile. Either
42- remove the '--with-mm' option, or build without thread safety (remove the
43- '--enable-zts' option).
44- ] ) ) ] )
45-
46- PHP_ADD_LIBRARY_WITH_PATH([ mm] ,
47- [ $MM_DIR/$PHP_LIBDIR] ,
48- [ SESSION_SHARED_LIBADD] )
49- PHP_ADD_INCLUDE([ $MM_DIR/include] )
29+ PKG_CHECK_MODULES([ LIBGLIB] , [ glib-2.0 >= 2.0] )
30+
31+ PHP_EVAL_INCLINE($[ LIBGLIB_CFLAGS] )
32+ PHP_EVAL_LIBLINE($[ LIBGLIB_LIBS] , [ GLIB_SHARED_LIBADD] )
33+ PHP_CHECK_LIBRARY([ glib-2.0] , [ g_try_malloc] ,
34+ [ AC_DEFINE ( [ HAVE_GLIB2] , [ 1] ,
35+ [ Define to 1 if libglib-2.0 library has 'g_try_malloc' function.] ) ] ,
36+ [ ]
37+ [ $GLIB_LIBS] )
38+
39+ SESSION_CFLAGS="$SESSION_CFLAGS $LIBGLIB_CFLAGS"
40+ PHP_SUBST([ GLIB_SHARED_LIBADD] )
41+
42+
5043 PHP_INSTALL_HEADERS([ ext/session] , [ mod_mm.h] )
51- AC_DEFINE ( [ HAVE_LIBMM ] , [ 1] ,
52- [ Define to 1 if the system has the 'mm ' library.] )
44+ AC_DEFINE ( [ HAVE_LIBGLIB ] , [ 1] ,
45+ [ Define to 1 if the system has the 'glib ' library.] )
5346 ] )
47+
48+ PHP_NEW_EXTENSION([ session] ,
49+ [ mod_user_class.c session.c mod_files.c mod_mm.c mod_user.c] ,
50+ [ $ext_shared] ,,
51+ [ $SESSION_CFLAGS] )
5452fi
0 commit comments