automake
[Top][All Lists]
Advanced

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

PATCH: make install-strip in cross-compilation environments


From: Alexandre Duret-Lutz
Subject: PATCH: make install-strip in cross-compilation environments
Date: 20 Jan 2001 15:42:33 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7

[sorry for the previous unedited mail, 
 sometimes I play gnus with my feet]

>>> "Alexandre" == Alexandre Oliva <address@hidden> writes:

[...]

 Alexandre> Even better!  Then we can just arrange for
 Alexandre> INSTALL_STRIP to set STRIPPROG and use install-sh
 Alexandre> for cross install-strip.  install-strip would pass
 Alexandre> INSTALL=$(INSTALL_STRIP) to the sub-make, where
 Alexandre> INSTALL_STRIP would be set by configure as needed
 Alexandre> for cross builds.

Can someone explain me the comment before the install-strip
rule: "We can't just set INSTALL_PROGRAM because that might be a
relative path".  This comment was added with the following
ChangeLog entry:

1998-12-11  Tom Tromey  <address@hidden>

        Bug report from Paul D. Smith:
        * automake.in (handle_merge_targets): Set
        AM_INSTALL_PROGRAM_FLAGS, not INSTALL_PROGRAM.
        * header-vars.am (INSTALL_PROGRAM): Added
        AM_INSTALL_PROGRAM_FLAGS.

But that doesn't help me.  I'm assuming it is now obsolete, but
maybe I'm plain wrong.  You'll tell me.

Anyway, here is what I came to.  It's quite more complicated
than what Alexandre suggested because libtool would not like to
get `STRIPPROG=something /bin/sh install' as argument; so I have
split this in two variables: $INSTALL_STRIP_PROGRAM is the
program which replace $INSTALL_PROGRAMM in install-strip mode,
and $INSTALL_STRIP_PROGRAM_ENV is the additional setup to
prepend to the libtool call.

2001-01-20  Alexandre Duret-Lutz  <address@hidden>

        `install -s' does not work on cross-compiled programs.  Therefore,
        when configuring a package for cross-compilation, check for some
        suitable `strip' and arrange the Makefiles so that `install-strip'
        will run `install-sh' with `STRIPPROG' set to the detected `strip'.

        * m4/strip.m4: New file.
        * m4/init.m4: Call AM_PROG_INSTALL_STRIP.
        * m4/Makefile.am (m4data_DATA): Add strip.m4.
        * automake.in (handle_merge_targets): In the install-strip rule,
        set INSTALL_PROGRAM to INSTALL_STRIP_PROGRAM, and INSTALL_PROGRAM_ENV
        to INSTALL_STRIP_PROGRAM_ENV; don't use INSTALL_STRIP_FLAG.
        * progs.am (address@hidden@PROGRAMS): Adapt to use INSTALL_PROGRAM_ENV,
        don't use INSTALL_STRIP_FLAG any longer.
        * header-vars.am (INSTALL_STRIP_FLAG): Remove.
        (INSTALL_PROGRAM_ENV): New variable.

--- old/automake-1.4b/progs.am  Wed Oct 18 19:18:33 2000
+++ automake-1.4b/progs.am      Fri Jan 19 21:06:34 2001
@@ -26,8 +26,8 @@
 ## lossage if the install program doesn't have a name that libtool
 ## expects.
            f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 
's/$$/$(EXEEXT)/'`"; \
-           echo " @LIBTOOL --mode=install@ $(INSTALL_PROGRAM) 
$(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(@address@hidden)/$$f"; \
-           @LIBTOOL --mode=install@ $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) 
$$p $(DESTDIR)$(@address@hidden)/$$f; \
+           echo " $(INSTALL_PROGRAM_ENV) @LIBTOOL --mode=install@ 
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(@address@hidden)/$$f"; \
+           $(INSTALL_PROGRAM_ENV) @LIBTOOL --mode=install@ $(INSTALL_PROGRAM) 
$$p $(DESTDIR)$(@address@hidden)/$$f; \
          else :; fi; \
        done
 
--- old/automake-1.4b/automake.in       Sat Dec 23 22:20:48 2000
+++ automake-1.4b/automake.in   Fri Jan 19 21:16:11 2001
@@ -3827,10 +3827,13 @@
 
     &do_one_merge_target ('all', @all);
 
-    # Generate the new 'install-strip' target.  We can't just set
-    # INSTALL_PROGRAM because that might be a relative path.
+    # Generate the new 'install-strip' target.
     $output_rules .= ("install-strip:\n\t"
-                     . '$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install'
+                     . '$(MAKE) $(AM_MAKEFLAGS) '
+                     . 'INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" '
+                     . "\\\n\t  "
+                     . 'INSTALL_PROGRAM_ENV="$(INSTALL_STRIP_PROGRAM_ENV)" '
+                     . 'install'
                      . "\n");
     push (@phony, 'install-strip');
 }
--- old/automake-1.4b/header-vars.am    Wed Oct 18 19:18:33 2000
+++ automake-1.4b/header-vars.am        Fri Jan 19 21:20:54 2001
@@ -62,9 +62,9 @@
 
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_PROGRAM_ENV =
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_FLAG =
 transform = @program_transform_name@
 
 ## These are defined because otherwise make on NetBSD V1.1 will print
--- old/automake-1.4b/m4/Makefile.am    Mon Nov 22 20:13:00 1999
+++ automake-1.4b/m4/Makefile.am        Thu Jan 18 21:16:05 2001
@@ -7,6 +7,6 @@
 m4data_DATA = ccstdc.m4 cond.m4 depend.m4 depout.m4 dmalloc.m4 \
 error.m4 gcj.m4 header.m4 init.m4 lex.m4 lispdir.m4 maintainer.m4 \
 minuso.m4 missing.m4 multi.m4 obstack.m4 protos.m4 ptrdiff.m4 \
-python.m4 regex.m4 sanity.m4 strtod.m4 termios.m4 winsz.m4
+python.m4 regex.m4 sanity.m4 strip.m4 strtod.m4 termios.m4 winsz.m4
 
 EXTRA_DIST = $(m4data_DATA)
--- old/automake-1.4b/m4/init.m4        Sat Oct 14 01:42:39 2000
+++ automake-1.4b/m4/init.m4    Fri Jan 19 19:43:37 2001
@@ -50,6 +50,7 @@
 AM_MISSING_PROG(MAKEINFO, makeinfo)
 AM_MISSING_PROG(AMTAR, tar)
 AM_MISSING_INSTALL_SH
+AM_PROG_INSTALL_STRIP
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
 AC_REQUIRE([AC_PROG_AWK])dnl
--- old/automake-1.4b/m4/strip.m4       Fri Jan 19 22:33:47 2001
+++ automake-1.4b/m4/strip.m4   Sat Jan 20 13:14:49 2001
@@ -0,0 +1,29 @@
+AC_DEFUN([AM_PROG_STRIP],
+[# Check for `strip', unless the installer
+# has set the STRIP environment variable.
+if test -z "$STRIP"; then
+  AC_CHECK_TOOL([STRIP],[strip])
+fi
+dnl For autoconf 2.50?
+dnl AC-ARG-VAR([STRIP], [program used to strip binaries])
+])
+
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[dnl Don't test for $cross_compiling = yes, it might be `maybe'...
+if test "$cross_compiling" != no; then
+  # since we are cross-compiling, we need to check for `strip', because
+  # the build strip is unlikely to know about the host binaries.
+  AM_PROG_STRIP
+  if test -z "$STRIP"; then
+    STRIP=':'
+    AC_MSG_WARN([strip missing, install-strip will not strip binaries])
+  fi
+  INSTALL_STRIP_PROGRAM="\${SHELL} \${install_sh} -c -s"
+  INSTALL_STRIP_PROGRAM_ENV="STRIPPROG='$STRIP'"
+else
+  # when not cross-compiling, the install program knowns how to strip.
+  INSTALL_STRIP_PROGRAM='${INSTALL} -s'
+  INSTALL_STRIP_PROGRAM_ENV=''
+fi
+AC_SUBST([INSTALL_STRIP_PROGRAM])
+AC_SUBST([INSTALL_STRIP_PROGRAM_ENV])])


-- 
Alexandre Duret-Lutz



reply via email to

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