Skip to content

Wrap clock_get_time check in AC_CACHE_CHECK #14434

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 1 commit into from
Jun 2, 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
41 changes: 17 additions & 24 deletions sapi/fpm/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@ PHP_ARG_ENABLE([fpm],,

dnl Configure checks.
AC_DEFUN([AC_FPM_CLOCK],
[
AC_CHECK_FUNCS([clock_gettime],,
[AC_SEARCH_LIBS([clock_gettime], [rt],
[ac_cv_func_clock_gettime=yes
AC_DEFINE([HAVE_CLOCK_GETTIME], [1])])])

have_clock_get_time=no

if test "$ac_cv_func_clock_gettime" = "no"; then
AC_MSG_CHECKING([for clock_get_time])

AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <mach/mach.h>
[AC_CHECK_FUNCS([clock_gettime],,
[AC_SEARCH_LIBS([clock_gettime], [rt],
[ac_cv_func_clock_gettime=yes
AC_DEFINE([HAVE_CLOCK_GETTIME], [1])])])

AS_VAR_IF([ac_cv_func_clock_gettime], [no],
[AC_CACHE_CHECK([for clock_get_time], [php_cv_func_clock_get_time],
[AC_RUN_IFELSE([AC_LANG_SOURCE([
#include <mach/mach.h>
#include <mach/clock.h>
#include <mach/mach_error.h>

Expand All @@ -37,18 +34,14 @@ AC_DEFUN([AC_FPM_CLOCK],

return 0;
}
]])], [
have_clock_get_time=yes
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
], [AC_MSG_RESULT([no (cross-compiling)])])
fi

if test "$have_clock_get_time" = "yes"; then
AC_DEFINE([HAVE_CLOCK_GET_TIME], 1, [do we have clock_get_time?])
fi
])
])],
[php_cv_func_clock_get_time=yes],
[php_cv_func_clock_get_time=no],
[php_cv_func_clock_get_time=no])])
AS_VAR_IF([php_cv_func_clock_get_time], [yes],
[AC_DEFINE([HAVE_CLOCK_GET_TIME], [1],
[Define to 1 if you have the 'clock_get_time' function.])])
])])

AC_DEFUN([AC_FPM_TRACE],
[
Expand Down
Loading