X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=m4%2Fpsi%2Fpsi.m4;h=b0e30f49eff63bbf66c687e0f4dfb8539c2736fd;hp=6b3668e1600bf47ba9b4d0c02d938b430cfa1864;hb=894e0ce93f9ce82109e904ae35c249bf6abe54f1;hpb=5ed7e51eb19a16f6f4e280abc33a2a4281b45166 diff --git a/m4/psi/psi.m4 b/m4/psi/psi.m4 index 6b3668e..b0e30f4 100644 --- a/m4/psi/psi.m4 +++ b/m4/psi/psi.m4 @@ -1,124 +1,68 @@ -dnl Generated headers with pre-defined types, structs, consts and decls. -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 -PSI_DECLS=$PHP_PSI_SRCDIR/php_psi_decls.h -PSI_VA_DECLS=$PHP_PSI_SRCDIR/php_psi_va_decls.h -PSI_FN_DECLS=$PHP_PSI_SRCDIR/php_psi_fn_decls.h - -PSI_CONFIG_APPEND= dnl PSI_CONFIG_INIT() 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, [ - for i in $PSI_STDTYPES $PSI_TYPES $PSI_STRUCTS $PSI_UNIONS $PSI_CONSTS $PSI_REDIRS $PSI_MACROS $PSI_DECLS $PSI_VA_DECLS $PSI_FN_DECLS; do - cat >$i <>$PSI_STDTYPES <@ = { - {PSI_T_INT8, "int8_t", NULL}, - {PSI_T_INT16, "int16_t", NULL}, - {PSI_T_INT32, "int32_t", NULL}, - {PSI_T_INT64, "int64_t", NULL}, - {PSI_T_UINT8, "uint8_t", NULL}, - {PSI_T_UINT16, "uint16_t", NULL}, - {PSI_T_UINT32, "uint32_t", NULL}, - {PSI_T_UINT64, "uint64_t", NULL}, -EOF - cat >>$PSI_TYPES <@ = { -EOF - cat >>$PSI_STRUCTS <@ = { -EOF - cat >>$PSI_UNIONS <@ = { -EOF - cat >>$PSI_CONSTS <@ = { -EOF - cat >>$PSI_REDIRS <@ = { -EOF - cat >>$PSI_MACROS <>$PSI_DECLS <@ = { -EOF - cat >>$PSI_VA_DECLS <@ = { -EOF - cat >>$PSI_FN_DECLS <@ = { -EOF + psi_save_LIBS=$LIBS + LIBS= + + if test "$PHP_PSI_MAINTAINER_MODE" = "yes"; then + PSI_FAST_CONFIG=true + PSI_DEPS=true + PSI_EXTRA_REDIRS=true + + PHP_SUBST(PSI_DEPS) + + PSI_CONFIG_TMP=$(mktemp -d) + else + PSI_FAST_CONFIG=false + PSI_DEPS=false + if test "$PHP_DEBUG" = "1"; then + PSI_EXTRA_REDIRS=true + else + PSI_EXTRA_REDIRS=false + fi + fi + + PSI_STDTYPES= + PSI_TYPES= + PSI_COMPOSITES= + PSI_CONSTS= + PSI_REDIRS= + PSI_MACROS= + PSI_DECLS= + + AC_CONFIG_FILES( + [$PHP_PSI_BUILDDIR/php_psi_stdinc.h:$PHP_PSI_SRCDIR/php_psi_stdinc.h.in] + [$PHP_PSI_BUILDDIR/php_psi_posix.h:$PHP_PSI_SRCDIR/php_psi_posix.h.in] + ) + ]) dnl PSI_CONFIG_DONE() dnl Finish the headers with the pre-defined types etc. AC_DEFUN(PSI_CONFIG_DONE, [ - cat >$PSI_STDINC <>$i <&AS_MESSAGE_FD + exec AS_MESSAGE_FD>$PSI_CONFIG_TMP/AS_TR_SH([$1])/stdout.log + exec 2>$PSI_CONFIG_TMP/AS_TR_SH([$1])/stderr.log + + dnl check for headers? + ifelse([$2],,:,[AC_CHECK_HEADERS($2)]) + + dnl chaway + cd $PSI_CONFIG_TMP/AS_TR_SH([$1]) + + dnl run checks + PSI_TYPES= + PSI_CONSTS= + PSI_COMPOSITES= + PSI_REDIRS= + PSI_MACROS= + PSI_DECLS= + AS_TR_CPP([PSI_CHECK_$1]) + + dnl save env + cat >$PSI_CONFIG_TMP/AS_TR_SH([$1])/conf.env <>$PSI_CONFIG_TMP/AS_TR_SH([$1])/conf.env <&66 + ) & +]) + AC_DEFUN(PSI_PTHREAD_ONCE, [ AX_PTHREAD([ LIBS="$PTHREAD_LIBS $LIBS" @@ -179,11 +170,30 @@ AC_DEFUN(PSI_PTHREAD, [ dnl PSI_INCLUDES() dnl Expands to a complete list of include statements including dnl AC_INCLUDES_DEFAULT(). -AC_DEFUN(PSI_INCLUDES, [#define PSI_INCLUDES -#define _GNU_SOURCE 1 -#define _POSIX_C_SOURCE 200809L -#define _XOPEN_SOURCE 700 +AC_DEFUN(PSI_INCLUDES, [dnl +#define PSI_INCLUDES +#ifndef _GNU_SOURCE +# define _GNU_SOURCE +#endif +#ifndef _REENTRANT +# define _REENTRANT +#endif AC_INCLUDES_DEFAULT() +#ifdef HAVE_STDBOOL_H +# include +#else +# ifndef HAVE__BOOL +# ifdef __cplusplus +typedef bool _Bool; +# else +# define _Bool signed char +# endif +# endif +# define bool _Bool +# define false 0 +# define true 1 +# define __bool_true_false_are_defined 1 +#endif #ifdef HAVE_ERRNO_H # include #endif @@ -208,7 +218,9 @@ AC_INCLUDES_DEFAULT() #ifdef HAVE_FCNTL_H # include #endif -#ifdef HAVE_NDBM_H +#ifdef HAVE_RELIC_H +# include +#elif HAVE_NDBM_H # include #elif HAVE_GDBM_NDBM_H # include @@ -261,7 +273,10 @@ dnl PSI_LEMON() dnl Declare $LEMON precious, and check for a `lemon` in $PATH. AC_DEFUN(PSI_LEMON, [ AC_ARG_VAR(LEMON, The lemon parser generator of the SQLite project) - AC_PATH_PROG(LEMON, lemon, ./lemon) + if test -z "$LEMON" + then + AC_PATH_PROG(LEMON, lemon, ./lemon) + fi PHP_SUBST(LEMON) ]) @@ -299,7 +314,7 @@ AC_DEFUN([PSI_SH_TEST_ALIGNOF], [test -n "$AS_TR_SH([ac_cv_alignof_]$1)" && test 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. +dnl Defines psi\\SIZEOF_ pre-defined constant in $PSI_CONSTS_H. AC_DEFUN(PSI_CHECK_SIZEOF, [ AC_CHECK_SIZEOF($1, [], PSI_INCLUDES $2) @@ -310,7 +325,7 @@ AC_DEFUN(PSI_CHECK_SIZEOF, [ 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. +dnl Defines psi\\ALIGNOF_ pre-defined constant in $PSI_CONSTS_H. AC_DEFUN(PSI_CHECK_ALIGNOF, [ AC_CHECK_ALIGNOF($1, PSI_INCLUDES $2) @@ -404,6 +419,7 @@ AC_DEFUN(PSI_CHECK_LIBFFI, [ PHP_EVAL_INCLINE(`$PKG_CONFIG --cflags libffi`) PHP_EVAL_LIBLINE(`$PKG_CONFIG --libs libffi`, PSI_SHARED_LIBADD) AC_DEFINE(HAVE_LIBFFI, 1, Have libffi) + AC_DEFINE_UNQUOTED([PHP_PSI_LIBFFI_VERSION], ["`$PKG_CONFIG --modversion libffi`"], [libffi version]) else AC_CACHE_CHECK(for libffi, psi_cv_libffi_dir, [ for psi_cv_libffi_dir in $PHP_PSI_LIBFFI {/usr{,/local},/opt}{,/libffi}