From 2382b3fe3e609e99ee1742b872de5b4ae61b2ecc Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sat, 20 Mar 2021 17:09:36 -0500
Subject: [PATCH v2 06/10] ./configure: Avoid warnings on Mac --with-lz4

Reported by Andrey Borodin and Tom Lane.

>>> configure: WARNING: lz4.h: accepted by the compiler, rejected by the preprocessor!
>>> configure: WARNING: lz4.h: proceeding with the compiler's result

Possibly we could instead just *remove* the AC_CHECK_HEADERS?
---
 configure    | 6 ++++++
 configure.ac | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/configure b/configure
index 6d34243dca..fa2b7692ca 100755
--- a/configure
+++ b/configure
@@ -13522,6 +13522,10 @@ fi
 fi
 
 if test "$with_lz4" = yes; then
+  ac_save_CPPFLAGS=$CPPFLAGS
+  CPPFLAGS="$LZ4_CFLAGS $CPPFLAGS"
+
+  # Verify we have LZ4's header files
   for ac_header in lz4/lz4.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "lz4/lz4.h" "ac_cv_header_lz4_lz4_h" "$ac_includes_default"
@@ -13549,6 +13553,8 @@ fi
 
 done
 
+
+  CPPFLAGS=$ac_save_CPPFLAGS
 fi
 
 if test "$with_gssapi" = yes ; then
diff --git a/configure.ac b/configure.ac
index e54e2fb632..bd92643a3b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1426,8 +1426,14 @@ Use --without-zlib to disable zlib support.])])
 fi
 
 if test "$with_lz4" = yes; then
+  ac_save_CPPFLAGS=$CPPFLAGS
+  CPPFLAGS="$LZ4_CFLAGS $CPPFLAGS"
+
+  # Verify we have LZ4's header files
   AC_CHECK_HEADERS(lz4/lz4.h, [],
        [AC_CHECK_HEADERS(lz4.h, [], [AC_MSG_ERROR([lz4.h header file is required for LZ4])])])
+
+  CPPFLAGS=$ac_save_CPPFLAGS
 fi
 
 if test "$with_gssapi" = yes ; then
-- 
2.17.0

