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

2022-10-27 Thread Paul D. Smith
Follow-up Comment #8, bug #63185 (project make):

RE sys/time.h, I have no idea why that's there, I must have found an example
somewhere or something.  But we already manage this in makeint.h so it's not
needed here anyway; I'll remove it.


___

Reply to this item at:

  

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




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

2022-10-26 Thread Dmitry Goncharov
Follow-up Comment #7, bug #63185 (project make):

i guess, it is possible that sys/loadavg.h exists, but still doesn't declare
getloadavg.

It is also possible that configure sets HAVE_DECL_GETLOADAVG to 0 and also
defines HAVE_SYS_LOADAVG_H and in this case there is a declaraion in
sys/loadavg.h and also in job.c. Which should be benign as long as the
declarations match.

This alone

#if HAVE_DECL_GETLOADAVG == 0
int getloadavg (double loadavg[], int nelem);
#endif

gets the job done.

Btw, why do you include sys/time.h?


___

Reply to this item at:

  

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




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

2022-10-26 Thread Paul D. Smith
Follow-up Comment #6, bug #63185 (project make):

You're right, I forgot that it's always wrong to use ifdef/ifndef with
HAVE_DECL values in autoconf.

But, I don't understand why you've added the !defined(HAVE_SYS_LOADAVG_H) to
the check.  If the function is not declared we need to declare it, it doesn't
matter whether we have sys/loadavg.h or not.

I don't know of any system like this, but it could be that sys/loadavg.h
exists but still doesn't declare getloadavg().  And if it does declare
getloadavg(), then HAVE_DECL_GETLOADAVG will be 1 anyway not 0 and we don't
need to check it.

Am I missing something?  I don't want to get this wrong again.


___

Reply to this item at:

  

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




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

2022-10-25 Thread Dmitry Goncharov
Follow-up Comment #5, bug #63185 (project make):

i guess this fell through the cracks. Paul, can you please have a look at the
attached patch?
One part of the patch you already applied, but there is the second part, which
is still needed.


___

Reply to this item at:

  

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




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

2022-10-18 Thread Dmitry Goncharov
Additional Item Attachment, bug #63185 (project make):

File name: sv63185.diff   Size:0 KB




___

Reply to this item at:

  

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




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

2022-10-18 Thread Dmitry Goncharov
Follow-up Comment #4, bug #63185 (project make):

This piece of code


+#ifdef HAVE_SYS_LOADAVG_H
+# include 
+#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:

  

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




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

2022-10-18 Thread Paul D. Smith
Update of bug #63185 (project make):

  Status:None => Fixed  
 Assigned to:None => psmith 
 Open/Closed:Open => Closed 
   Fixed Release:None => SCM
   Triage Status:None => Small Effort   

___

Follow-up Comment #3:

I added my fix below, hope it works...


___

Reply to this item at:

  

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




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

2022-10-15 Thread Paul D. Smith
Follow-up Comment #2, bug #63185 (project make):

Instead of reverting the content in job.c, can you keep that content but add
this:


#if HAVE_SYS_LOADAVG_H
#include 
#include 
#endif

#ifndef HAVE_DECL_GETLOADAVG
int getloadavg (double loadavg[], int nelem);
#endif


and see if that works?


___

Reply to this item at:

  

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




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

2022-10-08 Thread Dmitry Goncharov
Follow-up Comment #1, bug #63185 (project make):

The latest configure from 4.3.90 fails to detect getloadavg declaration on
sun
and aix.


../src/job.c: In function ▒load_too_high▒:
../src/job.c:2103:7: warning: implicit declaration of function
▒getloadavg▒ [-Wimplicit-function-declaration]
 2103 |   if (getloadavg (&load, 1) != 1)
  |   ^~



$ grep GETLOADAVG src/config.h
#define GNULIB_TEST_GETLOADAVG 1
#define HAVE_DECL_GETLOADAVG 1
$


The change was introduced in dd24a4c1cfa7b6928ddb2bcd00a023f23aaaf440.


$ git sh --pretty=format:%H dd24a4c1cfa7b6928ddb2bcd00a023f23aaaf440  --
configure.ac src/job.c
dd24a4c1cfa7b6928ddb2bcd00a023f23aaaf440
diff --git a/configure.ac b/configure.ac
index 51817b2c..4a0d5301 100644
--- a/configure.ac
+++ b/configure.ac
@@ -437,6 +437,9 @@ AS_CASE([$host],
 AC_DEFINE_UNQUOTED([PATH_SEPARATOR_CHAR],['$PATH_SEPARATOR'],
 [Define to the character that separates directories in PATH.])

+AC_DEFINE_UNQUOTED([HAVE_DECL_GETLOADAVG],[$HAVE_DECL_GETLOADAVG],
+[Define to 1 if you have the declaration of 'getloadavg'.])
+
 # Include the Maintainer's Makefile section, if it's here.

 MAINT_MAKEFILE=/dev/null
diff --git a/src/job.c b/src/job.c
index 0c9054bd..402d409f 100644
--- a/src/job.c
+++ b/src/job.c
@@ -216,7 +216,7 @@ pid2str (pid_t pid)
   return pidstring;
 }

-#ifndef HAVE_GETLOADAVG
+#ifndef HAVE_DECL_GETLOADAVG
 int getloadavg (double loadavg[], int nelem);
 #endif


This is the relevant part of config.log

configure:7677: checking for getloadavg
configure:7677: gcc-11 -o conftest -Wall -Wextra -ggdb -m64
-DMAKE_MAINTAINER_MODE=1   conftest.c  >&5
configure:7677: $? = 0
configure:7677: result: yes
configure:8030: checking for sys/loadavg.h
configure:8030: gcc-11 -c -Wall -Wextra -ggdb -m64 -DMAKE_MAINTAINER_MODE=1 
conftest.c >&5
configure:8030: $? = 0
configure:8030: result: yes
configure:8042: checking whether getloadavg is declared
configure:8042: gcc-11 -c -Wall -Wextra -ggdb -m64 -DMAKE_MAINTAINER_MODE=1  
conftest.c >&5
configure:8042: $? = 0
configure:8042: result: yes
...
| #define HAVE_SYS_LOADAVG_H 1
| #define GNULIB_TEST_GETLOADAVG 1
...
ac_cv_func_getloadavg=yes
...
ac_cv_have_decl_getloadavg=yes
...
GETLOADAVG_LIBS=''
GL_COND_OBJ_GETLOADAVG_FALSE=''
GL_COND_OBJ_GETLOADAVG_TRUE='#'
...
GL_GNULIB_GETLOADAVG='1'
...
HAVE_DECL_GETLOADAVG='1'
...
#define HAVE_DECL_GETLOADAVG 1


Reverting the change in job.c fixes the issue.


___

Reply to this item at:

  

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




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

2022-10-08 Thread Dmitry Goncharov
URL:
  

 Summary: configure fails to detect getloadavg declaration on
sun and aix.
 Project: make
   Submitter: dgoncharov
   Submitted: Sat 08 Oct 2022 08:26:14 PM UTC
Severity: 3 - Normal
  Item Group: Bug
  Status: None
 Privacy: Public
 Assigned to: None
 Open/Closed: Open
 Discussion Lock: Any
   Component Version: SCM
Operating System: POSIX-Based
   Fixed Release: None
   Triage Status: None


___

Follow-up Comments:


---
Date: Sat 08 Oct 2022 08:26:14 PM UTC By: Dmitry Goncharov 
.







___

Reply to this item at:

  

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