guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 02/02: Use gnulib for getpagesize


From: Mike Gran
Subject: [Guile-commits] 02/02: Use gnulib for getpagesize
Date: Tue, 10 Apr 2018 19:43:26 -0400 (EDT)

mike121 pushed a commit to branch wip-mingw-guile-2.2
in repository guile.

commit a2b20d8faf022e3d529e505476388fc7e51311cf
Author: Michael Gran <address@hidden>
Date:   Tue Apr 10 16:36:12 2018 -0700

    Use gnulib for getpagesize
    
    * lib/Makefile.am: updated
    * lib/getpagesize.c: new file
    * lib/getpagesize.m4: new file
    * lib/gnulib-cache.m4: updated
    * lib/gnulib-comp.m4: updated
---
 lib/Makefile.am    | 11 ++++++++++-
 lib/getpagesize.c  | 39 +++++++++++++++++++++++++++++++++++++++
 m4/getpagesize.m4  | 32 ++++++++++++++++++++++++++++++++
 m4/gnulib-cache.m4 |  3 ++-
 m4/gnulib-comp.m4  |  8 ++++++++
 5 files changed, 91 insertions(+), 2 deletions(-)

diff --git a/lib/Makefile.am b/lib/Makefile.am
index 1e52604..306a23e 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -21,7 +21,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --local-dir=gnulib-local --lib=libgnu 
--source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests 
--aux-dir=build-aux --avoid=lock --avoid=unistr/base --avoid=unistr/u8-mbtouc 
--avoid=unistr/u8-mbtouc-unsafe --avoid=unistr/u8-mbtoucr 
--avoid=unistr/u8-prev --avoid=unistr/u8-uctomb --avoid=unitypes --lgpl=3 
--conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept4 
alignof alloca-opt announce-gen autobuild bind byteswap c-strcase [...]
+# Reproduce by: gnulib-tool --import --local-dir=gnulib-local --lib=libgnu 
--source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests 
--aux-dir=build-aux --avoid=lock --avoid=unistr/base --avoid=unistr/u8-mbtouc 
--avoid=unistr/u8-mbtouc-unsafe --avoid=unistr/u8-mbtoucr 
--avoid=unistr/u8-prev --avoid=unistr/u8-uctomb --avoid=unitypes --lgpl=3 
--conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept4 
alignof alloca-opt announce-gen autobuild bind byteswap c-strcase [...]
 
 AUTOMAKE_OPTIONS = 1.9.6 gnits
 
@@ -659,6 +659,15 @@ EXTRA_libgnu_la_SOURCES += getlogin.c
 
 ## end   gnulib module getlogin
 
+## begin gnulib module getpagesize
+
+
+EXTRA_DIST += getpagesize.c
+
+EXTRA_libgnu_la_SOURCES += getpagesize.c
+
+## end   gnulib module getpagesize
+
 ## begin gnulib module getpeername
 
 
diff --git a/lib/getpagesize.c b/lib/getpagesize.c
new file mode 100644
index 0000000..695f980
--- /dev/null
+++ b/lib/getpagesize.c
@@ -0,0 +1,39 @@
+/* getpagesize emulation for systems where it cannot be done in a C macro.
+
+   Copyright (C) 2007, 2009-2017 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible and Martin Lambers.  */
+
+#include <config.h>
+
+/* Specification. */
+#include <unistd.h>
+
+/* This implementation is only for native Windows systems.  */
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+
+int
+getpagesize (void)
+{
+  SYSTEM_INFO system_info;
+  GetSystemInfo (&system_info);
+  return system_info.dwPageSize;
+}
+
+#endif
diff --git a/m4/getpagesize.m4 b/m4/getpagesize.m4
new file mode 100644
index 0000000..f891200
--- /dev/null
+++ b/m4/getpagesize.m4
@@ -0,0 +1,32 @@
+# getpagesize.m4 serial 9
+dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2017 Free Software Foundation,
+dnl Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_GETPAGESIZE],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CHECK_FUNCS([getpagesize])
+  if test $ac_cv_func_getpagesize = no; then
+    HAVE_GETPAGESIZE=0
+    AC_CHECK_HEADERS([OS.h])
+    if test $ac_cv_header_OS_h = yes; then
+      HAVE_OS_H=1
+    fi
+    AC_CHECK_HEADERS([sys/param.h])
+    if test $ac_cv_header_sys_param_h = yes; then
+      HAVE_SYS_PARAM_H=1
+    fi
+  fi
+  case "$host_os" in
+    mingw*)
+      REPLACE_GETPAGESIZE=1
+      ;;
+  esac
+  dnl Also check whether it's declared.
+  dnl mingw has getpagesize() in libgcc.a but doesn't declare it.
+  AC_CHECK_DECL([getpagesize], , [HAVE_DECL_GETPAGESIZE=0])
+])
diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4
index cde476e..b0be2e4 100644
--- a/m4/gnulib-cache.m4
+++ b/m4/gnulib-cache.m4
@@ -27,7 +27,7 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --local-dir=gnulib-local --lib=libgnu 
--source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests 
--aux-dir=build-aux --avoid=lock --avoid=unistr/base --avoid=unistr/u8-mbtouc 
--avoid=unistr/u8-mbtouc-unsafe --avoid=unistr/u8-mbtoucr 
--avoid=unistr/u8-prev --avoid=unistr/u8-uctomb --avoid=unitypes --lgpl=3 
--conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept4 
alignof alloca-opt announce-gen autobuild bind byteswap c-strcase canonicaliz 
[...]
+#   gnulib-tool --import --local-dir=gnulib-local --lib=libgnu 
--source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests 
--aux-dir=build-aux --avoid=lock --avoid=unistr/base --avoid=unistr/u8-mbtouc 
--avoid=unistr/u8-mbtouc-unsafe --avoid=unistr/u8-mbtoucr 
--avoid=unistr/u8-prev --avoid=unistr/u8-uctomb --avoid=unitypes --lgpl=3 
--conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept4 
alignof alloca-opt announce-gen autobuild bind byteswap c-strcase canonicaliz 
[...]
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([gnulib-local])
@@ -64,6 +64,7 @@ gl_MODULES([
   getaddrinfo
   gethostname
   getlogin
+  getpagesize
   getpeername
   getsockname
   getsockopt
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 070c2e9..59cc756 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -98,6 +98,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module getaddrinfo:
   # Code from module gethostname:
   # Code from module getlogin:
+  # Code from module getpagesize:
   # Code from module getpeername:
   # Code from module getsockname:
   # Code from module getsockopt:
@@ -386,6 +387,11 @@ AC_DEFUN([gl_INIT],
   fi
   gl_UNISTD_MODULE_INDICATOR([getlogin])
   AC_REQUIRE([gl_LIB_GETLOGIN])
+  gl_FUNC_GETPAGESIZE
+  if test $REPLACE_GETPAGESIZE = 1; then
+    AC_LIBOBJ([getpagesize])
+  fi
+  gl_UNISTD_MODULE_INDICATOR([getpagesize])
   AC_REQUIRE([gl_HEADER_SYS_SOCKET])
   if test "$ac_cv_header_winsock2_h" = yes; then
     AC_LIBOBJ([getpeername])
@@ -1620,6 +1626,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/getaddrinfo.c
   lib/gethostname.c
   lib/getlogin.c
+  lib/getpagesize.c
   lib/getpeername.c
   lib/getsockname.c
   lib/getsockopt.c
@@ -1831,6 +1838,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/getaddrinfo.m4
   m4/gethostname.m4
   m4/getlogin.m4
+  m4/getpagesize.m4
   m4/gettimeofday.m4
   m4/glibc21.m4
   m4/gnulib-common.m4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]