This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix warning in libf2c/libU77/hostnm_.c on glibc systems


Compiling hostnm_.c on a glibc 2.2.5 system, I get this warning:

/cvs/gcc/libf2c/libU77/hostnm_.c: In function `G77_hostnm_0':
/cvs/gcc/libf2c/libU77/hostnm_.c:39: warning: implicit declaration of function `gethostname'

The problem is that gethostname is only available in certain context,
e.g. with
#define _GNU_SOURCE 1
or 
#define _XOPEN_SOURCE 600L

We define _XOPEN_SOURCE to 500 instead of 600.

So, what shall we do?

I see two solutions:
- Use the appended patch to define _GNU_SOURCE
- Set _XOPEN_SOURCE to 600 instead of 500

What do you prefer?
Andreas

2003-02-03  Andreas Jaeger  <aj@suse.de>

	* libf2c/libU77/configure.in (AC_PROG_CC_WORKS): Define
	_GNU_SOURCE.

============================================================
Index: libf2c/libU77/configure.in
--- libf2c/libU77/configure.in	29 Nov 2002 17:53:45 -0000	1.15
+++ libf2c/libU77/configure.in	3 Feb 2003 09:58:34 -0000
@@ -1,5 +1,5 @@
 # Process this file with autoconf to produce a configure script.
-#   Copyright (C) 1995, 1998, 1999 Free Software Foundation, Inc.
+#   Copyright (C) 1995, 1998, 1999, 2003 Free Software Foundation, Inc.
 #   Contributed by Dave Love (d.love@dl.ac.uk).
 #
 #This file is part of the GNU Fortran libU77 library.
@@ -47,6 +47,7 @@ if test $may_use_xopen_source = yes; the
   # The following is needed by Solaris2.5.1 so that struct timeval is declared.
   AC_DEFINE(__EXTENSIONS__, 1, [Solaris extensions])
   AC_DEFINE(_FILE_OFFSET_BITS, 64, [Get 64-bit file size support])
+  AC_DEFINE(_GNU_SOURCE, 1, [Get GNU extensions])
 fi
 
 dnl Checks for programs.

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]