Correct a configure script test
In the MacPorts port for tcpflow, I've added this patch, and I suggest it be committed to your sources:
--- configure.ac.orig 2013-11-17 16:45:29.000000000 -0600
+++ configure.ac 2013-11-17 16:47:06.000000000 -0600
@@ -149,7 +138,7 @@
-Woverloaded-virtual -Wsign-promo \
-funit-at-a-time"
-if test x$CXX != "xclang++" && `uname -s` != 'Darwin' ; then
+if test "x$CXX" != "xclang++" -a "`uname -s`" != "Darwin" ; then
# -Wstrict-null-sentinel is not supported under clang or under Darwin's gcc
WARNINGS_TO_TEST="$WARNINGS_TO_TEST -Wstrict-null-sentinel"
fi
The reasons for these changes are:
- The bare
x$CXXcauses an error about incorrect number of arguments totestif$CXXcontains a space, as it does in MacPorts when the user requests to useccache(then$CXXcontains e.g.ccache /usr/bin/clang++) - Multiple tests must be combined with
-aor-o, not&&or||; otherwise, the next word (the result ofuname -s) is interpreted as a command name, resulting in an error thatDarwinis not a valid command name - On the off chance that the
unamecommand might be broken and return nothing, or might return multiple words, I enclosed it in quotes - Changed quotes around "Darwin" from single to double quotes to match the rest of the line
I would suggest refining the test further, since the compiler might be clang even if $CXX is not exactly equal to the string "clang++". For example, it might be /usr/bin/clang++ or /opt/local/bin/clang++-mp-3.3 or even /usr/bin/gcc (in Xcode 5). You might instead check whether __clang__ is defined, e.g. with $CXX -dM -E - < /dev/null | grep -q __clang__.
Thanks On Nov 17, 2013, at 10:11 PM, Ryan Schmidt [email protected] wrote:
In the MacPorts port for tcpflow, I've added this patch, and I suggest it be committed to your sources:
--- configure.ac.orig 2013-11-17 16:45:29.000000000 -0600 +++ configure.ac 2013-11-17 16:47:06.000000000 -0600 @@ -149,7 +138,7 @@ -Woverloaded-virtual -Wsign-promo
-funit-at-a-time"-if test x$CXX != "xclang++" &&
uname -s!= 'Darwin' ; then +if test "x$CXX" != "xclang++" -a "uname -s" != "Darwin" ; then-Wstrict-null-sentinel is not supported under clang or under Darwin's gcc
WARNINGS_TO_TEST="$WARNINGS_TO_TEST -Wstrict-null-sentinel" fi The reasons for these changes are:
The bare x$CXX causes an error about incorrect number of arguments to test if $CXX contains a space, as it does in MacPorts when the user requests to use ccache (then $CXX contains e.g. ccache /usr/bin/clang++) Multiple tests must be combined with -a or -o, not && or ||; otherwise, the next word (the result of uname -s) is interpreted as a command name, resulting in an error that Darwin is not a valid command name On the off chance that the uname command might be broken and return nothing, or might return multiple words, I enclosed it in quotes Changed quotes around "Darwin" from single to double quotes to match the rest of the line I would suggest refining the test further, since the compiler might be clang even if $CXX is not exactly equal to the string "clang++". For example, it might be /usr/bin/clang++ or /opt/local/bin/clang++-mp-3.3 or even /usr/bin/gcc (in Xcode 5). You might instead check whether clang is defined, e.g. with $CXX -dM -E - < /dev/null | grep -q clang.
— Reply to this email directly or view it on GitHub.