[Build/Install] Explicitly links with libstdc++; should allow libc++ if appropriate
Ported Issue from Mantis Original ID: 2509 Reported By: ryandesign
SEVERITY: MINOR Submitted: 2015-01-20 00:24:15
OS: OS X
OS BUILD: 10.10.2
PLATFORM: X86_64
PROFILE ID: 4
DESCRIPTION
Several files in Graphviz use "-lstdc++" to link with libstdc++:
$ grep lstdc++ -r .
./cmd/dot/Makefile.am:dot_static_LDADD += $(top_builddir)/plugin/lasi/.libs/libgvplugin_lasi_C.a $(LASI_LIBS) -lstdc++
./cmd/dot/Makefile.am:dot_builtins_LDADD += $(top_builddir)/plugin/lasi/libgvplugin_lasi.la $(LASI_LIBS) -lstdc++
./cmd/dot/Makefile.am:dot_static_LDADD += $(top_builddir)/plugin/lasi/.libs/libgvplugin_lasi_C.a $(LASI_LIBS) -lstdc++
./cmd/dot/Makefile.am:dot_builtins_LDADD += $(top_builddir)/plugin/lasi/libgvplugin_lasi.la $(LASI_LIBS) -lstdc++
./cmd/dot/Makefile.in:@WITH_LASI_TRUE@ $(LASI_LIBS) -lstdc++ \
./cmd/dot/Makefile.in:@WITH_LASI_TRUE@ $(LASI_LIBS) -lstdc++
./cmd/dot/Makefile.in:@WITH_LASI_TRUE@ $(LASI_LIBS) -lstdc++ \
./cmd/dot/Makefile.in:@WITH_LASI_TRUE@ $(LASI_LIBS) -lstdc++
./cmd/edgepaint/Makefile.am: $(ANN_LIBS) -lstdc++ -lm
./cmd/edgepaint/Makefile.in: $(ANN_LIBS) -lstdc++ -lm
./cmd/mingle/Makefile.am: $(ANN_LIBS) -lstdc++ -lm
./cmd/mingle/Makefile.in: $(ANN_LIBS) -lstdc++ -lm
./configure: IPSEPCOLA_LIBS='$(top_builddir)/lib/vpsc/libvpsc_C.la -lstdc++'
./configure.ac: IPSEPCOLA_LIBS='$(top_builddir)/lib/vpsc/libvpsc_C.la -lstdc++'
./debian/TODO: * Stop using -lstdc++ and use CXX (not trivial actually).
./plugin/gdiplus/Makefile.am:libgvplugin_gdiplus_la_LIBADD = -lgdi32 -lole32 -lstdc++ -luuid $(top_builddir)/lib/gvc/libgvc.la
./plugin/gdiplus/Makefile.in:libgvplugin_gdiplus_la_LIBADD = -lgdi32 -lole32 -lstdc++ -luuid $(top_builddir)/lib/gvc/libgvc.la
This isn't appropriate on systems where libc++ is the default, including OS X 10.9 and later. In fact the user may wish to switch the C++ library from its default by adding "-stdlib=libc++" or "-stdlib=libstdc++" to CXXFLAGS. This should be supported. Probably Graphviz should not be specifying which C++ library to use and should instead leave it up to the compiler's default or the user-supplied CXXFLAGS.
In MacPorts, we simply replace "-lstdc++" with "-lstdc++" when appropriate, based on MacPorts' determination, but of course that's not the proper solution: