From 3796d1fe58e5cab065021f215aec47e44ab91f78 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 10 Nov 2008 08:25:24 +0100 Subject: [PATCH] Use documented M4sh interfaces. * clcommit.m4sh: Do not unset CDPATH, use AS_INIT and M4sh diversions. * libltdl/config/mailnotify.m4sh: Likewise. * libtoolize.m4sh: Likewise. * tests/defs.m4sh: Likewise. * tests/testsuite.at: Move AT_INIT invocation at the top. * libltdl/m4/libtool.m4 (_LT_GENERATED_FILE_INIT): New. (LT_OUTPUT): Use it. * libltdl/config/general.m4sh (M4SH_IN_HEADER): New. (progpath): Move setting before $0 could be clobbered. * libltdl/config/ltmain.m4sh (M4SH_IN_HEADER): New. --- ChangeLog | 16 +++++++++++++ clcommit.m4sh | 7 ++---- libltdl/config/general.m4sh | 20 ++++++++++------ libltdl/config/ltmain.m4sh | 4 ++++ libltdl/config/mailnotify.m4sh | 7 ++---- libltdl/m4/libtool.m4 | 44 ++++++++++++++++++++++++---------- libtoolize.m4sh | 8 ++----- tests/defs.m4sh | 8 +++---- tests/testsuite.at | 5 ++-- 9 files changed, 77 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7450c7b27..ca5db4494 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2008-11-10 Paolo Bonzini + + Use documented M4sh interfaces. + * clcommit.m4sh: Do not unset CDPATH, use AS_INIT and M4sh diversions. + * libltdl/config/mailnotify.m4sh: Likewise. + * libtoolize.m4sh: Likewise. + * tests/defs.m4sh: Likewise. + * tests/testsuite.at: Move AT_INIT invocation at the top. + + * libltdl/m4/libtool.m4 (_LT_INIT_GENERATED): New. + (LT_OUTPUT): Use it. + + * libltdl/config/general.m4sh (M4SH_IN_HEADER): New. + (progpath): Move setting before $0 could be clobbered. + * libltdl/config/ltmain.m4sh (M4SH_IN_HEADER): New. + 2008-11-10 Paolo Bonzini Run sh.test on the M4sh source. diff --git a/clcommit.m4sh b/clcommit.m4sh index 0d3ba42fc..73719ccf8 100644 --- a/clcommit.m4sh +++ b/clcommit.m4sh @@ -1,5 +1,4 @@ -m4_define([_m4_divert(SCRIPT)], 100) -m4_divert_push([SCRIPT])#!/bin/sh +AS_INIT[]m4_divert_push([HEADER-COPYRIGHT])dnl # @configure_input@ # clcommit (GNU @PACKAGE@) version 2.0 @@ -80,9 +79,7 @@ test -f "libltdl/config/$MKSTAMP" && MKSTAMP="libltdl/config/$MKSTAMP" PROGRAM=clcommit -AS_SHELL_SANITIZE -$as_unset CDPATH - +m4_divert_pop m4_include([getopt.m4sh]) M4SH_VERBATIM([[ diff --git a/libltdl/config/general.m4sh b/libltdl/config/general.m4sh index 53ff5ea0f..cde735485 100644 --- a/libltdl/config/general.m4sh +++ b/libltdl/config/general.m4sh @@ -30,6 +30,19 @@ or obtained by writing to the Free Software Foundation, Inc., m4_define([M4SH_VERBATIM], [$1])dnl +m4_ifndef([M4SH_IN_HEADER], +[m4_define([M4SH_IN_HEADER], +[m4_divert_text([HEADER-COPYRIGHT], [$1])])]) + +M4SH_IN_HEADER([dnl +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" +]) + M4SH_VERBATIM([[ : ${CP="cp -f"} : ${ECHO="echo"} @@ -87,13 +100,6 @@ func_dirname_and_basename () # Generated shell functions inserted here. -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - # The name of this program: # In the unlikely event $progname began with a '-', it would play havoc with # func_echo (imagine progname=-n), so we prepend ./ in that case: diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index e7a5ff0cf..363ab932c 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -111,6 +111,10 @@ done $lt_unset CDPATH +dnl This script is generated by config.status, so we cannot put things +dnl in the header. +m4_define([M4SH_IN_HEADER], [$1])dnl + m4_include([getopt.m4sh]) M4SH_VERBATIM([[ diff --git a/libltdl/config/mailnotify.m4sh b/libltdl/config/mailnotify.m4sh index 20d6b832a..a95f201a0 100644 --- a/libltdl/config/mailnotify.m4sh +++ b/libltdl/config/mailnotify.m4sh @@ -1,5 +1,4 @@ -m4_define([_m4_divert(SCRIPT)], 100) -m4_divert_push([SCRIPT])#!/bin/sh +AS_INIT[]m4_divert_push([HEADER-COPYRIGHT])dnl # @configure_input@ # mailnotify (GNU @PACKAGE@) version 0.6 @@ -63,9 +62,7 @@ m4_divert_push([SCRIPT])#!/bin/sh PROGRAM=mailnotify -AS_SHELL_SANITIZE -$as_unset CDPATH - +m4_divert_pop m4_include([getopt.m4sh]) M4SH_VERBATIM([[ diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index caf88b187..23f3142bd 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -553,6 +553,35 @@ esac _LT_OUTPUT_LIBTOOL_INIT ]) +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# `#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test $lt_write_fail = 0 && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- @@ -562,20 +591,11 @@ _LT_OUTPUT_LIBTOOL_INIT AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) -cat >"$CONFIG_LT" <<_LTEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate a libtool stub with the current configuration. - -lt_cl_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_LTEOF +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF -AS_SHELL_SANITIZE -_AS_PREPARE - -exec AS_MESSAGE_FD>&1 +lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo diff --git a/libtoolize.m4sh b/libtoolize.m4sh index 456b4cfe0..30c3e3b1a 100644 --- a/libtoolize.m4sh +++ b/libtoolize.m4sh @@ -1,7 +1,5 @@ m4_pattern_allow([dnl]) -m4_define([_m4_divert(SCRIPT)], 100) -m4_divert_push([SCRIPT])dnl -#! /bin/sh +AS_INIT[]m4_divert_push([HEADER-COPYRIGHT])dnl # @configure_input@ # libtoolize (GNU @PACKAGE@@TIMESTAMP@) @VERSION@ @@ -72,9 +70,7 @@ m4_divert_push([SCRIPT])dnl PROGRAM=libtoolize -AS_SHELL_SANITIZE -$as_unset CDPATH - +m4_divert_pop m4_include([getopt.m4sh]) M4SH_VERBATIM([[ diff --git a/tests/defs.m4sh b/tests/defs.m4sh index c46781804..48d1d3722 100644 --- a/tests/defs.m4sh +++ b/tests/defs.m4sh @@ -1,5 +1,5 @@ -m4_define([_m4_divert(SCRIPT)], 100) -m4_divert_push([SCRIPT])# @configure_input@ +AS_INIT[]m4_divert_push([HEADER-COPYRIGHT])dnl +# @configure_input@ # defs -- Defines for Libtool testing environment. # # Copyright (C) 2003, 2004, 2005, 2007, 2008 Free Software @@ -26,9 +26,7 @@ m4_divert_push([SCRIPT])# @configure_input@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #### -AS_SHELL_SANITIZE -$as_unset CDPATH - +m4_divert_pop m4_include([general.m4sh]) M4SH_VERBATIM([[ diff --git a/tests/testsuite.at b/tests/testsuite.at index d5b0fe85b..599029144 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -23,6 +23,8 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #### +AT_INIT + m4_divert_push([PREPARE_TESTS])dnl : ${tst_dist=dist} : ${ACLOCAL=aclocal} @@ -371,5 +373,4 @@ dnl AT_TESTED([grep autoreconf autom4te automake]) ## The suite. ## ## ----------- ## -AT_INIT -# The other tests will be appended here by the Makefile rule. +# Tests will be appended here by the Makefile rule. -- 2.47.2