libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

350-gary-maintain-private-libobj-namespace


From: Gary V. Vaughan
Subject: 350-gary-maintain-private-libobj-namespace
Date: Tue, 29 Jan 2008 02:38:01 +0800 (PHT)
User-agent: mailnotify/0.9

Okay to commit?

I plan to commit this one in 72 hours (or less with a favourable
review) and roll libtool-2.1b.  This fixes the last of Eric's recently
reported bugs, making a patch to build M4 with nonrecursive libltdl
possible :-)

  from  Gary V. Vaughan  <address@hidden>
        Unfortunately, the autoconf implementation of AC_LIBOBJ and
        friends requires all libobjs to be in the same directory, as
        declared by AC_CONFIG_LIBOBJ_DIR.  That might prevent using
        either recursive or nonrecursive libltdl if the parent project
        has libobjs of its own, except that this patch tracks libltdl's
        libobjs in another namespace:
  
        * libltdl/m4/ltdl-libobj.m4: New file. Versions of AC_LIBOBJ
        and AC_LIBSOURCES that list missing sources in ltdl_LIBOBJS
        intstead of the global LIBOBJS variable.  Content of the macros
        inspired by code in gnulib-tool.
        * libltdl/m4/ltdl.m4 (LTDL_INIT): Push and pop the new
        definitions around potential sites that call AC_LIBOBJ.
        (_LTDL_MODE_DISPATCH): Initialise lt_libobj_prefix in
        nonrecursive mode.
        (LTDL_INIT): Using lt_libobj_prefix, initialise ltdl_LIBOBJS and
        ltdl_LTLIBOBJS.
        * libtoolize.m4sh (func_install_pkgmacro_subproject): Also copy
        ltdl-libobj.m4 directly to the subproject libltdl.
        (func_install_pkgmacro_parent): Also copy ltdl-libobj.m4
        directly to the parent macro directory, even when the other
        macro files are linked.
        * Makefile.am (aclocalfiles, sub_aclocal_m4_deps): Add
        ltdl-libobj.m4.
        * libtoolize.m4sh (func_fixup_ltdl_libobj): When copying
        ltdl-libobj.m4, substitute the actual libltdl directory for
        the default `libltdl'.
        (func_fixup_Makefile): Substitute ltdl_LIBOBJS and
        ltdl_LTLIBOBJS for LIBOBJS and LTLIBOBJS during copying
        either Makefile.am or Makefile.inc.
        * tests/libtoolize.at: Adjust tests for new output while copying
        ltdl-libobj.m4.
        Reported by Eric Blake <address@hidden>
  
  Index: b/Makefile.am
  ===================================================================
  --- a/Makefile.am
  +++ b/Makefile.am
  @@ -277,6 +277,7 @@ sub_aclocal_m4_deps = \
        $(srcdir)/libltdl/configure.ac \
        $(m4dir)/libtool.m4 \
        $(m4dir)/ltoptions.m4 \
  +     $(m4dir)/ltdl-libobj.m4 \
        $(m4dir)/ltdl.m4 \
        $(srcdir)/$(m4dir)/ltversion.m4 \
        $(m4dir)/ltsugar.m4 \
  @@ -343,8 +344,9 @@ auxfiles  = $(auxexefiles) config/ltmain.
   
   # Everything that gets picked up by aclocal is automatically distributed,
   # this is the list of macro files we install on the user's system.
  -aclocalfiles = m4/argz.m4 m4/libtool.m4 m4/ltdl.m4 m4/ltoptions.m4 \
  -               m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4
  +aclocalfiles = m4/argz.m4 m4/libtool.m4 m4/ltdl.m4 m4/ltdl-libobj.m4 \
  +               m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \
  +               m4/lt~obsolete.m4
   
   ## These are installed as a subdirectory of pkgdatadir so that
   ## libtoolize --ltdl can find them later:
  Index: b/libltdl/m4/ltdl-libobj.m4
  ===================================================================
  --- /dev/null
  +++ b/libltdl/m4/ltdl-libobj.m4
  @@ -0,0 +1,29 @@
  +# Maintain a private namespace for libltdl LIBOBJS.        -*- Autoconf -*-
  +#
  +#   Copyright (C) 2008 Free Software Foundation, Inc.
  +#   Written by Gary V. Vaughan, 2008
  +#
  +# This file is free software; the Free Software Foundation gives
  +# unlimited permission to copy and/or distribute it, with or without
  +# modifications, as long as this notice is preserved.
  +
  +# serial 1 ltdl-libobj.m4
  +
  +m4_pattern_allow([^_LT_LIBOBJS?|_LT_LIBSOURCES$])
  +
  +# Like AC_LIBOBJ, except that the module name goes
  +# into _LT_LIBOBJS instead of into LIBOBJS.
  +AC_DEFUN([_LT_LIBOBJ], [
  +  AS_LITERAL_IF([$1], [_LT_LIBSOURCES([$1.c])])dnl
  +  _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext"
  +])
  +
  +# Like AC_LIBSOURCES, except the directory where the source file is
  +# expected is separated from the user LIBOBJ directory.
  +AC_DEFUN([_LT_LIBSOURCES], [
  +  m4_foreach([_LTNAME], [$1], [
  +    m4_syscmd([test -r libltdl/]_LTNAME[ || test ! -d libltdl/])dnl
  +    m4_if(m4_sysval, [0], [],
  +      [AC_FATAL([missing libltdl/]_LTNAME)])
  +  ])
  +])
  Index: b/libltdl/m4/ltdl.m4
  ===================================================================
  --- a/libltdl/m4/ltdl.m4
  +++ b/libltdl/m4/ltdl.m4
  @@ -198,7 +198,7 @@ m4_if(_LTDL_DIR, [],
       [m4_case(m4_default(_LTDL_MODE, [subproject]),
          [subproject], [AC_CONFIG_SUBDIRS(_LTDL_DIR)
                          _LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"])],
  -       [nonrecursive], [_LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"])],
  +       [nonrecursive], [_LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"; 
lt_libobj_prefix="$lt_ltdl_dir/"])],
          [recursive], [],
        [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])])dnl
   dnl Be careful not to expand twice:
  @@ -217,6 +217,12 @@ AC_DEFUN([LTDL_INIT],
   [dnl Parse OPTIONS
   _LT_SET_OPTIONS([$0], [$1])
   
  +dnl We need to keep our own list of libobjs separate from our parent project,
  +dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while
  +dnl we look for our own LIBOBJs. Definitions in ltdl-libobj.m4.
  +m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ]))
  +m4_pushdef([AC_LIBSOURCES], m4_defn([_LT_LIBSOURCES]))
  +
   dnl If not otherwise defined, default to the 1.5.x compatible subproject 
mode:
   m4_if(_LTDL_MODE, [],
           [m4_define([_LTDL_MODE], m4_default([$2], [subproject]))
  @@ -309,6 +315,25 @@ AC_MSG_RESULT([$LIBLTDL])
   
   _LTDL_SETUP
   
  +dnl restore autoconf definition.
  +m4_popdef([AC_LIBOBJ])
  +m4_popdef([AC_LIBSOURCES])
  +
  +AC_CONFIG_COMMANDS_PRE([
  +    _ltdl_libobjs=
  +    _ltdl_ltlibobjs=
  +    if test -n "$_LT_LIBOBJS"; then
  +      # Remove the extension.
  +      sed_drop_objext='s/\.o$//;s/\.obj$//'
  +      for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | sed 
"$sed_drop_objext" | sort | uniq`; do
  +        _ltdl_libobjs="$_ltdl_libobjs $lt_libobj_prefix$i.$ac_objext"
  +        _ltdl_ltlibobjs="$_ltdl_ltlibobjs $lt_libobj_prefix$i.lo"
  +      done
  +    fi
  +    AC_SUBST([ltdl_LIBOBJS], [$_ltdl_libobjs])
  +    AC_SUBST([ltdl_LTLIBOBJS], [$_ltdl_ltlibobjs])
  +])
  +
   # Only expand once:
   m4_define([LTDL_INIT])
   ])# LTDL_INIT
  Index: b/libtoolize.m4sh
  ===================================================================
  --- a/libtoolize.m4sh
  +++ b/libtoolize.m4sh
  @@ -320,6 +320,26 @@ func_copy_some_files ()
       IFS="$my_save_IFS"
   }
   
  +
  +# func_fixup_ltdl_libobj srcdir destdir
  +func_fixup_ltdl_libobj ()
  +{
  +    $opt_debug
  +    my_filename=ltdl-libobj.m4
  +    my_srcdir="$1"
  +    my_destdir="$2"
  +    my_fixup_script="s,libltdl/,$ltdldir/,g"
  +
  +    $RM "$my_destdir/$my_filename" 2>/dev/null
  +    if $opt_dry_run; then :;
  +    else
  +      $SED "$my_fixup_script" \
  +        < "$my_srcdir/$my_filename" > "$my_destdir/$my_filename" ||
  +        func_fatal_error "cannot create $my_destdir/$my_filename"
  +    fi
  +}
  +
  +
   # func_fixup_Makefile srcfile srcdir destdir
   func_fixup_Makefile ()
   {
  @@ -328,6 +348,8 @@ func_fixup_Makefile ()
       my_srcdir="$2"
       my_destdir="$3"
       my_fixup_non_subpackage_script="\
  +      s,(LIBOBJS),(ltdl_LIBOBJS),g
  +      s,(LTLIBOBJS),(ltdl_LTLIBOBJS),g
         s,libltdl/configure.ac,,
         s,libltdl/configure,,
         s,libltdl/aclocal.m4,,
  @@ -339,7 +361,8 @@ func_fixup_Makefile ()
         Makefile.am)
        my_fixup_non_subpackage_script=`echo "$my_fixup_non_subpackage_script" 
| \
                sed 's,libltdl/,,'`
  -     my_fixup_inc_paths_script= ;;
  +     my_fixup_inc_paths_script=
  +     ;;
         Makefile.inc)
        repl=$ltdldir
        repl_uscore=`$ECHO "X$repl" | $Xsed -e 's,[/.+-],_,g'`
  @@ -952,7 +975,19 @@ func_install_pkgmacro_subproject ()
         func_echo "putting macros in AC_CONFIG_MACRO_DIR, 
\`$subproject_macrodir'."
       fi
   
  -    func_copy_some_files "argz.m4:libtool.m4:ltdl.m4:$pkgmacro_files" \
  +    func_copy_some_files "argz.m4:libtool.m4" \
  +      "$aclocaldir" "$subproject_macrodir"
  +
  +    # ltdl-libobj.m4 needs $ltdldir substitution during installation, so
  +    # we can't just copy it from $aclocaldir.
  +    case $opt_verbose in
  +      false) my_copy_msg="\`$subproject_macrodir" ;;
  +      *)     my_copy_msg="from \`$aclocaldir"     ;;
  +    esac
  +    $opt_quiet || func_echo "copying file $my_copy_msg/ltdl-libobj.m4'"
  +    func_fixup_ltdl_libobj "$aclocaldir" "$subproject_macrodir"
  +
  +    func_copy_some_files "ltdl.m4:$pkgmacro_files" \
         "$aclocaldir" "$subproject_macrodir"
   }
   
  @@ -983,8 +1018,18 @@ func_install_pkgmacro_parent ()
         LT_INIT 'A[CM]_PROG_LIBTOOL'
   
       if $opt_ltdl; then
  +      # Generate a temporary copy of ltdl-libobj.m4 for serial comparison.
  +      mym4tmpdir=`func_mktempdir`
  +      func_fixup_ltdl_libobj "$aclocaldir" "$mym4tmpdir"
  +      my_link="$opt_link"
  +      opt_link=false
  +      func_serial_update ltdl-libobj.m4 "$mym4tmpdir" "$macrodir" 
ltdl-libobj.m4
  +      opt_link="$my_link"
  +      rm -rf "$mym4tmpdir"
  +
         func_serial_update ltdl.m4 "$aclocaldir" "$macrodir" 'LTDL_INIT'
       else
  +      func_verbose "Not copying \`$macrodir/ltdl-libobj.m4', libltdl not 
used."
         func_verbose "Not copying \`$macrodir/ltdl.m4', libltdl not used."
       fi
   
  @@ -1004,8 +1049,8 @@ func_install_pkgmacro_files ()
   {
       $opt_debug
   
  -    # argz.m4, libtool.m4 and ltdl.m4 are handled specially below:
  -    func_massage_aclocal_DATA 'argz.m4|libtool.m4|ltdl.m4'
  +    # argz.m4, libtool.m4, ltdl-libobj.m4 and ltdl.m4 are handled specially:
  +    func_massage_aclocal_DATA 'argz.m4|libtool.m4|ltdl-libobj.m4|ltdl.m4'
   
     # 1. Parent has separate macrodir to subproject ltdl:
       if $opt_ltdl && test "x$ltdl_mode" = "xsubproject" &&
  Index: b/tests/libtoolize.at
  ===================================================================
  --- a/tests/libtoolize.at
  +++ b/tests/libtoolize.at
  @@ -304,6 +304,7 @@ libtoolize: copying file `build-aux/ltma
   libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
   libtoolize: copying file `m4/argz.m4'
   libtoolize: copying file `m4/libtool.m4'
  +libtoolize: copying file `m4/ltdl-libobj.m4'
   libtoolize: copying file `m4/ltdl.m4'
   libtoolize: copying file `m4/ltoptions.m4'
   libtoolize: copying file `m4/ltsugar.m4'
  @@ -376,6 +377,7 @@ libtoolize: linking file `ltdl/config/lt
   libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `ltdl/m4'.
   libtoolize: linking file `ltdl/m4/argz.m4'
   libtoolize: linking file `ltdl/m4/libtool.m4'
  +libtoolize: copying file `ltdl/m4/ltdl-libobj.m4'
   libtoolize: linking file `ltdl/m4/ltdl.m4'
   libtoolize: linking file `ltdl/m4/ltoptions.m4'
   libtoolize: linking file `ltdl/m4/ltsugar.m4'
  @@ -471,6 +473,7 @@ libtoolize: copying file `ltdl/config/lt
   libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `ltdl/m4'.
   libtoolize: copying file `ltdl/m4/argz.m4'
   libtoolize: copying file `ltdl/m4/libtool.m4'
  +libtoolize: copying file `ltdl/m4/ltdl-libobj.m4'
   libtoolize: copying file `ltdl/m4/ltdl.m4'
   libtoolize: copying file `ltdl/m4/ltoptions.m4'
   libtoolize: copying file `ltdl/m4/ltsugar.m4'
  @@ -668,6 +671,7 @@ libtoolize: copying file `build-aux/ltma
   libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
   libtoolize: copying file `m4/argz.m4'
   libtoolize: copying file `m4/libtool.m4'
  +libtoolize: copying file `m4/ltdl-libobj.m4'
   libtoolize: copying file `m4/ltdl.m4'
   libtoolize: copying file `m4/ltoptions.m4'
   libtoolize: copying file `m4/ltsugar.m4'
  @@ -743,6 +747,7 @@ libtoolize: copying file `ltdl/config/lt
   libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `acm4'.
   libtoolize: copying file `acm4/argz.m4'
   libtoolize: copying file `acm4/libtool.m4'
  +libtoolize: copying file `acm4/ltdl-libobj.m4'
   libtoolize: copying file `acm4/ltdl.m4'
   libtoolize: copying file `acm4/ltoptions.m4'
   libtoolize: copying file `acm4/ltsugar.m4'
  @@ -751,6 +756,7 @@ libtoolize: copying file `acm4/lt~obsole
   libtoolize: putting macros in `ltdl/m4'.
   libtoolize: copying file `ltdl/m4/argz.m4'
   libtoolize: copying file `ltdl/m4/libtool.m4'
  +libtoolize: copying file `ltdl/m4/ltdl-libobj.m4'
   libtoolize: copying file `ltdl/m4/ltdl.m4'
   libtoolize: copying file `ltdl/m4/ltoptions.m4'
   libtoolize: copying file `ltdl/m4/ltsugar.m4'
-- 
  ())_.              Email me: address@hidden
  ( '/           Read my blog: http://blog.azazil.net
  / )=         ...and my book: http://sources.redhat.com/autobook
`(_~)_ Join my AGLOCO Network: http://www.agloco.com/r/BBBS7912 
_________________________________________________________
This patch notification generated by vcsapply version 1.0
http://savannah.gnu.org/projects/cvs-utils

Attachment: pgpoAX6X67oUt.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]