bug-make
[Top][All Lists]
Advanced

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

[bug #63185] configure fails to detect getloadavg declaration on sun and


From: Dmitry Goncharov
Subject: [bug #63185] configure fails to detect getloadavg declaration on sun and aix.
Date: Tue, 18 Oct 2022 21:28:45 -0400 (EDT)

Follow-up Comment #4, bug #63185 (project make):

This piece of code

++++
+#ifdef HAVE_SYS_LOADAVG_H
+# include <sys/loadavg.h>
+#endif
----

indeed helps on sun, because sun has sys/loadavg.h.

However, aix does not have sys/loadavg.h (i didn't find a declaration of
getloadavg in any header on aix) and the change above does not help on aix.

The problem with the existing code
++++
#ifndef HAVE_DECL_GETLOADAVG
int getloadavg (double loadavg[], int nelem);
#endif
----

is that configure always defines HAVE_DECL_GETLOADAVG.
On sun and linux HAVE_DECL_GETLOADAVG is defined to be 1.
On aix HAVE_DECL_GETLOADAVG is defined to be 0.

++++
$ grep HAVE_DECL_GETLOADAVG src/config.h
#define HAVE_DECL_GETLOADAVG 0
----

This causes the preprocessor to remove this declaration of getloadavg from
job.c.

The attached patch does
++++
-#ifndef HAVE_DECL_GETLOADAVG
+#if HAVE_DECL_GETLOADAVG == 0 && !defined(HAVE_SYS_LOADAVG_H)
 int getloadavg (double loadavg[], int nelem);
 #endif
----

Tested on linux, sun and aix, all 64 bit.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63185>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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