diff --git a/0001-configure-Also-save-LDFLAGS-when-checking-compilabil.patch b/0001-configure-Also-save-LDFLAGS-when-checking-compilabil.patch new file mode 100644 index 0000000..3fc4cb6 --- /dev/null +++ b/0001-configure-Also-save-LDFLAGS-when-checking-compilabil.patch @@ -0,0 +1,60 @@ +From cbf272602f382bbe9a70b85c7041eced1b6fe806 Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +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 +--- + 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 + diff --git a/0002-configure-Ensure-with-geos-sfcgal-fail-if-unavailabl.patch b/0002-configure-Ensure-with-geos-sfcgal-fail-if-unavailabl.patch new file mode 100644 index 0000000..3e62cf3 --- /dev/null +++ b/0002-configure-Ensure-with-geos-sfcgal-fail-if-unavailabl.patch @@ -0,0 +1,100 @@ +From b795a67c570e021ea5e092c878c02996ed67f732 Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Mon, 22 Feb 2021 20:29:40 -0500 +Subject: [PATCH 2/2] configure: Ensure --with-geos/sfcgal fail if unavailable. + +Signed-off-by: Elliott Sales de Andrade +--- + gdal/m4/geos.m4 | 19 +++++++++++++++++-- + gdal/m4/sfcgal.m4 | 18 ++++++++++++++++-- + 2 files changed, 33 insertions(+), 4 deletions(-) + +diff --git gdal/m4/geos.m4 gdal/m4/geos.m4 +index dc31e7466d..1c68503974 100644 +--- gdal/m4/geos.m4 ++++ gdal/m4/geos.m4 +@@ -59,7 +59,9 @@ AC_DEFUN([GEOS_INIT],[ + elif test x"$with_geos" = x"yes" -o x"$with_geos" = x"" ; then + + AC_PATH_PROG(GEOS_CONFIG, geos-config, no) +- ac_geos_config_auto=yes ++ if test x"$with_geos" = x"" ; then ++ ac_geos_config_auto=yes ++ fi + + else + +@@ -140,7 +142,14 @@ AC_DEFUN([GEOS_INIT],[ + ) + + if test x"$HAVE_GEOS" = "xno"; then +- GEOS_CFLAGS="" ++ if test $ac_geos_config_auto = "yes" ; then ++ AC_MSG_WARN([GEOS was found on your system, but the library could not be linked. GEOS support disabled.]) ++ else ++ AC_MSG_ERROR([GEOS library could not be linked]) ++ fi ++ ++ GEOS_CFLAGS="" ++ + fi + + CFLAGS="${ax_save_CFLAGS}" +@@ -149,6 +158,12 @@ AC_DEFUN([GEOS_INIT],[ + + fi + ++ else ++ ++ if test $ac_geos_config_auto = "no" ; then ++ AC_MSG_ERROR([GEOS support explicitly enabled, but geos-config could not be found]) ++ fi ++ + fi + ]) + +diff --git gdal/m4/sfcgal.m4 gdal/m4/sfcgal.m4 +index 993b7521d6..2384f0f0dc 100644 +--- gdal/m4/sfcgal.m4 ++++ gdal/m4/sfcgal.m4 +@@ -58,7 +58,9 @@ AC_DEFUN([SFCGAL_INIT],[ + elif test x"$with_sfcgal" = x"yes" -o x"$with_sfcgal" = x"" ; then + + AC_PATH_PROG(SFCGAL_CONFIG, sfcgal-config, no) +- ac_sfcgal_config_auto=yes ++ if test x"$with_sfcgal" = x"" ; then ++ ac_sfcgal_config_auto=yes ++ fi + + else + +@@ -140,7 +142,13 @@ AC_DEFUN([SFCGAL_INIT],[ + + + if test x"$HAVE_SFCGAL" = "xno"; then +- SFCGAL_CFLAGS="" ++ if test $ac_sfcgal_config_auto = "yes" ; then ++ AC_MSG_WARN([SFCGAL was found on your system, but the library could not be linked. SFCGAL support disabled.]) ++ else ++ AC_MSG_ERROR([SFCGAL library could not be linked]) ++ fi ++ ++ SFCGAL_CFLAGS="" + fi + + CFLAGS="${ax_save_CFLAGS}" +@@ -149,5 +157,11 @@ AC_DEFUN([SFCGAL_INIT],[ + + fi + ++ else ++ ++ if test $ac_sfcgal_config_auto = "no" ; then ++ AC_MSG_ERROR([SFCGAL support explicitly enabled, but sfcgal-config could not be found]) ++ fi ++ + fi + ]) +-- +2.29.2 + diff --git a/gdal.spec b/gdal.spec index 6040527..c391b97 100644 --- a/gdal.spec +++ b/gdal.spec @@ -45,7 +45,7 @@ Name: gdal Version: 3.2.1 -Release: 8%{?dist}%{?bootstrap:.%{bootstrap}.bootstrap} +Release: 9%{?dist}%{?bootstrap:.%{bootstrap}.bootstrap} Summary: GIS file format library License: MIT URL: http://www.gdal.org @@ -79,6 +79,10 @@ Patch8: %{name}-gcc11.patch Patch9: gdal_no-diag-disable.patch # Increase some testing tolerances for new Proj. Patch10: gdalautotest-increase-tolerances.patch +# Fix GEOS and SFCGAL checks: +# https://github.com/OSGeo/gdal/pull/3476 +Patch11: 0001-configure-Also-save-LDFLAGS-when-checking-compilabil.patch +Patch12: 0002-configure-Ensure-with-geos-sfcgal-fail-if-unavailabl.patch BuildRequires: gcc @@ -687,6 +691,9 @@ popd #Or as before, using ldconfig %changelog +* Tue Feb 23 2021 Elliott Sales de Andrade - 3.2.1-9 +- Fix compile against GEOS on s390x + * Sat Feb 13 2021 Sandro Mani - 3.2.1-8 - Rebuild (geos)