From: Akim Demaille Date: Wed, 9 Feb 2000 17:01:44 +0000 (+0000) Subject: Extend the concept of `INIT-CMDS' to the AC_CONFIG_FOOS. X-Git-Tag: autoconf-2.50~1182 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0bc015e7b5a7c72c107da1df6b4c3bef8aed47e;p=thirdparty%2Fautoconf.git Extend the concept of `INIT-CMDS' to the AC_CONFIG_FOOS. * acgeneral.m4 (_AC_CONFIG_COMMANDS_INIT): New macro which will collect the `INIT-CMDS'. (AC_CONFIG_COMMANDS, AC_CONFIG_LINKS, AC_CONFIG_HEADERS, AC_CONFIG_FILES): Use it, and also temporarily divert to -1 instead of spamming dnl everywhere. (AC_OUTPUT_CONFIG_STATUS): Make sure to output the INIT-CMDS before the other sections, it'd be a pity to initialize after the use :). * doc/autoconf.texi (Configuration Actions): New section, documenting the common behavior of AC_CONFIG_FILES, AC_CONFIG_HEADERS, macro AC_CONFIG_COMMANDS, and AC_CONFIG_LINKS. (Configuration Files): Document $2 and $3 of AC_CONFIG_FILES. (Configuration Headers): Document $2 and $3 of AC_CONFIG_HEADERS. (Configuration Commands): Document $2 and $3 of AC_CONFIG_COMMANDS. (Configuration Links): Document $2 and $3 of AC_CONFIG_FILES. --- diff --git a/ChangeLog b/ChangeLog index e76548d25..5dad85e25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2000-02-09 Akim Demaille + + Extend the concept of `INIT-CMDS' to the AC_CONFIG_FOOS. + + * acgeneral.m4 (_AC_CONFIG_COMMANDS_INIT): New macro which will + collect the `INIT-CMDS'. + (AC_CONFIG_COMMANDS, AC_CONFIG_LINKS, AC_CONFIG_HEADERS, + AC_CONFIG_FILES): Use it, and also temporarily divert to -1 + instead of spamming dnl everywhere. + (AC_OUTPUT_CONFIG_STATUS): Make sure to output the INIT-CMDS + before the other sections, it'd be a pity to initialize after the + use :). + + * doc/autoconf.texi (Configuration Actions): New section, + documenting the common behavior of AC_CONFIG_FILES, + AC_CONFIG_HEADERS, macro AC_CONFIG_COMMANDS, and AC_CONFIG_LINKS. + (Configuration Files): Document $2 and $3 of AC_CONFIG_FILES. + (Configuration Headers): Document $2 and $3 of AC_CONFIG_HEADERS. + (Configuration Commands): Document $2 and $3 of AC_CONFIG_COMMANDS. + (Configuration Links): Document $2 and $3 of AC_CONFIG_FILES. + 2000-02-09 Akim Demaille * libm4.m4 (m4_sign, m4_cmp, m4_list_cmp): New macros. diff --git a/acgeneral.m4 b/acgeneral.m4 index 6524ec86c..ed73c6d7d 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -2911,6 +2911,62 @@ AC_DEFUN(AC_CHECK_TYPE, ## ----------------------- ## +# This section handles about all the preparation aspects for +# `config.status': registering the configuration files, the headers, the +# links, and the commands `config.status' will run. There is a little +# mixture though of things actually handled by `configure', such as +# running the `configure' in the sub directories. Minor detail. +# +# There are two kinds of commands: +# +# COMMANDS: +# +# They are output into `config.status' via a quoted here doc. These +# commands are always associated to a tag which the user can use to +# tell `config.status' what are the commands she wants to run. +# +# INIT-CMDS: +# +# They are output via an *unquoted* here-doc. As a consequence $var +# will be output as the value of VAR. This is typically used by +# `configure' to give `config,.status' some variables it needs to run +# the COMMANDS. At the difference of `COMMANDS', the INIT-CMDS are +# always run. +# +# +# Some uniformity exists around here, please respect it! +# +# A macro named AC_CONFIG_FOOS has three args: the `TAG...' (or +# `FILE...' when it applies), the `COMMANDS' and the `INIT-CMDS'. It +# first checks that TAG was not registered elsewhere thanks to +# AC_CONFIG_UNIQUE. Then it registers `TAG...' in AC_LIST_FOOS, and for +# each `TAG', a special line in AC_LIST_FOOS_COMMANDS which is used in +# `config.status' like this: +# +# case $ac_tag in +# AC_LIST_FOOS_COMMANDS +# esac +# +# Finally, the `INIT-CMDS' are dumped into a special diversion, via +# `_AC_CONFIG_COMMANDS_INIT'. While `COMMANDS' are output once per TAG, +# `INIT-CMDS' are dumpdef only once per call to AC_CONFIG_FOOS. +# +# AC_CONFIG_FOOS can be called several times (with different TAGs of +# course). +# +# Because these macros should not output anything, there should be `dnl' +# everywhere. A pain my friend, a pain. So instead in each macro we +# divert(-1) and restore the diversion at the end. +# +# +# Honorable members of this family are AC_CONFIG_FILES, +# AC_CONFIG_HEADERS, AC_CONFIG_LINKS and AC_CONFIG_COMMANDS. Bad boys +# are AC_LINK_FILES, AC_OUTPUT_COMMANDS and AC_OUTPUT when used with +# arguments. False members are AC_CONFIG_SUBDIRS and AC_CONFIG_AUX_DIR. +# Cousins are AC_CONFIG_COMMANDS_PRE and AC_CONFIG_COMMANDS_POST. + + + # AC_CONFIG_IF_MEMBER(DEST, LIST, ACTION-IF-TRUE, ACTION-IF-FALSE) # ---------------------------------------------------------------- # If DEST is member of LIST, expand to ACTION-IF-TRUE, else ACTION-IF-FALSE. @@ -2934,9 +2990,9 @@ define(AC_CONFIG_IF_MEMBER, # Verify that there is no double definition of an output file # (precisely, guarantees there is no common elements between # CONFIG_HEADERS, CONFIG_FILES, CONFIG_LINKS, and CONFIG_SUBDIRS). -# This macro should output nothing, so we divert to /dev/null. Note -# that this macro does not check if the list $[1] itself contains -# doubles. +# +# Note that this macro does not check if the list $[1] itself +# contains doubles. define(AC_CONFIG_UNIQUE, [AC_DIVERT_PUSH(AC_DIVERSION_KILL) AC_FOREACH([AC_File], [$1], @@ -2956,8 +3012,83 @@ AC_DIVERT_POP()dnl ]) -# AC_CONFIG_HEADERS(HEADERS..., [COMMANDS]) +# _AC_CONFIG_COMMANDS_INIT(INIT-COMMANDS) +# --------------------------------------- +# +# Register INIT-COMMANDS as command pasted *unquoted* in +# `config.status'. This is typically used to pass variables from +# `configure' to `config.status'. Note that $[1] is not over quoted as +# was the case in AC_OUTPUT_COMMANDS. +define(_AC_CONFIG_COMMANDS_INIT, +[ifval([$1], +[AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)dnl +$1 +AC_DIVERT_POP()])]) + + +# AC_CONFIG_COMMANDS(NAME...,[COMMANDS], [INIT-CMDS]) +# --------------------------------------------------- +# +# Specify additional commands to be run by config.status. This +# commands must be associated with a NAME, which should be thought +# as the name of a file the COMMANDS create. +AC_DEFUN([AC_CONFIG_COMMANDS], +[AC_DIVERT_PUSH(AC_DIVERSION_KILL) +AC_CONFIG_UNIQUE([$1]) +m4_append([AC_LIST_COMMANDS], [ $1]) + +ifelse([$2],,, [AC_FOREACH([AC_Name], [$1], +[m4_append([AC_LIST_COMMANDS_COMMANDS], +[ ]patsubst(AC_Name, [:.*])[ ) $2 ;; +])])]) +_AC_CONFIG_COMMANDS_INIT([$3]) +AC_DIVERT_POP()dnl +])dnl + +# Initialize the lists. +define([AC_LIST_COMMANDS]) +define([AC_LIST_COMMANDS_COMMANDS]) + + +# AC_OUTPUT_COMMANDS(EXTRA-CMDS, INIT-CMDS) # ----------------------------------------- +# Add additional commands for AC_OUTPUT to put into config.status. +# Use diversions instead of macros so we can be robust in the +# presence of commas in $1 and/or $2. +# FIXME: Obsolete it? +AC_DEFUN(AC_OUTPUT_COMMANDS, +[AC_DIVERT_PUSH(AC_DIVERSION_CMDS)dnl +[$1] +AC_DIVERT_POP()dnl +AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)dnl +[$2] +AC_DIVERT_POP()]) + + +# AC_CONFIG_COMMANDS_PRE(CMDS) +# ---------------------------- +# Commands to run right before config.status is created. Accumulates. +AC_DEFUN([AC_CONFIG_COMMANDS_PRE], +[m4_append([AC_OUTPUT_COMMANDS_PRE], [$1 +])]) + +# Initialize. +define([AC_OUTPUT_COMMANDS_PRE]) + + +# AC_CONFIG_COMMANDS_POST(CMDS) +# ----------------------------- +# Commands to run after config.status was created. Accumulates. +AC_DEFUN([AC_CONFIG_COMMANDS_POST], +[m4_append([AC_OUTPUT_COMMANDS_POST], [$1 +])]) + +# Initialize. +define([AC_OUTPUT_COMMANDS_POST]) + + +# AC_CONFIG_HEADERS(HEADERS..., [COMMANDS], [INIT-CMDS]) +# ------------------------------------------------------ # Specify that the HEADERS are to be created by instantiation of the # AC_DEFINEs. Associate the COMMANDS to the HEADERS. This macro # accumulates if called several times. @@ -2969,13 +3100,16 @@ AC_DIVERT_POP()dnl # AC_LIST_HEADERS_COMMANDS # esac AC_DEFUN([AC_CONFIG_HEADERS], -[AC_CONFIG_UNIQUE([$1])dnl -m4_append([AC_LIST_HEADERS], [ $1])dnl +[AC_DIVERT_PUSH(AC_DIVERSION_KILL) +AC_CONFIG_UNIQUE([$1]) +m4_append([AC_LIST_HEADERS], [ $1]) dnl Register the commands ifelse([$2],,, [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_HEADERS_COMMANDS], [ ]patsubst(AC_File, [:.*])[ ) $2 ;; -])])])dnl +])])]) +_AC_CONFIG_COMMANDS_INIT([$3]) +AC_DIVERT_POP()dnl ])dnl # Initialize to empty. It is much easier and uniform to have a config @@ -2992,30 +3126,25 @@ AC_DEFUN(AC_CONFIG_HEADER, [AC_CONFIG_HEADERS([$1])]) -# AC_CONFIG_LINKS(DEST:SOURCE..., [COMMANDS]) -# ------------------------------------------- +# AC_CONFIG_LINKS(DEST:SOURCE..., [COMMANDS], [INIT-CMDS]) +# -------------------------------------------------------- # Specify that config.status should establish a (symbolic if possible) # link from TOP_SRCDIR/SOURCE to TOP_SRCDIR/DEST. # Reject DEST=., because it is makes it hard for ./config.status # to guess the links to establish (`./config.status .'). -# This macro may be called multiple times. -# -# The commands are stored in a growing string AC_LIST_LINKS_COMMANDS -# which should be used like this: -# -# case $ac_file in -# AC_LIST_LINKS_COMMANDS -# esac AC_DEFUN(AC_CONFIG_LINKS, -[AC_CONFIG_UNIQUE([$1])dnl +[AC_DIVERT_PUSH(AC_DIVERSION_KILL) +AC_CONFIG_UNIQUE([$1]) ifelse(regexp([$1], [^\.:\| \.:]), -1,, - [AC_FATAL([$0: invalid destination: `.'])])dnl -m4_append([AC_LIST_LINKS], [ $1])dnl + [AC_FATAL([$0: invalid destination: `.'])]) +m4_append([AC_LIST_LINKS], [ $1]) dnl Register the commands ifelse([$2],,, [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_LINKS_COMMANDS], [ ]patsubst(AC_File, [:.*])[ ) $2 ;; -])])])dnl +])])]) +_AC_CONFIG_COMMANDS_INIT([$3]) +AC_DIVERT_POP()dnl ])dnl @@ -3045,8 +3174,8 @@ popdef([AC_Dsts])dnl -# AC_CONFIG_FILES(FILE...[, COMMANDS]) -# ------------------------------------ +# AC_CONFIG_FILES(FILE..., [COMMANDS], [INIT-CMDS]) +# ------------------------------------------------- # Specify output files, as with AC_OUTPUT, i.e., files that are # configured with AC_SUBST. Associate the COMMANDS to each FILE, # i.e., when config.status creates FILE, run COMMANDS afterwards. @@ -3058,13 +3187,16 @@ popdef([AC_Dsts])dnl # AC_LIST_FILES_COMMANDS # esac AC_DEFUN([AC_CONFIG_FILES], -[AC_CONFIG_UNIQUE([$1])dnl -m4_append([AC_LIST_FILES], [ $1])dnl +[AC_DIVERT_PUSH(AC_DIVERSION_KILL) +AC_CONFIG_UNIQUE([$1]) +m4_append([AC_LIST_FILES], [ $1]) dnl Register the commands. ifelse([$2],,, [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_FILES_COMMANDS], [ ]patsubst(AC_File, [:.*])[ ) $2 ;; -])])])dnl +])])]) +_AC_CONFIG_COMMANDS_INIT([$3]) +AC_DIVERT_POP()dnl ])dnl # Initialize the lists. @@ -3072,73 +3204,6 @@ define([AC_LIST_FILES]) define([AC_LIST_FILES_COMMANDS]) - -# AC_CONFIG_COMMANDS(NAME..., COMMANDS) -# ------------------------------------- -# Specify additional commands to be run by config.status. This -# commands must be associated with a NAME, which should be thought -# as the name of a file the COMMANDS create. -# -# This name must be a unique config key. -# -# The commands are stored in a growing string AC_LIST_COMMANDS_COMMANDS -# which should be used like this: -# -# case $ac_file in -# AC_LIST_COMMANDS_COMMANDS -# esac -AC_DEFUN([AC_CONFIG_COMMANDS], -[AC_CONFIG_UNIQUE([$1])dnl -m4_append([AC_LIST_COMMANDS], [ $1])dnl -dnl -ifelse([$2],,, [AC_FOREACH([AC_Name], [$1], -[m4_append([AC_LIST_COMMANDS_COMMANDS], -[ ]patsubst(AC_Name, [:.*])[ ) $2 ;; -])])])dnl -])dnl - -# Initialize the lists. -define([AC_LIST_COMMANDS]) -define([AC_LIST_COMMANDS_COMMANDS]) - - -# AC_OUTPUT_COMMANDS(EXTRA-CMDS, INIT-CMDS) -# ----------------------------------------- -# Add additional commands for AC_OUTPUT to put into config.status. -# Use diversions instead of macros so we can be robust in the -# presence of commas in $1 and/or $2. -# FIXME: Obsolete it? -AC_DEFUN(AC_OUTPUT_COMMANDS, -[AC_DIVERT_PUSH(AC_DIVERSION_CMDS)dnl -[$1] -AC_DIVERT_POP()dnl -AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)dnl -[$2] -AC_DIVERT_POP()]) - - -# AC_CONFIG_COMMANDS_PRE(CMDS) -# ---------------------------- -# Commands to run right before config.status is created. Accumulates. -AC_DEFUN([AC_CONFIG_COMMANDS_PRE], -[m4_append([AC_OUTPUT_COMMANDS_PRE], [$1 -])]) - -# Initialize. -define([AC_OUTPUT_COMMANDS_PRE]) - - -# AC_CONFIG_COMMANDS_POST(CMDS) -# ----------------------------- -# Commands to run after config.status was created. Accumulates. -AC_DEFUN([AC_CONFIG_COMMANDS_POST], -[m4_append([AC_OUTPUT_COMMANDS_POST], [$1 -])]) - -# Initialize. -define([AC_OUTPUT_COMMANDS_POST]) - - # AC_CONFIG_SUBDIRS(DIR ...) # -------------------------- # FIXME: `subdirs=' should not be here. @@ -3388,6 +3453,17 @@ trap 'rm -fr \$ac_cs_root*; exit 1' 1 2 15 EOF ])[]dnl ifval +dnl We output the INIT-CMDS first for obvious reasons :) + +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF # # CONFIG_COMMANDS section. # -undivert(AC_DIVERSION_ICMDS)dnl -EOF -cat >>$CONFIG_STATUS <<\EOF undivert(AC_DIVERSION_CMDS)dnl exit 0 EOF diff --git a/autoconf.texi b/autoconf.texi index 82be088c6..dc73f2ec0 100644 --- a/autoconf.texi +++ b/autoconf.texi @@ -4873,7 +4873,7 @@ i960-*-bout) obj_format=bout ;; esac @end example -@defmac AC_CONFIG_LINKS (@var{dest}:@var{source}@dots{}) +@defmac AC_CONFIG_LINKS (@var{dest}:@var{source}@dots{}, @ovar{cmds}, @ovar{init-cmds}) @maindex CONFIG_LINKS Make @code{AC_OUTPUT} link each of the existing files @var{source} to the corresponding link name @var{dest}. Makes a symbolic link if diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 82be088c6..dc73f2ec0 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -4873,7 +4873,7 @@ i960-*-bout) obj_format=bout ;; esac @end example -@defmac AC_CONFIG_LINKS (@var{dest}:@var{source}@dots{}) +@defmac AC_CONFIG_LINKS (@var{dest}:@var{source}@dots{}, @ovar{cmds}, @ovar{init-cmds}) @maindex CONFIG_LINKS Make @code{AC_OUTPUT} link each of the existing files @var{source} to the corresponding link name @var{dest}. Makes a symbolic link if diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 6524ec86c..ed73c6d7d 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -2911,6 +2911,62 @@ AC_DEFUN(AC_CHECK_TYPE, ## ----------------------- ## +# This section handles about all the preparation aspects for +# `config.status': registering the configuration files, the headers, the +# links, and the commands `config.status' will run. There is a little +# mixture though of things actually handled by `configure', such as +# running the `configure' in the sub directories. Minor detail. +# +# There are two kinds of commands: +# +# COMMANDS: +# +# They are output into `config.status' via a quoted here doc. These +# commands are always associated to a tag which the user can use to +# tell `config.status' what are the commands she wants to run. +# +# INIT-CMDS: +# +# They are output via an *unquoted* here-doc. As a consequence $var +# will be output as the value of VAR. This is typically used by +# `configure' to give `config,.status' some variables it needs to run +# the COMMANDS. At the difference of `COMMANDS', the INIT-CMDS are +# always run. +# +# +# Some uniformity exists around here, please respect it! +# +# A macro named AC_CONFIG_FOOS has three args: the `TAG...' (or +# `FILE...' when it applies), the `COMMANDS' and the `INIT-CMDS'. It +# first checks that TAG was not registered elsewhere thanks to +# AC_CONFIG_UNIQUE. Then it registers `TAG...' in AC_LIST_FOOS, and for +# each `TAG', a special line in AC_LIST_FOOS_COMMANDS which is used in +# `config.status' like this: +# +# case $ac_tag in +# AC_LIST_FOOS_COMMANDS +# esac +# +# Finally, the `INIT-CMDS' are dumped into a special diversion, via +# `_AC_CONFIG_COMMANDS_INIT'. While `COMMANDS' are output once per TAG, +# `INIT-CMDS' are dumpdef only once per call to AC_CONFIG_FOOS. +# +# AC_CONFIG_FOOS can be called several times (with different TAGs of +# course). +# +# Because these macros should not output anything, there should be `dnl' +# everywhere. A pain my friend, a pain. So instead in each macro we +# divert(-1) and restore the diversion at the end. +# +# +# Honorable members of this family are AC_CONFIG_FILES, +# AC_CONFIG_HEADERS, AC_CONFIG_LINKS and AC_CONFIG_COMMANDS. Bad boys +# are AC_LINK_FILES, AC_OUTPUT_COMMANDS and AC_OUTPUT when used with +# arguments. False members are AC_CONFIG_SUBDIRS and AC_CONFIG_AUX_DIR. +# Cousins are AC_CONFIG_COMMANDS_PRE and AC_CONFIG_COMMANDS_POST. + + + # AC_CONFIG_IF_MEMBER(DEST, LIST, ACTION-IF-TRUE, ACTION-IF-FALSE) # ---------------------------------------------------------------- # If DEST is member of LIST, expand to ACTION-IF-TRUE, else ACTION-IF-FALSE. @@ -2934,9 +2990,9 @@ define(AC_CONFIG_IF_MEMBER, # Verify that there is no double definition of an output file # (precisely, guarantees there is no common elements between # CONFIG_HEADERS, CONFIG_FILES, CONFIG_LINKS, and CONFIG_SUBDIRS). -# This macro should output nothing, so we divert to /dev/null. Note -# that this macro does not check if the list $[1] itself contains -# doubles. +# +# Note that this macro does not check if the list $[1] itself +# contains doubles. define(AC_CONFIG_UNIQUE, [AC_DIVERT_PUSH(AC_DIVERSION_KILL) AC_FOREACH([AC_File], [$1], @@ -2956,8 +3012,83 @@ AC_DIVERT_POP()dnl ]) -# AC_CONFIG_HEADERS(HEADERS..., [COMMANDS]) +# _AC_CONFIG_COMMANDS_INIT(INIT-COMMANDS) +# --------------------------------------- +# +# Register INIT-COMMANDS as command pasted *unquoted* in +# `config.status'. This is typically used to pass variables from +# `configure' to `config.status'. Note that $[1] is not over quoted as +# was the case in AC_OUTPUT_COMMANDS. +define(_AC_CONFIG_COMMANDS_INIT, +[ifval([$1], +[AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)dnl +$1 +AC_DIVERT_POP()])]) + + +# AC_CONFIG_COMMANDS(NAME...,[COMMANDS], [INIT-CMDS]) +# --------------------------------------------------- +# +# Specify additional commands to be run by config.status. This +# commands must be associated with a NAME, which should be thought +# as the name of a file the COMMANDS create. +AC_DEFUN([AC_CONFIG_COMMANDS], +[AC_DIVERT_PUSH(AC_DIVERSION_KILL) +AC_CONFIG_UNIQUE([$1]) +m4_append([AC_LIST_COMMANDS], [ $1]) + +ifelse([$2],,, [AC_FOREACH([AC_Name], [$1], +[m4_append([AC_LIST_COMMANDS_COMMANDS], +[ ]patsubst(AC_Name, [:.*])[ ) $2 ;; +])])]) +_AC_CONFIG_COMMANDS_INIT([$3]) +AC_DIVERT_POP()dnl +])dnl + +# Initialize the lists. +define([AC_LIST_COMMANDS]) +define([AC_LIST_COMMANDS_COMMANDS]) + + +# AC_OUTPUT_COMMANDS(EXTRA-CMDS, INIT-CMDS) # ----------------------------------------- +# Add additional commands for AC_OUTPUT to put into config.status. +# Use diversions instead of macros so we can be robust in the +# presence of commas in $1 and/or $2. +# FIXME: Obsolete it? +AC_DEFUN(AC_OUTPUT_COMMANDS, +[AC_DIVERT_PUSH(AC_DIVERSION_CMDS)dnl +[$1] +AC_DIVERT_POP()dnl +AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)dnl +[$2] +AC_DIVERT_POP()]) + + +# AC_CONFIG_COMMANDS_PRE(CMDS) +# ---------------------------- +# Commands to run right before config.status is created. Accumulates. +AC_DEFUN([AC_CONFIG_COMMANDS_PRE], +[m4_append([AC_OUTPUT_COMMANDS_PRE], [$1 +])]) + +# Initialize. +define([AC_OUTPUT_COMMANDS_PRE]) + + +# AC_CONFIG_COMMANDS_POST(CMDS) +# ----------------------------- +# Commands to run after config.status was created. Accumulates. +AC_DEFUN([AC_CONFIG_COMMANDS_POST], +[m4_append([AC_OUTPUT_COMMANDS_POST], [$1 +])]) + +# Initialize. +define([AC_OUTPUT_COMMANDS_POST]) + + +# AC_CONFIG_HEADERS(HEADERS..., [COMMANDS], [INIT-CMDS]) +# ------------------------------------------------------ # Specify that the HEADERS are to be created by instantiation of the # AC_DEFINEs. Associate the COMMANDS to the HEADERS. This macro # accumulates if called several times. @@ -2969,13 +3100,16 @@ AC_DIVERT_POP()dnl # AC_LIST_HEADERS_COMMANDS # esac AC_DEFUN([AC_CONFIG_HEADERS], -[AC_CONFIG_UNIQUE([$1])dnl -m4_append([AC_LIST_HEADERS], [ $1])dnl +[AC_DIVERT_PUSH(AC_DIVERSION_KILL) +AC_CONFIG_UNIQUE([$1]) +m4_append([AC_LIST_HEADERS], [ $1]) dnl Register the commands ifelse([$2],,, [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_HEADERS_COMMANDS], [ ]patsubst(AC_File, [:.*])[ ) $2 ;; -])])])dnl +])])]) +_AC_CONFIG_COMMANDS_INIT([$3]) +AC_DIVERT_POP()dnl ])dnl # Initialize to empty. It is much easier and uniform to have a config @@ -2992,30 +3126,25 @@ AC_DEFUN(AC_CONFIG_HEADER, [AC_CONFIG_HEADERS([$1])]) -# AC_CONFIG_LINKS(DEST:SOURCE..., [COMMANDS]) -# ------------------------------------------- +# AC_CONFIG_LINKS(DEST:SOURCE..., [COMMANDS], [INIT-CMDS]) +# -------------------------------------------------------- # Specify that config.status should establish a (symbolic if possible) # link from TOP_SRCDIR/SOURCE to TOP_SRCDIR/DEST. # Reject DEST=., because it is makes it hard for ./config.status # to guess the links to establish (`./config.status .'). -# This macro may be called multiple times. -# -# The commands are stored in a growing string AC_LIST_LINKS_COMMANDS -# which should be used like this: -# -# case $ac_file in -# AC_LIST_LINKS_COMMANDS -# esac AC_DEFUN(AC_CONFIG_LINKS, -[AC_CONFIG_UNIQUE([$1])dnl +[AC_DIVERT_PUSH(AC_DIVERSION_KILL) +AC_CONFIG_UNIQUE([$1]) ifelse(regexp([$1], [^\.:\| \.:]), -1,, - [AC_FATAL([$0: invalid destination: `.'])])dnl -m4_append([AC_LIST_LINKS], [ $1])dnl + [AC_FATAL([$0: invalid destination: `.'])]) +m4_append([AC_LIST_LINKS], [ $1]) dnl Register the commands ifelse([$2],,, [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_LINKS_COMMANDS], [ ]patsubst(AC_File, [:.*])[ ) $2 ;; -])])])dnl +])])]) +_AC_CONFIG_COMMANDS_INIT([$3]) +AC_DIVERT_POP()dnl ])dnl @@ -3045,8 +3174,8 @@ popdef([AC_Dsts])dnl -# AC_CONFIG_FILES(FILE...[, COMMANDS]) -# ------------------------------------ +# AC_CONFIG_FILES(FILE..., [COMMANDS], [INIT-CMDS]) +# ------------------------------------------------- # Specify output files, as with AC_OUTPUT, i.e., files that are # configured with AC_SUBST. Associate the COMMANDS to each FILE, # i.e., when config.status creates FILE, run COMMANDS afterwards. @@ -3058,13 +3187,16 @@ popdef([AC_Dsts])dnl # AC_LIST_FILES_COMMANDS # esac AC_DEFUN([AC_CONFIG_FILES], -[AC_CONFIG_UNIQUE([$1])dnl -m4_append([AC_LIST_FILES], [ $1])dnl +[AC_DIVERT_PUSH(AC_DIVERSION_KILL) +AC_CONFIG_UNIQUE([$1]) +m4_append([AC_LIST_FILES], [ $1]) dnl Register the commands. ifelse([$2],,, [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_FILES_COMMANDS], [ ]patsubst(AC_File, [:.*])[ ) $2 ;; -])])])dnl +])])]) +_AC_CONFIG_COMMANDS_INIT([$3]) +AC_DIVERT_POP()dnl ])dnl # Initialize the lists. @@ -3072,73 +3204,6 @@ define([AC_LIST_FILES]) define([AC_LIST_FILES_COMMANDS]) - -# AC_CONFIG_COMMANDS(NAME..., COMMANDS) -# ------------------------------------- -# Specify additional commands to be run by config.status. This -# commands must be associated with a NAME, which should be thought -# as the name of a file the COMMANDS create. -# -# This name must be a unique config key. -# -# The commands are stored in a growing string AC_LIST_COMMANDS_COMMANDS -# which should be used like this: -# -# case $ac_file in -# AC_LIST_COMMANDS_COMMANDS -# esac -AC_DEFUN([AC_CONFIG_COMMANDS], -[AC_CONFIG_UNIQUE([$1])dnl -m4_append([AC_LIST_COMMANDS], [ $1])dnl -dnl -ifelse([$2],,, [AC_FOREACH([AC_Name], [$1], -[m4_append([AC_LIST_COMMANDS_COMMANDS], -[ ]patsubst(AC_Name, [:.*])[ ) $2 ;; -])])])dnl -])dnl - -# Initialize the lists. -define([AC_LIST_COMMANDS]) -define([AC_LIST_COMMANDS_COMMANDS]) - - -# AC_OUTPUT_COMMANDS(EXTRA-CMDS, INIT-CMDS) -# ----------------------------------------- -# Add additional commands for AC_OUTPUT to put into config.status. -# Use diversions instead of macros so we can be robust in the -# presence of commas in $1 and/or $2. -# FIXME: Obsolete it? -AC_DEFUN(AC_OUTPUT_COMMANDS, -[AC_DIVERT_PUSH(AC_DIVERSION_CMDS)dnl -[$1] -AC_DIVERT_POP()dnl -AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)dnl -[$2] -AC_DIVERT_POP()]) - - -# AC_CONFIG_COMMANDS_PRE(CMDS) -# ---------------------------- -# Commands to run right before config.status is created. Accumulates. -AC_DEFUN([AC_CONFIG_COMMANDS_PRE], -[m4_append([AC_OUTPUT_COMMANDS_PRE], [$1 -])]) - -# Initialize. -define([AC_OUTPUT_COMMANDS_PRE]) - - -# AC_CONFIG_COMMANDS_POST(CMDS) -# ----------------------------- -# Commands to run after config.status was created. Accumulates. -AC_DEFUN([AC_CONFIG_COMMANDS_POST], -[m4_append([AC_OUTPUT_COMMANDS_POST], [$1 -])]) - -# Initialize. -define([AC_OUTPUT_COMMANDS_POST]) - - # AC_CONFIG_SUBDIRS(DIR ...) # -------------------------- # FIXME: `subdirs=' should not be here. @@ -3388,6 +3453,17 @@ trap 'rm -fr \$ac_cs_root*; exit 1' 1 2 15 EOF ])[]dnl ifval +dnl We output the INIT-CMDS first for obvious reasons :) + +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF # # CONFIG_COMMANDS section. # -undivert(AC_DIVERSION_ICMDS)dnl -EOF -cat >>$CONFIG_STATUS <<\EOF undivert(AC_DIVERSION_CMDS)dnl exit 0 EOF