bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

proposed gnulib module 'configmake', plus use by 'localcharset'


From: Paul Eggert
Subject: proposed gnulib module 'configmake', plus use by 'localcharset'
Date: Fri, 25 Aug 2006 00:34:21 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Currently, in-place builds for coreutils generte output that looks
like this:

gcc -std=gnu99 -DHAVE_CONFIG_H -DLIBDIR=\"/usr/local/lib\" -I. -I. -I.      -g 
-O2 -c allocsa.c
gcc -std=gnu99 -DHAVE_CONFIG_H -DLIBDIR=\"/usr/local/lib\" -I. -I. -I.      -g 
-O2 -c base64.c
gcc -std=gnu99 -DHAVE_CONFIG_H -DLIBDIR=\"/usr/local/lib\" -I. -I. -I.      -g 
-O2 -c diacrit.c
...

This is hard to read, and I'd like to make it shorter.  One obvious
candidate is the ' -DLIBDIR=\"/usr/local/lib\"' string, which is
needed only for compiling localcharset.c.

I propose that we add a module that creates a file 'configmake.h'
defining symbols like LIBDIR (or better, to avoid name space
collisions, CONFIGMAKE_LIBDIR).  configmake.h would contain the make
directory variables required by the GNU coding standards.

Here's a proposed gnulib patch to do this, which I've tested with CVS
coreutils.  It requires no change to coreutils.

2006-08-24  Paul Eggert  <address@hidden>

        New configmake module, so that "make" output isn't cluttered
        by fluff like '-DLIBDIR=\"/usr/local/lib\"'.
        * MODULES.html.sh (Support for building libraries and executables):
        Add configmake.
        * modules/configmake: New file.

        * modules/localcharset (Depends-on): Add configmake.
        (Makefile.am): Remove DEFS.
        (localcharset.$(OBJEXT)): Depend on configmake.h.
        * lib/localcharset.c: Include configmake.h.
        (get_charset_aliases): Use CONFIGMAKE_LIBDIR, not LIBDIR.

Index: MODULES.html.sh
===================================================================
RCS file: /cvsroot/gnulib/gnulib/MODULES.html.sh,v
retrieving revision 1.141
diff -p -u -r1.141 MODULES.html.sh
--- MODULES.html.sh     24 Aug 2006 20:15:12 -0000      1.141
+++ MODULES.html.sh     25 Aug 2006 06:41:39 -0000
@@ -2099,6 +2099,7 @@ func_all_modules ()
   func_echo "$element"
 
   func_begin_table
+  func_module configmake
   func_module dummy
   func_module elisp-comp
   func_module ldd
--- /dev/null   2005-09-24 22:00:15.000000000 -0700
+++ modules/configmake  2006-08-24 23:03:21.000000000 -0700
@@ -0,0 +1,48 @@
+Description:
+Variables set by "configure" or "make".
+
+Files:
+
+Depends-on:
+
+configure.ac:
+
+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' >address@hidden
+       mv address@hidden $@
+CLEANFILES += configmake.h configmake.h-t
+
+Include:
+"configmake.h"
+
+License:
+LGPL
+
+Maintainer:
+all
Index: modules/localcharset
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/localcharset,v
retrieving revision 1.6
diff -p -u -r1.6 localcharset
--- modules/localcharset        22 Sep 2004 15:11:04 -0000      1.6
+++ modules/localcharset        25 Aug 2006 06:41:39 -0000
@@ -12,6 +12,7 @@ m4/glibc21.m4
 m4/localcharset.m4
 
 Depends-on:
+configmake
 
 configure.ac:
 gl_LOCALCHARSET
@@ -19,7 +20,8 @@ gl_LOCALCHARSET
 Makefile.am:
 lib_SOURCES += localcharset.h localcharset.c
 EXTRA_DIST += config.charset ref-add.sin ref-del.sin
-DEFS += -DLIBDIR=\"$(libdir)\"
+
+localcharset.$(OBJEXT): configmake.h
 
 # We need the following in order to install a simple file in $(libdir)
 # which is shared with other installed packages. We use a list of referencing
Index: lib/localcharset.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/localcharset.c,v
retrieving revision 1.23
diff -p -u -r1.23 localcharset.c
--- lib/localcharset.c  31 Jul 2006 16:09:08 -0000      1.23
+++ lib/localcharset.c  25 Aug 2006 06:41:39 -0000
@@ -30,6 +30,8 @@
 #include <string.h>
 #include <stdlib.h>
 
+#include "configmake.h"
+
 #if defined _WIN32 || defined __WIN32__
 # define WIN32_NATIVE
 #endif
@@ -117,7 +119,7 @@ get_charset_aliases (void)
         necessary for running the testsuite before "make install".  */
       dir = getenv ("CHARSETALIASDIR");
       if (dir == NULL || dir[0] == '\0')
-       dir = relocate (LIBDIR);
+       dir = relocate (CONFIGMAKE_LIBDIR);
 
       /* Concatenate dir and base into freshly allocated file_name.  */
       {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]