From ed22b8d7473ea42e4167b03cfa096ffea26ee048 Mon Sep 17 00:00:00 2001 From: George Stagg Date: Mon, 8 Apr 2024 08:42:43 +0100 Subject: [PATCH] Mechanism to override AC_CHECK_FUNCS in Autoconf For R packages using Autoconf, we'll sometimes need to be able to force the result of AC_CHECK_FUNCS. For example, for the `uuid` package Autoconf sets `HAVE_GETRANDOM`. Despite compiling OK, using `getrandom()` at the time of writing in fact fails for R packages compiled using Emscripten, due to a missing symbol. Autoconf missed this because we compile R packages with the `SIDE_MODULE=1` flag, and with this flag Emscripten does not complain about the missing symbols. So, using this mechanism we can force Autoconf to return "no" when checking for `getrandom()`, fixing the issue with `uuid`. --- inst/configure | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inst/configure b/inst/configure index b0cb6d6..1b49c67 100755 --- a/inst/configure +++ b/inst/configure @@ -9,5 +9,8 @@ # Additional specific R package fixes export STRINGI_CPPFLAGS=-DU_HAVE_MMAP=0 +# Override specific Autoconf results for Emscripten environment +AC_FUNC_OVERRIDES='ac_cv_func_getrandom=no' + # sh is needed for scripts without shebang -emconfigure sh -c "./configure.orig --build=$BUILD_PLATFORM --host=wasm32-unknown-emscripten" +emconfigure sh -c "./configure.orig --build=$BUILD_PLATFORM --host=wasm32-unknown-emscripten $AC_FUNC_OVERRIDES"