* configure.ac (ASCPPPOST): Simplify to use just 'sed'.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 12 Dec 2006 00:03:17 +0000 (00:03 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 12 Dec 2006 00:03:17 +0000 (00:03 +0000)
* lib/Makefile.am (match.$(OBJEXT)): Check for CPP failure.

2006-12-11  Bruno Haible  <bruno@clisp.org>

Cross-compilation support.
* configure.ac (ASCPP): Remove substituted variable.
(ASCPPPOST, ASCPPFLAGS): New substituted variables.
* lib/Makefile.am (ASCPP, LN_S): Remove unnecessary macro definitions.
(match.$(OBJEXT)): Use CPP, ASCPPFLAGS, ASCPPPOST instead of ASCPP.
* configure.ac: Add test for chown function.
* gzip.c (treat_file) [!HAVE_CHOWN]: Don't call chown.
* gzip.c: Include "timespec.h".  This doesn't fix any bugs, but
it is clearer.

2006-12-11  Paul Eggert  <eggert@cs.ucla.edu>

ChangeLog
configure.ac
gzip.c
lib/Makefile.am

index 1259454c254ec98873a911607018413e80fea584..c515d6aacfaf3acd90b80d941e7d40fd8709ed79 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2006-12-11  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * configure.ac (ASCPPPOST): Simplify to use just 'sed'.
+       * lib/Makefile.am (match.$(OBJEXT)): Check for CPP failure.
+
+2006-12-11  Bruno Haible  <bruno@clisp.org>
+
+       Cross-compilation support.
+       * configure.ac (ASCPP): Remove substituted variable.
+       (ASCPPPOST, ASCPPFLAGS): New substituted variables.
+       * lib/Makefile.am (ASCPP, LN_S): Remove unnecessary macro definitions.
+       (match.$(OBJEXT)): Use CPP, ASCPPFLAGS, ASCPPPOST instead of ASCPP.
+       * configure.ac: Add test for chown function.
+       * gzip.c (treat_file) [!HAVE_CHOWN]: Don't call chown.
+       * gzip.c: Include "timespec.h".  This doesn't fix any bugs, but
+       it is clearer.
+
 2006-12-11  Paul Eggert  <eggert@cs.ucla.edu>
 
        The SSIZE_MAX fix didn't work on NSK, so fix it in a more-reliable
index a3267ab6a0ef69b26b698357c0e0442f81e836d1..ace5fbc17631d5b895776f3c457d99240cce27b6 100644 (file)
@@ -28,6 +28,7 @@ AM_INIT_AUTOMAKE([gnits])
 AC_PROG_CC_STDC
 AM_PROG_CC_C_O
 AC_PROG_CPP
+AC_CHECK_TOOL([NM], [nm], [nm])
 AC_PROG_LN_S
 AC_PROG_RANLIB
 AC_PROG_SHELL
@@ -37,29 +38,32 @@ AC_SYS_LARGEFILE
 
 gl_INIT
 
-# cc -E produces incorrect asm files on SVR4, we must use /lib/cpp.
-test -z "$ASCPP" && test -f /lib/cpp && ASCPP=/lib/cpp
-test -z "$ASCPP" && ASCPP="$CPP"
+# cc -E produces incorrect asm files on SVR4, so postprocess it.
+ASCPPPOST="sed '/^ *#/d; s,//.*,,; s/% /%/g; s/\\. /./g'"
+AC_SUBST([ASCPPPOST])
 
 AC_CACHE_CHECK([for underline in external names], [gzip_cv_underline],
   [gzip_cv_underline=yes
    AC_TRY_COMPILE([int foo() {return 0;}], [],
-     [nm conftest.$OBJEXT | grep _foo >/dev/null 2>&1 ||
+     [$NM conftest.$OBJEXT | grep _foo >/dev/null 2>&1 ||
        gzip_cv_underline=no])])
+ASCPPFLAGS=
 if test $gzip_cv_underline = no; then
-  ASCPP="${ASCPP} -DNO_UNDERLINE"
+  ASCPPFLAGS='-DNO_UNDERLINE'
 fi
+AC_SUBST([ASCPPFLAGS])
 AC_OBJEXT
 
 # Try to assemble match.S.
 # "gcc -E match.s" ignores -E, so we must use match_.s.
-AC_CACHE_CHECK([for assembler], [gzip_cv_assembler],
+AC_CACHE_CHECK([for an assembler syntax supported by this package],
+  [gzip_cv_assembler],
   [gzip_cv_assembler=no
    case " $DEFS " in
    *' NO_ASM '*) ;;
    *)
      if cp $srcdir/lib/match.c _match.S &&
-       eval "$ASCPP _match.S > match_.s 2>/dev/null"; then
+       eval "$CPP $ASCPPFLAGS _match.S | $ASCPPPOST > match_.s 2>/dev/null"; then
        if test ! -s match_.s || grep error < match_.s > /dev/null; then
         :
        elif eval "$CC -c match_.s >/dev/null 2>&1" &&
@@ -93,14 +97,13 @@ AC_ISC_POSIX
 AC_C_CONST
 AC_HEADER_STDC
 AC_CHECK_HEADERS_ONCE(fcntl.h limits.h memory.h time.h)
-AC_CHECK_FUNCS_ONCE([fchmod fchown fdopendir lstat siginterrupt])
+AC_CHECK_FUNCS_ONCE([chown fchmod fchown fdopendir lstat siginterrupt])
 AC_HEADER_DIRENT
 AC_TYPE_SIGNAL
 AC_TYPE_SIZE_T
 AC_TYPE_OFF_T
 
 AC_PREFIX_PROGRAM(gzip)
-AC_SUBST(ASCPP)dnl
 
 AC_CONFIG_FILES([Makefile doc/Makefile lib/Makefile])
 AC_OUTPUT
diff --git a/gzip.c b/gzip.c
index 96bbccdb859970eea4fcdf28cd3ef479d6ee6c39..0e36501cb07e84a90a9d10c0d384e0af6736d277 100644 (file)
--- a/gzip.c
+++ b/gzip.c
@@ -72,6 +72,7 @@ static char rcsid[] = "$Id$";
 #include "fcntl-safer.h"
 #include "getopt.h"
 #include "stat-time.h"
+#include "timespec.h"
 
                /* configuration */
 
@@ -1652,7 +1653,7 @@ local void copy_stat(ifstat)
 #ifndef NO_CHOWN
 # if HAVE_FCHOWN
     fchown (ofd, ifstat->st_uid, ifstat->st_gid);  /* Copy ownership */
-# else
+# elif HAVE_CHOWN
     chown(ofname, ifstat->st_uid, ifstat->st_gid);  /* Copy ownership */
 # endif
 #endif
index 95017370c100289ad847a56d5bb5d7426cf8e292..b5389742bc1f4a347cb3aac6e1021a36a0628e00 100644 (file)
@@ -22,14 +22,12 @@ include gnulib.mk
 libgzip_a_LIBADD += $(LIBOBJS)
 libgzip_a_DEPENDENCIES += $(LIBOBJS)
 
-ASCPP = @ASCPP@
-LN_S = @LN_S@
-
 match.$(OBJEXT): match.c
        cp $(srcdir)/match.c _match.S
-       $(ASCPP) _match.S > match_.s
+       $(CPP) $(ASCPPFLAGS) _match.S > _match.i
+       @ASCPPPOST@ < _match.i > match_.s
        $(CC) -c $(CFLAGS) $(ASFLAGS_config) match_.s
        mv match_.$(OBJEXT) $@
-       rm -f _match.S match_.s
+       rm -f _match.S _match.i match_.s
 
-MOSTLYCLEANFILES += _match.S match_.s
+MOSTLYCLEANFILES += _match.S _match.i match_.s