]> Savannah Git Hosting - gnulib.git/commitdiff
fopen-gnu: Allow use as dependency from test modules.
authorBruno Haible <bruno@clisp.org>
Mon, 3 Jan 2022 15:17:18 +0000 (16:17 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 3 Jan 2022 15:17:18 +0000 (16:17 +0100)
* m4/fopen.m4 (gl_FUNC_FOPEN_GNU): Set REPLACE_FOPEN_FOR_FOPEN_GNU
instead of REPLACE_FOPEN.
* m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize the fopen-gnu
module indicator.
(gl_STDIO_H_DEFAULTS): Initialize REPLACE_FOPEN_FOR_FOPEN_GNU.
* modules/stdio (Makefile.am): Substitute GNULIB_FOPEN_GNU,
REPLACE_FOPEN_FOR_FOPEN_GNU.
* modules/fopen-gnu (Depends-on): Add more dependencies.
(configure.ac): Test REPLACE_FOPEN_FOR_FOPEN_GNU instead of
REPLACE_FOPEN.
* lib/stdio.in.h (fopen): Test REPLACE_FOPEN,
REPLACE_FOPEN_FOR_FOPEN_GNU, and the respective module indicators
instead of just REPLACE_FOPEN.

ChangeLog
lib/stdio.in.h
m4/fopen.m4
m4/stdio_h.m4
modules/fopen-gnu
modules/stdio

index 655529e83395d312adab492d3f2cd3ecbc1fdc47..9824e579314aafc0e93d81a239c428d756e981cc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2022-01-03  Bruno Haible  <bruno@clisp.org>
+
+       fopen-gnu: Allow use as dependency from test modules.
+       * m4/fopen.m4 (gl_FUNC_FOPEN_GNU): Set REPLACE_FOPEN_FOR_FOPEN_GNU
+       instead of REPLACE_FOPEN.
+       * m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize the fopen-gnu
+       module indicator.
+       (gl_STDIO_H_DEFAULTS): Initialize REPLACE_FOPEN_FOR_FOPEN_GNU.
+       * modules/stdio (Makefile.am): Substitute GNULIB_FOPEN_GNU,
+       REPLACE_FOPEN_FOR_FOPEN_GNU.
+       * modules/fopen-gnu (Depends-on): Add more dependencies.
+       (configure.ac): Test REPLACE_FOPEN_FOR_FOPEN_GNU instead of
+       REPLACE_FOPEN.
+       * lib/stdio.in.h (fopen): Test REPLACE_FOPEN,
+       REPLACE_FOPEN_FOR_FOPEN_GNU, and the respective module indicators
+       instead of just REPLACE_FOPEN.
+
 2022-01-03  Bruno Haible  <bruno@clisp.org>
 
        realloc-gnu: Allow use as dependency from test modules.
index 8fcec011d43831aea85f9246a9270e7f66b7364e..7b36dac2f5216fe655781716f41cd9bca344364b 100644 (file)
@@ -399,7 +399,8 @@ _GL_CXXALIASWARN (fileno);
 #endif
 
 #if @GNULIB_FOPEN@
-# if @REPLACE_FOPEN@
+# if (@GNULIB_FOPEN@ && @REPLACE_FOPEN@) \
+     || (@GNULIB_FOPEN_GNU@ && @REPLACE_FOPEN_FOR_FOPEN_GNU@)
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef fopen
 #   define fopen rpl_fopen
index a177197433a37102c734ba766c17c9a87afe8681..50767f8288ab2bc9cb523d2b111d1ca8919a6a0b 100644 (file)
@@ -1,4 +1,4 @@
-# fopen.m4 serial 12
+# fopen.m4 serial 13
 dnl Copyright (C) 2007-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -136,11 +136,12 @@ int main ()
        ])
      rm -f conftest.x
     ])
+  REPLACE_FOPEN_FOR_FOPEN_GNU="$REPLACE_FOPEN"
   case "$gl_cv_func_fopen_mode_x" in
-    *no) REPLACE_FOPEN=1 ;;
+    *no) REPLACE_FOPEN_FOR_FOPEN_GNU=1 ;;
   esac
   case "$gl_cv_func_fopen_mode_e" in
-    *no) REPLACE_FOPEN=1 ;;
+    *no) REPLACE_FOPEN_FOR_FOPEN_GNU=1 ;;
   esac
 ])
 
index 3180d43f4a0dc9ac7a02823a0fdc7858d772d5ef..cc80e77365fd3c1207b56fc68af6cbae0065b5e1 100644 (file)
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 56
+# stdio_h.m4 serial 57
 dnl Copyright (C) 2007-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -119,6 +119,7 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS],
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETC])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETS])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FOPEN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FOPEN_GNU])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF_POSIX])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPURGE])
@@ -202,6 +203,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   REPLACE_FDOPEN=0;              AC_SUBST([REPLACE_FDOPEN])
   REPLACE_FFLUSH=0;              AC_SUBST([REPLACE_FFLUSH])
   REPLACE_FOPEN=0;               AC_SUBST([REPLACE_FOPEN])
+  REPLACE_FOPEN_FOR_FOPEN_GNU=0; AC_SUBST([REPLACE_FOPEN_FOR_FOPEN_GNU])
   REPLACE_FPRINTF=0;             AC_SUBST([REPLACE_FPRINTF])
   REPLACE_FPURGE=0;              AC_SUBST([REPLACE_FPURGE])
   REPLACE_FREOPEN=0;             AC_SUBST([REPLACE_FREOPEN])
index 9252c749b3d78d7ae377ec5fdc9e82abf443fe0d..86635a140b04b56fd987f7d344294c1d5071835a 100644 (file)
@@ -6,11 +6,16 @@ lib/fopen.c
 
 Depends-on:
 fopen
-open            [test $REPLACE_FOPEN = 1]
+open            [test $REPLACE_FOPEN_FOR_FOPEN_GNU = 1]
+fcntl-h         [test $REPLACE_FOPEN_FOR_FOPEN_GNU = 1]
+stdbool         [test $REPLACE_FOPEN_FOR_FOPEN_GNU = 1]
+unistd          [test $REPLACE_FOPEN_FOR_FOPEN_GNU = 1]
+close           [test $REPLACE_FOPEN_FOR_FOPEN_GNU = 1]
+fstat           [test $REPLACE_FOPEN_FOR_FOPEN_GNU = 1]
 
 configure.ac:
 gl_FUNC_FOPEN_GNU
-if test $REPLACE_FOPEN = 1; then
+if test $REPLACE_FOPEN_FOR_FOPEN_GNU = 1; then
   AC_LIBOBJ([fopen])
   gl_PREREQ_FOPEN
 fi
index dab8d4e8be440c314e4ad1f438f93240b09498ca..0f250558dc0864c872e3ec58c80ab9639933d6fc 100644 (file)
@@ -66,6 +66,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
              -e 's/@''GNULIB_FGETC''@/$(GNULIB_FGETC)/g' \
              -e 's/@''GNULIB_FGETS''@/$(GNULIB_FGETS)/g' \
              -e 's/@''GNULIB_FOPEN''@/$(GNULIB_FOPEN)/g' \
+             -e 's/@''GNULIB_FOPEN_GNU''@/$(GNULIB_FOPEN_GNU)/g' \
              -e 's/@''GNULIB_FPRINTF''@/$(GNULIB_FPRINTF)/g' \
              -e 's/@''GNULIB_FPRINTF_POSIX''@/$(GNULIB_FPRINTF_POSIX)/g' \
              -e 's/@''GNULIB_FPURGE''@/$(GNULIB_FPURGE)/g' \
@@ -141,6 +142,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_FDOPEN''@|$(REPLACE_FDOPEN)|g' \
              -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
              -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
+             -e 's|@''REPLACE_FOPEN_FOR_FOPEN_GNU''@|$(REPLACE_FOPEN_FOR_FOPEN_GNU)|g' \
              -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
              -e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \
              -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \