diff --git a/Makefile.am b/Makefile.am index 8a8eecb69720b38fac89527c5424baac5a5e5297..29501ab40caa671be41df73466db2ffa342b5430 100644 --- a/Makefile.am +++ b/Makefile.am @@ -129,6 +129,9 @@ clean-cov: MAINTAINERCLEANFILES = .git-module-status +BUILT_SOURCES = configmake.h +CLEANFILES = configmake.h + distclean-local: clean-GNUmakefile clean-GNUmakefile: test '$(srcdir)' = . || rm -f $(top_builddir)/GNUmakefile @@ -154,3 +157,44 @@ gen-AUTHORS: ci-%: $(MAKE) -C $(srcdir)/ci/ $@ + +# Listed in the same order as the GNU makefile conventions, and +# provided by autoconf 2.59c+ or 2.70. +# The Automake-defined pkg* macros are appended, in the order +# listed in the Automake 1.10a+ documentation. +configmake.h: Makefile + $(AM_V_GEN)rm -f $@-t && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + echo '#if WIN32'; \ + echo '# include /* avoid mingw pollution on DATADIR */'; \ + echo '#endif'; \ + echo '#define PREFIX "$(prefix)"'; \ + echo '#define EXEC_PREFIX "$(exec_prefix)"'; \ + echo '#define BINDIR "$(bindir)"'; \ + echo '#define SBINDIR "$(sbindir)"'; \ + echo '#define LIBEXECDIR "$(libexecdir)"'; \ + echo '#define DATAROOTDIR "$(datarootdir)"'; \ + echo '#define DATADIR "$(datadir)"'; \ + echo '#define SYSCONFDIR "$(sysconfdir)"'; \ + echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \ + echo '#define LOCALSTATEDIR "$(localstatedir)"'; \ + echo '#define RUNSTATEDIR "$(runstatedir)"'; \ + echo '#define INCLUDEDIR "$(includedir)"'; \ + echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \ + echo '#define DOCDIR "$(docdir)"'; \ + echo '#define INFODIR "$(infodir)"'; \ + echo '#define HTMLDIR "$(htmldir)"'; \ + echo '#define DVIDIR "$(dvidir)"'; \ + echo '#define PDFDIR "$(pdfdir)"'; \ + echo '#define PSDIR "$(psdir)"'; \ + echo '#define LIBDIR "$(libdir)"'; \ + echo '#define LISPDIR "$(lispdir)"'; \ + echo '#define LOCALEDIR "$(localedir)"'; \ + echo '#define MANDIR "$(mandir)"'; \ + echo '#define MANEXT "$(manext)"'; \ + echo '#define PKGDATADIR "$(pkgdatadir)"'; \ + echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \ + echo '#define PKGLIBDIR "$(pkglibdir)"'; \ + echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \ + } | sed '/""/d' > $@-t && \ + mv -f $@-t $@ diff --git a/configure.ac b/configure.ac index 4bdf38ec15d4833cae44f48551d1476afe05760d..f0d79b95d4e28f479b91e8bd37253c6513db91f6 100644 --- a/configure.ac +++ b/configure.ac @@ -132,14 +132,12 @@ AC_PROG_CPP dnl autoconf 2.70 adds a --runstatedir option so that downstreams dnl can point to /run instead of the historic /var/run, but dnl autoconf hasn't had a release since 2012. -dnl -dnl gnulib sets configmake.h to include runstatedir, but sets -dnl it to $localstatedir/run if $runstatedir env var is not set -dnl which is useless for apps that need to use /run without -dnl waiting for autoconf 2.70 -dnl +if test "x$runstatedir" = x; then + AC_SUBST([runstatedir], ['${localstatedir}/run']) +fi + dnl we introduce --with-runstatedir and then overwrite the -dnl value of $runstatedir so gnulib's configmake.h becomes useful +dnl value of $runstatedir so configmake.h is more useful AC_ARG_WITH( [runstatedir], [AS_HELP_STRING( diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c index 6e332f75784719fd3343e5399c433b62d80f4053..3b89f727428c3fb78ba4822c1e6543c7434f3770 100644 --- a/tools/nss/libvirt_nss.c +++ b/tools/nss/libvirt_nss.c @@ -41,12 +41,7 @@ # include #endif -/* - * This gnulib files is used for its macros only, - * so doesn't introduce a link time dep, which we - * must avoid - */ -#include "gnulib/lib/configmake.h" +#include "configmake.h" #include "libvirt_nss_leases.h" diff --git a/tools/virt-login-shell.c b/tools/virt-login-shell.c index cf4a249f0a14379acc95d17aedbaa1e35764f2d7..25449f972dea52dc24fae94cd89c43a24b64ba8e 100644 --- a/tools/virt-login-shell.c +++ b/tools/virt-login-shell.c @@ -28,11 +28,7 @@ #include #include -/* - * These gnulib files are used for their macros only, - * so don't introduce a link time dep, which we must avoid - */ -#include "gnulib/lib/configmake.h" +#include "configmake.h" #define VIR_INT64_STR_BUFLEN 21