autoguess provides a static, preprocessor-based feature detection header, config.h.guess, as an alternative or complement to a dynamically generated autoconf-based config.h. It can be used directly (e.g. via #include) or simply farmed for [relatively] up-to-date feature detection logic tested against modern Unix-like systems--DragonFly BSD, FreeBSD, Linux/glibc, Linux/musl, macOS, NetBSD, OpenBSD, and Solaris. (AIX support is frozen at 7.1 and not presently updated since the loss of Polar Home's AIX environment.)
config.h.guess relies on the evaluation of the defined operator in macro expansions for some critical feature detection tests. Such evaluation is technically undefined behavior according to the C standard, but has been historically supported by Unix compilers, and will continue to be supported. In many cases there is no reasonable alternative to this facility without requiring inclusion of dependent headers prior to inclusion of config.h.guess, which runs completely counter to how autoconf config.h has traditionally been used. Importantly, some of these headers, particularly pthread.h, could potentially change program behavior if they otherwise wouldn't have been included. And config.h.guess must be the first included header for AG_USE_SYSTEM_EXTENSIONS and AG_SYS_LARGEFILE feature selection to function properly. (Note that config.h.guess still needs to include some headers automatically, depending on platform.) Microsoft Visual Studio does not support defined expansions, at least in object-like macros. For this and other reasons Visual Studio remains an unsupported host environment for now.
Investigate whether defined operator expansion in function-like macros can be used for Visual Studio support. See this thread discussing different behaviors between function-like and object-like macros. Does it work as claimed even if the function-like macro is invoked from an object-like macro?
Update DragonFly BSD feature checks (tested 6.2).
Add checks for consttime_memequal, explicit_bzero, explicit_memset, memset_s, timingsafe_bcmp, and timingsafe_memcmp.
Belatedly add local project page and Git mirror under https://25thandClement.com/~william/projects/.
Fix AC_CHECK_HEADERS and AC_CHECK_FUNCS argument quoting in configure.ac (used for regression testing) to address Autoconf 2.71's deprecation of argument macro expansion in those macros.
Fix fallback logic for glibc <sys/sysctl.h> detection when __has_include is unavailable.
Build regression tests with -Wno-expansion-to-defined by default. This is a clang- and GCC-specific flag, but it's silently ignored by recent versions of Solaris Studio (tested Studio 12.6/Sun C 5.15; failed Sun C 5.13). Disable by defining the WARN_CFLAGS Makefile macro:
make WARN_CFLAGS= check.
Copyright (c) 2015-2019,2021-2022 William Ahern
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
git clone https://25thandClement.com/~william/projects/autoguess.git
Or browse the source code from the Github mirror.