]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build: generate configmake.h in root directory
authorDaniel P. Berrangé <berrange@redhat.com>
Fri, 17 Jan 2020 11:32:09 +0000 (11:32 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Wed, 29 Jan 2020 14:51:39 +0000 (14:51 +0000)
Currently we rely on gnulib creating configmake.h, but we
can easily create it ourselves instead.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Makefile.am
configure.ac
tools/nss/libvirt_nss.c
tools/virt-login-shell.c

index 8a8eecb69720b38fac89527c5424baac5a5e5297..29501ab40caa671be41df73466db2ffa342b5430 100644 (file)
@@ -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 <winsock2.h> /* 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 $@
index 4bdf38ec15d4833cae44f48551d1476afe05760d..f0d79b95d4e28f479b91e8bd37253c6513db91f6 100644 (file)
@@ -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(
index 6e332f75784719fd3343e5399c433b62d80f4053..3b89f727428c3fb78ba4822c1e6543c7434f3770 100644 (file)
 # include <nsswitch.h>
 #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"
 
index cf4a249f0a14379acc95d17aedbaa1e35764f2d7..25449f972dea52dc24fae94cd89c43a24b64ba8e 100644 (file)
 #include <errno.h>
 #include <string.h>
 
-/*
- * 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