From eff9c46bf58ba966b1cf3f23c77a6566492d37ab Mon Sep 17 00:00:00 2001 From: Antonio Nuno Monteiro Date: Mon, 23 Oct 2023 14:04:48 -0700 Subject: [PATCH] fix: builds on glibc >= 2.38 https://github.com/pganalyze/libpg_query/commit/9b21e3295402a0d0ee9a50c468d426c2dbb73ee6 --- lib/libpg_query/Makefile | 3 ++- lib/libpg_query/src/postgres/include/pg_config.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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