[augeas-devel] [PATCH] Put the default dir for lenses into DATADIR (the real fix)

David Lutterkort dlutter at redhat.com
Mon Jul 7 22:34:38 UTC 2008


5 files changed, 21 insertions(+), 11 deletions(-)
Makefile.am       |    2 +-
configure.ac      |    7 -------
src/Makefile.am   |   14 ++++++++++++++
src/internal.h    |    6 ++++--
tests/Makefile.am |    3 ++-


# HG changeset patch
# User David Lutterkort <dlutter at redhat.com>
# Date 1215470071 25200
# Node ID 72651f77f2924aa102d48bc0e62fd807b5ca2435
# Parent  ef0102907692982da3d05567db1c6049e4c23e68
Put the default dir for lenses into DATADIR (the real fix)

Reworks 527:14602e2757dd in a way that actually works and conforms to the
GNU coding standards.

Most of this fix suggested by Jim Meyering, I only touched it up a little
(and no doubt introduced all the bugs).

diff -r ef0102907692 -r 72651f77f292 Makefile.am
--- a/Makefile.am	Mon Jul 07 10:46:41 2008 -0700
+++ b/Makefile.am	Mon Jul 07 15:34:31 2008 -0700
@@ -8,7 +8,7 @@
 dist_lens_DATA=$(wildcard lenses/*.aug)
 dist_lenstest_DATA=$(wildcard lenses/tests/*.aug)
 
-EXTRA_DIST=augeas.spec
+EXTRA_DIST=augeas.spec build/aux/move-if-change
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = augeas.pc
diff -r ef0102907692 -r 72651f77f292 configure.ac
--- a/configure.ac	Mon Jul 07 10:46:41 2008 -0700
+++ b/configure.ac	Mon Jul 07 15:34:31 2008 -0700
@@ -32,13 +32,6 @@
 
 gl_INIT
 
-dnl This is a pretty hackish way to expand all the variable references
-dnl in DATADIR. In the end, we want a full absolute path
-eval aug_lens_dir=$datadir/augeas/lenses
-eval aug_lens_dir=$aug_lens_dir
-AC_DEFINE_UNQUOTED([AUGEAS_LENS_DIR], "$aug_lens_dir",
-                   "The default location for lens definitions")
-
 AC_OUTPUT(Makefile \
           gnulib/lib/Makefile \
           gnulib/tests/Makefile \
diff -r ef0102907692 -r 72651f77f292 src/Makefile.am
--- a/src/Makefile.am	Mon Jul 07 10:46:41 2008 -0700
+++ b/src/Makefile.am	Mon Jul 07 15:34:31 2008 -0700
@@ -7,6 +7,10 @@
 AM_YFLAGS=-d -p spec_
 
 EXTRA_DIST=try augeas_sym.version
+
+BUILT_SOURCES = datadir.h
+
+DISTCLEANFILES = datadir.h
 
 lib_LTLIBRARIES = libfa.la libaugeas.la
 noinst_LTLIBRARIES = liblexer.la
@@ -33,3 +37,13 @@
 
 liblexer_la_SOURCES = lexer.l
 liblexer_la_CFLAGS = $(AM_CFLAGS) -Wno-error
+
+# Generate datadir.h. AUGEAS_LENS_DIR in internal.h depends on
+# the value of DATADIR
+internal.h: datadir.h
+
+.FORCE-datadir.h: Makefile
+	echo '#define DATADIR "$(abspath $(datadir))"' > datadir.h1
+	$(top_srcdir)/build/aux/move-if-change datadir.h1 datadir.h
+
+datadir.h: .FORCE-datadir.h
diff -r ef0102907692 -r 72651f77f292 src/internal.h
--- a/src/internal.h	Mon Jul 07 10:46:41 2008 -0700
+++ b/src/internal.h	Mon Jul 07 15:34:31 2008 -0700
@@ -26,6 +26,7 @@
 #define DEBUG
 
 #include "list.h"
+#include "datadir.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -37,9 +38,10 @@
 
 /*
  * Various parameters about env vars, special tree nodes etc.
- * Some of them should be turned into buildtime configurables
- *
  */
+
+/* The default location for lens definitions */
+#define AUGEAS_LENS_DIR DATADIR "/augeas/lenses"
 
 /* The env var that points to the chroot holding files we may modify.
    Mostly useful for testing */
diff -r ef0102907692 -r 72651f77f292 tests/Makefile.am
--- a/tests/Makefile.am	Mon Jul 07 10:46:41 2008 -0700
+++ b/tests/Makefile.am	Mon Jul 07 15:34:31 2008 -0700
@@ -3,7 +3,8 @@
 GNULIB= ../gnulib/lib/libgnu.la
 GNULIB_CFLAGS= -I $(top_srcdir)/gnulib/lib
 
-AM_CFLAGS = $(AUGEAS_CFLAGS) $(WARN_CFLAGS) $(GNULIB_CFLAGS)
+AM_CFLAGS = $(AUGEAS_CFLAGS) $(WARN_CFLAGS) $(GNULIB_CFLAGS) \
+	-I $(top_builddir)/src
 
 valgrind: fatest
 	libtool --mode=execute valgrind --quiet --leak-check=full ./fatest




More information about the augeas-devel mailing list