choose-temp.c: Fix handling of sys/file.h to work in libiberty.
authorIan Lance Taylor <ian@cygnus.com>
Wed, 25 Feb 1998 23:09:55 +0000 (23:09 +0000)
committerJeff Law <law@gcc.gnu.org>
Wed, 25 Feb 1998 23:09:55 +0000 (16:09 -0700)
Mon Feb 23 14:33:15 1998  Ian Lance Taylor  <ian@cygnus.com>
        * choose-temp.c: Fix handling of sys/file.h to work in libiberty.

From-SVN: r18240

libiberty/ChangeLog
libiberty/choose-temp.c

index dbe5af5af8a353fc83c315bb36808fa37b111275..cff6e6bc3988a89ced2fd1b331f8ac86f104e228 100644 (file)
@@ -1,3 +1,7 @@
+Mon Feb 23 14:33:15 1998  Ian Lance Taylor  <ian@cygnus.com>
+
+       * choose-temp.c: Fix handling of sys/file.h to work in libiberty.
+
 Thu Feb 12 16:29:49 1998  Ian Lance Taylor  <ian@cygnus.com>
 
        * getopt.c: Update to latest FSF version.
index d8808ba02c31e05b164819621f3d6cafe8cf2f6b..5668f745207bb178653c4e7cb92895c44c50a20d 100644 (file)
@@ -1,5 +1,5 @@
 /* Utility to pick a temporary filename prefix.
-   Copyright (C) 1996, 1997 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,11 +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.  */
 
-#ifdef IN_GCC
+#if defined (IN_GCC) || defined (HAVE_CONFIG_H)
 #include "config.h"
 #endif
 
-#ifdef HAVE_SYS_FILE_H
+/* 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