From 4f2e62ba9fd482375fdc085de71a5c947741d140 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sat, 1 Sep 2012 01:46:39 +0200 Subject: build: refactor how lists of coreutils programs are defined This is in preparation of future changes. Still, this patch leaves the build system in a better shape; true, with more indirections, but also with less convoluted and brittle hacks. Unfortunately, this commit also makes some rebuild rules incomplete; that will son be fixed by follow-up patches. * build-aux/gen-lists-of-programs.sh: New, generates autoconf and automake input fragments that define "lists" of all coreutils programs, with further distinctions about how and when these programs should be built (by default; if the system is capable enough; only if the user asks for them explicitly). This is useful to avoid duplicating the definitions of these lists among several files (at least 'configure.ac' 'src/Makefile.am'); such duplication had proved a source of inconsistencies and bugs in the past. And the pre-existing way to avoid such duplication, as implemented in 'configure.ac' before this patch, was overly complex and brittle. * Makefile.am (EXTRA_DIST): Distribute the new script. * bootstrap.conf (bootstrap_post_import_hook): Run the new script to generate 'm4/cu-progs.m4' and 'src/cu-progs.mk'. * .gitignore: Ignore those files. * configure.ac: Include 'm4/cu-progs.m4', and decidedly simplify most of the program lists definition and processing accordingly. * src/Makefile.am: Similarly include 'src/cu-progs.mk', containing definition of variables $(default__progs), $(no_install__progs) and $(build_if_possible__progs). Accordingly ... (no_install__progs, build_if_possible__progs): ... remove. (EXTRA_DIST): Adjust definition. Adjust a comment. --- configure.ac | 62 ++++++++---------------------------------------------------- 1 file changed, 8 insertions(+), 54 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index f93e65e9b..de0dea86b 100644 --- a/configure.ac +++ b/configure.ac @@ -412,55 +412,13 @@ if test "$elf_sys" = "yes" && \ fi ############################################################################ -mk="$srcdir/src/Makefile.am" -# Extract all literal names from the definition of $(EXTRA_PROGRAMS) -# in $mk but don't expand the variable references. -# Append each literal name to $optional_bin_progs. -v=EXTRA_PROGRAMS -for gl_i in `sed -n '/^'$v' =/,/[[^\]]$/p' $mk \ - | sed 's/^ *//;/^\$.*/d;/^'$v' =/d' \ - | tr -s '\\015\\012\\\\' ' '`; do - gl_ADD_PROG([optional_bin_progs], $gl_i) -done - -# As above, extract literal names from the definition of $(no_install__progs) -# in $mk but don't expand the variable references. -v=no_install__progs -t=`sed -n '/^'$v' =/,/[[^\]]$/p' $mk \ - | sed 's/^ *//;/^\$.*/d;/^'$v' =/d' \ - | tr -s '\\015\\012\\\\' ' '` -# Remove any trailing space. -no_install_progs_default=`echo "$t"|sed 's/ $//'` - -# Unfortunately, due to the way autoconf's AS_HELP_STRING works, the list -# of default-not-installed programs, "arch hostname", must appear in two -# places: in this file below, and in $mk. Using "$no_install_progs_default" -# below cannot work. And we can't substitute the names into $mk because -# automake needs the literals, too. -# The compromise is to ensure that the space-separated list extracted -# above matches the literal 2nd argument below. -c="$srcdir/configure.ac" -re='^g''l_INCLUDE_EXCLUDE_PROG(.* [\[\(.*\)\]])' -t=`sed -n '/'"$re"'/{s/'"$re"'/\1/;s/,/ /gp -}' $c` -case $t in - $no_install_progs_default) ;; - *) AC_MSG_ERROR([[internal error: g'l_INCLUDE_EXCLUDE_PROG's 2nd arg, $t, - does not match the list of default-not-installed programs - ($no_install_progs_default) also recorded in $mk]], - 1) ;; -esac -# Given the name of a variable containing a space-separated list of -# install-by-default programs and the actual list do-not-install-by-default -# programs, modify the former variable to reflect any "do-install" and -# "don't-install" requests. -# I.e., add any program name specified via --enable-install-program=..., and -# remove any program name specified via --enable-no-install-program=... -# Note how the second argument below is a literal, with "," separators. -# That is required due to the way the macro works, and since the -# corresponding ./configure option argument is comma-separated on input. -gl_INCLUDE_EXCLUDE_PROG([optional_bin_progs], [arch,hostname]) +dnl Autogenerated by the 'gen-lists-of-programs.sh' auxiliary script. +dnl Issue proper calls to the macros gl_INCLUDE_EXCLUDE_PROG and +dnl gl_ADD_PROG (updating $optional_bin_progs), and generate the list +dnl of coreutils programs to be built only upon explicit user request, +dnl saving that list in the $no_install_progs_default shell variable. +m4_include([m4/cu-progs.m4]) # Now that we know which programs will actually be built up, figure out # which optional helper progs should be compiled. @@ -483,19 +441,15 @@ MAN=` # Normalize whitespace. MAN=`echo $MAN` +NO_INSTALL_PROGS_DEFAULT=$no_install_progs_default +AC_SUBST([NO_INSTALL_PROGS_DEFAULT]) OPTIONAL_BIN_PROGS=`echo "$optional_bin_progs "|sed 's/ /\$(EXEEXT) /g;s/ $//'` AC_SUBST([OPTIONAL_BIN_PROGS]) OPTIONAL_PKGLIB_PROGS=`echo "$optional_pkglib_progs " | sed 's/ $//'` AC_SUBST([OPTIONAL_PKGLIB_PROGS]) -NO_INSTALL_PROGS_DEFAULT=$no_install_progs_default -AC_SUBST([NO_INSTALL_PROGS_DEFAULT]) AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes]) -# Arrange to rerun configure whenever the file, src/Makefile.am, -# containing the list of program names changes. -CONFIG_STATUS_DEPENDENCIES='$(top_srcdir)/src/Makefile.am' -AC_SUBST([CONFIG_STATUS_DEPENDENCIES]) ############################################################################ # As long as "grep 'PRI[diouxX]' po/*.pot" reports matches in -- cgit v1.2.3-54-g00ecf