diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-06-19 20:25:36 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-06-19 20:25:36 -0700 |
commit | 29a25713116323adcac696a090420ed3c1e73e5f (patch) | |
tree | 53c4e86a83e015268ea435dace0a21d90ca6766e /configure | |
parent | 09091bedcc6dd570262de4a72c362b161a492df7 (diff) | |
download | txr-29a25713116323adcac696a090420ed3c1e73e5f.tar.gz txr-29a25713116323adcac696a090420ed3c1e73e5f.tar.bz2 txr-29a25713116323adcac696a090420ed3c1e73e5f.zip |
New function: strerror
* configure (have_strerror_r): New variable.
Detect whether we have strerror_r and which flavor:
GNU or POSIX. Define HAVE_STRERROR_GNU or HAVE_STRERROR_POSIX
in config.h.
* sysif.c (strerror_wrap): New function.
(sysif_init): Register strerror intrinsic.
* txr.1: Documented.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -173,6 +173,7 @@ have_unistd= have_sys_stat= have_sys_types= have_sys_time= +have_strerror_r= have_makedev= have_syslog= have_glob= @@ -2022,6 +2023,37 @@ else fi # +# errno stuff +# + +printf "Checking for strerror_r ..." + +for type in int 'char *' ; do + cat > conftest.c <<! +#include <string.h> + +int main(int argc, char **argv) +{ + $type (*fp)(int, char *, size_t) = strerror_r; + return 0; +} +! + if conftest EXTRA_FLAGS=-Werror=incompatible-pointer-types ; then + if [ "$type" = int ] ; then + printf "yes (POSIX)\n" + printf "#define HAVE_STRERROR_POSIX 1\n" >> config.h + else + printf "yes (GNU)\n" + printf "#define HAVE_STRERROR_GNU 1\n" >> config.h + fi + have_strerror_r=y + break + fi +done + +[ $have_strerror_r ] || printf "no\n" + +# # fcntl # |