unix.c (stream_ttyname): Protect use of ttyname by HAVE_TTYNAME macro.
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>
Fri, 2 Sep 2005 20:24:49 +0000 (22:24 +0200)
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Fri, 2 Sep 2005 20:24:49 +0000 (20:24 +0000)
* io/unix.c (stream_ttyname): Protect use of ttyname by
HAVE_TTYNAME macro.
* configure.ac: Add check for ttyname.
* config.h.in: Regenerate.
* configure: Regenerate.

From-SVN: r103794

libgfortran/ChangeLog
libgfortran/config.h.in
libgfortran/configure
libgfortran/configure.ac
libgfortran/io/unix.c

index 1dd69cb28445420c4f86c145049bb7b40d2d2ac5..a2dba91b4db46dd36c7e5b6b52ed4e6e58d29677 100644 (file)
@@ -1,3 +1,11 @@
+2005-09-02  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+       * io/unix.c (stream_ttyname): Protect use of ttyname by
+       HAVE_TTYNAME macro.
+       * configure.ac: Add check for ttyname.
+       * config.h.in: Regenerate.
+       * configure: Regenerate.
+
 2005-09-02  Andreas Jaeger  <aj@suse.de>
 
        * libgfortran.h: Add prototype for init_compile_options.
index c84938e08094de054aaa1bd8d09bbbbcec52f0e6..bc110c9fffaf9a9dccc3628ccce6d251f08b50cb 100644 (file)
 /* libm includes truncf */
 #undef HAVE_TRUNCF
 
+/* Define to 1 if you have the `ttyname' function. */
+#undef HAVE_TTYNAME
+
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
index 293fe0d53ef7e92349fe87768a1d696bbc77b605..6b6df14c4f902771de4d84821579289a5d0dea99 100755 (executable)
@@ -7409,7 +7409,8 @@ done
 
 
 
-for ac_func in sleep time
+
+for ac_func in sleep time ttyname
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 echo "$as_me:$LINENO: checking for $ac_func" >&5
index 41dc7e67b544fdf731d81b00caff81ca84967338..8968d45bf3a498c0e450a50c8b4fad0c87d0d9de 100644 (file)
@@ -171,7 +171,7 @@ AC_CHECK_LIB([m],[csin],[need_math="no"],[need_math="yes"])
 # Check for library functions.
 AC_CHECK_FUNCS(getrusage times mkstemp strtof strtold snprintf ftruncate chsize)
 AC_CHECK_FUNCS(chdir strerror getlogin gethostname kill link symlink perror)
-AC_CHECK_FUNCS(sleep time)
+AC_CHECK_FUNCS(sleep time ttyname)
 
 # Check libc for getgid, getpid, getuid
 AC_CHECK_LIB([c],[getgid],[AC_DEFINE([HAVE_GETGID],[1],[libc includes getgid])])
index a0ed7b64510502895b7579c887fea8eb24c4a471..69101efff0433c44536025cffdf29300e25b87ae 100644 (file)
@@ -1548,7 +1548,11 @@ stream_isatty (stream *s)
 char *
 stream_ttyname (stream *s)
 {
+#ifdef HAVE_TTYNAME
   return ttyname (((unix_stream *) s)->fd);
+#else
+  return NULL;
+#endif
 }