On Mon, Jul 31, 2023 at 7:18 PM Eric Gallager <eg...@gwmail.gwu.edu> wrote: > > I am on Darwin, where libtool sets shrext_cmds to `test .$module = > .yes && echo .so || echo .dylib`. In the project's configure.ac, there > is code that does this: > > AC_DEFINE_UNQUOTED([SHARED_LIB_EXT],["${shrext_cmds}"], > [Extension of a shared library])dnl > > This preprocessor macro, SHARED_LIB_EXT, then gets used in calls to > dlopen(), but unfortunately this leads to errors like this: > > Impossible to load libscifunctions`test .$module = .yes && echo .so || > echo .dylib` library: > dlopen(/Users/ericgallager/scilab/scilab/modules/functions/.libs/libscifunctions`test > .$module = .yes && echo .so || echo .dylib`, 10): image not found > > As you can see, shrext_cmds have been passed as a string literal into > the code using it. Is there a way that I can get the variable to be > evaluated first before substituting it? i.e. I want the result of > running the command, not the literal string for the command itself. > Sorry if this is an extremely beginner-level question; all my > experience with shells and such is self-taught, and I never really > learned the basics properly. > Thanks, > Eric Gallager
...never mind, I figured out the proper usage of eval to get the result that I wanted. Perhaps libtool could provide two versions of the shrext_cmds variable, one that has been run through eval, and one that hasn't, so that users don't have to do this ourselves? Just a suggestion. Thanks, Eric Gallager