From f29ded4b67ca5d750863ba24d16456ed8f730d0a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 16 Nov 2009 23:40:28 +0100 Subject: [PATCH] Use Gnulib's `warning' module. * m4/gnulib-cache.m4: Add `warnings'. * configure.ac: Use `gl_WARN_ADD' to check whether compiler flags are supported. * libguile/Makefile.am (libguile_la_LIBADD): Add $(LTLIBICONV). (libguile_la_LDFLAGS): Add $(INET_NTOP_LIB) $(INET_PTON_LIB). --- configure.ac | 10 ++++++++-- lib/Makefile.am | 26 ++++++++++++++---------- lib/getpagesize.c | 39 ------------------------------------ lib/stdlib.in.h | 47 ++++++++++++++++++++++++++++++++++++++++++++ lib/strftime.c | 2 +- lib/strftime.h | 8 ++++++++ lib/sys_stat.in.h | 44 ++++++++++++++++++++++++++++++++++++++++- lib/unistd.in.h | 37 +++++++++++++++++++++++++++------- libguile/Makefile.am | 6 ++++-- m4/getpagesize.m4 | 29 --------------------------- m4/gnulib-cache.m4 | 3 ++- m4/gnulib-comp.m4 | 6 ++---- m4/inet_ntop.m4 | 17 ++++++++-------- m4/inet_pton.m4 | 16 +++++++++++++-- m4/readlink.m4 | 7 +++++-- m4/stat.m4 | 18 ++++++++++++++--- m4/stdlib_h.m4 | 6 +++++- m4/sys_stat_h.m4 | 8 +++++++- m4/unistd_h.m4 | 7 ++++++- m4/warnings.m4 | 44 +++++++++++++++++++++++++++++++++++++++++ 20 files changed, 266 insertions(+), 114 deletions(-) delete mode 100644 lib/getpagesize.c delete mode 100644 m4/getpagesize.m4 create mode 100644 m4/warnings.m4 diff --git a/configure.ac b/configure.ac index 2f0ef02a7..7d7cf7d91 100644 --- a/configure.ac +++ b/configure.ac @@ -1436,6 +1436,7 @@ AC_ARG_VAR(GUILE_FOR_BUILD,[guile for build system]) AC_SUBST(GUILE_FOR_BUILD) ## If we're using GCC, ask for aggressive warnings. +GCC_CFLAGS="" case "$GCC" in yes ) ## We had -Wstrict-prototypes in here for a bit, but Guile does too @@ -1443,14 +1444,19 @@ case "$GCC" in ## less than exasperating. ## -Wpointer-arith was here too, but something changed in gcc/glibc ## and it became equally exasperating (gcc 2.95 and/or glibc 2.1.2). - GCC_CFLAGS="-Wall -Wmissing-prototypes" + POTENTIAL_GCC_CFLAGS="-Wall -Wmissing-prototypes" # Do this here so we don't screw up any of the tests above that might # not be "warning free" if test "${GUILE_ERROR_ON_WARNING}" = yes then - GCC_CFLAGS="${GCC_CFLAGS} -Werror" + POTENTIAL_GCC_CFLAGS="${POTENTIAL_GCC_CFLAGS} -Werror" enable_compile_warnings=no fi + + for flag in $POTENTIAL_GCC_CFLAGS + do + gl_WARN_ADD([$flag], [GCC_CFLAGS]) + done ;; esac diff --git a/lib/Makefile.am b/lib/Makefile.am index 5ec4cb4fb..284ed16d9 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -9,7 +9,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt autobuild byteswap canonicalize-lgpl environ extensions flock fpieee full-read full-write havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring putenv stdlib strcase strftime striconveh string verify vsnprintf +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt autobuild byteswap canonicalize-lgpl environ extensions flock fpieee full-read full-write havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring putenv stdlib strcase strftime striconveh string verify vsnprintf warnings AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects @@ -267,15 +267,6 @@ libgnu_la_SOURCES += full-write.h full-write.c ## end gnulib module full-write -## begin gnulib module getpagesize - - -EXTRA_DIST += getpagesize.c - -EXTRA_libgnu_la_SOURCES += getpagesize.c - -## end gnulib module getpagesize - ## begin gnulib module gperf GPERF = gperf @@ -804,7 +795,9 @@ stdlib.h: stdlib.in.h -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \ + -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \ -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \ + -e 's|@''GNULIB_MKSTEMPS''@|$(GNULIB_MKSTEMPS)|g' \ -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \ -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \ -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \ @@ -823,6 +816,8 @@ stdlib.h: stdlib.in.h -e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \ -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ + -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ + -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \ -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \ @@ -1084,7 +1079,9 @@ sys/stat.h: sys_stat.in.h -e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \ -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \ -e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \ + -e 's|@''GNULIB_MKFIFO''@|$(GNULIB_MKFIFO)|g' \ -e 's|@''GNULIB_MKFIFOAT''@|$(GNULIB_MKFIFOAT)|g' \ + -e 's|@''GNULIB_MKNOD''@|$(GNULIB_MKNOD)|g' \ -e 's|@''GNULIB_MKNODAT''@|$(GNULIB_MKNODAT)|g' \ -e 's|@''GNULIB_STAT''@|$(GNULIB_STAT)|g' \ -e 's|@''GNULIB_UTIMENSAT''@|$(GNULIB_UTIMENSAT)|g' \ @@ -1094,7 +1091,9 @@ sys/stat.h: sys_stat.in.h -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \ -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \ + -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \ -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \ + -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \ -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \ -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \ -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \ @@ -1102,6 +1101,8 @@ sys/stat.h: sys_stat.in.h -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \ -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \ -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \ + -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \ + -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \ -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \ -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ @@ -1179,6 +1180,7 @@ unistd.h: unistd.in.h -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \ -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \ + -e 's|@''GNULIB_GETGROUPS''@|$(GNULIB_GETGROUPS)|g' \ -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \ -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ @@ -1199,6 +1201,7 @@ unistd.h: unistd.in.h -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \ -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \ -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \ + -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ @@ -1208,9 +1211,11 @@ unistd.h: unistd.in.h -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \ -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ + -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \ + -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \ @@ -1231,6 +1236,7 @@ unistd.h: unistd.in.h -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ + -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ diff --git a/lib/getpagesize.c b/lib/getpagesize.c deleted file mode 100644 index 82238df19..000000000 --- a/lib/getpagesize.c +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 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 . */ - -/* Written by Bruno Haible and Martin Lambers. */ - -#include - -/* Specification. */ -#include - -/* This implementation is only for native Win32 systems. */ -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - -# define WIN32_LEAN_AND_MEAN -# include - -int -getpagesize (void) -{ - SYSTEM_INFO system_info; - GetSystemInfo (&system_info); - return system_info.dwPageSize; -} - -#endif diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 1ab4c5853..5e5550fce 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -224,6 +224,31 @@ extern int mkostemp (char * /*template*/, int /*flags*/); mkostemp (t, f)) #endif +#if @GNULIB_MKOSTEMPS@ +# if !@HAVE_MKOSTEMPS@ +/* Create a unique temporary file from TEMPLATE. + The last six characters of TEMPLATE before a suffix of length + SUFFIXLEN must be "XXXXXX"; + they are replaced with a string that makes the file name unique. + The flags are a bitmask, possibly including O_CLOEXEC (defined in ) + and O_TEXT, O_BINARY (defined in "binary-io.h"). + The file is then created, with the specified flags, ensuring it didn't exist + before. + The file is created read-write (mask at least 0600 & ~umask), but it may be + world-readable and world-writable (mask 0666 & ~umask), depending on the + implementation. + Returns the open file descriptor if successful, otherwise -1 and errno + set. */ +extern int mkostemps (char * /*template*/, int /*suffixlen*/, int /*flags*/); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mkostemps +# define mkostemps(t,s,f) \ + (GL_LINK_WARNING ("mkostemps is unportable - " \ + "use gnulib module mkostemps for portability"), \ + mkostemps (t, s, f)) +#endif + #if @GNULIB_MKSTEMP@ # if @REPLACE_MKSTEMP@ /* Create a unique temporary file from TEMPLATE. @@ -249,6 +274,28 @@ extern int mkstemp (char * /*template*/); mkstemp (t)) #endif +#if @GNULIB_MKSTEMPS@ +# if !@HAVE_MKSTEMPS@ +/* Create a unique temporary file from TEMPLATE. + The last six characters of TEMPLATE prior to a suffix of length + SUFFIXLEN must be "XXXXXX"; + they are replaced with a string that makes the file name unique. + The file is then created, ensuring it didn't exist before. + The file is created read-write (mask at least 0600 & ~umask), but it may be + world-readable and world-writable (mask 0666 & ~umask), depending on the + implementation. + Returns the open file descriptor if successful, otherwise -1 and errno + set. */ +extern int mkstemps (char * /*template*/, int /*suffixlen*/); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mkstemps +# define mkstemps(t,s) \ + (GL_LINK_WARNING ("mkstemps is unportable - " \ + "use gnulib module mkstemps for portability"), \ + mkstemps (t, s)) +#endif + #if @GNULIB_PUTENV@ # if @REPLACE_PUTENV@ # undef putenv diff --git a/lib/strftime.c b/lib/strftime.c index 8e7f445c0..ffccfd83c 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -27,11 +27,11 @@ #else # include # if FPRINTFTIME +# include "ignore-value.h" # include "fprintftime.h" # else # include "strftime.h" # endif -# include "ignore-value.h" #endif #include diff --git a/lib/strftime.h b/lib/strftime.h index fded6d0dc..27e11afa7 100644 --- a/lib/strftime.h +++ b/lib/strftime.h @@ -17,6 +17,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /* Just like strftime, but with two more arguments: POSIX requires that strftime use the local timezone information. When __UTC is nonzero and tm->tm_zone is NULL or the empty string, @@ -24,3 +28,7 @@ %N directive. */ size_t nstrftime (char *, size_t, char const *, struct tm const *, int __utc, int __ns); + +#ifdef __cplusplus +} +#endif diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index 5dc6428cd..d178f6e91 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -424,6 +424,23 @@ extern int mkdirat (int fd, char const *file, mode_t mode); #endif +#if @GNULIB_MKFIFO@ +# if @REPLACE_MKFIFO@ +# undef mkfifo +# define mkfifo rpl_mkfifo +# endif +# if !@HAVE_MKFIFO@ || @REPLACE_MKFIFO@ +int mkfifo (char const *file, mode_t mode); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mkfifo +# define mkfifo(n,m) \ + (GL_LINK_WARNING ("mkfifo is not portable - " \ + "use gnulib module mkfifo for portability"), \ + mkfifo (n, m)) +#endif + + #if @GNULIB_MKFIFOAT@ # if !@HAVE_MKFIFOAT@ int mkfifoat (int fd, char const *file, mode_t mode); @@ -437,6 +454,23 @@ int mkfifoat (int fd, char const *file, mode_t mode); #endif +#if @GNULIB_MKNOD@ +# if @REPLACE_MKNOD@ +# undef mknod +# define mknod rpl_mknod +# endif +# if !@HAVE_MKNOD@ || @REPLACE_MKNOD@ +int mknod (char const *file, mode_t mode, dev_t dev); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mknod +# define mknod(n,m,d) \ + (GL_LINK_WARNING ("mknod is not portable - " \ + "use gnulib module mknod for portability"), \ + mknod (n, m, d)) +#endif + + #if @GNULIB_MKNODAT@ # if !@HAVE_MKNODAT@ int mknodat (int fd, char const *file, mode_t mode, dev_t dev); @@ -456,7 +490,15 @@ int mknodat (int fd, char const *file, mode_t mode, dev_t dev); struct stat. This means that rpl_stat will not be used if the user does (stat)(a,b). Oh well. */ # undef stat -# define stat(name, st) rpl_stat (name, st) +# ifdef _LARGE_FILES + /* With _LARGE_FILES defined, AIX (only) defines stat to stat64, + so we have to replace stat64() instead of stat(). */ +# define stat stat64 +# undef stat64 +# define stat64(name, st) rpl_stat (name, st) +# else /* !_LARGE_FILES */ +# define stat(name, st) rpl_stat (name, st) +# endif /* !_LARGE_FILES */ extern int stat (const char *name, struct stat *buf); # endif #elif defined GNULIB_POSIXCHECK diff --git a/lib/unistd.in.h b/lib/unistd.in.h index dc6bb7a7c..01b81c8ec 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -126,18 +126,16 @@ extern "C" { #if @GNULIB_CHOWN@ # if @REPLACE_CHOWN@ -# ifndef REPLACE_CHOWN -# define REPLACE_CHOWN 1 -# endif -# if REPLACE_CHOWN +# undef chown +# define chown rpl_chown +# endif +# if !@HAVE_CHOWN@ || @REPLACE_CHOWN@ /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE to GID (if GID is not -1). Follow symbolic links. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2001 specification . */ -# define chown rpl_chown extern int chown (const char *file, uid_t uid, gid_t gid); -# endif # endif #elif defined GNULIB_POSIXCHECK # undef chown @@ -406,6 +404,28 @@ extern int getdtablesize (void); #endif +#if @GNULIB_GETGROUPS@ +# if @REPLACE_GETGROUPS@ +# undef getgroups +# define getgroups rpl_getgroups +# endif +# if !@HAVE_GETGROUPS@ || @REPLACE_GETGROUPS@ +/* Return the supplemental groups that the current process belongs to. + It is unspecified whether the effective group id is in the list. + If N is 0, return the group count; otherwise, N describes how many + entries are available in GROUPS. Return -1 and set errno if N is + not 0 and not large enough. Fails with ENOSYS on some systems. */ +int getgroups (int n, gid_t *groups); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getgroups +# define getgroups(n,g) \ + (GL_LINK_WARNING ("getgroups is unportable - " \ + "use gnulib module getgroups for portability"), \ + getgroups (n, g)) +#endif + + #if @GNULIB_GETHOSTNAME@ /* Return the standard host name of the machine. WARNING! The host name may or may not be fully qualified. @@ -545,12 +565,15 @@ extern void endusershell (void); #if @GNULIB_LCHOWN@ # if @REPLACE_LCHOWN@ +# undef lchown +# define lchown rpl_lchown +# endif +# if !@HAVE_LCHOWN@ || @REPLACE_LCHOWN@ /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE to GID (if GID is not -1). Do not follow symbolic links. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2001 specification . */ -# define lchown rpl_lchown extern int lchown (char const *file, uid_t owner, gid_t group); # endif #elif defined GNULIB_POSIXCHECK diff --git a/libguile/Makefile.am b/libguile/Makefile.am index d83cc7c58..6c2081a87 100644 --- a/libguile/Makefile.am +++ b/libguile/Makefile.am @@ -426,9 +426,11 @@ noinst_HEADERS = conv-integer.i.c conv-uinteger.i.c \ noinst_HEADERS += vm-engine.c vm-i-system.c vm-i-scheme.c vm-i-loader.c libguile_la_DEPENDENCIES = @LIBLOBJS@ -libguile_la_LIBADD = @LIBLOBJS@ $(gnulib_library) $(LTLIBGMP) $(LTLIBUNISTRING) +libguile_la_LIBADD = \ + @LIBLOBJS@ $(gnulib_library) $(LTLIBGMP) \ + $(LTLIBUNISTRING) $(LTLIBICONV) libguile_la_LDFLAGS = \ - @LTLIBINTL@ \ + @LTLIBINTL@ $(INET_NTOP_LIB) $(INET_PTON_LIB) \ -version-info @LIBGUILE_INTERFACE_CURRENT@:@LIBGUILE_INTERFACE_REVISION@:@LIBGUILE_INTERFACE_AGE@ \ -export-dynamic -no-undefined \ $(GNU_LD_FLAGS) diff --git a/m4/getpagesize.m4 b/m4/getpagesize.m4 deleted file mode 100644 index 0d07a3a53..000000000 --- a/m4/getpagesize.m4 +++ /dev/null @@ -1,29 +0,0 @@ -# getpagesize.m4 serial 7 -dnl Copyright (C) 2002, 2004-2005, 2007 Free Software Foundation, 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 - AC_LIBOBJ([getpagesize]) - ;; - esac -]) diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4 index 0d3fda96a..9867d8619 100644 --- a/m4/gnulib-cache.m4 +++ b/m4/gnulib-cache.m4 @@ -15,7 +15,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt autobuild byteswap canonicalize-lgpl environ extensions flock fpieee full-read full-write havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring putenv stdlib strcase strftime striconveh string verify vsnprintf +# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt autobuild byteswap canonicalize-lgpl environ extensions flock fpieee full-read full-write havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring putenv stdlib strcase strftime striconveh string verify vsnprintf warnings # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) @@ -46,6 +46,7 @@ gl_MODULES([ string verify vsnprintf + warnings ]) gl_AVOID([]) gl_SOURCE_BASE([lib]) diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index cb13d81f4..869016005 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -58,8 +58,6 @@ AC_DEFUN([gl_INIT], gl_FLOAT_H gl_FUNC_FLOCK gl_HEADER_SYS_FILE_MODULE_INDICATOR([flock]) - gl_FUNC_GETPAGESIZE - gl_UNISTD_MODULE_INDICATOR([getpagesize]) AM_ICONV gl_ICONV_H gl_FUNC_ICONV_OPEN @@ -132,6 +130,7 @@ AC_DEFUN([gl_INIT], gl_FUNC_VASNPRINTF gl_FUNC_VSNPRINTF gl_STDIO_MODULE_INDICATOR([vsnprintf]) + AC_SUBST([WARN_CFLAGS]) gl_WCHAR_H gl_FUNC_WRITE gl_UNISTD_MODULE_INDICATOR([write]) @@ -287,7 +286,6 @@ AC_DEFUN([gl_FILE_LIST], [ lib/full-read.h lib/full-write.c lib/full-write.h - lib/getpagesize.c lib/iconv.c lib/iconv.in.h lib/iconv_close.c @@ -383,7 +381,6 @@ AC_DEFUN([gl_FILE_LIST], [ m4/float_h.m4 m4/flock.m4 m4/fpieee.m4 - m4/getpagesize.m4 m4/glibc21.m4 m4/gnulib-common.m4 m4/iconv.m4 @@ -447,6 +444,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/vasnprintf.m4 m4/visibility.m4 m4/vsnprintf.m4 + m4/warnings.m4 m4/wchar.m4 m4/wchar_t.m4 m4/wint_t.m4 diff --git a/m4/inet_ntop.m4 b/m4/inet_ntop.m4 index 2bbdca108..2a8ff2051 100644 --- a/m4/inet_ntop.m4 +++ b/m4/inet_ntop.m4 @@ -1,4 +1,4 @@ -# inet_ntop.m4 serial 9 +# inet_ntop.m4 serial 11 dnl Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,17 +11,18 @@ AC_DEFUN([gl_INET_NTOP], gl_REPLACE_ARPA_INET_H - dnl The AC_SEARCH_LIBS call is a hack to persuade the Solaris 8 linker to - dnl find inet_ntop. - dnl - dnl It is the responsibility of gl_INET_NTOP's caller to arrange for - dnl -lnsl if it is needed. Normally -lnsl is not needed on Solaris 8, - dnl since inet_ntop is needed only by getaddrinfo, and getaddrinfo - dnl isn't built on Solaris 8. + dnl Most platforms that provide inet_ntop define it in libc. + dnl Solaris 8..10 provide inet_ntop in libnsl instead. gl_save_LIBS=$LIBS AC_SEARCH_LIBS([inet_ntop], [nsl], [], [AC_REPLACE_FUNCS([inet_ntop])]) LIBS=$gl_save_LIBS + INET_NTOP_LIB= + if test "$ac_cv_search_inet_ntop" != "no" && + test "$ac_cv_search_inet_ntop" != "none required"; then + INET_NTOP_LIB="$ac_cv_search_inet_ntop" + fi + AC_SUBST([INET_NTOP_LIB]) gl_PREREQ_INET_NTOP ]) diff --git a/m4/inet_pton.m4 b/m4/inet_pton.m4 index e0ec432bc..e890b9b7a 100644 --- a/m4/inet_pton.m4 +++ b/m4/inet_pton.m4 @@ -1,4 +1,4 @@ -# inet_pton.m4 serial 7 +# inet_pton.m4 serial 9 dnl Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,7 +11,19 @@ AC_DEFUN([gl_INET_PTON], gl_REPLACE_ARPA_INET_H - AC_REPLACE_FUNCS([inet_pton]) + dnl Most platforms that provide inet_pton define it in libc. + dnl Solaris 8..10 provide inet_pton in libnsl instead. + gl_save_LIBS=$LIBS + AC_SEARCH_LIBS([inet_pton], [nsl], [], + [AC_REPLACE_FUNCS([inet_pton])]) + LIBS=$gl_save_LIBS + INET_PTON_LIB= + if test "$ac_cv_search_inet_pton" != "no" && + test "$ac_cv_search_inet_pton" != "none required"; then + INET_PTON_LIB="$ac_cv_search_inet_pton" + fi + AC_SUBST([INET_PTON_LIB]) + gl_PREREQ_INET_PTON ]) diff --git a/m4/readlink.m4 b/m4/readlink.m4 index fa7c2ddcb..e61c1a1cf 100644 --- a/m4/readlink.m4 +++ b/m4/readlink.m4 @@ -1,4 +1,4 @@ -# readlink.m4 serial 7 +# readlink.m4 serial 8 dnl Copyright (C) 2003, 2007, 2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -21,15 +21,18 @@ AC_DEFUN([gl_FUNC_READLINK], /* Cause compilation failure if original declaration has wrong type. */ ssize_t readlink (const char *, char *, size_t);]])], [gl_cv_decl_readlink_works=yes], [gl_cv_decl_readlink_works=no])]) + dnl Solaris 9 ignores trailing slash. + dnl FreeBSD 7.2 dereferences only one level of links with trailing slash. AC_CACHE_CHECK([whether readlink handles trailing slash correctly], [gl_cv_func_readlink_works], [# We have readlink, so assume ln -s works. ln -s conftest.no-such conftest.link + ln -s conftest.link conftest.lnk2 AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[char buf[20]; - return readlink ("conftest.link/", buf, sizeof buf) != -1;]])], + return readlink ("conftest.lnk2/", buf, sizeof buf) != -1;]])], [gl_cv_func_readlink_works=yes], [gl_cv_func_readlink_works=no], [gl_cv_func_readlink_works="guessing no"]) rm -f conftest.link]) diff --git a/m4/stat.m4 b/m4/stat.m4 index 0a10de14f..ce6933b3c 100644 --- a/m4/stat.m4 +++ b/m4/stat.m4 @@ -1,4 +1,4 @@ -# serial 2 +# serial 3 # Copyright (C) 2009 Free Software Foundation, Inc. # @@ -11,6 +11,7 @@ AC_DEFUN([gl_FUNC_STAT], AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_REQUIRE([gl_AC_DOS]) AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([lstat]) dnl mingw is the only known platform where stat(".") and stat("./") differ AC_CACHE_CHECK([whether stat handles trailing slashes on directories], [gl_cv_func_stat_dir_slash], @@ -24,15 +25,26 @@ AC_DEFUN([gl_FUNC_STAT], *) gl_cv_func_stat_dir_slash="guessing yes";; esac])]) dnl Solaris 9 mistakenly succeeds on stat("file/") + dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/") AC_CACHE_CHECK([whether stat handles trailing slashes on files], [gl_cv_func_stat_file_slash], [touch conftest.tmp + # Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + ln -s conftest.tmp conftest.lnk + fi AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include -]], [[struct stat st; return !stat ("conftest.tmp/", &st);]])], +]], [[struct stat st; + if (!stat ("conftest.tmp/", &st)) return 1; +#if HAVE_LSTAT + if (!stat ("conftest.lnk/", &st)) return 2; +#endif + ]])], [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no], - [gl_cv_func_stat_file_slash="guessing no"])]) + [gl_cv_func_stat_file_slash="guessing no"]) + rm -f conftest.tmp conftest.lnk]) case $gl_cv_func_stat_dir_slash in *no) REPLACE_STAT=1 AC_DEFINE([REPLACE_FUNC_STAT_DIR], [1], [Define to 1 if stat needs diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index 42d551d3b..4556ac04c 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -1,4 +1,4 @@ -# stdlib_h.m4 serial 20 +# stdlib_h.m4 serial 21 dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -41,7 +41,9 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP]) + GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS]) GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) + GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS]) GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) @@ -61,6 +63,8 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_MALLOC_POSIX=1; AC_SUBST([HAVE_MALLOC_POSIX]) HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP]) + HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS]) + HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS]) HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX]) HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4 index 1edf54834..838cf484e 100644 --- a/m4/sys_stat_h.m4 +++ b/m4/sys_stat_h.m4 @@ -1,4 +1,4 @@ -# sys_stat_h.m4 serial 19 -*- Autoconf -*- +# sys_stat_h.m4 serial 21 -*- Autoconf -*- dnl Copyright (C) 2006-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -45,7 +45,9 @@ AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD]) GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT]) GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT]) + GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO]) GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT]) + GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD]) GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT]) GNULIB_STAT=0; AC_SUBST([GNULIB_STAT]) GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT]) @@ -56,7 +58,9 @@ AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD]) HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT]) HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT]) + HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO]) HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT]) + HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD]) HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT]) HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT]) REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT]) @@ -64,6 +68,8 @@ AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS]) REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT]) REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR]) + REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO]) + REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD]) REPLACE_STAT=0; AC_SUBST([REPLACE_STAT]) REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT]) ]) diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index 5aa39aeda..88e60a053 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 31 +# unistd_h.m4 serial 34 dnl Copyright (C) 2006-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -46,6 +46,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) + GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS]) GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME]) GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) @@ -67,6 +68,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT]) GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) HAVE_DUP3=1; AC_SUBST([HAVE_DUP3]) HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) @@ -76,9 +78,11 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) HAVE_GETDOMAINNAME=1; AC_SUBST([HAVE_GETDOMAINNAME]) HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) + HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS]) HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) HAVE_GETUSERSHELL=1; AC_SUBST([HAVE_GETUSERSHELL]) + HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) HAVE_LINK=1; AC_SUBST([HAVE_LINK]) HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2]) @@ -99,6 +103,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR]) REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) + REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) diff --git a/m4/warnings.m4 b/m4/warnings.m4 new file mode 100644 index 000000000..c32cf4ed6 --- /dev/null +++ b/m4/warnings.m4 @@ -0,0 +1,44 @@ +# warnings.m4 serial 2 +dnl Copyright (C) 2008 Free Software Foundation, 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. + +dnl From Simon Josefsson + +# gl_AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH]) +# ---------------------------------------------------- +# Provide the functionality of AS_VAR_IF if Autoconf does not have it. +m4_ifdef([AS_VAR_IF], +[m4_copy([AS_VAR_IF], [gl_AS_VAR_IF])], +[m4_define([gl_AS_VAR_IF], +[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])]) + +# gl_AS_VAR_APPEND(VAR, VALUE) +# ---------------------------- +# Provide the functionality of AS_VAR_APPEND if Autoconf does not have it. +m4_ifdef([AS_VAR_APPEND], +[m4_copy([AS_VAR_APPEND], [gl_AS_VAR_APPEND])], +[m4_define([gl_AS_VAR_APPEND], +[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])]) + +# gl_WARN_ADD(PARAMETER, [VARIABLE = WARN_CFLAGS]) +# ------------------------------------------------ +# Adds parameter to WARN_CFLAGS if the compiler supports it. For example, +# gl_WARN_ADD([-Wparentheses]). +AC_DEFUN([gl_WARN_ADD], +[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_$1])dnl +AC_CACHE_CHECK([whether compiler handles $1], [gl_Warn], [ + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} $1" + AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])], + [AS_VAR_SET([gl_Warn], [yes])], + [AS_VAR_SET([gl_Warn], [no])]) + CPPFLAGS="$save_CPPFLAGS" +]) +AS_VAR_PUSHDEF([gl_Flags], m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]))dnl +gl_AS_VAR_IF([gl_Warn], [yes], [gl_AS_VAR_APPEND([gl_Flags], [" $1"])]) +AS_VAR_POPDEF([gl_Flags])dnl +AS_VAR_POPDEF([gl_Warn])dnl +m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl +]) -- 2.20.1