[uim-commit] r2967 - in branches/r5rs/sigscheme: . m4 src

yamaken at freedesktop.org yamaken at freedesktop.org
Sun Jan 22 05:28:15 PST 2006


Author: yamaken
Date: 2006-01-22 05:28:11 -0800 (Sun, 22 Jan 2006)
New Revision: 2967

Added:
   branches/r5rs/sigscheme/m4/ax_lib_glibc.m4
   branches/r5rs/sigscheme/src/config-asprintf.h
Modified:
   branches/r5rs/sigscheme/configure.in
   branches/r5rs/sigscheme/m4/Makefile.am
   branches/r5rs/sigscheme/src/Makefile.am
   branches/r5rs/sigscheme/src/error.c
   branches/r5rs/sigscheme/src/strport.c
Log:
* sigscheme/m4/ax_lib_glibc.m4
  - New file
* sigscheme/m4/Makefile.am
  - (EXTRA_DIST): Add ax_lib_glibc.m4
* sigscheme/configure.in
  - Add AX_LIB_GLIBC
* sigscheme/src/config-asprintf.h
  - New file
  - Define _GNU_SOURCE if glibc
* sigscheme/src/error.c
* sigscheme/src/strport.c
  - Include config-asprintf.h
* sigscheme/src/Makefile.am
  - (libsscm_la_SOURCES): Add config-asprintf.h


Modified: branches/r5rs/sigscheme/configure.in
===================================================================
--- branches/r5rs/sigscheme/configure.in	2006-01-22 13:15:23 UTC (rev 2966)
+++ branches/r5rs/sigscheme/configure.in	2006-01-22 13:28:11 UTC (rev 2967)
@@ -16,6 +16,8 @@
 
 # Checks for libraries.
 
+AX_LIB_GLIBC
+
 # Checks for header files.
 AC_HEADER_STDC
 AC_CHECK_HEADERS([limits.h malloc.h stddef.h stdlib.h string.h unistd.h])

Modified: branches/r5rs/sigscheme/m4/Makefile.am
===================================================================
--- branches/r5rs/sigscheme/m4/Makefile.am	2006-01-22 13:15:23 UTC (rev 2966)
+++ branches/r5rs/sigscheme/m4/Makefile.am	2006-01-22 13:28:11 UTC (rev 2967)
@@ -1,3 +1,4 @@
 EXTRA_DIST = ax_check_page_aligned_malloc.m4    \
              ax_c___attribute__.m4              \
-             ax_create_stdint_h.m4
+             ax_create_stdint_h.m4              \
+             ax_lib_glibc.m4

Added: branches/r5rs/sigscheme/m4/ax_lib_glibc.m4
===================================================================
--- branches/r5rs/sigscheme/m4/ax_lib_glibc.m4	2006-01-22 13:15:23 UTC (rev 2966)
+++ branches/r5rs/sigscheme/m4/ax_lib_glibc.m4	2006-01-22 13:28:11 UTC (rev 2967)
@@ -0,0 +1,40 @@
+dnl @synopsis AX_LIB_GLIBC
+dnl
+dnl Defines HAVE_GLIBC if libc is the GNU libc.
+dnl
+dnl This macro only performs the glibc detection, and not responsible for
+dnl defining any extension specifiers such as _GNU_SOURCE. Do it by
+dnl separate code as needed.
+dnl 
+dnl Although __GLIBC__ is provided by glibc, it is available only after
+dnl including feature.h. But some extensions of glibc requires that
+dnl corresponding macro is defined by user before feature.h is included,
+dnl to be enabled. For example, _GNU_SOURCE is required to enable
+dnl asprintf(3). So this macro provide HAVE_GLIBC to define such extension
+dnl specifier macros only if the libc is glibc, to avoid that unneeded
+dnl macros that may cause an incompatible effect are defined in non-glibc
+dnl environment.
+dnl
+dnl @category C
+dnl @author YamaKen <yamaken AT bp.iij4u.or.jp>
+dnl @version 2006-01-22
+dnl @license AllPermissive
+
+AC_DEFUN([AX_LIB_GLIBC],
+  [AC_CACHE_CHECK([if libc is the GNU libc],
+    ax_cv_lib_glibc,
+    [AC_EGREP_CPP('^ax_cv_lib_glibc_yes$', [
+/* To avoid being affected from possible header reorganization, this macro
+ * does not include features.h directly. */
+#include <stdlib.h>
+#if (defined(__GLIBC__) || defined(__GNU_LIBRARY__))
+ax_cv_lib_glibc_yes
+#endif
+      ],
+      ax_cv_lib_glibc=yes,
+      ax_cv_lib_glibc=no)
+    ])
+  if test "x$ax_cv_lib_glibc" = yes; then
+    AC_DEFINE(HAVE_GLIBC, 1, [Define to 1 if you have the GNU libc.])
+  fi
+])

Modified: branches/r5rs/sigscheme/src/Makefile.am
===================================================================
--- branches/r5rs/sigscheme/src/Makefile.am	2006-01-22 13:15:23 UTC (rev 2966)
+++ branches/r5rs/sigscheme/src/Makefile.am	2006-01-22 13:28:11 UTC (rev 2967)
@@ -57,6 +57,7 @@
 EXTRA_DIST = $(FUNC_TABLES) $(BUILD_FUNCTBL_SOURCES) \
         storage-fatty.h storage-compact.h
 libsscm_la_SOURCES = \
+		config-asprintf.h \
 		alloc.c storage.c write.c \
                 storage-gc.c \
                 storage-symbol.c \

Added: branches/r5rs/sigscheme/src/config-asprintf.h
===================================================================
--- branches/r5rs/sigscheme/src/config-asprintf.h	2006-01-22 13:15:23 UTC (rev 2966)
+++ branches/r5rs/sigscheme/src/config-asprintf.h	2006-01-22 13:28:11 UTC (rev 2967)
@@ -0,0 +1,45 @@
+/*===========================================================================
+ *  FileName : config-asprintf.h
+ *  About    : Internal configuration to enable asprintf(3)
+ *
+ *  Copyright (C) 2006 YamaKen <yamaken AT bp.iij4u.or.jp>
+ *
+ *  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *  3. Neither the name of authors nor the names of its contributors
+ *     may be used to endorse or promote products derived from this software
+ *     without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
+ *  IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ *  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ *  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ *  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ *  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ *  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+===========================================================================*/
+#ifndef __CONFIG_ASPRINTF_H
+#define __CONFIG_ASPRINTF_H
+
+#include "config.h"
+
+#if HAVE_GLIBC
+#if (HAVE_ASPRINTF || HAVE_VASPRINTF)
+#define _GNU_SOURCE
+#endif
+#endif /* HAVE_GLIBC */
+
+#endif /* __CONFIG_ASPRINTF_H */

Modified: branches/r5rs/sigscheme/src/error.c
===================================================================
--- branches/r5rs/sigscheme/src/error.c	2006-01-22 13:15:23 UTC (rev 2966)
+++ branches/r5rs/sigscheme/src/error.c	2006-01-22 13:28:11 UTC (rev 2967)
@@ -32,6 +32,9 @@
  *  SUCH DAMAGE.
 ===========================================================================*/
 
+#include "config.h"
+#include "config-asprintf.h"
+
 /*=======================================
   System Include
 =======================================*/

Modified: branches/r5rs/sigscheme/src/strport.c
===================================================================
--- branches/r5rs/sigscheme/src/strport.c	2006-01-22 13:15:23 UTC (rev 2966)
+++ branches/r5rs/sigscheme/src/strport.c	2006-01-22 13:28:11 UTC (rev 2967)
@@ -38,6 +38,9 @@
  *   into another
  */
 
+#include "config.h"
+#include "config-asprintf.h"
+
 /*=======================================
   System Include
 =======================================*/



More information about the uim-commit mailing list