On FreeBSD the definition exists in <stdlib.h> --- configure.ac | 1 + filters/cache/cache.c | 5 ++++- filters/cow/cow.c | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 87f14d6..3381955 100644 --- a/configure.ac +++ b/configure.ac @@ -130,6 +130,7 @@ CFLAGS="${acx_nbdkit_save_CFLAGS}" dnl Check for other headers, all optional. AC_CHECK_HEADERS([\ + alloca.h \ byteswap.h \ endian.h \ selinux/selinux.h \ diff --git a/filters/cache/cache.c b/filters/cache/cache.c index 76a0438..90a0444 100644 --- a/filters/cache/cache.c +++ b/filters/cache/cache.c @@ -39,7 +39,6 @@ #include <stdbool.h> #include <string.h> #include <inttypes.h> -#include <alloca.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> @@ -47,6 +46,10 @@ #include <sys/ioctl.h> #include <assert.h> +#ifdef HAVE_ALLOCA_H +#include <alloca.h> +#endif + #include <nbdkit-filter.h> #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) diff --git a/filters/cow/cow.c b/filters/cow/cow.c index 2f86f6c..5df1db2 100644 --- a/filters/cow/cow.c +++ b/filters/cow/cow.c @@ -77,13 +77,16 @@ #include <stdbool.h> #include <string.h> #include <inttypes.h> -#include <alloca.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <sys/types.h> #include <sys/ioctl.h> +#ifdef HAVE_ALLOCA_H +#include <alloca.h> +#endif + #include <nbdkit-filter.h> #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) -- 2.18.0