diff options
author | Simon Josefsson <simon@josefsson.org> | 2010-01-12 21:26:24 +0100 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2010-01-12 21:26:24 +0100 |
commit | 49c82b023a8ea68af2941fc4b8b851ce807dd6d7 (patch) | |
tree | da14c2681202f4282552401172351bb80c7aa239 /gl | |
parent | d7a5e23798fd7ec5f2cc077786ac9fdadca8d594 (diff) | |
download | libtasn1-49c82b023a8ea68af2941fc4b8b851ce807dd6d7.tar.gz libtasn1-49c82b023a8ea68af2941fc4b8b851ce807dd6d7.tar.bz2 libtasn1-49c82b023a8ea68af2941fc4b8b851ce807dd6d7.zip |
Update gnulib files.
Diffstat (limited to 'gl')
-rw-r--r-- | gl/Makefile.am | 22 | ||||
-rw-r--r-- | gl/m4/gnulib-common.m4 | 10 | ||||
-rw-r--r-- | gl/m4/gnulib-comp.m4 | 2 | ||||
-rw-r--r-- | gl/m4/unistd_h.m4 | 12 | ||||
-rw-r--r-- | gl/m4/warn-on-use.m4 | 45 | ||||
-rw-r--r-- | gl/m4/warnings.m4 | 10 | ||||
-rw-r--r-- | gl/unistd.in.h | 18 |
7 files changed, 102 insertions, 17 deletions
diff --git a/gl/Makefile.am b/gl/Makefile.am index 13c55ee..ebfa36a 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am @@ -336,7 +336,7 @@ BUILT_SOURCES += unistd.h # We need the following in order to create an empty placeholder for # <unistd.h> when the system doesn't have one. -unistd.h: unistd.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H) +unistd.h: unistd.in.h $(LINK_WARNING_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ @@ -438,6 +438,7 @@ unistd.h: unistd.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H) -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/unistd.in.h; \ } > $@-t && \ mv $@-t $@ @@ -480,6 +481,25 @@ libgnu_la_SOURCES += version-etc-fsf.c ## end gnulib module version-etc-fsf +## begin gnulib module warn-on-use + +BUILT_SOURCES += warn-on-use.h +# The warn-on-use.h that gets inserted into generated .h files is the same as +# build-aux/warn-on-use.h, except that it has the copyright header cut off. +warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/^.ifndef/,$$p' \ + < $(top_srcdir)/build-aux/warn-on-use.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t + +WARN_ON_USE_H=warn-on-use.h + +EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h + +## end gnulib module warn-on-use + ## begin gnulib module wchar BUILT_SOURCES += wchar.h diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4 index d53b9cb..b7812a8 100644 --- a/gl/m4/gnulib-common.m4 +++ b/gl/m4/gnulib-common.m4 @@ -1,4 +1,4 @@ -# gnulib-common.m4 serial 11 +# gnulib-common.m4 serial 12 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -52,6 +52,14 @@ m4_ifndef([m4_foreach_w], [m4_define([m4_foreach_w], [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) +# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH]) +# ---------------------------------------------------- +# Backport of autoconf-2.63b's macro. +# Remove this macro when we can assume autoconf >= 2.64. +m4_ifndef([AS_VAR_IF], +[m4_define([AS_VAR_IF], +[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])]) + # AC_PROG_MKDIR_P # is a backport of autoconf-2.60's AC_PROG_MKDIR_P. # Remove this macro when we can assume autoconf >= 2.60. diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index e65fb75..a84bfee 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -213,6 +213,7 @@ AC_DEFUN([gl_FILE_LIST], [ build-aux/update-copyright build-aux/useless-if-before-free build-aux/vc-list-files + build-aux/warn-on-use.h doc/fdl-1.3.texi doc/gendocs_template lib/getopt.c @@ -252,6 +253,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/stdlib_h.m4 m4/unistd_h.m4 m4/version-etc.m4 + m4/warn-on-use.m4 m4/warnings.m4 m4/wchar.m4 m4/wchar_t.m4 diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4 index f3074ea..aacec2b 100644 --- a/gl/m4/unistd_h.m4 +++ b/gl/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 37 +# unistd_h.m4 serial 38 dnl Copyright (C) 2006-2010 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,6 +11,7 @@ AC_DEFUN([gl_UNISTD_H], dnl Use AC_REQUIRE here, so that the default behavior below is expanded dnl once only, before all statements that occur in other macros. AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_C_INLINE]) gl_CHECK_NEXT_HEADERS([unistd.h]) @@ -21,6 +22,15 @@ AC_DEFUN([gl_UNISTD_H], HAVE_UNISTD_H=0 fi AC_SUBST([HAVE_UNISTD_H]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <unistd.h> +/* Some systems declare environ in the wrong header. */ +#ifndef __GLIBC__ +# include <stdlib.h> +#endif + ]], [environ]) ]) AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], diff --git a/gl/m4/warn-on-use.m4 b/gl/m4/warn-on-use.m4 new file mode 100644 index 0000000..ab46422 --- /dev/null +++ b/gl/m4/warn-on-use.m4 @@ -0,0 +1,45 @@ +# warn-on-use.m4 serial 1 +dnl Copyright (C) 2010 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. + +# gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) +# --------------------------------------- +# For each whitespace-separated element in the list of NAMES, define +# HAVE_RAW_DECL_name if the function has a declaration among INCLUDES +# even after being undefined as a macro. +# +# See warn-on-use.h for some hints on how to poison function names, as +# well as ideas on poisoning global variables and macros. NAMES may +# include global variables, but remember that only functions work with +# _GL_WARN_ON_USE. Typically, INCLUDES only needs to list a single +# header, but if the replacement header pulls in other headers because +# some systems declare functions in the wrong header, then INCLUDES +# should do likewise. +# +# If you assume C89, then it is generally safe to assume declarations +# for functions declared in that standard (such as gets) without +# needing gl_WARN_ON_USE_PREPARE. +AC_DEFUN([gl_WARN_ON_USE_PREPARE], +[ + m4_foreach_w([gl_decl], [$2], + [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), + [Define to 1 if ]m4_defn([gl_decl])[ is declared even after + undefining macros.])])dnl + for gl_func in m4_flatten([$2]); do + AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl + AC_CACHE_CHECK([whether $gl_func is declared without a macro], + [gl_Symbol], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], +[@%:@undef $gl_func + (void) $gl_func;])], + [AS_VAR_SET([gl_Symbol], [yes])], [AS_VAR_SET([gl_Symbol], [no])])]) + AS_VAR_IF([gl_Symbol], [yes], + [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) + dnl shortcut - if the raw declaration exists, then set a cache + dnl variable to allow skipping any later AC_CHECK_DECL efforts + eval ac_cv_have_decl_$gl_func=yes]) + AS_VAR_POPDEF([gl_Symbol])dnl + done +]) diff --git a/gl/m4/warnings.m4 b/gl/m4/warnings.m4 index 2745d73..dad5c1f 100644 --- a/gl/m4/warnings.m4 +++ b/gl/m4/warnings.m4 @@ -6,14 +6,6 @@ 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. @@ -37,7 +29,7 @@ AC_CACHE_CHECK([whether compiler handles $1], [gl_Warn], [ 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_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 diff --git a/gl/unistd.in.h b/gl/unistd.in.h index 350109b..0b2d591 100644 --- a/gl/unistd.in.h +++ b/gl/unistd.in.h @@ -118,6 +118,8 @@ /* The definition of _GL_ARG_NONNULL is copied here. */ +/* The definition of _GL_WARN_ON_USE is copied here. */ + /* OS/2 EMX lacks these macros. */ #ifndef STDIN_FILENO @@ -250,11 +252,17 @@ extern char **environ; # endif # endif #elif defined GNULIB_POSIXCHECK -# undef environ -# define environ \ - (GL_LINK_WARNING ("environ is unportable - " \ - "use gnulib module environ for portability"), \ - environ) +# if HAVE_RAW_DECL_ENVIRON +static inline char *** +rpl_environ (void) +{ + return &environ; +} +_GL_WARN_ON_USE (rpl_environ, "environ is unportable - " + "use gnulib module environ for portability"); +# undef environ +# define environ (*rpl_environ ()) +# endif #endif |