From: Gary V. Vaughan Date: Mon, 28 Oct 2013 03:06:40 +0000 (+1300) Subject: bootstrap: search for a non-truncating sed binary. X-Git-Tag: v2.4.2.427~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=97a331b094b7842203f8bf0c4baf993fc8f522e2;p=thirdparty%2Flibtool.git bootstrap: search for a non-truncating sed binary. On at least Unixware 7.1.4, the first sed binary on PATH is unable to process the extract-trace scripts. * gl/build-aux/funclib.sh (PATH_SEPARATOR): Set to : or ; according to a feature test. (func_executable_p): New function. (SED): Search PATH for a sed binary that doesn't truncate its own output if available, and set SED accordingly. (scriptversion): Update. * Makefile.am (SCRIPT_ENV): New macro, for propagating configured variables. (ltdl_ac_aux_dir, $(ltmain_sh), install-data-local): Use it. * bootstrap: Regenerate. Reported by Tim Rice. Signed-off-by: Gary V. Vaughan --- diff --git a/Makefile.am b/Makefile.am index d6dbc68dc..01a87cb95 100644 --- a/Makefile.am +++ b/Makefile.am @@ -54,6 +54,8 @@ rebuild = rebuild=:; revision=`$(lt__cd) $(srcdir) && $(git_version_gen) | sed ' # Bootstrap. # # ---------- # +SCRIPT_ENV = SED='$(SED)' + build_scripts = $(srcdir)/$(aux_dir)/announce-gen \ $(srcdir)/$(aux_dir)/do-release-commit-and-tag \ $(srcdir)/$(aux_dir)/gendocs.sh \ @@ -161,7 +163,7 @@ $(ltmain_sh): $(ltmain_in) $(dotversion) if test 0 = '$(AM_DEFAULT_VERBOSITY)' && test 1 != '$(V)'; \ then echo " GEN " $@; \ else echo "$(inline_source) '$(ltmain_in)' |" $(bootstrap_edit) "> '$@'"; fi; \ - $(inline_source) '$(ltmain_in)' | $(bootstrap_edit) > '$@'; \ + $(SCRIPT_ENV) '$(inline_source)' '$(ltmain_in)' | $(bootstrap_edit) > '$@'; \ chmod a-w '$@'; \ fi @@ -248,7 +250,7 @@ all-local: $(LTDL_BOOTSTRAP_DEPS) ## ---------------- ## abs_aux_dir = `$(lt__cd) '$(srcdir)/$(aux_dir)' && pwd` -ltdl_ac_aux_dir = `$(extract_trace) AC_CONFIG_AUX_DIR $(srcdir)/libltdl/configure.ac` +ltdl_ac_aux_dir = `$(SCRIPT_ENV) $(extract_trace) AC_CONFIG_AUX_DIR $(srcdir)/libltdl/configure.ac` configure_edit = $(bootstrap_edit) \ -e '/^\. /s|@auxscriptsdir\@|'$(abs_aux_dir)'|g' \ @@ -507,7 +509,7 @@ install-data-local: $(lt_Makefile_in) $(INSTALL_DATA) "$(ltdldir)/$$p" "$(DESTDIR)$(pkgdatadir)/$$p"; \ done ## Inline helper-scripts for installed libtoolize script - '$(inline_source)' libtoolize > '$(DESTDIR)$(bindir)/libtoolize'; + $(SCRIPT_ENV) '$(inline_source)' libtoolize > '$(DESTDIR)$(bindir)/libtoolize'; -chmod a+x '$(DESTDIR)$(pkgdatadir)/configure' '$(DESTDIR)$(bindir)/libtoolize' diff --git a/bootstrap b/bootstrap index 83171b55e..f1376b137 100755 --- a/bootstrap +++ b/bootstrap @@ -9,7 +9,7 @@ # Source required external libraries: # Set a version string for this script. -scriptversion=2013-08-23.20; # UTC +scriptversion=2013-10-28.02; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 @@ -94,6 +94,31 @@ nl=' ' IFS="$sp $nl" +# There are apparently some retarded systems that use ';' as a PATH separator! +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + + +## ------------------------- ## +## Locate command utilities. ## +## ------------------------- ## + + +# func_executable_p FILE +# ---------------------- +# Check that FILE is an executable regular file. +func_executable_p () +{ + test -f "$1" && test -x "$1" +} + + # There are still modern systems that have problems with 'echo' mis- # handling backslashes, among others, so make sure $bs_echo is set to a # command that correctly interprets backslashes. @@ -134,6 +159,64 @@ else bs_echo='sh -c $bs_echo_body bs_echo' fi +# Unless the user overrides by setting SED, search the path for either GNU +# sed, or the sed that truncates its output the least. +test -z "$SED" && { + _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for _G_i in 1 2 3 4 5 6 7; do + _G_sed_script="$_G_sed_script$nl$_G_sed_script" + done + echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed + _G_sed_script= + + _G_path_prog_found=false + _G_save_IFS=$IFS; IFS=$PATH_SEPARATOR + for _G_dir in $PATH:/usr/xpg4/bin; do + IFS=$_G_save_IFS + test -z "$_G_dir" && _G_dir=. + for _G_prog_name in sed gsed; do + for _exeext in '' .EXE; do + _G_path_prog="$_G_dir/$_G_prog_name$_exeext" + func_executable_p "$_G_path_prog" || continue + case `"$_G_path_prog" --version 2>&1` in + *GNU*) _G_path_SED=$_G_path_prog _G_path_prog_found=: ;; + *) + _G_count=0 + _G_path_prog_max=0 + $bs_echo_n 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + $bs_echo '' >> conftest.nl + "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test $_G_count -gt $_G_path_prog_max; then + # Best one so far, save it but keep looking for a better one + _G_path_SED=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test $_G_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + ;; + esac + + $_G_path_prog_found && break 3 + done + done + done + IFS=$_G_save_IFS + test -z "$_G_path_SED" && { + echo "no acceptable sed could be found in \$PATH" >&2 + exit 1 + } + SED=$_G_path_SED +} + ## ------------------------------- ## ## User overridable command paths. ## @@ -154,7 +237,6 @@ fi : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} -: ${SED="sed"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} diff --git a/gl/build-aux/funclib.sh b/gl/build-aux/funclib.sh index 2f27d772a..d42b27b1e 100644 --- a/gl/build-aux/funclib.sh +++ b/gl/build-aux/funclib.sh @@ -1,5 +1,5 @@ # Set a version string for this script. -scriptversion=2013-08-23.20; # UTC +scriptversion=2013-10-28.02; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 @@ -84,6 +84,31 @@ nl=' ' IFS="$sp $nl" +# There are apparently some retarded systems that use ';' as a PATH separator! +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + + +## ------------------------- ## +## Locate command utilities. ## +## ------------------------- ## + + +# func_executable_p FILE +# ---------------------- +# Check that FILE is an executable regular file. +func_executable_p () +{ + test -f "$1" && test -x "$1" +} + + # There are still modern systems that have problems with 'echo' mis- # handling backslashes, among others, so make sure $bs_echo is set to a # command that correctly interprets backslashes. @@ -124,6 +149,64 @@ else bs_echo='sh -c $bs_echo_body bs_echo' fi +# Unless the user overrides by setting SED, search the path for either GNU +# sed, or the sed that truncates its output the least. +test -z "$SED" && { + _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for _G_i in 1 2 3 4 5 6 7; do + _G_sed_script="$_G_sed_script$nl$_G_sed_script" + done + echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed + _G_sed_script= + + _G_path_prog_found=false + _G_save_IFS=$IFS; IFS=$PATH_SEPARATOR + for _G_dir in $PATH:/usr/xpg4/bin; do + IFS=$_G_save_IFS + test -z "$_G_dir" && _G_dir=. + for _G_prog_name in sed gsed; do + for _exeext in '' .EXE; do + _G_path_prog="$_G_dir/$_G_prog_name$_exeext" + func_executable_p "$_G_path_prog" || continue + case `"$_G_path_prog" --version 2>&1` in + *GNU*) _G_path_SED=$_G_path_prog _G_path_prog_found=: ;; + *) + _G_count=0 + _G_path_prog_max=0 + $bs_echo_n 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + $bs_echo '' >> conftest.nl + "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test $_G_count -gt $_G_path_prog_max; then + # Best one so far, save it but keep looking for a better one + _G_path_SED=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test $_G_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + ;; + esac + + $_G_path_prog_found && break 3 + done + done + done + IFS=$_G_save_IFS + test -z "$_G_path_SED" && { + echo "no acceptable sed could be found in \$PATH" >&2 + exit 1 + } + SED=$_G_path_SED +} + ## ------------------------------- ## ## User overridable command paths. ## @@ -144,7 +227,6 @@ fi : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} -: ${SED="sed"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"}