X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=m4%2Fpsi.m4;h=41acc565fbdaf7ac31b22eb86ecc851efe96b53e;hp=c9f4e080df6c0381680e18e623e896d22501daea;hb=06c05f17db2d8475cd7564f409041af4f3827e25;hpb=7e4b0ccdd2123647b6fff8065c0abc61be3fb44d diff --git a/m4/psi.m4 b/m4/psi.m4 index c9f4e08..41acc56 100644 --- a/m4/psi.m4 +++ b/m4/psi.m4 @@ -3,6 +3,7 @@ PSI_STDINC=$PHP_PSI_SRCDIR/php_psi_stdinc.h PSI_STDTYPES=$PHP_PSI_SRCDIR/php_psi_stdtypes.h PSI_TYPES=$PHP_PSI_SRCDIR/php_psi_types.h PSI_STRUCTS=$PHP_PSI_SRCDIR/php_psi_structs.h +PSI_UNIONS=$PHP_PSI_SRCDIR/php_psi_unions.h PSI_CONSTS=$PHP_PSI_SRCDIR/php_psi_consts.h PSI_REDIRS=$PHP_PSI_SRCDIR/php_psi_redirs.h PSI_MACROS=$PHP_PSI_SRCDIR/php_psi_macros.h @@ -14,9 +15,14 @@ dnl Creates stubs of the headers with pre-defined types etc. dnl These headers are included by src/context.c. dnl This macro must be called prior any checks for a type, struct, decl etc. AC_DEFUN(PSI_CONFIG_INIT, [ - cat >$PSI_STDTYPES <$i <>$PSI_STDTYPES <$PSI_TYPES <@ = { + cat >>$PSI_TYPES <@ = { EOF - cat >$PSI_STRUCTS <>$PSI_STRUCTS <@ = { EOF - cat >$PSI_CONSTS <>$PSI_UNIONS <@ = { +EOF + cat >>$PSI_CONSTS <@ = { EOF - cat >$PSI_REDIRS <>$PSI_REDIRS <@ = { EOF - cat >$PSI_MACROS $PSI_DECLS <>$PSI_MACROS <>$PSI_DECLS <@ = { EOF - cat >$PSI_VA_DECLS <>$PSI_VA_DECLS <@ = { EOF ]) @@ -85,9 +102,18 @@ dnl Finish the headers with the pre-defined types etc. AC_DEFUN(PSI_CONFIG_DONE, [ cat >$PSI_STDINC <>$i < +AC_DEFUN(PSI_SH_CONFIG_POSIX_ENABLED, [$AS_TR_SH([psi_config_posix_]$1)]) + +dnl PSI_CONFIG_POSIX_ENABLED(section, action-if-yes, action-if-not) +dnl Internal. Used to check if --enable-psi-posix=section was given. +AC_DEFUN(PSI_CONFIG_POSIX_ENABLED, [ + AS_TR_SH([psi_config_posix_]$1)=false + case "$PHP_PSI_POSIX" in + yes|all) + AS_TR_SH([psi_config_posix_]$1)=true + ;; + *) + if expr "$PHP_PSI_POSIX" : '\b$1\b' >/dev/null; then + AS_TR_SH([psi_config_posix_]$1)=true + fi + ;; + esac + if $AS_TR_SH([psi_config_posix_]$1); then + ifelse([$2],,:,[$2]) + else + ifelse([$3],,:,[$3]) + fi +]) + +dnl PSI_TEST_POSIX_ENABLED(section, action-if-yes, action-if-not) +dnl Shell-if test if PSI POSIX section was configured. +AC_DEFUN(PSI_SH_TEST_POSIX_ENABLED, [ + if test "PSI_SH_CONFIG_POSIX_ENABLED([$1])" && $PSI_SH_CONFIG_POSIX_ENABLED([$1]); then + ifelse([$2],,:,[$2]) + else + ifelse([$3],,:,[$3]) + fi +]) + +dnl PSI_CONFIG_POSIX(section, headers) +AC_DEFUN(PSI_CONFIG_POSIX, [ + PSI_CONFIG_POSIX_ENABLED($1, [ + PHP_CONFIGURE_PART(Configuring PSI POSIX: $1) + ifelse([$2],,:,[AC_CHECK_HEADERS($2)]) + ], [ + return 0 + ]) +]) + +AC_DEFUN(PSI_PTHREAD_ONCE, [ + AX_PTHREAD([ + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + ]) +]) +AC_DEFUN(PSI_PTHREAD, [ + AC_REQUIRE([PSI_PTHREAD_ONCE]) +]) + dnl PSI_INCLUDES() dnl Expands to a complete list of include statements including dnl AC_INCLUDES_DEFAULT(). @@ -156,6 +237,9 @@ AC_DEFUN(PSI_INCLUDES, [AC_INCLUDES_DEFAULT() #ifdef HAVE_TIME_H # include #endif +#ifdef HAVE_SIGNAL_H +# include +#endif #ifdef HAVE_SYSLOG_H # include #endif @@ -191,10 +275,22 @@ dnl PSI_SH_SIZEOF(type) dnl expand to shell variable $ac_cv_sizeof_ AC_DEFUN([PSI_SH_SIZEOF], [$AS_TR_SH([ac_cv_sizeof_]$1)]) +dnl PSI_SH_OFFSETOF(type) +dnl Expand to shell variable $ac_cv_offsetof_ +AC_DEFUN([PSI_SH_OFFSETOF], [$AS_TR_SH([ac_cv_offsetof_]$1)]) + +dnl PSI_SH_ALIGNOF(type) +dnl Expand to shell variable $ac_cv_offsetof_ +AC_DEFUN([PSI_SH_ALIGNOF], [$AS_TR_SH([ac_cv_alignof_]$1)]) + dnl PSI_SH_TEST_SIZEOF(type) dnl `if` condition to test if $ac_cv_sizeof_$1 is greater than 0. AC_DEFUN([PSI_SH_TEST_SIZEOF], [test -n "$AS_TR_SH([ac_cv_sizeof_]$1)" && test "$AS_TR_SH([ac_cv_sizeof_]$1)" -gt 0]) +dnl PSI_SH_TEST_ALIGNOF(type) +dnl `if` condition to test if $ac_cv_alignof_$1 is greater than 0. +AC_DEFUN([PSI_SH_TEST_ALIGNOF], [test -n "$AS_TR_SH([ac_cv_alignof_]$1)" && test "$AS_TR_SH([ac_cv_alignof_]$1)" -gt 0]) + dnl PSI_CHECK_SIZEOF(type, special-includes) dnl AC_CHECK_SIZEOF wrapper with PSI_INCLUDES dnl Defines psi\\SIZEOF_ pre-defined constant in $PSI_CONSTS. @@ -206,6 +302,17 @@ AC_DEFUN(PSI_CHECK_SIZEOF, [ fi ]) +dnl PSI_CHECK_ALIGNOF(type, special-includes) +dnl AC_CHECK_ALIGNOF wrapper with PSI_INCLUDES +dnl Defines psi\\ALIGNOF_ pre-defined constant in $PSI_CONSTS. +AC_DEFUN(PSI_CHECK_ALIGNOF, [ + AC_CHECK_ALIGNOF($1, PSI_INCLUDES + $2) + if PSI_SH_TEST_ALIGNOF($1); then + psi_add_int_const "AS_TR_CPP([ALIGNOF_]$1)" "$AS_TR_SH([ac_cv_alignof_]$1)" + fi +]) + dnl PSI_CHECK_OFFSETOF(struct, element) dnl Check the offset of a struct element, implemented in the similar manner dnl like AC_CHECK_SIZEOF. @@ -225,10 +332,6 @@ AC_DEFUN(PSI_CHECK_OFFSETOF, [ ) ]) -dnl PSI_SH_OFFSETOF(type) -dnl Expand to shell variable $ac_cv_offsetof_ -AC_DEFUN([PSI_SH_OFFSETOF], [$AS_TR_SH([ac_cv_offsetof_]$1)]) - dnl PSI_COMPUTE_STR(variable, string or expression) dnl Compute a string constant value in a similar manner like AC_COMPUTE_INT.