2019-05-13 00:43:03 +08:00
|
|
|
dnl This file contains local autoconf macros.
|
2005-02-25 02:11:36 +08:00
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
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.
|
2018-07-29 09:43:45 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Adds separator title configure output (idea borrowed from mm).
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CONFIGURE_PART],[
|
|
|
|
AC_MSG_RESULT()
|
|
|
|
AC_MSG_RESULT([${T_MD}$1${T_ME}])
|
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl ----------------------------------------------------------------------------
|
|
|
|
dnl Build system helper macros.
|
|
|
|
dnl ----------------------------------------------------------------------------
|
2005-02-25 02:11:36 +08:00
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_DEF_HAVE(what)
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Generates 'AC_DEFINE(HAVE_WHAT, 1, [ ])'.
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
2005-06-14 10:18:44 +08:00
|
|
|
AC_DEFUN([PHP_DEF_HAVE],[AC_DEFINE([HAVE_]translit($1,a-z_.-,A-Z___), 1, [ ])])
|
2005-02-25 02:11:36 +08:00
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_RUN_ONCE(namespace, variable, code)
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Execute code, if variable is not set in namespace.
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_RUN_ONCE],[
|
|
|
|
changequote({,})
|
2005-05-27 21:10:01 +08:00
|
|
|
unique=`echo $2|$SED 's/[^a-zA-Z0-9]/_/g'`
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Expands path to an absolute path and assigns it to variable.
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_EXPAND_PATH],[
|
|
|
|
if test -z "$1" || echo "$1" | grep '^/' >/dev/null ; then
|
|
|
|
$2=$1
|
|
|
|
else
|
|
|
|
changequote({,})
|
2013-06-24 02:01:36 +08:00
|
|
|
ep_dir=`echo $1|$SED 's%/*[^/][^/]*/*$%%'`
|
2005-02-25 02:11:36 +08:00
|
|
|
changequote([,])
|
2013-06-24 02:01:36 +08:00
|
|
|
ep_realdir=`(cd "$ep_dir" && pwd)`
|
|
|
|
$2="$ep_realdir"/`basename "$1"`
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-05-13 00:43:03 +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
|
2020-02-01 14:03:13 +08:00
|
|
|
dnl Adds variable with its value into Makefile, e.g.:
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl CC = gcc
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_SUBST],[
|
|
|
|
PHP_VAR_SUBST="$PHP_VAR_SUBST $1"
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
2020-02-01 14:03:13 +08:00
|
|
|
dnl PHP_SUBST_OLD(varname, [VALUE])
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Same as PHP_SUBST() but also substitutes all @VARNAME@ instances in every
|
|
|
|
dnl file passed to AC_OUTPUT.
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_SUBST_OLD],[
|
2020-02-01 14:03:13 +08:00
|
|
|
AC_SUBST($@)
|
|
|
|
PHP_SUBST([$1])
|
2005-02-25 02:11:36 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_OUTPUT(file)
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Adds "file" to the list of files generated by AC_OUTPUT. This macro can be
|
|
|
|
dnl used several times.
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_OUTPUT],[
|
|
|
|
PHP_OUTPUT_FILES="$PHP_OUTPUT_FILES $1"
|
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl ----------------------------------------------------------------------------
|
|
|
|
dnl Build system base macros.
|
|
|
|
dnl ----------------------------------------------------------------------------
|
2005-02-25 02:11:36 +08:00
|
|
|
|
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Creates build directories and Makefile placeholders.
|
|
|
|
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
|
2005-05-07 10:51:53 +08:00
|
|
|
test -d include || $php_shtool mkdir include
|
2002-03-07 22:20:02 +08:00
|
|
|
> Makefile.objects
|
|
|
|
> Makefile.fragments
|
2019-05-13 00:43:03 +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
|
2005-05-27 21:10:01 +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
|
2018-07-29 09:43:45 +08:00
|
|
|
dnl
|
2002-03-07 22:20:02 +08:00
|
|
|
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
|
|
|
|
|
2019-03-04 13:06:10 +08:00
|
|
|
cat $abs_srcdir/build/Makefile.global Makefile.fragments Makefile.objects >> Makefile
|
2002-03-07 22:20:02 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_ADD_MAKEFILE_FRAGMENT([srcfile [, ext_srcdir [, ext_builddir]]])
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Processes a file called Makefile.frag in the source directory of the most
|
|
|
|
dnl recently added extension. $(srcdir) and $(builddir) are substituted with the
|
|
|
|
dnl proper paths. Can be used to supply custom rules and/or additional targets.
|
2005-02-25 02:11:36 +08:00
|
|
|
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)
|
2007-03-25 18:21:02 +08:00
|
|
|
test -f "$src" && $SED -e "s#\$(srcdir)#$ac_srcdir#g" -e "s#\$(builddir)#$ac_builddir#g" $src >> Makefile.fragments
|
2005-02-25 02:11:36 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_ADD_SOURCES(source-path, sources [, special-flags [, type]])
|
2002-03-07 22:20:02 +08:00
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Adds sources which are located relative to source-path to the array of type
|
|
|
|
dnl type. Sources are processed with optional special-flags which are passed to
|
|
|
|
dnl the compiler. Sources can be either written in C or C++ (filenames shall end
|
|
|
|
dnl in .c or .cpp, respectively).
|
2002-03-07 22:20:02 +08:00
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Note: If source-path begins with a "/", the "/" is removed and the path is
|
|
|
|
dnl interpreted relative to the top build-directory.
|
|
|
|
dnl
|
|
|
|
dnl Which array to append to?
|
2002-03-07 22:20:02 +08:00
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_ADD_SOURCES],[
|
2010-11-14 07:13:07 +08:00
|
|
|
PHP_ADD_SOURCES_X($1, $2, $3, 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)
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
|
|
|
dnl Internal, don't use.
|
|
|
|
dnl
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Additional to PHP_ADD_SOURCES (see above), this lets you set the name of the
|
|
|
|
dnl array target-var directly, as well as whether shared objects will be built
|
|
|
|
dnl from the sources. Should not be used directly.
|
2018-07-29 09:43:45 +08:00
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_ADD_SOURCES_X],[
|
2019-05-13 00:43:03 +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
|
2018-07-29 09:43:45 +08:00
|
|
|
|
2002-03-07 22:20:02 +08:00
|
|
|
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
|
|
|
|
2019-05-13 00:43:03 +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
|
2018-07-29 09:43:45 +08:00
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Remove the suffix.
|
2002-03-07 22:20:02 +08:00
|
|
|
IFS=.
|
|
|
|
set $ac_src
|
|
|
|
ac_obj=[$]1
|
|
|
|
IFS=$old_IFS
|
2018-07-29 09:43:45 +08:00
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Append to the array which has been dynamically chosen at m4 time.
|
2002-04-06 21:42:40 +08:00
|
|
|
$4="[$]$4 [$]ac_bdir[$]ac_obj.lo"
|
2002-03-07 22:20:02 +08:00
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Choose the right compiler/flags/etc. for the source-file.
|
2002-03-07 22:20:02 +08:00
|
|
|
case $ac_src in
|
2005-09-23 17:40:24 +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" ;;
|
|
|
|
*.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" ;;
|
|
|
|
*.cpp|*.cc|*.cxx[)] 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
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Create a rule for the object/source combo.
|
2005-09-23 17:40:24 +08:00
|
|
|
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
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl ----------------------------------------------------------------------------
|
|
|
|
dnl Compiler characteristics checks.
|
|
|
|
dnl ----------------------------------------------------------------------------
|
2001-12-01 08:59:43 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_RUNPATH_SWITCH
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Checks for -R, etc. switch.
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_RUNPATH_SWITCH],[
|
|
|
|
AC_MSG_CHECKING([if compiler supports -R])
|
|
|
|
AC_CACHE_VAL(php_cv_cc_dashr,[
|
2005-09-23 17:40:24 +08:00
|
|
|
SAVE_LIBS=$LIBS
|
|
|
|
LIBS="-R /usr/$PHP_LIBDIR $LIBS"
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],[php_cv_cc_dashr=yes],[php_cv_cc_dashr=no])
|
2005-09-23 17:40:24 +08:00
|
|
|
LIBS=$SAVE_LIBS])
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_MSG_RESULT([$php_cv_cc_dashr])
|
|
|
|
if test $php_cv_cc_dashr = "yes"; then
|
2005-09-23 17:40:24 +08:00
|
|
|
ld_runpath_switch=-R
|
2005-02-25 02:11:36 +08:00
|
|
|
else
|
2005-09-23 17:40:24 +08:00
|
|
|
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"
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],[php_cv_cc_rpath=yes],[php_cv_cc_rpath=no])
|
2005-09-23 17:40:24 +08:00
|
|
|
LIBS=$SAVE_LIBS])
|
|
|
|
AC_MSG_RESULT([$php_cv_cc_rpath])
|
|
|
|
if test $php_cv_cc_rpath = "yes"; then
|
|
|
|
ld_runpath_switch=-Wl,-rpath,
|
|
|
|
else
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Something innocuous.
|
2005-09-23 17:40:24 +08:00
|
|
|
ld_runpath_switch=-L
|
|
|
|
fi
|
2005-02-25 02:11:36 +08:00
|
|
|
fi
|
2007-08-20 22:28:45 +08:00
|
|
|
if test "$PHP_RPATH" = "no"; then
|
|
|
|
ld_runpath_switch=
|
|
|
|
fi
|
2005-02-25 02:11:36 +08:00
|
|
|
])
|
|
|
|
|
2020-08-04 22:11:58 +08:00
|
|
|
AC_DEFUN([PHP_CHECK_GCC_ARG],[
|
2020-08-08 16:38:31 +08:00
|
|
|
AC_MSG_ERROR([[Use AX_CHECK_COMPILE_FLAG instead]])
|
2020-08-04 22:11:58 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_LIBGCC_LIBPATH(gcc)
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Stores the location of libgcc in libgcc_libpath.
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_LIBGCC_LIBPATH],[
|
|
|
|
changequote({,})
|
2005-05-27 21:10:01 +08:00
|
|
|
libgcc_libpath=`$1 --print-libgcc-file-name|$SED 's%/*[^/][^/]*$%%'`
|
2005-02-25 02:11:36 +08:00
|
|
|
changequote([,])
|
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl ----------------------------------------------------------------------------
|
|
|
|
dnl Macros to modify LIBS, INCLUDES, etc. variables.
|
|
|
|
dnl ----------------------------------------------------------------------------
|
2005-02-25 02:11:36 +08:00
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_REMOVE_USR_LIB(NAME)
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Removes all -L/usr/$PHP_LIBDIR entries from variable NAME.
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Use this macro, if you need to add libraries and or library search paths to
|
|
|
|
dnl the PHP build system which are only given in compiler notation.
|
2000-06-17 18:50:42 +08:00
|
|
|
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
|
2005-06-13 16:44:47 +08:00
|
|
|
-pthread[)]
|
|
|
|
if test "$ext_shared" = "yes"; then
|
|
|
|
$2="[$]$2 -pthread"
|
|
|
|
else
|
|
|
|
PHP_RUN_ONCE(EXTRA_LDFLAGS, [$ac_i], [EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i"])
|
2019-10-14 17:32:47 +08:00
|
|
|
PHP_RUN_ONCE(EXTRA_LDFLAGS_PROGRAM, [$ac_i],
|
|
|
|
[EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $ac_i"])
|
2005-06-13 16:44:47 +08:00
|
|
|
fi
|
|
|
|
;;
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Use this macro, if you need to add header search paths to the PHP build
|
|
|
|
dnl system which are only given in compiler notation.
|
2000-06-17 18:50:42 +08:00
|
|
|
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
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
|
|
|
dnl _PHP_ADD_LIBPATH_GLOBAL(variable)
|
|
|
|
dnl
|
|
|
|
dnl Internal, don't use.
|
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
|
|
])
|
2019-05-13 00:43:03 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_ADD_LIBPATH(path [, SHARED-LIBADD])
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Adds a path to linkpath/runpath (LDFLAGS).
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_ADD_LIBPATH],[
|
2005-06-22 14:50:24 +08:00
|
|
|
if test "$1" != "/usr/$PHP_LIBDIR" && test "$1" != "/usr/lib"; then
|
2005-02-25 02:11:36 +08:00
|
|
|
PHP_EXPAND_PATH($1, ai_p)
|
|
|
|
ifelse([$2],,[
|
|
|
|
_PHP_ADD_LIBPATH_GLOBAL([$ai_p])
|
|
|
|
],[
|
|
|
|
if test "$ext_shared" = "yes"; then
|
2007-08-20 22:28:45 +08:00
|
|
|
$2="-L$ai_p [$]$2"
|
|
|
|
test -n "$ld_runpath_switch" && $2="$ld_runpath_switch$ai_p [$]$2"
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Builds RPATHS/LDFLAGS from PHP_RPATHS.
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Can be passed to native cc/libtool
|
2005-02-25 02:11:36 +08:00
|
|
|
PHP_LDFLAGS="$PHP_LDFLAGS -L$i"
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Libtool-specific
|
2005-02-25 02:11:36 +08:00
|
|
|
PHP_RPATHS="$PHP_RPATHS -R $i"
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl cc-specific
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Add an include path. If before is 1, add in the beginning of INCLUDES.
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
|
|
|
dnl _PHP_X_ADD_LIBRARY
|
|
|
|
dnl
|
|
|
|
dnl Internal, don't use.
|
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([_PHP_X_ADD_LIBRARY],[dnl
|
|
|
|
ifelse([$2],,$3="-l$1 [$]$3", $3="[$]$3 -l$1") dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl _PHP_ADD_LIBRARY_SKELETON
|
|
|
|
dnl
|
|
|
|
dnl Internal, don't use.
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_ADD_LIBRARY(library[, append[, shared-libadd]])
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Add a library to the link line.
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Add a library to the link line (deferred, not used during configure).
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Add a library to the link line and path to linkpath/runpath. If
|
|
|
|
dnl shared-libadd is not empty and $ext_shared is yes, shared-libadd will be
|
|
|
|
dnl assigned the library information.
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Add a library to the link line (deferred) and path to linkpath/runpath (not
|
|
|
|
dnl deferred). If shared-libadd is not empty and $ext_shared is yes,
|
|
|
|
dnl shared-libadd will be assigned the library information.
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Add a (Darwin / Mac OS X) framework to the link line. If before is 1, the
|
|
|
|
dnl framework is added to the beginning of the line.
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Add a (Darwin / Mac OS X) framework path to the link and include lines.
|
|
|
|
dnl Default paths include (but are not limited to) /Local/Library/Frameworks and
|
|
|
|
dnl /System/Library/Frameworks, so these don't need to be specifically added. If
|
|
|
|
dnl before is 1, the framework path is added to the beginning of the relevant
|
|
|
|
dnl lines.
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Adds a (Darwin / Mac OS X) framework path and the framework itself to the
|
|
|
|
dnl link and include lines.
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Set libtool variable.
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl ----------------------------------------------------------------------------
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl Wrapper macros for AC_ARG_WITH / AC_ARG_ENABLE
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl ----------------------------------------------------------------------------
|
2005-02-25 02:11:36 +08:00
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_ARG_ANALYZE_EX
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
|
|
|
dnl Internal.
|
|
|
|
dnl
|
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,*[)]
|
2005-05-27 21:10:01 +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
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_ARG_ANALYZE
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
|
|
|
dnl Internal.
|
|
|
|
dnl
|
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]])
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2000-03-30 23:00:30 +08:00
|
|
|
dnl Sets PHP_ARG_NAME either to the user value or to the default value.
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl default-val defaults to no. This will also set the variable ext_shared, and
|
|
|
|
dnl will overwrite any previous variable of that name. If extension-or-not is
|
|
|
|
dnl yes (default), then do the ENABLE_ALL check and run 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],[
|
2007-07-16 18:00:44 +08:00
|
|
|
php_with_[]translit($1,A-Z0-9-,a-z0-9_)=ifelse($4,,no,$4)
|
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
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_REAL_ARG_WITH
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
|
|
|
dnl Internal.
|
|
|
|
dnl
|
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)
|
2010-11-14 06:22:51 +08:00
|
|
|
ifelse($6,yes,[test "$PHP_ENABLE_ALL" && $5=$PHP_ENABLE_ALL])
|
2005-02-25 02:11:36 +08:00
|
|
|
])
|
|
|
|
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]])
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl Sets PHP_ARG_NAME either to the user value or to the default value.
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl default-val defaults to no. This will also set the variable ext_shared, and
|
|
|
|
dnl will overwrite any previous variable of that name. If extension-or-not is
|
|
|
|
dnl yes (default), then do the ENABLE_ALL check and run the PHP_ARG_ANALYZE_EX.
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_ARG_ENABLE],[
|
2007-07-16 18:00:44 +08:00
|
|
|
php_enable_[]translit($1,A-Z0-9-,a-z0-9_)=ifelse($4,,no,$4)
|
|
|
|
PHP_REAL_ARG_ENABLE([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z0-9-,A-Z0-9_),[ifelse($5,,yes,$5)])
|
1999-12-30 10:59:53 +08:00
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_REAL_ARG_ENABLE
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
|
|
|
dnl Internal.
|
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_REAL_ARG_ENABLE],[
|
|
|
|
ifelse([$2],,,[AC_MSG_CHECKING([$2])])
|
|
|
|
AC_ARG_ENABLE($1,[$3],$5=[$]enableval,
|
|
|
|
[
|
|
|
|
$5=ifelse($4,,no,$4)
|
2010-11-14 06:22:51 +08:00
|
|
|
ifelse($6,yes,[test "$PHP_ENABLE_ALL" && $5=$PHP_ENABLE_ALL])
|
2005-02-25 02:11:36 +08:00
|
|
|
])
|
|
|
|
PHP_ARG_ANALYZE($5,[$2],$6)
|
1999-12-30 10:59:53 +08:00
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl ----------------------------------------------------------------------------
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl Build macros
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl ----------------------------------------------------------------------------
|
2005-02-25 02:11:36 +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],[
|
2019-03-22 17:10:01 +08:00
|
|
|
enable_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
|
2011-12-27 21:53:11 +08:00
|
|
|
PHP_ADD_LIBRARY(stdc++)
|
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
|
2019-10-29 23:01:59 +08:00
|
|
|
OVERALL_TARGET=libphp.la
|
2010-11-14 07:13:07 +08:00
|
|
|
php_sapi_module=shared
|
2018-07-29 09:43:45 +08:00
|
|
|
|
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
|
2019-10-29 23:01:59 +08:00
|
|
|
OVERALL_TARGET=libphp.la
|
2010-11-14 07:13:07 +08:00
|
|
|
php_sapi_module=static
|
1999-10-04 23:18:26 +08:00
|
|
|
])
|
|
|
|
|
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
|
2019-10-29 23:01:59 +08:00
|
|
|
OVERALL_TARGET=libs/libphp.bundle
|
2010-11-14 07:13:07 +08:00
|
|
|
php_sapi_module=static
|
2002-03-30 11:17:25 +08:00
|
|
|
])
|
|
|
|
|
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],[
|
2005-05-30 18:56:13 +08:00
|
|
|
php_c_pre='$(LIBTOOL) --mode=compile $(CC)'
|
2002-03-07 22:20:02 +08:00
|
|
|
php_c_meta='$(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS)'
|
2005-05-30 18:56:13 +08:00
|
|
|
php_c_post=
|
|
|
|
php_cxx_pre='$(LIBTOOL) --mode=compile $(CXX)'
|
2002-03-07 22:20:02 +08:00
|
|
|
php_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS)'
|
2005-05-30 18:56:13 +08:00
|
|
|
php_cxx_post=
|
|
|
|
php_lo=lo
|
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
|
|
|
])
|
|
|
|
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2008-02-18 04:50:03 +08:00
|
|
|
dnl PHP_SHARED_MODULE(module-name, object-var, build-dir, cxx, zend_ext)
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Basically sets up the link-stage for building module-name from object_var in
|
|
|
|
dnl 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"
|
2019-02-19 01:01:23 +08:00
|
|
|
suffix=la
|
1999-06-21 02:52:46 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
case $host_alias in
|
2005-07-07 13:54:43 +08:00
|
|
|
*aix*[)]
|
2019-02-19 01:01:23 +08:00
|
|
|
additional_flags="-Wl,-G"
|
2005-02-25 02:11:36 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2008-02-18 04:50:03 +08:00
|
|
|
if test "x$5" = "xyes"; then
|
|
|
|
PHP_ZEND_EX="$PHP_ZEND_EX \$(phplibdir)/$1.$suffix"
|
|
|
|
else
|
|
|
|
PHP_MODULES="$PHP_MODULES \$(phplibdir)/$1.$suffix"
|
|
|
|
fi
|
2005-02-25 02:11:36 +08:00
|
|
|
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)
|
2020-04-28 04:31:54 +08:00
|
|
|
\$(LIBTOOL) --mode=link ifelse($4,,[\$(CC)],[\$(CXX)]) -shared \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) $additional_flags -o [\$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)
|
2005-02-25 02:11:36 +08:00
|
|
|
|
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Selects the SAPI name and type (static, shared, bundle, program) and
|
|
|
|
dnl optionally also the source-files for the SAPI-specific objects.
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_SELECT_SAPI],[
|
2010-11-14 07:13:07 +08:00
|
|
|
if test "$2" = "program"; then
|
|
|
|
PHP_BINARIES="$PHP_BINARIES $1"
|
|
|
|
elif test "$PHP_SAPI" != "none"; then
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
+--------------------------------------------------------------------+
|
|
|
|
| *** ATTENTION *** |
|
|
|
|
| |
|
Clean up some unused code (and fix some comments) in build scripts
- Fix typo in build/php.m4
- Nothing uses HAVE_INTTYPES_H; so remove check for header file
- Nothing defines ZEND_ACCONFIG_H_NO_C_PROTOS; so remove #ifndef
- `format_money` was removed in 2019, so <monetary.h> no longer needed
- Nothing uses HAVE_NETDB_H; so remove check for header file
- Nothing checks HAVE_TERMIOS_H; so remove check for header file
(This was actually added when Wez Furlong was adding the original implementation of
PTY support in `proc_open`, since replaced.)
- Nothing checks HAVE_SYS_AUXV_H; so remove check for header file
- PHP_BUILD_DATE variable is not used for anything, so remove it
This variable was added to the Makefile, but from there, was not used for anything.
The comments suggest it was intended to allow 'reproducible builds'. Presumably,
this means that if a bug is found in a PHP binary somewhere, one could look at the
Makefile which it was built from, see the date, and then could check the same
code version out from source control. But... there can easily be multiple commits
to the repo in the same day. Also, what makes us think that the Makefile which a
binary was built from will be easily available?
Besides, ext/standard/info.c already embeds the build date and time in each binary...
but it does it using `__DATE__` and `__TIME__` (see `php_print_info`).
- Nothing checks HAVE_FINITE; so don't check for function
- Grammar fix to comment in build/php.m4
- Nothing sets $php_ldflags_add_usr_lib variable in configure, so remove conditional
This was added in 2002, when Rasmus was having difficulty building PHP on some
host and needed to have /usr/lib in the rpath. It was never documented and
probably has never been used by anyone else.
2020-05-27 01:56:52 +08:00
|
|
|
| You've configured multiple SAPIs to be built. You can build only |
|
2010-11-14 07:13:07 +08:00
|
|
|
| one SAPI module plus CGI, CLI and FPM binaries at the same time. |
|
|
|
|
+--------------------------------------------------------------------+
|
|
|
|
])
|
|
|
|
else
|
|
|
|
PHP_SAPI=$1
|
2018-07-29 09:43:45 +08:00
|
|
|
fi
|
2010-11-14 07:13:07 +08:00
|
|
|
|
|
|
|
PHP_ADD_BUILD_DIR([sapi/$1])
|
|
|
|
|
|
|
|
PHP_INSTALLED_SAPIS="$PHP_INSTALLED_SAPIS $1"
|
|
|
|
|
|
|
|
ifelse($2,program,[
|
2010-11-17 21:01:53 +08:00
|
|
|
PHP_BUILD_PROGRAM
|
2010-11-14 07:13:07 +08:00
|
|
|
install_binaries="install-binaries"
|
|
|
|
install_binary_targets="$install_binary_targets install-$1"
|
|
|
|
PHP_SUBST(PHP_[]translit($1,a-z0-9-,A-Z0-9_)[]_OBJS)
|
|
|
|
ifelse($3,,,[PHP_ADD_SOURCES_X([sapi/$1],[$3],[$4],PHP_[]translit($1,a-z0-9-,A-Z0-9_)[]_OBJS)])
|
|
|
|
],[
|
2010-11-17 21:01:53 +08:00
|
|
|
case "$2" in
|
|
|
|
static[)] PHP_BUILD_STATIC;;
|
|
|
|
shared[)] PHP_BUILD_SHARED;;
|
|
|
|
bundle[)] PHP_BUILD_BUNDLE;;
|
|
|
|
esac
|
2010-11-14 07:13:07 +08:00
|
|
|
install_sapi="install-sapi"
|
|
|
|
ifelse($3,,,[PHP_ADD_SOURCES([sapi/$1],[$3],[$4],[sapi])])
|
|
|
|
])
|
1999-09-26 17:05:56 +08:00
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_ADD_BUILD_DIR
|
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_ADD_BUILD_DIR],[
|
2005-05-07 10:51:53 +08:00
|
|
|
ifelse($2,,[
|
|
|
|
BUILD_DIR="$BUILD_DIR $1"
|
|
|
|
], [
|
|
|
|
$php_shtool mkdir -p $1
|
|
|
|
])
|
2005-02-25 02:11:36 +08:00
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_GEN_BUILD_DIRS
|
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_GEN_BUILD_DIRS],[
|
|
|
|
$php_shtool mkdir -p $BUILD_DIR
|
|
|
|
])
|
|
|
|
|
1999-06-21 02:52:46 +08:00
|
|
|
dnl
|
2009-05-10 04:26:51 +08:00
|
|
|
dnl PHP_NEW_EXTENSION(extname, sources [, shared [, sapi_class [, extra-cflags [, cxx [, zend_ext]]]]])
|
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
|
2014-11-03 06:25:49 +08:00
|
|
|
dnl "extname" is the name of the extension.
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl "sources" is a list of files relative to the subdir which are used to build
|
|
|
|
dnl the extension.
|
|
|
|
dnl "shared" can be set to "shared" or "yes" to build the extension as a
|
|
|
|
dnl dynamically loadable library. Optional parameter "sapi_class" can be set to
|
|
|
|
dnl "cli" to mark extension build only with CLI or CGI sapi's. "extra-cflags"
|
|
|
|
dnl are passed to the compiler, with @ext_srcdir@ and @ext_builddir@ being
|
|
|
|
dnl substituted.
|
2008-07-21 18:31:37 +08:00
|
|
|
dnl "cxx" can be used to indicate that a C++ shared module is desired.
|
|
|
|
dnl "zend_ext" indicates a zend extension.
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_NEW_EXTENSION],[
|
|
|
|
ext_builddir=[]PHP_EXT_BUILDDIR($1)
|
|
|
|
ext_srcdir=[]PHP_EXT_SRCDIR($1)
|
2014-11-03 06:25:49 +08:00
|
|
|
ext_dir=[]PHP_EXT_DIR($1)
|
2005-02-25 02:11:36 +08:00
|
|
|
|
2005-05-27 21:10:01 +08:00
|
|
|
ifelse($5,,ac_extra=,[ac_extra=`echo "$5"|$SED s#@ext_srcdir@#$ext_srcdir#g|$SED s#@ext_builddir@#$ext_builddir#g`])
|
2005-02-25 02:11:36 +08:00
|
|
|
|
|
|
|
if test "$3" != "shared" && test "$3" != "yes" && test "$4" != "cli"; then
|
|
|
|
dnl ---------------------------------------------- Static module
|
2005-11-30 12:47:24 +08:00
|
|
|
[PHP_]translit($1,a-z_-,A-Z__)[_SHARED]=no
|
2014-11-03 06:25:49 +08:00
|
|
|
PHP_ADD_SOURCES($ext_dir,$2,$ac_extra,)
|
|
|
|
EXT_STATIC="$EXT_STATIC $1;$ext_dir"
|
2005-02-25 02:11:36 +08:00
|
|
|
if test "$3" != "nocli"; then
|
2014-11-03 06:25:49 +08:00
|
|
|
EXT_CLI_STATIC="$EXT_CLI_STATIC $1;$ext_dir"
|
2005-02-25 02:11:36 +08:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
if test "$3" = "shared" || test "$3" = "yes"; then
|
|
|
|
dnl ---------------------------------------------- Shared module
|
2005-11-30 12:47:24 +08:00
|
|
|
[PHP_]translit($1,a-z_-,A-Z__)[_SHARED]=yes
|
2014-11-03 06:25:49 +08:00
|
|
|
PHP_ADD_SOURCES_X($ext_dir,$2,$ac_extra,shared_objects_$1,yes)
|
2016-11-12 18:20:01 +08:00
|
|
|
PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir, $6, $7)
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2005-11-30 12:47:24 +08:00
|
|
|
[PHP_]translit($1,a-z_-,A-Z__)[_SHARED]=no
|
2009-05-10 04:26:51 +08:00
|
|
|
case "$PHP_SAPI" in
|
2018-09-18 20:49:36 +08:00
|
|
|
cgi|embed|phpdbg[)]
|
2014-11-03 06:25:49 +08:00
|
|
|
PHP_ADD_SOURCES($ext_dir,$2,$ac_extra,)
|
|
|
|
EXT_STATIC="$EXT_STATIC $1;$ext_dir"
|
2009-05-10 04:26:51 +08:00
|
|
|
;;
|
|
|
|
*[)]
|
2014-11-03 06:25:49 +08:00
|
|
|
PHP_ADD_SOURCES($ext_dir,$2,$ac_extra,cli)
|
2009-05-10 04:26:51 +08:00
|
|
|
;;
|
|
|
|
esac
|
2014-11-03 06:25:49 +08:00
|
|
|
EXT_CLI_STATIC="$EXT_CLI_STATIC $1;$ext_dir"
|
2005-02-25 02:11:36 +08:00
|
|
|
fi
|
|
|
|
PHP_ADD_BUILD_DIR($ext_builddir)
|
2005-11-22 07:08:02 +08:00
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Set for phpize builds only.
|
2018-07-29 09:43:45 +08:00
|
|
|
dnl ---------------------------
|
2005-11-22 07:08:02 +08:00
|
|
|
if test "$ext_builddir" = "."; then
|
|
|
|
PHP_PECL_EXTENSION=$1
|
|
|
|
PHP_SUBST(PHP_PECL_EXTENSION)
|
|
|
|
fi
|
2005-02-25 02:11:36 +08:00
|
|
|
])
|
|
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Checks whether $withval is "shared" or starts with "shared,XXX" and sets
|
|
|
|
dnl $shared to "yes" or "no", and removes "shared,?" stuff 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
|
2006-02-28 20:26:03 +08:00
|
|
|
dnl This macro is scanned by genif.sh when it builds the internal functions
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl list, so that modules can be init'd in the correct order
|
|
|
|
dnl $1 = name of extension, $2 = extension upon which it depends
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl $3 = optional: if true, it's ok for $2 to have not been configured default
|
|
|
|
dnl is false and should halt the build. To be effective, this macro must be
|
|
|
|
dnl invoked *after* PHP_NEW_EXTENSION. The extension on which it depends must
|
|
|
|
dnl also have been configured. See ADD_EXTENSION_DEP in win32 build.
|
2001-08-03 13:17:18 +08:00
|
|
|
dnl
|
2005-11-30 12:47:24 +08:00
|
|
|
AC_DEFUN([PHP_ADD_EXTENSION_DEP], [
|
|
|
|
am_i_shared=$[PHP_]translit($1,a-z_-,A-Z__)[_SHARED]
|
|
|
|
is_it_shared=$[PHP_]translit($2,a-z_-,A-Z__)[_SHARED]
|
2006-02-28 20:26:03 +08:00
|
|
|
is_it_enabled=$[PHP_]translit($2,a-z_-,A-Z__)
|
2005-11-30 12:47:24 +08:00
|
|
|
if test "$am_i_shared" = "no" && test "$is_it_shared" = "yes" ; then
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
You've configured extension $1 to build statically, but it
|
|
|
|
depends on extension $2, which you've configured to build shared.
|
|
|
|
You either need to build $1 shared or build $2 statically for the
|
|
|
|
build to be successful.
|
|
|
|
])
|
|
|
|
fi
|
2006-02-28 20:26:03 +08:00
|
|
|
if test "x$is_it_enabled" = "xno" && test "x$3" != "xtrue"; then
|
2005-11-30 12:47:24 +08:00
|
|
|
AC_MSG_ERROR([
|
|
|
|
You've configured extension $1, which depends on extension $2,
|
|
|
|
but you've either not enabled $2, or have disabled it.
|
|
|
|
])
|
|
|
|
fi
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Some systems require that we link $2 to $1 when building.
|
2005-11-30 12:47:24 +08:00
|
|
|
])
|
2005-02-25 02:11:36 +08:00
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl ----------------------------------------------------------------------------
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl Checks for structures, typedefs, broken functions, etc.
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl ----------------------------------------------------------------------------
|
2005-02-25 02:11:36 +08:00
|
|
|
|
2007-07-27 06:45:59 +08:00
|
|
|
dnl
|
2007-07-26 06:49:39 +08:00
|
|
|
dnl _PHP_CHECK_SIZEOF(type, cross-value, extra-headers [, found-action [, not-found-action]])
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Internal helper macro.
|
|
|
|
dnl
|
2007-07-26 06:49:39 +08:00
|
|
|
AC_DEFUN([_PHP_CHECK_SIZEOF], [
|
|
|
|
php_cache_value=php_cv_sizeof_[]$1
|
|
|
|
AC_CACHE_VAL(php_cv_sizeof_[]$1, [
|
|
|
|
old_LIBS=$LIBS
|
|
|
|
LIBS=
|
|
|
|
old_LDFLAGS=$LDFLAGS
|
|
|
|
LDFLAGS=
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
|
2007-06-27 22:40:08 +08:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
2007-07-26 06:49:39 +08:00
|
|
|
$3
|
|
|
|
|
2007-06-27 22:40:08 +08:00
|
|
|
int main()
|
|
|
|
{
|
2007-07-26 06:49:39 +08:00
|
|
|
FILE *fp = fopen("conftestval", "w");
|
|
|
|
if (!fp) return(1);
|
|
|
|
fprintf(fp, "%d\n", sizeof($1));
|
|
|
|
return(0);
|
|
|
|
}
|
2018-07-30 07:50:24 +08:00
|
|
|
]])], [
|
2007-07-26 06:49:39 +08:00
|
|
|
eval $php_cache_value=`cat conftestval`
|
|
|
|
], [
|
|
|
|
eval $php_cache_value=0
|
|
|
|
], [
|
|
|
|
ifelse([$2],,[eval $php_cache_value=0], [eval $php_cache_value=$2])
|
|
|
|
])
|
|
|
|
LDFLAGS=$old_LDFLAGS
|
|
|
|
LIBS=$old_LIBS
|
|
|
|
])
|
|
|
|
if eval test "\$$php_cache_value" != "0"; then
|
|
|
|
ifelse([$4],[],:,[$4])
|
|
|
|
ifelse([$5],[],,[else $5])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_CHECK_SIZEOF(type, cross-value, extra-headers)
|
|
|
|
dnl
|
2010-05-06 05:55:44 +08:00
|
|
|
AC_DEFUN([PHP_CHECK_SIZEOF], [
|
2007-07-26 06:49:39 +08:00
|
|
|
AC_MSG_CHECKING([size of $1])
|
|
|
|
_PHP_CHECK_SIZEOF($1, $2, $3, [
|
|
|
|
AC_DEFINE_UNQUOTED([SIZEOF_]translit($1,a-z,A-Z_), [$]php_cv_sizeof_[]$1, [Size of $1])
|
|
|
|
AC_DEFINE_UNQUOTED([HAVE_]translit($1,a-z,A-Z_), 1, [Whether $1 is available])
|
|
|
|
])
|
|
|
|
AC_MSG_RESULT([[$][php_cv_sizeof_]translit($1, ,_)])
|
2007-06-27 22:40:08 +08:00
|
|
|
])
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
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>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Check type of reentrant time-related functions. Type can be: irix, hpux or
|
|
|
|
dnl 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,[
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
2005-02-25 02:11:36 +08:00
|
|
|
#include <time.h>
|
|
|
|
|
2019-09-10 03:29:03 +08:00
|
|
|
int main() {
|
2005-02-25 02:11:36 +08:00
|
|
|
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);
|
|
|
|
}
|
2018-07-30 07:50:24 +08:00
|
|
|
]])],[
|
2005-02-25 02:11:36 +08:00
|
|
|
ac_cv_time_r_type=hpux
|
|
|
|
],[
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
2005-02-25 02:11:36 +08:00
|
|
|
#include <time.h>
|
2019-09-10 03:29:03 +08:00
|
|
|
int main() {
|
2005-02-25 02:11:36 +08:00
|
|
|
struct tm t, *s;
|
|
|
|
time_t old = 0;
|
|
|
|
char buf[27], *p;
|
2018-07-29 09:43:45 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
s = gmtime_r(&old, &t);
|
|
|
|
p = asctime_r(&t, buf, 26);
|
|
|
|
if (p == buf && s == &t) return (0);
|
|
|
|
return (1);
|
|
|
|
}
|
2018-07-30 07:50:24 +08:00
|
|
|
]])],[
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
|
|
|
dnl Internal.
|
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_DOES_PWRITE_WORK],[
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
2005-02-25 02:11:36 +08:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <errno.h>
|
2019-09-10 03:29:03 +08:00
|
|
|
#include <stdlib.h>
|
2005-02-25 02:11:36 +08:00
|
|
|
$1
|
2019-09-10 03:29:03 +08:00
|
|
|
int main() {
|
2005-02-25 02:11:36 +08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2018-07-30 07:50:24 +08:00
|
|
|
]])],[
|
2005-02-25 02:11:36 +08:00
|
|
|
ac_cv_pwrite=yes
|
|
|
|
],[
|
|
|
|
ac_cv_pwrite=no
|
|
|
|
],[
|
|
|
|
ac_cv_pwrite=no
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl PHP_DOES_PREAD_WORK
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
|
|
|
dnl Internal.
|
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_DEFUN([PHP_DOES_PREAD_WORK],[
|
|
|
|
echo test > conftest_in
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
2005-02-25 02:11:36 +08:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <errno.h>
|
2019-09-10 03:29:03 +08:00
|
|
|
#include <stdlib.h>
|
2005-02-25 02:11:36 +08:00
|
|
|
$1
|
2019-09-10 03:29:03 +08:00
|
|
|
int main() {
|
2018-07-29 09:43:45 +08:00
|
|
|
char buf[3];
|
2005-02-25 02:11:36 +08:00
|
|
|
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);
|
|
|
|
}
|
2018-07-30 07:50:24 +08:00
|
|
|
]])],[
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2018-07-29 09:43:45 +08:00
|
|
|
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
|
2018-07-29 09:43:45 +08:00
|
|
|
fi
|
2005-02-25 02:11:36 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_MISSING_TIME_R_DECL
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_MISSING_TIME_R_DECL],[
|
|
|
|
AC_MSG_CHECKING([for missing declarations of reentrant functions])
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm *(*func)() = localtime_r]])],[
|
2005-02-25 02:11:36 +08:00
|
|
|
:
|
|
|
|
],[
|
|
|
|
AC_DEFINE(MISSING_LOCALTIME_R_DECL,1,[Whether localtime_r is declared])
|
|
|
|
])
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm *(*func)() = gmtime_r]])],[
|
2005-02-25 02:11:36 +08:00
|
|
|
:
|
|
|
|
],[
|
|
|
|
AC_DEFINE(MISSING_GMTIME_R_DECL,1,[Whether gmtime_r is declared])
|
|
|
|
])
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[char *(*func)() = asctime_r]])],[
|
2005-02-25 02:11:36 +08:00
|
|
|
:
|
|
|
|
],[
|
|
|
|
AC_DEFINE(MISSING_ASCTIME_R_DECL,1,[Whether asctime_r is declared])
|
|
|
|
])
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[char *(*func)() = ctime_r]])],[
|
2005-02-25 02:11:36 +08:00
|
|
|
:
|
|
|
|
],[
|
|
|
|
AC_DEFINE(MISSING_CTIME_R_DECL,1,[Whether ctime_r is declared])
|
|
|
|
])
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h>]], [[char *(*func)() = strtok_r]])],[
|
2005-02-25 02:11:36 +08:00
|
|
|
:
|
|
|
|
],[
|
|
|
|
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
|
|
|
])
|
|
|
|
|
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,
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
2005-02-25 02:11:36 +08:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
2018-07-30 07:50:24 +08:00
|
|
|
]], [[struct flock x;]])],[
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
|
|
])
|
|
|
|
|
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])
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#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
|
2005-07-14 08:12:26 +08:00
|
|
|
dnl PHP_SOCKADDR_CHECKS
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
2005-07-14 08:12:26 +08:00
|
|
|
AC_DEFUN([PHP_SOCKADDR_CHECKS], [
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Check for struct sockaddr_storage exists.
|
2005-07-14 08:12:26 +08:00
|
|
|
AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_sockaddr_storage,
|
2018-07-30 07:50:24 +08:00
|
|
|
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>]],
|
|
|
|
[[struct sockaddr_storage s; s]])],
|
2005-07-14 08:12:26 +08:00
|
|
|
[ac_cv_sockaddr_storage=yes], [ac_cv_sockaddr_storage=no])
|
|
|
|
])
|
|
|
|
if test "$ac_cv_sockaddr_storage" = "yes"; then
|
|
|
|
AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [Whether you have struct sockaddr_storage])
|
|
|
|
fi
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Check if field sa_len exists in struct sockaddr.
|
1999-09-29 23:17:02 +08:00
|
|
|
AC_CACHE_CHECK([for field sa_len in struct sockaddr],ac_cv_sockaddr_sa_len,[
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>]], [[static struct sockaddr sa; int n = (int) sa.sa_len; return n;]])],
|
2005-07-14 08:12:26 +08:00
|
|
|
[ac_cv_sockaddr_sa_len=yes], [ac_cv_sockaddr_sa_len=no])
|
1999-09-29 23:17:02 +08:00
|
|
|
])
|
2005-07-14 08:12:26 +08:00
|
|
|
if test "$ac_cv_sockaddr_sa_len" = "yes"; then
|
|
|
|
AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Whether struct sockaddr has field sa_len])
|
|
|
|
fi
|
1999-09-29 23:17:02 +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,[
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
2018-07-29 09:43:45 +08:00
|
|
|
int main(void) {
|
|
|
|
return (unsigned char)'A' != (unsigned char)0xC1;
|
|
|
|
}
|
2018-07-30 07:50:24 +08:00
|
|
|
]])],[
|
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
|
2020-04-15 17:51:06 +08:00
|
|
|
AC_MSG_ERROR([PHP does not support EBCDIC targets])
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
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*[)]
|
2005-09-23 17:40:24 +08:00
|
|
|
AC_DEFINE(HAVE_BROKEN_GETCWD,1, [Define if system has broken getcwd])
|
|
|
|
AC_MSG_RESULT([yes]);;
|
|
|
|
*[)]
|
|
|
|
AC_MSG_RESULT([no]);;
|
2003-03-17 21:40:45 +08:00
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
2018-09-11 18:23:20 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_BROKEN_GCC_STRLEN_OPT
|
|
|
|
dnl
|
|
|
|
dnl Early releases of GCC 8 shipped with a strlen() optimization bug, so they
|
|
|
|
dnl didn't properly handle the `char val[1]` struct hack. See bug #76510.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_BROKEN_GCC_STRLEN_OPT], [
|
|
|
|
AC_CACHE_CHECK([for broken gcc optimize-strlen],ac_cv_have_broken_gcc_strlen_opt,[
|
|
|
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
struct s
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char c[1];
|
|
|
|
};
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
struct s *s = malloc(sizeof(struct s) + 3);
|
|
|
|
s->i = 3;
|
|
|
|
strcpy(s->c, "foo");
|
|
|
|
return strlen(s->c+1) == 2;
|
|
|
|
}
|
|
|
|
]])],[
|
|
|
|
ac_cv_have_broken_gcc_strlen_opt=yes
|
|
|
|
],[
|
|
|
|
ac_cv_have_broken_gcc_strlen_opt=no
|
|
|
|
],[
|
|
|
|
ac_cv_have_broken_gcc_strlen_opt=no
|
|
|
|
])])
|
|
|
|
if test "$ac_cv_have_broken_gcc_strlen_opt" = "yes"; then
|
|
|
|
CFLAGS="$CFLAGS -fno-optimize-strlen"
|
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl This comes in two flavors: newer glibcs (since 2.1.2?) have a type called
|
|
|
|
dnl cookie_io_functions_t.
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
2005-02-25 02:11:36 +08:00
|
|
|
#define _GNU_SOURCE
|
|
|
|
#include <stdio.h>
|
2018-07-30 07:50:24 +08:00
|
|
|
]], [[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
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Even newer glibcs have a different seeker definition.
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
2002-08-23 06:28:19 +08:00
|
|
|
#define _GNU_SOURCE
|
|
|
|
#include <stdio.h>
|
2019-09-10 03:29:03 +08:00
|
|
|
#include <stdlib.h>
|
2002-08-23 06:28:19 +08:00
|
|
|
|
|
|
|
struct cookiedata {
|
2020-08-04 21:54:31 +08:00
|
|
|
off64_t pos;
|
2002-08-23 06:28:19 +08:00
|
|
|
};
|
|
|
|
|
2020-08-04 21:54:31 +08:00
|
|
|
ssize_t reader(void *cookie, char *buffer, size_t size)
|
2002-08-23 06:28:19 +08:00
|
|
|
{ return size; }
|
2020-08-04 21:54:31 +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; }
|
2020-08-04 21:54:31 +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};
|
|
|
|
|
2019-09-10 03:29:03 +08:00
|
|
|
int main() {
|
2002-08-23 06:28:19 +08:00
|
|
|
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)
|
2005-09-23 17:40:24 +08:00
|
|
|
exit(0);
|
2002-08-23 06:28:19 +08:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2018-07-30 07:50:24 +08:00
|
|
|
]])], [
|
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
|
|
|
|
])
|
2018-07-29 09:43:45 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
else
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Older glibc versions (up to 2.1.2?) call it _IO_cookie_io_functions_t.
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
2005-02-25 02:11:36 +08:00
|
|
|
#define _GNU_SOURCE
|
|
|
|
#include <stdio.h>
|
2018-07-30 07:50:24 +08:00
|
|
|
]], [[_IO_cookie_io_functions_t cookie;]])], [have_IO_cookie_io_functions_t=yes], [])
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl ----------------------------------------------------------------------------
|
|
|
|
dnl Library/function existence and build sanity checks.
|
|
|
|
dnl ----------------------------------------------------------------------------
|
2005-02-25 02:11:36 +08:00
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_CHECK_LIBRARY(library, function [, action-found [, action-not-found [, extra-libs]]])
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Wrapper for AC_CHECK_LIB.
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CHECK_LIBRARY], [
|
|
|
|
save_old_LDFLAGS=$LDFLAGS
|
|
|
|
ac_stuff="$5"
|
2018-07-29 09:43:45 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl El cheapo wrapper for AC_CHECK_LIB.
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CHECK_FRAMEWORK], [
|
|
|
|
save_old_LDFLAGS=$LDFLAGS
|
|
|
|
LDFLAGS="-framework $1 $LDFLAGS"
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Supplying "c" to AC_CHECK_LIB is technically cheating, but rewriting
|
|
|
|
dnl AC_CHECK_LIB is overkill and this only affects the "checking.." output
|
|
|
|
dnl anyway.
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_CHECK_LIB(c,[$2],[
|
|
|
|
LDFLAGS=$save_old_LDFLAGS
|
|
|
|
$3
|
|
|
|
],[
|
|
|
|
LDFLAGS=$save_old_LDFLAGS
|
|
|
|
$4
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_CHECK_FUNC_LIB(func, libs)
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl This macro checks whether 'func' or '__func' exists in the specified
|
|
|
|
dnl library. Defines HAVE_func and HAVE_library if found and adds the library to
|
|
|
|
dnl LIBS. This should be called in the ACTION-IF-NOT-FOUND part of
|
|
|
|
dnl PHP_CHECK_FUNC.
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl autoconf undefines the builtin "shift" :-(
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl If possible, we use the builtin shift anyway, otherwise we use the ubercool
|
|
|
|
dnl definition that has been tested so far with FreeBSD/GNU m4.
|
|
|
|
dnl
|
2005-02-25 02:11:36 +08:00
|
|
|
ifdef([builtin],[builtin(define, phpshift, [builtin(shift, $@)])],[
|
|
|
|
define([phpshift],[ifelse(index([$@],[,]),-1,,[substr([$@],incr(index([$@],[,])))])])
|
|
|
|
])
|
2019-05-13 00:43:03 +08:00
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_CHECK_FUNC_LIB
|
2005-02-25 02:11:36 +08:00
|
|
|
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"
|
2019-09-10 03:29:03 +08:00
|
|
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return (0); }]])],[found=yes],[found=no],[found=no])
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl This macro checks whether 'func' or '__func' exists in the default libraries
|
|
|
|
dnl and as a fall back in the specified library. Defines HAVE_func and
|
|
|
|
dnl HAVE_library if found and adds the library to LIBS.
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CHECK_FUNC],[
|
|
|
|
unset ac_cv_func_$1
|
|
|
|
unset ac_cv_func___$1
|
|
|
|
unset found
|
2018-07-29 09:43:45 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
AC_CHECK_FUNC($1, [found=yes],[ AC_CHECK_FUNC(__$1,[found=yes],[found=no]) ])
|
|
|
|
|
|
|
|
case $found in
|
2018-07-29 09:43:45 +08:00
|
|
|
yes[)]
|
2005-02-25 02:11:36 +08:00
|
|
|
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"
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
2005-02-25 02:11:36 +08:00
|
|
|
$5
|
|
|
|
char $1();
|
|
|
|
int main() {
|
|
|
|
$1();
|
|
|
|
return 0;
|
|
|
|
}
|
2018-07-30 07:50:24 +08:00
|
|
|
]])],[
|
2005-02-25 02:11:36 +08:00
|
|
|
LIBS=$old_LIBS
|
|
|
|
$2
|
|
|
|
],[
|
|
|
|
LIBS=$old_LIBS
|
|
|
|
$3
|
|
|
|
],[
|
|
|
|
LIBS=$old_LIBS
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl ----------------------------------------------------------------------------
|
|
|
|
dnl Platform characteristics checks.
|
|
|
|
dnl ----------------------------------------------------------------------------
|
2005-02-25 02:11:36 +08:00
|
|
|
|
2006-04-09 01:53:11 +08:00
|
|
|
dnl
|
2006-04-10 20:17:36 +08:00
|
|
|
dnl PHP_SHLIB_SUFFIX_NAMES
|
2006-04-09 01:53:11 +08:00
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Determines link library suffix SHLIB_SUFFIX_NAME which can be: .so, .sl or
|
|
|
|
dnl .dylib
|
2006-04-10 20:16:17 +08:00
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Determines shared library suffix SHLIB_DL_SUFFIX_NAME suffix can be: .so or
|
|
|
|
dnl .sl
|
2006-04-09 01:53:11 +08:00
|
|
|
dnl
|
2006-04-10 20:17:36 +08:00
|
|
|
AC_DEFUN([PHP_SHLIB_SUFFIX_NAMES],[
|
2006-04-09 01:53:11 +08:00
|
|
|
AC_REQUIRE([PHP_CANONICAL_HOST_TARGET])dnl
|
2006-04-10 20:16:17 +08:00
|
|
|
PHP_SUBST_OLD(SHLIB_SUFFIX_NAME)
|
|
|
|
PHP_SUBST_OLD(SHLIB_DL_SUFFIX_NAME)
|
|
|
|
SHLIB_SUFFIX_NAME=so
|
2006-04-09 01:53:11 +08:00
|
|
|
SHLIB_DL_SUFFIX_NAME=$SHLIB_SUFFIX_NAME
|
|
|
|
case $host_alias in
|
|
|
|
*hpux*[)]
|
2006-04-10 20:16:17 +08:00
|
|
|
SHLIB_SUFFIX_NAME=sl
|
2006-04-09 01:53:11 +08:00
|
|
|
SHLIB_DL_SUFFIX_NAME=sl
|
|
|
|
;;
|
|
|
|
*darwin*[)]
|
2006-04-10 20:16:17 +08:00
|
|
|
SHLIB_SUFFIX_NAME=dylib
|
2006-04-09 01:53:11 +08:00
|
|
|
SHLIB_DL_SUFFIX_NAME=so
|
|
|
|
;;
|
|
|
|
esac
|
2005-02-25 02:11:36 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_C_BIGENDIAN
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Replacement macro for AC_C_BIGENDIAN.
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
2005-02-25 02:11:36 +08:00
|
|
|
int main(void)
|
|
|
|
{
|
2005-09-23 17:40:24 +08:00
|
|
|
short one = 1;
|
|
|
|
char *cp = (char *)&one;
|
|
|
|
|
|
|
|
if (*cp == 0) {
|
|
|
|
return(0);
|
|
|
|
} else {
|
|
|
|
return(1);
|
|
|
|
}
|
2005-02-25 02:11:36 +08:00
|
|
|
}
|
2018-07-30 07:50:24 +08:00
|
|
|
]])], [ac_cv_c_bigendian_php=yes], [ac_cv_c_bigendian_php=no], [ac_cv_c_bigendian_php=unknown])
|
2005-02-25 02:11:36 +08:00
|
|
|
])
|
|
|
|
if test $ac_cv_c_bigendian_php = yes; then
|
|
|
|
AC_DEFINE(WORDS_BIGENDIAN, [], [Define if processor uses big-endian word])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl ----------------------------------------------------------------------------
|
|
|
|
dnl Checks for programs: PHP_PROG_<program>.
|
|
|
|
dnl ----------------------------------------------------------------------------
|
2005-02-25 02:11:36 +08:00
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_PROG_SENDMAIL
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Search for the sendmail binary.
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_PROG_SENDMAIL], [
|
|
|
|
PHP_ALT_PATH=/usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib
|
2020-05-09 08:08:14 +08:00
|
|
|
AC_PATH_PROG(PROG_SENDMAIL, sendmail, /usr/sbin/sendmail, $PATH:$PHP_ALT_PATH)
|
2005-02-25 02:11:36 +08:00
|
|
|
PHP_SUBST(PROG_SENDMAIL)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_PROG_AWK
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Some vendors force mawk before gawk; mawk is broken so we don't like that.
|
2005-02-25 02:11:36 +08:00
|
|
|
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])
|
|
|
|
;;
|
2018-07-29 09:43:45 +08:00
|
|
|
*gawk)
|
2005-02-25 02:11:36 +08:00
|
|
|
;;
|
2018-07-29 09:43:45 +08:00
|
|
|
bork)
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
2019-03-17 23:22:02 +08:00
|
|
|
dnl PHP_PROG_BISON([MIN-VERSION], [EXCLUDED-VERSION...])
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
2019-03-17 23:22:02 +08:00
|
|
|
dnl Search for bison and optionally check if version is at least the minimum
|
|
|
|
dnl required version MIN-VERSION and doesn't match any of the blank separated
|
|
|
|
dnl list of excluded versions EXCLUDED-VERSION (for example "3.0 3.2").
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_PROG_BISON], [
|
2019-03-17 00:22:44 +08:00
|
|
|
AC_CHECK_PROG(YACC, bison, bison)
|
2019-03-17 23:22:02 +08:00
|
|
|
|
|
|
|
ifelse($1,,php_bison_required_version='',php_bison_required_version="$1")
|
|
|
|
ifelse($2,,php_bison_excluded_versions='none',php_bison_excluded_versions="$2")
|
|
|
|
|
|
|
|
if test -n "$YACC"; then
|
|
|
|
AC_MSG_CHECKING([for bison version])
|
|
|
|
|
|
|
|
php_bison_version=$($YACC --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | tr -d a-z)
|
2020-07-13 15:40:19 +08:00
|
|
|
if test -z "$php_bison_version"; then
|
|
|
|
php_bison_version=0.0.0
|
|
|
|
fi
|
2019-03-17 23:22:02 +08:00
|
|
|
ac_IFS=$IFS; IFS="."
|
|
|
|
set $php_bison_version
|
|
|
|
IFS=$ac_IFS
|
|
|
|
php_bison_num=`expr [$]{1:-0} \* 10000 + [$]{2:-0} \* 100 + [$]{3:-0}`
|
|
|
|
php_bison_branch="[$]1.[$]2"
|
|
|
|
php_bison_check=ok
|
|
|
|
|
|
|
|
if test -z "$php_bison_required_version" && test -z "$php_bison_num"; then
|
|
|
|
php_bison_check=invalid
|
|
|
|
elif test -n "$php_bison_required_version"; then
|
|
|
|
ac_IFS=$IFS; IFS="."
|
|
|
|
set $php_bison_required_version
|
|
|
|
IFS=$ac_IFS
|
|
|
|
php_bison_required_num=`expr [$]{1:-0} \* 10000 + [$]{2:-0} \* 100 + [$]{3:-0}`
|
|
|
|
php_bison_required_version="$php_bison_required_version or later"
|
|
|
|
|
|
|
|
if test -z "$php_bison_num" || test "$php_bison_num" -lt "$php_bison_required_num"; then
|
|
|
|
php_bison_check=invalid
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
for php_bison_check_version in $php_bison_excluded_versions; do
|
|
|
|
if test "$php_bison_version" = "$php_bison_check_version" || test "$php_bison_branch" = "$php_bison_check_version"; then
|
|
|
|
php_bison_check=invalid
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if test "$php_bison_check" != "invalid"; then
|
2020-02-01 14:03:13 +08:00
|
|
|
PHP_SUBST_OLD([YFLAGS], [-Wall])
|
2019-03-17 23:22:02 +08:00
|
|
|
AC_MSG_RESULT([$php_bison_version (ok)])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([$php_bison_version])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
case $php_bison_check in
|
|
|
|
""|invalid[)]
|
2019-06-23 21:53:19 +08:00
|
|
|
if test ! -f "$abs_srcdir/Zend/zend_language_parser.h" || test ! -f "$abs_srcdir/Zend/zend_language_parser.c"; then
|
2019-03-17 23:22:02 +08:00
|
|
|
AC_MSG_ERROR([bison $php_bison_required_version is required to generate PHP parsers (excluded versions: $php_bison_excluded_versions).])
|
|
|
|
fi
|
|
|
|
|
|
|
|
YACC="exit 0;"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
PHP_SUBST(YACC)
|
|
|
|
])
|
2001-09-05 21:18:09 +08:00
|
|
|
|
2002-08-07 00:01:34 +08:00
|
|
|
dnl
|
2019-03-17 23:22:02 +08:00
|
|
|
dnl PHP_PROG_RE2C([MIN-VERSION])
|
2002-08-07 00:01:34 +08:00
|
|
|
dnl
|
2019-03-17 23:22:02 +08:00
|
|
|
dnl Search for the re2c and optionally check if version is at least the minimum
|
|
|
|
dnl required version MIN-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)
|
2019-03-17 23:22:02 +08:00
|
|
|
|
|
|
|
ifelse($1,,php_re2c_required_version='',php_re2c_required_version="$1")
|
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
if test -n "$RE2C"; then
|
2019-03-17 23:22:02 +08:00
|
|
|
AC_MSG_CHECKING([for re2c version])
|
|
|
|
|
|
|
|
php_re2c_version=$($RE2C --version | cut -d ' ' -f 2 2>/dev/null)
|
2020-07-13 15:40:19 +08:00
|
|
|
if test -z "$php_re2c_version"; then
|
|
|
|
php_re2c_version=0.0.0
|
|
|
|
fi
|
2019-03-17 23:22:02 +08:00
|
|
|
ac_IFS=$IFS; IFS="."
|
|
|
|
set $php_re2c_version
|
|
|
|
IFS=$ac_IFS
|
|
|
|
php_re2c_num=`expr [$]{1:-0} \* 10000 + [$]{2:-0} \* 100 + [$]{3:-0}`
|
|
|
|
php_re2c_check=ok
|
|
|
|
|
|
|
|
if test -z "$php_re2c_required_version" && test -z "$php_re2c_num"; then
|
|
|
|
php_re2c_check=invalid
|
|
|
|
elif test -n "$php_re2c_required_version"; then
|
|
|
|
ac_IFS=$IFS; IFS="."
|
|
|
|
set $php_re2c_required_version
|
|
|
|
IFS=$ac_IFS
|
|
|
|
php_re2c_required_num=`expr [$]{1:-0} \* 10000 + [$]{2:-0} \* 100 + [$]{3:-0}`
|
|
|
|
php_re2c_required_version="$php_re2c_required_version or later"
|
|
|
|
|
|
|
|
if test -z "$php_re2c_num" || test "$php_re2c_num" -lt "$php_re2c_required_num"; then
|
|
|
|
php_re2c_check=invalid
|
2018-07-29 09:43:45 +08:00
|
|
|
fi
|
2019-03-17 23:22:02 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$php_re2c_check" != "invalid"; then
|
|
|
|
AC_MSG_RESULT([$php_re2c_version (ok)])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([$php_re2c_version])
|
|
|
|
fi
|
2005-02-25 02:11:36 +08:00
|
|
|
fi
|
2019-03-17 23:22:02 +08:00
|
|
|
|
|
|
|
case $php_re2c_check in
|
2005-02-27 20:42:28 +08:00
|
|
|
""|invalid[)]
|
2019-06-23 21:53:19 +08:00
|
|
|
if test ! -f "$abs_srcdir/Zend/zend_language_scanner.c"; then
|
2019-03-17 23:22:02 +08:00
|
|
|
AC_MSG_ERROR([re2c $php_re2c_required_version is required to generate PHP lexers.])
|
2018-12-02 04:36:40 +08:00
|
|
|
fi
|
2018-11-23 07:40:34 +08:00
|
|
|
|
2005-02-27 20:42:28 +08:00
|
|
|
RE2C="exit 0;"
|
|
|
|
;;
|
|
|
|
esac
|
2019-03-17 23:22:02 +08:00
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
PHP_SUBST(RE2C)
|
2002-08-07 00:01:34 +08:00
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl ----------------------------------------------------------------------------
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl Common setup macros: PHP_SETUP_<what>
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl ----------------------------------------------------------------------------
|
2005-02-25 02:11:36 +08:00
|
|
|
|
2007-07-27 06:45:59 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_SETUP_ICU([shared-add])
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Common setup macro for ICU.
|
2007-07-27 06:45:59 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_SETUP_ICU],[
|
2019-02-07 18:00:51 +08:00
|
|
|
PKG_CHECK_MODULES([ICU], [icu-uc >= 50.1 icu-io icu-i18n])
|
2007-07-27 06:45:59 +08:00
|
|
|
|
2018-12-05 20:27:30 +08:00
|
|
|
PHP_EVAL_INCLINE($ICU_CFLAGS)
|
|
|
|
PHP_EVAL_LIBLINE($ICU_LIBS, $1)
|
2007-07-27 06:45:59 +08:00
|
|
|
|
2018-12-05 20:27:30 +08:00
|
|
|
ICU_CFLAGS="$ICU_CFLAGS -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1"
|
|
|
|
ICU_CXXFLAGS="$ICU_CXXFLAGS -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit"
|
2007-07-27 06:45:59 +08:00
|
|
|
|
2018-12-05 20:27:30 +08:00
|
|
|
if test "$PKG_CONFIG icu-io --atleast-version=60"; then
|
|
|
|
ICU_CFLAGS="$ICU_CFLAGS -DU_HIDE_OBSOLETE_UTF_OLD_H=1"
|
2007-07-27 06:45:59 +08:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2018-07-29 09:43:45 +08:00
|
|
|
dnl
|
2003-06-24 22:05:26 +08:00
|
|
|
dnl PHP_SETUP_OPENSSL(shared-add [, action-found [, action-not-found]])
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Common setup macro for openssl.
|
2003-06-24 22:05:26 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_SETUP_OPENSSL],[
|
|
|
|
found_openssl=no
|
|
|
|
|
2020-01-17 18:22:32 +08:00
|
|
|
PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.0.1], [found_openssl=yes])
|
2003-06-24 22:05:26 +08:00
|
|
|
|
2004-12-30 22:50:06 +08:00
|
|
|
if test "$found_openssl" = "yes"; then
|
2018-11-08 03:24:23 +08:00
|
|
|
PHP_EVAL_LIBLINE($OPENSSL_LIBS, $1)
|
|
|
|
PHP_EVAL_INCLINE($OPENSSL_CFLAGS)
|
2003-10-03 12:29:13 +08:00
|
|
|
ifelse([$2],[],:,[$2])
|
2003-06-24 22:05:26 +08:00
|
|
|
ifelse([$3],[],,[else $3])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2018-07-29 09:43:45 +08:00
|
|
|
dnl
|
2002-03-18 05:09:21 +08:00
|
|
|
dnl PHP_SETUP_ICONV(shared-add [, action-found [, action-not-found]])
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Common setup macro for iconv.
|
2002-03-18 05:09:21 +08:00
|
|
|
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
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Check libc first if no path is provided in --with-iconv.
|
2002-03-22 04:22:05 +08:00
|
|
|
if test "$PHP_ICONV" = "yes"; then
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Reset LIBS temporarily as it may have already been included -liconv in.
|
2012-04-03 00:32:42 +08:00
|
|
|
LIBS_save="$LIBS"
|
|
|
|
LIBS=
|
2002-03-22 04:22:05 +08:00
|
|
|
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,[
|
2005-04-08 04:39:02 +08:00
|
|
|
AC_DEFINE(HAVE_LIBICONV, 1, [ ])
|
2002-03-22 04:22:05 +08:00
|
|
|
found_iconv=yes
|
|
|
|
])
|
|
|
|
])
|
2012-04-03 00:32:42 +08:00
|
|
|
LIBS="$LIBS_save"
|
2002-03-22 04:22:05 +08:00
|
|
|
fi
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Check external libs for iconv funcs.
|
2002-03-22 04:22:05 +08:00
|
|
|
if test "$found_iconv" = "no"; then
|
2002-03-18 05:09:21 +08:00
|
|
|
|
|
|
|
for i in $PHP_ICONV /usr/local /usr; do
|
2020-08-07 22:05:24 +08:00
|
|
|
if test -r $i/include/iconv.h; then
|
2002-03-20 20:08:30 +08:00
|
|
|
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
|
2018-07-29 09:43:45 +08:00
|
|
|
|
2004-11-03 22:07:09 +08:00
|
|
|
if test -f $ICONV_DIR/$PHP_LIBDIR/lib$iconv_lib_name.a ||
|
2019-04-09 08:42:11 +08:00
|
|
|
test -f $ICONV_DIR/$PHP_LIBDIR/lib$iconv_lib_name.$SHLIB_SUFFIX_NAME ||
|
|
|
|
test -f $ICONV_DIR/$PHP_LIBDIR/lib$iconv_lib_name.tbd
|
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
|
2005-04-08 04:39:02 +08:00
|
|
|
AC_DEFINE(HAVE_LIBICONV,1,[ ])
|
2010-03-08 23:51:08 +08:00
|
|
|
AC_DEFINE([ICONV_ALIASED_LIBICONV],1,[iconv() is aliased to libiconv() in -liconv])
|
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
|
|
|
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
|
|
|
|
2018-07-29 09:43:45 +08:00
|
|
|
dnl
|
2003-05-19 23:33:19 +08:00
|
|
|
dnl PHP_SETUP_LIBXML(shared-add [, action-found [, action-not-found]])
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Common setup macro for libxml.
|
2003-05-19 23:33:19 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_SETUP_LIBXML], [
|
2020-07-16 20:19:40 +08:00
|
|
|
PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.9.0])
|
2003-05-19 23:33:19 +08:00
|
|
|
|
2019-04-17 19:07:15 +08:00
|
|
|
PHP_EVAL_INCLINE($LIBXML_CFLAGS)
|
|
|
|
PHP_EVAL_LIBLINE($LIBXML_LIBS, $1)
|
2018-02-07 03:16:22 +08:00
|
|
|
|
2019-04-17 19:07:15 +08:00
|
|
|
AC_DEFINE(HAVE_LIBXML, 1, [ ])
|
2018-02-07 03:16:22 +08:00
|
|
|
|
2019-04-17 19:07:15 +08:00
|
|
|
$2
|
2003-05-19 23:33:19 +08:00
|
|
|
])
|
|
|
|
|
2019-05-29 21:09:43 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_SETUP_EXPAT([shared-add])
|
|
|
|
dnl
|
|
|
|
dnl Common setup macro for expat.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_SETUP_EXPAT], [
|
|
|
|
PKG_CHECK_MODULES([EXPAT], [expat])
|
|
|
|
|
|
|
|
PHP_EVAL_INCLINE($EXPAT_CFLAGS)
|
|
|
|
PHP_EVAL_LIBLINE($EXPAT_LIBS, $1)
|
|
|
|
|
|
|
|
AC_DEFINE(HAVE_LIBEXPAT, 1, [ ])
|
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl ----------------------------------------------------------------------------
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl Misc. macros
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl ----------------------------------------------------------------------------
|
2002-07-26 02:37:16 +08:00
|
|
|
|
2018-07-29 09:43:45 +08:00
|
|
|
dnl
|
2005-05-07 10:51:53 +08:00
|
|
|
dnl PHP_INSTALL_HEADERS(path [, file ...])
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl PHP header files to be installed.
|
2005-05-07 10:51:53 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_INSTALL_HEADERS],[
|
2005-07-08 07:18:22 +08:00
|
|
|
ifelse([$2],[],[
|
|
|
|
for header_file in $1; do
|
2005-05-07 10:51:53 +08:00
|
|
|
PHP_RUN_ONCE(INSTALLHEADERS, $header_file, [
|
2005-11-22 07:08:02 +08:00
|
|
|
INSTALL_HEADERS="$INSTALL_HEADERS $header_file"
|
2005-05-07 10:51:53 +08:00
|
|
|
])
|
2018-07-29 09:43:45 +08:00
|
|
|
done
|
2005-07-08 07:18:22 +08:00
|
|
|
], [
|
2005-05-07 10:51:53 +08:00
|
|
|
header_path=$1
|
2005-07-08 07:18:22 +08:00
|
|
|
for header_file in $2; do
|
2005-05-07 10:51:53 +08:00
|
|
|
hp_hf="$header_path/$header_file"
|
|
|
|
PHP_RUN_ONCE(INSTALLHEADERS, $hp_hf, [
|
2005-11-22 07:08:02 +08:00
|
|
|
INSTALL_HEADERS="$INSTALL_HEADERS $hp_hf"
|
2005-05-07 10:51:53 +08:00
|
|
|
])
|
2018-07-29 09:43:45 +08:00
|
|
|
done
|
2005-07-08 07:18:22 +08:00
|
|
|
])
|
2005-05-07 10:51:53 +08:00
|
|
|
])
|
|
|
|
|
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
|
2019-07-07 12:25:58 +08:00
|
|
|
dnl This macro is used to get a comparable version for Apache.
|
2002-07-26 02:37:16 +08:00
|
|
|
dnl
|
2002-10-24 18:41:36 +08:00
|
|
|
AC_DEFUN([PHP_AP_EXTRACT_VERSION],[
|
2011-03-24 02:56:47 +08:00
|
|
|
ac_output=`$1 -v 2>&1 | grep version | $SED -e 's/Oracle-HTTP-//'`
|
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
|
|
|
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_CONFIG_NICE(filename)
|
|
|
|
dnl
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl This macro creates script file with given filename which includes the last
|
|
|
|
dnl configure command run by user. This file is named 'config.nice' in PHP.
|
2005-02-25 02:11:36 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CONFIG_NICE],[
|
2005-05-27 21:10:01 +08:00
|
|
|
AC_REQUIRE([AC_PROG_EGREP])
|
2018-12-02 05:03:31 +08:00
|
|
|
AC_REQUIRE([AC_PROG_SED])
|
2007-06-29 09:10:35 +08:00
|
|
|
PHP_SUBST_OLD(EGREP)
|
|
|
|
PHP_SUBST_OLD(SED)
|
2005-02-25 02:11:36 +08:00
|
|
|
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
|
|
|
|
2016-11-20 16:32:26 +08:00
|
|
|
clean_configure_args=$ac_configure_args
|
2007-01-02 04:10:01 +08:00
|
|
|
for var in CFLAGS CXXFLAGS CPPFLAGS LDFLAGS EXTRA_LDFLAGS_PROGRAM LIBS CC CXX; do
|
2005-02-25 02:11:36 +08:00
|
|
|
eval val=\$$var
|
|
|
|
if test -n "$val"; then
|
|
|
|
echo "$var='$val' \\" >> $1
|
2016-11-20 16:32:26 +08:00
|
|
|
if test `expr "X$ac_configure_args" : ".*${var}.*"` != 0; then
|
|
|
|
clean_configure_args=$(echo $clean_configure_args | sed -e "s#'$var=$val'##")
|
|
|
|
fi
|
2005-02-25 02:11:36 +08:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2006-10-03 03:17:53 +08:00
|
|
|
echo "'[$]0' \\" >> $1
|
2017-06-15 08:30:39 +08:00
|
|
|
if test `expr " [$]0" : " '.*"` = 0; then
|
2006-10-03 04:49:23 +08:00
|
|
|
CONFIGURE_COMMAND="$CONFIGURE_COMMAND '[$]0'"
|
2018-07-29 09:43:45 +08:00
|
|
|
else
|
2006-10-03 04:49:23 +08:00
|
|
|
CONFIGURE_COMMAND="$CONFIGURE_COMMAND [$]0"
|
|
|
|
fi
|
2016-11-20 16:32:26 +08:00
|
|
|
CONFIGURE_ARGS="$clean_configure_args"
|
2015-10-08 17:16:22 +08:00
|
|
|
while test "X$CONFIGURE_ARGS" != "X";
|
|
|
|
do
|
|
|
|
if CURRENT_ARG=`expr "X$CONFIGURE_ARGS" : "X *\('[[^']]*'\)"`
|
|
|
|
then
|
|
|
|
CONFIGURE_ARGS=`expr "X$CONFIGURE_ARGS" : "X *'[[^']]*' \(.*\)"`
|
|
|
|
elif CURRENT_ARG=`expr "X$CONFIGURE_ARGS" : "X *\([[^ ]]*\)"`
|
|
|
|
then
|
|
|
|
CONFIGURE_ARGS=`expr "X$CONFIGURE_ARGS" : "X *[[^ ]]* \(.*\)"`
|
|
|
|
CURRENT_ARG="'$CURRENT_ARG'"
|
|
|
|
else
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
$as_echo "$CURRENT_ARG \\" >>$1
|
|
|
|
CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS $CURRENT_ARG"
|
2005-02-25 02:11:36 +08:00
|
|
|
done
|
|
|
|
echo '"[$]@"' >> $1
|
|
|
|
chmod +x $1
|
2007-06-29 09:10:35 +08:00
|
|
|
CONFIGURE_COMMAND="$CONFIGURE_COMMAND $CONFIGURE_OPTIONS"
|
2005-04-30 09:52:22 +08:00
|
|
|
PHP_SUBST_OLD(CONFIGURE_COMMAND)
|
2007-06-29 09:10:35 +08:00
|
|
|
PHP_SUBST_OLD(CONFIGURE_OPTIONS)
|
2004-09-12 14:35:51 +08:00
|
|
|
])
|
2004-12-21 04:37:45 +08:00
|
|
|
|
2005-06-14 08:00:53 +08:00
|
|
|
dnl
|
2005-06-14 09:43:53 +08:00
|
|
|
dnl PHP_CHECK_PDO_INCLUDES([found [, not-found]])
|
2005-06-14 08:00:53 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CHECK_PDO_INCLUDES],[
|
2011-05-15 13:24:34 +08:00
|
|
|
AC_CACHE_CHECK([for PDO includes], pdo_cv_inc_path, [
|
2005-06-14 08:00:53 +08:00
|
|
|
if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
|
2011-05-15 13:24:34 +08:00
|
|
|
pdo_cv_inc_path=$abs_srcdir/ext
|
2005-06-14 08:00:53 +08:00
|
|
|
elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
|
2011-05-15 13:24:34 +08:00
|
|
|
pdo_cv_inc_path=$abs_srcdir/ext
|
2015-02-06 19:06:29 +08:00
|
|
|
elif test -f $phpincludedir/ext/pdo/php_pdo_driver.h; then
|
|
|
|
pdo_cv_inc_path=$phpincludedir/ext
|
2005-06-14 08:00:53 +08:00
|
|
|
fi
|
|
|
|
])
|
2011-05-15 13:24:34 +08:00
|
|
|
if test -n "$pdo_cv_inc_path"; then
|
2005-06-14 09:43:53 +08:00
|
|
|
ifelse([$1],[],:,[$1])
|
|
|
|
else
|
|
|
|
ifelse([$2],[],[AC_MSG_ERROR([Cannot find php_pdo_driver.h.])],[$2])
|
|
|
|
fi
|
2005-06-14 08:00:53 +08:00
|
|
|
])
|
2006-12-05 02:28:49 +08:00
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_DETECT_ICC
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
|
|
|
dnl Detect Intel C++ Compiler and unset $GCC if ICC found.
|
|
|
|
dnl
|
2006-12-05 02:28:49 +08:00
|
|
|
AC_DEFUN([PHP_DETECT_ICC],
|
|
|
|
[
|
|
|
|
ICC="no"
|
|
|
|
AC_MSG_CHECKING([for icc])
|
|
|
|
AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
|
|
|
|
ICC="no"
|
|
|
|
AC_MSG_RESULT([no]),
|
|
|
|
ICC="yes"
|
2008-07-24 22:17:54 +08:00
|
|
|
GCC="no"
|
2006-12-05 02:28:49 +08:00
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
)
|
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2008-11-07 04:42:11 +08:00
|
|
|
dnl PHP_DETECT_SUNCC
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
|
|
|
dnl Detect if the systems default compiler is suncc. We also set some useful
|
|
|
|
dnl CFLAGS if the user didn't set any.
|
|
|
|
dnl
|
2008-11-07 04:42:11 +08:00
|
|
|
AC_DEFUN([PHP_DETECT_SUNCC],[
|
|
|
|
SUNCC="no"
|
|
|
|
AC_MSG_CHECKING([for suncc])
|
|
|
|
AC_EGREP_CPP([^__SUNPRO_C], [__SUNPRO_C],
|
|
|
|
SUNCC="no"
|
|
|
|
AC_MSG_RESULT([no]),
|
|
|
|
SUNCC="yes"
|
2008-12-04 03:53:45 +08:00
|
|
|
GCC="no"
|
2009-08-12 07:45:35 +08:00
|
|
|
test -n "$auto_cflags" && CFLAGS="-O -xs -xstrconst -zlazyload"
|
2008-11-07 04:42:11 +08:00
|
|
|
GCC=""
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
)
|
|
|
|
])
|
|
|
|
|
2006-12-12 15:38:04 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_CRYPT_R_STYLE
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
Clean up some unused code (and fix some comments) in build scripts
- Fix typo in build/php.m4
- Nothing uses HAVE_INTTYPES_H; so remove check for header file
- Nothing defines ZEND_ACCONFIG_H_NO_C_PROTOS; so remove #ifndef
- `format_money` was removed in 2019, so <monetary.h> no longer needed
- Nothing uses HAVE_NETDB_H; so remove check for header file
- Nothing checks HAVE_TERMIOS_H; so remove check for header file
(This was actually added when Wez Furlong was adding the original implementation of
PTY support in `proc_open`, since replaced.)
- Nothing checks HAVE_SYS_AUXV_H; so remove check for header file
- PHP_BUILD_DATE variable is not used for anything, so remove it
This variable was added to the Makefile, but from there, was not used for anything.
The comments suggest it was intended to allow 'reproducible builds'. Presumably,
this means that if a bug is found in a PHP binary somewhere, one could look at the
Makefile which it was built from, see the date, and then could check the same
code version out from source control. But... there can easily be multiple commits
to the repo in the same day. Also, what makes us think that the Makefile which a
binary was built from will be easily available?
Besides, ext/standard/info.c already embeds the build date and time in each binary...
but it does it using `__DATE__` and `__TIME__` (see `php_print_info`).
- Nothing checks HAVE_FINITE; so don't check for function
- Grammar fix to comment in build/php.m4
- Nothing sets $php_ldflags_add_usr_lib variable in configure, so remove conditional
This was added in 2002, when Rasmus was having difficulty building PHP on some
host and needed to have /usr/lib in the rpath. It was never documented and
probably has never been used by anyone else.
2020-05-27 01:56:52 +08:00
|
|
|
dnl Detect the style of crypt_r() if any is available.
|
|
|
|
dnl See APR_CHECK_CRYPT_R_STYLE() for original version.
|
2006-12-12 15:38:04 +08:00
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CRYPT_R_STYLE],
|
|
|
|
[
|
|
|
|
AC_CACHE_CHECK([which data struct is used by crypt_r], php_cv_crypt_r_style,[
|
|
|
|
php_cv_crypt_r_style=none
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
2006-12-12 20:06:37 +08:00
|
|
|
#define _REENTRANT 1
|
2006-12-12 15:38:04 +08:00
|
|
|
#include <crypt.h>
|
2018-07-30 07:50:24 +08:00
|
|
|
]], [[
|
2006-12-12 15:38:04 +08:00
|
|
|
CRYPTD buffer;
|
|
|
|
crypt_r("passwd", "hash", &buffer);
|
2018-07-30 07:50:24 +08:00
|
|
|
]])],[php_cv_crypt_r_style=cryptd],[])
|
2006-12-12 15:38:04 +08:00
|
|
|
|
|
|
|
if test "$php_cv_crypt_r_style" = "none"; then
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
2006-12-12 20:06:37 +08:00
|
|
|
#define _REENTRANT 1
|
2006-12-12 15:38:04 +08:00
|
|
|
#include <crypt.h>
|
2018-07-30 07:50:24 +08:00
|
|
|
]],[[
|
2006-12-12 15:38:04 +08:00
|
|
|
struct crypt_data buffer;
|
|
|
|
crypt_r("passwd", "hash", &buffer);
|
2018-07-30 07:50:24 +08:00
|
|
|
]])],[php_cv_crypt_r_style=struct_crypt_data],[])
|
2006-12-12 15:38:04 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$php_cv_crypt_r_style" = "none"; then
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
2006-12-12 20:06:37 +08:00
|
|
|
#define _REENTRANT 1
|
2006-12-12 15:38:04 +08:00
|
|
|
#define _GNU_SOURCE
|
|
|
|
#include <crypt.h>
|
2018-07-30 07:50:24 +08:00
|
|
|
]],[[
|
2006-12-12 15:38:04 +08:00
|
|
|
struct crypt_data buffer;
|
|
|
|
crypt_r("passwd", "hash", &buffer);
|
2018-07-30 07:50:24 +08:00
|
|
|
]])],[php_cv_crypt_r_style=struct_crypt_data_gnu_source],[])
|
2006-12-12 15:38:04 +08:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
if test "$php_cv_crypt_r_style" = "cryptd"; then
|
|
|
|
AC_DEFINE(CRYPT_R_CRYPTD, 1, [Define if crypt_r has uses CRYPTD])
|
|
|
|
fi
|
|
|
|
if test "$php_cv_crypt_r_style" = "struct_crypt_data" -o "$php_cv_crypt_r_style" = "struct_crypt_data_gnu_source"; then
|
|
|
|
AC_DEFINE(CRYPT_R_STRUCT_CRYPT_DATA, 1, [Define if crypt_r uses struct crypt_data])
|
|
|
|
fi
|
|
|
|
if test "$php_cv_crypt_r_style" = "struct_crypt_data_gnu_source"; then
|
|
|
|
AC_DEFINE(CRYPT_R_GNU_SOURCE, 1, [Define if struct crypt_data requires _GNU_SOURCE])
|
|
|
|
fi
|
|
|
|
if test "$php_cv_crypt_r_style" = "none"; then
|
2006-12-12 18:16:06 +08:00
|
|
|
AC_MSG_ERROR([Unable to detect data struct used by crypt_r])
|
2006-12-12 15:38:04 +08:00
|
|
|
fi
|
|
|
|
])
|
2007-02-21 04:11:11 +08:00
|
|
|
|
2007-06-27 22:40:08 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_TEST_WRITE_STDOUT
|
|
|
|
dnl
|
2007-02-21 04:11:11 +08:00
|
|
|
AC_DEFUN([PHP_TEST_WRITE_STDOUT],[
|
|
|
|
AC_CACHE_CHECK(whether writing to stdout works,ac_cv_write_stdout,[
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
2007-02-21 04:11:11 +08:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define TEXT "This is the test message -- "
|
|
|
|
|
2019-09-10 03:29:03 +08:00
|
|
|
int main()
|
2007-02-21 04:11:11 +08:00
|
|
|
{
|
|
|
|
int n;
|
|
|
|
|
|
|
|
n = write(1, TEXT, sizeof(TEXT)-1);
|
|
|
|
return (!(n == sizeof(TEXT)-1));
|
|
|
|
}
|
2018-07-30 07:50:24 +08:00
|
|
|
]])],[
|
2007-02-21 04:11:11 +08:00
|
|
|
ac_cv_write_stdout=yes
|
|
|
|
],[
|
|
|
|
ac_cv_write_stdout=no
|
|
|
|
],[
|
|
|
|
ac_cv_write_stdout=no
|
|
|
|
])
|
|
|
|
])
|
|
|
|
if test "$ac_cv_write_stdout" = "yes"; then
|
|
|
|
AC_DEFINE(PHP_WRITE_STDOUT, 1, [whether write(2) works])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2010-04-24 21:32:30 +08:00
|
|
|
dnl
|
2010-11-14 06:22:51 +08:00
|
|
|
dnl PHP_INIT_DTRACE(providerdesc, header-file, sources [, module])
|
2010-04-24 21:32:30 +08:00
|
|
|
dnl
|
2010-11-14 06:22:51 +08:00
|
|
|
AC_DEFUN([PHP_INIT_DTRACE],[
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Set paths properly when called from extension.
|
2010-11-14 06:22:51 +08:00
|
|
|
case "$4" in
|
2010-11-19 00:02:37 +08:00
|
|
|
""[)] ac_srcdir="$abs_srcdir/"; unset ac_bdir;;
|
|
|
|
/*[)] ac_srcdir=`echo "$4"|cut -c 2-`"/"; ac_bdir=$ac_srcdir;;
|
|
|
|
*[)] ac_srcdir="$abs_srcdir/$1/"; ac_bdir="$4/";;
|
2010-11-14 06:22:51 +08:00
|
|
|
esac
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl providerdesc.
|
2010-11-14 06:22:51 +08:00
|
|
|
ac_provsrc=$1
|
2010-04-24 21:32:30 +08:00
|
|
|
old_IFS=[$]IFS
|
|
|
|
IFS=.
|
2010-11-14 06:22:51 +08:00
|
|
|
set $ac_provsrc
|
|
|
|
ac_provobj=[$]1
|
2010-04-24 21:32:30 +08:00
|
|
|
IFS=$old_IFS
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl header-file.
|
2010-11-14 06:22:51 +08:00
|
|
|
ac_hdrobj=$2
|
2010-04-24 21:32:30 +08:00
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Add providerdesc.o or .lo into global objects when needed.
|
2010-11-18 18:11:36 +08:00
|
|
|
case $host_alias in
|
2011-07-27 07:49:37 +08:00
|
|
|
*freebsd*)
|
2019-10-04 15:10:22 +08:00
|
|
|
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.lo"
|
2011-07-27 07:49:37 +08:00
|
|
|
PHP_LDFLAGS="$PHP_LDFLAGS -lelf"
|
|
|
|
;;
|
2010-11-18 18:11:36 +08:00
|
|
|
*solaris*)
|
2013-08-17 01:40:50 +08:00
|
|
|
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.lo"
|
2010-11-18 18:11:36 +08:00
|
|
|
;;
|
2012-12-03 19:21:32 +08:00
|
|
|
*linux*)
|
2013-08-17 01:40:50 +08:00
|
|
|
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.lo"
|
2012-12-03 19:21:32 +08:00
|
|
|
;;
|
2010-11-18 18:11:36 +08:00
|
|
|
esac
|
2010-04-24 21:32:30 +08:00
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl DTrace objects.
|
2010-04-24 21:32:30 +08:00
|
|
|
old_IFS=[$]IFS
|
2010-11-14 06:22:51 +08:00
|
|
|
for ac_src in $3; do
|
2010-04-24 21:32:30 +08:00
|
|
|
IFS=.
|
|
|
|
set $ac_src
|
|
|
|
ac_obj=[$]1
|
|
|
|
IFS=$old_IFS
|
|
|
|
|
|
|
|
PHP_DTRACE_OBJS="[$]PHP_DTRACE_OBJS [$]ac_bdir[$]ac_obj.lo"
|
|
|
|
done;
|
|
|
|
|
2010-11-14 07:13:07 +08:00
|
|
|
case [$]php_sapi_module in
|
2010-11-17 21:01:53 +08:00
|
|
|
shared[)]
|
2010-11-14 06:22:51 +08:00
|
|
|
for ac_lo in $PHP_DTRACE_OBJS; do
|
|
|
|
dtrace_objs="[$]dtrace_objs `echo $ac_lo | $SED -e 's,\.lo$,.o,' -e 's#\(.*\)\/#\1\/.libs\/#'`"
|
|
|
|
done;
|
|
|
|
;;
|
2010-11-17 21:01:53 +08:00
|
|
|
*[)]
|
|
|
|
dtrace_objs='$(PHP_DTRACE_OBJS:.lo=.o)'
|
|
|
|
;;
|
2010-11-14 06:22:51 +08:00
|
|
|
esac
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Generate Makefile.objects entries. The empty $ac_provsrc command stops an
|
|
|
|
dnl implicit circular dependency in GNU Make which causes the .d file to be
|
|
|
|
dnl overwritten (Bug 61268).
|
2010-11-14 06:22:51 +08:00
|
|
|
cat>>Makefile.objects<<EOF
|
|
|
|
|
2013-08-06 05:21:06 +08:00
|
|
|
$abs_srcdir/$ac_provsrc:;
|
|
|
|
|
2010-11-14 06:22:51 +08:00
|
|
|
$ac_bdir[$]ac_hdrobj: $abs_srcdir/$ac_provsrc
|
2013-08-17 01:40:50 +08:00
|
|
|
CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) -e 's,PHP_,DTRACE_,g' \$[]@.bak > \$[]@
|
2010-04-24 21:32:30 +08:00
|
|
|
|
2010-11-14 06:22:51 +08:00
|
|
|
\$(PHP_DTRACE_OBJS): $ac_bdir[$]ac_hdrobj
|
|
|
|
|
2013-08-17 01:40:50 +08:00
|
|
|
EOF
|
|
|
|
|
|
|
|
case $host_alias in
|
2019-10-04 15:10:22 +08:00
|
|
|
*solaris*|*linux*|*freebsd*)
|
2013-08-17 01:40:50 +08:00
|
|
|
dtrace_prov_name="`echo $ac_provsrc | $SED -e 's#\(.*\)\/##'`.o"
|
|
|
|
dtrace_lib_dir="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/[^/]*#\1#'`/.libs"
|
|
|
|
dtrace_d_obj="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/\([^/]*\)#\1/.libs/\2#'`.o"
|
|
|
|
dtrace_nolib_objs='$(PHP_DTRACE_OBJS:.lo=.o)'
|
|
|
|
for ac_lo in $PHP_DTRACE_OBJS; do
|
|
|
|
dtrace_lib_objs="[$]dtrace_lib_objs `echo $ac_lo | $SED -e 's,\.lo$,.o,' -e 's#\(.*\)\/#\1\/.libs\/#'`"
|
|
|
|
done;
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl Always attempt to create both PIC and non-PIC DTrace objects (Bug 63692)
|
2013-08-17 01:40:50 +08:00
|
|
|
cat>>Makefile.objects<<EOF
|
|
|
|
$ac_bdir[$]ac_provsrc.lo: \$(PHP_DTRACE_OBJS)
|
|
|
|
echo "[#] Generated by Makefile for libtool" > \$[]@
|
|
|
|
@test -d "$dtrace_lib_dir" || mkdir $dtrace_lib_dir
|
|
|
|
if CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $dtrace_d_obj -s $abs_srcdir/$ac_provsrc $dtrace_lib_objs 2> /dev/null && test -f "$dtrace_d_obj"; then [\\]
|
|
|
|
echo "pic_object=['].libs/$dtrace_prov_name[']" >> \$[]@ [;\\]
|
|
|
|
else [\\]
|
|
|
|
echo "pic_object='none'" >> \$[]@ [;\\]
|
|
|
|
fi
|
|
|
|
if CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $ac_bdir[$]ac_provsrc.o -s $abs_srcdir/$ac_provsrc $dtrace_nolib_objs 2> /dev/null && test -f "$ac_bdir[$]ac_provsrc.o"; then [\\]
|
|
|
|
echo "non_pic_object=[']$dtrace_prov_name[']" >> \$[]@ [;\\]
|
|
|
|
else [\\]
|
|
|
|
echo "non_pic_object='none'" >> \$[]@ [;\\]
|
|
|
|
fi
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cat>>Makefile.objects<<EOF
|
2010-11-14 06:22:51 +08:00
|
|
|
$ac_bdir[$]ac_provsrc.o: \$(PHP_DTRACE_OBJS)
|
2012-12-16 15:51:17 +08:00
|
|
|
CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o \$[]@ -s $abs_srcdir/$ac_provsrc $dtrace_objs
|
2010-11-14 06:22:51 +08:00
|
|
|
|
|
|
|
EOF
|
2013-08-17 01:40:50 +08:00
|
|
|
;;
|
|
|
|
esac
|
2010-11-14 06:22:51 +08:00
|
|
|
])
|
2013-08-07 04:45:35 +08:00
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl PHP_CHECK_STDINT_TYPES
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_CHECK_STDINT_TYPES], [
|
2019-03-15 06:21:17 +08:00
|
|
|
AC_CHECK_SIZEOF([short])
|
|
|
|
AC_CHECK_SIZEOF([int])
|
|
|
|
AC_CHECK_SIZEOF([long])
|
|
|
|
AC_CHECK_SIZEOF([long long])
|
|
|
|
AC_CHECK_SIZEOF([size_t])
|
2020-04-29 00:33:19 +08:00
|
|
|
AC_CHECK_SIZEOF([off_t])
|
2020-07-22 22:03:06 +08:00
|
|
|
AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t], [], [
|
|
|
|
AC_MSG_ERROR([One of the intN_t or uintN_t types is not available])
|
|
|
|
], [
|
2020-04-23 02:18:19 +08:00
|
|
|
#include <stdint.h>
|
2013-08-07 04:45:35 +08:00
|
|
|
#if HAVE_SYS_TYPES_H
|
|
|
|
# include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
])
|
|
|
|
])
|
2015-03-21 01:58:58 +08:00
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2015-03-21 01:58:58 +08:00
|
|
|
dnl PHP_CHECK_BUILTIN_EXPECT
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2015-03-21 01:58:58 +08:00
|
|
|
AC_DEFUN([PHP_CHECK_BUILTIN_EXPECT], [
|
|
|
|
AC_MSG_CHECKING([for __builtin_expect])
|
|
|
|
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
2015-03-21 01:58:58 +08:00
|
|
|
return __builtin_expect(1,1) ? 1 : 0;
|
2018-07-30 07:50:24 +08:00
|
|
|
]])], [
|
2015-03-21 01:58:58 +08:00
|
|
|
have_builtin_expect=1
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
], [
|
|
|
|
have_builtin_expect=0
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
|
2015-03-23 17:00:37 +08:00
|
|
|
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_EXPECT], [$have_builtin_expect], [Whether the compiler supports __builtin_expect])
|
2015-03-21 01:58:58 +08:00
|
|
|
])
|
2015-12-03 18:28:41 +08:00
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2015-12-03 18:28:41 +08:00
|
|
|
dnl PHP_CHECK_BUILTIN_CLZ
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2015-12-03 18:28:41 +08:00
|
|
|
AC_DEFUN([PHP_CHECK_BUILTIN_CLZ], [
|
|
|
|
AC_MSG_CHECKING([for __builtin_clz])
|
|
|
|
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
2015-12-03 18:28:41 +08:00
|
|
|
return __builtin_clz(1) ? 1 : 0;
|
2018-07-30 07:50:24 +08:00
|
|
|
]])], [
|
2015-12-03 18:28:41 +08:00
|
|
|
have_builtin_clz=1
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
], [
|
|
|
|
have_builtin_clz=0
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CLZ], [$have_builtin_clz], [Whether the compiler supports __builtin_clz])
|
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2015-12-03 18:28:41 +08:00
|
|
|
dnl PHP_CHECK_BUILTIN_CTZL
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2015-12-03 18:28:41 +08:00
|
|
|
AC_DEFUN([PHP_CHECK_BUILTIN_CTZL], [
|
|
|
|
AC_MSG_CHECKING([for __builtin_ctzl])
|
|
|
|
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
2015-12-03 18:28:41 +08:00
|
|
|
return __builtin_ctzl(2L) ? 1 : 0;
|
2018-07-30 07:50:24 +08:00
|
|
|
]])], [
|
2015-12-03 18:28:41 +08:00
|
|
|
have_builtin_ctzl=1
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
], [
|
|
|
|
have_builtin_ctzl=0
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CTZL], [$have_builtin_ctzl], [Whether the compiler supports __builtin_ctzl])
|
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2015-12-03 18:28:41 +08:00
|
|
|
dnl PHP_CHECK_BUILTIN_CTZLL
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2015-12-03 18:28:41 +08:00
|
|
|
AC_DEFUN([PHP_CHECK_BUILTIN_CTZLL], [
|
|
|
|
AC_MSG_CHECKING([for __builtin_ctzll])
|
|
|
|
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
2015-12-03 18:28:41 +08:00
|
|
|
return __builtin_ctzll(2LL) ? 1 : 0;
|
2018-07-30 07:50:24 +08:00
|
|
|
]])], [
|
2015-12-03 18:28:41 +08:00
|
|
|
have_builtin_ctzll=1
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
], [
|
|
|
|
have_builtin_ctzll=0
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CTZLL], [$have_builtin_ctzll], [Whether the compiler supports __builtin_ctzll])
|
|
|
|
])
|
2016-08-11 19:57:30 +08:00
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2016-08-11 19:57:30 +08:00
|
|
|
dnl PHP_CHECK_BUILTIN_SMULL_OVERFLOW
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2016-08-11 19:57:30 +08:00
|
|
|
AC_DEFUN([PHP_CHECK_BUILTIN_SMULL_OVERFLOW], [
|
|
|
|
AC_MSG_CHECKING([for __builtin_smull_overflow])
|
|
|
|
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
2016-08-11 19:57:30 +08:00
|
|
|
long tmpvar;
|
|
|
|
return __builtin_smull_overflow(3, 7, &tmpvar);
|
2018-07-30 07:50:24 +08:00
|
|
|
]])], [
|
2016-08-11 19:57:30 +08:00
|
|
|
have_builtin_smull_overflow=1
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
], [
|
|
|
|
have_builtin_smull_overflow=0
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_SMULL_OVERFLOW],
|
|
|
|
[$have_builtin_smull_overflow], [Whether the compiler supports __builtin_smull_overflow])
|
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2016-08-11 19:57:30 +08:00
|
|
|
dnl PHP_CHECK_BUILTIN_SMULLL_OVERFLOW
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2016-08-11 19:57:30 +08:00
|
|
|
AC_DEFUN([PHP_CHECK_BUILTIN_SMULLL_OVERFLOW], [
|
|
|
|
AC_MSG_CHECKING([for __builtin_smulll_overflow])
|
|
|
|
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
2016-08-11 19:57:30 +08:00
|
|
|
long long tmpvar;
|
|
|
|
return __builtin_smulll_overflow(3, 7, &tmpvar);
|
2018-07-30 07:50:24 +08:00
|
|
|
]])], [
|
2016-08-11 19:57:30 +08:00
|
|
|
have_builtin_smulll_overflow=1
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
], [
|
|
|
|
have_builtin_smulll_overflow=0
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_SMULLL_OVERFLOW],
|
|
|
|
[$have_builtin_smulll_overflow], [Whether the compiler supports __builtin_smulll_overflow])
|
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2016-08-11 19:57:30 +08:00
|
|
|
dnl PHP_CHECK_BUILTIN_SADDL_OVERFLOW
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2016-08-11 19:57:30 +08:00
|
|
|
AC_DEFUN([PHP_CHECK_BUILTIN_SADDL_OVERFLOW], [
|
|
|
|
AC_MSG_CHECKING([for __builtin_saddl_overflow])
|
|
|
|
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
2016-08-11 19:57:30 +08:00
|
|
|
long tmpvar;
|
|
|
|
return __builtin_saddl_overflow(3, 7, &tmpvar);
|
2018-07-30 07:50:24 +08:00
|
|
|
]])], [
|
2016-08-11 19:57:30 +08:00
|
|
|
have_builtin_saddl_overflow=1
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
], [
|
|
|
|
have_builtin_saddl_overflow=0
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_SADDL_OVERFLOW],
|
|
|
|
[$have_builtin_saddl_overflow], [Whether the compiler supports __builtin_saddl_overflow])
|
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2016-08-11 23:57:58 +08:00
|
|
|
dnl PHP_CHECK_BUILTIN_SADDLL_OVERFLOW
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2016-08-11 19:57:30 +08:00
|
|
|
AC_DEFUN([PHP_CHECK_BUILTIN_SADDLL_OVERFLOW], [
|
|
|
|
AC_MSG_CHECKING([for __builtin_saddll_overflow])
|
|
|
|
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
2016-08-11 19:57:30 +08:00
|
|
|
long long tmpvar;
|
|
|
|
return __builtin_saddll_overflow(3, 7, &tmpvar);
|
2018-07-30 07:50:24 +08:00
|
|
|
]])], [
|
2016-08-11 19:57:30 +08:00
|
|
|
have_builtin_saddll_overflow=1
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
], [
|
|
|
|
have_builtin_saddll_overflow=0
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
|
2016-08-11 23:57:58 +08:00
|
|
|
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_SADDLL_OVERFLOW],
|
2016-08-11 19:57:30 +08:00
|
|
|
[$have_builtin_saddll_overflow], [Whether the compiler supports __builtin_saddll_overflow])
|
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2016-08-11 23:57:58 +08:00
|
|
|
dnl PHP_CHECK_BUILTIN_SSUBL_OVERFLOW
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2016-08-11 19:57:30 +08:00
|
|
|
AC_DEFUN([PHP_CHECK_BUILTIN_SSUBL_OVERFLOW], [
|
|
|
|
AC_MSG_CHECKING([for __builtin_ssubl_overflow])
|
|
|
|
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
2016-08-11 19:57:30 +08:00
|
|
|
long tmpvar;
|
|
|
|
return __builtin_ssubl_overflow(3, 7, &tmpvar);
|
2018-07-30 07:50:24 +08:00
|
|
|
]])], [
|
2016-08-11 19:57:30 +08:00
|
|
|
have_builtin_ssubl_overflow=1
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
], [
|
|
|
|
have_builtin_ssubl_overflow=0
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_SSUBL_OVERFLOW],
|
|
|
|
[$have_builtin_ssubl_overflow], [Whether the compiler supports __builtin_ssubl_overflow])
|
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2016-08-11 19:57:30 +08:00
|
|
|
dnl PHP_CHECK_BUILTIN_SSUBLL_OVERFLOW
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2016-08-11 19:57:30 +08:00
|
|
|
AC_DEFUN([PHP_CHECK_BUILTIN_SSUBLL_OVERFLOW], [
|
|
|
|
AC_MSG_CHECKING([for __builtin_ssubll_overflow])
|
|
|
|
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
2016-08-11 19:57:30 +08:00
|
|
|
long long tmpvar;
|
|
|
|
return __builtin_ssubll_overflow(3, 7, &tmpvar);
|
2018-07-30 07:50:24 +08:00
|
|
|
]])], [
|
2016-08-11 19:57:30 +08:00
|
|
|
have_builtin_ssubll_overflow=1
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
], [
|
|
|
|
have_builtin_ssubll_overflow=0
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_SSUBLL_OVERFLOW],
|
|
|
|
[$have_builtin_ssubll_overflow], [Whether the compiler supports __builtin_ssubll_overflow])
|
|
|
|
])
|
Use AX_CHECK_COMPILE_FLAG macro to check for -fvisibility=hidden support.
The existing check for -fvisibility=hidden support came from a time
when only GCC had it. The test for it used a regular expression to
parse the GCC major version from the output of `$CC --version`, and
would look for version 4 or greater.
The regular expression used to accomplish this is doomed, however,
since GCC can be built with a custom version string
(--with-pkgversion). Moreover, the $CC variable can be set to
something that confuses it but is otherwise valid. For example, it
would fail with CC=x86_64-pc-linux-gnu-gcc.
This commit fixes two aspects of the feature test. First, it no longer
limits the test to GCC. At least clang now supports the flag, and can
make use of it when GCC is its backend. Second, support for the flag
is tested directly, by attempting to pass it to the compiler, rather
than by parsing its version string. The latter is accomplished with a
new macro, AX_CHECK_COMPILE_FLAG, taken from the autoconf archive.
The new macro has been added to acinclude.m4, and the test stanza in
configure.in has been replaced with a single call to the new macro.
Note that the new macro calls AC_PREREQ(2.64) -- a more stringent
requirement than the existing AC_PREREQ(2.59) in configure.in. The
difference represents about six years of autoconf releases, from v2.59
in December of 2003 to v2.64 in July of 2009.
This problem was noticed by Brian Evans, who also suggested the fix.
PHP-Bug: 73062
2016-09-10 23:20:50 +08:00
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2018-01-15 21:01:27 +08:00
|
|
|
dnl PHP_CHECK_BUILTIN_CPU_INIT
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2018-01-15 21:01:27 +08:00
|
|
|
AC_DEFUN([PHP_CHECK_BUILTIN_CPU_INIT], [
|
|
|
|
AC_MSG_CHECKING([for __builtin_cpu_init])
|
|
|
|
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
2018-01-15 21:01:27 +08:00
|
|
|
return __builtin_cpu_init()? 1 : 0;
|
2018-07-30 07:50:24 +08:00
|
|
|
]])], [
|
2018-01-15 21:01:27 +08:00
|
|
|
have_builtin_cpu_init=1
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
], [
|
|
|
|
have_builtin_cpu_init=0
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CPU_INIT],
|
|
|
|
[$have_builtin_cpu_init], [Whether the compiler supports __builtin_cpu_init])
|
|
|
|
])
|
|
|
|
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2018-02-10 16:58:27 +08:00
|
|
|
dnl PHP_CHECK_BUILTIN_CPU_SUPPORTS
|
2019-05-13 00:43:03 +08:00
|
|
|
dnl
|
2018-02-10 16:58:27 +08:00
|
|
|
AC_DEFUN([PHP_CHECK_BUILTIN_CPU_SUPPORTS], [
|
|
|
|
AC_MSG_CHECKING([for __builtin_cpu_supports])
|
|
|
|
|
2018-07-30 07:50:24 +08:00
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
|
2018-02-12 20:46:17 +08:00
|
|
|
return __builtin_cpu_supports("sse")? 1 : 0;
|
2018-07-30 07:50:24 +08:00
|
|
|
]])], [
|
2018-02-10 16:58:27 +08:00
|
|
|
have_builtin_cpu_supports=1
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
], [
|
|
|
|
have_builtin_cpu_supports=0
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CPU_SUPPORTS],
|
|
|
|
[$have_builtin_cpu_supports], [Whether the compiler supports __builtin_cpu_supports])
|
2018-02-12 20:46:17 +08:00
|
|
|
])
|
2018-02-10 16:58:27 +08:00
|
|
|
|
2019-07-11 08:00:51 +08:00
|
|
|
dnl
|
|
|
|
dnl PHP_PATCH_CONFIG_HEADERS([FILE])
|
|
|
|
dnl
|
|
|
|
dnl PACKAGE_* symbols are automatically defined by Autoconf. When including
|
|
|
|
dnl configuration header, warnings about redefined symbols are emitted for such
|
|
|
|
dnl symbols if they are defined by multiple libraries. This disables all
|
|
|
|
dnl PACKAGE_* symbols in the generated configuration header template FILE. For
|
|
|
|
dnl example, main/php_config.h.in for PHP or config.h.in for PHP extensions.
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([PHP_PATCH_CONFIG_HEADERS], [
|
|
|
|
AC_MSG_NOTICE([patching $1])
|
|
|
|
|
|
|
|
$SED -e 's/^#undef PACKAGE_[^ ]*/\/\* & \*\//g' < $srcdir/$1 \
|
|
|
|
> $srcdir/$1.tmp && mv $srcdir/$1.tmp $srcdir/$1
|
|
|
|
])
|