bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* [PATCH 1/2] m4/getloadavg.m4: restrict AIX specific test on AIX
@ 2020-02-24 12:56 Jens Rehsack
  2020-02-24 12:56 ` [PATCH 2/2] modules: fcntl: allow being detected by importing projects Jens Rehsack
  2020-02-24 20:20 ` [PATCH 1/2] m4/getloadavg.m4: restrict AIX specific test on AIX Bruno Haible
  0 siblings, 2 replies; 4+ messages in thread
From: Jens Rehsack @ 2020-02-24 12:56 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Jens Rehsack

When cross compiling for a system without getloadavg, do not try add
additional linker paths unless it's absolutely necessary.

Signed-off-by: Jens Rehsack <sno@netbsd.org>
---
 m4/getloadavg.m4 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
index 3bd2a142e..696c5de90 100644
--- a/m4/getloadavg.m4
+++ b/m4/getloadavg.m4
@@ -42,6 +42,8 @@ AC_CHECK_FUNC([getloadavg], [],
    fi
 
    if test $gl_func_getloadavg_done = no; then
+     AS_CASE([$host_os],
+             [aix*], [
      # There is a commonly available library for RS/6000 AIX.
      # Since it is not a standard part of AIX, it might be installed locally.
      gl_getloadavg_LIBS=$LIBS
@@ -49,6 +51,7 @@ AC_CHECK_FUNC([getloadavg], [],
      AC_CHECK_LIB([getloadavg], [getloadavg],
                   [LIBS="-lgetloadavg $LIBS" gl_func_getloadavg_done=yes],
                   [LIBS=$gl_getloadavg_LIBS])
+       ], [:])
    fi
 
    # Set up the replacement function if necessary.
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] modules: fcntl: allow being detected by importing projects
  2020-02-24 12:56 [PATCH 1/2] m4/getloadavg.m4: restrict AIX specific test on AIX Jens Rehsack
@ 2020-02-24 12:56 ` Jens Rehsack
  2020-02-24 20:08   ` Bruno Haible
  2020-02-24 20:20 ` [PATCH 1/2] m4/getloadavg.m4: restrict AIX specific test on AIX Bruno Haible
  1 sibling, 1 reply; 4+ messages in thread
From: Jens Rehsack @ 2020-02-24 12:56 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Jens Rehsack

GNU project `make` relies on gnulib but provides some own compatibility
functions - including an `fcntl`, which fails on mingw.
The intension of gnulib is providing these functions and being wider tested,
but silently injecting a function opens battle of compatibility layers.

So adding a hint into target `config.h` to allow deciding whether using
an own compatibility implementation or not.

Signed-off-by: Jens Rehsack <sno@netbsd.org>
---
 modules/fcntl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/modules/fcntl b/modules/fcntl
index 3ee0811c8..508794de2 100644
--- a/modules/fcntl
+++ b/modules/fcntl
@@ -17,6 +17,7 @@ configure.ac:
 gl_FUNC_FCNTL
 if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then
   AC_LIBOBJ([fcntl])
+  AC_DEFINE(HAVE_GNULIB_FCNTL, 1, [Define to 1 if you have the `fcntl' function via gnulib.])
 fi
 gl_FCNTL_MODULE_INDICATOR([fcntl])
 
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] modules: fcntl: allow being detected by importing projects
  2020-02-24 12:56 ` [PATCH 2/2] modules: fcntl: allow being detected by importing projects Jens Rehsack
@ 2020-02-24 20:08   ` Bruno Haible
  0 siblings, 0 replies; 4+ messages in thread
From: Bruno Haible @ 2020-02-24 20:08 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Jens Rehsack

Jens Rehsack wrote:
> battle of compatibility layers.

Yes, we need C preprocessor macros to avoid conflicts between compatibility
layers.

It's preferable to have this witness macro defined through the .h file.


2020-02-24  Bruno Haible  <bruno@clisp.org>

	fcntl: Add witness of gnulib override.
	Reported by Jens Rehsack <sno@netbsd.org> in
	<https://lists.gnu.org/archive/html/bug-gnulib/2020-02/msg00137.html>.
	* lib/fcntl.in.h (GNULIB_defined_rpl_fcntl, GNULIB_defined_fcntl): New
	macros.

diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index b2e1e51..0a21c95 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -116,9 +116,15 @@ _GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - "
 #  endif
 _GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...));
 _GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...));
+#  if !GNULIB_defined_rpl_fcntl
+#   define GNULIB_defined_rpl_fcntl 1
+#  endif
 # else
 #  if !@HAVE_FCNTL@
 _GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...));
+#   if !GNULIB_defined_fcntl
+#    define GNULIB_defined_fcntl 1
+#   endif
 #  endif
 _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...));
 # endif



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] m4/getloadavg.m4: restrict AIX specific test on AIX
  2020-02-24 12:56 [PATCH 1/2] m4/getloadavg.m4: restrict AIX specific test on AIX Jens Rehsack
  2020-02-24 12:56 ` [PATCH 2/2] modules: fcntl: allow being detected by importing projects Jens Rehsack
@ 2020-02-24 20:20 ` Bruno Haible
  1 sibling, 0 replies; 4+ messages in thread
From: Bruno Haible @ 2020-02-24 20:20 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Jens Rehsack

Jens Rehsack wrote:
> When cross compiling for a system without getloadavg, do not try add
> additional linker paths unless it's absolutely necessary.
> 
> Signed-off-by: Jens Rehsack <sno@netbsd.org>
> ---
>  m4/getloadavg.m4 | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
> index 3bd2a142e..696c5de90 100644
> --- a/m4/getloadavg.m4
> +++ b/m4/getloadavg.m4
> @@ -42,6 +42,8 @@ AC_CHECK_FUNC([getloadavg], [],
>     fi
>  
>     if test $gl_func_getloadavg_done = no; then
> +     AS_CASE([$host_os],
> +             [aix*], [
>       # There is a commonly available library for RS/6000 AIX.
>       # Since it is not a standard part of AIX, it might be installed locally.
>       gl_getloadavg_LIBS=$LIBS

In gnulib, we often try to be system-agnostic in the *.m4 files. For example,
if on a different system someone builds a libgetloadavg.{a,so}, this autoconf
test snippet would recognize it. This is a feature, not a misfeature.

Also, in gnulib, we don't use the AS_IF, AS_CASE, etc. macros, because it's
simpler to write the shell code directly.


2020-02-24  Bruno Haible  <bruno@clisp.org>

	getloadavg: Don't use /usr/local when cross-compiling on AIX.
	Reported by Jens Rehsack <sno@netbsd.org> in
	<https://lists.gnu.org/archive/html/bug-gnulib/2020-02/msg00136.html>.
	* m4/getloadavg.m4 (gl_GETLOADAVG): Don't look in /usr/local/lib when
	cross-compiling.

diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
index 3bd2a14..8e96965 100644
--- a/m4/getloadavg.m4
+++ b/m4/getloadavg.m4
@@ -7,7 +7,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-#serial 8
+#serial 9
 
 # Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
 # New applications should use gl_GETLOADAVG instead.
@@ -45,7 +45,9 @@ AC_CHECK_FUNC([getloadavg], [],
      # There is a commonly available library for RS/6000 AIX.
      # Since it is not a standard part of AIX, it might be installed locally.
      gl_getloadavg_LIBS=$LIBS
-     LIBS="-L/usr/local/lib $LIBS"
+     if test $cross_compiling != yes; then
+       LIBS="-L/usr/local/lib $LIBS"
+     fi
      AC_CHECK_LIB([getloadavg], [getloadavg],
                   [LIBS="-lgetloadavg $LIBS" gl_func_getloadavg_done=yes],
                   [LIBS=$gl_getloadavg_LIBS])



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-24 20:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-24 12:56 [PATCH 1/2] m4/getloadavg.m4: restrict AIX specific test on AIX Jens Rehsack
2020-02-24 12:56 ` [PATCH 2/2] modules: fcntl: allow being detected by importing projects Jens Rehsack
2020-02-24 20:08   ` Bruno Haible
2020-02-24 20:20 ` [PATCH 1/2] m4/getloadavg.m4: restrict AIX specific test on AIX Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).