]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
libtool patches from Gord
authorTom Tromey <tromey@redhat.com>
Wed, 19 Mar 1997 04:38:45 +0000 (04:38 +0000)
committerTom Tromey <tromey@redhat.com>
Wed, 19 Mar 1997 04:38:45 +0000 (04:38 +0000)
13 files changed:
ChangeLog
Makefile.am
Makefile.in
automake.in
automake.texi
lib/am/Makefile.am
lib/am/ltlib.am [moved from ltlibs.am with 74% similarity]
lib/am/ltlibrary.am [new file with mode: 0644]
lib/am/progs.am
ltlib-clean.am [new file with mode: 0644]
ltlib.am [new file with mode: 0644]
ltlibrary.am [new file with mode: 0644]
progs.am

index c2b0588818e3183d73175423fe76acd7802c9bbd..4e2c182ae2819a74bdf74f296835a5ccb9683312 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -41,6 +41,14 @@ Fri Feb 28 22:14:53 1997  Tom Tromey  <tromey@cygnus.com>
        * automake.in (usage): Changed bug-reporting address.
        (handle_dist): Use undef, not delete.
 
+Wed Feb 26 08:41:11 1997  Gordon Matzigkeit  <gord@gnu.ai.mit.edu>
+
+       * automake.in (%obsolete_macros): Reintroduce, with hints for what
+       to do to upgrade the support.
+
+       * automake.in, ltlib-clean.am, ltlib.am, ltlibrary.am: Revamped
+       libtool support to use the _LTLIBRARIES primary.
+
 Wed Feb 26 00:20:39 1997  Tom Tromey  <tromey@cygnus.com>
 
        * automake.in (handle_tags): In default case, add @tags_deps to
index d5556faf49a9f24c52a9a3a64215fdd8c17a1de9..10e85c0abfb3306bd9800a7e33a7390646f61e3b 100644 (file)
@@ -9,13 +9,13 @@ bin_SCRIPTS = automake aclocal
 info_TEXINFOS = automake.texi
 
 pkgdata_DATA = clean-kr.am clean.am compile-kr.am comp-vars.am \
-compile.am data.am dejagnu.am depend.am depend2.am dist-vars.am footer.am \
-header.am header-vars.am kr-extra.am libs.am library.am libtool.am ltlibs.am \
-mans-vars.am program.am progs.am remake-hdr.am \
-remake.am scripts.am subdirs.am tags.am tags-clean.am \
-texi-vers.am texinfos.am libs-clean.am \
-progs-clean.am data-clean.am COPYING INSTALL texinfo.tex ansi2knr.c \
-ansi2knr.1 lisp.am lisp-clean.am
+compile.am data.am dejagnu.am depend.am depend2.am dist-vars.am        \
+footer.am header.am header-vars.am kr-extra.am libs.am library.am \
+libtool.am ltlib.am ltlibrary.am mans-vars.am program.am progs.am \
+remake-hdr.am remake.am scripts.am subdirs.am tags.am tags-clean.am \
+texi-vers.am texinfos.am libs-clean.am ltlib-clean.am progs-clean.am \
+data-clean.am COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1        \
+lisp.am lisp-clean.am
 
 ## These must all be executable when installed.
 pkgdata_SCRIPTS = config.guess config.sub install-sh interlock mdate-sh \
index 57d5b7f997e563262f3361241b86451208c4f809..3c251325d15d6221634ece97c4fb9f57bd9a8cd0 100644 (file)
@@ -52,13 +52,13 @@ bin_SCRIPTS = automake aclocal
 info_TEXINFOS = automake.texi
 
 pkgdata_DATA = clean-kr.am clean.am compile-kr.am comp-vars.am \
-compile.am data.am dejagnu.am depend.am depend2.am dist-vars.am footer.am \
-header.am header-vars.am kr-extra.am libs.am library.am libtool.am ltlibs.am \
-mans-vars.am program.am progs.am remake-hdr.am \
-remake.am scripts.am subdirs.am tags.am tags-clean.am \
-texi-vers.am texinfos.am libs-clean.am \
-progs-clean.am data-clean.am COPYING INSTALL texinfo.tex ansi2knr.c \
-ansi2knr.1 lisp.am lisp-clean.am
+compile.am data.am dejagnu.am depend.am depend2.am dist-vars.am        \
+footer.am header.am header-vars.am kr-extra.am libs.am library.am \
+libtool.am ltlib.am ltlibrary.am mans-vars.am program.am progs.am \
+remake-hdr.am remake.am scripts.am subdirs.am tags.am tags-clean.am \
+texi-vers.am texinfos.am libs-clean.am ltlib-clean.am progs-clean.am \
+data-clean.am COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1        \
+lisp.am lisp-clean.am
 
 pkgdata_SCRIPTS = config.guess config.sub install-sh interlock mdate-sh \
 mkinstalldirs elisp-comp ylwrap acinstall
index 3220f5d740e32464c12f60e1bb8e6772019fc3e4..20cf097e77b82db4e4f3dd6d9a2ebb6b5d34562b 100755 (executable)
@@ -217,6 +217,40 @@ $cygnus_mode = 0;
 # Keys of this hash are names of dependency files to ignore.
 %omit_dependencies = ();
 
+# Map from obsolete macros to hints for new macros.
+# FIXME complete the list so that there are no `0' hints.
+%obsolete_macros =
+    (
+     'AC_FEATURE_CTYPE', "use \`AC_HEADER_STDC'",
+     'AC_FEATURE_ERRNO', "add \`strerror' to \`AC_REPLACE_FUNCS(...)'",
+     'AC_FEATURE_EXIT', 0,
+     'AC_SYSTEM_HEADER', 0,
+
+     # Autoconf macros that Automake enhances.
+     'AC_CONFIG_HEADER', "use \`AM_CONFIG_HEADER'",
+
+     'fp_C_PROTOTYPES', "use \`AM_C_PROTOTYPES'",
+     'fp_PROG_CC_STDC', "use \`AM_PROG_CC_STDC'",
+     'fp_PROG_INSTALL', "use \`AM_PROG_INSTALL'",
+     'fp_WITH_DMALLOC', "use \`AM_WITH_DMALLOC'",
+     'fp_WITH_REGEX', "use \`AM_WITH_REGEX'",
+     'gm_PROG_LIBTOOL', "use \`AM_PROG_LIBTOOL'",
+     'jm_MAINTAINER_MODE', "use \`AM_MAINTAINER_MODE'",
+     'md_TYPE_PTRDIFF_T', "use \`AM_TYPE_PTRDIFF_T'",
+     'ud_PATH_LISPDIR', "use \`AM_PATH_LISPDIR'",
+
+     # Now part of autoconf proper, under a different name.
+     'AM_FUNC_FNMATCH', "use \`AC_FUNC_FNMATCH'",
+     'fp_FUNC_FNMATCH', "use \`AC_FUNC_FNMATCH'",
+     'AM_SANITY_CHECK_CC', "automatically done by \`AC_PROG_CC'",
+
+# These aren't quite obsolete.
+#      'md_PATH_PROG',
+     );
+
+# Regexp to match the above macros.
+$obsolete_rx = '(' . join ('|', keys %obsolete_macros) . ')';
+
 \f
 
 &initialize_global_constants;
@@ -480,6 +514,7 @@ sub generate_makefile
     &handle_configure ($output, $makefile, @secondary_inputs);
     &handle_gettext;
     &handle_libraries;
+    &handle_ltlibraries;
     &handle_programs;
     &handle_scripts;
 
@@ -800,11 +835,12 @@ sub handle_yacc_lex_cxx
     #
     # Handle libtool.
     #
-    local ($libtool) = '';
+    local ($ltcompile, $ltlink) = ('', '');
     if ($seen_libtool)
     {
        &define_configure_variable ("LIBTOOL");
-       $libtool = '$(LIBTOOL) --mode=link ';
+       $ltcompile = '$(LIBTOOL) --mode=compile ';
+       $ltlink = '$(LIBTOOL) --mode=link ';
     }
 
     #
@@ -818,6 +854,10 @@ sub handle_yacc_lex_cxx
 
        &define_configure_variable ("CXXFLAGS");
        &define_variable ('CXXCOMPILE', '$(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS)');
+       &define_variable ('LTCXXCOMPILE',
+                         $ltcompile . '$(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS)')
+           if ($seen_libtool);
+
        &define_variable ('CXXLINK', $libtool . '$(CXX) $(LDFLAGS) -o $@');
 
        local ($ext);
@@ -826,7 +866,7 @@ sub handle_yacc_lex_cxx
            $output_rules .= ("$ext.o:\n"
                              . "\t\$(CXXCOMPILE) -c \$<\n");
            $output_rules .= ("$ext.lo:\n"
-                             . "\t\$(LIBTOOL) --mode=compile \x$(CXXCOMPILE) -c \$<\n")
+                             . "\t\$(LTCXXCOMPILE) -c \$<\n")
                if ($seen_libtool);
        }
 
@@ -855,7 +895,11 @@ sub handle_yacc_lex_cxx
        &define_configure_variable ('CFLAGS');
        &define_variable ('COMPILE',
                          '$(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)');
-       &define_variable ('LINK', $libtool . '$(CC) $(LDFLAGS) -o $@');
+       &define_variable ('LTCOMPILE',
+                         $ltcompile .
+                         '$(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)')
+           if ($seen_libtool);
+       &define_variable ('LINK', $ltlink . '$(CC) $(LDFLAGS) -o $@');
 
        if (! defined $configure_vars{'CC'})
        {
@@ -1207,13 +1251,13 @@ sub handle_lib_objects
 
        # Automatically handle @LIBOBJS@ and @ALLOCA@.  Basically this
        # means adding entries to dep_files.
-       if ($lsearch eq '@LIBOBJS@')
+       if ($lsearch =~ /^\@(LT)?LIBOBJS\@$/)
        {
            push (@dep_list, $lsearch);
            $seen_libobjs = 1;
            if (! keys %libsources)
            {
-               &am_line_error ($var, "\@LIBOBJS\@ seen but never set in \`configure.in'");
+               &am_line_error ($var, "\@$1" . "LIBOBJS\@ seen but never set in \`configure.in'");
            }
 
            local ($iter, $rewrite);
@@ -1236,11 +1280,11 @@ sub handle_lib_objects
                }
            }
        }
-       elsif ($lsearch eq '@ALLOCA@')
+       elsif ($lsearch =~ /^\@(LT)?ALLOCA\@$/)
        {
            push (@dep_list, $lsearch);
            &am_line_error ($var,
-                           "\@ALLOCA\@ seen but \`AC_FUNC_ALLOCA' not in \`configure.in'")
+                           "\@$1" . "ALLOCA\@ seen but \`AC_FUNC_ALLOCA' not in \`configure.in'")
                if ! defined $libsources{'alloca.c'};
            $dep_files{'.deps/alloca.P'} = 1;
            &require_file_with_line ($var, $FOREIGN, 'alloca.c');
@@ -1272,7 +1316,7 @@ sub handle_lib_objects
 # Handle C programs.
 sub handle_programs
 {
-    local (@proglist) = &am_install_var ('-clean', '-ltlibs',
+    local (@proglist) = &am_install_var ('-clean',
                                         'progs', 'PROGRAMS',
                                         'bin', 'sbin', 'libexec', 'pkglib',
                                         'noinst', 'check');
@@ -1492,6 +1536,136 @@ sub handle_libraries
     &define_configure_variable ('RANLIB');
 }
 
+# Handle shared libraries.
+sub handle_ltlibraries
+{
+    local (@liblist) = &am_install_var ('-clean',
+                                       'ltlib', 'LTLIBRARIES',
+                                       'lib', 'pkglib');
+    return if ! @liblist;
+
+    local (%instdirs);
+    local (%valid) = &am_primary_prefixes ('LTLIBRARIES', 'lib', 'pkglib');
+
+    local ($key);
+    foreach $key (keys %valid)
+    {
+       if (&variable_defined ($key . '_LTLIBRARIES'))
+       {
+           if (!$seen_libtool)
+           {
+               &am_line_error ($key . '_LTLIBRARIES', "library used but \`LIBTOOL' not defined in \`configure.in'");
+               # Only get this error once.
+               $configure_vars{'LIBTOOL'} = 1;
+               $seen_libtool = 1;
+           }
+
+           # Get the installation directory of each library.
+           next if ($key eq 'EXTRA');
+           for (&variable_value_as_list ($key . '_LTLIBRARIES'))
+           {
+               if ($instdirs{$_})
+               {
+                   &am_error ("\`$_' is already going to be installed in \`$instdirs{$_}'");
+               }
+               else
+               {
+                   $instdirs{$_} = $key;
+               }
+           }
+       }
+    }
+
+    local ($onelib);
+    local ($munge);
+    local ($xlib);
+    local ($seen_libobjs) = 0;
+    foreach $onelib (@liblist)
+    {
+       # Check that the library fits the standard naming convention.
+       if ($onelib !~ /^lib.*\.la$/)
+       {
+           # FIXME this should only be a warning for foreign packages
+           # FIXME should put line number here.  That means mapping
+           # from library name back to variable name.
+           &am_error ("\`$onelib' is not a standard libtool library name");
+       }
+
+       local ($obj) = &get_object_extension ($onelib);
+
+       # Canonicalize names.
+       ($xlib = $onelib) =~ tr/A-Za-z0-9_/_/c;
+       if ($xlib ne $onelib)
+       {
+           local ($xt);
+           foreach $xt ('_LIBADD', '_LDFLAGS', '_SOURCES', '_OBJECTS', '_DEPENDENCIES')
+           {
+               &am_line_error ($onelib . $xt,
+                               "invalid variable \`" . $onelib . $xt
+                               . "'; should be \`" . $xlib . $xt . "'")
+                   if &variable_defined ($onelib . $xt);
+           }
+       }
+
+       if (! &variable_defined ($xlib . '_LDFLAGS'))
+       {
+           # Define the lib_LDFLAGS variable.
+           &define_variable ($xlib . '_LDFLAGS', '');
+       }
+
+       if (&variable_defined ($xlib . '_LIBADD'))
+       {
+           if (&handle_lib_objects ($xlib, $xlib . '_LIBADD', 0))
+           {
+               $seen_libobjs = 1;
+           }
+       }
+       else
+       {
+           # Generate support for conditional object inclusion in
+           # libraries.
+           &define_variable ($xlib . "_LIBADD", '');
+       }
+
+       local ($linker) = &handle_source_transform ($xlib, $onelib, $obj);
+
+       # Determine program to use for link.
+       local ($xlink);
+       if (&variable_defined ($xlib . '_LINK'))
+       {
+           $xlink = $xlib . '_LINK';
+       }
+       else
+       {
+           $xlink = $linker ? $linker : 'LINK';
+       }
+
+
+       $output_rules .=
+           &file_contents_with_transform ('s/\@LTLIBRARY\@/'
+                                          . $onelib . '/go;'
+                                          . 's/\@XLTLIBRARY\@/'
+                                          . $xlib . '/go;'
+                                          . 's/\@DIR\@/'
+                                          . $instdirs{$onelib} . '/go;'
+                                          . 's/\@XLINK\@/' . $xlink . '/go;',
+                                          'ltlibrary');
+    }
+
+    if ($seen_libobjs)
+    {
+       foreach $onelib (@liblist)
+       {
+           # Canonicalize names.
+           ($xlib = $onelib) =~ tr/A-Za-z0-9_/_/c;
+           if (&variable_defined ($xlib . '_LIBADD'))
+           {
+               &check_libobjs_sources ($xlib, $xlib . '_LIBADD');
+           }
+       }
+    }
+}
+
 # See if any _SOURCES variable were misspelled.  Also, make sure that
 # EXTRA_ variables don't contain configure substitutions.
 sub check_typos
@@ -3396,9 +3570,14 @@ sub scan_one_configure_file
            }
        }
 
-       if (/(fp_WITH_DMALLOC|fp_WITH_REGEX|fp_FUNC_FNMATCH|fp_PROG_INSTALL|fp_C_PROTOTYPES|jm_MAINTAINER_MODE|ud_GNU_GETTEXT)/)
+       if (/$obsolete_rx/o)
        {
-           &am_conf_line_error ($filename, $., "\`$1' is obsolete; use corresponding \`AM_' macro");
+           local ($hint) = '';
+           if ($obsolete_macros{$1})
+           {
+               $hint = '; ' . $obsolete_macros{$1};
+           }
+           &am_conf_line_error ($filename, $., "\`$1' is obsolete$hint");
        }
 
        # Process the AC_OUTPUT macro.
@@ -3573,6 +3752,7 @@ sub scan_one_configure_file
        {
            $seen_libtool = 1;
            $libtool_line = $.;
+           $configure_vars{'LIBTOOL'} = 1;
            $configure_vars{'RANLIB'} = 1;
            $configure_vars{'CC'} = 1;
            # AM_PROG_LIBTOOL runs AC_CANONICAL_HOST.  Make sure we
@@ -4494,27 +4674,25 @@ sub am_install_var
 {
     local (@args) = @_;
 
-    local ($do_clean, $do_ltlibs) = (0, 0);
-    local ($more_xform) = '';
-    while (@args)
-    {
-       if ($args[0] eq '-clean')
-       {
-           $do_clean = 1;
-       }
-       if ($args[0] eq '-ltlibs')
-       {
-           $do_ltlibs = 1;
-           if ($seen_libtool)
+    local ($do_clean) = 0;
+
+    local ($ltxform);
+    if (defined $configure_vars{'LIBTOOL'})
            {
-               # Note that we explicitly set the mode, to avoid
-               # lossage if the program name isn't what we expect.
-               $more_xform = 's/\@LIBTOOL\@/\$(LIBTOOL) --mode=install/;';
+       # Transform '@LIBTOOL ...@' to '$(LIBTOOL) ...'
+       $ltxform = 's/\@LIBTOOL([^\@]*)\@/\$(LIBTOOL) $1/;';
            }
            else
            {
-               $more_xform = 's/\@LIBTOOL\@//;';
+       # Delete '@LIBTOOL ...@'
+       $ltxform = 's/\@LIBTOOL([^\@]*)\@//;';
            }
+
+    while (@args)
+    {
+       if ($args[0] eq '-clean')
+       {
+           $do_clean = 1;
        }
        elsif ($args[0] !~ /^-/)
        {
@@ -4523,7 +4701,6 @@ sub am_install_var
        shift (@args);
     }
     local ($file, $primary, @prefixes) = @args;
-    unshift (@prefixes, 'lib') if ($do_ltlibs);
 
     local (@used) = ();
     local (@result) = ();
@@ -4585,38 +4762,6 @@ sub am_install_var
                    }
                    next;
                }
-
-               if ($do_ltlibs)
-               {
-                   if ($rcurs =~ /^lib.*\.l?a$/)
-                   {
-                       if (! $seen_libtool)
-                       {
-                           &am_line_error ($one_name,
-                                           "\`$rcurs' is a libtool library name, but AM_PROG_LIBTOOL is not in \`configure.in'");
-                           $seen_libtool = 1;
-                       }
-
-                       # Check that libtool libraries go only into
-                       # libdir.  Ignore `EXTRA' libtool libraries.
-                       if ($rcurs =~ /^lib.*\.la$/ && $X ne 'lib'
-                           && $X ne 'EXTRA')
-                       {
-                           &am_line_error ($one_name,
-                                           "libtool library \`$rcurs' must only be installed in libdir");
-                       }
-                       elsif ($X =~ /^s?bin|libexec$/)
-                       {
-                           &am_line_error ($one_name,
-                                           "library \`$rcurs' must not be installed in a binary directory");
-                       }
-                   }
-                   elsif ($X eq 'lib')
-                   {
-                       &am_line_error ($one_name,
-                                       "only libraries (not \`$rcurs') may be installed in libdir");
-                   }
-               }
                push (@result, $rcurs);
            }
 
@@ -4648,19 +4793,10 @@ sub am_install_var
                next;
            }
 
-           if ($do_ltlibs && $X eq 'lib')
-           {
-               $output_rules .=
-                   &file_contents_with_transform ('s/\@DIR\@/' . $X . '/go;',
-                                                  'ltlibs');
-           }
-           else
-           {
                $output_rules .=
                    &file_contents_with_transform ('s/\@DIR\@/' . $X . '/g;'
-                                                  . $more_xform,
+                                              . $ltxform,
                                                   $file);
-           }
 
            push (@uninstall, 'uninstall-' . $X . $primary);
            push (@phony, 'uninstall-' . $X . $primary);
index dc8901e3612e089078d6e90e2e80bdf1f494d2bc..cba52345241213cd4e4e95a49669e7a91e8f1e6b 100644 (file)
@@ -587,9 +587,6 @@ AC_OUTPUT(Makefile,
 [test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h])
 @end example
 @cvindex AC_CONFIG_HEADER
-Note that Automake does not currently currently check to make sure the
-@code{AC_OUTPUT} command is correct.  Hopefully a future version of
-@code{autoconf} will let Automake handle this automatically.
 
 @item AC_CONFIG_AUX_DIR
 Automake will look for various helper scripts, such as
@@ -732,12 +729,26 @@ a variable in each generated @file{Makefile.in}.
 @node Invoking aclocal
 @section Auto-generating aclocal.m4
 
+Automake includes a number of Autoconf macros which can be used in your
+package; some of them are actually required by Automake in certain
+situations.  These macros must be defined in your @file{aclocal.m4};
+otherwise they will not be seen by @code{autoconf}.
+
 The @code{aclocal} program will automatically generate @file{aclocal.m4}
 files based on the contents of @file{configure.in}.  This provides a
 convenient way to get Automake-provided macros, without having to
 search around.  Also, the @code{aclocal} mechanism is extensible for use
 by other packages.
 
+At startup, @code{aclocal} scans all the @samp{.m4} files it can find,
+looking for macro definitions.  Then it scans @file{configure.in}.  Any
+mention of one of the macros found in the first step causes that macro,
+and any macros it in turn requires, to be put into @file{aclocal.m4}.
+
+The contents of @file{acinclude.m4}, if it exists, are also
+automatically included in @file{aclocal.m4}.  This is useful for
+incorporating local macros into @file{configure}.
+
 @code{aclocal} accepts the following options:
 
 @table @code
@@ -796,10 +807,21 @@ variable @code{LIBOBJS}.
 @node Extending aclocal
 @section Writing your own aclocal macros
 
-... explain format of macro files
-... explain how to get your own macros installed (using acinstall)
-... explain situations where this is actually useful (eg gettext)
+Aclocal doesn't have any built-in knowledge of any macros, so it is easy
+to extend it with your own macros.
+
+This is mostly used for libraries which want to supply their own
+Autoconf macros for use by other programs.  For instance the
+@code{gettext} library supplies a macro @code{AM_GNU_GETTEXT} which
+should be used by any package using @code{gettext}.  When the library is
+installed, it installs this macro so that @code{aclocal} will find it.
+
+A file of macros should be a series of @code{AC_DEFUN}'s.  Aclocal also
+understands @code{AC_REQUIRE}, so it is safe to put each macro in a
+separate file.
 
+A macro file's name should end in @samp{.m4}.  Such files should be
+installed in @file{$(datadir)/aclocal}.
 
 @node Top level
 @chapter The top-level @file{Makefile.am}
@@ -846,6 +868,7 @@ to build C programs and libraries.
 * A Program::                   Building a program
 * A Library::                   Building a library
 * LIBOBJS::                     Special handling for LIBOBJS and ALLOCA
+* A Shared Library::            Building a Libtool library
 * Program variables::           Variables used when building a program
 * Yacc and Lex::                Yacc and Lex support
 * C++::                         C++ and other languages
@@ -969,6 +992,9 @@ Building a library is much like building a program.  In this case, the
 name of the primary is @samp{LIBRARIES}.  Libraries can be installed in
 @code{libdir} or @code{pkglibdir}.
 
+@xref{A Shared Library}, for information on how to build shared
+libraries using Libtool and the @samp{LTLIBRARIES} primary.
+
 Each @samp{_LIBRARIES} variable is a list of the libraries to be built.
 For instance to create a library named @file{libcpio.a}, but not install
 it, you would write:
@@ -993,15 +1019,6 @@ variable.  This should be used for objects determined by
 libcpio_a_LIBADD = @@LIBOBJS@@ @@ALLOCA@@
 @end example
 
-@unnumberedsubsec Building Libraries with @code{libtool}
-
-The innovation used by GNU Libtool (@pxref{Top, , The Libtool Manual,
-libtool, The Libtool Manual}) is that libraries are programs.
-
-So, if you have GNU Libtool and want to use it to build your libraries,
-you should use the @samp{lib_PROGRAMS} variable (@pxref{Using Automake,
-, Using Automake with Libtool, libtool, The Libtool Manual}).
-
 @node LIBOBJS
 @section Special handling for LIBOBJS and ALLOCA
 
@@ -1015,6 +1032,34 @@ dependency-tracking scheme, see @xref{Dependencies}.
 @code{@@LIBOBJS@@} and @code{@@ALLOCA@@} are specially recognized in any
 @samp{_LDADD} or @samp{_LIBADD} variable.
 
+@node A Shared Library
+@section Building a Shared Library
+
+Building shared libraries is a relatively complex matter.  For this
+reason, GNU Libtool (@pxref{Top, , The Libtool Manual, libtool, The
+Libtool Manual}) was created to help build shared libraries in a
+platform-independent way.
+
+Automake uses Libtool to build libraries declared with
+@samp{LTLIBRARIES} primary.  Each @samp{_LTLIBRARIES} variable is a list
+of shared libraries to build.  For instance, to create a library named
+@file{libgettext.a} and its corresponding shared libraries, and install
+them in @samp{libdir}, write:
+
+@example
+lib_LTLIBRARIES = libgettext.la
+@end example
+
+Note that shared libraries @emph{must} be installed, so
+@samp{noinst_LTLIBRARIES} and @samp{check_LTLIBRARIES} are not allowed.
+
+For each library, the @samp{library_LIBADD} variable contains the names
+of extra libtool objects (@samp{.lo} files) to add to the shared
+library.  The @samp{library_LDFLAGS} variable contains any additional
+libtool flags, such as @samp{-version-info} or @samp{-static}.
+
+@xref{Using Automake, Using Automake with Libtool, libtool, The Libtool
+Manual, The Libtool Manual}, for more information.
 
 @node Program variables
 @section Variables used when building a program
@@ -1033,7 +1078,11 @@ There are some additional variables which Automake itself defines:
 @table @code
 @item INCLUDES
 A list of @samp{-I} options.  This can be set in your @file{Makefile.am}
-if you have special directories you want to look in.
+if you have special directories you want to look in.  @code{automake}
+already provides some @samp{-I} options automatically.  In particular it
+generates @samp{-I$(srcdir)} and a @samp{-I} pointing to the directory
+holding @file{config.h} (if you've used @code{AC_CONFIG_HEADER} or
+@code{AM_CONFIG_HEADER}).
 
 @item COMPILE
 This is the command used to actually compile a C source file.  The
@@ -1393,6 +1442,7 @@ use in GNU programs, it tries hard to interoperate with other GNU tools.
 * Emacs Lisp::                  Emacs Lisp
 * gettext::                     Gettext
 * Guile::                       Guile
+* Libtool::                     Libtool
 @end menu
 
 @node Emacs Lisp
@@ -1411,6 +1461,13 @@ By default Automake will byte-compile all Emacs Lisp source files using
 the Emacs found by @code{AM_PATH_LISPDIR}.  If you wish to avoid
 byte-compiling, simply define the variable @samp{ELCFILES} to be empty.
 @vindex ELCFILES
+Byte-compiled Emacs Lisp files are not portable among all versions of
+Emacs, so it makes sense to turn this off if you expect sites to have
+more than one version of Emacs installed.  Furthermore, many packages
+don't actually benefit from byte-compilation.  Still, we recommand that
+you leave it enabled by default.  It is probably better for sites with
+strange setups to cope for themselves than to make the installation less
+nice for everybody else.
 
 @node gettext
 @section Gettext
@@ -1449,6 +1506,12 @@ macro is understood to mean:
 As the Guile module code matures, no doubt the Automake support will
 grow as well.
 
+@node Libtool
+@section Libtool
+
+Automake provides support for GNU Libtool (@pxref{Top, , The Libtool
+Manual, libtool, The Libtool Manual}) with the @samp{LTLIBRARIES}
+primary.  @xref{A Shared Library}.
 
 @node Documentation
 @chapter Building documentation
index d5556faf49a9f24c52a9a3a64215fdd8c17a1de9..10e85c0abfb3306bd9800a7e33a7390646f61e3b 100644 (file)
@@ -9,13 +9,13 @@ bin_SCRIPTS = automake aclocal
 info_TEXINFOS = automake.texi
 
 pkgdata_DATA = clean-kr.am clean.am compile-kr.am comp-vars.am \
-compile.am data.am dejagnu.am depend.am depend2.am dist-vars.am footer.am \
-header.am header-vars.am kr-extra.am libs.am library.am libtool.am ltlibs.am \
-mans-vars.am program.am progs.am remake-hdr.am \
-remake.am scripts.am subdirs.am tags.am tags-clean.am \
-texi-vers.am texinfos.am libs-clean.am \
-progs-clean.am data-clean.am COPYING INSTALL texinfo.tex ansi2knr.c \
-ansi2knr.1 lisp.am lisp-clean.am
+compile.am data.am dejagnu.am depend.am depend2.am dist-vars.am        \
+footer.am header.am header-vars.am kr-extra.am libs.am library.am \
+libtool.am ltlib.am ltlibrary.am mans-vars.am program.am progs.am \
+remake-hdr.am remake.am scripts.am subdirs.am tags.am tags-clean.am \
+texi-vers.am texinfos.am libs-clean.am ltlib-clean.am progs-clean.am \
+data-clean.am COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1        \
+lisp.am lisp-clean.am
 
 ## These must all be executable when installed.
 pkgdata_SCRIPTS = config.guess config.sub install-sh interlock mdate-sh \
similarity index 74%
rename from ltlibs.am
rename to lib/am/ltlib.am
index 250309a24f2101cff846f71923c5f27b1276c373..a30b6664821d2143eb36a950c030e53ae258f68d 100644 (file)
--- a/ltlibs.am
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ## 02111-1307, USA.
-install-@DIR@PROGRAMS: $(@DIR@_PROGRAMS)
+install-@DIR@LTLIBRARIES: $(@DIR@_LTLIBRARIES)
        $(NORMAL_INSTALL)
        $(mkinstalldirs) $(@DIR@dir)
 ## Funny invocation because Makefile variable can be empty, leading to
 ## a syntax error in sh.
-       @list="$(@DIR@_PROGRAMS)"; for p in $$list; do \
+       @list="$(@DIR@_LTLIBRARIES)"; for p in $$list; do \
          if test -f $$p; then \
 ## Note that we explicitly set the libtool mode.  This avoids any lossage
 ## if the program doesn't have a name that libtool expects.
-           echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(@DIR@dir)/$$p"; \
-           $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(@DIR@dir)/$$p; \
+           echo "@LIBTOOL --mode=install@ $(INSTALL_PROGRAM) $$p $(@DIR@dir)/$$p"; \
+           @LIBTOOL --mode=install@ $(INSTALL_PROGRAM) $$p $(@DIR@dir)/$$p; \
          else :; fi; \
        done
 
-uninstall-@DIR@PROGRAMS:
-       list="$(@DIR@_PROGRAMS)"; for p in $$list; do \
-         $(LIBTOOL) --mode=uninstall rm -f $(@DIR@dir)/$$p; \
+uninstall-@DIR@LTLIBRARIES:
+       list="$(@DIR@_LTLIBRARIES)"; for p in $$list; do \
+         @LIBTOOL --mode=uninstall@ rm -f $(@DIR@dir)/$$p; \
        done
diff --git a/lib/am/ltlibrary.am b/lib/am/ltlibrary.am
new file mode 100644 (file)
index 0000000..dd1d817
--- /dev/null
@@ -0,0 +1,19 @@
+## automake - create Makefile.in from Makefile.am
+## Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+## 02111-1307, USA.
+@LTLIBRARY@: $(@XLTLIBRARY@_OBJECTS) $(@XLTLIBRARY@_DEPENDENCIES)
+       $(@XLINK@) -rpath $(@DIR@dir) $(@XLTLIBRARY@_LDFLAGS) $(@XLTLIBRARY@_OBJECTS) $(@XLTLIBRARY@_LIBADD) $(LIBS)
index 432af873968589d7f69e9f7021f96b1ca79559bc..debcf71ce95832a1361e8e9eb84333f92a18f396 100644 (file)
@@ -22,13 +22,11 @@ install-@DIR@PROGRAMS: $(@DIR@_PROGRAMS)
 ## a syntax error in sh.
        @list="$(@DIR@_PROGRAMS)"; for p in $$list; do \
          if test -f $$p; then \
-## It is harmless to unconditionally use $(LIBTOOL) here because it
-## will be null in non-libtoolized packages, and even if it is set to
-## a real libtool, its behaviour is identical to normal INSTALL_PROGRAM.
-## Note that we explicitly set the libtool mode.  This avoids any lossage
-## if the program doesn't have a name that libtool expects.
-           echo " @LIBTOOL@ $(INSTALL_PROGRAM) $$p $(@DIR@dir)/`echo $$p|sed '$(transform)'`"; \
-           @LIBTOOL@ $(INSTALL_PROGRAM) $$p $(@DIR@dir)/`echo $$p|sed '$(transform)'`; \
+## Note that we explicitly set the libtool mode.  This avoids any
+## lossage if the install program doesn't have a name that libtool
+## expects.
+           echo " @LIBTOOL --mode=install@ $(INSTALL_PROGRAM) $$p $(@DIR@dir)/`echo $$p|sed '$(transform)'`"; \
+           @LIBTOOL --mode=install@ $(INSTALL_PROGRAM) $$p $(@DIR@dir)/`echo $$p|sed '$(transform)'`; \
          else :; fi; \
        done
 
diff --git a/ltlib-clean.am b/ltlib-clean.am
new file mode 100644 (file)
index 0000000..384acab
--- /dev/null
@@ -0,0 +1,25 @@
+## automake - create Makefile.in from Makefile.am
+## Copyright (C) 1997 Free Software Foundation, Inc.
+
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+## 02111-1307, USA.
+mostlyclean-@DIR@LTLIBRARIES:
+
+clean-@DIR@LTLIBRARIES:
+       test -z "$(@DIR@_LTLIBRARIES)" || rm -f $(@DIR@_LTLIBRARIES)
+
+distclean-@DIR@LTLIBRARIES:
+
+maintainer-clean-@DIR@LTLIBRARIES:
diff --git a/ltlib.am b/ltlib.am
new file mode 100644 (file)
index 0000000..a30b666
--- /dev/null
+++ b/ltlib.am
@@ -0,0 +1,35 @@
+## automake - create Makefile.in from Makefile.am
+## Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+## 02111-1307, USA.
+install-@DIR@LTLIBRARIES: $(@DIR@_LTLIBRARIES)
+       $(NORMAL_INSTALL)
+       $(mkinstalldirs) $(@DIR@dir)
+## Funny invocation because Makefile variable can be empty, leading to
+## a syntax error in sh.
+       @list="$(@DIR@_LTLIBRARIES)"; for p in $$list; do \
+         if test -f $$p; then \
+## Note that we explicitly set the libtool mode.  This avoids any lossage
+## if the program doesn't have a name that libtool expects.
+           echo "@LIBTOOL --mode=install@ $(INSTALL_PROGRAM) $$p $(@DIR@dir)/$$p"; \
+           @LIBTOOL --mode=install@ $(INSTALL_PROGRAM) $$p $(@DIR@dir)/$$p; \
+         else :; fi; \
+       done
+
+uninstall-@DIR@LTLIBRARIES:
+       list="$(@DIR@_LTLIBRARIES)"; for p in $$list; do \
+         @LIBTOOL --mode=uninstall@ rm -f $(@DIR@dir)/$$p; \
+       done
diff --git a/ltlibrary.am b/ltlibrary.am
new file mode 100644 (file)
index 0000000..dd1d817
--- /dev/null
@@ -0,0 +1,19 @@
+## automake - create Makefile.in from Makefile.am
+## Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+## 02111-1307, USA.
+@LTLIBRARY@: $(@XLTLIBRARY@_OBJECTS) $(@XLTLIBRARY@_DEPENDENCIES)
+       $(@XLINK@) -rpath $(@DIR@dir) $(@XLTLIBRARY@_LDFLAGS) $(@XLTLIBRARY@_OBJECTS) $(@XLTLIBRARY@_LIBADD) $(LIBS)
index 432af873968589d7f69e9f7021f96b1ca79559bc..debcf71ce95832a1361e8e9eb84333f92a18f396 100644 (file)
--- a/progs.am
+++ b/progs.am
@@ -22,13 +22,11 @@ install-@DIR@PROGRAMS: $(@DIR@_PROGRAMS)
 ## a syntax error in sh.
        @list="$(@DIR@_PROGRAMS)"; for p in $$list; do \
          if test -f $$p; then \
-## It is harmless to unconditionally use $(LIBTOOL) here because it
-## will be null in non-libtoolized packages, and even if it is set to
-## a real libtool, its behaviour is identical to normal INSTALL_PROGRAM.
-## Note that we explicitly set the libtool mode.  This avoids any lossage
-## if the program doesn't have a name that libtool expects.
-           echo " @LIBTOOL@ $(INSTALL_PROGRAM) $$p $(@DIR@dir)/`echo $$p|sed '$(transform)'`"; \
-           @LIBTOOL@ $(INSTALL_PROGRAM) $$p $(@DIR@dir)/`echo $$p|sed '$(transform)'`; \
+## Note that we explicitly set the libtool mode.  This avoids any
+## lossage if the install program doesn't have a name that libtool
+## expects.
+           echo " @LIBTOOL --mode=install@ $(INSTALL_PROGRAM) $$p $(@DIR@dir)/`echo $$p|sed '$(transform)'`"; \
+           @LIBTOOL --mode=install@ $(INSTALL_PROGRAM) $$p $(@DIR@dir)/`echo $$p|sed '$(transform)'`; \
          else :; fi; \
        done