X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=config.m4;h=d2cf0733ac9e395a89300424b5c0789442b6c205;hp=f6f43cef47691c9afee328f09dfcdb180b6021d6;hb=eea1703836c35020dd45e465f5cb1450eadfaa1c;hpb=665b431c0b92dcb3b261d0365d057a6ace711e19 diff --git a/config.m4 b/config.m4 index f6f43ce..d2cf073 100644 --- a/config.m4 +++ b/config.m4 @@ -79,52 +79,67 @@ if test "$PHP_PSI" != "no"; then else AC_MSG_WARN([Could not find libjit, please provide the base install path]) fi - + PHP_SUBST(PSI_SHARED_LIBADD) - + PSI_TYPES="" + dnl PSI_TYPE(type name, basic type, whether to check alignmnet) AC_DEFUN(PSI_TYPE, [ AC_CHECK_SIZEOF($1) - AC_CHECK_ALIGNOF($1) + if test "$3" && test "$3" != "no" + then + AC_CHECK_ALIGNOF($1) + fi if test "$2" && test "$ac_cv_sizeof_[]$1" -gt 0; then psi_type_bits=`expr ${AS_TR_SH(ac_cv_sizeof_[]$1)} \* 8` - PSI_TYPES="{\""$2[]${psi_type_bits}[]_t"\", \""$1"\"}, $PSI_TYPES" - fi + PSI_TYPES="{PSI_T_[]translit($2,a-z,A-Z)[]${psi_type_bits}, \""$2[]${psi_type_bits}[]_t"\", \""$1"\"}, $PSI_TYPES" + fi ]) + PSI_CONSTS="" + dnl PSI_COMPUTE_STR(variable, string or expression, includes) AC_DEFUN(PSI_COMPUTE_STR, [ - var=$1 - exp=$2 - inc=$3 AC_TRY_RUN([ - $inc + $3 int main() { - return EOF == fputs($exp, fopen("conftest.out", "w")); + return EOF == fputs($2, fopen("conftest.out", "w")); } ], [ - eval $var=\\\"`cat conftest.out`\\\" + eval $1=\\\"`cat conftest.out`\\\" ]) ]) + + dnl PSI_CONST(const name, type, headers to include) AC_DEFUN(PSI_CONST, [ AC_MSG_CHECKING(value of $1) + PSI_INCLUDES= + if test "$3" + then + for i in $3 + do + PSI_INCLUDES="$PSI_INCLUDES +#include <$i>" + done + fi case $2 in - str*) - PSI_COMPUTE_STR(psi_const_val, $1, AC_INCLUDES_DEFAULT($3)) + str*|quoted_str*) + PSI_COMPUTE_STR(psi_const_val, $1, AC_INCLUDES_DEFAULT()$PSI_INCLUDES) if test "$psi_const_val"; then - PSI_CONSTS="{\"$1\", IS_STRING, $psi_const_val, 0}, $PSI_CONSTS" + PSI_CONSTS="{PSI_T_STRING, \"string\", \"$1\", $psi_const_val, PSI_T_QUOTED_STRING}, $PSI_CONSTS" fi ;; *) - AC_COMPUTE_INT(psi_const_val, $1, AC_INCLUDES_DEFAULT($3)) + AC_COMPUTE_INT(psi_const_val, $1, AC_INCLUDES_DEFAULT()$PSI_INCLUDES) if test "$psi_const_val"; then - PSI_CONSTS="{\"$1\", IS_LONG, NULL, $psi_const_val}, $PSI_CONSTS" + PSI_CONSTS="{PSI_T_INT, \"int\", \"$1\", \"$psi_const_val\", PSI_T_NUMBER}, $PSI_CONSTS" fi ;; esac + AC_MSG_RESULT($psi_const_val) ]) - + AC_DEFUN([AX_CHECK_SIGN], [ typename=`echo $1 | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g"` AC_CACHE_CHECK([whether $1 is signed], ax_cv_decl_${typename}_signed, [ @@ -139,7 +154,7 @@ if test "$PHP_PSI" != "no"; then $3 fi ]) - + PSI_TYPE(char, int) PSI_TYPE(short, int) PSI_TYPE(int, int) @@ -147,7 +162,7 @@ if test "$PHP_PSI" != "no"; then PSI_TYPE(float) PSI_TYPE(double) PSI_TYPE(void *) - + dnl stddef.h PSI_TYPE(ptrdiff_t, int) PSI_TYPE(size_t, uint) @@ -155,9 +170,8 @@ if test "$PHP_PSI" != "no"; then AX_CHECK_SIGN(wchar_t, psi_wchar_t=int, psi_wchar_t=uint) PSI_TYPE(wchar_t, $psi_wchar_t) ]) - + dnl stdio.h - PSI_TYPE(fpos_t, int) PSI_CONST(BUFSIZ, int) PSI_CONST(_IOFBF, int) PSI_CONST(_IOLBF, int) @@ -170,15 +184,17 @@ if test "$PHP_PSI" != "no"; then PSI_CONST(TMP_MAX, int) PSI_CONST(EOF, int) PSI_CONST(P_tmpdir, string) + PSI_CONST(L_ctermid, int) + PSI_CONST(L_tmpnam, int) dnl stdlib.h PSI_CONST(EXIT_FAILURE, int) PSI_CONST(EXIT_SUCCESS, int) PSI_CONST(RAND_MAX, int) PSI_CONST(MB_CUR_MAX, int) dnl sys/time.h - PSI_CONST(ITIMER_REAL, int) - PSI_CONST(ITIMER_VIRTUAL, int) - PSI_CONST(ITIMER_PROF, int) + PSI_CONST(ITIMER_REAL, int, sys/time.h) + PSI_CONST(ITIMER_VIRTUAL, int, sys/time.h) + PSI_CONST(ITIMER_PROF, int, sys/time.h) dnl sys/types.h PSI_TYPE(blkcnt_t, int) PSI_TYPE(blksize_t, int) @@ -203,7 +219,7 @@ if test "$PHP_PSI" != "no"; then AC_DEFINE_UNQUOTED(PHP_PSI_TYPES, $PSI_TYPES, Predefined types) AC_DEFINE_UNQUOTED(PHP_PSI_CONSTS, $PSI_CONSTS, Predefined constants) - + PHP_PSI_SRCDIR=PHP_EXT_SRCDIR(psi) PHP_PSI_BUILDDIR=PHP_EXT_BUILDDIR(psi)