PHP_ARG_ENABLE(psi, whether to enable PHP System Interface support,
[ --enable-psi Enable PHP System Interface support])
-PHP_ARG_ENABLE(psi-posix, whether to pre-define POSIX decls,
-[ --enable-psi-posix=... PSI: pre-define POSIX decls], [ ], [ ])
+if test "$PHP_PSI" != no; then
+ PHP_CONFIGURE_PART(Configuring PSI)
-PHP_ARG_WITH(psi-libjit, where to find libjit,
-[ --with-psi-libjit=DIR PSI: path to libjit], [ ], [ ])
+ PHP_ARG_ENABLE(psi-posix, whether to pre-define POSIX decls,
+ [ --enable-psi-posix=... PSI: pre-define POSIX decls], [ ], [ ])
-PHP_ARG_WITH(psi-libffi, where to find libffi,
-[ --with-psi-libffi=DIR PSI: path to libffi], [ ], [ ])
+ PHP_ARG_WITH(psi-libjit, where to find libjit,
+ [ --with-psi-libjit=DIR PSI: path to libjit], [ ], [ ])
-if test "$PHP_PSI" != no; then
- PHP_CONFIGURE_PART(Configuring PSI)
+ PHP_ARG_WITH(psi-libffi, where to find libffi,
+ [ --with-psi-libffi=DIR PSI: path to libffi], [ ], [ ])
- save_LIBS=$LIBS
+ psi_save_LIBS=$LIBS
LIBS=
PSI_LEMON
PSI_CHECK_WCTYPE
PSI_CONFIG_DONE
- eval_LIBS=$LIBS
- LIBS=$save_LIBS
- PHP_EVAL_LIBLINE($eval_LIBS, PSI_SHARED_LIBADD)
+ psi_eval_LIBS=$LIBS
+ LIBS=$psi_save_LIBS
+ PHP_EVAL_LIBLINE($psi_eval_LIBS, PSI_SHARED_LIBADD)
PHP_SUBST(PSI_SHARED_LIBADD)
AC_DEFINE_UNQUOTED(PHP_PSI_SHLIB_SUFFIX, ["$SHLIB_SUFFIX_NAME"], DL suffix)
- AC_DEFINE_UNQUOTED([PSI_STDINC], [$PSI_STDINC], [Standard includes])
- AC_DEFINE_UNQUOTED([PSI_TYPES], [$PSI_TYPES], [Predefined types])
- AC_DEFINE_UNQUOTED([PSI_STRUCTS], [$PSI_STRUCTS], [Predefined structs])
- AC_DEFINE_UNQUOTED([PSI_UNIONS], [$PSI_UNIONS], [Predefined structs])
- AC_DEFINE_UNQUOTED([PSI_CONSTS], [$PSI_CONSTS], [Predefined constants])
- AC_DEFINE_UNQUOTED([PSI_MACROS], [$PSI_MACROS], [Redirected Macros])
- AC_DEFINE_UNQUOTED([PSI_REDIRS], [$PSI_REDIRS], [Redirected functions])
- AC_DEFINE_UNQUOTED([PSI_DECLS], [$PSI_DECLS], [Predefined functions])
- AC_DEFINE_UNQUOTED([PSI_VA_DECLS], [$PSI_VA_DECLS], [Predefined vararg functions])
+ AC_DEFINE_UNQUOTED([PSI_STDINC], ["$PSI_STDINC"], [Standard includes])
+ AC_DEFINE_UNQUOTED([PSI_TYPES], ["$PSI_TYPES"], [Predefined types])
+ AC_DEFINE_UNQUOTED([PSI_STRUCTS], ["$PSI_STRUCTS"], [Predefined structs])
+ AC_DEFINE_UNQUOTED([PSI_UNIONS], ["$PSI_UNIONS"], [Predefined structs])
+ AC_DEFINE_UNQUOTED([PSI_CONSTS], ["$PSI_CONSTS"], [Predefined constants])
+ AC_DEFINE_UNQUOTED([PSI_MACROS], ["$PSI_MACROS"], [Redirected Macros])
+ AC_DEFINE_UNQUOTED([PSI_REDIRS], ["$PSI_REDIRS"], [Redirected functions])
+ AC_DEFINE_UNQUOTED([PSI_DECLS], ["$PSI_DECLS"], [Predefined functions])
+ AC_DEFINE_UNQUOTED([PSI_VA_DECLS], ["$PSI_VA_DECLS"], [Predefined vararg functions])
PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src)
PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src/types)
PSI_CHECK_NDBM() {
- PSI_CONFIG_POSIX(ndbm, ndbm.h gdbm-ndbm.h)
-
- PHP_CHECK_FUNC(dbm_open, gdbm_compat)
- # See http://www.gnu.org.ua/software/gdbm/manual/html_section/gdbm_19.html
- if expr X"$LIBS" : "X.*-lgdbm_compat" >/dev/null; then
- LIBS="-lgdbm $LIBS"
- fi
+ PSI_CONFIG_POSIX(ndbm, dnl
+ ndbm.h dnl posix
+ relic.h dnl qdbm
+ gdbm-ndbm.h dnl gdbm
+ )
PSI_STRUCT(datum, [
void *dptr,
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)])
+ PSI_DECL(void dbm_clearerr, [(DBM *db)], [], [-lqdbm -lgdbm_compat])
+ PSI_DECL(void dbm_close, [(DBM *db)], [], [-lqdbm -lgdbm_compat])
+ PSI_DECL(int dbm_delete, [(DBM *db, datum key)], [], [-lqdbm -lgdbm_compat])
+ PSI_DECL(int dbm_error, [(DBM *db)], [], [-lqdbm -lgdbm_compat])
+ PSI_DECL(datum dbm_fetch, [(DBM *db, datum key)], [], [-lqdbm -lgdbm_compat])
+ PSI_DECL(datum dbm_firstkey, [(DBM *db)], [], [-lqdbm -lgdbm_compat])
+ PSI_DECL(datum dbm_nextkey, [(DBM *db)], [], [-lqdbm -lgdbm_compat])
+ PSI_DECL(DBM *dbm_open, [(char *file, int open_flags, mode_t file_mode)], [], [-lqdbm -lgdbm_compat])
+ PSI_DECL(int dbm_store, [(DBM *db, datum key, datum content, int store_mode)], [], [-lqdbm -lgdbm_compat])
+
+ # See http://www.gnu.org.ua/software/gdbm/manual/html_section/gdbm_19.html
+ if expr X"$LIBS" : "X.*-lgdbm_compat" >/dev/null; then
+ LIBS="-lgdbm $LIBS"
+ fi
}
\ No newline at end of file
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_FUNCTOR_TYPE(void sighandler_t, [(int signo)])
+ PSI_FUNCTOR_TYPE(void sigaction_t, [(int signo, siginfo_t *info, ucontext_t *context)])
PSI_STRUCT(struct sigaction, [
- sa_handler sa_handler,
+ sighandler_t sa_handler,
sigset_t sa_mask,
int sa_flags,
- sa_sigaction sa_sigaction]
+ sigaction_t sa_sigaction]
)
PSI_STRUCT(ucontext_t, [
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(sighandler_t signal, [(int sig, sighandler_t *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(sighandler_t sigset, [(int sig, sighandler_t 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(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(void setkey, [(char *key)], [], [-lcrypt])
PSI_DECL(char *setstate, [(char *state)])
PSI_DECL(void srand, [(unsigned seed)])
PSI_DECL(void srand48, [(long seed)])
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(int clock_getcpuclockid, [(pid_t pid, clockid_t *clock_id)], [], [-lrt])
+ PSI_DECL(int clock_getres, [(clockid_t clk_id, struct timespec *res)], [], [-lrt])
+ PSI_DECL(int clock_gettime, [(clockid_t clk_id, struct timespec *tp)], [], [-lrt])
+ PSI_DECL(int clock_nanosleep, [(clockid_t clk_id, int flags, struct timespec *rqtp, struct timespec *rmtp)], [], [-lrt])
+ PSI_DECL(int clock_settime, [(clockid_t clk_id, struct timespec *tp)], [], [-lrt])
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(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(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(int timer_create, [(clockid_t clk_id, struct sigevent *se, timer_t *t)], [], [-lrt])
+ PSI_DECL(int timer_delete, [(timer_t t)], [], [-lrt])
+ PSI_DECL(int timer_getoverrun, [(timer_t t)], [], [-lrt])
+ PSI_DECL(int timer_gettime, [(timer_t t, struct itimerspec *ts)], [], [-lrt])
+ PSI_DECL(int timer_settime, [(timer_t t, int flags, struct itimerspec *value, struct itimerspec *ovalue)], [], [-lrt])
PSI_DECL(void tzset, [()])
PSI_EXTVAR(int daylight)
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(char *crypt, [(const char *key, const char *salt)], [], [-lcrypt])
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 encrypt, [(char block@<:@64@:>@, int edflag)], [], [-lcrypt])
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_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, [
+AC_DEFUN(PSI_CONFIG_INIT, [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])dnl
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 <<EOF
/* generated by configure */
dnl Expands to a complete list of include statements including
dnl AC_INCLUDES_DEFAULT().
AC_DEFUN(PSI_INCLUDES, [#define PSI_INCLUDES
-#define _GNU_SOURCE 1
-#define _POSIX_C_SOURCE 200809L
-#define _XOPEN_SOURCE 700
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+#ifndef _REENTRANT
+# define _REENTRANT
+#endif
AC_INCLUDES_DEFAULT()
#ifdef HAVE_ERRNO_H
# include <errno.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
-#ifdef HAVE_NDBM_H
+#ifdef HAVE_RELIC_H
+# include <relic.h>
+#elif HAVE_NDBM_H
# include <ndbm.h>
#elif HAVE_GDBM_NDBM_H
# include <gdbm-ndbm.h>
psi_decl_args="[$psi_decl_args{]PSI_TYPE_PAIR(member_type)[, \"]member_name[\",] $pl, $as[}]"
])
-dnl PSI_DECL(type func, args, flags)
+dnl PSI_DECL(type func, args, flags, libs)
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])
+ AC_REQUIRE([PSI_FUNC_LIBC_MAIN])dnl
+
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_decl_check=
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
+ for lib in "" $4; do
+ decl_save_LIBS=$LIBS
+ LIBS=$lib
+ 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}'`
+ ])
+ LIBS=$decl_save_LIBS
+
+ if test -n "$psi_symbol_redirect"; then
+ if test -n "$lib"; then
+ psi_decl_check="$psi_symbol_redirect in $lib"
+ else
+ psi_decl_check="$psi_symbol_redirect"
+ fi
+ break
+ fi
+ done
+ [psi_cv_fn_]PSI_VAR_NAME($1)=$psi_decl_check
])
- case "$[psi_cv_fn_]PSI_VAR_NAME($1)" in
+
+ psi_symbol_redirect=`AS_ECHO("$[psi_cv_fn_]PSI_VAR_NAME($1)") | $AWK -F " in " '{print [$]1}'`
+ psi_symbol_libflag=`AS_ECHO("$[psi_cv_fn_]PSI_VAR_NAME($1)") | $AWK -F " in " '{print [$]2}'`
+
+ if test -n "$psi_symbol_libflag"; then
+ if ! expr "X$LIBS" : "X.*\b$psi_symbol_libflag\b" >/dev/null; then
+ LIBS="$psi_symbol_libflag $LIBS"
+ fi
+ fi
+
+ case "$psi_symbol_redirect" in
"$psi_symbol"|"_$psi_symbol")
case "$PHP_DEBUG-$3" in
"1-")