From: Michael Wallner Date: Mon, 17 Oct 2016 08:37:39 +0000 (+0200) Subject: autoconf: split into subdirectories; redirect calls in debug builds X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=commitdiff_plain;h=c9b3436bd51a4dcf7d6cc6817d4c7a8ad99538d4;hp=09735ea6055f959a9cac481268754f07d6f6eb9f autoconf: split into subdirectories; redirect calls in debug builds --- diff --git a/Makefile.frag b/Makefile.frag index 4efd8b3..f98715d 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -52,3 +52,6 @@ $(PHP_PSI_SRCDIR)/src/parser.re: $(PHP_PSI_SRCDIR)/src/parser_proc.h touch $@ $(PHP_PSI_SRCDIR)/src/parser.c: $(PHP_PSI_SRCDIR)/src/parser.re $(RE2C) -o $@ $< + +$(PHP_PSI_SRCDIR)/src/types/decl.c: $(PHP_PSI_SRCDIR)/php_psi_macros.h $(PHP_PSI_SRCDIR)/php_psi_redirs.h +$(PHP_PSI_SRCDIR)/src/context.c: $(PHP_PSI_SRCDIR)/php_psi_consts.h $(PHP_PSI_SRCDIR)/php_psi_decls.h $(PHP_PSI_SRCDIR)/php_psi_fn_decls.h $(PHP_PSI_SRCDIR)/php_psi_structs.h $(PHP_PSI_SRCDIR)/php_psi_types.h $(PHP_PSI_SRCDIR)/php_psi_unions.h $(PHP_PSI_SRCDIR)/php_psi_va_decls.h diff --git a/config.m4 b/config.m4 index 47ee1b0..f5c82c1 100644 --- a/config.m4 +++ b/config.m4 @@ -2,41 +2,41 @@ PHP_PSI_SRCDIR=PHP_EXT_SRCDIR(psi) PHP_PSI_BUILDDIR=PHP_EXT_BUILDDIR(psi) m4_foreach(incfile, [ - [ax_check_sign.m4], - [ax_pthread.m4], - [psi.m4], - [psi_type.m4], - [psi_const.m4], - [psi_decl.m4], - [psi_macro.m4], - [psi_struct.m4], - [errno.m4], - [fcntl.m4], - [glob.m4], - [locale.m4], - [stddef.m4], - [stdio.m4], - [stdint.m4], - [stdlib.m4], - [sys_select.m4], - [sys_socket.m4], - [sys_stat.m4], - [sys_time.m4], - [sys_times.m4], - [sys_types.m4], - [sys_uio.m4], - [sys_utsname.m4], - [ndbm.m4], - [netdb.m4], - [netinet_in.m4], - [netinet_tcp.m4], - [poll.m4], - [signal.m4], - [syslog.m4], - [time.m4], - [unistd.m4], - [wchar.m4], - [wctype.m4]], [ + [ax/ax_check_sign.m4], + [ax/ax_pthread.m4], + [psi/psi.m4], + [psi/psi_type.m4], + [psi/psi_const.m4], + [psi/psi_decl.m4], + [psi/psi_macro.m4], + [psi/psi_struct.m4], + [posix/errno.m4], + [posix/fcntl.m4], + [posix/glob.m4], + [posix/locale.m4], + [posix/stddef.m4], + [posix/stdio.m4], + [posix/stdint.m4], + [posix/stdlib.m4], + [posix/sys_select.m4], + [posix/sys_socket.m4], + [posix/sys_stat.m4], + [posix/sys_time.m4], + [posix/sys_times.m4], + [posix/sys_types.m4], + [posix/sys_uio.m4], + [posix/sys_utsname.m4], + [posix/ndbm.m4], + [posix/netdb.m4], + [posix/netinet_in.m4], + [posix/netinet_tcp.m4], + [posix/poll.m4], + [posix/signal.m4], + [posix/syslog.m4], + [posix/time.m4], + [posix/unistd.m4], + [posix/wchar.m4], + [posix/wctype.m4]], [ dnl pecl build sinclude([m4/]incfile) dnl php-src build diff --git a/m4/ax/ax_check_sign.m4 b/m4/ax/ax_check_sign.m4 new file mode 100644 index 0000000..5c925c2 --- /dev/null +++ b/m4/ax/ax_check_sign.m4 @@ -0,0 +1,53 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_sign.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_SIGN (TYPE, [ACTION-IF-SIGNED], [ACTION-IF-UNSIGNED], [INCLUDES]) +# +# DESCRIPTION +# +# Checks whether TYPE is signed or not. If no INCLUDES are specified, the +# default includes are used. If ACTION-IF-SIGNED is given, it is +# additional shell code to execute when the type is signed. If +# ACTION-IF-UNSIGNED is given, it is executed when the type is unsigned. +# +# This macro assumes that the type exists. Therefore the existence of the +# type should be checked before calling this macro. For example: +# +# AC_CHECK_HEADERS([wchar.h]) +# AC_CHECK_TYPE([wchar_t],,[ AC_MSG_ERROR([Type wchar_t not found.]) ]) +# AX_CHECK_SIGN([wchar_t], +# [ AC_DEFINE(WCHAR_T_SIGNED, 1, [Define if wchar_t is signed]) ], +# [ AC_DEFINE(WCHAR_T_UNSIGNED, 1, [Define if wchar_t is unsigned]) ], [ +# #ifdef HAVE_WCHAR_H +# #include +# #endif +# ]) +# +# LICENSE +# +# Copyright (c) 2008 Ville Laurikari +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 6 + +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, [ + AC_TRY_COMPILE([$4], + [ int foo @<:@ 1 - 2 * !((($1) -1) < 0) @:>@ ], + [ eval "ax_cv_decl_${typename}_signed=\"yes\"" ], + [ eval "ax_cv_decl_${typename}_signed=\"no\"" ])]) + symbolname=`echo $1 | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g" | tr "a-z" "A-Z"` + if eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"yes\""; then + $2 + elif eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"no\""; then + $3 + fi +]) diff --git a/m4/ax/ax_pthread.m4 b/m4/ax/ax_pthread.m4 new file mode 100644 index 0000000..d383ad5 --- /dev/null +++ b/m4/ax/ax_pthread.m4 @@ -0,0 +1,332 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_pthread.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro figures out how to build C programs using POSIX threads. It +# sets the PTHREAD_LIBS output variable to the threads library and linker +# flags, and the PTHREAD_CFLAGS output variable to any special C compiler +# flags that are needed. (The user can also force certain compiler +# flags/libs to be tested by setting these environment variables.) +# +# Also sets PTHREAD_CC to any special C compiler that is needed for +# multi-threaded programs (defaults to the value of CC otherwise). (This +# is necessary on AIX to use the special cc_r compiler alias.) +# +# NOTE: You are assumed to not only compile your program with these flags, +# but also link it with them as well. e.g. you should link with +# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS +# +# If you are only building threads programs, you may wish to use these +# variables in your default LIBS, CFLAGS, and CC: +# +# LIBS="$PTHREAD_LIBS $LIBS" +# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +# CC="$PTHREAD_CC" +# +# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant +# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name +# (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +# +# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the +# PTHREAD_PRIO_INHERIT symbol is defined when compiling with +# PTHREAD_CFLAGS. +# +# ACTION-IF-FOUND is a list of shell commands to run if a threads library +# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it +# is not found. If ACTION-IF-FOUND is not specified, the default action +# will define HAVE_PTHREAD. +# +# Please let the authors know if this macro fails on any platform, or if +# you have any other suggestions or comments. This macro was based on work +# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help +# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by +# Alejandro Forero Cuervo to the autoconf macro repository. We are also +# grateful for the helpful feedback of numerous users. +# +# Updated for Autoconf 2.68 by Daniel Richard G. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2011 Daniel Richard G. +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 21 + +AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) +AC_DEFUN([AX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_LANG_PUSH([C]) +ax_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) + AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes]) + AC_MSG_RESULT([$ax_pthread_ok]) + if test x"$ax_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# ... -mt is also the pthreads flag for HP/aCC +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case ${host_os} in + solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" + ;; + + darwin*) + ax_pthread_flags="-pthread $ax_pthread_flags" + ;; +esac + +# Clang doesn't consider unrecognized options an error unless we specify +# -Werror. We throw in some extra Clang-specific options to ensure that +# this doesn't happen for GCC, which also accepts -Werror. + +AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags]) +save_CFLAGS="$CFLAGS" +ax_pthread_extra_flags="-Werror" +CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])], + [AC_MSG_RESULT([yes])], + [ax_pthread_extra_flags= + AC_MSG_RESULT([no])]) +CFLAGS="$save_CFLAGS" + +if test x"$ax_pthread_ok" = xno; then +for flag in $ax_pthread_flags; do + + case $flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $flag]) + PTHREAD_CFLAGS="$flag" + ;; + + pthread-config) + AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) + if test x"$ax_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$flag]) + PTHREAD_LIBS="-l$flag" + ;; + esac + + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include + static void routine(void *a) { a = 0; } + static void *start_routine(void *a) { return a; }], + [pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */])], + [ax_pthread_ok=yes], + []) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + AC_MSG_RESULT([$ax_pthread_ok]) + if test "x$ax_pthread_ok" = xyes; then + break; + fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$ax_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + AC_MSG_CHECKING([for joinable pthread attribute]) + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [int attr = $attr; return attr /* ; */])], + [attr_name=$attr; break], + []) + done + AC_MSG_RESULT([$attr_name]) + if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then + AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name], + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + fi + + AC_MSG_CHECKING([if more special flags are required for pthreads]) + flag=no + case ${host_os} in + aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; + osf* | hpux*) flag="-D_REENTRANT";; + solaris*) + if test "$GCC" = "yes"; then + flag="-D_REENTRANT" + else + # TODO: What about Clang on Solaris? + flag="-mt -D_REENTRANT" + fi + ;; + esac + AC_MSG_RESULT([$flag]) + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi + + AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], + [ax_cv_PTHREAD_PRIO_INHERIT], [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[int i = PTHREAD_PRIO_INHERIT;]])], + [ax_cv_PTHREAD_PRIO_INHERIT=yes], + [ax_cv_PTHREAD_PRIO_INHERIT=no]) + ]) + AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"], + [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])]) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + # More AIX lossage: compile with *_r variant + if test "x$GCC" != xyes; then + case $host_os in + aix*) + AS_CASE(["x/$CC"], + [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], + [#handle absolute path differently from PATH based program lookup + AS_CASE(["x$CC"], + [x/*], + [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], + [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) + ;; + esac + fi +fi + +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + +AC_SUBST([PTHREAD_LIBS]) +AC_SUBST([PTHREAD_CFLAGS]) +AC_SUBST([PTHREAD_CC]) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$ax_pthread_ok" = xyes; then + ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) + : +else + ax_pthread_ok=no + $2 +fi +AC_LANG_POP +])dnl AX_PTHREAD diff --git a/m4/ax_check_sign.m4 b/m4/ax_check_sign.m4 deleted file mode 100644 index 5c925c2..0000000 --- a/m4/ax_check_sign.m4 +++ /dev/null @@ -1,53 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_sign.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_SIGN (TYPE, [ACTION-IF-SIGNED], [ACTION-IF-UNSIGNED], [INCLUDES]) -# -# DESCRIPTION -# -# Checks whether TYPE is signed or not. If no INCLUDES are specified, the -# default includes are used. If ACTION-IF-SIGNED is given, it is -# additional shell code to execute when the type is signed. If -# ACTION-IF-UNSIGNED is given, it is executed when the type is unsigned. -# -# This macro assumes that the type exists. Therefore the existence of the -# type should be checked before calling this macro. For example: -# -# AC_CHECK_HEADERS([wchar.h]) -# AC_CHECK_TYPE([wchar_t],,[ AC_MSG_ERROR([Type wchar_t not found.]) ]) -# AX_CHECK_SIGN([wchar_t], -# [ AC_DEFINE(WCHAR_T_SIGNED, 1, [Define if wchar_t is signed]) ], -# [ AC_DEFINE(WCHAR_T_UNSIGNED, 1, [Define if wchar_t is unsigned]) ], [ -# #ifdef HAVE_WCHAR_H -# #include -# #endif -# ]) -# -# LICENSE -# -# Copyright (c) 2008 Ville Laurikari -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 6 - -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, [ - AC_TRY_COMPILE([$4], - [ int foo @<:@ 1 - 2 * !((($1) -1) < 0) @:>@ ], - [ eval "ax_cv_decl_${typename}_signed=\"yes\"" ], - [ eval "ax_cv_decl_${typename}_signed=\"no\"" ])]) - symbolname=`echo $1 | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g" | tr "a-z" "A-Z"` - if eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"yes\""; then - $2 - elif eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"no\""; then - $3 - fi -]) diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4 deleted file mode 100644 index d383ad5..0000000 --- a/m4/ax_pthread.m4 +++ /dev/null @@ -1,332 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_pthread.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro figures out how to build C programs using POSIX threads. It -# sets the PTHREAD_LIBS output variable to the threads library and linker -# flags, and the PTHREAD_CFLAGS output variable to any special C compiler -# flags that are needed. (The user can also force certain compiler -# flags/libs to be tested by setting these environment variables.) -# -# Also sets PTHREAD_CC to any special C compiler that is needed for -# multi-threaded programs (defaults to the value of CC otherwise). (This -# is necessary on AIX to use the special cc_r compiler alias.) -# -# NOTE: You are assumed to not only compile your program with these flags, -# but also link it with them as well. e.g. you should link with -# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS -# -# If you are only building threads programs, you may wish to use these -# variables in your default LIBS, CFLAGS, and CC: -# -# LIBS="$PTHREAD_LIBS $LIBS" -# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -# CC="$PTHREAD_CC" -# -# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant -# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name -# (e.g. PTHREAD_CREATE_UNDETACHED on AIX). -# -# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the -# PTHREAD_PRIO_INHERIT symbol is defined when compiling with -# PTHREAD_CFLAGS. -# -# ACTION-IF-FOUND is a list of shell commands to run if a threads library -# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it -# is not found. If ACTION-IF-FOUND is not specified, the default action -# will define HAVE_PTHREAD. -# -# Please let the authors know if this macro fails on any platform, or if -# you have any other suggestions or comments. This macro was based on work -# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help -# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by -# Alejandro Forero Cuervo to the autoconf macro repository. We are also -# grateful for the helpful feedback of numerous users. -# -# Updated for Autoconf 2.68 by Daniel Richard G. -# -# LICENSE -# -# Copyright (c) 2008 Steven G. Johnson -# Copyright (c) 2011 Daniel Richard G. -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 21 - -AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) -AC_DEFUN([AX_PTHREAD], [ -AC_REQUIRE([AC_CANONICAL_HOST]) -AC_LANG_PUSH([C]) -ax_pthread_ok=no - -# We used to check for pthread.h first, but this fails if pthread.h -# requires special compiler flags (e.g. on True64 or Sequent). -# It gets checked for in the link test anyway. - -# First of all, check if the user has set any of the PTHREAD_LIBS, -# etcetera environment variables, and if threads linking works using -# them: -if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) - AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes]) - AC_MSG_RESULT([$ax_pthread_ok]) - if test x"$ax_pthread_ok" = xno; then - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" -fi - -# We must check for the threads library under a number of different -# names; the ordering is very important because some systems -# (e.g. DEC) have both -lpthread and -lpthreads, where one of the -# libraries is broken (non-POSIX). - -# Create a list of thread flags to try. Items starting with a "-" are -# C compiler flags, and other items are library names, except for "none" -# which indicates that we try without any flags at all, and "pthread-config" -# which is a program returning the flags for the Pth emulation library. - -ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" - -# The ordering *is* (sometimes) important. Some notes on the -# individual items follow: - -# pthreads: AIX (must check this before -lpthread) -# none: in case threads are in libc; should be tried before -Kthread and -# other compiler flags to prevent continual compiler warnings -# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) -# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) -# -pthreads: Solaris/gcc -# -mthreads: Mingw32/gcc, Lynx/gcc -# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads too; -# also defines -D_REENTRANT) -# ... -mt is also the pthreads flag for HP/aCC -# pthread: Linux, etcetera -# --thread-safe: KAI C++ -# pthread-config: use pthread-config program (for GNU Pth library) - -case ${host_os} in - solaris*) - - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (We need to link with -pthreads/-mt/ - # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather - # a function called by this macro, so we could check for that, but - # who knows whether they'll stub that too in a future libc.) So, - # we'll just look for -pthreads and -lpthread first: - - ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" - ;; - - darwin*) - ax_pthread_flags="-pthread $ax_pthread_flags" - ;; -esac - -# Clang doesn't consider unrecognized options an error unless we specify -# -Werror. We throw in some extra Clang-specific options to ensure that -# this doesn't happen for GCC, which also accepts -Werror. - -AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags]) -save_CFLAGS="$CFLAGS" -ax_pthread_extra_flags="-Werror" -CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument" -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])], - [AC_MSG_RESULT([yes])], - [ax_pthread_extra_flags= - AC_MSG_RESULT([no])]) -CFLAGS="$save_CFLAGS" - -if test x"$ax_pthread_ok" = xno; then -for flag in $ax_pthread_flags; do - - case $flag in - none) - AC_MSG_CHECKING([whether pthreads work without any flags]) - ;; - - -*) - AC_MSG_CHECKING([whether pthreads work with $flag]) - PTHREAD_CFLAGS="$flag" - ;; - - pthread-config) - AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) - if test x"$ax_pthread_config" = xno; then continue; fi - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; - - *) - AC_MSG_CHECKING([for the pthreads library -l$flag]) - PTHREAD_LIBS="-l$flag" - ;; - esac - - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags" - - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include - static void routine(void *a) { a = 0; } - static void *start_routine(void *a) { return a; }], - [pthread_t th; pthread_attr_t attr; - pthread_create(&th, 0, start_routine, 0); - pthread_join(th, 0); - pthread_attr_init(&attr); - pthread_cleanup_push(routine, 0); - pthread_cleanup_pop(0) /* ; */])], - [ax_pthread_ok=yes], - []) - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - - AC_MSG_RESULT([$ax_pthread_ok]) - if test "x$ax_pthread_ok" = xyes; then - break; - fi - - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" -done -fi - -# Various other checks: -if test "x$ax_pthread_ok" = xyes; then - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - - # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - AC_MSG_CHECKING([for joinable pthread attribute]) - attr_name=unknown - for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], - [int attr = $attr; return attr /* ; */])], - [attr_name=$attr; break], - []) - done - AC_MSG_RESULT([$attr_name]) - if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then - AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name], - [Define to necessary symbol if this constant - uses a non-standard name on your system.]) - fi - - AC_MSG_CHECKING([if more special flags are required for pthreads]) - flag=no - case ${host_os} in - aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; - osf* | hpux*) flag="-D_REENTRANT";; - solaris*) - if test "$GCC" = "yes"; then - flag="-D_REENTRANT" - else - # TODO: What about Clang on Solaris? - flag="-mt -D_REENTRANT" - fi - ;; - esac - AC_MSG_RESULT([$flag]) - if test "x$flag" != xno; then - PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" - fi - - AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], - [ax_cv_PTHREAD_PRIO_INHERIT], [ - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[int i = PTHREAD_PRIO_INHERIT;]])], - [ax_cv_PTHREAD_PRIO_INHERIT=yes], - [ax_cv_PTHREAD_PRIO_INHERIT=no]) - ]) - AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"], - [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])]) - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - - # More AIX lossage: compile with *_r variant - if test "x$GCC" != xyes; then - case $host_os in - aix*) - AS_CASE(["x/$CC"], - [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], - [#handle absolute path differently from PATH based program lookup - AS_CASE(["x$CC"], - [x/*], - [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], - [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) - ;; - esac - fi -fi - -test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" - -AC_SUBST([PTHREAD_LIBS]) -AC_SUBST([PTHREAD_CFLAGS]) -AC_SUBST([PTHREAD_CC]) - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$ax_pthread_ok" = xyes; then - ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) - : -else - ax_pthread_ok=no - $2 -fi -AC_LANG_POP -])dnl AX_PTHREAD diff --git a/m4/errno.m4 b/m4/errno.m4 deleted file mode 100644 index 4d28b8b..0000000 --- a/m4/errno.m4 +++ /dev/null @@ -1,87 +0,0 @@ -PSI_CHECK_ERRNO() { - PSI_CONFIG_POSIX(errno, errno.h) - - PSI_EXTVAR(int errno) - - PSI_CONST(E2BIG, int) - PSI_CONST(EACCES, int) - PSI_CONST(EADDRINUSE, int) - PSI_CONST(EADDRNOTAVAIL, int) - PSI_CONST(EAFNOSUPPORT, int) - PSI_CONST(EAGAIN, int) - PSI_CONST(EALREADY, int) - PSI_CONST(EBADF, int) - PSI_CONST(EBADMSG, int) - PSI_CONST(EBUSY, int) - PSI_CONST(ECANCELED, int) - PSI_CONST(ECHILD, int) - PSI_CONST(ECONNABORTED, int) - PSI_CONST(ECONNREFUSED, int) - PSI_CONST(ECONNRESET, int) - PSI_CONST(EDEADLK, int) - PSI_CONST(EDESTADDRREQ, int) - PSI_CONST(EDOM, int) - PSI_CONST(EDQUOT, int) - PSI_CONST(EEXIST, int) - PSI_CONST(EFAULT, int) - PSI_CONST(EFBIG, int) - PSI_CONST(EHOSTUNREACH, int) - PSI_CONST(EIDRM, int) - PSI_CONST(EILSEQ, int) - PSI_CONST(EINPROGRESS, int) - PSI_CONST(EINTR, int) - PSI_CONST(EINVAL, int) - PSI_CONST(EIO, int) - PSI_CONST(EISCONN, int) - PSI_CONST(EISDIR, int) - PSI_CONST(ELOOP, int) - PSI_CONST(EMFILE, int) - PSI_CONST(EMLINK, int) - PSI_CONST(EMSGSIZE, int) - PSI_CONST(EMULTIHOP, int) - PSI_CONST(ENAMETOOLONG, int) - PSI_CONST(ENETDOWN, int) - PSI_CONST(ENETRESET, int) - PSI_CONST(ENETUNREACH, int) - PSI_CONST(ENFILE, int) - PSI_CONST(ENOBUFS, int) - PSI_CONST(ENODATA, int) - PSI_CONST(ENODEV, int) - PSI_CONST(ENOENT, int) - PSI_CONST(ENOEXEC, int) - PSI_CONST(ENOLCK, int) - PSI_CONST(ENOLINK, int) - PSI_CONST(ENOMEM, int) - PSI_CONST(ENOMSG, int) - PSI_CONST(ENOPROTOOPT, int) - PSI_CONST(ENOSPC, int) - PSI_CONST(ENOSR, int) - PSI_CONST(ENOSTR, int) - PSI_CONST(ENOSYS, int) - PSI_CONST(ENOTCONN, int) - PSI_CONST(ENOTDIR, int) - PSI_CONST(ENOTEMPTY, int) - PSI_CONST(ENOTRECOVERABLE, int) - PSI_CONST(ENOTSOCK, int) - PSI_CONST(ENOTSUP, int) - PSI_CONST(ENOTTY, int) - PSI_CONST(ENXIO, int) - PSI_CONST(EOPNOTSUPP, int) - PSI_CONST(EOVERFLOW, int) - PSI_CONST(EOWNERDEAD, int) - PSI_CONST(EPERM, int) - PSI_CONST(EPIPE, int) - PSI_CONST(EPROTO, int) - PSI_CONST(EPROTONOSUPPORT, int) - PSI_CONST(EPROTOTYPE, int) - PSI_CONST(ERANGE, int) - PSI_CONST(EROFS, int) - PSI_CONST(ESPIPE, int) - PSI_CONST(ESRCH, int) - PSI_CONST(ESTALE, int) - PSI_CONST(ETIME, int) - PSI_CONST(ETIMEDOUT, int) - PSI_CONST(ETXTBSY, int) - PSI_CONST(EWOULDBLOCK, int) - PSI_CONST(EXDEV, int) -} diff --git a/m4/fcntl.m4 b/m4/fcntl.m4 deleted file mode 100644 index 9e992cc..0000000 --- a/m4/fcntl.m4 +++ /dev/null @@ -1,73 +0,0 @@ -PSI_CHECK_FCNTL() { - PSI_CONFIG_POSIX(fcntl, fcntl.h) - - PSI_CONST(F_DUPFD, int) - PSI_CONST(F_DUPFD_CLOEXEC, int) - PSI_CONST(F_GETFD, int) - PSI_CONST(F_SETFD, int) - PSI_CONST(F_GETFL, int) - PSI_CONST(F_SETFL, int) - PSI_CONST(F_GETLK, int) - PSI_CONST(F_SETLK, int) - PSI_CONST(F_SETLKW, int) - PSI_CONST(F_GETOWN, int) - PSI_CONST(F_SETOWN, int) - - PSI_CONST(FD_CLOEXEC, int) - - PSI_CONST(F_RDLCK, int) - PSI_CONST(F_UNLCK, int) - PSI_CONST(F_WRLCK, int) - - PSI_CONST(O_CLOEXEC, int) - PSI_CONST(O_CREAT, int) - PSI_CONST(O_DIRECTORY, int) - PSI_CONST(O_EXCL, int) - PSI_CONST(O_NOCTTY, int) - PSI_CONST(O_NOFOLLOW, int) - PSI_CONST(O_TRUNC, int) - PSI_CONST(O_TTY_INIT, int) - - PSI_CONST(O_APPEND, int) - PSI_CONST(O_DSYNC, int) - PSI_CONST(O_NONBLOCK, int) - PSI_CONST(O_RSYNC, int) - PSI_CONST(O_SYNC, int) - - PSI_CONST(O_ACCMODE, int) - - PSI_CONST(O_EXEC, int) - PSI_CONST(O_RDONLY, int) - PSI_CONST(O_RDWR, int) - PSI_CONST(O_SEARCH, int) - PSI_CONST(O_WRONLY, int) - - PSI_CONST(AT_FDCWD, int) - PSI_CONST(AT_EACCESS, int) - PSI_CONST(AT_SYMLINK_NOFOLLOW, int) - PSI_CONST(AT_SYMLINK_FOLLOW, int) - PSI_CONST(AT_REMOVEDIR, int) - - PSI_CONST(POSIX_FADV_DONTNEED, int) - PSI_CONST(POSIX_FADV_NOREUSE, int) - PSI_CONST(POSIX_FADV_NORMAL, int) - PSI_CONST(POSIX_FADV_RANDOM, int) - PSI_CONST(POSIX_FADV_SEQUENTUAL, int) - PSI_CONST(POSIX_FADV_WILLNEED, int) - - PSI_STRUCT(struct flock, [ - short l_type, - short l_whence, - off_t l_start, - off_t l_len, - pid_t l_pid] - ) - - PSI_DECL(int creat, [(const char *path, mode_t mode)]) - PSI_DECL(int fcntl, [(int fd, int cmd, mode_t mode)]) - PSI_DECL(int open, [(const char *path, int flags, mode_t mode)]) - PSI_DECL(int openat, [(int dirfd, const char *path, int flags, mode_t mode)]) - - PSI_DECL(int posix_fadvise, [(int fd, off_t offset, off_t len, int advice)]) - PSI_DECL(int posix_fallocate, [(int fd, off_t offset, off_t len)]) -} diff --git a/m4/glob.m4 b/m4/glob.m4 deleted file mode 100644 index da5dc0e..0000000 --- a/m4/glob.m4 +++ /dev/null @@ -1,30 +0,0 @@ -PSI_CHECK_GLOB() { - PSI_CONFIG_POSIX(glob, glob.h) - - PSI_STRUCT(glob_t, [ - size_t gl_pathc, - int gl_matchc, - size_t gl_offs, - int gl_flags, - char **gl_pathv]) - - PSI_DECL(int glob, [(char *path, int flags, void *err, glob_t *buf)]) - PSI_DECL(void globfree, [(glob_t *buf)]) - - PSI_CONST(GLOB_APPEND, int) - PSI_CONST(GLOB_BRACE, int) - PSI_CONST(GLOB_DOOFFS, int) - PSI_CONST(GLOB_ERR, int) - PSI_CONST(GLOB_MARK, int) - PSI_CONST(GLOB_NOCHECK, int) - PSI_CONST(GLOB_NOESCAPE, int) - PSI_CONST(GLOB_NOMAGIC, int) - PSI_CONST(GLOB_NOSORT, int) - PSI_CONST(GLOB_ONLYDIR, int) - PSI_CONST(GLOB_PERIOD, int) - PSI_CONST(GLOB_TILDE, int) - PSI_CONST(GLOB_TILDE_CHECK, int) - PSI_CONST(GLOB_ABORTED, int) - PSI_CONST(GLOB_NOMATCH, int) - PSI_CONST(GLOB_NOSPACE, int) -} diff --git a/m4/locale.m4 b/m4/locale.m4 deleted file mode 100644 index 3459101..0000000 --- a/m4/locale.m4 +++ /dev/null @@ -1,56 +0,0 @@ -PSI_CHECK_LOCALE() { - PSI_CONFIG_POSIX(locale, locale.h xlocale.h) - - PSI_STRUCT(struct lconv, [ - char *currency_symbol, - char *decimal_point, - char frac_digits, - char *grouping, - char *int_curr_symbol, - char int_frac_digits, - char int_n_cs_precedes, - char int_n_sep_by_space, - char int_n_sign_posn, - char int_p_cs_precedes, - char int_p_sep_by_space, - char int_p_sign_posn, - char *mon_decimal_point, - char *mon_grouping, - char *mon_thousands_sep, - char *negative_sign, - char n_cs_precedes, - char n_sep_by_space, - char n_sign_posn, - char *positive_sign, - char p_cs_precedes, - char p_sep_by_space, - char p_sign_posn, - char *thousands_sep]) - - PSI_CONST(LC_ALL, int) - PSI_CONST(LC_COLLATE, int) - PSI_CONST(LC_CTYPE, int) - PSI_CONST(LC_MESSAGES, int) - PSI_CONST(LC_MONETARY, int) - PSI_CONST(LC_NUMERIC, int) - PSI_CONST(LC_TIME, int) - - PSI_CONST(LC_COLLATE_MASK, int) - PSI_CONST(LC_CTYPE_MASK, int) - PSI_CONST(LC_MESSAGES_MASK, int) - PSI_CONST(LC_MONETARY_MASK, int) - PSI_CONST(LC_NUMERIC_MASK, int) - PSI_CONST(LC_TIME_MASK, int) - PSI_CONST(LC_ALL_MASK, int) - - PSI_MACRO(locale_t LC_GLOBAL_LOCALE) - - PSI_OPAQUE_TYPE(locale_t) - - PSI_DECL(locale_t duplocale, [(locale_t loc)]) - PSI_DECL(void freelocale, [(locale_t loc)]) - PSI_DECL(struct lconv *localeconv, [(void)]) - PSI_DECL(locale_t newlocale, [(int mask, const char *locale, locale_t base)]) - PSI_DECL(char *setlocale, [(int category, const char *locale)]) - PSI_DECL(locale_t uselocale, [(locale_t loc)]) -} diff --git a/m4/ndbm.m4 b/m4/ndbm.m4 deleted file mode 100644 index 3d60b06..0000000 --- a/m4/ndbm.m4 +++ /dev/null @@ -1,25 +0,0 @@ -PSI_CHECK_NDBM() { - PSI_CONFIG_POSIX(ndbm, ndbm.h) - - PHP_CHECK_FUNC_LIB(dbm_open, gdbm_compat) - - PSI_STRUCT(datum, [ - void *dptr, - int dsize] - ) - - PSI_OPAQUE_TYPE(DBM) - - PSI_CONST(DBM_INSERT, int) - PSI_CONST(DBM_REPLACE, int) - - PSI_DECL(void dbm_clearerr, [(DBM *db)]) - PSI_DECL(void dbm_close, [(DBM *db)]) - PSI_DECL(int dbm_delete, [(DBM *db, datum key)]) - PSI_DECL(int dbm_error, [(DBM *db)]) - PSI_DECL(datum dbm_fetch, [(DBM *db, datum key)]) - PSI_DECL(datum dbm_firstkey, [(DBM *db)]) - PSI_DECL(datum dbm_nextkey, [(DBM *db)]) - PSI_DECL(DBM *dbm_open, [(char *file, int open_flags, mode_t file_mode)]) - PSI_DECL(int dbm_store, [(DBM *db, datum key, datum content, int store_mode)]) -} \ No newline at end of file diff --git a/m4/netdb.m4 b/m4/netdb.m4 deleted file mode 100644 index 43008e5..0000000 --- a/m4/netdb.m4 +++ /dev/null @@ -1,96 +0,0 @@ -PSI_CHECK_NETDB() { - PSI_CONFIG_POSIX(netdb, netdb.h) - - PSI_STRUCT(struct hostent, [ - char *h_name, - char **h_aliases, - int h_addrtype, - int h_length, - char **h_addr_list] - ) - - PSI_STRUCT(struct netent, [ - char *n_name, - char **n_aliases, - int n_addrtype, - uint32_t n_net] - ) - - PSI_STRUCT(struct protoent, [ - char *p_name, - char **p_aliases, - int p_proto] - ) - - PSI_STRUCT(struct servent, [ - char *s_name, - char **s_aliases, - int s_port, - char *s_proto] - ) - - PSI_CONST(IPPORT_RESERVED, int) - - PSI_STRUCT(struct addrinfo, [ - int ai_flags, - int ai_family, - int ai_socktype, - int ai_protocol, - socklen_t ai_addrlen, - struct sockaddr *ai_addr, - char *ai_canonname, - struct addrinfo *ai_next] - ) - - PSI_CONST(AI_PASSIVE, int) - PSI_CONST(AI_CANONNAME, int) - PSI_CONST(AI_NUMERICHOST, int) - PSI_CONST(AI_NUMERICSERV, int) - PSI_CONST(AI_V4MAPPED, int) - PSI_CONST(AI_ALL, int) - PSI_CONST(AI_ADDRCONFIG, int) - - PSI_CONST(NI_NOFQDN, int) - PSI_CONST(NI_NUMERICHOST, int) - PSI_CONST(NI_NAMEREQD, int) - PSI_CONST(NI_NUMERICSERV, int) - PSI_CONST(NI_NUMERICSCOPE, int) - PSI_CONST(NI_DGRAM, int) - - PSI_CONST(NI_MAXHOST, int) - PSI_CONST(NI_MAXSERV, int) - - PSI_CONST(EAI_AGAIN, int) - PSI_CONST(EAI_BADFLAGS, int) - PSI_CONST(EAI_FAIL, int) - PSI_CONST(EAI_FAMILY, int) - PSI_CONST(EAI_MEMORY, int) - PSI_CONST(EAI_NONAME, int) - PSI_CONST(EAI_SERVICE, int) - PSI_CONST(EAI_SOCKTYPE, int) - PSI_CONST(EAI_SYSTEM, int) - PSI_CONST(EAI_OVERFLOW, int) - - PSI_DECL(void endhostent, [(void)]) - PSI_DECL(void endnetent, [(void)]) - PSI_DECL(void endprotoent, [(void)]) - PSI_DECL(void endservent, [(void)]) - PSI_DECL(void freeaddrinfo, [(struct addrinfo *res)]) - PSI_DECL(char *gai_strerror, [(int errcode)]) - PSI_DECL(int getaddrinfo, [(char *node, char *service, struct addrinfo *hints, struct addrinfo **res)]) - PSI_DECL(struct hostent *gethostent, [(void)]) - PSI_DECL(int getnameinfo, [(struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags)]) - PSI_DECL(struct netent *getnetbyaddr, [(uint32_t net, int type)]) - PSI_DECL(struct netent *getnetbyname, [(char *name)]) - PSI_DECL(struct netent *getnetent, [(void)]) - PSI_DECL(struct protoent *getprotobyname, [(char *name)]) - PSI_DECL(struct protoent *getprotobynumber, [(int proto)]) - PSI_DECL(struct protoent *getprotoent, [(void)]) - PSI_DECL(struct servent *getservbyname, [(char *name, char *proto)]) - PSI_DECL(struct servent *getservbyport, [(int port, char *proto)]) - PSI_DECL(struct servent *getservent, [(void)]) - PSI_DECL(void sethostent, [(int stayopen)]) - PSI_DECL(void setnetent, [(int stayopen)]) - PSI_DECL(void setprotoent, [(int stayopen)]) - PSI_DECL(void setservent, [(int stayopen)]) -} diff --git a/m4/netinet_in.m4 b/m4/netinet_in.m4 deleted file mode 100644 index e226d05..0000000 --- a/m4/netinet_in.m4 +++ /dev/null @@ -1,66 +0,0 @@ -PSI_CHECK_NETINET_IN() { - PSI_CONFIG_POSIX(netinet/in, netinet/in.h) - - PSI_TYPE(in_port_t, uint) - PSI_TYPE(in_addr_t, uint) - - PSI_STRUCT(struct in_addr, [ - in_addr_t s_addr] - ) - - PSI_STRUCT(struct sockaddr_in, [ - sa_family_t sin_family, - in_port_t sin_port, - struct in_addr sin_addr] - ) - - PSI_STRUCT(struct in6_addr, [ - uint8_t s6_addr@<:@16@:>@] - ) - PSI_STRUCT(struct sockaddr_in6, [ - sa_family_t sin6_family, - in_port_t sin6_port, - uint32_t sin6_flowinfo, - struct in6_addr sin6_addr, - uint32_t sin6_scope_id] - ) - - PSI_STRUCT(struct ipv6_mreq, [ - struct in6_addr ipv6mr_multiaddr, - unsigned ipv6mr_interface] - ) - - PSI_CONST(IPPROTO_IP, int) - PSI_CONST(IPPROTO_IPV6, int) - PSI_CONST(IPPROTO_ICMP, int) - PSI_CONST(IPPROTO_RAW, int) - PSI_CONST(IPPROTO_TCP, int) - PSI_CONST(IPPROTO_UDP, int) - - PSI_CONST(INADDR_ANY, int) - PSI_CONST(INADDR_BROADCAST, int) - PSI_CONST(INET6_ADDRSTRLEN, int) - - PSI_CONST(IPV6_JOIN_GROUP, int) - PSI_CONST(IPV6_LEAVE_GROUP, int) - PSI_CONST(IPV6_MULTICAST_HOPS, int) - PSI_CONST(IPV6_MULTICAST_IF, int) - PSI_CONST(IPV6_MULTICAST_LOOP, int) - PSI_CONST(IPV6_UNICAST_HOPS, int) - PSI_CONST(IPV6_V6ONLY, int) - - PSI_MACRO(int IN6_IS_ADDR_UNSPECIFIED, [(const struct in6_addr *a)]) - PSI_MACRO(int IN6_IS_ADDR_LOOPBACK, [(const struct in6_addr *a)]) - PSI_MACRO(int IN6_IS_ADDR_MULTICAST, [(const struct in6_addr *a)]) - PSI_MACRO(int IN6_IS_ADDR_LINKLOCAL, [(const struct in6_addr *a)]) - PSI_MACRO(int IN6_IS_ADDR_SITELOCAL, [(const struct in6_addr *a)]) - PSI_MACRO(int IN6_IS_ADDR_V4MAPPED, [(const struct in6_addr *a)]) - PSI_MACRO(int IN6_IS_ADDR_V4COMPAT, [(const struct in6_addr *a)]) - PSI_MACRO(int IN6_IS_ADDR_MC_NODELOCAL, [(const struct in6_addr *a)]) - PSI_MACRO(int IN6_IS_ADDR_MC_LINKLOCAL, [(const struct in6_addr *a)]) - PSI_MACRO(int IN6_IS_ADDR_MC_SITELOCAL, [(const struct in6_addr *a)]) - PSI_MACRO(int IN6_IS_ADDR_MC_ORGLOCAL, [(const struct in6_addr *a)]) - PSI_MACRO(int IN6_IS_ADDR_MC_GLOBAL, [(const struct in6_addr *a)]) - - PSI_EXTVAR(struct in6_addr in6addr_loopback) -} diff --git a/m4/netinet_tcp.m4 b/m4/netinet_tcp.m4 deleted file mode 100644 index 4e10420..0000000 --- a/m4/netinet_tcp.m4 +++ /dev/null @@ -1,5 +0,0 @@ -PSI_CHECK_NETINET_TCP() { - PSI_CONFIG_POSIX(netinet/tcp, netinet/tcp.h) - - PSI_CONST(TCP_NODELAY, int) -} diff --git a/m4/poll.m4 b/m4/poll.m4 deleted file mode 100644 index bbbb221..0000000 --- a/m4/poll.m4 +++ /dev/null @@ -1,24 +0,0 @@ -PSI_CHECK_POLL() { - PSI_CONFIG_POSIX(poll, poll.h) - - PSI_STRUCT(struct pollfd, [ - int fd, - short events, - short revents] - ) - - PSI_TYPE(nfds_t, uint) - - PSI_CONST(POLLIN, int) - PSI_CONST(POLLRDNORM, int) - PSI_CONST(POLLRDBAND, int) - PSI_CONST(POLLPRI, int) - PSI_CONST(POLLOUT, int) - PSI_CONST(POLLWRNORM, int) - PSI_CONST(POLLRWBAND, int) - PSI_CONST(POLLERR, int) - PSI_CONST(POLLHUP, int) - PSI_CONST(POLLNVAL, int) - - PSI_DECL(int poll, [(struct pollfd *fds, nfds_t nfds, int timeout)]) -} diff --git a/m4/posix/errno.m4 b/m4/posix/errno.m4 new file mode 100644 index 0000000..4d28b8b --- /dev/null +++ b/m4/posix/errno.m4 @@ -0,0 +1,87 @@ +PSI_CHECK_ERRNO() { + PSI_CONFIG_POSIX(errno, errno.h) + + PSI_EXTVAR(int errno) + + PSI_CONST(E2BIG, int) + PSI_CONST(EACCES, int) + PSI_CONST(EADDRINUSE, int) + PSI_CONST(EADDRNOTAVAIL, int) + PSI_CONST(EAFNOSUPPORT, int) + PSI_CONST(EAGAIN, int) + PSI_CONST(EALREADY, int) + PSI_CONST(EBADF, int) + PSI_CONST(EBADMSG, int) + PSI_CONST(EBUSY, int) + PSI_CONST(ECANCELED, int) + PSI_CONST(ECHILD, int) + PSI_CONST(ECONNABORTED, int) + PSI_CONST(ECONNREFUSED, int) + PSI_CONST(ECONNRESET, int) + PSI_CONST(EDEADLK, int) + PSI_CONST(EDESTADDRREQ, int) + PSI_CONST(EDOM, int) + PSI_CONST(EDQUOT, int) + PSI_CONST(EEXIST, int) + PSI_CONST(EFAULT, int) + PSI_CONST(EFBIG, int) + PSI_CONST(EHOSTUNREACH, int) + PSI_CONST(EIDRM, int) + PSI_CONST(EILSEQ, int) + PSI_CONST(EINPROGRESS, int) + PSI_CONST(EINTR, int) + PSI_CONST(EINVAL, int) + PSI_CONST(EIO, int) + PSI_CONST(EISCONN, int) + PSI_CONST(EISDIR, int) + PSI_CONST(ELOOP, int) + PSI_CONST(EMFILE, int) + PSI_CONST(EMLINK, int) + PSI_CONST(EMSGSIZE, int) + PSI_CONST(EMULTIHOP, int) + PSI_CONST(ENAMETOOLONG, int) + PSI_CONST(ENETDOWN, int) + PSI_CONST(ENETRESET, int) + PSI_CONST(ENETUNREACH, int) + PSI_CONST(ENFILE, int) + PSI_CONST(ENOBUFS, int) + PSI_CONST(ENODATA, int) + PSI_CONST(ENODEV, int) + PSI_CONST(ENOENT, int) + PSI_CONST(ENOEXEC, int) + PSI_CONST(ENOLCK, int) + PSI_CONST(ENOLINK, int) + PSI_CONST(ENOMEM, int) + PSI_CONST(ENOMSG, int) + PSI_CONST(ENOPROTOOPT, int) + PSI_CONST(ENOSPC, int) + PSI_CONST(ENOSR, int) + PSI_CONST(ENOSTR, int) + PSI_CONST(ENOSYS, int) + PSI_CONST(ENOTCONN, int) + PSI_CONST(ENOTDIR, int) + PSI_CONST(ENOTEMPTY, int) + PSI_CONST(ENOTRECOVERABLE, int) + PSI_CONST(ENOTSOCK, int) + PSI_CONST(ENOTSUP, int) + PSI_CONST(ENOTTY, int) + PSI_CONST(ENXIO, int) + PSI_CONST(EOPNOTSUPP, int) + PSI_CONST(EOVERFLOW, int) + PSI_CONST(EOWNERDEAD, int) + PSI_CONST(EPERM, int) + PSI_CONST(EPIPE, int) + PSI_CONST(EPROTO, int) + PSI_CONST(EPROTONOSUPPORT, int) + PSI_CONST(EPROTOTYPE, int) + PSI_CONST(ERANGE, int) + PSI_CONST(EROFS, int) + PSI_CONST(ESPIPE, int) + PSI_CONST(ESRCH, int) + PSI_CONST(ESTALE, int) + PSI_CONST(ETIME, int) + PSI_CONST(ETIMEDOUT, int) + PSI_CONST(ETXTBSY, int) + PSI_CONST(EWOULDBLOCK, int) + PSI_CONST(EXDEV, int) +} diff --git a/m4/posix/fcntl.m4 b/m4/posix/fcntl.m4 new file mode 100644 index 0000000..9e992cc --- /dev/null +++ b/m4/posix/fcntl.m4 @@ -0,0 +1,73 @@ +PSI_CHECK_FCNTL() { + PSI_CONFIG_POSIX(fcntl, fcntl.h) + + PSI_CONST(F_DUPFD, int) + PSI_CONST(F_DUPFD_CLOEXEC, int) + PSI_CONST(F_GETFD, int) + PSI_CONST(F_SETFD, int) + PSI_CONST(F_GETFL, int) + PSI_CONST(F_SETFL, int) + PSI_CONST(F_GETLK, int) + PSI_CONST(F_SETLK, int) + PSI_CONST(F_SETLKW, int) + PSI_CONST(F_GETOWN, int) + PSI_CONST(F_SETOWN, int) + + PSI_CONST(FD_CLOEXEC, int) + + PSI_CONST(F_RDLCK, int) + PSI_CONST(F_UNLCK, int) + PSI_CONST(F_WRLCK, int) + + PSI_CONST(O_CLOEXEC, int) + PSI_CONST(O_CREAT, int) + PSI_CONST(O_DIRECTORY, int) + PSI_CONST(O_EXCL, int) + PSI_CONST(O_NOCTTY, int) + PSI_CONST(O_NOFOLLOW, int) + PSI_CONST(O_TRUNC, int) + PSI_CONST(O_TTY_INIT, int) + + PSI_CONST(O_APPEND, int) + PSI_CONST(O_DSYNC, int) + PSI_CONST(O_NONBLOCK, int) + PSI_CONST(O_RSYNC, int) + PSI_CONST(O_SYNC, int) + + PSI_CONST(O_ACCMODE, int) + + PSI_CONST(O_EXEC, int) + PSI_CONST(O_RDONLY, int) + PSI_CONST(O_RDWR, int) + PSI_CONST(O_SEARCH, int) + PSI_CONST(O_WRONLY, int) + + PSI_CONST(AT_FDCWD, int) + PSI_CONST(AT_EACCESS, int) + PSI_CONST(AT_SYMLINK_NOFOLLOW, int) + PSI_CONST(AT_SYMLINK_FOLLOW, int) + PSI_CONST(AT_REMOVEDIR, int) + + PSI_CONST(POSIX_FADV_DONTNEED, int) + PSI_CONST(POSIX_FADV_NOREUSE, int) + PSI_CONST(POSIX_FADV_NORMAL, int) + PSI_CONST(POSIX_FADV_RANDOM, int) + PSI_CONST(POSIX_FADV_SEQUENTUAL, int) + PSI_CONST(POSIX_FADV_WILLNEED, int) + + PSI_STRUCT(struct flock, [ + short l_type, + short l_whence, + off_t l_start, + off_t l_len, + pid_t l_pid] + ) + + PSI_DECL(int creat, [(const char *path, mode_t mode)]) + PSI_DECL(int fcntl, [(int fd, int cmd, mode_t mode)]) + PSI_DECL(int open, [(const char *path, int flags, mode_t mode)]) + PSI_DECL(int openat, [(int dirfd, const char *path, int flags, mode_t mode)]) + + PSI_DECL(int posix_fadvise, [(int fd, off_t offset, off_t len, int advice)]) + PSI_DECL(int posix_fallocate, [(int fd, off_t offset, off_t len)]) +} diff --git a/m4/posix/glob.m4 b/m4/posix/glob.m4 new file mode 100644 index 0000000..f727d5e --- /dev/null +++ b/m4/posix/glob.m4 @@ -0,0 +1,31 @@ +PSI_CHECK_GLOB() { + PSI_CONFIG_POSIX(glob, glob.h) + + PSI_STRUCT(glob_t, [ + size_t gl_pathc, + int gl_matchc, + size_t gl_offs, + int gl_flags, + char **gl_pathv]) + + PSI_FUNCTOR_TYPE(int glob_err, [(const char *epath, int eerrno)]) + PSI_DECL(int glob, [(char *path, int flags, glob_err err, glob_t *buf)]) + PSI_DECL(void globfree, [(glob_t *buf)]) + + PSI_CONST(GLOB_APPEND, int) + PSI_CONST(GLOB_BRACE, int) + PSI_CONST(GLOB_DOOFFS, int) + PSI_CONST(GLOB_ERR, int) + PSI_CONST(GLOB_MARK, int) + PSI_CONST(GLOB_NOCHECK, int) + PSI_CONST(GLOB_NOESCAPE, int) + PSI_CONST(GLOB_NOMAGIC, int) + PSI_CONST(GLOB_NOSORT, int) + PSI_CONST(GLOB_ONLYDIR, int) + PSI_CONST(GLOB_PERIOD, int) + PSI_CONST(GLOB_TILDE, int) + PSI_CONST(GLOB_TILDE_CHECK, int) + PSI_CONST(GLOB_ABORTED, int) + PSI_CONST(GLOB_NOMATCH, int) + PSI_CONST(GLOB_NOSPACE, int) +} diff --git a/m4/posix/locale.m4 b/m4/posix/locale.m4 new file mode 100644 index 0000000..3459101 --- /dev/null +++ b/m4/posix/locale.m4 @@ -0,0 +1,56 @@ +PSI_CHECK_LOCALE() { + PSI_CONFIG_POSIX(locale, locale.h xlocale.h) + + PSI_STRUCT(struct lconv, [ + char *currency_symbol, + char *decimal_point, + char frac_digits, + char *grouping, + char *int_curr_symbol, + char int_frac_digits, + char int_n_cs_precedes, + char int_n_sep_by_space, + char int_n_sign_posn, + char int_p_cs_precedes, + char int_p_sep_by_space, + char int_p_sign_posn, + char *mon_decimal_point, + char *mon_grouping, + char *mon_thousands_sep, + char *negative_sign, + char n_cs_precedes, + char n_sep_by_space, + char n_sign_posn, + char *positive_sign, + char p_cs_precedes, + char p_sep_by_space, + char p_sign_posn, + char *thousands_sep]) + + PSI_CONST(LC_ALL, int) + PSI_CONST(LC_COLLATE, int) + PSI_CONST(LC_CTYPE, int) + PSI_CONST(LC_MESSAGES, int) + PSI_CONST(LC_MONETARY, int) + PSI_CONST(LC_NUMERIC, int) + PSI_CONST(LC_TIME, int) + + PSI_CONST(LC_COLLATE_MASK, int) + PSI_CONST(LC_CTYPE_MASK, int) + PSI_CONST(LC_MESSAGES_MASK, int) + PSI_CONST(LC_MONETARY_MASK, int) + PSI_CONST(LC_NUMERIC_MASK, int) + PSI_CONST(LC_TIME_MASK, int) + PSI_CONST(LC_ALL_MASK, int) + + PSI_MACRO(locale_t LC_GLOBAL_LOCALE) + + PSI_OPAQUE_TYPE(locale_t) + + PSI_DECL(locale_t duplocale, [(locale_t loc)]) + PSI_DECL(void freelocale, [(locale_t loc)]) + PSI_DECL(struct lconv *localeconv, [(void)]) + PSI_DECL(locale_t newlocale, [(int mask, const char *locale, locale_t base)]) + PSI_DECL(char *setlocale, [(int category, const char *locale)]) + PSI_DECL(locale_t uselocale, [(locale_t loc)]) +} diff --git a/m4/posix/ndbm.m4 b/m4/posix/ndbm.m4 new file mode 100644 index 0000000..3d60b06 --- /dev/null +++ b/m4/posix/ndbm.m4 @@ -0,0 +1,25 @@ +PSI_CHECK_NDBM() { + PSI_CONFIG_POSIX(ndbm, ndbm.h) + + PHP_CHECK_FUNC_LIB(dbm_open, gdbm_compat) + + PSI_STRUCT(datum, [ + void *dptr, + int dsize] + ) + + PSI_OPAQUE_TYPE(DBM) + + PSI_CONST(DBM_INSERT, int) + PSI_CONST(DBM_REPLACE, int) + + PSI_DECL(void dbm_clearerr, [(DBM *db)]) + PSI_DECL(void dbm_close, [(DBM *db)]) + PSI_DECL(int dbm_delete, [(DBM *db, datum key)]) + PSI_DECL(int dbm_error, [(DBM *db)]) + PSI_DECL(datum dbm_fetch, [(DBM *db, datum key)]) + PSI_DECL(datum dbm_firstkey, [(DBM *db)]) + PSI_DECL(datum dbm_nextkey, [(DBM *db)]) + PSI_DECL(DBM *dbm_open, [(char *file, int open_flags, mode_t file_mode)]) + PSI_DECL(int dbm_store, [(DBM *db, datum key, datum content, int store_mode)]) +} \ No newline at end of file diff --git a/m4/posix/netdb.m4 b/m4/posix/netdb.m4 new file mode 100644 index 0000000..8d5b49a --- /dev/null +++ b/m4/posix/netdb.m4 @@ -0,0 +1,96 @@ +PSI_CHECK_NETDB() { + PSI_CONFIG_POSIX(netdb, netdb.h) + + PSI_STRUCT(struct hostent, [ + char *h_name, + char **h_aliases, + int h_addrtype, + int h_length, + char **h_addr_list] + ) + + PSI_STRUCT(struct netent, [ + char *n_name, + char **n_aliases, + int n_addrtype, + uint32_t n_net] + ) + + PSI_STRUCT(struct protoent, [ + char *p_name, + char **p_aliases, + int p_proto] + ) + + PSI_STRUCT(struct servent, [ + char *s_name, + char **s_aliases, + int s_port, + char *s_proto] + ) + + PSI_CONST(IPPORT_RESERVED, int) + + PSI_STRUCT(struct addrinfo, [ + int ai_flags, + int ai_family, + int ai_socktype, + int ai_protocol, + socklen_t ai_addrlen, + struct sockaddr *ai_addr, + char *ai_canonname, + struct addrinfo *ai_next] + ) + + PSI_CONST(AI_PASSIVE, int) + PSI_CONST(AI_CANONNAME, int) + PSI_CONST(AI_NUMERICHOST, int) + PSI_CONST(AI_NUMERICSERV, int) + PSI_CONST(AI_V4MAPPED, int) + PSI_CONST(AI_ALL, int) + PSI_CONST(AI_ADDRCONFIG, int) + + PSI_CONST(NI_NOFQDN, int) + PSI_CONST(NI_NUMERICHOST, int) + PSI_CONST(NI_NAMEREQD, int) + PSI_CONST(NI_NUMERICSERV, int) + PSI_CONST(NI_NUMERICSCOPE, int) + PSI_CONST(NI_DGRAM, int) + + PSI_CONST(NI_MAXHOST, int) + PSI_CONST(NI_MAXSERV, int) + + PSI_CONST(EAI_AGAIN, int) + PSI_CONST(EAI_BADFLAGS, int) + PSI_CONST(EAI_FAIL, int) + PSI_CONST(EAI_FAMILY, int) + PSI_CONST(EAI_MEMORY, int) + PSI_CONST(EAI_NONAME, int) + PSI_CONST(EAI_SERVICE, int) + PSI_CONST(EAI_SOCKTYPE, int) + PSI_CONST(EAI_SYSTEM, int) + PSI_CONST(EAI_OVERFLOW, int) + + PSI_DECL(void endhostent, [(void)]) + PSI_DECL(void endnetent, [(void)]) + PSI_DECL(void endprotoent, [(void)]) + PSI_DECL(void endservent, [(void)]) + PSI_DECL(void freeaddrinfo, [(struct addrinfo *res)]) + PSI_DECL(const char *gai_strerror, [(int errcode)]) + PSI_DECL(int getaddrinfo, [(char *node, char *service, struct addrinfo *hints, struct addrinfo **res)]) + PSI_DECL(struct hostent *gethostent, [(void)]) + PSI_DECL(int getnameinfo, [(struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags)]) + PSI_DECL(struct netent *getnetbyaddr, [(uint32_t net, int type)]) + PSI_DECL(struct netent *getnetbyname, [(char *name)]) + PSI_DECL(struct netent *getnetent, [(void)]) + PSI_DECL(struct protoent *getprotobyname, [(char *name)]) + PSI_DECL(struct protoent *getprotobynumber, [(int proto)]) + PSI_DECL(struct protoent *getprotoent, [(void)]) + PSI_DECL(struct servent *getservbyname, [(char *name, char *proto)]) + PSI_DECL(struct servent *getservbyport, [(int port, char *proto)]) + PSI_DECL(struct servent *getservent, [(void)]) + PSI_DECL(void sethostent, [(int stayopen)]) + PSI_DECL(void setnetent, [(int stayopen)]) + PSI_DECL(void setprotoent, [(int stayopen)]) + PSI_DECL(void setservent, [(int stayopen)]) +} diff --git a/m4/posix/netinet_in.m4 b/m4/posix/netinet_in.m4 new file mode 100644 index 0000000..e226d05 --- /dev/null +++ b/m4/posix/netinet_in.m4 @@ -0,0 +1,66 @@ +PSI_CHECK_NETINET_IN() { + PSI_CONFIG_POSIX(netinet/in, netinet/in.h) + + PSI_TYPE(in_port_t, uint) + PSI_TYPE(in_addr_t, uint) + + PSI_STRUCT(struct in_addr, [ + in_addr_t s_addr] + ) + + PSI_STRUCT(struct sockaddr_in, [ + sa_family_t sin_family, + in_port_t sin_port, + struct in_addr sin_addr] + ) + + PSI_STRUCT(struct in6_addr, [ + uint8_t s6_addr@<:@16@:>@] + ) + PSI_STRUCT(struct sockaddr_in6, [ + sa_family_t sin6_family, + in_port_t sin6_port, + uint32_t sin6_flowinfo, + struct in6_addr sin6_addr, + uint32_t sin6_scope_id] + ) + + PSI_STRUCT(struct ipv6_mreq, [ + struct in6_addr ipv6mr_multiaddr, + unsigned ipv6mr_interface] + ) + + PSI_CONST(IPPROTO_IP, int) + PSI_CONST(IPPROTO_IPV6, int) + PSI_CONST(IPPROTO_ICMP, int) + PSI_CONST(IPPROTO_RAW, int) + PSI_CONST(IPPROTO_TCP, int) + PSI_CONST(IPPROTO_UDP, int) + + PSI_CONST(INADDR_ANY, int) + PSI_CONST(INADDR_BROADCAST, int) + PSI_CONST(INET6_ADDRSTRLEN, int) + + PSI_CONST(IPV6_JOIN_GROUP, int) + PSI_CONST(IPV6_LEAVE_GROUP, int) + PSI_CONST(IPV6_MULTICAST_HOPS, int) + PSI_CONST(IPV6_MULTICAST_IF, int) + PSI_CONST(IPV6_MULTICAST_LOOP, int) + PSI_CONST(IPV6_UNICAST_HOPS, int) + PSI_CONST(IPV6_V6ONLY, int) + + PSI_MACRO(int IN6_IS_ADDR_UNSPECIFIED, [(const struct in6_addr *a)]) + PSI_MACRO(int IN6_IS_ADDR_LOOPBACK, [(const struct in6_addr *a)]) + PSI_MACRO(int IN6_IS_ADDR_MULTICAST, [(const struct in6_addr *a)]) + PSI_MACRO(int IN6_IS_ADDR_LINKLOCAL, [(const struct in6_addr *a)]) + PSI_MACRO(int IN6_IS_ADDR_SITELOCAL, [(const struct in6_addr *a)]) + PSI_MACRO(int IN6_IS_ADDR_V4MAPPED, [(const struct in6_addr *a)]) + PSI_MACRO(int IN6_IS_ADDR_V4COMPAT, [(const struct in6_addr *a)]) + PSI_MACRO(int IN6_IS_ADDR_MC_NODELOCAL, [(const struct in6_addr *a)]) + PSI_MACRO(int IN6_IS_ADDR_MC_LINKLOCAL, [(const struct in6_addr *a)]) + PSI_MACRO(int IN6_IS_ADDR_MC_SITELOCAL, [(const struct in6_addr *a)]) + PSI_MACRO(int IN6_IS_ADDR_MC_ORGLOCAL, [(const struct in6_addr *a)]) + PSI_MACRO(int IN6_IS_ADDR_MC_GLOBAL, [(const struct in6_addr *a)]) + + PSI_EXTVAR(struct in6_addr in6addr_loopback) +} diff --git a/m4/posix/netinet_tcp.m4 b/m4/posix/netinet_tcp.m4 new file mode 100644 index 0000000..4e10420 --- /dev/null +++ b/m4/posix/netinet_tcp.m4 @@ -0,0 +1,5 @@ +PSI_CHECK_NETINET_TCP() { + PSI_CONFIG_POSIX(netinet/tcp, netinet/tcp.h) + + PSI_CONST(TCP_NODELAY, int) +} diff --git a/m4/posix/poll.m4 b/m4/posix/poll.m4 new file mode 100644 index 0000000..bbbb221 --- /dev/null +++ b/m4/posix/poll.m4 @@ -0,0 +1,24 @@ +PSI_CHECK_POLL() { + PSI_CONFIG_POSIX(poll, poll.h) + + PSI_STRUCT(struct pollfd, [ + int fd, + short events, + short revents] + ) + + PSI_TYPE(nfds_t, uint) + + PSI_CONST(POLLIN, int) + PSI_CONST(POLLRDNORM, int) + PSI_CONST(POLLRDBAND, int) + PSI_CONST(POLLPRI, int) + PSI_CONST(POLLOUT, int) + PSI_CONST(POLLWRNORM, int) + PSI_CONST(POLLRWBAND, int) + PSI_CONST(POLLERR, int) + PSI_CONST(POLLHUP, int) + PSI_CONST(POLLNVAL, int) + + PSI_DECL(int poll, [(struct pollfd *fds, nfds_t nfds, int timeout)]) +} diff --git a/m4/posix/signal.m4 b/m4/posix/signal.m4 new file mode 100644 index 0000000..a9225ce --- /dev/null +++ b/m4/posix/signal.m4 @@ -0,0 +1,187 @@ +PSI_CHECK_SIGNAL() { + PSI_CONFIG_POSIX(signal, signal.h) + + PSI_PTHREAD + + PSI_CONST(SIG_DFL, int) + PSI_CONST(SIG_ERR, int) + PSI_CONST(SIG_HOLD, int) + PSI_CONST(SIG_IGN, int) + + PSI_CONST(SIGEV_NONE, int) + PSI_CONST(SIGEV_SIGNAL, int) + PSI_CONST(SIGEV_THREAD, int) + + PSI_MACRO(int SIGRTMIN) + PSI_MACRO(int SIGRTMAX) + PSI_MACRO(int RTSIG_MAX) + + PSI_CONST(SIGABRT, int) + PSI_CONST(SIGALRM, int) + PSI_CONST(SIGBUS, int) + PSI_CONST(SIGCHLD, int) + PSI_CONST(SIGCONT, int) + PSI_CONST(SIGFPE, int) + PSI_CONST(SIGHUP, int) + PSI_CONST(SIGILL, int) + PSI_CONST(SIGINT, int) + PSI_CONST(SIGKILL, int) + PSI_CONST(SIGPIPE, int) + PSI_CONST(SIGQUIT, int) + PSI_CONST(SIGSEGV, int) + PSI_CONST(SIGSTOP, int) + PSI_CONST(SIGTERM, int) + PSI_CONST(SIGTSTP, int) + PSI_CONST(SIGTTIN, int) + PSI_CONST(SIGTTOU, int) + PSI_CONST(SIGUSR1, int) + PSI_CONST(SIGUSR2, int) + PSI_CONST(SIGPOLL, int) + PSI_CONST(SIGPROF, int) + PSI_CONST(SIGSYS, int) + PSI_CONST(SIGTRAP, int) + PSI_CONST(SIGURG, int) + PSI_CONST(SIGVTALRM, int) + PSI_CONST(SIGXCPU, int) + PSI_CONST(SIGXFSZ, int) + + PSI_MACRO(int SIG_BLOCK) + PSI_MACRO(int SIG_UNBLOCK) + PSI_MACRO(int SIG_SETMASK) + + PSI_CONST(SA_NOCLDSTOP, int) + PSI_CONST(SA_ONSTACK, int) + PSI_CONST(SA_RESETHAND, int) + PSI_CONST(SA_RESTART, int) + PSI_CONST(SA_SIGINFO, int) + PSI_CONST(SA_NOCLDWAIT, int) + PSI_CONST(SA_NODEFER, int) + PSI_CONST(SS_ONSTACK, int) + PSI_CONST(SS_DISABLE, int) + PSI_CONST(MINSIGSTKSZ, int) + PSI_CONST(SIGSTKSZ, int) + + PSI_CONST(ILL_ILLOPC, int) + PSI_CONST(ILL_ILLOPN, int) + PSI_CONST(ILL_ILLADR, int) + PSI_CONST(ILL_ILLTRP, int) + PSI_CONST(ILL_PRVOPC, int) + PSI_CONST(ILL_PRVREG, int) + PSI_CONST(ILL_COPROC, int) + PSI_CONST(ILL_BADSTK, int) + PSI_CONST(FPE_INTDIV, int) + PSI_CONST(FPE_INTOVF, int) + PSI_CONST(FPE_FLTDIV, int) + PSI_CONST(FPE_FLTOVF, int) + PSI_CONST(FPE_FLTUND, int) + PSI_CONST(FPE_FLTRES, int) + PSI_CONST(FPE_FLTINV, int) + PSI_CONST(FPE_FLTSUB, int) + PSI_CONST(SEGV_MAPERR, int) + PSI_CONST(SEGV_ACCERR, int) + PSI_CONST(BUS_ADRALN, int) + PSI_CONST(BUS_ADRERR, int) + PSI_CONST(BUS_OBJERR, int) + PSI_CONST(TRAP_BRKPT, int) + PSI_CONST(TRAP_TRACE, int) + PSI_CONST(CLD_EXITED, int) + PSI_CONST(CLD_KILLED, int) + PSI_CONST(CLD_DUMPED, int) + PSI_CONST(CLD_TRAPPED, int) + PSI_CONST(CLD_STOPPED, int) + PSI_CONST(CLD_CONTINUED, int) + PSI_CONST(POLL_IN, int) + PSI_CONST(POLL_OUT, int) + PSI_CONST(POLL_MSG, int) + PSI_CONST(POLL_ERR, int) + PSI_CONST(POLL_PRI, int) + PSI_CONST(POLL_HUP, int) + PSI_CONST(SI_USER, int) + PSI_CONST(SI_QUEUE, int) + PSI_CONST(SI_TIMER, int) + PSI_CONST(SI_ASYNCIO, int) + PSI_CONST(SI_MESGQ, int) + + PSI_TYPE(sig_atomic_t, int) + PSI_OPAQUE_TYPE(sigset_t) + PSI_OPAQUE_TYPE(mcontext_t) + + PSI_UNION(union sigval, [ + int sival_int, + void *sival_ptr] + ) + + PSI_STRUCT(struct sigevent, [ + int sigev_notify, + int sigev_signo, + union sigval sigev_value] + ) + + PSI_STRUCT(stack_t, [ + void *ss_sp, + size_t ss_size, + int ss_flags] + ) + + PSI_FUNCTOR_TYPE(void sa_handler, [(int signo)]) + PSI_FUNCTOR_TYPE(void sa_sigaction, [(int signo, siginfo_t *info, ucontext_t *context)]) + + PSI_STRUCT(struct sigaction, [ + sa_handler sa_handler, + sigset_t sa_mask, + int sa_flags, + sa_sigaction sa_sigaction] + ) + + PSI_STRUCT(ucontext_t, [ + ucontext_t *uc_link, + sigset_t uc_sigmask, + stack_t uc_stack, + mcontext_t uc_mcontext] + ) + + PSI_STRUCT(siginfo_t, [ + int si_signo, + int si_code, + int si_errno, + pid_t si_pid, + uid_t si_uid, + void *si_addr, + int si_status, + long si_band, + union sigval si_value] + ) + + PSI_DECL(int kill, [(pid_t pid, int sig)]) + PSI_DECL(int killpg, [(pid_t pgrp, int sig)]) + PSI_DECL(void psiginfo, [(const siginfo_t *pinfo, const char *s)]) + PSI_DECL(void psignal, [(int sig, const char *s)]) + + PSI_SH_TEST_POSIX_ENABLED(pthread, [ + PSI_DECL(int pthread_kill, [(pthread_t thread, int sig)]) + PSI_DECL(int pthread_sigmask, [(int how, const sigset_t *set, sigset_t *oldset)]) + ]) + + PSI_DECL(int raise, [(int sig)]) + PSI_DECL(int sigaction, [(int sig, const struct sigaction *act, struct sigaction *oact)]) + PSI_DECL(int sigaddset, [(sigset_t * set, int signum)]) + PSI_DECL(int sigaltstack, [(const stack_t *ss, stack_t *oss)]) + PSI_DECL(int sigdelset, [(sigset_t *set, int signum)]) + PSI_DECL(int sigemptyset, [(sigset_t *set)]) + PSI_DECL(int sigfillset, [(sigset_t *set)]) + PSI_DECL(int sighold, [(int sig)]) + PSI_DECL(int sigignore, [(int sig)]) + PSI_DECL(int siginterrupt, [(int sig, int flag)]) + PSI_DECL(int sigismember, [(const sigset_t *set, int signum)]) + PSI_DECL(void *signal, [(int sig, void *func)]) + PSI_DECL(int sigpause, [(int sig)]) + PSI_DECL(int sigpending, [(sigset_t *set)]) + PSI_DECL(int sigprocmask, [(int how, const sigset_t *set, sigset_t *oset)]) + PSI_DECL(int sigqueue, [(pid_t pid, int sig, const union sigval value)]) + PSI_DECL(int sigrelse, [(int sig)]) + PSI_DECL(void *sigset, [(int sig, void *disp)]) + PSI_DECL(int sigsuspend, [(const sigset_t *sigmask)]) + PSI_DECL(int sigtimedwait, [(const sigset_t *set, siginfo_t *info, const struct timespec *timeout)]) + PSI_DECL(int sigwait, [(const sigset_t *set, int *sig)]) + PSI_DECL(int sigwaitinfo, [(const sigset_t *set, siginfo_t *info)]) +} \ No newline at end of file diff --git a/m4/posix/stddef.m4 b/m4/posix/stddef.m4 new file mode 100644 index 0000000..fd52d2a --- /dev/null +++ b/m4/posix/stddef.m4 @@ -0,0 +1,18 @@ +PSI_CHECK_STDDEF() { + AC_CHECK_HEADERS(stddef.h) + PSI_TYPE(ptrdiff_t, int) + PSI_CONST(PTRDIFF_MIN, int) + PSI_CONST(PTRDIFF_MAX, int) + PSI_TYPE(size_t, uint) + PSI_CONST(SIZE_MAX, int) + PSI_TYPE(wchar_t, int) + if PSI_SH_TEST_SIZEOF(wchar_t); then :; else + # some platforms fail to provide wchar_t in stddef.h + unset ac_cv_sizeof_wchar_t + unset ax_cv_decl_wchar_t_signed + AC_CHECK_HEADERS(wchar.h) + PSI_TYPE(wchar_t, int) + fi + PSI_CONST(WCHAR_MIN, int) + PSI_CONST(WCHAR_MAX, int) +} diff --git a/m4/posix/stdint.m4 b/m4/posix/stdint.m4 new file mode 100644 index 0000000..c21c129 --- /dev/null +++ b/m4/posix/stdint.m4 @@ -0,0 +1,70 @@ +PSI_CHECK_STDINT() { + AC_CHECK_HEADERS(stdint.h) + + PSI_TYPE(int_least8_t, sint) + PSI_TYPE(int_least16_t, sint) + PSI_TYPE(int_least32_t, sint) + PSI_TYPE(int_least64_t, sint) + PSI_TYPE(uint_least8_t, uint) + PSI_TYPE(uint_least16_t, uint) + PSI_TYPE(uint_least32_t, uint) + PSI_TYPE(uint_least64_t, uint) + PSI_TYPE(int_fast8_t, sint) + PSI_TYPE(int_fast16_t, sint) + PSI_TYPE(int_fast32_t, sint) + PSI_TYPE(int_fast64_t, sint) + PSI_TYPE(uint_fast8_t, uint) + PSI_TYPE(uint_fast16_t, uint) + PSI_TYPE(uint_fast32_t, uint) + PSI_TYPE(uint_fast64_t, uint) + PSI_TYPE(intptr_t, sint) + PSI_TYPE(uintptr_t, uint) + PSI_TYPE(intmax_t, sint) + PSI_TYPE(uintmax_t, uint) + + PSI_CONST(INT8_MIN, int) + PSI_CONST(INT8_MAX, int) + PSI_CONST(UINT8_MAX, int) + PSI_CONST(INT16_MIN, int) + PSI_CONST(INT16_MAX, int) + PSI_CONST(UINT16_MAX, int) + PSI_CONST(INT32_MIN, int) + PSI_CONST(INT32_MAX, int) + PSI_CONST(UINT32_MAX, int) + PSI_CONST(INT64_MIN, int) + PSI_CONST(INT64_MAX, int) + PSI_CONST(UINT64_MAX, int) + + PSI_CONST(INT_LEAST8_MIN, int) + PSI_CONST(INT_LEAST8_MAX, int) + PSI_CONST(UINT_LEAST8_MAX, int) + PSI_CONST(INT_LEAST16_MIN, int) + PSI_CONST(INT_LEAST16_MAX, int) + PSI_CONST(UINT_LEAST16_MAX, int) + PSI_CONST(INT_LEAST32_MIN, int) + PSI_CONST(INT_LEAST32_MAX, int) + PSI_CONST(UINT_LEAST32_MAX, int) + PSI_CONST(INT_LEAST64_MIN, int) + PSI_CONST(INT_LEAST64_MAX, int) + PSI_CONST(UINT_LEAST64_MAX, int) + + PSI_CONST(INT_FAST8_MIN, int) + PSI_CONST(INT_FAST8_MAX, int) + PSI_CONST(UINT_FAST8_MAX, int) + PSI_CONST(INT_FAST16_MIN, int) + PSI_CONST(INT_FAST16_MAX, int) + PSI_CONST(UINT_FAST16_MAX, int) + PSI_CONST(INT_FAST32_MIN, int) + PSI_CONST(INT_FAST32_MAX, int) + PSI_CONST(UINT_FAST32_MAX, int) + PSI_CONST(INT_FAST64_MIN, int) + PSI_CONST(INT_FAST64_MAX, int) + PSI_CONST(UINT_FAST64_MAX, int) + + PSI_CONST(INTPTR_MIN, int) + PSI_CONST(INTPTR_MAX, int) + PSI_CONST(UINTPTR_MAX, int) + PSI_CONST(INTMAX_MIN, int) + PSI_CONST(INTMAX_MAX, int) + PSI_CONST(UINTMAX_MAX, int) +} diff --git a/m4/posix/stdio.m4 b/m4/posix/stdio.m4 new file mode 100644 index 0000000..a2b40b5 --- /dev/null +++ b/m4/posix/stdio.m4 @@ -0,0 +1,87 @@ +PSI_CHECK_STDIO() { + PSI_CONFIG_POSIX(stdio, stdio.h) + + PSI_STRUCT(FILE) + PSI_STRUCT(fpos_t) + + PSI_CONST(BUFSIZ, int) + PSI_CONST(_IOFBF, int) + PSI_CONST(_IOLBF, int) + PSI_CONST(_IONBF, int) + PSI_CONST(SEEK_CUR, int) + PSI_CONST(SEEK_END, int) + PSI_CONST(SEEK_SET, int) + PSI_CONST(FILENAME_MAX, int) + PSI_CONST(FOPEN_MAX, int) + PSI_CONST(TMP_MAX, int) + PSI_CONST(EOF, int) + PSI_CONST(P_tmpdir, string) + PSI_CONST(L_ctermid, int) + PSI_CONST(L_tmpnam, int) + + PSI_MACRO(FILE *stderr) + PSI_MACRO(FILE *stdout) + PSI_MACRO(FILE *stdin) + + PSI_DECL(void clearerr, [(FILE *stream)]) + PSI_DECL(char *ctermid, [(char *s)]) + PSI_DECL(int fclose, [(FILE *stream)]) + PSI_DECL(FILE *fdopen, [(int fd, char *mode)]) + PSI_DECL(int feof, [(FILE *stream)]) + PSI_DECL(int ferror, [(FILE *stream)]) + PSI_DECL(int fflush, [(FILE *stream)]) + PSI_DECL(int fgetc, [(FILE *stream)]) + PSI_DECL(int fgetpos, [(FILE *stream, fpos_t *pos)]) + PSI_DECL(char *fgets, [(char *buf, int len, FILE *stream)]) + PSI_DECL(int fileno, [(FILE *stream)]) + PSI_DECL(void flockfile, [(FILE *stream)]) + PSI_DECL(FILE *fmemopen, [(void *buf, size_t len, char *mode)]) + PSI_DECL(FILE *fopen, [(char *path, char *mode)]) + PSI_DECL(int fputc, [(int c, FILE *stream)]) + PSI_DECL(int fputs, [(char *s, FILE *stream)]) + PSI_DECL(size_t fread, [(void *buf, size_t len, size_t n, FILE *stream)]) + PSI_DECL(FILE *freopen, [(char *path, char *mode, FILE *stream)]) + PSI_DECL(int fseek, [(FILE *stream, long offset, int whence)]) + PSI_DECL(int fseeko, [(FILE *stream, off_t offset, int whence)]) + PSI_DECL(int fsetpos, [(FILE *stream, fpos_t *pos)]) + PSI_DECL(long ftell, [(FILE *stream)]) + PSI_DECL(off_t ftello, [(FILE *stream)]) + PSI_DECL(int ftrylockfile, [(FILE *stream)]) + PSI_DECL(void funlockfile, [(FILE *stream)]) + PSI_DECL(size_t fwrite, [(void *buf, size_t len, size_t n, FILE *stream)]) + PSI_DECL(int getc, [(FILE *stream)]) + PSI_DECL(int getchar, [(void)]) + PSI_DECL(int getc_unlocked, [(FILE *stream)]) + PSI_DECL(int getchar_unlocked, [(void)]) + PSI_DECL(ssize_t getdelim, [(char **lineptr, size_t *n, int delim, FILE *stream)]) + PSI_DECL(ssize_t getline, [(char **lineptr, size_t *n, FILE *stream)]) + PSI_DECL(char *gets, [(char *buf)]) + PSI_DECL(FILE *open_memstream, [(char **ptr, size_t *sizeloc)]) + PSI_DECL(int pclose, [(FILE *stream)]) + PSI_DECL(void perror, [(char *s)]) + PSI_DECL(FILE *popen, [(char *command, char *type)]) + PSI_DECL(int putc, [(int c, FILE *stream)]) + PSI_DECL(int putchar, [(int c)]) + PSI_DECL(int putc_unlocked, [(int c, FILE *stream)]) + PSI_DECL(int putchar_unlocked, [(int c)]) + PSI_DECL(int puts, [(char *s)]) + PSI_DECL(int remove, [(char *path)]) + PSI_DECL(int rename, [(char *old, char *new)]) + PSI_DECL(int renameat, [(int oldfd, char *oldpath, int newfd, char *newpath)]) + PSI_DECL(void rewind, [(FILE *stream)]) + PSI_DECL(void setbuf, [(FILE *stream, char *buf)]) + PSI_DECL(int setvbuf, [(FILE *stream, char *buf, int mode, size_t size)]) + PSI_DECL(char *tempnam, [(char *dir, char *prefix)]) + PSI_DECL(FILE *tmpfile, [(void)]) + PSI_DECL(char *tmpnam, [(char *s)]) + PSI_DECL(int ungetc, [(int c, FILE *stream)]) + + PSI_DECL(int dprintf, [(int fd, char *format)], vararg) + PSI_DECL(int fprintf, [(FILE *stream, char *format)], vararg) + PSI_DECL(int fscanf, [(FILE *stream, char *format)], vararg) + PSI_DECL(int printf, [(char *format)], vararg) + PSI_DECL(int scanf, [(char *format)], vararg) + PSI_DECL(int snprintf, [(char *str, size_t size, char *format)], vararg) + PSI_DECL(int sprintf, [(char *str, char *format)], vararg) + PSI_DECL(int sscanf, [(char *str, char *format)], vararg) +} diff --git a/m4/posix/stdlib.m4 b/m4/posix/stdlib.m4 new file mode 100644 index 0000000..60a3015 --- /dev/null +++ b/m4/posix/stdlib.m4 @@ -0,0 +1,79 @@ +PSI_CHECK_STDLIB() { + AC_CHECK_HEADERS(stdlib.h) + + PSI_STRUCT(div_t, [ + int quot, + int rem + ]) + PSI_STRUCT(ldiv_t, [ + long quot, + long rem + ]) + PSI_STRUCT(lldiv_t, [ + long long quot, + long long rem + ]) + + PSI_CONST(EXIT_FAILURE, int) + PSI_CONST(EXIT_SUCCESS, int) + PSI_CONST(RAND_MAX, int) + + PSI_MACRO(int MB_CUR_MAX) + + PSI_DECL(void _Exit, [(int status)]) + PSI_DECL(void abort, [()]) + PSI_DECL(int abs, [(int n)]) + PSI_DECL(double atof, [(char *str)]) + PSI_DECL(int atoi, [(char *str)]) + PSI_DECL(long atol, [(char *str)]) + PSI_DECL(div_t div, [(int numerator, int denominator)]) + PSI_DECL(double drand48, [()]) + PSI_DECL(double erand48, [(unsigned short xsubi@<:@3@:>@)]) + PSI_DECL(void exit, [(int status)]) + PSI_DECL(void free, [(void *ptr)]) + PSI_DECL(char *getenv, [(char *var)]) + PSI_DECL(int grantpt, [(int fd)]) + PSI_DECL(char *initstate, [(unsigned int seed, char *state, size_t n)]) + PSI_DECL(long jrand48, [(unsigned short xsubi@<:@3@:>@)]) + PSI_DECL(long labs, [(long l)]) + PSI_DECL(void lcong48, [(unsigned short param@<:@7@:>@)]) + PSI_DECL(ldiv_t ldiv, [(long numerator, long denominator)]) + PSI_DECL(lldiv_t lldiv, [(long long numerator, long long denominator)]) + PSI_DECL(long lrand48, [()]) + PSI_DECL(int mblen, [(const char *s, size_t n)]) + PSI_DECL(size_t mbstowcs, [(wchar_t *dest, char *src, size_t n)]) + PSI_DECL(int mbtowc, [(wchar_t *pwc, char *s, size_t n)]) + PSI_DECL(char *mkdtemp, [(char *template)]) + PSI_DECL(char *mkdstemp, [(char *template)]) + PSI_DECL(long mrand48, [()]) + PSI_DECL(long nrand48, [(unsigned short xsubi@<:@3@:>@)]) + PSI_DECL(int posix_openpt, [(int flags)]) + PSI_DECL(char *ptsname, [(int fd)]) + PSI_DECL(char *pstname_r, [(int fd, char *buf, size_t buflen)]) + PSI_DECL(int putenv, [(char *var)]) + PSI_DECL(int rand, [()]) + PSI_DECL(int rand_r, [(unsigned *seed_p)]) + PSI_DECL(long random, [()]) + PSI_DECL(char *realpath, [(char *path, char *resolved)]) + PSI_DECL(unsigned short *seed48, [(unsigned short seed16v@<:@3@:>@)]) + PSI_DECL(int setenv, [(char *var, char *val, int overwrite)]) + + AC_SEARCH_LIBS(setkey, crypt, [ + PSI_DECL(void setkey, [(char *key)]) + ]) + + PSI_DECL(char *setstate, [(char *state)]) + PSI_DECL(void srand, [(unsigned seed)]) + PSI_DECL(void srand48, [(long seed)]) + PSI_DECL(void srandom, [(unsigned seed)]) + PSI_DECL(double strtod, [(char *nptr, char **endptr)]) + PSI_DECL(float strtof, [(char *nptr, char **endptr)]) + PSI_DECL(long strtol, [(char *nptr, char **endptr, int base)]) + PSI_DECL(long double strtold, [(const char *nptr, char **endptr)]) + PSI_DECL(unsigned long strtoul, [(char *nptr, char **endptr, int base)]) + PSI_DECL(int system, [(char *command)]) + PSI_DECL(int unlockpt, [(int fd)]) + PSI_DECL(int unsetenv, [(char *var)]) + PSI_DECL(size_t wcstombs, [(char *dest, wchar_t *src, size_t n)]) + PSI_DECL(int wctomb, [(char *s, wchar_t wc)]) +} diff --git a/m4/posix/sys_select.m4 b/m4/posix/sys_select.m4 new file mode 100644 index 0000000..0390299 --- /dev/null +++ b/m4/posix/sys_select.m4 @@ -0,0 +1,17 @@ +PSI_CHECK_SYS_SELECT() { + PSI_CONFIG_POSIX(sys/select, sys/select.h) + + PSI_STRUCT(fd_set, []) + + PSI_CONST(FD_SETSIZE, int) + + PSI_DECL(void FD_CLEAR, [(int fd, fd_set *s)]) + PSI_DECL(void FD_COPY, [(fd_set *s1, fd_set *s2)]) + PSI_DECL(void FD_CLR, [(int fd, fd_set *s)]) + PSI_DECL(void FD_SET, [(int fd, fd_set *s)]) + PSI_DECL(int FD_ISSET, [(int fd, fd_set *s)]) + PSI_DECL(void FD_ZERO, [(fd_set *s)]) + + PSI_DECL(int select, [(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout)]) + dnl PSI_DECL(int pselect, [(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout, sigset_t *sigmask)]) +} diff --git a/m4/posix/sys_socket.m4 b/m4/posix/sys_socket.m4 new file mode 100644 index 0000000..6d1eaf3 --- /dev/null +++ b/m4/posix/sys_socket.m4 @@ -0,0 +1,93 @@ +PSI_CHECK_SYS_SOCKET() { + PSI_CONFIG_POSIX(sys/socket, sys/socket.h) + + PSI_TYPE(socklen_t, int) + PSI_TYPE(sa_family_t, uint) + + PSI_STRUCT(struct sockaddr, [ + sa_family_t sa_family, + char sa_data@<:@0@:>@] + ) + PSI_STRUCT(struct sockaddr_storage, [ + sa_family_t ss_family] + ) + PSI_STRUCT(struct msghdr, [ + void *msg_name, + socklen_t msg_namelen, + struct iovec *msg_iov, + int msg_iovlen, + void *msg_control, + socklen_t msg_controllen, + int msg_flags] + ) + PSI_STRUCT(struct cmsghdr, [ + socklen_t cmsg_len, + int cmsg_level, + int cmsg_type] + ) + PSI_STRUCT(struct linger, [ + int l_onoff, + int l_linger] + ) + + PSI_CONST(AF_INET, int) + PSI_CONST(AF_INET6, int) + PSI_CONST(AF_UNIX, int) + PSI_CONST(AF_UNSPEC, int) + PSI_CONST(MSG_CTRUNC, int) + PSI_CONST(MSG_DONTROUTE, int) + PSI_CONST(MSG_EOR, int) + PSI_CONST(MSG_NOSIGNAL, int) + PSI_CONST(MSG_OOB, int) + PSI_CONST(MSG_PEEK, int) + PSI_CONST(MSG_TRUNC, int) + PSI_CONST(MSG_WAITALL, int) + PSI_CONST(SCM_RIGHTS, int) + PSI_CONST(SHUT_RD, int) + PSI_CONST(SHUT_RDWR, int) + PSI_CONST(SHUT_WR, int) + PSI_CONST(SOCK_DGRAM, int) + PSI_CONST(SOCK_RAW, int) + PSI_CONST(SOCK_SEQPACKET, int) + PSI_CONST(SOCK_STREAM, int) + PSI_CONST(SOL_SOCKET, int) + PSI_CONST(SO_ACCEPTCONN, int) + PSI_CONST(SO_BROADCAST, int) + PSI_CONST(SO_DEBUG, int) + PSI_CONST(SO_DONTROUTE, int) + PSI_CONST(SO_ERROR, int) + PSI_CONST(SO_KEEPALIVE, int) + PSI_CONST(SO_LINGER, int) + PSI_CONST(SO_OOBINLINE, int) + PSI_CONST(SO_RCVBUF, int) + PSI_CONST(SO_RCVLOWAT, int) + PSI_CONST(SO_RCVTIMEO, int) + PSI_CONST(SO_REUSEADDR, int) + PSI_CONST(SO_SNDBUF, int) + PSI_CONST(SO_SNDLOWAT, int) + PSI_CONST(SO_SNDTIMEO, int) + PSI_CONST(SO_TYPE, int) + + PSI_MACRO(unsigned char *CMSG_DATA, [(struct cmsghdr *m)]) + PSI_MACRO(struct cmsghdr *CMSG_NXTHDR, [(struct msghdr *m, struct cmsghdr *c)]) + PSI_MACRO(struct cmsghdr *CMSG_FIRSTHDR, [(struct msghdr *m)]) + + PSI_DECL(int accept, [(int socket, struct sockaddr *address, socklen_t *address_len)]) + PSI_DECL(int bind, [(int socket, struct sockaddr *address, socklen_t address_len)]) + PSI_DECL(int connect, [(int socket, struct sockaddr *address, socklen_t address_len)]) + PSI_DECL(int getpeername, [(int socket, struct sockaddr *address, socklen_t *address_len)]) + PSI_DECL(int getsockname, [(int socket, struct sockaddr *address, socklen_t *address_len)]) + PSI_DECL(int getsockopt, [(int socket, int level, int option_name, void *option_value, socklen_t *option_len)]) + PSI_DECL(int listen, [(int socket, int backlog)]) + PSI_DECL(int recv, [(int socket, void *buffer, size_t length, int flags)]) + PSI_DECL(int recvfrom, [(int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len)]) + PSI_DECL(int recvmsg, [(int socket, struct msghdr *message, int flags)]) + PSI_DECL(int send, [(int socket, void *buffer, size_t length, int flags)]) + PSI_DECL(int sendmsg, [(int socket, struct msghdr *message, int flags)]) + PSI_DECL(int sendto, [(int socket, void *message, size_t length, int flags, struct sockaddr *dest_addr, socklen_t dest_len)]) + PSI_DECL(int setsockopt, [(int socket, int level, int option_name, void *option_value, socklen_t option_len)]) + PSI_DECL(int shutdown, [(int socket, int how)]) + PSI_DECL(int sockatmark, [(int socket)]) + PSI_DECL(int socket, [(int domain, int type, int protocol)]) + PSI_DECL(int socketpair, [(int domain, int type, int protocol, int socket_vector@<:@2@:>@)]) +} diff --git a/m4/posix/sys_stat.m4 b/m4/posix/sys_stat.m4 new file mode 100644 index 0000000..fb44945 --- /dev/null +++ b/m4/posix/sys_stat.m4 @@ -0,0 +1,85 @@ +PSI_CHECK_SYS_STAT() { + PSI_CONFIG_POSIX(sys/stat, sys/stat.h) + + PSI_STRUCT(struct stat, [ + dev_t st_dev, + ino_t st_ino, + mode_t st_mode, + nlink_t st_nlink, + uid_t st_uid, + gid_t st_gid, + dev_t st_rdev, + off_t st_size, + blksize_t st_blksize, + blkcnt_t st_blocks, + time_t st_atime, + time_t st_mtime, + time_t st_ctime, + struct timespec st_atim, + struct timespec st_mtim, + struct timespec st_ctim, + struct timespec st_atimespec, + struct timespec st_mtimespec, + struct timespec st_ctimespec, + struct timespec st_birthtimespec, + time_t st_birthtime, + int st_flags, + int st_gen] + ) + + PSI_CONST(S_IFMT, int) + PSI_CONST(S_IFBLK, int) + PSI_CONST(S_IFCHR, int) + PSI_CONST(S_IFIFO, int) + PSI_CONST(S_IFREG, int) + PSI_CONST(S_IFDIR, int) + PSI_CONST(S_IFLNK, int) + PSI_CONST(S_IFSOCK, int) + PSI_CONST(S_IRWXU, int) + PSI_CONST(S_IRUSR, int) + PSI_CONST(S_IWUSR, int) + PSI_CONST(S_IXUSR, int) + PSI_CONST(S_IRWXG, int) + PSI_CONST(S_IRGRP, int) + PSI_CONST(S_IWGRP, int) + PSI_CONST(S_IXGRP, int) + PSI_CONST(S_IRWXO, int) + PSI_CONST(S_IROTH, int) + PSI_CONST(S_IWOTH, int) + PSI_CONST(S_IXOTH, int) + PSI_CONST(S_ISUID, int) + PSI_CONST(S_ISGID, int) + PSI_CONST(S_ISVTX, int) + PSI_CONST(UTIME_NOW, int) + PSI_CONST(UTIME_OMIT, int) + + PSI_MACRO(int S_ISBLK, [(mode_t m)]) + PSI_MACRO(int S_ISCHR, [(mode_t m)]) + PSI_MACRO(int S_ISDIR, [(mode_t m)]) + PSI_MACRO(int S_ISFIFO, [(mode_t m)]) + PSI_MACRO(int S_ISREG, [(mode_t m)]) + PSI_MACRO(int S_ISLNK, [(mode_t m)]) + PSI_MACRO(int S_ISSOCK, [(mode_t m)]) + + PSI_MACRO(int S_TYPEISMQ, [(struct stat *s)]) + PSI_MACRO(int S_TYPEISSEM, [(struct stat *s)]) + PSI_MACRO(int S_TYPEISSHM, [(struct stat *s)]) + PSI_MACRO(int S_TYPEISTMO, [(struct stat *s)]) + + PSI_DECL(int chmod, [(char *path, mode_t mode)]) + PSI_DECL(int fchmod, [(int fd, mode_t mode)]) + PSI_DECL(int fchmodat, [(int fd, char *path, mode_t mode, int flag)]) + PSI_DECL(int fstat, [(int fd, struct stat *buf)]) + PSI_DECL(int fstatat, [(int fd, char *path, struct stat *buf, int flag)]) + PSI_DECL(int futimens, [(int fd, struct timespec times@<:@2@:>@)]) + PSI_DECL(int lstat, [(char *path, struct stat *buf)]) + PSI_DECL(int mkdir, [(char *path, mode_t mode)]) + PSI_DECL(int mkdirat, [(int fd, char *path, mode_t mode)]) + PSI_DECL(int mkfifo, [(char *path, mode_t mode)]) + PSI_DECL(int mkfifoat, [(int fd, char *path, mode_t mode)]) + PSI_DECL(int mknod, [(char *path, mode_t mode, dev_t dev)]) + PSI_DECL(int mknodat, [(int fd, char *path, mode_t mode, dev_t dev)]) + PSI_DECL(int stat, [(char *path, struct stat *buf)]) + PSI_DECL(mode_t umask, [(mode_t mode)]) + PSI_DECL(int utimensat, [(int fd, char *path, struct timespec times@<:@2@:>@, int flag)]) +} diff --git a/m4/posix/sys_time.m4 b/m4/posix/sys_time.m4 new file mode 100644 index 0000000..7dfecfd --- /dev/null +++ b/m4/posix/sys_time.m4 @@ -0,0 +1,25 @@ +PSI_CHECK_SYS_TIME() { + PSI_CONFIG_POSIX(sys/time, sys/time.h) + + PSI_CONST(ITIMER_REAL, int) + PSI_CONST(ITIMER_VIRTUAL, int) + PSI_CONST(ITIMER_PROF, int) + + PSI_STRUCT(struct timeval, [ + time_t tv_sec, + suseconds_t tv_usec] + ) + PSI_STRUCT(struct itimerval, [ + struct timeval it_interval, + struct timeval it_value] + ) + PSI_STRUCT(struct timezone, [ + int tz_minuteswest, + int tz_dsttime] + ) + + PSI_DECL(int getitimer, [(int which, struct itimerval *value)]) + PSI_DECL(int setitimer, [(int which, struct itimerval *value, struct itimerval *ovalue)]) + PSI_DECL(int gettimeofday, [(struct timeval *tp, struct timezone *tz)]) + PSI_DECL(int utimes, [(char *path, struct timeval times@<:@2@:>@)]) +} diff --git a/m4/posix/sys_times.m4 b/m4/posix/sys_times.m4 new file mode 100644 index 0000000..3301070 --- /dev/null +++ b/m4/posix/sys_times.m4 @@ -0,0 +1,12 @@ +PSI_CHECK_SYS_TIMES() { + PSI_CONFIG_POSIX(sys/times, sys/times.h) + + PSI_STRUCT(struct tms, [ + clock_t tms_utime, + clock_t tms_stime, + clock_t tms_cutime, + clock_t tms_cstime] + ) + + PSI_DECL(clock_t times, [(struct tms *buf)]) +} diff --git a/m4/posix/sys_types.m4 b/m4/posix/sys_types.m4 new file mode 100644 index 0000000..88315df --- /dev/null +++ b/m4/posix/sys_types.m4 @@ -0,0 +1,24 @@ +PSI_CHECK_SYS_TYPES() { + AC_CHECK_HEADERS(sys/types.h) + + PSI_TYPE(blkcnt_t, int) + PSI_TYPE(blksize_t, int) + PSI_TYPE(clock_t, int) + PSI_TYPE(clockid_t, int) + PSI_TYPE(dev_t, int) + PSI_TYPE(fsblkcnt_t, uint) + PSI_TYPE(fsfilcnt_t, uint) + PSI_TYPE(gid_t, int) + PSI_TYPE(id_t, int) + PSI_TYPE(ino_t, uint) + PSI_TYPE(key_t, int) + PSI_TYPE(mode_t, int) + PSI_TYPE(nlink_t, int) + PSI_TYPE(off_t, int) + PSI_TYPE(pid_t, int) + PSI_TYPE(ssize_t, int) + PSI_TYPE(suseconds_t, int) + PSI_TYPE(time_t, int) + PSI_TYPE(timer_t, int) + PSI_TYPE(uid_t, int) +} diff --git a/m4/posix/sys_uio.m4 b/m4/posix/sys_uio.m4 new file mode 100644 index 0000000..7cd4c3c --- /dev/null +++ b/m4/posix/sys_uio.m4 @@ -0,0 +1,11 @@ +PSI_CHECK_SYS_UIO() { + PSI_CONFIG_POSIX(sys/uio, sys/uio.h) + + PSI_STRUCT(struct iovec, [ + void *iov_base, + size_t iov_len] + ) + + PSI_DECL(ssize_t readv, [(int fd, struct iovec *iov, int iovcnt)]) + PSI_DECL(ssize_t writev, [(int fd, struct iovec *iov, int iovcnt)]) +} diff --git a/m4/posix/sys_utsname.m4 b/m4/posix/sys_utsname.m4 new file mode 100644 index 0000000..36f49d3 --- /dev/null +++ b/m4/posix/sys_utsname.m4 @@ -0,0 +1,14 @@ +PSI_CHECK_SYS_UTSNAME() { + PSI_CONFIG_POSIX(sys/utsname, sys/utsname.h) + + PSI_STRUCT(struct utsname, [ + char sysname@<:@0@:>@, + char nodename@<:@0@:>@, + char release@<:@0@:>@, + char version@<:@0@:>@, + char machine@<:@0@:>@, + char domainname@<:@0@:>@ + ]) + + PSI_DECL(int uname, [(struct utsname *name)]) +} diff --git a/m4/posix/syslog.m4 b/m4/posix/syslog.m4 new file mode 100644 index 0000000..3547f75 --- /dev/null +++ b/m4/posix/syslog.m4 @@ -0,0 +1,42 @@ +PSI_CHECK_SYSLOG() { + PSI_CONFIG_POSIX(syslog, syslog.h) + + PSI_CONST(LOG_PID, int) + PSI_CONST(LOG_CONS, int) + PSI_CONST(LOG_NDELAY, int) + PSI_CONST(LOG_ODELAY, int) + PSI_CONST(LOG_NOWAIT, int) + PSI_CONST(LOG_KERN, int) + PSI_CONST(LOG_USER, int) + PSI_CONST(LOG_MAIL, int) + PSI_CONST(LOG_NEWS, int) + PSI_CONST(LOG_UUCP, int) + PSI_CONST(LOG_DAEMON, int) + PSI_CONST(LOG_AUTH, int) + PSI_CONST(LOG_CRON, int) + PSI_CONST(LOG_LPR, int) + PSI_CONST(LOG_LOCAL0, int) + PSI_CONST(LOG_LOCAL1, int) + PSI_CONST(LOG_LOCAL2, int) + PSI_CONST(LOG_LOCAL3, int) + PSI_CONST(LOG_LOCAL4, int) + PSI_CONST(LOG_LOCAL5, int) + PSI_CONST(LOG_LOCAL6, int) + PSI_CONST(LOG_LOCAL7, int) + PSI_CONST(LOG_EMERG, int) + PSI_CONST(LOG_ALERT, int) + PSI_CONST(LOG_CRIT, int) + PSI_CONST(LOG_ERR, int) + PSI_CONST(LOG_WARNING, int) + PSI_CONST(LOG_NOTICE, int) + PSI_CONST(LOG_INFO, int) + PSI_CONST(LOG_DEBUG, int) + + PSI_MACRO(int LOG_MASK, [(int pri)]) + PSI_MACRO(int LOG_UPTO, [(int pri)]) + + PSI_DECL(void closelog, [(void)]) + PSI_DECL(void openlog, [(char *ident, int option, int facility)]) + PSI_DECL(void syslog, [(int priority, char *format)], vararg) + PSI_DECL(int setlogmask, [(int mask)]) +} diff --git a/m4/posix/time.m4 b/m4/posix/time.m4 new file mode 100644 index 0000000..e1b4011 --- /dev/null +++ b/m4/posix/time.m4 @@ -0,0 +1,63 @@ +PSI_CHECK_TIME() { + PSI_CONFIG_POSIX(time, time.h) + + PSI_CONST(CLOCKS_PER_SEC, int) + PSI_CONST(CLOCK_MONOTONIC, int) + PSI_CONST(CLOCK_PROCESS_CPUTIME_ID, int) + PSI_CONST(CLOCK_REALTIME, int) + PSI_CONST(CLOCK_THREAD_CPUTIME_ID, int) + PSI_CONST(TIMER_ABSTIME, int) + + PSI_STRUCT(struct tm, [ + int tm_sec, + int tm_min, + int tm_hour, + int tm_mday, + int tm_mon, + int tm_year, + int tm_wday, + int tm_yday, + int tm_isdst] + ) + PSI_STRUCT(struct timespec, [ + time_t tv_sec, + long tv_nsec] + ) + PSI_STRUCT(struct itimerspec, [ + struct timespec it_interval, + struct timespec it_value] + ) + + PSI_DECL(char *asctime, [(struct tm *tm)]) + PSI_DECL(char *asctime_r, [(struct tm *tm, char *buf)]) + PSI_DECL(clock_t clock, [()]) + PSI_DECL(int clock_getcpuclockid, [(pid_t pid, clockid_t *clock_id)]) + PSI_DECL(int clock_getres, [(clockid_t clk_id, struct timespec *res)]) + PSI_DECL(int clock_gettime, [(clockid_t clk_id, struct timespec *tp)]) + PSI_DECL(int clock_nanosleep, [(clockid_t clk_id, int flags, struct timespec *rqtp, struct timespec *rmtp)]) + PSI_DECL(int clock_settime, [(clockid_t clk_id, struct timespec *tp)]) + PSI_DECL(char *ctime, [(time_t *t)]) + PSI_DECL(char *ctime_r, [(time_t *t, char *buf)]) + PSI_DECL(double difftime, [(time_t time1, time_t time0)]) + PSI_DECL(struct tm *getdate, [(char *string)]) + PSI_DECL(struct tm *gmtime, [(time_t *t)]) + PSI_DECL(struct tm *gmtime_r, [(time_t *t, struct tm *buf)]) + PSI_DECL(struct tm *localtime, [(time_t *t)]) + PSI_DECL(struct tm *localtime_r, [(time_t *t, struct tm *buf)]) + PSI_DECL(time_t mktime, [(struct tm *tm)]) + PSI_DECL(int nanosleep, [(struct timespec *rqts, struct timespec *rmts)]) + PSI_DECL(size_t strftime, [(char *s, size_t max, char *fmt, struct tm *tm)]) + dnl PSI_DECL(size_t strftime_l, [(char *s, size_t max, char *fmt, struct tm *tm, locale_t l)]) + PSI_DECL(char *strptime, [(char *s, char *fmt, struct tm *tm)]) + PSI_DECL(time_t time, [(time_t *t)]) + dnl PSI_DECL(int timer_create, [(clockid_t clk_id, struct sigevent *se, timer_t *t)]) + PSI_DECL(int timer_delete, [(timer_t t)]) + PSI_DECL(int timer_getoverrun, [(timer_t t)]) + PSI_DECL(int timer_gettime, [(timer_t t, struct itimerspec *ts)]) + PSI_DECL(int timer_settime, [(timer_t t, int flags, struct itimerspec *value, struct itimerspec *ovalue)]) + PSI_DECL(void tzset, [()]) + + PSI_EXTVAR(int daylight) + PSI_EXTVAR(long timezone) + PSI_EXTVAR(char **tzname) +} diff --git a/m4/posix/unistd.m4 b/m4/posix/unistd.m4 new file mode 100644 index 0000000..2126500 --- /dev/null +++ b/m4/posix/unistd.m4 @@ -0,0 +1,378 @@ +PSI_CHECK_UNISTD() { + PSI_CONFIG_POSIX(unistd, unistd.h) + + PSI_CONST(F_LOCK, int) + PSI_CONST(F_TEST, int) + PSI_CONST(F_TLOCK, int) + PSI_CONST(F_ULOCK, int) + PSI_CONST(F_OK, int) + PSI_CONST(R_OK, int) + PSI_CONST(W_OK, int) + PSI_CONST(X_OK, int) + PSI_CONST(STDERR_FILENO, int) + PSI_CONST(STDIN_FILENO, int) + PSI_CONST(STDOUT_FILENO, int) + PSI_CONST(_CS_PATH, int) + PSI_CONST(_CS_POSIX_V6_ILP32_OFF32_CFLAGS, int) + PSI_CONST(_CS_POSIX_V6_ILP32_OFF32_LDFLAGS, int) + PSI_CONST(_CS_POSIX_V6_ILP32_OFF32_LIBS, int) + PSI_CONST(_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, int) + PSI_CONST(_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, int) + PSI_CONST(_CS_POSIX_V6_ILP32_OFFBIG_LIBS, int) + PSI_CONST(_CS_POSIX_V6_LP64_OFF64_CFLAGS, int) + PSI_CONST(_CS_POSIX_V6_LP64_OFF64_LDFLAGS, int) + PSI_CONST(_CS_POSIX_V6_LP64_OFF64_LIBS, int) + PSI_CONST(_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, int) + PSI_CONST(_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, int) + PSI_CONST(_CS_POSIX_V6_LPBIG_OFFBIG_LIBS, int) + PSI_CONST(_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS, int) + PSI_CONST(_CS_POSIX_V7_ILP32_OFF32_CFLAGS, int) + PSI_CONST(_CS_POSIX_V7_ILP32_OFF32_LDFLAGS, int) + PSI_CONST(_CS_POSIX_V7_ILP32_OFF32_LIBS, int) + PSI_CONST(_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, int) + PSI_CONST(_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, int) + PSI_CONST(_CS_POSIX_V7_ILP32_OFFBIG_LIBS, int) + PSI_CONST(_CS_POSIX_V7_LP64_OFF64_CFLAGS, int) + PSI_CONST(_CS_POSIX_V7_LP64_OFF64_LDFLAGS, int) + PSI_CONST(_CS_POSIX_V7_LP64_OFF64_LIBS, int) + PSI_CONST(_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, int) + PSI_CONST(_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, int) + PSI_CONST(_CS_POSIX_V7_LPBIG_OFFBIG_LIBS, int) + PSI_CONST(_CS_POSIX_V7_THREADS_CFLAGS, int) + PSI_CONST(_CS_POSIX_V7_THREADS_LDFLAGS, int) + PSI_CONST(_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS, int) + PSI_CONST(_CS_V6_ENV, int) + PSI_CONST(_CS_V7_ENV, int) + PSI_CONST(_PC_2_SYMLINKS, int) + PSI_CONST(_PC_ALLOC_SIZE_MIN, int) + PSI_CONST(_PC_ASYNC_IO, int) + PSI_CONST(_PC_CHOWN_RESTRICTED, int) + PSI_CONST(_PC_FILESIZEBITS, int) + PSI_CONST(_PC_LINK_MAX, int) + PSI_CONST(_PC_MAX_CANON, int) + PSI_CONST(_PC_MAX_INPUT, int) + PSI_CONST(_PC_NAME_MAX, int) + PSI_CONST(_PC_NO_TRUNC, int) + PSI_CONST(_PC_PATH_MAX, int) + PSI_CONST(_PC_PIPE_BUF, int) + PSI_CONST(_PC_PRIO_IO, int) + PSI_CONST(_PC_REC_INCR_XFER_SIZE, int) + PSI_CONST(_PC_REC_MAX_XFER_SIZE, int) + PSI_CONST(_PC_REC_MIN_XFER_SIZE, int) + PSI_CONST(_PC_REC_XFER_ALIGN, int) + PSI_CONST(_PC_SYMLINK_MAX, int) + PSI_CONST(_PC_SYNC_IO, int) + PSI_CONST(_PC_TIMESTAMP_RESOLUTION, int) + PSI_CONST(_PC_VDISABLE, int) + PSI_CONST(_POSIX2_CHAR_TERM, int) + PSI_CONST(_POSIX2_C_BIND, int) + PSI_CONST(_POSIX2_C_DEV, int) + PSI_CONST(_POSIX2_FORT_DEV, int) + PSI_CONST(_POSIX2_FORT_RUN, int) + PSI_CONST(_POSIX2_LOCALEDEF, int) + PSI_CONST(_POSIX2_PBS, int) + PSI_CONST(_POSIX2_PBS_ACCOUNTING, int) + PSI_CONST(_POSIX2_PBS_CHECKPOINT, int) + PSI_CONST(_POSIX2_PBS_LOCATE, int) + PSI_CONST(_POSIX2_PBS_MESSAGE, int) + PSI_CONST(_POSIX2_PBS_TRACK, int) + PSI_CONST(_POSIX2_SW_DEV, int) + PSI_CONST(_POSIX2_SYMLINKS, int) + PSI_CONST(_POSIX2_UPE, int) + PSI_CONST(_POSIX2_VERSION, int) + PSI_CONST(_POSIX_ADVISORY_INFO, int) + PSI_CONST(_POSIX_ASYNCHRONOUS_IO, int) + PSI_CONST(_POSIX_ASYNC_IO, int) + PSI_CONST(_POSIX_BARRIERS, int) + PSI_CONST(_POSIX_CHOWN_RESTRICTED, int) + PSI_CONST(_POSIX_CLOCK_SELECTION, int) + PSI_CONST(_POSIX_CPUTIME, int) + PSI_CONST(_POSIX_FSYNC, int) + PSI_CONST(_POSIX_IPV6, int) + PSI_CONST(_POSIX_JOB_CONTROL, int) + PSI_CONST(_POSIX_MAPPED_FILES, int) + PSI_CONST(_POSIX_MEMLOCK, int) + PSI_CONST(_POSIX_MEMLOCK_RANGE, int) + PSI_CONST(_POSIX_MEMORY_PROTECTION, int) + PSI_CONST(_POSIX_MESSAGE_PASSING, int) + PSI_CONST(_POSIX_MONOTONIC_CLOCK, int) + PSI_CONST(_POSIX_NO_TRUNC, int) + PSI_CONST(_POSIX_PRIORITIZED_IO, int) + PSI_CONST(_POSIX_PRIORITY_SCHEDULING, int) + PSI_CONST(_POSIX_PRIO_IO, int) + PSI_CONST(_POSIX_RAW_SOCKETS, int) + PSI_CONST(_POSIX_READER_WRITER_LOCKS, int) + PSI_CONST(_POSIX_REALTIME_SIGNALS, int) + PSI_CONST(_POSIX_REGEXP, int) + PSI_CONST(_POSIX_SAVED_IDS, int) + PSI_CONST(_POSIX_SEMAPHORES, int) + PSI_CONST(_POSIX_SHARED_MEMORY_OBJECTS, int) + PSI_CONST(_POSIX_SHELL, int) + PSI_CONST(_POSIX_SPAWN, int) + PSI_CONST(_POSIX_SPIN_LOCKS, int) + PSI_CONST(_POSIX_SPORADIC_SERVER, int) + PSI_CONST(_POSIX_SYNCHRONIZED_IO, int) + PSI_CONST(_POSIX_SYNC_IO, int) + PSI_CONST(_POSIX_THREADS, int) + PSI_CONST(_POSIX_THREAD_ATTR_STACKADDR, int) + PSI_CONST(_POSIX_THREAD_ATTR_STACKSIZE, int) + PSI_CONST(_POSIX_THREAD_CPUTIME, int) + PSI_CONST(_POSIX_THREAD_PRIORITY_SCHEDULING, int) + PSI_CONST(_POSIX_THREAD_PRIO_INHERIT, int) + PSI_CONST(_POSIX_THREAD_PRIO_PROTECT, int) + PSI_CONST(_POSIX_THREAD_PROCESS_SHARED, int) + PSI_CONST(_POSIX_THREAD_ROBUST_PRIO_INHERIT, int) + PSI_CONST(_POSIX_THREAD_ROBUST_PRIO_PROTECT, int) + PSI_CONST(_POSIX_THREAD_SAFE_FUNCTIONS, int) + PSI_CONST(_POSIX_THREAD_SPORADIC_SERVER, int) + PSI_CONST(_POSIX_TIMEOUTS, int) + PSI_CONST(_POSIX_TIMERS, int) + PSI_CONST(_POSIX_TIMESTAMP_RESOLUTION, int) + PSI_CONST(_POSIX_TRACE, int) + PSI_CONST(_POSIX_TRACE_EVENT_FILTER, int) + PSI_CONST(_POSIX_TRACE_INHERIT, int) + PSI_CONST(_POSIX_TRACE_LOG, int) + PSI_CONST(_POSIX_TYPED_MEMORY_OBJECTS, int) + PSI_CONST(_POSIX_V6_ILP32_OFF32, int) + PSI_CONST(_POSIX_V6_ILP32_OFFBIG, int) + PSI_CONST(_POSIX_V6_LP64_OFF64, int) + PSI_CONST(_POSIX_V6_LPBIG_OFFBIG, int) + PSI_CONST(_POSIX_V7_ILP32_OFF32, int) + PSI_CONST(_POSIX_V7_ILP32_OFFBIG, int) + PSI_CONST(_POSIX_V7_LP64_OFF64, int) + PSI_CONST(_POSIX_V7_LPBIG_OFFBIG, int) + PSI_CONST(_POSIX_VDISABLE, int) + PSI_CONST(_POSIX_VERSION, int) + PSI_CONST(_SC_2_CHAR_TERM, int) + PSI_CONST(_SC_2_C_BIND, int) + PSI_CONST(_SC_2_C_DEV, int) + PSI_CONST(_SC_2_FORT_DEV, int) + PSI_CONST(_SC_2_FORT_RUN, int) + PSI_CONST(_SC_2_LOCALEDEF, int) + PSI_CONST(_SC_2_PBS, int) + PSI_CONST(_SC_2_PBS_ACCOUNTING, int) + PSI_CONST(_SC_2_PBS_CHECKPOINT, int) + PSI_CONST(_SC_2_PBS_LOCATE, int) + PSI_CONST(_SC_2_PBS_MESSAGE, int) + PSI_CONST(_SC_2_PBS_TRACK, int) + PSI_CONST(_SC_2_SW_DEV, int) + PSI_CONST(_SC_2_UPE, int) + PSI_CONST(_SC_2_VERSION, int) + PSI_CONST(_SC_ADVISORY_INFO, int) + PSI_CONST(_SC_AIO_LISTIO_MAX, int) + PSI_CONST(_SC_AIO_MAX, int) + PSI_CONST(_SC_AIO_PRIO_DELTA_MAX, int) + PSI_CONST(_SC_ARG_MAX, int) + PSI_CONST(_SC_ASYNCHRONOUS_IO, int) + PSI_CONST(_SC_ATEXIT_MAX, int) + PSI_CONST(_SC_BARRIERS, int) + PSI_CONST(_SC_BC_BASE_MAX, int) + PSI_CONST(_SC_BC_DIM_MAX, int) + PSI_CONST(_SC_BC_SCALE_MAX, int) + PSI_CONST(_SC_BC_STRING_MAX, int) + PSI_CONST(_SC_CHILD_MAX, int) + PSI_CONST(_SC_CLK_TCK, int) + PSI_CONST(_SC_CLOCK_SELECTION, int) + PSI_CONST(_SC_COLL_WEIGHTS_MAX, int) + PSI_CONST(_SC_CPUTIME, int) + PSI_CONST(_SC_DELAYTIMER_MAX, int) + PSI_CONST(_SC_EXPR_NEST_MAX, int) + PSI_CONST(_SC_FSYNC, int) + PSI_CONST(_SC_GETGR_R_SIZE_MAX, int) + PSI_CONST(_SC_GETPW_R_SIZE_MAX, int) + PSI_CONST(_SC_HOST_NAME_MAX, int) + PSI_CONST(_SC_IOV_MAX, int) + PSI_CONST(_SC_IPV6, int) + PSI_CONST(_SC_JOB_CONTROL, int) + PSI_CONST(_SC_LINE_MAX, int) + PSI_CONST(_SC_LOGIN_NAME_MAX, int) + PSI_CONST(_SC_MAPPED_FILES, int) + PSI_CONST(_SC_MEMLOCK, int) + PSI_CONST(_SC_MEMLOCK_RANGE, int) + PSI_CONST(_SC_MEMORY_PROTECTION, int) + PSI_CONST(_SC_MESSAGE_PASSING, int) + PSI_CONST(_SC_MONOTONIC_CLOCK, int) + PSI_CONST(_SC_MQ_OPEN_MAX, int) + PSI_CONST(_SC_MQ_PRIO_MAX, int) + PSI_CONST(_SC_NGROUPS_MAX, int) + PSI_CONST(_SC_OPEN_MAX, int) + PSI_CONST(_SC_PAGESIZE, int) + PSI_CONST(_SC_PAGE_SIZE, int) + PSI_CONST(_SC_PRIORITIZED_IO, int) + PSI_CONST(_SC_PRIORITY_SCHEDULING, int) + PSI_CONST(_SC_RAW_SOCKETS, int) + PSI_CONST(_SC_READER_WRITER_LOCKS, int) + PSI_CONST(_SC_REALTIME_SIGNALS, int) + PSI_CONST(_SC_REGEXP, int) + PSI_CONST(_SC_RE_DUP_MAX, int) + PSI_CONST(_SC_RTSIG_MAX, int) + PSI_CONST(_SC_SAVED_IDS, int) + PSI_CONST(_SC_SEMAPHORES, int) + PSI_CONST(_SC_SEM_NSEMS_MAX, int) + PSI_CONST(_SC_SEM_VALUE_MAX, int) + PSI_CONST(_SC_SHARED_MEMORY_OBJECTS, int) + PSI_CONST(_SC_SHELL, int) + PSI_CONST(_SC_SIGQUEUE_MAX, int) + PSI_CONST(_SC_SPAWN, int) + PSI_CONST(_SC_SPIN_LOCKS, int) + PSI_CONST(_SC_SPORADIC_SERVER, int) + PSI_CONST(_SC_SS_REPL_MAX, int) + PSI_CONST(_SC_STREAM_MAX, int) + PSI_CONST(_SC_SYMLOOP_MAX, int) + PSI_CONST(_SC_SYNCHRONIZED_IO, int) + PSI_CONST(_SC_THREADS, int) + PSI_CONST(_SC_THREAD_ATTR_STACKADDR, int) + PSI_CONST(_SC_THREAD_ATTR_STACKSIZE, int) + PSI_CONST(_SC_THREAD_CPUTIME, int) + PSI_CONST(_SC_THREAD_DESTRUCTOR_ITERATIONS, int) + PSI_CONST(_SC_THREAD_KEYS_MAX, int) + PSI_CONST(_SC_THREAD_PRIORITY_SCHEDULING, int) + PSI_CONST(_SC_THREAD_PRIO_INHERIT, int) + PSI_CONST(_SC_THREAD_PRIO_PROTECT, int) + PSI_CONST(_SC_THREAD_PROCESS_SHARED, int) + PSI_CONST(_SC_THREAD_ROBUST_PRIO_INHERIT, int) + PSI_CONST(_SC_THREAD_ROBUST_PRIO_PROTECT, int) + PSI_CONST(_SC_THREAD_SAFE_FUNCTIONS, int) + PSI_CONST(_SC_THREAD_SPORADIC_SERVER, int) + PSI_CONST(_SC_THREAD_STACK_MIN, int) + PSI_CONST(_SC_THREAD_THREADS_MAX, int) + PSI_CONST(_SC_TIMEOUTS, int) + PSI_CONST(_SC_TIMERS, int) + PSI_CONST(_SC_TIMER_MAX, int) + PSI_CONST(_SC_TRACE, int) + PSI_CONST(_SC_TRACE_EVENT_FILTER, int) + PSI_CONST(_SC_TRACE_EVENT_NAME_MAX, int) + PSI_CONST(_SC_TRACE_INHERIT, int) + PSI_CONST(_SC_TRACE_LOG, int) + PSI_CONST(_SC_TRACE_NAME_MAX, int) + PSI_CONST(_SC_TRACE_SYS_MAX, int) + PSI_CONST(_SC_TRACE_USER_EVENT_MAX, int) + PSI_CONST(_SC_TTY_NAME_MAX, int) + PSI_CONST(_SC_TYPED_MEMORY_OBJECTS, int) + PSI_CONST(_SC_TZNAME_MAX, int) + PSI_CONST(_SC_V6_ILP32_OFF32, int) + PSI_CONST(_SC_V6_ILP32_OFFBIG, int) + PSI_CONST(_SC_V6_LP64_OFF64, int) + PSI_CONST(_SC_V6_LPBIG_OFFBIG, int) + PSI_CONST(_SC_V7_ILP32_OFF32, int) + PSI_CONST(_SC_V7_ILP32_OFFBIG, int) + PSI_CONST(_SC_V7_LP64_OFF64, int) + PSI_CONST(_SC_V7_LPBIG_OFFBIG, int) + PSI_CONST(_SC_VERSION, int) + PSI_CONST(_SC_XOPEN_CRYPT, int) + PSI_CONST(_SC_XOPEN_ENH_I18N, int) + PSI_CONST(_SC_XOPEN_REALTIME, int) + PSI_CONST(_SC_XOPEN_REALTIME_THREADS, int) + PSI_CONST(_SC_XOPEN_SHM, int) + PSI_CONST(_SC_XOPEN_STREAMS, int) + PSI_CONST(_SC_XOPEN_UNIX, int) + PSI_CONST(_SC_XOPEN_UUCP, int) + PSI_CONST(_SC_XOPEN_VERSION, int) + PSI_CONST(_XOPEN_CRYPT, int) + PSI_CONST(_XOPEN_ENH_I18N, int) + PSI_CONST(_XOPEN_REALTIME, int) + PSI_CONST(_XOPEN_REALTIME_THREADS, int) + PSI_CONST(_XOPEN_SHM, int) + PSI_CONST(_XOPEN_STREAMS, int) + PSI_CONST(_XOPEN_UNIX, int) + PSI_CONST(_XOPEN_UUCP, int) + PSI_CONST(_XOPEN_VERSION, int) + + PSI_EXTVAR(char *optarg) + PSI_EXTVAR(int opterr) + PSI_EXTVAR(int optind) + PSI_EXTVAR(int optopt) + + PSI_DECL(int access, [(const char *path, int amode)]) + PSI_DECL(unsigned alarm, [(unsigned seconds)]) + PSI_DECL(int chdir, [(const char *path)]) + PSI_DECL(int chown, [(const char *path, uid_t owner, gid_t group)]) + PSI_DECL(int close, [(int fildes)]) + PSI_DECL(size_t confstr, [(int name, char *buf, size_t len)]) + + AC_SEARCH_LIBS(crypt, crypt, [ + PSI_DECL(char *crypt, [(const char *key, const char *salt)]) + ]) + + PSI_DECL(int dup, [(int fildes)]) + PSI_DECL(int dup2, [(int fildes, int fildes2)]) + + AC_SEARCH_LIBS(encrypt, crypt, [ + PSI_DECL(void encrypt, [(char block@<:@64@:>@, int edflag)]) + ]) + + PSI_DECL(void _exit, [(int status)]) + PSI_DECL(int execl, [(const char *path, const char *arg)], vararg) + PSI_DECL(int execle, [(const char *path, const char *arg)], vararg) + PSI_DECL(int execlp, [(const char *file, const char *arg)], vararg) + PSI_DECL(int execv, [(const char *path, char **argv)]) + PSI_DECL(int execve, [(const char *path, char **argv, char **envp)]) + PSI_DECL(int execvp, [(const char *file, char **argv)]) + PSI_DECL(int faccessat, [(int fd, const char *path, int amode, int flag)]) + PSI_DECL(int fchdir, [(int fildes)]) + PSI_DECL(int fchown, [(int fildes, uid_t owner, gid_t group)]) + PSI_DECL(int fchownat, [(int fd, const char *path, uid_t owner, gid_t group, int flag)]) + PSI_DECL(int fdatasync, [(int fildes)]) + PSI_DECL(int fexecve, [(int fd, char **argv, char **envp)]) + PSI_DECL(pid_t fork, [(void)]) + PSI_DECL(long fpathconf, [(int fd, int name)]) + PSI_DECL(int fsync, [(int fildes)]) + PSI_DECL(int ftruncate, [(int fildes, off_t length)]) + PSI_DECL(char *getcwd, [(char *buf, size_t size)]) + PSI_DECL(gid_t getegid, [(void)]) + PSI_DECL(uid_t geteuid, [(void)]) + PSI_DECL(gid_t getgid, [(void)]) + PSI_DECL(int getgroups, [(int gidsetsize, gid_t *grouplist)]) + PSI_DECL(long gethostid, [(void)]) + PSI_DECL(int gethostname, [(char * name, size_t namelen)]) + PSI_DECL(char *getlogin, [(void)]) + PSI_DECL(int getlogin_r, [(char *buf, size_t bufsize)]) + PSI_DECL(int getopt, [(int argc, char **argv, const char *optstring)]) + PSI_DECL(pid_t getpgid, [(pid_t pid)]) + PSI_DECL(pid_t getpgrp, [(void)]) + PSI_DECL(pid_t getpid, [(void)]) + PSI_DECL(pid_t getppid, [(void)]) + PSI_DECL(pid_t getsid, [(pid_t pid)]) + PSI_DECL(uid_t getuid, [(void)]) + PSI_DECL(int isatty, [(int fd)]) + PSI_DECL(int lchown, [(const char *path, uid_t owner, gid_t group)]) + PSI_DECL(int link, [(const char *path1, const char *path2)]) + PSI_DECL(int linkat, [(int fd1, const char *path1, int fd2, const char *path2, int flag)]) + PSI_DECL(int lockf, [(int fd, int cmd, off_t len)]) + PSI_DECL(off_t lseek, [(int fildes, off_t offset, int whence)]) + PSI_DECL(int nice, [(int incr)]) + PSI_DECL(long pathconf, [(const char *path, int name)]) + PSI_DECL(int pause, [(void)]) + PSI_DECL(int pipe, [(int fildes@<:@2@:>@)]) + PSI_DECL(ssize_t pread, [(int fildes, void *buf, size_t nbyte, off_t offset)]) + PSI_DECL(ssize_t pwrite, [(int fildes, const void *buf, size_t nbyte, off_t offset)]) + PSI_DECL(ssize_t read, [(int fd, void *buf, size_t count)]) + PSI_DECL(ssize_t readlink, [(const char *path, char *buf, size_t bufsize)]) + PSI_DECL(ssize_t readlinkat, [(int fd, const char *path, char *buf, size_t bufsize)]) + PSI_DECL(int rmdir, [(const char *path)]) + PSI_DECL(int setegid, [(gid_t gid)]) + PSI_DECL(int seteuid, [(uid_t uid)]) + PSI_DECL(int setgid, [(gid_t gid)]) + PSI_DECL(int setpgid, [(pid_t pid, pid_t pgid)]) + PSI_DECL(pid_t setpgrp, [(void)]) + PSI_DECL(int setregid, [(gid_t rgid, gid_t egid)]) + PSI_DECL(int setreuid, [(uid_t ruid, uid_t euid)]) + PSI_DECL(pid_t setsid, [(void)]) + PSI_DECL(int setuid, [(uid_t uid)]) + PSI_DECL(unsigned sleep, [(unsigned seconds)]) + PSI_DECL(void swab, [(const void *from, void *to, ssize_t n)]) + PSI_DECL(int symlink, [(const char *path1, const char *path2)]) + PSI_DECL(int symlinkat, [(const char *path1, int fd, const char *path2)]) + PSI_DECL(void sync, [(void)]) + PSI_DECL(long sysconf, [(int name)]) + PSI_DECL(pid_t tcgetpgrp, [(int fd)]) + PSI_DECL(int tcsetpgrp, [(int fd, pid_t pgrp)]) + PSI_DECL(int truncate, [(const char *path, off_t length)]) + PSI_DECL(char *ttyname, [(int fd)]) + PSI_DECL(int ttyname_r, [(int fd, char *buf, size_t buflen)]) + PSI_DECL(int unlink, [(const char *path)]) + PSI_DECL(int unlinkat, [(int fd, const char *path, int flag)]) + PSI_DECL(ssize_t write, [(int fildes, const void *buf, size_t nbyte)]) + + +} \ No newline at end of file diff --git a/m4/posix/wchar.m4 b/m4/posix/wchar.m4 new file mode 100644 index 0000000..f1a7026 --- /dev/null +++ b/m4/posix/wchar.m4 @@ -0,0 +1,79 @@ +PSI_CHECK_WCHAR() { + PSI_CONFIG_POSIX(wchar, wchar.h) + + PSI_TYPE(wint_t, int) + PSI_STRUCT(mbstate_t) + + PSI_CONST(WINT_MIN, int) + PSI_CONST(WINT_MAX, int) + PSI_CONST(WEOF, int) + + PSI_DECL(wint_t btowc, [(int c)]) + PSI_DECL(wint_t fgetwc, [(FILE *stream)]) + PSI_DECL(wchar_t *fgetws, [(wchar_t *ws, int n, FILE *stream)]) + PSI_DECL(wint_t fputwc, [(wchar_t c, FILE *stream)]) + PSI_DECL(int fputws, [(const wchar_t *ws, FILE *stream)]) + PSI_DECL(int fwide, [(FILE *stream, int mode)]) + PSI_DECL(int fwprintf, [(FILE *stream, const wchar_t *format)], vararg) + PSI_DECL(int fwscanf, [(FILE *stream, const wchar_t *format)], vararg) + PSI_DECL(wint_t getwc, [(FILE *stream)]) + PSI_DECL(wint_t getwchar, [(void)]) + PSI_DECL(size_t mbrlen, [(const char *s, size_t n, mbstate_t *ps)]) + PSI_DECL(size_t mbrtowc, [(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)]) + PSI_DECL(int mbsinit, [(const mbstate_t *ps)]) + PSI_DECL(size_t mbsnrtowcs, [(wchar_t *dst, const char **src, size_t nms, size_t len, mbstate_t *ps)]) + PSI_DECL(size_t mbsrtowcs, [(wchar_t *dst, const char **src, size_t len, mbstate_t *ps)]) + PSI_DECL(FILE *open_wmemstream, [(wchar_t **ptr, size_t *size)]) + PSI_DECL(wint_t putwc, [(wchar_t wc, FILE *stream)]) + PSI_DECL(wint_t putwchar, [(wchar_t wc)]) + PSI_DECL(int swprintf, [(wchar_t *wcs, size_t maxlen, const wchar_t *format)], vararg) + PSI_DECL(int swscanf, [(const wchar_t *ws, const wchar_t *format)], vararg) + PSI_DECL(wint_t ungetwc, [(wint_t wc, FILE *stream)]) + PSI_DECL(wchar_t *wcpcpy, [(wchar_t *dest, const wchar_t *src)]) + PSI_DECL(wchar_t *wcpncpy, [(wchar_t *dest, const wchar_t *src, size_t n)]) + PSI_DECL(size_t wcrtomb, [(char *s, wchar_t wc, mbstate_t *ps)]) + PSI_DECL(int wcscasecmp, [(const wchar_t *s1, const wchar_t *s2)]) + PSI_DECL(int wcscasecmp_l, [(const wchar_t *s1, const wchar_t *s2, locale_t loc)]) + PSI_DECL(wchar_t *wcscat, [(wchar_t *dest, const wchar_t *src)]) + PSI_DECL(wchar_t *wcschr, [(const wchar_t *wcs, wchar_t wc)]) + PSI_DECL(int wcscmp, [(const wchar_t *s1, const wchar_t *s2)]) + PSI_DECL(int wcscoll, [(const wchar_t *s1, const wchar_t *s2)]) + PSI_DECL(int wcscoll_l, [(const wchar_t *s1, const wchar_t *s2, locale_t loc)]) + PSI_DECL(wchar_t *wcscpy, [(wchar_t *dest, const wchar_t *src)]) + PSI_DECL(size_t wcscspn, [(const wchar_t *wcs, const wchar_t *reject)]) + PSI_DECL(wchar_t *wcsdup, [(const wchar_t *s)]) + PSI_DECL(size_t wcsftime, [(wchar_t *wcs, size_t maxsize, const wchar_t *format, const struct tm *timeptr)]) + PSI_DECL(size_t wcslen, [(const wchar_t *s)]) + PSI_DECL(int wcsncasecmp, [(const wchar_t *s1, const wchar_t *s2, size_t n)]) + PSI_DECL(int wcsncasecmp_l, [(const wchar_t *s1, const wchar_t *s2, size_t n, locale_t loc)]) + PSI_DECL(wchar_t *wcsncat, [(wchar_t *dest, const wchar_t *src, size_t n)]) + PSI_DECL(int wcsncmp, [(const wchar_t *s1, const wchar_t *s2, size_t n)]) + PSI_DECL(wchar_t *wcsncpy, [(wchar_t *dest, const wchar_t *src, size_t n)]) + PSI_DECL(size_t wcsnlen, [(const wchar_t *s, size_t maxlen)]) + PSI_DECL(size_t wcsnrtombs, [(char *dest, const wchar_t **src, size_t nwc, size_t len, mbstate_t *ps)]) + PSI_DECL(wchar_t *wcspbrk, [(const wchar_t *wcs, const wchar_t *accept)]) + PSI_DECL(wchar_t *wcsrchr, [(const wchar_t *wcs, wchar_t wc)]) + PSI_DECL(size_t wcsrtombs, [(char *dest, const wchar_t **src, size_t n, mbstate_t *ps)]) + PSI_DECL(size_t wcsspn, [(const wchar_t *wcs, const wchar_t *accept)]) + PSI_DECL(wchar_t *wcsstr, [(const wchar_t *haystack, const wchar_t *needle)]) + PSI_DECL(double wcstod, [(const wchar_t *nptr, wchar_t **endptr)]) + PSI_DECL(float wcstof, [(const wchar_t *nptr, wchar_t **endptr)]) + PSI_DECL(wchar_t *wcstok, [(wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)]) + PSI_DECL(long wcstol, [(const wchar_t *nptr, wchar_t **endptr, int base)]) + PSI_DECL(long double wcstold, [(const wchar_t *nptr, wchar_t **endptr)]) + PSI_DECL(long long wcstoll, [(const wchar_t *nptr, wchar_t **endptr, int base)]) + PSI_DECL(unsigned long wcstoul, [(const wchar_t *nptr, wchar_t **endptr, int base)]) + PSI_DECL(unsigned long long wcstoull, [(const wchar_t *nptr, wchar_t **endptr, int base)]) + PSI_DECL(int wcswidth, [(const wchar_t *s, size_t n)]) + PSI_DECL(size_t wcsxfrm, [(wchar_t *ws1, const wchar_t *ws2, size_t n)]) + PSI_DECL(size_t wcsxfrm_l, [(wchar_t *ws1, const wchar_t *ws2, size_t n, locale_t loc)]) + PSI_DECL(int wctob, [(wint_t c)]) + PSI_DECL(int wcwidth, [(wchar_t c)]) + PSI_DECL(wchar_t *wmemchr, [(const wchar_t *s, wchar_t c, size_t n)]) + PSI_DECL(int wmemcmp, [(const wchar_t *s1, const wchar_t *s2, size_t n)]) + PSI_DECL(wchar_t *wmemcpy, [(wchar_t *dest, const wchar_t *src, size_t n)]) + PSI_DECL(wchar_t *wmemmove, [(wchar_t *dest, const wchar_t *src, size_t n)]) + PSI_DECL(wchar_t *wmemset, [(wchar_t *wcs, wchar_t wc, size_t n)]) + PSI_DECL(int wprintf, [(const wchar_t *format)], vararg) + PSI_DECL(int wscanf, [(const wchar_t *format)], vararg) +} diff --git a/m4/posix/wctype.m4 b/m4/posix/wctype.m4 new file mode 100644 index 0000000..319dada --- /dev/null +++ b/m4/posix/wctype.m4 @@ -0,0 +1,42 @@ +PSI_CHECK_WCTYPE() { + PSI_CONFIG_POSIX(wctype, wctype.h) + + PSI_TYPE(wctype_t, int) + PSI_TYPE(wctrans_t, int) + + PSI_DECL(int iswalnum, [(wint_t wc)]) + PSI_DECL(int iswalpha, [(wint_t wc)]) + PSI_DECL(int iswcntrl, [(wint_t wc)]) + PSI_DECL(int iswctype, [(wint_t wc, wctype_t class)]) + PSI_DECL(int iswdigit, [(wint_t wc)]) + PSI_DECL(int iswgraph, [(wint_t wc)]) + PSI_DECL(int iswlower, [(wint_t wc)]) + PSI_DECL(int iswprint, [(wint_t wc)]) + PSI_DECL(int iswpunct, [(wint_t wc)]) + PSI_DECL(int iswspace, [(wint_t wc)]) + PSI_DECL(int iswupper, [(wint_t wc)]) + PSI_DECL(int iswxdigit, [(wint_t wc)]) + PSI_DECL(wint_t towlower, [(wint_t wc)]) + PSI_DECL(wint_t towupper, [(wint_t wc)]) + PSI_DECL(wint_t towctrans, [(wint_t wc, wctrans_t desc)]) + PSI_DECL(wctype_t wctype, [(const char *name)]) + PSI_DECL(wctrans_t wctrans, [(const char *class)]) + + PSI_DECL(int iswalnum_l, [(wint_t wc, locale_t loc)]) + PSI_DECL(int iswalpha_l, [(wint_t wc, locale_t loc)]) + PSI_DECL(int iswcntrl_l, [(wint_t wc, locale_t loc)]) + PSI_DECL(int iswctype_l, [(wint_t wc_l, wctype_t class, locale_t loc)]) + PSI_DECL(int iswdigit_l, [(wint_t wc, locale_t loc)]) + PSI_DECL(int iswgraph_l, [(wint_t wc, locale_t loc)]) + PSI_DECL(int iswlower_l, [(wint_t wc, locale_t loc)]) + PSI_DECL(int iswprint_l, [(wint_t wc, locale_t loc)]) + PSI_DECL(int iswpunct_l, [(wint_t wc, locale_t loc)]) + PSI_DECL(int iswspace_l, [(wint_t wc, locale_t loc)]) + PSI_DECL(int iswupper_l, [(wint_t wc, locale_t loc)]) + PSI_DECL(int iswxdigit_l, [(wint_t wc, locale_t loc)]) + PSI_DECL(wint_t towlower_l, [(wint_t wc, locale_t loc)]) + PSI_DECL(wint_t towupper_l, [(wint_t wc, locale_t loc)]) + PSI_DECL(wint_t towctrans_l, [(wint_t wc, wctrans_t desc, locale_t loc)]) + PSI_DECL(wctype_t wctype_l, [(const char *name, locale_t loc)]) + PSI_DECL(wctrans_t wctrans_l, [(const char *class, locale_t loc)]) +} diff --git a/m4/psi.m4 b/m4/psi.m4 deleted file mode 100644 index 8d8797c..0000000 --- a/m4/psi.m4 +++ /dev/null @@ -1,441 +0,0 @@ -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 - -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 -]) - -dnl PSI_CONFIG_DONE() -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(). -AC_DEFUN(PSI_INCLUDES, [AC_INCLUDES_DEFAULT() -#ifdef HAVE_ERRNO_H -# include -#endif -#ifdef HAVE_GLOB_H -# include -#endif -#ifdef HAVE_LOCALE_H -# include -#endif -#ifdef HAVE_XLOCALE_H -# include -#endif -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETINET_TCP_H -# include -#endif -#ifdef HAVE_ARPA_NAMESER_H -# include -#endif -#ifdef HAVE_FCNTL_H -# include -#endif -#ifdef HAVE_NDBM_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_POLL_H -# include -#endif -#ifdef HAVE_RESOLV_H -# include -#endif -#ifdef HAVE_SYS_SELECT_H -# include -#endif -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -#ifdef HAVE_SYS_TIME_H -# include -#endif -#ifdef HAVE_SYS_TIMES_H -# include -#endif -#ifdef HAVE_SYS_UIO_H -# include -#endif -#ifdef HAVE_SYS_UTSNAME_H -# include -#endif -#ifdef HAVE_TIME_H -# include -#endif -#ifdef HAVE_SIGNAL_H -# include -#endif -#ifdef HAVE_SYSLOG_H -# include -#endif -#ifdef HAVE_WCHAR_H -# include -#endif -#ifdef HAVE_WCTYPE_H -# include -#endif -]) - -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) - PHP_SUBST(LEMON) -]) - -dnl PSI_PKG_CONFIG() -dnl Check for `pkg-config` and add possible libjit and libffi directories to -dnl $PKG_CONFIG_PATH, because those libs often ship with headers etc. in -dnl arch-dependent locations. -AC_DEFUN([PSI_PKG_CONFIG], [ - if test -z "$PKG_CONFIG" - then - AC_PATH_PROG(PKG_CONFIG, pkg-config, false) - fi - export PKG_CONFIG_PATH="$PHP_PSI_LIBFFI/lib/pkgconfig:$PHP_PSI_LIBJIT/lib/pkgconfig:$PKG_CONFIG_PATH" -]) - -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. -AC_DEFUN(PSI_CHECK_SIZEOF, [ - AC_CHECK_SIZEOF($1, [], PSI_INCLUDES - $2) - 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_ 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. -dnl AC_DEFINEs OFFSETOF__. -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`\\\" - ]) -]) - -dnl PSI_CHECK_LIBJIT() -dnl Check for libjit in $PHP_PSI_LIBJIT or standard locations -dnl AC_DEFINEs HAVE_LIBJIT. -AC_DEFUN(PSI_CHECK_LIBJIT, [ - AC_CACHE_CHECK(for libjit, psi_cv_libjit_dir, [ - for psi_cv_libjit_dir in $PHP_PSI_LIBJIT {/usr{,/local},/opt}{,/libjit} - do - if test -e $psi_cv_libjit_dir/include/jit/jit.h - then - break - fi - psi_cv_libjit_dir= - done - ]) - if test -n "$psi_cv_libjit_dir" - then - PHP_ADD_INCLUDE($psi_cv_libjit_dir/include) - PHP_ADD_LIBRARY_WITH_PATH(jit, $psi_cv_libjit_dir/$PHP_LIBDIR, PSI_SHARED_LIBADD) - AC_DEFINE(HAVE_LIBJIT, 1, Have libjit) - else - AC_MSG_WARN([Could not find libjit, please provide the base install path]) - fi -]) - -dnl PSI_CHECK_LIBFFI() -dnl Check for libffi with `pkg-config`. If that fails, `configure` looks into -dnl $PHP_PSI_LIBFFI or standard locations to find libjit deps. -dnl Checks for availability of recent closure API: -dnl \ffi_closure_alloc and \ffi_prep_closure. -dnl Checks for availability of recent vararg API: -dnl \ffi_prep_cif_var. -dnl AC_DEFINEs HAVE_LIBFFI, PSI_HAVE_FFI_CLOSURE_ALLOC, -dnl PSI_HAVE_FFI_PREP_CLOSURE and PSI_HAVE_FFO_PREP_VIF_VAR. -AC_DEFUN(PSI_CHECK_LIBFFI, [ - AC_REQUIRE([PSI_PKG_CONFIG])dnl - - AC_CACHE_CHECK(for libffi through pkg-config, psi_cv_libffi, [ - if $PKG_CONFIG --exists libffi - then - psi_cv_libffi=true - else - psi_cv_libffi=false - fi]) - - if $psi_cv_libffi - then - AC_MSG_CHECKING(for libffi) - psi_cv_libffi_dir=`$PKG_CONFIG --variable=prefix libffi` - AC_MSG_RESULT($psi_cv_libffi_dir) - PHP_EVAL_INCLINE(`$PKG_CONFIG --cflags libffi`) - PHP_EVAL_LIBLINE(`$PKG_CONFIG --libs libffi`, PSI_SHARED_LIBADD) - AC_DEFINE(HAVE_LIBFFI, 1, Have libffi) - else - AC_CACHE_CHECK(for libffi, psi_cv_libffi_dir, [ - for psi_cv_libffi_dir in $PHP_PSI_LIBFFI {/usr{,/local},/opt}{,/libffi} - do - if test -e $psi_cv_libffi_dir/include/ffi/ffi.h - then - break - fi - psi_cv_libffi_dir= - done]) - if test -n "$psi_cv_libffi_dir" - then - PHP_ADD_INCLUDE($psi_cv_libffi_dir/include/ffi) - PHP_ADD_LIBRARY_WITH_PATH(ffi, $psi_cv_libffi_dir/$PHP_LIBDIR, PSI_SHARED_LIBADD) - AC_DEFINE(HAVE_LIBFFI, 1, Have libffi) - else - AC_MSG_WARN([Could not find libffi, please provide the base install path]) - fi - fi - PHP_CHECK_LIBRARY(ffi, ffi_closure_alloc, [ - PHP_CHECK_LIBRARY(ffi, ffi_prep_closure_loc, [ - AC_DEFINE(PSI_HAVE_FFI_PREP_CLOSURE_LOC, 1, [ ]) - ], [], -L$psi_cv_libffi_dir/$PHP_LIBDIR) - AC_DEFINE(PSI_HAVE_FFI_CLOSURE_ALLOC, 1, [ ]) - ], [ - PHP_CHECK_LIBRARY(ffi, ffi_prep_closure, [ - AC_CHECK_HEADERS(sys/mman.h) - PHP_CHECK_FUNC(mmap) - AC_DEFINE(PSI_HAVE_FFI_PREP_CLOSURE, 1, [ ]) - ], [ - ], -L$psi_cv_libffi_dir/$PHP_LIBDIR) - ], -L$psi_cv_libffi_dir/$PHP_LIBDIR) - PHP_CHECK_LIBRARY(ffi, ffi_prep_cif_var, [ - AC_DEFINE(PSI_HAVE_FFI_PREP_CIF_VAR, 1, [ ]) - ], [ - ], -L$psi_cv_libffi_dir/$PHP_LIBDIR) -]) diff --git a/m4/psi/psi.m4 b/m4/psi/psi.m4 new file mode 100644 index 0000000..2a1e681 --- /dev/null +++ b/m4/psi/psi.m4 @@ -0,0 +1,443 @@ +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 +]) + +dnl PSI_CONFIG_DONE() +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(). +AC_DEFUN(PSI_INCLUDES, [AC_INCLUDES_DEFAULT() +#ifdef HAVE_ERRNO_H +# include +#endif +#ifdef HAVE_GLOB_H +# include +#endif +#ifdef HAVE_LOCALE_H +# include +#endif +#ifdef HAVE_XLOCALE_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETINET_TCP_H +# include +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include +#endif +#ifdef HAVE_FCNTL_H +# include +#endif +#ifdef HAVE_NDBM_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_POLL_H +# include +#endif +#ifdef HAVE_RESOLV_H +# include +#endif +#ifdef HAVE_SYS_SELECT_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_SYS_TIME_H +# include +#endif +#ifdef HAVE_SYS_TIMES_H +# include +#endif +#ifdef HAVE_SYS_UIO_H +# include +#endif +#ifdef HAVE_SYS_UTSNAME_H +# include +#endif +#ifdef HAVE_TIME_H +# include +#endif +#ifdef HAVE_SIGNAL_H +# include +#endif +#ifdef HAVE_SYSLOG_H +# include +#endif +#ifdef HAVE_WCHAR_H +# include +#endif +#ifdef HAVE_WCTYPE_H +# include +#endif +]) + +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) + PHP_SUBST(LEMON) +]) + +dnl PSI_PKG_CONFIG() +dnl Check for `pkg-config` and add possible libjit and libffi directories to +dnl $PKG_CONFIG_PATH, because those libs often ship with headers etc. in +dnl arch-dependent locations. +AC_DEFUN([PSI_PKG_CONFIG], [ + if test -z "$PKG_CONFIG" + then + AC_PATH_PROG(PKG_CONFIG, pkg-config, false) + fi + export PKG_CONFIG_PATH="$PHP_PSI_LIBFFI/lib/pkgconfig:$PHP_PSI_LIBJIT/lib/pkgconfig:$PKG_CONFIG_PATH" +]) + +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. +AC_DEFUN(PSI_CHECK_SIZEOF, [ + AC_CHECK_SIZEOF($1, [], PSI_INCLUDES + $2) + 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_ 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. +dnl AC_DEFINEs OFFSETOF__. +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`\\\" + ]) +]) + +dnl PSI_CHECK_LIBJIT() +dnl Check for libjit in $PHP_PSI_LIBJIT or standard locations +dnl AC_DEFINEs HAVE_LIBJIT. +AC_DEFUN(PSI_CHECK_LIBJIT, [ + AC_CACHE_CHECK(for libjit, psi_cv_libjit_dir, [ + for psi_cv_libjit_dir in $PHP_PSI_LIBJIT {/usr{,/local},/opt}{,/libjit} + do + if test -e $psi_cv_libjit_dir/include/jit/jit.h + then + break + fi + psi_cv_libjit_dir= + done + ]) + if test -n "$psi_cv_libjit_dir" + then + PHP_ADD_INCLUDE($psi_cv_libjit_dir/include) + PHP_ADD_LIBRARY_WITH_PATH(jit, $psi_cv_libjit_dir/$PHP_LIBDIR, PSI_SHARED_LIBADD) + AC_DEFINE(HAVE_LIBJIT, 1, Have libjit) + else + AC_MSG_WARN([Could not find libjit, please provide the base install path]) + fi +]) + +dnl PSI_CHECK_LIBFFI() +dnl Check for libffi with `pkg-config`. If that fails, `configure` looks into +dnl $PHP_PSI_LIBFFI or standard locations to find libjit deps. +dnl Checks for availability of recent closure API: +dnl \ffi_closure_alloc and \ffi_prep_closure. +dnl Checks for availability of recent vararg API: +dnl \ffi_prep_cif_var. +dnl AC_DEFINEs HAVE_LIBFFI, PSI_HAVE_FFI_CLOSURE_ALLOC, +dnl PSI_HAVE_FFI_PREP_CLOSURE and PSI_HAVE_FFO_PREP_VIF_VAR. +AC_DEFUN(PSI_CHECK_LIBFFI, [ + AC_REQUIRE([PSI_PKG_CONFIG])dnl + + AC_CACHE_CHECK(for libffi through pkg-config, psi_cv_libffi, [ + if $PKG_CONFIG --exists libffi + then + psi_cv_libffi=true + else + psi_cv_libffi=false + fi]) + + if $psi_cv_libffi + then + AC_MSG_CHECKING(for libffi) + psi_cv_libffi_dir=`$PKG_CONFIG --variable=prefix libffi` + AC_MSG_RESULT($psi_cv_libffi_dir) + PHP_EVAL_INCLINE(`$PKG_CONFIG --cflags libffi`) + PHP_EVAL_LIBLINE(`$PKG_CONFIG --libs libffi`, PSI_SHARED_LIBADD) + AC_DEFINE(HAVE_LIBFFI, 1, Have libffi) + else + AC_CACHE_CHECK(for libffi, psi_cv_libffi_dir, [ + for psi_cv_libffi_dir in $PHP_PSI_LIBFFI {/usr{,/local},/opt}{,/libffi} + do + if test -e $psi_cv_libffi_dir/include/ffi/ffi.h + then + break + fi + psi_cv_libffi_dir= + done]) + if test -n "$psi_cv_libffi_dir" + then + PHP_ADD_INCLUDE($psi_cv_libffi_dir/include/ffi) + PHP_ADD_LIBRARY_WITH_PATH(ffi, $psi_cv_libffi_dir/$PHP_LIBDIR, PSI_SHARED_LIBADD) + AC_DEFINE(HAVE_LIBFFI, 1, Have libffi) + else + AC_MSG_WARN([Could not find libffi, please provide the base install path]) + fi + fi + PHP_CHECK_LIBRARY(ffi, ffi_closure_alloc, [ + PHP_CHECK_LIBRARY(ffi, ffi_prep_closure_loc, [ + AC_DEFINE(PSI_HAVE_FFI_PREP_CLOSURE_LOC, 1, [ ]) + ], [], -L$psi_cv_libffi_dir/$PHP_LIBDIR) + AC_DEFINE(PSI_HAVE_FFI_CLOSURE_ALLOC, 1, [ ]) + ], [ + PHP_CHECK_LIBRARY(ffi, ffi_prep_closure, [ + AC_CHECK_HEADERS(sys/mman.h) + PHP_CHECK_FUNC(mmap) + AC_DEFINE(PSI_HAVE_FFI_PREP_CLOSURE, 1, [ ]) + ], [ + ], -L$psi_cv_libffi_dir/$PHP_LIBDIR) + ], -L$psi_cv_libffi_dir/$PHP_LIBDIR) + PHP_CHECK_LIBRARY(ffi, ffi_prep_cif_var, [ + AC_DEFINE(PSI_HAVE_FFI_PREP_CIF_VAR, 1, [ ]) + ], [ + ], -L$psi_cv_libffi_dir/$PHP_LIBDIR) +]) diff --git a/m4/psi/psi_const.m4 b/m4/psi/psi_const.m4 new file mode 100644 index 0000000..6c3cf6b --- /dev/null +++ b/m4/psi/psi_const.m4 @@ -0,0 +1,51 @@ +# psi_add_str_const(name, value) +# Add a pre-defined string constant to $PSI_CONSTS +psi_add_str_const() { + grep -q "\"psi\\\\\\\\$1\"" $PSI_CONSTS \ + || cat >>$PSI_CONSTS <>$PSI_CONSTS <>$PSI_REDIRS <>$PSI_FN_DECLS <>$PSI_VA_DECLS <>$PSI_DECLS <@@:>@+U / {print$[]3; exit}'` + ]) + psi_cv_libc_main=$psi_libc_main + ]) +]) + +dnl PSI_DECL_ARGS(decl args) +dnl INTERNAL: build psi_decl_args +AC_DEFUN(PSI_DECL_ARGS, [ + psi_decl_args= + PSI_DECL_ARG($1) + m4_case([$2], + [(void)], [], + [()], [], + [m4_map_args_sep([PSI_DECL_ARG(m4_normalize(], [))], [], m4_bregexp([$2], [(\(.*\))], [\1]))]) +]) + +dnl PSI_DECL_ARG(decl arg) +dnl INTERNAL: build psi_decl_args +AC_DEFUN(PSI_DECL_ARG, [ + m4_define([member_name], PSI_VAR_NAME($1)) + m4_define([member_type], PSI_VAR_TYPE($1)) + + PSI_TYPE_INDIRECTION([$1],, pl, as) + if test -n "$psi_decl_args"; then + psi_decl_args="$psi_decl_args, " + fi + psi_decl_args="[$psi_decl_args{]PSI_TYPE_PAIR(member_type)[, \"]member_name[\",] $pl, $as[}]" +]) + +dnl PSI_DECL(type func, args, flags) +dnl Check for a function or macro declaration and a possible asm redirection. +dnl Adds a pre-defined (vararg) decl to $PSI_VA_DECLS/$PSI_DECLS. +dnl Calls PSI_MACRO if PSI_FUNC fails. +AC_DEFUN(PSI_DECL, [ + AC_REQUIRE([PSI_FUNC_LIBC_MAIN]) + PSI_DECL_ARGS($1, $2) + + psi_symbol="PSI_VAR_NAME($1)" + AC_CACHE_CHECK(for PSI_VAR_NAME($1), [psi_cv_fn_]PSI_VAR_NAME($1), [ + psi_symbol_redirect= + AC_TRY_LINK(PSI_INCLUDES, [ + void (*fn)(void) = (void (*)(void)) $psi_symbol; (*fn)() + ], [ + psi_symbol_redirect=`nm -g conftest$ac_exeext | $AWK -F ' *|@' '/^@<:@@<:@:space:@:>@@:>@+U '$psi_cv_libc_main'/ {next} /^@<:@@<:@:space:@:>@@:>@+U / {print$[]3; exit}'` + ]) + [psi_cv_fn_]PSI_VAR_NAME($1)=$psi_symbol_redirect + ]) + case "$[psi_cv_fn_]PSI_VAR_NAME($1)" in + "$psi_symbol"|"_$psi_symbol") + case "$PHP_DEBUG-$3" in + "1-") + PSI_MACRO($1, $2, [ + psi_add_decl "$psi_decl_args" + ]) + ;; + *) + psi_add_decl "$psi_decl_args" $3 + ;; + esac + ;; + "") + ifelse([$3], vararg, [ + AC_MSG_ERROR(varargs macro support is not implemented) + ],[ + PSI_MACRO($1, $2, [ + psi_add_decl "$psi_decl_args" + ]) + ]) + ;; + *) + PSI_REDIR($psi_symbol) + psi_add_decl "$psi_decl_args" $3 + ;; + esac +]) diff --git a/m4/psi/psi_macro.m4 b/m4/psi/psi_macro.m4 new file mode 100644 index 0000000..b3ee988 --- /dev/null +++ b/m4/psi/psi_macro.m4 @@ -0,0 +1,44 @@ +# psi_add_macro(macro) +# Add a pre-defined macro function to $PSI_MACROS. +psi_add_macro() { + cat >>$PSI_MACROS <>$PSI_STRUCTS <>$PSI_UNIONS <member_name + ) + if PSI_SH_TEST_SIZEOF($1 member_name); then + PSI_CHECK_OFFSETOF($1, member_name) + PSI_TYPE_INDIRECTION($2, [PSI_SH_SIZEOF([$1 member_name])], pl, as) + + psi_member_sizeof=PSI_SH_SIZEOF($1 member_name) + psi_member_offsetof=PSI_SH_OFFSETOF($1 member_name) + + if test $pl -gt 0 && test $as -eq 0; then + check_size=PSI_SH_SIZEOF(void *) + elif test $pl -eq 1 && test $as -gt 0; then + check_size=`expr PSI_SH_SIZEOF(member_type) \* $as` + else + check_size=PSI_SH_SIZEOF(member_type) + fi + if test $psi_member_sizeof != "$check_size"; then + psi_member_basic_type=PSI_SH_BASIC_TYPE(member_type) + psi_member_type_pair="`psi_type_pair $psi_member_basic_type $psi_member_sizeof`" + psi_struct_members="$psi_struct_members, {$psi_member_type_pair, \"[]member_name[]\", $psi_member_offsetof, $psi_member_sizeof, $pl, $as}" + AC_MSG_WARN(pre-defined size $check_size of $2 in $1 does not match computed size $psi_member_sizeof; adjusting to $psi_member_type_pair) + else + psi_struct_members="[$psi_struct_members, {]PSI_TYPE_PAIR(member_type)[, \"]member_name[\", $psi_member_offsetof, $psi_member_sizeof, $pl, $as}]" + fi + fi +]) + +dnl PSI_STRUCT(struct name, struct members) +dnl Check a struct and its members and add a pre-defined struct and possibly a +dnl pre-defined type for this struct. +dnl Calls PSI_CHECK_SIZEOF and PSI_CHECK_ALIGNOF for the struct. +dnl Calls PSI_CHECK_SIZEOF, PSI_CHECK_OFFSETOF and PSI_TYPE_INDIRECTON for each member. +AC_DEFUN(PSI_STRUCT, [ + PSI_CHECK_SIZEOF($1) + if PSI_SH_TEST_SIZEOF($1); then + PSI_CHECK_ALIGNOF($1) + psi_struct_name=m4_bregexp([$1], [^\(struct \)?\(\w+\)], [\2]) + psi_struct_members="{PSI_T_STRUCT, \"struct\", \"$psi_struct_name\", PSI_SH_ALIGNOF($1), PSI_SH_SIZEOF($1), 0, 0}" + ifelse([$2],,,[m4_map_args_sep([PSI_STRUCT_MEMBER($1, m4_normalize(], [))], [], $2)]) + psi_add_struct "$psi_struct_members" + if test "$1" = "$psi_struct_name"; then + psi_add_type "{PSI_T_STRUCT, \"$1\", \"$1\"}" + fi + fi +]) + +dnl PSI_UNION(union name, union/struct members) +dnl Check a union and its members and add a pre-defined union and possibly a +dnl pre-defined type for this union. +dnl Calls PSI_CHECK_SIZEOF for the union and each member. +dnl Calls PSI_CHECK_OFFSETOF and PSI_TYPE_INDIRECTON for each member. +AC_DEFUN(PSI_UNION, [ + PSI_CHECK_SIZEOF($1) + if PSI_SH_TEST_SIZEOF($1); then + PSI_CHECK_ALIGNOF($1) + psi_struct_name=m4_bregexp([$1], [^\(union \)?\(\w+\)], [\2]) + psi_struct_members="{PSI_T_UNION, \"union\", \"$psi_struct_name\", PSI_SH_ALIGNOF($1), PSI_SH_SIZEOF($1), 0, 0}" + ifelse([$2],,,[m4_map_args_sep([PSI_STRUCT_MEMBER($1, m4_normalize(], [))], [], $2)]) + psi_add_union "$psi_struct_members" + if test "$1" = "$psi_struct_name"; then + psi_add_type "{PSI_T_UNION, \"$1\", \"$1\"}" + fi + fi +]) diff --git a/m4/psi/psi_type.m4 b/m4/psi/psi_type.m4 new file mode 100644 index 0000000..826ae7e --- /dev/null +++ b/m4/psi/psi_type.m4 @@ -0,0 +1,260 @@ +# psi_add_type(type triplet) +# Add a pre-defined type to $PSI_TYPES. +psi_add_type() { + cat >>$PSI_TYPES <>$PSI_STDTYPES <, \"\" tuple. +# Uses stdint types when possible. +psi_type_pair() { + local psi_type_name=`printf "%s" "$1" | tr -cd A-Za-z0-9_` + local psi_type_lower=`printf "%s" "$1" | tr A-Z a-z` + case $psi_type_lower in + int*|uint*) + local psi_type_upper=`printf "%s" "$psi_type_name" | tr a-z A-Z` + local psi_type_bits=`expr $2 \* 8` + echo "PSI_T_${psi_type_upper}${psi_type_bits}, \"${psi_type_lower}${psi_type_bits}_t\"" + ;; + struct*) + echo "PSI_T_STRUCT, \"$2\"" + ;; + union*) + echo "PSI_T_UNION, \"$2\"" + ;; + void) + echo "PSI_T_VOID, \"void\"" + ;; + *) + echo "PSI_T_NAME, \"$psi_type_name\"" + ;; + esac +} + +dnl PSI_TYPE(type name, basic type) +dnl Check for a specific type, optionally referring to a basic type. +dnl Calls AC_TYPE_ (if defined) and PSI_CHECK_SIZEOF. +dnl If the basic type is just specified as "int" (in contrast to "sint" or +dnl "uint"), AX_CHECK_SIGN is used to discover signedness of the type. +dnl Defines a pre-defined type in $PSI_TYPES. +AC_DEFUN(PSI_TYPE, [ + ifdef(AS_TR_CPP(AC_TYPE_$1), AS_TR_CPP(AC_TYPE_$1)) + PSI_CHECK_SIZEOF($1) + psi_basic_type=AS_TR_SH($2) + case $psi_basic_type in + int) + AX_CHECK_SIGN($1, :, [psi_basic_type=uint], PSI_INCLUDES) + ;; + sint) + psi_basic_type=int + ;; + esac + if test "$2" && PSI_SH_TEST_SIZEOF($1); then + AS_TR_SH(psi_basic_type_$1)=$psi_basic_type + psi_add_type "{`psi_type_pair $psi_basic_type PSI_SH_SIZEOF($1)`, \"$1\"}" + fi +]) + +AC_DEFUN(PSI_STDTYPE, [ + ifdef(AS_TR_CPP(AC_TYPE_$1), AS_TR_CPP(AC_TYPE_$1)) + PSI_CHECK_SIZEOF($1) + if PSI_SH_TEST_SIZEOF($1); then + m4_case([$1], + [float],[psi_add_stdtype "{PSI_T_FLOAT, \"float\", NULL}"], + [double],[psi_add_stdtype "{PSI_T_DOUBLE, \"double\", NULL}"], + [long double],[psi_add_stdtype "{PSI_T_LONG_DOUBLE, \"long double\", NULL}"], + [ + AX_CHECK_SIGN($1, psi_basic_type=int, psi_basic_type=uint, PSI_INCLUDES) + AS_TR_SH(psi_basic_type_$1)=$psi_basic_type + psi_add_stdtype "{`psi_type_pair $psi_basic_type PSI_SH_SIZEOF($1)`, \"$1\"}" + ]) + fi +]) + +dnl PSI_SH_BASIC_TYPE(type) +dnl Expand to the basic type (int/uint) of a distinct type +AC_DEFUN(PSI_SH_BASIC_TYPE, [$AS_TR_SH([psi_basic_type_]$1)]) + +dnl PSI_OPAQUE_TYPE(type name) +dnl Checks a type for being a scalar, a struct or a pointer type. +dnl Calls AC_TYPE_ (if defined) and PSI_CHECK_SIZEOF. +dnl Defines a pre-defined type in $PSI_TYPES and a pre-defined struct in +dnl $PSI_STRUCTS if the type is a struct. +AC_DEFUN(PSI_OPAQUE_TYPE, [ + ifdef(AS_TR_CPP(AC_TYPE_$1), AS_TR_CPP(AC_TYPE_$1)) + PSI_CHECK_SIZEOF($1) + if PSI_SH_TEST_SIZEOF($1); then + psi_type_class= + AC_CACHE_CHECK(kind of $1, AS_TR_SH([psi_cv_type_class_]$1), [ + AC_TRY_COMPILE(PSI_INCLUDES, [char test@<:@($1)1@:>@;], [ + psi_type_class=scalar + ], [ + AC_TRY_COMPILE(PSI_INCLUDES, [$1 test = 0;], [ + AC_TRY_COMPILE(PSI_INCLUDES, [$1 test = (($1)0)+1;], [ + psi_type_class="pointer of known type" + ], [ + psi_type_class="pointer of opaque type" + ]) + ], [ + psi_type_class=struct + ]) + ]) + AS_TR_SH([psi_cv_type_class_]$1)="$psi_type_class" + ]) + case "$AS_TR_SH([psi_cv_type_class_]$1)" in + scalar) + AX_CHECK_SIGN($1, [psi_basic_type=int], [psi_basic_type=uint], PSI_INCLUDES) + psi_add_type "{`psi_type_pair $psi_basic_type PSI_SH_SIZEOF($1)`, \"$1\"}" + ;; + struct) + PSI_STRUCT($1) + ;; + pointer*) + psi_add_type "{PSI_T_POINTER, \"void\", \"$1\"}" + ;; + *) + AC_MSG_WARN(could not detect kind of $1) + ;; + esac + fi +]) + +dnl PSI_FUNCTOR_TYPE(type functor_name, args) +dnl Forwards to PSI_DECL_TYPE. +AC_DEFUN(PSI_FUNCTOR_TYPE, [ + dnl psi_add_type "{PSI_T_POINTER, \"void\", \"PSI_VAR_NAME($1)\"}" + AS_TR_SH([ac_cv_sizeof_]PSI_VAR_NAME($1))=PSI_SH_SIZEOF(void *) + PSI_DECL_TYPE([$1], [$2]) + if test "$PHP_DEBUG" = "1"; then + AC_CHECK_TYPE(PSI_VAR_NAME($1), [], [ + psi_add_macro ["#undef ]PSI_VAR_NAME($1)["] + psi_add_macro ["typedef ]PSI_VAR_TYPE($1)[ (*]PSI_VAR_NAME($1)[)]$2;" + ]) + fi +]) + +dnl PSI_VAR_TYPE(decl arg) +dnl Extracts the type of a decl arg, e.g. dnl unsigned char* buf[16] -> unsigned char*. +AC_DEFUN(PSI_VAR_TYPE, [m4_bregexp([$1], [^\(const \)?\(.*\) \([*]*\)[^ ]+$], [\2\3])]) + +dnl PSI_VAR_NAME(decl arg) +dnl Extracts the var name of a decl arg, e.g. unsigned char* buf[16] -> buf. +AC_DEFUN(PSI_VAR_NAME, [m4_bregexp(m4_bregexp([$1], [\([^ ]+\)$], [\1]), [\w+], [\&])]) + +dnl PSI_TYPE_INDIRECTION(decl arg, size, pointer_level_var, array_size_var) +dnl Calculates and assigns pointer_level and array_size of a decl arg to sh vars. +AC_DEFUN(PSI_TYPE_INDIRECTION, [ + m4_define([psi_pointer_level], m4_len(m4_bpatsubst([PSI_VAR_TYPE($1)], [[^*]]))) + m4_define([psi_array_size], [m4_bregexp([PSI_VAR_TYPE($1)], [@<:@\([0-9]+\)@:>@], [\1])]) + + ifelse(psi_array_size.$2,0., [ + AC_MSG_ERROR([cannot compute dynamic array size of a non-struct member]) + ], [ + ifelse(psi_pointer_level,0,[ + m4_define([psi_type_size],[$]AS_TR_SH([ac_cv_sizeof_]m4_bregexp(PSI_VAR_TYPE([$1]), [^\( \|\w\)+], [\&]))) + ],[ + m4_define([psi_type_size],$ac_cv_sizeof_void_p) + ]) + ]) + + m4_case(psi_array_size,,[ + $3=psi_pointer_level + $4=0] + ,0,[ + $3=m4_incr(psi_pointer_level) + $4="`expr $2 / psi_type_size`" + ], [ + $3=m4_incr(psi_pointer_level) + $4=psi_array_size + ]) +]) + +dnl PSI_TYPE_PAIR(type) +dnl Expand to a PSI_T_, \\"\\" tuple. +dnl FIXME: There is also psi_type_pair()? +AC_DEFUN(PSI_TYPE_PAIR, [m4_case(m4_bregexp([$1], [^\w+], [\&]), + [void], [PSI_T_VOID, \"void\"], + [struct], [PSI_T_STRUCT, \"m4_bregexp([$1], [^struct \(\w+\)], [\1])\"], + [union], [PSI_T_UNION, \"m4_bregexp([$1], [^union \(\w+\)], [\1])\"], + [PSI_T_NAME, \"m4_bregexp([$1], [^\(\w+ \)*\w+], [\&])\"])]) + +dnl PSI_CHECK_STD_TYPES() +dnl Checks for standard ANSI-C and stdint types. +AC_DEFUN(PSI_CHECK_STD_TYPES, [ + AC_CHECK_HEADERS(stdint.h) + + AC_TYPE_INT8_T + PSI_CHECK_SIZEOF(int8_t) + AC_CHECK_ALIGNOF(int8_t) + AC_TYPE_UINT8_T + PSI_CHECK_SIZEOF(uint8_t) + AC_CHECK_ALIGNOF(uint8_t) + AC_TYPE_INT16_T + PSI_CHECK_SIZEOF(int16_t) + AC_CHECK_ALIGNOF(int16_t) + AC_TYPE_UINT16_T + PSI_CHECK_SIZEOF(uint16_t) + AC_CHECK_ALIGNOF(uint16_t) + AC_TYPE_INT32_T + PSI_CHECK_SIZEOF(int32_t) + AC_CHECK_ALIGNOF(int32_t) + AC_TYPE_UINT32_T + PSI_CHECK_SIZEOF(uint32_t) + AC_CHECK_ALIGNOF(uint32_t) + AC_TYPE_INT64_T + PSI_CHECK_SIZEOF(int64_t) + AC_CHECK_ALIGNOF(int64_t) + AC_TYPE_UINT64_T + PSI_CHECK_SIZEOF(uint64_t) + AC_CHECK_ALIGNOF(uint64_t) + + PSI_CHECK_SIZEOF(void *) + AC_CHECK_ALIGNOF(void *) + + PSI_STDTYPE(float) + AC_CHECK_ALIGNOF(float) + PSI_STDTYPE(double) + AC_CHECK_ALIGNOF(double) + PSI_STDTYPE(long double) + AC_CHECK_ALIGNOF(long double) + + PSI_STDTYPE(char, int) + AC_CHECK_ALIGNOF(char) + PSI_STDTYPE(signed char, int) + PSI_STDTYPE(unsigned char, uint) + PSI_STDTYPE(short, int) + AC_CHECK_ALIGNOF(short) + PSI_STDTYPE(short int, int) + PSI_STDTYPE(signed short, int) + PSI_STDTYPE(signed short int, int) + PSI_STDTYPE(unsigned short, uint) + PSI_STDTYPE(unsigned short int, uint) + PSI_STDTYPE(int, int) + AC_CHECK_ALIGNOF(int) + PSI_STDTYPE(signed int, int) + PSI_STDTYPE(signed, int) + PSI_STDTYPE(unsigned int, uint) + PSI_STDTYPE(unsigned, uint) + PSI_STDTYPE(long, int) + AC_CHECK_ALIGNOF(long) + PSI_STDTYPE(long int, int) + PSI_STDTYPE(signed long int, int) + PSI_STDTYPE(unsigned long, uint) + PSI_STDTYPE(unsigned long int, uint) + PSI_STDTYPE(long long, int) + AC_CHECK_ALIGNOF(long long) + PSI_STDTYPE(signed long long, int) + PSI_STDTYPE(signed long long int, int) + PSI_STDTYPE(unsigned long long, uint) + PSI_STDTYPE(unsigned long long int, uint) + dnl this must come after the check fo "unsigned long long int"; autoconf, wth? + PSI_STDTYPE(long long int, int) +]) diff --git a/m4/psi_const.m4 b/m4/psi_const.m4 deleted file mode 100644 index 6c3cf6b..0000000 --- a/m4/psi_const.m4 +++ /dev/null @@ -1,51 +0,0 @@ -# psi_add_str_const(name, value) -# Add a pre-defined string constant to $PSI_CONSTS -psi_add_str_const() { - grep -q "\"psi\\\\\\\\$1\"" $PSI_CONSTS \ - || cat >>$PSI_CONSTS <>$PSI_CONSTS <>$PSI_REDIRS <>$PSI_FN_DECLS <>$PSI_VA_DECLS <>$PSI_DECLS <@@:>@+U / {print$[]3; exit}'` - ]) - psi_cv_libc_main=$psi_libc_main - ]) -]) - -dnl PSI_DECL_ARGS(decl args) -dnl INTERNAL: build psi_decl_args -AC_DEFUN(PSI_DECL_ARGS, [ - psi_decl_args= - PSI_DECL_ARG($1) - m4_case([$2], - [(void)], [], - [()], [], - [m4_map_args_sep([PSI_DECL_ARG(m4_normalize(], [))], [], m4_bregexp([$2], [(\(.*\))], [\1]))]) -]) - -dnl PSI_DECL_ARG(decl arg) -dnl INTERNAL: build psi_decl_args -AC_DEFUN(PSI_DECL_ARG, [ - m4_define([member_name], PSI_VAR_NAME($1)) - m4_define([member_type], PSI_VAR_TYPE($1)) - - PSI_TYPE_INDIRECTION([$1],, pl, as) - if test -n "$psi_decl_args"; then - psi_decl_args="$psi_decl_args, " - fi - psi_decl_args="[$psi_decl_args{]PSI_TYPE_PAIR(member_type)[, \"]member_name[\",] $pl, $as[}]" -]) - -dnl PSI_DECL(type func, args, flags) -dnl Check for a function or macro declaration and a possible asm redirection. -dnl Adds a pre-defined (vararg) decl to $PSI_VA_DECLS/$PSI_DECLS. -dnl Calls PSI_MACRO if PSI_FUNC fails. -AC_DEFUN(PSI_DECL, [ - AC_REQUIRE([PSI_FUNC_LIBC_MAIN]) - PSI_DECL_ARGS($1, $2) - - psi_symbol="PSI_VAR_NAME($1)" - AC_CACHE_CHECK(for PSI_VAR_NAME($1), [psi_cv_fn_]PSI_VAR_NAME($1), [ - psi_symbol_redirect= - AC_TRY_LINK(PSI_INCLUDES, [ - void (*fn)(void) = (void (*)(void)) $psi_symbol; (*fn)() - ], [ - psi_symbol_redirect=`nm -g conftest$ac_exeext | $AWK -F ' *|@' '/^@<:@@<:@:space:@:>@@:>@+U '$psi_cv_libc_main'/ {next} /^@<:@@<:@:space:@:>@@:>@+U / {print$[]3; exit}'` - ]) - [psi_cv_fn_]PSI_VAR_NAME($1)=$psi_symbol_redirect - ]) - case "$[psi_cv_fn_]PSI_VAR_NAME($1)" in - "$psi_symbol"|"_$psi_symbol") - psi_add_decl "$psi_decl_args" $3 - ;; - "") - ifelse([$3], vararg, [ - AC_MSG_ERROR(varargs macro support is not implemented) - ],[ - PSI_MACRO($1, $2, [ - psi_add_decl "$psi_decl_args" - ]) - ]) - ;; - *) - PSI_REDIR($psi_symbol) - psi_add_decl "$psi_decl_args" $3 - ;; - esac -]) diff --git a/m4/psi_macro.m4 b/m4/psi_macro.m4 deleted file mode 100644 index b3ee988..0000000 --- a/m4/psi_macro.m4 +++ /dev/null @@ -1,44 +0,0 @@ -# psi_add_macro(macro) -# Add a pre-defined macro function to $PSI_MACROS. -psi_add_macro() { - cat >>$PSI_MACROS <>$PSI_STRUCTS <>$PSI_UNIONS <member_name - ) - if PSI_SH_TEST_SIZEOF($1 member_name); then - PSI_CHECK_OFFSETOF($1, member_name) - PSI_TYPE_INDIRECTION($2, [PSI_SH_SIZEOF([$1 member_name])], pl, as) - - psi_member_sizeof=PSI_SH_SIZEOF($1 member_name) - psi_member_offsetof=PSI_SH_OFFSETOF($1 member_name) - - if test $pl -gt 0 && test $as -eq 0; then - check_size=PSI_SH_SIZEOF(void *) - elif test $pl -eq 1 && test $as -gt 0; then - check_size=`expr PSI_SH_SIZEOF(member_type) \* $as` - else - check_size=PSI_SH_SIZEOF(member_type) - fi - if test $psi_member_sizeof != "$check_size"; then - psi_member_basic_type=PSI_SH_BASIC_TYPE(member_type) - psi_member_type_pair="`psi_type_pair $psi_member_basic_type $psi_member_sizeof`" - psi_struct_members="$psi_struct_members, {$psi_member_type_pair, \"[]member_name[]\", $psi_member_offsetof, $psi_member_sizeof, $pl, $as}" - AC_MSG_WARN(pre-defined size $check_size of $2 in $1 does not match computed size $psi_member_sizeof; adjusting to $psi_member_type_pair) - else - psi_struct_members="[$psi_struct_members, {]PSI_TYPE_PAIR(member_type)[, \"]member_name[\", $psi_member_offsetof, $psi_member_sizeof, $pl, $as}]" - fi - fi -]) - -dnl PSI_STRUCT(struct name, struct members) -dnl Check a struct and its members and add a pre-defined struct and possibly a -dnl pre-defined type for this struct. -dnl Calls PSI_CHECK_SIZEOF and PSI_CHECK_ALIGNOF for the struct. -dnl Calls PSI_CHECK_SIZEOF, PSI_CHECK_OFFSETOF and PSI_TYPE_INDIRECTON for each member. -AC_DEFUN(PSI_STRUCT, [ - PSI_CHECK_SIZEOF($1) - if PSI_SH_TEST_SIZEOF($1); then - PSI_CHECK_ALIGNOF($1) - psi_struct_name=m4_bregexp([$1], [^\(struct \)?\(\w+\)], [\2]) - psi_struct_members="{PSI_T_STRUCT, \"struct\", \"$psi_struct_name\", PSI_SH_ALIGNOF($1), PSI_SH_SIZEOF($1), 0, 0}" - ifelse([$2],,,[m4_map_args_sep([PSI_STRUCT_MEMBER($1, m4_normalize(], [))], [], $2)]) - psi_add_struct "$psi_struct_members" - if test "$1" = "$psi_struct_name"; then - psi_add_type "{PSI_T_STRUCT, \"$1\", \"$1\"}" - fi - fi -]) - -dnl PSI_UNION(union name, union/struct members) -dnl Check a union and its members and add a pre-defined union and possibly a -dnl pre-defined type for this union. -dnl Calls PSI_CHECK_SIZEOF for the union and each member. -dnl Calls PSI_CHECK_OFFSETOF and PSI_TYPE_INDIRECTON for each member. -AC_DEFUN(PSI_UNION, [ - PSI_CHECK_SIZEOF($1) - if PSI_SH_TEST_SIZEOF($1); then - PSI_CHECK_ALIGNOF($1) - psi_struct_name=m4_bregexp([$1], [^\(union \)?\(\w+\)], [\2]) - psi_struct_members="{PSI_T_UNION, \"union\", \"$psi_struct_name\", PSI_SH_ALIGNOF($1), PSI_SH_SIZEOF($1), 0, 0}" - ifelse([$2],,,[m4_map_args_sep([PSI_STRUCT_MEMBER($1, m4_normalize(], [))], [], $2)]) - psi_add_union "$psi_struct_members" - if test "$1" = "$psi_struct_name"; then - psi_add_type "{PSI_T_UNION, \"$1\", \"$1\"}" - fi - fi -]) diff --git a/m4/psi_type.m4 b/m4/psi_type.m4 deleted file mode 100644 index ad2d000..0000000 --- a/m4/psi_type.m4 +++ /dev/null @@ -1,254 +0,0 @@ -# psi_add_type(type triplet) -# Add a pre-defined type to $PSI_TYPES. -psi_add_type() { - cat >>$PSI_TYPES <>$PSI_STDTYPES <, \"\" tuple. -# Uses stdint types when possible. -psi_type_pair() { - local psi_type_name=`printf "%s" "$1" | tr -cd A-Za-z0-9_` - local psi_type_lower=`printf "%s" "$1" | tr A-Z a-z` - case $psi_type_lower in - int*|uint*) - local psi_type_upper=`printf "%s" "$psi_type_name" | tr a-z A-Z` - local psi_type_bits=`expr $2 \* 8` - echo "PSI_T_${psi_type_upper}${psi_type_bits}, \"${psi_type_lower}${psi_type_bits}_t\"" - ;; - struct*) - echo "PSI_T_STRUCT, \"$2\"" - ;; - union*) - echo "PSI_T_UNION, \"$2\"" - ;; - void) - echo "PSI_T_VOID, \"void\"" - ;; - *) - echo "PSI_T_NAME, \"$psi_type_name\"" - ;; - esac -} - -dnl PSI_TYPE(type name, basic type) -dnl Check for a specific type, optionally referring to a basic type. -dnl Calls AC_TYPE_ (if defined) and PSI_CHECK_SIZEOF. -dnl If the basic type is just specified as "int" (in contrast to "sint" or -dnl "uint"), AX_CHECK_SIGN is used to discover signedness of the type. -dnl Defines a pre-defined type in $PSI_TYPES. -AC_DEFUN(PSI_TYPE, [ - ifdef(AS_TR_CPP(AC_TYPE_$1), AS_TR_CPP(AC_TYPE_$1)) - PSI_CHECK_SIZEOF($1) - psi_basic_type=AS_TR_SH($2) - case $psi_basic_type in - int) - AX_CHECK_SIGN($1, :, [psi_basic_type=uint], PSI_INCLUDES) - ;; - sint) - psi_basic_type=int - ;; - esac - if test "$2" && PSI_SH_TEST_SIZEOF($1); then - AS_TR_SH(psi_basic_type_$1)=$psi_basic_type - psi_add_type "{`psi_type_pair $psi_basic_type PSI_SH_SIZEOF($1)`, \"$1\"}" - fi -]) - -AC_DEFUN(PSI_STDTYPE, [ - ifdef(AS_TR_CPP(AC_TYPE_$1), AS_TR_CPP(AC_TYPE_$1)) - PSI_CHECK_SIZEOF($1) - if PSI_SH_TEST_SIZEOF($1); then - m4_case([$1], - [float],[psi_add_stdtype "{PSI_T_FLOAT, \"float\", NULL}"], - [double],[psi_add_stdtype "{PSI_T_DOUBLE, \"double\", NULL}"], - [long double],[psi_add_stdtype "{PSI_T_LONG_DOUBLE, \"long double\", NULL}"], - [ - AX_CHECK_SIGN($1, psi_basic_type=int, psi_basic_type=uint, PSI_INCLUDES) - AS_TR_SH(psi_basic_type_$1)=$psi_basic_type - psi_add_stdtype "{`psi_type_pair $psi_basic_type PSI_SH_SIZEOF($1)`, \"$1\"}" - ]) - fi -]) - -dnl PSI_SH_BASIC_TYPE(type) -dnl Expand to the basic type (int/uint) of a distinct type -AC_DEFUN(PSI_SH_BASIC_TYPE, [$AS_TR_SH([psi_basic_type_]$1)]) - -dnl PSI_OPAQUE_TYPE(type name) -dnl Checks a type for being a scalar, a struct or a pointer type. -dnl Calls AC_TYPE_ (if defined) and PSI_CHECK_SIZEOF. -dnl Defines a pre-defined type in $PSI_TYPES and a pre-defined struct in -dnl $PSI_STRUCTS if the type is a struct. -AC_DEFUN(PSI_OPAQUE_TYPE, [ - ifdef(AS_TR_CPP(AC_TYPE_$1), AS_TR_CPP(AC_TYPE_$1)) - PSI_CHECK_SIZEOF($1) - if PSI_SH_TEST_SIZEOF($1); then - psi_type_class= - AC_CACHE_CHECK(kind of $1, AS_TR_SH([psi_cv_type_class_]$1), [ - AC_TRY_COMPILE(PSI_INCLUDES, [char test@<:@($1)1@:>@;], [ - psi_type_class=scalar - ], [ - AC_TRY_COMPILE(PSI_INCLUDES, [$1 test = 0;], [ - AC_TRY_COMPILE(PSI_INCLUDES, [$1 test = (($1)0)+1;], [ - psi_type_class="pointer of known type" - ], [ - psi_type_class="pointer of opaque type" - ]) - ], [ - psi_type_class=struct - ]) - ]) - AS_TR_SH([psi_cv_type_class_]$1)="$psi_type_class" - ]) - case "$AS_TR_SH([psi_cv_type_class_]$1)" in - scalar) - AX_CHECK_SIGN($1, [psi_basic_type=int], [psi_basic_type=uint], PSI_INCLUDES) - psi_add_type "{`psi_type_pair $psi_basic_type PSI_SH_SIZEOF($1)`, \"$1\"}" - ;; - struct) - PSI_STRUCT($1) - ;; - pointer*) - psi_add_type "{PSI_T_POINTER, \"void\", \"$1\"}" - ;; - *) - AC_MSG_WARN(could not detect kind of $1) - ;; - esac - fi -]) - -dnl PSI_FUNCTOR_TYPE(type functor_name, args) -dnl Forwards to PSI_DECL_TYPE. -AC_DEFUN(PSI_FUNCTOR_TYPE, [ - dnl psi_add_type "{PSI_T_POINTER, \"void\", \"PSI_VAR_NAME($1)\"}" - AS_TR_SH([ac_cv_sizeof_]PSI_VAR_NAME($1))=PSI_SH_SIZEOF(void *) - PSI_DECL_TYPE([$1], [$2]) -]) - -dnl PSI_VAR_TYPE(decl arg) -dnl Extracts the type of a decl arg, e.g. dnl unsigned char* buf[16] -> unsigned char*. -AC_DEFUN(PSI_VAR_TYPE, [m4_bregexp([$1], [^\(const \)?\(.*\) \([*]*\)[^ ]+$], [\2\3])]) - -dnl PSI_VAR_NAME(decl arg) -dnl Extracts the var name of a decl arg, e.g. unsigned char* buf[16] -> buf. -AC_DEFUN(PSI_VAR_NAME, [m4_bregexp(m4_bregexp([$1], [\([^ ]+\)$], [\1]), [\w+], [\&])]) - -dnl PSI_TYPE_INDIRECTION(decl arg, size, pointer_level_var, array_size_var) -dnl Calculates and assigns pointer_level and array_size of a decl arg to sh vars. -AC_DEFUN(PSI_TYPE_INDIRECTION, [ - m4_define([psi_pointer_level], m4_len(m4_bpatsubst([PSI_VAR_TYPE($1)], [[^*]]))) - m4_define([psi_array_size], [m4_bregexp([PSI_VAR_TYPE($1)], [@<:@\([0-9]+\)@:>@], [\1])]) - - ifelse(psi_array_size.$2,0., [ - AC_MSG_ERROR([cannot compute dynamic array size of a non-struct member]) - ], [ - ifelse(psi_pointer_level,0,[ - m4_define([psi_type_size],[$]AS_TR_SH([ac_cv_sizeof_]m4_bregexp(PSI_VAR_TYPE([$1]), [^\( \|\w\)+], [\&]))) - ],[ - m4_define([psi_type_size],$ac_cv_sizeof_void_p) - ]) - ]) - - m4_case(psi_array_size,,[ - $3=psi_pointer_level - $4=0] - ,0,[ - $3=m4_incr(psi_pointer_level) - $4="`expr $2 / psi_type_size`" - ], [ - $3=m4_incr(psi_pointer_level) - $4=psi_array_size - ]) -]) - -dnl PSI_TYPE_PAIR(type) -dnl Expand to a PSI_T_, \\"\\" tuple. -dnl FIXME: There is also psi_type_pair()? -AC_DEFUN(PSI_TYPE_PAIR, [m4_case(m4_bregexp([$1], [^\w+], [\&]), - [void], [PSI_T_VOID, \"void\"], - [struct], [PSI_T_STRUCT, \"m4_bregexp([$1], [^struct \(\w+\)], [\1])\"], - [union], [PSI_T_UNION, \"m4_bregexp([$1], [^union \(\w+\)], [\1])\"], - [PSI_T_NAME, \"m4_bregexp([$1], [^\(\w+ \)*\w+], [\&])\"])]) - -dnl PSI_CHECK_STD_TYPES() -dnl Checks for standard ANSI-C and stdint types. -AC_DEFUN(PSI_CHECK_STD_TYPES, [ - AC_CHECK_HEADERS(stdint.h) - - AC_TYPE_INT8_T - PSI_CHECK_SIZEOF(int8_t) - AC_CHECK_ALIGNOF(int8_t) - AC_TYPE_UINT8_T - PSI_CHECK_SIZEOF(uint8_t) - AC_CHECK_ALIGNOF(uint8_t) - AC_TYPE_INT16_T - PSI_CHECK_SIZEOF(int16_t) - AC_CHECK_ALIGNOF(int16_t) - AC_TYPE_UINT16_T - PSI_CHECK_SIZEOF(uint16_t) - AC_CHECK_ALIGNOF(uint16_t) - AC_TYPE_INT32_T - PSI_CHECK_SIZEOF(int32_t) - AC_CHECK_ALIGNOF(int32_t) - AC_TYPE_UINT32_T - PSI_CHECK_SIZEOF(uint32_t) - AC_CHECK_ALIGNOF(uint32_t) - AC_TYPE_INT64_T - PSI_CHECK_SIZEOF(int64_t) - AC_CHECK_ALIGNOF(int64_t) - AC_TYPE_UINT64_T - PSI_CHECK_SIZEOF(uint64_t) - AC_CHECK_ALIGNOF(uint64_t) - - PSI_CHECK_SIZEOF(void *) - AC_CHECK_ALIGNOF(void *) - - PSI_STDTYPE(float) - AC_CHECK_ALIGNOF(float) - PSI_STDTYPE(double) - AC_CHECK_ALIGNOF(double) - PSI_STDTYPE(long double) - AC_CHECK_ALIGNOF(long double) - - PSI_STDTYPE(char, int) - AC_CHECK_ALIGNOF(char) - PSI_STDTYPE(signed char, int) - PSI_STDTYPE(unsigned char, uint) - PSI_STDTYPE(short, int) - AC_CHECK_ALIGNOF(short) - PSI_STDTYPE(short int, int) - PSI_STDTYPE(signed short, int) - PSI_STDTYPE(signed short int, int) - PSI_STDTYPE(unsigned short, uint) - PSI_STDTYPE(unsigned short int, uint) - PSI_STDTYPE(int, int) - AC_CHECK_ALIGNOF(int) - PSI_STDTYPE(signed int, int) - PSI_STDTYPE(signed, int) - PSI_STDTYPE(unsigned int, uint) - PSI_STDTYPE(unsigned, uint) - PSI_STDTYPE(long, int) - AC_CHECK_ALIGNOF(long) - PSI_STDTYPE(long int, int) - PSI_STDTYPE(signed long int, int) - PSI_STDTYPE(unsigned long, uint) - PSI_STDTYPE(unsigned long int, uint) - PSI_STDTYPE(long long, int) - AC_CHECK_ALIGNOF(long long) - PSI_STDTYPE(signed long long, int) - PSI_STDTYPE(signed long long int, int) - PSI_STDTYPE(unsigned long long, uint) - PSI_STDTYPE(unsigned long long int, uint) - dnl this must come after the check fo "unsigned long long int"; autoconf, wth? - PSI_STDTYPE(long long int, int) -]) diff --git a/m4/signal.m4 b/m4/signal.m4 deleted file mode 100644 index a9225ce..0000000 --- a/m4/signal.m4 +++ /dev/null @@ -1,187 +0,0 @@ -PSI_CHECK_SIGNAL() { - PSI_CONFIG_POSIX(signal, signal.h) - - PSI_PTHREAD - - PSI_CONST(SIG_DFL, int) - PSI_CONST(SIG_ERR, int) - PSI_CONST(SIG_HOLD, int) - PSI_CONST(SIG_IGN, int) - - PSI_CONST(SIGEV_NONE, int) - PSI_CONST(SIGEV_SIGNAL, int) - PSI_CONST(SIGEV_THREAD, int) - - PSI_MACRO(int SIGRTMIN) - PSI_MACRO(int SIGRTMAX) - PSI_MACRO(int RTSIG_MAX) - - PSI_CONST(SIGABRT, int) - PSI_CONST(SIGALRM, int) - PSI_CONST(SIGBUS, int) - PSI_CONST(SIGCHLD, int) - PSI_CONST(SIGCONT, int) - PSI_CONST(SIGFPE, int) - PSI_CONST(SIGHUP, int) - PSI_CONST(SIGILL, int) - PSI_CONST(SIGINT, int) - PSI_CONST(SIGKILL, int) - PSI_CONST(SIGPIPE, int) - PSI_CONST(SIGQUIT, int) - PSI_CONST(SIGSEGV, int) - PSI_CONST(SIGSTOP, int) - PSI_CONST(SIGTERM, int) - PSI_CONST(SIGTSTP, int) - PSI_CONST(SIGTTIN, int) - PSI_CONST(SIGTTOU, int) - PSI_CONST(SIGUSR1, int) - PSI_CONST(SIGUSR2, int) - PSI_CONST(SIGPOLL, int) - PSI_CONST(SIGPROF, int) - PSI_CONST(SIGSYS, int) - PSI_CONST(SIGTRAP, int) - PSI_CONST(SIGURG, int) - PSI_CONST(SIGVTALRM, int) - PSI_CONST(SIGXCPU, int) - PSI_CONST(SIGXFSZ, int) - - PSI_MACRO(int SIG_BLOCK) - PSI_MACRO(int SIG_UNBLOCK) - PSI_MACRO(int SIG_SETMASK) - - PSI_CONST(SA_NOCLDSTOP, int) - PSI_CONST(SA_ONSTACK, int) - PSI_CONST(SA_RESETHAND, int) - PSI_CONST(SA_RESTART, int) - PSI_CONST(SA_SIGINFO, int) - PSI_CONST(SA_NOCLDWAIT, int) - PSI_CONST(SA_NODEFER, int) - PSI_CONST(SS_ONSTACK, int) - PSI_CONST(SS_DISABLE, int) - PSI_CONST(MINSIGSTKSZ, int) - PSI_CONST(SIGSTKSZ, int) - - PSI_CONST(ILL_ILLOPC, int) - PSI_CONST(ILL_ILLOPN, int) - PSI_CONST(ILL_ILLADR, int) - PSI_CONST(ILL_ILLTRP, int) - PSI_CONST(ILL_PRVOPC, int) - PSI_CONST(ILL_PRVREG, int) - PSI_CONST(ILL_COPROC, int) - PSI_CONST(ILL_BADSTK, int) - PSI_CONST(FPE_INTDIV, int) - PSI_CONST(FPE_INTOVF, int) - PSI_CONST(FPE_FLTDIV, int) - PSI_CONST(FPE_FLTOVF, int) - PSI_CONST(FPE_FLTUND, int) - PSI_CONST(FPE_FLTRES, int) - PSI_CONST(FPE_FLTINV, int) - PSI_CONST(FPE_FLTSUB, int) - PSI_CONST(SEGV_MAPERR, int) - PSI_CONST(SEGV_ACCERR, int) - PSI_CONST(BUS_ADRALN, int) - PSI_CONST(BUS_ADRERR, int) - PSI_CONST(BUS_OBJERR, int) - PSI_CONST(TRAP_BRKPT, int) - PSI_CONST(TRAP_TRACE, int) - PSI_CONST(CLD_EXITED, int) - PSI_CONST(CLD_KILLED, int) - PSI_CONST(CLD_DUMPED, int) - PSI_CONST(CLD_TRAPPED, int) - PSI_CONST(CLD_STOPPED, int) - PSI_CONST(CLD_CONTINUED, int) - PSI_CONST(POLL_IN, int) - PSI_CONST(POLL_OUT, int) - PSI_CONST(POLL_MSG, int) - PSI_CONST(POLL_ERR, int) - PSI_CONST(POLL_PRI, int) - PSI_CONST(POLL_HUP, int) - PSI_CONST(SI_USER, int) - PSI_CONST(SI_QUEUE, int) - PSI_CONST(SI_TIMER, int) - PSI_CONST(SI_ASYNCIO, int) - PSI_CONST(SI_MESGQ, int) - - PSI_TYPE(sig_atomic_t, int) - PSI_OPAQUE_TYPE(sigset_t) - PSI_OPAQUE_TYPE(mcontext_t) - - PSI_UNION(union sigval, [ - int sival_int, - void *sival_ptr] - ) - - PSI_STRUCT(struct sigevent, [ - int sigev_notify, - int sigev_signo, - union sigval sigev_value] - ) - - PSI_STRUCT(stack_t, [ - void *ss_sp, - size_t ss_size, - int ss_flags] - ) - - PSI_FUNCTOR_TYPE(void sa_handler, [(int signo)]) - PSI_FUNCTOR_TYPE(void sa_sigaction, [(int signo, siginfo_t *info, ucontext_t *context)]) - - PSI_STRUCT(struct sigaction, [ - sa_handler sa_handler, - sigset_t sa_mask, - int sa_flags, - sa_sigaction sa_sigaction] - ) - - PSI_STRUCT(ucontext_t, [ - ucontext_t *uc_link, - sigset_t uc_sigmask, - stack_t uc_stack, - mcontext_t uc_mcontext] - ) - - PSI_STRUCT(siginfo_t, [ - int si_signo, - int si_code, - int si_errno, - pid_t si_pid, - uid_t si_uid, - void *si_addr, - int si_status, - long si_band, - union sigval si_value] - ) - - PSI_DECL(int kill, [(pid_t pid, int sig)]) - PSI_DECL(int killpg, [(pid_t pgrp, int sig)]) - PSI_DECL(void psiginfo, [(const siginfo_t *pinfo, const char *s)]) - PSI_DECL(void psignal, [(int sig, const char *s)]) - - PSI_SH_TEST_POSIX_ENABLED(pthread, [ - PSI_DECL(int pthread_kill, [(pthread_t thread, int sig)]) - PSI_DECL(int pthread_sigmask, [(int how, const sigset_t *set, sigset_t *oldset)]) - ]) - - PSI_DECL(int raise, [(int sig)]) - PSI_DECL(int sigaction, [(int sig, const struct sigaction *act, struct sigaction *oact)]) - PSI_DECL(int sigaddset, [(sigset_t * set, int signum)]) - PSI_DECL(int sigaltstack, [(const stack_t *ss, stack_t *oss)]) - PSI_DECL(int sigdelset, [(sigset_t *set, int signum)]) - PSI_DECL(int sigemptyset, [(sigset_t *set)]) - PSI_DECL(int sigfillset, [(sigset_t *set)]) - PSI_DECL(int sighold, [(int sig)]) - PSI_DECL(int sigignore, [(int sig)]) - PSI_DECL(int siginterrupt, [(int sig, int flag)]) - PSI_DECL(int sigismember, [(const sigset_t *set, int signum)]) - PSI_DECL(void *signal, [(int sig, void *func)]) - PSI_DECL(int sigpause, [(int sig)]) - PSI_DECL(int sigpending, [(sigset_t *set)]) - PSI_DECL(int sigprocmask, [(int how, const sigset_t *set, sigset_t *oset)]) - PSI_DECL(int sigqueue, [(pid_t pid, int sig, const union sigval value)]) - PSI_DECL(int sigrelse, [(int sig)]) - PSI_DECL(void *sigset, [(int sig, void *disp)]) - PSI_DECL(int sigsuspend, [(const sigset_t *sigmask)]) - PSI_DECL(int sigtimedwait, [(const sigset_t *set, siginfo_t *info, const struct timespec *timeout)]) - PSI_DECL(int sigwait, [(const sigset_t *set, int *sig)]) - PSI_DECL(int sigwaitinfo, [(const sigset_t *set, siginfo_t *info)]) -} \ No newline at end of file diff --git a/m4/stddef.m4 b/m4/stddef.m4 deleted file mode 100644 index fd52d2a..0000000 --- a/m4/stddef.m4 +++ /dev/null @@ -1,18 +0,0 @@ -PSI_CHECK_STDDEF() { - AC_CHECK_HEADERS(stddef.h) - PSI_TYPE(ptrdiff_t, int) - PSI_CONST(PTRDIFF_MIN, int) - PSI_CONST(PTRDIFF_MAX, int) - PSI_TYPE(size_t, uint) - PSI_CONST(SIZE_MAX, int) - PSI_TYPE(wchar_t, int) - if PSI_SH_TEST_SIZEOF(wchar_t); then :; else - # some platforms fail to provide wchar_t in stddef.h - unset ac_cv_sizeof_wchar_t - unset ax_cv_decl_wchar_t_signed - AC_CHECK_HEADERS(wchar.h) - PSI_TYPE(wchar_t, int) - fi - PSI_CONST(WCHAR_MIN, int) - PSI_CONST(WCHAR_MAX, int) -} diff --git a/m4/stdint.m4 b/m4/stdint.m4 deleted file mode 100644 index c21c129..0000000 --- a/m4/stdint.m4 +++ /dev/null @@ -1,70 +0,0 @@ -PSI_CHECK_STDINT() { - AC_CHECK_HEADERS(stdint.h) - - PSI_TYPE(int_least8_t, sint) - PSI_TYPE(int_least16_t, sint) - PSI_TYPE(int_least32_t, sint) - PSI_TYPE(int_least64_t, sint) - PSI_TYPE(uint_least8_t, uint) - PSI_TYPE(uint_least16_t, uint) - PSI_TYPE(uint_least32_t, uint) - PSI_TYPE(uint_least64_t, uint) - PSI_TYPE(int_fast8_t, sint) - PSI_TYPE(int_fast16_t, sint) - PSI_TYPE(int_fast32_t, sint) - PSI_TYPE(int_fast64_t, sint) - PSI_TYPE(uint_fast8_t, uint) - PSI_TYPE(uint_fast16_t, uint) - PSI_TYPE(uint_fast32_t, uint) - PSI_TYPE(uint_fast64_t, uint) - PSI_TYPE(intptr_t, sint) - PSI_TYPE(uintptr_t, uint) - PSI_TYPE(intmax_t, sint) - PSI_TYPE(uintmax_t, uint) - - PSI_CONST(INT8_MIN, int) - PSI_CONST(INT8_MAX, int) - PSI_CONST(UINT8_MAX, int) - PSI_CONST(INT16_MIN, int) - PSI_CONST(INT16_MAX, int) - PSI_CONST(UINT16_MAX, int) - PSI_CONST(INT32_MIN, int) - PSI_CONST(INT32_MAX, int) - PSI_CONST(UINT32_MAX, int) - PSI_CONST(INT64_MIN, int) - PSI_CONST(INT64_MAX, int) - PSI_CONST(UINT64_MAX, int) - - PSI_CONST(INT_LEAST8_MIN, int) - PSI_CONST(INT_LEAST8_MAX, int) - PSI_CONST(UINT_LEAST8_MAX, int) - PSI_CONST(INT_LEAST16_MIN, int) - PSI_CONST(INT_LEAST16_MAX, int) - PSI_CONST(UINT_LEAST16_MAX, int) - PSI_CONST(INT_LEAST32_MIN, int) - PSI_CONST(INT_LEAST32_MAX, int) - PSI_CONST(UINT_LEAST32_MAX, int) - PSI_CONST(INT_LEAST64_MIN, int) - PSI_CONST(INT_LEAST64_MAX, int) - PSI_CONST(UINT_LEAST64_MAX, int) - - PSI_CONST(INT_FAST8_MIN, int) - PSI_CONST(INT_FAST8_MAX, int) - PSI_CONST(UINT_FAST8_MAX, int) - PSI_CONST(INT_FAST16_MIN, int) - PSI_CONST(INT_FAST16_MAX, int) - PSI_CONST(UINT_FAST16_MAX, int) - PSI_CONST(INT_FAST32_MIN, int) - PSI_CONST(INT_FAST32_MAX, int) - PSI_CONST(UINT_FAST32_MAX, int) - PSI_CONST(INT_FAST64_MIN, int) - PSI_CONST(INT_FAST64_MAX, int) - PSI_CONST(UINT_FAST64_MAX, int) - - PSI_CONST(INTPTR_MIN, int) - PSI_CONST(INTPTR_MAX, int) - PSI_CONST(UINTPTR_MAX, int) - PSI_CONST(INTMAX_MIN, int) - PSI_CONST(INTMAX_MAX, int) - PSI_CONST(UINTMAX_MAX, int) -} diff --git a/m4/stdio.m4 b/m4/stdio.m4 deleted file mode 100644 index a2b40b5..0000000 --- a/m4/stdio.m4 +++ /dev/null @@ -1,87 +0,0 @@ -PSI_CHECK_STDIO() { - PSI_CONFIG_POSIX(stdio, stdio.h) - - PSI_STRUCT(FILE) - PSI_STRUCT(fpos_t) - - PSI_CONST(BUFSIZ, int) - PSI_CONST(_IOFBF, int) - PSI_CONST(_IOLBF, int) - PSI_CONST(_IONBF, int) - PSI_CONST(SEEK_CUR, int) - PSI_CONST(SEEK_END, int) - PSI_CONST(SEEK_SET, int) - PSI_CONST(FILENAME_MAX, int) - PSI_CONST(FOPEN_MAX, int) - PSI_CONST(TMP_MAX, int) - PSI_CONST(EOF, int) - PSI_CONST(P_tmpdir, string) - PSI_CONST(L_ctermid, int) - PSI_CONST(L_tmpnam, int) - - PSI_MACRO(FILE *stderr) - PSI_MACRO(FILE *stdout) - PSI_MACRO(FILE *stdin) - - PSI_DECL(void clearerr, [(FILE *stream)]) - PSI_DECL(char *ctermid, [(char *s)]) - PSI_DECL(int fclose, [(FILE *stream)]) - PSI_DECL(FILE *fdopen, [(int fd, char *mode)]) - PSI_DECL(int feof, [(FILE *stream)]) - PSI_DECL(int ferror, [(FILE *stream)]) - PSI_DECL(int fflush, [(FILE *stream)]) - PSI_DECL(int fgetc, [(FILE *stream)]) - PSI_DECL(int fgetpos, [(FILE *stream, fpos_t *pos)]) - PSI_DECL(char *fgets, [(char *buf, int len, FILE *stream)]) - PSI_DECL(int fileno, [(FILE *stream)]) - PSI_DECL(void flockfile, [(FILE *stream)]) - PSI_DECL(FILE *fmemopen, [(void *buf, size_t len, char *mode)]) - PSI_DECL(FILE *fopen, [(char *path, char *mode)]) - PSI_DECL(int fputc, [(int c, FILE *stream)]) - PSI_DECL(int fputs, [(char *s, FILE *stream)]) - PSI_DECL(size_t fread, [(void *buf, size_t len, size_t n, FILE *stream)]) - PSI_DECL(FILE *freopen, [(char *path, char *mode, FILE *stream)]) - PSI_DECL(int fseek, [(FILE *stream, long offset, int whence)]) - PSI_DECL(int fseeko, [(FILE *stream, off_t offset, int whence)]) - PSI_DECL(int fsetpos, [(FILE *stream, fpos_t *pos)]) - PSI_DECL(long ftell, [(FILE *stream)]) - PSI_DECL(off_t ftello, [(FILE *stream)]) - PSI_DECL(int ftrylockfile, [(FILE *stream)]) - PSI_DECL(void funlockfile, [(FILE *stream)]) - PSI_DECL(size_t fwrite, [(void *buf, size_t len, size_t n, FILE *stream)]) - PSI_DECL(int getc, [(FILE *stream)]) - PSI_DECL(int getchar, [(void)]) - PSI_DECL(int getc_unlocked, [(FILE *stream)]) - PSI_DECL(int getchar_unlocked, [(void)]) - PSI_DECL(ssize_t getdelim, [(char **lineptr, size_t *n, int delim, FILE *stream)]) - PSI_DECL(ssize_t getline, [(char **lineptr, size_t *n, FILE *stream)]) - PSI_DECL(char *gets, [(char *buf)]) - PSI_DECL(FILE *open_memstream, [(char **ptr, size_t *sizeloc)]) - PSI_DECL(int pclose, [(FILE *stream)]) - PSI_DECL(void perror, [(char *s)]) - PSI_DECL(FILE *popen, [(char *command, char *type)]) - PSI_DECL(int putc, [(int c, FILE *stream)]) - PSI_DECL(int putchar, [(int c)]) - PSI_DECL(int putc_unlocked, [(int c, FILE *stream)]) - PSI_DECL(int putchar_unlocked, [(int c)]) - PSI_DECL(int puts, [(char *s)]) - PSI_DECL(int remove, [(char *path)]) - PSI_DECL(int rename, [(char *old, char *new)]) - PSI_DECL(int renameat, [(int oldfd, char *oldpath, int newfd, char *newpath)]) - PSI_DECL(void rewind, [(FILE *stream)]) - PSI_DECL(void setbuf, [(FILE *stream, char *buf)]) - PSI_DECL(int setvbuf, [(FILE *stream, char *buf, int mode, size_t size)]) - PSI_DECL(char *tempnam, [(char *dir, char *prefix)]) - PSI_DECL(FILE *tmpfile, [(void)]) - PSI_DECL(char *tmpnam, [(char *s)]) - PSI_DECL(int ungetc, [(int c, FILE *stream)]) - - PSI_DECL(int dprintf, [(int fd, char *format)], vararg) - PSI_DECL(int fprintf, [(FILE *stream, char *format)], vararg) - PSI_DECL(int fscanf, [(FILE *stream, char *format)], vararg) - PSI_DECL(int printf, [(char *format)], vararg) - PSI_DECL(int scanf, [(char *format)], vararg) - PSI_DECL(int snprintf, [(char *str, size_t size, char *format)], vararg) - PSI_DECL(int sprintf, [(char *str, char *format)], vararg) - PSI_DECL(int sscanf, [(char *str, char *format)], vararg) -} diff --git a/m4/stdlib.m4 b/m4/stdlib.m4 deleted file mode 100644 index 4f2f739..0000000 --- a/m4/stdlib.m4 +++ /dev/null @@ -1,79 +0,0 @@ -PSI_CHECK_STDLIB() { - AC_CHECK_HEADERS(stdlib.h) - - PSI_STRUCT(div_t, [ - int quot, - int rem - ]) - PSI_STRUCT(ldiv_t, [ - long quot, - long rem - ]) - PSI_STRUCT(lldiv_t, [ - long long quot, - long long rem - ]) - - PSI_CONST(EXIT_FAILURE, int) - PSI_CONST(EXIT_SUCCESS, int) - PSI_CONST(RAND_MAX, int) - - PSI_MACRO(int MB_CUR_MAX) - - PSI_DECL(void _Exit, [(int status)]) - PSI_DECL(void abort, [()]) - PSI_DECL(int abs, [(int n)]) - PSI_DECL(double atof, [(char *str)]) - PSI_DECL(int atoi, [(char *str)]) - PSI_DECL(long atol, [(char *str)]) - PSI_DECL(div_t div, [(int numerator, int denominator)]) - PSI_DECL(double drand48, [()]) - PSI_DECL(double erand48, [(unsigned short xsubi@<:@3@:>@)]) - PSI_DECL(void exit, [(int status)]) - PSI_DECL(void free, [(void *ptr)]) - PSI_DECL(char *getenv, [(char *var)]) - PSI_DECL(int grantpt, [(int fd)]) - PSI_DECL(char *initstate, [(unsigned int seed, char *state, size_t n)]) - PSI_DECL(long jrand48, [(unsigned short xsubi@<:@3@:>@)]) - PSI_DECL(long labs, [(long l)]) - PSI_DECL(void lcong48, [(unsigned short param@<:@7@:>@)]) - PSI_DECL(ldiv_t ldiv, [(long numerator, long denominator)]) - PSI_DECL(lldiv_t lldiv, [(long long numerator, long long denominator)]) - PSI_DECL(long lrand48, [()]) - PSI_DECL(int mblen, [(const char *s, size_t n)]) - PSI_DECL(size_t mbstowcs, [(wchar_t *dest, char *src, size_t n)]) - PSI_DECL(int mbtowc, [(wchar_t *pwc, char *s, size_t n)]) - PSI_DECL(char *mkdtemp, [(char *template)]) - PSI_DECL(char *mkdstemp, [(char *template)]) - PSI_DECL(long mrand48, [()]) - PSI_DECL(long nrand48, [(unsigned short xsubi@<:@3@:>@)]) - PSI_DECL(int posix_openpt, [(int flags)]) - PSI_DECL(char *ptsname, [(int fd)]) - PSI_DECL(char *pstname_r, [(int fd, char *buf, size_t buflen)]) - PSI_DECL(int putenv, [(char *var)]) - PSI_DECL(int rand, [()]) - PSI_DECL(int rand_r, [(unsigned *seed_p)]) - PSI_DECL(long random, [()]) - PSI_DECL(char *realpath, [(char *path, char *resolved)]) - PSI_DECL(unsigned short *seed48, [(unsigned short seed16v@<:@3@:>@)]) - PSI_DECL(int setenv, [(char *var)]) - - AC_SEARCH_LIBS(setkey, crypt, [ - PSI_DECL(void setkey, [(char *key)]) - ]) - - PSI_DECL(char *setstate, [(char *state)]) - PSI_DECL(void srand, [(unsigned seed)]) - PSI_DECL(void srand48, [(long seed)]) - PSI_DECL(void srandom, [(unsigned seed)]) - PSI_DECL(double strtod, [(char *nptr, char **endptr)]) - PSI_DECL(float strtof, [(char *nptr, char **endptr)]) - PSI_DECL(long strtol, [(char *nptr, char **endptr)]) - PSI_DECL(long double strtold, [(const char *nptr, char **endptr)]) - PSI_DECL(unsigned long strtoul, [(char *nptr, char **endptr)]) - PSI_DECL(int system, [(char *command)]) - PSI_DECL(int unlockpt, [(int fd)]) - PSI_DECL(int unsetenv, [(char *var)]) - PSI_DECL(size_t wcstombs, [(char *dest, wchar_t *src, size_t n)]) - PSI_DECL(int wctomb, [(char *s, wchar_t wc)]) -} diff --git a/m4/sys_select.m4 b/m4/sys_select.m4 deleted file mode 100644 index 0390299..0000000 --- a/m4/sys_select.m4 +++ /dev/null @@ -1,17 +0,0 @@ -PSI_CHECK_SYS_SELECT() { - PSI_CONFIG_POSIX(sys/select, sys/select.h) - - PSI_STRUCT(fd_set, []) - - PSI_CONST(FD_SETSIZE, int) - - PSI_DECL(void FD_CLEAR, [(int fd, fd_set *s)]) - PSI_DECL(void FD_COPY, [(fd_set *s1, fd_set *s2)]) - PSI_DECL(void FD_CLR, [(int fd, fd_set *s)]) - PSI_DECL(void FD_SET, [(int fd, fd_set *s)]) - PSI_DECL(int FD_ISSET, [(int fd, fd_set *s)]) - PSI_DECL(void FD_ZERO, [(fd_set *s)]) - - PSI_DECL(int select, [(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout)]) - dnl PSI_DECL(int pselect, [(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout, sigset_t *sigmask)]) -} diff --git a/m4/sys_socket.m4 b/m4/sys_socket.m4 deleted file mode 100644 index 6d1eaf3..0000000 --- a/m4/sys_socket.m4 +++ /dev/null @@ -1,93 +0,0 @@ -PSI_CHECK_SYS_SOCKET() { - PSI_CONFIG_POSIX(sys/socket, sys/socket.h) - - PSI_TYPE(socklen_t, int) - PSI_TYPE(sa_family_t, uint) - - PSI_STRUCT(struct sockaddr, [ - sa_family_t sa_family, - char sa_data@<:@0@:>@] - ) - PSI_STRUCT(struct sockaddr_storage, [ - sa_family_t ss_family] - ) - PSI_STRUCT(struct msghdr, [ - void *msg_name, - socklen_t msg_namelen, - struct iovec *msg_iov, - int msg_iovlen, - void *msg_control, - socklen_t msg_controllen, - int msg_flags] - ) - PSI_STRUCT(struct cmsghdr, [ - socklen_t cmsg_len, - int cmsg_level, - int cmsg_type] - ) - PSI_STRUCT(struct linger, [ - int l_onoff, - int l_linger] - ) - - PSI_CONST(AF_INET, int) - PSI_CONST(AF_INET6, int) - PSI_CONST(AF_UNIX, int) - PSI_CONST(AF_UNSPEC, int) - PSI_CONST(MSG_CTRUNC, int) - PSI_CONST(MSG_DONTROUTE, int) - PSI_CONST(MSG_EOR, int) - PSI_CONST(MSG_NOSIGNAL, int) - PSI_CONST(MSG_OOB, int) - PSI_CONST(MSG_PEEK, int) - PSI_CONST(MSG_TRUNC, int) - PSI_CONST(MSG_WAITALL, int) - PSI_CONST(SCM_RIGHTS, int) - PSI_CONST(SHUT_RD, int) - PSI_CONST(SHUT_RDWR, int) - PSI_CONST(SHUT_WR, int) - PSI_CONST(SOCK_DGRAM, int) - PSI_CONST(SOCK_RAW, int) - PSI_CONST(SOCK_SEQPACKET, int) - PSI_CONST(SOCK_STREAM, int) - PSI_CONST(SOL_SOCKET, int) - PSI_CONST(SO_ACCEPTCONN, int) - PSI_CONST(SO_BROADCAST, int) - PSI_CONST(SO_DEBUG, int) - PSI_CONST(SO_DONTROUTE, int) - PSI_CONST(SO_ERROR, int) - PSI_CONST(SO_KEEPALIVE, int) - PSI_CONST(SO_LINGER, int) - PSI_CONST(SO_OOBINLINE, int) - PSI_CONST(SO_RCVBUF, int) - PSI_CONST(SO_RCVLOWAT, int) - PSI_CONST(SO_RCVTIMEO, int) - PSI_CONST(SO_REUSEADDR, int) - PSI_CONST(SO_SNDBUF, int) - PSI_CONST(SO_SNDLOWAT, int) - PSI_CONST(SO_SNDTIMEO, int) - PSI_CONST(SO_TYPE, int) - - PSI_MACRO(unsigned char *CMSG_DATA, [(struct cmsghdr *m)]) - PSI_MACRO(struct cmsghdr *CMSG_NXTHDR, [(struct msghdr *m, struct cmsghdr *c)]) - PSI_MACRO(struct cmsghdr *CMSG_FIRSTHDR, [(struct msghdr *m)]) - - PSI_DECL(int accept, [(int socket, struct sockaddr *address, socklen_t *address_len)]) - PSI_DECL(int bind, [(int socket, struct sockaddr *address, socklen_t address_len)]) - PSI_DECL(int connect, [(int socket, struct sockaddr *address, socklen_t address_len)]) - PSI_DECL(int getpeername, [(int socket, struct sockaddr *address, socklen_t *address_len)]) - PSI_DECL(int getsockname, [(int socket, struct sockaddr *address, socklen_t *address_len)]) - PSI_DECL(int getsockopt, [(int socket, int level, int option_name, void *option_value, socklen_t *option_len)]) - PSI_DECL(int listen, [(int socket, int backlog)]) - PSI_DECL(int recv, [(int socket, void *buffer, size_t length, int flags)]) - PSI_DECL(int recvfrom, [(int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len)]) - PSI_DECL(int recvmsg, [(int socket, struct msghdr *message, int flags)]) - PSI_DECL(int send, [(int socket, void *buffer, size_t length, int flags)]) - PSI_DECL(int sendmsg, [(int socket, struct msghdr *message, int flags)]) - PSI_DECL(int sendto, [(int socket, void *message, size_t length, int flags, struct sockaddr *dest_addr, socklen_t dest_len)]) - PSI_DECL(int setsockopt, [(int socket, int level, int option_name, void *option_value, socklen_t option_len)]) - PSI_DECL(int shutdown, [(int socket, int how)]) - PSI_DECL(int sockatmark, [(int socket)]) - PSI_DECL(int socket, [(int domain, int type, int protocol)]) - PSI_DECL(int socketpair, [(int domain, int type, int protocol, int socket_vector@<:@2@:>@)]) -} diff --git a/m4/sys_stat.m4 b/m4/sys_stat.m4 deleted file mode 100644 index fb44945..0000000 --- a/m4/sys_stat.m4 +++ /dev/null @@ -1,85 +0,0 @@ -PSI_CHECK_SYS_STAT() { - PSI_CONFIG_POSIX(sys/stat, sys/stat.h) - - PSI_STRUCT(struct stat, [ - dev_t st_dev, - ino_t st_ino, - mode_t st_mode, - nlink_t st_nlink, - uid_t st_uid, - gid_t st_gid, - dev_t st_rdev, - off_t st_size, - blksize_t st_blksize, - blkcnt_t st_blocks, - time_t st_atime, - time_t st_mtime, - time_t st_ctime, - struct timespec st_atim, - struct timespec st_mtim, - struct timespec st_ctim, - struct timespec st_atimespec, - struct timespec st_mtimespec, - struct timespec st_ctimespec, - struct timespec st_birthtimespec, - time_t st_birthtime, - int st_flags, - int st_gen] - ) - - PSI_CONST(S_IFMT, int) - PSI_CONST(S_IFBLK, int) - PSI_CONST(S_IFCHR, int) - PSI_CONST(S_IFIFO, int) - PSI_CONST(S_IFREG, int) - PSI_CONST(S_IFDIR, int) - PSI_CONST(S_IFLNK, int) - PSI_CONST(S_IFSOCK, int) - PSI_CONST(S_IRWXU, int) - PSI_CONST(S_IRUSR, int) - PSI_CONST(S_IWUSR, int) - PSI_CONST(S_IXUSR, int) - PSI_CONST(S_IRWXG, int) - PSI_CONST(S_IRGRP, int) - PSI_CONST(S_IWGRP, int) - PSI_CONST(S_IXGRP, int) - PSI_CONST(S_IRWXO, int) - PSI_CONST(S_IROTH, int) - PSI_CONST(S_IWOTH, int) - PSI_CONST(S_IXOTH, int) - PSI_CONST(S_ISUID, int) - PSI_CONST(S_ISGID, int) - PSI_CONST(S_ISVTX, int) - PSI_CONST(UTIME_NOW, int) - PSI_CONST(UTIME_OMIT, int) - - PSI_MACRO(int S_ISBLK, [(mode_t m)]) - PSI_MACRO(int S_ISCHR, [(mode_t m)]) - PSI_MACRO(int S_ISDIR, [(mode_t m)]) - PSI_MACRO(int S_ISFIFO, [(mode_t m)]) - PSI_MACRO(int S_ISREG, [(mode_t m)]) - PSI_MACRO(int S_ISLNK, [(mode_t m)]) - PSI_MACRO(int S_ISSOCK, [(mode_t m)]) - - PSI_MACRO(int S_TYPEISMQ, [(struct stat *s)]) - PSI_MACRO(int S_TYPEISSEM, [(struct stat *s)]) - PSI_MACRO(int S_TYPEISSHM, [(struct stat *s)]) - PSI_MACRO(int S_TYPEISTMO, [(struct stat *s)]) - - PSI_DECL(int chmod, [(char *path, mode_t mode)]) - PSI_DECL(int fchmod, [(int fd, mode_t mode)]) - PSI_DECL(int fchmodat, [(int fd, char *path, mode_t mode, int flag)]) - PSI_DECL(int fstat, [(int fd, struct stat *buf)]) - PSI_DECL(int fstatat, [(int fd, char *path, struct stat *buf, int flag)]) - PSI_DECL(int futimens, [(int fd, struct timespec times@<:@2@:>@)]) - PSI_DECL(int lstat, [(char *path, struct stat *buf)]) - PSI_DECL(int mkdir, [(char *path, mode_t mode)]) - PSI_DECL(int mkdirat, [(int fd, char *path, mode_t mode)]) - PSI_DECL(int mkfifo, [(char *path, mode_t mode)]) - PSI_DECL(int mkfifoat, [(int fd, char *path, mode_t mode)]) - PSI_DECL(int mknod, [(char *path, mode_t mode, dev_t dev)]) - PSI_DECL(int mknodat, [(int fd, char *path, mode_t mode, dev_t dev)]) - PSI_DECL(int stat, [(char *path, struct stat *buf)]) - PSI_DECL(mode_t umask, [(mode_t mode)]) - PSI_DECL(int utimensat, [(int fd, char *path, struct timespec times@<:@2@:>@, int flag)]) -} diff --git a/m4/sys_time.m4 b/m4/sys_time.m4 deleted file mode 100644 index 9c1f744..0000000 --- a/m4/sys_time.m4 +++ /dev/null @@ -1,26 +0,0 @@ -PSI_CHECK_SYS_TIME() { - PSI_CONFIG_POSIX(sys/time, sys/time.h) - - PSI_CONST(ITIMER_REAL, int) - PSI_CONST(ITIMER_VIRTUAL, int) - PSI_CONST(ITIMER_PROF, int) - - PSI_STRUCT(struct timeval, [ - time_t tv_sec, - suseconds_t tv_usec] - ) - PSI_STRUCT(struct itimerval, [ - struct timeval it_interval, - struct timeval it_value] - ) - PSI_STRUCT(struct timezone, [ - int tz_minuteswest, - int tz_dsttime] - ) - - PSI_DECL(int getitimer, [(int which, struct itimerval *value)]) - PSI_DECL(int setitimer, [(int which, struct itimerval *value, struct itimerval *ovalue)]) - PSI_DECL(int gettimeofday, [(struct timeval *tp, struct timezone *tz)]) - PSI_DECL(int utimes, [(char *path, struct timeval times@<:@2@:>@)]) - PSI_DECL(int utimensat, [(int fd, char *path, struct timespec times@<:@2@:>@)]) -} diff --git a/m4/sys_times.m4 b/m4/sys_times.m4 deleted file mode 100644 index 3301070..0000000 --- a/m4/sys_times.m4 +++ /dev/null @@ -1,12 +0,0 @@ -PSI_CHECK_SYS_TIMES() { - PSI_CONFIG_POSIX(sys/times, sys/times.h) - - PSI_STRUCT(struct tms, [ - clock_t tms_utime, - clock_t tms_stime, - clock_t tms_cutime, - clock_t tms_cstime] - ) - - PSI_DECL(clock_t times, [(struct tms *buf)]) -} diff --git a/m4/sys_types.m4 b/m4/sys_types.m4 deleted file mode 100644 index 88315df..0000000 --- a/m4/sys_types.m4 +++ /dev/null @@ -1,24 +0,0 @@ -PSI_CHECK_SYS_TYPES() { - AC_CHECK_HEADERS(sys/types.h) - - PSI_TYPE(blkcnt_t, int) - PSI_TYPE(blksize_t, int) - PSI_TYPE(clock_t, int) - PSI_TYPE(clockid_t, int) - PSI_TYPE(dev_t, int) - PSI_TYPE(fsblkcnt_t, uint) - PSI_TYPE(fsfilcnt_t, uint) - PSI_TYPE(gid_t, int) - PSI_TYPE(id_t, int) - PSI_TYPE(ino_t, uint) - PSI_TYPE(key_t, int) - PSI_TYPE(mode_t, int) - PSI_TYPE(nlink_t, int) - PSI_TYPE(off_t, int) - PSI_TYPE(pid_t, int) - PSI_TYPE(ssize_t, int) - PSI_TYPE(suseconds_t, int) - PSI_TYPE(time_t, int) - PSI_TYPE(timer_t, int) - PSI_TYPE(uid_t, int) -} diff --git a/m4/sys_uio.m4 b/m4/sys_uio.m4 deleted file mode 100644 index 7cd4c3c..0000000 --- a/m4/sys_uio.m4 +++ /dev/null @@ -1,11 +0,0 @@ -PSI_CHECK_SYS_UIO() { - PSI_CONFIG_POSIX(sys/uio, sys/uio.h) - - PSI_STRUCT(struct iovec, [ - void *iov_base, - size_t iov_len] - ) - - PSI_DECL(ssize_t readv, [(int fd, struct iovec *iov, int iovcnt)]) - PSI_DECL(ssize_t writev, [(int fd, struct iovec *iov, int iovcnt)]) -} diff --git a/m4/sys_utsname.m4 b/m4/sys_utsname.m4 deleted file mode 100644 index 36f49d3..0000000 --- a/m4/sys_utsname.m4 +++ /dev/null @@ -1,14 +0,0 @@ -PSI_CHECK_SYS_UTSNAME() { - PSI_CONFIG_POSIX(sys/utsname, sys/utsname.h) - - PSI_STRUCT(struct utsname, [ - char sysname@<:@0@:>@, - char nodename@<:@0@:>@, - char release@<:@0@:>@, - char version@<:@0@:>@, - char machine@<:@0@:>@, - char domainname@<:@0@:>@ - ]) - - PSI_DECL(int uname, [(struct utsname *name)]) -} diff --git a/m4/syslog.m4 b/m4/syslog.m4 deleted file mode 100644 index 3547f75..0000000 --- a/m4/syslog.m4 +++ /dev/null @@ -1,42 +0,0 @@ -PSI_CHECK_SYSLOG() { - PSI_CONFIG_POSIX(syslog, syslog.h) - - PSI_CONST(LOG_PID, int) - PSI_CONST(LOG_CONS, int) - PSI_CONST(LOG_NDELAY, int) - PSI_CONST(LOG_ODELAY, int) - PSI_CONST(LOG_NOWAIT, int) - PSI_CONST(LOG_KERN, int) - PSI_CONST(LOG_USER, int) - PSI_CONST(LOG_MAIL, int) - PSI_CONST(LOG_NEWS, int) - PSI_CONST(LOG_UUCP, int) - PSI_CONST(LOG_DAEMON, int) - PSI_CONST(LOG_AUTH, int) - PSI_CONST(LOG_CRON, int) - PSI_CONST(LOG_LPR, int) - PSI_CONST(LOG_LOCAL0, int) - PSI_CONST(LOG_LOCAL1, int) - PSI_CONST(LOG_LOCAL2, int) - PSI_CONST(LOG_LOCAL3, int) - PSI_CONST(LOG_LOCAL4, int) - PSI_CONST(LOG_LOCAL5, int) - PSI_CONST(LOG_LOCAL6, int) - PSI_CONST(LOG_LOCAL7, int) - PSI_CONST(LOG_EMERG, int) - PSI_CONST(LOG_ALERT, int) - PSI_CONST(LOG_CRIT, int) - PSI_CONST(LOG_ERR, int) - PSI_CONST(LOG_WARNING, int) - PSI_CONST(LOG_NOTICE, int) - PSI_CONST(LOG_INFO, int) - PSI_CONST(LOG_DEBUG, int) - - PSI_MACRO(int LOG_MASK, [(int pri)]) - PSI_MACRO(int LOG_UPTO, [(int pri)]) - - PSI_DECL(void closelog, [(void)]) - PSI_DECL(void openlog, [(char *ident, int option, int facility)]) - PSI_DECL(void syslog, [(int priority, char *format)], vararg) - PSI_DECL(int setlogmask, [(int mask)]) -} diff --git a/m4/time.m4 b/m4/time.m4 deleted file mode 100644 index e1b4011..0000000 --- a/m4/time.m4 +++ /dev/null @@ -1,63 +0,0 @@ -PSI_CHECK_TIME() { - PSI_CONFIG_POSIX(time, time.h) - - PSI_CONST(CLOCKS_PER_SEC, int) - PSI_CONST(CLOCK_MONOTONIC, int) - PSI_CONST(CLOCK_PROCESS_CPUTIME_ID, int) - PSI_CONST(CLOCK_REALTIME, int) - PSI_CONST(CLOCK_THREAD_CPUTIME_ID, int) - PSI_CONST(TIMER_ABSTIME, int) - - PSI_STRUCT(struct tm, [ - int tm_sec, - int tm_min, - int tm_hour, - int tm_mday, - int tm_mon, - int tm_year, - int tm_wday, - int tm_yday, - int tm_isdst] - ) - PSI_STRUCT(struct timespec, [ - time_t tv_sec, - long tv_nsec] - ) - PSI_STRUCT(struct itimerspec, [ - struct timespec it_interval, - struct timespec it_value] - ) - - PSI_DECL(char *asctime, [(struct tm *tm)]) - PSI_DECL(char *asctime_r, [(struct tm *tm, char *buf)]) - PSI_DECL(clock_t clock, [()]) - PSI_DECL(int clock_getcpuclockid, [(pid_t pid, clockid_t *clock_id)]) - PSI_DECL(int clock_getres, [(clockid_t clk_id, struct timespec *res)]) - PSI_DECL(int clock_gettime, [(clockid_t clk_id, struct timespec *tp)]) - PSI_DECL(int clock_nanosleep, [(clockid_t clk_id, int flags, struct timespec *rqtp, struct timespec *rmtp)]) - PSI_DECL(int clock_settime, [(clockid_t clk_id, struct timespec *tp)]) - PSI_DECL(char *ctime, [(time_t *t)]) - PSI_DECL(char *ctime_r, [(time_t *t, char *buf)]) - PSI_DECL(double difftime, [(time_t time1, time_t time0)]) - PSI_DECL(struct tm *getdate, [(char *string)]) - PSI_DECL(struct tm *gmtime, [(time_t *t)]) - PSI_DECL(struct tm *gmtime_r, [(time_t *t, struct tm *buf)]) - PSI_DECL(struct tm *localtime, [(time_t *t)]) - PSI_DECL(struct tm *localtime_r, [(time_t *t, struct tm *buf)]) - PSI_DECL(time_t mktime, [(struct tm *tm)]) - PSI_DECL(int nanosleep, [(struct timespec *rqts, struct timespec *rmts)]) - PSI_DECL(size_t strftime, [(char *s, size_t max, char *fmt, struct tm *tm)]) - dnl PSI_DECL(size_t strftime_l, [(char *s, size_t max, char *fmt, struct tm *tm, locale_t l)]) - PSI_DECL(char *strptime, [(char *s, char *fmt, struct tm *tm)]) - PSI_DECL(time_t time, [(time_t *t)]) - dnl PSI_DECL(int timer_create, [(clockid_t clk_id, struct sigevent *se, timer_t *t)]) - PSI_DECL(int timer_delete, [(timer_t t)]) - PSI_DECL(int timer_getoverrun, [(timer_t t)]) - PSI_DECL(int timer_gettime, [(timer_t t, struct itimerspec *ts)]) - PSI_DECL(int timer_settime, [(timer_t t, int flags, struct itimerspec *value, struct itimerspec *ovalue)]) - PSI_DECL(void tzset, [()]) - - PSI_EXTVAR(int daylight) - PSI_EXTVAR(long timezone) - PSI_EXTVAR(char **tzname) -} diff --git a/m4/unistd.m4 b/m4/unistd.m4 deleted file mode 100644 index 2126500..0000000 --- a/m4/unistd.m4 +++ /dev/null @@ -1,378 +0,0 @@ -PSI_CHECK_UNISTD() { - PSI_CONFIG_POSIX(unistd, unistd.h) - - PSI_CONST(F_LOCK, int) - PSI_CONST(F_TEST, int) - PSI_CONST(F_TLOCK, int) - PSI_CONST(F_ULOCK, int) - PSI_CONST(F_OK, int) - PSI_CONST(R_OK, int) - PSI_CONST(W_OK, int) - PSI_CONST(X_OK, int) - PSI_CONST(STDERR_FILENO, int) - PSI_CONST(STDIN_FILENO, int) - PSI_CONST(STDOUT_FILENO, int) - PSI_CONST(_CS_PATH, int) - PSI_CONST(_CS_POSIX_V6_ILP32_OFF32_CFLAGS, int) - PSI_CONST(_CS_POSIX_V6_ILP32_OFF32_LDFLAGS, int) - PSI_CONST(_CS_POSIX_V6_ILP32_OFF32_LIBS, int) - PSI_CONST(_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, int) - PSI_CONST(_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, int) - PSI_CONST(_CS_POSIX_V6_ILP32_OFFBIG_LIBS, int) - PSI_CONST(_CS_POSIX_V6_LP64_OFF64_CFLAGS, int) - PSI_CONST(_CS_POSIX_V6_LP64_OFF64_LDFLAGS, int) - PSI_CONST(_CS_POSIX_V6_LP64_OFF64_LIBS, int) - PSI_CONST(_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, int) - PSI_CONST(_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, int) - PSI_CONST(_CS_POSIX_V6_LPBIG_OFFBIG_LIBS, int) - PSI_CONST(_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS, int) - PSI_CONST(_CS_POSIX_V7_ILP32_OFF32_CFLAGS, int) - PSI_CONST(_CS_POSIX_V7_ILP32_OFF32_LDFLAGS, int) - PSI_CONST(_CS_POSIX_V7_ILP32_OFF32_LIBS, int) - PSI_CONST(_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, int) - PSI_CONST(_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, int) - PSI_CONST(_CS_POSIX_V7_ILP32_OFFBIG_LIBS, int) - PSI_CONST(_CS_POSIX_V7_LP64_OFF64_CFLAGS, int) - PSI_CONST(_CS_POSIX_V7_LP64_OFF64_LDFLAGS, int) - PSI_CONST(_CS_POSIX_V7_LP64_OFF64_LIBS, int) - PSI_CONST(_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, int) - PSI_CONST(_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, int) - PSI_CONST(_CS_POSIX_V7_LPBIG_OFFBIG_LIBS, int) - PSI_CONST(_CS_POSIX_V7_THREADS_CFLAGS, int) - PSI_CONST(_CS_POSIX_V7_THREADS_LDFLAGS, int) - PSI_CONST(_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS, int) - PSI_CONST(_CS_V6_ENV, int) - PSI_CONST(_CS_V7_ENV, int) - PSI_CONST(_PC_2_SYMLINKS, int) - PSI_CONST(_PC_ALLOC_SIZE_MIN, int) - PSI_CONST(_PC_ASYNC_IO, int) - PSI_CONST(_PC_CHOWN_RESTRICTED, int) - PSI_CONST(_PC_FILESIZEBITS, int) - PSI_CONST(_PC_LINK_MAX, int) - PSI_CONST(_PC_MAX_CANON, int) - PSI_CONST(_PC_MAX_INPUT, int) - PSI_CONST(_PC_NAME_MAX, int) - PSI_CONST(_PC_NO_TRUNC, int) - PSI_CONST(_PC_PATH_MAX, int) - PSI_CONST(_PC_PIPE_BUF, int) - PSI_CONST(_PC_PRIO_IO, int) - PSI_CONST(_PC_REC_INCR_XFER_SIZE, int) - PSI_CONST(_PC_REC_MAX_XFER_SIZE, int) - PSI_CONST(_PC_REC_MIN_XFER_SIZE, int) - PSI_CONST(_PC_REC_XFER_ALIGN, int) - PSI_CONST(_PC_SYMLINK_MAX, int) - PSI_CONST(_PC_SYNC_IO, int) - PSI_CONST(_PC_TIMESTAMP_RESOLUTION, int) - PSI_CONST(_PC_VDISABLE, int) - PSI_CONST(_POSIX2_CHAR_TERM, int) - PSI_CONST(_POSIX2_C_BIND, int) - PSI_CONST(_POSIX2_C_DEV, int) - PSI_CONST(_POSIX2_FORT_DEV, int) - PSI_CONST(_POSIX2_FORT_RUN, int) - PSI_CONST(_POSIX2_LOCALEDEF, int) - PSI_CONST(_POSIX2_PBS, int) - PSI_CONST(_POSIX2_PBS_ACCOUNTING, int) - PSI_CONST(_POSIX2_PBS_CHECKPOINT, int) - PSI_CONST(_POSIX2_PBS_LOCATE, int) - PSI_CONST(_POSIX2_PBS_MESSAGE, int) - PSI_CONST(_POSIX2_PBS_TRACK, int) - PSI_CONST(_POSIX2_SW_DEV, int) - PSI_CONST(_POSIX2_SYMLINKS, int) - PSI_CONST(_POSIX2_UPE, int) - PSI_CONST(_POSIX2_VERSION, int) - PSI_CONST(_POSIX_ADVISORY_INFO, int) - PSI_CONST(_POSIX_ASYNCHRONOUS_IO, int) - PSI_CONST(_POSIX_ASYNC_IO, int) - PSI_CONST(_POSIX_BARRIERS, int) - PSI_CONST(_POSIX_CHOWN_RESTRICTED, int) - PSI_CONST(_POSIX_CLOCK_SELECTION, int) - PSI_CONST(_POSIX_CPUTIME, int) - PSI_CONST(_POSIX_FSYNC, int) - PSI_CONST(_POSIX_IPV6, int) - PSI_CONST(_POSIX_JOB_CONTROL, int) - PSI_CONST(_POSIX_MAPPED_FILES, int) - PSI_CONST(_POSIX_MEMLOCK, int) - PSI_CONST(_POSIX_MEMLOCK_RANGE, int) - PSI_CONST(_POSIX_MEMORY_PROTECTION, int) - PSI_CONST(_POSIX_MESSAGE_PASSING, int) - PSI_CONST(_POSIX_MONOTONIC_CLOCK, int) - PSI_CONST(_POSIX_NO_TRUNC, int) - PSI_CONST(_POSIX_PRIORITIZED_IO, int) - PSI_CONST(_POSIX_PRIORITY_SCHEDULING, int) - PSI_CONST(_POSIX_PRIO_IO, int) - PSI_CONST(_POSIX_RAW_SOCKETS, int) - PSI_CONST(_POSIX_READER_WRITER_LOCKS, int) - PSI_CONST(_POSIX_REALTIME_SIGNALS, int) - PSI_CONST(_POSIX_REGEXP, int) - PSI_CONST(_POSIX_SAVED_IDS, int) - PSI_CONST(_POSIX_SEMAPHORES, int) - PSI_CONST(_POSIX_SHARED_MEMORY_OBJECTS, int) - PSI_CONST(_POSIX_SHELL, int) - PSI_CONST(_POSIX_SPAWN, int) - PSI_CONST(_POSIX_SPIN_LOCKS, int) - PSI_CONST(_POSIX_SPORADIC_SERVER, int) - PSI_CONST(_POSIX_SYNCHRONIZED_IO, int) - PSI_CONST(_POSIX_SYNC_IO, int) - PSI_CONST(_POSIX_THREADS, int) - PSI_CONST(_POSIX_THREAD_ATTR_STACKADDR, int) - PSI_CONST(_POSIX_THREAD_ATTR_STACKSIZE, int) - PSI_CONST(_POSIX_THREAD_CPUTIME, int) - PSI_CONST(_POSIX_THREAD_PRIORITY_SCHEDULING, int) - PSI_CONST(_POSIX_THREAD_PRIO_INHERIT, int) - PSI_CONST(_POSIX_THREAD_PRIO_PROTECT, int) - PSI_CONST(_POSIX_THREAD_PROCESS_SHARED, int) - PSI_CONST(_POSIX_THREAD_ROBUST_PRIO_INHERIT, int) - PSI_CONST(_POSIX_THREAD_ROBUST_PRIO_PROTECT, int) - PSI_CONST(_POSIX_THREAD_SAFE_FUNCTIONS, int) - PSI_CONST(_POSIX_THREAD_SPORADIC_SERVER, int) - PSI_CONST(_POSIX_TIMEOUTS, int) - PSI_CONST(_POSIX_TIMERS, int) - PSI_CONST(_POSIX_TIMESTAMP_RESOLUTION, int) - PSI_CONST(_POSIX_TRACE, int) - PSI_CONST(_POSIX_TRACE_EVENT_FILTER, int) - PSI_CONST(_POSIX_TRACE_INHERIT, int) - PSI_CONST(_POSIX_TRACE_LOG, int) - PSI_CONST(_POSIX_TYPED_MEMORY_OBJECTS, int) - PSI_CONST(_POSIX_V6_ILP32_OFF32, int) - PSI_CONST(_POSIX_V6_ILP32_OFFBIG, int) - PSI_CONST(_POSIX_V6_LP64_OFF64, int) - PSI_CONST(_POSIX_V6_LPBIG_OFFBIG, int) - PSI_CONST(_POSIX_V7_ILP32_OFF32, int) - PSI_CONST(_POSIX_V7_ILP32_OFFBIG, int) - PSI_CONST(_POSIX_V7_LP64_OFF64, int) - PSI_CONST(_POSIX_V7_LPBIG_OFFBIG, int) - PSI_CONST(_POSIX_VDISABLE, int) - PSI_CONST(_POSIX_VERSION, int) - PSI_CONST(_SC_2_CHAR_TERM, int) - PSI_CONST(_SC_2_C_BIND, int) - PSI_CONST(_SC_2_C_DEV, int) - PSI_CONST(_SC_2_FORT_DEV, int) - PSI_CONST(_SC_2_FORT_RUN, int) - PSI_CONST(_SC_2_LOCALEDEF, int) - PSI_CONST(_SC_2_PBS, int) - PSI_CONST(_SC_2_PBS_ACCOUNTING, int) - PSI_CONST(_SC_2_PBS_CHECKPOINT, int) - PSI_CONST(_SC_2_PBS_LOCATE, int) - PSI_CONST(_SC_2_PBS_MESSAGE, int) - PSI_CONST(_SC_2_PBS_TRACK, int) - PSI_CONST(_SC_2_SW_DEV, int) - PSI_CONST(_SC_2_UPE, int) - PSI_CONST(_SC_2_VERSION, int) - PSI_CONST(_SC_ADVISORY_INFO, int) - PSI_CONST(_SC_AIO_LISTIO_MAX, int) - PSI_CONST(_SC_AIO_MAX, int) - PSI_CONST(_SC_AIO_PRIO_DELTA_MAX, int) - PSI_CONST(_SC_ARG_MAX, int) - PSI_CONST(_SC_ASYNCHRONOUS_IO, int) - PSI_CONST(_SC_ATEXIT_MAX, int) - PSI_CONST(_SC_BARRIERS, int) - PSI_CONST(_SC_BC_BASE_MAX, int) - PSI_CONST(_SC_BC_DIM_MAX, int) - PSI_CONST(_SC_BC_SCALE_MAX, int) - PSI_CONST(_SC_BC_STRING_MAX, int) - PSI_CONST(_SC_CHILD_MAX, int) - PSI_CONST(_SC_CLK_TCK, int) - PSI_CONST(_SC_CLOCK_SELECTION, int) - PSI_CONST(_SC_COLL_WEIGHTS_MAX, int) - PSI_CONST(_SC_CPUTIME, int) - PSI_CONST(_SC_DELAYTIMER_MAX, int) - PSI_CONST(_SC_EXPR_NEST_MAX, int) - PSI_CONST(_SC_FSYNC, int) - PSI_CONST(_SC_GETGR_R_SIZE_MAX, int) - PSI_CONST(_SC_GETPW_R_SIZE_MAX, int) - PSI_CONST(_SC_HOST_NAME_MAX, int) - PSI_CONST(_SC_IOV_MAX, int) - PSI_CONST(_SC_IPV6, int) - PSI_CONST(_SC_JOB_CONTROL, int) - PSI_CONST(_SC_LINE_MAX, int) - PSI_CONST(_SC_LOGIN_NAME_MAX, int) - PSI_CONST(_SC_MAPPED_FILES, int) - PSI_CONST(_SC_MEMLOCK, int) - PSI_CONST(_SC_MEMLOCK_RANGE, int) - PSI_CONST(_SC_MEMORY_PROTECTION, int) - PSI_CONST(_SC_MESSAGE_PASSING, int) - PSI_CONST(_SC_MONOTONIC_CLOCK, int) - PSI_CONST(_SC_MQ_OPEN_MAX, int) - PSI_CONST(_SC_MQ_PRIO_MAX, int) - PSI_CONST(_SC_NGROUPS_MAX, int) - PSI_CONST(_SC_OPEN_MAX, int) - PSI_CONST(_SC_PAGESIZE, int) - PSI_CONST(_SC_PAGE_SIZE, int) - PSI_CONST(_SC_PRIORITIZED_IO, int) - PSI_CONST(_SC_PRIORITY_SCHEDULING, int) - PSI_CONST(_SC_RAW_SOCKETS, int) - PSI_CONST(_SC_READER_WRITER_LOCKS, int) - PSI_CONST(_SC_REALTIME_SIGNALS, int) - PSI_CONST(_SC_REGEXP, int) - PSI_CONST(_SC_RE_DUP_MAX, int) - PSI_CONST(_SC_RTSIG_MAX, int) - PSI_CONST(_SC_SAVED_IDS, int) - PSI_CONST(_SC_SEMAPHORES, int) - PSI_CONST(_SC_SEM_NSEMS_MAX, int) - PSI_CONST(_SC_SEM_VALUE_MAX, int) - PSI_CONST(_SC_SHARED_MEMORY_OBJECTS, int) - PSI_CONST(_SC_SHELL, int) - PSI_CONST(_SC_SIGQUEUE_MAX, int) - PSI_CONST(_SC_SPAWN, int) - PSI_CONST(_SC_SPIN_LOCKS, int) - PSI_CONST(_SC_SPORADIC_SERVER, int) - PSI_CONST(_SC_SS_REPL_MAX, int) - PSI_CONST(_SC_STREAM_MAX, int) - PSI_CONST(_SC_SYMLOOP_MAX, int) - PSI_CONST(_SC_SYNCHRONIZED_IO, int) - PSI_CONST(_SC_THREADS, int) - PSI_CONST(_SC_THREAD_ATTR_STACKADDR, int) - PSI_CONST(_SC_THREAD_ATTR_STACKSIZE, int) - PSI_CONST(_SC_THREAD_CPUTIME, int) - PSI_CONST(_SC_THREAD_DESTRUCTOR_ITERATIONS, int) - PSI_CONST(_SC_THREAD_KEYS_MAX, int) - PSI_CONST(_SC_THREAD_PRIORITY_SCHEDULING, int) - PSI_CONST(_SC_THREAD_PRIO_INHERIT, int) - PSI_CONST(_SC_THREAD_PRIO_PROTECT, int) - PSI_CONST(_SC_THREAD_PROCESS_SHARED, int) - PSI_CONST(_SC_THREAD_ROBUST_PRIO_INHERIT, int) - PSI_CONST(_SC_THREAD_ROBUST_PRIO_PROTECT, int) - PSI_CONST(_SC_THREAD_SAFE_FUNCTIONS, int) - PSI_CONST(_SC_THREAD_SPORADIC_SERVER, int) - PSI_CONST(_SC_THREAD_STACK_MIN, int) - PSI_CONST(_SC_THREAD_THREADS_MAX, int) - PSI_CONST(_SC_TIMEOUTS, int) - PSI_CONST(_SC_TIMERS, int) - PSI_CONST(_SC_TIMER_MAX, int) - PSI_CONST(_SC_TRACE, int) - PSI_CONST(_SC_TRACE_EVENT_FILTER, int) - PSI_CONST(_SC_TRACE_EVENT_NAME_MAX, int) - PSI_CONST(_SC_TRACE_INHERIT, int) - PSI_CONST(_SC_TRACE_LOG, int) - PSI_CONST(_SC_TRACE_NAME_MAX, int) - PSI_CONST(_SC_TRACE_SYS_MAX, int) - PSI_CONST(_SC_TRACE_USER_EVENT_MAX, int) - PSI_CONST(_SC_TTY_NAME_MAX, int) - PSI_CONST(_SC_TYPED_MEMORY_OBJECTS, int) - PSI_CONST(_SC_TZNAME_MAX, int) - PSI_CONST(_SC_V6_ILP32_OFF32, int) - PSI_CONST(_SC_V6_ILP32_OFFBIG, int) - PSI_CONST(_SC_V6_LP64_OFF64, int) - PSI_CONST(_SC_V6_LPBIG_OFFBIG, int) - PSI_CONST(_SC_V7_ILP32_OFF32, int) - PSI_CONST(_SC_V7_ILP32_OFFBIG, int) - PSI_CONST(_SC_V7_LP64_OFF64, int) - PSI_CONST(_SC_V7_LPBIG_OFFBIG, int) - PSI_CONST(_SC_VERSION, int) - PSI_CONST(_SC_XOPEN_CRYPT, int) - PSI_CONST(_SC_XOPEN_ENH_I18N, int) - PSI_CONST(_SC_XOPEN_REALTIME, int) - PSI_CONST(_SC_XOPEN_REALTIME_THREADS, int) - PSI_CONST(_SC_XOPEN_SHM, int) - PSI_CONST(_SC_XOPEN_STREAMS, int) - PSI_CONST(_SC_XOPEN_UNIX, int) - PSI_CONST(_SC_XOPEN_UUCP, int) - PSI_CONST(_SC_XOPEN_VERSION, int) - PSI_CONST(_XOPEN_CRYPT, int) - PSI_CONST(_XOPEN_ENH_I18N, int) - PSI_CONST(_XOPEN_REALTIME, int) - PSI_CONST(_XOPEN_REALTIME_THREADS, int) - PSI_CONST(_XOPEN_SHM, int) - PSI_CONST(_XOPEN_STREAMS, int) - PSI_CONST(_XOPEN_UNIX, int) - PSI_CONST(_XOPEN_UUCP, int) - PSI_CONST(_XOPEN_VERSION, int) - - PSI_EXTVAR(char *optarg) - PSI_EXTVAR(int opterr) - PSI_EXTVAR(int optind) - PSI_EXTVAR(int optopt) - - PSI_DECL(int access, [(const char *path, int amode)]) - PSI_DECL(unsigned alarm, [(unsigned seconds)]) - PSI_DECL(int chdir, [(const char *path)]) - PSI_DECL(int chown, [(const char *path, uid_t owner, gid_t group)]) - PSI_DECL(int close, [(int fildes)]) - PSI_DECL(size_t confstr, [(int name, char *buf, size_t len)]) - - AC_SEARCH_LIBS(crypt, crypt, [ - PSI_DECL(char *crypt, [(const char *key, const char *salt)]) - ]) - - PSI_DECL(int dup, [(int fildes)]) - PSI_DECL(int dup2, [(int fildes, int fildes2)]) - - AC_SEARCH_LIBS(encrypt, crypt, [ - PSI_DECL(void encrypt, [(char block@<:@64@:>@, int edflag)]) - ]) - - PSI_DECL(void _exit, [(int status)]) - PSI_DECL(int execl, [(const char *path, const char *arg)], vararg) - PSI_DECL(int execle, [(const char *path, const char *arg)], vararg) - PSI_DECL(int execlp, [(const char *file, const char *arg)], vararg) - PSI_DECL(int execv, [(const char *path, char **argv)]) - PSI_DECL(int execve, [(const char *path, char **argv, char **envp)]) - PSI_DECL(int execvp, [(const char *file, char **argv)]) - PSI_DECL(int faccessat, [(int fd, const char *path, int amode, int flag)]) - PSI_DECL(int fchdir, [(int fildes)]) - PSI_DECL(int fchown, [(int fildes, uid_t owner, gid_t group)]) - PSI_DECL(int fchownat, [(int fd, const char *path, uid_t owner, gid_t group, int flag)]) - PSI_DECL(int fdatasync, [(int fildes)]) - PSI_DECL(int fexecve, [(int fd, char **argv, char **envp)]) - PSI_DECL(pid_t fork, [(void)]) - PSI_DECL(long fpathconf, [(int fd, int name)]) - PSI_DECL(int fsync, [(int fildes)]) - PSI_DECL(int ftruncate, [(int fildes, off_t length)]) - PSI_DECL(char *getcwd, [(char *buf, size_t size)]) - PSI_DECL(gid_t getegid, [(void)]) - PSI_DECL(uid_t geteuid, [(void)]) - PSI_DECL(gid_t getgid, [(void)]) - PSI_DECL(int getgroups, [(int gidsetsize, gid_t *grouplist)]) - PSI_DECL(long gethostid, [(void)]) - PSI_DECL(int gethostname, [(char * name, size_t namelen)]) - PSI_DECL(char *getlogin, [(void)]) - PSI_DECL(int getlogin_r, [(char *buf, size_t bufsize)]) - PSI_DECL(int getopt, [(int argc, char **argv, const char *optstring)]) - PSI_DECL(pid_t getpgid, [(pid_t pid)]) - PSI_DECL(pid_t getpgrp, [(void)]) - PSI_DECL(pid_t getpid, [(void)]) - PSI_DECL(pid_t getppid, [(void)]) - PSI_DECL(pid_t getsid, [(pid_t pid)]) - PSI_DECL(uid_t getuid, [(void)]) - PSI_DECL(int isatty, [(int fd)]) - PSI_DECL(int lchown, [(const char *path, uid_t owner, gid_t group)]) - PSI_DECL(int link, [(const char *path1, const char *path2)]) - PSI_DECL(int linkat, [(int fd1, const char *path1, int fd2, const char *path2, int flag)]) - PSI_DECL(int lockf, [(int fd, int cmd, off_t len)]) - PSI_DECL(off_t lseek, [(int fildes, off_t offset, int whence)]) - PSI_DECL(int nice, [(int incr)]) - PSI_DECL(long pathconf, [(const char *path, int name)]) - PSI_DECL(int pause, [(void)]) - PSI_DECL(int pipe, [(int fildes@<:@2@:>@)]) - PSI_DECL(ssize_t pread, [(int fildes, void *buf, size_t nbyte, off_t offset)]) - PSI_DECL(ssize_t pwrite, [(int fildes, const void *buf, size_t nbyte, off_t offset)]) - PSI_DECL(ssize_t read, [(int fd, void *buf, size_t count)]) - PSI_DECL(ssize_t readlink, [(const char *path, char *buf, size_t bufsize)]) - PSI_DECL(ssize_t readlinkat, [(int fd, const char *path, char *buf, size_t bufsize)]) - PSI_DECL(int rmdir, [(const char *path)]) - PSI_DECL(int setegid, [(gid_t gid)]) - PSI_DECL(int seteuid, [(uid_t uid)]) - PSI_DECL(int setgid, [(gid_t gid)]) - PSI_DECL(int setpgid, [(pid_t pid, pid_t pgid)]) - PSI_DECL(pid_t setpgrp, [(void)]) - PSI_DECL(int setregid, [(gid_t rgid, gid_t egid)]) - PSI_DECL(int setreuid, [(uid_t ruid, uid_t euid)]) - PSI_DECL(pid_t setsid, [(void)]) - PSI_DECL(int setuid, [(uid_t uid)]) - PSI_DECL(unsigned sleep, [(unsigned seconds)]) - PSI_DECL(void swab, [(const void *from, void *to, ssize_t n)]) - PSI_DECL(int symlink, [(const char *path1, const char *path2)]) - PSI_DECL(int symlinkat, [(const char *path1, int fd, const char *path2)]) - PSI_DECL(void sync, [(void)]) - PSI_DECL(long sysconf, [(int name)]) - PSI_DECL(pid_t tcgetpgrp, [(int fd)]) - PSI_DECL(int tcsetpgrp, [(int fd, pid_t pgrp)]) - PSI_DECL(int truncate, [(const char *path, off_t length)]) - PSI_DECL(char *ttyname, [(int fd)]) - PSI_DECL(int ttyname_r, [(int fd, char *buf, size_t buflen)]) - PSI_DECL(int unlink, [(const char *path)]) - PSI_DECL(int unlinkat, [(int fd, const char *path, int flag)]) - PSI_DECL(ssize_t write, [(int fildes, const void *buf, size_t nbyte)]) - - -} \ No newline at end of file diff --git a/m4/wchar.m4 b/m4/wchar.m4 deleted file mode 100644 index f1a7026..0000000 --- a/m4/wchar.m4 +++ /dev/null @@ -1,79 +0,0 @@ -PSI_CHECK_WCHAR() { - PSI_CONFIG_POSIX(wchar, wchar.h) - - PSI_TYPE(wint_t, int) - PSI_STRUCT(mbstate_t) - - PSI_CONST(WINT_MIN, int) - PSI_CONST(WINT_MAX, int) - PSI_CONST(WEOF, int) - - PSI_DECL(wint_t btowc, [(int c)]) - PSI_DECL(wint_t fgetwc, [(FILE *stream)]) - PSI_DECL(wchar_t *fgetws, [(wchar_t *ws, int n, FILE *stream)]) - PSI_DECL(wint_t fputwc, [(wchar_t c, FILE *stream)]) - PSI_DECL(int fputws, [(const wchar_t *ws, FILE *stream)]) - PSI_DECL(int fwide, [(FILE *stream, int mode)]) - PSI_DECL(int fwprintf, [(FILE *stream, const wchar_t *format)], vararg) - PSI_DECL(int fwscanf, [(FILE *stream, const wchar_t *format)], vararg) - PSI_DECL(wint_t getwc, [(FILE *stream)]) - PSI_DECL(wint_t getwchar, [(void)]) - PSI_DECL(size_t mbrlen, [(const char *s, size_t n, mbstate_t *ps)]) - PSI_DECL(size_t mbrtowc, [(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)]) - PSI_DECL(int mbsinit, [(const mbstate_t *ps)]) - PSI_DECL(size_t mbsnrtowcs, [(wchar_t *dst, const char **src, size_t nms, size_t len, mbstate_t *ps)]) - PSI_DECL(size_t mbsrtowcs, [(wchar_t *dst, const char **src, size_t len, mbstate_t *ps)]) - PSI_DECL(FILE *open_wmemstream, [(wchar_t **ptr, size_t *size)]) - PSI_DECL(wint_t putwc, [(wchar_t wc, FILE *stream)]) - PSI_DECL(wint_t putwchar, [(wchar_t wc)]) - PSI_DECL(int swprintf, [(wchar_t *wcs, size_t maxlen, const wchar_t *format)], vararg) - PSI_DECL(int swscanf, [(const wchar_t *ws, const wchar_t *format)], vararg) - PSI_DECL(wint_t ungetwc, [(wint_t wc, FILE *stream)]) - PSI_DECL(wchar_t *wcpcpy, [(wchar_t *dest, const wchar_t *src)]) - PSI_DECL(wchar_t *wcpncpy, [(wchar_t *dest, const wchar_t *src, size_t n)]) - PSI_DECL(size_t wcrtomb, [(char *s, wchar_t wc, mbstate_t *ps)]) - PSI_DECL(int wcscasecmp, [(const wchar_t *s1, const wchar_t *s2)]) - PSI_DECL(int wcscasecmp_l, [(const wchar_t *s1, const wchar_t *s2, locale_t loc)]) - PSI_DECL(wchar_t *wcscat, [(wchar_t *dest, const wchar_t *src)]) - PSI_DECL(wchar_t *wcschr, [(const wchar_t *wcs, wchar_t wc)]) - PSI_DECL(int wcscmp, [(const wchar_t *s1, const wchar_t *s2)]) - PSI_DECL(int wcscoll, [(const wchar_t *s1, const wchar_t *s2)]) - PSI_DECL(int wcscoll_l, [(const wchar_t *s1, const wchar_t *s2, locale_t loc)]) - PSI_DECL(wchar_t *wcscpy, [(wchar_t *dest, const wchar_t *src)]) - PSI_DECL(size_t wcscspn, [(const wchar_t *wcs, const wchar_t *reject)]) - PSI_DECL(wchar_t *wcsdup, [(const wchar_t *s)]) - PSI_DECL(size_t wcsftime, [(wchar_t *wcs, size_t maxsize, const wchar_t *format, const struct tm *timeptr)]) - PSI_DECL(size_t wcslen, [(const wchar_t *s)]) - PSI_DECL(int wcsncasecmp, [(const wchar_t *s1, const wchar_t *s2, size_t n)]) - PSI_DECL(int wcsncasecmp_l, [(const wchar_t *s1, const wchar_t *s2, size_t n, locale_t loc)]) - PSI_DECL(wchar_t *wcsncat, [(wchar_t *dest, const wchar_t *src, size_t n)]) - PSI_DECL(int wcsncmp, [(const wchar_t *s1, const wchar_t *s2, size_t n)]) - PSI_DECL(wchar_t *wcsncpy, [(wchar_t *dest, const wchar_t *src, size_t n)]) - PSI_DECL(size_t wcsnlen, [(const wchar_t *s, size_t maxlen)]) - PSI_DECL(size_t wcsnrtombs, [(char *dest, const wchar_t **src, size_t nwc, size_t len, mbstate_t *ps)]) - PSI_DECL(wchar_t *wcspbrk, [(const wchar_t *wcs, const wchar_t *accept)]) - PSI_DECL(wchar_t *wcsrchr, [(const wchar_t *wcs, wchar_t wc)]) - PSI_DECL(size_t wcsrtombs, [(char *dest, const wchar_t **src, size_t n, mbstate_t *ps)]) - PSI_DECL(size_t wcsspn, [(const wchar_t *wcs, const wchar_t *accept)]) - PSI_DECL(wchar_t *wcsstr, [(const wchar_t *haystack, const wchar_t *needle)]) - PSI_DECL(double wcstod, [(const wchar_t *nptr, wchar_t **endptr)]) - PSI_DECL(float wcstof, [(const wchar_t *nptr, wchar_t **endptr)]) - PSI_DECL(wchar_t *wcstok, [(wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)]) - PSI_DECL(long wcstol, [(const wchar_t *nptr, wchar_t **endptr, int base)]) - PSI_DECL(long double wcstold, [(const wchar_t *nptr, wchar_t **endptr)]) - PSI_DECL(long long wcstoll, [(const wchar_t *nptr, wchar_t **endptr, int base)]) - PSI_DECL(unsigned long wcstoul, [(const wchar_t *nptr, wchar_t **endptr, int base)]) - PSI_DECL(unsigned long long wcstoull, [(const wchar_t *nptr, wchar_t **endptr, int base)]) - PSI_DECL(int wcswidth, [(const wchar_t *s, size_t n)]) - PSI_DECL(size_t wcsxfrm, [(wchar_t *ws1, const wchar_t *ws2, size_t n)]) - PSI_DECL(size_t wcsxfrm_l, [(wchar_t *ws1, const wchar_t *ws2, size_t n, locale_t loc)]) - PSI_DECL(int wctob, [(wint_t c)]) - PSI_DECL(int wcwidth, [(wchar_t c)]) - PSI_DECL(wchar_t *wmemchr, [(const wchar_t *s, wchar_t c, size_t n)]) - PSI_DECL(int wmemcmp, [(const wchar_t *s1, const wchar_t *s2, size_t n)]) - PSI_DECL(wchar_t *wmemcpy, [(wchar_t *dest, const wchar_t *src, size_t n)]) - PSI_DECL(wchar_t *wmemmove, [(wchar_t *dest, const wchar_t *src, size_t n)]) - PSI_DECL(wchar_t *wmemset, [(wchar_t *wcs, wchar_t wc, size_t n)]) - PSI_DECL(int wprintf, [(const wchar_t *format)], vararg) - PSI_DECL(int wscanf, [(const wchar_t *format)], vararg) -} diff --git a/m4/wctype.m4 b/m4/wctype.m4 deleted file mode 100644 index 319dada..0000000 --- a/m4/wctype.m4 +++ /dev/null @@ -1,42 +0,0 @@ -PSI_CHECK_WCTYPE() { - PSI_CONFIG_POSIX(wctype, wctype.h) - - PSI_TYPE(wctype_t, int) - PSI_TYPE(wctrans_t, int) - - PSI_DECL(int iswalnum, [(wint_t wc)]) - PSI_DECL(int iswalpha, [(wint_t wc)]) - PSI_DECL(int iswcntrl, [(wint_t wc)]) - PSI_DECL(int iswctype, [(wint_t wc, wctype_t class)]) - PSI_DECL(int iswdigit, [(wint_t wc)]) - PSI_DECL(int iswgraph, [(wint_t wc)]) - PSI_DECL(int iswlower, [(wint_t wc)]) - PSI_DECL(int iswprint, [(wint_t wc)]) - PSI_DECL(int iswpunct, [(wint_t wc)]) - PSI_DECL(int iswspace, [(wint_t wc)]) - PSI_DECL(int iswupper, [(wint_t wc)]) - PSI_DECL(int iswxdigit, [(wint_t wc)]) - PSI_DECL(wint_t towlower, [(wint_t wc)]) - PSI_DECL(wint_t towupper, [(wint_t wc)]) - PSI_DECL(wint_t towctrans, [(wint_t wc, wctrans_t desc)]) - PSI_DECL(wctype_t wctype, [(const char *name)]) - PSI_DECL(wctrans_t wctrans, [(const char *class)]) - - PSI_DECL(int iswalnum_l, [(wint_t wc, locale_t loc)]) - PSI_DECL(int iswalpha_l, [(wint_t wc, locale_t loc)]) - PSI_DECL(int iswcntrl_l, [(wint_t wc, locale_t loc)]) - PSI_DECL(int iswctype_l, [(wint_t wc_l, wctype_t class, locale_t loc)]) - PSI_DECL(int iswdigit_l, [(wint_t wc, locale_t loc)]) - PSI_DECL(int iswgraph_l, [(wint_t wc, locale_t loc)]) - PSI_DECL(int iswlower_l, [(wint_t wc, locale_t loc)]) - PSI_DECL(int iswprint_l, [(wint_t wc, locale_t loc)]) - PSI_DECL(int iswpunct_l, [(wint_t wc, locale_t loc)]) - PSI_DECL(int iswspace_l, [(wint_t wc, locale_t loc)]) - PSI_DECL(int iswupper_l, [(wint_t wc, locale_t loc)]) - PSI_DECL(int iswxdigit_l, [(wint_t wc, locale_t loc)]) - PSI_DECL(wint_t towlower_l, [(wint_t wc, locale_t loc)]) - PSI_DECL(wint_t towupper_l, [(wint_t wc, locale_t loc)]) - PSI_DECL(wint_t towctrans_l, [(wint_t wc, wctrans_t desc, locale_t loc)]) - PSI_DECL(wctype_t wctype_l, [(const char *name, locale_t loc)]) - PSI_DECL(wctrans_t wctrans_l, [(const char *class, locale_t loc)]) -} diff --git a/psi.d/glob.psi b/psi.d/glob.psi index 72c0c76..61ada04 100644 --- a/psi.d/glob.psi +++ b/psi.d/glob.psi @@ -1,7 +1,10 @@ -function psi\glob(string $pattern, int $flags, array &$glob = NULL) : int { +function psi\glob(string $pattern, int $flags, array &$glob = NULL, callable $errfn = NULL) : int { let path = strval($pattern); let flags = intval($flags); - let err = NULL; + let err = callback intval($errfn( + to_string(errmsg), + to_int(errno) + )); let buf = &arrval($glob); return to_int(glob); set $glob = to_array(*buf, diff --git a/src/calc.c b/src/calc.c index 806685e..0e21ec5 100644 --- a/src/calc.c +++ b/src/calc.c @@ -99,12 +99,12 @@ int psi_calc_num_exp(num_exp *exp, impl_val *strct, impl_val *res) { #define PSI_CALC_OP(var) do { \ const char *fmt = "calc %" PRI##var ", %" PRI##var ": %" PRI##var "\n"; \ res->var = PSI_CALC(v1->var, v2->var); \ - if (!res->var) fprintf(stderr, fmt, v1->var, v2->var, res->var); \ + if (!res->var && (v1->var || v2->var)) fprintf(stderr, fmt, v1->var, v2->var, res->var); \ } while (0) #define PSI_CALC_OP2(vres, var1, var2) do { \ const char *fmt = "calc %" PRI##var1 ", %" PRI##var2 ": %" PRI##vres "\n"; \ res->vres = PSI_CALC(v1->var1, v2->var2); \ - if (!res->vres) fprintf(stderr, fmt, v1->var1, v2->var2, res->vres); \ + if (!res->vres && (v1->var1 || v2->var2)) fprintf(stderr, fmt, v1->var1, v2->var2, res->vres); \ } while(0) #ifdef HAVE_LONG_DOUBLE diff --git a/tests/glob/glob002.phpt b/tests/glob/glob002.phpt index 4ac964a..36edb4d 100644 --- a/tests/glob/glob002.phpt +++ b/tests/glob/glob002.phpt @@ -12,7 +12,7 @@ PHP_OS === "Linux" or die("skip - only for Linux"); 5]; -var_dump(psi\glob("*.php{,t}", psi\GLOB_BRACE|psi\GLOB_DOOFFS, $glob)); +var_dump(psi\glob("*002.php{,t}", psi\GLOB_BRACE|psi\GLOB_DOOFFS, $glob)); var_dump($glob); ?> ===DONE=== @@ -21,13 +21,13 @@ var_dump($glob); int(0) array(4) { ["gl_pathc"]=> - int(4) + int(2) ["gl_offs"]=> int(5) ["gl_flags"]=> int(%d) ["gl_pathv"]=> - array(9) { + array(7) { [0]=> string(0) "" [1]=> @@ -41,11 +41,7 @@ array(4) { [5]=> string(11) "glob002.php" [6]=> - string(12) "glob001.phpt" - [7]=> string(12) "glob002.phpt" - [8]=> - string(12) "glob003.phpt" } } ===DONE===