Reputation: 3775
I am creating a configure
file for an R package. So far, the R/C++ parts of the code are ok, but when I run devtools::check()
to check for my code integrity/quality, I get a note (i.e., a soft warning) about my configure
file that says possible bashism in configure line XX ('command' with option other than -p)
This is the part of configure
that R doesn't like:
# Extra checks on MacOS for SSL support in libpq
# command -v is probably fine: https://stackoverflow.com/a/677212/946850
if [ `uname` = "Darwin" ] && [ `command -v pkg-config` ]; then
if pkg-config --atleast-version=12 libpq; then
case "`pkg-config --libs --static libpq`" in
*crypto*)
echo "Local libpq has SSL support"
;;
*)
echo "Local libpq does not have SSL support"
FORCE_AUTOBREW=1
;;
esac
else
FORCE_AUTOBREW=1
fi
fi
Should I ignore that or should I write that part in a general way? If the right way is the 2nd way, which would be a good practice to write these kind of configurations?
Sorry if this is a noob question. I am a statistician trying to learn something that is not what I readily available in R/SPSS.
Upvotes: 1
Views: 87
Reputation: 3775
what works with devtools::check()
and returns 0 notes is
if [ "`uname`" = Darwin ] && [ "`command -v pkg-config`" ]; then
instead of
if [ `uname` = "Darwin" ] && [ `command -v pkg-config` ]; then
this solution is an "average" of all the comments in this thread
Upvotes: 2
Reputation: 295679
The check is either wrong, or checking for compatibility with pre-POSIX Bourne shell; the POSIX.2 standard requires command -v
to work and has since at least 1994 if not the initial publication in 1992; there's no genuine bashism here.
Upvotes: 3