I prepare two possible patches against libtool version 1.5.22. Both
patches change "soname_spec" if flag to avoid lib-prefix is set.
1.) libtool-1.5.22.ACNOPREFIX.patch
This patch define autoconf macro AC_LIBTOOL_NOSHPREFIX.
In is suitable for project, as example libiconv, where build with
non-gcc win32 compilers produce dlls without lib-prefix. In this case
author{s} can put AC_LIBTOOL_NOSHPREFIX in configure[.in|ac] to ensure
compatible dlls for mingw builds.
2.) libtool-1.5.22.ARGPREFIX.patch
This patch add argument --without-dllprefix to configure, so that
package creator(distributors) can decide how to create dlls.
Please comment,
Roumen
Roumen Petrov wrote:
Let a project use libtool to make libraries.
In case of mingw build (cross-compilation) in many cases is good dll
to be without lib prefix.
In these cases cross-compilation can create dlls with same names as
native build and those dlls can be used instead native build.
The name of import library can left libNAME.dll.a.
When building shared libraries on unix usually Makefile.am contain
lib_LTLIBRARIES = lib<NAME>.la and result is lib<NAME>.so...
It is similar to case for pcre.la (topic "dll names on windows") but
with lib-prefix for la-file.
How to do this?
Notes:
- libtool macro AC_LIBTOOL_SYS_DYNAMIC_LINKER don't preserve
"libname_spec" set by CONFIG_SITE so that I cannot use
"libname_spec="\$name"" in CONFIG_SITE file;
- same for "soname_spec";
- LDFLAGS -module is only to inform automake that we use "nonstandard"
name, i.e without lib prefix.
This is not my case since for other systems lib prefix is fine.
Also note that with argument "-module" file is installed in libdir (!)
and without in bindir;
- to use def-file with content "LIBRARY NAME.dll" and to pass to
linker by example with -export-symbols.
In this case import library "libNAME.dll.a" is created for "NAME.dll"
but dll-name is "libNAME.dll".
We can rename dll (to remove lib prefix) and in file "libNAME.la" to
remove lib-prefix in dlname.
In this case libtool will install "NAME.dll", i.e. without lib prefix,
but create in libdir la-file with dlname='../bin/libNAME.dll' so that
we should edit again.
More info:
Command:
$i386-mingw32msvc-gcc -shared ... -o .libs/<NAME>.dll ... -Xlinker
--out-implib -Xlinker .libs/lib<NAME>.dll.a"
create dll without lib prefix and put <NAME>.dll in import library.
Roumen
--- libtool.m4.SHPREFIX 2006-01-18 04:42:04.000000000 +0200
+++ libtool.m4 2007-07-23 00:04:51.000000000 +0300
@@ -200,6 +200,8 @@
AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
enable_win32_dll=yes, enable_win32_dll=no)
+AC_PROVIDE_IFELSE([AC_LIBTOOL_NOSHPREFIX],
+avoid_shprefix=yes, avoid_shprefix=no)
AC_ARG_ENABLE([libtool-lock],
[AC_HELP_STRING([--disable-libtool-lock],
@@ -1328,8 +1330,12 @@
sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
;;
mingw*)
- # MinGW DLLs use traditional 'lib' prefix
+ if test x$avoid_shprefix = xyes; then
+ soname_spec='${name}`echo ${release} | $SED -e
's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ else
+ # use traditional 'lib' prefix
soname_spec='${libname}`echo ${release} | $SED -e
's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ fi
sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" |
$SED -e "s/^libraries://" -e "s,=/,/,g"`
if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null];
then
# It is most probably a Windows format PATH printed by
@@ -1902,6 +1908,14 @@
])# AC_LIBTOOL_WIN32_DLL
+# AC_LIBTOOL_NOSHPREFIX
+# --------------------
+# blabla...
+AC_DEFUN([AC_LIBTOOL_NOSHPREFIX],
+[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_NOSHPREFIX
+
+
# AC_ENABLE_SHARED([DEFAULT])
# ---------------------------
# implement the --enable-shared flag
--- libtool.m4.ARGPREFIX 2006-01-18 04:42:04.000000000 +0200
+++ libtool.m4 2007-07-24 23:13:04.000000000 +0300
@@ -1328,8 +1328,17 @@
sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
;;
mingw*)
- # MinGW DLLs use traditional 'lib' prefix
- soname_spec='${libname}`echo ${release} | $SED -e
's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ AC_ARG_WITH([dllprefix],
+ [AS_HELP_STRING([--without-dllprefix],
+ [disable traditional 'lib' dll-prefix])],
+ [],
+ [with_dllprefix=no])
+ if test x$with_dllprefix = xyes; then
+ # use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e
's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ else
+ soname_spec='${name}`echo ${release} | $SED -e
's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ fi
sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" |
$SED -e "s/^libraries://" -e "s,=/,/,g"`
if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null];
then
# It is most probably a Windows format PATH printed by
_______________________________________________
http://lists.gnu.org/mailman/listinfo/libtool