Hello list,
Bob Tennent <[email protected]> wrote:
|ERROR: one of clock_gettime(2) and gettimeofday(1) is required.
So Bob wasn't kidding, insisted and made me finally realize (Hey!
Wicked!) that there is a real problem in the build system.
On Linux "sys/time.h" doesn't provide the NULL constant, which is
perfectly valid according to the standard (ISO C89: stdio.h, ISO
C99: stddef.h), but rather odd given that the gettimeofday(2)
function can regulary take a NULL argument. Other operating
systems make "sys/time.h" self-sufficient. Nonetheless "boing"
from my side of the road.
Moreover on some Linux systems the clock_gettime(2) etc.
functionality is present, yet not in -lc (C library) but in -lrt
(realtime extension), though that is not documented in the RHEL
manual page that i have seen (on the web). The problem is that
on the RHEL system that Bob uses -lrt is *not* automatically
linked into the program when the functionality is used. So, if
Linux users see the above error, one way to deal with it is to add
-lrt to the libraries, e.g., with the default WANT_AUTOCC:
$ make ADDLDFLAGS=-lrt
If that doesn't help then either you can use git(1) [master] or
use the attached patch as in
?0[steffen@boo tmp]$ cd s-nail-14.8.1/
?0[steffen@boo s-nail-14.8.1]$ patch -p1 < ../nail-to-master.diff
patching file cmd_cnd.c
patching file mk-conf.sh
?0[steffen@boo s-nail-14.8.1]$
Note it also includes a one-line fix for disallowing some faulty
`if' comparison operators.
Sorry for the inconvenience,
--steffen
diff --git a/cmd_cnd.c b/cmd_cnd.c
index 15fcc47..aadcf79 100644
--- a/cmd_cnd.c
+++ b/cmd_cnd.c
@@ -152,7 +152,8 @@ jesyn:
#endif
)
goto jesyn;
- }
+ } else
+ goto jesyn;
/* The right hand side may also be a variable, more syntax checking */
if ((rhv = argv[2]) == NULL /* Can't happen */)
diff --git a/mk-conf.sh b/mk-conf.sh
index 1c844ed..51e424b 100644
--- a/mk-conf.sh
+++ b/mk-conf.sh
@@ -856,7 +856,18 @@ if link_check clock_gettime 'clock_gettime(2)' \
int main(void)
{
struct timespec ts;
-
+ clock_gettime(CLOCK_REALTIME, &ts);
+ return 0;
+}
+!
+then
+ :
+elif link_check clock_gettime 'clock_gettime(2) (via -lrt)' \
+ '#define HAVE_CLOCK_GETTIME' '-lrt' << \!
+#include <time.h>
+int main(void)
+{
+ struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
return 0;
}
@@ -865,11 +876,11 @@ then
:
elif link_check gettimeofday 'gettimeofday(2)' \
'#define HAVE_GETTIMEOFDAY' << \!
+#include <stdio.h> /* For C89 NULL */
#include <sys/time.h>
int main(void)
{
struct timeval tv;
-
gettimeofday(&tv, NULL);
return 0;
}
@@ -877,7 +888,7 @@ int main(void)
then
:
else
- msg 'ERROR: one of clock_gettime(2) and gettimeofday(1) is required.'
+ msg 'ERROR: one of clock_gettime(2) and gettimeofday(2) is required.'
msg 'That much Unix we indulge ourselfs.'
config_exit 1
fi
@@ -1060,6 +1071,7 @@ if feat_no NOALLOCA; then
# not to overoptimize and silently break some code
link_check alloca '__builtin_alloca()' \
'#define HAVE_ALLOCA __builtin_alloca' << \!
+#include <stdio.h> /* For C89 NULL */
int main(void)
{
void *vp = __builtin_alloca(1);
@@ -1342,6 +1354,7 @@ int main(void)
if [ "${have_openssl}" = 'yes' ]; then
compile_check stack_of 'OpenSSL STACK_OF()' \
'#define HAVE_OPENSSL_STACK_OF' << \!
+#include <stdio.h> /* For C89 NULL */
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/x509v3.h>
@@ -1358,6 +1371,7 @@ int main(void)
link_check ossl_conf 'OpenSSL_modules_load_file() support' \
'#define HAVE_OPENSSL_CONFIG' << \!
+#include <stdio.h> /* For C89 NULL */
#include <openssl/conf.h>
int main(void)
@@ -1452,6 +1466,7 @@ int main(void)
if feat_yes DEVEL; then
link_check ossl_memhooks 'OpenSSL memory hooks' \
'#define HAVE_OPENSSL_MEMHOOKS' << \!
+#include <stdio.h> /* For C89 NULL */
#include <openssl/crypto.h>
int main(void)
@@ -1666,6 +1681,7 @@ if feat_yes EDITLINE && [ -z "${have_readline}" ]; then
__edlib() {
link_check editline "for editline(3) (${1})" \
'#define HAVE_EDITLINE' "${1}" << \!
+#include <stdio.h> /* For C89 NULL */
#include <histedit.h>
static char * getprompt(void) { return (char*)"ok"; }
int main(void)
------------------------------------------------------------------------------
_______________________________________________
S-nail-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/s-nail-users