Skip to content

Autotools: Refactor PHP_TIME_R_TYPE check #14823

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
Jul 5, 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
40 changes: 18 additions & 22 deletions build/php.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1064,9 +1064,10 @@ dnl
dnl Check type of reentrant time-related functions. Type can be: irix, hpux or
dnl POSIX.
dnl
AC_DEFUN([PHP_TIME_R_TYPE],[
AC_CACHE_CHECK(for type of reentrant time-related functions, ac_cv_time_r_type,[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
AC_DEFUN([PHP_TIME_R_TYPE],
[AC_CACHE_CHECK([for type of reentrant time-related functions],
[php_cv_time_r_type],
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <time.h>

int main(void) {
Expand All @@ -1080,10 +1081,9 @@ r = (int) asctime_r(&t, buf, 26);
if (r == s && s == 0) return (0);
return (1);
}
]])],[
ac_cv_time_r_type=hpux
],[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
]])],
[php_cv_time_r_type=hpux],
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <time.h>
int main(void) {
struct tm t, *s;
Expand All @@ -1095,21 +1095,17 @@ int main(void) {
if (p == buf && s == &t) return (0);
return (1);
}
]])],[
ac_cv_time_r_type=irix
],[
ac_cv_time_r_type=POSIX
],[
ac_cv_time_r_type=POSIX
])
],[
ac_cv_time_r_type=POSIX
])
])
case $ac_cv_time_r_type in
hpux[)] AC_DEFINE(PHP_HPUX_TIME_R,1,[Whether you have HP-UX 10.x]) ;;
irix[)] AC_DEFINE(PHP_IRIX_TIME_R,1,[Whether you have IRIX-style functions]) ;;
esac
]])],
[php_cv_time_r_type=irix],
[php_cv_time_r_type=POSIX],
[php_cv_time_r_type=POSIX])],
[php_cv_time_r_type=POSIX])
])
AS_CASE([php_cv_time_r_type],
[hpux], [AC_DEFINE([PHP_HPUX_TIME_R], [1],
[Define to 1 if you have HP-UX 10.x.-style reentrant time functions.])]
[irix], [AC_DEFINE([PHP_IRIX_TIME_R], [1],
[Define to 1 you have IRIX-style reentrant time functions.])])
])

dnl
Expand Down
Loading