bug-gnulib
[Top][All Lists]
Advanced

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

Re: Error compiling strtoimax.c on hppa2.0w-hp-hpux11.11


From: Paul Eggert
Subject: Re: Error compiling strtoimax.c on hppa2.0w-hp-hpux11.11
Date: Wed, 09 Oct 2013 08:06:52 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0

Thanks, apparently this problem has been around for a while; see
<http://lists.gnu.org/archive/html/bug-bash/2005-09/msg00022.html>.

I pushed the following patch, which I hope fixes things for you.
It'll be a bit more of a pain to merge this into bash etc.,
but you can test it separately by grabbing a copy of the latest
gnulib via 'git clone git://git.savannah.gnu.org/gnulib.git'
and then running the command:

./gnulib-tool --test strtoimax strtoumax

I've done that on Fedora 19 but don't have a HP-UX 11.11 host
to try it out on.

>From 42d263937a411dfc4685aa3384d34b9888daeb06 Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Wed, 9 Oct 2013 08:05:24 -0700
Subject: [PATCH] strtoimax, strtoumax: port to HP-UX 11.11

Problem reported by Daniel Richard G. in
<http://lists.gnu.org/archive/html/bug-gnulib/2013-10/msg00023.html>.
* lib/inttypes.in.h (strtoumax): Replace strtoumax if
REPLACE_STRTOUMAX, thus treating it consistently with strtoimax.
* m4/inttypes.m4 (gl_INTTYPES_H_DEFAULTS): Add default for
REPLACE_STRTOUMAX.
* m4/strtoimax.m4 (gl_FUNC_STRTOIMAX):
* m4/strtoumax.m4 (gl_FUNC_STRTOUMAX):
Replace the function if defined as a macro but not as a function.
* modules/inttypes-incomplete (inttypes.h): Substitute
REPLACE_STRTOUMAX.
* modules/strtoumax (configure.ac): Replace strtoumax if
REPLACE_STRTOUMAX.
---
 ChangeLog                   | 17 +++++++++++++++++
 lib/inttypes.in.h           | 16 +++++++++++++---
 m4/inttypes.m4              |  1 +
 m4/strtoimax.m4             |  8 ++++++--
 m4/strtoumax.m4             |  9 +++++++--
 modules/inttypes-incomplete |  1 +
 modules/strtoumax           |  2 +-
 7 files changed, 46 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1d3cb6c..b176e1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2013-10-09  Paul Eggert  <address@hidden>
+
+       strtoimax, strtoumax: port to HP-UX 11.11
+       Problem reported by Daniel Richard G. in
+       <http://lists.gnu.org/archive/html/bug-gnulib/2013-10/msg00023.html>.
+       * lib/inttypes.in.h (strtoumax): Replace strtoumax if
+       REPLACE_STRTOUMAX, thus treating it consistently with strtoimax.
+       * m4/inttypes.m4 (gl_INTTYPES_H_DEFAULTS): Add default for
+       REPLACE_STRTOUMAX.
+       * m4/strtoimax.m4 (gl_FUNC_STRTOIMAX):
+       * m4/strtoumax.m4 (gl_FUNC_STRTOUMAX):
+       Replace the function if defined as a macro but not as a function.
+       * modules/inttypes-incomplete (inttypes.h): Substitute
+       REPLACE_STRTOUMAX.
+       * modules/strtoumax (configure.ac): Replace strtoumax if
+       REPLACE_STRTOUMAX.
+
 2013-10-08  Paul Eggert  <address@hidden>
 
        strtoimax: port to HP-UX 11.11
diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h
index 1893f55..05a22ff 100644
--- a/lib/inttypes.in.h
+++ b/lib/inttypes.in.h
@@ -1105,12 +1105,22 @@ _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
 #endif
 
 #if @GNULIB_STRTOUMAX@
-# if address@hidden@
-#  undef strtoumax
+# if @REPLACE_STRTOUMAX@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strtoumax
+#   define strtoumax rpl_strtoumax
+#  endif
+_GL_FUNCDECL_RPL (strtoumax, uintmax_t,
+                  (const char *, char **, int) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtoumax, uintmax_t, (const char *, char **, int));
+# else
+#  if address@hidden@
+#   undef strtoumax
 _GL_FUNCDECL_SYS (strtoumax, uintmax_t,
                   (const char *, char **, int) _GL_ARG_NONNULL ((1)));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (strtoumax, uintmax_t, (const char *, char **, int));
+# endif
 _GL_CXXALIASWARN (strtoumax);
 #elif defined GNULIB_POSIXCHECK
 # undef strtoumax
diff --git a/m4/inttypes.m4 b/m4/inttypes.m4
index 3b483d3..b06c777 100644
--- a/m4/inttypes.m4
+++ b/m4/inttypes.m4
@@ -148,6 +148,7 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS],
   HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX])
   HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX])
   REPLACE_STRTOIMAX=0;   AC_SUBST([REPLACE_STRTOIMAX])
+  REPLACE_STRTOUMAX=0;   AC_SUBST([REPLACE_STRTOUMAX])
   INT32_MAX_LT_INTMAX_MAX=1;  AC_SUBST([INT32_MAX_LT_INTMAX_MAX])
   INT64_MAX_EQ_LONG_MAX='defined _LP64';  AC_SUBST([INT64_MAX_EQ_LONG_MAX])
   PRI_MACROS_BROKEN=0;   AC_SUBST([PRI_MACROS_BROKEN])
diff --git a/m4/strtoimax.m4 b/m4/strtoimax.m4
index bee93b2..20454dc 100644
--- a/m4/strtoimax.m4
+++ b/m4/strtoimax.m4
@@ -1,4 +1,4 @@
-# strtoimax.m4 serial 13
+# strtoimax.m4 serial 14
 dnl Copyright (C) 2002-2004, 2006, 2009-2013 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -15,7 +15,7 @@ AC_DEFUN([gl_FUNC_STRTOIMAX],
     HAVE_DECL_STRTOIMAX=0
   fi
 
-  if test $ac_cv_func_strtoimax = yes; then
+  if test "$ac_cv_func_strtoimax" = yes; then
     HAVE_STRTOIMAX=1
     dnl On AIX 5.1, strtoimax() fails for values outside the 'int' range.
     AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
@@ -72,6 +72,10 @@ int main ()
       *no) REPLACE_STRTOIMAX=1 ;;
     esac
   else
+    if test "$ac_cv_have_decl_strtoimax" = yes; then
+      # HP-UX 11.11 has "#define strtoimax(...) ..." but no function.
+      REPLACE_STRTOIMAX=1
+    fi
     HAVE_STRTOIMAX=0
   fi
 ])
diff --git a/m4/strtoumax.m4 b/m4/strtoumax.m4
index 6a6aeb5..9c8ff17 100644
--- a/m4/strtoumax.m4
+++ b/m4/strtoumax.m4
@@ -1,4 +1,4 @@
-# strtoumax.m4 serial 11
+# strtoumax.m4 serial 12
 dnl Copyright (C) 2002-2004, 2006, 2009-2013 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -11,7 +11,12 @@ AC_DEFUN([gl_FUNC_STRTOUMAX],
   dnl On OSF/1 5.1 with cc, this function is declared but not defined.
   AC_CHECK_FUNCS_ONCE([strtoumax])
   AC_CHECK_DECLS_ONCE([strtoumax])
-  if test "$ac_cv_have_decl_strtoumax" != yes; then
+  if test "$ac_cv_have_decl_strtoumax" = yes; then
+    if test "$ac_cv_func_strtoumax" != yes; then
+      # HP-UX 11.11 has "#define strtoimax(...) ..." but no function.
+      REPLACE_STRTOUMAX=1
+    fi
+  else
     HAVE_DECL_STRTOUMAX=0
   fi
 ])
diff --git a/modules/inttypes-incomplete b/modules/inttypes-incomplete
index 5943dae..8c29a29 100644
--- a/modules/inttypes-incomplete
+++ b/modules/inttypes-incomplete
@@ -43,6 +43,7 @@ inttypes.h: inttypes.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(WARN_ON_U
              -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
              -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
              -e 's/@''REPLACE_STRTOIMAX''@/$(REPLACE_STRTOIMAX)/g' \
+             -e 's/@''REPLACE_STRTOUMAX''@/$(REPLACE_STRTOUMAX)/g' \
              -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' 
\
              -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \
              -e 
's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \
diff --git a/modules/strtoumax b/modules/strtoumax
index dc72a0a..1d2a15a 100644
--- a/modules/strtoumax
+++ b/modules/strtoumax
@@ -15,7 +15,7 @@ strtoull        [test $ac_cv_func_strtoumax = no && test 
$ac_cv_type_unsigned_lo
 
 configure.ac:
 gl_FUNC_STRTOUMAX
-if test $ac_cv_func_strtoumax = no; then
+if test $HAVE_STRTOUMAX = 0 || test $REPLACE_STRTOUMAX = 1; then
   AC_LIBOBJ([strtoumax])
   gl_PREREQ_STRTOUMAX
 fi
-- 
1.8.3.1





reply via email to

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