From b1c7429d1d36be399b65551e8be9f15e53917e90 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 25 Aug 2021 23:15:04 -0700 Subject: mmap: Solaris 10 build fix. Solaris 10's 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. --- configure | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'configure') diff --git a/configure b/configure index 0008f764..6cbf5570 100755 --- a/configure +++ b/configure @@ -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 < +#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 #include +#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 -- cgit v1.2.3