From 5ee9c6e95736d9ae925fedab4caa0c615d115fb2 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 10 Jan 2014 20:46:25 -0800 Subject: * configure: Detect platforms which don't reveal declarations in C headers which are extensions to standard C, like popen or fileno, in response to standard feature selection macros like -D_POSIX_SOURCE. MinGW and Cygwin are offenders. These platforms hide the declarations when gcc is in -ansi mode, by testing for __STRICT_ANSI__. Turns out, however, that -U__STRICT_ANSI__ on the gcc command line strips this away, causing the declarations to be revealed. * lib.c, parser.l, stream.c, utf8.c: Removed the declarations which compensated for the above problem. Yippee! Fuck you, stupid Cygwin troglodytes, and the MinGW horse you rode in on. http://cygwin.com/ml/cygwin/2011-10/msg00131.html --- ChangeLog | 15 +++++++++++++++ configure | 23 +++++++++++++++++++++++ lib.c | 5 ----- parser.l | 4 ---- stream.c | 5 ----- utf8.c | 4 ---- 6 files changed, 38 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4b9259ee..32199aa9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2014-01-10 Kaz Kylheku + + * configure: Detect platforms which don't reveal declarations + in C headers which are extensions to standard C, like popen or fileno, + in response to standard feature selection macros like -D_POSIX_SOURCE. + MinGW and Cygwin are offenders. These platforms hide the declarations + when gcc is in -ansi mode, by testing for __STRICT_ANSI__. Turns out, + however, that -U__STRICT_ANSI__ on the gcc command line strips this + away, causing the declarations to be revealed. + + * lib.c, parser.l, stream.c, utf8.c: Removed the declarations which + compensated for the above problem. Yippee! Fuck you, stupid Cygwin + troglodytes, and the MinGW horse you rode in on. + http://cygwin.com/ml/cygwin/2011-10/msg00131.html + 2014-01-10 Kaz Kylheku * eval.c (eval_init): Renaming lisp-parse to read; lisp-parse diff --git a/configure b/configure index 337e2427..6574934e 100755 --- a/configure +++ b/configure @@ -708,6 +708,29 @@ done printf "done\n" +# +# Check for idiotic behavior: extensions in C header files controlled +# by __STRICT_ANSI__ rather than things like __POSIX_SOURCE. +# + +printf "Checking for proper support for feature-test macros ... " + +cat > conftest.c < + +int main(void) +{ + return fileno(stdin); +} +! +rm -f conftest$exe +if ! $make EXTRA_FLAGS=-Werror conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then + printf "no\n" + lang_flags="$lang_flags -U__STRICT_ANSI__" +else + printf "yes\n" +fi + # # Check for annoying warnings from ctype.h macros # diff --git a/lib.c b/lib.c index 9662668b..5f046edf 100644 --- a/lib.c +++ b/lib.c @@ -60,11 +60,6 @@ #define max(a, b) ((a) > (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b)) -#if HAVE_WINDOWS_H -int putenv(const char *); -int tzset(void); -#endif - #if !HAVE_POSIX_SIGS int async_sig_enabled = 0; #endif diff --git a/parser.l b/parser.l index 449fb236..0dca7331 100644 --- a/parser.l +++ b/parser.l @@ -50,10 +50,6 @@ #include "hash.h" #include "parser.h" -#if HAVE_WINDOWS_H -int fileno(FILE *stream); -#endif - #define YY_INPUT(buf, result, max_size) \ do { \ val c = get_byte(yyin_stream); \ diff --git a/stream.c b/stream.c index 1ad75444..7ef91d5c 100644 --- a/stream.c +++ b/stream.c @@ -55,11 +55,6 @@ #include "stream.h" #include "utf8.h" -#if HAVE_WINDOWS_H -int fileno(FILE *stream); -int pclose(FILE *stream); -#endif - val std_input, std_output, std_debug, std_error, std_null; val output_produced; diff --git a/utf8.c b/utf8.c index c37e7d8d..36354277 100644 --- a/utf8.c +++ b/utf8.c @@ -36,10 +36,6 @@ #include "unwind.h" #include "utf8.h" -#if HAVE_WINDOWS_H -FILE *popen(const char *path, const char *mode); -#endif - #if WCHAR_MAX > 65535 #define FULL_UNICODE #endif -- cgit v1.2.3