summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-04-07 14:02:04 -0700
committerKaz Kylheku <kaz@kylheku.com>2012-04-07 14:02:04 -0700
commitbe0a434fcb763aff834f3c305c094c11a1e5da2a (patch)
treeac850f782332815186ce7479b627898be2144a90
parent9824a363682faabb4d0be80117bd30c82c6ac51c (diff)
downloadtxr-be0a434fcb763aff834f3c305c094c11a1e5da2a.tar.gz
txr-be0a434fcb763aff834f3c305c094c11a1e5da2a.tar.bz2
txr-be0a434fcb763aff834f3c305c094c11a1e5da2a.zip
* configure: Added new check for some clashing external names,
which we can redefine out of the way in config.h. * lib.c: config.h was being included before <windows.h>.
-rw-r--r--ChangeLog7
-rwxr-xr-xconfigure40
-rw-r--r--lib.c2
3 files changed, 48 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 0413e9a2..f4c26d8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2012-04-07 Kaz Kylheku <kaz@kylheku.com>
+ * configure: Added new check for some clashing external names,
+ which we can redefine out of the way in config.h.
+
+ * lib.c: config.h was being included before <windows.h>.
+
+2012-04-07 Kaz Kylheku <kaz@kylheku.com>
+
* txr.1: Documented int-flo, flo-int, search-regex,
match-regex and regsub.
diff --git a/configure b/configure
index 6c6d7c2e..f52f3470 100755
--- a/configure
+++ b/configure
@@ -1046,6 +1046,46 @@ else
fi
#
+# Check for annoying clashes from non-conforming BSD-derived systems that don't
+# honor Unix/POSIX feature selection macros!
+#
+
+printf "Checking for name clashes caused by nonconforming toolchains ... "
+
+for ident in trunc floorf random ; do
+ cat > conftest.c <<!
+#include <assert.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <errno.h>
+#include <float.h>
+#include <limits.h>
+#include <math.h>
+#include <setjmp.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+
+struct txr_foo { int txr; } $ident;
+
+int $ident(void);
+
+int main(void) { return 0; }
+!
+ rm -f conftest
+ if ! make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then
+ printf "#define %s txr_%s\n" $ident $ident >> config.h
+ fi
+done
+
+#
# Extra debugging.
#
diff --git a/lib.c b/lib.c
index 51c584b0..30ac7d8d 100644
--- a/lib.c
+++ b/lib.c
@@ -36,11 +36,11 @@
#include <errno.h>
#include <wchar.h>
#include <math.h>
-#include "config.h"
#ifdef HAVE_GETENVIRONMENTSTRINGS
#define NOMINMAX
#include <windows.h>
#endif
+#include "config.h"
#include "lib.h"
#include "gc.h"
#include "arith.h"