bug-gnulib
[Top][All Lists]
Advanced

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

Re: AIX 5.1 xlc va_copy (stdarg patch)


From: Bruno Haible
Subject: Re: AIX 5.1 xlc va_copy (stdarg patch)
Date: Tue, 11 Mar 2008 05:44:12 +0100
User-agent: KMail/1.5.4

Peter O'Gorman wrote:
> Attached.

Thanks. I have applied this modified patch.
  - In the doc: there is no need to enumerate the various workarounds which
    work or don't work here; this info is not interesting for the user. Just
    what is the portability problem and whether gnulib fixes it or not.
  - In stdarg.m4: Don't use AC_LANG_PUSH / AC_LANG_POP. If the user's package
    is written in C++, there is no point in switching to C for this test.
  - Use AC_EGREP_CPP instead of AC_COMPILE_IFELSE (faster).
  - Module description: There's no use of HAVE_VA_COPY any more.

2008-03-10  Peter O'Gorman  <address@hidden>
            Bruno Haible  <address@hidden>

        Make va_copy work with some version of xlc on AIX 5.1.
        * lib/stdarg.in.h: New file.
        * m4/stdarg.m4 (gl_STDARG_H): Initialize STDARG_H and NEXT_STDARG_H.
        On AIX, use a <stdarg.h> file substitute.
        * modules/stdarg (Files): Add lib/stdarg.in.h.
        (Depends-on): Add include_next.
        (Makefile.am): Build a stdarg.h substitute if requested.
        * doc/posix-functions/va_copy.texi: Document the platforms lacking it.

========================== lib/stdarg.in.h ==============================
/* Substitute for and wrapper around <stdarg.h>.
   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

#ifndef va_copy
# define va_copy(a,b) ((a) = (b))
#endif

#endif /* _GL_STDARG_H */
#endif /* _GL_STDARG_H */
===========================================================================
*** m4/stdarg.m4.orig   2008-03-11 05:31:52.000000000 +0100
--- m4/stdarg.m4        2008-03-11 05:02:05.000000000 +0100
***************
*** 1,5 ****
! # stdarg.m4 serial 1
! dnl Copyright (C) 2006 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.
--- 1,5 ----
! # stdarg.m4 serial 2
! dnl Copyright (C) 2006, 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.
***************
*** 9,14 ****
--- 9,16 ----
  
  AC_DEFUN([gl_STDARG_H],
  [
+   STDARG_H='';                AC_SUBST([STDARG_H])
+   NEXT_STDARG_H='<stdarg.h>'; AC_SUBST([NEXT_STDARG_H])
    AC_MSG_CHECKING([for va_copy])
    AC_CACHE_VAL([gl_cv_func_va_copy], [
      AC_TRY_COMPILE([#include <stdarg.h>], [
***************
*** 19,40 ****
        [gl_cv_func_va_copy=yes], [gl_cv_func_va_copy=no])])
    AC_MSG_RESULT([$gl_cv_func_va_copy])
    if test $gl_cv_func_va_copy = no; then
!     # Provide a substitute, either __va_copy or as a simple assignment.
!     AC_CACHE_VAL([gl_cv_func___va_copy], [
!       AC_TRY_COMPILE([#include <stdarg.h>], [
  #ifndef __va_copy
  error, bail out
  #endif
  ],
!         [gl_cv_func___va_copy=yes], [gl_cv_func___va_copy=no])])
!     if test $gl_cv_func___va_copy = yes; then
!       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.])
      fi
    fi
  ])
--- 21,67 ----
        [gl_cv_func_va_copy=yes], [gl_cv_func_va_copy=no])])
    AC_MSG_RESULT([$gl_cv_func_va_copy])
    if test $gl_cv_func_va_copy = no; then
!     dnl Provide a substitute.
!     dnl Usually a simple definition in <config.h> is enough. Not so on AIX 5
!     dnl with some versions of the /usr/vac/bin/cc compiler. It has an 
<stdarg.h>
!     dnl which does '#undef va_copy', leading to a missing va_copy symbol. For
!     dnl this platform, we use an <stdarg.h> substitute. But we cannot use this
!     dnl approach on other platforms, because <stdarg.h> often defines only
!     dnl preprocessor macros and gl_ABSOLUTE_HEADER, gl_CHECK_NEXT_HEADERS do
!     dnl not work in this situation.
!     AC_EGREP_CPP([vaccine],
!       [#if defined _AIX && !defined __GNUC__
!         AIX vaccine
!        #endif
!       ], [gl_aixcc=yes], [gl_aixcc=no])
!     if test $gl_aixcc = yes; then
!       dnl Provide a substitute <stdarg.h> file.
!       STDARG_H=stdarg.h
!       gl_CHECK_NEXT_HEADERS([stdarg.h])
!       dnl Fallback for the case when <stdarg.h> contains only macro 
definitions.
!       if test "$gl_cv_next_stdarg_h" = '""'; then
!         gl_cv_next_stdarg_h='"///usr/include/stdarg.h"'
!         NEXT_STDARG_H="$gl_cv_next_stdarg_h"
!       fi
!     else
!       dnl Provide a substitute in <config.h>, either __va_copy or as a simple
!       dnl assignment.
!       AC_CACHE_VAL([gl_cv_func___va_copy], [
!         AC_TRY_COMPILE([#include <stdarg.h>], [
  #ifndef __va_copy
  error, bail out
  #endif
  ],
!           [gl_cv_func___va_copy=yes], [gl_cv_func___va_copy=no])])
!       if test $gl_cv_func___va_copy = yes; then
!         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.])
!       fi
      fi
    fi
  ])
*** modules/stdarg.orig 2008-03-11 05:31:52.000000000 +0100
--- modules/stdarg      2008-03-11 04:38:05.000000000 +0100
***************
*** 2,10 ****
--- 2,12 ----
  An <stdarg.h> that conforms to C99.
  
  Files:
+ lib/stdarg.in.h
  m4/stdarg.m4
  
  Depends-on:
+ include_next
  
  configure.ac-early:
  dnl Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode
***************
*** 17,22 ****
--- 19,37 ----
  gl_STDARG_H
  
  Makefile.am:
+ BUILT_SOURCES += $(STDARG_H)
+ 
+ # We need the following in order to create <stdarg.h> 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' \
+             < $(srcdir)/stdarg.in.h; \
+       } > address@hidden
+       mv address@hidden $@
+ MOSTLYCLEANFILES += stdarg.h stdarg.h-t
  
  Include:
  #include <stdarg.h>
*** doc/posix-functions/va_copy.texi.orig       2008-03-11 05:31:52.000000000 
+0100
--- doc/posix-functions/va_copy.texi    2008-03-11 05:31:31.000000000 +0100
***************
*** 9,15 ****
  Portability problems fixed by Gnulib:
  @itemize
  @item
! This macro is missing on some platforms.
  @end itemize
  
  Portability problems not fixed by Gnulib:
--- 9,16 ----
  Portability problems fixed by Gnulib:
  @itemize
  @item
! This macro is missing on some platforms:
! AIX 5.1 with cc or xlc, HP-UX 11 with cc, IRIX 6.5 with cc, OSF/1 5.1 with cc.
  @end itemize
  
  Portability problems not fixed by Gnulib:






reply via email to

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