automake
[Top][All Lists]
Advanced

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

PATCH(2): make install-strip in cross-compilation environments


From: Alexandre Duret-Lutz
Subject: PATCH(2): make install-strip in cross-compilation environments
Date: 29 Jan 2001 09:05:21 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Here is a revised patch.

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

        * m4/strip.m4: New file.
        * m4/Makefile.am (m4data_DATA): Add strip.m4.
        * m4/init.m4: Call AM_PROG_INSTALL_STRIP.
        * m4/missing.m4 (AM_AUX_DIR_EXPAND): New function.
        (AM_MISSING_INSTALL_SH, AM_MISSING_HAS_RUN): Use $am_aux_dir instead
        of $ac_aux_dir, and require AM_AUX_DIR_EXPAND.
        * m4/depend.m4 (AM_DEP_TRACK): Likewise.
        * 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/automake.in       Sat Dec 23 22:20:48 2000
+++ automake-1.4b/automake.in   Sun Jan 28 20:10:09 2001
@@ -3827,10 +3827,16 @@
 
     &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.  (If you ever modify
+    # this, keep in mind that INSTALL_PROGRAM is used in
+    # subdirectories, so never set it to a value relative to
+    # the top directory.)
     $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        Sun Jan 28 16:58:14 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        Mon Jan 22 21:11:22 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/depend.m4      Fri Dec 22 21:45:12 2000
+++ automake-1.4b/m4/depend.m4  Sat Jan 27 11:54:47 2001
@@ -80,13 +80,14 @@
 ])
 
 AC_DEFUN([AM_DEP_TRACK],[
+AC_REQUIRE([AM_AUX_DIR_EXPAND])
 AC_ARG_ENABLE(dependency-tracking,
 [  --disable-dependency-tracking Speeds up one-time builds
   --enable-dependency-tracking  Do not reject slow dependency extractors])
 if test "x$enable_dependency_tracking" = xno; then
   AMDEP="#"
 else
-  am_depcomp="$ac_aux_dir/depcomp"
+  am_depcomp="$am_aux_dir/depcomp"
   if test ! -f "$am_depcomp"; then
     AMDEP="#"
   else
--- old/automake-1.4b/m4/init.m4        Sat Oct 14 01:42:39 2000
+++ automake-1.4b/m4/init.m4    Mon Jan 22 21:11:22 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/missing.m4     Sat Oct 14 01:42:39 2000
+++ automake-1.4b/m4/missing.m4 Sun Jan 28 17:39:52 2001
@@ -11,10 +11,11 @@
 # AM_MISSING_INSTALL_SH()
 AC_DEFUN([AM_MISSING_INSTALL_SH], [
 AC_REQUIRE([AM_MISSING_HAS_RUN])
+AC_REQUIRE([AM_AUX_DIR_EXPAND])
 if test -z "$install_sh"; then
-   install_sh="$ac_aux_dir/install-sh"
-   test -f "$install_sh" || install_sh="$ac_aux_dir/install.sh"
-   test -f "$install_sh" || 
install_sh="${am_missing_run}${ac_auxdir}/install-sh"
+   install_sh="${am_aux_dir}/install-sh"
+   test -f "$install_sh" || install_sh="${am_aux_dir}/install.sh"
+   test -f "$install_sh" || 
install_sh="${am_missing_run}${am_aux_dir}/install-sh"
    dnl FIXME: an evil hack: we remove the SHELL invocation from
    dnl install_sh because automake adds it back in.  Sigh.
    install_sh="`echo $install_sh | sed -e 's/\${SHELL}//'`"
@@ -25,8 +26,9 @@
 # Define MISSING if not defined so far and test if it supports --run.
 # If it does, set am_missing_run to use it, otherwise, to nothing.
 AC_DEFUN([AM_MISSING_HAS_RUN], [
+AC_REQUIRE([AM_AUX_DIR_EXPAND])
 test x"${MISSING+set}" = xset || \
-  MISSING="\${SHELL} `CDPATH=:; cd $ac_aux_dir && pwd`/missing"
+  MISSING="\${SHELL} $am_aux_dir/missing"
 # Use eval to expand $SHELL
 if eval "$MISSING --run :"; then
   am_missing_run="$MISSING --run "
@@ -35,4 +37,28 @@
   am_backtick='`'
   AC_MSG_WARN([${am_backtick}missing' script is too old or missing])
 fi
+])
+
+# AM_AUX_DIR_EXPAND
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to ${srcdir}/foo.  In other projects, it is set to `.'.
+# Of course, Automake must honor this variable whenever it call a tool
+# from the auxiliary directory.  The problem is that $srcdir (hence
+# $ac_aux_dir) can be either an absolute path or a path relative to
+# $top_srcdir or absolute, this depends on how configure is run.  This
+# is pretty anoying since it makes $ac_aux_dir quite unusable in
+# subdirectories: on the top source directory, any form will work
+# fine, but in subdirectories relative pat needs to be adapted.
+# - calling $top_srcidr/$ac_aux_dir/missing would success if $srcdir is
+#   relative, but fail if $srcdir is absolute
+# - conversly, calling $ax_aux_dir/missing would fail if $srcdir is
+#   absolute, and success on relative paths.
+#
+# Consequently, we define and use $am_aux_dir, the "always absolute"
+# version of $ac_aux_dir.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND], [
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd`
 ])
--- old/automake-1.4b/m4/strip.m4       Fri Jan 19 22:33:47 2001
+++ automake-1.4b/m4/strip.m4   Sun Jan 28 19:56:40 2001
@@ -0,0 +1,44 @@
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross=compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so if we ever
+# need to use a non standard strip, we just have to make sure we use
+# install-sh with the STRIPPROG variable set.
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_MISSING_INSTALL_SH])
+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 a suitable `strip'
+  AM_PROG_STRIP
+  if test -z "$STRIP"; then
+    AC_MSG_WARN([strip missing, install-strip will not strip binaries])
+  fi
+fi
+
+# If $STRIP is defined (either by the user, or by AM_PROG_STRIP),
+# instruct install-strip to use install-sh and the given $STRIP program.
+# Otherwise, just use ${INSTALL}: the idea is to use the vendor install
+# as much as possible, because it's faster.
+if test -z "$STRIP"; then
+  # The top level make will set INSTALL_PROGRAM=$(INSTALL_STRIP_PROGRAM)
+  # and the double dolard below is there to make sure that ${INSTALL}
+  # is substitued in the sub-makes, not at the top-level; this is
+  # needed if ${INSTALL} is a relative path (ajusted in each subdirectory
+  # by config.status).
+  INSTALL_STRIP_PROGRAM='$${INSTALL} -s'
+  INSTALL_STRIP_PROGRAM_ENV=''
+else
+  INSTALL_STRIP_PROGRAM='${SHELL} $(install_sh) -c -s'
+  INSTALL_STRIP_PROGRAM_ENV="STRIPPROG='$STRIP'"
+fi
+AC_SUBST([INSTALL_STRIP_PROGRAM])
+AC_SUBST([INSTALL_STRIP_PROGRAM_ENV])])
+
+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
+])
--- old/automake-1.4b/progs.am  Wed Oct 18 19:18:33 2000
+++ automake-1.4b/progs.am      Mon Jan 22 21:11:22 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
 

-- 
Alexandre Duret-Lutz



reply via email to

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