summaryrefslogtreecommitdiff
path: root/yacc
diff options
context:
space:
mode:
authorMark Shinwell <mshinwell@janestreet.com>2014-05-30 12:49:24 +0000
committerMark Shinwell <mshinwell@janestreet.com>2014-05-30 12:49:24 +0000
commitec9672749700ee2bd466fb70fc003b09b6fe59d1 (patch)
tree50f30ca4cf05d3626244132a2993ab46ef0ef558 /yacc
parent60d0af57c40b51394e51333994f5434252b8a52f (diff)
downloadocaml-ec9672749700ee2bd466fb70fc003b09b6fe59d1.tar.gz
merge from 4.02 (rev. 14929): add configure detection of mkstemp, remove old HAVE_MKSTEMP conditional, rename HAVE_MKSTEMP -> HAS_MKSTEMP
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14930 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'yacc')
-rw-r--r--yacc/main.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/yacc/main.c b/yacc/main.c
index d2f329310d..9388b9d1a8 100644
--- a/yacc/main.c
+++ b/yacc/main.c
@@ -55,11 +55,7 @@ char *text_file_name;
char *union_file_name;
char *verbose_file_name;
-#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) || (__APPLE__)
-#define HAVE_MKSTEMP
-#endif
-
-#ifdef HAVE_MKSTEMP
+#ifdef HAS_MKSTEMP
int action_fd = -1, entry_fd = -1, text_fd = -1, union_fd = -1;
#endif
@@ -101,7 +97,7 @@ char *rassoc;
short **derives;
char *nullable;
-#if !defined(HAVE_MKSTEMP)
+#if !defined(HAS_MKSTEMP)
extern char *mktemp(char *);
#endif
#ifndef NO_UNIX
@@ -111,7 +107,7 @@ extern char *getenv(const char *);
void done(int k)
{
-#ifdef HAVE_MKSTEMP
+#ifdef HAS_MKSTEMP
if (action_fd != -1)
unlink(action_file_name);
if (entry_fd != -1)
@@ -325,7 +321,7 @@ void create_file_names(void)
text_file_name[len + 5] = 't';
union_file_name[len + 5] = 'u';
-#ifdef HAVE_MKSTEMP
+#ifdef HAS_MKSTEMP
action_fd = mkstemp(action_file_name);
if (action_fd == -1)
open_error(action_file_name);
@@ -384,7 +380,7 @@ void open_files(void)
open_error(input_file_name);
}
-#ifdef HAVE_MKSTEMP
+#ifdef HAS_MKSTEMP
action_file = fdopen(action_fd, "w");
#else
action_file = fopen(action_file_name, "w");
@@ -392,7 +388,7 @@ void open_files(void)
if (action_file == 0)
open_error(action_file_name);
-#ifdef HAVE_MKSTEMP
+#ifdef HAS_MKSTEMP
entry_file = fdopen(entry_fd, "w");
#else
entry_file = fopen(entry_file_name, "w");
@@ -400,7 +396,7 @@ void open_files(void)
if (entry_file == 0)
open_error(entry_file_name);
-#ifdef HAVE_MKSTEMP
+#ifdef HAS_MKSTEMP
text_file = fdopen(text_fd, "w");
#else
text_file = fopen(text_file_name, "w");
@@ -420,7 +416,7 @@ void open_files(void)
defines_file = fopen(defines_file_name, "w");
if (defines_file == 0)
open_error(defines_file_name);
-#ifdef HAVE_MKSTEMP
+#ifdef HAS_MKSTEMP
union_file = fdopen(union_fd, "w");
#else
union_file = fopen(union_file_name, "w");