test: avoid false positives in 'cc-no-c-o' script
[platform/upstream/automake.git] / t / ax / cc-no-c-o.in
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 "$@"