diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-10-25 19:54:20 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-10-25 19:54:20 -0700 |
commit | 14fe44683255c06abe7fd1f59fc10c338307e487 (patch) | |
tree | b49e8ebaf33d7aca10c9c0a53534f1817e73562e | |
parent | 66229085bbd92dc75dc0bb9bc4d34c8438c48b1d (diff) | |
download | txr-14fe44683255c06abe7fd1f59fc10c338307e487.tar.gz txr-14fe44683255c06abe7fd1f59fc10c338307e487.tar.bz2 txr-14fe44683255c06abe7fd1f59fc10c338307e487.zip |
configure: memalign fixes.
This fixes build problems on Mac OS and Solaris due
to the introduction of the use of memalign.
* configure: After detecting that __EXTENSIONS__ is
required on Solaris and adding that to lang_flags, we
must call gen_config_make so that it becomes available to
subsequent configure tests. On Solaris, memalign is just in
<stdlib.h>, so let's test for that first, then test for a
memalign in <malloc.h>, and in that case add HAVE_MALLOC_H
into config.h. Also, fixing two bugs here. Firstly, the
memalign test used inverted logic, causing HAVE_MEMALIGN
to be defined on platforms that don't have it. Secondly,
the dummy while loop that is just supposed to be a control
structure for forward breaks turned infinite due to a
missing break at the bottom.
* lib.c: if HAVE_MALLOC_H is defined and nonzero, then
include <malloc.h>.
-rwxr-xr-x | configure | 24 | ||||
-rw-r--r-- | lib.c | 2 |
2 files changed, 24 insertions, 2 deletions
@@ -2482,6 +2482,7 @@ elif conftest EXTRA_FLAGS=-D__EXTENSIONS__=1 ; then printf "yes\n" printf "#define HAVE_SETGROUPS 1\n" >> config.h lang_flags="$lang_flags -D__EXTENSIONS__=1" # Solaris buggery + gen_config_make have_unistd=y have_sys_types=y else @@ -2679,6 +2680,25 @@ printf "Checking for malloc-with-alignment function ... " while true ; do cat > conftest.c <<! +#include <stdlib.h> + +int main(void) +{ + void *bytes = memalign(16, 42); + return 0; +} +! + + if conftest ; then + printf "memalign\n" + printf "#define HAVE_MEMALIGN 1\n" $try_header >> config.h + break; + fi + + cat conftest.err + exit 1 + + cat > conftest.c <<! #include <malloc.h> int main(void) @@ -2688,9 +2708,10 @@ int main(void) } ! - if ! conftest ; then + if conftest ; then printf "memalign\n" printf "#define HAVE_MEMALIGN 1\n" $try_header >> config.h + printf "#define HAVE_MALLOC_H 1\n" $try_header >> config.h break; fi @@ -2711,6 +2732,7 @@ int main(void) fi printf "none\n" + break done printf "Checking for termios ... " @@ -45,7 +45,7 @@ #define NOMINMAX #include <windows.h> #endif -#if HAVE_MEMALIGN +#if HAVE_MALLOC_H #include <malloc.h> #endif #include "lib.h" |