Jim Meyering <[EMAIL PROTECTED]> wrote: > "Gabor Z. Papp" <[EMAIL PROTECTED]> wrote: > ... >> Tried to compile coreutils 6.0 from alpha.gnu, and here is the result. > ... >> gcc -std=gnu99 -g -O2 -Wl,--as-needed -o dd dd.o ../lib/libcoreutils.a >> ../lib/libcoreutils.a >> ../lib/libcoreutils.a(gettime.o): In function `gettime': >> /home/gzp/src/coreutils-6.0/lib/gettime.c:36: undefined reference to >> `clock_gettime' >> collect2: ld returned 1 exit status >> make[3]: *** [dd] Error 1 >> make[3]: Leaving directory `/home/gzp/src/coreutils-6.0/src' >> make[2]: *** [all] Error 2 >> make[2]: Leaving directory `/home/gzp/src/coreutils-6.0/src' >> make[1]: *** [all-recursive] Error 1 >> make[1]: Leaving directory `/home/gzp/src/coreutils-6.0' >> make: *** [all] Error 2 > > Thanks again for the report. > That was caused by a bug in gethrxtime.m4. > The gettime libraries ($LIB_CLOCK_GETTIME) are needed > by gethrxtime.c only if CLOCK_MONOTONIC is *not* defined. > > Here's the patch: > > 2006-08-18 Jim Meyering <[EMAIL PROTECTED]> > > * gethrxtime.m4 (gl_PREREQ_GETHRXTIME): Reverse sense of test for
Well, that patch worked for him, but probably for nobody else :) I've reverted it, and have checked in the following instead. His system does not define CLOCK_MONOTONIC at all. Instead, gethrxtime.c ends up using clock_gettime through gettime, because that system *does* define CLOCK_REALTIME. 2006-08-18 Jim Meyering <[EMAIL PROTECTED]> * gethrxtime.m4 (gl_PREREQ_GETHRXTIME): Also check for CLOCK_REALTIME, since gethrxtime may revert to using clock_gettime via gettime.c. Gabor Z. Papp reported that gethrxtime-using programs failed to link due to unresolved clock_gettime on a linux-2.4.x system. Index: m4/gethrxtime.m4 =================================================================== RCS file: /fetish/cu/m4/gethrxtime.m4,v retrieving revision 1.5 diff -u -p -r1.5 gethrxtime.m4 --- m4/gethrxtime.m4 18 Aug 2006 08:24:46 -0000 1.5 +++ m4/gethrxtime.m4 18 Aug 2006 08:55:41 -0000 @@ -1,5 +1,5 @@ -# gethrxtime.m4 serial 3 -dnl Copyright (C) 2005 Free Software Foundation, Inc. +# gethrxtime.m4 serial 4 +dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -56,18 +56,18 @@ AC_DEFUN([gl_PREREQ_GETHRXTIME], if test $ac_cv_func_nanouptime != yes; then LIB_GETHRXTIME= - AC_CACHE_CHECK([whether CLOCK_MONOTONIC is defined], - gl_cv_have_CLOCK_MONOTONIC, - [AC_EGREP_CPP([have_CLOCK_MONOTONIC], + AC_CACHE_CHECK([whether CLOCK_MONOTONIC or CLOCK_REALTIME is defined], + gl_cv_have_clock_gettime_macro, + [AC_EGREP_CPP([have_clock_gettime_macro], [ # include <time.h> -# ifdef CLOCK_MONOTONIC - have_CLOCK_MONOTONIC +# if defined CLOCK_MONOTONIC || defined CLOCK_REALTIME + have_clock_gettime_macro # endif ], - gl_cv_have_CLOCK_MONOTONIC=yes, - gl_cv_have_CLOCK_MONOTONIC=no)]) - if test $gl_cv_have_CLOCK_MONOTONIC = yes; then + gl_cv_have_clock_gettime_macro=yes, + gl_cv_have_clock_gettime_macro=no)]) + if test $gl_cv_have_clock_gettime_macro = yes; then LIB_GETHRXTIME=$LIB_CLOCK_GETTIME fi AC_SUBST([LIB_GETHRXTIME])