mirror of
git://git.savannah.gnu.org/libtool.git
synced 2024-11-21 01:40:57 +08:00
1998-11-04 Alexandre Oliva <oliva@dcc.unicamp.br>
* ltconfig.in, ltmain.in: updated and fixed the patches below 1998-11-04 Thomas Tanner <tanner@gmx.de> * mdemo/*: added new demo to demonstrate building of dlopenend modules * tests/Makefile.am, tests/mdemo*: added some tests for mdemo 1998-11-04 Gary V. Vaughan <gvaughan@oranda.demon.co.uk> * demo/configure.in: added AC_EXEEXT macro so that the tests can work on cywin32/mingw32 hosts. This requires the current CVS autoconf 1998-11-04 Thomas Tanner <tanner@gmx.de> * ltmain.in: New flag -export-symbols; new dlpreopen system * demo/dlmain.c: removed dld_preloaded_symbol_count 1998-11-04 Ian Lance Taylor <ian@cygnus.com> * ltmain.in: On installation, don't get confused if the same name appears more than once in the list of library names. 1998-11-04 Ian Lance Taylor <ian@cygnus.com> * ltconfig.in: Add objext and libext variables. Check for object suffix. Check for mingw32* as well as cygwin32*. Use objext when testing compiler. Add support for Visual C++ on cygwin32 when not using gcc. Add objext, libext, and fix_srcfile_path to generated libtool script. * ltmain.in: Use .${objext} rather than .o. Use fix_srcfile_path if it is set. Check for .obj as well as for .o, and for .lib as well as for .a. Use .${libext} rather than .a when creating old libraries. * libtoolize.in: Change initial /bin/sh to @SHELL@. * libtool.m4 (AM_PROG_LIBTOOL): Add AC_REQUIRE for AC_CANONICAL_BUILD, so that autoconf doesn't get mixed up by the AC_REQUIRE in AC_CHECK_TOOL. 1998-11-04 Ian Lance Taylor <ian@cygnus.com> * ltconfig.in: Look in the right directory for libtool.c in archive_cmds for cygwin32. 1998-11-04 Ian Lance Taylor <ian@cygnus.com> * ltconfig.in: Fix cygwin32 support to avoid using a double extension, to delete the def file, to set version_type to windows, and to include versuffix in the DLL name. * ltmain.in: Add support for a version_type of windows. 1998-11-04 Ian Lance Taylor <ian@cygnus.com> * ltconfig.in: Add cygwin32 support. * libtool.m4 (AM_PROG_LIBTOOL): Call AM_SYS_LIBTOOL_CYGWIN32 on a cygwin32 host. Pass DLLTOOL and AS to ltconfig. (AM_SYS_LIBTOOL_CYGWIN32): New macro.
This commit is contained in:
parent
b9d0ec01b0
commit
8c1f97e1be
61
ChangeLog
61
ChangeLog
@ -1,3 +1,64 @@
|
||||
1998-11-04 Alexandre Oliva <oliva@dcc.unicamp.br>
|
||||
|
||||
* ltconfig.in, ltmain.in: updated and fixed the patches below
|
||||
|
||||
1998-11-04 Thomas Tanner <tanner@gmx.de>
|
||||
|
||||
* mdemo/*: added new demo to demonstrate building of dlopenend
|
||||
modules
|
||||
* tests/Makefile.am, tests/mdemo*: added some tests for mdemo
|
||||
|
||||
1998-11-04 Gary V. Vaughan <gvaughan@oranda.demon.co.uk>
|
||||
|
||||
* demo/configure.in: added AC_EXEEXT macro so that the tests can
|
||||
work on cywin32/mingw32 hosts. This requires the current CVS
|
||||
autoconf
|
||||
|
||||
1998-11-04 Thomas Tanner <tanner@gmx.de>
|
||||
|
||||
* ltmain.in: New flag -export-symbols; new dlpreopen system
|
||||
* demo/dlmain.c: removed dld_preloaded_symbol_count
|
||||
|
||||
1998-11-04 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* ltmain.in: On installation, don't get confused if the same name
|
||||
appears more than once in the list of library names.
|
||||
|
||||
1998-11-04 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* ltconfig.in: Add objext and libext variables. Check for object
|
||||
suffix. Check for mingw32* as well as cygwin32*. Use objext when
|
||||
testing compiler. Add support for Visual C++ on cygwin32 when not
|
||||
using gcc. Add objext, libext, and fix_srcfile_path to generated
|
||||
libtool script.
|
||||
* ltmain.in: Use .${objext} rather than .o. Use fix_srcfile_path
|
||||
if it is set. Check for .obj as well as for .o, and for .lib as
|
||||
well as for .a. Use .${libext} rather than .a when creating old
|
||||
libraries.
|
||||
* libtoolize.in: Change initial /bin/sh to @SHELL@.
|
||||
* libtool.m4 (AM_PROG_LIBTOOL): Add AC_REQUIRE for
|
||||
AC_CANONICAL_BUILD, so that autoconf doesn't get mixed up by the
|
||||
AC_REQUIRE in AC_CHECK_TOOL.
|
||||
|
||||
1998-11-04 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* ltconfig.in: Look in the right directory for libtool.c in
|
||||
archive_cmds for cygwin32.
|
||||
|
||||
1998-11-04 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* ltconfig.in: Fix cygwin32 support to avoid using a double
|
||||
extension, to delete the def file, to set version_type to windows,
|
||||
and to include versuffix in the DLL name.
|
||||
* ltmain.in: Add support for a version_type of windows.
|
||||
|
||||
1998-11-04 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* ltconfig.in: Add cygwin32 support.
|
||||
* libtool.m4 (AM_PROG_LIBTOOL): Call AM_SYS_LIBTOOL_CYGWIN32 on a
|
||||
cygwin32 host. Pass DLLTOOL and AS to ltconfig.
|
||||
(AM_SYS_LIBTOOL_CYGWIN32): New macro.
|
||||
|
||||
1998-11-04 Alexandre Oliva <oliva@dcc.unicamp.br>
|
||||
|
||||
* libtool.m4 (sco): fix typo
|
||||
|
37
Makefile.am
37
Makefile.am
@ -20,6 +20,14 @@ demo_distfiles = demo/Makefile.in demo/Makefile.am demo/README \
|
||||
demo/configure demo/configure.in demo/foo.c demo/foo.h \
|
||||
demo/dlmain.c demo/hello.c demo/main.c demo/run.test
|
||||
|
||||
# Files in the mdemo subdirectory that go in the distribution.
|
||||
mdemo_distfiles = mdemo/Makefile.in mdemo/Makefile.am mdemo/README \
|
||||
mdemo/acinclude.m4 mdemo/aclocal.m4 \
|
||||
mdemo/configure mdemo/configure.in \
|
||||
mdemo/foo.h mdemo/foo1.c mdemo/foo2.c \
|
||||
mdemo/libfoo1.sym mdemo/libfoo2.sym \
|
||||
mdemo/main.c mdemo/ltdl.h mdemo/ltdl.c mdemo/ltdls.c
|
||||
|
||||
# These are required by libtoolize.
|
||||
pkgdata_SCRIPTS = config.guess config.sub ltconfig
|
||||
pkgdata_DATA = ltmain.sh
|
||||
@ -59,8 +67,8 @@ $(srcdir)/ltmain.sh: ltmain.in $(top_srcdir)/configure.in
|
||||
sed -e 's/@''PACKAGE@/@PACKAGE@/' -e 's/@''VERSION@/@VERSION@/' $(srcdir)/ltmain.in > ltmain.shT
|
||||
mv -f ltmain.shT $@
|
||||
|
||||
# Distribute the demo subdirectory.
|
||||
dist-hook: $(demo_distfiles)
|
||||
# Distribute the demo and mdemo subdirectory.
|
||||
dist-hook: $(demo_distfiles) $(mdemo_distfiles)
|
||||
mkdir $(distdir)/demo
|
||||
-chmod 755 $(distdir)/demo
|
||||
here=`pwd`; distdir=`cd $(distdir) && pwd` \
|
||||
@ -72,9 +80,20 @@ dist-hook: $(demo_distfiles)
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
mkdir $(distdir)/mdemo
|
||||
-chmod 755 $(distdir)/mdemo
|
||||
here=`pwd`; distdir=`cd $(distdir) && pwd` \
|
||||
&& cd $(srcdir)/mdemo \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here/mdemo --srcdir-name=$(srcdir)/mdemo --output-dir=$$distdir/mdemo
|
||||
@for file in $(mdemo_distfiles); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
|
||||
# All our rules should depend on these demo files.
|
||||
all: demo/Makefile.in demo/configure
|
||||
all: demo/Makefile.in demo/configure mdemo/Makefile.in mdemo/configure
|
||||
|
||||
# We use our own libtool.m4.
|
||||
$(srcdir)/acinclude.m4: libtool.m4
|
||||
@ -83,6 +102,9 @@ $(srcdir)/acinclude.m4: libtool.m4
|
||||
$(srcdir)/demo/acinclude.m4: libtool.m4
|
||||
rm -f $(srcdir)/demo/acinclude.m4
|
||||
cd $(srcdir)/demo && $(LN_S) ../libtool.m4 acinclude.m4
|
||||
$(srcdir)/mdemo/acinclude.m4: libtool.m4
|
||||
rm -f $(srcdir)/mdemo/acinclude.m4
|
||||
cd $(srcdir)/mdemo && $(LN_S) ../libtool.m4 acinclude.m4
|
||||
|
||||
# Rules for rebuilding some of the demo source files.
|
||||
$(srcdir)/demo/Makefile.in: demo/Makefile.am demo/configure.in demo/aclocal.m4
|
||||
@ -94,6 +116,15 @@ $(srcdir)/demo/configure: demo/configure.in demo/aclocal.m4
|
||||
$(srcdir)/demo/aclocal.m4: demo/configure.in demo/acinclude.m4
|
||||
cd $(srcdir)/demo && $(ACLOCAL)
|
||||
|
||||
$(srcdir)/mdemo/Makefile.in: mdemo/Makefile.am mdemo/configure.in mdemo/aclocal.m4
|
||||
cd $(srcdir)/mdemo && $(AUTOMAKE)
|
||||
|
||||
$(srcdir)/mdemo/configure: mdemo/configure.in mdemo/aclocal.m4
|
||||
cd $(srcdir)/mdemo && $(AUTOCONF)
|
||||
|
||||
$(srcdir)/mdemo/aclocal.m4: mdemo/configure.in mdemo/acinclude.m4
|
||||
cd $(srcdir)/mdemo && $(ACLOCAL)
|
||||
|
||||
######################################################################
|
||||
# These commands really help my life as a maintainer who uses PRCS.
|
||||
# Feel free to copy them to your own project. I just run a
|
||||
|
@ -3,6 +3,7 @@ AC_INIT(hello.c)
|
||||
AM_INIT_AUTOMAKE(hell,1.0)
|
||||
|
||||
AC_PROG_CC
|
||||
AC_EXEEXT
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
dnl Output the makefile
|
||||
|
@ -28,7 +28,6 @@ struct dld_symlist
|
||||
};
|
||||
|
||||
extern struct dld_symlist dld_preloaded_symbols[];
|
||||
extern int dld_preloaded_symbol_count;
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
@ -42,24 +41,21 @@ main (argc, argv)
|
||||
|
||||
printf ("Welcome to *modular* GNU Hell!\n");
|
||||
|
||||
if (dld_preloaded_symbol_count < 0)
|
||||
printf ("Sorry, the symbol list is not sorted and unique.\n");
|
||||
else
|
||||
printf ("Yippee! The symbol list is both sorted and unique.\n");
|
||||
|
||||
/* Look up the symbols we require for this demonstration. */
|
||||
s = dld_preloaded_symbols;
|
||||
while (s->name)
|
||||
{
|
||||
/* FIXME: we are simplistic about leading underscores. */
|
||||
printf ("found symbol: %s\n", s->name);
|
||||
if (!strcmp ("hello", s->name))
|
||||
phello = s->address;
|
||||
else if (!strcmp ("foo", s->name))
|
||||
pfoo = s->address;
|
||||
else if (!strcmp ("nothing", s->name))
|
||||
pnothing = s->address;
|
||||
|
||||
if (s->address) {
|
||||
/* FIXME: we are simplistic about leading underscores. */
|
||||
printf ("found symbol: %s\n", s->name);
|
||||
if (!strcmp ("hello", s->name))
|
||||
phello = s->address;
|
||||
else if (!strcmp ("foo", s->name))
|
||||
pfoo = s->address;
|
||||
else if (!strcmp ("nothing", s->name))
|
||||
pnothing = s->address;
|
||||
} else
|
||||
printf ("found file: %s\n", s->name);
|
||||
s ++;
|
||||
}
|
||||
|
||||
|
@ -1109,6 +1109,11 @@ Link @var{file} into the output program, and add its symbols to
|
||||
Allow symbols from @var{output-file} to be resolved with @code{dlsym}
|
||||
(@pxref{Dlopened modules}).
|
||||
|
||||
@item -export-symbols @var{symfile}
|
||||
Same as @samp{-export-dynamic}, except that it only exports symbols
|
||||
that are listed in @var{symfile}. The symbol file should end in @samp{.sym}
|
||||
and must contain the name of one symbol per line.
|
||||
|
||||
@item -L@var{libdir}
|
||||
Search @var{libdir} for required libraries that have already been
|
||||
installed.
|
||||
@ -2227,10 +2232,10 @@ On some operating systems, a program symbol must be specially declared
|
||||
in order to be dynamically resolved with the @code{dlsym} (or
|
||||
equivalent) function.
|
||||
|
||||
Libtool provides the @samp{-export-dynamic} link flag (@pxref{Link
|
||||
mode}), which does this declaration. You need to use this flag if you
|
||||
are linking an application program that dlopens other modules or a
|
||||
libtool library that will also be dlopened.
|
||||
Libtool provides the @samp{-export-dynamic} and @samp{-export-symbols} link
|
||||
flags (@pxref{Link mode}), which does this declaration.
|
||||
You need to use this flag if you are linking an application program that
|
||||
dlopens other modules or a libtool library that will also be dlopened.
|
||||
|
||||
For example, if we wanted to build a shared library, @file{libhello},
|
||||
that would later be dlopened by an application, we would add
|
||||
@ -2289,9 +2294,9 @@ module, or the module is not found, then the application can recover
|
||||
without crashing.
|
||||
@end enumerate
|
||||
|
||||
Libtool emulates @samp{-export-dynamic} on static platforms by linking
|
||||
objects into the program at compile time, and creating data structures
|
||||
that represent the program's symbol table.
|
||||
Libtool emulates @samp{-export-dynamic} and @samp{-export-symbols}
|
||||
on static platforms by linking objects into the program at compile time,
|
||||
and creating data structures that represent the program's symbol table.
|
||||
|
||||
In order to use this feature, you must declare the objects you want your
|
||||
application to dlopen by using the @samp{-dlopen} or @samp{-dlpreopen}
|
||||
@ -2305,15 +2310,10 @@ generic pointer to the appropriate object, such as @code{&fprintf}.
|
||||
|
||||
@deftypevar {dld_symbol *} dld_preloaded_symbols
|
||||
An array of @var{dld_symbol} structures, representing all the preloaded
|
||||
symbols linked into the program. The last element has a @var{name} of
|
||||
@code{0}.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar int dld_preloaded_symbol_count
|
||||
The number of elements in @var{dld_preloaded_symbols}, if it is sorted
|
||||
in ascending order by @var{name}. Otherwise, @code{-1}, to indicate
|
||||
that the application needs to sort and count @var{dld_preloaded_symbols}
|
||||
itself, or search it linearly.
|
||||
symbols linked into the program. For each @samp{-dlpreloaded} file
|
||||
there is an element with the @var{name} of the file and a @var{address}
|
||||
of @code{0}, followed by all symbols exported from this file.
|
||||
The last element has a @var{name} and @var{address} of @code{0}.
|
||||
@end deftypevar
|
||||
|
||||
Some compilers may allow identifiers which are not valid in ANSI C, such
|
||||
@ -2327,8 +2327,9 @@ in @var{dld_preloaded_symbols}.
|
||||
@cindex names of dynamic modules
|
||||
@cindex dynamic modules, names
|
||||
|
||||
After a library has been linked with @samp{-export-dynamic}, it can be
|
||||
dlopened. Unfortunately, because of the variation in library names,
|
||||
After a library has been linked with @samp{-export-dynamic} or
|
||||
@samp{-export-symbols}, it can be dlopened.
|
||||
Unfortunately, because of the variation in library names,
|
||||
your package needs to determine the correct file to dlopen.
|
||||
|
||||
The most straightforward and flexible implementation is to determine the
|
||||
|
15
libtool.m4
vendored
15
libtool.m4
vendored
@ -21,11 +21,12 @@
|
||||
## configuration script generated by Autoconf, you may include it under
|
||||
## the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# serial 28 AM_PROG_LIBTOOL
|
||||
# serial 29 AM_PROG_LIBTOOL
|
||||
AC_DEFUN(AM_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AM_ENABLE_SHARED])dnl
|
||||
AC_REQUIRE([AM_ENABLE_STATIC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AM_PROG_LD])dnl
|
||||
@ -77,6 +78,11 @@ case "$host" in
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
fi
|
||||
;;
|
||||
|
||||
*-*-cygwin32*)
|
||||
AM_SYS_LIBTOOL_CYGWIN32
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# enable the --disable-libtool-lock switch
|
||||
@ -94,6 +100,7 @@ fi
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
|
||||
DLLTOOL="$DLLTOOL" AS="$AS" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
@ -276,3 +283,9 @@ NM="$ac_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
AC_SUBST(NM)
|
||||
])
|
||||
|
||||
# AM_SYS_LIBTOOL_CYGWIN32 - find tools needed on cygwin32
|
||||
AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN32,
|
||||
[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
])
|
||||
|
192
ltconfig.in
192
ltconfig.in
@ -118,6 +118,8 @@ verify_host=yes
|
||||
with_gcc=no
|
||||
with_gnu_ld=no
|
||||
need_locks=yes
|
||||
objext=o
|
||||
libext=a
|
||||
|
||||
old_AR="$AR"
|
||||
old_CC="$CC"
|
||||
@ -127,6 +129,8 @@ old_LD="$LD"
|
||||
old_LN_S="$LN_S"
|
||||
old_NM="$NM"
|
||||
old_RANLIB="$RANLIB"
|
||||
old_DLLTOOL="$DLLTOOL"
|
||||
old_AS="$AS"
|
||||
|
||||
# Parse the command line options.
|
||||
args=
|
||||
@ -393,6 +397,10 @@ if test -n "$RANLIB"; then
|
||||
old_postinstall_cmds="\$RANLIB \$oldlib;$old_postinstall_cmds"
|
||||
fi
|
||||
|
||||
# Set sane defaults for `DLLTOOL' and `AS', used on cygwin32.
|
||||
test -z "$DLLTOOL" && DLLTOOL=dlltool
|
||||
test -z "$AS" && AS=as
|
||||
|
||||
# Check to see if we are using GCC.
|
||||
if test "$with_gcc" != yes || test -z "$CC"; then
|
||||
# If CC is not set, then try to find GCC or a usable CC.
|
||||
@ -482,6 +490,28 @@ fi
|
||||
set dummy $CC
|
||||
compiler="$2"
|
||||
|
||||
echo $ac_n "checking for object suffix... $ac_c" 1>&6
|
||||
$rm conftest*
|
||||
echo 'int i = 1;' > conftest.c
|
||||
echo "$progname:@LINENO@: checking for object suffix" >& 5
|
||||
if { (eval echo $progname:@LINENO@: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
|
||||
# Append any warnings to the config.log.
|
||||
cat conftest.err 1>&5
|
||||
|
||||
for ac_file in conftest.*; do
|
||||
case $ac_file in
|
||||
*.c) ;;
|
||||
*) objext=`echo $ac_file | sed -e s/conftest.//` ;;
|
||||
esac
|
||||
done
|
||||
else
|
||||
cat conftest.err 1>&5
|
||||
echo "$progname: failed program was:" >&5
|
||||
cat conftest.c >&5
|
||||
fi
|
||||
$rm conftest*
|
||||
echo "$ac_t$objext" 1>&6
|
||||
|
||||
echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
|
||||
pic_flag=
|
||||
special_shlib_compile_flags=
|
||||
@ -498,7 +528,7 @@ if test "$with_gcc" = yes; then
|
||||
aix3* | aix4* | irix5* | irix6* | osf3* | osf4*)
|
||||
# PIC is the default for these OSes.
|
||||
;;
|
||||
os2*)
|
||||
cygwin32* | mingw32* | os2*)
|
||||
# We can build DLLs from non-PIC.
|
||||
;;
|
||||
amigaos*)
|
||||
@ -532,7 +562,7 @@ else
|
||||
# PIC (with -KPIC) is the default.
|
||||
;;
|
||||
|
||||
os2*)
|
||||
cygwin32* | mingw32* | os2*)
|
||||
# We can build DLLs from non-PIC.
|
||||
;;
|
||||
|
||||
@ -587,7 +617,7 @@ if test -n "$pic_flag"; then
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $pic_flag -DPIC"
|
||||
echo "$progname:@LINENO@: checking if $compiler PIC flag $pic_flag works" >&5
|
||||
if { (eval echo $progname:@LINENO@: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then
|
||||
if { (eval echo $progname:@LINENO@: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
|
||||
# Append any warnings to the config.log.
|
||||
cat conftest.err 1>&5
|
||||
|
||||
@ -848,6 +878,54 @@ if test "$with_gnu_ld" = yes; then
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
cygwin32* | mingw32*)
|
||||
if test "$with_gcc" = yes; then
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
allow_undefined_flag=unsupported
|
||||
# Very, very bogus.
|
||||
echo '
|
||||
#include <windows.h>
|
||||
|
||||
struct _reent *_impure_ptr;
|
||||
extern struct _reent *__imp_reent_data;
|
||||
BOOL APIENTRY
|
||||
__dll_entry (HINSTANCE hinst, DWORD reason, LPVOID reserved)
|
||||
{
|
||||
_impure_ptr = __imp_reent_data;
|
||||
}
|
||||
' > ltdll.c
|
||||
archive_cmds='$CC -c '"`pwd`"'/ltdll.c; echo EXPORTS > $lib.exp;
|
||||
if test -z "$export_symbols"; then $NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' > $lib.exp;\
|
||||
else cat "$export_symbols" > $lib.exp; fi;\
|
||||
$LD -s --base-file $soname-base --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs;\
|
||||
$DLLTOOL --as=$AS --dllname $soname --def $lib.exp --base-file $soname-base --output-exp $soname-exp;\
|
||||
$LD -s --base-file $soname-base $soname-exp --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs;\
|
||||
$DLLTOOL --as=$AS --dllname $soname --def $lib.exp --base-file $soname-base --output-exp $soname-exp;\
|
||||
$LD $soname-exp --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs;\
|
||||
$rm libtool.$objext $soname-base $soname-exp'
|
||||
old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $lib.exp --output-lib $objdir/$libname.a;$rm $lib.exp'
|
||||
else
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
with_gnu_ld=no
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec=' '
|
||||
allow_undefined_flag=unsupported
|
||||
# Tell ltmain to make .lib files, not .a files.
|
||||
libext=lib
|
||||
# FIXME: Setting linknames here is a bad hack.
|
||||
archive_cmds='$CC -o $lib$libobjs`echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll;linknames='
|
||||
# The linker will automatically build a .lib file if we build a DLL.
|
||||
old_archive_from_new_cmds='true'
|
||||
# FIXME: Should let the user specify the lib program.
|
||||
old_archive_cmds='lib /OUT:$oldlib$oldobjs'
|
||||
fix_srcfile_path='`cygpath -w $srcfile`'
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib$libobjs'
|
||||
@ -857,7 +935,7 @@ if test "$with_gnu_ld" = yes; then
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "$ld_shlibs" = yes; then
|
||||
if test "$ld_shlibs" = yes && test "$with_gnu_ld" = yes; then
|
||||
runpath_var=LD_RUN_PATH
|
||||
hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
|
||||
export_dynamic_flag_spec='${wl}--export-dynamic'
|
||||
@ -868,7 +946,8 @@ else
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
allow_undefined_flag=unsupported
|
||||
archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE;$AR cru $lib $objdir/$soname'
|
||||
archive_cmds='if test -z "$export_symbols"; then $NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' > $lib.exp;\
|
||||
else cat "$export_symbols" > $lib.exp; fi;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -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
|
||||
@ -881,7 +960,8 @@ else
|
||||
|
||||
aix4*)
|
||||
allow_undefined_flag=unsupported
|
||||
archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' > $lib.exp;$CC -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry;$AR cru $lib $objdir/$soname'
|
||||
archive_cmds='if test -z "$export_symbols"; then $NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' > $lib.exp;\
|
||||
else cat "$export_symbols" > $lib.exp; fi; $CC -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry;$AR cru $lib $objdir/$soname'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
@ -892,6 +972,53 @@ else
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
|
||||
cygwin32* | mingw32*)
|
||||
if test "$with_gcc" = yes; then
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
allow_undefined_flag=unsupported
|
||||
# Very, very bogus.
|
||||
echo '
|
||||
#include <windows.h>
|
||||
|
||||
struct _reent *_impure_ptr;
|
||||
extern struct _reent *__imp_reent_data;
|
||||
BOOL APIENTRY
|
||||
__dll_entry (HINSTANCE hinst, DWORD reason, LPVOID reserved)
|
||||
{
|
||||
_impure_ptr = __imp_reent_data;
|
||||
}
|
||||
' > ltdll.c
|
||||
archive_cmds='$CC -c '"`pwd`"'/ltdll.c; echo EXPORTS > $lib.exp;
|
||||
if test -z "$export_symbols"; then $NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' > $lib.exp;\
|
||||
else cat "$export_symbols" > $lib.exp; fi;\
|
||||
$LD -s --base-file $soname-base --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs;\
|
||||
$DLLTOOL --as=$AS --dllname $soname --def $lib.exp --base-file $soname-base --output-exp $soname-exp;\
|
||||
$LD -s --base-file $soname-base $soname-exp --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs;\
|
||||
$DLLTOOL --as=$AS --dllname $soname --def $lib.exp --base-file $soname-base --output-exp $soname-exp;\
|
||||
$LD $soname-exp --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs;\
|
||||
$rm libtool.$objext $soname-base $soname-exp'
|
||||
old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $lib.exp --output-lib $objdir/$libname.a;$rm $lib.exp'
|
||||
else
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec=' '
|
||||
allow_undefined_flag=unsupported
|
||||
# Tell ltmain to make .lib files, not .a files.
|
||||
libext=lib
|
||||
# FIXME: Setting linknames here is a bad hack.
|
||||
archive_cmds='$CC -o $lib$libobjs`echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll;linknames='
|
||||
# The linker will automatically build a .lib file if we build a DLL.
|
||||
old_archive_from_new_cmds='true'
|
||||
# FIXME: Should let the user specify the lib program.
|
||||
old_archive_cmds='lib /OUT:$oldlib$oldobjs'
|
||||
fix_srcfile_path='`cygpath -w $srcfile`'
|
||||
fi
|
||||
;;
|
||||
|
||||
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
|
||||
# support. Future versions do this automatically, but an explicit c++rt0.o
|
||||
# does not break anything, and helps significantly (at the cost of a little
|
||||
@ -1076,6 +1203,10 @@ case "$host_os" in
|
||||
aix*)
|
||||
symcode='[BCDTU]'
|
||||
;;
|
||||
cygwin32* | mingw32*)
|
||||
sympat='_\([_A-Za-z][_A-Za-z0-9]*\)'
|
||||
symxfrm='_\1 \1'
|
||||
;;
|
||||
irix*)
|
||||
# Cannot use undefined symbols on IRIX because inlined functions mess us up.
|
||||
symcode='[BCDEGRST]'
|
||||
@ -1090,6 +1221,14 @@ if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
|
||||
symcode='[ABCDGISTUW]'
|
||||
fi
|
||||
|
||||
case "$host_os" in
|
||||
cygwin32* | mingw32*)
|
||||
# We do not want undefined symbols on cygwin32. The user must
|
||||
# arrange to define them via -l arguments.
|
||||
symcode='[ABCDGISTW]'
|
||||
;;
|
||||
esac
|
||||
|
||||
# Write the raw and C identifiers.
|
||||
global_symbol_pipe="sed -n -e 's/^.* $symcode $sympat$/$symxfrm/p'"
|
||||
|
||||
@ -1109,10 +1248,10 @@ main(){nm_test_var='a';nm_test_func();return(0);}
|
||||
EOF
|
||||
|
||||
echo "$progname:@LINENO@: checking if global_symbol_pipe works" >&5
|
||||
if { (eval echo $progname:@LINENO@: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then
|
||||
if { (eval echo $progname:@LINENO@: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then
|
||||
# Now try to grab the symbols.
|
||||
nlist=conftest.nm
|
||||
if { echo "$progname:@LINENO@: eval \"$NM conftest.o | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.o | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
|
||||
if { echo "$progname:@LINENO@: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
|
||||
|
||||
# Try sorting and uniquifying the output.
|
||||
if sort "$nlist" | uniq > "$nlist"T; then
|
||||
@ -1165,10 +1304,10 @@ EOF
|
||||
#endif
|
||||
EOF
|
||||
# Now try linking the two files.
|
||||
mv conftest.o conftestm.o
|
||||
mv conftest.$objext conftestm.$objext
|
||||
save_LIBS="$LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
LIBS='conftestm.o'
|
||||
LIBS="conftestm.$objext"
|
||||
CFLAGS="$CFLAGS$no_builtin_flag"
|
||||
if { (eval echo $progname:@LINENO@: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
pipe_works=yes
|
||||
@ -1258,6 +1397,18 @@ amigaos*)
|
||||
finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
|
||||
;;
|
||||
|
||||
cygwin32* | mingw32*)
|
||||
version_type=windows
|
||||
if test "$with_gcc" = yes; then
|
||||
library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a'
|
||||
else
|
||||
library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
|
||||
fi
|
||||
dynamic_linker='Win32 ld.exe'
|
||||
libname_spec='$name'
|
||||
shlibpath_var=PATH
|
||||
;;
|
||||
|
||||
freebsd2* | freebsd3*)
|
||||
version_type=sunos
|
||||
library_names_spec='${libname}${release}.so$versuffix $libname.so'
|
||||
@ -1433,7 +1584,8 @@ case "$ltmain" in
|
||||
*.sh)
|
||||
# Now quote all the things that may contain metacharacters.
|
||||
for var in ltecho old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \
|
||||
old_LN_S AR CC LD LN_S NM LTSHELL VERSION reload_flag reload_cmds wl \
|
||||
old_LN_S old_DLLTOOL old_AS AR CC LD LN_S NM LTSHELL VERSION \
|
||||
reload_flag reload_cmds wl \
|
||||
pic_flag link_static_flag no_builtin_flag export_dynamic_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 \
|
||||
@ -1503,7 +1655,7 @@ EOF
|
||||
*)
|
||||
# Double-quote the variables that need it (for aesthetics).
|
||||
for var in old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \
|
||||
old_LN_S; do
|
||||
old_LN_S old_DLLTOOL old_AS; do
|
||||
eval "$var=\\\"\$var\\\""
|
||||
done
|
||||
|
||||
@ -1524,6 +1676,7 @@ cat <<EOF >> "$cfgfile"
|
||||
#
|
||||
# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\
|
||||
# LD=$old_LD NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\
|
||||
# DLLTOOL="$old_DLLTOOL" AS="$old_AS" \\
|
||||
# $0$ltconfig_args
|
||||
#
|
||||
# Compiler and other test output produced by $progname, useful for
|
||||
@ -1563,6 +1716,12 @@ LN_S=$LN_S
|
||||
# A BSD-compatible nm program.
|
||||
NM=$NM
|
||||
|
||||
# Used on cygwin32: DLL creation program.
|
||||
DLLTOOL="$DLLTOOL"
|
||||
|
||||
# Used on cygwin32: assembler.
|
||||
AS="$AS"
|
||||
|
||||
# The name of the directory that contains temporary libtool files.
|
||||
objdir=$objdir
|
||||
|
||||
@ -1573,6 +1732,12 @@ reload_cmds=$reload_cmds
|
||||
# How to pass a linker flag through the compiler.
|
||||
wl=$wl
|
||||
|
||||
# Object file suffix (normally "o").
|
||||
objext="$objext"
|
||||
|
||||
# Old archive suffix (normally "a").
|
||||
libext="$libext"
|
||||
|
||||
# Additional compiler flags for building library objects.
|
||||
pic_flag=$pic_flag
|
||||
|
||||
@ -1666,6 +1831,9 @@ hardcode_minus_L=$hardcode_minus_L
|
||||
# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
|
||||
# the resulting binary.
|
||||
hardcode_shlibpath_var=$hardcode_shlibpath_var
|
||||
|
||||
# Fix the shell variable \$srcfile for the compiler.
|
||||
fix_srcfile_path="$fix_srcfile_path"
|
||||
EOF
|
||||
|
||||
case "$ltmain" in
|
||||
|
238
ltmain.in
238
ltmain.in
@ -89,6 +89,8 @@ run=
|
||||
show="$echo"
|
||||
show_help=
|
||||
execute_dlfiles=
|
||||
lo2o="s/\\.lo\$/.${objext}/"
|
||||
los2o="s/\\.lo /.${objext} /g"
|
||||
|
||||
# Parse our command line options once, thoroughly.
|
||||
while test $# -gt 0
|
||||
@ -347,7 +349,7 @@ if test -z "$show_help"; then
|
||||
libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
|
||||
|
||||
case "$libobj" in
|
||||
*.lo) obj=`$echo "X$libobj" | $Xsed -e 's/\.lo$/.o/'` ;;
|
||||
*.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
|
||||
*)
|
||||
$echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
|
||||
exit 1
|
||||
@ -373,7 +375,7 @@ if test -z "$show_help"; then
|
||||
# Calculate the filename of the output object if compiler does
|
||||
# not support -o with -c
|
||||
if test "$compiler_c_o" = no; then
|
||||
output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.o
|
||||
output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
|
||||
lockfile="$output_obj.lock"
|
||||
removelist="$removelist $output_obj $lockfile"
|
||||
trap "$run $rm $removelist; exit 1" 1 2 15
|
||||
@ -408,6 +410,10 @@ compiler."
|
||||
echo $srcfile > "$lockfile"
|
||||
fi
|
||||
|
||||
if test -n "$fix_srcfile_path"; then
|
||||
eval srcfile=\"$fix_srcfile_path\"
|
||||
fi
|
||||
|
||||
# Only build a PIC object if we are building libtool libraries.
|
||||
if test "$build_libtool_libs" = yes; then
|
||||
# Without this assignment, base_compile gets emptied.
|
||||
@ -557,6 +563,7 @@ compiler."
|
||||
dlfiles=
|
||||
dlprefiles=
|
||||
export_dynamic=no
|
||||
export_symbols=
|
||||
generated=
|
||||
hardcode_libdirs=
|
||||
libobjs=
|
||||
@ -614,6 +621,23 @@ compiler."
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
exportsyms)
|
||||
export_symbols="$arg"
|
||||
if test ! -f "$arg"; then
|
||||
$echo "$modename: symbol file \`$arg' does not exist"
|
||||
exit 1
|
||||
fi
|
||||
if test -n "$export_dynamic_flag_spec"; then
|
||||
eval arg=\"$export_dynamic_flag_spec\"
|
||||
else
|
||||
arg=
|
||||
fi
|
||||
|
||||
# Add the symbol object into the linking commands.
|
||||
compile_command="$compile_command @SYMFILE@"
|
||||
finalize_command="$finalize_command @SYMFILE@"
|
||||
prev=
|
||||
;;
|
||||
release)
|
||||
release="-$arg"
|
||||
prev=
|
||||
@ -674,6 +698,19 @@ compiler."
|
||||
fi
|
||||
;;
|
||||
|
||||
-export-symbols)
|
||||
if test "$export_dynamic" != no; then
|
||||
$echo "$modename: cannot have both -export-dynamic and -export-symbols"
|
||||
exit 1
|
||||
fi
|
||||
if test -n "$export_symbols"; then
|
||||
$echo "$modename: cannot have more than one -exported-symbols"
|
||||
exit 1
|
||||
fi
|
||||
prev=exportsyms
|
||||
continue
|
||||
;;
|
||||
|
||||
-L*)
|
||||
dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
|
||||
case "$dir" in
|
||||
@ -733,7 +770,7 @@ compiler."
|
||||
esac
|
||||
;;
|
||||
|
||||
*.o | *.a)
|
||||
*.o | *.obj | *.a | *.lib)
|
||||
# A standard object.
|
||||
objs="$objs $arg"
|
||||
;;
|
||||
@ -753,7 +790,7 @@ compiler."
|
||||
|
||||
if test "$prev" = dlprefiles; then
|
||||
# Preload the old-style object.
|
||||
dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e 's/\.lo$/.o/'`
|
||||
dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
|
||||
prev=
|
||||
fi
|
||||
libobjs="$libobjs $arg"
|
||||
@ -1013,7 +1050,7 @@ compiler."
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*.a)
|
||||
*.a | *.lib)
|
||||
if test -n "$link_against_libtool_libs"; then
|
||||
$echo "$modename: error: cannot link libtool libraries into archives" 1>&2
|
||||
exit 1
|
||||
@ -1189,6 +1226,13 @@ compiler."
|
||||
versuffix=".$current.$revision"
|
||||
;;
|
||||
|
||||
windows)
|
||||
# Like Linux, but with '-' rather than '.', since we only
|
||||
# want one extension on Windows 95.
|
||||
major=`expr $current - $age`
|
||||
versuffix="-$major-$age-$revision"
|
||||
;;
|
||||
|
||||
*)
|
||||
$echo "$modename: unknown library version type \`$version_type'" 1>&2
|
||||
echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
|
||||
@ -1240,10 +1284,10 @@ compiler."
|
||||
|
||||
# Now set the variables for building old libraries.
|
||||
if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
|
||||
oldlibs="$oldlibs $output_objdir/$libname.a"
|
||||
oldlibs="$oldlibs $output_objdir/$libname.$libext"
|
||||
|
||||
# Transform .lo files to .o files.
|
||||
oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
|
||||
oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.'${libext}' //g' -e "$los2o" -e 's/ $//g'`
|
||||
fi
|
||||
|
||||
if test "$build_libtool_libs" = yes; then
|
||||
@ -1266,7 +1310,7 @@ compiler."
|
||||
done
|
||||
|
||||
# Use standard objects if they are PIC.
|
||||
test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//g'`
|
||||
test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e "$los2o" -e 's/ $//g'`
|
||||
|
||||
if test -n "$whole_archive_flag_spec"; then
|
||||
if test -n "$convenience"; then
|
||||
@ -1312,15 +1356,15 @@ compiler."
|
||||
fi
|
||||
done
|
||||
|
||||
# If -export-dynamic was specified, set the dlname.
|
||||
if test "$export_dynamic" = yes; then
|
||||
# If -export-dynamic/symbols was specified, set the dlname.
|
||||
if test "$export_dynamic" = yes || test -n "$export_symbols"; then
|
||||
# On all known operating systems, these are identical.
|
||||
dlname="$soname"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
*.lo | *.o)
|
||||
*.lo | *.o | *.obj)
|
||||
if test -n "$link_against_libtool_libs"; then
|
||||
$echo "$modename: error: cannot link libtool libraries into objects" 1>&2
|
||||
exit 1
|
||||
@ -1353,7 +1397,7 @@ compiler."
|
||||
exit 1
|
||||
fi
|
||||
libobj="$output"
|
||||
obj=`$echo "X$output" | $Xsed -e 's/\.lo$/.o/'`
|
||||
obj=`$echo "X$output" | $Xsed -e "$lo2o"`
|
||||
;;
|
||||
*)
|
||||
libobj=
|
||||
@ -1365,7 +1409,7 @@ compiler."
|
||||
$run $rm $obj $libobj
|
||||
|
||||
# Create the old-style object.
|
||||
reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
|
||||
reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.'${libext}' //g' -e 's/[^ ]*\.lib //g' -e "$los2o" -e 's/ $//g'`
|
||||
|
||||
output="$obj"
|
||||
eval cmds=\"$reload_cmds\"
|
||||
@ -1471,61 +1515,45 @@ compiler."
|
||||
|
||||
if test -n "$libobjs" && test "$build_old_libs" = yes; then
|
||||
# Transform all the library objects into standard objects.
|
||||
compile_command=`$echo "X$compile_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
|
||||
finalize_command=`$echo "X$finalize_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
|
||||
compile_command=`$echo "X$compile_command " | $Xsed -e "$los2o" -e 's/ $//'`
|
||||
finalize_command=`$echo "X$finalize_command " | $Xsed -e "$los2o" -e 's/ $//'`
|
||||
fi
|
||||
|
||||
if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
|
||||
if { test "$export_dynamic" = yes || test "$export_dynamic" = yes; } &&
|
||||
test -n "$NM" && test -n "$global_symbol_pipe"; then
|
||||
dlsyms="${outputname}S.c"
|
||||
else
|
||||
dlsyms=
|
||||
fi
|
||||
|
||||
if test -n "$dlsyms"; then
|
||||
# Add our own program objects to the preloaded list.
|
||||
dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
|
||||
case "$dlsyms" in
|
||||
"") ;;
|
||||
*.c)
|
||||
if test -z "$export_symbols"; then
|
||||
# Add our own program objects to the preloaded list.
|
||||
dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e "$los2o" -e 's/ $//'`
|
||||
fi
|
||||
|
||||
# Discover the nlist of each of the dlfiles.
|
||||
nlist="${output_objdir}/${output}.nm"
|
||||
# Discover the nlist of each of the dlfiles.
|
||||
nlist="$objdir/${output}.nm"
|
||||
|
||||
if test -d $output_objdir; then
|
||||
$show "$rm $nlist ${nlist}T"
|
||||
$run $rm "$nlist" "${nlist}T"
|
||||
else
|
||||
$show "$mkdir $output_objdir"
|
||||
$run $mkdir $output_objdir
|
||||
status=$?
|
||||
if test $status -ne 0 && test ! -d $output_objdir; then
|
||||
exit $status
|
||||
fi
|
||||
fi
|
||||
|
||||
for arg in $dlprefiles; do
|
||||
$show "extracting global C symbols from \`$arg'"
|
||||
$run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
|
||||
done
|
||||
|
||||
# Parse the name list into a source file.
|
||||
$show "creating $output_objdir/$dlsyms"
|
||||
if test -z "$run"; then
|
||||
# Make sure we at least have an empty file.
|
||||
test -f "$nlist" || : > "$nlist"
|
||||
|
||||
# Try sorting and uniquifying the output.
|
||||
if sort "$nlist" | uniq > "$nlist"T; then
|
||||
mv -f "$nlist"T "$nlist"
|
||||
wcout=`wc "$nlist" 2>/dev/null`
|
||||
count=`echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
|
||||
(test "$count" -ge 0) 2>/dev/null || count=-1
|
||||
if test -d $objdir; then
|
||||
$show "$rm $nlist ${nlist}T"
|
||||
$run $rm "$nlist" "${nlist}T"
|
||||
else
|
||||
$rm "$nlist"T
|
||||
count=-1
|
||||
$show "$mkdir $objdir"
|
||||
$run $mkdir $objdir
|
||||
status=$?
|
||||
if test $status -ne 0 && test ! -d $objdir; then
|
||||
exit $status
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$dlsyms" in
|
||||
"") ;;
|
||||
*.c)
|
||||
$echo > "$output_objdir/$dlsyms" "\
|
||||
# Parse the name list into a source file.
|
||||
$show "creating $objdir/$dlsyms"
|
||||
|
||||
$echo > "$objdir/$dlsyms" "\
|
||||
/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
|
||||
/* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
|
||||
|
||||
@ -1534,21 +1562,39 @@ extern \"C\" {
|
||||
#endif
|
||||
|
||||
/* Prevent the only kind of declaration conflicts we can make. */
|
||||
#define dld_preloaded_symbol_count some_other_symbol
|
||||
#define dld_preloaded_symbols some_other_symbol
|
||||
|
||||
/* External symbol declarations for the compiler. */\
|
||||
"
|
||||
|
||||
if test -n "$export_symbols"; then
|
||||
sed -e 's/^\(.*\)/\1 \1/' < "$export_symbols" > "$nlist"
|
||||
fi
|
||||
|
||||
for arg in $dlprefiles; do
|
||||
$show "extracting global C symbols from \`$arg'"
|
||||
$run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
|
||||
done
|
||||
|
||||
if test -z "$run"; then
|
||||
# Make sure we at least have an empty file.
|
||||
test -f "$nlist" || : > "$nlist"
|
||||
|
||||
# Try sorting and uniquifying the output.
|
||||
if sort "$nlist" | uniq > "$nlist"T; then
|
||||
mv -f "$nlist"T "$nlist"
|
||||
else
|
||||
$rm "$nlist"T
|
||||
fi
|
||||
|
||||
if test -f "$nlist"; then
|
||||
sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$output_objdir/$dlsyms"
|
||||
else
|
||||
else
|
||||
echo '/* NONE */' >> "$output_objdir/$dlsyms"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
$echo >> "$output_objdir/$dlsyms" "\
|
||||
|
||||
#undef dld_preloaded_symbol_count
|
||||
#undef dld_preloaded_symbols
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
@ -1557,9 +1603,6 @@ extern \"C\" {
|
||||
# define __ptr_t char *
|
||||
#endif
|
||||
|
||||
/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
|
||||
int dld_preloaded_symbol_count = $count;
|
||||
|
||||
/* The mapping between symbol names and symbols. */
|
||||
struct {
|
||||
char *name;
|
||||
@ -1569,6 +1612,25 @@ dld_preloaded_symbols[] =
|
||||
{\
|
||||
"
|
||||
|
||||
if test -n "$export_symbols"; then
|
||||
echo >> "$objdir/$dlsyms" "\
|
||||
{\"${output}\", (__ptr_t) 0},"
|
||||
sed 's/^\(.*\)/ {"\1", (__ptr_t) \&\1},/' < "$export_symbols" >> "$objdir/$dlsyms"
|
||||
fi
|
||||
|
||||
for arg in $dlprefiles; do
|
||||
echo >> "$objdir/$dlsyms" "\
|
||||
{\"$arg\", (__ptr_t) 0},"
|
||||
eval "$NM $arg | $global_symbol_pipe > '$nlist'"
|
||||
|
||||
if test -f "$nlist"; then
|
||||
sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
|
||||
else
|
||||
echo '/* NONE */' >> "$output_objdir/$dlsyms"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
if test -f "$nlist"; then
|
||||
sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$output_objdir/$dlsyms"
|
||||
fi
|
||||
@ -1581,23 +1643,22 @@ dld_preloaded_symbols[] =
|
||||
}
|
||||
#endif\
|
||||
"
|
||||
;;
|
||||
fi
|
||||
|
||||
*)
|
||||
$echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# Now compile the dynamic symbol file.
|
||||
$show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
|
||||
$run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
|
||||
|
||||
# Now compile the dynamic symbol file.
|
||||
$show "(cd $output_objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
|
||||
$run eval '(cd $output_objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
|
||||
|
||||
# Transform the symbol file into the correct name.
|
||||
compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${output}S.o%"`
|
||||
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${output}S.o%"`
|
||||
elif test "$export_dynamic" != yes; then
|
||||
# Transform the symbol file into the correct name.
|
||||
compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
|
||||
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
|
||||
;;
|
||||
*)
|
||||
$echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
elif test "$export_dynamic" != yes && test -z "$export_symbols"; then
|
||||
test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
|
||||
else
|
||||
# We keep going just in case the user didn't refer to
|
||||
@ -1821,6 +1882,7 @@ fi\
|
||||
addlibs="$convenience"
|
||||
build_libtool_libs=no
|
||||
else
|
||||
oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.'${libext}' //g' -e 's/[^ ]*\.lib //g' -e "$los2o" -e 's/ $//g'`
|
||||
addlibs="$old_convenience"
|
||||
fi
|
||||
|
||||
@ -1869,7 +1931,7 @@ fi\
|
||||
case "$output" in
|
||||
*.la)
|
||||
old_library=
|
||||
test "$build_old_libs" = yes && old_library="$libname.a"
|
||||
test "$build_old_libs" = yes && old_library="$libname.$libext"
|
||||
$show "creating $output"
|
||||
|
||||
# Only create the output if not a dry run.
|
||||
@ -2060,7 +2122,7 @@ libdir='$install_libdir'\
|
||||
|
||||
# Do each installation.
|
||||
case "$file" in
|
||||
*.a)
|
||||
*.a | *.lib)
|
||||
# Do the static libraries later.
|
||||
staticlibs="$staticlibs $file"
|
||||
;;
|
||||
@ -2165,9 +2227,9 @@ libdir='$install_libdir'\
|
||||
# Deduce the name of the destination old-style object file.
|
||||
case "$destfile" in
|
||||
*.lo)
|
||||
staticdest=`$echo "X$destfile" | $Xsed -e 's/\.lo$/.o/'`
|
||||
staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
|
||||
;;
|
||||
*.o)
|
||||
*.o | *.obj)
|
||||
staticdest="$destfile"
|
||||
destfile=
|
||||
;;
|
||||
@ -2187,7 +2249,7 @@ libdir='$install_libdir'\
|
||||
# Install the old object if enabled.
|
||||
if test "$build_old_libs" = yes; then
|
||||
# Deduce the name of the old-style object file.
|
||||
staticobj=`$echo "X$file" | $Xsed -e 's/\.lo$/.o/'`
|
||||
staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
|
||||
|
||||
$show "$install_prog $staticobj $staticdest"
|
||||
$run eval "$install_prog \$staticobj \$staticdest" || exit $?
|
||||
@ -2584,7 +2646,7 @@ libdir='$install_libdir'\
|
||||
|
||||
*.lo)
|
||||
if test "$build_old_libs" = yes; then
|
||||
oldobj=`$echo "X$name" | $Xsed -e 's/\.lo$/.o/'`
|
||||
oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
|
||||
rmfiles="$rmfiles $dir/$oldobj"
|
||||
fi
|
||||
$show "$rm $rmfiles"
|
||||
@ -2742,11 +2804,11 @@ object files.
|
||||
If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
|
||||
library objects (\`.lo' files) may be specified, and \`-rpath' is required.
|
||||
|
||||
If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
|
||||
and \`ranlib'.
|
||||
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
|
||||
using \`ar' and \`ranlib', or on Windows using \`lib'.
|
||||
|
||||
If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
|
||||
created, otherwise an executable program is created."
|
||||
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
|
||||
is created, otherwise an executable program is created."
|
||||
;;
|
||||
|
||||
uninstall)
|
||||
|
13
mdemo/.cvsignore
Normal file
13
mdemo/.cvsignore
Normal file
@ -0,0 +1,13 @@
|
||||
.deps
|
||||
.libs
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
configure
|
||||
config.*
|
||||
conftest*
|
||||
libtool
|
||||
*.lo
|
||||
*.la
|
||||
hell
|
||||
hell.debug
|
29
mdemo/Makefile.am
Normal file
29
mdemo/Makefile.am
Normal file
@ -0,0 +1,29 @@
|
||||
# A brief demonstration of using Automake with Libtool. -*-Makefile-*-
|
||||
#
|
||||
# NOTE: Don't forget that in the libtool distribution, files in this
|
||||
# directory are distributed by the demo_distfiles variable in the top
|
||||
# level Makefile.
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
EXTRA_DIST = acinclude.m4
|
||||
|
||||
lib_LTLIBRARIES = libfoo1.la libfoo2.la
|
||||
libfoo1_la_SOURCES = foo1.c foolib1.h
|
||||
libfoo1_la_LDFLAGS = -export-symbols $(srcdir)/libfoo1.sym -lm
|
||||
|
||||
libfoo2_la_SOURCES = foo2.c foolib2.h
|
||||
libfoo2_la_LDFLAGS = -export-symbols $(srcdir)/libfoo2.sym -lm
|
||||
|
||||
include_HEADERS = foo.h
|
||||
|
||||
bin_PROGRAMS = hell hell.debug
|
||||
|
||||
# Create a version of hell that does dlopen.
|
||||
hell_SOURCES = main.c ltdl.c
|
||||
hell_LDFLAGS = $(LIBADD_DL)
|
||||
hell_DEPENDENCIES = libfoo1.la libfoo2.la
|
||||
|
||||
# Create an easier-to-debug version of hell.
|
||||
hell_debug_SOURCES = main.c ltdls.c
|
||||
hell_debug_LDADD = libfoo1.la libfoo2.la
|
||||
hell_debug_LDFLAGS = -export-dynamic -dlpreopen libfoo1.la -dlpreopen libfoo2.la -static
|
10
mdemo/README
Normal file
10
mdemo/README
Normal file
@ -0,0 +1,10 @@
|
||||
This is GNU modular hell, an example package that uses GNU libtool with an
|
||||
Automake-generated environment to build two simple libraries and programs.
|
||||
|
||||
It demonstrates how to build both dynamic and static libraries
|
||||
that can be dlopened. You need a wrapper (ltdl.c and ltdls.c)
|
||||
for your dlopen functions. For static libraries we prefix all
|
||||
non-static symbols with libname___ using the LTEXP(symbol) macro.
|
||||
When dlopening these static libraries, we cut the prefix off to
|
||||
get the real name.
|
||||
|
23
mdemo/configure.in
Normal file
23
mdemo/configure.in
Normal file
@ -0,0 +1,23 @@
|
||||
dnl Initialize the hell package.
|
||||
AC_INIT(main.c)
|
||||
AM_INIT_AUTOMAKE(module,1.0)
|
||||
|
||||
AC_PROG_CC
|
||||
AC_EXEEXT
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
AC_CHECK_HEADERS(string.h dlfcn.h dl.h)
|
||||
AC_CHECK_FUNCS(strdup)
|
||||
|
||||
LIBADD_DL=
|
||||
AC_CHECK_FUNCS(dlopen,,
|
||||
[AC_CHECK_LIB(dl, dlopen, LIBADD_DL="-ldl",
|
||||
[AC_CHECK_LIB(dld, shl_load, LIBADD_DL="-ldld",
|
||||
[AC_CHECK_FUNCS(dlopen, LIBADD_DL="")]
|
||||
)]
|
||||
)]
|
||||
)
|
||||
AC_SUBST(LIBADD_DL)
|
||||
|
||||
dnl Output the makefile
|
||||
AC_OUTPUT(Makefile)
|
60
mdemo/foo.h
Normal file
60
mdemo/foo.h
Normal file
@ -0,0 +1,60 @@
|
||||
/* foo.h -- interface to the libfoo* libraries
|
||||
Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
|
||||
This file is part of GNU Libtool.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA. */
|
||||
|
||||
/* Only include this header file once. */
|
||||
#ifndef _FOO_H_
|
||||
#define _FOO_H_ 1
|
||||
|
||||
/* __BEGIN_DECLS should be used at the beginning of your declarations,
|
||||
so that C++ compilers don't mangle their names. Use __END_DECLS at
|
||||
the end of C declarations. */
|
||||
#undef __BEGIN_DECLS
|
||||
#undef __END_DECLS
|
||||
#ifdef __cplusplus
|
||||
# define __BEGIN_DECLS extern "C" {
|
||||
# define __END_DECLS }
|
||||
#else
|
||||
# define __BEGIN_DECLS /* empty */
|
||||
# define __END_DECLS /* empty */
|
||||
#endif
|
||||
|
||||
/* __P is a macro used to wrap function prototypes, so that compilers
|
||||
that don't understand ANSI C prototypes still work, and ANSI C
|
||||
compilers can issue warnings about type mismatches. */
|
||||
#undef __P
|
||||
#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32) || defined(__cplusplus)
|
||||
# define __P(protos) protos
|
||||
#else
|
||||
# define __P(protos) ()
|
||||
#endif
|
||||
|
||||
/* Silly constants that the functions return. */
|
||||
#define HELLO_RET 0xe110
|
||||
#define FOO_RET 0xf00
|
||||
|
||||
#ifndef PIC
|
||||
#define glue(a,b) a ## b
|
||||
#define symglue(a,b) glue(a,b)
|
||||
#define LTPREFIX(name) ___ ## name
|
||||
#define LTEXP(name) symglue(DLNAME,LTPREFIX(name))
|
||||
#else
|
||||
#define LTEXP(name) name
|
||||
#endif
|
||||
|
||||
#endif /* !_FOO_H_ */
|
41
mdemo/foo1.c
Normal file
41
mdemo/foo1.c
Normal file
@ -0,0 +1,41 @@
|
||||
/* foo1.c -- trivial test library
|
||||
Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
|
||||
This file is part of GNU Libtool.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA. */
|
||||
|
||||
#define DLNAME foo1
|
||||
|
||||
#include "foo.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
/* Give a global variable definition. */
|
||||
int LTEXP(nothing);
|
||||
|
||||
int
|
||||
LTEXP(foo1)()
|
||||
{
|
||||
printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
|
||||
return FOO_RET;
|
||||
}
|
||||
|
||||
int
|
||||
LTEXP(hello) ()
|
||||
{
|
||||
printf ("** This is foolib 1 **\n");
|
||||
return HELLO_RET;
|
||||
}
|
41
mdemo/foo2.c
Normal file
41
mdemo/foo2.c
Normal file
@ -0,0 +1,41 @@
|
||||
/* foo2.c -- trivial test library
|
||||
Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
|
||||
This file is part of GNU Libtool.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA. */
|
||||
|
||||
#define DLNAME foo2
|
||||
|
||||
#include "foo.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
/* Give a global variable definition. */
|
||||
int LTEXP(nothing);
|
||||
|
||||
int
|
||||
LTEXP(foo2)()
|
||||
{
|
||||
printf ("sin (0.0) = %g\n", (double) sin ((double) 0.0));
|
||||
return FOO_RET;
|
||||
}
|
||||
|
||||
int
|
||||
LTEXP(hello) ()
|
||||
{
|
||||
printf ("** This is foolib 2 **\n");
|
||||
return HELLO_RET;
|
||||
}
|
3
mdemo/libfoo1.sym
Normal file
3
mdemo/libfoo1.sym
Normal file
@ -0,0 +1,3 @@
|
||||
nothing
|
||||
hello
|
||||
foo1
|
3
mdemo/libfoo2.sym
Normal file
3
mdemo/libfoo2.sym
Normal file
@ -0,0 +1,3 @@
|
||||
nothing
|
||||
hello
|
||||
foo2
|
43
mdemo/ltdl.c
Normal file
43
mdemo/ltdl.c
Normal file
@ -0,0 +1,43 @@
|
||||
/* ltdl.c -- dlopen functions
|
||||
Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
|
||||
This file is part of GNU Libtool.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA. */
|
||||
|
||||
#include "ltdl.h"
|
||||
|
||||
#ifdef HAVE_DLFCN_H
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DL_H
|
||||
#include <dl.h>
|
||||
#endif
|
||||
|
||||
lt_dlhandle lt_dlopen(char *name)
|
||||
{
|
||||
return dlopen(name, RTLD_LAZY);
|
||||
}
|
||||
|
||||
void lt_dlclose(lt_dlhandle handle)
|
||||
{
|
||||
dlclose(handle);
|
||||
}
|
||||
|
||||
void *lt_dlsym(lt_dlhandle handle, char *name)
|
||||
{
|
||||
return dlsym(handle, name);
|
||||
}
|
55
mdemo/ltdl.h
Normal file
55
mdemo/ltdl.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* ltdl.h -- generic dlopen functions
|
||||
Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
|
||||
This file is part of GNU Libtool.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA. */
|
||||
|
||||
/* Only include this header file once. */
|
||||
#ifndef _DL_H_
|
||||
#define _DL_H_ 1
|
||||
|
||||
/* __BEGIN_DECLS should be used at the beginning of your declarations,
|
||||
so that C++ compilers don't mangle their names. Use __END_DECLS at
|
||||
the end of C declarations. */
|
||||
#undef __BEGIN_DECLS
|
||||
#undef __END_DECLS
|
||||
#ifdef __cplusplus
|
||||
# define __BEGIN_DECLS extern "C" {
|
||||
# define __END_DECLS }
|
||||
#else
|
||||
# define __BEGIN_DECLS /* empty */
|
||||
# define __END_DECLS /* empty */
|
||||
#endif
|
||||
|
||||
/* __P is a macro used to wrap function prototypes, so that compilers
|
||||
that don't understand ANSI C prototypes still work, and ANSI C
|
||||
compilers can issue warnings about type mismatches. */
|
||||
#undef __P
|
||||
#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32) || defined(__cplusplus)
|
||||
# define __P(protos) protos
|
||||
#else
|
||||
# define __P(protos) ()
|
||||
#endif
|
||||
|
||||
typedef void *lt_dlhandle;
|
||||
|
||||
__BEGIN_DECLS
|
||||
lt_dlhandle lt_dlopen __P((char *name));
|
||||
void lt_dlclose __P((lt_dlhandle handle));
|
||||
void *lt_dlsym __P((lt_dlhandle handle, char *name));
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_DLL_H_ */
|
76
mdemo/ltdls.c
Normal file
76
mdemo/ltdls.c
Normal file
@ -0,0 +1,76 @@
|
||||
/* ltdls.c -- static dlopen functions
|
||||
Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
|
||||
This file is part of GNU Libtool.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA. */
|
||||
|
||||
#include "ltdl.h"
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
struct dld_symlist
|
||||
{
|
||||
char *name;
|
||||
void *address;
|
||||
};
|
||||
|
||||
extern struct dld_symlist dld_preloaded_symbols[];
|
||||
|
||||
lt_dlhandle lt_dlopen(char *name)
|
||||
{
|
||||
struct dld_symlist *s;
|
||||
|
||||
s = dld_preloaded_symbols;
|
||||
while (s->name) {
|
||||
if (!s->address && !strcmp(s->name, name))
|
||||
break;
|
||||
s++;
|
||||
}
|
||||
if (!s->name)
|
||||
return NULL;
|
||||
return strdup(name);
|
||||
}
|
||||
|
||||
void lt_dlclose(lt_dlhandle handle)
|
||||
{
|
||||
free(handle);
|
||||
}
|
||||
|
||||
void *lt_dlsym(lt_dlhandle handle, char *name)
|
||||
{
|
||||
struct dld_symlist *s;
|
||||
char *p;
|
||||
|
||||
s = dld_preloaded_symbols;
|
||||
while (s->name) {
|
||||
if (!s->address && !strcmp(s->name, handle))
|
||||
break;
|
||||
s++;
|
||||
}
|
||||
if (!s->name)
|
||||
return NULL;
|
||||
s++;
|
||||
while (s->address) {
|
||||
p = strstr(s->name, "___");
|
||||
if (p && !strcmp(&p[3], name))
|
||||
return s->address;
|
||||
s++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
92
mdemo/main.c
Normal file
92
mdemo/main.c
Normal file
@ -0,0 +1,92 @@
|
||||
/* main.c -- hello test program
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
This file is part of GNU Libtool.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA. */
|
||||
|
||||
#include "foo.h"
|
||||
#include "ltdl.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void testlib(char *lib, char *alt)
|
||||
{
|
||||
lt_dlhandle handle;
|
||||
int (*pfoo1)() = 0;
|
||||
int (*pfoo2)() = 0;
|
||||
int (*phello)() = 0;
|
||||
int *pnothing = 0;
|
||||
|
||||
handle = lt_dlopen(lib);
|
||||
if (!handle)
|
||||
handle = lt_dlopen(alt);
|
||||
if (!handle) {
|
||||
fprintf (stderr, "can't open library %s!\n", lib);
|
||||
return;
|
||||
}
|
||||
phello = lt_dlsym(handle, "hello");
|
||||
pfoo1 = lt_dlsym(handle, "foo1");
|
||||
pfoo2 = lt_dlsym(handle, "foo2");
|
||||
pnothing = lt_dlsym(handle, "nothing");
|
||||
|
||||
if (phello)
|
||||
{
|
||||
int value = (*phello) ();
|
||||
|
||||
printf ("hello returned: %i\n", value);
|
||||
if (value == HELLO_RET)
|
||||
printf("hello is ok!\n");
|
||||
}
|
||||
else
|
||||
fprintf (stderr, "did not find the `hello' function\n");
|
||||
|
||||
/* Try assigning to the nothing variable. */
|
||||
if (pnothing)
|
||||
*pnothing = 1;
|
||||
else
|
||||
fprintf (stderr, "did not find the `nothing' variable\n");
|
||||
|
||||
/* Just call the functions and check return values. */
|
||||
if (pfoo1)
|
||||
{
|
||||
if ((*pfoo1) () == FOO_RET)
|
||||
printf("foo1 is ok!\n");
|
||||
}
|
||||
else if (pfoo2)
|
||||
{
|
||||
if ((*pfoo2) () == FOO_RET)
|
||||
printf("foo2 is ok!\n");
|
||||
}
|
||||
else
|
||||
fprintf (stderr, "did not find the `foo' function\n");
|
||||
|
||||
lt_dlclose(handle);
|
||||
}
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
|
||||
printf ("Welcome to *modular* GNU Hell!\n");
|
||||
|
||||
testlib(".libs/libfoo1.so", ".libs/libfoo1.a");
|
||||
|
||||
testlib(".libs/libfoo2.so", ".libs/libfoo2.a");
|
||||
|
||||
return 0;
|
||||
}
|
@ -3,8 +3,11 @@
|
||||
AUTOMAKE_OPTIONS = gnits
|
||||
|
||||
makesequence = demo-make.test demo-exec.test \
|
||||
demo-inst.test demo-unst.test hardcode.test
|
||||
TESTS = demo-conf.test $(makesequence) link.test link-2.test nomode.test \
|
||||
demo-inst.test demo-unst.test hardcode.test \
|
||||
mdemo-make.test mdemo-exec.test \
|
||||
mdemo-inst.test mdemo-unst.test
|
||||
TESTS = demo-conf.test mdemo-conf.test $(makesequence) \
|
||||
link.test link-2.test nomode.test \
|
||||
quote.test sh.test suffix.test
|
||||
|
||||
# Be sure to reexport important environment variables.
|
||||
@ -16,4 +19,5 @@ EXTRA_DIST = defs $(TESTS)
|
||||
# We need to remove any files that the above tests created.
|
||||
clean-local:
|
||||
-test -f ../demo/Makefile && cd ../demo && $(MAKE) distclean
|
||||
-test -f ../mdemo/Makefile && cd ../mdemo && $(MAKE) distclean
|
||||
rm -rf _inst
|
||||
|
30
tests/mdemo-conf.test
Executable file
30
tests/mdemo-conf.test
Executable file
@ -0,0 +1,30 @@
|
||||
#! /bin/sh
|
||||
# mdemo-conf.test - try configuring the ../mdemo subdirectory
|
||||
|
||||
# Test script header.
|
||||
need_prefix=yes
|
||||
if test -z "$srcdir"; then
|
||||
srcdir=`echo "$0" | sed 's%/[^/]*$%%'`
|
||||
test "$srcdir" = "$0" && srcdir=.
|
||||
test "${VERBOSE+set}" != "set" && VERBOSE=yes
|
||||
fi
|
||||
. $srcdir/defs || exit 1
|
||||
|
||||
# Maybe we have a VPATH build, in which case, create a new subdir.
|
||||
test -d ../mdemo || mkdir ../mdemo
|
||||
|
||||
# Change to our build directory.
|
||||
cd ../mdemo || exit 1
|
||||
|
||||
# Possibly clean up the distribution.
|
||||
if test -f Makefile; then
|
||||
echo "= Running $make distclean in ../mdemo"
|
||||
$make distclean
|
||||
fi
|
||||
rm -f config.cache
|
||||
|
||||
# Configure the demonstration.
|
||||
echo "= Configuring in ../mdemo (prefix=$prefix)"
|
||||
CONFIG_SITE=/dev/null ${CONFIG_SHELL-/bin/sh} $srcdir/../mdemo/configure --srcdir=$srcdir/../mdemo --prefix=$prefix || exit 1
|
||||
|
||||
exit 0
|
35
tests/mdemo-exec.test
Executable file
35
tests/mdemo-exec.test
Executable file
@ -0,0 +1,35 @@
|
||||
#! /bin/sh
|
||||
# mdemo-exec.test - check that programs in the ../mdemo subdirectory are viable
|
||||
|
||||
# Test script header.
|
||||
need_prefix=no
|
||||
if test -z "$srcdir"; then
|
||||
srcdir=`echo "$0" | sed 's%/[^/]*$%%'`
|
||||
test "$srcdir" = "$0" && srcdir=.
|
||||
test "${VERBOSE+set}" != "set" && VERBOSE=yes
|
||||
fi
|
||||
. $srcdir/defs || exit 1
|
||||
|
||||
if test -f ../mdemo/hell; then :
|
||||
else
|
||||
echo "You must run mdemo-make.test before running $0" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check to see if the programs really run.
|
||||
echo "Executing uninstalled programs in ../mdemo"
|
||||
|
||||
status=0
|
||||
if ../mdemo/hell.debug| grep 'GNU Hell'; then :
|
||||
else
|
||||
echo "$0: cannot execute ../mdemo/hell.debug" 1>&2
|
||||
status=1
|
||||
fi
|
||||
|
||||
if ../mdemo/hell | grep 'GNU Hell'; then :
|
||||
else
|
||||
echo "$0: cannot execute ../mdemo/hell" 1>&2
|
||||
status=1
|
||||
fi
|
||||
|
||||
exit $status
|
46
tests/mdemo-inst.test
Executable file
46
tests/mdemo-inst.test
Executable file
@ -0,0 +1,46 @@
|
||||
#! /bin/sh
|
||||
# mdemo-inst.test - try installing from the ../mdemo subdirectory
|
||||
|
||||
# Test script header.
|
||||
need_prefix=yes
|
||||
if test -z "$srcdir"; then
|
||||
srcdir=`echo "$0" | sed 's%/[^/]*$%%'`
|
||||
test "$srcdir" = "$0" && srcdir=.
|
||||
test "${VERBOSE+set}" != "set" && VERBOSE=yes
|
||||
fi
|
||||
. $srcdir/defs || exit 1
|
||||
|
||||
# Check that things are built.
|
||||
if test -f ../mdemo/hell; then :
|
||||
else
|
||||
echo "You must run mdemo-make.test before $0" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Change to our build directory.
|
||||
cd ../mdemo || exit 1
|
||||
|
||||
echo "= Running $make install in ../mdemo"
|
||||
$make install || exit 1
|
||||
|
||||
echo "= Executing installed programs"
|
||||
status=0
|
||||
if $prefix/bin/hell.debug | grep 'Welcome to GNU Hell'; then :
|
||||
else
|
||||
echo "$0: cannot execute $prefix/bin/hell.debug" 1>&2
|
||||
status=1
|
||||
fi
|
||||
|
||||
if $prefix/bin/hell | grep 'Welcome to GNU Hell'; then :
|
||||
else
|
||||
echo "$0: cannot execute $prefix/bin/hell" 1>&2
|
||||
|
||||
# Simple check to see if they are superuser.
|
||||
if test -w /; then :
|
||||
else
|
||||
echo "You may need to run $0 as the superuser."
|
||||
fi
|
||||
status=1
|
||||
fi
|
||||
|
||||
exit $status
|
25
tests/mdemo-make.test
Executable file
25
tests/mdemo-make.test
Executable file
@ -0,0 +1,25 @@
|
||||
#! /bin/sh
|
||||
# mdemo-make.test - try building in the ../mdemo subdirectory
|
||||
|
||||
# Test script header.
|
||||
need_prefix=no
|
||||
if test -z "$srcdir"; then
|
||||
srcdir=`echo "$0" | sed 's%/[^/]*$%%'`
|
||||
test "$srcdir" = "$0" && srcdir=.
|
||||
test "${VERBOSE+set}" != "set" && VERBOSE=yes
|
||||
fi
|
||||
. $srcdir/defs || exit 1
|
||||
|
||||
if test -f ../mdemo/Makefile; then :
|
||||
else
|
||||
echo "You must run mdemo-conf.test before running $0" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Change to our build directory.
|
||||
cd ../mdemo || exit 1
|
||||
|
||||
# Do the actual build.
|
||||
echo "Making in ../mdemo"
|
||||
$make || exit 1
|
||||
exit 0
|
35
tests/mdemo-unst.test
Executable file
35
tests/mdemo-unst.test
Executable file
@ -0,0 +1,35 @@
|
||||
#! /bin/sh
|
||||
# mdemo.test - try uninstalling in the ../mdemo subdirectory
|
||||
|
||||
# Test script header.
|
||||
need_prefix=yes
|
||||
if test -z "$srcdir"; then
|
||||
srcdir=`echo "$0" | sed 's%/[^/]*$%%'`
|
||||
test "$srcdir" = "$0" && srcdir=.
|
||||
test "${VERBOSE+set}" != "set" && VERBOSE=yes
|
||||
fi
|
||||
. $srcdir/defs || exit 1
|
||||
|
||||
# Maybe we have a VPATH build, in which case, create a new subdir.
|
||||
if test "$prefix/bin/hell"; then :
|
||||
else
|
||||
echo "You must run mdemo-inst.test before $0." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Change to our build directory.
|
||||
cd ../mdemo || exit 1
|
||||
|
||||
echo "= Running $make uninstall in ../mdemo"
|
||||
$make uninstall || exit 1
|
||||
|
||||
# See that there were no files leftover in $prefix.
|
||||
# Ignore dotfiles, so that .nfsXXX files don't screw up the test.
|
||||
leftovers=`find $prefix ! -type d ! -name '.*' -print`
|
||||
if test -n "$leftovers"; then
|
||||
echo "= Leftover after make uninstall:"
|
||||
ls -l $leftovers
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
79
tests/mdemo.test
Normal file
79
tests/mdemo.test
Normal file
@ -0,0 +1,79 @@
|
||||
#! /bin/sh
|
||||
# mdemo.test - try building in the ../mdemo subdirectory
|
||||
|
||||
# Test script header.
|
||||
need_prefix=yes
|
||||
if test -z "$srcdir"; then
|
||||
srcdir=.
|
||||
test "${VERBOSE+set}" != "set" && VERBOSE=yes
|
||||
fi
|
||||
. $srcdir/defs || exit 1
|
||||
|
||||
# Maybe we have a VPATH build, in which case, create a new subdir.
|
||||
test -d ../mdemo || mkdir ../mdemo
|
||||
|
||||
# Change to our build directory.
|
||||
cd ../mdemo || exit 1
|
||||
|
||||
# Possibly clean up the distribution.
|
||||
if test -f config.cache; then
|
||||
echo "= Running make distclean in ../mdemo"
|
||||
make distclean || rm -f config.cache
|
||||
fi
|
||||
|
||||
# Configure the demonstration.
|
||||
echo "= Configuring in ../mdemo (prefix=$prefix)"
|
||||
$srcdir/../mdemo/configure --srcdir=$srcdir/../mdemo --prefix=$prefix || exit 1
|
||||
|
||||
# Do the actual build.
|
||||
echo "= Running make in ../mdemo"
|
||||
make || exit 1
|
||||
|
||||
# Try running the program.
|
||||
echo "= Executing uninstalled programs"
|
||||
if ./hell.debug | grep 'GNU Hell'; then :
|
||||
else
|
||||
echo "$0: cannot execute ./hell.debug" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ./hell | grep 'GNU Hell'; then :
|
||||
else
|
||||
echo "$0: cannot execute ./hell" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "= Running make install in ../mdemo"
|
||||
make install || exit 1
|
||||
|
||||
echo "= Executing installed programs"
|
||||
if $prefix/bin/hell.debug | grep 'GNU Hell'; then :
|
||||
else
|
||||
echo "$0: cannot execute $prefix/bin/hell.debug" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if $prefix/bin/hell | grep 'GNU Hell'; then :
|
||||
else
|
||||
echo "$0: warning: cannot execute $prefix/bin/hell" 1>&2
|
||||
fi
|
||||
|
||||
echo "= Running make uninstall in ../mdemo"
|
||||
make uninstall || exit 1
|
||||
|
||||
# See that there were no files leftover in $prefix.
|
||||
leftovers=`find $prefix ! -type d -print`
|
||||
if test -n "$leftovers"; then
|
||||
echo "= Leftover after make uninstall:"
|
||||
ls -l $leftovers
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Delete the directory tree we created.
|
||||
rm -rf $prefix
|
||||
|
||||
|
||||
# Clean up the distribution.
|
||||
make distclean
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user