- if PSI_SH_TEST_SIZEOF($1); then
- psi_add_int_const "AS_TR_CPP([SIZEOF_]$1)" "$AS_TR_SH([ac_cv_sizeof_]$1)"
- fi
-])
-
-dnl PSI_CHECK_ALIGNOF(type, special-includes)
-dnl AC_CHECK_ALIGNOF wrapper with PSI_INCLUDES
-dnl Defines psi\\ALIGNOF_<TYPE> pre-defined constant in $PSI_CONSTS_H.
-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.
-dnl AC_DEFINEs OFFSETOF_<STRUCT>_<ELEMENT>.
-AC_DEFUN(PSI_CHECK_OFFSETOF, [
- _AC_CACHE_CHECK_INT(
- [offset of $2 in $1],
- [AS_TR_SH([ac_cv_offsetof_$1_$2])],
- [(long int) (offsetof ($1, $2))],
- [PSI_INCLUDES],
- [AC_MSG_FAILURE([cannot compute offsetof ($1, $2)])]
- )
- AC_DEFINE_UNQUOTED(
- AS_TR_CPP(offsetof_$1_$2),
- $AS_TR_SH([ac_cv_offsetof_$1_$2]),
- [The offset of `$2' in `$1', as computed by offsetof.]
- )
-])
-
-
-dnl PSI_COMPUTE_STR(variable, string or expression)
-dnl Compute a string constant value in a similar manner like AC_COMPUTE_INT.
-AC_DEFUN(PSI_COMPUTE_STR, [
- AC_TRY_RUN(
- PSI_INCLUDES
- [int main() {
- return EOF == fputs($2, fopen("conftest.out", "w"));
- }
- ], [
- eval $1=\\\"`cat conftest.out`\\\"
- ])