[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnulib and automake
From: |
John W. Eaton |
Subject: |
Re: gnulib and automake |
Date: |
Mon, 2 Nov 2009 16:08:59 -0500 |
On 2-Nov-2009, Benjamin Lindner wrote:
| Benjamin Lindner wrote:
| > John W. Eaton wrote:
| >> I updated the patch here:
| >>
| >> http://jweaton.org/automake-diffs.gz
| >>
| >> Please start with this newer version of the patch if you decide to try
| >> any further debugging.
| >>
| >
| > sure,
| > I'll start a new clean trial and report back.
| >
|
| It seems that one prerequisite to get shared libraries built using
| libtool, one has to specify "-no-undefined" as libtool's link options.
| See e.g.
| http://readlist.com/lists/lists.sourceforge.net/mingw-users/0/3404.html
|
| What it the correct way in automake to get this flag into the link
| options (preferably only for the *-*-mingw* platform)?
|
| I now patch all makefile.in files, but these are generated (by automake
| I guess). I couldn't find the source for the link commands as
|
| libcruft_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
| $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
| $(CXXFLAGS) $(libcruft_la_LDFLAGS) $(LDFLAGS) -o $@
|
| which I modified to
|
| libcruft_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
| $(LIBTOOLFLAGS) --mode=link $(CXXLD) -no-undefined $(AM_CXXFLAGS) \
| $(CXXFLAGS) $(libcruft_la_LDFLAGS) $(LDFLAGS) -o $@
|
| but that's not really a nice solution.
|
| Is there an additional libtool makefile variable, something like
| $(libtool_LDFLAGS) ?
| Or can one define an additional individual variable like
| $(libtool_NOUNDEFINED) which is empty by default, and set to
| "-no-undefined" for mingw platform?
Does the following change work for you?
Thanks,
jwe
diff --git a/common.mk b/common.mk
--- a/common.mk
+++ b/common.mk
@@ -141,8 +141,9 @@
BUILD_CXX = @BUILD_CXX@
BUILD_CXXFLAGS = @BUILD_CXXFLAGS@
+NO_UNDEFINED_LDFLAG = @NO_UNDEFINED_LDFLAG@
+
LD_CXX = @LD_CXX@
-AM_LDFLAGS = @LDFLAGS@
LD_STATIC_FLAG = @LD_STATIC_FLAG@
#ALL_LDFLAGS = $(LIBFLAGS) $(LD_STATIC_FLAG) $(CPICFLAG) $(LDFLAGS)
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -230,13 +230,7 @@
gcc_version=`$CC -v 2>&1 | grep "^.*gcc version" | \
sed -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//'`
case "$gcc_version" in
- 2.*)
- if test -z "$LDFLAGS"; then
- LDFLAGS="-g"
- AC_MSG_NOTICE([defining LDFLAGS to be $LDFLAGS])
- fi
- ;;
- 1.*)
+ [12].*)
warn_gcc_version="gcc version $gcc_version is likely to cause problems"
AC_MSG_WARN($warn_gcc_version)
;;
@@ -1365,15 +1359,18 @@
AC_CHECK_FUNCS(gethostname, [], [AC_CHECK_LIB(socket, gethostname)])
AC_CHECK_FUNCS(getpwnam, [], [AC_CHECK_LIB(sun, getpwnam)])
+NO_UNDEFINED_LDFLAG=
case "$canonical_host_type" in
*-*-cygwin*)
AC_CHECK_LIB(wsock32, gethostname)
LIBS="$LIBS -lwsock32"
;;
*-*-msdosmsvc* | *-*-mingw*)
- LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32"
+ LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32"
+ NO_UNDEFINED_LDFLAG=-no-undefined
;;
esac
+AC_SUBST(NO_UNDEFINED_LDFLAG)
### Type stuff.
diff --git a/libcruft/Makefile.am b/libcruft/Makefile.am
--- a/libcruft/Makefile.am
+++ b/libcruft/Makefile.am
@@ -29,7 +29,7 @@
libcruft_la_SOURCES =
-libcruft_la_LDFLAGS = -release $(version)
+libcruft_la_LDFLAGS = -release $(version) $(NO_UNDEFINED_LDFLAG)
libcruft_la_LIBADD = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
diff --git a/liboctave/Makefile.am b/liboctave/Makefile.am
--- a/liboctave/Makefile.am
+++ b/liboctave/Makefile.am
@@ -511,7 +511,7 @@
liboctave_la_LIBADD = $(LINK_DEPS)
-liboctave_la_LDFLAGS = -release $(version)
+liboctave_la_LDFLAGS = -release $(version) $(NO_UNDEFINED_LDFLAG)
octinclude_HEADERS = \
$(INCS) \
diff --git a/src/Makefile.am b/src/Makefile.am
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -529,7 +529,7 @@
$(OPT_HANDLERS) \
$(OPT_INC)
-liboctinterp_la_LDFLAGS = -release $(version)
+liboctinterp_la_LDFLAGS = -release $(version) $(NO_UNDEFINED_LDFLAG)
## Order matters here. Leave builtins.cc last, because it depends on
## $(DEF_FILES), and building those requires all the sources