aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Law <law@gcc.gnu.org>1998-02-25 16:10:36 -0700
committerJeff Law <law@gcc.gnu.org>1998-02-25 16:10:36 -0700
commita0dfe933e224ac4241d4a35d1bec7c7e55fe8544 (patch)
tree7ff7e49e9952b57607996b458d8a5b199453fcdb
parentc3cf395b61d4df4fea1e155295ff15641589bff9 (diff)
downloadgcc-a0dfe933e224ac4241d4a35d1bec7c7e55fe8544.zip
gcc-a0dfe933e224ac4241d4a35d1bec7c7e55fe8544.tar.gz
gcc-a0dfe933e224ac4241d4a35d1bec7c7e55fe8544.tar.bz2
choose-temp.c: Fix handling of sys/file.h to work in libiberty.
8 * choose-temp.c: Fix handling of sys/file.h to work in libiberty. From-SVN: r18242
-rw-r--r--gcc/choose-temp.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/gcc/choose-temp.c b/gcc/choose-temp.c
index 798de48..5668f74 100644
--- a/gcc/choose-temp.c
+++ b/gcc/choose-temp.c
@@ -1,5 +1,5 @@
/* Utility to pick a temporary filename prefix.
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
@@ -22,7 +22,16 @@ Boston, MA 02111-1307, USA. */
/* This file lives in at least two places: libiberty and gcc.
Don't change one without the other. */
-#ifndef NO_SYS_FILE_H
+#if defined (IN_GCC) || defined (HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+/* If we are in gcc, or we have a config.h, we assume that
+ HAVE_SYS_FILE_H tells us whether to include sys/file.h. However,
+ libiberty does not have a config.h, and instead arranges to define
+ NO_SYS_FILE_H on the command line when there is no sys/file.h. */
+
+#if (defined (IN_GCC) || defined (HAVE_CONFIG_H)) ? defined (HAVE_SYS_FILE_H) : ! defined (NO_SYS_FILE_H)
#include <sys/types.h>
#include <sys/file.h> /* May get R_OK, etc. on some systems. */
#endif
@@ -36,7 +45,6 @@ Boston, MA 02111-1307, USA. */
#include <stdio.h> /* May get P_tmpdir. */
#ifdef IN_GCC
-#include "config.h"
#include "gansidecl.h"
extern char *xmalloc ();
#else
@@ -54,7 +62,7 @@ extern char *xmalloc ();
/* On MSDOS, write temp files in current dir
because there's no place else we can expect to use. */
/* ??? Although the current directory is tried as a last resort,
- this is left in so that on MSDOS it is prefered to /tmp on the
+ this is left in so that on MSDOS it is preferred to /tmp on the
off chance that someone requires this, since that was the previous
behaviour. */
#ifdef __MSDOS__
@@ -68,7 +76,7 @@ extern char *xmalloc ();
#define TEMP_FILE "ccXXXXXX"
/* Subroutine of choose_temp_base.
- If BASE is non-NULL, returh it.
+ If BASE is non-NULL, return it.
Otherwise it checks if DIR is a usable directory.
If success, DIR is returned.
Otherwise NULL is returned. */
@@ -114,11 +122,7 @@ choose_temp_base ()
/* If all else fails, use the current directory! */
if (base == 0)
-#ifdef VMS
- base = "[";
-#else
base = ".";
-#endif
#else /* MPW */
base = ":";