OSDN Git Service

* libtool-ldflags: New script.
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Jan 2006 00:30:27 +0000 (00:30 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Jan 2006 00:30:27 +0000 (00:30 +0000)
* src/Makefile.am (LTLDFLAGS): New variable.
(CXXLINK): Use LTLDFLAGS.
* src/Makefile.in: Regenerated.
* libsupc++/Makefile.am (LTLDFLAGS): New variable.
(CXXLINK): Use LTLDFLAGS.
* libsupc++/Makefile.in: Regenerated.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109256 138bc75d-0d04-0410-961f-82ee72b054a4

ChangeLog
libstdc++-v3/ChangeLog
libstdc++-v3/libsupc++/Makefile.am
libstdc++-v3/libsupc++/Makefile.in
libstdc++-v3/src/Makefile.am
libstdc++-v3/src/Makefile.in
libtool-ldflags [new file with mode: 0755]

index 9539f61..9c968ff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-01-02  Mark Mitchell  <mark@codesourcery.com>
+
+       * libtool-ldflags: New script.
+
 2006-01-02  Andreas Schwab  <schwab@suse.de>
 
        * configure.in: When reconfiguring remove Makefile in
 2006-01-02  Andreas Schwab  <schwab@suse.de>
 
        * configure.in: When reconfiguring remove Makefile in
index a673370..c6bd64e 100644 (file)
@@ -1,3 +1,12 @@
+2006-01-02  Mark Mitchell  <mark@codesourcery.com>
+
+       * src/Makefile.am (LTLDFLAGS): New variable. 
+       (CXXLINK): Use LTLDFLAGS.
+       * src/Makefile.in: Regenerated.
+       * libsupc++/Makefile.am (LTLDFLAGS): New variable. 
+       (CXXLINK): Use LTLDFLAGS.
+       * libsupc++/Makefile.in: Regenerated.
+
 2006-01-02  Paolo Carlini  <pcarlini@suse.de>
 
        PR libstdc++/24645
 2006-01-02  Paolo Carlini  <pcarlini@suse.de>
 
        PR libstdc++/24645
index 2c749cb..4ce2861 100644 (file)
@@ -139,6 +139,8 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared \
               --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
               $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) 
 
               --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
               $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) 
 
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+
 # 3) We'd have a problem when building the shared libstdc++ object if
 # the rules automake generates would be used.  We cannot allow g++ to
 # be used since this would add -lstdc++ to the link line which of
 # 3) We'd have a problem when building the shared libstdc++ object if
 # the rules automake generates would be used.  We cannot allow g++ to
 # be used since this would add -lstdc++ to the link line which of
@@ -147,7 +149,7 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared \
 # compilation driver.
 CXXLINK = $(LIBTOOL) --tag CXX --tag disable-shared \
          --mode=link $(CXX) \
 # compilation driver.
 CXXLINK = $(LIBTOOL) --tag CXX --tag disable-shared \
          --mode=link $(CXX) \
-         $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
+         $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
 
 # We have to have rules modified from the default to counteract SUN make
 # prepending each of $(glibcxxinstall_HEADERS) with VPATH below.
 
 # We have to have rules modified from the default to counteract SUN make
 # prepending each of $(glibcxxinstall_HEADERS) with VPATH below.
index c787f17..0b132b0 100644 (file)
@@ -402,6 +402,7 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared \
               --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
               $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) 
 
               --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
               $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) 
 
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
 
 # 3) We'd have a problem when building the shared libstdc++ object if
 # the rules automake generates would be used.  We cannot allow g++ to
 
 # 3) We'd have a problem when building the shared libstdc++ object if
 # the rules automake generates would be used.  We cannot allow g++ to
@@ -411,7 +412,7 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared \
 # compilation driver.
 CXXLINK = $(LIBTOOL) --tag CXX --tag disable-shared \
          --mode=link $(CXX) \
 # compilation driver.
 CXXLINK = $(LIBTOOL) --tag CXX --tag disable-shared \
          --mode=link $(CXX) \
-         $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
+         $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
 
 all: all-am
 
 
 all: all-am
 
index 0855c59..973e75f 100644 (file)
@@ -226,6 +226,8 @@ AM_CXXFLAGS = \
 LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
               $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) 
 
 LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
               $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) 
 
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+
 # 3) We'd have a problem when building the shared libstdc++ object if
 # the rules automake generates would be used.  We cannot allow g++ to
 # be used since this would add -lstdc++ to the link line which of
 # 3) We'd have a problem when building the shared libstdc++ object if
 # the rules automake generates would be used.  We cannot allow g++ to
 # be used since this would add -lstdc++ to the link line which of
@@ -233,7 +235,7 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
 # directory to configure libstdc++-v3 to use gcc as the C++
 # compilation driver.
 CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \
 # directory to configure libstdc++-v3 to use gcc as the C++
 # compilation driver.
 CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \
-         $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
+         $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
 
 
 # Added bits to build debug library.
 
 
 # Added bits to build debug library.
index f78e735..1a99a63 100644 (file)
@@ -405,6 +405,7 @@ AM_CXXFLAGS = \
 LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
               $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) 
 
 LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
               $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) 
 
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
 
 # 3) We'd have a problem when building the shared libstdc++ object if
 # the rules automake generates would be used.  We cannot allow g++ to
 
 # 3) We'd have a problem when building the shared libstdc++ object if
 # the rules automake generates would be used.  We cannot allow g++ to
@@ -413,7 +414,7 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
 # directory to configure libstdc++-v3 to use gcc as the C++
 # compilation driver.
 CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \
 # directory to configure libstdc++-v3 to use gcc as the C++
 # compilation driver.
 CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \
-         $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
+         $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
 
 debugdir = debug
 all: all-am
 
 debugdir = debug
 all: all-am
diff --git a/libtool-ldflags b/libtool-ldflags
new file mode 100755 (executable)
index 0000000..6321747
--- /dev/null
@@ -0,0 +1,97 @@
+#! /bin/sh
+
+# Script to translate LDFLAGS into a form suitable for use with libtool.
+
+# Copyright (C) 2005 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 Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+# MA 02110-1301, USA. 
+
+# Contributed by CodeSourcery, LLC.
+
+# This script is designed to be used from a Makefile that uses libtool
+# to build libraries as follows: 
+#
+#   LTLDFLAGS = $(shell libtool-ldflags $(LDFLAGS))
+#
+# Then, use (LTLDFLAGS) in place of $(LDFLAGS) in your link line.
+
+# The output of the script.  This string is built up as we process the
+# arguments.
+result=
+
+for arg
+do
+    case $arg in
+       -f*|--*)
+           # 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" 
+           ;;
+       *)
+           # We do not want to add -Xcompiler to other options because
+           # that would prevent libtool itself from recognizing them.
+           ;;
+    esac
+
+    # If $(LDFLAGS) is (say):
+    #   a "b'c d" e
+    # then the user expects that:
+    #   $(LD) $(LDFLAGS)
+    # will pass three arguments to $(LD):
+    #   1) a
+    #   2) b'c d
+    #   3) e
+    # We must ensure, therefore, that the arguments are appropriately
+    # quoted so that using:
+    #   libtool --mode=link ... $(LTLDFLAGS)
+    # will result in the same number of arguments being passed to
+    # libtool.   In other words, when this script was invoked, the shell 
+    # removed one level of quoting, present in $(LDFLAGS); we have to put 
+    # it back.
+
+    # Quote any embedded single quotes.
+    case $arg in
+       *"'"*)
+           # The following command creates the script:
+           #   1s,^X,,;s|'|'"'"'|g
+           # which removes a leading X, and then quotes and embedded single
+           # quotes.
+           sed_script="1s,^X,,;s|'|'\"'\"'|g"
+           # Add a leading "X" so that if $arg starts with a dash,
+           # the echo command will not try to interpret the argument
+           # as a command-line option.
+           arg="X$arg"
+           # Generate the quoted string.
+           quoted_arg=`echo "$arg" | sed -e "$sed_script"`
+           ;;
+       *)
+           quoted_arg=$arg
+           ;;
+    esac
+    # Surround the entire argument with single quotes.
+    quoted_arg="'"$quoted_arg"'" 
+
+    # Add it to the string.
+    result="$result $quoted_arg"
+done
+
+# Output the string we have built up.
+echo "$result"