jchelly / gadgetviewer

Simple tool for interactive visualisation of Gadget and SWIFT N-body simulations
GNU General Public License v3.0
24 stars 9 forks source link

Use library flags in Automake check for Glib config file parser #18

Closed calvin-sykes closed 2 years ago

calvin-sykes commented 2 years ago

This is a tiny fix to the configure script so that if you use --with-libglib-2.0 to specify a path to Glib, that path is used when the separate test for the config file parser is done.

Otherwise, if Glib is installed somewhere non-standard (e.g. homebrew on Mac) the config parser won't be found even if it is actually available and so the automatic reading of extra datasets silently fails.

jchelly commented 2 years ago

Thanks Calvin. I'll merge that in.

If you're having to set lots of --with flags to make it find libraries you could try setting the environment variable PKG_CONFIG_PATH instead. E.g. if your packages are in /opt/local/ then I think PKG_CONFIG_PATH=/opt/local/lib/pkgconfig/ should do it (although I haven't tried building gadgetviewer on a mac in a long time).

calvin-sykes commented 2 years ago

Thanks for the tip! With pkg-config set up this fix is still needed (so that the path it found gets passed into the configure test) but I've mistakenly used a variable that only gets set if pkg-config wasn't found.

If you reopen the PR I've pushed a new commit that corrects this, or if it's easier to just make the change locally, line 66 in configure.ac should be changed to

LDFLAGS="${LDFLAGS} ${GLIB_LIBS}"

With that change the build works correctly with or without pkg-config, and the only --with flag I still need is for HDF5 as for some reason its homebrew package doesn't support pkg-config.

jchelly commented 2 years ago

Ok, thanks, I've pushed the new commit.