GNOME Bugzilla – Bug 353239
Get rid of AC_DEFINE_DIR
Last modified: 2015-10-13 01:47:30 UTC
Please describe the problem: The AC_DEFINE_DIR used in configure.in does not behave correctly with NetBSD's default shell. The macro tries to expand the given variable, which holds a directory, but due to the code it uses, the value ends up prefixed with the current process identifier as in: vardir="19832${prefix}/somewhere". As you can imagine this causes all sorts of "random" problems at run time because many applets are not able to locate their data files. An example is Sticky Notes crashing completely when creating a new note. A trivial solution could be to update the package to use the latest AC_DEFINE_DIR code, which I tink solves these problems. Unfortunately, this is not the best solution and is likely to cause other problems in the future. See below. According to GNU Autoconf's documentation (see autoconf.info, "19.5 How Do I `#define' Installation Directories?"), expanding a directory variable from the configure script is incorrect for two reasons: 1. Expanding the variable prevents the user from modifying variables at installation time as in "make install datadir=/my/data/directory". Doing so should affect all variables that rely on 'datadir' (e.g. gladedir=${datadir}/glade), but this does not work if the variables were expanded by the configure script (because the "dependency" is lost). 2. Nothing warrants that there is a determinate amount of expansions required before the variable is usable. The AS_AC_EXPAND macro introduced recently tries to achieve this by implementing a loop, but is still insufficient because it does not solve the prior point. Instead, the configure script has to AC_SUBST the directory variables and let the Makefiles expand them at build/install time. As a result, extra -D flags are needed in compiler calls to pass the directory macros to source files, and some non-C files (such as invest-applet/invest/defs.py.in) need to be generated using sed and not from AC_OUTPUT. Steps to reproduce: 1. Install gnome-applets under NetBSD. 2. Add the Sticky Notes applet to the panel. 3. Double click on the new applet 4. See it crash because it is not able to find the .glade file. Actual results: Expected results: Does this happen every time? Other information:
Created attachment 71769 [details] [review] Proposed patch. This patch changes the build system to substitute all directory variables at build time. It is quite big so it should be applied as soon as possible to avoid becoming obsolete. I hope to have got it right, but I have been unable to test it completely. I currently lack a 2.15/2.16 GNOME installation so have tested gnome-applets' CVS head against GNOME 2.14.3 as much as possible. Before commiting it, it's highly recommended that you do a full clean build of this package and install it on your system to do some basic tests afterwards and see that nothing serious breaks. By the way: note that some directory variables were renamed. I did this for consistency among them and inside the package: some applets were using e.g. GNOME_GLADEDIR while other were using simply GLADEDIR.
I think we should clean this up too. Other packages are using: gnome-panel, nautilus: libpanel-applet/Makefile.am: -DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \ totem: browser-plugin/Makefile.am: -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ Can we agree on one scheme for doing this across the project maybe? :-)