[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] m4/getloadavg.m4: restrict AIX specific test on AIX
From: |
Bruno Haible |
Subject: |
Re: [PATCH 1/2] m4/getloadavg.m4: restrict AIX specific test on AIX |
Date: |
Mon, 24 Feb 2020 21:20:00 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-171-generic; KDE/5.18.0; x86_64; ; ) |
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 <address@hidden>
> ---
> 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 <address@hidden>
getloadavg: Don't use /usr/local when cross-compiling on AIX.
Reported by Jens Rehsack <address@hidden> 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])