@@ -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
@@ -27,26 +24,27 @@ if test "$PHP_SESSION" != "no"; then
2724 [ Define to 1 if the PHP extension 'session' is available.] )
2825
2926 AS_VAR_IF ( [ PHP_MM] , [ no] ,, [
30- for i in $PHP_MM /usr/local /usr; do
31- AS_IF ( [ test -f "$i/include/mm.h"] , [ MM_DIR=$i; break;] )
32- done
33-
34- AS_VAR_IF ( [ MM_DIR] ,,
35- [ AC_MSG_ERROR ( [ Cannot find the 'mm' library, <mm.h> header file not found.] ) ] )
36-
37- AS_VAR_IF ( [ PHP_THREAD_SAFETY] , [ yes] , [ AC_MSG_ERROR ( m4_text_wrap ( [
38- The configure option '--with-mm' cannot be combined with '--enable-zts'.
39- The mm library is not thread-safe, and mod_mm.c refuses to compile. Either
40- remove the '--with-mm' option, or build without thread safety (remove the
41- '--enable-zts' option).
42- ] ) ) ] )
43-
44- PHP_ADD_LIBRARY_WITH_PATH([ mm] ,
45- [ $MM_DIR/$PHP_LIBDIR] ,
46- [ SESSION_SHARED_LIBADD] )
47- PHP_ADD_INCLUDE([ $MM_DIR/include] )
27+ PKG_CHECK_MODULES([ LIBGLIB] , [ glib-2.0 >= 2.0] )
28+
29+ PHP_EVAL_INCLINE($[ LIBGLIB_CFLAGS] )
30+ PHP_EVAL_LIBLINE($[ LIBGLIB_LIBS] , [ GLIB_SHARED_LIBADD] )
31+ PHP_CHECK_LIBRARY([ glib-2.0] , [ g_try_malloc] ,
32+ [ AC_DEFINE ( [ HAVE_GLIB2] , [ 1] ,
33+ [ Define to 1 if libglib-2.0 library has 'g_try_malloc' function.] ) ] ,
34+ [ ]
35+ [ $GLIB_LIBS] )
36+
37+ SESSION_CFLAGS="$SESSION_CFLAGS $LIBGLIB_CFLAGS"
38+ PHP_SUBST([ GLIB_SHARED_LIBADD] )
39+
40+
4841 PHP_INSTALL_HEADERS([ ext/session] , [ mod_mm.h] )
49- AC_DEFINE ( [ HAVE_LIBMM ] , [ 1] ,
50- [ Define to 1 if the system has the 'mm ' library.] )
42+ AC_DEFINE ( [ HAVE_LIBGLIB ] , [ 1] ,
43+ [ Define to 1 if the system has the 'glib ' library.] )
5144 ] )
45+
46+ PHP_NEW_EXTENSION([ session] ,
47+ [ mod_user_class.c session.c mod_files.c mod_mm.c mod_user.c] ,
48+ [ $ext_shared] ,,
49+ [ $SESSION_CFLAGS] )
5250fi
0 commit comments