bug-gnulib
[Top][All Lists]
Advanced

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

snprintfv, more gnulibification


From: Daniel Jacobowitz
Subject: snprintfv, more gnulibification
Date: Sun, 25 Feb 2007 09:35:10 -0500
User-agent: Mutt/1.5.13 (2006-08-11)

This patch changes compat.in to compat.h.  It's no longer installable
standalone, although if someone is interested in making it standalone
again later it wouldn't be hard (via the same @@ substitution
technique that some other headers in gnulib use).  In the process, the
static inline check went away - current autoconf's inline check also
checks for working static inline.

I did notice one thing: Paolo's updates added a check for runetype.h
in order to make Mac OS/X's <wchar.h> work properly.  Perhaps gnulib's
substitute wchar.h ought to handle that?

-- 
Daniel Jacobowitz
CodeSourcery

2007-02-26  Daniel Jacobowitz  <address@hidden>

        * .cvsignore: Add build-aux.
        * configure.ac: Generate config-h.in instead of config.h.in.
        * snprintfv.m4 (INVOKE_SNPRINTFV_MACROS): Remove obsolete checks.  Use
        gnulib more.  Do not generate compat.h.  Improve unlocked I/O checkis.
        * lib/Makefile.am, lib/Makefile.in, m4/gnulib-cache.m4, 
m4/gnulib-comp.m4,
        m4/stdarg.m4: Add stdarg module.
        * snprintfv/Makefile.am (DISTCLEANFILES, pkginclude_HEADERS)
        (nodist_pkginclude_HEADERS, noinst_HEADERS, nodist_noinst_HEADERS)
        (EXTRA_DIST, BUILT_SOURCES, compat.h, compat.stamp): No longer generate
        compat.h.
        * snprintfv/compat.h: New file, based on ...
        * snprintfv/compat.in: ... this, deleted.

Index: .cvsignore
===================================================================
RCS file: /sources/libsnprintfv/libsnprintfv/.cvsignore,v
retrieving revision 1.1
diff -u -p -r1.1 .cvsignore
--- .cvsignore  8 Jul 2002 08:40:40 -0000       1.1
+++ .cvsignore  25 Feb 2007 05:32:13 -0000
@@ -20,3 +20,4 @@ version.texi
 *.info-*
 *.dvi
 *.ps
+build-aux
Index: configure.ac
===================================================================
RCS file: /sources/libsnprintfv/libsnprintfv/configure.ac,v
retrieving revision 1.6
diff -u -p -r1.6 configure.ac
--- configure.ac        24 Feb 2007 04:34:52 -0000      1.6
+++ configure.ac        25 Feb 2007 05:32:13 -0000
@@ -28,7 +28,7 @@ dnl Code:
 AC_PREREQ(2.60)
 AC_INIT(snprintfv, 1.1, address@hidden)
 AC_CONFIG_SRCDIR(snprintfv/printf.in)
-AC_CONFIG_HEADERS(config.h)
+AC_CONFIG_HEADERS([config.h:config-h.in])
 AC_CONFIG_AUX_DIR(build-aux)
 AC_CONFIG_MACRO_DIR(build-aux)
 
Index: snprintfv.m4
===================================================================
RCS file: /sources/libsnprintfv/libsnprintfv/snprintfv.m4,v
retrieving revision 1.2
diff -u -p -r1.2 snprintfv.m4
--- snprintfv.m4        21 Feb 2007 15:41:26 -0000      1.2
+++ snprintfv.m4        25 Feb 2007 05:32:13 -0000
@@ -74,6 +74,7 @@ AC_DEFUN([INVOKE_SNPRINTFV_MACROS],[
   AC_REQUIRE([AM_WITH_DMALLOC])
   AC_REQUIRE([AC_PROG_AWK])
 
+  dnl FIXME: gnulib's wchar_.h ought to do this.
   # ----------------------------------------------------------------------
   # check for various programs used during the build.
   # On OS/X, "wchar.h" needs "runetype.h" to work properly.
@@ -90,23 +91,9 @@ AC_DEFUN([INVOKE_SNPRINTFV_MACROS],[
   # ----------------------------------------------------------------------
   # Checks for typedefs
   # ----------------------------------------------------------------------
-  AC_CHECK_TYPE(wchar_t, [], [
-    AC_DEFINE_UNQUOTED([wchar_t], [unsigned int],
-        [Define to `unsigned int' if not found])])
-  AC_CHECK_TYPE(wint_t, [], [
-    AC_DEFINE_UNQUOTED([wint_t], [unsigned int],
-        [Define to `unsigned int' if not found])], [
-    AC_INCLUDES_DEFAULT
-    #if HAVE_RUNETYPE_H
-    # include <runetype.h>
-    #endif
-    #if HAVE_WCHAR_H
-   # include <wchar.h>
-    #endif
-    ])
-  AC_CHECK_TYPE(long long)
-  AC_CHECK_TYPE(intmax_t)
-  AC_TYPE_SIZE_T
+  AC_REQUIRE([gt_TYPE_WCHAR_T])
+  AC_REQUIRE([gt_TYPE_WINT_T])
+  AC_REQUIRE([AC_TYPE_SIZE_T])
   AC_TYPE_LONG_DOUBLE
 
   # ----------------------------------------------------------------------
@@ -117,190 +104,8 @@ AC_DEFUN([INVOKE_SNPRINTFV_MACROS],[
   AC_CHECK_LIB(m, log)
   AC_CHECK_FUNCS(copysign copysignl isinf isinfl isnan isnanl modfl)
 
-  # ----------------------------------------------------------------------
-  # Add code to config.status to create an installable host dependent
-  # configuration file.
-  # ----------------------------------------------------------------------
-
-  AC_CONFIG_COMMANDS([snprintfv/compat.h], [
-      outfile=snprintfv/compat.h
-      tmpfile=${outfile}T
-      dirname="sed s,^.*/,,g"
-      echo creating $outfile
-      cat > $tmpfile << _EOF_
-/*  -*- Mode: C -*-
- * --------------------------------------------------------------------
- * DO NOT EDIT THIS FILE!  It has been automatically generated
- * from:    configure.in and `echo $outfile|$dirname`.in
- * on host: `(hostname || uname -n) 2>/dev/null | sed 1q`
- * --------------------------------------------------------------------
- * `echo $outfile|$dirname` --- portability code generated for snprintfv by 
configure.in
- */
-
-#ifndef SNPRINTFV_COMPAT_H
-#define SNPRINTFV_COMPAT_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#if 0
-/* This brace is so that emacs can still indent properly: */ }
-#endif
-#endif /* __cplusplus */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdarg.h>
-_EOF_
-  
-      # Add the code to include these headers only if autoconf has
-      # shown them to be present.
-      if test x$ac_cv_header_sys_types_h = xyes; then
-        echo '#include <sys/types.h>' >> $tmpfile
-      fi
-      if test x$ac_cv_header_string_h = xyes; then
-        echo '#include <string.h>' >> $tmpfile
-      elif test x$ac_cv_header_strings_h = xyes; then
-        echo '#include <strings.h>' >> $tmpfile
-      fi
-  
-      if test x$ac_cv_header_inttypes_h = xyes; then
-        echo '#include <inttypes.h>' >> $tmpfile
-      elif test x$ac_cv_header_stdint_h = xyes; then
-        echo '#include <stdint.h>' >> $tmpfile
-      fi
-  
-      if test x$ac_cv_header_runetype_h = xyes; then
-        echo '#include <runetype.h>' >> $tmpfile
-      fi
-      if test x$ac_cv_header_wchar_h = xyes; then
-        echo '#include <wchar.h>' >> $tmpfile
-      fi
-  
-      if test x$snv_cv_static_inline = xyes; then
-        echo '#define SNV_INLINE static inline' >> $tmpfile
-      else
-        echo '#define SNV_INLINE static' >> $tmpfile
-      fi
-  
-      if test x$ac_cv_type_wchar_t = xno; then
-        echo 'typedef unsigned int snv_wchar_t;' >> $tmpfile
-      else
-        echo 'typedef wchar_t snv_wchar_t;' >> $tmpfile
-      fi
-      if test x$ac_cv_type_wint_t = xno; then
-        echo 'typedef unsigned int snv_wint_t;' >> $tmpfile
-      else
-        echo 'typedef wint_t snv_wint_t;' >> $tmpfile
-      fi
-  
-      if test x$ac_cv_c_long_double = xno; then
-        echo 'typedef double snv_long_double;' >> $tmpfile
-      else
-        echo 'typedef long double snv_long_double;' >> $tmpfile
-      fi
-      if test x$ac_cv_type_intmax_t = xno; then
-        if test x$ac_cv_type_long_long = xno; then
-          cat >> $tmpfile << '_EOF_'
-typedef long intmax_t;
-typedef unsigned long uintmax_t;
-_EOF_
-       else
-          cat >> $tmpfile << '_EOF_'
-typedef long long intmax_t;
-typedef unsigned long long uintmax_t;
-_EOF_
-        fi
-      fi
-  
-      if test x$ac_cv_type_size_t != xyes; then
-        cat >> $tmpfile << \_EOF_
-
-typedef unsigned long size_t;
-_EOF_
-      fi
-  
-      if test $ac_cv_func_fputc_unlocked = no || test $ac_cv_func_flockfile = 
no; then
-        cat >> $tmpfile << \_EOF_
-#define SNV_FPUTC_UNLOCKED fputc
-#define SNV_PUTC_UNLOCKED putc
-#define SNV_WITH_LOCKED_FP(fp, tmp_var) \
-  for (tmp_var = 1; tmp_var--; )
-_EOF_
-  
-      else
-        cat >> $tmpfile << \_EOF_
-#define SNV_FPUTC_UNLOCKED fputc_unlocked
-#define SNV_PUTC_UNLOCKED putc_unlocked
-#define SNV_WITH_LOCKED_FP(fp, tmp_var) \
-  for (flockfile (fp), tmp_var = 1; \
-       tmp_var--; funlockfile (fp))
-_EOF_
-      fi
-  
-      cat >> $tmpfile << \_EOF_
-
-/* Define macros for storing integers inside pointers.
- * Be aware that it is only safe to use these macros to store `int'
- * values in `char*' (or `void*') words, and then extract them later.
- * Although it will work the other way round on many common
- * architectures, it is not portable to assume a `char*' can be
- * stored in an `int' and extracted later without loss of the msb's
- */
-
-#define SNV_POINTER_TO_LONG(p) ((long)(p))
-#define SNV_POINTER_TO_ULONG(p)        ((unsigned long)(p))
-#define SNV_LONG_TO_POINTER(i) ((snv_pointer)(long)(i))
-#define SNV_ULONG_TO_POINTER(u)        ((snv_pointer)(unsigned long)(u))
-_EOF_
-  
-      # The ugly but portable cpp stuff comes from here
-      infile=$srcdir/snprintfv/`echo $outfile | sed 's,.*/,,g;s,\..*$,,g'`.in
-      sed '/^##.*$/d' $infile >> $tmpfile 
-  
-      cat >> $tmpfile << \_EOF_
-
-#ifdef __cplusplus
-#if 0
-/* This brace is so that emacs can still indent properly: */ {
-#endif
-}
-#endif /* __cplusplus */
-
-#endif /* COMPAT_H */
-_EOF_
-  
-      if cmp -s $tmpfile $outfile; then
-        echo $outfile is unchanged
-        rm -f $tmpfile
-      else
-        mv $tmpfile $outfile
-      fi
-  
-  ],[
-    ac_cv_header_inttypes_h=$ac_cv_header_inttypes_h
-    ac_cv_header_stdint_h=$ac_cv_header_stdint_h
-    ac_cv_header_stdlib_h=$ac_cv_header_stdlib_h
-    ac_cv_header_sys_types_h=$ac_cv_header_sys_types_h
-    ac_cv_header_wchar_h=$ac_cv_header_wchar_h
-    ac_cv_header_memory_h=$ac_cv_header_memory_h
-    ac_cv_header_stdarg_h=$ac_cv_header_stdarg_h
-    ac_cv_header_varargs_h=$ac_cv_header_varargs_h
-    ac_cv_header_string_h=$ac_cv_header_string_h
-    ac_cv_header_strings_h=$ac_cv_header_strings_h
-    ac_cv_header_limits_h=$ac_cv_header_limits_h
-    ac_cv_header_values_h=$ac_cv_header_values_h
-    ac_cv_header_errno_h=$ac_cv_header_errno_h
-    ac_cv_func_fputc_unlocked=$ac_cv_func_fputc_unlocked
-    ac_cv_func_flockfile=$ac_cv_func_flockfile
-    ac_cv_type_intmax_t=$ac_cv_type_intmax_t
-    ac_cv_c_long_double=$ac_cv_c_long_double
-    ac_cv_type_size_t=$ac_cv_type_size_t
-    ac_cv_type_wchar_t=$ac_cv_type_wchar_t
-    ac_cv_type_wint_t=$ac_cv_type_wint_t
-    snv_cv_static_inline=$snv_cv_static_inline
-    srcdir=$srcdir
-  ])
-  
+  dnl Persuade glibc and Solaris <stdio.h> to declare
+  dnl fgets_unlocked(), fputs_unlocked() etc.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS(flockfile fputc_unlocked)
 ])
Index: lib/Makefile.am
===================================================================
RCS file: /sources/libsnprintfv/libsnprintfv/lib/Makefile.am,v
retrieving revision 1.1
diff -u -p -r1.1 Makefile.am
--- lib/Makefile.am     24 Feb 2007 04:34:52 -0000      1.1
+++ lib/Makefile.am     25 Feb 2007 05:32:13 -0000
@@ -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 --aux-dir=build-aux --libtool --macro-prefix=gl 
stdint string wchar wcwidth
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib 
--m4-base=m4 --doc-base=doc --aux-dir=build-aux --libtool --macro-prefix=gl 
stdarg stdint string wchar wcwidth
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
Index: lib/Makefile.in
===================================================================
RCS file: /sources/libsnprintfv/libsnprintfv/lib/Makefile.in,v
retrieving revision 1.1
diff -u -p -r1.1 Makefile.in
--- lib/Makefile.in     24 Feb 2007 04:34:52 -0000      1.1
+++ lib/Makefile.in     25 Feb 2007 05:32:13 -0000
@@ -23,7 +23,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 --aux-dir=build-aux --libtool --macro-prefix=gl 
stdint string wchar wcwidth
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib 
--m4-base=m4 --doc-base=doc --aux-dir=build-aux --libtool --macro-prefix=gl 
stdarg stdint string wchar wcwidth
 
 
 
@@ -55,12 +55,12 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \
        $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/gnulib-comp.m4 \
-       $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/stdint.m4 \
-       $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/ulonglong.m4 \
-       $(top_srcdir)/m4/wchar.m4 $(top_srcdir)/m4/wchar_t.m4 \
-       $(top_srcdir)/m4/wctype.m4 $(top_srcdir)/m4/wcwidth.m4 \
-       $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/snprintfv.m4 \
-       $(top_srcdir)/configure.ac
+       $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/stdarg.m4 \
+       $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/string_h.m4 \
+       $(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/m4/wchar.m4 \
+       $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \
+       $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \
+       $(top_srcdir)/snprintfv.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
Index: m4/gnulib-cache.m4
===================================================================
RCS file: /sources/libsnprintfv/libsnprintfv/m4/gnulib-cache.m4,v
retrieving revision 1.1
diff -u -p -r1.1 gnulib-cache.m4
--- m4/gnulib-cache.m4  24 Feb 2007 04:34:52 -0000      1.1
+++ m4/gnulib-cache.m4  25 Feb 2007 05:32:13 -0000
@@ -15,11 +15,11 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 
--doc-base=doc --aux-dir=build-aux --libtool --macro-prefix=gl stdint string 
wchar wcwidth
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 
--doc-base=doc --aux-dir=build-aux --libtool --macro-prefix=gl stdarg stdint 
string wchar wcwidth
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
-gl_MODULES([stdint string wchar wcwidth])
+gl_MODULES([stdarg stdint string wchar wcwidth])
 gl_AVOID([])
 gl_SOURCE_BASE([lib])
 gl_M4_BASE([m4])
Index: m4/gnulib-comp.m4
===================================================================
RCS file: /sources/libsnprintfv/libsnprintfv/m4/gnulib-comp.m4,v
retrieving revision 1.1
diff -u -p -r1.1 gnulib-comp.m4
--- m4/gnulib-comp.m4   24 Feb 2007 04:34:52 -0000      1.1
+++ m4/gnulib-comp.m4   25 Feb 2007 05:32:13 -0000
@@ -27,6 +27,11 @@ AC_DEFUN([gl_EARLY],
   AC_REQUIRE([AC_PROG_RANLIB])
   AC_REQUIRE([AC_GNU_SOURCE])
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  dnl Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode
+  dnl for the builtin va_copy to work.  With Autoconf 2.60 or later,
+  dnl AC_PROG_CC_STDC arranges for this.  With older Autoconf AC_PROG_CC_STDC
+  dnl shouldn't hurt, though installers are on their own to set c99 mode.
+  AC_REQUIRE([AC_PROG_CC_STDC])
 ])
 
 # This macro should be invoked from ./configure.ac, in the section
@@ -39,6 +44,7 @@ AC_DEFUN([gl_INIT],
   AM_CONDITIONAL([GL_COND_LIBTOOL], [true])
   gl_cond_libtool=true
   gl_source_base='lib'
+  gl_STDARG_H
   gl_STDINT_H
   gl_HEADER_STRING_H
   gl_WCHAR_H
@@ -92,6 +98,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/extensions.m4
   m4/gnulib-common.m4
   m4/longlong.m4
+  m4/stdarg.m4
   m4/stdint.m4
   m4/string_h.m4
   m4/ulonglong.m4
Index: m4/stdarg.m4
===================================================================
RCS file: m4/stdarg.m4
diff -N m4/stdarg.m4
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ m4/stdarg.m4        25 Feb 2007 05:32:13 -0000
@@ -0,0 +1,40 @@
+# 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.
+
+dnl From Bruno Haible.
+dnl Provide a working va_copy in combination with <stdarg.h>.
+
+AC_DEFUN([gl_STDARG_H],
+[
+  AC_MSG_CHECKING([for va_copy])
+  AC_CACHE_VAL([gl_cv_func_va_copy], [
+    AC_TRY_COMPILE([#include <stdarg.h>], [
+#ifndef va_copy
+void (*func) (va_list, va_list) = va_copy;
+#endif
+],
+      [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
+])
Index: snprintfv/Makefile.am
===================================================================
RCS file: /sources/libsnprintfv/libsnprintfv/snprintfv/Makefile.am,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile.am
--- snprintfv/Makefile.am       24 Feb 2007 04:34:52 -0000      1.7
+++ snprintfv/Makefile.am       25 Feb 2007 05:32:13 -0000
@@ -28,7 +28,6 @@
 
 AUTOMAKE_OPTIONS       = gnits
 
-DISTCLEANFILES          = compat.h compat.stamp
 MAINTAINERCLEANFILES   = Makefile.in
 
 AWK                    = gawk
@@ -42,12 +41,11 @@ LDADD                       = $(top_builddir)/lib/libgnu.la
 
 if INSTALL_SNPRINTFV
 include_HEADERS           = printf.h
-pkginclude_HEADERS        = mem.h filament.h stream.h dl.h
-nodist_pkginclude_HEADERS = compat.h
+pkginclude_HEADERS        = mem.h filament.h stream.h dl.h compat.h
 noinst_HEADERS            = ltdl.h
 else
-noinst_HEADERS            = mem.h filament.h stream.h printf.h dl.h ltdl.h
-nodist_noinst_HEADERS     = compat.h
+noinst_HEADERS            = mem.h filament.h stream.h printf.h dl.h ltdl.h \
+                           compat.h
 endif
 
 dist_noinst_DATA          = filament.stamp stream.stamp printf.stamp dl.stamp
@@ -86,14 +84,12 @@ libsnprintfvc_la_SOURCES=                                   
        \
 # header files after extracting the prototypes from the sources
 #
 EXTRA_DIST             =                                               \
-                       compat.in                                       \
                        filament.in                                     \
                        printf.in                                       \
                        dl.in                                           \
                        stream.in
 
 BUILT_SOURCES          =                                               \
-                       compat.h                                        \
                        filament.h                                      \
                        printf.h                                        \
                        dl.h                                            \
@@ -133,15 +129,5 @@ filament.stamp: filament.in filament.c
 stream.stamp: stream.in stream.c
 dl.stamp: dl.in dl-yes.c
 
-#
-# compat.h is generated differently, so we can't use the pattern rule
-# above:
-#
-compat.h: compat.stamp
-compat.stamp: $(srcdir)/compat.in $(top_builddir)/config.status
-       cd $(top_builddir) \
-         && $(SHELL) ./config.status snprintfv/compat.h
-       echo timestamp > $@
-
 # Makefile.am ends here
 
Index: snprintfv/compat.h
===================================================================
RCS file: snprintfv/compat.h
diff -N snprintfv/compat.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ snprintfv/compat.h  25 Feb 2007 05:32:13 -0000
@@ -0,0 +1,222 @@
+/* compat.h.in --- verbose but portable cpp defines for snprintfv
+ * Copyright (C) 1999 Gary V. Vaughan
+ * Originally by Gary V. Vaughan, 1999
+ * This file is part of Snprintfv
+ * Copyright (C) 1998, 1999, 2000, 2002 Gary V. Vaughan
+ * Originally by Gary V. Vaughan, 1998
+ * This file is part of Snprintfv
+ *
+ * Snprintfv 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 of the
+ * License, or (at your option) any later version.
+ *
+ * Snprintfv 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.
+ *
+ * As a special exception to the GNU General Public License, if you
+ * distribute this file as part of a program that also links with and
+ * uses the libopts library from AutoGen, you may include it under
+ * the same distribution terms used by the libopts library.
+ */
+
+#ifndef SNPRINTFV_COMPAT_H
+#define SNPRINTFV_COMPAT_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+/* This brace is so that emacs can still indent properly: */ }
+#endif
+#endif /* __cplusplus */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <sys/types.h>
+#include <string.h>
+#include <stdint.h>
+
+#define SNV_INLINE static inline
+
+#ifdef HAVE_WCHAR_T
+#ifdef HAVE_RUNETYPE_H
+#include <runetype.h>
+#endif
+#include <wchar.h>
+typedef wchar_t snv_wchar_t;
+#else
+typedef unsigned int snv_wchar_t;
+#endif
+
+#ifdef HAVE_WINT_T
+typedef wint_t snv_wint_t;
+#else
+typedef unsigned int snv_wint_t;
+#endif
+
+#ifdef HAVE_LONG_DOUBLE
+typedef long double snv_long_double;
+#else
+typedef double snv_long_double;
+#endif
+
+#if defined(HAVE_FPUTC_UNLOCKED) && defined(HAVE_FLOCKFILE)
+#define SNV_FPUTC_UNLOCKED fputc_unlocked
+#define SNV_PUTC_UNLOCKED putc_unlocked
+#define SNV_WITH_LOCKED_FP(fp, tmp_var) \
+  for (flockfile (fp), tmp_var = 1; \
+       tmp_var--; funlockfile (fp))
+#else
+#define SNV_FPUTC_UNLOCKED fputc
+#define SNV_PUTC_UNLOCKED putc
+#define SNV_WITH_LOCKED_FP(fp, tmp_var) \
+  for (tmp_var = 1; tmp_var--; )
+#endif
+
+/* Define macros for storing integers inside pointers.
+ * Be aware that it is only safe to use these macros to store `int'
+ * values in `char*' (or `void*') words, and then extract them later.
+ * Although it will work the other way round on many common
+ * architectures, it is not portable to assume a `char*' can be
+ * stored in an `int' and extracted later without loss of the msb's
+ */
+
+#define SNV_POINTER_TO_LONG(p) ((long)(p))
+#define SNV_POINTER_TO_ULONG(p)        ((unsigned long)(p))
+#define SNV_LONG_TO_POINTER(i) ((snv_pointer)(long)(i))
+#define SNV_ULONG_TO_POINTER(u)        ((snv_pointer)(unsigned long)(u))
+
+/* inline and const keywords are (mostly) handled by config.h */
+#ifdef __GNUC__
+#  ifndef const
+#    define const      __const
+#  endif
+#  ifndef signed
+#    define signed     __signed
+#  endif
+#else
+#  ifndef __STDC__
+#    undef  signed
+#    define signed
+#  endif
+#endif
+
+#ifdef __STDC__
+#  ifndef SNV_STR
+#    define SNV_STR(x)         #x
+#  endif
+typedef void *snv_pointer;
+typedef const void *snv_constpointer;
+#else
+#  ifndef SNV_STR
+#    define SNV_STR(x)         "x"
+#  endif
+typedef char *snv_pointer;
+typedef char *snv_constpointer;
+#endif
+
+/* Do not use `enum boolean': this tag is used in SVR4 <sys/types.h>.  */
+typedef enum { SNV_FALSE = 0, SNV_TRUE = 1 } snv_bool_t;
+
+#if defined __CYGWIN32__
+#  ifndef __CYGWIN__
+#     define __CYGWIN__
+#  endif
+#endif
+#if defined __CYGWIN__ || defined __MSVCRT__ || defined WIN32 || defined 
__WIN32__
+#  ifndef _WIN32
+#    define _WIN32
+#  endif
+#endif
+
+#ifndef EXIT_SUCCESS
+#  define EXIT_SUCCESS  0
+#  define EXIT_FAILURE  1
+#endif
+
+#undef SNV_STMT_START
+#undef SNV_STMT_END
+#if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus)
+#  define SNV_STMT_START       (void)(
+#  define SNV_STMT_END         )
+#else
+#  if (defined (sun) || defined (__sun__))
+#    define SNV_STMT_START     if (1)
+#    define SNV_STMT_END       else (void)0
+#  else
+#    define SNV_STMT_START     do
+#    define SNV_STMT_END       while (0)
+#  endif
+#endif
+
+#undef SNV_GNUC_PRINTF
+#undef SNV_GNUC_NORETURN
+#if    __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+#  define SNV_GNUC_PRINTF( args, format_idx, arg_idx )         \
+       args __attribute__((format (printf, format_idx, arg_idx)))
+#  define SNV_GNUC_NORETURN                                            \
+       __attribute__((noreturn))
+#  define SNV_ASSERT_FMT        " (", __PRETTY_FUNCTION__, ")"
+#else /* !__GNUC__ */
+#  define SNV_GNUC_PRINTF( args, format_idx, arg_idx ) args
+#  define SNV_GNUC_NORETURN
+#  define SNV_ASSERT_FMT               "", "", ""
+#endif /* !__GNUC__ */
+
+#define snv_assert(expr)                       snv_fassert(stderr, expr)
+#define snv_fassert(stream, expr)      SNV_STMT_START{                 \
+    if (!(expr))                               \
+    {                                                     \
+       fprintf (stream, "file %s: line %d%s%s%s: assertion \"%s\" failed.\n", \
+       __FILE__, __LINE__, SNV_ASSERT_FMT, SNV_STR(expr));             \
+       exit(EXIT_FAILURE);                                             \
+    };                                 }SNV_STMT_END
+
+#define return_if_fail(expr)           freturn_if_fail(stderr, expr)
+#define freturn_if_fail(expr)          SNV_STMT_START{                 \
+    if (!(expr))                                                       \
+    {                                                                  \
+       fprintf (stream, "file %s: line %d%s%s%s: assertion \"%s\" failed.\n", \
+       __FILE__, __LINE__, SNV_ASSERT_FMT, SNV_STR(expr));             \
+       return;                                                         \
+    };                                 }SNV_STMT_END
+
+#define return_val_if_fail(expr, val)  freturn_val_if_fail(stderr, expr, val)
+#define freturn_val_if_fail(stream, expr, val) SNV_STMT_START{         \
+    if (!(expr))                                                       \
+    {                                                                  \
+       fprintf (stream, "file %s: line %d%s%s%s: assertion \"%s\" failed.\n", \
+       __FILE__, __LINE__, SNV_ASSERT_FMT, SNV_STR(expr));             \
+       return val;                                                     \
+    };                                 }SNV_STMT_END
+
+#ifndef MAX
+#define MAX(a,b)       ((a) > (b) ? (a) : (b))
+#endif
+
+#ifndef MIN
+#define MIN(a,b)       ((a) < (b) ? (a) : (b))
+#endif
+
+#ifndef ABS
+#define ABS(a)         ((a) < 0 ? -(a) : (a))
+#endif
+
+
+#ifdef __cplusplus
+#if 0
+/* This brace is so that emacs can still indent properly: */ {
+#endif
+}
+#endif /* __cplusplus */
+
+#endif /* COMPAT_H */
Index: snprintfv/compat.in
===================================================================
RCS file: snprintfv/compat.in
diff -N snprintfv/compat.in
--- snprintfv/compat.in 24 Feb 2007 04:34:52 -0000      1.6
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,145 +0,0 @@
-##  -*- Mode: C -*-
-## --------------------------------------------------------------------
-## compat.h.in --- verbose but portable cpp defines for snprintfv
-## Copyright (C) 1999 Gary V. Vaughan
-## Originally by Gary V. Vaughan, 1999
-## This file is part of Snprintfv
-##
-## Snprintfv 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 of the
-## License, or (at your option) any later version.
-##
-## Snprintfv 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.
-##
-## As a special exception to the GNU General Public License, if you
-## distribute this file as part of a program that also links with and
-## uses the libopts library from AutoGen, you may include it under
-## the same distribution terms used by the libopts library.
-
-## Code:
-
-/* inline and const keywords are (mostly) handled by config.h */
-#ifdef __GNUC__
-#  ifndef const
-#    define const      __const
-#  endif
-#  ifndef signed
-#    define signed     __signed
-#  endif
-#else
-#  ifndef __STDC__
-#    undef  signed
-#    define signed
-#  endif
-#endif
-
-#ifdef __STDC__
-#  ifndef SNV_STR
-#    define SNV_STR(x)         #x
-#  endif
-typedef void *snv_pointer;
-typedef const void *snv_constpointer;
-#else
-#  ifndef SNV_STR
-#    define SNV_STR(x)         "x"
-#  endif
-typedef char *snv_pointer;
-typedef char *snv_constpointer;
-#endif
-
-/* Do not use `enum boolean': this tag is used in SVR4 <sys/types.h>.  */
-typedef enum { SNV_FALSE = 0, SNV_TRUE = 1 } snv_bool_t;
-
-#if defined __CYGWIN32__
-#  ifndef __CYGWIN__
-#     define __CYGWIN__
-#  endif
-#endif
-#if defined __CYGWIN__ || defined __MSVCRT__ || defined WIN32 || defined 
__WIN32__
-#  ifndef _WIN32
-#    define _WIN32
-#  endif
-#endif
-
-#ifndef EXIT_SUCCESS
-#  define EXIT_SUCCESS  0
-#  define EXIT_FAILURE  1
-#endif
-
-#undef SNV_STMT_START
-#undef SNV_STMT_END
-#if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus)
-#  define SNV_STMT_START       (void)(
-#  define SNV_STMT_END         )
-#else
-#  if (defined (sun) || defined (__sun__))
-#    define SNV_STMT_START     if (1)
-#    define SNV_STMT_END       else (void)0
-#  else
-#    define SNV_STMT_START     do
-#    define SNV_STMT_END       while (0)
-#  endif
-#endif
-
-#undef SNV_GNUC_PRINTF
-#undef SNV_GNUC_NORETURN
-#if    __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
-#  define SNV_GNUC_PRINTF( args, format_idx, arg_idx )         \
-       args __attribute__((format (printf, format_idx, arg_idx)))
-#  define SNV_GNUC_NORETURN                                            \
-       __attribute__((noreturn))
-#  define SNV_ASSERT_FMT        " (", __PRETTY_FUNCTION__, ")"
-#else /* !__GNUC__ */
-#  define SNV_GNUC_PRINTF( args, format_idx, arg_idx ) args
-#  define SNV_GNUC_NORETURN
-#  define SNV_ASSERT_FMT               "", "", ""
-#endif /* !__GNUC__ */
-
-#define snv_assert(expr)                       snv_fassert(stderr, expr)
-#define snv_fassert(stream, expr)      SNV_STMT_START{                 \
-    if (!(expr))                               \
-    {                                                     \
-       fprintf (stream, "file %s: line %d%s%s%s: assertion \"%s\" failed.\n", \
-       __FILE__, __LINE__, SNV_ASSERT_FMT, SNV_STR(expr));             \
-       exit(EXIT_FAILURE);                                             \
-    };                                 }SNV_STMT_END
-
-#define return_if_fail(expr)           freturn_if_fail(stderr, expr)
-#define freturn_if_fail(expr)          SNV_STMT_START{                 \
-    if (!(expr))                                                       \
-    {                                                                  \
-       fprintf (stream, "file %s: line %d%s%s%s: assertion \"%s\" failed.\n", \
-       __FILE__, __LINE__, SNV_ASSERT_FMT, SNV_STR(expr));             \
-       return;                                                         \
-    };                                 }SNV_STMT_END
-
-#define return_val_if_fail(expr, val)  freturn_val_if_fail(stderr, expr, val)
-#define freturn_val_if_fail(stream, expr, val) SNV_STMT_START{         \
-    if (!(expr))                                                       \
-    {                                                                  \
-       fprintf (stream, "file %s: line %d%s%s%s: assertion \"%s\" failed.\n", \
-       __FILE__, __LINE__, SNV_ASSERT_FMT, SNV_STR(expr));             \
-       return val;                                                     \
-    };                                 }SNV_STMT_END
-
-#ifndef MAX
-#define MAX(a,b)       ((a) > (b) ? (a) : (b))
-#endif
-
-#ifndef MIN
-#define MIN(a,b)       ((a) < (b) ? (a) : (b))
-#endif
-
-#ifndef ABS
-#define ABS(a)         ((a) < 0 ? -(a) : (a))
-#endif
-
-##  compat.h.in ends here




reply via email to

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