From cdd4444161dffa8759a201d71801787b64db42dc Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Mon, 4 Oct 2010 02:23:23 +0200
Subject: [PATCH] gnulib-tool: Fixes for --create-testdir with --libtool.

* gnulib-tool (func_get_automake_snippet): Don't augment
EXTRA_lib_SOURCES for the pt_chown module, since pt_chown.o goes into
an executable.
(func_create_testdir): Handle module 'alloca' like func_import.
Reported by Bruce Korb <bruce.korb@gmail.com>.
---
 ChangeLog   |  9 +++++++++
 gnulib-tool | 13 +++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 1d06c162d9..9f6223ca59 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-10-03  Bruno Haible  <bruno@clisp.org>
+
+	gnulib-tool: Fixes for --create-testdir with --libtool.
+	* gnulib-tool (func_get_automake_snippet): Don't augment
+	EXTRA_lib_SOURCES for the pt_chown module, since pt_chown.o goes into
+	an executable.
+	(func_create_testdir): Handle module 'alloca' like func_import.
+	Reported by Bruce Korb <bruce.korb@gmail.com>.
+
 2010-10-03  Paul Eggert  <eggert@cs.ucla.edu>
 
 	Avoid some lines longer than 80 characters.
diff --git a/gnulib-tool b/gnulib-tool
index eff054a448..245ed995e1 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -2228,6 +2228,7 @@ func_get_automake_snippet ()
       # automake will generate a useless dependency; this is harmless.
       case "$1" in
         relocatable-prog-wrapper) ;;
+        pt_chown) ;;
         *)
           func_filter_filelist extra_files "$nl" "$extra_files" '' '.c' '' ''
           if test -n "$extra_files"; then
@@ -5128,6 +5129,12 @@ func_create_testdir ()
            *)
              func_get_autoconf_snippet "$module" \
                | sed -e "$sed_replace_build_aux"
+             if test "$module" = 'alloca' && test "$libtool" = true; then
+               echo 'changequote(,)dnl'
+               echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
+               echo 'changequote([, ])dnl'
+               echo 'AC_SUBST([LTALLOCA])'
+             fi
              ;;
          esac
        fi
@@ -5250,6 +5257,12 @@ func_create_testdir ()
      if test -n "$module"; then
        func_get_autoconf_snippet "$module" \
          | sed -e "$sed_replace_build_aux"
+       if test "$module" = 'alloca' && test "$libtool" = true; then
+         echo 'changequote(,)dnl'
+         echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
+         echo 'changequote([, ])dnl'
+         echo 'AC_SUBST([LTALLOCA])'
+       fi
      fi
    done
    func_emit_initmacro_end $macro_prefix
-- 
2.30.2