redoconf: posix.rc: fix abort when timespec is not available.
Now we define HAS_POSIX=1 if it works, and to blank otherwise, to be consistent with other rc scripts, but it doesn't abort if we can't find timespec. Meanwhile, slightly clarify the error message in rc.sh. Reported-by: Nathaniel Filardo <nwfilardo@gmail.com>
This commit is contained in:
parent
bdb8d8a27d
commit
017997c035
3 changed files with 10 additions and 4 deletions
2
docs/cookbook/c/clean.do
Normal file
2
docs/cookbook/c/clean.do
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
rm -rf out out.*
|
||||||
|
rm -f *~ .*~ */*~ */.*~ sources arches allconfig when.c
|
||||||
|
|
@ -8,9 +8,13 @@ struct timespec x;
|
||||||
'
|
'
|
||||||
|
|
||||||
x=
|
x=
|
||||||
|
rc_replaceln HAS_POSIX 1
|
||||||
if ! rc_compile cc link "$prog"; then
|
if ! rc_compile cc link "$prog"; then
|
||||||
x="-D_XOPEN_SOURCE=500"
|
x="-D_XOPEN_SOURCE=500"
|
||||||
rc_appendln CPPFLAGS "$x"
|
rc_appendln CPPFLAGS "$x"
|
||||||
rc_compile cc link "$prog"
|
if ! rc_compile cc link "$prog"; then
|
||||||
|
rc_undo
|
||||||
|
rc_replaceln HAS_POSIX ""
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
rc_save
|
rc_save
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ _rc_exit_check() {
|
||||||
echo "Fatal: used redoconf/rc.sh but didn't call rc_include." >&2
|
echo "Fatal: used redoconf/rc.sh but didn't call rc_include." >&2
|
||||||
exit 91
|
exit 91
|
||||||
elif [ -n "$RC_QUEUE" ]; then
|
elif [ -n "$RC_QUEUE" ]; then
|
||||||
echo "Fatal: must call rc_save or rc_undo before ending." >&2
|
echo "Fatal: script exited without rc_save or rc_undo." >&2
|
||||||
exit 92
|
exit 92
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue