diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-08-25 23:15:04 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-08-25 23:15:04 -0700 |
commit | b1c7429d1d36be399b65551e8be9f15e53917e90 (patch) | |
tree | a56d1c48666b45994e3550535b542532e1285423 | |
parent | 8984d14da07ff8eb82bccd2b5cede969dcbd5f34 (diff) | |
download | txr-b1c7429d1d36be399b65551e8be9f15e53917e90.tar.gz txr-b1c7429d1d36be399b65551e8be9f15e53917e90.tar.bz2 txr-b1c7429d1d36be399b65551e8be9f15e53917e90.zip |
mmap: Solaris 10 build fix.
Solaris 10's <sys/mman.h> header doesn't declare madvise if
_POSIX_C_SOURCE > 2 is defined or _XPTG4_2, even though
__EXTENSIONS__ is defined. This is a bug in the header.
* configure (solaris_target): New variable. We set this to y
in several places where the script discovers that
-D__EXTENSIONS__ is required to get something to work, which
is a Solaris 10 telltale sign. Then just before the mmap test,
if solaris_target is true, we deposit a blurb into config.h
that declares madvise. This way, the ffi.c code, or any other
committed C code doesn't have to carry any Solaris hack.
-rwxr-xr-x | configure | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -212,6 +212,7 @@ have_pkgconfig= libffi_cflags= darwin_target= android_target= +solaris_target= build_id= # @@ -2973,6 +2974,7 @@ elif conftest EXTRA_FLAGS=-D__EXTENSIONS__=1 ; then gen_config_make have_unistd=y have_sys_types=y + solaris_target=y else printf "no\n" fi @@ -3259,6 +3261,9 @@ int main(int argc, char **argv) printf "yes\n" printf "#define HAVE_WINSIZE 1\n" >> config.h have_winsize=y + if [ "$termios_define" = __EXTENSIONS__ ] ; then + solaris_target=y + fi break; fi done @@ -3781,11 +3786,24 @@ else printf "no\n" fi +if [ $solaris_target ] ; then + cat >> config.h <<! +#include <stddef.h> +#ifdef __sun__ +#ifdef __cplusplus +extern "C" +#endif +int madvise(void *addr, size_t len, int behav); +#endif +! +fi + printf "Checking for mmap ... " cat > conftest.c <<! #include <sys/mman.h> #include <unistd.h> #include <stdlib.h> +#include "config.h" int main(void) { @@ -3807,6 +3825,8 @@ if conftest ; then printf "#define HAVE_MMAP 1\n" >> config.h else printf "no\n" + cat conftest.err + exit 1 fi |