patches/gcc/4.4.4/240-libstdc++-pic.patch
author Daniel Price <daniel.price@gmail.com>
Tue Nov 20 16:59:17 2012 -0800 (2012-11-20)
changeset 3126 333d3e40cbd1
parent 1948 d341be24dc68
permissions -rw-r--r--
scripts: refine static linking check to better guide the user

The current mechanism to check if static linking is possible, and the mesage
displayed on failure, can be puzzling to the unsuspecting user.

Also, the current implementation is not using the existing infrastructure,
and is thus difficult to enhance with new tests.

So, switch to using the standard CT_DoExecLog infra, and use four tests to
check for the host compiler:
- check we can run it
- check it can build a trivial program
- check it can statically link that program
- check if it statically link with libstdc++

That should cover most of the problems. Hopefully.

(At the same time, fix a typo in a comment)

Signed-off-by: Daniel Price <daniel.price@gmail.com>
[yann.morin.1998@free.fr: split original patch for self-contained changes]
[yann.morin.1998@free.fr: use steps to better see gcc's output]
[yann.morin.1998@free.fr: commit log]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Message-Id: <163f86b5216fc08c672a.1353459722@nipigon.dssd.com>
Patchwork-Id: 200536
yann@1948
     1
diff -durN gcc-4.4.4.orig/libstdc++-v3/src/Makefile.am gcc-4.4.4/libstdc++-v3/src/Makefile.am
yann@1948
     2
--- gcc-4.4.4.orig/libstdc++-v3/src/Makefile.am	2009-08-26 21:04:11.000000000 +0200
yann@1948
     3
+++ gcc-4.4.4/libstdc++-v3/src/Makefile.am	2010-05-16 19:13:50.000000000 +0200
yann@1948
     4
@@ -356,6 +356,13 @@
yann@1948
     5
 	  $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
yann@1948
     6
 
yann@1948
     7
 
yann@1948
     8
+install-exec-local:
yann@1948
     9
+	pic_objs=`sed -n "s:'::g;s:^pic_object=::p" *.lo | grep -v '^none$$'`; \
yann@1948
    10
+	if [ x"$$pic_objs" != x ]; then \
yann@1948
    11
+		$(AR) cru libstdc++_pic.a $$pic_objs $(top_builddir)/libsupc++/*.o || exit 1; \
yann@1948
    12
+		$(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) || exit 1; \
yann@1948
    13
+	fi
yann@1948
    14
+
yann@1948
    15
 # Added bits to build debug library.
yann@1948
    16
 if GLIBCXX_BUILD_DEBUG
yann@1948
    17
 all-local: build_debug
yann@1948
    18
diff -durN gcc-4.4.4.orig/libstdc++-v3/src/Makefile.in gcc-4.4.4/libstdc++-v3/src/Makefile.in
yann@1948
    19
--- gcc-4.4.4.orig/libstdc++-v3/src/Makefile.in	2009-08-26 21:04:11.000000000 +0200
yann@1948
    20
+++ gcc-4.4.4/libstdc++-v3/src/Makefile.in	2010-05-16 19:13:50.000000000 +0200
yann@1948
    21
@@ -726,7 +726,7 @@
yann@1948
    22
 
yann@1948
    23
 install-data-am: install-data-local
yann@1948
    24
 
yann@1948
    25
-install-exec-am: install-toolexeclibLTLIBRARIES
yann@1948
    26
+install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local
yann@1948
    27
 
yann@1948
    28
 install-info: install-info-am
yann@1948
    29
 
yann@1948
    30
@@ -765,7 +765,7 @@
yann@1948
    31
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
yann@1948
    32
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
yann@1948
    33
 	tags uninstall uninstall-am uninstall-info-am \
yann@1948
    34
-	uninstall-toolexeclibLTLIBRARIES
yann@1948
    35
+	uninstall-toolexeclibLTLIBRARIES install-exec-local
yann@1948
    36
 
yann@1948
    37
 
yann@1948
    38
 # Symbol versioning for shared libraries.
yann@1948
    39
@@ -947,6 +947,14 @@
yann@1948
    40
 install_debug:
yann@1948
    41
 	(cd ${debugdir} && $(MAKE) \
yann@1948
    42
 	toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
yann@1948
    43
+
yann@1948
    44
+install-exec-local:
yann@1948
    45
+	pic_objs=`sed -n "s:'::g;s:^pic_object=::p" *.lo | grep -v '^none$$'`; \
yann@1948
    46
+	if [ x"$$pic_objs" != x ]; then \
yann@1948
    47
+		$(AR) cru libstdc++_pic.a $$pic_objs $(top_builddir)/libsupc++/*.o || exit 1; \
yann@1948
    48
+		$(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) || exit 1; \
yann@1948
    49
+	fi
yann@1948
    50
+
yann@1948
    51
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
yann@1948
    52
 # Otherwise a system limit (for SysV at least) may be exceeded.
yann@1948
    53
 .NOEXPORT: