]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
*** empty log message ***
authorThomas Tanner <tanner@gmx.de>
Fri, 18 Dec 1998 22:23:51 +0000 (22:23 +0000)
committerThomas Tanner <tanner@gmx.de>
Fri, 18 Dec 1998 22:23:51 +0000 (22:23 +0000)
13 files changed:
ChangeLog
doc/libtool.texi
libltdl/Makefile.am
libltdl/configure.in
libltdl/ltdl.c
libltdl/ltdl.h
ltconfig.in
ltmain.in
mdemo/Makefile.am
mdemo/README
mdemo/configure.in
mdemo/main.c
tests/sh.test

index 93c6f0a920800c4185eb8b22a96ae5bbd21c67ca..161bf6e693fabcf062eddbf890a68dd7ebd78933 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+1998-12-18  Thomas Tanner  <tanner@gmx.de>
+
+       * ltconfig.in: added need_lib_prefix and need_version,
+         which determine whether we must prefix modules with 'lib'
+         and whether versioning is required for libraries.
+       * ltmain.in: allow modules names without 'lib' prefix, 
+         new -avoid-versioning option
+       * doc/libtool.texi (link flags): updated documentation for -module,
+         added -avoid-versioning
+       * doc/libtool.texi (libtool script contents): 
+         documented the two new flags and archive_sym_cmds
+       * doc/libtool.texi (tests): 
+         added (partially very short) documentation for assign.test, 
+         nomode.test, quote.test, sh.test
+       * libltdl/ltdl.c: canonicalize module names, 
+         some cleanups and bugfixes,  __ptr_t is predefined on 
+         some systems - use lt_ptr_t instead
+       * mdemo/: renamed hell* to mdemo* (hell is already used in
+         demo), updated the documentation, import sin and cos in main
+         program rather than linking libfoo1 statically
+
 1998-12-17  Gary V. Vaughan  <gvaughan@oranda.demon.co.uk>
 
        * libtool.m4 (AM_PROG_LIBTOOL): Added AC_PREREQ(2.12) to prevent
index 3ad7c2c9225b4481057a41a3865c96033fa05f91..30087de04551b173c87cd4afbd96f77144d00aa0 100644 (file)
@@ -1135,6 +1135,11 @@ If @var{output-file} is a program, then do not link it against any
 shared libraries at all.  If @var{output-file} is a library, then only
 create a static library.
 
+@item -avoid-versioning
+Tries to avoid versioning (@pxref{Versioning}) for libraries and modules,
+i.e. no version information is stored and no symbolic links are created.
+If the platform requires versioning, this option has no effect.
+
 @item -dlopen @var{file}
 Same as @samp{-dlpreopen @var{file}}, if native dlopening is not
 supported on the host platform (@pxref{Dlopened modules}).  Otherwise,
@@ -1168,6 +1173,9 @@ Creates a library that can be dlopenend (@pxref{Dlopened modules}).
 This option doesn't work for programs and must not be used 
 together with @samp{-export-symbols}.
 It implies the option @samp{-export-dynamic}.
+Module names don't need to be prefixed with 'lib'.
+In order to prevent name clashes, however, 'libname' and 'name' 
+must not be used at the same time.
 
 @item -no-undefined
 Declare that @var{output-file} does not depend on any other libraries.
@@ -2551,6 +2559,12 @@ Here is a list of the current programs in the test suite, and what they
 test for:
 
 @table @file
+
+@item assign.test
+@pindex assign.test
+Checks whether we don't put break or continue on the same 
+line as an assignment in the libtool script.
+
 @item demo-conf.test
 @itemx demo-exec.test
 @itemx demo-inst.test
@@ -2609,6 +2623,18 @@ library works properly.
 This test makes sure that files ending in @samp{.lo} are never linked
 directly into a program file.
 
+@item nomode.test
+@pindex nomode.test
+Check whether we can actually get help for libtool.
+
+@item quote.test
+@pindex quote.test
+This program checks libtool's metacharacter quoting.
+
+@item sh.test
+@pindex sh.test
+Checks whether a `test' command was forgotton in libtool.
+
 @item suffix.test
 @pindex suffix.test
 When other programming languages are used with libtool (@pxref{Other
@@ -2616,11 +2642,6 @@ languages}), the source files may end in suffixes other than @samp{.c}.
 This test validates that libtool can handle suffixes for all the file
 types that it supports, and that it fails when the suffix is invalid.
 
-@item test-e.test
-@pindex test-e.test
-This program checks that the @code{test -e} construct is @emph{never}
-used in the libtool scripts.  Checking for the existence of a file can
-only be done in a portable way by using @code{test -f}.
 @end table
 
 @node When tests fail
@@ -3018,8 +3039,10 @@ aren't defined in that library.
 @end defvar
 
 @defvar archive_cmds
+@defvarx archive_sym_cmds
 @defvarx old_archive_cmds
 Commands used to create shared and static libraries, respectively.
+archive_sym_cmds is used when -export-symbols was defined.
 @end defvar
 
 @defvar build_libtool_libs
@@ -3125,6 +3148,16 @@ Linker flag (passed through the C compiler) used to prevent dynamic
 linking.
 @end defvar
 
+@defvar need_lib_prefix
+Whether libtool should automatically prefix module names with 'lib'.
+Set to @samp{yes} or @samp{no}.
+@end defvar
+
+@defvar need_version
+Whether versioning is required for libraries.
+Set to @samp{yes} or @samp{no}.
+@end defvar
+
 @defvar no_builtin_flag
 Compiler flag to disable builtin functions that conflict with declaring
 external global symbols as @code{char}.
index b411f2709a608a4290f5789744375c54186eaa6e..b5a3f086059c7b225e16d7ac1767a95cfc30a347 100644 (file)
@@ -9,7 +9,7 @@ noinst_LTLIBRARIES = libltdl.la
 libltdl_la_SOURCES = ltdl.c
 libltdl_la_LDFLAGS = $(LIBADD_DL) 
 
-noinst_HEADERS = ltdl.h
+include_HEADERS = ltdl.h
 
 # rebuild the libtool script if needed
 ltdl.lo: libtool
index 70525881fbba705ab4e6eb10d36e6f35aa3b0402..a1dfbb9114e3642eb2e9c7cb1b02a4161700163d 100644 (file)
@@ -6,7 +6,7 @@ AC_PROG_CC
 AM_PROG_LIBTOOL
 
 AC_HEADER_STDC
-AC_CHECK_HEADERS(malloc.h memory.h stdlib.h unistd.h stdio.h dlfcn.h dl.h)
+AC_CHECK_HEADERS(malloc.h memory.h stdlib.h unistd.h stdio.h ctype.h dlfcn.h dl.h)
 AC_CHECK_HEADERS(string.h strings.h, break)
 AC_CHECK_FUNCS(strdup strrchr rindex)
 
index 0a241c2ea07f9384853b2bce88509da129ea6e92..78872cbbf09f6288d818d7ffa18e27ef2df8b1a6 100644 (file)
@@ -27,6 +27,10 @@ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #include <strings.h>
 #endif
 
+#if HAVE_CTYPE_H
+#include <ctype.h>
+#endif
+
 #if HAVE_MALLOC_H
 #include <malloc.h>
 #endif
@@ -55,7 +59,7 @@ typedef struct lt_dltype_t {
        int (*mod_exit) __P((void));
        int (*lib_open) __P((lt_dlhandle handle, const char *filename));
        int (*lib_close) __P((lt_dlhandle handle));
-       __ptr_t (*find_sym) __P((lt_dlhandle handle, const char *symbol));
+       lt_ptr_t (*find_sym) __P((lt_dlhandle handle, const char *symbol));
 } lt_dltype_t, *lt_dltype;
 
 #define LT_DLTYPE_TOP NULL
@@ -66,8 +70,8 @@ typedef       struct lt_dlhandle_t {
        char    *filename;      /* file name */
        char    *name;          /* module name */
        int     usage;          /* usage */
-       __ptr_t handle;         /* system handle */
-       __ptr_t sys;            /* system specific data */
+       lt_ptr_t handle;        /* system handle */
+       lt_ptr_t system;        /* system specific data */
 } lt_dlhandle_t;
 
 #if ! HAVE_STRDUP
@@ -166,7 +170,7 @@ dl_close (handle)  lt_dlhandle handle;
        return dlclose(handle->handle);
 }
 
-static __ptr_t
+static lt_ptr_t
 dl_sym (handle, symbol)  lt_dlhandle handle; const char *symbol;
 {
        return dlsym(handle->handle, symbol);
@@ -218,7 +222,7 @@ shl_close (handle)  lt_dlhandle handle;
        return 0;
 }
 
-static __ptr_t
+static lt_ptr_t
 shl_sym (handle, symbol)  lt_dlhandle handle; const char *symbol;
 {
        int status, i;
@@ -263,7 +267,7 @@ dld_open (handle, filename)  lt_dlhandle handle; const char *filename;
 {
        if (dld_link(filename))
                return 1;
-       handle->handle = filename;
+       handle->handle = strdup(filename);
        return 0;
 }
 
@@ -271,10 +275,11 @@ static int
 dld_close (handle)  lt_dlhandle handle;
 {
        dld_unlink_by_file((char*)(handle->handle), 1);
+       free(handle->filename);
        return 0;
 }
 
-static __ptr_t
+static lt_ptr_t
 dld_sym (handle, symbol)  lt_dlhandle handle; const char *symbol;
 {
        return dld_get_func(symbol);
@@ -322,7 +327,7 @@ wll_close (handle)  lt_dlhandle handle;
        return 0;
 }
 
-static __ptr_t
+static lt_ptr_t
 wll_sym (handle, symbol)  lt_dlhandle handle; const char *symbol;
 {
        return GetProcAddress(handle->handle, symbol);
@@ -345,7 +350,7 @@ wll = { LT_DLTYPE_TOP, wll_init, wll_exit,
 struct dld_symlist
 {
   char *name;
-  __ptr_t address;
+  lt_ptr_t address;
 };
 
 extern struct dld_symlist dld_preloaded_symbols[];
@@ -384,7 +389,7 @@ dldpre_close (handle)  lt_dlhandle handle;
        return 0;
 }
 
-static __ptr_t
+static lt_ptr_t
 dldpre_sym (handle, symbol)  lt_dlhandle handle; const char *symbol;
 {
        struct dld_symlist *s = (struct dld_symlist*)(handle->handle);
@@ -527,6 +532,7 @@ lt_dlopen (filename)  const char *filename;
        if (ext && strcmp(ext, ".la") == 0) {
                char    dlname[1024], libdir[1024], deps[1024];
                char    fullname[1024], old_name[1024]; /* FIXME: unchecked */
+               int     i;
                lt_dltype type;
 
                dlname[0] = libdir[0] = deps[0] = old_name[0] = '\0';
@@ -577,10 +583,14 @@ lt_dlopen (filename)  const char *filename;
                                }
                        }
                }       
-               handle->filename = strdup(fullname);
+               handle->filename = strdup(filename);
                /* extract the module name from the file name */
                strcpy(tmp, basename);
                tmp[ext - basename] = '\0';
+               /* canonicalize the modul name */               
+               for (i = 0; i < ext - basename; i++)
+                       if (!isalnum(tmp[i]))
+                               tmp[i] = '_';
                handle->name = strdup(tmp);
        } else {
                /* not a libtool module */
@@ -628,11 +638,11 @@ lt_dlclose (handle)  lt_dlhandle handle;
        return 0;
 }
 
-__ptr_t
+lt_ptr_t
 lt_dlsym (handle, symbol)  lt_dlhandle handle; const char *symbol;
 {
        char    sym[128];
-       __ptr_t address;
+       lt_ptr_t address;
 
        if (handle->name) {     /* libtool module */
 #ifdef NEED_USCORE
index 330e9624b1b014fff7d4e0450d2a1e11d8d3f431..13385134863edb0a5f118f184d2d9e1cfe096758 100644 (file)
@@ -38,19 +38,19 @@ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    that don't understand ANSI C prototypes still work, and ANSI C
    compilers can issue warnings about type mismatches. */
 #undef __P
-#undef __ptr_t
+#undef lt_ptr_t
 #if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32) || defined(__cplusplus)
 # define __P(protos) protos
-# define __ptr_t     void*
+# define lt_ptr_t     void*
 #else
 # define __P(protos) ()
-# define __ptr_t     char*
+# define lt_ptr_t     char*
 #endif
 
 #ifdef _LTDL_COMPILE_
 typedef        struct lt_dlhandle_t *lt_dlhandle;
 #else
-typedef        __ptr_t lt_dlhandle;
+typedef        lt_ptr_t lt_dlhandle;
 #endif
 
 __BEGIN_DECLS
@@ -58,7 +58,7 @@ int           lt_dlinit __P((void));
 int            lt_dlexit __P((void));
 lt_dlhandle    lt_dlopen __P((const char *filename));
 int            lt_dlclose __P((lt_dlhandle handle));
-__ptr_t                lt_dlsym __P((lt_dlhandle handle, const char *name));
+lt_ptr_t       lt_dlsym __P((lt_dlhandle handle, const char *name));
 __END_DECLS
 
 #endif /* !_LTDL_H_ */
index 76a49242ece6654bbc5902b48f5cd267c6f04cb1..19db0e5bed46065f29f8172c701654d2c3953ad2 100755 (executable)
@@ -969,6 +969,8 @@ echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c
 
 allow_undefined_flag=
 no_undefined_flag=
+need_lib_prefix=yes
+need_version=yes
 archive_cmds=
 archive_sym_cmds=
 old_archive_from_new_cmds=
@@ -1603,6 +1605,7 @@ cygwin32* | mingw32*)
   fi
   dynamic_linker='Win32 ld.exe'
   libname_spec='$name'
+  need_lib_prefix=no
   shlibpath_var=PATH
   ;;
 
@@ -1654,6 +1657,8 @@ linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
 # This must be Linux ELF.
 linux-gnu*)
   version_type=linux
+  need_lib_prefix=no
+  need_version=no
   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
   soname_spec='${libname}${release}.so$major'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
@@ -1681,6 +1686,7 @@ netbsd* | openbsd*)
 
 os2*)
   libname_spec='$name'
+  need_lib_prefix=no
   library_names_spec='$libname.dll $libname.a'
   dynamic_linker='OS/2 ld.exe'
   shlibpath_var=LIBPATH
@@ -1970,6 +1976,12 @@ compiler_o_lo=$compiler_o_lo
 # Must we lock files when doing compilation ?
 need_locks=$need_locks
 
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
 # Compiler flag to prevent dynamic linking.
 link_static_flag=$link_static_flag
 
index a2bbc699e44ab71dcfc3ee852484be3a705aeb3a..ea54dd0eff7555b57b4e1fac0637ead1fda96e76 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -580,6 +580,7 @@ compiler."
     deplibs=
     eval lib_search_path=\"$sys_lib_search_path\"
     
+    avoid_versioning=no
     dlfiles=
     dlprefiles=
     export_dynamic=no
@@ -685,6 +686,11 @@ compiler."
        continue
        ;;
 
+      -avoid-versioning)
+       avoid_versioning=yes
+       continue
+       ;;
+
       -dlopen)
         prev=dlfiles
         continue
@@ -1124,17 +1130,26 @@ compiler."
     *.la)
       # Make sure we only generate libraries of the form `libNAME.la'.
       case "$outputname" in
-      lib*) ;;
+      lib*) 
+        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+        eval libname=\"$libname_spec\"
+        ;;
       *)
-       $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
-       $echo "$help" 1>&2
-       exit 1
-       ;;
+        if test "$module" = no; then
+          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+          $echo "$help" 1>&2
+          exit 1
+        fi
+        if test "$need_lib_prefix" = yes; then
+          # Add the "lib" prefix for modules if required
+          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+          eval libname=\"$libname_spec\"
+        else
+          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+        fi
+        ;;
       esac
 
-      name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
-      eval libname=\"$libname_spec\"
-
       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
       if test "X$output_objdir" = "X$output"; then
         output_objdir="$objdir"
@@ -1304,6 +1319,13 @@ compiler."
          esac
        fi
 
+       # Remove version info from name if versioning should be avoided
+       if test "$avoid_versioning" = yes && test "$need_version" = no; then
+         major=
+         versuffix=
+         verstring=""
+       fi
+       
        # Check to see if the archive will have undefined symbols.
        if test "$allow_undefined" = yes; then
          if test "$allow_undefined_flag" = unsupported; then
index f3d06d096eb4ef29421fb4850fde5d514a285bd6..10c322789e2318a644139bc8c98d20a10e8283c7 100644 (file)
@@ -9,25 +9,25 @@ EXTRA_DIST = acinclude.m4
 lib_LTLIBRARIES = libfoo1.la libfoo2.la
 
 libfoo1_la_SOURCES = foo1.c
-libfoo1_la_LDFLAGS = -lm -module
+libfoo1_la_LDFLAGS = -lm -module -avoid-version
 
 libfoo2_la_SOURCES = foo2.c
-libfoo2_la_LDFLAGS = -lm -module -static
+libfoo2_la_LDFLAGS = -lm -module
 
 noinst_HEADERS = foo.h
 
-bin_PROGRAMS = hell hell.debug
+bin_PROGRAMS = mdemo mdemo.debug
 
 # Create a version of hell that does dlopen.
-hell_SOURCES = main.c
-hell_LDADD = ../libltdl/libltdl.la \
+mdemo_SOURCES = main.c
+mdemo_LDADD = ../libltdl/libltdl.la \
        -lm # We won't need this when libltdl takes care of dependencies
-hell_LDFLAGS = -export-dynamic -dlopen libfoo1.la -dlopen libfoo2.la
-hell_DEPENDENCIES = ../libltdl/libltdl.la libfoo1.la libfoo2.la
+mdemo_LDFLAGS = -export-dynamic -dlopen libfoo1.la -dlopen libfoo2.la
+mdemo_DEPENDENCIES = ../libltdl/libltdl.la libfoo1.la libfoo2.la
 
-# Create an easier-to-debug version of hell.
-hell_debug_SOURCES = main.c
-hell_debug_LDADD = ../libltdl/libltdl.la
-hell_debug_LDFLAGS = -static -export-dynamic \
+# Create an easier-to-debug version of mdemo.
+mdemo_debug_SOURCES = main.c
+mdemo_debug_LDADD = ../libltdl/libltdl.la
+mdemo_debug_LDFLAGS = -static -export-dynamic \
        -dlopen libfoo1.la -dlopen libfoo2.la
-hell_DEPENDENCIES = ../libltdl/libltdl.la libfoo1.la libfoo2.la
+mdemo_debug_DEPENDENCIES = ../libltdl/libltdl.la libfoo1.la libfoo2.la
index cb313852a6170d669b7a8c08325b6c3eecb3960d..c6be6bef2f157ec464b1a0f8aaa76830beadacf9 100644 (file)
@@ -1,10 +1,9 @@
-This is GNU modular hell, an example package that uses GNU libtool with an
+This is mdemo, 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'll need a wrapper (libltdl)
-for your dlopen functions. For static libraries we prefix all
-non-static symbols with libname___ using the LTEXP(symbol) macro.
+for your dlopen functions. We prefix all exported symbols with "libname_LTX_".
 When dlopening these static libraries, we cut the prefix off to
 get the real name.
 
index 249a0438df6d9463ab985ba6bb3a5088083db644..284a7c8fae3d45c2243d4fc3a190b42b9024ab39 100644 (file)
@@ -1,6 +1,6 @@
-dnl Initialize the hell package.
+dnl Initialize the mdemo package.
 AC_INIT(main.c)
-AM_INIT_AUTOMAKE(module,0.1)
+AM_INIT_AUTOMAKE(mdemo,0.1)
 
 AC_PROG_CC
 AC_EXEEXT
index e6df0553fd8217ae8a89374a97aab17a9ce77ed1..62e00d3767cafc46bb0396c1414dd71721eb08bf 100644 (file)
@@ -1,4 +1,4 @@
-/* main.c -- hello test program
+/* main.c -- mdemo test program
    Copyright (C) 1996 Free Software Foundation, Inc.
    This file is part of GNU Libtool.
 
@@ -21,6 +21,11 @@ USA. */
 #include "ltdl.h"
 #include <stdio.h>
 #include <string.h>
+#include <math.h>
+
+/* import sin and cos (used by the modules) */
+extern double sin (double x);
+extern double cos (double x);
 
 int
 test_dl (char *filename)
@@ -81,7 +86,7 @@ main (int argc, char **argv)
 {
   int i;
 
-  printf ("Welcome to *modular* GNU Hell!\n");
+  printf ("Welcome GNU libtool mdemo!\n");
 
   if (argc < 2) {
     fprintf (stderr, "usage: %s module [module...]\n", argv[0]);
index 71678600fbca3b38a59e551b1c25577427700a1f..99a92d89ca0d7806f199b57aa959c37ae6b62ed0 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# if.test - check that we haven't forgotten a `test' command
+# sh.test - check that we haven't forgotten a `test' command
 
 # Test script header.
 need_prefix=no