bug-gnulib
[Top][All Lists]
Advanced

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

Minix support, part 6


From: Bruno Haible
Subject: Minix support, part 6
Date: Sun, 31 Jul 2011 22:39:27 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

With gcc, I'm getting these compilation errors:

gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I..  -DGNULIB_STRICT_CHECKING=1  -Wall 
-I/home/bruno/prefix-minix-gcc/include  -g -O2 -MT regex.o -MD -MP -MF 
$depbase.Tpo -c -o regex.o regex.c && mv -f $depbase.Tpo $depbase.Po
In file included from regex_internal.h:37,
                 from regex.c:59:
./wctype.h:579: error: static declaration of 'towlower' follows non-static 
declaration
./wctype.h:590: error: static declaration of 'towupper' follows non-static 
declaration
*** Error code 1 (continuing)

gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I..  -DGNULIB_STRICT_CHECKING=1  -Wall 
-I/home/bruno/prefix-minix-gcc/include  -g -O2 -MT wcwidth.o -MD -MP -MF 
$depbase.Tpo -c -o wcwidth.o wcwidth.c && mv -f $depbase.Tpo $depbase.Po
In file included from wcwidth.c:23:
./wctype.h:579: error: static declaration of 'towlower' follows non-static 
declaration
./wctype.h:590: error: static declaration of 'towupper' follows non-static 
declaration
*** Error code 1 (continuing)


Again, it's because of functions that are declared in the header files but
are not defined. Here's the workaround:


2011-07-31  Bruno Haible  <address@hidden>

        wctype-h: Add support for Minix.
        * m4/wctype_h.m4 (gl_WCTYPE_H): Test whether towlower is declared. Set
        REPLACE_TOWLOWER.
        * modules/wctype-h (Makefile.am): Substitute REPLACE_TOWLOWER.
        * lib/wctype.in.h (towlower, towupper): Test REPLACE_TOWLOWER, not
        REPLACE_ISWCNTRL.

--- lib/wctype.in.h.orig        Sun Jul 31 22:33:06 2011
+++ lib/wctype.in.h     Sun Jul 31 22:26:55 2011
@@ -128,6 +128,10 @@
 #    define iswspace rpl_iswspace
 #    define iswupper rpl_iswupper
 #    define iswxdigit rpl_iswxdigit
+#   endif
+#  endif
+#  if @REPLACE_TOWLOWER@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #    define towlower rpl_towlower
 #    define towupper rpl_towupper
 #   endif
@@ -271,7 +275,7 @@
 }
 
 static inline wint_t
-#  if @REPLACE_ISWCNTRL@
+#  if @REPLACE_TOWLOWER@
 rpl_towlower
 #  else
 towlower
@@ -282,7 +286,7 @@
 }
 
 static inline wint_t
-#  if @REPLACE_ISWCNTRL@
+#  if @REPLACE_TOWLOWER@
 rpl_towupper
 #  else
 towupper
@@ -429,7 +433,7 @@
 # endif
 #endif
 
-#if @REPLACE_ISWCNTRL@ || defined __MINGW32__
+#if @REPLACE_TOWLOWER@ || defined __MINGW32__
 _GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc));
 _GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc));
 #else
--- m4/wctype_h.m4.orig Sun Jul 31 22:33:06 2011
+++ m4/wctype_h.m4      Sun Jul 31 22:28:40 2011
@@ -1,4 +1,4 @@
-# wctype_h.m4 serial 14
+# wctype_h.m4 serial 15
 
 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
 
@@ -75,7 +75,39 @@
   AC_SUBST([REPLACE_ISWCNTRL])
 
   if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then
-    dnl Redefine all of iswcntrl, ..., towupper in <wctype.h>.
+    dnl Redefine all of iswcntrl, ..., iswxdigit in <wctype.h>.
+    :
+  fi
+
+  if test $REPLACE_ISWCNTRL = 1; then
+    REPLACE_TOWLOWER=1
+  else
+    AC_CHECK_DECLS([towlower],,,
+      [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be
+           included before <wchar.h>.
+           BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h>
+           must be included before <wchar.h>.  */
+        #include <stddef.h>
+        #include <stdio.h>
+        #include <time.h>
+        #include <wchar.h>
+        #if HAVE_WCTYPE_H
+        # include <wctype.h>
+        #endif
+      ]])
+    if test $ac_cv_have_decl_towlower = yes; then
+      dnl On Minix 3.1.8, the system's <wctype.h> declares towlower() and
+      dnl towupper() although it does not have the functions. Avoid a collision
+      dnl with gnulib's replacement.
+      REPLACE_TOWLOWER=1
+    else
+      REPLACE_TOWLOWER=0
+    fi
+  fi
+  AC_SUBST([REPLACE_TOWLOWER])
+
+  if test $HAVE_ISWCNTRL = 0 || test $REPLACE_TOWLOWER = 1; then
+    dnl Redefine towlower, towupper in <wctype.h>.
     :
   fi
 
--- modules/wctype-h.orig       Sun Jul 31 22:33:06 2011
+++ modules/wctype-h    Sun Jul 31 22:24:37 2011
@@ -40,6 +40,7 @@
              -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
              -e 's/@''REPLACE_ISWBLANK''@/$(REPLACE_ISWBLANK)/g' \
              -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \
+             -e 's/@''REPLACE_TOWLOWER''@/$(REPLACE_TOWLOWER)/g' \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/wctype.in.h; \

-- 
In memoriam Jean Jaurès <http://en.wikipedia.org/wiki/Jean_Jaurès>



reply via email to

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