[GiNaC-devel] [PATCH] build scripts: do not link everything with -ldl

Alexei Sheplyakov varg at theor.jinr.ru
Thu Mar 22 11:57:04 CET 2007


The functions provided by libdl are not re-exported via GiNaC headers,
so the binary/library using GiNaC don't need to be _directly_ linked
with -ldl. The [GNU] linker is smart enough to handle such kind of
library dependencies on its own. See
<http://lists.debian.org/debian-devel-announce/2005/11/msg00016.html>
for more details.

---
 configure.ac      |    4 ++--
 ginac/Makefile.am |    1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 92399dc..2957eeb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -118,15 +118,15 @@ if test "x$CONFIG_RUSAGE" = "xno"; then
     AC_CHECK_HEADER(ctime, , GINAC_ERROR([The standard <ctime> header file could not be found.]))
 fi
 
+DL_LIBS=""
 dnl Check for dl library (needed for GiNaC::compile).
 AC_CHECK_LIB(dl, dlopen,
 	[
 		DL_LIBS="-ldl"
-		AC_SUBST(DL_LIBS)
 		AC_DEFINE(HAVE_LIBDL, 1, [set to 1 if you have a working libdl installed.])
 	], 
 	GINAC_WARNING([libdl not found. GiNaC::compile will be disabled.]))
-LIBS="$LIBS $DL_LIBS"
+AC_SUBST(DL_LIBS)
 
 dnl We need to have Bruno Haible's CLN installed.
 dnl (pkg-config must have installed pkg.m4 at a visible place, which provides
diff --git a/ginac/Makefile.am b/ginac/Makefile.am
index 5455895..283c18b 100644
--- a/ginac/Makefile.am
+++ b/ginac/Makefile.am
@@ -11,6 +11,7 @@ libginac_la_SOURCES = add.cpp archive.cpp basic.cpp clifford.cpp color.cpp \
   utils.cpp wildcard.cpp input_parser.yy input_lexer.ll \
   input_lexer.h remember.h tostring.h utils.h
 libginac_la_LDFLAGS = -version-info $(LT_VERSION_INFO) -release $(LT_RELEASE)
+libginac_la_LIBADD = $(DL_LIBS)
 ginacincludedir = $(includedir)/ginac
 ginacinclude_HEADERS = ginac.h add.h archive.h assertion.h basic.h class_info.h \
   clifford.h color.h constant.h container.h ex.h excompiler.h expair.h expairseq.h \
-- 
1.4.4.4

-- 
All science is either physics or stamp collecting.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
Url : http://www.cebix.net/pipermail/ginac-devel/attachments/20070322/dabe061d/attachment-0001.pgp


More information about the GiNaC-devel mailing list