88
99set -e
1010
11- # Use GNU version for make, nproc, readlink and sed on *BSD
12- case " $OSTYPE " in
13- * bsd* )
14- MAKE=" gmake"
15- NPROC=" gnproc"
16- READLINK=" greadlink"
17- SED=" gsed"
18- ;;
19- * )
20- MAKE=" make"
21- NPROC=" nproc"
22- READLINK=" readlink"
23- SED=" sed"
24- ;;
25- esac
11+ # Use system's GNU version for make, nproc, readlink and sed on *BSD
12+ MAKE=$( command -v gmake|| command -v make)
13+ NPROC=$( command -v gnproc|| command -v nproc)
14+ READLINK=$( command -v greadlink|| command -v readlink)
15+ SED=$( command -v gsed|| command -v sed)
2616
2717ME=" ${0} "
2818ME_dir=" $( dirname -- " $( " ${READLINK} " -fm -- " ${ME} " ) " ) "
@@ -49,24 +39,8 @@ path_GNU="$("${READLINK}" -fm -- "${path_GNU:-${path_UUTILS}/../gnu}")"
4939
5040# ##
5141
52- # On MacOS there is no system /usr/bin/timeout
53- # and trying to add it to /usr/bin (with symlink of copy binary) will fail unless system integrity protection is disabled (not ideal)
54- # ref: https://support.apple.com/en-us/102149
55- # On MacOS the Homebrew coreutils could be installed and then "sudo ln -s /opt/homebrew/bin/timeout /usr/local/bin/timeout"
56- # Set to /usr/local/bin/timeout instead if /usr/bin/timeout is not found
57- SYSTEM_TIMEOUT=" timeout"
58- if [ -x /usr/bin/timeout ]; then
59- SYSTEM_TIMEOUT=" /usr/bin/timeout"
60- elif [ -x /usr/local/bin/timeout ]; then
61- SYSTEM_TIMEOUT=" /usr/local/bin/timeout"
62- fi
63-
64- SYSTEM_YES=" yes"
65- if [ -x /usr/bin/yes ]; then
66- SYSTEM_YES=" /usr/bin/yes"
67- elif [ -x /usr/local/bin/yes ]; then
68- SYSTEM_YES=" /usr/local/bin/yes"
69- fi
42+ SYSTEM_TIMEOUT=$( command -v timeout)
43+ SYSTEM_YES=$( command -v yes)
7044
7145# ##
7246
0 commit comments