From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1499) id 2157F3889E09; Thu, 15 Dec 2022 14:28:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2157F3889E09 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671114490; bh=dXmM9ACQjFwtdMGYWBSySsNQ1T3E/AwBZchM49B5XGU=; h=From:To:Subject:Date:From; b=Hv7l3u1rTRe0eHQW91HhBNZtIdLbk4vEK8vJKRI4vsEOuZO2DjI2NMyuxlfsh1B86 2YBpZfxvb0OM30Tza4mGVXA6jqSextPfYh1aosP8XYBVJ/WBvVPv+AUaBmHHjM9o0A fM6IlMT0fsTVpyye/OaEdP0jmOckH8+N6AT9rx+0= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Gaius Mulley To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4721] Subject: [committed, pushed] PR-107607 m2: Remove bdepend on realpath, cut and echo X-Act-Checkin: gcc X-Git-Author: Gaius Mulley X-Git-Refname: refs/heads/master X-Git-Oldrev: 4a1648084137f515eddd5dc087d5dfbf360a5bfa X-Git-Newrev: 85d0d2683b7b00b9ec77ef4dc6a4494df6c7f555 Message-Id: <20221215142810.2157F3889E09@sourceware.org> Date: Thu, 15 Dec 2022 14:28:10 +0000 (GMT) List-Id: https://gcc.gnu.org/g:85d0d2683b7b00b9ec77ef4dc6a4494df6c7f555 commit r13-4721-g85d0d2683b7b00b9ec77ef4dc6a4494df6c7f555 Author: Gaius Mulley Date: Thu Dec 15 14:25:05 2022 +0000 Subject: [committed, pushed] PR-107607 m2: Remove bdepend on realpath, cut and echo It can be replaced by a subshell'd cd just fine. (cd gcc/m2; autoconf-2.69) gcc/m2/ChangeLog: * configure.ac: Stop probing for realpath. * tools-src/calcpath: Break dependency on realpath, cut and echo. * configure: Rebuilt. Signed-off-by: Gaius Mulley Diff: --- gcc/m2/configure | 47 ----------------------------------------------- gcc/m2/configure.ac | 5 ----- gcc/m2/tools-src/calcpath | 34 ++++++++++++++++++---------------- 3 files changed, 18 insertions(+), 68 deletions(-) diff --git a/gcc/m2/configure b/gcc/m2/configure index db1ca3d1f9b..91768ab9c6f 100755 --- a/gcc/m2/configure +++ b/gcc/m2/configure @@ -630,7 +630,6 @@ CPPFLAGS LDFLAGS CFLAGS CC -regex_realpath target_os target_vendor target_cpu @@ -2235,52 +2234,6 @@ test -n "$target_alias" && NONENONEs,x,x, && program_prefix=${target_alias}- -for ac_prog in realpath -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_regex_realpath+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$regex_realpath"; then - ac_cv_prog_regex_realpath="$regex_realpath" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_regex_realpath="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -regex_realpath=$ac_cv_prog_regex_realpath -if test -n "$regex_realpath"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $regex_realpath" >&5 -$as_echo "$regex_realpath" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$regex_realpath" && break -done - -if test x$regex_realpath = "x" ; then - as_fn_error $? "realpath is required to build GNU Modula-2 (hint install coreutils)." "$LINENO" 5 -fi - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' diff --git a/gcc/m2/configure.ac b/gcc/m2/configure.ac index 756e01c4321..5583af7f64c 100644 --- a/gcc/m2/configure.ac +++ b/gcc/m2/configure.ac @@ -24,11 +24,6 @@ AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_CANONICAL_TARGET -AC_CHECK_PROGS(regex_realpath, realpath) -if test x$regex_realpath = "x" ; then - AC_MSG_ERROR([realpath is required to build GNU Modula-2 (hint install coreutils).]) -fi - AC_CHECK_FUNCS([stpcpy]) AC_CHECK_HEADERS(sys/types.h) diff --git a/gcc/m2/tools-src/calcpath b/gcc/m2/tools-src/calcpath index e0817704f64..05324513aa1 100755 --- a/gcc/m2/tools-src/calcpath +++ b/gcc/m2/tools-src/calcpath @@ -23,27 +23,29 @@ Usage () { - echo "Usage: calcpath pathcomponent1 pathcomponent2 subdir" - echo -n " if pathcomponent1 is relative then pathcomponent1/pathcomponet2/subdir is" - echo " returned" - echo " otherwise pathcomponet2/subdir is returned" - echo " the path is checked for legality in subdir." + cat<&2 + exit 1 +} if [ $# -eq 3 ]; then - if [ "$(echo $2 | cut -b 1)" = "." ] ; then - # relative path - the_path=$1/$2/$3 - else - the_path=$2/$3 - fi - cd $3 - if realpath ${the_path} > /dev/null ; then - echo ${the_path} + case "$2" in + /*) the_path="$2/$3" ;; + *) the_path="$1/$2/$3" ;; + esac + cd "$3" || die "could not access $3" + if ( cd "$the_path" ); then + printf '%s\n' "${the_path}" else - echo "calcpath: error ${the_path} is not a valid path in subdirectory $3" 1>&2 - exit 1 + die "${the_path} is not a valid path in subdirectory $3" fi else Usage