https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114924

Revision: 114924
Author:   hashar
Date:     2012-04-16 12:45:49 +0000 (Mon, 16 Apr 2012)
Log Message:
-----------
enhance librt detection

We explicitly requested to link against librt despite that library
not being always wanted or just unavailable on Mac OS X.

This patch introduce the new --without-librt which let you disable librt.
It also unconditionally disable such linking on the darwin platform.

Modified Paths:
--------------
    trunk/php/luasandbox/config.m4

Modified: trunk/php/luasandbox/config.m4
===================================================================
--- trunk/php/luasandbox/config.m4      2012-04-16 12:43:39 UTC (rev 114923)
+++ trunk/php/luasandbox/config.m4      2012-04-16 12:45:49 UTC (rev 114924)
@@ -5,11 +5,15 @@
 
 PHP_ARG_WITH(luasandbox, for luasandbox support,
 [  --with-luasandbox             Include luasandbox support])
+dnl RT is not available on Mac OS X so we need an easy way to
+dnl disable librt.
+PHP_ARG_WITH(librt, [whether to include librt],
+[  --without-librt    Do not attempt to use librt, forced on Mac OS X], yes, 
no)
 
 if test "$PHP_LUASANDBOX" != "no"; then
        dnl Include pkg-config macros definitions:
        m4_include([m4/pkg.m4])
-       
+
        dnl ICU did not support pkg-config till recently; current WM version
        dnl probably does not support it as well
        m4_include([m4/ac_check_icu.m4])
@@ -25,6 +29,22 @@
 
        AC_CHECK_ICU( [4.0] )
 
+       AC_MSG_CHECKING([whether to use librt])
+       dnl librt does not exist on Mac OS X
+       case "$host_alias" in
+       *darwin*)
+               AC_MSG_RESULT([no, not available on Mac OS X])
+               PHP_LIBRT="no"
+       ;;
+       *)
+               AC_MSG_RESULT($PHP_LIBRT)
+       ;;
+       esac
+
+       if test "$PHP_LIBRT" != "no"; then
+               PKG_CHECK_MODULES([RT], [rt])
+       fi
+
        dnl LUA_LIBS and LUA_CFLAGS interprets them:
        PHP_EVAL_INCLINE($LUA_CFLAGS)
        PHP_EVAL_LIBLINE($LUA_LIBS, LUASANDBOX_SHARED_LIBADD)
@@ -32,7 +52,8 @@
        PHP_EVAL_INCLINE($ICU_CFLAGS)
        PHP_EVAL_LIBLINE($ICU_LIBS, LUASANDBOX_SHARED_LIBADD)
 
-       PHP_EVAL_LIBLINE("-lrt", LUASANDBOX_SHARED_LIBADD)
+       PHP_EVAL_INCLINE($RT_CFLAGS)
+       PHP_EVAL_LIBLINE($RT_LIBS, LUASANDBOX_SHARED_LIBADD)
 
        PHP_SUBST(LUASANDBOX_SHARED_LIBADD)
        PHP_NEW_EXTENSION(luasandbox, alloc.c data_conversion.c library.c 
luasandbox.c timer.c ustring.c, $ext_shared)


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to