]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* updated to HEAD
authorThomas Tanner <tanner@gmx.de>
Thu, 25 Feb 1999 06:53:50 +0000 (06:53 +0000)
committerThomas Tanner <tanner@gmx.de>
Thu, 25 Feb 1999 06:53:50 +0000 (06:53 +0000)
* libtool.m4: added the macros AC_ENABLE/DISABLE_FAST_INSTALL
  for optional fast installation
* ltconfig.in: added new flag --enable-fast-install

23 files changed:
ChangeLog
THANKS
TODO
autogen
cdemo/Makefile.am
cdemo/configure.in
cdemo/foo.c [moved from cdemo/foo1.c with 90% similarity]
cdemo/main.c
demo/Makefile.am
demo/configure.in
demo/dlmain.c
depdemo/configure.in
doc/libtool.texi
libltdl/configure.in
libltdl/ltdl.c
libltdl/ltdl.h
libtool.m4
ltconfig.in
ltmain.in
mail/sgi [deleted file]
mdemo/Makefile.am
mdemo/configure.in
mdemo/main.c

index 798e070d833b8692c91710b2001b9a764d7f6b79..dda46e166cae20bf2d485dd5ca0eae4d44e2b170 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+1999-02-25  Thomas Tanner  <tanner@gmx.de>
+
+       * updated to HEAD
+       * libtool.m4: added the macros AC_ENABLE/DISABLE_FAST_INSTALL
+         for optional fast installation
+       * ltconfig.in: added new flag --enable-fast-install
+
 1999-02-21  Thomas Tanner  <tanner@gmx.de>
 
        * depdemo: moved each library into a subdirectory
diff --git a/THANKS b/THANKS
index 99fe19a765b2a84ad6bf08f6753cf43687035c05..242b00961048270345266352b73d8a9f2a8abebe 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -15,6 +15,7 @@ Andrey Slepuhin <pooh@msu.ru>
 Bruno Haible <haible@ilog.fr>
 Carl D. Roth <roth@cse.ucsc.edu>
 Chris P. Ross <cross@eng.us.uu.net>
+DJ Delorie <dj@delorie.com>
 Edouard G. Parmelan <Edouard.Parmelan@France.NCR.COM>
 Eric Estievenart <eric@via.ecp.fr>
 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
diff --git a/TODO b/TODO
index 763f591372e39913a7d7ba8efb2d71bf07003cbd..76e7d5842ed4d2746e850b226289fbbcaa46a373 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,63 +1,65 @@
-For next public release:
-************************
+For next alpha release:
+***********************
 
-* Create a new library version_type, `irix'.  Janos Farkas writes:
+* Fast installation (linking on demand in the build tree)
+must be optional.
 
-I just realized I also have mortal access to an SGI system, and found
-this in the dso.5 page, this looks more informative :)
+* check whether the version of libtool.m4 is compatible
+with ltconfig/ltmain.sh
 
-   Versioning of Shared Objects.
+* libltdl is broken when configured with --enable-ltdl-install
 
-   QUICK OVERVIEW
+* check whether the "file" command is available
 
-   For a shared object to be versioned the following needs to be done:
+* update the NEWS file
 
-   * Version strings consist of 3 parts and a dot: The string "sgi",
-     a decimal number (the major number), a dot, and a decimal number
-     (the minor number).
-
-   * Add the command -set_version sgi1.0 to the command to build
-     the shared object (cc -shared, ld -shared, etc.).
+* Tom Lane adds that HP-UX's linker, at least (I've also found this on
+AIX 4), distinguishes between global function and global variable
+references.  This means that we cannot declare every symbol as `extern
+char'.  Find a workaround.
 
-   * Whenever you make a COMPATIBLE change update the minor version
-     number (the one after the dot), and add the latest version string
-     to colon-separated list of version strings, e.g., -set_version
-     sgi1.0:sgi1.1:sgi1.3
+For next public release:
+************************
 
-   * Whenever you make an INCOMPATIBLE change, update the
-     major version number.  Pass this as the version list, e.g.,
-     -set_version sgi2.0.  Change the filename of the OLD shared object
-     by adding a dot followed by the previous major number to the filename
-     of the shared object.  DO NOT CHANGE the soname of the object.
-     No change to the file contents are necessary or desirable.  Simply
-     rename the file.
+* Inter-library dependencies should be fully tracked by libtool
+and need to work for ltlibraries too. This requires looking up 
+installed libtool libraries for transparent support.
+Thomas Tanner has a patch for this. 
 
-* Inter-library dependencies should be fully tracked by libtool.
-Reminded by Alexandre Oliva.  This requires looking up installed
-libtool libraries for transparent support.
+* Alexandre Oliva suggests that we should have an option to hardcode
+paths into libraries, as well as binaries: `... -Wl,-soname
+-Wl,/tmp/libtest.so.0 ...'.  Tim Mooney wants the same thing.
 
-* Inter-library dependencies need to work for ltlibraries too.
-Thomas Tanner has a patch for this.
+* Lists of exported symbols should be stored in the pseudo library
+so that the size of lt_preloaded_symbols can be reduced.
 
-* Alexandre Oliva suggests that we hardcode paths into libraries, as
-well as binaries:  `... -Wl,-soname -Wl,/tmp/libtest.so.0 ...'.  Tim
-Mooney wants the same thing.
+* Godmar Back writes:
+  libltdl uses such stdio functions as fopen, fgets, feof, fclose, and others.
+  These functions are not async-signal-safe. While this does not make 
+  libltdl unusable, it restricts its usefulness and puts an 
+  unnecessary burden on the user.
 
-* Tom Lane adds that HP-UX's linker, at least (I've also found this on
-AIX 4), distinguishes between global function and global variable
-references.  This means that we cannot declare every symbol as `extern
-char'.  Find a workaround.
+  As a remedy, I'd recommend to replace those functions with functions
+  that POSIX says are async-signal-safe, such as open, read, close.
+  This will require you to handle interrupted system calls and implement
+  fgets, but the former isn't hard and there's plenty of implementations
+  out from which you can steal the latter.
 
-* Jeff Garzik <jgarzik@pobox.com> noticed that libtool wrapper scripts do
-not always work on Linux.  When running tests in a newly built package, the
-script is prone to picking up a similarly sonamed library in /usr/lib in
-preference to the newly built library in the distribution.  The scripts *do*
-work under Solaris however.
+  I believe relying on async-signal-safe functions to the greatest extent
+  possible would greatly improve libltdl's ability to be embedded in and 
+  used by other systems.
 
 * Documentation:
 
 - libltdl documentation needs to be completed.
 
+- AC_PROG_LIBTOOL, AC_ENABLE/DISABLE_SHARED/STATIC, AC_LIBTOOL_DLOPEN
+  are not documented.
+
+- Purpose and usage of convenience libraries must be better documented
+
+- some new internal variables are not documented yet.
+
 In the future:
 **************
 
diff --git a/autogen b/autogen
index aebb562c760964ff42d782d040c2bf5201c2cb77..2a35dcac50783dad7e782fab0556e1245c5c2e5a 100644 (file)
--- a/autogen
+++ b/autogen
@@ -19,7 +19,7 @@ for sub in demo depdemo libltdl mdemo cdemo; do
   rm -f acinclude.m4
   cp ../libtool.m4 acinclude.m4
   aclocal
-  autoheader
+  test "$sub" = libltdl && autoheader
   automake --gnits --add-missing
   autoconf
   cd ..
index 31774d14c3c274b0308cd249f3a6c53ebd65b8a2..8e9a844a8ac22db166b616744c082aa66a890dac 100644 (file)
@@ -2,17 +2,15 @@
 #
 AUTOMAKE_OPTIONS = no-dependencies foreign
 
-INCLUDES = -I$(srcdir)/../libltdl
-
 EXTRA_DIST = acinclude.m4
 
-noinst_LTLIBRARIES = libfoo1.la
+noinst_LTLIBRARIES = libfoo.la
 
-libfoo1_la_SOURCES = foo1.c
+libfoo_la_SOURCES = foo.c
 
 noinst_HEADERS = foo.h
 
 bin_PROGRAMS = cdemo
 
 cdemo_SOURCES = main.c
-cdemo_LDADD = libfoo1.la $(LIBADD_M)
+cdemo_LDADD = libfoo.la
index 97f3a3b47ba734ef65cd904f5184ac5337bfb5ea..e39ca3c4b2c6ee725dafe236f803cce00dd5ece4 100644 (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)
similarity index 90%
rename from cdemo/foo1.c
rename to cdemo/foo.c
index 6a0275459dd04e29b1f0bea026e9318fea0f3d71..5c407058484b357f7e4ea4ee8bd46c20fcda5cb2 100644 (file)
@@ -1,4 +1,4 @@
-/* foo1.c -- trivial test library
+/* foo.c -- trivial test library
    Copyright (C) 1998-1999 Free Software Foundation, Inc.
    Originally by Thomas Tanner <tanner@gmx.de>
    This file is part of GNU Libtool.
@@ -25,10 +25,8 @@ USA. */
 #include <math.h>
 #endif
 
-/* exported functions */
-
 int
-foo1()
+foo()
 {
   printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
   return FOO_RET;
@@ -37,6 +35,6 @@ foo1()
 int
 hello()
 {
-  printf ("** This is foolib 1 **\n");
+  printf ("** This is libfoo **\n");
   return HELLO_RET;
 }
index 291f358459fe0389b3c95187f2e2a358536d0d8f..79602a249be85b288fa6a64be54493a02813bcdc 100644 (file)
@@ -36,8 +36,8 @@ main (argc,argv)
   if (value == HELLO_RET)
     printf("hello is ok!\n");
 
-  if (foo1 () == FOO_RET)
-    printf("foo1 is ok!\n");
+  if (foo () == FOO_RET)
+    printf("foo is ok!\n");
 
   return 0;
 }
index ac93cb6d91193816ba3c5b47bc4a77ebdc49213b..cd3ea84b76f78b60e5e8b354e216e69924b3fb02 100644 (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
 
 include_HEADERS = foo.h
 
index e0fac772d0971e55cb5a198050bd0d70fd6411c6..67cb0bd216742be5c3401df2d9ff2b240d546135 100644 (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)
index 2af03f44947d20b045245cdceb5063b9202c1875..7c123bb8e285d1e93910fb7f61dd2af0569b1e36 100644 (file)
@@ -63,7 +63,6 @@ main (argc, argv)
          /* In an ideal world a shared lib would be able to export data */
          pnothing = (int*)&nothing;
 #endif
-
       } else 
         printf ("found file: %s\n", s->name);
       s ++;
index 9994c3d44d8f8ccd468b9e9410ffc603ad5978dd..96720c83ef91ea1d2c4dcbfe8f3f576cac9c4ca5 100644 (file)
@@ -15,8 +15,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(
index 2e3c630cf814c18753902284bdc49ca7c99e69e5..f35ade7d06b5f85dfe8c717bd8f5beaaec15f5a8 100644 (file)
@@ -173,7 +173,7 @@ Dlopened modules
 
 Using libltdl
 
-* Libltdl's interface::         How to use libltdl in your programs.
+* Libltdl interface::           How to use libltdl in your programs.
 * Modules for libltdl::         Creating modules that can be @code{dlopen}ed.
 * Distributing libltdl::        How to distribute libltdl with your package.
 
@@ -1163,8 +1163,12 @@ Allow symbols from @var{output-file} to be resolved with @code{dlsym}
 @item -export-symbols @var{symfile}
 Tells the linker to export only the symbols listed in @var{symfile}. 
 The symbol file should end in @samp{.sym} and must contain the name of one 
-symbol per line. This option does not work for modules and is not
-supported on all platforms.
+symbol per line. This option has no effect on some platforms.
+By default all symbols are exported.
+
+@item -export-symbols-regex @var{regex}
+Same as @samp{-export-symbols}, except that only symbols matching
+the regular expression @var{regex} are exported.
 By default all symbols are exported.
 
 @item -L@var{libdir}
@@ -2553,16 +2557,16 @@ libtool's dlpreopen (see @pxref{Dlpreopening})
 @end itemize
 
 @menu
-* Libltdl's interface::         How to use libltdl in your programs.
+* Libltdl interface::           How to use libltdl in your programs.
 * Modules for libltdl::         Creating modules that can be @code{dlopen}ed.
 * Distributing libltdl::        How to distribute libltdl with your package.
 @end menu
 
-@node Libltdl's interface
+@node Libltdl interface
 @section How to use libltdl in your programs
 
 @noindent
-Libltdl's API is similar to the dlopen interface of Solaris and Linux,
+The libltdl API is similar to the dlopen interface of Solaris and Linux,
 which is very simple but powerful.
 
 @noindent
@@ -3137,16 +3141,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 
@@ -3331,6 +3335,13 @@ simply set shell variables, then sourced the libtool backend,
 inlines the contents of @code{ltmain.sh} into the generated
 @code{libtool}, which improves performance on many systems.
 
+The convention used for naming variables which hold shell commands for
+delayed evaluation, is to use the suffix @code{_cmd} where a single
+line of valid shell script is needed, and the suffix @code{_cmds} where
+multiple lines of shell script @strong{may} be delayed for later
+evaluation.  By convention, @code{_cmds} variables delimit the
+evaluation units with the @code{~} character where necessary.
+
 Here is a listing of each of the configuration variables, and how they
 are used within @code{ltmain.sh}:
 
@@ -3376,11 +3387,17 @@ is no way to generate a shared library with references to symbols that
 aren't defined in that library.
 @end defvar
 
+@defvar always_export_symbols
+Whether libtool should automatically generate a list of exported symbols
+using @var{export_symbols_cmds} before linking an archive.
+Set to @samp{yes} or @samp{no}.  Default is @samp{no}
+@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
@@ -3411,16 +3428,35 @@ i.e whether object files do not have to have the suffix ".o".
 Set to @samp{yes} or @samp{no}.
 @end defvar
 
+@defvar dlopen
+Whether @code{dlopen} is supported on the platform.
+Set to @samp{yes} or @samp{no}.
+@end defvar
+
+@defvar dlopen_self
+Whether it is possible to @code{dlopen} the executable itself.
+Set to @samp{yes} or @samp{no}.
+@end defvar
+
 @defvar echo
 An @code{echo} program which does not interpret backslashes as an
 escape character.
 @end defvar
 
+@defvar exclude_expsyms
+List of symbols that should not be listed in the preloaded symbols.
+@end defvar
+
 @defvar export_dynamic_flag_spec
 Compiler link flag that allows a dlopened shared library to reference
 symbols that are defined in the program.
 @end defvar
 
+@defvar export_symbols_cmds
+Commands to extract exported symbols from @var{libobjs} to the
+file @var{export_symbols}.
+@end defvar
+
 @defvar finish_cmds
 Commands to tell the dynamic linker how to find shared libraries in a
 specific directory.
@@ -3491,6 +3527,10 @@ For information purposes, set to the specified and canonical names of
 the system that libtool was configured for.
 @end defvar
 
+@defvar include_expsyms
+List of symbols that must always be exported when using @var{export_symbols}.
+@end defvar
+
 @defvar libext
 The standard old archive suffix (normally "a").
 @end defvar
@@ -3517,6 +3557,9 @@ Whether libtool should automatically prefix module names with 'lib'.
 Set to @samp{yes} or @samp{no}.  By default, it is @samp{unknown}, which 
 means the same as @samp{yes}, but documents that we are not really sure
 about it.
+@samp{yes} means that it is possible both to @code{dlopen} and to
+link against a library wihthout 'lib' prefix,
+i.e. it requires @var{hardcode_direct} to be @samp{yes}.
 @end defvar
 
 @defvar need_version
@@ -3575,6 +3618,17 @@ The environment variable that tells the linker which directories to
 hardcode in the resulting executable.
 @end defvar
 
+@defvar shlibpath_overrides_runpath
+Indicates whether it is possible to override the hard-coded library
+search path of a program with an environment variable.  If this is set
+to no, libtool may have to create two copies of a program in the build
+tree, one to be installed and one to be run in the build tree only.  The 
+latter will be created on-demand, only if the program is actually run in
+the build tree.  If this is set to yes, libtool will set
+@code{shlibpath_var} in the wrapper script before starting the program.
+The default value is unknown, which is equivalent to no.
+@end defvar
+
 @defvar shlibpath_var
 The environment variable that tells the dynamic linker where to find
 shared libraries.
index 39aa2051779a5ea490b33956310cdd6967ff7cbb..3785958af628b75f9fc9f1726a61b9da85a7b9f9 100644 (file)
@@ -44,7 +44,8 @@ libltdl_cv_shlibext=`cat conftest`
 rm -f conftest
 ])
 if test -n "$libltdl_cv_shlibext"; then
-  AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$libltdl_cv_shlibext")
+  AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$libltdl_cv_shlibext",
+    [Define to the extension used for shared libraries, say, ".so". ])
 fi
 
 AC_CACHE_CHECK([which variable specifies run-time library path],
@@ -60,7 +61,8 @@ libltdl_cv_shlibpath_var=`cat conftest`
 rm -f conftest
 ])
 if test -n "$libltdl_cv_shlibpath_var"; then
-  AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var")
+  AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var",
+    [Define to the name of the environment variable that determines the dynamic library search path. ])
 fi
 
 AC_CACHE_CHECK([for objdir],
@@ -76,10 +78,11 @@ libltdl_cv_objdir=`cat conftest`
 rm -f conftest
 ])
 test -z "$libltdl_cv_objdir" && libltdl_cv_objdir=".libs"
-AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir/")
+AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir/",
+  [Define to the sub-directory in which libtool stores uninstalled libraries. ])
 
 AC_HEADER_STDC
-AC_CHECK_HEADERS(malloc.h memory.h stdlib.h stdio.h ctype.h dlfcn.h dl.h)
+AC_CHECK_HEADERS(malloc.h memory.h stdlib.h stdio.h ctype.h dlfcn.h dl.h dld.h)
 AC_CHECK_HEADERS(string.h strings.h, break)
 AC_CHECK_FUNCS(strdup strchr strrchr index rindex)
 
@@ -100,15 +103,22 @@ AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen],
   rm -f conftest
 ])
 if test x"$libltdl_cv_preloaded_symbols" = x"yes"; then
-  AC_DEFINE(HAVE_PRELOADED_SYMBOLS)
+  AC_DEFINE(HAVE_PRELOADED_SYMBOLS, 1,
+    [Define if libtool can extract symbol lists from object files. ])
 fi
 
 test_dlerror=no
 LIBADD_DL=
-AC_CHECK_FUNCS(dlopen, [AC_DEFINE(HAVE_LIBDL) test_dlerror=yes],
-  [AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_LIBDL) LIBADD_DL="-ldl" test_dlerror=yes],
-    [AC_CHECK_LIB(dld, dld_link, [AC_DEFINE(HAVE_DLD) LIBADD_DL="-ldld"],
-      [AC_CHECK_FUNCS(shl_load, AC_DEFINE(HAVE_SHL_LOAD))]
+AC_CHECK_FUNCS(dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
+                         [Define if you have the libdl library or equivalent. ]) test_dlerror=yes],
+  [AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
+                              [Define if you have the libdl library. ]) dnl
+                            LIBADD_DL="-ldl" test_dlerror=yes],
+    [AC_CHECK_LIB(dld, dld_link, [AC_DEFINE(HAVE_DLD, 1,
+                                   [Define if you have the GNU dld library. ]) dnl
+                                 LIBADD_DL="-ldld"],
+      [AC_CHECK_FUNCS(shl_load, [AC_DEFINE(HAVE_SHL_LOAD, 1,
+                                  [Define if you have the shl_load function. ])])]
     )]
   )]
 )
@@ -141,7 +151,8 @@ main() { void *self, *ptr1, *ptr2; self=dlopen(0,RTLD_LAZY);
 fi
 
 if test x"$libltdl_cv_need_uscore" = xyes; then
-  AC_DEFINE(NEED_USCORE)
+  AC_DEFINE(NEED_USCORE, 1,
+    [Define if dlsym() requires a leading underscode in symbol names. ])
 fi
 
 dnl Output the makefile
index 714eb1ab08c014aa808c900e79360336b081b1c4..2b4432730a301c7040ba483ed543c9fd23160269 100644 (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) __P((size_t size)) = malloc;
+void    (*lt_dlfree)  __P((lt_ptr_t ptr)) = free;
+
 typedef struct lt_dltype_t {
        struct lt_dltype_t *next;
        const char *sym_prefix; /* prefix for symbols */
@@ -107,7 +110,7 @@ typedef struct lt_dltype_t {
        int (*lib_open) __P((lt_dlhandle handle, const char *filename));
        int (*lib_close) __P((lt_dlhandle handle));
        lt_ptr_t (*find_sym) __P((lt_dlhandle handle, const char *symbol));
-} lt_dltype_t, *lt_dltype;
+} lt_dltype_t;
 
 #define LTDL_TYPE_TOP 0
 
@@ -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;
@@ -404,6 +407,10 @@ shl = { LTDL_TYPE_TOP, 0, shl_init, shl_exit,
 
 /* dynamic linking with dld */
 
+#if HAVE_DLD_H
+#include <dld.h>
+#endif
+
 static int
 dld_init ()
 {
@@ -423,12 +430,12 @@ dld_open (handle, filename)
 {
        handle->handle = strdup(filename);
        if (!handle->handle) {
-               last_error = no_memory_error;
+               last_error = memory_error;
                return 1;
        }
        if (dld_link(filename) != 0) {
                last_error = unknown_error;
-               free(handle->handle);
+               lt_dlfree(handle->handle);
                return 1;
        }
        return 0;
@@ -442,7 +449,7 @@ dld_close (handle)
                last_error = unknown_error;
                return 1;
        }
-       free(handle->filename);
+       lt_dlfree(handle->filename);
        return 0;
 }
 
@@ -560,7 +567,7 @@ presym_free_symlists ()
                lt_dlsymlists_t *tmp = lists;
                
                lists = lists->next;
-               free(tmp);
+               lt_dlfree(tmp);
        }
        preloaded_symbols = 0;
        return 0;
@@ -586,7 +593,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;
@@ -616,15 +623,8 @@ presym_open (handle, filename)
                last_error = no_symbols_error;
                return 1;
        }
-       if (!filename) {
-               if (!default_preloaded_symbols) {
-                       last_error = file_not_found_error;
-                       return 1;
-               } else {
-                       handle->handle = (lt_ptr_t) default_preloaded_symbols;
-                       return 0;
-               }
-       }
+       if (!filename)
+               filename = "@PROGRAM@";
        while (lists) {
                const lt_dlsymlist *syms = lists->syms;
        
@@ -658,7 +658,7 @@ presym_sym (handle, symbol)
 
        syms++;
        while (syms->address) {
-               if (syms->address && strcmp(syms->name, symbol) == 0)
+               if (strcmp(syms->name, symbol) == 0)
                        return syms->address;
                syms++;
        }
@@ -678,14 +678,14 @@ static char *user_search_path = 0;
 static lt_dlhandle handles = 0;
 static int initialized = 0;
 
-static lt_dltype types = LTDL_TYPE_TOP;
+static lt_dltype_t *types = LTDL_TYPE_TOP;
 #undef LTDL_TYPE_TOP
 
 int
 lt_dlinit ()
 {
        /* initialize libltdl */
-       lt_dltype *type = &types;
+       lt_dltype_t **type = &types;
        int typecount = 0;
 
        if (initialized) {      /* Initialize only at first call. */
@@ -736,7 +736,7 @@ int
 lt_dlexit ()
 {
        /* shut down libltdl */
-       lt_dltype type = types;
+       lt_dltype_t *type = types;
        int     errors;
        
        if (!initialized) {
@@ -769,7 +769,7 @@ tryall_dlopen (handle, filename)
        const char *filename;
 {
        lt_dlhandle cur;
-       lt_dltype type = types;
+       lt_dltype_t *type = types;
        const char *saved_error = last_error;
        
        /* check whether the module was already opened */
@@ -804,7 +804,7 @@ tryall_dlopen (handle, filename)
        }
        if (!type) {
                if (cur->filename)
-                       free(cur->filename);
+                       lt_dlfree(cur->filename);
                return 1;
        }
        cur->type = type;
@@ -832,7 +832,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 +842,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 +850,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 +865,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 +874,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 +882,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 +926,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 +940,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 +956,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 +996,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 +1021,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,25 +1045,25 @@ 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;
                }
                handle->usage = 0;
+               handle->depcount = 0;
+               handle->deplibs = 0;
                newhandle = handle;
-               if (tryall_dlopen(handle, 0) != 0) {
-                       free(newhandle);
+               if (tryall_dlopen(&newhandle, 0) != 0) {
+                       lt_dlfree(handle);
                        return 0;
                }
-               if (newhandle != handle)
-                       free(newhandle);
-               return handle;
+               goto register_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 +1087,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 +1123,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 +1158,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 +1179,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 +1188,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;
@@ -1200,26 +1200,28 @@ lt_dlopen (filename)
                handle->depcount = 0;
                handle->deplibs = 0;
                newhandle = handle;
-               if (tryall_dlopen(&handle, filename)
+               if (tryall_dlopen(&newhandle, filename)
                    && (!dir
-                       || (!find_file(basename, user_search_path, 0, &handle)
+                       || (!find_file(basename, user_search_path,
+                                         0, &newhandle)
                            && !find_file(basename,
                                          getenv("LTDL_LIBRARY_PATH"),
-                                         0, &handle)
+                                         0, &newhandle)
 #ifdef LTDL_SHLIBPATH_VAR
                            && !find_file(basename,
                                          getenv(LTDL_SHLIBPATH_VAR),
-                                         0, &handle)
+                                         0, &newhandle)
 #endif
                                ))) {
-                       free(handle);
+                       lt_dlfree(handle);
                        if (dir)
-                               free(dir);
+                               lt_dlfree(dir);
                        return 0;
                }
        }
+register_handle:
        if (newhandle != handle) {
-               free(handle);
+               lt_dlfree(handle);
                handle = newhandle;
        }
        if (!handle->usage) {
@@ -1228,9 +1230,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;
 }
@@ -1244,10 +1246,8 @@ lt_dlopenext (filename)
        int     len;
        const char *saved_error = last_error;
        
-       if (!filename) {
-               last_error = file_not_found_error;
-               return 0;
-       }
+       if (!filename)
+               return lt_dlopen(filename);
        len = strlen(filename);
        if (!len) {
                last_error = file_not_found_error;
@@ -1258,7 +1258,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 +1268,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 +1287,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 +1322,11 @@ lt_dlclose (handle)
                        handles = handle->next;
                error = handle->type->lib_close(handle);
                error += unload_deplibs(handle);
-               free(handle->filename);
+               if (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 +1358,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 +1376,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 +1388,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 +1415,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 +1423,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 +1434,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;
index a441979a42b1d551cf2ef8933b6c25670ad4b401..2f58da355674174008dd1b6c1936e1161f4d7ca0 100644 (file)
@@ -41,13 +41,15 @@ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #undef __P
 #undef lt_ptr_t
 #if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32) || defined(__cplusplus)
-# define __P(protos) protos
-# define lt_ptr_t     void*
+# define __P(protos)   protos
+# define lt_ptr_t      void*
 #else
-# define __P(protos) ()
-# define lt_ptr_t     char*
+# define __P(protos)   ()
+# 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)__P((size_t size));
+extern void (*lt_dlfree)__P((lt_ptr_t ptr));
+
 __END_DECLS
 
 #endif /* !_LTDL_H_ */
index dccffd2d2f56e64441d09d509b809a3ebd3190ae..42c90ca482b3c22ea28cefe34cdb72a86a967237 100644 (file)
 ## configuration script generated by Autoconf, you may include it under
 ## the same distribution terms that you use for the rest of that program.
 
-# serial 31 AC_PROG_LIBTOOL
+# serial 32 AC_PROG_LIBTOOL
 AC_DEFUN(AC_PROG_LIBTOOL,
 [AC_PREREQ(2.12.2)dnl
 AC_REQUIRE([AC_ENABLE_SHARED])dnl
 AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_DISABLE_FAST_INSTALL])dnl
 AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 AC_REQUIRE([AC_PROG_RANLIB])dnl
@@ -44,6 +45,9 @@ AC_SUBST(LIBTOOL)dnl
 libtool_flags=
 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = yes && libtool_flags="$libtool_flags --enable-fast-install"
+test "x$lt_cv_dlopen" != xno && libtool_flags="$libtool_flags --enable-dlopen"
+test "x$lt_cv_dlopen_self" = xyes && libtool_flags="$libtool_flags --enable-dlopen-self"
 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
@@ -116,6 +120,42 @@ LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
 exec 5>>./config.log
 ])
 
+# AC_LIBTOOL_DLOPEN - check for dlopen support
+AC_DEFUN(AC_LIBTOOL_DLOPEN,
+[AC_CACHE_VAL(lt_cv_dlopen,
+[lt_cv_dlopen=no lt_cv_dlopen_libs=
+AC_CHECK_FUNC(dlopen, [lt_cv_dlopen="dlopen"],
+  [AC_CHECK_LIB(dl, dlopen, [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+    [AC_CHECK_LIB(dld, dld_link, [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"],
+      [AC_CHECK_FUNC(shl_load, [lt_cv_dlopen="shl_load"],
+        [AC_CHECK_FUNC(LoadLibrary, [lt_cv_dlopen="LoadLibrary"])]
+      )]
+    )]
+  )]
+)])
+
+case "$lt_cv_dlopen" in
+dlopen)
+  AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self,
+    [LT_SAVE_LIBS="$LIBS"; LIBS="$lt_cv_dlopen_libs $LIBS"
+    AC_TRY_RUN([
+#include <dlfcn.h>
+#include <stdio.h>
+fnord() { int i=42;}
+main() { void *self, *ptr1, *ptr2; self=dlopen(0,RTLD_LAZY);
+    if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
+    if(ptr1 || ptr2) exit(0); } exit(1); } 
+], lt_cv_dlopen_self=no, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=cross)
+    LIBS="$LT_SAVE_LIBS"])
+  ;;
+# We should probably test other for NULL support in other dlopening
+# mechanisms too.
+*)
+  lt_cv_dlopen_self=no
+  ;;
+esac
+])
+
 # AC_ENABLE_SHARED - implement the --enable-shared flag
 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
@@ -149,10 +189,6 @@ enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
 AC_DEFUN(AC_DISABLE_SHARED,
 [AC_ENABLE_SHARED(no)])
 
-# AC_DISABLE_STATIC - set the default static flag to --disable-static
-AC_DEFUN(AC_DISABLE_STATIC,
-[AC_ENABLE_STATIC(no)])
-
 # AC_ENABLE_STATIC - implement the --enable-static flag
 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
@@ -182,6 +218,44 @@ esac],
 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
 ])
 
+# AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN(AC_DISABLE_STATIC,
+[AC_ENABLE_STATIC(no)])
+
+
+# AC_DISABLE_FAST_INSTALL - implement the --enable-fast-install flag
+# Usage: AC_DISABLE_FAST_INSTALL[(DEFAULT)]
+#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
+#   `yes'.
+AC_DEFUN(AC_DISABLE_FAST_INSTALL,
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, yes, no))dnl
+AC_ARG_ENABLE(fast-install,
+changequote(<<, >>)dnl
+<<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+  enable_fast_install=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_fast_install=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
+])
+
+# AC_ENABLE_FAST_INSTALL - set the default to --enable-fast-install
+AC_DEFUN(AC_ENABLE_FAST_INSTALL,
+[AC_DISABLE_FAST_INSTALL(no)])
+
 
 # AC_PROG_LD - find the path to the GNU or non-GNU linker
 AC_DEFUN(AC_PROG_LD,
@@ -546,6 +620,12 @@ 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)
+AC_CHECK_LIB(m, cos)
+])
+
 dnl old names
 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
index e45b382f7211b8959a0821862b40a2155c485797..afc69ca947f96f67dbbbf8a408fbbbe6d413b6f4 100755 (executable)
@@ -153,6 +153,10 @@ sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
 # Same as above, but do not quote variable references.
 double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
 
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
 # The name of this program.
 progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'`
 
@@ -173,6 +177,9 @@ can_build_shared=yes
 enable_shared=yes
 # All known linkers require a `.a' archive for static linking.
 enable_static=yes
+enable_fast_install=no
+enable_dlopen=unknown
+enable_dlopen_self=unknown
 ltmain=
 silent=
 srcdir=
@@ -225,6 +232,9 @@ Generate a system-specific libtool script.
     --debug                enable verbose shell tracing
     --disable-shared       do not build shared libraries
     --disable-static       do not build static libraries
+    --enable-fast-install  optimize for fast installation
+    --enable-dlopen        enable dlopen support
+    --enable-dlopen-self   enable support for dlopening programs
     --help                 display this help and exit
     --no-verify            do not verify that HOST is a valid host type
 -o, --output=FILE          specify the output file [default=$default_ofile]
@@ -253,6 +263,12 @@ EOM
 
   --disable-static) enable_static=no ;;
 
+  --enable-fast-install) enable_fast_install=yes ;;
+
+  --enable-dlopen) enable_dlopen=yes ;;
+
+  --enable-dlopen-self) enable_dlopen_self=yes ;;
+
   --quiet | --silent) silent=yes ;;
 
   --srcdir) prev=srcdir ;;
@@ -1002,7 +1018,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=
@@ -1014,6 +1030,16 @@ hardcode_direct=no
 hardcode_minus_L=no
 hardcode_shlibpath_var=unsupported
 runpath_var=
+always_export_symbols=no
+export_symbols_cmds='$NM $libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
+# include_expsyms should be a list of space-separated symbols to be *always*
+# included in the symbol list
+include_expsyms=
+# exclude_expsyms can be an egrep regular expression of symbols to exclude
+# it will be wrapped by `^(' and `) ', so one must not match beginning or
+# end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+# as well as any symbol that contains `d'.
+exclude_expsyms=
 
 case "$host_os" in
 aix3* | aix4*)
@@ -1029,6 +1055,11 @@ cygwin* | mingw*)
     with_gnu_ld=no
   fi
   ;;
+
+freebsd2* | sunos4*)
+  exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+  ;;
+
 esac
 
 ld_shlibs=yes
@@ -1054,7 +1085,7 @@ if test "$with_gnu_ld" = yes; then
 
   beos*)
     if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
-      archive_cmds='$CC -nostart ${wl}-soname $wl$soname -o $lib $libobjs $deplibs $linkopts'
+      archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
     else
       ld_shlibs=no
     fi
@@ -1065,34 +1096,36 @@ 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
 
-    archive_cmds='rm -f $objdir/$soname-ltdll.c~
+    # Extract the symbol export list from an `--export-all' def file,
+    # then regenerate the def file from the symbol export list, so that
+    # the compiled dll only exports the symbol export list.
+    export_symbols_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 --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs~
+      $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def  $objdir/$soname-ltdll.$objext $libobjs~
+      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]* ; *//" < $objdir/$soname-def > $export_symbols'
+
+    archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~
+      _lt_hint=1;
+      for symbol in `cat $export_symbols`; do
+        echo " \$symbol @ \$_lt_hint ; " >> $objdir/$soname-def;
+       _lt_hint=`expr 1 + \$_lt_hint`;
+      done~
       $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-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_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-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_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~
-      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~
-      cat "$export_symbols" >> $objdir/$soname-def~
-      $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-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_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-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_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'
+      old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a'
     ;;
 
   *)
     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_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
     else
       ld_shlibs=no
     fi
@@ -1110,9 +1143,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
@@ -1137,9 +1169,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
@@ -1226,9 +1257,9 @@ else
 
   irix5* | irix6*)
     if test "$with_gcc" = yes; then
-      archive_cmds='$CC -shared -o $lib ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` $libobjs $deplibs $linkopts'
+      archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
     else
-      archive_cmds='$LD -shared -o $lib -soname $soname `test -n "$verstring" && echo -set_version $verstring` $libobjs $deplibs $linkopts'
+      archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
     fi
     hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
     hardcode_libdir_separator=:
@@ -1263,10 +1294,10 @@ else
   osf3* | osf4*)
     if test "$with_gcc" = yes; then
       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-      archive_cmds='$CC -shared${allow_undefined_flag} -o $lib ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` $libobjs $deplibs $linkopts'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
     else
       allow_undefined_flag=' -expect_unresolved \*'
-      archive_cmds='$LD -shared${allow_undefined_flag} -o $lib -soname $soname `test -n "$verstring" && echo -set_version $verstring` $libobjs $deplibs $linkopts'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
     fi
     hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
     hardcode_libdir_separator=:
@@ -1282,8 +1313,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
     ;;
@@ -1533,13 +1564,6 @@ else
 fi
 echo "$ac_t$hardcode_action" 1>&6
 
-# Check relinking.
-echo $ac_n "checking whether relinking is necessary... $ac_c" 1>&6
-must_relink=no
-if test "$hardcode_action" = relink || test "$shlibpath_overrides_runpath" != yes; then
-  must_relink=yes
-fi
-echo "$ac_t$must_relink" 1>&6
 
 reload_flag=
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
@@ -1562,7 +1586,7 @@ shlibpath_overrides_runpath=unknown
 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.
@@ -1571,7 +1595,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
@@ -1622,13 +1646,13 @@ bsdi4*)
 cygwin* | mingw*)
   version_type=windows
   if test "$with_gcc" = yes; then
-    library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
+    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'
   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
@@ -1644,16 +1668,19 @@ 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
+      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+      need_version=no
+      need_lib_prefix=no
       ;;
     freebsd-*)
       deplibs_check_method=unknown
+      library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+      need_version=yes
       ;;
   esac
-  library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
-  finish_cmds='PATH="$PATH:/sbin" OBJFORMAT="$objformat" ldconfig -m $libdir'
+  finish_cmds='PATH="$PATH:/sbin" OBJFORMAT="'"$objformat"'" ldconfig -m $libdir'
   shlibpath_var=LD_LIBRARY_PATH
-  need_version=yes
   ;;
 
 gnu*)
@@ -1677,16 +1704,17 @@ hpux9* | hpux10* | hpux11*)
   ;;
 
 irix5*)
-  version_type=osf
+  version_type=irix
   soname_spec='${libname}${release}.so'
   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
+  shlibpath_overrides_runpath=no
   ;;
 
 irix6*)
-  version_type=osf
+  version_type=irix
   need_lib_prefix=no
   need_version=no
   soname_spec='${libname}${release}.so'
@@ -1698,9 +1726,10 @@ irix6*)
   *) libsuff= shlibsuff= libmagic=never-match;;
   esac
   shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
   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.
@@ -1719,7 +1748,7 @@ linux-gnu*)
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   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'
@@ -1735,11 +1764,11 @@ linux-gnu*)
 netbsd*)
   version_type=sunos
   if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}.so$versuffix'
+    library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
     finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir'
     dynamic_linker='NetBSD (a.out) ld.so'
   else
-    library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so'
+    library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
     soname_spec='${libname}${release}.so$major'
     dynamic_linker='NetBSD ld.elf_so'
   fi
@@ -1752,7 +1781,7 @@ openbsd*)
     need_lib_prefix=no
     need_version=no
   fi
-  library_names_spec='${libname}${release}.so$versuffix'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   ;;
@@ -1791,7 +1820,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*)
@@ -1844,6 +1873,14 @@ test "$dynamic_linker" = no && can_build_shared=no
 # Report the final consequences.
 echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6
 
+# Check relinking.
+echo $ac_n "checking whether relinking is necessary... $ac_c" 1>&6
+must_relink=no
+if test "$hardcode_action" = relink || test "$shlibpath_overrides_runpath" != yes; then
+  must_relink=yes
+fi
+echo "$ac_t$must_relink" 1>&6
+
 echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
 test "$can_build_shared" = "no" && enable_shared=no
 
@@ -1903,20 +1940,20 @@ 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_cmds 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 | \
+    export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
     postinstall_cmds | postuninstall_cmds | \
     finish_cmds | sys_lib_search_path_spec)
       # Double-quote double-evaled strings.
-      eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\"\`\\\""
+      eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
       ;;
     *)
       eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
@@ -2017,6 +2054,9 @@ build_libtool_libs=$enable_shared
 # Whether or not to build static libraries.
 build_old_libs=$enable_static
 
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
 # The host system.
 host_alias=$host_alias
 host=$host
@@ -2079,6 +2119,12 @@ need_lib_prefix=$need_lib_prefix
 # Do we need a version for libraries?
 need_version=$need_version
 
+# Whether dlopen is supported.
+dlopen=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
 # Compiler flag to prevent dynamic linking.
 link_static_flag=$link_static_flag
 
@@ -2118,7 +2164,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
 
@@ -2126,7 +2172,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
@@ -2185,6 +2231,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_cmds=$export_symbols_cmds
+
+# 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
index 6149f221c9f1c894e9384a319a4a0397ff50351c..53a99bad1f57a0bf22768464e56faff89ea9d8a7 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -794,10 +794,11 @@ compiler."
     avoid_version=no
     dlfiles=
     dlprefiles=
+    dlself=no
     export_dynamic=no
     export_symbols=
+    export_symbols_regex=
     generated=
-    hardcode_libdirs=
     libobjs=
     ltlibs=
     module=no
@@ -854,6 +855,15 @@ compiler."
          fi
          case "$arg" in
          *.la | *.lo) ;;  # We handle these cases below.
+         self)
+           if test "$prev" = dlprefiles; then
+             dlself=yes
+           elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+             dlself=yes
+           fi
+           prev=
+           continue
+           ;;
          *)
            dlprefiles="$dlprefiles $arg"
            test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
@@ -861,7 +871,7 @@ compiler."
            ;;
          esac
          ;;
-       exportsyms)
+       expsyms)
          export_symbols="$arg"
          if test ! -f "$arg"; then
            $echo "$modename: symbol file \`$arg' does not exist"
@@ -870,6 +880,11 @@ compiler."
          prev=
          continue
          ;;
+       expsyms_regex)
+         export_symbols_regex="$arg"
+         prev=
+         continue
+         ;;
        release)
          release="-$arg"
          prev=
@@ -932,20 +947,19 @@ compiler."
          else
            arg=
          fi
-         if test "$preload" = no; then
-           # Add the symbol object into the linking commands.
-           compile_command="$compile_command @SYMFILE@"
-           preload=yes
-         fi
        fi
        ;;
 
-      -export-symbols)
-       if test -n "$export_symbols"; then
+      -export-symbols | -export-symbols-regex)
+       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
          $echo "$modename: cannot have more than one -exported-symbols"
          exit 1
        fi
-       prev=exportsyms
+       if test "$arg" = "-export-symbols"; then
+         prev=expsyms
+       else
+         prev=expsyms_regex
+       fi
        continue
        ;;
 
@@ -1059,7 +1073,7 @@ compiler."
        # A library object.
        if test "$prev" = dlfiles; then
          dlfiles="$dlfiles $arg"
-         if test "$build_libtool_libs" = yes; then
+         if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
            prev=
            continue
          else
@@ -1127,8 +1141,8 @@ compiler."
        # This library was specified with -dlopen.
        if test "$prev" = dlfiles; then
          dlfiles="$dlfiles $arg"
-         if test -z "$dlname" || test "$build_libtool_libs" = no; then
-           # If there is no dlname or we're linking statically,
+         if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
+           # If there is no dlname, no dlopen support or we're linking statically,
            # we need to preload.
            prev=dlprefiles
          else
@@ -1179,11 +1193,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%^.*/%%'`
@@ -1400,6 +1409,20 @@ compiler."
        case "$version_type" in
        none) ;;
 
+       irix)
+         major=`expr $current - $age + 1`
+         versuffix="$major.$revision"
+         verstring="sgi$major.$revision"
+
+         # Add in all the interfaces that we are compatible with.
+         loop=$revision
+         while test $loop != 0; do
+           iface=`expr $revision - $loop`
+           loop=`expr $loop - 1`
+           verstring="sgi$major.$iface:$verstring"
+         done
+         ;;
+
        linux)
          major=.`expr $current - $age`
          versuffix="$major.$age.$revision"
@@ -1759,6 +1782,7 @@ compiler."
       fi
 
       dep_rpath=
+      hardcode_libdirs=
       if test -n "$rpath$xrpath" && test "$hardcode_into_libs" = yes && test -n "$hardcode_libdir_flag_spec"; then
        for dir in $rpath $xrpath; do
          libdir="$dir"
@@ -1933,7 +1957,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"
@@ -2066,14 +2090,47 @@ 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 -z "$export_symbols"; then
+         if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+           $show "generating symbol list for \`$libname.la'"
+           export_symbols="$objdir/$libname.exp"
+           $run $rm $export_symbols
+           eval cmds=\"$export_symbols_cmds\"
+           IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
+           for cmd in $cmds; do
+             IFS="$save_ifs"
+             $show "$cmd"
+             $run eval "$cmd" || exit $?
+           done
+           IFS="$save_ifs"
+           if test -n "$export_symbols_regex"; then
+             $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"$export_symbols\"T"
+             $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "$export_symbols"T'
+             $show "$mv \"$export_symbols\"T \"$export_symbols\""
+             $run eval '$mv "$export_symbols"T "$export_symbols"'
+           fi
+         fi
+       fi
+
+       if test -n "$export_symbols" && test -n "$include_expsyms"; then
+         $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+       fi
+
        # Make a backup of the uninstalled library when relinking
        if test "$relink" = yes && test "$hardcode_into_libs" = yes ; then
          $run eval '(cd $output_objdir && $rm "$realname"U && $mv $realname "$realname"U)' || exit $?
        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
@@ -2210,6 +2267,17 @@ EOF
        $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
       fi
 
+      if test "$preload" = yes; then
+       if test "$dlopen" = unknown || test "$dlopen_self" = unknown; then
+         $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+       fi 
+      fi
+    
+      if test "$dlself" = yes && test "$export_dynamic" = no; then
+       $echo "$modename: error: \`-dlopen self' requires \`-export-dynamic'" 1>&2
+       exit 1
+      fi
+       
       # Find libtool libraries and add their dependencies/rpaths
       newdeplibs=
       newdependency_libs=
@@ -2539,9 +2607,10 @@ EOF
       done
       
       deplibs="$newdeplibs"
-      dep_rpath=
 
       # Now hardcode the library paths
+      dep_rpath=
+      hardcode_libdirs=
       if test -n "$rpath$xrpath"; then
        # If the user specified any rpath flags, then add them.
        for libdir in $rpath $xrpath; do
@@ -2599,10 +2668,13 @@ EOF
        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
       fi
 
-      if test "$export_dynamic" = yes || test -n "$dlfiles$dlprefiles" && test -n "$NM" && test -n "$global_symbol_pipe"; then
-       dlsyms="${outputname}S.c"
-      else
-       dlsyms=
+      dlsyms=
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" = yes; then
+        if test -n "$NM" && test -n "$global_symbol_pipe"; then
+         dlsyms="${outputname}S.c"
+       else
+         $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+       fi
       fi
 
       if test -n "$dlsyms"; then
@@ -2641,7 +2713,7 @@ extern \"C\" {
 /* External symbol declarations for the compiler. */\
 "
 
-         if test "$export_dynamic" = yes; then
+         if test "$dlself" = yes; then
            if test -n "$export_symbols"; then
              $run eval 'sed -e "s/^\(.*\)/\1 \1/" < "$export_symbols" > "$nlist"'
            else
@@ -2665,11 +2737,16 @@ extern \"C\" {
 
            # Try sorting and uniquifying the output.
            if sort "$nlist" | uniq > "$nlist"T; then
-             mv -f "$nlist"T "$nlist"
+             $mv "$nlist"T "$nlist"
            else
              $rm "$nlist"T
            fi
 
+           if test -n "$exclude_expsyms"; then
+             egrep -v "^($exclude_expsyms) " "$nlist" > "$nlist"T
+             $mv "$nlist"T "$nlist"
+           fi
+
            if test -f "$nlist"; then
              sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$output_objdir/$dlsyms"
            else
@@ -2696,11 +2773,10 @@ lt_preloaded_symbols[] =
 {\
 "
 
-           # First entry is always the program itself
-           echo >> "$output_objdir/$dlsyms" "\
-  {\"${output}\", (lt_ptr_t) 0},"
-
-           if test "$export_dynamic" = yes; then
+           if test "$dlself" = yes; then
+             # First entry is the program itself
+             echo >> "$output_objdir/$dlsyms" "\
+  {\"@PROGRAM@\", (lt_ptr_t) 0},"
              if test -n "$export_symbols"; then
                sed 's/^\(.*\)/  {"\1", (lt_ptr_t) \&\1},/' < "$export_symbols" >> "$output_objdir/$dlsyms"
              else
@@ -2708,7 +2784,13 @@ lt_preloaded_symbols[] =
                for arg in $progfiles; do
                  eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
                done
+
                if test -f "$nlist"; then
+                 if test -n "$exclude_expsyms"; then
+                   egrep -v "^($exclude_expsyms) " "$nlist" > "$nlist"T
+                   $mv "$nlist"T "$nlist"
+                 fi
+
                  sed 's/^\(.*\) \(.*\)$/  {"\1", (lt_ptr_t) \&\2},/' < "$nlist" >> "$output_objdir/$dlsyms"
                else
                  echo '/* NONE */' >> "$output_objdir/$dlsyms"
@@ -2723,6 +2805,11 @@ lt_preloaded_symbols[] =
              eval "$NM $arg | $global_symbol_pipe > '$nlist'"
 
              if test -f "$nlist"; then
+               if test -n "$exclude_expsyms"; then
+                 egrep -v "^($exclude_expsyms) " "$nlist" > "$nlist"T
+                 $mv "$nlist"T "$nlist"
+               fi
+
                sed 's/^\(.*\) \(.*\)$/  {"\1", (lt_ptr_t) \&\2},/' < "$nlist" >> "$output_objdir/$dlsyms"
              else
                echo '/* NONE */' >> "$output_objdir/$dlsyms"
@@ -2761,10 +2848,7 @@ static const void *lt_preloaded_setup() {
        # We keep going just in case the user didn't refer to
        # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
        # really was required.
-       if test -n "$dlfiles$dlprefiles"; then
-         $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
-       fi
-
+       
        # Nullify the symbol file.
        compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
       fi
diff --git a/mail/sgi b/mail/sgi
deleted file mode 100644 (file)
index ff0ab51..0000000
--- a/mail/sgi
+++ /dev/null
@@ -1,137 +0,0 @@
-From Janos.Farkas-nouce/priv-#5HYEEI07/9C6uVbFUutOXk6szqe@lk9qw.mail.eon.ml.org Tue Mar 31 15:39:15 1998
-X-From-Line: Janos.Farkas-nouce/priv-#5HYEEI07/9C6uVbFUutOXk6szqe@lk9qw.mail.eon.ml.org Tue Mar 31 15:39:15 1998
-Return-Path: <Janos.Farkas-nouce/priv-#5HYEEI07/9C6uVbFUutOXk6szqe@lk9qw.mail.eon.ml.org>
-Delivered-To: gord@trick.profitpress.com
-Received: (qmail 903 invoked from network); 31 Mar 1998 15:39:14 -0000
-Received: from unknown (HELO bambam.m-tech.ab.ca) (127.0.0.1)
-  by 127.0.0.1 with SMTP; 31 Mar 1998 15:39:14 -0000
-Received: from mi5.satimex.tvnet.hu (gateway.m-tech.ab.ca [10.0.0.1]) by bambam.m-tech.ab.ca (8.8.5/8.6.9) with SMTP id DAA25302 for <gord@m-tech.ab.ca>; Mon, 30 Mar 1998 03:28:54 -0700
-Received: (qmail 3288 invoked by uid 2001); 30 Mar 1998 10:36:04 -0000
-Date: Mon, 30 Mar 1998 12:36:04 +0200
-From: Janos Farkas <Janos.Farkas-nouce/priv-#UiTVSa/OAc8mBkHH9CeLgE.uMWK@lk9qw.mail.eon.ml.org>
-To: Ian Lance Taylor <ian@cygnus.com>, gord@m-tech.ab.ca
-Cc: bug-libtool@gnu.org, tiemann@cygnus.com
-Subject: Re: Irix shared libraries
-Mail-Followup-To: Ian Lance Taylor <ian@cygnus.com>, gord@m-tech.ab.ca,
-       bug-libtool@gnu.org, tiemann@cygnus.com
-Message-ID: <19980330123604.03725@lk9qw.mail.eon.ml.org>
-References: <86hg4h59tw.fsf@trick.profitpress.com> <199803300034.TAA16378@subrogation.cygnus.com>
-Mime-Version: 1.0
-Content-Type: text/plain; charset=us-ascii
-In-Reply-To: <199803300034.TAA16378@subrogation.cygnus.com>; from Ian Lance Taylor on Sun, Mar 29, 1998 at 07:34:01PM -0500
-Errors-To: Janos Farkas <Janos.Farkas-sys/priv-#5zJlUoBBccl/-errors@lk9qw.mail.eon.ml.org>
-Xref: trick.profitpress.com mail.libtool:1249
-Lines: 44
-X-Gnus-Article-Number: 1   Wed Nov  4 08:02:28 1998
-
-On 1998-03-29 at 19:34:01, Ian Lance Taylor wrote:
->    From: Gordon Matzigkeit <gord@m-tech.ab.ca>
->    Date: 29 Mar 1998 16:57:47 -0700
-> 
->    Do you have access to the IRIX ld man pages?  I don't know why it's
->    complaining about `non-sgi' interface versions.  I was under the
->    impression that any colon-separated list of strings would do.
-> 
-> Here is the entire ld man page, but it does not appear particularly
-> helpful.
-
-I just realized I also have mortal access to an SGI system, and found
-this in the dso.5 page, this looks more informative :)
-
-   Versioning of Shared Objects.
-
-   QUICK OVERVIEW
-
-   For a shared object to be versioned
-   the following needs to be done:
-
-   * Version strings consist of 3 parts and a dot: The string "sgi",
-     a decimal number (the major number), a dot, and a decimal number
-     (the minor number).
-
-   * Add the command -set_version sgi1.0 to the command to build
-     the shared object (cc -shared, ld -shared, etc.).
-
-   * Whenever you make a COMPATIBLE change update the minor version
-     number (the one after the dot), and add the latest version string
-     to colon-separated list of version strings, e.g., -set_version
-     sgi1.0:sgi1.1:sgi1.3
-
-   * Whenever you make an INCOMPATIBLE change, update the
-     major version number.  Pass this as the version list, e.g.,
-     -set_version sgi2.0.  Change the filename of the OLD shared object
-     by adding a dot followed by the previous major number to the filename
-     of the shared object.  DO NOT CHANGE the soname of the object.
-     No change to the file contents are necessary or desirable.  Simply
-     rename the file.
-
--- 
-Janos - Don't worry, my address is real.  I'm just bored of spam.
-
-From nobody Wed Oct 14 16:54:11 1998
-X-From-Line: gord@gnu.org Fri Jul 03 02:26:01 1998
-Return-Path: <gord@gnu.org>
-Delivered-To: gord@trick.fig.org
-Received: (qmail 9753 invoked from network); 3 Jul 1998 02:25:59 -0000
-Received: from unknown (HELO bambam.m-tech.ab.ca) (127.0.0.1)
-  by 127.0.0.1 with SMTP; 3 Jul 1998 02:25:59 -0000
-Received: from mescaline.gnu.org (gateway [10.0.0.1]) by bambam.m-tech.ab.ca (8.8.5/8.6.9) with ESMTP id SAA13535 for <gord@m-tech.ab.ca>; Thu, 2 Jul 1998 18:34:06 -0600
-Received: from platinum.math.arizona.edu by mescaline.gnu.org (8.8.5/8.6.12GNU) with ESMTP id UAA09573 for <bug-libtool@gnu.org>; Thu, 2 Jul 1998 20:41:52 -0400
-Date: Fri, 3 Jul 1998 00:40:12 GMT
-Message-Id: <199807030040.AAA16739@platinum.math.arizona.edu>
-Received: by platinum.math.arizona.edu; Fri, 3 Jul 1998 00:40:12 GMT
-From: "Robert S. Maier" <rsm@math.arizona.edu>
-To: bug-libtool@gnu.org
-Subject: misc. libtool bugs
-Phase-of-Moon: Waxing Gibbous (62% of Full)
-Organization: Mathematics Department, University of Arizona
-Xref: trick.fig.org mail.libtool:1516
-Lines: 46
-X-Gnus-Article-Number: 2   Wed Nov  4 08:02:28 1998
-
-Through installing the plotutils package on several platforms, I've turned
-up a few additional bugs in libtool-1.2.  Here they are...
-
-1. The plotutils package uses libtool to link together a shared library,
-`libplot'.  It also compiles several executables, each in its own
-subdirectory, and links them with `libplot'.  It then runs tests on the
-executables.  
-
-By looking at the test output I figured out that the version of libplot
-that gets linked with the executables is by default the previously
-installed version (if any), rather than the one that that's just been
-built.  This happens under IRIX 5.3 and 6.4, when compiling with both cc
-and gcc.  Probably on other platforms as well.
-
-I assume there's something wrong with LD_LIBRARY_PATH.  But the shell
-scripts that libtool generates (i.e., the pseudo-executables) contain the
-lines
-
-    # Add our own library path to LD_LIBRARY_PATH
-    LD_LIBRARY_PATH="$thisdir/../libplot/.libs:$LD_LIBRARY_PATH"
-
-    # Some systems cannot cope with colon-terminated LD_LIBRARY_PATH
-    LD_LIBRARY_PATH=`$echo "X$LD_LIBRARY_PATH" | $Xsed -e 's/:*$//'`
-
-which certainly look right.
-
-A workaround here is to do `rm -f /usr/local/lib/libplot.*' before
-installing the package.  But that's a pretty drastic workaround.
-
-2. At least on those IRIX platforms, there's something buggy about the
-option "-set_version 1.1.2:0.0:1.0" that libtool-1.2 passes to ld.  If
-I compile a version of my `graph' utility that is meant to be linked with
--lXm instead of -lXaw (the default), as well as -lplot, I get the following
-when I go to its subdirectory and try to run it without installing it:
-
-       cosmo$ echo 0 0 1 1 2 0 | graph -TX -C
-                4352:graph: rld: Warning: version search suppressed because object libplot.so in liblist has non-sgi interface version (1.0)
-                4352:graph: rld: Fatal Error: cannot map soname 'libplot.so' using any of the filenames /usr/local/lib/libplot.so:/lib/libplot.so:/usr/lib/libplot.so:/usr/local/ivtools/lib/SGI/libplot.so:/lib/cmplrs/cc/libplot.so:/usr/lib/cmplrs/cc/libplot.so: -- either the file does not exist or the file is not mappable (with reason indicated in previous msg)
-
-Not sure what's going on here.  If I do a `make install', the installed
-version of `graph' functions perfectly.  It's only the uninstalled one,
-built specially to be linked with -lXm, that gives error messages about SGI
-version numbering for -lplot.
-
---Robert
-
index 569000dfb342edd463796c27d5b6421a37f6d1e7..e2b62f446ac15782e8b5c8d8eb915018aa00ea93 100644 (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 = -module -avoid-version
 
 libfoo2_la_SOURCES = foo2.c
-libfoo2_la_LDFLAGS = $(LIBADD_M) -module
+libfoo2_la_LDFLAGS = -module
 
 noinst_HEADERS = foo.h
 
@@ -30,7 +30,8 @@ mdemo_SOURCES = main.c
 mdemo_LDFLAGS = -export-dynamic ## FIXME: remove this when libtool and libltdl
 ## handle dependencies of modules
 ## The quotes around -dlopen below fool automake into accepting it
-mdemo_LDADD = ../libltdl/libltdl.la "-dlopen" foo1.la "-dlopen" libfoo2.la
+mdemo_LDADD = ../libltdl/libltdl.la "-dlopen" self \
+               "-dlopen" foo1.la "-dlopen" libfoo2.la
 mdemo_DEPENDENCIES = ../libltdl/libltdl.la foo1.la libfoo2.la
 
 # Create a statically linked version of mdemo.
index c29c35906599edc4deb4dbdba01ab41dd49eebeb..ebada43b61738db27ba98ce2d47fa305328745a1 100644 (file)
@@ -5,6 +5,7 @@ AM_INIT_AUTOMAKE(mdemo,0.1)
 AC_PROG_CC
 AC_C_CONST
 AC_EXEEXT
+AC_LIBTOOL_DLOPEN
 AM_PROG_LIBTOOL
 
 if ${CONFIG_SHELL} ./libtool --features | grep "enable static" >/dev/null; then
@@ -16,8 +17,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)
index 53f86f5de6b7e438b94b78da11f8cf01c9188963..8355f0c902140eb87562c8eab5924015d7f40f17 100644 (file)
@@ -78,6 +78,51 @@ test_dl (filename)
   return 0;
 }
 
+int
+myfunc ()
+{
+  return HELLO_RET;
+}
+
+int myvar;
+
+int
+test_dlself ()
+{
+  lt_dlhandle handle;  
+  int (*pmyfunc)() = 0;
+  int *pmyvar = 0;
+
+  handle = lt_dlopen(0);
+  if (!handle) {
+    fprintf (stderr, "can't dlopen the program!\n");
+    fprintf (stderr, "error was: %s\n", lt_dlerror());
+    return 1;
+  }
+  pmyfunc = (int(*)())lt_dlsym(handle, "myfunc");  
+  pmyvar  = (int*)lt_dlsym(handle, "myvar");  
+
+  if (pmyfunc)
+    {
+      int value = (*pmyfunc) ();
+      
+      printf ("myfunc returned: %i\n", value);
+      if (value == HELLO_RET)
+        printf("myfunc is ok!\n");
+    }
+  else
+    fprintf (stderr, "did not find the `myfunc' function\n");
+
+  /* Try assigning to the variable. */
+  if (pmyvar)
+    *pmyvar = 1;
+  else
+    fprintf (stderr, "did not find the `myvar' variable\n");
+
+  lt_dlclose(handle);
+  return 0;
+}
+
 int
 main (argc, argv)
   int argc;
@@ -101,6 +146,9 @@ main (argc, argv)
     if (test_dl(argv[i]))
        return 1;
 
+  if (test_dlself())
+    return 1;
+
   lt_dlexit();
   return 0;
 }