redoconf: clock_gettime() detection needs to depend on -lrt.
More generally, default.func.rc.od wasn't super useful because you couldn't specify either a header file or library dependencies. Drop it and make an explicit clock_gettime.rc.od. As a bonus, this also checks that CLOCK_MONOTONIC exists as expected. Reported-by: Wayne Scott <wsc9tt@gmail.com>
This commit is contained in:
parent
ea6a7135f1
commit
337e026ce3
3 changed files with 18 additions and 14 deletions
|
|
@ -9,7 +9,7 @@ rc_include \
|
||||||
rc/libm.rc \
|
rc/libm.rc \
|
||||||
rc/rt.autolib.rc \
|
rc/rt.autolib.rc \
|
||||||
rc/libpng.rc \
|
rc/libpng.rc \
|
||||||
rc/clock_gettime.func.rc \
|
rc/clock_gettime.rc \
|
||||||
rc/mach_time.h.rc \
|
rc/mach_time.h.rc \
|
||||||
rc/windows.h.rc \
|
rc/windows.h.rc \
|
||||||
rc/posix.rc \
|
rc/posix.rc \
|
||||||
|
|
|
||||||
17
docs/cookbook/c/rc/clock_gettime.rc.od
Normal file
17
docs/cookbook/c/rc/clock_gettime.rc.od
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
. ./redoconf.rc
|
||||||
|
rc_include rc/CC.rc rc/rt.autolib.rc rc/posix.rc
|
||||||
|
|
||||||
|
prog="
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
void test() { clock_gettime(CLOCK_MONOTONIC, NULL); }
|
||||||
|
"
|
||||||
|
|
||||||
|
rc_appendln LIBS "$LIBRT"
|
||||||
|
if rc_compile cc link "$prog"; then
|
||||||
|
rc_replaceln "HAVE_CLOCK_GETTIME" 1
|
||||||
|
else
|
||||||
|
rc_undo
|
||||||
|
rc_replaceln "HAVE_CLOCK_GETTIME" ""
|
||||||
|
fi
|
||||||
|
rc_save
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
. ./redoconf.rc
|
|
||||||
rc_include rc/CC.rc
|
|
||||||
|
|
||||||
base="${1#*/}"
|
|
||||||
f="${base%.func.rc}"
|
|
||||||
F=$(echo "$f" | tr 'a-z.' 'A-Z_')
|
|
||||||
|
|
||||||
if rc_compile cc link "void $f(); void test() { $f(); }"; then
|
|
||||||
rc_replaceln "HAVE_$F" 1
|
|
||||||
else
|
|
||||||
rc_replaceln "HAVE_$F" ""
|
|
||||||
fi
|
|
||||||
rc_save
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue