From e157215536f282fd83e1a577ff815a3d3e393806 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Tue, 21 Dec 1999 11:11:54 +0000 Subject: [PATCH] 1999-10-31 Akim Demaille Provide a means to specify commands to run before config.status is created (and, for symmetry, after it is created). This is typically needed by Automake so that AC_REPLACEd functions go through deansification via LIBOBJS=`echo $LIBOBJS | sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'` and/or by Libtool which needs to define LTLIBOBJS and others: LTLIBOBJS=`echo $LIBOBJS | sed 's/\.o/\.lo/g'` AC_SUBST(LTLIBOBJS) * acgeneral.m4 (AC_OUTPUT_PRE_COMMANDS): New growing string. Initialize. (AC_OUTPUT_POST_COMMANDS): Likewise. (AC_CONFIG_PRE_COMMANDS): New macro, grows AC_OUTPUT_PRE_COMMANDS. (AC_CONFIG_PRE_COMMANDS): Likewise. (AC_OUTPUT): Run AC_OUTPUT_PRE_COMMANDS before AC_OUTPUT_CONFIG_STATUS, and AC_OUTPUT_POST_COMMANDS after. --- ChangeLog | 23 +++++++++++++++++++++++ TODO | 13 ++++++++----- acgeneral.m4 | 32 ++++++++++++++++++++++++++++++-- lib/autoconf/general.m4 | 32 ++++++++++++++++++++++++++++++-- 4 files changed, 91 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index e137c375..cfef1fa8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +1999-10-31 Akim Demaille + + Provide a means to specify commands to run before config.status is + created (and, for symmetry, after it is created). + + This is typically needed by Automake so that AC_REPLACEd functions + go through deansification via + + LIBOBJS=`echo $LIBOBJS | sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'` + + and/or by Libtool which needs to define LTLIBOBJS and others: + + LTLIBOBJS=`echo $LIBOBJS | sed 's/\.o/\.lo/g'` + AC_SUBST(LTLIBOBJS) + + * acgeneral.m4 (AC_OUTPUT_PRE_COMMANDS): New growing string. + Initialize. + (AC_OUTPUT_POST_COMMANDS): Likewise. + (AC_CONFIG_PRE_COMMANDS): New macro, grows AC_OUTPUT_PRE_COMMANDS. + (AC_CONFIG_PRE_COMMANDS): Likewise. + (AC_OUTPUT): Run AC_OUTPUT_PRE_COMMANDS before + AC_OUTPUT_CONFIG_STATUS, and AC_OUTPUT_POST_COMMANDS after. + 1999-10-31 Akim Demaille Remove spurious empty lines appearing in configures. diff --git a/TODO b/TODO index 0ee39e89..1ce90c09 100644 --- a/TODO +++ b/TODO @@ -19,15 +19,18 @@ reader catches that properly, we should not care. If no info reader can handle this, we should change the affected node names. Bug triggered by looking for `CONFIG_FILES' in the index. -** autoconf.texi: Document AC_CONFIG_FILES and AC_CONFIG_COMMANDS. +** AC_CONFIG_FILES, AC_CONFIG_COMMANDS. +Will we need both ICMD and CMD as is the case for AC_OUTPUT_COMMANDS? +If so, they have to be adapted. + +** autoconf.texi: Document AC_CONFIG_FILES, AC_CONFIG_COMMANDS. I didn't do it, because I don't know where to do that. I would like to have all the AC_CONFIG_ together, but it is not currently the case. An architecture for the docs needs to be decided. -** autoconf.texi, near fubar=27. -This example is *wrong*. fubar is set in configure, not -config.status, therefore the extra commands will not know $fubar, as -the example let us believe. +** AC_CONFIG_PRE_COMMANDS, AC_CONFIG_POST_COMMANDS. +We still have to discuss a few issues: should the pre-commands be run +before the cache is created? Are the names OK? Document, see above. ** AC_C_STRUCT_MEMBER needs a full rewrite. And once done, the former specialized macros should be adapted. diff --git a/acgeneral.m4 b/acgeneral.m4 index 3b188cc8..8e88cfc7 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -3082,6 +3082,7 @@ dnl ----------------------------------------- dnl Add additional commands for AC_OUTPUT to put into config.status. dnl Use diversions instead of macros so we can be robust in the dnl presence of commas in $1 and/or $2. +dnl FIXME: Obsolete it? AC_DEFUN(AC_OUTPUT_COMMANDS, [AC_DIVERT_PUSH(AC_DIVERSION_CMDS)dnl [$1] @@ -3091,6 +3092,28 @@ AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)dnl AC_DIVERT_POP()]) +dnl AC_CONFIG_PRE_COMMANDS(CMDS) +dnl ---------------------------- +dnl Commands to run right before config.status is created. Accumulates. +AC_DEFUN([AC_CONFIG_PRE_COMMANDS], +[m4_append([AC_OUTPUT_PRE_COMMANDS], [$1 +])]) + +dnl Initialize. +define([AC_OUTPUT_PRE_COMMANDS]) + + +dnl AC_CONFIG_POST_COMMANDS(CMDS) +dnl ----------------------------- +dnl Commands to run after config.status was created. Accumulates. +AC_DEFUN([AC_CONFIG_POST_COMMANDS], +[m4_append([AC_OUTPUT_POST_COMMANDS], [$1 +])]) + +dnl Initialize. +define([AC_OUTPUT_POST_COMMANDS]) + + dnl AC_CONFIG_SUBDIRS(DIR ...) dnl -------------------------- dnl FIXME: `subdirs=' should not be here. @@ -3138,13 +3161,18 @@ trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 ifset([AC_LIST_HEADERS], [DEFS=-DHAVE_CONFIG_H], [AC_OUTPUT_MAKE_DEFS()]) +dnl Commands to run before creating config.status. +AC_OUTPUT_PRE_COMMANDS()dnl + # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} - AC_OUTPUT_CONFIG_STATUS()dnl - rm -fr confdefs* $ac_clean_files trap 'exit 1' 1 2 15 + +dnl Commands to run after config.status was created +AC_OUTPUT_POST_COMMANDS()dnl + test "$no_create" = yes || $SHELL $CONFIG_STATUS || exit 1 dnl config.status should not do recursion. ifset([AC_LIST_SUBDIRS], [AC_OUTPUT_SUBDIRS(AC_LIST_SUBDIRS)])dnl diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 3b188cc8..8e88cfc7 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -3082,6 +3082,7 @@ dnl ----------------------------------------- dnl Add additional commands for AC_OUTPUT to put into config.status. dnl Use diversions instead of macros so we can be robust in the dnl presence of commas in $1 and/or $2. +dnl FIXME: Obsolete it? AC_DEFUN(AC_OUTPUT_COMMANDS, [AC_DIVERT_PUSH(AC_DIVERSION_CMDS)dnl [$1] @@ -3091,6 +3092,28 @@ AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)dnl AC_DIVERT_POP()]) +dnl AC_CONFIG_PRE_COMMANDS(CMDS) +dnl ---------------------------- +dnl Commands to run right before config.status is created. Accumulates. +AC_DEFUN([AC_CONFIG_PRE_COMMANDS], +[m4_append([AC_OUTPUT_PRE_COMMANDS], [$1 +])]) + +dnl Initialize. +define([AC_OUTPUT_PRE_COMMANDS]) + + +dnl AC_CONFIG_POST_COMMANDS(CMDS) +dnl ----------------------------- +dnl Commands to run after config.status was created. Accumulates. +AC_DEFUN([AC_CONFIG_POST_COMMANDS], +[m4_append([AC_OUTPUT_POST_COMMANDS], [$1 +])]) + +dnl Initialize. +define([AC_OUTPUT_POST_COMMANDS]) + + dnl AC_CONFIG_SUBDIRS(DIR ...) dnl -------------------------- dnl FIXME: `subdirs=' should not be here. @@ -3138,13 +3161,18 @@ trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 ifset([AC_LIST_HEADERS], [DEFS=-DHAVE_CONFIG_H], [AC_OUTPUT_MAKE_DEFS()]) +dnl Commands to run before creating config.status. +AC_OUTPUT_PRE_COMMANDS()dnl + # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} - AC_OUTPUT_CONFIG_STATUS()dnl - rm -fr confdefs* $ac_clean_files trap 'exit 1' 1 2 15 + +dnl Commands to run after config.status was created +AC_OUTPUT_POST_COMMANDS()dnl + test "$no_create" = yes || $SHELL $CONFIG_STATUS || exit 1 dnl config.status should not do recursion. ifset([AC_LIST_SUBDIRS], [AC_OUTPUT_SUBDIRS(AC_LIST_SUBDIRS)])dnl