[php-src] PR #13706: Check major, minor and makedev with Autoconf's AC_HEADER_MAJOR
| From: | petk | Date: | Thu, 14 Mar 2024 06:57:33 +0000 |
| Subject: | [php-src] PR #13706: Check major, minor and makedev with Autoconf's AC_HEADER_MAJOR | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-25415@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/13706
Author: petk
The non-standard major(), minor(), and makedev() can be defined as macros. These are usually used
together with the Autoconf macro AC_HEADER_MAJOR, which defines the MAJOR_IN_MKDEV if sys/mkdev.h is
available, or MAJOR_IN_SYS_SYSMACROS if sys/sysmacros.h is available.
On Solaris/illumos they are in the sys/mkdev.h header (macro defined to libc implementation) and in
sys/sysmacros.h (macro defined with binary operators and bits shifting). On systems with musl and
glibc 2.28 or later they are defined in sys/sysmacros.h, in glibc 2.27 and earlier they were in
sys/types.h. On BSD-based systems and macOS they are in the sys/types.h.
Autoconf 2.70 has fixed the AC_HEADER_MAJOR macro, so it detects the headers properly due to glibc
2.25 throwing deprecation warnings when using the macros from sys/types.h. With Autoconf 2.69 and
earlier the ac_cv_header_sys_types_h_makedev cache variable can skip the improper sys/types.h check
in the macro.
This change syncs the usage within the ext/fileinfo/libmagic bundled library and ext/posix.
When sys/mkdev.h header is available, code includes that, otherwise it conditionally includes the
sys/sysmacros.h. The ext/posix has additional check whether linker sees the makedev, otherwise it
checks if makedev is declared within the given set of headers accoring to the AC_HEADER_MAJOR logic.
Previously the AC_CHECK_FUNCS didn't detect it.