Brad Jorsch <[email protected]> wrote:
> Autoconf uses multiple levels of variables when defining paths. For
> example, ${datadir} by default is ${datarootdir}, which by default is
> ${prefix}/share, which by default is /usr/local. Substituting from
> ./configure, as is done by AC_DEFINE or AC_DEFINE_UNQUOTED, does not
> expand all these variables. This was causing some of our defines to have
> garbage like "${prefix}/share/pixmaps" rather than the intended
> "/usr/local/share/pixmaps".
> The solution is to generate the files needing these paths from the
> Makefile rather than from ./configure, because make does fully expand
> all those levels.
[...]
> diff --git a/Makefile.am b/Makefile.am
> index 8f7b6b0..7b92502 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -1,5 +1,34 @@
> ## Process this file with automake to produce Makefile.in
[...]
> +config-paths.h: Makefile
> + @echo "Generating $@"
> + @echo '/* where shared data is stored */' >> $@
> + @echo '#define PKGDATADIR "$(pkgdatadir)/WindowMaker"' >> $@
[...]
> diff --git a/configure.ac b/configure.ac
> index 89bde42..d2724cd 100644
> --- a/configure.ac
> +++ b/configure.ac
[...]
> -pkgdatadir=`eval echo $datadir`
> -AC_DEFINE_UNQUOTED(PKGDATADIR, "$pkgdatadir/WindowMaker", [where shared data
> is stored (defined by configure)])
> -
> -
> -_sysconfdir=`eval echo $sysconfdir`
> -AC_DEFINE_UNQUOTED(SYSCONFDIR, "$_sysconfdir", [where the configuration is
> stored (defined by configure)])
> +pkgdatadir='${datadir}'
> +AC_SUBST(pkgdatadir)
[...]
Hello,
I think this introduces a bug.
autoconf variable pkgdatadir suddenly points to /usr/share instead
of /usr/share/WindowMaker. This causes installation of the files in
prefsdata_DATA (e.g autostart.sh) in WindowMaker/Makefile* to end up
in /usr/share/ instead of /usr/share/WindowMaker.
Also I cannot understand why it is a good thing that autoconfs idea
of pkgdatadir differs from the C-#define PKGDATADIR).
cu andreas
--
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'
>From bacacad4eda8e009a421f713c2182822716c21ba Mon Sep 17 00:00:00 2001
From: Andreas Metzler <[email protected]>
Date: Sat, 16 Oct 2010 15:41:37 +0200
Subject: [PATCH 1/2] point ac's $pkgdatadir to ${datadir}/WindowMaker
Fix regression from "Fix path substitutions" patch. Make sure that
*both* the autoconf variable pkgdatadir and the C macro have the correct
value ${datadir}/WindowMaker (i.e. /usr/share/WindowMaker).
---
Makefile.am | 2 +-
configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index c75cb24..96dfc68 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,7 +24,7 @@ config-paths.h: Makefile
@echo '#define PIXMAPDIR "$(pixmapdir)"' >> $@
@echo '' >> $@
@echo '/* where shared data is stored */' >> $@
- @echo '#define PKGDATADIR "$(pkgdatadir)/WindowMaker"' >> $@
+ @echo '#define PKGDATADIR "$(pkgdatadir)"' >> $@
@echo '' >> $@
@echo '/* where the configuration is stored */' >> $@
@echo '#define SYSCONFDIR "$(sysconfdir)"' >> $@
diff --git a/configure.ac b/configure.ac
index 15145fd..ff6fac1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -820,7 +820,7 @@ else
fi
AC_SUBST(pixmapdir)
-pkgdatadir='${datadir}'
+pkgdatadir='${datadir}/WindowMaker'
AC_SUBST(pkgdatadir)
--
1.7.1