automake-patches
[Top][All Lists]
Advanced

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

Fix install-strip when $(STRIP) contains several words.


From: Ralf Wildenhues
Subject: Fix install-strip when $(STRIP) contains several words.
Date: Mon, 1 Nov 2010 22:25:02 +0100
User-agent: Mutt/1.5.20 (2010-08-04)

I was wondering whether, if $(STRIP) is empty, one would want
install-strip to have the same effect as install, but then again,
the value of $(STRIP) at 'make install' time isn't currently used
for all stripping anyway: libtool figures out how to strip things
at configure time (and sets things differently for static and shared
libraries).  Thus, I have kept the semantics of still passing the -s
flag to install-sh even if STRIP is empty.

While here, I've updated the comment about double quotes after tracing
it back to when it was added to automake.in.

AFAIK there is no reliable portable way to find out whether some file
has been stripped or not (for the testsuite).

This is for maint.  I'll leave a couple of days for comments before
pushing.

Thanks,
Ralf

    Fix install-strip when $(STRIP) contains several words.
    
    * lib/am/install.am (install-strip): Update comment.  Use
    separate sub-make invocations for empty and nonempty $(STRIP),
    to fix quoting issues.
    * tests/strip2.test, tests/strip3.test: New tests.
    * tests/Makefile.am (TESTS): Adjust.

diff --git a/lib/am/install.am b/lib/am/install.am
index d261070..01ae49a 100644
--- a/lib/am/install.am
+++ b/lib/am/install.am
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 2001, 2002, 2003, 2004, 2006, 2008, 2009  Free Software
+## Copyright (C) 2001, 2002, 2003, 2004, 2006, 2008, 2009, 2010 Free Software
 ## Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
@@ -90,9 +90,17 @@ install-strip:
 ## It's OK to override both with INSTALL_STRIP_PROGRAM, because
 ## INSTALL_STRIP_PROGRAM uses install-sh (see m4/strip.m4 for a rationale).
 ##
-## Use double quotes here because we might need to interpolate some
-## backquotes at runtime.
-       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-         `test -z '$(STRIP)' || \
-           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+## Use double quotes for the *_PROGRAM settings because we might need to
+## interpolate some backquotes at runtime.
+##
+## The case for empty $(STRIP) is separate so that it is quoted correctly for
+## multiple words, but does not expand to an empty words if STRIP is empty.
+       if test -z '$(STRIP)'; then \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s 
\
+             install; \
+       else \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s 
\
+           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+       fi
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6673293..0b85159 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -696,6 +696,8 @@ stamph2.test \
 stdlib.test \
 stdlib2.test \
 strip.test \
+strip2.test \
+strip3.test \
 subdir.test \
 subdir2.test \
 subdir3.test \
diff --git a/tests/strip2.test b/tests/strip2.test
new file mode 100755
index 0000000..5786ded
--- /dev/null
+++ b/tests/strip2.test
@@ -0,0 +1,54 @@
+#! /bin/sh
+# Copyright (C) 2010 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, see <http://www.gnu.org/licenses/>.
+
+# Ensure install-strip works when STRIP consists of more than one word.
+# This test needs GNU binutils strip.  See sister test strip3.
+
+required=strip
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+lib_LIBRARIES = libfoo.a
+END
+
+cat > foo.c << 'END'
+int main () { return 0; }
+END
+
+cat > libfoo.c << 'END'
+int foo () { return 0; }
+END
+
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+prefix=`pwd`/inst
+./configure --prefix="$prefix" STRIP='strip --verbose'
+$MAKE
+$MAKE install-strip
+
+:
diff --git a/tests/strip3.test b/tests/strip3.test
new file mode 100755
index 0000000..b159673
--- /dev/null
+++ b/tests/strip3.test
@@ -0,0 +1,54 @@
+#! /bin/sh
+# Copyright (C) 2010 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, see <http://www.gnu.org/licenses/>.
+
+# Ensure install-strip works when STRIP consists of more than one word.
+# This test needs GNU binutils strip.  Libtool variant.
+
+required='libtoolize strip'
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_LIBTOOL
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+lib_LTLIBRARIES = libfoo.la
+END
+
+cat > foo.c << 'END'
+int main () { return 0; }
+END
+
+cat > libfoo.c << 'END'
+int foo () { return 0; }
+END
+
+libtoolize
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+prefix=`pwd`/inst
+./configure --prefix="$prefix" STRIP='strip --verbose'
+$MAKE
+$MAKE install-strip
+
+:



reply via email to

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