ElementsProject / libwally-core

Useful primitives for wallets
Other
281 stars 135 forks source link

m4/ax_jni_include_dir: don't cache result #338

Closed whitslack closed 1 year ago

whitslack commented 1 year ago

The AX_JNI_INCLUDE_DIR macro was violating the first rule of AC_CACHE_CHECK: "The commands-to-set-it must have no side effects except for setting the variable cache-id." Specifically, JNI_INCLUDE_DIRS was being modified within the code block that was only supposed to be setting the value of ac_cv_jni_header_path. This was causing JNI_INCLUDE_DIRS to be incorrect/incomplete when ac_cv_jni_header_path was initialized from an Autoconf cache file.

Since the tests to find the JNI header paths are so trivial, there is nothing to be gained by caching the results. The most straightforward fix is not to cache, and that is the fix provided in this PR.

This PR is based on a patch that I submitted to GNU Savannah, but that patch does not cleanly apply here because libwally-core's local copy is not in sync with the most recent version in the GNU Autoconf Archive.

jgriffiths commented 1 year ago

Merged, thanks!