From 7cf581dde321e37cfe5fa5fa8ea491310da65ca3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 12 Dec 2006 00:03:17 +0000 Subject: [PATCH] * configure.ac (ASCPPPOST): Simplify to use just 'sed'. * lib/Makefile.am (match.$(OBJEXT)): Check for CPP failure. 2006-12-11 Bruno Haible 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 --- ChangeLog | 17 +++++++++++++++++ configure.ac | 21 ++++++++++++--------- gzip.c | 3 ++- lib/Makefile.am | 10 ++++------ 4 files changed, 35 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1259454..c515d6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2006-12-11 Paul Eggert + + * configure.ac (ASCPPPOST): Simplify to use just 'sed'. + * lib/Makefile.am (match.$(OBJEXT)): Check for CPP failure. + +2006-12-11 Bruno Haible + + 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 The SSIZE_MAX fix didn't work on NSK, so fix it in a more-reliable diff --git a/configure.ac b/configure.ac index a3267ab..ace5fbc 100644 --- a/configure.ac +++ b/configure.ac @@ -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 96bbccd..0e36501 100644 --- 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 diff --git a/lib/Makefile.am b/lib/Makefile.am index 9501737..b538974 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -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 -- 2.47.2