The AC_DEFINE_QUOTED scheme falls over if the autoconf variable requires
expansion. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=385769.

Define a config.h file autogenerated by the build system and let 'make'
do the variable expansion.

Cc: Qi Fuli <qi.f...@jp.fujitsu.com>
Signed-off-by: Dan Williams <dan.j.willi...@intel.com>
---
 .gitignore        |    1 +
 configure.ac      |    2 --
 ndctl/Makefile.am |    7 +++++++
 ndctl/monitor.c   |    1 +
 4 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 0baace4b457e..5a3d8e4507e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,7 @@ daxctl/lib/libdaxctl.la
 daxctl/lib/libdaxctl.lo
 daxctl/lib/libdaxctl.pc
 *.a
+ndctl/config.h
 ndctl/lib/libndctl.pc
 ndctl/ndctl
 rhel/
diff --git a/configure.ac b/configure.ac
index aa07ec7bc870..a02a2d80e1d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -158,8 +158,6 @@ ndctl_monitorconfdir=${sysconfdir}/ndctl
 ndctl_monitorconf=monitor.conf
 AC_SUBST([ndctl_monitorconfdir])
 AC_SUBST([ndctl_monitorconf])
-AC_DEFINE_UNQUOTED(NDCTL_CONF_FILE, 
["$ndctl_monitorconfdir/$ndctl_monitorconf"],
-       [default ndctl monitor conf path])
 
 my_CFLAGS="\
 -Wall \
diff --git a/ndctl/Makefile.am b/ndctl/Makefile.am
index ff01e0688afd..f96f08974aa6 100644
--- a/ndctl/Makefile.am
+++ b/ndctl/Makefile.am
@@ -2,6 +2,13 @@ include $(top_srcdir)/Makefile.am.in
 
 bin_PROGRAMS = ndctl
 
+DISTCLEANFILES = config.h
+BUILT_SOURCES = config.h
+config.h: Makefile
+       $(AM_V_GEN) echo "/* Autogenerated by ndctl/Makefile.am */" >$@
+       $(AM_V_GEN) echo '#define NDCTL_CONF_FILE \
+               "$(ndctl_monitorconfdir)/$(ndctl_monitorconf)"' >>$@
+
 ndctl_SOURCES = ndctl.c \
                bus.c \
                create-nfit.c \
diff --git a/ndctl/monitor.c b/ndctl/monitor.c
index 233f2bbd9b55..0daba0e96306 100644
--- a/ndctl/monitor.c
+++ b/ndctl/monitor.c
@@ -10,6 +10,7 @@
 #include <util/util.h>
 #include <util/parse-options.h>
 #include <util/strbuf.h>
+#include <ndctl/config.h>
 #include <ndctl/ndctl.h>
 #include <ndctl/libndctl.h>
 #include <sys/epoll.h>

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to