2008-??-?? Peter O'Gorman * modules/stdarg: Use a replacement header for va_copy. * lib/stdarg.in.h: This is it. * m4/stdarg.m4: Use the replacement header if va_copy and __va_copy are not available. diff --git a/m4/stdarg.m4 b/m4/stdarg.m4 index e8e680a..36af1ad 100644 --- a/m4/stdarg.m4 +++ b/m4/stdarg.m4 @@ -9,6 +9,10 @@ dnl Provide a working va_copy in combination with . AC_DEFUN([gl_STDARG_H], [ + HAVE_VA_COPY=1 + STDARG_H= + AC_SUBST([STDARG_H]) + AC_SUBST([HAVE_VA_COPY]) AC_MSG_CHECKING([for va_copy]) AC_CACHE_VAL([gl_cv_func_va_copy], [ AC_TRY_COMPILE([#include ], [ @@ -31,10 +35,9 @@ error, bail out AC_DEFINE([va_copy], [__va_copy], [Define as a macro for copying va_list variables.]) else - AH_VERBATIM([gl_VA_COPY], [/* A replacement for va_copy, if needed. */ -#define gl_va_copy(a,b) ((a) = (b))]) - AC_DEFINE([va_copy], [gl_va_copy], - [Define as a macro for copying va_list variables.]) + STDARG_H=stdarg.h + HAVE_VA_COPY=0 + gl_CHECK_NEXT_HEADERS([stdarg.h]) fi fi ]) diff --git a/modules/stdarg b/modules/stdarg index 48febb2..e386f3e 100644 --- a/modules/stdarg +++ b/modules/stdarg @@ -3,8 +3,10 @@ An that conforms to C99. Files: m4/stdarg.m4 +lib/stdarg.in.h Depends-on: +include_next configure.ac-early: dnl Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode @@ -17,6 +19,21 @@ configure.ac: gl_STDARG_H Makefile.am: +BUILT_SOURCES += $(STDARG_H) + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +stdarg.h: stdarg.in.h + rm -f address@hidden $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \ + -e 's/@''HAVE_VA_COPY''@/$(HAVE_VA_COPY)/g' \ + < $(srcdir)/stdarg.in.h; \ + } > address@hidden + mv address@hidden $@ + +MOSTLYCLEANFILES += stdarg.h stdarg.h-t Include: #include --- /dev/null Tue Feb 26 22:22:00 2008 +++ a/lib/stdarg.in.h Tue Feb 26 21:16:02 2008 @@ -0,0 +1,31 @@ +/* + Copyright (C) 2008 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 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_STDARG_H + +/* The include_next requires a split double-inclusion guard. */ address@hidden@ @NEXT_STDARG_H@ + +#ifndef _GL_STDARG_H +#define _GL_STDARG_H + +#if ! @HAVE_VA_COPY@ +#define va_copy(a,b) ((a) = (b)) +#endif + +#endif /* _GL_STDARG_H */ +#endif /* _GL_STDARG_H */