diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-04-10 20:36:11 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-04-10 20:36:11 -0700 |
commit | 7b825e541377fc8a6f6ec8e490187c7b19bda6c3 (patch) | |
tree | 2c6aa914a917c44ffd88e0d5afa0a4822728dbd6 | |
parent | 38abf85defad8a15899687e35c7037bb2ddf42b0 (diff) | |
download | txr-7b825e541377fc8a6f6ec8e490187c7b19bda6c3.tar.gz txr-7b825e541377fc8a6f6ec8e490187c7b19bda6c3.tar.bz2 txr-7b825e541377fc8a6f6ec8e490187c7b19bda6c3.zip |
More NetBSD porting.
* Makefile (EXTRA_FLAGS): Handy new variable for additional
ad-hoc CFLAGS. Needed by a new test in configure.
* configure: Check for annoying warnings about char being used
as an array subscript when calling the macros from <ctype.h>.
If this occurs, suppress it by #undef-ing the macros.
(lang_flags): Switching fromm _XOPEN_SOURCE to _XOPEN_SOURCE=2
because this is needed on NetBSD to obtain declarations of
popen and pclose.
* stream.c (pipe_close): If we don't have the WIFCONTINUED macro,
then define it to expand to zero. It's absent on NetBSD and they
already seem to have a hack for this because there is a warning about
the function not being defined, but then the program links anyway.
Let's do it properly and not rely on their hack.
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rwxr-xr-x | configure | 28 | ||||
-rw-r--r-- | stream.c | 3 |
4 files changed, 51 insertions, 2 deletions
@@ -1,5 +1,25 @@ 2012-04-10 Kaz Kylheku <kaz@kylheku.com> + More NetBSD porting. + + * Makefile (EXTRA_FLAGS): Handy new variable for additional + ad-hoc CFLAGS. Needed by a new test in configure. + + * configure: Check for annoying warnings about char being used + as an array subscript when calling the macros from <ctype.h>. + If this occurs, suppress it by #undef-ing the macros. + (lang_flags): Switching fromm _XOPEN_SOURCE to _XOPEN_SOURCE=2 + because this is needed on NetBSD to obtain declarations of + popen and pclose. + + * stream.c (pipe_close): If we don't have the WIFCONTINUED macro, + then define it to expand to zero. It's absent on NetBSD and they + already seem to have a hack for this because there is a warning about + the function not being defined, but then the program links anyway. + Let's do it properly and not rely on their hack. + +2012-04-10 Kaz Kylheku <kaz@kylheku.com> + * arith.c (INT_PTR_MAX_MP): New static variable. (in_int_ptr_range): New function. (arith_init): Initialize INT_PTR_MAX_MP. @@ -29,7 +29,7 @@ include config.make CFLAGS := -I. -I$(top_srcdir) $(LANG_FLAGS) $(DIAG_FLAGS) \ - $(OPT_FLAGS) $(DBG_FLAGS) $(PLATFORM_FLAGS) + $(OPT_FLAGS) $(DBG_FLAGS) $(PLATFORM_FLAGS) $(EXTRA_FLAGS) CFLAGS += -I$(top_srcdir)/mpi-$(mpi_version) CFLAGS := $(filter-out $(REMOVE_FLAGS),$(CFLAGS)) @@ -128,7 +128,7 @@ yacc_given=${yacc+y} yacc=${yacc-'$(cross)$(tool_prefix)$(yaccname)'} nm=${nm-'$(cross)$(tool_prefix)nm'} opt_flags=${opt_flags--O2} -lang_flags=${lang_flags--ansi -D_XOPEN_SOURCE} +lang_flags=${lang_flags--ansi -D_XOPEN_SOURCE=2} diag_flags=${diag_flags--Wall -Wmissing-prototypes -Wstrict-prototypes} debug_flags=${debug_flags--g} inline=${inline-} @@ -666,6 +666,32 @@ done printf "done\n" # +# Check for annoying warnings from ctype.h macros +# + +printf "Checking for annoying warnings from <ctype.h> macros ... " + +cat > conftest.c <<! +#include <ctype.h> + +int main(void) +{ + char x = '3'; + return isdigit(x); +} +! +if ! $make EXTRA_FLAGS=-Werror conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then + printf "present\n" + cat >> config.h <<! +$(for x in isalpha isupper islower isdigit isxdigit isalnum isspace \ + ispunct isprint isgraph iscntrl isblank ; do \ + printf "#undef %s\n" $x ; done) +! +else + printf "absent\n" +fi + +# # Check what kind of C type we have for integers wider than long, # if any. # @@ -284,6 +284,9 @@ static val pipe_close(val stream, val throw_on_error) lit("unable to obtain status of command ~a: ~a/~s"), stream, num(errno), string_utf8(strerror(errno)), nao); #ifdef HAVE_SYS_WAIT +#ifndef WIFCONTINUED +#define WIFCONTINUED(X) 0 +#endif } else if (WIFEXITED(status)) { int exitstatus = WEXITSTATUS(status); uw_throwf(process_error_s, lit("pipe ~a terminated with status ~a"), |