diff --git a/Makefile b/Makefile index ef9b5a9a4..f32b0cc7b 100644 --- a/Makefile +++ b/Makefile @@ -312,6 +312,14 @@ config.h: echo '#define HAVE_ATTRIBUTE_TARGET 1' >> $@ echo '#define HAVE_BUILTIN_CPU_SUPPORT_SSSE3 1' >> $@ echo '#endif' >> $@ + echo '#if defined __linux__' >> $@ + echo '#define HAVE_GETAUXVAL' >> $@ + echo '#elif defined __FreeBSD__' >> $@ + echo '#define HAVE_ELF_AUX_INFO' >> $@ + echo '#elif defined __OpenBSD__' >> $@ + echo '// Enable extra OpenBSD checks (see simd.c)' >> $@ + echo '#define HAVE_OPENBSD' >> $@ + echo '#endif' >> $@ # And similarly for htslib.pc.tmp ("pkg-config template"). No dependency # on htslib.pc.in listed, as if that file is newer the usual way to regenerate diff --git a/simd.c b/simd.c index e936e8baa..014a370d6 100644 --- a/simd.c +++ b/simd.c @@ -42,6 +42,18 @@ DEALINGS IN THE SOFTWARE. */ #if defined __arm__ || defined __aarch64__ +#ifdef HAVE_OPENBSD +/* + * Extra check for elf_aux_info() on configure-less OpenBSD builds. Once + * version 7.5 has dropped off support, this can be changed to an assumption + * that the function exists in the Makefile-generated config.h. + */ +#include +#if OpenBSD >= 202409 +#define HAVE_ELF_AUX_INFO +#endif +#endif + #if defined HAVE_GETAUXVAL || defined HAVE_ELF_AUX_INFO #include #elif defined __APPLE__