Skip to content

Commit 52ed06d

Browse files
authored
Autotools: Move HAVE_DTRACE and PHP_DTRACE_OBJS to PHP_INIT_DTRACE (#14722)
The sys/sdt.h is required header when using DTrace, HAVE_DTRACE can be defined together when initializing and PHP_DTRACE_OBJS can be substituted to simplify the macro usage a bit further.
1 parent c44834d commit 52ed06d

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

build/php.m4

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2283,7 +2283,10 @@ int main(void)
22832283
dnl
22842284
dnl PHP_INIT_DTRACE(providerdesc, header-file, sources [, module])
22852285
dnl
2286-
AC_DEFUN([PHP_INIT_DTRACE],[
2286+
AC_DEFUN([PHP_INIT_DTRACE],
2287+
[AC_CHECK_HEADER([sys/sdt.h],,
2288+
[AC_MSG_ERROR([Cannot find sys/sdt.h which is required for DTrace support.])])
2289+
22872290
dnl Set paths properly when called from extension.
22882291
case "$4" in
22892292
""[)] ac_srcdir="$abs_srcdir/"; unset ac_bdir;;
@@ -2388,6 +2391,9 @@ $ac_bdir[$]ac_provsrc.o: \$(PHP_DTRACE_OBJS)
23882391
EOF
23892392
;;
23902393
esac
2394+
2395+
AC_DEFINE([HAVE_DTRACE], [1], [Define to 1 if DTrace support is enabled.])
2396+
PHP_SUBST([PHP_DTRACE_OBJS])
23912397
])
23922398

23932399
dnl

configure.ac

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,17 +1031,12 @@ PHP_ARG_ENABLE([dtrace],
10311031
[no],
10321032
[no])
10331033

1034-
if test "$PHP_DTRACE" = "yes"; then
1035-
AC_CHECK_HEADER([sys/sdt.h], [
1036-
PHP_INIT_DTRACE([Zend/zend_dtrace.d],[Zend/zend_dtrace_gen.h],[main/main.c Zend/zend_API.c \
1034+
AS_VAR_IF([PHP_DTRACE], [yes],
1035+
[PHP_INIT_DTRACE([Zend/zend_dtrace.d],
1036+
[Zend/zend_dtrace_gen.h],
1037+
[main/main.c Zend/zend_API.c \
10371038
Zend/zend_execute.c Zend/zend_exceptions.c \
1038-
Zend/zend_dtrace.c Zend/zend.c])
1039-
AC_DEFINE(HAVE_DTRACE, 1, [Whether to enable DTrace support])
1040-
PHP_SUBST(PHP_DTRACE_OBJS)
1041-
], [
1042-
AC_MSG_ERROR([Cannot find sys/sdt.h which is required for DTrace support])
1043-
])
1044-
fi
1039+
Zend/zend_dtrace.c Zend/zend.c])])
10451040

10461041
AC_MSG_CHECKING([how big to make fd sets])
10471042
PHP_ARG_ENABLE([fd-setsize],,

0 commit comments

Comments
 (0)