Blob Blame History Raw
From cbf272602f382bbe9a70b85c7041eced1b6fe806 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Mon, 22 Feb 2021 18:00:56 -0500
Subject: [PATCH 1/2] configure: Also save LDFLAGS when checking compilability.

There may be corresponding flags in the environment between CFLAGS and
LDFLAGS. If CFLAGS is overwritten, then LDFLAGS should be as well, or it
may cause compile tests to fail erroneously.

Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
 gdal/m4/geos.m4   | 3 +++
 gdal/m4/sfcgal.m4 | 3 +++
 2 files changed, 6 insertions(+)

diff --git gdal/m4/geos.m4 gdal/m4/geos.m4
index eb5cb19e09..dc31e7466d 100644
--- gdal/m4/geos.m4
+++ gdal/m4/geos.m4
@@ -129,6 +129,8 @@ AC_DEFUN([GEOS_INIT],[
       LIBS=${GEOS_LIBS}
       ax_save_CFLAGS="${CFLAGS}"
       CFLAGS="${GEOS_CFLAGS}"
+      ax_save_LDFLAGS="${LDFLAGS}"
+      LDFLAGS=""
 
       AC_CHECK_LIB([geos_c],
         [GEOSversion],
@@ -143,6 +145,7 @@ AC_DEFUN([GEOS_INIT],[
 
       CFLAGS="${ax_save_CFLAGS}"
       LIBS="${ax_save_LIBS}"
+      LDFLAGS="${ax_save_LDFLAGS}"
 
     fi
 
diff --git gdal/m4/sfcgal.m4 gdal/m4/sfcgal.m4
index 4dcebb7301..993b7521d6 100644
--- gdal/m4/sfcgal.m4
+++ gdal/m4/sfcgal.m4
@@ -128,6 +128,8 @@ AC_DEFUN([SFCGAL_INIT],[
       LIBS=${SFCGAL_LIBS}
       ax_save_CFLAGS="${CFLAGS}"
       CFLAGS="${SFCGAL_CFLAGS}"
+      ax_save_LDFLAGS="${LDFLAGS}"
+      LDFLAGS=""
 
       AC_CHECK_LIB([SFCGAL],
         [sfcgal_version],
@@ -143,6 +145,7 @@ AC_DEFUN([SFCGAL_INIT],[
 
       CFLAGS="${ax_save_CFLAGS}"
       LIBS="${ax_save_LIBS}"
+      LDFLAGS="${ax_save_LDFLAGS}"
 
     fi
 
-- 
2.29.2