bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ld-output-def


From: Simon Josefsson
Subject: ld-output-def
Date: Tue, 31 Mar 2009 12:01:06 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.90 (gnu/linux)

How about this module?  I use something similar in many of my projects.

For an example of when a *.def file is useful, see "Using the GnuTLS DLL
from your Visual Studio program" on <http://josefsson.org/gnutls4win/>.

/Simon

>From 13d4ef1dbd6f3f172b403fb968a265fefe53edbf Mon Sep 17 00:00:00 2001
From: Simon Josefsson <address@hidden>
Date: Tue, 31 Mar 2009 12:00:23 +0200
Subject: [PATCH] Add new module ld-output-def.

---
 MODULES.html.sh        |    1 +
 doc/gnulib.texi        |    3 +++
 doc/ld-output-def.texi |   21 +++++++++++++++++++++
 m4/ld-output-def.m4    |   28 ++++++++++++++++++++++++++++
 modules/ld-output-def  |   14 ++++++++++++++
 5 files changed, 67 insertions(+), 0 deletions(-)
 create mode 100644 doc/ld-output-def.texi
 create mode 100644 m4/ld-output-def.m4
 create mode 100644 modules/ld-output-def

diff --git a/MODULES.html.sh b/MODULES.html.sh
index a5efaeb..82b1520 100755
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -3129,6 +3129,7 @@ func_all_modules ()
   func_module gperf
   func_module havelib
   func_module include_next
+  func_module ld-output-def
   func_module ldd
   func_module lib-ignore
   func_module link-warning
diff --git a/doc/gnulib.texi b/doc/gnulib.texi
index 6e13cdf..445f23a 100644
--- a/doc/gnulib.texi
+++ b/doc/gnulib.texi
@@ -5823,6 +5823,7 @@ This list of functions is sorted according to the header 
that declares them.
 * Searching for Libraries::
 * Exported Symbols of Shared Libraries::
 * LD Version Scripts::
+* LD DEF Files::
 * Supporting Relocation::
 * func::
 * warnings::
@@ -5915,6 +5916,8 @@ generated automatically.
 
 @include ld-version-script.texi
 
address@hidden ld-output-def.texi
+
 @include relocatable-maint.texi
 
 @include func.texi
diff --git a/doc/ld-output-def.texi b/doc/ld-output-def.texi
new file mode 100644
index 0000000..166befe
--- /dev/null
+++ b/doc/ld-output-def.texi
@@ -0,0 +1,21 @@
address@hidden LD DEF Files
address@hidden LD DEF Files
+
+The @code{ld-output-def} module detects whether the linker supports
address@hidden  The parameter is used to generate DEF files,
+which can be useful for Windows users when they want to generate an
+import library for your DLL.
+
+You use the module by importing it to your library, and then add the
+following lines to the @code{Makefile.am} that builds the library:
+
address@hidden
+if HAVE_LD_OUTPUT_DEF
+libfoo_la_LDFLAGS += -Wl,--output-def,libfoo-$(SOVERSION).def
+defexecdir = $(bindir)
+defexec_DATA = libfoo-$(SOVERSION).def
+DISTCLEANFILES += $(defexec_DATA)
+endif
address@hidden smallexample
+
+See the GNU LD manual for more information.
diff --git a/m4/ld-output-def.m4 b/m4/ld-output-def.m4
new file mode 100644
index 0000000..ea87b35
--- /dev/null
+++ b/m4/ld-output-def.m4
@@ -0,0 +1,28 @@
+# ld-output-def.m4 serial 2
+dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Simon Josefsson
+
+# gl_LD_OUTPUT_DEF()
+# -------------
+# Check if linker supports -Wl,--output-def and define automake
+# conditional HAVE_LD_OUTPUT_DEF if it is.
+AC_DEFUN([gl_LD_OUTPUT_DEF],
+[
+  AC_MSG_CHECKING([if gcc/ld supports -Wl,--output-def])
+  if test "$enable_shared" = no; then
+    output_def=no
+    AC_MSG_RESULT([not need, since shared libraries are disabled])
+  else
+    _gcc_ldflags_save=$LDFLAGS
+    LDFLAGS="-Wl,--output-def,foo.def"
+    AC_LINK_IFELSE(AC_LANG_PROGRAM([]),output_def=yes,output_def=no)
+    rm -f foo.def
+    AC_MSG_RESULT($output_def)
+    LDFLAGS="$_gcc_ldflags_save"
+  fi
+  AM_CONDITIONAL(HAVE_LD_OUTPUT_DEF, test "$output_def" = "yes")
+])
diff --git a/modules/ld-output-def b/modules/ld-output-def
new file mode 100644
index 0000000..344b501
--- /dev/null
+++ b/modules/ld-output-def
@@ -0,0 +1,14 @@
+Description:
+Macros to test whether LD support --output-def.
+
+Files:
+m4/ld-output-def.m4
+
+configure.ac:
+gl_LD_OUTPUT_DEF
+
+License:
+unlimited
+
+Maintainer:
+Simon Josefsson
-- 
1.5.6.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]