libtool-patches
[Top][All Lists]
Advanced

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

278-gary-libtoolize-without-automake-or-AC_CONFIG_MACRO_DIR.diff


From: Gary V. Vaughan
Subject: 278-gary-libtoolize-without-automake-or-AC_CONFIG_MACRO_DIR.diff
Date: Fri, 23 Sep 2005 13:17:43 +0100
User-agent: quilt/0.42-1

Okay to commit?

For users that have an old style configure.in without AC_CONFIG_MACRO_DIR,
and who don't use Automake (hence no `ACLOCAL_AMFLAGS = -I m4'), libtoolize
currently refuses to copy any of libtool's Autoconf macros.  This changeset
reverts to the 1.5.x behaviour of dropping them in the current directory
in that case.

I've also added another diagnostic that will remind the user that modern
autoconfiscated projects should use AC_CONFIG_MACRO_DIR to keep these
macros in a subdirectory.

 libtoolize.m4sh |   43 +++++++++++++++++++++++++++++--------------
 1 files changed, 29 insertions(+), 14 deletions(-)

Index: libtool--devo--1.0/libtoolize.m4sh
===================================================================
--- libtool--devo--1.0.orig/libtoolize.m4sh
+++ libtool--devo--1.0/libtoolize.m4sh
@@ -368,7 +368,7 @@ func_scan_files ()
            s,^.*AC_CONFIG_AUX_DIR([[[  ]*\([^])]]*\).*$,auxdir=\1,; p;
         };
        /AC_CONFIG_MACRO_DIR(/ {
-           s,^.*AC_CONFIG_MACRO_DIR([[[        ]*\([^])]]*\).*$,m4dir=\1,; p;
+           s,^.*AC_CONFIG_MACRO_DIR([[[        ]*\([^])]]*\).*$,macrodir=\1,; 
p;
         };
        /A[[CM]]_PROG_LIBTOOL/ { s,^.*$,seen_libtool=:,; p; };
        /LT_INIT/            { s,^.*$,seen_libtool=:,; p; };
@@ -421,6 +421,7 @@ func_scan_files ()
     my_sed_aclocal_flags='/^[[         ]]*ACLOCAL_[[A-Z_]]*FLAGS[[     ]]*=/ {
        s,^[[^=]]*=[[   ]]*\(.*\), \1,; q; };
        d'
+    m4dir="$macrodir"
     if test ! -n "$m4dir" && test -f Makefile.am; then
       my_m4dir_is_next=false
       for arg in `$SED "$my_sed_aclocal_flags" Makefile.am`; do
@@ -436,6 +437,12 @@ func_scan_files ()
         fi
       done
     fi
+
+    # If we still didn't find anything, and yet autoconf is being used,
+    # this must be a tree using old autotools that expects macro files
+    # to be in the current directory.
+    $seen_autoconf && \
+      test -z "$m4dir" && m4dir=.
 }
 
 # func_included_files searchfile
@@ -933,24 +940,32 @@ func_nonemptydir_p ()
   fi
 
   # Copy libtool's m4 macros to the macro directory, if they are newer.
-  if test -n "$m4dir"; then
-    $opt_quiet || func_echo "putting macros in AC_CONFIG_MACRO_DIR, \`$m4dir'."
+  test x"$m4dir" = x. || AC_CONFIG_MACRO_DIR=" AC_CONFIG_MACRO_DIR,"
+  $opt_quiet || func_echo "putting macros in$AC_CONFIG_MACRO_DIR \`$m4dir'."
 
-    func_serial_update  libtool.m4 "$aclocaldir" "$m4dir" \
-      LT_INIT 'A[[CM]]_PROG_LIBTOOL'
+  func_serial_update  libtool.m4 "$aclocaldir" "$m4dir" \
+    LT_INIT 'A[[CM]]_PROG_LIBTOOL'
 
-    if $seen_ltdl; then
-      func_serial_update ltdl.m4 "$aclocaldir" "$m4dir" 'LTDL_INIT'
-    else
-      func_verbose "Not copying \`$m4dir/ltdl.m4', libltdl not used."
-    fi
-
-    func_copy_some_files "$pkgmacro_files" "$aclocaldir" \
-      "$m4dir" func_serial_update
+  if $seen_ltdl; then
+    func_serial_update ltdl.m4 "$aclocaldir" "$m4dir" 'LTDL_INIT'
   else
-    func_verbose "AC_CONFIG_MACRO_DIR not defined, not copying libtool macro 
files."
+    func_verbose "Not copying \`$m4dir/ltdl.m4', libltdl not used."
   fi
 
+  func_copy_some_files "$pkgmacro_files" "$aclocaldir" \
+    "$m4dir" func_serial_update
+
+
+  # Suggest modern idioms for storing autoconf macros:
+  $opt_quiet || \
+    if test -z "$macrodir$ltdldir" && $seen_autoconf; then
+      if test x"$m4dir" = x.; then
+        func_echo "add \`AC_CONFIG_MACRO_DIR([m4])' to $configure_ac to store 
autoconf macros"
+      else
+        func_echo "consider adding \`AC_CONFIG_MACRO_DIR([$m4dir])'to 
$configure.ac"
+      fi
+    fi
+
   # Offer some suggestions for avoiding duplicate files in a project
   # that uses libltdl:
   if test -n "$ltdldir" && $seen_autoconf; then
-- 
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook




reply via email to

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