+2007-12-10 Martin Lambers <marlam@marlam.de>
+
+ Override getpagesize on mingw.
+ * lib/getpagesize.c: New file.
+ * m4/getpagesize.m4 (gl_FUNC_GETPAGESIZE): Enable replacement on mingw.
+ * modules/getpagesize (Files): Add lib/getpagesize.c.
+ * lib/unistd.in.h (getpagesize): Declare if we are using a replacement.
+ * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize
+ REPLACE_GETPAGESIZE.
+ * modules/unistd (Makefile.am): Substitute REPLACE_GETPAGESIZE.
+
2007-12-25 Bruno Haible <bruno@clisp.org>
* modules/localcharset (Notice): New field.
--- /dev/null
+/* getpagesize emulation for systems where it cannot be done in a C macro.
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU 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 General Public License for more details.
+
+ You should have received a copy of the GNU 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 Win32 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
#if @GNULIB_GETPAGESIZE@
-# if !@HAVE_GETPAGESIZE@
+# if @REPLACE_GETPAGESIZE@
+# define getpagesize rpl_getpagesize
+extern int getpagesize (void);
+# elif !@HAVE_GETPAGESIZE@
/* This is for POSIX systems. */
# if !defined getpagesize && defined _SC_PAGESIZE
# if ! (defined __VMS && __VMS_VER < 70000000)
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
HAVE_SYS_PARAM_H=1
fi
fi
+ case "$host_os" in
+ mingw*)
+ REPLACE_GETPAGESIZE=1
+ AC_LIBOBJ([getpagesize])
+ ;;
+ esac
])
REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN])
REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR])
REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD])
+ REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])
REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN])
REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK])
])
getpagesize() function: Return memory page size.
Files:
+lib/getpagesize.c
m4/getpagesize.m4
Depends-on:
-e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
-e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
+ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
-e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
-e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
< $(srcdir)/unistd.in.h; \