📄 acinclude.m4
字号:
]) ]) if test "$ac_cv_broken_snprintf" = "yes"; then AC_DEFINE(PHP_BROKEN_SNPRINTF, 1, [Whether snprintf is C99 conform]) else AC_DEFINE(PHP_BROKEN_SNPRINTF, 0, [Whether snprintf is C99 conform]) fi])dnl PHP_SHARED_MODULE(module-name, object-var, build-dir)dnldnl Basically sets up the link-stage for building module-namednl from object_var in build-dir.dnlAC_DEFUN([PHP_SHARED_MODULE],[ PHP_MODULES="$PHP_MODULES \$(phplibdir)/$1.la" PHP_SUBST($2) cat >>Makefile.objects<<EOF\$(phplibdir)/$1.la: $3/$1.la \$(LIBTOOL) --mode=install cp $3/$1.la \$(phplibdir)$3/$1.la: \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_DEPENDENCIES) \$(LIBTOOL) --mode=link \$(CC) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) -o \[$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)EOF])dnldnl PHP_SELECT_SAPI(name, type[, sources [, extra-cflags [, build-target]]])dnldnl Selects the SAPI name and type (static, shared, programm)dnl and optionally also the source-files for the SAPI-specificdnl objects.dnlAC_DEFUN([PHP_SELECT_SAPI],[ PHP_SAPI=$1 case "$2" in static[)] PHP_BUILD_STATIC;; shared[)] PHP_BUILD_SHARED;; bundle[)] PHP_BUILD_BUNDLE;; program[)] PHP_BUILD_PROGRAM($5);; esac ifelse($3,,,[PHP_ADD_SOURCES([sapi/$1],[$3],[$4],[sapi])])])dnl deprecatedAC_DEFUN([PHP_EXTENSION],[ sources=`$AWK -f $abs_srcdir/scan_makefile_in.awk < []PHP_EXT_SRCDIR($1)[]/Makefile.in` PHP_NEW_EXTENSION($1, $sources, $2, $3) if test -r "$ext_srcdir/Makefile.frag"; then PHP_ADD_MAKEFILE_FRAGMENT fi])AC_DEFUN([PHP_ADD_BUILD_DIR],[ BUILD_DIR="$BUILD_DIR $1"])AC_DEFUN([PHP_GEN_BUILD_DIRS],[ $php_shtool mkdir -p $BUILD_DIR])dnldnl PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags]]])dnldnl Includes an extension in the build.dnldnl "extname" is the name of the ext/ subdir where the extension resides.dnl "sources" is a list of files relative to the subdir which are useddnl to build the extension.dnl "shared" can be set to "shared" or "yes" to build the extension asdnl a dynamically loadable library. Optional parameter "sapi_class" candnl be set to "cli" to mark extension build only with CLI or CGI sapi's.dnl extra-cflags are passed to the compiler, with @ext_srcdir@ beingdnl substituted.AC_DEFUN([PHP_NEW_EXTENSION],[ ext_builddir=[]PHP_EXT_BUILDDIR($1) ext_srcdir=[]PHP_EXT_SRCDIR($1) ifelse($5,,ac_extra=,[ac_extra=`echo "$5"|sed s#@ext_srcdir@#$ext_srcdir#g`]) if test "$3" != "shared" && test "$3" != "yes" && test "$4" != "cli"; thendnl ---------------------------------------------- Static module PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,) EXT_STATIC="$EXT_STATIC $1" if test "$3" != "nocli"; then EXT_CLI_STATIC="$EXT_CLI_STATIC $1" fi else if test "$3" = "shared" || test "$3" = "yes"; thendnl ---------------------------------------------- Shared module PHP_ADD_SOURCES_X(PHP_EXT_DIR($1),$2,$ac_extra,shared_objects_$1,yes) PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir) AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z_-,A-Z__), 1, Whether to build $1 as dynamic module) fi fi if test "$3" != "shared" && test "$3" != "yes" && test "$4" = "cli"; thendnl ---------------------------------------------- CLI static module if test "$PHP_SAPI" = "cgi"; then PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,) EXT_STATIC="$EXT_STATIC $1" else PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,cli) fi EXT_CLI_STATIC="$EXT_CLI_STATIC $1" fi PHP_ADD_BUILD_DIR($ext_builddir)])dnldnl Solaris requires main code to be position independent in orderdnl to let shared objects find symbols. Weird. Ugly.dnldnl Must be run after all --with-NN options that let the userdnl choose dynamic extensions, and after the gcc test.dnlAC_DEFUN([PHP_SOLARIS_PIC_WEIRDNESS],[ AC_MSG_CHECKING([whether -fPIC is required]) if test -n "$EXT_SHARED"; then os=`uname -sr 2>/dev/null` case $os in "SunOS 5.6"|"SunOS 5.7"[)] case $CC in gcc*|egcs*) CFLAGS="$CFLAGS -fPIC";; *[)] CFLAGS="$CFLAGS -fpic";; esac AC_MSG_RESULT([yes]);; *[)] AC_MSG_RESULT([no]);; esac else AC_MSG_RESULT([no]) fi])dnldnl Checks whether $withval is "shared" or starts with "shared,XXX"dnl and sets $shared to "yes" or "no", and removes "shared,?" stuffdnl from $withval.dnlAC_DEFUN([PHP_WITH_SHARED],[ PHP_ARG_ANALYZE_EX(withval) shared=$ext_shared unset ext_shared ext_output])dnl The problem is that the default compilation flags in Solaris 2.6 won'tdnl let programs access large files; you need to tell the compiler thatdnl you actually want your programs to work on large files. For morednl details about this brain damage please see:dnl http://www.sas.com/standards/large.file/x_open.20Mar96.htmldnl Written by Paul Eggert <eggert@twinsun.com>.AC_DEFUN([PHP_SYS_LFS],[dnl # If available, prefer support for large files unless the user specified # one of the CPPFLAGS, LDFLAGS, or LIBS variables. AC_MSG_CHECKING([whether large file support needs explicit enabling]) ac_getconfs='' ac_result=yes ac_set='' ac_shellvars='CPPFLAGS LDFLAGS LIBS' for ac_shellvar in $ac_shellvars; do case $ac_shellvar in CPPFLAGS[)] ac_lfsvar=LFS_CFLAGS ;; *[)] ac_lfsvar=LFS_$ac_shellvar ;; esac eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; } ac_getconf=`getconf $ac_lfsvar` ac_getconfs=$ac_getconfs$ac_getconf eval ac_test_$ac_shellvar=\$ac_getconf done case "$ac_result$ac_getconfs" in yes[)] ac_result=no ;; esac case "$ac_result$ac_set" in yes?*[)] ac_result="yes, but $ac_set is already set, so use its settings" esac AC_MSG_RESULT([$ac_result]) case $ac_result in yes[)] for ac_shellvar in $ac_shellvars; do eval $ac_shellvar=\$ac_test_$ac_shellvar done ;; esac])AC_DEFUN([PHP_SOCKADDR_SA_LEN],[ AC_CACHE_CHECK([for field sa_len in struct sockaddr],ac_cv_sockaddr_sa_len,[ AC_TRY_COMPILE([#include <sys/types.h>#include <sys/socket.h>], [struct sockaddr s; s.sa_len;], [ac_cv_sockaddr_sa_len=yes AC_DEFINE(HAVE_SOCKADDR_SA_LEN,1,[ ])], [ac_cv_sockaddr_sa_len=no]) ])])dnl ## PHP_OUTPUT(file)dnl ## adds "file" to the list of files generated by AC_OUTPUTdnl ## This macro can be used several times.AC_DEFUN([PHP_OUTPUT],[ PHP_OUTPUT_FILES="$PHP_OUTPUT_FILES $1"])AC_DEFUN([PHP_DECLARED_TIMEZONE],[ AC_CACHE_CHECK(for declared timezone, ac_cv_declared_timezone,[ AC_TRY_COMPILE([#include <sys/types.h>#include <time.h>#ifdef HAVE_SYS_TIME_H#include <sys/time.h>#endif],[ time_t foo = (time_t) timezone;],[ ac_cv_declared_timezone=yes],[ ac_cv_declared_timezone=no])]) if test "$ac_cv_declared_timezone" = "yes"; then AC_DEFINE(HAVE_DECLARED_TIMEZONE, 1, [Whether system headers declare timezone]) fi])AC_DEFUN([PHP_EBCDIC],[ AC_CACHE_CHECK([whether system uses EBCDIC],ac_cv_ebcdic,[ AC_TRY_RUN( [int main(void) { return (unsigned char)'A' != (unsigned char)0xC1; } ],[ ac_cv_ebcdic=yes],[ ac_cv_ebcdic=no],[ ac_cv_ebcdic=no])]) if test "$ac_cv_ebcdic" = "yes"; then AC_DEFINE(CHARSET_EBCDIC,1, [Define if system uses EBCDIC]) fi])dnl Some systems, notably Solaris, cause getcwd() or realpath to fail if adnl component of the path has execute but not read permissionsAC_DEFUN([PHP_BROKEN_GETCWD],[ AC_MSG_CHECKING([for broken getcwd]) os=`uname -sr 2>/dev/null` case $os in SunOS*[)] AC_DEFINE(HAVE_BROKEN_GETCWD,1, [Define if system has broken getcwd]) AC_MSG_RESULT([yes]);; *[)] AC_MSG_RESULT([no]);; esac])AC_DEFUN([PHP_BROKEN_GLIBC_FOPEN_APPEND],[ AC_MSG_CHECKING([for broken libc stdio]) AC_CACHE_VAL(have_broken_glibc_fopen_append,[ AC_TRY_RUN([#include <stdio.h>int main(int argc, char *argv[]){ FILE *fp; long position; char *filename = "/tmp/phpglibccheck"; fp = fopen(filename, "w"); if (fp == NULL) { perror("fopen"); exit(2); } fputs("foobar", fp); fclose(fp); fp = fopen(filename, "a+"); position = ftell(fp); fclose(fp); unlink(filename); if (position == 0) return 1; return 0;}],[have_broken_glibc_fopen_append=no],[have_broken_glibc_fopen_append=yes ],AC_TRY_COMPILE([#include <features.h>],[#if !__GLIBC_PREREQ(2,2)choke me#endif],[have_broken_glibc_fopen_append=yes],[have_broken_glibc_fopen_append=no ]))]) if test "$have_broken_glibc_fopen_append" = "yes"; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_BROKEN_GLIBC_FOPEN_APPEND,1, [Define if your glibc borks on fopen with mode a+]) else AC_MSG_RESULT(no) fi])AC_DEFUN([PHP_FOPENCOOKIE],[ AC_CHECK_FUNC(fopencookie, [ have_glibc_fopencookie=yes ]) if test "$have_glibc_fopencookie" = "yes" ; then dnl this comes in two flavors: dnl newer glibcs (since 2.1.2 ? ) dnl have a type called cookie_io_functions_t AC_TRY_COMPILE([ #define _GNU_SOURCE #include <stdio.h> ], [ cookie_io_functions_t cookie; ], [ have_cookie_io_functions_t=yes ], [] ) if test "$have_cookie_io_functions_t" = "yes" ; then cookie_io_functions_t=cookie_io_functions_t have_fopen_cookie=yes dnl even newer glibcs have a different seeker definition... AC_TRY_RUN([#define _GNU_SOURCE#include <stdio.h>struct cookiedata { __off64_t pos;};__ssize_t reader(void *cookie, char *buffer, size_t size){ return size; }__ssize_t writer(void *cookie, const char *buffer, size_t size){ return size; }int closer(void *cookie){ return 0; }int seeker(void *cookie, __off64_t *position, int whence){ ((struct cookiedata*)cookie)->pos = *position; return 0; }cookie_io_functions_t funcs = {reader, writer, seeker, closer};main() { struct cookiedata g = { 0 }; FILE *fp = fopencookie(&g, "r", funcs); if (fp && fseek(fp, 8192, SEEK_SET) == 0 && g.pos == 8192) exit(0); exit(1);} ], [ cookie_io_functions_use_off64_t=yes ], [ ] ) else dnl older glibc versions (up to 2.1.2 ?) dnl call it _IO_cookie_io_functions_t AC_TRY_COMPILE([ #define _GNU_SOURCE #include <stdio.h> ], [ _IO_cookie_io_functions_t cookie; ], [ have_IO_cookie_io_functions_t=yes ], [] ) if test "$have_cookie_io_functions_t" = "yes" ; then cookie_io_functions_t=_IO_cookie_io_functions_t have_fopen_cookie=yes fi fi if test "$have_fopen_cookie" = "yes" ; then AC_DEFINE(HAVE_FOPENCOOKIE, 1, [ ]) AC_DEFINE_UNQUOTED(COOKIE_IO_FUNCTIONS_T, $cookie_io_functions_t, [ ]) if test "$cookie_io_functions_use_off64_t" = "yes" ; then AC_DEFINE(COOKIE_SEEKER_USES_OFF64_T, 1, [ ]) fi fi fi])dnldnl PHP_CHECK_LIBRARY(library, function [, action-found [, action-not-found [, extra-ldflags]]])dnldnl Wrapper for AC_CHECK_LIBdnlAC_DEFUN([PHP_CHECK_LIBRARY], [ save_old_LDFLAGS=$LDFLAGS ac_stuff="$5" save_ext_shared=$ext_shared ext_shared=yes PHP_EVAL_LIBLINE([$]ac_stuff, LDFLAGS) AC_CHECK_LIB([$1],[$2],[ LDFLAGS=$save_old_LDFLAGS ext_shared=$save_ext_shared $3 ],[ LDFLAGS=$save_old_LDFLAGS ext_shared=$save_ext_shared unset ac_cv_func_$1 $4 ])dnl])dnldnl PHP_CHECK_FRAMEWORK(framework, function [, action-found [, action-not-found ]])dnldnl El cheapo wrapper for AC_CHECK_LIBdnlAC_DEFUN([PHP_CHECK_FRAMEWORK], [ save_old_LDFLAGS=$LDFLAGS LDFLAGS="-framework $1 $LDFLAGS" dnl supplying "c" to AC_CHECK_LIB is technically cheating, but dnl rewriting AC_CHECK_LIB is overkill and this only affects dnl the "checking.." output anyway. AC_CHECK_LIB(c,[$2],[ LDFLAGS=$save_old_LDFLAGS $3 ],[ LDFLAGS=$save_old_LDFLAGS $4 ])])dnl dnl PHP_SETUP_ICONV(shared-add [, action-found [, action-not-found]])dnldnl Common setup macro for iconvdnlAC_DEFUN([PHP_SETUP_ICONV], [ found_iconv=no unset ICONV_DIR dnl dnl Check libc first if no path is provided in --with-iconv dnl if test "$PHP_ICONV" = "yes"; then AC_CHECK_FUNC(iconv, [ PHP_DEFINE(HAVE_ICONV) found_iconv=yes ],[ AC_CHECK_FUNC(libiconv,[ PHP_DEFINE(HAVE_LIBICONV) found_iconv=yes ]) ]) fi dnl dnl Check external libs for iconv funcs dnl if test "$found_iconv" = "no"; then for i in $PHP_ICONV /usr/local /usr; do if test -r $i/include/giconv.h; then AC_DEFINE(HAVE_GICONV_H, 1, [ ]) ICONV_DIR=$i iconv_lib_name=giconv break elif test -r $i/include/iconv.h; then ICONV_DIR=$i iconv_lib_name=iconv break fi done if test -z "$ICONV_DIR"; then AC_MSG_ERROR([Please specify the install prefix of iconv with --with-iconv=<DIR>]) fi if test -f $ICONV_DIR/lib/lib$iconv_lib_name.a || test -f $ICONV_DIR/lib/lib$iconv_lib_name.$SHLIB_SUFFIX_NAME then PHP_CHECK_LIBRARY($iconv_lib_name, libiconv, [ found_iconv=yes PHP_DEFINE(HAVE_LIBICONV) ], [ PHP_CHECK_LIBRARY($iconv_lib_name, iconv, [ found_iconv=yes PHP_DEFINE(HAVE_ICONV) ], [], [ -L$ICONV_DIR/lib ]) ], [ -L$ICONV_DIR/lib ]) fi fi if test "$found_iconv" = "yes"; then if test -n "$ICONV_DIR"; then AC_DEFINE(HAVE_ICONV, 1, [ ]) PHP_ADD_LIBRARY_WITH_PATH($iconv_lib_name, $ICONV_DIR/lib, $1) PHP_ADD_INCLUDE($ICONV_DIR/include) fi $2ifelse([$3],[],,[else $3]) fi])AC_DEFUN([PHP_DEF_HAVE],[AC_DEFINE([HAVE_]translit($1,a-z_-,A-Z__), 1, [ ])])dnldnl PHP_CHECK_FUNC_LIB(func, libs)dnl This macro checks whether 'func' or '__func' existsdnl in the specified library.dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS.dnl This should be called in the ACTION-IF-NOT-FOUND part of PHP_CHECK_FUNCdnldnl autoconf undefines the builtin "shift" :-(dnl If possible, we use the builtin shift anyway, otherwise we usednl the ubercool definition I have tested so far with FreeBSD/GNU m4ifdef([builtin],[builtin(define, phpshift, [builtin(shift, $@)])],[define([phpshift],[ifelse(index([$@],[,]),-1,,[substr([$@],incr(index([$@],[,])))])])])AC_DEFUN([PHP_CHECK_FUNC_LIB],[ ifelse($2,,:,[ unset ac_cv_lib_$2[]_$1 unset ac_cv_lib_$2[]___$1 unset found AC_CHECK_LIB($2, $1, [found=yes], [ AC_CHECK_LIB($2, __$1, [found=yes], [found=no]) ]) if test "$found" = "yes"; then ac_libs=$LIBS LIBS="$LIBS -l$2" AC_TRY_RUN([main() { return (0); }],[found=yes],[found=no],[found=no]) LIBS=$ac_libs fi if test "$found" = "yes"; then PHP_ADD_LIBRARY($2) PHP_DEF_HAVE($1) PHP_DEF_HAVE(lib$2) ac_cv_func_$1=yes else PHP_CHECK_FUNC_LIB($1,phpshift(phpshift($@))) fi ])])dnldnl PHP_CHECK_FUNC(func, ...)dnl This macro checks whether 'func' or '__func' existsdnl in the default libraries and as a fall back in the specified library.dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS.dnlAC_DEFUN([PHP_CHECK_FUNC],[ unset ac_cv_func_$1 unset ac_cv_func___$1 unset found AC_CHECK_FUNC($1, [found=yes],[ AC_CHECK_FUNC(__$1,[found=yes],[found=no]) ]) case $found in yes[)] PHP_DEF_HAVE($1) ac_cv_func_$1=yes ;; ifelse($#,1,,[ *[)] PHP_CHECK_FUNC_LIB($@) ;; ]) esac])dnldnl PHP_AP_EXTRACT_VERSION(/path/httpd)dnl This macro is used to get a comparablednl version for apache1/2.dnlAC_DEFUN([PHP_AP_EXTRACT_VERSION],[ ac_output=`$1 -v 2>&1` ac_IFS=$IFSIFS="- /." set $ac_output IFS=$ac_IFS APACHE_VERSION=`expr [$]4 \* 1000000 + [$]5 \* 1000 + [$]6`])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -