test: avoid false positives in 'cc-no-c-o' script
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 21 Jul 2013 12:46:48 +0000 (13:46 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 23 Jul 2013 19:36:08 +0000 (20:36 +0100)
Fixes automake bug#14911.

* t/ax/cc-no-c-o.in: Be more careful in determining whether both the
'-c' and '-o' options have been passed on the command line to the
compiler.  In particular, do not spuriously complain in the face of
options like '-compatibility_version' or '-current_version' (seen on
Mac OS X 10.7).
* THANKS: Update.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
THANKS
t/ax/cc-no-c-o.in

diff --git a/THANKS b/THANKS
index b708943..1482da2 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -145,6 +145,7 @@ Gwenole Beauchesne              gbeauchesne@mandrakesoft.com
 H.J. Lu                         hjl@lucon.org
 H.Merijn Brand                  h.m.brand@hccnet.nl
 Hans Ulrich Niedermann          hun@n-dimensional.de
+Hanspeter Niederstrasser        fink@snaggledworks.com
 Harald Dunkel                   harald@CoWare.com
 Harlan Stenn                    Harlan.Stenn@pfcs.com
 He Li                           tippa000@yahoo.com
index c18f9b9..bbc9ec9 100644 (file)
 
 am_CC=${AM_TESTSUITE_GNU_CC-'@GNU_CC@'}
 
-case " $* " in
- *\ -c*\ -o* | *\ -o*\ -c*)
+seen_c=false
+seen_o=false
+
+for arg
+do
+  case $arg in
+    -c)
+      seen_c=true;;
+    # It is acceptable not to leave a space between the '-o' option
+    # and its argument, so we have to cater for that.
+    -o|-o*)
+      seen_o=true;;
+  esac
+  if $seen_c && $seen_o; then
     echo "$0: both '-o' and '-c' seen on the command line" >&2
     exit 2
-    ;;
-esac
+  fi
+done
 
 exec $am_CC "$@"