X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fconfigmake;h=c9af25912d3b75f5e6796c3e1913aa1fb34651a4;hb=e53e23a012113952499a70115d2ca26b2a33e2bf;hp=4f162b9f8924c93b493397fee8dbe1a6921b3525;hpb=6c541ce48d57d04ec4cbc37c9fd0526f6cf32f4b;p=gnulib.git diff --git a/modules/configmake b/modules/configmake index 4f162b9f8..c9af25912 100644 --- a/modules/configmake +++ b/modules/configmake @@ -2,48 +2,78 @@ Description: Variables set by "configure" or "make". Files: +m4/configmake.m4 Depends-on: configure.ac: +gl_CONFIGMAKE_PREP Makefile.am: -# Listed in the same order as the GNU makefile conventions. -configmake.h: - ( \ - echo '#define CONFIGMAKE_PREFIX "$(prefix)"'; \ - echo '#define CONFIGMAKE_EXEC_PREFIX "$(exec_prefix)"'; \ - echo '#define CONFIGMAKE_BINDIR "$(bindir)"'; \ - echo '#define CONFIGMAKE_SBINDIR "$(sbindir)"'; \ - echo '#define CONFIGMAKE_LIBEXECDIR "$(libexecdir)"'; \ - echo '#define CONFIGMAKE_DATAROOTDIR "$(datarootdir)"'; \ - echo '#define CONFIGMAKE_DATADIR "$(datadir)"'; \ - echo '#define CONFIGMAKE_SYSCONFDIR "$(sysconfdir)"'; \ - echo '#define CONFIGMAKE_SHAREDSTATEDIR "$(sharedstatedir)"'; \ - echo '#define CONFIGMAKE_LOCALSTATEDIR "$(localstatedir)"'; \ - echo '#define CONFIGMAKE_INCLUDEDIR "$(includedir)"'; \ - echo '#define CONFIGMAKE_OLDINCLUDEDIR "$(oldincludedir)"'; \ - echo '#define CONFIGMAKE_DOCDIR "$(docdir)"'; \ - echo '#define CONFIGMAKE_INFODIR "$(infodir)"'; \ - echo '#define CONFIGMAKE_HTMLDIR "$(htmldir)"'; \ - echo '#define CONFIGMAKE_DVIDIR "$(dvidir)"'; \ - echo '#define CONFIGMAKE_PDFDIR "$(pdfdir)"'; \ - echo '#define CONFIGMAKE_PSDIR "$(psdir)"'; \ - echo '#define CONFIGMAKE_LIBDIR "$(libdir)"'; \ - echo '#define CONFIGMAKE_LISPDIR "$(lispdir)"'; \ - echo '#define CONFIGMAKE_LOCALEDIR "$(localedir)"'; \ - echo '#define CONFIGMAKE_MANDIR "$(mandir)"'; \ - echo '#define CONFIGMAKE_MANEXT "$(manext)"'; \ - :) | sed '/""/d' >$@-t - mv $@-t $@ +# Retrieve values of the variables through 'configure' followed by +# 'make', not directly through 'configure', so that a user who +# sets some of these variables consistently on the 'make' command +# line gets correct results. +# +# One advantage of this approach, compared to the classical +# approach of adding -DLIBDIR=\"$(libdir)\" etc. to AM_CPPFLAGS, +# is that it protects against the use of undefined variables. +# If, say, $(libdir) is not set in the Makefile, LIBDIR is not +# defined by this module, and code using LIBDIR gives a +# compilation error. +# +# Another advantage is that 'make' output is shorter. +# +# Listed in the same order as the GNU makefile conventions, and +# provided by autoconf 2.59c+. +# 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 '#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 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 && \ + if test -f $@ && cmp $@-t $@ > /dev/null; then \ + rm -f $@-t; \ + else \ + rm -f $@; mv $@-t $@; \ + fi + BUILT_SOURCES += configmake.h CLEANFILES += configmake.h configmake.h-t Include: +/* Include only after all system include files. */ "configmake.h" License: -LGPL +LGPLv2+ Maintainer: all