[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: missing dependency
From: |
Bruno Haible |
Subject: |
Re: missing dependency |
Date: |
Tue, 9 Feb 2010 00:41:57 +0100 |
User-agent: |
KMail/1.9.9 |
Eric Blake wrote:
> But something IS needed. If you use gnulib-tool, but not --with-tests, then
> nothing calls gl_FUNC_OBSTACK_PRINTF, which means that
> HAVE_DECL_OBSTACK_PRINTF
> is never set to 0, which causes compilation failures on non-glibc platforms
> because obstack_printf is no longer declared in our replacement <stdio.h>.
Ah, now I see. Yes, in this case HAVE_DECL_OBSTACK_PRINTF is not set to 0, and
GNULIB_OBSTACK_PRINTF is not set to 1.
> diff --git a/m4/obstack-printf.m4 b/m4/obstack-printf.m4
> @@ -18,11 +18,6 @@ AC_DEFUN([gl_FUNC_OBSTACK_PRINTF],
> if test $ac_cv_func_obstack_printf = no ; then
> gl_REPLACE_OBSTACK_PRINTF
> fi
> -
> - AC_CHECK_DECLS_ONCE([obstack_printf])
> - if test $ac_cv_have_decl_obstack_printf = no; then
> - HAVE_DECL_OBSTACK_PRINTF=0
> - fi
> ])
>
> AC_DEFUN([gl_REPLACE_OBSTACK_PRINTF],
> @@ -32,4 +27,9 @@ AC_DEFUN([gl_REPLACE_OBSTACK_PRINTF],
> if test $ac_cv_func_obstack_printf = yes; then
> REPLACE_OBSTACK_PRINTF=1
> fi
> +
> + AC_CHECK_DECLS_ONCE([obstack_printf])
> + if test $ac_cv_have_decl_obstack_printf = no; then
> + HAVE_DECL_OBSTACK_PRINTF=0
> + fi
> ])
I think it's a little safer to this check also when gl_REPLACE_OBSTACK_PRINTF
is not being invoked. (Think of a platform that has obstack_printf in its
libraries but we are missing the magic that causes it to be declared in the
system's <stdio.h>.)
So the combined proposed patch would look like this:
2010-02-08 Eric Blake <address@hidden>
Bruno Haible <address@hidden>
* m4/obstack-printf.m4 (gl_DECL_OBSTACK_PRINTF): New macro, extracted
from gl_FUNC_OBSTACK_PRINTF.
(gl_FUNC_OBSTACK_PRINTF): Invoke it.
* m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_POSIX): Likewise.
* lib/stdio.in.h (obstack_printf, obstack_vprintf): Declare also if
GNULIB_OBSTACK_PRINTF_POSIX is 1 and GNULIB_OBSTACK_PRINTF is 0.
--- m4/obstack-printf.m4.orig Tue Feb 9 00:34:39 2010
+++ m4/obstack-printf.m4 Tue Feb 9 00:33:38 2010
@@ -1,4 +1,4 @@
-# obstack-printf.m4 serial 2
+# obstack-printf.m4 serial 3
dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -19,10 +19,7 @@
gl_REPLACE_OBSTACK_PRINTF
fi
- AC_CHECK_DECLS_ONCE([obstack_printf])
- if test $ac_cv_have_decl_obstack_printf = no; then
- HAVE_DECL_OBSTACK_PRINTF=0
- fi
+ gl_DECL_OBSTACK_PRINTF
])
AC_DEFUN([gl_REPLACE_OBSTACK_PRINTF],
@@ -33,3 +30,13 @@
REPLACE_OBSTACK_PRINTF=1
fi
])
+
+dnl Ensure obstack_printf(), obstack_vprintf() are declared (whether they are
+dnl being replaced or not).
+AC_DEFUN([gl_DECL_OBSTACK_PRINTF],
+[
+ AC_CHECK_DECLS_ONCE([obstack_printf])
+ if test $ac_cv_have_decl_obstack_printf = no; then
+ HAVE_DECL_OBSTACK_PRINTF=0
+ fi
+])
--- m4/obstack-printf-posix.m4.orig Tue Feb 9 00:34:39 2010
+++ m4/obstack-printf-posix.m4 Tue Feb 9 00:33:46 2010
@@ -1,4 +1,4 @@
-# obstack-printf-posix.m4 serial 3
+# obstack-printf-posix.m4 serial 4
dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -101,4 +101,5 @@
gl_REPLACE_VASNPRINTF
gl_REPLACE_OBSTACK_PRINTF
fi
+ gl_DECL_OBSTACK_PRINTF
])
--- lib/stdio.in.h.orig Tue Feb 9 00:34:39 2010
+++ lib/stdio.in.h Tue Feb 9 00:29:30 2010
@@ -386,7 +386,7 @@
# endif
#endif
-#if @GNULIB_OBSTACK_PRINTF@
+#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
# if @REPLACE_OBSTACK_PRINTF@
# define obstack_printf rpl_osbtack_printf
# define obstack_vprintf rpl_obstack_vprintf