Search code examples
rgslcran

R CRAN Check: autoheader: warning: missing template: HAVE_GSL_HEADER autoheader: Use AC_DEFINE([HAVE_GSL_HEADER], [], [Description])


Recently a package on CRAN that I am maintaining gets the following error: (I did not change anything - error just was not present before - CRAN probably added additional checks)

Result: WARN Output from running autoreconf: autoheader: warning: missing template: HAVE_GSL_HEADER autoheader: Use AC_DEFINE([HAVE_GSL_HEADER], [], [Description]) autoreconf: /usr/bin/autoheader failed with exit status: 1 Flavors: r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc

Here is the link to the CRAN check page: https://cran.r-project.org/web/checks/check_results_ridge.html

The error seems to appear only for r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc.

Github Link to package Source Code: https://github.com/SteffenMoritz/ridge

The package uses the GSL lib. (if somebody wonders about the GSL in the error message)

Unfortunately I only overtook maintenance of the package and don't have too much idea about the C things.

I assume, the error message has nothing to do with the R part of the package. Do I have to add the AC_DEFINE somewhere in the C files?

Could somebody explain me, what exactly the error message says to me. Guess this might already help me to figure things out.

edit: Think I have to change something in this file (just a guess) https://github.com/SteffenMoritz/ridge/blob/master/configure.ac

But the code there is the following:

if test "${HAVE_GSL}" = TRUE; then
dnl Define HAVE_GSL_H in src/config.h
    AC_CHECK_HEADERS([gsl/gsl_version.h],AC_DEFINE(HAVE_GSL_HEADER), [HAVE_GSL=FALSE])
    if test "${HAVE_GSL}" = FALSE; then
       AC_MSG_WARN([gsl headers not found, perhaps check the path?])
       AC_MSG_WARN([ridge will be installed, but some functions will be 
unavailable])
    fi
fi

So it seems there is a statement AC_DEFINE(HAVE_GSL_HEADER), [HAVE_GSL=FALSE]).


Solution

  • Put the below into a file called diff.patch or whatever you like in the top directory.

    diff --git a/configure.ac b/configure.ac
    index e643140..0b256a6 100644
    --- a/configure.ac
    +++ b/configure.ac
    @@ -22,7 +22,8 @@ fi
    
     if test "${HAVE_GSL}" = TRUE; then
     dnl Define HAVE_GSL_H in src/config.h
    -    AC_CHECK_HEADERS([gsl/gsl_version.h],AC_DEFINE(HAVE_GSL_HEADER),[HAVE_GSL=FALSE])
    +    AC_CHECK_HEADERS([gsl/gsl_version.h],
    +    AC_DEFINE(HAVE_GSL_HEADER, [], [Description]),[HAVE_GSL=FALSE])
         if test "${HAVE_GSL}" = FALSE; then
            AC_MSG_WARN([gsl headers not found, perhaps check the path?])
            AC_MSG_WARN([ridge will be installed, but some functions will be unavailable])
    

    Run patch -p1 < diff.patch.
    Now autoreconf should rebuild all just fine.