1999-04-17 08:37:12 +08:00
|
|
|
dnl $Id$
|
|
|
|
dnl
|
|
|
|
dnl This file contains local autoconf functions.
|
2000-03-26 10:47:00 +08:00
|
|
|
|
2000-05-01 10:42:55 +08:00
|
|
|
sinclude(dynlib.m4)
|
|
|
|
|
2001-06-15 20:53:20 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_TARGET_RDYNAMIC
|
|
|
|
dnl
|
|
|
|
dnl Checks whether -rdynamic is supported by the compiler. This
|
|
|
|
dnl is necessary for some targets to populate the global symbol
|
|
|
|
dnl table. Otherwise, dynamic modules would not be able to resolve
|
|
|
|
dnl PHP-related symbols.
|
|
|
|
dnl
|
|
|
|
dnl If successful, adds -rdynamic to PHP_LDFLAGS.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN(PHP_TARGET_RDYNAMIC,[
|
|
|
|
if test -n "$GCC"; then
|
|
|
|
dnl we should use a PHP-specific macro here
|
|
|
|
TSRM_CHECK_GCC_ARG(-rdynamic, gcc_rdynamic=yes)
|
|
|
|
if test "$gcc_rdynamic" = "yes"; then
|
|
|
|
PHP_LDFLAGS="$PHP_LDFLAGS -rdynamic"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2001-05-09 21:57:56 +08:00
|
|
|
AC_DEFUN(PHP_REMOVE_USR_LIB,[
|
2001-05-12 18:33:52 +08:00
|
|
|
unset ac_new_flags
|
2001-05-09 21:57:56 +08:00
|
|
|
for i in [$]$1; do
|
|
|
|
case [$]i in
|
|
|
|
-L/usr/lib|-L/usr/lib/) ;;
|
|
|
|
*) ac_new_flags="[$]ac_new_flags [$]i" ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
$1=[$]ac_new_flags
|
|
|
|
])
|
|
|
|
|
2000-12-15 01:29:38 +08:00
|
|
|
AC_DEFUN(PHP_SETUP_OPENSSL,[
|
|
|
|
if test "$PHP_OPENSSL" = "no"; then
|
|
|
|
PHP_OPENSSL="/usr/local/ssl /usr/local /usr /usr/local/openssl"
|
|
|
|
fi
|
|
|
|
|
|
|
|
for i in $PHP_OPENSSL; do
|
|
|
|
if test -r $i/include/openssl/evp.h; then
|
|
|
|
OPENSSL_DIR=$i
|
|
|
|
OPENSSL_INC=$i/include
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if test -z "$OPENSSL_DIR"; then
|
|
|
|
AC_MSG_ERROR(Cannot find OpenSSL's <evp.h>)
|
|
|
|
fi
|
|
|
|
|
|
|
|
old_CPPFLAGS=$CPPFLAGS
|
2001-05-12 18:33:52 +08:00
|
|
|
CPPFLAGS=-I$OPENSSL_INC
|
2000-12-15 01:29:38 +08:00
|
|
|
AC_MSG_CHECKING(for OpenSSL version)
|
|
|
|
AC_EGREP_CPP(yes,[
|
|
|
|
#include <openssl/opensslv.h>
|
2001-01-07 19:36:15 +08:00
|
|
|
#if OPENSSL_VERSION_NUMBER >= 0x0090500fL
|
2000-12-15 01:29:38 +08:00
|
|
|
yes
|
|
|
|
#endif
|
|
|
|
],[
|
2001-01-07 19:36:15 +08:00
|
|
|
AC_MSG_RESULT(>= 0.9.5)
|
2000-12-15 01:29:38 +08:00
|
|
|
],[
|
2001-01-07 19:36:15 +08:00
|
|
|
AC_MSG_ERROR(OpenSSL version 0.9.5 or greater required.)
|
2000-12-15 01:29:38 +08:00
|
|
|
])
|
|
|
|
CPPFLAGS=$old_CPPFLAGS
|
2001-01-04 02:12:06 +08:00
|
|
|
|
2001-03-28 04:35:04 +08:00
|
|
|
PHP_ADD_LIBPATH($OPENSSL_DIR/lib)
|
2001-01-04 02:12:06 +08:00
|
|
|
|
|
|
|
AC_CHECK_LIB(crypto, CRYPTO_free, [
|
2001-03-28 04:35:04 +08:00
|
|
|
PHP_ADD_LIBRARY(crypto)
|
2001-01-04 02:12:06 +08:00
|
|
|
],[
|
|
|
|
AC_MSG_ERROR(libcrypto not found!)
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_CHECK_LIB(ssl, SSL_CTX_set_ssl_version, [
|
2001-03-28 04:35:04 +08:00
|
|
|
PHP_ADD_LIBRARY(ssl)
|
2001-01-04 02:12:06 +08:00
|
|
|
],[
|
|
|
|
AC_MSG_ERROR(libssl not found!)
|
|
|
|
])
|
2001-03-28 04:35:04 +08:00
|
|
|
PHP_ADD_INCLUDE($OPENSSL_INC)
|
2000-12-15 01:29:38 +08:00
|
|
|
])
|
|
|
|
|
2000-06-17 18:50:42 +08:00
|
|
|
dnl PHP_EVAL_LIBLINE(LINE, SHARED-LIBADD)
|
|
|
|
dnl
|
|
|
|
dnl Use this macro, if you need to add libraries and or library search
|
|
|
|
dnl paths to the PHP build system which are only given in compiler
|
|
|
|
dnl notation.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN(PHP_EVAL_LIBLINE,[
|
|
|
|
for ac_i in $1; do
|
2001-05-12 19:09:05 +08:00
|
|
|
case $ac_i in
|
2000-06-17 18:50:42 +08:00
|
|
|
-l*)
|
|
|
|
ac_ii=`echo $ac_i|cut -c 3-`
|
2001-03-28 04:35:04 +08:00
|
|
|
PHP_ADD_LIBRARY($ac_ii,,$2)
|
2000-06-17 18:50:42 +08:00
|
|
|
;;
|
|
|
|
-L*)
|
|
|
|
ac_ii=`echo $ac_i|cut -c 3-`
|
2001-03-28 04:35:04 +08:00
|
|
|
PHP_ADD_LIBPATH($ac_ii,$2)
|
2000-06-17 18:50:42 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl PHP_EVAL_INCLINE(LINE)
|
|
|
|
dnl
|
|
|
|
dnl Use this macro, if you need to add header search paths to the PHP
|
|
|
|
dnl build system which are only given in compiler notation.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN(PHP_EVAL_INCLINE,[
|
|
|
|
for ac_i in $1; do
|
2001-05-12 19:09:05 +08:00
|
|
|
case $ac_i in
|
2000-06-17 18:50:42 +08:00
|
|
|
-I*)
|
|
|
|
ac_ii=`echo $ac_i|cut -c 3-`
|
2001-03-28 04:35:04 +08:00
|
|
|
PHP_ADD_INCLUDE($ac_ii)
|
2000-06-17 18:50:42 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
])
|
|
|
|
|
2000-05-24 19:06:57 +08:00
|
|
|
AC_DEFUN(PHP_READDIR_R_TYPE,[
|
2000-05-28 03:30:36 +08:00
|
|
|
dnl HAVE_READDIR_R is also defined by libmysql
|
|
|
|
AC_CHECK_FUNC(readdir_r,ac_cv_func_readdir_r=yes,ac_cv_func_readdir=no)
|
2000-05-24 19:06:57 +08:00
|
|
|
if test "$ac_cv_func_readdir_r" = "yes"; then
|
2000-05-23 23:13:16 +08:00
|
|
|
AC_CACHE_CHECK(for type of readdir_r, ac_cv_what_readdir_r,[
|
|
|
|
AC_TRY_RUN([
|
2000-05-24 19:06:57 +08:00
|
|
|
#define _REENTRANT
|
2000-05-23 23:13:16 +08:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
|
2000-10-15 08:58:29 +08:00
|
|
|
#ifndef PATH_MAX
|
|
|
|
#define PATH_MAX 1024
|
|
|
|
#endif
|
|
|
|
|
2000-05-23 23:13:16 +08:00
|
|
|
main() {
|
|
|
|
DIR *dir;
|
2000-11-03 02:24:43 +08:00
|
|
|
char entry[sizeof(struct dirent)+PATH_MAX];
|
2000-09-11 23:25:06 +08:00
|
|
|
struct dirent *pentry = (struct dirent *) &entry;
|
2000-05-23 23:13:16 +08:00
|
|
|
|
|
|
|
dir = opendir("/");
|
|
|
|
if (!dir)
|
|
|
|
exit(1);
|
2000-10-11 22:35:45 +08:00
|
|
|
if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0)
|
2000-05-23 23:13:16 +08:00
|
|
|
exit(0);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
],[
|
|
|
|
ac_cv_what_readdir_r=POSIX
|
|
|
|
],[
|
2000-05-24 19:06:57 +08:00
|
|
|
AC_TRY_CPP([
|
|
|
|
#define _REENTRANT
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
int readdir_r(DIR *, struct dirent *);
|
|
|
|
],[
|
|
|
|
ac_cv_what_readdir_r=old-style
|
|
|
|
],[
|
|
|
|
ac_cv_what_readdir_r=none
|
|
|
|
])
|
2000-05-23 23:13:16 +08:00
|
|
|
],[
|
|
|
|
ac_cv_what_readdir_r=none
|
|
|
|
])
|
|
|
|
])
|
2001-05-12 19:09:05 +08:00
|
|
|
case $ac_cv_what_readdir_r in
|
2000-05-24 19:06:57 +08:00
|
|
|
POSIX)
|
|
|
|
AC_DEFINE(HAVE_POSIX_READDIR_R,1,[whether you have POSIX readdir_r]);;
|
|
|
|
old-style)
|
|
|
|
AC_DEFINE(HAVE_OLD_READDIR_R,1,[whether you have old-style readdir_r]);;
|
|
|
|
esac
|
2000-05-23 23:13:16 +08:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2000-05-18 19:35:17 +08:00
|
|
|
AC_DEFUN(PHP_SHLIB_SUFFIX_NAME,[
|
|
|
|
PHP_SUBST(SHLIB_SUFFIX_NAME)
|
|
|
|
SHLIB_SUFFIX_NAME=so
|
2001-05-12 19:09:05 +08:00
|
|
|
case $host_alias in
|
2000-05-18 19:35:17 +08:00
|
|
|
*hpux*)
|
|
|
|
SHLIB_SUFFIX_NAME=sl
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
2000-05-18 03:08:44 +08:00
|
|
|
AC_DEFUN(PHP_DEBUG_MACRO,[
|
2001-05-12 18:33:52 +08:00
|
|
|
DEBUG_LOG=$1
|
2000-05-18 03:08:44 +08:00
|
|
|
cat >$1 <<X
|
|
|
|
CONFIGURE: $CONFIGURE_COMMAND
|
|
|
|
CC: $CC
|
|
|
|
CFLAGS: $CFLAGS
|
|
|
|
CPPFLAGS: $CPPFLAGS
|
|
|
|
CXX: $CXX
|
|
|
|
CXXFLAGS: $CXXFLAGS
|
|
|
|
INCLUDES: $INCLUDES
|
|
|
|
LDFLAGS: $LDFLAGS
|
|
|
|
LIBS: $LIBS
|
|
|
|
DLIBS: $DLIBS
|
|
|
|
SAPI: $PHP_SAPI
|
|
|
|
PHP_RPATHS: $PHP_RPATHS
|
|
|
|
uname -a: `uname -a`
|
|
|
|
|
|
|
|
X
|
|
|
|
cat >conftest.$ac_ext <<X
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
X
|
|
|
|
(eval echo \"$ac_link\"; eval $ac_link && ./conftest) >>$1 2>&1
|
|
|
|
rm -fr conftest*
|
|
|
|
])
|
2001-05-21 07:39:09 +08:00
|
|
|
|
|
|
|
AC_DEFUN(PHP_MISSING_PREAD_DECL,[
|
|
|
|
AC_CACHE_CHECK(whether pread works without custom declaration,ac_cv_pread,[
|
|
|
|
AC_TRY_COMPILE([#include <unistd.h>],[size_t (*func)() = pread],[
|
|
|
|
ac_cv_pread=yes
|
|
|
|
],[
|
|
|
|
echo test > conftest_in
|
|
|
|
AC_TRY_RUN([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
main() { char buf[3]; return !(pread(open("conftest_in", O_RDONLY), buf, 2, 0) == 2); }
|
|
|
|
],[
|
|
|
|
ac_cv_pread=yes
|
|
|
|
],[
|
|
|
|
echo test > conftest_in
|
|
|
|
AC_TRY_RUN([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
ssize_t pread(int, void *, size_t, off64_t);
|
|
|
|
main() { char buf[3]; return !(pread(open("conftest_in", O_RDONLY), buf, 2, 0) == 2); }
|
|
|
|
],[
|
|
|
|
ac_cv_pread=64
|
|
|
|
],[
|
|
|
|
ac_cv_pread=no
|
|
|
|
])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
case $ac_cv_pread in
|
|
|
|
no) ac_cv_func_pread=no;;
|
|
|
|
64) AC_DEFINE(PHP_PREAD_64, 1, [whether pread64 is default]);;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN(PHP_MISSING_PWRITE_DECL,[
|
|
|
|
AC_CACHE_CHECK(whether pwrite works without custom declaration,ac_cv_pwrite,[
|
|
|
|
AC_TRY_COMPILE([#include <unistd.h>],[size_t (*func)() = pwrite],[
|
|
|
|
ac_cv_pwrite=yes
|
|
|
|
],[
|
|
|
|
AC_TRY_RUN([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
main() { return !(pwrite(open("conftest_out", O_WRONLY|O_CREAT, 0600), "Ok", 2, 0) == 2); }
|
|
|
|
],[
|
|
|
|
ac_cv_pwrite=yes
|
|
|
|
],[
|
|
|
|
AC_TRY_RUN([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
ssize_t pwrite(int, void *, size_t, off64_t);
|
|
|
|
main() { return !(pwrite(open("conftest_out", O_WRONLY|O_CREAT, 0600), "Ok", 2, 0) == 2); }
|
|
|
|
],[
|
|
|
|
ac_cv_pwrite=64
|
|
|
|
],[
|
|
|
|
ac_cv_pwrite=no
|
|
|
|
])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
case $ac_cv_pwrite in
|
|
|
|
no) ac_cv_func_pwrite=no;;
|
|
|
|
64) AC_DEFINE(PHP_PWRITE_64, 1, [whether pwrite64 is default]);;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
2000-05-04 18:38:17 +08:00
|
|
|
AC_DEFUN(PHP_MISSING_TIME_R_DECL,[
|
|
|
|
AC_MSG_CHECKING(for missing declarations of reentrant functions)
|
|
|
|
AC_TRY_COMPILE([#include <time.h>],[struct tm *(*func)() = localtime_r],[
|
|
|
|
:
|
|
|
|
],[
|
|
|
|
AC_DEFINE(MISSING_LOCALTIME_R_DECL,1,[Whether localtime_r is declared])
|
|
|
|
])
|
|
|
|
AC_TRY_COMPILE([#include <time.h>],[struct tm *(*func)() = gmtime_r],[
|
|
|
|
:
|
|
|
|
],[
|
|
|
|
AC_DEFINE(MISSING_GMTIME_R_DECL,1,[Whether gmtime_r is declared])
|
|
|
|
])
|
|
|
|
AC_TRY_COMPILE([#include <time.h>],[char *(*func)() = asctime_r],[
|
|
|
|
:
|
|
|
|
],[
|
|
|
|
AC_DEFINE(MISSING_ASCTIME_R_DECL,1,[Whether asctime_r is declared])
|
|
|
|
])
|
|
|
|
AC_TRY_COMPILE([#include <time.h>],[char *(*func)() = ctime_r],[
|
|
|
|
:
|
|
|
|
],[
|
|
|
|
AC_DEFINE(MISSING_CTIME_R_DECL,1,[Whether ctime_r is declared])
|
|
|
|
])
|
|
|
|
AC_TRY_COMPILE([#include <string.h>],[char *(*func)() = strtok_r],[
|
|
|
|
:
|
|
|
|
],[
|
|
|
|
AC_DEFINE(MISSING_STRTOK_R_DECL,1,[Whether strtok_r is declared])
|
|
|
|
])
|
|
|
|
AC_MSG_RESULT(done)
|
|
|
|
])
|
|
|
|
|
2000-03-30 23:00:30 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_LIBGCC_LIBPATH(gcc)
|
|
|
|
dnl Stores the location of libgcc in libgcc_libpath
|
|
|
|
dnl
|
|
|
|
AC_DEFUN(PHP_LIBGCC_LIBPATH,[
|
2000-05-02 02:32:09 +08:00
|
|
|
changequote({,})
|
2001-05-12 18:33:52 +08:00
|
|
|
libgcc_libpath=`$1 --print-libgcc-file-name|sed 's%/*[^/][^/]*$%%'`
|
2000-05-02 02:32:09 +08:00
|
|
|
changequote([,])
|
2000-03-30 23:00:30 +08:00
|
|
|
])
|
|
|
|
|
2000-05-01 10:42:55 +08:00
|
|
|
AC_DEFUN(PHP_ARG_ANALYZE,[
|
2001-05-12 19:09:05 +08:00
|
|
|
case [$]$1 in
|
2000-05-01 10:42:55 +08:00
|
|
|
shared,*)
|
|
|
|
ext_output="yes, shared"
|
|
|
|
ext_shared=yes
|
2000-12-03 18:58:18 +08:00
|
|
|
$1=`echo "[$]$1"|sed 's/^shared,//'`
|
2000-05-01 10:42:55 +08:00
|
|
|
;;
|
|
|
|
shared)
|
|
|
|
ext_output="yes, shared"
|
|
|
|
ext_shared=yes
|
|
|
|
$1=yes
|
|
|
|
;;
|
|
|
|
no)
|
2001-05-12 18:33:52 +08:00
|
|
|
ext_output=no
|
2000-05-01 10:42:55 +08:00
|
|
|
ext_shared=no
|
|
|
|
;;
|
|
|
|
*)
|
2001-05-12 18:33:52 +08:00
|
|
|
ext_output=yes
|
2000-05-01 10:42:55 +08:00
|
|
|
ext_shared=no
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2000-06-08 03:13:28 +08:00
|
|
|
if test "$php_always_shared" = "yes"; then
|
2000-05-03 04:56:03 +08:00
|
|
|
ext_output="yes, shared"
|
|
|
|
ext_shared=yes
|
|
|
|
test "[$]$1" = "no" && $1=yes
|
|
|
|
fi
|
|
|
|
|
2000-05-01 10:42:55 +08:00
|
|
|
AC_MSG_RESULT($ext_output)
|
|
|
|
])
|
|
|
|
|
2000-03-30 23:00:30 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_ARG_WITH(arg-name, check message, help text[, default-val])
|
|
|
|
dnl Sets PHP_ARG_NAME either to the user value or to the default value.
|
2001-05-10 02:12:12 +08:00
|
|
|
dnl default-val defaults to no. This will also set the variable ext_shared,
|
|
|
|
dnl and will overwrite any previous variable of that name.
|
2000-03-30 23:00:30 +08:00
|
|
|
dnl
|
2000-03-28 07:33:38 +08:00
|
|
|
AC_DEFUN(PHP_ARG_WITH,[
|
2000-10-28 18:48:32 +08:00
|
|
|
PHP_REAL_ARG_WITH([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z0-9-,A-Z0-9_))
|
2000-05-01 10:42:55 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN(PHP_REAL_ARG_WITH,[
|
2000-03-28 07:33:38 +08:00
|
|
|
AC_MSG_CHECKING($2)
|
2000-05-01 10:42:55 +08:00
|
|
|
AC_ARG_WITH($1,[$3],$5=[$]withval,$5=ifelse($4,,no,$4))
|
|
|
|
PHP_ARG_ANALYZE($5)
|
2000-03-28 07:33:38 +08:00
|
|
|
])
|
|
|
|
|
2000-03-30 23:00:30 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_ARG_ENABLE(arg-name, check message, help text[, default-val])
|
|
|
|
dnl Sets PHP_ARG_NAME either to the user value or to the default value.
|
2001-05-10 02:12:12 +08:00
|
|
|
dnl default-val defaults to no. This will also set the variable ext_shared,
|
|
|
|
dnl and will overwrite any previous variable of that name.
|
2000-03-30 23:00:30 +08:00
|
|
|
dnl
|
2000-03-28 07:33:38 +08:00
|
|
|
AC_DEFUN(PHP_ARG_ENABLE,[
|
2000-05-01 10:42:55 +08:00
|
|
|
PHP_REAL_ARG_ENABLE([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z-,A-Z_))
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN(PHP_REAL_ARG_ENABLE,[
|
2000-03-28 07:33:38 +08:00
|
|
|
AC_MSG_CHECKING($2)
|
2000-05-01 10:42:55 +08:00
|
|
|
AC_ARG_ENABLE($1,[$3],$5=[$]enableval,$5=ifelse($4,,no,$4))
|
|
|
|
PHP_ARG_ANALYZE($5)
|
2000-03-28 07:33:38 +08:00
|
|
|
])
|
|
|
|
|
2000-03-26 10:47:00 +08:00
|
|
|
AC_DEFUN(PHP_MODULE_PTR,[
|
|
|
|
EXTRA_MODULE_PTRS="$EXTRA_MODULE_PTRS $1,"
|
|
|
|
])
|
2000-03-08 02:05:16 +08:00
|
|
|
|
|
|
|
AC_DEFUN(PHP_CONFIG_NICE,[
|
|
|
|
rm -f $1
|
|
|
|
cat >$1<<EOF
|
|
|
|
#! /bin/sh
|
|
|
|
#
|
|
|
|
# Created by configure
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
2001-05-20 04:21:58 +08:00
|
|
|
for var in CFLAGS CXXFLAGS CPPFLAGS LDFLAGS LIBS CC CXX; do
|
|
|
|
eval val=\$$var
|
|
|
|
if test -n "$val"; then
|
|
|
|
echo "$var='$val' \\" >> $1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2000-03-08 02:05:16 +08:00
|
|
|
for arg in [$]0 "[$]@"; do
|
2001-05-20 04:21:58 +08:00
|
|
|
echo "'[$]arg' \\" >> $1
|
2000-03-08 02:05:16 +08:00
|
|
|
done
|
|
|
|
echo '"[$]@"' >> $1
|
|
|
|
chmod +x $1
|
|
|
|
])
|
1999-04-17 08:37:12 +08:00
|
|
|
|
2000-03-04 00:10:38 +08:00
|
|
|
AC_DEFUN(PHP_TIME_R_TYPE,[
|
2000-05-23 23:43:29 +08:00
|
|
|
AC_CACHE_CHECK(for type of reentrant time-related functions, ac_cv_time_r_type,[
|
2000-03-04 00:10:38 +08:00
|
|
|
AC_TRY_RUN([
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
main() {
|
|
|
|
char buf[27];
|
|
|
|
struct tm t;
|
|
|
|
time_t old = 0;
|
2000-04-02 00:00:34 +08:00
|
|
|
int r, s;
|
2000-03-04 00:10:38 +08:00
|
|
|
|
2000-04-02 00:00:34 +08:00
|
|
|
s = gmtime_r(&old, &t);
|
2000-03-04 00:10:38 +08:00
|
|
|
r = (int) asctime_r(&t, buf, 26);
|
2001-05-21 05:29:55 +08:00
|
|
|
if (r == s && s == 0) return (0);
|
|
|
|
return (1);
|
2000-03-04 00:10:38 +08:00
|
|
|
}
|
|
|
|
],[
|
|
|
|
ac_cv_time_r_type=hpux
|
|
|
|
],[
|
2001-05-21 05:29:55 +08:00
|
|
|
AC_TRY_RUN([
|
|
|
|
#include <time.h>
|
|
|
|
main() {
|
|
|
|
struct tm t, *s;
|
|
|
|
time_t old = 0;
|
|
|
|
char buf[27], *p;
|
|
|
|
|
|
|
|
s = gmtime_r(&old, &t);
|
|
|
|
p = asctime_r(&t, buf, 26);
|
2001-05-21 05:55:57 +08:00
|
|
|
if (p == buf && s == &t) return (0);
|
2001-05-21 05:29:55 +08:00
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
],[
|
|
|
|
ac_cv_time_r_type=irix
|
|
|
|
],[
|
|
|
|
ac_cv_time_r_type=POSIX
|
|
|
|
])
|
2000-03-04 00:10:38 +08:00
|
|
|
],[
|
2000-05-23 23:43:29 +08:00
|
|
|
ac_cv_time_r_type=POSIX
|
2000-03-04 00:10:38 +08:00
|
|
|
])
|
|
|
|
])
|
2001-05-21 05:29:55 +08:00
|
|
|
case $ac_cv_time_r_type in
|
|
|
|
hpux) AC_DEFINE(PHP_HPUX_TIME_R,1,[Whether you have HP-UX 10.x]) ;;
|
|
|
|
irix) AC_DEFINE(PHP_IRIX_TIME_R,1,[Whether you have IRIX-style functions]) ;;
|
|
|
|
esac
|
2000-03-04 00:10:38 +08:00
|
|
|
])
|
|
|
|
|
1999-12-30 10:59:53 +08:00
|
|
|
AC_DEFUN(PHP_SUBST,[
|
|
|
|
PHP_VAR_SUBST="$PHP_VAR_SUBST $1"
|
2000-12-21 01:21:37 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN(PHP_SUBST_OLD,[
|
|
|
|
PHP_SUBST($1)
|
1999-12-30 10:59:53 +08:00
|
|
|
AC_SUBST($1)
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN(PHP_FAST_OUTPUT,[
|
|
|
|
PHP_FAST_OUTPUT_FILES="$PHP_FAST_OUTPUT_FILES $1"
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN(PHP_MKDIR_P_CHECK,[
|
|
|
|
AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[
|
|
|
|
test -d conftestdir && rm -rf conftestdir
|
|
|
|
mkdir -p conftestdir/somedir >/dev/null 2>&1
|
2001-05-21 05:07:23 +08:00
|
|
|
dnl `mkdir -p' must be quiet about creating existing directories
|
|
|
|
mkdir -p conftestdir/somedir >/dev/null 2>&1
|
|
|
|
if test "$?" = "0" && test -d conftestdir/somedir; then
|
1999-12-30 10:59:53 +08:00
|
|
|
ac_cv_mkdir_p=yes
|
|
|
|
else
|
|
|
|
ac_cv_mkdir_p=no
|
|
|
|
fi
|
|
|
|
rm -rf conftestdir
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2000-06-11 18:38:37 +08:00
|
|
|
AC_DEFUN(PHP_GEN_CONFIG_VARS,[
|
1999-12-30 10:59:53 +08:00
|
|
|
PHP_MKDIR_P_CHECK
|
|
|
|
echo creating config_vars.mk
|
|
|
|
> config_vars.mk
|
|
|
|
for i in $PHP_VAR_SUBST; do
|
|
|
|
eval echo "$i = \$$i" >> config_vars.mk
|
|
|
|
done
|
2000-06-11 18:38:37 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN(PHP_GEN_MAKEFILES,[
|
2000-09-26 19:19:38 +08:00
|
|
|
$SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $BSD_MAKEFILE $1
|
1999-12-30 10:59:53 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN(PHP_TM_GMTOFF,[
|
|
|
|
AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
|
|
|
|
[AC_TRY_COMPILE([#include <sys/types.h>
|
|
|
|
#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;],
|
|
|
|
ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)])
|
|
|
|
|
|
|
|
if test "$ac_cv_struct_tm_gmtoff" = yes; then
|
2000-06-08 14:14:58 +08:00
|
|
|
AC_DEFINE(HAVE_TM_GMTOFF,1,[whether you have tm_gmtoff in struct tm])
|
1999-12-30 10:59:53 +08:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl PHP_CONFIGURE_PART(MESSAGE)
|
|
|
|
dnl Idea borrowed from mm
|
|
|
|
AC_DEFUN(PHP_CONFIGURE_PART,[
|
|
|
|
AC_MSG_RESULT()
|
|
|
|
AC_MSG_RESULT(${T_MD}$1${T_ME})
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN(PHP_PROG_SENDMAIL,[
|
2001-02-21 15:39:13 +08:00
|
|
|
AC_PATH_PROG(PROG_SENDMAIL, sendmail,[], $PATH:/usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib)
|
1999-12-30 10:59:53 +08:00
|
|
|
if test -n "$PROG_SENDMAIL"; then
|
2000-06-08 14:14:58 +08:00
|
|
|
AC_DEFINE(HAVE_SENDMAIL,1,[whether you have sendmail])
|
1999-12-30 10:59:53 +08:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN(PHP_RUNPATH_SWITCH,[
|
|
|
|
dnl check for -R, etc. switch
|
|
|
|
AC_MSG_CHECKING(if compiler supports -R)
|
|
|
|
AC_CACHE_VAL(php_cv_cc_dashr,[
|
2001-05-12 18:33:52 +08:00
|
|
|
SAVE_LIBS=$LIBS
|
|
|
|
LIBS="-R /usr/lib $LIBS"
|
1999-12-30 10:59:53 +08:00
|
|
|
AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
|
2001-05-12 18:33:52 +08:00
|
|
|
LIBS=$SAVE_LIBS])
|
1999-12-30 10:59:53 +08:00
|
|
|
AC_MSG_RESULT($php_cv_cc_dashr)
|
|
|
|
if test $php_cv_cc_dashr = "yes"; then
|
2001-05-12 18:33:52 +08:00
|
|
|
ld_runpath_switch=-R
|
1999-12-30 10:59:53 +08:00
|
|
|
else
|
|
|
|
AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
|
|
|
|
AC_CACHE_VAL(php_cv_cc_rpath,[
|
2001-05-12 18:33:52 +08:00
|
|
|
SAVE_LIBS=$LIBS
|
|
|
|
LIBS="-Wl,-rpath,/usr/lib $LIBS"
|
1999-12-30 10:59:53 +08:00
|
|
|
AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
|
2001-05-12 18:33:52 +08:00
|
|
|
LIBS=$SAVE_LIBS])
|
1999-12-30 10:59:53 +08:00
|
|
|
AC_MSG_RESULT($php_cv_cc_rpath)
|
|
|
|
if test $php_cv_cc_rpath = "yes"; then
|
2001-05-12 18:33:52 +08:00
|
|
|
ld_runpath_switch=-Wl,-rpath,
|
1999-12-30 10:59:53 +08:00
|
|
|
else
|
|
|
|
dnl something innocuous
|
2001-05-12 18:33:52 +08:00
|
|
|
ld_runpath_switch=-L
|
1999-12-30 10:59:53 +08:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN(PHP_STRUCT_FLOCK,[
|
|
|
|
AC_CACHE_CHECK(for struct flock,ac_cv_struct_flock,
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
],
|
|
|
|
[struct flock x;],
|
|
|
|
[
|
|
|
|
ac_cv_struct_flock=yes
|
|
|
|
],[
|
|
|
|
ac_cv_struct_flock=no
|
|
|
|
])
|
|
|
|
)
|
|
|
|
if test "$ac_cv_struct_flock" = "yes" ; then
|
2000-06-08 14:14:58 +08:00
|
|
|
AC_DEFINE(HAVE_STRUCT_FLOCK, 1,[whether you have struct flock])
|
1999-12-30 10:59:53 +08:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN(PHP_SOCKLEN_T,[
|
|
|
|
AC_CACHE_CHECK(for socklen_t,ac_cv_socklen_t,
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
],[
|
|
|
|
socklen_t x;
|
|
|
|
],[
|
|
|
|
ac_cv_socklen_t=yes
|
|
|
|
],[
|
|
|
|
ac_cv_socklen_t=no
|
|
|
|
]))
|
1999-12-31 00:09:17 +08:00
|
|
|
if test "$ac_cv_socklen_t" = "yes"; then
|
|
|
|
AC_DEFINE(HAVE_SOCKLEN_T, 1, [Whether you have socklen_t])
|
1999-12-30 10:59:53 +08:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
1999-11-21 03:00:17 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_SET_SYM_FILE(path)
|
|
|
|
dnl
|
|
|
|
dnl set the path of the file which contains the symbol export list
|
|
|
|
dnl
|
|
|
|
AC_DEFUN(PHP_SET_SYM_FILE,
|
|
|
|
[
|
2001-05-12 18:33:52 +08:00
|
|
|
PHP_SYM_FILE=$1
|
1999-11-21 03:00:17 +08:00
|
|
|
])
|
|
|
|
|
1999-11-24 11:27:53 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_BUILD_THREAD_SAFE
|
1999-11-24 17:49:30 +08:00
|
|
|
dnl
|
1999-11-24 11:27:53 +08:00
|
|
|
AC_DEFUN(PHP_BUILD_THREAD_SAFE,[
|
1999-12-21 08:15:51 +08:00
|
|
|
enable_experimental_zts=yes
|
2000-05-04 17:42:27 +08:00
|
|
|
if test "$pthreads_working" != "yes"; then
|
2000-09-22 07:18:25 +08:00
|
|
|
AC_MSG_ERROR(ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads.)
|
2000-05-04 17:42:27 +08:00
|
|
|
fi
|
1999-11-24 11:27:53 +08:00
|
|
|
])
|
|
|
|
|
2000-07-10 04:39:18 +08:00
|
|
|
AC_DEFUN(PHP_REQUIRE_CXX,[
|
|
|
|
if test -z "$php_cxx_done"; then
|
|
|
|
AC_PROG_CXX
|
|
|
|
AC_PROG_CXXCPP
|
|
|
|
php_cxx_done=yes
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
1999-10-04 23:18:26 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_BUILD_SHARED
|
|
|
|
dnl
|
|
|
|
AC_DEFUN(PHP_BUILD_SHARED,[
|
|
|
|
php_build_target=shared
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_BUILD_STATIC
|
|
|
|
dnl
|
|
|
|
AC_DEFUN(PHP_BUILD_STATIC,[
|
|
|
|
php_build_target=static
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_BUILD_PROGRAM
|
|
|
|
dnl
|
|
|
|
AC_DEFUN(PHP_BUILD_PROGRAM,[
|
|
|
|
php_build_target=program
|
|
|
|
])
|
|
|
|
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
|
|
|
dnl AC_PHP_ONCE(namespace, variable, code)
|
|
|
|
dnl
|
|
|
|
dnl execute code, if variable is not set in namespace
|
|
|
|
dnl
|
|
|
|
AC_DEFUN(AC_PHP_ONCE,[
|
2000-06-01 04:30:16 +08:00
|
|
|
changequote({,})
|
|
|
|
unique=`echo $2|sed 's/[^a-zA-Z0-9]/_/g'`
|
|
|
|
changequote([,])
|
1999-06-21 02:52:46 +08:00
|
|
|
cmd="echo $ac_n \"\$$1$unique$ac_c\""
|
|
|
|
if test -n "$unique" && test "`eval $cmd`" = "" ; then
|
|
|
|
eval "$1$unique=set"
|
|
|
|
$3
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
2001-03-28 04:35:04 +08:00
|
|
|
dnl PHP_EXPAND_PATH(path, variable)
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
|
|
|
dnl expands path to an absolute path and assigns it to variable
|
|
|
|
dnl
|
2001-03-28 04:35:04 +08:00
|
|
|
AC_DEFUN(PHP_EXPAND_PATH,[
|
1999-06-28 05:14:00 +08:00
|
|
|
if test -z "$1" || echo "$1" | grep '^/' >/dev/null ; then
|
2001-05-12 18:33:52 +08:00
|
|
|
$2=$1
|
1999-06-28 05:14:00 +08:00
|
|
|
else
|
2000-05-05 00:08:10 +08:00
|
|
|
changequote({,})
|
2000-10-13 07:17:21 +08:00
|
|
|
ep_dir="`echo $1|sed 's%/*[^/][^/]*/*$%%'`"
|
2000-05-05 00:08:10 +08:00
|
|
|
changequote([,])
|
1999-11-13 20:38:23 +08:00
|
|
|
ep_realdir="`(cd \"$ep_dir\" && pwd)`"
|
|
|
|
$2="$ep_realdir/`basename \"$1\"`"
|
1999-06-21 02:52:46 +08:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
2001-03-28 04:35:04 +08:00
|
|
|
dnl PHP_ADD_LIBPATH(path[, shared-libadd])
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
|
|
|
dnl add a library to linkpath/runpath
|
|
|
|
dnl
|
2001-03-28 04:35:04 +08:00
|
|
|
AC_DEFUN(PHP_ADD_LIBPATH,[
|
1999-09-26 23:38:58 +08:00
|
|
|
if test "$1" != "/usr/lib"; then
|
2001-03-28 04:35:04 +08:00
|
|
|
PHP_EXPAND_PATH($1, ai_p)
|
2000-05-24 07:13:13 +08:00
|
|
|
if test "$ext_shared" = "yes" && test -n "$2"; then
|
|
|
|
$2="-R$1 -L$1 [$]$2"
|
|
|
|
else
|
|
|
|
AC_PHP_ONCE(LIBPATH, $ai_p, [
|
|
|
|
test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p"
|
|
|
|
LDFLAGS="$LDFLAGS -L$ai_p"
|
|
|
|
PHP_RPATHS="$PHP_RPATHS $ai_p"
|
|
|
|
])
|
|
|
|
fi
|
1999-09-26 23:38:58 +08:00
|
|
|
fi
|
1999-09-26 17:05:56 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
2001-03-28 04:35:04 +08:00
|
|
|
dnl PHP_BUILD_RPATH()
|
1999-09-26 17:05:56 +08:00
|
|
|
dnl
|
|
|
|
dnl builds RPATH from PHP_RPATHS
|
|
|
|
dnl
|
2001-03-28 04:35:04 +08:00
|
|
|
AC_DEFUN(PHP_BUILD_RPATH,[
|
2000-03-30 23:00:30 +08:00
|
|
|
if test "$PHP_RPATH" = "yes" && test -n "$PHP_RPATHS"; then
|
1999-10-04 23:18:26 +08:00
|
|
|
OLD_RPATHS="$PHP_RPATHS"
|
2001-05-12 18:33:52 +08:00
|
|
|
unset PHP_RPATHS
|
2000-03-30 23:00:30 +08:00
|
|
|
for i in $OLD_RPATHS; do
|
|
|
|
PHP_LDFLAGS="$PHP_LDFLAGS -L$i"
|
|
|
|
PHP_RPATHS="$PHP_RPATHS -R $i"
|
2001-05-12 18:33:52 +08:00
|
|
|
NATIVE_RPATHS="$NATIVE_RPATHS $ld_runpath_switch$i"
|
2000-03-30 23:00:30 +08:00
|
|
|
done
|
1999-09-26 17:05:56 +08:00
|
|
|
fi
|
1999-06-21 02:52:46 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
2001-06-01 14:26:22 +08:00
|
|
|
dnl PHP_ADD_INCLUDE(path [,before])
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2001-06-11 12:15:58 +08:00
|
|
|
dnl add an include path.
|
2001-06-01 14:26:22 +08:00
|
|
|
dnl if before is 1, add in the beginning of INCLUDES.
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2001-03-28 04:35:04 +08:00
|
|
|
AC_DEFUN(PHP_ADD_INCLUDE,[
|
1999-09-26 23:38:58 +08:00
|
|
|
if test "$1" != "/usr/include"; then
|
2001-03-28 04:35:04 +08:00
|
|
|
PHP_EXPAND_PATH($1, ai_p)
|
1999-09-26 23:38:58 +08:00
|
|
|
AC_PHP_ONCE(INCLUDEPATH, $ai_p, [
|
2001-06-01 14:26:22 +08:00
|
|
|
if test "$2"; then
|
|
|
|
INCLUDES="-I$ai_p $INCLUDES"
|
|
|
|
else
|
|
|
|
INCLUDES="$INCLUDES -I$ai_p"
|
|
|
|
fi
|
1999-09-26 23:38:58 +08:00
|
|
|
])
|
|
|
|
fi
|
1999-06-21 02:52:46 +08:00
|
|
|
])
|
|
|
|
|
2000-05-24 07:13:13 +08:00
|
|
|
AC_DEFUN(PHP_X_ADD_LIBRARY,[
|
2000-09-22 07:18:25 +08:00
|
|
|
ifelse($2,,$3="-l$1 [$]$3", $3="[$]$3 -l$1")
|
2000-05-24 07:13:13 +08:00
|
|
|
])
|
|
|
|
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2001-03-28 04:35:04 +08:00
|
|
|
dnl PHP_ADD_LIBRARY(library[, append[, shared-libadd]])
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
|
|
|
dnl add a library to the link line
|
|
|
|
dnl
|
2001-03-28 04:35:04 +08:00
|
|
|
AC_DEFUN(PHP_ADD_LIBRARY,[
|
2001-05-12 19:09:05 +08:00
|
|
|
case $1 in
|
2000-06-17 18:53:08 +08:00
|
|
|
c|c_r|pthread*) ;;
|
|
|
|
*)
|
2000-05-24 07:13:13 +08:00
|
|
|
ifelse($3,,[
|
2000-07-10 18:26:13 +08:00
|
|
|
PHP_X_ADD_LIBRARY($1,$2,LIBS)
|
2000-05-24 07:13:13 +08:00
|
|
|
],[
|
|
|
|
if test "$ext_shared" = "yes"; then
|
|
|
|
PHP_X_ADD_LIBRARY($1,$2,$3)
|
|
|
|
else
|
2001-03-28 04:35:04 +08:00
|
|
|
PHP_ADD_LIBRARY($1,$2)
|
2000-05-24 07:13:13 +08:00
|
|
|
fi
|
|
|
|
])
|
2000-06-17 18:53:08 +08:00
|
|
|
;;
|
|
|
|
esac
|
1999-06-21 02:52:46 +08:00
|
|
|
])
|
|
|
|
|
2000-02-29 21:02:29 +08:00
|
|
|
dnl
|
2001-03-28 04:35:04 +08:00
|
|
|
dnl PHP_ADD_LIBRARY_DEFER(library[, append])
|
2000-02-29 21:02:29 +08:00
|
|
|
dnl
|
2000-03-12 06:05:41 +08:00
|
|
|
dnl add a library to the link line (deferred)
|
2001-03-28 04:35:04 +08:00
|
|
|
AC_DEFUN(PHP_ADD_LIBRARY_DEFER,[
|
2000-07-10 18:26:13 +08:00
|
|
|
ifelse($#, 1, DLIBS="-l$1 $DLIBS", DLIBS="$DLIBS -l$1")
|
2000-02-29 21:02:29 +08:00
|
|
|
])
|
|
|
|
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2001-03-28 04:35:04 +08:00
|
|
|
dnl PHP_ADD_LIBRARY_WITH_PATH(library, path[, shared-libadd])
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2000-05-02 12:00:14 +08:00
|
|
|
dnl add a library to the link line and path to linkpath/runpath.
|
|
|
|
dnl if shared-libadd is not empty and $ext_shared is yes,
|
|
|
|
dnl shared-libadd will be assigned the library information
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2001-03-28 04:35:04 +08:00
|
|
|
AC_DEFUN(PHP_ADD_LIBRARY_WITH_PATH,[
|
2000-05-02 12:00:14 +08:00
|
|
|
ifelse($3,,[
|
2000-05-08 16:27:48 +08:00
|
|
|
if test -n "$2"; then
|
2001-03-28 04:35:04 +08:00
|
|
|
PHP_ADD_LIBPATH($2)
|
2000-05-08 16:27:48 +08:00
|
|
|
fi
|
2001-03-28 04:35:04 +08:00
|
|
|
PHP_ADD_LIBRARY($1)
|
2000-05-02 12:00:14 +08:00
|
|
|
],[
|
|
|
|
if test "$ext_shared" = "yes"; then
|
2000-05-24 07:13:13 +08:00
|
|
|
$3="-l$1 [$]$3"
|
2000-05-02 12:00:14 +08:00
|
|
|
if test -n "$2"; then
|
2001-03-28 04:35:04 +08:00
|
|
|
PHP_ADD_LIBPATH($2,$3)
|
2000-05-02 12:00:14 +08:00
|
|
|
fi
|
|
|
|
else
|
2001-03-28 04:35:04 +08:00
|
|
|
PHP_ADD_LIBRARY_WITH_PATH($1,$2)
|
2000-05-24 07:13:13 +08:00
|
|
|
fi
|
2000-05-02 12:00:14 +08:00
|
|
|
])
|
1999-06-21 02:52:46 +08:00
|
|
|
])
|
|
|
|
|
2000-03-12 06:05:41 +08:00
|
|
|
dnl
|
2001-03-28 04:35:04 +08:00
|
|
|
dnl PHP_ADD_LIBRARY_DEFER_WITH_PATH(library, path)
|
2000-03-12 06:05:41 +08:00
|
|
|
dnl
|
|
|
|
dnl add a library to the link line (deferred)
|
|
|
|
dnl and path to linkpath/runpath (not deferred)
|
|
|
|
dnl
|
2001-03-28 04:35:04 +08:00
|
|
|
AC_DEFUN(PHP_ADD_LIBRARY_DEFER_WITH_PATH,[
|
|
|
|
PHP_ADD_LIBPATH($2)
|
|
|
|
PHP_ADD_LIBRARY_DEFER($1)
|
2000-03-12 06:05:41 +08:00
|
|
|
])
|
1999-04-25 07:36:25 +08:00
|
|
|
|
2001-03-28 04:35:04 +08:00
|
|
|
dnl
|
|
|
|
dnl Set libtool variable
|
|
|
|
dnl
|
1999-09-16 16:26:46 +08:00
|
|
|
AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[
|
|
|
|
LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
|
|
|
|
])
|
|
|
|
|
1999-04-25 07:36:25 +08:00
|
|
|
dnl
|
|
|
|
dnl Check for cc option
|
|
|
|
dnl
|
2001-03-28 04:35:04 +08:00
|
|
|
AC_DEFUN(PHP_CHECK_CC_OPTION,[
|
1999-04-25 07:36:25 +08:00
|
|
|
echo "main(){return 0;}" > conftest.$ac_ext
|
2001-05-12 18:33:52 +08:00
|
|
|
opt=$1
|
2000-06-01 04:30:16 +08:00
|
|
|
changequote({,})
|
|
|
|
var=`echo $opt|sed 's/[^a-zA-Z0-9]/_/g'`
|
|
|
|
changequote([,])
|
1999-04-26 00:50:40 +08:00
|
|
|
AC_MSG_CHECKING([if compiler supports -$1 really])
|
1999-08-04 04:56:13 +08:00
|
|
|
ac_php_compile="${CC-cc} -$opt -o conftest $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1"
|
|
|
|
if eval $ac_php_compile 2>&1 | egrep "$opt" > /dev/null 2>&1 ; then
|
1999-04-25 07:36:25 +08:00
|
|
|
eval php_cc_$var=no
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
else
|
1999-08-04 04:56:13 +08:00
|
|
|
if eval ./conftest 2>/dev/null ; then
|
|
|
|
eval php_cc_$var=yes
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
else
|
|
|
|
eval php_cc_$var=no
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
fi
|
1999-04-25 07:36:25 +08:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
1999-11-14 00:51:33 +08:00
|
|
|
AC_DEFUN(PHP_REGEX,[
|
1999-11-13 21:27:49 +08:00
|
|
|
|
1999-11-14 00:51:33 +08:00
|
|
|
if test "$REGEX_TYPE" = "php"; then
|
1999-11-13 04:56:30 +08:00
|
|
|
REGEX_LIB=regex/libregex.la
|
1999-11-14 00:51:33 +08:00
|
|
|
REGEX_DIR=regex
|
2000-06-08 14:14:58 +08:00
|
|
|
AC_DEFINE(HSREGEX,1,[ ])
|
|
|
|
AC_DEFINE(REGEX,1,[ ])
|
1999-12-30 10:59:53 +08:00
|
|
|
PHP_FAST_OUTPUT(regex/Makefile)
|
1999-11-14 00:51:33 +08:00
|
|
|
elif test "$REGEX_TYPE" = "system"; then
|
2000-06-08 14:14:58 +08:00
|
|
|
AC_DEFINE(REGEX,0,[ ])
|
1999-11-13 04:56:30 +08:00
|
|
|
fi
|
|
|
|
|
1999-11-14 00:51:33 +08:00
|
|
|
AC_MSG_CHECKING(which regex library to use)
|
|
|
|
AC_MSG_RESULT($REGEX_TYPE)
|
|
|
|
|
1999-12-30 10:59:53 +08:00
|
|
|
PHP_SUBST(REGEX_DIR)
|
|
|
|
PHP_SUBST(REGEX_LIB)
|
|
|
|
PHP_SUBST(HSREGEX)
|
1999-11-13 04:56:30 +08:00
|
|
|
])
|
1999-04-25 07:36:25 +08:00
|
|
|
|
1999-04-17 08:37:12 +08:00
|
|
|
dnl
|
|
|
|
dnl See if we have broken header files like SunOS has.
|
|
|
|
dnl
|
2001-03-28 04:35:04 +08:00
|
|
|
AC_DEFUN(PHP_MISSING_FCLOSE_DECL,[
|
1999-04-17 08:37:12 +08:00
|
|
|
AC_MSG_CHECKING([for fclose declaration])
|
|
|
|
AC_TRY_COMPILE([#include <stdio.h>],[int (*func)() = fclose],[
|
2000-06-08 14:14:58 +08:00
|
|
|
AC_DEFINE(MISSING_FCLOSE_DECL,0,[ ])
|
1999-04-17 08:37:12 +08:00
|
|
|
AC_MSG_RESULT(ok)
|
|
|
|
],[
|
2000-06-08 14:14:58 +08:00
|
|
|
AC_DEFINE(MISSING_FCLOSE_DECL,1,[ ])
|
1999-04-17 08:37:12 +08:00
|
|
|
AC_MSG_RESULT(missing)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl Check for broken sprintf()
|
|
|
|
dnl
|
2001-03-28 04:35:04 +08:00
|
|
|
AC_DEFUN(PHP_AC_BROKEN_SPRINTF,[
|
1999-12-30 10:59:53 +08:00
|
|
|
AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[
|
|
|
|
AC_TRY_RUN([main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }],[
|
|
|
|
ac_cv_broken_sprintf=no
|
|
|
|
],[
|
|
|
|
ac_cv_broken_sprintf=yes
|
|
|
|
],[
|
|
|
|
ac_cv_broken_sprintf=no
|
|
|
|
])
|
1999-04-17 08:37:12 +08:00
|
|
|
])
|
1999-12-30 10:59:53 +08:00
|
|
|
if test "$ac_cv_broken_sprintf" = "yes"; then
|
2000-06-08 14:14:58 +08:00
|
|
|
AC_DEFINE(PHP_BROKEN_SPRINTF, 1, [ ])
|
1999-12-30 10:59:53 +08:00
|
|
|
else
|
2000-06-08 14:14:58 +08:00
|
|
|
AC_DEFINE(PHP_BROKEN_SPRINTF, 0, [ ])
|
1999-12-30 10:59:53 +08:00
|
|
|
fi
|
1999-04-17 08:37:12 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
1999-09-29 23:17:02 +08:00
|
|
|
dnl PHP_EXTENSION(extname [, shared])
|
|
|
|
dnl
|
|
|
|
dnl Includes an extension in the build.
|
|
|
|
dnl
|
|
|
|
dnl "extname" is the name of the ext/ subdir where the extension resides
|
|
|
|
dnl "shared" can be set to "shared" or "yes" to build the extension as
|
|
|
|
dnl a dynamically loadable library.
|
1999-04-17 08:37:12 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN(PHP_EXTENSION,[
|
2000-05-01 10:42:55 +08:00
|
|
|
EXT_SUBDIRS="$EXT_SUBDIRS $1"
|
|
|
|
|
|
|
|
if test -d "$abs_srcdir/ext/$1"; then
|
|
|
|
dnl ---------------------------------------------- Internal Module
|
2001-05-12 18:33:52 +08:00
|
|
|
ext_builddir=ext/$1
|
|
|
|
ext_srcdir=$abs_srcdir/ext/$1
|
2000-05-01 10:42:55 +08:00
|
|
|
else
|
|
|
|
dnl ---------------------------------------------- External Module
|
2001-05-12 18:33:52 +08:00
|
|
|
ext_builddir=.
|
|
|
|
ext_srcdir=$abs_srcdir
|
1999-09-04 01:46:39 +08:00
|
|
|
fi
|
2000-05-01 10:42:55 +08:00
|
|
|
|
|
|
|
if test "$2" != "shared" && test "$2" != "yes"; then
|
|
|
|
dnl ---------------------------------------------- Static module
|
|
|
|
LIB_BUILD($ext_builddir)
|
|
|
|
EXT_LTLIBS="$EXT_LTLIBS $ext_builddir/lib$1.la"
|
|
|
|
EXT_STATIC="$EXT_STATIC $1"
|
|
|
|
else
|
|
|
|
dnl ---------------------------------------------- Shared module
|
|
|
|
LIB_BUILD($ext_builddir,yes)
|
|
|
|
AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z-,A-Z_), 1, Whether to build $1 as dynamic module)
|
|
|
|
fi
|
|
|
|
|
|
|
|
PHP_FAST_OUTPUT($ext_builddir/Makefile)
|
1999-04-17 08:37:12 +08:00
|
|
|
])
|
|
|
|
|
1999-12-30 10:59:53 +08:00
|
|
|
PHP_SUBST(EXT_SUBDIRS)
|
|
|
|
PHP_SUBST(EXT_STATIC)
|
|
|
|
PHP_SUBST(EXT_SHARED)
|
|
|
|
PHP_SUBST(EXT_LIBS)
|
|
|
|
PHP_SUBST(EXT_LTLIBS)
|
1999-07-25 03:02:38 +08:00
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl Solaris requires main code to be position independent in order
|
|
|
|
dnl to let shared objects find symbols. Weird. Ugly.
|
|
|
|
dnl
|
|
|
|
dnl Must be run after all --with-NN options that let the user
|
|
|
|
dnl choose dynamic extensions, and after the gcc test.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN(PHP_SOLARIS_PIC_WEIRDNESS,[
|
|
|
|
AC_MSG_CHECKING(whether -fPIC is required)
|
2001-05-12 18:33:52 +08:00
|
|
|
if test -n "$EXT_SHARED"; then
|
1999-07-25 03:02:38 +08:00
|
|
|
os=`uname -sr 2>/dev/null`
|
2001-05-12 19:09:05 +08:00
|
|
|
case $os in
|
1999-07-25 03:10:17 +08:00
|
|
|
"SunOS 5.6"|"SunOS 5.7")
|
2001-05-12 19:09:05 +08:00
|
|
|
case $CC in
|
1999-07-25 03:02:38 +08:00
|
|
|
gcc*|egcs*) CFLAGS="$CFLAGS -fPIC";;
|
|
|
|
*) CFLAGS="$CFLAGS -fpic";;
|
|
|
|
esac
|
|
|
|
AC_MSG_RESULT(yes);;
|
|
|
|
*)
|
|
|
|
AC_MSG_RESULT(no);;
|
|
|
|
esac
|
1999-09-12 20:20:59 +08:00
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
1999-07-25 03:02:38 +08:00
|
|
|
fi
|
|
|
|
])
|
1999-09-14 01:17:51 +08:00
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl Checks whether $withval is "shared" or starts with "shared,XXX"
|
|
|
|
dnl and sets $shared to "yes" or "no", and removes "shared,?" stuff
|
|
|
|
dnl from $withval.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN(PHP_WITH_SHARED,[
|
|
|
|
case $withval in
|
|
|
|
shared)
|
|
|
|
shared=yes
|
|
|
|
withval=yes
|
|
|
|
;;
|
|
|
|
shared,*)
|
|
|
|
shared=yes
|
|
|
|
withval=`echo $withval | sed -e 's/^shared,//'`
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
shared=no
|
|
|
|
;;
|
|
|
|
esac
|
1999-12-30 10:59:53 +08:00
|
|
|
if test -n "$php_always_shared"; then
|
|
|
|
shared=yes
|
|
|
|
fi
|
1999-09-14 01:17:51 +08:00
|
|
|
])
|
1999-09-27 21:15:20 +08:00
|
|
|
|
|
|
|
dnl The problem is that the default compilation flags in Solaris 2.6 won't
|
|
|
|
dnl let programs access large files; you need to tell the compiler that
|
|
|
|
dnl you actually want your programs to work on large files. For more
|
|
|
|
dnl details about this brain damage please see:
|
|
|
|
dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
|
|
|
|
|
|
|
|
dnl Written by Paul Eggert <eggert@twinsun.com>.
|
|
|
|
|
2001-03-28 04:35:04 +08:00
|
|
|
AC_DEFUN(PHP_SYS_LFS,
|
1999-09-27 21:15:20 +08:00
|
|
|
[dnl
|
|
|
|
# If available, prefer support for large files unless the user specified
|
|
|
|
# one of the CPPFLAGS, LDFLAGS, or LIBS variables.
|
|
|
|
AC_MSG_CHECKING(whether large file support needs explicit enabling)
|
|
|
|
ac_getconfs=''
|
|
|
|
ac_result=yes
|
|
|
|
ac_set=''
|
|
|
|
ac_shellvars='CPPFLAGS LDFLAGS LIBS'
|
|
|
|
for ac_shellvar in $ac_shellvars; do
|
|
|
|
case $ac_shellvar in
|
|
|
|
CPPFLAGS) ac_lfsvar=LFS_CFLAGS ;;
|
|
|
|
*) ac_lfsvar=LFS_$ac_shellvar ;;
|
|
|
|
esac
|
|
|
|
eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar
|
|
|
|
(getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; }
|
|
|
|
ac_getconf=`getconf $ac_lfsvar`
|
|
|
|
ac_getconfs=$ac_getconfs$ac_getconf
|
|
|
|
eval ac_test_$ac_shellvar=\$ac_getconf
|
|
|
|
done
|
|
|
|
case "$ac_result$ac_getconfs" in
|
|
|
|
yes) ac_result=no ;;
|
|
|
|
esac
|
|
|
|
case "$ac_result$ac_set" in
|
|
|
|
yes?*) ac_result="yes, but $ac_set is already set, so use its settings"
|
|
|
|
esac
|
|
|
|
AC_MSG_RESULT($ac_result)
|
|
|
|
case $ac_result in
|
|
|
|
yes)
|
|
|
|
for ac_shellvar in $ac_shellvars; do
|
|
|
|
eval $ac_shellvar=\$ac_test_$ac_shellvar
|
|
|
|
done ;;
|
|
|
|
esac
|
|
|
|
])
|
1999-09-29 23:17:02 +08:00
|
|
|
|
2001-03-28 04:35:04 +08:00
|
|
|
AC_DEFUN(PHP_SOCKADDR_SA_LEN,[
|
1999-09-29 23:17:02 +08:00
|
|
|
AC_CACHE_CHECK([for field sa_len in struct sockaddr],ac_cv_sockaddr_sa_len,[
|
|
|
|
AC_TRY_COMPILE([#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>],
|
|
|
|
[struct sockaddr s; s.sa_len;],
|
|
|
|
[ac_cv_sockaddr_sa_len=yes
|
2000-06-08 14:14:58 +08:00
|
|
|
AC_DEFINE(HAVE_SOCKADDR_SA_LEN,1,[ ])],
|
1999-09-29 23:17:02 +08:00
|
|
|
[ac_cv_sockaddr_sa_len=no])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
1999-12-30 10:59:53 +08:00
|
|
|
|
2000-07-26 22:53:54 +08:00
|
|
|
dnl ## PHP_OUTPUT(file)
|
1999-09-29 23:17:02 +08:00
|
|
|
dnl ## adds "file" to the list of files generated by AC_OUTPUT
|
|
|
|
dnl ## This macro can be used several times.
|
|
|
|
AC_DEFUN(PHP_OUTPUT,[
|
|
|
|
PHP_OUTPUT_FILES="$PHP_OUTPUT_FILES $1"
|
|
|
|
])
|
1999-12-30 10:59:53 +08:00
|
|
|
|
2000-01-01 10:22:01 +08:00
|
|
|
AC_DEFUN(PHP_DECLARED_TIMEZONE,[
|
|
|
|
AC_CACHE_CHECK(for declared timezone, ac_cv_declared_timezone,[
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <time.h>
|
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
#include <sys/time.h>
|
|
|
|
#endif
|
|
|
|
],[
|
|
|
|
time_t foo = (time_t) timezone;
|
|
|
|
],[
|
|
|
|
ac_cv_declared_timezone=yes
|
|
|
|
],[
|
|
|
|
ac_cv_declared_timezone=no
|
|
|
|
])])
|
|
|
|
if test "$ac_cv_declared_timezone" = "yes"; then
|
|
|
|
AC_DEFINE(HAVE_DECLARED_TIMEZONE, 1, [Whether system headers declare timezone])
|
|
|
|
fi
|
|
|
|
])
|
2000-04-13 20:24:28 +08:00
|
|
|
|
|
|
|
AC_DEFUN(PHP_EBCDIC,[
|
|
|
|
AC_CACHE_CHECK([whether system uses EBCDIC],ac_cv_ebcdic,[
|
|
|
|
AC_TRY_RUN( [
|
|
|
|
int main(void) {
|
|
|
|
return (unsigned char)'A' != (unsigned char)0xC1;
|
|
|
|
}
|
|
|
|
],[
|
2001-05-12 18:33:52 +08:00
|
|
|
ac_cv_ebcdic=yes
|
2000-04-13 20:24:28 +08:00
|
|
|
],[
|
2001-05-12 18:33:52 +08:00
|
|
|
ac_cv_ebcdic=no
|
2000-04-13 20:24:28 +08:00
|
|
|
],[
|
2001-05-12 18:33:52 +08:00
|
|
|
ac_cv_ebcdic=no
|
2000-04-13 20:24:28 +08:00
|
|
|
])])
|
|
|
|
if test "$ac_cv_ebcdic" = "yes"; then
|
2000-06-08 14:14:58 +08:00
|
|
|
AC_DEFINE(CHARSET_EBCDIC,1, [Define if system uses EBCDIC])
|
2000-04-13 20:24:28 +08:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2001-06-10 21:51:18 +08:00
|
|
|
AC_DEFUN(AC_ADD_LIBPATH, [indir([PHP_ADD_LIBPATH])])
|
|
|
|
AC_DEFUN(AC_ADD_LIBRARY, [indir([PHP_ADD_LIBRARY])])
|
|
|
|
AC_DEFUN(AC_ADD_LIBRARY_WITH_PATH, [indir([PHP_ADD_LIBRARY_WITH_PATH])])
|
|
|
|
AC_DEFUN(AC_ADD_INCLUDE, [indir([PHP_ADD_INCLUDE])])
|
|
|
|
|
2000-11-21 16:38:20 +08:00
|
|
|
AC_DEFUN(PHP_FOPENCOOKIE,[
|
|
|
|
AC_CHECK_FUNC(fopencookie, [ have_glibc_fopencookie=yes ])
|
|
|
|
|
|
|
|
if test "$have_glibc_fopencookie" = "yes" ; then
|
|
|
|
dnl this comes in two flavors:
|
|
|
|
dnl newer glibcs (since 2.1.2 ? )
|
|
|
|
dnl have a type called cookie_io_functions_t
|
|
|
|
AC_TRY_COMPILE([ #define _GNU_SOURCE
|
|
|
|
#include <stdio.h>
|
|
|
|
],
|
|
|
|
[ cookie_io_functions_t cookie; ],
|
|
|
|
[ have_cookie_io_functions_t=yes ],
|
|
|
|
[ ] )
|
|
|
|
|
|
|
|
if test "$have_cookie_io_functions_t" = "yes" ; then
|
|
|
|
cookie_io_functions_t=cookie_io_functions_t
|
|
|
|
have_fopen_cookie=yes
|
|
|
|
else
|
|
|
|
dnl older glibc versions (up to 2.1.2 ?)
|
|
|
|
dnl call it _IO_cookie_io_functions_t
|
|
|
|
AC_TRY_COMPILE([ #define _GNU_SOURCE
|
|
|
|
#include <stdio.h>
|
|
|
|
],
|
|
|
|
[ _IO_cookie_io_functions_t cookie; ],
|
|
|
|
[ have_IO_cookie_io_functions_t=yes ],
|
|
|
|
[] )
|
|
|
|
if test "$have_cookie_io_functions_t" = "yes" ; then
|
|
|
|
cookie_io_functions_t=_IO_cookie_io_functions_t
|
|
|
|
have_fopen_cookie=yes
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$have_fopen_cookie" = "yes" ; then
|
|
|
|
AC_DEFINE(HAVE_FOPENCOOKIE, 1, [ ])
|
|
|
|
AC_DEFINE_UNQUOTED(COOKIE_IO_FUNCTIONS_T, $cookie_io_functions_t, [ ])
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
])
|