[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gzip cross-compile failure
From: |
Paul Eggert |
Subject: |
Re: gzip cross-compile failure |
Date: |
Mon, 11 Dec 2006 16:09:41 -0800 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
Thanks for all that checking. I installed your patches, except for a
couple of minor things. First, I left the #ifndef NO_CHOWN in, since
I want to defer cleaning out the NO_* cruft for a later release of
gzip. Second, I reworded the ASCPPPOST code in lib/Makefile.am to
detect any failures anywhere in the pipeline.
Here's what I installed. Thanks again!
2006-12-11 Paul Eggert <address@hidden>
* configure.ac (ASCPPPOST): Simplify to use just 'sed'.
* lib/Makefile.am (match.$(OBJEXT)): Check for CPP failure.
2006-12-11 Bruno Haible <address@hidden>
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.
Index: configure.ac
===================================================================
RCS file: /cvsroot/gzip/gzip/configure.ac,v
retrieving revision 1.9
diff -p -u -r1.9 configure.ac
--- configure.ac 9 Dec 2006 07:19:57 -0000 1.9
+++ configure.ac 12 Dec 2006 00:03:05 -0000
@@ -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
Index: gzip.c
===================================================================
RCS file: /cvsroot/gzip/gzip/gzip.c,v
retrieving revision 1.10
diff -p -u -r1.10 gzip.c
--- gzip.c 11 Dec 2006 18:54:39 -0000 1.10
+++ gzip.c 12 Dec 2006 00:03:05 -0000
@@ -72,6 +72,7 @@ static char rcsid[] = "$Id: gzip.c,v 1.1
#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: lib/Makefile.am
===================================================================
RCS file: /cvsroot/gzip/gzip/lib/Makefile.am,v
retrieving revision 1.3
diff -p -u -r1.3 Makefile.am
--- lib/Makefile.am 8 Dec 2006 09:30:30 -0000 1.3
+++ lib/Makefile.am 12 Dec 2006 00:03:05 -0000
@@ -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