* *demo/Makefile.am: use $(MATHLIB)

* *demo/configure.in: use AC_CHECK_LIBM
* doc/libtool.texi: renamed file_magic_command to file_magic_cmd,
  renamed archive_sym_cmds to archive_expsym_cmds
* ltconfig.in: ditto
* ltmain.in: ditto
* libltdl/ltdl.c: use lt_dlmalloc/free
* libltdl/ltdl.h: define lt_dlmalloc/free
* libtool.m4: added AC_CHECK_LIBM macro
* ltconfig.in: renamed archive_sym_cmds to archive_expsym_cmds,
  added always_export_symbols, export_symbols_cmd, exclude_expsyms,
  include_expsyms, removed archive_cmds for cygwin/mingw and AIX,
  on Solaris store the exported symbols list in objdir
* ltmain.in: allow -export-symbols for modules, use thread_safe flag,
  add include_expsyms to the exported symbols
This commit is contained in:
Thomas Tanner 1999-02-13 15:43:04 +00:00
parent ec379bc0dc
commit 6d34bd85f0
15 changed files with 178 additions and 121 deletions

View File

@ -1,3 +1,21 @@
1999-02-13 Thomas Tanner <tanner@gmx.de>
* *demo/Makefile.am: use $(MATHLIB)
* *demo/configure.in: use AC_CHECK_LIBM
* doc/libtool.texi: renamed file_magic_command to file_magic_cmd,
renamed archive_sym_cmds to archive_expsym_cmds
* ltconfig.in: ditto
* ltmain.in: ditto
* libltdl/ltdl.c: use lt_dlmalloc/free
* libltdl/ltdl.h: define lt_dlmalloc/free
* libtool.m4: added AC_CHECK_LIBM macro
* ltconfig.in: renamed archive_sym_cmds to archive_expsym_cmds,
added always_export_symbols, export_symbols_cmd, exclude_expsyms,
include_expsyms, removed archive_cmds for cygwin/mingw and AIX,
on Solaris store the exported symbols list in objdir
* ltmain.in: allow -export-symbols for modules, use thread_safe flag,
add include_expsyms to the exported symbols
1999-02-12 Gary V. Vaughan <gvaughan@oranda.demon.co.uk>
* libltdl/ltdl.h (_LTDLL_EXTERN): libltdl is no longer linked as a

View File

@ -15,4 +15,4 @@ noinst_HEADERS = foo.h
bin_PROGRAMS = cdemo
cdemo_SOURCES = main.c
cdemo_LDADD = libfoo1.la $(LIBADD_M)
cdemo_LDADD = libfoo1.la $(MATHLIB)

View File

@ -8,8 +8,7 @@ AM_PROG_LIBTOOL
AC_CHECK_HEADERS(math.h)
AC_CHECK_LIB(m, cos, LIBADD_M="-lm", LIBADD_M=)
AC_SUBST(LIBADD_M)
AC_CHECK_LIBM
dnl Output the makefile
AC_OUTPUT(Makefile)

View File

@ -10,7 +10,7 @@ CLEANFILES = $(hardcode_tests)
# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = hello.c foo.c
libhello_la_LDFLAGS = -version-info 3:12:1 $(LIBADD_M)
libhello_la_LDFLAGS = -version-info 3:12:1 $(MATHLIB)
include_HEADERS = foo.h

View File

@ -19,8 +19,7 @@ grep '^global_symbol_pipe=..*$' ./libtool >/dev/null])
AC_CHECK_HEADERS(string.h math.h)
AC_CHECK_LIB(m, cos, LIBADD_M="-lm", LIBADD_M=)
AC_SUBST(LIBADD_M)
AC_CHECK_LIBM
dnl Output the makefile
AC_OUTPUT(Makefile)

View File

@ -9,7 +9,7 @@ libl2_la_LIBADD = libl1.la
libl3_la_SOURCES = l3.c l3.h sysdep.h
libl3_la_LIBADD = libl1.la libl2.la
libl4_la_SOURCES = l4.c l4.h sysdep.h
libl4_la_LIBADD = libl3.la $(LIBADD_M)
libl4_la_LIBADD = libl3.la $(MATHLIB)
bin_PROGRAMS = depdemo depdemo.static

View File

@ -8,8 +8,7 @@ AM_PROG_LIBTOOL
AC_CHECK_HEADERS(math.h)
AC_CHECK_LIB(m, cos, LIBADD_M="-lm", LIBADD_M=)
AC_SUBST(LIBADD_M)
AC_CHECK_LIBM
dnl Output the makefile
AC_OUTPUT(Makefile)

View File

@ -3137,16 +3137,16 @@ of the message that contained his patch:
The basic architecture is this: in @file{ltconfig.in}, the person who
writes libtool makes sure @samp{$deplibs}, or @samp{$compile_dependencylibs}
are included in @samp{$archive_cmds} somewhere and also sets the
@samp{$deplibs_check_method}, and maybe @samp{$file_magic_command} when
@samp{$deplibs_check_method}, and maybe @samp{$file_magic_cmd} when
@samp{deplibs_check_method} is file_magic.
@samp{deplibs_check_method} can be one of five things:
@table @samp
@item file_magic [@var{regex}]
@vindex file_magic
@vindex file_magic_command
@vindex file_magic_cmd
looks in the library link path for libraries that have the right
libname. Then it runs @samp{$file_magic_command} on the library and
libname. Then it runs @samp{$file_magic_cmd} on the library and
checks for a match against @samp{regex} using @code{egrep}.
@item test_compile
@ -3377,10 +3377,10 @@ aren't defined in that library.
@end defvar
@defvar archive_cmds
@defvarx archive_sym_cmds
@defvarx archive_expsym_cmds
@defvarx old_archive_cmds
Commands used to create shared and static libraries, respectively.
@samp{archive_sym_cmds} is used when -export-symbols was defined.
@samp{archive_expsym_cmds} is used when -export-symbols was defined.
@end defvar
@defvar old_archive_from_new_cmds

View File

@ -99,6 +99,9 @@ const lt_dlsymlist lt_preloaded_symbols[1] = { { 0, 0 } };
static const char *last_error = 0;
lt_ptr_t (*lt_dlmalloc)(size_t size) = malloc;
void (*lt_dlfree)(lt_ptr_t ptr) = free;
typedef struct lt_dltype_t {
struct lt_dltype_t *next;
const char *sym_prefix; /* prefix for symbols */
@ -136,7 +139,7 @@ strdup(str)
if (!str)
return str;
tmp = (char*) malloc(strlen(str)+1);
tmp = (char*) lt_dlmalloc(strlen(str)+1);
if (tmp)
strcpy(tmp, str);
return tmp;
@ -428,7 +431,7 @@ dld_open (handle, filename)
}
if (dld_link(filename) != 0) {
last_error = unknown_error;
free(handle->handle);
lt_dlfree(handle->handle);
return 1;
}
return 0;
@ -442,7 +445,7 @@ dld_close (handle)
last_error = unknown_error;
return 1;
}
free(handle->filename);
lt_dlfree(handle->filename);
return 0;
}
@ -560,7 +563,7 @@ presym_free_symlists ()
lt_dlsymlists_t *tmp = lists;
lists = lists->next;
free(tmp);
lt_dlfree(tmp);
}
preloaded_symbols = 0;
return 0;
@ -586,7 +589,7 @@ presym_add_symlist (preloaded)
lists = lists->next;
}
tmp = (lt_dlsymlists_t*) malloc(sizeof(lt_dlsymlists_t));
tmp = (lt_dlsymlists_t*) lt_dlmalloc(sizeof(lt_dlsymlists_t));
if (!tmp) {
last_error = memory_error;
return 1;
@ -804,7 +807,7 @@ tryall_dlopen (handle, filename)
}
if (!type) {
if (cur->filename)
free(cur->filename);
lt_dlfree(cur->filename);
return 1;
}
cur->type = type;
@ -832,7 +835,7 @@ find_module (handle, dir, libdir, dlname, old_name, installed)
if (installed && libdir) {
int ret;
char *filename = (char*)
malloc(strlen(libdir)+1+strlen(dlname)+1);
lt_dlmalloc(strlen(libdir)+1+strlen(dlname)+1);
if (!filename) {
last_error = memory_error;
@ -842,7 +845,7 @@ find_module (handle, dir, libdir, dlname, old_name, installed)
strcat(filename, "/");
strcat(filename, dlname);
ret = tryall_dlopen(handle, filename) == 0;
free(filename);
lt_dlfree(filename);
if (ret)
return 0;
}
@ -850,7 +853,7 @@ find_module (handle, dir, libdir, dlname, old_name, installed)
if (!installed) {
int ret;
char *filename = (char*)
malloc((dir ? strlen(dir) : 0)
lt_dlmalloc((dir ? strlen(dir) : 0)
+ strlen(objdir) + strlen(dlname) + 1);
if (!filename) {
@ -865,7 +868,7 @@ find_module (handle, dir, libdir, dlname, old_name, installed)
strcat(filename, dlname);
ret = tryall_dlopen(handle, filename) == 0;
free(filename);
lt_dlfree(filename);
if (ret)
return 0;
}
@ -874,7 +877,7 @@ find_module (handle, dir, libdir, dlname, old_name, installed)
{
int ret;
char *filename = (char*)
malloc((dir ? strlen(dir) : 0)
lt_dlmalloc((dir ? strlen(dir) : 0)
+ strlen(dlname) + 1);
if (dir)
strcpy(filename, dir);
@ -882,7 +885,7 @@ find_module (handle, dir, libdir, dlname, old_name, installed)
*filename = 0;
strcat(filename, dlname);
ret = tryall_dlopen(handle, filename) == 0;
free(filename);
lt_dlfree(filename);
if (ret)
return 0;
}
@ -926,9 +929,9 @@ find_file (basename, search_path, pdir, handle)
continue;
if (lendir + 1 + lenbase >= filenamesize) {
if (filename)
free(filename);
lt_dlfree(filename);
filenamesize = lendir + 1 + lenbase + 1;
filename = (char*) malloc(filenamesize);
filename = (char*) lt_dlmalloc(filenamesize);
if (!filename) {
last_error = memory_error;
return 0;
@ -940,14 +943,14 @@ find_file (basename, search_path, pdir, handle)
strcpy(filename+lendir, basename);
if (handle) {
if (tryall_dlopen(handle, filename) == 0) {
free(filename);
lt_dlfree(filename);
return (lt_ptr_t) handle;
}
} else {
FILE *file = fopen(filename, LTDL_READTEXT_MODE);
if (file) {
if (*pdir)
free(*pdir);
lt_dlfree(*pdir);
filename[lendir] = '\0';
*pdir = strdup(filename);
if (!*pdir) {
@ -956,13 +959,13 @@ find_file (basename, search_path, pdir, handle)
memory overhead. */
*pdir = filename;
} else
free(filename);
lt_dlfree(filename);
return (lt_ptr_t) file;
}
}
}
if (filename)
free(filename);
lt_dlfree(filename);
last_error = file_not_found_error;
return 0;
}
@ -996,9 +999,9 @@ trim (dest, s)
int len = strlen(s);
if (*dest)
free(*dest);
lt_dlfree(*dest);
if (len > 3 && s[0] == '\'') {
tmp = (char*) malloc(i - s);
tmp = (char*) lt_dlmalloc(i - s);
if (!tmp) {
last_error = memory_error;
return 1;
@ -1021,17 +1024,17 @@ free_vars(dir, name, dlname, oldname, libdir, deplibs)
char *deplibs;
{
if (dir)
free(dir);
lt_dlfree(dir);
if (name)
free(name);
lt_dlfree(name);
if (dlname)
free(dlname);
lt_dlfree(dlname);
if (oldname)
free(oldname);
lt_dlfree(oldname);
if (libdir)
free(libdir);
lt_dlfree(libdir);
if (deplibs)
free(deplibs);
lt_dlfree(deplibs);
return 0;
}
@ -1045,7 +1048,7 @@ lt_dlopen (filename)
char *dir = 0, *name = 0;
if (!filename) {
handle = (lt_dlhandle) malloc(sizeof(lt_dlhandle_t));
handle = (lt_dlhandle) lt_dlmalloc(sizeof(lt_dlhandle_t));
if (!handle) {
last_error = memory_error;
return 0;
@ -1053,17 +1056,17 @@ lt_dlopen (filename)
handle->usage = 0;
newhandle = handle;
if (tryall_dlopen(handle, 0) != 0) {
free(newhandle);
lt_dlfree(newhandle);
return 0;
}
if (newhandle != handle)
free(newhandle);
lt_dlfree(newhandle);
return handle;
}
basename = strrchr(filename, '/');
if (basename) {
basename++;
dir = (char*) malloc(basename - filename + 1);
dir = (char*) lt_dlmalloc(basename - filename + 1);
if (!dir) {
last_error = memory_error;
return 0;
@ -1087,11 +1090,11 @@ lt_dlopen (filename)
int installed = 1;
/* extract the module name from the file name */
name = (char*) malloc(ext - basename + 1);
name = (char*) lt_dlmalloc(ext - basename + 1);
if (!name) {
last_error = memory_error;
if (dir)
free(dir);
lt_dlfree(dir);
return 0;
}
/* canonicalize the module name */
@ -1123,9 +1126,9 @@ lt_dlopen (filename)
}
if (!file) {
if (name)
free(name);
lt_dlfree(name);
if (dir)
free(dir);
lt_dlfree(dir);
return 0;
}
/* read the .la file */
@ -1158,10 +1161,10 @@ lt_dlopen (filename)
}
fclose(file);
/* allocate the handle */
handle = (lt_dlhandle) malloc(sizeof(lt_dlhandle_t));
handle = (lt_dlhandle) lt_dlmalloc(sizeof(lt_dlhandle_t));
if (!handle || error) {
if (handle)
free(handle);
lt_dlfree(handle);
if (!error)
last_error = memory_error;
free_vars(name, dir, dlname, old_name, libdir, deplibs);
@ -1179,7 +1182,7 @@ lt_dlopen (filename)
} else
error = 1;
if (error) {
free(handle);
lt_dlfree(handle);
free_vars(name, dir, dlname, old_name, libdir, deplibs);
return 0;
}
@ -1188,11 +1191,11 @@ lt_dlopen (filename)
}
} else {
/* not a libtool module */
handle = (lt_dlhandle) malloc(sizeof(lt_dlhandle_t));
handle = (lt_dlhandle) lt_dlmalloc(sizeof(lt_dlhandle_t));
if (!handle) {
last_error = memory_error;
if (dir)
free(dir);
lt_dlfree(dir);
return 0;
}
handle->usage = 0;
@ -1212,14 +1215,14 @@ lt_dlopen (filename)
0, &handle)
#endif
))) {
free(handle);
lt_dlfree(handle);
if (dir)
free(dir);
lt_dlfree(dir);
return 0;
}
}
if (newhandle != handle) {
free(handle);
lt_dlfree(handle);
handle = newhandle;
}
if (!handle->usage) {
@ -1228,9 +1231,9 @@ lt_dlopen (filename)
handle->next = handles;
handles = handle;
} else if (name)
free(name);
lt_dlfree(name);
if (dir)
free(dir);
lt_dlfree(dir);
last_error = saved_error;
return handle;
}
@ -1258,7 +1261,7 @@ lt_dlopenext (filename)
if (handle)
return handle;
/* try "filename.la" */
tmp = (char*) malloc(len+4);
tmp = (char*) lt_dlmalloc(len+4);
if (!tmp) {
last_error = memory_error;
return 0;
@ -1268,14 +1271,14 @@ lt_dlopenext (filename)
handle = lt_dlopen(tmp);
if (handle) {
last_error = saved_error;
free(tmp);
lt_dlfree(tmp);
return handle;
}
#ifdef LTDL_SHLIB_EXT
/* try "filename.EXT" */
if (strlen(shlib_ext) > 3) {
free(tmp);
tmp = (char*) malloc(len + strlen(shlib_ext) + 1);
lt_dlfree(tmp);
tmp = (char*) lt_dlmalloc(len + strlen(shlib_ext) + 1);
if (!tmp) {
last_error = memory_error;
return 0;
@ -1287,12 +1290,12 @@ lt_dlopenext (filename)
handle = lt_dlopen(tmp);
if (handle) {
last_error = saved_error;
free(tmp);
lt_dlfree(tmp);
return handle;
}
#endif
last_error = file_not_found_error;
free(tmp);
lt_dlfree(tmp);
return 0;
}
@ -1322,10 +1325,10 @@ lt_dlclose (handle)
handles = handle->next;
error = handle->type->lib_close(handle);
error += unload_deplibs(handle);
free(handle->filename);
lt_dlfree(handle->filename);
if (handle->name)
free(handle->name);
free(handle);
lt_dlfree(handle->name);
lt_dlfree(handle);
return error;
}
return 0;
@ -1357,7 +1360,7 @@ lt_dlsym (handle, symbol)
if (lensym + LTDL_SYMBOL_OVERHEAD < LTDL_SYMBOL_LENGTH)
sym = lsym;
else
sym = (char*) malloc(lensym + LTDL_SYMBOL_OVERHEAD + 1);
sym = (char*) lt_dlmalloc(lensym + LTDL_SYMBOL_OVERHEAD + 1);
if (!sym) {
last_error = buffer_overflow_error;
return 0;
@ -1375,7 +1378,7 @@ lt_dlsym (handle, symbol)
address = handle->type->find_sym(handle, sym);
if (address) {
if (sym != lsym)
free(sym);
lt_dlfree(sym);
return address;
}
}
@ -1387,7 +1390,7 @@ lt_dlsym (handle, symbol)
strcpy(sym, symbol);
address = handle->type->find_sym(handle, sym);
if (sym != lsym)
free(sym);
lt_dlfree(sym);
return address;
}
@ -1414,7 +1417,7 @@ lt_dladdsearchdir (search_dir)
}
} else {
char *new_search_path = (char*)
malloc(strlen(user_search_path) +
lt_dlmalloc(strlen(user_search_path) +
strlen(search_dir) + 1);
if (!new_search_path) {
last_error = memory_error;
@ -1422,7 +1425,7 @@ lt_dladdsearchdir (search_dir)
}
strcat(new_search_path, ":");
strcat(new_search_path, search_dir);
free(user_search_path);
lt_dlfree(user_search_path);
user_search_path = new_search_path;
}
return 0;
@ -1433,7 +1436,7 @@ lt_dlsetsearchpath (search_path)
const char *search_path;
{
if (user_search_path)
free(user_search_path);
lt_dlfree(user_search_path);
user_search_path = 0; /* reset the search path */
if (!search_path || !strlen(search_path))
return 0;

View File

@ -48,6 +48,8 @@ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# define lt_ptr_t char*
#endif
#include <stdlib.h>
#ifdef _LTDL_COMPILE_
typedef struct lt_dlhandle_t *lt_dlhandle;
#else
@ -76,6 +78,9 @@ extern const char *lt_dlgetsearchpath __P((void));
extern const lt_dlsymlist lt_preloaded_symbols[];
#define LTDL_SET_PRELOADED_SYMBOLS() lt_dlpreload_default(lt_preloaded_symbols)
extern lt_ptr_t (*lt_dlmalloc)(size_t size);
extern void (*lt_dlfree)(lt_ptr_t ptr);
__END_DECLS
#endif /* !_LTDL_H_ */

8
libtool.m4 vendored
View File

@ -546,6 +546,14 @@ USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no}
AC_SUBST(USE_SYMBOL_UNDERSCORE)dnl
])
# AC_CHECK_LIBM - check for math library
AC_DEFUN(AC_CHECK_LIBM,
[
AC_CHECK_LIB(mw, _mwvalidcheckl, MATHLIB="-lmw", MATHLIB=)
AC_CHECK_LIB(m, cos, MATHLIB="-lm $MATHLIB", )
AC_SUBST(MATHLIB)dnl
])
dnl old names
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl

View File

@ -1002,7 +1002,7 @@ need_version=unknown
# when you set need_version to no, make sure it does not cause -set_version
# flags to be left without arguments
archive_cmds=
archive_sym_cmds=
archive_expsym_cmds=
old_archive_from_new_cmds=
export_dynamic_flag_spec=
whole_archive_flag_spec=
@ -1013,6 +1013,10 @@ hardcode_direct=no
hardcode_minus_L=no
hardcode_shlibpath_var=unsupported
runpath_var=
always_export_symbols=no
export_symbols_cmd="$NM $libobjs | $global_symbol_pipe | sed '\''s/.* //'\' | sort | uniq > $export_symbols"
include_expsyms=
exclude_expsyms=
case "$host_os" in
aix3* | aix4*)
@ -1064,19 +1068,10 @@ if test "$with_gnu_ld" = yes; then
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
allow_undefined_flag=unsupported
always_export_symbols=yes
export_symbols_cmd='$DLLTOOL --export-all --output-def $export_symbols $objdir/$soname-ltdll.$objext $libobjs'
archive_cmds='rm -f $objdir/$soname-ltdll.c~
sed -e "/^# \/\* ltdll.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
(cd $objdir && $CC -c $soname-ltdll.c)~
echo EXPORTS > $objdir/$soname-def~
$DLLTOOL --export-all --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs~
$CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
$DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
$CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
$DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
$CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts'
archive_sym_cmds='rm -f $objdir/$soname-ltdll.c~
archive_expsym_cmds='rm -f $objdir/$soname-ltdll.c~
sed -e "/^# \/\* ltdll.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
(cd $objdir && $CC -c $soname-ltdll.c)~
echo EXPORTS > $objdir/$soname-def~
@ -1093,7 +1088,7 @@ if test "$with_gnu_ld" = yes; then
*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib $libobjs $deplibs $linkopts'
archive_sym_cmds='$CC -shared ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib $libobjs $deplibs $linkopts'
archive_expsym_cmds='$CC -shared ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib $libobjs $deplibs $linkopts'
else
ld_shlibs=no
fi
@ -1111,9 +1106,8 @@ else
case "$host_os" in
aix3*)
allow_undefined_flag=unsupported
archive_cmds='$NM $libobjs | $global_symbol_pipe | sed '\''s/.* //'\' | sort | uniq' > $lib.exp~
$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$lib.exp -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname'
archive_sym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname'
always_export_symbols=yes
archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname'
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
@ -1138,9 +1132,8 @@ else
fi
archive_cmds='$CC -shared ${wl}-bnoentry -o $objdir/$soname $libobjs $deplibs $linkopts'
else
archive_cmds='$NM $libobjs | $global_symbol_pipe | sed '\''s/.* //'\' | sort | uniq' > $lib.exp~
$CC -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry'
archive_sym_cmds='$CC -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bM:SRE ${wl}-bnoentry'
always_export_symbols=yes
archive_expsym_cmds='$CC -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bM:SRE ${wl}-bnoentry'
hardcode_direct=yes
fi
hardcode_minus_L=yes
@ -1283,8 +1276,8 @@ else
# $CC -shared without GNU ld will not create a library from C++
# object files and a static libstdc++, better avoid it by now
archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
archive_sym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
archive_expsym_cmds='$echo "{ global:" > $objdir/$lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $objdir/$lib.exp~$echo "local: *; };" >> $objdir/$lib.exp~
$LD -G${allow_undefined_flag} -M $objdir/$lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $objdir/$lib.exp'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_shlibpath_var=no
;;
@ -1555,7 +1548,7 @@ shlibpath_var=
version_type=none
dynamic_linker="$host_os ld.so"
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
file_magic_command=
file_magic_cmd=
deplibs_check_method='unknown'
# Need to set the preceding variable on all platforms that support
# interlibrary dependencies.
@ -1564,7 +1557,7 @@ deplibs_check_method='unknown'
# 'pass_all' -- all dependencies passed with no checks.
# 'test_compile' -- check by making test program.
# 'file_magic [regex]' -- check by looking for files in library path
# which responds to the $file_magic_command with a given egrep regex.
# which responds to the $file_magic_cmd with a given egrep regex.
# If you have `file' or equivalent on your system and you're not sure
# whether `pass_all' will *always* work, you probably want this one.
echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
@ -1621,7 +1614,7 @@ cygwin* | mingw*)
fi
dynamic_linker='Win32 ld.exe'
deplibs_check_method='file_magic file format pei*-i386.*architecture: i386'
file_magic_command='objdump -f'
file_magic_cmd='objdump -f'
need_lib_prefix=no
# FIXME: first we should search . and the directory the executable is in
shlibpath_var=PATH
@ -1637,7 +1630,7 @@ freebsd*)
case "$version_type" in
freebsd-elf*)
deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
file_magic_command=file
file_magic_cmd=file
;;
freebsd-*)
deplibs_check_method=unknown
@ -1675,7 +1668,7 @@ irix5*)
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
shlibpath_var=LD_LIBRARY_PATH
deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" # or should it be pass_all?
file_magic_command=file
file_magic_cmd=file
;;
irix6*)
@ -1693,7 +1686,7 @@ irix6*)
shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" # or should it be pass_all?
file_magic_command=file
file_magic_cmd=file
;;
# No shared lib support for Linux oldld, aout, or coff.
@ -1711,7 +1704,7 @@ linux-gnu*)
finish_cmds='PATH="$PATH:/sbin" ldconfig -n $libdir'
shlibpath_var=LD_LIBRARY_PATH
deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
file_magic_command=file
file_magic_cmd=file
if test -f /lib/ld.so.1; then
dynamic_linker='GNU ld.so'
@ -1782,7 +1775,7 @@ solaris*)
# ldd complains unless libraries are executable
postinstall_cmds='chmod +x $lib'
deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib"
file_magic_command="file"
file_magic_cmd="file"
;;
sunos4*)
@ -1893,16 +1886,16 @@ case "$ltmain" in
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_sym_cmds postinstall_cmds postuninstall_cmds \
file_magic_command deplibs_check_method allow_undefined_flag no_undefined_flag \
old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \
file_magic_cmd export_symbols_cmd deplibs_check_method allow_undefined_flag no_undefined_flag \
finish_cmds finish_eval global_symbol_pipe hardcode_libdir_flag_spec \
hardcode_libdir_separator sys_lib_search_path_spec \
compiler_c_o compiler_o_lo need_locks; do
compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
case "$var" in
reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
old_postinstall_cmds | old_postuninstall_cmds | \
archive_cmds | archive_sym_cmds | \
archive_cmds | archive_expsym_cmds | \
postinstall_cmds | postuninstall_cmds | \
finish_cmds | sys_lib_search_path_spec)
# Double-quote double-evaled strings.
@ -2108,7 +2101,7 @@ old_archive_from_new_cmds=$old_archive_from_new_cmds
# Commands used to build and install a shared archive.
archive_cmds=$archive_cmds
archive_sym_cmds=$archive_sym_cmds
archive_expsym_cmds=$archive_expsym_cmds
postinstall_cmds=$postinstall_cmds
postuninstall_cmds=$postuninstall_cmds
@ -2116,7 +2109,7 @@ postuninstall_cmds=$postuninstall_cmds
deplibs_check_method=$deplibs_check_method
# Command to use when deplibs_check_method == file_magic
file_magic_command=$file_magic_command
file_magic_cmd=$file_magic_cmd
# Flag that allows shared libraries with undefined symbols to be built.
allow_undefined_flag=$allow_undefined_flag
@ -2166,6 +2159,19 @@ sys_lib_search_path_spec=$sys_lib_search_path_spec
# Fix the shell variable \$srcfile for the compiler.
fix_srcfile_path="$fix_srcfile_path"
# Set to yes if exported symbols are required
always_export_symbols=$always_export_symbols
# The command to extract exported symbols
export_symbols_cmd=$export_symbols_cmd
# Symbols that should not be listed in the preloaded symbols
exclude_expsyms=$exclude_expsyms
# Symbols that must always be exported
include_expsyms=$include_expsyms
EOF
case "$ltmain" in

View File

@ -1293,11 +1293,6 @@ compiler."
exit 1
fi
if test -n "$export_symbols" && test "$module" = yes; then
$echo "$modename: \`-export-symbols' is not supported for modules"
exit 1
fi
oldlibs=
# calculate the name of the file, without its directory
outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
@ -1724,7 +1719,7 @@ EOF
| $Xsed -e 's,[^/]*$,,'`"$potliblink";;
esac
done
if eval $file_magic_command \"\$potlib\" \
if eval $file_magic_cmd \"\$potlib\" \
| sed '11,$d' \
| egrep "$file_magic_regex" > /dev/null; then
newdeplibs="$newdeplibs $a_deplib"
@ -1857,9 +1852,25 @@ EOF
done
fi
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
eval flag=\"$thread_safe_flag_spec\"
linkopts="$linkopts $flag"
fi
# Prepare the list of exported symbols
if test "$always_export_symbols" = yes && test -z "$export_symbols"; then
export_symbols="$objdir/$libname.exp"
$run $rm $export_symbols
$run eval "$export_symbols_cmd"
fi
if test -n "$include_expsyms"; then
$run $echo "X$include_expsyms" | $SP2NL >> $export_symbols
fi
# Do each of the archive commands.
if test -n "$export_symbols" && test -n "$archive_sym_cmds"; then
eval cmds=\"$archive_sym_cmds\"
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
eval cmds=\"$archive_expsym_cmds\"
else
eval cmds=\"$archive_cmds\"
fi
@ -2137,6 +2148,10 @@ extern \"C\" {
$run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
done
if test -n "$exclude_expsyms"; then
: # TODO: remove symbols from $nlist
fi
if test -z "$run"; then
# Make sure we have at least an empty file.
test -f "$nlist" || : > "$nlist"
@ -2186,6 +2201,9 @@ lt_preloaded_symbols[] =
for arg in $progfiles; do
eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
done
if test -n "$exclude_expsyms"; then
: # TODO: remove symbols from $nlist
fi
if test -f "$nlist"; then
sed 's/^\(.*\) \(.*\)$/ {"\1", (lt_ptr_t) \&\2},/' < "$nlist" >> "$output_objdir/$dlsyms"
else
@ -2200,6 +2218,9 @@ lt_preloaded_symbols[] =
{\"$name\", (lt_ptr_t) 0},"
eval "$NM $arg | $global_symbol_pipe > '$nlist'"
if test -n "$exclude_expsyms"; then
: # TODO: remove symbols from $nlist
fi
if test -f "$nlist"; then
sed 's/^\(.*\) \(.*\)$/ {"\1", (lt_ptr_t) \&\2},/' < "$nlist" >> "$output_objdir/$dlsyms"
else

View File

@ -9,10 +9,10 @@ EXTRA_DIST = acinclude.m4
lib_LTLIBRARIES = foo1.la libfoo2.la
foo1_la_SOURCES = foo1.c
foo1_la_LDFLAGS = $(LIBADD_M) -module -avoid-version
foo1_la_LDFLAGS = $(MATHLIB) -module -avoid-version
libfoo2_la_SOURCES = foo2.c
libfoo2_la_LDFLAGS = $(LIBADD_M) -module
libfoo2_la_LDFLAGS = $(MATHLIB) -module
noinst_HEADERS = foo.h

View File

@ -16,8 +16,7 @@ AC_SUBST(STATIC)
AC_CHECK_HEADERS(math.h)
AC_CHECK_LIB(m, cos, LIBADD_M="-lm", LIBADD_M=)
AC_SUBST(LIBADD_M)
AC_CHECK_LIBM
dnl Output the makefile
AC_OUTPUT(Makefile)