changeset 10266:82db36545def

use gnulib gethostname module
author John W. Eaton <jwe@octave.org>
date Thu, 04 Feb 2010 04:43:08 -0500
parents 8c583af2cf64
children 479c7df0cc96
files ChangeLog bootstrap.conf configure.ac liboctave/ChangeLog liboctave/lo-cutils.c liboctave/lo-sysdep.h src/ChangeLog src/sysdep.cc
diffstat 8 files changed, 16 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Feb 04 03:56:28 2010 -0500
+++ b/ChangeLog	Thu Feb 04 04:43:08 2010 -0500
@@ -1,3 +1,8 @@
+2010-02-04  John W. Eaton  <jwe@octave.org>
+
+	* configure.ac: Don't check for gethostname.
+	* bootstrap.conf (gnulib_modules): Include gethostname in the list.
+
 2010-02-03  John W. Eaton  <jwe@octave.org>
 
 	* configure.ac: Don't check for fcntl.h or fcntl.
--- a/bootstrap.conf	Thu Feb 04 03:56:28 2010 -0500
+++ b/bootstrap.conf	Thu Feb 04 04:43:08 2010 -0500
@@ -23,6 +23,7 @@
   fcntl
   fnmatch
   getcwd
+  gethostname
   getopt-gnu
   gettimeofday
   glob
--- a/configure.ac	Thu Feb 04 03:56:28 2010 -0500
+++ b/configure.ac	Thu Feb 04 04:43:08 2010 -0500
@@ -1370,18 +1370,13 @@
 AC_SUBST(SCRIPTS_EXE_SUFFIX)
 
 ### special checks for odd OS specific things.
-###
-### I am told that on some SCO systems, the only place to find some
-### functions like gethostname and gettimeofday is in libsocket.
 
-AC_CHECK_FUNCS(gethostname, [], [AC_CHECK_LIB(socket, gethostname)])
 AC_CHECK_FUNCS(getpwnam, [], [AC_CHECK_LIB(sun, getpwnam)])
 
 NO_UNDEFINED_LDFLAG=
 case "$canonical_host_type" in
   *-*-cygwin*)
-   AC_CHECK_LIB(wsock32, gethostname)
-   LIBS="$LIBS -lwsock32"
+    LIBS="$LIBS -lwsock32"
   ;;
   *-*-mingw*)
     if test "$have_msvc" = "yes"; then
--- a/liboctave/ChangeLog	Thu Feb 04 03:56:28 2010 -0500
+++ b/liboctave/ChangeLog	Thu Feb 04 04:43:08 2010 -0500
@@ -1,3 +1,8 @@
+2010-02-04  John W. Eaton  <jwe@octave.org>
+
+	* lo-cutils.c (gethostname): Delete function.
+	* lo-sysdep.h (gethostname): Delete declaration.
+
 2010-02-03  John W. Eaton  <jwe@octave.org>
 
 	* oct-syscalls.h, oct-syscalls.cc (octave_fcntl): Assume fcntl exists.
--- a/liboctave/lo-cutils.c	Thu Feb 04 03:56:28 2010 -0500
+++ b/liboctave/lo-cutils.c	Thu Feb 04 04:43:08 2010 -0500
@@ -55,32 +55,6 @@
   qsort (base, n, size, cmp);
 }
 
-#if defined (__WIN32__) && ! defined (_POSIX_VERSION)
-
-#include <winsock.h>
-
-#elif ! defined (HAVE_GETHOSTNAME) && defined (HAVE_SYS_UTSNAME_H)
-
-#include <sys/utsname.h>
-
-int
-gethostname (char *name, int namelen)
-{
-  int i;
-  struct utsname ut;
-
-  --namelen;
-
-  uname (&ut);
-  i = strlen (ut.nodename) + 1;
-  strncpy (name, ut.nodename, i < namelen ? i : namelen);
-  name[namelen] = '\0';
-
-  return 0;
-}
-
-#endif
-
 OCTAVE_API int
 octave_strcasecmp (const char *s1, const char *s2)
 {
--- a/liboctave/lo-sysdep.h	Thu Feb 04 03:56:28 2010 -0500
+++ b/liboctave/lo-sysdep.h	Thu Feb 04 04:43:08 2010 -0500
@@ -32,10 +32,6 @@
 
 extern int octave_chdir (const std::string&);
 
-#if ! defined (HAVE_GETHOSTNAME) && defined (HAVE_SYS_UTSNAME_H)
-extern int gethostname (char *, int);
-#endif
-
 #if defined (__WIN32__) && ! defined (__CYGWIN__)
 extern pid_t octave_popen2 (const std::string&, const string_vector&,
     bool, int *, std::string&);
--- a/src/ChangeLog	Thu Feb 04 03:56:28 2010 -0500
+++ b/src/ChangeLog	Thu Feb 04 04:43:08 2010 -0500
@@ -1,3 +1,7 @@
+2010-02-04  John W. Eaton  <jwe@octave.org>
+
+	* sysdep.cc: Don't include <sys/utsname.h>.
+
 2010-02-04  John W. Eaton  <jwe@octave.org>
 
 	* graphics.h.in (gh_manager::lookup (const octave_value&)):
--- a/src/sysdep.cc	Thu Feb 04 03:56:28 2010 -0500
+++ b/src/sysdep.cc	Thu Feb 04 04:43:08 2010 -0500
@@ -61,10 +61,6 @@
 #include <ieeefp.h>
 #endif
 
-#if !defined (HAVE_GETHOSTNAME) && defined (HAVE_SYS_UTSNAME_H)
-#include <sys/utsname.h>
-#endif
-
 #include "cmd-edit.h"
 #include "file-ops.h"
 #include "lo-mappers.h"