Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check major, minor and makedev with Autoconf's AC_HEADER_MAJOR (#13706)
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_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.
- Loading branch information