[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: coreutils 6.6 fails to compile on IRIX 5.3
From: |
Paul Eggert |
Subject: |
Re: coreutils 6.6 fails to compile on IRIX 5.3 |
Date: |
Thu, 21 Dec 2006 16:29:47 -0800 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
This is following up on the thread here:
<http://lists.gnu.org/archive/html/bug-coreutils/2006-12/msg00017.html>
Georg Schwarz <address@hidden> writes:
> 6.7 fails the same way:
>
> cc -g -o dir ls.o ls-dir.o ../lib/libcoreutils.a ../lib/libcoreutils.a
> ld:
> Unresolved:
> _ctmp_
> _iswctype
> ...
> Symbols from ./lib/mbswidth.o:
> [219] | 0| |Global |typedef wchar_t | Undefined|
> _ctmp_
> [220] | 0| |Proc | | Undefined|
> _iswctype
>
> Symbols from ./lib/regex.o:
>
> [2480] | 4| |Global |typedef wchar_t | scNil| _ctmp_
>
> Symbols from ./src/ls.o:
>
> [2476] | 0| |Global |typedef wchar_t | Undefined|
> _ctmp_
> [2477] | 0| |Proc | | Undefined|
> _iswct ype
Thanks for checking that.
<http://mail.gnome.org/archives/gtk-list/1998-January/msg00471.html>
makes it clear that we can work around the problem by adding this
declaration:
wchar_t _ctmp_;
We could put this into every source file that includes wctype.h,
but I think it's cleaner to have a wctype module that handles
wctype gotchas like this.
So I installed the following patch into gnulib, which I hope fixes the
problem for regex.o and ls.o. I'll address the mbswidth.o issue in a
followup message. I'm afraid the only way to really try this is to
bootstrap coreutils from CVS
<http://savannah.gnu.org/cvs/?group=coreutils>. I can help you out
with that if you want to try it, but you may want to wait for the next
coreutils release.
2006-12-21 Paul Eggert <address@hidden>
* MODULES.html.sh: New module wctype.
* lib/wctype_.h, m4/wctype.m4, modules/wctype: New files.
* lib/fnmatch.c: Don't bother to include <wchar.h> before
<wctype.h>, since the new wctype module should fix this.
* lib/quotearg.c: Include <wctype.h> unconditionally, since
the wctype module should arrange for it.
* lib/regex_internal.h: Likewise.
* m4/quotearg.m4 (gl_QUOTEARG): Don't check for wctype.h or iswprint,
since the wctype module should handle this now.
* m4/regex.m4 (gl_PREREQ_REGEX): Don't check for wctype.h.
* modules/fnmatch (Depends-on): Add wctype.
* modules/quotearg (Depends-on): Likewise.
* modules/regex (Depends-on): Likewise.
Index: MODULES.html.sh
===================================================================
RCS file: /cvsroot/gnulib/gnulib/MODULES.html.sh,v
retrieving revision 1.162
diff -u -p -r1.162 MODULES.html.sh
--- MODULES.html.sh 18 Dec 2006 18:04:20 -0000 1.162
+++ MODULES.html.sh 22 Dec 2006 00:21:51 -0000
@@ -1814,6 +1814,16 @@ func_all_modules ()
func_module strtoull
func_end_table
+ element="Wide character classification and mapping utilities <wctype.h>"
+ element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
+ func_section_wrap isoc_sup_wctype
+ func_wrap H3
+ func_echo "$element"
+
+ func_begin_table
+ func_module wctype
+ func_end_table
+
element="Functions for greatest-width integer types <inttypes.h>"
element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
func_section_wrap isoc_sup_inttypes
Index: lib/wctype_.h
===================================================================
RCS file: lib/wctype_.h
diff -N lib/wctype_.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/wctype_.h 22 Dec 2006 00:21:51 -0000
@@ -0,0 +1,160 @@
+/* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
+
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Written by Bruno Haible and Paul Eggert. */
+
+/* iswctype, towctrans, towlower, towupper, wctrans, wctype,
+ wctrans_t, and wctype_t are not yet implemented. */
+
+#ifndef _GL_WCTYPE_H
+#define _GL_WCTYPE_H
+
+/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
+ <wchar.h>.
+ BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
+ <wchar.h>. */
+#include <stdio.h>
+#include <time.h>
+#include <wchar.h>
+
+#if @HAVE_WCTYPE_H@
+# include @ABSOLUTE_WCTYPE_H@
+#endif
+
+#if @HAVE_WCTYPE_CTMP_BUG@
+static wint_t _ctmp_;
+#endif
+
+/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
+ Assume all 12 functions are implemented the same way, or not at all. */
+
+#if !defined iswalnum && !HAVE_ISWCNTRL
+static inline int
+iswalnum (wint_t wc)
+{
+ return ((wc >= '0' && wc <= '9')
+ || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
+}
+# define iswalnum iswalnum
+#endif
+
+#if !defined iswalpha && !HAVE_ISWCNTRL
+static inline int
+iswalpha (wint_t wc)
+{
+ return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
+}
+# define iswalpha iswalpha
+#endif
+
+#if !defined iswblank && !HAVE_ISWCNTRL
+static inline int
+iswblank (wint_t wc)
+{
+ return wc == ' ' || wc == '\t';
+}
+# define iswblank iswblank
+#endif
+
+#if !defined iswcntrl && !HAVE_ISWCNTRL
+static inline int
+iswcntrl (wint_t wc)
+{
+ return (wc & ~0x1f) == 0 || wc == 0x7f;
+}
+# define iswcntrl iswcntrl
+#endif
+
+#if !defined iswdigit && !HAVE_ISWCNTRL
+static inline int
+iswdigit (wint_t wc)
+{
+ return wc >= '0' && wc <= '9';
+}
+# define iswdigit iswdigit
+#endif
+
+#if !defined iswgraph && !HAVE_ISWCNTRL
+static inline int
+iswgraph (wint_t wc)
+{
+ return wc >= '!' && wc <= '~';
+}
+# define iswgraph iswgraph
+#endif
+
+#if !defined iswlower && !HAVE_ISWCNTRL
+static inline int
+iswlower (wint_t wc)
+{
+ return wc >= 'a' && wc <= 'z';
+}
+# define iswlower iswlower
+#endif
+
+#if !defined iswprint && !HAVE_ISWCNTRL
+static inline int
+iswprint (wint_t wc)
+{
+ return wc >= ' ' && wc <= '~';
+}
+# define iswprint iswprint
+#endif
+
+#if !defined iswpunct && !HAVE_ISWCNTRL
+static inline int
+iswpunct (wint_t wc)
+{
+ return (wc >= '!' && wc <= '~'
+ && !((wc >= '0' && wc <= '9')
+ || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
+}
+# define iswpunct iswpunct
+#endif
+
+#if !defined iswspace && !HAVE_ISWCNTRL
+static inline int
+iswspace (wint_t wc)
+{
+ return (wc == ' ' || wc == '\t'
+ || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
+}
+# define iswspace iswspace
+#endif
+
+#if !defined iswupper && !HAVE_ISWCNTRL
+static inline int
+iswupper (wint_t wc)
+{
+ return wc >= 'A' && wc <= 'Z';
+}
+# define iswupper iswupper
+#endif
+
+#if !defined iswxdigit && !HAVE_ISWCNTRL
+static inline int
+iswxdigit (wint_t wc)
+{
+ return ((wc >= '0' && wc <= '9')
+ || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
+}
+# define iswxdigit iswxdigit
+#endif
+
+
+#endif /* _GL_WCTYPE_H */
Index: lib/fnmatch.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/fnmatch.c,v
retrieving revision 1.37
diff -u -p -r1.37 fnmatch.c
--- lib/fnmatch.c 4 Dec 2006 06:41:56 -0000 1.37
+++ lib/fnmatch.c 22 Dec 2006 00:21:51 -0000
@@ -46,8 +46,6 @@
/* For platform which support the ISO C amendement 1 functionality we
support user defined character classes. */
#if defined _LIBC || WIDE_CHAR_SUPPORT
-/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
-# include <wchar.h>
# include <wctype.h>
#endif
Index: lib/quotearg.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/quotearg.c,v
retrieving revision 1.52
diff -u -p -r1.52 quotearg.c
--- lib/quotearg.c 8 Nov 2006 20:13:12 -0000 1.52
+++ lib/quotearg.c 22 Dec 2006 00:21:51 -0000
@@ -62,14 +62,7 @@
# define mbsinit(ps) 1
#endif
-#ifndef iswprint
-# if HAVE_WCTYPE_H
-# include <wctype.h>
-# endif
-# if !defined iswprint && !HAVE_ISWPRINT
-# define iswprint(wc) 1
-# endif
-#endif
+#include <wctype.h>
#ifndef SIZE_MAX
# define SIZE_MAX ((size_t) -1)
Index: lib/regex_internal.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/regex_internal.h,v
retrieving revision 1.26
diff -u -p -r1.26 regex_internal.h
--- lib/regex_internal.h 4 Dec 2006 06:41:56 -0000 1.26
+++ lib/regex_internal.h 22 Dec 2006 00:21:51 -0000
@@ -40,9 +40,7 @@
#if defined HAVE_WCHAR_H || defined _LIBC
# include <wchar.h>
#endif /* HAVE_WCHAR_H || _LIBC */
-#if defined HAVE_WCTYPE_H || defined _LIBC
-# include <wctype.h>
-#endif /* HAVE_WCTYPE_H || _LIBC */
+#include <wctype.h>
#include <stdint.h>
#if defined _LIBC
# include <bits/libc-lock.h>
Index: m4/wctype.m4
===================================================================
RCS file: m4/wctype.m4
diff -N m4/wctype.m4
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ m4/wctype.m4 22 Dec 2006 00:21:51 -0000
@@ -0,0 +1,54 @@
+dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
+
+dnl Copyright (C) 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Written by Paul Eggert.
+
+AC_DEFUN([gl_WCTYPE_H],
+[
+ AC_CHECK_FUNCS_ONCE([iswcntrl])
+ AC_CHECK_HEADERS_ONCE([wctype.h])
+ AC_REQUIRE([AC_C_INLINE])
+
+ if test $ac_cv_header_wctype_h = yes; then
+ gl_ABSOLUTE_HEADER([wctype.h])
+ ABSOLUTE_WCTYPE_H=\"$gl_cv_absolute_wctype_h\"
+ HAVE_WCTYPE_H=1
+ else
+ ABSOLUTE_WCTYPE_H=\"no/such/file/wctype.h\"
+ HAVE_WCTYPE_H=0
+ fi
+ AC_SUBST([ABSOLUTE_WCTYPE_H])
+ AC_SUBST([HAVE_WCTYPE_H])
+
+ WCTYPE_H=wctype.h
+ HAVE_WCTYPE_CTMP_BUG=0
+ if test $ac_cv_header_wctype_h = yes; then
+ AC_CACHE_CHECK([whether wctype macros need _ctmp_ declared],
+ [gl_cv_wctype_ctmp_bug],
+ [gl_cv_wctype_ctmp_bug=no
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <wctype.h>
+ ]],
+ [[return iswprint (0);]])],
+ [gl_cv_wctype_ctmp_bug='no, but bare wctype.h does not work'],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <wctype.h>
+ static wint_t _ctmp_;]],
+ [[return iswprint (0);]])],
+ [gl_cv_wctype_ctmp_bug=yes])])])
+ case $gl_cv_wctype_ctmp_bug,$ac_cv_func_iswcntrl in #(
+ yes,*)
+ HAVE_WCTYPE_CTMP_BUG=1;; #(
+ no,yes)
+ WCTYPE_H=;;
+ esac
+ fi
+ AC_SUBST([WCTYPE_H])
+ AC_SUBST([HAVE_WCTYPE_CTMP_BUG])
+])
Index: m4/quotearg.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/quotearg.m4,v
retrieving revision 1.6
diff -u -p -r1.6 quotearg.m4
--- m4/quotearg.m4 21 Aug 2006 21:46:31 -0000 1.6
+++ m4/quotearg.m4 22 Dec 2006 00:21:51 -0000
@@ -9,8 +9,8 @@ AC_DEFUN([gl_QUOTEARG],
AC_LIBOBJ([quotearg])
dnl Prerequisites of lib/quotearg.c.
- AC_CHECK_HEADERS_ONCE(wchar.h wctype.h)
- AC_CHECK_FUNCS_ONCE(iswprint mbsinit)
+ AC_CHECK_HEADERS_ONCE([wchar.h])
+ AC_CHECK_FUNCS_ONCE([mbsinit])
AC_TYPE_MBSTATE_T
gl_FUNC_MBRTOWC
])
Index: m4/regex.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/regex.m4,v
retrieving revision 1.58
diff -u -p -r1.58 regex.m4
--- m4/regex.m4 4 Dec 2006 06:41:56 -0000 1.58
+++ m4/regex.m4 22 Dec 2006 00:21:51 -0000
@@ -193,7 +193,7 @@ AC_DEFUN([gl_PREREQ_REGEX],
AC_REQUIRE([AC_GNU_SOURCE])
AC_REQUIRE([AC_C_RESTRICT])
AC_REQUIRE([AM_LANGINFO_CODESET])
- AC_CHECK_HEADERS_ONCE([wchar.h wctype.h])
+ AC_CHECK_HEADERS_ONCE([wchar.h])
AC_CHECK_FUNCS_ONCE([iswctype mbrtowc mempcpy wcrtomb wcscoll])
AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>])
])
Index: modules/wctype
===================================================================
RCS file: modules/wctype
diff -N modules/wctype
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules/wctype 22 Dec 2006 00:21:51 -0000
@@ -0,0 +1,36 @@
+Description:
+A <wctype.h> that conforms better to C99.
+
+Files:
+lib/wctype_.h
+m4/wctype.m4
+
+Depends-on:
+
+configure.ac:
+gl_WCTYPE_H
+
+Makefile.am:
+BUILT_SOURCES += $(WCTYPE_H)
+
+# We need the following in order to create <wctype.h> when the system
+# doesn't have one that works with the given compiler.
+wctype.h: wctype_.h
+ rm -f address@hidden $@
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \
+ -e 's|@''ABSOLUTE_WCTYPE_H''@|$(ABSOLUTE_WCTYPE_H)|g' \
+ -e 's/@''HAVE_WCTYPE_CTMP_BUG''@/$(HAVE_WCTYPE_CTMP_BUG)/g' \
+ < $(srcdir)/wctype_.h; \
+ } > address@hidden
+ mv address@hidden $@
+MOSTLYCLEANFILES += wctype.h wctype.h-t
+
+Include:
+#include <wctype.h>
+
+License:
+LGPL
+
+Maintainer:
+all
Index: modules/fnmatch
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/fnmatch,v
retrieving revision 1.15
diff -u -p -r1.15 fnmatch
--- modules/fnmatch 13 Oct 2006 12:40:23 -0000 1.15
+++ modules/fnmatch 22 Dec 2006 00:21:51 -0000
@@ -11,6 +11,7 @@ m4/fnmatch.m4
Depends-on:
alloca
stdbool
+wctype
configure.ac:
# No macro. You should also use one of fnmatch-posix or fnmatch-gnu.
Index: modules/quotearg
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/quotearg,v
retrieving revision 1.10
diff -u -p -r1.10 quotearg
--- modules/quotearg 13 Oct 2006 12:40:23 -0000 1.10
+++ modules/quotearg 22 Dec 2006 00:21:51 -0000
@@ -12,6 +12,7 @@ Depends-on:
xalloc
gettext-h
stdbool
+wctype
configure.ac:
gl_QUOTEARG
Index: modules/regex
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/regex,v
retrieving revision 1.18
diff -u -p -r1.18 regex
--- modules/regex 13 Oct 2006 12:40:23 -0000 1.18
+++ modules/regex 22 Dec 2006 00:21:51 -0000
@@ -19,6 +19,7 @@ malloc
stdint
strcase
ssize_t
+wctype
configure.ac:
gl_REGEX
- Re: coreutils 6.6 fails to compile on IRIX 5.3, Jim Meyering, 2006/12/03
- Re: coreutils 6.6 fails to compile on IRIX 5.3, Paul Eggert, 2006/12/04
- Message not available
- Re: coreutils 6.6 fails to compile on IRIX 5.3, Eric Blake, 2006/12/26
- Re: coreutils 6.6 fails to compile on IRIX 5.3, Eric Blake, 2006/12/27
- Re: coreutils 6.6 fails to compile on IRIX 5.3, Eric Blake, 2006/12/27
- Re: coreutils 6.6 fails to compile on IRIX 5.3, Jim Meyering, 2006/12/27
- Re: coreutils 6.6 fails to compile on IRIX 5.3, Paul Eggert, 2006/12/27