2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
1999-04-17 08:37:12 +08:00
|
|
|
dnl $Id$
|
|
|
|
dnl
|
|
|
|
dnl This file contains local autoconf functions.
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
dnl Output stylize macros for configure (help/runtime)
|
|
|
|
dnl -------------------------------------------------------------------------
|
2000-03-26 10:47:00 +08:00
|
|
|
|
2002-03-07 22:20:02 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_HELP_SEPARATOR(title)
|
2002-03-07 22:20:02 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl Adds separator title into the configure --help display.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_HELP_SEPARATOR],[
|
|
|
|
AC_ARG_ENABLE([],[
|
|
|
|
$1
|
|
|
|
],[])
|
2002-03-07 22:20:02 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_CONFIGURE_PART(title)
|
|
|
|
dnl
|
|
|
|
dnl Adds separator title configure output (idea borrowed from mm)
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CONFIGURE_PART],[
|
|
|
|
AC_MSG_RESULT()
|
|
|
|
AC_MSG_RESULT([${T_MD}$1${T_ME}])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
dnl Build system helper macros
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_DEF_HAVE(what)
|
|
|
|
dnl
|
|
|
|
dnl Generates 'AC_DEFINE(HAVE_WHAT, 1, [ ])'
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_DEF_HAVE],[AC_DEFINE([HAVE_]translit($1,a-z_-,A-Z__), 1, [ ])])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_RUN_ONCE(namespace, variable, code)
|
|
|
|
dnl
|
|
|
|
dnl execute code, if variable is not set in namespace
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_RUN_ONCE],[
|
|
|
|
changequote({,})
|
|
|
|
unique=`echo $2|sed 's/[^a-zA-Z0-9]/_/g'`
|
|
|
|
changequote([,])
|
|
|
|
cmd="echo $ac_n \"\$$1$unique$ac_c\""
|
|
|
|
if test -n "$unique" && test "`eval $cmd`" = "" ; then
|
|
|
|
eval "$1$unique=set"
|
|
|
|
$3
|
|
|
|
fi
|
2003-09-03 03:42:17 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_EXPAND_PATH(path, variable)
|
|
|
|
dnl
|
|
|
|
dnl expands path to an absolute path and assigns it to variable
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_EXPAND_PATH],[
|
|
|
|
if test -z "$1" || echo "$1" | grep '^/' >/dev/null ; then
|
|
|
|
$2=$1
|
|
|
|
else
|
|
|
|
changequote({,})
|
|
|
|
ep_dir="`echo $1|sed 's%/*[^/][^/]*/*$%%'`"
|
|
|
|
changequote([,])
|
|
|
|
ep_realdir="`(cd \"$ep_dir\" && pwd)`"
|
|
|
|
$2="$ep_realdir/`basename \"$1\"`"
|
|
|
|
fi
|
|
|
|
])
|
2002-03-07 22:20:02 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_DEFINE(WHAT [, value[, directory]])
|
2002-03-07 22:20:02 +08:00
|
|
|
dnl
|
2002-03-20 21:24:59 +08:00
|
|
|
dnl Creates builddir/include/what.h and in there #define WHAT value
|
2002-03-07 22:20:02 +08:00
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_DEFINE],[
|
2004-12-07 04:39:20 +08:00
|
|
|
[echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" > ]ifelse([$3],,[include],[$3])[/php_]translit($1,A-Z,a-z)[.h]
|
2002-03-07 22:20:02 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_SUBST(varname)
|
|
|
|
dnl
|
|
|
|
dnl Adds variable with it's value into Makefile, e.g.:
|
|
|
|
dnl CC = gcc
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_SUBST],[
|
|
|
|
PHP_VAR_SUBST="$PHP_VAR_SUBST $1"
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_SUBST_OLD(varname)
|
|
|
|
dnl
|
|
|
|
dnl Same as PHP_SUBST() but also substitutes all @VARNAME@
|
|
|
|
dnl instances in every file passed to AC_OUTPUT()
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_SUBST_OLD],[
|
|
|
|
PHP_SUBST($1)
|
|
|
|
AC_SUBST($1)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_OUTPUT(file)
|
|
|
|
dnl
|
|
|
|
dnl Adds "file" to the list of files generated by AC_OUTPUT
|
|
|
|
dnl This macro can be used several times.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_OUTPUT],[
|
|
|
|
PHP_OUTPUT_FILES="$PHP_OUTPUT_FILES $1"
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
dnl Build system base macros
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
dnl
|
2005-01-07 14:12:42 +08:00
|
|
|
dnl PHP_CANONICAL_HOST_TARGET
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CANONICAL_HOST_TARGET],[
|
|
|
|
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
|
|
|
AC_REQUIRE([AC_CANONICAL_TARGET])dnl
|
|
|
|
dnl Make sure we do not continue if host_alias is empty.
|
|
|
|
if test -z "$host_alias" && test -n "$host"; then
|
|
|
|
host_alias=$host
|
|
|
|
fi
|
|
|
|
if test -z "$host_alias"; then
|
|
|
|
AC_MSG_ERROR([host_alias is not set!])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
2002-03-07 22:20:02 +08:00
|
|
|
dnl PHP_INIT_BUILD_SYSTEM
|
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_INIT_BUILD_SYSTEM],[
|
2005-01-07 14:12:42 +08:00
|
|
|
AC_REQUIRE([PHP_CANONICAL_HOST_TARGET])dnl
|
2003-04-01 16:05:01 +08:00
|
|
|
test -d include || mkdir include
|
2002-03-07 22:20:02 +08:00
|
|
|
> Makefile.objects
|
|
|
|
> Makefile.fragments
|
2002-11-15 08:20:17 +08:00
|
|
|
dnl We need to play tricks here to avoid matching the grep line itself
|
2002-03-20 21:24:59 +08:00
|
|
|
pattern=define
|
2003-07-01 08:16:23 +08:00
|
|
|
egrep $pattern'.*include/php' $srcdir/configure|sed 's/.*>//'|xargs touch 2>/dev/null
|
2002-03-07 22:20:02 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
2002-03-07 22:20:02 +08:00
|
|
|
dnl PHP_GEN_GLOBAL_MAKEFILE
|
|
|
|
dnl
|
|
|
|
dnl Generates the global makefile.
|
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_GEN_GLOBAL_MAKEFILE],[
|
2002-03-07 22:20:02 +08:00
|
|
|
cat >Makefile <<EOF
|
|
|
|
srcdir = $abs_srcdir
|
|
|
|
builddir = $abs_builddir
|
|
|
|
top_srcdir = $abs_srcdir
|
|
|
|
top_builddir = $abs_builddir
|
|
|
|
EOF
|
|
|
|
for i in $PHP_VAR_SUBST; do
|
|
|
|
eval echo "$i = \$$i" >> Makefile
|
|
|
|
done
|
|
|
|
|
|
|
|
cat $abs_srcdir/Makefile.global Makefile.fragments Makefile.objects >> Makefile
|
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_ADD_MAKEFILE_FRAGMENT([srcfile [, ext_srcdir [, ext_builddir]]])
|
|
|
|
dnl
|
|
|
|
dnl Processes a file called Makefile.frag in the source directory
|
|
|
|
dnl of the most recently added extension. $(srcdir) and $(builddir)
|
|
|
|
dnl are substituted with the proper paths. Can be used to supply
|
|
|
|
dnl custom rules and/or additional targets.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_ADD_MAKEFILE_FRAGMENT],[
|
|
|
|
ifelse($1,,src=$ext_srcdir/Makefile.frag,src=$1)
|
|
|
|
ifelse($2,,ac_srcdir=$ext_srcdir,ac_srcdir=$2)
|
|
|
|
ifelse($3,,ac_builddir=$ext_builddir,ac_builddir=$3)
|
|
|
|
sed -e "s#\$(srcdir)#$ac_srcdir#g" -e "s#\$(builddir)#$ac_builddir#g" $src >> Makefile.fragments
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_ADD_SOURCES(source-path, sources [, special-flags [, type]])
|
2002-03-07 22:20:02 +08:00
|
|
|
dnl
|
|
|
|
dnl Adds sources which are located relative to source-path to the
|
|
|
|
dnl array of type type. Sources are processed with optional
|
|
|
|
dnl special-flags which are passed to the compiler. Sources
|
|
|
|
dnl can be either written in C or C++ (filenames shall end in .c
|
|
|
|
dnl or .cpp, respectively).
|
|
|
|
dnl
|
|
|
|
dnl Note: If source-path begins with a "/", the "/" is removed and
|
|
|
|
dnl the path is interpreted relative to the top build-directory.
|
|
|
|
dnl
|
|
|
|
dnl which array to append to?
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_ADD_SOURCES],[
|
2002-03-13 20:48:05 +08:00
|
|
|
PHP_ADD_SOURCES_X($1, $2, $3, ifelse($4,cli,PHP_CLI_OBJS,ifelse($4,sapi,PHP_SAPI_OBJS,PHP_GLOBAL_OBJS)))
|
2002-03-07 22:20:02 +08:00
|
|
|
])
|
2005-02-25 02:11:36 +08:00
|
|
|
|
2002-03-27 19:09:20 +08:00
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
dnl _PHP_ASSIGN_BUILD_VARS(type)
|
2002-03-27 19:09:20 +08:00
|
|
|
dnl internal, don't use
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([_PHP_ASSIGN_BUILD_VARS],[
|
2002-03-20 21:24:59 +08:00
|
|
|
ifelse($1,shared,[
|
|
|
|
b_c_pre=$shared_c_pre
|
|
|
|
b_cxx_pre=$shared_cxx_pre
|
|
|
|
b_c_meta=$shared_c_meta
|
|
|
|
b_cxx_meta=$shared_cxx_meta
|
|
|
|
b_c_post=$shared_c_post
|
|
|
|
b_cxx_post=$shared_cxx_post
|
|
|
|
],[
|
|
|
|
b_c_pre=$php_c_pre
|
|
|
|
b_cxx_pre=$php_cxx_pre
|
|
|
|
b_c_meta=$php_c_meta
|
|
|
|
b_cxx_meta=$php_cxx_meta
|
|
|
|
b_c_post=$php_c_post
|
|
|
|
b_cxx_post=$php_cxx_post
|
|
|
|
])dnl
|
2002-03-07 22:20:02 +08:00
|
|
|
b_lo=[$]$1_lo
|
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
2002-03-07 22:20:02 +08:00
|
|
|
dnl PHP_ADD_SOURCES_X(source-path, sources[, special-flags[, target-var[, shared[, special-post-flags]]]])
|
|
|
|
dnl
|
|
|
|
dnl Additional to PHP_ADD_SOURCES (see above), this lets you set the
|
|
|
|
dnl name of the array target-var directly, as well as whether
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl shared objects will be built from the sources.
|
|
|
|
dnl
|
|
|
|
dnl Should not be used directly.
|
2002-03-07 22:20:02 +08:00
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_ADD_SOURCES_X],[
|
2002-03-07 22:20:02 +08:00
|
|
|
dnl relative to source- or build-directory?
|
2002-04-06 21:42:40 +08:00
|
|
|
dnl ac_srcdir/ac_bdir include trailing slash
|
2002-03-07 22:20:02 +08:00
|
|
|
case $1 in
|
2002-05-29 00:30:16 +08:00
|
|
|
""[)] ac_srcdir="$abs_srcdir/"; unset ac_bdir; ac_inc="-I. -I$abs_srcdir" ;;
|
2002-07-06 03:06:53 +08:00
|
|
|
/*[)] ac_srcdir=`echo "$1"|cut -c 2-`"/"; ac_bdir=$ac_srcdir; ac_inc="-I$ac_bdir -I$abs_srcdir/$ac_bdir" ;;
|
2002-04-06 21:42:40 +08:00
|
|
|
*[)] ac_srcdir="$abs_srcdir/$1/"; ac_bdir="$1/"; ac_inc="-I$ac_bdir -I$ac_srcdir" ;;
|
2002-03-07 22:20:02 +08:00
|
|
|
esac
|
|
|
|
|
|
|
|
dnl how to build .. shared or static?
|
2002-10-24 18:41:36 +08:00
|
|
|
ifelse($5,yes,_PHP_ASSIGN_BUILD_VARS(shared),_PHP_ASSIGN_BUILD_VARS(php))
|
2002-03-07 22:20:02 +08:00
|
|
|
|
|
|
|
dnl iterate over the sources
|
2002-03-13 20:48:05 +08:00
|
|
|
old_IFS=[$]IFS
|
2002-03-07 22:20:02 +08:00
|
|
|
for ac_src in $2; do
|
|
|
|
|
|
|
|
dnl remove the suffix
|
|
|
|
IFS=.
|
|
|
|
set $ac_src
|
|
|
|
ac_obj=[$]1
|
|
|
|
IFS=$old_IFS
|
|
|
|
|
2002-04-06 21:42:40 +08:00
|
|
|
dnl append to the array which has been dynamically chosen at m4 time
|
|
|
|
$4="[$]$4 [$]ac_bdir[$]ac_obj.lo"
|
2002-03-07 22:20:02 +08:00
|
|
|
|
|
|
|
dnl choose the right compiler/flags/etc. for the source-file
|
|
|
|
case $ac_src in
|
2002-04-06 21:42:40 +08:00
|
|
|
*.c[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
|
2004-01-10 07:37:29 +08:00
|
|
|
*.s[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
|
|
|
|
*.S[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
|
2005-04-21 04:48:19 +08:00
|
|
|
*.cpp|*.cc[)] ac_comp="$b_cxx_pre $3 $ac_inc $b_cxx_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_cxx_post" ;;
|
2002-03-07 22:20:02 +08:00
|
|
|
esac
|
|
|
|
|
|
|
|
dnl create a rule for the object/source combo
|
|
|
|
cat >>Makefile.objects<<EOF
|
2002-04-06 21:42:40 +08:00
|
|
|
$ac_bdir[$]ac_obj.lo: $ac_srcdir[$]ac_src
|
2002-03-07 22:20:02 +08:00
|
|
|
$ac_comp
|
|
|
|
EOF
|
|
|
|
done
|
|
|
|
])
|
2000-05-01 10:42:55 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
dnl Compiler characteristics checks
|
|
|
|
dnl -------------------------------------------------------------------------
|
2001-12-01 08:59:43 +08:00
|
|
|
|
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
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_TARGET_RDYNAMIC],[
|
2001-06-15 20:53:20 +08:00
|
|
|
if test -n "$GCC"; then
|
|
|
|
dnl we should use a PHP-specific macro here
|
2005-02-25 02:11:36 +08:00
|
|
|
PHP_CHECK_GCC_ARG(-rdynamic, gcc_rdynamic=yes)
|
2001-06-15 20:53:20 +08:00
|
|
|
if test "$gcc_rdynamic" = "yes"; then
|
|
|
|
PHP_LDFLAGS="$PHP_LDFLAGS -rdynamic"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_RUNPATH_SWITCH
|
|
|
|
dnl
|
|
|
|
dnl Checks for -R, etc. switch
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_RUNPATH_SWITCH],[
|
|
|
|
AC_MSG_CHECKING([if compiler supports -R])
|
|
|
|
AC_CACHE_VAL(php_cv_cc_dashr,[
|
|
|
|
SAVE_LIBS=$LIBS
|
|
|
|
LIBS="-R /usr/$PHP_LIBDIR $LIBS"
|
|
|
|
AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
|
|
|
|
LIBS=$SAVE_LIBS])
|
|
|
|
AC_MSG_RESULT([$php_cv_cc_dashr])
|
|
|
|
if test $php_cv_cc_dashr = "yes"; then
|
|
|
|
ld_runpath_switch=-R
|
|
|
|
else
|
|
|
|
AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
|
|
|
|
AC_CACHE_VAL(php_cv_cc_rpath,[
|
|
|
|
SAVE_LIBS=$LIBS
|
|
|
|
LIBS="-Wl,-rpath,/usr/$PHP_LIBDIR $LIBS"
|
|
|
|
AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
|
|
|
|
LIBS=$SAVE_LIBS])
|
|
|
|
AC_MSG_RESULT([$php_cv_cc_rpath])
|
|
|
|
if test $php_cv_cc_rpath = "yes"; then
|
|
|
|
ld_runpath_switch=-Wl,-rpath,
|
|
|
|
else
|
|
|
|
dnl something innocuous
|
|
|
|
ld_runpath_switch=-L
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_CHECK_GCC_ARG(arg, action-if-found, action-if-not-found)
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CHECK_GCC_ARG],[
|
|
|
|
gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_)
|
|
|
|
AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [
|
|
|
|
echo 'void somefunc() { };' > conftest.c
|
|
|
|
cmd='$CC $1 -c conftest.c'
|
|
|
|
if eval $cmd 2>&1 | egrep -e $1 >/dev/null ; then
|
|
|
|
ac_result=no
|
|
|
|
else
|
|
|
|
ac_result=yes
|
|
|
|
fi
|
|
|
|
eval $gcc_arg_name=$ac_result
|
|
|
|
rm -f conftest.*
|
|
|
|
])
|
|
|
|
if eval test "\$$gcc_arg_name" = "yes"; then
|
|
|
|
$2
|
|
|
|
else
|
|
|
|
:
|
|
|
|
$3
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_LIBGCC_LIBPATH(gcc)
|
|
|
|
dnl
|
|
|
|
dnl Stores the location of libgcc in libgcc_libpath
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_LIBGCC_LIBPATH],[
|
|
|
|
changequote({,})
|
|
|
|
libgcc_libpath=`$1 --print-libgcc-file-name|sed 's%/*[^/][^/]*$%%'`
|
|
|
|
changequote([,])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
dnl Macros to modify LIBS, INCLUDES, etc. variables
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_REMOVE_USR_LIB(NAME)
|
|
|
|
dnl
|
|
|
|
dnl Removes all -L/usr/$PHP_LIBDIR entries from variable NAME
|
|
|
|
dnl
|
2002-10-24 18:41:36 +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
|
2004-11-03 22:07:09 +08:00
|
|
|
-L/usr/$PHP_LIBDIR|-L/usr/$PHP_LIBDIR/[)] ;;
|
2003-07-04 06:54:57 +08:00
|
|
|
*[)] ac_new_flags="[$]ac_new_flags [$]i" ;;
|
2001-05-09 21:57:56 +08:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
$1=[$]ac_new_flags
|
|
|
|
])
|
2002-01-22 00:39:17 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_EVAL_LIBLINE(libline, SHARED-LIBADD)
|
2000-06-17 18:50:42 +08:00
|
|
|
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
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_EVAL_LIBLINE],[
|
2000-06-17 18:50:42 +08:00
|
|
|
for ac_i in $1; do
|
2001-05-12 19:09:05 +08:00
|
|
|
case $ac_i in
|
2003-07-04 06:54:57 +08:00
|
|
|
-l*[)]
|
2000-06-17 18:50:42 +08:00
|
|
|
ac_ii=`echo $ac_i|cut -c 3-`
|
2002-07-07 08:47:16 +08:00
|
|
|
PHP_ADD_LIBRARY($ac_ii,1,$2)
|
2000-06-17 18:50:42 +08:00
|
|
|
;;
|
2003-07-04 06:54:57 +08:00
|
|
|
-L*[)]
|
2000-06-17 18:50:42 +08:00
|
|
|
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
|
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_EVAL_INCLINE(headerline)
|
2000-06-17 18:50:42 +08:00
|
|
|
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
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_EVAL_INCLINE],[
|
2000-06-17 18:50:42 +08:00
|
|
|
for ac_i in $1; do
|
2001-05-12 19:09:05 +08:00
|
|
|
case $ac_i in
|
2003-07-04 06:54:57 +08:00
|
|
|
-I*[)]
|
2000-06-17 18:50:42 +08:00
|
|
|
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
|
|
|
|
])
|
2002-09-05 02:47:28 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl internal, don't use
|
|
|
|
AC_DEFUN([_PHP_ADD_LIBPATH_GLOBAL],[
|
|
|
|
PHP_RUN_ONCE(LIBPATH, $1, [
|
|
|
|
test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$1"
|
|
|
|
LDFLAGS="$LDFLAGS -L$1"
|
|
|
|
PHP_RPATHS="$PHP_RPATHS $1"
|
2000-05-23 23:13:16 +08:00
|
|
|
])
|
2005-02-25 02:11:36 +08:00
|
|
|
])dnl
|
|
|
|
dnl
|
|
|
|
dnl
|
|
|
|
dnl PHP_ADD_LIBPATH(path [, SHARED-LIBADD])
|
|
|
|
dnl
|
|
|
|
dnl Adds a path to linkpath/runpath (LDFLAGS)
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_ADD_LIBPATH],[
|
|
|
|
if test "$1" != "/usr/$PHP_LIBDIR"; then
|
|
|
|
PHP_EXPAND_PATH($1, ai_p)
|
|
|
|
ifelse([$2],,[
|
|
|
|
_PHP_ADD_LIBPATH_GLOBAL([$ai_p])
|
|
|
|
],[
|
|
|
|
if test "$ext_shared" = "yes"; then
|
|
|
|
$2="$ld_runpath_switch$ai_p -L$ai_p [$]$2"
|
|
|
|
else
|
|
|
|
_PHP_ADD_LIBPATH_GLOBAL([$ai_p])
|
|
|
|
fi
|
|
|
|
])
|
2000-05-23 23:13:16 +08:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_UTILIZE_RPATHS()
|
|
|
|
dnl
|
|
|
|
dnl builds RPATHS/LDFLAGS from PHP_RPATHS
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_UTILIZE_RPATHS],[
|
|
|
|
OLD_RPATHS=$PHP_RPATHS
|
|
|
|
unset PHP_RPATHS
|
2000-05-18 19:35:17 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
for i in $OLD_RPATHS; do
|
|
|
|
dnl Can be passed to native cc/libtool
|
|
|
|
PHP_LDFLAGS="$PHP_LDFLAGS -L$i"
|
|
|
|
dnl Libtool-specific
|
|
|
|
PHP_RPATHS="$PHP_RPATHS -R $i"
|
|
|
|
dnl cc-specific
|
|
|
|
NATIVE_RPATHS="$NATIVE_RPATHS $ld_runpath_switch$i"
|
|
|
|
done
|
2000-05-18 03:08:44 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
if test "$PHP_RPATH" = "no"; then
|
|
|
|
unset PHP_RPATHS
|
|
|
|
unset NATIVE_RPATHS
|
|
|
|
fi
|
2000-05-18 03:08:44 +08:00
|
|
|
])
|
2001-05-21 07:39:09 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_ADD_INCLUDE(path [,before])
|
|
|
|
dnl
|
|
|
|
dnl add an include path.
|
|
|
|
dnl if before is 1, add in the beginning of INCLUDES.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_ADD_INCLUDE],[
|
|
|
|
if test "$1" != "/usr/include"; then
|
|
|
|
PHP_EXPAND_PATH($1, ai_p)
|
|
|
|
PHP_RUN_ONCE(INCLUDEPATH, $ai_p, [
|
|
|
|
if test "$2"; then
|
|
|
|
INCLUDES="-I$ai_p $INCLUDES"
|
|
|
|
else
|
|
|
|
INCLUDES="$INCLUDES -I$ai_p"
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
fi
|
|
|
|
])
|
2002-10-02 14:05:16 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl internal, don't use
|
|
|
|
AC_DEFUN([_PHP_X_ADD_LIBRARY],[dnl
|
|
|
|
ifelse([$2],,$3="-l$1 [$]$3", $3="[$]$3 -l$1") dnl
|
|
|
|
])dnl
|
|
|
|
dnl
|
|
|
|
dnl internal, don't use
|
|
|
|
AC_DEFUN([_PHP_ADD_LIBRARY_SKELETON],[
|
|
|
|
case $1 in
|
|
|
|
c|c_r|pthread*[)] ;;
|
|
|
|
*[)] ifelse($3,,[
|
|
|
|
_PHP_X_ADD_LIBRARY($1,$2,$5)
|
2002-09-06 18:27:26 +08:00
|
|
|
],[
|
2005-02-25 02:11:36 +08:00
|
|
|
if test "$ext_shared" = "yes"; then
|
|
|
|
_PHP_X_ADD_LIBRARY($1,$2,$3)
|
|
|
|
else
|
|
|
|
$4($1,$2)
|
|
|
|
fi
|
|
|
|
]) ;;
|
|
|
|
esac
|
|
|
|
])dnl
|
|
|
|
dnl
|
|
|
|
dnl
|
|
|
|
dnl PHP_ADD_LIBRARY(library[, append[, shared-libadd]])
|
|
|
|
dnl
|
|
|
|
dnl add a library to the link line
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_ADD_LIBRARY],[
|
|
|
|
_PHP_ADD_LIBRARY_SKELETON([$1],[$2],[$3],[PHP_ADD_LIBRARY],[LIBS])
|
2001-05-21 07:39:09 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_ADD_LIBRARY_DEFER(library[, append[, shared-libadd]])
|
|
|
|
dnl
|
|
|
|
dnl add a library to the link line (deferred, not used during configure)
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_ADD_LIBRARY_DEFER],[
|
|
|
|
_PHP_ADD_LIBRARY_SKELETON([$1],[$2],[$3],[PHP_ADD_LIBRARY_DEFER],[DLIBS])
|
2002-09-06 18:27:26 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_ADD_LIBRARY_WITH_PATH(library, path[, shared-libadd])
|
|
|
|
dnl
|
|
|
|
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
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_ADD_LIBRARY_WITH_PATH],[
|
|
|
|
ifelse($3,,[
|
|
|
|
if test -n "$2"; then
|
|
|
|
PHP_ADD_LIBPATH($2)
|
|
|
|
fi
|
|
|
|
PHP_ADD_LIBRARY($1)
|
|
|
|
],[
|
|
|
|
if test "$ext_shared" = "yes"; then
|
|
|
|
$3="-l$1 [$]$3"
|
|
|
|
if test -n "$2"; then
|
|
|
|
PHP_ADD_LIBPATH($2,$3)
|
2002-09-06 18:27:26 +08:00
|
|
|
fi
|
2005-02-25 02:11:36 +08:00
|
|
|
else
|
|
|
|
PHP_ADD_LIBRARY_WITH_PATH($1,$2)
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
])
|
2002-09-06 18:27:26 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_ADD_LIBRARY_DEFER_WITH_PATH(library, path[, shared-libadd])
|
|
|
|
dnl
|
|
|
|
dnl add a library to the link line (deferred)
|
|
|
|
dnl and path to linkpath/runpath (not deferred)
|
|
|
|
dnl if shared-libadd is not empty and $ext_shared is yes,
|
|
|
|
dnl shared-libadd will be assigned the library information
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_ADD_LIBRARY_DEFER_WITH_PATH],[
|
|
|
|
ifelse($3,,[
|
|
|
|
if test -n "$2"; then
|
|
|
|
PHP_ADD_LIBPATH($2)
|
|
|
|
fi
|
|
|
|
PHP_ADD_LIBRARY_DEFER($1)
|
|
|
|
],[
|
|
|
|
if test "$ext_shared" = "yes"; then
|
|
|
|
$3="-l$1 [$]$3"
|
|
|
|
if test -n "$2"; then
|
|
|
|
PHP_ADD_LIBPATH($2,$3)
|
2002-10-02 14:05:16 +08:00
|
|
|
fi
|
2005-02-25 02:11:36 +08:00
|
|
|
else
|
|
|
|
PHP_ADD_LIBRARY_DEFER_WITH_PATH($1,$2)
|
|
|
|
fi
|
|
|
|
])
|
2001-05-21 07:39:09 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_ADD_FRAMEWORK(framework [,before])
|
|
|
|
dnl
|
|
|
|
dnl add a (Darwin / Mac OS X) framework to the link
|
|
|
|
dnl line. if before is 1, the framework is added
|
|
|
|
dnl to the beginning of the line.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_ADD_FRAMEWORK], [
|
|
|
|
PHP_RUN_ONCE(FRAMEWORKS, $1, [
|
|
|
|
if test "$2"; then
|
|
|
|
PHP_FRAMEWORKS="-framework $1 $PHP_FRAMEWORKS"
|
|
|
|
else
|
|
|
|
PHP_FRAMEWORKS="$PHP_FRAMEWORKS -framework $1"
|
2002-09-06 18:27:26 +08:00
|
|
|
fi
|
|
|
|
])
|
2005-02-25 02:11:36 +08:00
|
|
|
])
|
2002-09-06 18:27:26 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_ADD_FRAMEWORKPATH(path [,before])
|
|
|
|
dnl
|
|
|
|
dnl add a (Darwin / Mac OS X) framework path to the link
|
|
|
|
dnl and include lines. default paths include (but are
|
|
|
|
dnl not limited to) /Local/Library/Frameworks and
|
|
|
|
dnl /System/Library/Frameworks, so these don't need
|
|
|
|
dnl to be specifically added. if before is 1, the
|
|
|
|
dnl framework path is added to the beginning of the
|
|
|
|
dnl relevant lines.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_ADD_FRAMEWORKPATH], [
|
|
|
|
PHP_EXPAND_PATH($1, ai_p)
|
|
|
|
PHP_RUN_ONCE(FRAMEWORKPATH, $ai_p, [
|
|
|
|
if test "$2"; then
|
|
|
|
PHP_FRAMEWORKPATH="-F$ai_p $PHP_FRAMEWORKPATH"
|
|
|
|
else
|
|
|
|
PHP_FRAMEWORKPATH="$PHP_FRAMEWORKPATH -F$ai_p"
|
2002-10-02 14:05:16 +08:00
|
|
|
fi
|
2005-02-25 02:11:36 +08:00
|
|
|
])
|
2002-09-06 18:27:26 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_ADD_FRAMEWORK_WITH_PATH(framework, path)
|
|
|
|
dnl
|
|
|
|
dnl Adds a (Darwin / Mac OS X) framework path and the
|
|
|
|
dnl framework itself to the link and include lines.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_ADD_FRAMEWORK_WITH_PATH], [
|
|
|
|
PHP_ADD_FRAMEWORKPATH($2)
|
|
|
|
PHP_ADD_FRAMEWORK($1)
|
2000-05-04 18:38:17 +08:00
|
|
|
])
|
|
|
|
|
2000-03-30 23:00:30 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_SET_LIBTOOL_VARIABLE(var)
|
2000-03-30 23:00:30 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl Set libtool variable
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_SET_LIBTOOL_VARIABLE],[
|
|
|
|
if test -z "$LIBTOOL"; then
|
|
|
|
LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
|
|
|
|
else
|
|
|
|
LIBTOOL="$LIBTOOL $1"
|
|
|
|
fi
|
2000-03-30 23:00:30 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
dnl Wrapper macros for AC_ARG_WITH / AC_ARG_ENABLE
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
dnl PHP_ARG_ANALYZE_EX
|
|
|
|
dnl internal
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_ARG_ANALYZE_EX],[
|
2002-03-13 20:30:49 +08:00
|
|
|
ext_output="yes, shared"
|
|
|
|
ext_shared=yes
|
2001-05-12 19:09:05 +08:00
|
|
|
case [$]$1 in
|
2003-07-04 06:54:57 +08:00
|
|
|
shared,*[)]
|
2000-12-03 18:58:18 +08:00
|
|
|
$1=`echo "[$]$1"|sed 's/^shared,//'`
|
2000-05-01 10:42:55 +08:00
|
|
|
;;
|
2003-07-04 06:54:57 +08:00
|
|
|
shared[)]
|
2000-05-01 10:42:55 +08:00
|
|
|
$1=yes
|
|
|
|
;;
|
2003-07-04 06:54:57 +08:00
|
|
|
no[)]
|
2001-05-12 18:33:52 +08:00
|
|
|
ext_output=no
|
2000-05-01 10:42:55 +08:00
|
|
|
ext_shared=no
|
|
|
|
;;
|
2003-07-04 06:54:57 +08:00
|
|
|
*[)]
|
2001-05-12 18:33:52 +08:00
|
|
|
ext_output=yes
|
2000-05-01 10:42:55 +08:00
|
|
|
ext_shared=no
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2002-03-13 20:30:49 +08:00
|
|
|
PHP_ALWAYS_SHARED([$1])
|
|
|
|
])
|
2000-05-03 04:56:03 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_ARG_ANALYZE
|
|
|
|
dnl internal
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_ARG_ANALYZE],[
|
2003-03-25 21:43:13 +08:00
|
|
|
ifelse([$3],yes,[PHP_ARG_ANALYZE_EX([$1])],[ext_output=ifelse([$]$1,,no,[$]$1)])
|
2002-03-07 22:20:02 +08:00
|
|
|
ifelse([$2],,,[AC_MSG_RESULT([$ext_output])])
|
2000-05-01 10:42:55 +08:00
|
|
|
])
|
|
|
|
|
2000-03-30 23:00:30 +08:00
|
|
|
dnl
|
2002-09-05 02:47:28 +08:00
|
|
|
dnl PHP_ARG_WITH(arg-name, check message, help text[, default-val[, extension-or-not]])
|
2000-03-30 23:00:30 +08:00
|
|
|
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.
|
2002-09-05 02:47:28 +08:00
|
|
|
dnl If extension-or-not is yes (default), then do the ENABLE_ALL check and run
|
|
|
|
dnl the PHP_ARG_ANALYZE_EX.
|
2000-03-30 23:00:30 +08:00
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_ARG_WITH],[
|
2002-09-05 02:47:28 +08:00
|
|
|
PHP_REAL_ARG_WITH([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z0-9-,A-Z0-9_),[ifelse($5,,yes,$5)])
|
2000-05-01 10:42:55 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_REAL_ARG_WITH
|
|
|
|
dnl internal
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_REAL_ARG_WITH],[
|
2002-03-07 22:20:02 +08:00
|
|
|
ifelse([$2],,,[AC_MSG_CHECKING([$2])])
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_ARG_WITH($1,[$3],$5=[$]withval,
|
|
|
|
[
|
|
|
|
$5=ifelse($4,,no,$4)
|
|
|
|
|
|
|
|
if test "$PHP_ENABLE_ALL" && test "$6" = "yes"; then
|
|
|
|
$5=$PHP_ENABLE_ALL
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
PHP_ARG_ANALYZE($5,[$2],$6)
|
1999-12-30 10:59:53 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_ARG_ENABLE(arg-name, check message, help text[, default-val[, extension-or-not]])
|
|
|
|
dnl Sets PHP_ARG_NAME either to the user value or to the default value.
|
|
|
|
dnl default-val defaults to no. This will also set the variable ext_shared,
|
|
|
|
dnl and will overwrite any previous variable of that name.
|
|
|
|
dnl If extension-or-not is yes (default), then do the ENABLE_ALL check and run
|
|
|
|
dnl the PHP_ARG_ANALYZE_EX.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_ARG_ENABLE],[
|
|
|
|
PHP_REAL_ARG_ENABLE([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z-,A-Z_),[ifelse($5,,yes,$5)])
|
1999-12-30 10:59:53 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_REAL_ARG_ENABLE
|
|
|
|
dnl internal
|
|
|
|
AC_DEFUN([PHP_REAL_ARG_ENABLE],[
|
|
|
|
ifelse([$2],,,[AC_MSG_CHECKING([$2])])
|
|
|
|
AC_ARG_ENABLE($1,[$3],$5=[$]enableval,
|
|
|
|
[
|
|
|
|
$5=ifelse($4,,no,$4)
|
|
|
|
|
|
|
|
if test "$PHP_ENABLE_ALL" && test "$6" = "yes"; then
|
|
|
|
$5=$PHP_ENABLE_ALL
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
PHP_ARG_ANALYZE($5,[$2],$6)
|
1999-12-30 10:59:53 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
dnl Build macros
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
|
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
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_SET_SYM_FILE],
|
1999-11-21 03:00:17 +08:00
|
|
|
[
|
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
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_BUILD_THREAD_SAFE],[
|
2003-01-20 05:37:40 +08:00
|
|
|
enable_maintainer_zts=yes
|
2000-05-04 17:42:27 +08:00
|
|
|
if test "$pthreads_working" != "yes"; then
|
2001-09-07 04:55:24 +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
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_REQUIRE_CXX
|
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_REQUIRE_CXX],[
|
2000-07-10 04:39:18 +08:00
|
|
|
if test -z "$php_cxx_done"; then
|
2005-03-04 23:13:03 +08:00
|
|
|
AC_PROG_CXX
|
|
|
|
AC_PROG_CXXCPP
|
2000-07-10 04:39:18 +08:00
|
|
|
php_cxx_done=yes
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
1999-10-04 23:18:26 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_BUILD_SHARED
|
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_BUILD_SHARED],[
|
2002-03-07 22:20:02 +08:00
|
|
|
PHP_BUILD_PROGRAM
|
2003-03-29 12:52:46 +08:00
|
|
|
OVERALL_TARGET=libphp5.la
|
1999-10-04 23:18:26 +08:00
|
|
|
php_build_target=shared
|
2002-03-07 22:20:02 +08:00
|
|
|
|
|
|
|
php_c_pre=$shared_c_pre
|
|
|
|
php_c_meta=$shared_c_meta
|
|
|
|
php_c_post=$shared_c_post
|
|
|
|
php_cxx_pre=$shared_cxx_pre
|
|
|
|
php_cxx_meta=$shared_cxx_meta
|
|
|
|
php_cxx_post=$shared_cxx_post
|
|
|
|
php_lo=$shared_lo
|
1999-10-04 23:18:26 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_BUILD_STATIC
|
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_BUILD_STATIC],[
|
2002-03-07 22:20:02 +08:00
|
|
|
PHP_BUILD_PROGRAM
|
2003-03-29 12:52:46 +08:00
|
|
|
OVERALL_TARGET=libphp5.la
|
1999-10-04 23:18:26 +08:00
|
|
|
php_build_target=static
|
|
|
|
])
|
|
|
|
|
2002-03-30 11:17:25 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_BUILD_BUNDLE
|
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_BUILD_BUNDLE],[
|
2002-03-30 11:17:25 +08:00
|
|
|
PHP_BUILD_PROGRAM
|
2003-03-29 12:52:46 +08:00
|
|
|
OVERALL_TARGET=libs/libphp5.bundle
|
2002-03-30 11:17:25 +08:00
|
|
|
php_build_target=static
|
|
|
|
])
|
|
|
|
|
1999-10-04 23:18:26 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_BUILD_PROGRAM
|
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_BUILD_PROGRAM],[
|
2002-09-30 00:22:49 +08:00
|
|
|
OVERALL_TARGET=[]ifelse($1,,php,$1)
|
2002-03-07 22:20:02 +08:00
|
|
|
php_c_pre='$(CC)'
|
|
|
|
php_c_meta='$(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS)'
|
2002-03-14 00:59:49 +08:00
|
|
|
php_c_post=' && echo > $[@]'
|
2002-03-07 22:20:02 +08:00
|
|
|
php_cxx_pre='$(CXX)'
|
|
|
|
php_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS)'
|
2002-03-14 00:59:49 +08:00
|
|
|
php_cxx_post=' && echo > $[@]'
|
2002-03-07 22:20:02 +08:00
|
|
|
php_lo=o
|
2005-01-20 01:35:55 +08:00
|
|
|
|
|
|
|
case $with_pic in
|
|
|
|
yes) pic_setting='-prefer-pic';;
|
|
|
|
no) pic_setting='-prefer-non-pic';;
|
|
|
|
esac
|
|
|
|
|
2002-03-07 22:20:02 +08:00
|
|
|
shared_c_pre='$(LIBTOOL) --mode=compile $(CC)'
|
2005-01-20 01:35:55 +08:00
|
|
|
shared_c_meta='$(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) '$pic_setting
|
2002-03-07 22:20:02 +08:00
|
|
|
shared_c_post=
|
|
|
|
shared_cxx_pre='$(LIBTOOL) --mode=compile $(CXX)'
|
2005-01-20 01:35:55 +08:00
|
|
|
shared_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS) '$pic_setting
|
2002-03-07 22:20:02 +08:00
|
|
|
shared_cxx_post=
|
|
|
|
shared_lo=lo
|
|
|
|
|
1999-10-04 23:18:26 +08:00
|
|
|
php_build_target=program
|
|
|
|
])
|
|
|
|
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_SHARED_MODULE(module-name, object-var, build-dir, cxx)
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl Basically sets up the link-stage for building module-name
|
|
|
|
dnl from object_var in build-dir.
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_SHARED_MODULE],[
|
|
|
|
install_modules="install-modules"
|
1999-06-21 02:52:46 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
case $host_alias in
|
|
|
|
*darwin*[)]
|
|
|
|
suffix=so
|
|
|
|
link_cmd='ifelse($4,,[$(CC)],[$(CXX)]) -dynamic -flat_namespace -bundle -undefined suppress $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)'
|
|
|
|
;;
|
|
|
|
*[)]
|
|
|
|
suffix=la
|
|
|
|
link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)'
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
PHP_MODULES="$PHP_MODULES \$(phplibdir)/$1.$suffix"
|
|
|
|
PHP_SUBST($2)
|
|
|
|
cat >>Makefile.objects<<EOF
|
|
|
|
\$(phplibdir)/$1.$suffix: $3/$1.$suffix
|
|
|
|
\$(LIBTOOL) --mode=install cp $3/$1.$suffix \$(phplibdir)
|
|
|
|
|
|
|
|
$3/$1.$suffix: \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_DEPENDENCIES)
|
|
|
|
$link_cmd
|
|
|
|
|
|
|
|
EOF
|
1999-06-21 02:52:46 +08:00
|
|
|
])
|
2005-02-25 02:11:36 +08:00
|
|
|
|
2002-03-27 19:09:20 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_SELECT_SAPI(name, type[, sources [, extra-cflags [, build-target]]])
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl Selects the SAPI name and type (static, shared, programm)
|
|
|
|
dnl and optionally also the source-files for the SAPI-specific
|
|
|
|
dnl objects.
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_SELECT_SAPI],[
|
|
|
|
PHP_SAPI=$1
|
|
|
|
|
|
|
|
case "$2" in
|
|
|
|
static[)] PHP_BUILD_STATIC;;
|
|
|
|
shared[)] PHP_BUILD_SHARED;;
|
|
|
|
bundle[)] PHP_BUILD_BUNDLE;;
|
|
|
|
program[)] PHP_BUILD_PROGRAM($5);;
|
|
|
|
esac
|
|
|
|
|
|
|
|
ifelse($3,,,[PHP_ADD_SOURCES([sapi/$1],[$3],[$4],[sapi])])
|
1999-09-26 17:05:56 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl deprecated
|
|
|
|
AC_DEFUN([PHP_EXTENSION],[
|
|
|
|
sources=`$AWK -f $abs_srcdir/build/scan_makefile_in.awk < []PHP_EXT_SRCDIR($1)[]/Makefile.in`
|
2002-07-20 09:28:56 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
PHP_NEW_EXTENSION($1, $sources, $2, $3)
|
2002-07-20 09:28:56 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
if test -r "$ext_srcdir/Makefile.frag"; then
|
|
|
|
PHP_ADD_MAKEFILE_FRAGMENT
|
1999-09-26 17:05:56 +08:00
|
|
|
fi
|
1999-06-21 02:52:46 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_ADD_BUILD_DIR],[
|
|
|
|
BUILD_DIR="$BUILD_DIR $1"
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN([PHP_GEN_BUILD_DIRS],[
|
|
|
|
$php_shtool mkdir -p $BUILD_DIR
|
|
|
|
])
|
|
|
|
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags[, cxx]]]])
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl Includes an extension in the build.
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl "extname" is the name of the ext/ subdir where the extension resides.
|
|
|
|
dnl "sources" is a list of files relative to the subdir which are used
|
|
|
|
dnl to build the extension.
|
|
|
|
dnl "shared" can be set to "shared" or "yes" to build the extension as
|
|
|
|
dnl a dynamically loadable library. Optional parameter "sapi_class" can
|
|
|
|
dnl be set to "cli" to mark extension build only with CLI or CGI sapi's.
|
|
|
|
dnl extra-cflags are passed to the compiler, with @ext_srcdir@ being
|
|
|
|
dnl substituted.
|
|
|
|
AC_DEFUN([PHP_NEW_EXTENSION],[
|
|
|
|
ext_builddir=[]PHP_EXT_BUILDDIR($1)
|
|
|
|
ext_srcdir=[]PHP_EXT_SRCDIR($1)
|
|
|
|
|
|
|
|
ifelse($5,,ac_extra=,[ac_extra=`echo "$5"|sed s#@ext_srcdir@#$ext_srcdir#g`])
|
|
|
|
|
|
|
|
if test "$3" != "shared" && test "$3" != "yes" && test "$4" != "cli"; then
|
|
|
|
dnl ---------------------------------------------- Static module
|
|
|
|
|
|
|
|
PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,)
|
|
|
|
EXT_STATIC="$EXT_STATIC $1"
|
|
|
|
if test "$3" != "nocli"; then
|
|
|
|
EXT_CLI_STATIC="$EXT_CLI_STATIC $1"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
if test "$3" = "shared" || test "$3" = "yes"; then
|
|
|
|
dnl ---------------------------------------------- Shared module
|
|
|
|
PHP_ADD_SOURCES_X(PHP_EXT_DIR($1),$2,$ac_extra,shared_objects_$1,yes)
|
|
|
|
PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir, $6)
|
|
|
|
AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z_-,A-Z__), 1, Whether to build $1 as dynamic module)
|
|
|
|
fi
|
1999-09-26 23:38:58 +08:00
|
|
|
fi
|
2005-02-25 02:11:36 +08:00
|
|
|
|
|
|
|
if test "$3" != "shared" && test "$3" != "yes" && test "$4" = "cli"; then
|
|
|
|
dnl ---------------------------------------------- CLI static module
|
|
|
|
if test "$PHP_SAPI" = "cgi"; then
|
|
|
|
PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,)
|
|
|
|
EXT_STATIC="$EXT_STATIC $1"
|
2002-03-27 19:09:20 +08:00
|
|
|
else
|
2005-02-25 02:11:36 +08:00
|
|
|
PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,cli)
|
2002-03-27 19:09:20 +08:00
|
|
|
fi
|
2005-02-25 02:11:36 +08:00
|
|
|
EXT_CLI_STATIC="$EXT_CLI_STATIC $1"
|
|
|
|
fi
|
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir)
|
|
|
|
])
|
|
|
|
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_WITH_SHARED
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
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.
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_WITH_SHARED],[
|
|
|
|
PHP_ARG_ANALYZE_EX(withval)
|
|
|
|
shared=$ext_shared
|
|
|
|
unset ext_shared ext_output
|
1999-06-21 02:52:46 +08:00
|
|
|
])
|
|
|
|
|
2000-02-29 21:02:29 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_ADD_EXTENSION_DEP(extname, depends [, depconf])
|
2000-02-29 21:02:29 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl This macro is currently a placeholder in the config.m4 file
|
|
|
|
dnl it is scanned by genif.sh when it builds the internal functions
|
|
|
|
dnl list, so that modules can be init'd in the correct order
|
|
|
|
dnl $1 = name of extension, $2 = extension upon which it depends
|
|
|
|
dnl $3 = optional: if true, it's ok for $2 to have not been configured
|
|
|
|
dnl default is false and should halt the build.
|
|
|
|
dnl See ADD_EXTENSION_DEP in win32 build
|
2001-08-03 13:17:18 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_ADD_EXTENSION_DEP], [])
|
|
|
|
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
dnl Checks for structures, typedefs, broken functions, etc.
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_CHECK_IN_ADDR_T
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CHECK_IN_ADDR_T], [
|
|
|
|
dnl AIX keeps in_addr_t in /usr/include/netinet/in.h
|
|
|
|
AC_MSG_CHECKING([for in_addr_t])
|
|
|
|
AC_CACHE_VAL(ac_cv_type_in_addr_t,
|
|
|
|
[AC_EGREP_CPP(dnl
|
|
|
|
changequote(<<,>>)dnl
|
|
|
|
<<in_addr_t[^a-zA-Z_0-9]>>dnl
|
|
|
|
changequote([,]), [#include <sys/types.h>
|
|
|
|
#if STDC_HEADERS
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_NETINET_IN_H
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#endif], ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)])dnl
|
|
|
|
AC_MSG_RESULT([$ac_cv_type_in_addr_t])
|
|
|
|
if test $ac_cv_type_in_addr_t = no; then
|
|
|
|
AC_DEFINE(in_addr_t, u_int, [ ])
|
|
|
|
fi
|
2001-08-03 13:17:18 +08:00
|
|
|
])
|
2002-04-04 18:03:29 +08:00
|
|
|
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_TIME_R_TYPE
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl Check type of reentrant time-related functions
|
|
|
|
dnl Type can be: irix, hpux or POSIX
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_TIME_R_TYPE],[
|
|
|
|
AC_CACHE_CHECK(for type of reentrant time-related functions, ac_cv_time_r_type,[
|
|
|
|
AC_TRY_RUN([
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
main() {
|
|
|
|
char buf[27];
|
|
|
|
struct tm t;
|
|
|
|
time_t old = 0;
|
|
|
|
int r, s;
|
|
|
|
|
|
|
|
s = gmtime_r(&old, &t);
|
|
|
|
r = (int) asctime_r(&t, buf, 26);
|
|
|
|
if (r == s && s == 0) return (0);
|
|
|
|
return (1);
|
|
|
|
}
|
2000-05-02 12:00:14 +08:00
|
|
|
],[
|
2005-02-25 02:11:36 +08:00
|
|
|
ac_cv_time_r_type=hpux
|
|
|
|
],[
|
|
|
|
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);
|
|
|
|
if (p == buf && s == &t) return (0);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
],[
|
|
|
|
ac_cv_time_r_type=irix
|
|
|
|
],[
|
|
|
|
ac_cv_time_r_type=POSIX
|
2005-02-25 03:27:10 +08:00
|
|
|
],[
|
|
|
|
ac_cv_time_r_type=POSIX
|
2005-02-25 02:11:36 +08:00
|
|
|
])
|
|
|
|
],[
|
|
|
|
ac_cv_time_r_type=POSIX
|
2000-05-02 12:00:14 +08:00
|
|
|
])
|
2005-02-25 02:11:36 +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
|
1999-06-21 02:52:46 +08:00
|
|
|
])
|
|
|
|
|
2000-03-12 06:05:41 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_DOES_PWRITE_WORK
|
|
|
|
dnl internal
|
|
|
|
AC_DEFUN([PHP_DOES_PWRITE_WORK],[
|
|
|
|
AC_TRY_RUN([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <errno.h>
|
|
|
|
$1
|
|
|
|
main() {
|
|
|
|
int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600);
|
|
|
|
|
|
|
|
if (fd < 0) exit(1);
|
|
|
|
if (pwrite(fd, "text", 4, 0) != 4) exit(1);
|
|
|
|
/* Linux glibc breakage until 2.2.5 */
|
|
|
|
if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) exit(1);
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
],[
|
|
|
|
ac_cv_pwrite=yes
|
|
|
|
],[
|
|
|
|
ac_cv_pwrite=no
|
|
|
|
],[
|
|
|
|
ac_cv_pwrite=no
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl PHP_DOES_PREAD_WORK
|
|
|
|
dnl internal
|
|
|
|
AC_DEFUN([PHP_DOES_PREAD_WORK],[
|
|
|
|
echo test > conftest_in
|
|
|
|
AC_TRY_RUN([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <errno.h>
|
|
|
|
$1
|
|
|
|
main() {
|
|
|
|
char buf[3];
|
|
|
|
int fd = open("conftest_in", O_RDONLY);
|
|
|
|
if (fd < 0) exit(1);
|
|
|
|
if (pread(fd, buf, 2, 0) != 2) exit(1);
|
|
|
|
/* Linux glibc breakage until 2.2.5 */
|
|
|
|
if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) exit(1);
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
],[
|
|
|
|
ac_cv_pread=yes
|
|
|
|
],[
|
|
|
|
ac_cv_pread=no
|
|
|
|
],[
|
|
|
|
ac_cv_pread=no
|
|
|
|
])
|
|
|
|
rm -f conftest_in
|
|
|
|
])
|
|
|
|
|
2000-03-12 06:05:41 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_PWRITE_TEST
|
2000-03-12 06:05:41 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_PWRITE_TEST],[
|
|
|
|
AC_CACHE_CHECK(whether pwrite works,ac_cv_pwrite,[
|
|
|
|
PHP_DOES_PWRITE_WORK
|
|
|
|
if test "$ac_cv_pwrite" = "no"; then
|
|
|
|
PHP_DOES_PWRITE_WORK([ssize_t pwrite(int, void *, size_t, off64_t);])
|
|
|
|
if test "$ac_cv_pwrite" = "yes"; then
|
|
|
|
ac_cv_pwrite=64
|
|
|
|
fi
|
2002-06-24 19:36:21 +08:00
|
|
|
fi
|
2005-02-25 02:11:36 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
if test "$ac_cv_pwrite" != "no"; then
|
|
|
|
AC_DEFINE(HAVE_PWRITE, 1, [ ])
|
|
|
|
if test "$ac_cv_pwrite" = "64"; then
|
|
|
|
AC_DEFINE(PHP_PWRITE_64, 1, [whether pwrite64 is default])
|
|
|
|
fi
|
|
|
|
fi
|
2000-03-12 06:05:41 +08:00
|
|
|
])
|
1999-04-25 07:36:25 +08:00
|
|
|
|
2002-08-07 00:01:34 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_PREAD_TEST
|
2002-08-07 00:01:34 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_PREAD_TEST],[
|
|
|
|
AC_CACHE_CHECK(whether pread works,ac_cv_pread,[
|
|
|
|
PHP_DOES_PREAD_WORK
|
|
|
|
if test "$ac_cv_pread" = "no"; then
|
|
|
|
PHP_DOES_PREAD_WORK([ssize_t pread(int, void *, size_t, off64_t);])
|
|
|
|
if test "$ac_cv_pread" = "yes"; then
|
|
|
|
ac_cv_pread=64
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
])
|
2002-08-07 00:01:34 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
if test "$ac_cv_pread" != "no"; then
|
|
|
|
AC_DEFINE(HAVE_PREAD, 1, [ ])
|
|
|
|
if test "$ac_cv_pread" = "64"; then
|
|
|
|
AC_DEFINE(PHP_PREAD_64, 1, [whether pread64 is default])
|
2002-08-07 00:01:34 +08:00
|
|
|
fi
|
2005-02-25 02:11:36 +08:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_MISSING_TIME_R_DECL
|
|
|
|
dnl
|
|
|
|
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])
|
2002-08-07 00:01:34 +08:00
|
|
|
])
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_MSG_RESULT([done])
|
2002-08-07 00:01:34 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_READDIR_R_TYPE
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_READDIR_R_TYPE],[
|
|
|
|
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)
|
|
|
|
if test "$ac_cv_func_readdir_r" = "yes"; then
|
|
|
|
AC_CACHE_CHECK(for type of readdir_r, ac_cv_what_readdir_r,[
|
|
|
|
AC_TRY_RUN([
|
|
|
|
#define _REENTRANT
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
|
|
|
|
#ifndef PATH_MAX
|
|
|
|
#define PATH_MAX 1024
|
|
|
|
#endif
|
2002-08-07 00:01:34 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
main() {
|
|
|
|
DIR *dir;
|
|
|
|
char entry[sizeof(struct dirent)+PATH_MAX];
|
|
|
|
struct dirent *pentry = (struct dirent *) &entry;
|
|
|
|
|
|
|
|
dir = opendir("/");
|
|
|
|
if (!dir)
|
|
|
|
exit(1);
|
|
|
|
if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0)
|
|
|
|
exit(0);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
],[
|
|
|
|
ac_cv_what_readdir_r=POSIX
|
|
|
|
],[
|
|
|
|
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
|
|
|
|
])
|
|
|
|
],[
|
|
|
|
ac_cv_what_readdir_r=none
|
|
|
|
])
|
2002-08-07 00:01:34 +08:00
|
|
|
])
|
2005-02-25 02:11:36 +08:00
|
|
|
case $ac_cv_what_readdir_r in
|
|
|
|
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
|
|
|
|
fi
|
2002-08-07 00:01:34 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_TM_GMTOFF
|
|
|
|
dnl
|
|
|
|
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
|
|
|
|
AC_DEFINE(HAVE_TM_GMTOFF,1,[whether you have tm_gmtoff in struct tm])
|
|
|
|
fi
|
2002-08-07 00:01:34 +08:00
|
|
|
])
|
|
|
|
|
2001-03-28 04:35:04 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_STRUCT_FLOCK
|
2001-03-28 04:35:04 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
|
|
|
AC_DEFINE(HAVE_STRUCT_FLOCK, 1,[whether you have struct flock])
|
|
|
|
fi
|
1999-09-16 16:26:46 +08:00
|
|
|
])
|
|
|
|
|
1999-04-25 07:36:25 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_SOCKLEN_T
|
1999-04-25 07:36:25 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
|
|
|
]))
|
|
|
|
if test "$ac_cv_socklen_t" = "yes"; then
|
|
|
|
AC_DEFINE(HAVE_SOCKLEN_T, 1, [Whether you have socklen_t])
|
2002-04-09 02:43:35 +08:00
|
|
|
fi
|
1999-11-13 04:56:30 +08:00
|
|
|
])
|
1999-04-25 07:36:25 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_MISSING_FCLOSE_DECL
|
1999-04-17 08:37:12 +08:00
|
|
|
dnl
|
|
|
|
dnl See if we have broken header files like SunOS has.
|
|
|
|
dnl
|
2002-10-24 18:41:36 +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,[ ])
|
2001-09-07 04:55:24 +08:00
|
|
|
AC_MSG_RESULT([ok])
|
1999-04-17 08:37:12 +08:00
|
|
|
],[
|
2000-06-08 14:14:58 +08:00
|
|
|
AC_DEFINE(MISSING_FCLOSE_DECL,1,[ ])
|
2001-09-07 04:55:24 +08:00
|
|
|
AC_MSG_RESULT([missing])
|
1999-04-17 08:37:12 +08:00
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_AC_BROKEN_SPRINTF
|
1999-04-17 08:37:12 +08:00
|
|
|
dnl
|
2002-10-02 20:52:53 +08:00
|
|
|
dnl Check for broken sprintf(), C99 conformance
|
1999-04-17 08:37:12 +08:00
|
|
|
dnl
|
2002-10-24 18:41:36 +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
|
2002-10-02 20:52:53 +08:00
|
|
|
AC_DEFINE(PHP_BROKEN_SPRINTF, 1, [Whether sprintf is C99 conform])
|
1999-12-30 10:59:53 +08:00
|
|
|
else
|
2002-10-02 20:52:53 +08:00
|
|
|
AC_DEFINE(PHP_BROKEN_SPRINTF, 0, [Whether sprintf is C99 conform])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_AC_BROKEN_SNPRINTF
|
2002-10-02 20:52:53 +08:00
|
|
|
dnl
|
|
|
|
dnl Check for broken snprintf(), C99 conformance
|
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_AC_BROKEN_SNPRINTF],[
|
2002-10-02 20:52:53 +08:00
|
|
|
AC_CACHE_CHECK(whether snprintf is broken, ac_cv_broken_snprintf,[
|
|
|
|
AC_TRY_RUN([
|
|
|
|
#define NULL (0L)
|
|
|
|
main() {
|
|
|
|
char buf[20];
|
|
|
|
int res = 0;
|
|
|
|
res = res || (snprintf(buf, 2, "marcus") != 6);
|
|
|
|
res = res || (buf[1] != '\0');
|
2003-06-28 20:29:43 +08:00
|
|
|
/* Implementations may consider this as an encoding error */
|
|
|
|
snprintf(buf, 0, "boerger");
|
|
|
|
/* However, they MUST ignore the pointer */
|
2002-10-02 20:52:53 +08:00
|
|
|
res = res || (buf[0] != 'm');
|
|
|
|
res = res || (snprintf(NULL, 0, "boerger") != 7);
|
|
|
|
res = res || (snprintf(buf, sizeof(buf), "%f", 0.12345678) != 8);
|
|
|
|
exit(res);
|
|
|
|
}
|
|
|
|
],[
|
|
|
|
ac_cv_broken_snprintf=no
|
|
|
|
],[
|
|
|
|
ac_cv_broken_snprintf=yes
|
|
|
|
],[
|
|
|
|
ac_cv_broken_snprintf=no
|
|
|
|
])
|
|
|
|
])
|
|
|
|
if test "$ac_cv_broken_snprintf" = "yes"; then
|
|
|
|
AC_DEFINE(PHP_BROKEN_SNPRINTF, 1, [Whether snprintf is C99 conform])
|
|
|
|
else
|
|
|
|
AC_DEFINE(PHP_BROKEN_SNPRINTF, 0, [Whether snprintf is C99 conform])
|
1999-12-30 10:59:53 +08:00
|
|
|
fi
|
1999-04-17 08:37:12 +08:00
|
|
|
])
|
|
|
|
|
1999-09-29 23:17:02 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_SOLARIS_PIC_WEIRDNESS
|
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
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_SOLARIS_PIC_WEIRDNESS],[
|
2001-09-07 04:55:24 +08:00
|
|
|
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
|
2003-07-04 06:54:57 +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";;
|
2003-07-04 06:54:57 +08:00
|
|
|
*[)] CFLAGS="$CFLAGS -fpic";;
|
1999-07-25 03:02:38 +08:00
|
|
|
esac
|
2001-09-07 04:55:24 +08:00
|
|
|
AC_MSG_RESULT([yes]);;
|
2003-07-04 06:54:57 +08:00
|
|
|
*[)]
|
2001-09-07 04:55:24 +08:00
|
|
|
AC_MSG_RESULT([no]);;
|
1999-07-25 03:02:38 +08:00
|
|
|
esac
|
1999-09-12 20:20:59 +08:00
|
|
|
else
|
2001-09-07 04:55:24 +08:00
|
|
|
AC_MSG_RESULT([no])
|
1999-07-25 03:02:38 +08:00
|
|
|
fi
|
|
|
|
])
|
1999-09-14 01:17:51 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_SYS_LFS
|
|
|
|
dnl
|
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
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
1999-09-27 21:15:20 +08:00
|
|
|
dnl Written by Paul Eggert <eggert@twinsun.com>.
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
2002-10-24 18:41:36 +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.
|
2001-09-07 04:55:24 +08:00
|
|
|
AC_MSG_CHECKING([whether large file support needs explicit enabling])
|
1999-09-27 21:15:20 +08:00
|
|
|
ac_getconfs=''
|
|
|
|
ac_result=yes
|
|
|
|
ac_set=''
|
|
|
|
ac_shellvars='CPPFLAGS LDFLAGS LIBS'
|
|
|
|
for ac_shellvar in $ac_shellvars; do
|
|
|
|
case $ac_shellvar in
|
2003-07-04 06:54:57 +08:00
|
|
|
CPPFLAGS[)] ac_lfsvar=LFS_CFLAGS ;;
|
|
|
|
*[)] ac_lfsvar=LFS_$ac_shellvar ;;
|
1999-09-27 21:15:20 +08:00
|
|
|
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
|
2003-07-04 06:54:57 +08:00
|
|
|
yes[)] ac_result=no ;;
|
1999-09-27 21:15:20 +08:00
|
|
|
esac
|
|
|
|
case "$ac_result$ac_set" in
|
2003-07-04 06:54:57 +08:00
|
|
|
yes?*[)] ac_result="yes, but $ac_set is already set, so use its settings"
|
1999-09-27 21:15:20 +08:00
|
|
|
esac
|
2001-09-07 04:55:24 +08:00
|
|
|
AC_MSG_RESULT([$ac_result])
|
1999-09-27 21:15:20 +08:00
|
|
|
case $ac_result in
|
2003-07-04 06:54:57 +08:00
|
|
|
yes[)]
|
1999-09-27 21:15:20 +08:00
|
|
|
for ac_shellvar in $ac_shellvars; do
|
|
|
|
eval $ac_shellvar=\$ac_test_$ac_shellvar
|
|
|
|
done ;;
|
|
|
|
esac
|
|
|
|
])
|
1999-09-29 23:17:02 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_SOCKADDR_SA_LEN
|
|
|
|
dnl
|
2002-10-24 18:41:36 +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])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_DECLARED_TIMEZONE
|
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_DECLARED_TIMEZONE],[
|
2000-01-01 10:22:01 +08:00
|
|
|
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
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_EBCDIC
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_EBCDIC], [
|
2000-04-13 20:24:28 +08:00
|
|
|
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
|
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_BROKEN_GETCWD
|
|
|
|
dnl
|
2003-03-17 21:40:45 +08:00
|
|
|
dnl Some systems, notably Solaris, cause getcwd() or realpath to fail if a
|
|
|
|
dnl component of the path has execute but not read permissions
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
2003-03-17 21:40:45 +08:00
|
|
|
AC_DEFUN([PHP_BROKEN_GETCWD],[
|
|
|
|
AC_MSG_CHECKING([for broken getcwd])
|
|
|
|
os=`uname -sr 2>/dev/null`
|
|
|
|
case $os in
|
2003-07-04 06:54:57 +08:00
|
|
|
SunOS*[)]
|
2003-03-17 21:40:45 +08:00
|
|
|
AC_DEFINE(HAVE_BROKEN_GETCWD,1, [Define if system has broken getcwd])
|
|
|
|
AC_MSG_RESULT([yes]);;
|
2003-07-04 06:54:57 +08:00
|
|
|
*[)]
|
2003-03-17 21:40:45 +08:00
|
|
|
AC_MSG_RESULT([no]);;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_BROKEN_GLIBC_FOPEN_APPEND
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_BROKEN_GLIBC_FOPEN_APPEND], [
|
2003-01-01 17:58:17 +08:00
|
|
|
AC_MSG_CHECKING([for broken libc stdio])
|
2003-01-04 06:05:12 +08:00
|
|
|
AC_CACHE_VAL(have_broken_glibc_fopen_append,[
|
2003-01-01 17:58:17 +08:00
|
|
|
AC_TRY_RUN([
|
|
|
|
#include <stdio.h>
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
FILE *fp;
|
|
|
|
long position;
|
|
|
|
char *filename = "/tmp/phpglibccheck";
|
|
|
|
|
|
|
|
fp = fopen(filename, "w");
|
|
|
|
if (fp == NULL) {
|
|
|
|
perror("fopen");
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
fputs("foobar", fp);
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
fp = fopen(filename, "a+");
|
|
|
|
position = ftell(fp);
|
|
|
|
fclose(fp);
|
|
|
|
unlink(filename);
|
|
|
|
if (position == 0)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
],
|
|
|
|
[have_broken_glibc_fopen_append=no],
|
2003-01-04 06:05:12 +08:00
|
|
|
[have_broken_glibc_fopen_append=yes ],
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <features.h>
|
|
|
|
],[
|
|
|
|
#if !__GLIBC_PREREQ(2,2)
|
|
|
|
choke me
|
|
|
|
#endif
|
|
|
|
],
|
|
|
|
[have_broken_glibc_fopen_append=yes],
|
|
|
|
[have_broken_glibc_fopen_append=no ])
|
|
|
|
)])
|
2003-01-01 17:58:17 +08:00
|
|
|
|
|
|
|
if test "$have_broken_glibc_fopen_append" = "yes"; then
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_BROKEN_GLIBC_FOPEN_APPEND,1, [Define if your glibc borks on fopen with mode a+])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_FOPENCOOKIE
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_FOPENCOOKIE], [
|
|
|
|
AC_CHECK_FUNC(fopencookie, [have_glibc_fopencookie=yes])
|
2003-01-01 17:58:17 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
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], [])
|
2002-08-23 06:28:19 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
if test "$have_cookie_io_functions_t" = "yes"; then
|
|
|
|
cookie_io_functions_t=cookie_io_functions_t
|
|
|
|
have_fopen_cookie=yes
|
2002-08-23 06:28:19 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl even newer glibcs have a different seeker definition...
|
|
|
|
AC_TRY_RUN([
|
2002-08-23 06:28:19 +08:00
|
|
|
#define _GNU_SOURCE
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
struct cookiedata {
|
2002-11-18 19:39:42 +08:00
|
|
|
__off64_t pos;
|
2002-08-23 06:28:19 +08:00
|
|
|
};
|
|
|
|
|
2002-11-18 19:39:42 +08:00
|
|
|
__ssize_t reader(void *cookie, char *buffer, size_t size)
|
2002-08-23 06:28:19 +08:00
|
|
|
{ return size; }
|
2002-11-18 19:39:42 +08:00
|
|
|
__ssize_t writer(void *cookie, const char *buffer, size_t size)
|
2002-08-23 06:28:19 +08:00
|
|
|
{ return size; }
|
|
|
|
int closer(void *cookie)
|
|
|
|
{ return 0; }
|
2002-11-18 19:39:42 +08:00
|
|
|
int seeker(void *cookie, __off64_t *position, int whence)
|
2002-08-23 06:28:19 +08:00
|
|
|
{ ((struct cookiedata*)cookie)->pos = *position; return 0; }
|
|
|
|
|
|
|
|
cookie_io_functions_t funcs = {reader, writer, seeker, closer};
|
|
|
|
|
|
|
|
main() {
|
|
|
|
struct cookiedata g = { 0 };
|
|
|
|
FILE *fp = fopencookie(&g, "r", funcs);
|
|
|
|
|
2002-11-18 19:39:42 +08:00
|
|
|
if (fp && fseek(fp, 8192, SEEK_SET) == 0 && g.pos == 8192)
|
2002-08-23 06:28:19 +08:00
|
|
|
exit(0);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2005-02-25 03:27:10 +08:00
|
|
|
], [
|
|
|
|
cookie_io_functions_use_off64_t=yes
|
|
|
|
], [
|
|
|
|
cookie_io_functions_use_off64_t=no
|
|
|
|
], [
|
|
|
|
cookie_io_functions_use_off64_t=no
|
|
|
|
])
|
2005-02-25 02:11:36 +08:00
|
|
|
|
|
|
|
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, [ ])
|
|
|
|
if test "$cookie_io_functions_use_off64_t" = "yes" ; then
|
|
|
|
AC_DEFINE(COOKIE_SEEKER_USES_OFF64_T, 1, [ ])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
dnl Library/function existance and build sanity checks
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_CHECK_LIBRARY(library, function [, action-found [, action-not-found [, extra-libs]]])
|
|
|
|
dnl
|
|
|
|
dnl Wrapper for AC_CHECK_LIB
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CHECK_LIBRARY], [
|
|
|
|
save_old_LDFLAGS=$LDFLAGS
|
|
|
|
ac_stuff="$5"
|
|
|
|
|
|
|
|
save_ext_shared=$ext_shared
|
|
|
|
ext_shared=yes
|
|
|
|
PHP_EVAL_LIBLINE([$]ac_stuff, LDFLAGS)
|
|
|
|
AC_CHECK_LIB([$1],[$2],[
|
|
|
|
LDFLAGS=$save_old_LDFLAGS
|
|
|
|
ext_shared=$save_ext_shared
|
|
|
|
$3
|
|
|
|
],[
|
|
|
|
LDFLAGS=$save_old_LDFLAGS
|
|
|
|
ext_shared=$save_ext_shared
|
|
|
|
unset ac_cv_lib_$1[]_$2
|
|
|
|
$4
|
|
|
|
])dnl
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_CHECK_FRAMEWORK(framework, function [, action-found [, action-not-found ]])
|
|
|
|
dnl
|
|
|
|
dnl El cheapo wrapper for AC_CHECK_LIB
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CHECK_FRAMEWORK], [
|
|
|
|
save_old_LDFLAGS=$LDFLAGS
|
|
|
|
LDFLAGS="-framework $1 $LDFLAGS"
|
|
|
|
dnl supplying "c" to AC_CHECK_LIB is technically cheating, but
|
|
|
|
dnl rewriting AC_CHECK_LIB is overkill and this only affects
|
|
|
|
dnl the "checking.." output anyway.
|
|
|
|
AC_CHECK_LIB(c,[$2],[
|
|
|
|
LDFLAGS=$save_old_LDFLAGS
|
|
|
|
$3
|
|
|
|
],[
|
|
|
|
LDFLAGS=$save_old_LDFLAGS
|
|
|
|
$4
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_CHECK_FUNC_LIB(func, libs)
|
|
|
|
dnl
|
|
|
|
dnl This macro checks whether 'func' or '__func' exists
|
|
|
|
dnl in the specified library.
|
|
|
|
dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS.
|
|
|
|
dnl This should be called in the ACTION-IF-NOT-FOUND part of PHP_CHECK_FUNC
|
|
|
|
dnl
|
|
|
|
dnl
|
|
|
|
dnl autoconf undefines the builtin "shift" :-(
|
|
|
|
dnl If possible, we use the builtin shift anyway, otherwise we use
|
|
|
|
dnl the ubercool definition I have tested so far with FreeBSD/GNU m4
|
|
|
|
ifdef([builtin],[builtin(define, phpshift, [builtin(shift, $@)])],[
|
|
|
|
define([phpshift],[ifelse(index([$@],[,]),-1,,[substr([$@],incr(index([$@],[,])))])])
|
|
|
|
])
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CHECK_FUNC_LIB],[
|
|
|
|
ifelse($2,,:,[
|
|
|
|
unset ac_cv_lib_$2[]_$1
|
|
|
|
unset ac_cv_lib_$2[]___$1
|
|
|
|
unset found
|
|
|
|
AC_CHECK_LIB($2, $1, [found=yes], [
|
|
|
|
AC_CHECK_LIB($2, __$1, [found=yes], [found=no])
|
|
|
|
])
|
|
|
|
|
|
|
|
if test "$found" = "yes"; then
|
|
|
|
ac_libs=$LIBS
|
|
|
|
LIBS="$LIBS -l$2"
|
|
|
|
AC_TRY_RUN([main() { return (0); }],[found=yes],[found=no],[found=no])
|
|
|
|
LIBS=$ac_libs
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$found" = "yes"; then
|
|
|
|
PHP_ADD_LIBRARY($2)
|
|
|
|
PHP_DEF_HAVE($1)
|
|
|
|
PHP_DEF_HAVE(lib$2)
|
|
|
|
ac_cv_func_$1=yes
|
|
|
|
else
|
|
|
|
PHP_CHECK_FUNC_LIB($1,phpshift(phpshift($@)))
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_CHECK_FUNC(func, ...)
|
|
|
|
dnl
|
|
|
|
dnl This macro checks whether 'func' or '__func' exists
|
|
|
|
dnl in the default libraries and as a fall back in the specified library.
|
|
|
|
dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CHECK_FUNC],[
|
|
|
|
unset ac_cv_func_$1
|
|
|
|
unset ac_cv_func___$1
|
|
|
|
unset found
|
|
|
|
|
|
|
|
AC_CHECK_FUNC($1, [found=yes],[ AC_CHECK_FUNC(__$1,[found=yes],[found=no]) ])
|
|
|
|
|
|
|
|
case $found in
|
|
|
|
yes[)]
|
|
|
|
PHP_DEF_HAVE($1)
|
|
|
|
ac_cv_func_$1=yes
|
|
|
|
;;
|
|
|
|
ifelse($#,1,,[
|
|
|
|
*[)] PHP_CHECK_FUNC_LIB($@) ;;
|
|
|
|
])
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_TEST_BUILD(function, action-if-ok, action-if-not-ok [, extra-libs [, extra-source]])
|
|
|
|
dnl
|
|
|
|
dnl This macro checks whether build works and given function exists.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_TEST_BUILD], [
|
|
|
|
old_LIBS=$LIBS
|
|
|
|
LIBS="$4 $LIBS"
|
|
|
|
AC_TRY_RUN([
|
|
|
|
$5
|
|
|
|
char $1();
|
|
|
|
int main() {
|
|
|
|
$1();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
], [
|
|
|
|
LIBS=$old_LIBS
|
|
|
|
$2
|
|
|
|
],[
|
|
|
|
LIBS=$old_LIBS
|
|
|
|
$3
|
|
|
|
],[
|
|
|
|
LIBS=$old_LIBS
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
dnl Platform characteristics checks
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_SHLIB_SUFFIX_NAME
|
|
|
|
dnl
|
|
|
|
dnl Determines shared library suffix
|
|
|
|
dnl suffix can be: .so, .sl or .dylib
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_SHLIB_SUFFIX_NAME],[
|
|
|
|
AC_REQUIRE([PHP_CANONICAL_HOST_TARGET])dnl
|
|
|
|
PHP_SUBST(SHLIB_SUFFIX_NAME)
|
|
|
|
SHLIB_SUFFIX_NAME=so
|
|
|
|
case $host_alias in
|
|
|
|
*hpux*[)]
|
|
|
|
SHLIB_SUFFIX_NAME=sl
|
|
|
|
;;
|
|
|
|
*darwin*[)]
|
|
|
|
SHLIB_SUFFIX_NAME=dylib
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_CHECK_64BIT([do if 32], [do if 64])
|
|
|
|
dnl
|
|
|
|
dnl This macro is used to detect if we're at 64-bit platform or not.
|
|
|
|
dnl It could be useful for those external libs, that have different precompiled
|
|
|
|
dnl versions in different directories.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CHECK_64BIT],[
|
2005-02-25 03:27:10 +08:00
|
|
|
AC_CHECK_SIZEOF(long int, 4)
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_MSG_CHECKING([checking if we're at 64-bit platform])
|
|
|
|
if test "$ac_cv_sizeof_long_int" = "4" ; then
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
$1
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
$2
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_C_BIGENDIAN
|
|
|
|
dnl
|
|
|
|
dnl Replacement macro for AC_C_BIGENDIAN
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_C_BIGENDIAN],
|
|
|
|
[AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian_php,
|
|
|
|
[
|
|
|
|
ac_cv_c_bigendian_php=unknown
|
|
|
|
AC_TRY_RUN(
|
|
|
|
[
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
short one = 1;
|
|
|
|
char *cp = (char *)&one;
|
|
|
|
|
|
|
|
if (*cp == 0) {
|
|
|
|
return(0);
|
|
|
|
} else {
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
], [ac_cv_c_bigendian_php=yes], [ac_cv_c_bigendian_php=no], [ac_cv_c_bigendian_php=unknown])
|
|
|
|
])
|
|
|
|
if test $ac_cv_c_bigendian_php = yes; then
|
|
|
|
AC_DEFINE(WORDS_BIGENDIAN, [], [Define if processor uses big-endian word])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
dnl Checks for programs: PHP_PROG_<program>
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_PROG_SENDMAIL
|
|
|
|
dnl
|
|
|
|
dnl Search for the sendmail binary
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_PROG_SENDMAIL], [
|
|
|
|
PHP_ALT_PATH=/usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib
|
|
|
|
AC_PATH_PROG(PROG_SENDMAIL, sendmail,[], $PATH:$PHP_ALT_PATH)
|
|
|
|
if test -n "$PROG_SENDMAIL"; then
|
|
|
|
AC_DEFINE(HAVE_SENDMAIL,1,[whether you have sendmail])
|
|
|
|
fi
|
|
|
|
PHP_SUBST(PROG_SENDMAIL)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_PROG_AWK
|
|
|
|
dnl
|
|
|
|
dnl Some vendors force mawk before gawk; mawk is broken so we don't like that
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_PROG_AWK], [
|
|
|
|
AC_CHECK_PROGS(AWK, gawk nawk awk mawk, bork, /usr/xpg4/bin/:$PATH)
|
|
|
|
case "$AWK" in
|
|
|
|
*mawk)
|
|
|
|
AC_MSG_WARN([mawk is known to have problems on some systems. You should install GNU awk])
|
|
|
|
;;
|
|
|
|
*gawk)
|
|
|
|
;;
|
|
|
|
bork)
|
|
|
|
AC_MSG_ERROR([Could not find awk; Install GNU awk])
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
AC_MSG_CHECKING([if $AWK is broken])
|
|
|
|
if ! $AWK 'function foo() {}' >/dev/null 2>&1 ; then
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
AC_MSG_ERROR([You should install GNU awk])
|
2000-11-21 16:38:20 +08:00
|
|
|
else
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_MSG_RESULT([no])
|
2002-08-23 06:28:19 +08:00
|
|
|
fi
|
2005-02-25 02:11:36 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
PHP_SUBST(AWK)
|
2000-11-21 16:38:20 +08:00
|
|
|
])
|
2001-09-05 21:18:09 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_PROG_BISON
|
|
|
|
dnl
|
|
|
|
dnl Search for bison and check it's version
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_PROG_BISON], [
|
|
|
|
AC_PROG_YACC
|
2005-02-27 20:42:28 +08:00
|
|
|
if test "$YACC" = "bison -y"; then
|
|
|
|
AC_CACHE_CHECK([for bison version], php_cv_bison_version, [
|
|
|
|
set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | sed -e 's/\./ /'|tr -d a-z`
|
|
|
|
if test "${1}" -ne "1" -o "(" "${2}" != "28" -a "${2}" != "35" -a "${2}" != "75" -a "${2}" != "875" ")"; then
|
|
|
|
php_cv_bison_version=invalid
|
|
|
|
else
|
|
|
|
php_cv_bison_version="${1}.${2} (ok)"
|
|
|
|
fi
|
|
|
|
])
|
2005-02-25 02:11:36 +08:00
|
|
|
fi
|
2005-02-27 20:42:28 +08:00
|
|
|
case $php_cv_bison_version in
|
|
|
|
""|invalid[)]
|
|
|
|
AC_MSG_WARN([You will need bison 1.28, 1.35, 1.75 or 1.875 if you want to regenerate the Zend/PHP parsers (found ${1}.${2}).])
|
|
|
|
YACC="exit 0;"
|
|
|
|
;;
|
|
|
|
esac
|
2005-02-25 02:11:36 +08:00
|
|
|
PHP_SUBST(YACC)
|
|
|
|
])
|
2001-09-05 21:18:09 +08:00
|
|
|
|
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_PROG_LEX
|
2001-09-05 21:18:09 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl Search for (f)lex and check it's version
|
2001-09-05 21:18:09 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_PROG_LEX], [
|
|
|
|
AC_PROG_LEX
|
|
|
|
if test -n "$LEX"; then
|
|
|
|
AC_DECL_YYTEXT
|
|
|
|
:
|
|
|
|
fi
|
|
|
|
dnl ## Make flex scanners use const if they can, even if __STDC__ is not
|
|
|
|
dnl ## true, for compilers like Sun's that only set __STDC__ true in
|
|
|
|
dnl ## "limit-to-ANSI-standard" mode, not in "ANSI-compatible" mode
|
|
|
|
AC_C_CONST
|
|
|
|
if test "$ac_cv_c_const" = "yes" ; then
|
|
|
|
LEX_CFLAGS="-DYY_USE_CONST"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$LEX" ;then
|
2005-02-27 20:42:28 +08:00
|
|
|
AC_CACHE_CHECK([for flex version], php_cv_flex_version, [
|
|
|
|
flexvers=`echo "" | $LEX -V -v --version 2>/dev/null | sed -e 's/^.* //' -e 's/\./ /g'`
|
|
|
|
if test ! -z "$flexvers"; then
|
|
|
|
set $flexvers
|
|
|
|
if test "${1}" != "2" -o "${2}" != "5" -o "${3}" != "4"; then
|
|
|
|
php_cv_flex_version=invalid
|
|
|
|
else
|
|
|
|
php_cv_flex_version="${1}.${2}.${3} (ok)"
|
|
|
|
fi
|
2005-02-25 02:11:36 +08:00
|
|
|
fi
|
2005-02-27 20:42:28 +08:00
|
|
|
])
|
2005-02-25 02:11:36 +08:00
|
|
|
fi
|
2005-02-27 20:42:28 +08:00
|
|
|
case $php_cv_flex_version in
|
|
|
|
""|invalid[)]
|
|
|
|
AC_MSG_WARN([You will need flex 2.5.4 if you want to regenerate Zend/PHP lexical parsers.])
|
|
|
|
LEX="exit 0;"
|
|
|
|
;;
|
|
|
|
esac
|
2005-02-25 02:11:36 +08:00
|
|
|
PHP_SUBST(LEX)
|
2001-09-05 21:18:09 +08:00
|
|
|
])
|
|
|
|
|
2002-08-07 00:01:34 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_PROG_RE2C
|
2002-08-07 00:01:34 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl Search for the re2c binary and check the version
|
2002-08-07 00:01:34 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_PROG_RE2C],[
|
|
|
|
AC_CHECK_PROG(RE2C, re2c, re2c)
|
|
|
|
if test -n "$RE2C"; then
|
2005-02-27 20:42:28 +08:00
|
|
|
AC_CACHE_CHECK([for re2c version], php_cv_re2c_version, [
|
|
|
|
re2c_vernum=`echo "" | re2c --vernum 2>/dev/null`
|
2005-02-28 08:07:16 +08:00
|
|
|
if test -z "$re2c_vernum" || test "$re2c_vernum" -lt "904"; then
|
2005-02-25 02:11:36 +08:00
|
|
|
php_cv_re2c_version=invalid
|
|
|
|
else
|
|
|
|
php_cv_re2c_version="`echo "" | re2c --version | cut -d ' ' -f 2 2>/dev/null` (ok)"
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
fi
|
2005-02-27 20:42:28 +08:00
|
|
|
case $php_cv_re2c_version in
|
|
|
|
""|invalid[)]
|
|
|
|
AC_MSG_WARN([You will need re2c 0.94 or later if you want to regenerate PHP parsers.])
|
|
|
|
RE2C="exit 0;"
|
|
|
|
;;
|
|
|
|
esac
|
2005-02-25 02:11:36 +08:00
|
|
|
PHP_SUBST(RE2C)
|
2002-08-07 00:01:34 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
dnl Common setup macros: PHP_SETUP_<what>
|
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
|
2004-12-30 22:50:06 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_SETUP_KERBEROS(shared-add [, action-found [, action-not-found]])
|
|
|
|
dnl
|
|
|
|
dnl Common setup macro for kerberos
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_SETUP_KERBEROS],[
|
|
|
|
found_kerberos=no
|
|
|
|
unset KERBEROS_CFLAGS
|
|
|
|
unset KERBEROS_LIBS
|
|
|
|
|
|
|
|
dnl First try to find krb5-config
|
|
|
|
if test -z "$KRB5_CONFIG"; then
|
|
|
|
AC_PATH_PROG(KRB5_CONFIG, krb5-config, no, [$PATH:/usr/kerberos/bin:/usr/local/bin])
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl If krb5-config is found try using it
|
|
|
|
if test "$PHP_KERBEROS" = "yes" && test -x "$KRB5_CONFIG"; then
|
|
|
|
KERBEROS_LIBS=`$KRB5_CONFIG --libs gssapi`
|
|
|
|
KERBEROS_CFLAGS=`$KRB5_CONFIG --cflags gssapi`
|
|
|
|
|
|
|
|
if test -n "$KERBEROS_LIBS" && test -n "$KERBEROS_CFLAGS"; then
|
|
|
|
found_kerberos=yes
|
|
|
|
PHP_EVAL_LIBLINE($KERBEROS_LIBS, $1)
|
|
|
|
PHP_EVAL_INCLINE($KERBEROS_CFLAGS)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl If still not found use old skool method
|
|
|
|
if test "$found_kerberos" = "no"; then
|
|
|
|
|
|
|
|
if test "$PHP_KERBEROS" = "yes"; then
|
|
|
|
PHP_KERBEROS="/usr/kerberos /usr/local /usr"
|
|
|
|
fi
|
|
|
|
|
|
|
|
for i in $PHP_KERBEROS; do
|
|
|
|
if test -f $i/$PHP_LIBDIR/libkrb5.a || test -f $i/$PHP_LIBDIR/libkrb5.$SHLIB_SUFFIX_NAME; then
|
|
|
|
PHP_KERBEROS_DIR=$i
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if test "$PHP_KERBEROS_DIR"; then
|
|
|
|
found_kerberos=yes
|
|
|
|
PHP_ADD_LIBPATH($PHP_KERBEROS_DIR/$PHP_LIBDIR, $1)
|
|
|
|
PHP_ADD_LIBRARY(gssapi_krb5, 1, $1)
|
|
|
|
PHP_ADD_LIBRARY(krb5, 1, $1)
|
|
|
|
PHP_ADD_LIBRARY(k5crypto, 1, $1)
|
|
|
|
PHP_ADD_LIBRARY(com_err, 1, $1)
|
|
|
|
PHP_ADD_INCLUDE($PHP_KERBEROS_DIR/include)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$found_kerberos" = "yes"; then
|
|
|
|
ifelse([$2],[],:,[$2])
|
|
|
|
ifelse([$3],[],,[else $3])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2003-06-24 22:05:26 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_SETUP_OPENSSL(shared-add [, action-found [, action-not-found]])
|
|
|
|
dnl
|
|
|
|
dnl Common setup macro for openssl
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_SETUP_OPENSSL],[
|
|
|
|
found_openssl=no
|
|
|
|
unset OPENSSL_INCDIR
|
|
|
|
unset OPENSSL_LIBDIR
|
|
|
|
|
2004-12-30 22:50:06 +08:00
|
|
|
dnl Fallbacks for different configure options
|
|
|
|
if test "$PHP_OPENSSL" != "no"; then
|
|
|
|
PHP_OPENSSL_DIR=$PHP_OPENSSL
|
|
|
|
elif test "$PHP_IMAP_SSL" != "no"; then
|
|
|
|
PHP_OPENSSL_DIR=$PHP_IMAP_SSL
|
|
|
|
fi
|
|
|
|
|
2003-09-24 22:22:57 +08:00
|
|
|
dnl First try to find pkg-config
|
|
|
|
if test -z "$PKG_CONFIG"; then
|
|
|
|
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl If pkg-config is found try using it
|
2004-12-30 22:50:06 +08:00
|
|
|
if test "$PHP_OPENSSL_DIR" = "yes" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists openssl; then
|
2003-09-24 22:22:57 +08:00
|
|
|
if $PKG_CONFIG --atleast-version=0.9.6 openssl; then
|
|
|
|
found_openssl=yes
|
|
|
|
OPENSSL_LIBS=`$PKG_CONFIG --libs openssl`
|
|
|
|
OPENSSL_INCS=`$PKG_CONFIG --cflags-only-I openssl`
|
|
|
|
OPENSSL_INCDIR=`$PKG_CONFIG --variable=includedir openssl`
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([OpenSSL version 0.9.6 or greater required.])
|
|
|
|
fi
|
|
|
|
|
2003-10-03 12:29:13 +08:00
|
|
|
if test -n "$OPENSSL_LIBS" && test -n "$OPENSSL_INCS"; then
|
|
|
|
PHP_EVAL_LIBLINE($OPENSSL_LIBS, $1)
|
|
|
|
PHP_EVAL_INCLINE($OPENSSL_INCS)
|
|
|
|
fi
|
2004-12-30 22:50:06 +08:00
|
|
|
fi
|
2003-10-03 12:29:13 +08:00
|
|
|
|
2004-12-30 22:50:06 +08:00
|
|
|
dnl If pkg-config fails for some reason, revert to the old method
|
|
|
|
if test "$found_openssl" = "no"; then
|
|
|
|
|
|
|
|
if test "$PHP_OPENSSL_DIR" = "yes"; then
|
|
|
|
PHP_OPENSSL_DIR="/usr/local/ssl /usr/local /usr /usr/local/openssl"
|
2003-06-24 22:05:26 +08:00
|
|
|
fi
|
|
|
|
|
2004-12-30 22:50:06 +08:00
|
|
|
for i in $PHP_OPENSSL_DIR; do
|
2003-09-24 22:24:18 +08:00
|
|
|
if test -r $i/include/openssl/evp.h; then
|
|
|
|
OPENSSL_INCDIR=$i/include
|
|
|
|
fi
|
2004-11-03 22:07:09 +08:00
|
|
|
if test -r $i/$PHP_LIBDIR/libssl.a -o -r $i/$PHP_LIBDIR/libssl.$SHLIB_SUFFIX_NAME; then
|
|
|
|
OPENSSL_LIBDIR=$i/$PHP_LIBDIR
|
2003-09-24 22:24:18 +08:00
|
|
|
fi
|
2003-10-02 08:35:09 +08:00
|
|
|
test -n "$OPENSSL_INCDIR" && test -n "$OPENSSL_LIBDIR" && break
|
2003-09-24 22:24:18 +08:00
|
|
|
done
|
2003-06-24 22:05:26 +08:00
|
|
|
|
2003-09-24 22:24:18 +08:00
|
|
|
if test -z "$OPENSSL_INCDIR"; then
|
|
|
|
AC_MSG_ERROR([Cannot find OpenSSL's <evp.h>])
|
|
|
|
fi
|
2003-06-24 22:05:26 +08:00
|
|
|
|
2003-09-24 22:24:18 +08:00
|
|
|
if test -z "$OPENSSL_LIBDIR"; then
|
|
|
|
AC_MSG_ERROR([Cannot find OpenSSL's libraries])
|
|
|
|
fi
|
|
|
|
|
|
|
|
old_CPPFLAGS=$CPPFLAGS
|
|
|
|
CPPFLAGS=-I$OPENSSL_INCDIR
|
|
|
|
AC_MSG_CHECKING([for OpenSSL version])
|
|
|
|
AC_EGREP_CPP(yes,[
|
2003-06-24 22:05:26 +08:00
|
|
|
#include <openssl/opensslv.h>
|
|
|
|
#if OPENSSL_VERSION_NUMBER >= 0x0090600fL
|
|
|
|
yes
|
|
|
|
#endif
|
2003-09-24 22:24:18 +08:00
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([>= 0.9.6])
|
|
|
|
],[
|
|
|
|
AC_MSG_ERROR([OpenSSL version 0.9.6 or greater required.])
|
|
|
|
])
|
|
|
|
CPPFLAGS=$old_CPPFLAGS
|
|
|
|
|
2003-10-03 12:29:13 +08:00
|
|
|
PHP_ADD_INCLUDE($OPENSSL_INCDIR)
|
|
|
|
|
2003-09-24 22:24:18 +08:00
|
|
|
PHP_CHECK_LIBRARY(crypto, CRYPTO_free, [
|
2003-10-03 12:29:13 +08:00
|
|
|
PHP_ADD_LIBRARY(crypto,,$1)
|
|
|
|
],[
|
2003-09-24 22:24:18 +08:00
|
|
|
AC_MSG_ERROR([libcrypto not found!])
|
2003-06-24 22:05:26 +08:00
|
|
|
],[
|
2003-09-24 22:24:18 +08:00
|
|
|
-L$OPENSSL_LIBDIR
|
2003-06-24 22:05:26 +08:00
|
|
|
])
|
2003-11-13 22:17:47 +08:00
|
|
|
|
|
|
|
old_LIBS=$LIBS
|
|
|
|
LIBS="$LIBS -lcrypto"
|
2003-10-03 12:29:13 +08:00
|
|
|
PHP_CHECK_LIBRARY(ssl, SSL_CTX_set_ssl_version, [
|
|
|
|
found_openssl=yes
|
|
|
|
],[
|
|
|
|
AC_MSG_ERROR([libssl not found!])
|
|
|
|
],[
|
|
|
|
-L$OPENSSL_LIBDIR
|
|
|
|
])
|
2003-11-13 22:17:47 +08:00
|
|
|
LIBS=$old_LIBS
|
2003-12-12 13:19:30 +08:00
|
|
|
PHP_ADD_LIBRARY(ssl,,$1)
|
2004-01-20 09:11:04 +08:00
|
|
|
|
|
|
|
PHP_ADD_LIBPATH($OPENSSL_LIBDIR, $1)
|
2003-09-24 22:22:57 +08:00
|
|
|
fi
|
2003-06-24 22:05:26 +08:00
|
|
|
|
2004-12-30 22:50:06 +08:00
|
|
|
if test "$found_openssl" = "yes"; then
|
2003-09-24 22:22:57 +08:00
|
|
|
dnl For apache 1.3.x static build
|
2003-06-24 22:05:26 +08:00
|
|
|
OPENSSL_INCDIR_OPT=-I$OPENSSL_INCDIR
|
|
|
|
AC_SUBST(OPENSSL_INCDIR_OPT)
|
|
|
|
|
2003-10-03 12:29:13 +08:00
|
|
|
ifelse([$2],[],:,[$2])
|
2003-06-24 22:05:26 +08:00
|
|
|
ifelse([$3],[],,[else $3])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2002-03-18 05:09:21 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_SETUP_ICONV(shared-add [, action-found [, action-not-found]])
|
|
|
|
dnl
|
|
|
|
dnl Common setup macro for iconv
|
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_SETUP_ICONV], [
|
2002-03-18 05:09:21 +08:00
|
|
|
found_iconv=no
|
2002-03-20 19:59:48 +08:00
|
|
|
unset ICONV_DIR
|
|
|
|
|
2004-12-08 20:50:00 +08:00
|
|
|
# Create the directories for a VPATH build:
|
2005-04-08 04:39:02 +08:00
|
|
|
$php_shtool mkdir -p ext/iconv
|
2004-12-08 20:50:00 +08:00
|
|
|
|
2004-12-11 19:16:55 +08:00
|
|
|
echo > ext/iconv/php_have_bsd_iconv.h
|
|
|
|
echo > ext/iconv/php_have_glibc_iconv.h
|
2004-12-07 04:39:20 +08:00
|
|
|
echo > ext/iconv/php_have_libiconv.h
|
|
|
|
echo > ext/iconv/php_have_iconv.h
|
2004-12-09 17:06:06 +08:00
|
|
|
echo > ext/iconv/php_php_iconv_impl.h
|
2004-12-11 19:16:55 +08:00
|
|
|
echo > ext/iconv/php_php_iconv_h_path.h
|
|
|
|
echo > ext/iconv/php_iconv_supports_errno.h
|
2004-12-07 04:39:20 +08:00
|
|
|
|
2002-03-22 04:22:05 +08:00
|
|
|
dnl
|
|
|
|
dnl Check libc first if no path is provided in --with-iconv
|
|
|
|
dnl
|
|
|
|
if test "$PHP_ICONV" = "yes"; then
|
|
|
|
AC_CHECK_FUNC(iconv, [
|
2002-03-20 21:24:59 +08:00
|
|
|
found_iconv=yes
|
2002-03-22 04:22:05 +08:00
|
|
|
],[
|
|
|
|
AC_CHECK_FUNC(libiconv,[
|
2004-12-07 04:39:20 +08:00
|
|
|
PHP_DEFINE(HAVE_LIBICONV,1,[ext/iconv])
|
2005-04-08 04:39:02 +08:00
|
|
|
AC_DEFINE(HAVE_LIBICONV, 1, [ ])
|
2002-03-22 04:22:05 +08:00
|
|
|
found_iconv=yes
|
|
|
|
])
|
|
|
|
])
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl Check external libs for iconv funcs
|
|
|
|
dnl
|
|
|
|
if test "$found_iconv" = "no"; then
|
2002-03-18 05:09:21 +08:00
|
|
|
|
|
|
|
for i in $PHP_ICONV /usr/local /usr; do
|
2002-03-20 20:08:30 +08:00
|
|
|
if test -r $i/include/giconv.h; then
|
2002-03-26 08:14:02 +08:00
|
|
|
AC_DEFINE(HAVE_GICONV_H, 1, [ ])
|
2002-03-18 05:09:21 +08:00
|
|
|
ICONV_DIR=$i
|
2002-03-20 20:08:30 +08:00
|
|
|
iconv_lib_name=giconv
|
2002-03-18 05:09:21 +08:00
|
|
|
break
|
2002-03-20 20:08:30 +08:00
|
|
|
elif test -r $i/include/iconv.h; then
|
|
|
|
ICONV_DIR=$i
|
|
|
|
iconv_lib_name=iconv
|
|
|
|
break
|
2002-03-26 08:14:02 +08:00
|
|
|
fi
|
2002-03-18 05:09:21 +08:00
|
|
|
done
|
|
|
|
|
|
|
|
if test -z "$ICONV_DIR"; then
|
2002-03-22 04:22:05 +08:00
|
|
|
AC_MSG_ERROR([Please specify the install prefix of iconv with --with-iconv=<DIR>])
|
2002-03-18 05:09:21 +08:00
|
|
|
fi
|
|
|
|
|
2004-11-03 22:07:09 +08:00
|
|
|
if test -f $ICONV_DIR/$PHP_LIBDIR/lib$iconv_lib_name.a ||
|
|
|
|
test -f $ICONV_DIR/$PHP_LIBDIR/lib$iconv_lib_name.$SHLIB_SUFFIX_NAME
|
2002-03-18 05:09:21 +08:00
|
|
|
then
|
2002-03-20 06:40:18 +08:00
|
|
|
PHP_CHECK_LIBRARY($iconv_lib_name, libiconv, [
|
2002-03-18 05:09:21 +08:00
|
|
|
found_iconv=yes
|
2004-12-07 04:39:20 +08:00
|
|
|
PHP_DEFINE(HAVE_LIBICONV,1,[ext/iconv])
|
2005-04-08 04:39:02 +08:00
|
|
|
AC_DEFINE(HAVE_LIBICONV,1,[ ])
|
2002-03-18 05:09:21 +08:00
|
|
|
], [
|
2002-03-20 15:36:56 +08:00
|
|
|
PHP_CHECK_LIBRARY($iconv_lib_name, iconv, [
|
|
|
|
found_iconv=yes
|
2002-03-21 02:16:51 +08:00
|
|
|
], [], [
|
2004-11-03 22:07:09 +08:00
|
|
|
-L$ICONV_DIR/$PHP_LIBDIR
|
2002-03-20 15:36:56 +08:00
|
|
|
])
|
2002-03-18 05:09:21 +08:00
|
|
|
], [
|
2004-11-03 22:07:09 +08:00
|
|
|
-L$ICONV_DIR/$PHP_LIBDIR
|
2002-03-18 05:09:21 +08:00
|
|
|
])
|
|
|
|
fi
|
2002-03-22 04:22:05 +08:00
|
|
|
fi
|
2002-01-04 20:26:27 +08:00
|
|
|
|
2002-03-20 20:08:30 +08:00
|
|
|
if test "$found_iconv" = "yes"; then
|
2005-04-08 04:39:02 +08:00
|
|
|
PHP_DEFINE(HAVE_ICONV,1,[ext/iconv])
|
|
|
|
AC_DEFINE(HAVE_ICONV,1,[ ])
|
2002-03-20 19:59:48 +08:00
|
|
|
if test -n "$ICONV_DIR"; then
|
2004-11-03 22:07:09 +08:00
|
|
|
PHP_ADD_LIBRARY_WITH_PATH($iconv_lib_name, $ICONV_DIR/$PHP_LIBDIR, $1)
|
2002-03-20 19:59:48 +08:00
|
|
|
PHP_ADD_INCLUDE($ICONV_DIR/include)
|
|
|
|
fi
|
2002-03-18 05:09:21 +08:00
|
|
|
$2
|
2002-03-20 20:08:30 +08:00
|
|
|
ifelse([$3],[],,[else $3])
|
2002-03-18 05:09:21 +08:00
|
|
|
fi
|
|
|
|
])
|
1. PHP_CHECK_FUNC(func, lib1, lib2, ..., libn) searches for
func and __func using LIBS, and if unsuccessful, searches
each specified lib. Defines HAVE_FUNC, if found. If func/__func is
found in library foo, HAVE_LIBFOO is defined.
(Jani, me)
2. Autoconf 2.5x is more pedantic regarding locating header files.
We include the proper header files now in the check. (me)
3. The nsl/bind/socket/etc checks have been rewritten using PHP_CHECK_FUNC.
This ensures that no extra library is used, if the symbol is
available in libc which avoids issues on BSD/OS, OpenBSD and others.
(Jani)
2002-07-05 05:07:08 +08:00
|
|
|
|
2003-05-19 23:33:19 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_SETUP_LIBXML(shared-add [, action-found [, action-not-found]])
|
|
|
|
dnl
|
|
|
|
dnl Common setup macro for libxml
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_SETUP_LIBXML], [
|
|
|
|
|
|
|
|
for i in $PHP_LIBXML_DIR /usr/local /usr; do
|
|
|
|
if test -x "$i/bin/xml2-config"; then
|
|
|
|
XML2_CONFIG="$i/bin/xml2-config"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if test -x "$XML2_CONFIG"; then
|
|
|
|
libxml_full_version=`$XML2_CONFIG --version`
|
|
|
|
ac_IFS=$IFS
|
|
|
|
IFS="."
|
|
|
|
set $libxml_full_version
|
|
|
|
IFS=$ac_IFS
|
|
|
|
LIBXML_VERSION=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3`
|
2005-03-11 06:35:18 +08:00
|
|
|
if test "$LIBXML_VERSION" -ge "2006000"; then
|
2003-05-19 23:33:19 +08:00
|
|
|
LIBXML_LIBS=`$XML2_CONFIG --libs`
|
|
|
|
LIBXML_INCS=`$XML2_CONFIG --cflags`
|
2003-05-20 05:11:44 +08:00
|
|
|
PHP_EVAL_LIBLINE($LIBXML_LIBS, $1)
|
2003-05-19 23:33:19 +08:00
|
|
|
PHP_EVAL_INCLINE($LIBXML_INCS)
|
2004-02-23 11:24:58 +08:00
|
|
|
|
|
|
|
dnl Check that build works with given libs
|
|
|
|
AC_CACHE_CHECK(whether libxml build works, php_cv_libxml_build_works, [
|
|
|
|
PHP_TEST_BUILD(xmlInitParser,
|
|
|
|
[
|
|
|
|
php_cv_libxml_build_works=yes
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
AC_MSG_ERROR([build test failed. Please check the config.log for details.])
|
|
|
|
], [
|
|
|
|
[$]$1
|
|
|
|
])
|
|
|
|
])
|
2004-03-27 10:03:44 +08:00
|
|
|
if test "$php_cv_libxml_build_works" = "yes"; then
|
|
|
|
AC_DEFINE(HAVE_LIBXML, 1, [ ])
|
|
|
|
fi
|
2003-05-19 23:33:19 +08:00
|
|
|
$2
|
|
|
|
else
|
2005-03-11 06:35:18 +08:00
|
|
|
AC_MSG_ERROR([libxml2 version 2.6.0 or greater required.])
|
2003-05-19 23:33:19 +08:00
|
|
|
fi
|
|
|
|
ifelse([$3],[],,[else $3])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl -------------------------------------------------------------------------
|
|
|
|
dnl Misc. macros
|
|
|
|
dnl -------------------------------------------------------------------------
|
2002-07-26 02:37:16 +08:00
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_AP_EXTRACT_VERSION(/path/httpd)
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
2002-07-26 02:37:16 +08:00
|
|
|
dnl This macro is used to get a comparable
|
|
|
|
dnl version for apache1/2.
|
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_AP_EXTRACT_VERSION],[
|
2004-11-03 21:04:10 +08:00
|
|
|
ac_output=`$1 -v 2>&1 | grep version`
|
2002-07-26 02:37:16 +08:00
|
|
|
ac_IFS=$IFS
|
|
|
|
IFS="- /.
|
|
|
|
"
|
|
|
|
set $ac_output
|
|
|
|
IFS=$ac_IFS
|
|
|
|
|
|
|
|
APACHE_VERSION=`expr [$]4 \* 1000000 + [$]5 \* 1000 + [$]6`
|
|
|
|
])
|
2004-02-23 11:24:58 +08:00
|
|
|
|
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_DEBUG_MACRO(filename)
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_DEBUG_MACRO],[
|
|
|
|
DEBUG_LOG=$1
|
|
|
|
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*
|
2004-02-23 11:24:58 +08:00
|
|
|
])
|
2004-07-18 20:03:51 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_CONFIG_NICE(filename)
|
|
|
|
dnl
|
|
|
|
dnl Generates the config.nice file
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CONFIG_NICE],[
|
|
|
|
test -f $1 && mv $1 $1.old
|
|
|
|
rm -f $1.old
|
|
|
|
cat >$1<<EOF
|
|
|
|
#! /bin/sh
|
|
|
|
#
|
|
|
|
# Created by configure
|
2004-07-18 20:03:51 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
EOF
|
2004-07-18 20:03:51 +08:00
|
|
|
|
2005-02-25 02:11:36 +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
|
|
|
|
|
|
|
|
for arg in [$]0 "[$]@"; do
|
|
|
|
echo "'[$]arg' \\" >> $1
|
|
|
|
done
|
|
|
|
echo '"[$]@"' >> $1
|
|
|
|
chmod +x $1
|
2004-09-12 14:35:51 +08:00
|
|
|
])
|
2004-12-21 04:37:45 +08:00
|
|
|
|
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_REGEX
|
2004-12-21 04:37:45 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_REGEX],[
|
|
|
|
if test "$REGEX_TYPE" = "php"; then
|
|
|
|
AC_DEFINE(HSREGEX,1,[ ])
|
|
|
|
AC_DEFINE(REGEX,1,[ ])
|
|
|
|
PHP_ADD_SOURCES(regex, regcomp.c regexec.c regerror.c regfree.c)
|
|
|
|
elif test "$REGEX_TYPE" = "system"; then
|
|
|
|
AC_DEFINE(REGEX,0,[ ])
|
|
|
|
fi
|
2004-12-21 04:37:45 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_MSG_CHECKING([which regex library to use])
|
|
|
|
AC_MSG_RESULT([$REGEX_TYPE])
|
2004-12-21 04:37:45 +08:00
|
|
|
])
|