Source: cpl
Version: 7.1-3
Tags: patch upstream
User: helm...@debian.org
Usertags: rebootstrap
cpl fails to cross build from source, because it uses AC_RUN_IFELSE to
check the version of cfitsio. It does so in a quite questionable way.
For instance, the check - as currently implemented - would consier
version 3.4 greater than 3.350. It would also consider version 3.35
equal to 3.350. My patch changes that and makes the version check behave
"sanely". We can avoid AC_RUN_IFELSE, by not checking CFITSIO_VERSION
and instead checking CFITSIO_MAJOR and CFITSIO_MINOR. The latter two are
integers and AC_COMPUTE_INT works with cross compilation.
The patch only fixes one AC_RUN_IFELSE. It's quite invasive already, so
I'm filing it as an incremental improvement. At the same time, it is
quite a simplification. I intend to work on further AC_RUN_IFELSE if it
is acceptable (preferably upstream). Please close this bug when removing
that particular AC_RUN_IFELSE.
Helmut
--- cpl-7.1.orig/m4/cpl.m4
+++ cpl-7.1/m4/cpl.m4
@@ -171,41 +171,17 @@
CFLAGS="$CFITSIO_CFLAGS"
LDFLAGS="$CFITSIO_LDFLAGS"
LIBS="$LIBCFITSIO"
-
-AC_RUN_IFELSE([AC_LANG_PROGRAM(
- [[
- #include
- #include
- ]],
- [
- int vlib = 0;
- int vmin = (int)(1000. * $cpl_cfitsio_check_version + 0.5);
-
- float v = CFITSIO_VERSION;
-
- vlib = (int)(v * 1000 + 0.5);
-
- FILE* f = fopen("conftest.out", "w");
- fprintf(f, "%5.3f\n", v);
- fclose(f);
-
- if (vlib < vmin) {
- return 1;
- }
-
- return 0;
- ])],
- [
- cpl_cfitsio_version="`cat conftest.out`";
- rm -f conftest.out
- ],
- [
- cpl_cfitsio_version="no";
- cpl_cfitsio_version_found="unknown";
- test -r conftest.out && cpl_cfitsio_version_found="`cat conftest.out`";
- rm -f conftest.out
- ])
-
+
+ cpl_cfitsio_version=
+ AC_COMPUTE_INT([CFITSIO_MAJOR],[CFITSIO_MAJOR],[#include ],[cpl_cfitsio_version=no])
+ AC_COMPUTE_INT([CFITSIO_MINOR],[CFITSIO_MINOR],[#include ],[cpl_cfitsio_version=no])
+ AS_IF([test x$cpl_cfitsio_version = xno],
+ [AC_MSG_ERROR([version of cfitsio could not be determined])],
+ [cpl_cfitsio_version=$CFITSIO_MAJOR.$CFITSIO_MINOR])
+ AS_VERSION_COMPARE([$cpl_cfitsio_check_version],
+ [$cpl_cfitsio_version],[],[],
+ [AC_MSG_ERROR([Installed cfitsio ($cpl_cfitsio_version) is too old])])
+
AC_MSG_RESULT([$cpl_cfitsio_version])
AC_LANG_POP(C)
@@ -215,20 +191,9 @@
LIBS="$cpl_cfitsio_libs_save"
-if test x"$cpl_cfitsio_version" = xno; then
-
-AC_MSG_ERROR([Installed cfitsio ($cpl_cfitsio_version_found) is too old])
-
-CFITSIO_INCLUDES=""
-CFITSIO_CFLAGS=""
-CFITSIO_LDFLAGS=""
-LIBCFITSIO=""
-
-else
AC_DEFINE_UNQUOTED([CPL_CFITSIO_VERSION],
[$cpl_cfitsio_version],
[Minimum required version of CFITSIO])
-fi
fi
--- cpl-7.1.orig/configure.ac
+++ cpl-7.1/configure.ac
@@ -70,7 +70,7 @@
AC_CHECK_LIB(nsl, inet_ntoa, [LIBS="$LIBS -lnsl"])
CPL_CONFIG_CEXT
-CPL_CONFIG_CFITSIO([3.350])
+CPL_CONFIG_CFITSIO([3.35])
CPL_CHECK_WCS([4.16])
CPL_CHECK_FFTW([3.3.3])