bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] build: avoid link failure on systems using gnulib's fcntl bu


From: Bruno Haible
Subject: Re: [PATCH] build: avoid link failure on systems using gnulib's fcntl but not open
Date: Sun, 28 Mar 2010 00:47:14 +0100
User-agent: KMail/1.9.9

Hi,

After cleaning up the @GNULIB_XYZ@ variables for possible use in tests-related
modules, now the same for the GNULIB_XYZ C macros.

Two third of the gl_MODULE_INDICATOR invocations produce a GNULIB_XYZ macro
that is used to test whether the 'xyz' module _can be used_.
The other third of the gl_MODULE_INDICATOR invocations produce a GNULIB_XYZ
macro that is used to test whether _the unit test for 'xyz' should be enabled_.

In the case of a tests-related module, for which the files get copied into
gltests/ rather than gllib/:
  - In the former case, the GNULIB_XYZ macro should evaluate to 1 or 0,
    depending whether the compilation unit sits in gltests/ or not.
  - In the latter case, the GNULIB_XYZ macro should evaluate to 1.

This means that we need different macros for produding the value of GNULIB_XYZ.
This is addressed by the patch below.

(For how to reproduce the former case: use
"gnulib-tool --import --with-tests renameat". 'renameat-tests' depends on
'filenamecat', so 'filenamecat' will be among the tests-related modules.
The macro GNULIB_FILENAMECAT, defined in config.h, shall evaluate to 1 or 0,
depending from where config.h is included.)

Even worse, for some modules, the GNULIB_XYZ macro is used in both ways:
  modules/faccessat:gl_MODULE_INDICATOR_FOR_USE([faccessat])
  modules/fdopendir:gl_MODULE_INDICATOR_FOR_USE([fdopendir])
  modules/mkostemp:gl_MODULE_INDICATOR_FOR_USE([mkostemp])
  modules/mkostemps:gl_MODULE_INDICATOR_FOR_USE([mkostemps])
  modules/mkstemps:gl_MODULE_INDICATOR_FOR_USE([mkstemps])
This will be addressed in the next patch.


2010-03-27  Bruno Haible  <address@hidden>

        Distinguish two kinds of module indicators.
        * m4/gnulib-common.m4 (gl_MODULE_INDICATOR_FOR_TESTS): Renamed from
        gl_MODULE_INDICATOR.
        (gl_MODULE_INDICATOR): New macro.
        * m4/dirent_h.m4 (gl_DIRENT_MODULE_INDICATOR): Invoke
        gl_MODULE_INDICATOR_FOR_TESTS instead of gl_MODULE_INDICATOR.
        * m4/fcntl_h.m4 (gl_FCNTL_MODULE_INDICATOR): Likewise.
        * m4/langinfo_h.m4 (gl_LANGINFO_MODULE_INDICATOR): Likewise.
        * m4/locale_h.m4 (gl_LOCALE_MODULE_INDICATOR): Likewise.
        * m4/math_h.m4 (gl_MATH_MODULE_INDICATOR): Likewise.
        * m4/pty_h.m4 (gl_PTY_MODULE_INDICATOR): Likewise.
        * m4/search_h.m4 (gl_SEARCH_MODULE_INDICATOR): Likewise.
        * m4/signal_h.m4 (gl_SIGNAL_MODULE_INDICATOR): Likewise.
        * m4/spawn_h.m4 (gl_SPAWN_MODULE_INDICATOR): Likewise.
        * m4/stdio_h.m4 (gl_STDIO_MODULE_INDICATOR): Likewise.
        * m4/stdlib_h.m4 (gl_STDLIB_MODULE_INDICATOR): Likewise.
        * m4/string_h.m4 (gl_STRING_MODULE_INDICATOR): Likewise.
        * m4/sys_ioctl_h.m4 (gl_SYS_IOCTL_MODULE_INDICATOR): Likewise.
        * m4/sys_select_h.m4 (gl_SYS_SELECT_MODULE_INDICATOR): Likewise.
        * m4/sys_socket_h.m4 (gl_SYS_SOCKET_MODULE_INDICATOR): Likewise.
        * m4/sys_stat_h.m4 (gl_SYS_STAT_MODULE_INDICATOR): Likewise.
        * m4/sys_time_h.m4 (gl_SYS_TIME_MODULE_INDICATOR): Likewise.
        * m4/time_h.m4 (gl_TIME_MODULE_INDICATOR): Likewise.
        * m4/unistd_h.m4 (gl_UNISTD_MODULE_INDICATOR): Likewise.
        * m4/wchar_h.m4 (gl_WCHAR_MODULE_INDICATOR): Likewise.
        * modules/cloexec (configure.ac): Likewise.
        * modules/getopt-gnu (configure.ac): Likewise.
        * modules/uninorm/u8-normalize (configure.ac): Likewise.
        * modules/uninorm/u16-normalize (configure.ac): Likewise.
        * modules/uninorm/u32-normalize (configure.ac): Likewise.
        * modules/fdopendir (configure.ac): Invoke gl_MODULE_INDICATOR.

--- m4/gnulib-common.m4.orig    Sun Mar 28 00:25:50 2010
+++ m4/gnulib-common.m4 Sun Mar 28 00:15:55 2010
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 15
+# gnulib-common.m4 serial 16
 dnl Copyright (C) 2007-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,
@@ -52,9 +52,39 @@
 ])
 
 # gl_MODULE_INDICATOR([modulename])
-# defines a C macro indicating the presence of the given module.
+# defines a C macro indicating the presence of the given module
+# in a location where it can be used.
+#                                             |  Value  |   Value   |
+#                                             | in lib/ | in tests/ |
+# --------------------------------------------+---------+-----------+
+# Module present among main modules:          |    1    |     1     |
+# --------------------------------------------+---------+-----------+
+# Module present among tests-related modules: |    0    |     1     |
+# --------------------------------------------+---------+-----------+
+# Module not present at all:                  |    0    |     0     |
+# --------------------------------------------+---------+-----------+
 AC_DEFUN([gl_MODULE_INDICATOR],
 [
+  
AC_DEFINE_UNQUOTED([GNULIB_]translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]),
+    [gl_MODULE_INDICATOR_CONDITION],
+    [Define to a C preprocessor expression that evaluates to 1 or 0, depending 
whether the gnulib module ]$1[ shall be considered present.])
+])
+
+# gl_MODULE_INDICATOR_FOR_TESTS([modulename])
+# defines a C macro indicating the presence of the given module
+# in lib or tests. This is useful to determine whether the module
+# should be tested.
+#                                             |  Value  |   Value   |
+#                                             | in lib/ | in tests/ |
+# --------------------------------------------+---------+-----------+
+# Module present among main modules:          |    1    |     1     |
+# --------------------------------------------+---------+-----------+
+# Module present among tests-related modules: |    1    |     1     |
+# --------------------------------------------+---------+-----------+
+# Module not present at all:                  |    0    |     0     |
+# --------------------------------------------+---------+-----------+
+AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS],
+[
   
AC_DEFINE([GNULIB_]translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]),
 [1],
     [Define to 1 when using the gnulib module ]$1[.])
 ])
--- m4/dirent_h.m4.orig Sun Mar 28 00:25:50 2010
+++ m4/dirent_h.m4      Sat Mar 27 19:21:29 2010
@@ -34,7 +34,7 @@
   AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_DIRENT_H_DEFAULTS],
--- m4/fcntl_h.m4.orig  Sun Mar 28 00:25:50 2010
+++ m4/fcntl_h.m4       Sat Mar 27 19:21:37 2010
@@ -26,7 +26,7 @@
   AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_FCNTL_H_DEFAULTS],
--- m4/langinfo_h.m4.orig       Sun Mar 28 00:25:50 2010
+++ m4/langinfo_h.m4    Sat Mar 27 19:21:53 2010
@@ -65,7 +65,7 @@
   AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_LANGINFO_H_DEFAULTS],
--- m4/locale_h.m4.orig Sun Mar 28 00:25:50 2010
+++ m4/locale_h.m4      Sat Mar 27 19:22:01 2010
@@ -80,7 +80,7 @@
   AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_LOCALE_H_DEFAULTS],
--- m4/math_h.m4.orig   Sun Mar 28 00:25:50 2010
+++ m4/math_h.m4        Sat Mar 27 19:22:11 2010
@@ -49,7 +49,7 @@
   AC_REQUIRE([gl_MATH_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_MATH_H_DEFAULTS],
--- m4/pty_h.m4.orig    Sun Mar 28 00:25:50 2010
+++ m4/pty_h.m4 Sat Mar 27 19:22:22 2010
@@ -50,7 +50,7 @@
   AC_REQUIRE([gl_PTY_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_PTY_H_DEFAULTS],
--- m4/search_h.m4.orig Sun Mar 28 00:25:50 2010
+++ m4/search_h.m4      Sat Mar 27 19:22:29 2010
@@ -28,7 +28,7 @@
   AC_REQUIRE([gl_SEARCH_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_SEARCH_H_DEFAULTS],
--- m4/signal_h.m4.orig Sun Mar 28 00:25:50 2010
+++ m4/signal_h.m4      Sat Mar 27 19:22:35 2010
@@ -29,7 +29,7 @@
   AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_SIGNAL_H_DEFAULTS],
--- m4/spawn_h.m4.orig  Sun Mar 28 00:25:50 2010
+++ m4/spawn_h.m4       Sat Mar 27 19:22:43 2010
@@ -79,7 +79,7 @@
   AC_REQUIRE([gl_SPAWN_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_SPAWN_H_DEFAULTS],
--- m4/stdio_h.m4.orig  Sun Mar 28 00:25:50 2010
+++ m4/stdio_h.m4       Sat Mar 27 19:22:56 2010
@@ -46,7 +46,7 @@
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_STDIO_H_DEFAULTS],
--- m4/stdlib_h.m4.orig Sun Mar 28 00:25:50 2010
+++ m4/stdlib_h.m4      Sat Mar 27 19:23:04 2010
@@ -45,7 +45,7 @@
   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_STDLIB_H_DEFAULTS],
--- m4/string_h.m4.orig Sun Mar 28 00:25:50 2010
+++ m4/string_h.m4      Sat Mar 27 19:23:18 2010
@@ -36,7 +36,7 @@
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
--- m4/sys_ioctl_h.m4.orig      Sun Mar 28 00:25:50 2010
+++ m4/sys_ioctl_h.m4   Sat Mar 27 19:23:31 2010
@@ -57,7 +57,7 @@
   AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_SYS_IOCTL_H_DEFAULTS],
--- m4/sys_select_h.m4.orig     Sun Mar 28 00:25:50 2010
+++ m4/sys_select_h.m4  Sat Mar 27 19:23:39 2010
@@ -74,7 +74,7 @@
   AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_SYS_SELECT_H_DEFAULTS],
--- m4/sys_socket_h.m4.orig     Sun Mar 28 00:25:50 2010
+++ m4/sys_socket_h.m4  Sat Mar 27 19:23:51 2010
@@ -127,7 +127,7 @@
   AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
--- m4/sys_stat_h.m4.orig       Sun Mar 28 00:25:50 2010
+++ m4/sys_stat_h.m4    Sat Mar 27 19:24:00 2010
@@ -40,7 +40,7 @@
   AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
--- m4/sys_time_h.m4.orig       Sun Mar 28 00:25:50 2010
+++ m4/sys_time_h.m4    Sat Mar 27 19:24:08 2010
@@ -58,7 +58,7 @@
   AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_HEADER_SYS_TIME_H_DEFAULTS],
--- m4/time_h.m4.orig   Sun Mar 28 00:25:51 2010
+++ m4/time_h.m4        Sat Mar 27 19:24:27 2010
@@ -67,7 +67,7 @@
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
--- m4/unistd_h.m4.orig Sun Mar 28 00:25:51 2010
+++ m4/unistd_h.m4      Sat Mar 27 19:24:39 2010
@@ -48,7 +48,7 @@
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_UNISTD_H_DEFAULTS],
--- m4/wchar_h.m4.orig  Sun Mar 28 00:25:51 2010
+++ m4/wchar_h.m4       Sat Mar 27 19:24:48 2010
@@ -109,7 +109,7 @@
   AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
   dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR([$1])
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_WCHAR_H_DEFAULTS],
--- modules/cloexec.orig        Sun Mar 28 00:25:51 2010
+++ modules/cloexec     Sat Mar 27 19:28:37 2010
@@ -13,7 +13,7 @@
 
 configure.ac:
 gl_CLOEXEC
-gl_MODULE_INDICATOR([cloexec])
+gl_MODULE_INDICATOR_FOR_TESTS([cloexec])
 
 Makefile.am:
 
--- modules/fdopendir.orig      Sun Mar 28 00:25:51 2010
+++ modules/fdopendir   Sat Mar 27 23:55:56 2010
@@ -18,6 +18,7 @@
 configure.ac:
 gl_FUNC_FDOPENDIR
 gl_DIRENT_MODULE_INDICATOR([fdopendir])
+gl_MODULE_INDICATOR([fdopendir])
 
 Makefile.am:
 
--- modules/getopt-gnu.orig     Sun Mar 28 00:25:51 2010
+++ modules/getopt-gnu  Sat Mar 27 19:51:34 2010
@@ -9,7 +9,7 @@
 
 configure.ac:
 gl_FUNC_GETOPT_GNU
-gl_MODULE_INDICATOR([getopt-gnu])
+gl_MODULE_INDICATOR_FOR_TESTS([getopt-gnu])
 
 Makefile.am:
 
--- modules/uninorm/u8-normalize.orig   Sun Mar 28 00:25:51 2010
+++ modules/uninorm/u8-normalize        Sat Mar 27 19:53:40 2010
@@ -15,7 +15,7 @@
 uninorm/decompose-internal
 
 configure.ac:
-gl_MODULE_INDICATOR([uninorm/u8-normalize])
+gl_MODULE_INDICATOR_FOR_TESTS([uninorm/u8-normalize])
 
 Makefile.am:
 lib_SOURCES += uninorm/u8-normalize.c
--- modules/uninorm/u16-normalize.orig  Sun Mar 28 00:25:51 2010
+++ modules/uninorm/u16-normalize       Sat Mar 27 19:53:18 2010
@@ -15,7 +15,7 @@
 uninorm/decompose-internal
 
 configure.ac:
-gl_MODULE_INDICATOR([uninorm/u16-normalize])
+gl_MODULE_INDICATOR_FOR_TESTS([uninorm/u16-normalize])
 
 Makefile.am:
 lib_SOURCES += uninorm/u16-normalize.c
--- modules/uninorm/u32-normalize.orig  Sun Mar 28 00:25:51 2010
+++ modules/uninorm/u32-normalize       Sat Mar 27 19:53:42 2010
@@ -15,7 +15,7 @@
 uninorm/decompose-internal
 
 configure.ac:
-gl_MODULE_INDICATOR([uninorm/u32-normalize])
+gl_MODULE_INDICATOR_FOR_TESTS([uninorm/u32-normalize])
 
 Makefile.am:
 lib_SOURCES += uninorm/u32-normalize.c




reply via email to

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