Message-ID: <26510.26056.951900.698722@rob.eddelbuettel.com>
Date: 2025-01-20T15:03:36Z
From: Dirk Eddelbuettel
Subject: [R-pkg-devel] Package builds on all systems except on Fedora with clang
In-Reply-To: <AM8PR10MB46602CEED17D226A6520A93FA7E42@AM8PR10MB4660.EURPRD10.PROD.OUTLOOK.COM>
On 19 January 2025 at 20:42, Pepijn de Vries wrote:
| I think I could write a similar test as used by `cpp11tesseract`:
|
| https://github.com/pachadotdev/cpp11tesseract/blob/2ea8287ef2c27901446bafa402728014d99904d4/configure#L66-L85
Taking an example from a package not on CRAN 'for policy violations' may not
be the safest best.
`autoconf` has included the ability to conduction these tests for a long
time. Here is an (old) snippet from RProtoBuf which uses a test file to
assert we have a recent enough version:
## also check for minimum version
AC_MSG_CHECKING([if ProtoBuf version >= 2.2.0])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <google/protobuf/stubs/common.h>
int main() {
if (GOOGLE_PROTOBUF_VERSION >= 2001000) {
exit (0);
} else {
exit(1);
}
}
]])],
[pb_version_ok=yes],
[pb_version_ok=no],
[pb_version_ok=yes])
if test x"${pb_version_ok}" = x"no"; then
AC_MSG_ERROR([Need ProtoBuf version >= 2.2.0])
else
AC_MSG_RESULT([yes])
fi
Note that this happens after we found suitable compiler and linker switches.
And of course, switching to `autoconf` is no small task either. But getting
an external library to build reliably on all platforms is one of the harder
things to set up at CRAN.
Dirk
--
dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org