]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libtool-ldflags
gcov: rename 2 options.
[thirdparty/gcc.git] / libtool-ldflags
index 6321747b4a95b4163d9e847f1b529cef98bae6f7..5de9e2978d4047f550f37baf89cb44d0b74f0313 100755 (executable)
@@ -2,7 +2,7 @@
 
 # Script to translate LDFLAGS into a form suitable for use with libtool.
 
-# Copyright (C) 2005 Free Software Foundation, Inc.
+# Copyright (C) 2005-2014 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # The output of the script.  This string is built up as we process the
 # arguments.
 result=
+prev_arg=
 
 for arg
 do
     case $arg in
-       -f*|--*)
+       -f*|--*|-static-lib*|-shared-lib*|-B*)
            # Libtool does not ascribe any special meaning options
            # that begin with -f or with a double-dash.  So, it will
            # think these options are linker options, and prefix them
            # with "-Wl,".  Then, the compiler driver will ignore the
            # options.  So, we prefix these options with -Xcompiler to
            # make clear to libtool that they are in fact compiler
-           # options.
-           result="$result -Xcompiler" 
+           # options.  Similarly for e.g. -static-libstdc++, or
+           # -B/some/path.
+           case $prev_arg in
+               -Xpreprocessor|-Xcompiler|-Xlinker)
+                   # This option is already prefixed; don't prefix it again.
+                   ;;
+               *)
+                   result="$result -Xcompiler"
+                   ;;
+           esac
            ;;
        *)
            # We do not want to add -Xcompiler to other options because
            # that would prevent libtool itself from recognizing them.
            ;;
     esac
+    prev_arg=$arg
 
     # If $(LDFLAGS) is (say):
     #   a "b'c d" e