autoconf_tutorial icon indicating copy to clipboard operation
autoconf_tutorial copied to clipboard

Add mention of AC_CACHE_VAL

Open rhelmot opened this issue 10 months ago • 2 comments

Hello! I'm trying to do a drive by contribution on an autoconf project in order to make it cross compile. I found this tutorial when looking for information on how to get past the fact that it is presently using a bare AC_RUN_IFELSE for a configuration check, and laughed out loud when I got to the part of the tutorial where it says, more or less, "don't do that :)".

I eventually found (by reading the bash source code of all things) that the right tool for the jobs is AC_CACHE_VAL. I think it would be nice if this tutorial mentioned that!

rhelmot avatar Feb 26 '25 22:02 rhelmot

I don't entirely follow. AC_CACHE_VAL retrieves something from the cache, AC_RUN_IFELSE checks if something ran. Are you referring to running the configure script in normal mode, then retrieving he cached value in cross compile mode?

I think I might be missing context on the specific problem here. Could you provide an example?

edrosten avatar Feb 27 '25 07:02 edrosten

AC_CACHE_VAL retrieves a value from the cache (or command line!) if it exists and otherwise runs a clause to generate it. A way I've seen to make programs that use AC_RUN_IFELSE able to cross compile is to hardcode the cached value as determined by running the script on the target machine into the command line of the build script.

rhelmot avatar Feb 27 '25 07:02 rhelmot