From: Ralf Wildenhues Date: Sat, 21 Jan 2006 16:44:41 +0000 (+0000) Subject: * bootstrap: Don't use semicolons inside { } in sed scripts, as X-Git-Tag: release-2-1b~340 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d9ab46f1ec660675dcfa715194dae0b81f440cc;p=thirdparty%2Flibtool.git * bootstrap: Don't use semicolons inside { } in sed scripts, as Posix says it's not portable. * Makefile.am (libltdl/Makefile.am): Likewise. * libtoolize.m4sh (all over the map): Likewise. * libltdl/config/getopt.m4sh (func_version, func_usage) (func_help): Likewise. * libltdl/config/ltmain.m4sh (func_win32_libid): Likewise. * libltdl/m4/libtool.m4 (_LT_SYS_MODULE_PATH_AIX): Likewise. * clcommit.m4sh, libltdl/config/mailnotify.m4sh: Likewise. * tests/sh.test, tests/testsuite.at (LT_AT_TAG): Likewise. Noted by Paul Eggert . --- diff --git a/ChangeLog b/ChangeLog index 6f7648ed6..3acacae28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2006-01-21 Ralf Wildenhues + * bootstrap: Don't use semicolons inside { } in sed scripts, as + Posix says it's not portable. + * Makefile.am (libltdl/Makefile.am): Likewise. + * libtoolize.m4sh (all over the map): Likewise. + * libltdl/config/getopt.m4sh (func_version, func_usage) + (func_help): Likewise. + * libltdl/config/ltmain.m4sh (func_win32_libid): Likewise. + * libltdl/m4/libtool.m4 (_LT_SYS_MODULE_PATH_AIX): Likewise. + * clcommit.m4sh, libltdl/config/mailnotify.m4sh: Likewise. + * tests/sh.test, tests/testsuite.at (LT_AT_TAG): Likewise. + Noted by Paul Eggert . + * libltdl/config/ltmain.m4sh (func_mode_compile): Also transform `.obj' correctly. Reported by George Bosilca . diff --git a/Makefile.am b/Makefile.am index 1caef99d8..316beaaa0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -214,9 +214,9 @@ $(srcdir)/libltdl/Makefile.am: $(srcdir)/libltdl/Makefile.inc echo 'CLEANFILES ='; \ echo 'MOSTLYCLEANFILES ='; \ } >> $$out; \ - $(SED) -n '/^.. DO NOT REMOVE THIS LINE -- /,$$ \ - { s,libltdl_,,; s,libltdl/,,; s,: libltdl/,: ,; \ - s,\$$(libltdl_,$$(,; p; }' $$in >> $$out; + $(SED) -n '/^.. DO NOT REMOVE THIS LINE -- /,$$p' | \ + $(SED) -e 's,libltdl_,,; s,libltdl/,,; s,: libltdl/,: ,' \ + -e 's,\$$(libltdl_,$$(,' $$in >> $$out; chmod a-w $(srcdir)/libltdl/Makefile.am $(srcdir)/libltdl/Makefile.in: $(srcdir)/libltdl/Makefile.am \ diff --git a/bootstrap b/bootstrap index f16f71bb7..d98cdea75 100755 --- a/bootstrap +++ b/bootstrap @@ -99,7 +99,11 @@ if test -z "$reconfdirs"; then fi # Extract the package name and version number from configure.ac: -set dummy `$SED -n '/AC_INIT/{s/[][,()]/ /g; p;}' configure.ac` +set dummy `$SED -n ' + /AC_INIT/{ + s/[][,()]/ /g + p + }' configure.ac` shift # Whip up a dirty Makefile: diff --git a/clcommit.m4sh b/clcommit.m4sh index 20223ed47..8548477a1 100644 --- a/clcommit.m4sh +++ b/clcommit.m4sh @@ -392,7 +392,11 @@ func_commit () { if $opt_tla; then tla_log=`$TLA make-log` - test -n "$summary" || summary=`$SED -e '1{s/^Summary: *//;q;}'` + test -n "$summary" || summary=`$SED -e ' + 1{ + s/^Summary: *// + q + }'` echo "Summary: $summary" > "$tla_log$$T" && $SED 1d "$tla_log" >> "$tla_log$$T" && cat < "$log_file" >> "$tla_log$$T" && @@ -458,7 +462,11 @@ func_mailnotify () ${PAGER-more} "$notify_file" || break # Break out the subject line again - my_mail_subject=`$SED -e '1{s/^Subject: *//;q;}' "$notify_file"` + my_mail_subject=`$SED -e ' + 1{ + s/^Subject: *// + q + }' "$notify_file"` my_mail_body=`$SED -e '2,$p;d' "$notify_file"` echo "$my_mail_body" > "$notify_file" diff --git a/libltdl/config/getopt.m4sh b/libltdl/config/getopt.m4sh index abaac254f..493e201a8 100644 --- a/libltdl/config/getopt.m4sh +++ b/libltdl/config/getopt.m4sh @@ -32,9 +32,10 @@ m4_include([general.m4sh]) func_version () { $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { - s/^# //; s/^# *$//; - s/\((C)\)[[ 0-9,-]]*\( [[1-9]][[0-9]]*\)/\1\2/; - p; + s/^# // + s/^# *$// + s/\((C)\)[[ 0-9,-]]*\( [[1-9]][[0-9]]*\)/\1\2/ + p }' < "$progpath" exit $? } @@ -44,9 +45,10 @@ func_version () func_usage () { $SED -n '/^# Usage:/,/# -h/ { - s/^# //; s/^# *$//; - s/\$progname/'$progname'/; - p; + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p }' < "$progpath" $ECHO $ECHO "run \`$progname --help | more' for full usage" @@ -58,16 +60,17 @@ func_usage () func_help () { $SED -n '/^# Usage:/,/# Report bugs to/ { - s/^# //; s/^# *$//; - s*\$progname*'$progname'*; - s*\$SHELL*'"$SHELL"'*; - s*\$LTCC*'"$LTCC"'*; - s*\$LTCFLAGS*'"$LTCFLAGS"'*; - s*\$LD*'"$LD"'*; - s/\$with_gnu_ld/'"$with_gnu_ld"'/; - s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/; - s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/; - p; + s/^# // + s/^# *$// + s*\$progname*'$progname'* + s*\$SHELL*'"$SHELL"'* + s*\$LTCC*'"$LTCC"'* + s*\$LTCFLAGS*'"$LTCFLAGS"'* + s*\$LD*'"$LD"'* + s/\$with_gnu_ld/'"$with_gnu_ld"'/ + s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ + p }' < "$progpath" exit $? } diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index b705b161f..a21aa14e6 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -683,7 +683,14 @@ func_win32_libid () if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | - $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` + $SED -n -e ' + 1,100{ + / I /{ + s,.*,import, + p + q + } + }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; diff --git a/libltdl/config/mailnotify.m4sh b/libltdl/config/mailnotify.m4sh index 45a150fbb..69de0adf0 100644 --- a/libltdl/config/mailnotify.m4sh +++ b/libltdl/config/mailnotify.m4sh @@ -204,7 +204,12 @@ func_headers () { my_outfile="$1" my_destination="$2" - my_sed_version_no='/^# '$PROGRAM' (GNU / { s/^# .*version //; p; }; d' + my_sed_version_no=' + /^# '$PROGRAM' (GNU / { + s/^# .*version // + p + } + d' { echo "User-Agent: $PROGRAM/`$SED \"$my_sed_version_no\" < $progpath`" diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index 28104480e..0fdd554ab 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -887,11 +887,18 @@ $RM conftest* # to the aix ld manual. m4_defun([_LT_SYS_MODULE_PATH_AIX], [AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi],[]) +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi],[]) if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ])# _LT_SYS_MODULE_PATH_AIX diff --git a/libtoolize.m4sh b/libtoolize.m4sh index 415acbc8c..22cb006a1 100644 --- a/libtoolize.m4sh +++ b/libtoolize.m4sh @@ -339,7 +339,10 @@ func_scan_files () # Set local variables to reflect contents of configure.ac my_sed_scan_configure_ac='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,; - /AC_INIT/ { s,^.*$,seen_autoconf=:,; p; }; + /AC_INIT/ { + s,^.*$,seen_autoconf=:, + p + } d' test -z "$configure_ac" \ || eval `$SED "$my_sed_scan_configure_ac" "$configure_ac"` @@ -358,27 +361,48 @@ func_scan_files () # Probe macro usage in configure.ac and/or aclocal.m4. # # ---------------------------------------------------- # - my_sed_traces='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,; - s,^.*AC_REQUIRE(.*$,,; s,^.*m4[]_require(.*$,,; s,^.*m4[]_define(.*$,,; - s,^.*A[[CU]]_DEFUN(.*$,,; s,^.*m4[]_defun(.*$,,; + my_sed_traces='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,, + s,^.*AC_REQUIRE(.*$,,; s,^.*m4[]_require(.*$,,; s,^.*m4[]_define(.*$,, + s,^.*A[[CU]]_DEFUN(.*$,,; s,^.*m4[]_defun(.*$,, /AC_CONFIG_AUX_DIR(/ { - s,^.*AC_CONFIG_AUX_DIR([[[ ]*\([^])]]*\).*$,auxdir=\1,; p; - }; + s,^.*AC_CONFIG_AUX_DIR([[[ ]*\([^])]]*\).*$,auxdir=\1, + p + } /AC_CONFIG_MACRO_DIR(/ { - s,^.*AC_CONFIG_MACRO_DIR([[[ ]*\([^])]]*\).*$,macrodir=\1,; p; - }; - /_LT_CONFIG_LTDL_DIR(/d; + s,^.*AC_CONFIG_MACRO_DIR([[[ ]*\([^])]]*\).*$,macrodir=\1, + p + } + /_LT_CONFIG_LTDL_DIR(/d /LT_CONFIG_LTDL_DIR(/ { - s/^.*LT_CONFIG_LTDL_DIR([[[ ]*\([^]),]*\)[^,]]*/ac_ltdldir=\1%%/; - s/%%[[[, ]*\([^])]]*\).*$/ ac_ltdl_mode=\1%%/; - s/%%.*$//; p; - }; - /A[[CM]]_PROG_LIBTOOL/ { s,^.*$,seen_libtool=:,; p; }; - /LT_INIT/ { s,^.*$,seen_libtool=:,; p; }; - /LTDL_INIT/ { s,^.*$,seen_ltdl=:,; p; }; - /LT_WITH_LTDL/ { s,^.*$,seen_ltdl=:,; p; }; - /AC_LIB_LTDL/ { s,^.*$,seen_ltdl=:,; p; }; - /AC_WITH_LTDL/ { s,^.*$,seen_ltdl=:,; p; }; + s/^.*LT_CONFIG_LTDL_DIR([[[ ]*\([^]),]*\)[^,]]*/ac_ltdldir=\1%%/ + s/%%[[[, ]*\([^])]]*\).*$/ ac_ltdl_mode=\1%%/ + s/%%.*$// + p + } + /A[[CM]]_PROG_LIBTOOL/ { + s,^.*$,seen_libtool=:, + p + } + /LT_INIT/ { + s,^.*$,seen_libtool=:, + p + } + /LTDL_INIT/ { + s,^.*$,seen_ltdl=:, + p + } + /LT_WITH_LTDL/ { + s,^.*$,seen_ltdl=:, + p + } + /AC_LIB_LTDL/ { + s,^.*$,seen_ltdl=:, + p + } + /AC_WITH_LTDL/ { + s,^.*$,seen_ltdl=:, + p + } d' eval `cat aclocal.m4 "$configure_ac" 2>/dev/null | $SED "$my_sed_traces"` @@ -470,8 +494,11 @@ func_scan_files () # If AC_CONFIG_MACRO_DIR turned nothing up, we hunt for ACLOCAL_AMFLAGS # in `Makefile.am' for a `-I' argument. - my_sed_aclocal_flags='/^[[ ]]*ACLOCAL_[[A-Z_]]*FLAGS[[ ]]*=/ { - s,^[[^=]]*=[[ ]]*\(.*\), \1,; q; }; + my_sed_aclocal_flags=' + /^[[ ]]*ACLOCAL_[[A-Z_]]*FLAGS[[ ]]*=/ { + s,^[[^=]]*=[[ ]]*\(.*\), \1, + q + } d' m4dir="$macrodir" if test ! -n "$m4dir" && test -f Makefile.am; then @@ -500,7 +527,10 @@ func_included_files () my_include_regex= my_sed_include=' - /^[m4]_include(\[[.*\]])$/ { s,^[m4]_include(\[[\(.*\)\]])$,\1,; p; }; + /^[m4]_include(\[[.*\]])$/ { + s,^[m4]_include(\[[\(.*\)\]])$,\1, + p + } d' if test -f "$my_searchfile"; then @@ -523,9 +553,11 @@ func_serial () $opt_debug my_filename="$1" my_macro_regex="$2" - my_sed_serial=['/^# serial [1-9][0-9.]*[ ]*'"$my_macro_regex"'[ ]*$/ { - s,^# serial \([1-9][0-9.]*\).*$,\1,; q; - }; + my_sed_serial=[' + /^# serial [1-9][0-9.]*[ ]*'"$my_macro_regex"'[ ]*$/ { + s,^# serial \([1-9][0-9.]*\).*$,\1, + q + } d'] # Search FILENAME and all the files it m4_includes for a serial number @@ -755,10 +787,12 @@ func_keyword_update () func_ltmain_update () { $opt_debug - my_sed_ltmain=['/^package_revision='\''*[0-9][1-9.]*'\''*/ { - s,^package_revision='\''*\([0-9.]*\)'\''*[ ]*$,\1,; p; - }; - d'] + my_sed_ltmain=[' + /^package_revision='\''*[0-9][1-9.]*'\''*/ { + s,^package_revision='\''*\([0-9.]*\)'\''*[ ]*$,\1, + p + } + d'] func_keyword_update "$1" "$2" "$3" "$my_sed_ltmain" @@ -773,10 +807,13 @@ func_ltmain_update () func_config_update () { $opt_debug - my_sed_config=['/^timestamp='\''*[0-9][1-9-]*'\''*/ { - s,^timestamp='\''*\([0-9-]*\)'\''*,\1,; s/-/./g; p; - }; - d'] + my_sed_config=[' + /^timestamp='\''*[0-9][1-9-]*'\''*/ { + s,^timestamp='\''*\([0-9-]*\)'\''*,\1, + s/-/./g + p + } + d'] func_keyword_update "$1" "$2" "$3" "$my_sed_config" @@ -791,10 +828,13 @@ func_config_update () func_install_update () { $opt_debug - my_sed_install=['/^scriptversion='\''*[0-9][1-9.-]*'\''*/ { - s,^scriptversion='\''*\([0-9.-]*\)'\''*,\1,; s/-/./g; p; - }; - d'] + my_sed_install=[' + /^scriptversion='\''*[0-9][1-9.-]*'\''*/ { + s,^scriptversion='\''*\([0-9.-]*\)'\''*,\1, + s/-/./g + p + } + d'] func_keyword_update "$1" "$2" "$3" "$my_sed_install" diff --git a/tests/sh.test b/tests/sh.test index fec6fb261..7783ade0b 100755 --- a/tests/sh.test +++ b/tests/sh.test @@ -84,8 +84,13 @@ fi # Check for using shift after set dummy (same or following line). for s in $scripts do - if $SED -n '/set[ ][ ]*dummy/{/set.*dummy.*;.*shift/d;N;/\n.*shift/D;p;}' "$s" | - $EGREP .; then + if $SED -n ' + /set[ ][ ]*dummy/{ + /set.*dummy.*;.*shift/d + N + /\n.*shift/D + p + }' "$s" | $EGREP .; then echo "use \`shift' after \`set dummy' in $s" status=$EXIT_FAILURE fi @@ -95,8 +100,12 @@ done # redirect stderr so we also barf when sed issues diagnostics. for s in $scripts do - if $SED -n '/^func_/{N;/^func_[^ ]* ()\n{$/d;p;}' "$s" 2>&1 | - $EGREP .; then + if $SED -n ' + /^func_/{ + N + /^func_[^ ]* ()\n{$/d + p + }' "$s" 2>&1 | $EGREP .; then echo "Function definitions should look like this in $s: func_foo () { @@ -112,7 +121,7 @@ for s in "$m4dir/libtool.m4" do if $SED -n '/case \$cc_basename in/,/esac/ { /^[ ]*[a-zA-Z][a-zA-Z0-9+]*[^*][ ]*)/p - };' $s 2>&1 | $EGREP .; then + }' $s 2>&1 | $EGREP .; then echo "\$cc_basename matches should include a trailing \`*' in $s." status=$EXIT_FAILURE fi diff --git a/tests/testsuite.at b/tests/testsuite.at index 08de5bf8c..31bd83afc 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -152,7 +152,11 @@ m4_define([LT_AT_EXEC_CHECK], # -------------- m4_define([LT_AT_TAG], [AT_KEYWORDS([$1]) -eval `$LIBTOOL --tag=$1 --config | sed -n '/^CC=/ { s/CC/$1/; p;}'` +eval `$LIBTOOL --tag=$1 --config | sed -n ' + /^CC=/{ + s/CC/$1/ + p + }'` AT_CHECK([test -n "[$]$1" || (exit 77)]) ])