Skip to content

Commit 382e00b

Browse files
committed
improve timer support detection
1 parent 5af5c17 commit 382e00b

File tree

4 files changed

+23
-11
lines changed

4 files changed

+23
-11
lines changed

Zend/Zend.m4

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,28 @@ fi
269269
AC_MSG_CHECKING(whether to enable zend signal handling)
270270
AC_MSG_RESULT($ZEND_SIGNALS)
271271
272+
dnl By default, enable Zend Timer only for ZTS builds
273+
AC_ARG_ENABLE([zend-timer],
274+
[AS_HELP_STRING([--enable-zend-timer],
275+
[whether to enable zend timer system])],
276+
[ZEND_TIMER=$enableval],
277+
[ZEND_TIMER=$ZEND_ZTS])
278+
279+
AS_CASE(["$host_alias"], [*linux*], [], [ZEND_TIMER='no'])
280+
281+
PHP_CHECK_FUNC(timer_create, rt)
282+
if test "$ac_cv_func_timer_create" != "yes"; then
283+
ZEND_TIMER='no'
284+
fi
285+
286+
if test "$ZEND_TIMER" = "yes"; then
287+
AC_DEFINE(ZEND_TIMER, 1, [Use zend timer system])
288+
CFLAGS="$CFLAGS -DZEND_TIMER"
289+
fi
290+
291+
AC_MSG_CHECKING(whether to enable zend timer system)
292+
AC_MSG_RESULT($ZEND_TIMER)
293+
272294
])
273295

274296
AC_MSG_CHECKING(whether /dev/urandom exists)

Zend/zend_timer.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
+----------------------------------------------------------------------+
1515
*/
1616

17-
#include "zend_timer.h"
18-
1917
#ifdef ZEND_TIMER
2018

2119
#include <stdio.h>

Zend/zend_timer.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,13 @@
1717
#ifndef ZEND_TIMER_H
1818
#define ZEND_TIMER_H
1919

20-
#ifdef __linux__
21-
#include "php_config.h"
22-
23-
# if defined(ZTS) && defined(HAVE_TIMER_CREATE)
24-
#define ZEND_TIMER 1
20+
# ifdef ZEND_TIMER
2521

2622
#include "zend_long.h"
2723

2824
ZEND_API void zend_timer_create(void);
2925
ZEND_API void zend_timer_settime(zend_long seconds);
3026
ZEND_API void zend_timer_delete(void);
3127

32-
# endif
3328
# endif
3429
#endif

configure.ac

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -744,9 +744,6 @@ fi
744744
dnl Check for openpty. It may require linking against libutil or libbsd.
745745
PHP_CHECK_FUNC(openpty, util, bsd)
746746

747-
dnl Check for timer_create
748-
PHP_CHECK_FUNC(timer_create, rt)
749-
750747
dnl General settings.
751748
dnl ----------------------------------------------------------------------------
752749
PHP_CONFIGURE_PART(General settings)

0 commit comments

Comments
 (0)