apenwarr-redo/docs/cookbook/c/rc/posix.rc.od
Avery Pennarun 017997c035 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>
2019-02-23 21:00:26 -05:00

20 lines
295 B
Text

. ./redoconf.rc
rc_include rc/CC.rc
prog='
#include <time.h>
struct timespec x;
'
x=
rc_replaceln HAS_POSIX 1
if ! rc_compile cc link "$prog"; then
x="-D_XOPEN_SOURCE=500"
rc_appendln CPPFLAGS "$x"
if ! rc_compile cc link "$prog"; then
rc_undo
rc_replaceln HAS_POSIX ""
fi
fi
rc_save