[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
patches for building loadable modules
From: |
Schleicher Ralph (LLI) |
Subject: |
patches for building loadable modules |
Date: |
Thu, 19 Sep 2002 18:37:54 +0200 |
libtool 1.4.2
Hi,
here is a patch for Libtool for more control about how libraries
(especially loadable modules) are compiled and linked.
First, a -no-static option is added to (a) not compile static object
files and (b) not create static libtool libraries.
Second, a -soext option is added to override the default file name
extension of shared libraries (.so on most systems).
With this patch applied, my Makefile.am looks like this:
# Matlab MEX-file.
matlabarch_LTLIBRARIES = hell.la
hell_la_SOURCES = hell.c
hell_la_CFLAGS = -no-static \
-DMATLAB_MEX_FILE -I$(MATLAB)/extern/include
hell_la_LDFLAGS = -no-static -module -avoid-version \
-export-symbols mex-symbols -soext .$(MEXEXT)
hell_la_LIBADD = $(MEX_LIBADD)
The result is a working Matlab MEX-file:
$ cd .libs
$ ls -l
10 Sep 19 18:17 hell.la -> ../hell.la
814 Sep 19 18:17 hell.lai
35116 Sep 19 18:17 hell.mexhpux*
$ matlab
>> hell
Hello world!
Good bye sailor!
>> quit
Here's the patch (a second generic libtool patch for better MinGW
support is added below, apply it first if patch rejects some hunks):
diff -c2 ltmain.in.orig ltmain.in
*** ltmain.in.orig Fri May 17 13:43:24 2002
--- ltmain.in Thu Sep 19 17:43:13 2002
***************
*** 320,323 ****
--- 320,332 ----
;;
+ -no-static)
+ if test "$build_libtool_libs" != yes; then
+ echo "$modename: not configured to build shared libraries" 1>&2
+ exit 1
+ fi
+ build_old_libs=no
+ continue
+ ;;
+
-prefer-pic)
pic_mode=yes
***************
*** 785,788 ****
--- 794,798 ----
# We need to know -static, to get the right output filenames.
+ can_build_libtool_libs=$build_libtool_libs
for arg
do
***************
*** 806,809 ****
--- 816,828 ----
break
;;
+ -no-static)
+ if test "$can_build_libtool_libs" != yes; then
+ echo "$modename: not configured to build shared libraries" 1>&2
+ exit 1
+ fi
+ dlopen_self=unknown
+ build_libtool_libs=yes
+ build_old_libs=no
+ ;;
esac
done
***************
*** 1124,1127 ****
--- 1143,1151 ----
;;
+ -soext)
+ prev=soext
+ continue
+ ;;
+
-static)
# The effects of -static are defined in a previous loop.
***************
*** 4853,4856 ****
--- 4877,4881 ----
-prefer-non-pic try to building non-PIC objects only
-static always build a \`.o' file suitable for static linking
+ -no-static never build a \`.o' file suitable for static linking
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
***************
*** 4938,4942 ****
--- 4963,4969 ----
-rpath LIBDIR the created library will eventually be installed in LIBDIR
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -soext SUFFIX use SUFFIX for the file name extension of the library
-static do not do any dynamic linking of libtool libraries
+ -no-static never create static libtool libraries
-version-info CURRENT[:REVISION[:AGE]]
specify library version info [each variable defaults to 0]
diff -c2 libtool.m4.orig libtool.m4
*** libtool.m4.orig Tue Sep 11 05:16:01 2001
--- libtool.m4 Thu Sep 19 17:39:02 2002
***************
*** 1925,1928 ****
--- 1925,1929 ----
libname_spec='lib$name'
soname_spec=
+ soext=.so
postinstall_cmds=
postuninstall_cmds=
***************
*** 1939,1947 ****
aix3*)
version_type=linux
! library_names_spec='${libname}${release}.so$versuffix $libname.a'
shlibpath_var=LIBPATH
# AIX has no versioning support, so we append a major version to the name.
! soname_spec='${libname}${release}.so$major'
;;
--- 1940,1948 ----
aix3*)
version_type=linux
! library_names_spec='${libname}${release}$soext$versuffix $libname.a'
shlibpath_var=LIBPATH
# AIX has no versioning support, so we append a major version to the name.
! soname_spec='${libname}${release}$soext$major'
;;
***************
*** 1950,1954 ****
if test "$host_cpu" = ia64; then
# AIX 5 supports IA64
! library_names_spec='${libname}${release}.so$major
${libname}${release}.so$versuffix $libname.so'
shlibpath_var=LD_LIBRARY_PATH
else
--- 1951,1955 ----
if test "$host_cpu" = ia64; then
# AIX 5 supports IA64
! library_names_spec='${libname}${release}$soext$major
${libname}${release}$soext$versuffix $libname$soext'
shlibpath_var=LD_LIBRARY_PATH
else
***************
*** 1977,1986 ****
# instead of lib<name>.a to let people know that these are not
# typical AIX shared libraries.
! library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so$major $libname.so'
else
# We preserve .a as extension for shared libraries through AIX4.2
# and later when we are not doing run time linking.
library_names_spec='${libname}${release}.a $libname.a'
! soname_spec='${libname}${release}.so$major'
fi
shlibpath_var=LIBPATH
--- 1978,1987 ----
# instead of lib<name>.a to let people know that these are not
# typical AIX shared libraries.
! library_names_spec='${libname}${release}$soext$versuffix
${libname}${release}$soext$major $libname$soext'
else
# We preserve .a as extension for shared libraries through AIX4.2
# and later when we are not doing run time linking.
library_names_spec='${libname}${release}.a $libname.a'
! soname_spec='${libname}${release}$soext$major'
fi
shlibpath_var=LIBPATH
***************
*** 1995,1999 ****
beos*)
! library_names_spec='${libname}.so'
dynamic_linker="$host_os ld.so"
shlibpath_var=LIBRARY_PATH
--- 1996,2000 ----
beos*)
! library_names_spec='${libname}$soext'
dynamic_linker="$host_os ld.so"
shlibpath_var=LIBRARY_PATH
***************
*** 2003,2008 ****
version_type=linux
need_version=no
! library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so$major $libname.so'
! soname_spec='${libname}${release}.so$major'
finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH
--- 2004,2009 ----
version_type=linux
need_version=no
! library_names_spec='${libname}${release}$soext$versuffix
${libname}${release}$soext$major $libname$soext'
! soname_spec='${libname}${release}$soext$major'
finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH
***************
*** 2055,2060 ****
# cross-compilation, but unfortunately the echo tests do not
# yet detect zsh echo's removal of \ escapes.
! library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes
&& echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes
&& echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo
dylib)'
! soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so
|| echo dylib)'
shlibpath_overrides_runpath=yes
shlibpath_var=DYLD_LIBRARY_PATH
--- 2056,2061 ----
# cross-compilation, but unfortunately the echo tests do not
# yet detect zsh echo's removal of \ escapes.
! library_names_spec='${libname}${release}${versuffix}$(test .$module = .yes
&& echo $soext || echo .dylib) ${libname}${release}${major}$(test .$module =
.yes && echo $soext || echo .dylib) ${libname}$(test .$module = .yes && echo
$soext || echo .dylib)'
! soname_spec='${libname}${release}${major}$(test .$module = .yes && echo
$soext || echo .dylib)'
shlibpath_overrides_runpath=yes
shlibpath_var=DYLD_LIBRARY_PATH
***************
*** 2070,2079 ****
case $version_type in
freebsd-elf*)
! library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so $libname.so'
need_version=no
need_lib_prefix=no
;;
freebsd-*)
! library_names_spec='${libname}${release}.so$versuffix
$libname.so$versuffix'
need_version=yes
;;
--- 2071,2080 ----
case $version_type in
freebsd-elf*)
! library_names_spec='${libname}${release}$soext$versuffix
${libname}${release}$soext $libname$soext'
need_version=no
need_lib_prefix=no
;;
freebsd-*)
! library_names_spec='${libname}${release}$soext$versuffix
$libname$soext$versuffix'
need_version=yes
;;
***************
*** 2095,2100 ****
need_lib_prefix=no
need_version=no
! library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so${major} ${libname}.so'
! soname_spec='${libname}${release}.so$major'
shlibpath_var=LD_LIBRARY_PATH
hardcode_into_libs=yes
--- 2096,2101 ----
need_lib_prefix=no
need_version=no
! library_names_spec='${libname}${release}$soext$versuffix
${libname}${release}$soext${major} ${libname}$soext'
! soname_spec='${libname}${release}$soext$major'
shlibpath_var=LD_LIBRARY_PATH
hardcode_into_libs=yes
***************
*** 2110,2115 ****
shlibpath_var=SHLIB_PATH
shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
! library_names_spec='${libname}${release}.sl$versuffix
${libname}${release}.sl$major $libname.sl'
! soname_spec='${libname}${release}.sl$major'
# HP-UX runs *really* slowly unless shared libraries are mode 555.
postinstall_cmds='chmod 555 $lib'
--- 2111,2117 ----
shlibpath_var=SHLIB_PATH
shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
! library_names_spec='${libname}${release}$soext$versuffix
${libname}${release}$soext$major $libname$soext'
! soname_spec='${libname}${release}$soext$major'
! soext=.sl
# HP-UX runs *really* slowly unless shared libraries are mode 555.
postinstall_cmds='chmod 555 $lib'
***************
*** 2120,2125 ****
need_lib_prefix=no
need_version=no
! soname_spec='${libname}${release}.so$major'
! library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so$major ${libname}${release}.so $libname.so'
case $host_os in
irix5*)
--- 2122,2127 ----
need_lib_prefix=no
need_version=no
! soname_spec='${libname}${release}$soext$major'
! library_names_spec='${libname}${release}$soext$versuffix
${libname}${release}$soext$major ${libname}${release}$soext $libname$soext'
case $host_os in
irix5*)
***************
*** 2151,2156 ****
need_lib_prefix=no
need_version=no
! library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so$major $libname.so'
! soname_spec='${libname}${release}.so$major'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
shlibpath_var=LD_LIBRARY_PATH
--- 2153,2158 ----
need_lib_prefix=no
need_version=no
! library_names_spec='${libname}${release}$soext$versuffix
${libname}${release}$soext$major $libname$soext'
! soname_spec='${libname}${release}$soext$major'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
shlibpath_var=LD_LIBRARY_PATH
***************
*** 2175,2184 ****
need_version=no
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
! library_names_spec='${libname}${release}.so$versuffix
${libname}.so$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
dynamic_linker='NetBSD (a.out) ld.so'
else
! library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
! soname_spec='${libname}${release}.so$major'
dynamic_linker='NetBSD ld.elf_so'
fi
--- 2177,2186 ----
need_version=no
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
! library_names_spec='${libname}${release}$soext$versuffix
${libname}$soext$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
dynamic_linker='NetBSD (a.out) ld.so'
else
! library_names_spec='${libname}${release}$soext$versuffix
${libname}${release}$soext$major ${libname}${release}$soext ${libname}$soext'
! soname_spec='${libname}${release}$soext$major'
dynamic_linker='NetBSD ld.elf_so'
fi
***************
*** 2190,2194 ****
newsos6)
version_type=linux
! library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so$major $libname.so'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
--- 2192,2196 ----
newsos6)
version_type=linux
! library_names_spec='${libname}${release}$soext$versuffix
${libname}${release}$soext$major $libname$soext'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
***************
*** 2211,2215 ****
shlibpath_overrides_runpath=yes
fi
! library_names_spec='${libname}${release}.so$versuffix
${libname}.so$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
--- 2213,2217 ----
shlibpath_overrides_runpath=yes
fi
! library_names_spec='${libname}${release}$soext$versuffix
${libname}$soext$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
***************
*** 2227,2232 ****
version_type=osf
need_version=no
! soname_spec='${libname}${release}.so'
! library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so $libname.so'
shlibpath_var=LD_LIBRARY_PATH
sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc
/usr/lib /usr/local/lib /var/shlib"
--- 2229,2234 ----
version_type=osf
need_version=no
! soname_spec='${libname}${release}$soext'
! library_names_spec='${libname}${release}$soext$versuffix
${libname}${release}$soext $libname$soext'
shlibpath_var=LD_LIBRARY_PATH
sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc
/usr/lib /usr/local/lib /var/shlib"
***************
*** 2236,2241 ****
sco3.2v5*)
version_type=osf
! soname_spec='${libname}${release}.so$major'
! library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so$major $libname.so'
shlibpath_var=LD_LIBRARY_PATH
;;
--- 2238,2243 ----
sco3.2v5*)
version_type=osf
! soname_spec='${libname}${release}$soext$major'
! library_names_spec='${libname}${release}$soext$versuffix
${libname}${release}$soext$major $libname$soext'
shlibpath_var=LD_LIBRARY_PATH
;;
***************
*** 2245,2250 ****
need_lib_prefix=no
need_version=no
! library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so$major $libname.so'
! soname_spec='${libname}${release}.so$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
--- 2247,2252 ----
need_lib_prefix=no
need_version=no
! library_names_spec='${libname}${release}$soext$versuffix
${libname}${release}$soext$major $libname$soext'
! soname_spec='${libname}${release}$soext$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
***************
*** 2256,2260 ****
sunos4*)
version_type=sunos
! library_names_spec='${libname}${release}.so$versuffix
${libname}.so$versuffix'
finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH
--- 2258,2262 ----
sunos4*)
version_type=sunos
! library_names_spec='${libname}${release}$soext$versuffix
${libname}$soext$versuffix'
finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH
***************
*** 2268,2273 ****
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
version_type=linux
! library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so$major $libname.so'
! soname_spec='${libname}${release}.so$major'
shlibpath_var=LD_LIBRARY_PATH
case $host_vendor in
--- 2270,2275 ----
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
version_type=linux
! library_names_spec='${libname}${release}$soext$versuffix
${libname}${release}$soext$major $libname$soext'
! soname_spec='${libname}${release}$soext$major'
shlibpath_var=LD_LIBRARY_PATH
case $host_vendor in
***************
*** 2286,2291 ****
uts4*)
version_type=linux
! library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so$major $libname.so'
! soname_spec='${libname}${release}.so$major'
shlibpath_var=LD_LIBRARY_PATH
;;
--- 2288,2293 ----
uts4*)
version_type=linux
! library_names_spec='${libname}${release}$soext$versuffix
${libname}${release}$soext$major $libname$soext'
! soname_spec='${libname}${release}$soext$major'
shlibpath_var=LD_LIBRARY_PATH
;;
***************
*** 2295,2300 ****
need_lib_prefix=no
need_version=no
! library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so$major $libname.so'
! soname_spec='${libname}${release}.so$major'
shlibpath_var=LD_LIBRARY_PATH
;;
--- 2297,2302 ----
need_lib_prefix=no
need_version=no
! library_names_spec='${libname}${release}$soext$versuffix
${libname}${release}$soext$major $libname$soext'
! soname_spec='${libname}${release}$soext$major'
shlibpath_var=LD_LIBRARY_PATH
;;
***************
*** 2303,2308 ****
if test -d /usr/nec ;then
version_type=linux
! library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
! soname_spec='$libname.so.$major'
shlibpath_var=LD_LIBRARY_PATH
fi
--- 2305,2310 ----
if test -d /usr/nec ;then
version_type=linux
! library_names_spec='$libname$soext.$versuffix $libname$soext.$major
$libname$soext'
! soname_spec='$libname$soext.$major'
shlibpath_var=LD_LIBRARY_PATH
fi
***************
*** 2453,2457 ****
pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
thread_safe_flag_spec whole_archive_flag_spec libname_spec \
! library_names_spec soname_spec \
RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \
--- 2455,2459 ----
pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
thread_safe_flag_spec whole_archive_flag_spec libname_spec \
! library_names_spec soname_spec soext \
RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \
***************
*** 2651,2654 ****
--- 2653,2659 ----
# The coded name of the library, if different from the real name.
soname_spec=$lt_soname_spec
+
+ # The file name extension of the library.
+ soext=$lt_soext
# Commands used to build and install an old-style archive.
This is the MinGW patch:
*** ltmain.in.orig Tue Sep 11 01:40:18 2001
--- ltmain.in Fri May 17 13:43:24 2002
***************
*** 3713,3717 ****
# Backslashes separate directories on plain windows
! *-*-mingw | *-*-os2*)
$echo >> $output "\
exec \$progdir\\\\\$program \${1+\"address@hidden"}
--- 3713,3717 ----
# Backslashes separate directories on plain windows
! *-*-mingw* | *-*-os2*)
$echo >> $output "\
exec \$progdir\\\\\$program \${1+\"address@hidden"}
***************
*** 4274,4290 ****
# Do a test to see if this is really a libtool program.
! if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null
2>&1; then
notinst_deplibs=
relink_command=
# If there is no directory component, then add one.
! case $file in
! */* | *\\*) . $file ;;
! *) . ./$file ;;
esac
# Check the variables that should have been set.
if test -z "$notinst_deplibs"; then
! $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
exit 1
fi
--- 4274,4296 ----
# Do a test to see if this is really a libtool program.
! tem=$file
! case $host in
! *-mingw*)
! tem=`echo "$file" | sed 's,\.exe$,,'`
! ;;
! esac
! if (sed -e '4q' $tem | egrep "^# Generated by .*$PACKAGE") >/dev/null
2>&1; then
notinst_deplibs=
relink_command=
# If there is no directory component, then add one.
! case $tem in
! */* | *\\*) . $tem ;;
! *) . ./$tem ;;
esac
# Check the variables that should have been set.
if test -z "$notinst_deplibs"; then
! $echo "$modename: invalid libtool wrapper script \`$tem'" 1>&2
exit 1
fi
***************
*** 4310,4316 ****
relink_command=
# If there is no directory component, then add one.
! case $file in
! */* | *\\*) . $file ;;
! *) . ./$file ;;
esac
--- 4316,4322 ----
relink_command=
# If there is no directory component, then add one.
! case $tem in
! */* | *\\*) . $tem ;;
! *) . ./$tem ;;
esac
--
Ralph
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- patches for building loadable modules,
Schleicher Ralph (LLI) <=