diff --git a/lib/libpg_query/Makefile b/lib/libpg_query/Makefile index 9eca568..5d3f608 100644 --- a/lib/libpg_query/Makefile +++ b/lib/libpg_query/Makefile @@ -155,7 +155,8 @@ extract_source: $(PGDIR) # Avoid dependency on cpuid.h (only supported on x86 systems) echo "#undef HAVE__GET_CPUID" >> ./src/postgres/include/pg_config.h # Ensure we don't fail on systems that have strchrnul support (FreeBSD) - echo "#ifdef __FreeBSD__" >> ./src/postgres/include/pg_config.h + echo "#include " >> $(PGDIR)/src/include/pg_config.h + echo "#if defined(__FreeBSD__) || defined(__NetBSD__) || (defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || __GLIBC__ > 2))" >> $(PGDIR)/src/include/pg_config.h echo "#define HAVE_STRCHRNUL" >> ./src/postgres/include/pg_config.h echo "#endif" >> ./src/postgres/include/pg_config.h # Copy version information so its easily accessible diff --git a/lib/libpg_query/src/postgres/include/pg_config.h b/lib/libpg_query/src/postgres/include/pg_config.h index 7808cc8..0f38b3c 100644 --- a/lib/libpg_query/src/postgres/include/pg_config.h +++ b/lib/libpg_query/src/postgres/include/pg_config.h @@ -990,6 +990,7 @@ #undef HAVE_EXECINFO_H #undef HAVE_BACKTRACE_SYMBOLS #undef HAVE__GET_CPUID -#ifdef __FreeBSD__ +#include +#if defined(__FreeBSD__) || defined(__NetBSD__) || (defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || __GLIBC__ > 2)) #define HAVE_STRCHRNUL #endif