mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Autotools: Check struct stat.st_blocks with AC_CHECK_MEMBERS (#13562)
The AC_STRUCT_ST_BLOCKS expects fileblocks object to be compiled with AC_LIBOBJ if stat.st_blocks is missing on the system. This can be simplified with the usual AC_CHECK_MEMBERS since PHP is using the stat.st_blocks (and stat.st_blksize) conditionally. These members are mostly present on all POSIX-based systems except on Windows these days. This also removes the obsolete HAVE_ST_BLOCKS symbol: https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/types.m4?h=v2.72#n1055 Additionally, the st_blksize and st_blocks members are checked conditionally with HAVE_ preprocessor macros. Instead of filtering Windows specifically here, the preprocessor macros HAVE_STRUCT_STAT_ST_BLKSIZE and HAVE_STRUCT_STAT_ST_BLOCKS can be used.
This commit is contained in:
@@ -84,6 +84,10 @@ PHP 8.6 INTERNALS UPGRADE NOTES
|
||||
values can be compared to the result of
|
||||
zend_enum_fetch_case_id(zend_object*).
|
||||
|
||||
- Unix build system changes:
|
||||
. Symbol HAVE_ST_BLOCKS has been removed from php_config.h (use
|
||||
HAVE_STRUCT_STAT_ST_BLOCKS).
|
||||
|
||||
========================
|
||||
3. Module changes
|
||||
========================
|
||||
|
||||
10
configure.ac
10
configure.ac
@@ -504,11 +504,11 @@ AS_VAR_IF([php_cv_have_alignof], [yes],
|
||||
|
||||
dnl Check for structure members.
|
||||
AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
|
||||
AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
|
||||
dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exist.
|
||||
if test "$(uname -s 2>/dev/null)" != "QNX"; then
|
||||
AC_STRUCT_ST_BLOCKS
|
||||
fi
|
||||
AC_CHECK_MEMBERS(m4_normalize([
|
||||
struct stat.st_blksize,
|
||||
struct stat.st_blocks,
|
||||
struct stat.st_rdev
|
||||
]))
|
||||
|
||||
dnl Checks for types.
|
||||
AC_TYPE_UID_T
|
||||
|
||||
@@ -631,8 +631,10 @@ statme_baby:
|
||||
if (data) {
|
||||
sb.st_ino = data->inode;
|
||||
}
|
||||
#ifndef PHP_WIN32
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
sb.st_blksize = -1;
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
|
||||
sb.st_blocks = -1;
|
||||
#endif
|
||||
phar_fancy_stat(&sb, type, return_value);
|
||||
|
||||
@@ -526,8 +526,10 @@ void phar_dostat(phar_archive_data *phar, phar_entry_info *data, php_stream_stat
|
||||
if (!is_temp_dir) {
|
||||
ssb->sb.st_ino = data->inode;
|
||||
}
|
||||
#ifndef PHP_WIN32
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
ssb->sb.st_blksize = -1;
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
|
||||
ssb->sb.st_blocks = -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -177,8 +177,10 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb) /* {{{
|
||||
ssb->sb.st_ctime = sb.mtime;
|
||||
ssb->sb.st_nlink = 1;
|
||||
ssb->sb.st_rdev = -1;
|
||||
#ifndef PHP_WIN32
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
ssb->sb.st_blksize = -1;
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
|
||||
ssb->sb.st_blocks = -1;
|
||||
#endif
|
||||
ssb->sb.st_ino = -1;
|
||||
|
||||
@@ -213,8 +213,10 @@ static int php_stream_memory_stat(php_stream *stream, php_stream_statbuf *ssb) /
|
||||
/* generate unique inode number for alias/filename, so no phars will conflict */
|
||||
ssb->sb.st_ino = 0;
|
||||
|
||||
#ifndef PHP_WIN32
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
ssb->sb.st_blksize = -1;
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
|
||||
ssb->sb.st_blocks = -1;
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user