diff options
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rwxr-xr-x | autogen.sh | 2 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | gnulib-local/Makefile.am | 25 | ||||
-rw-r--r-- | gnulib-local/lib/unicase.h.diff | 19 | ||||
-rw-r--r-- | gnulib-local/lib/unictype.h.diff | 19 | ||||
-rw-r--r-- | gnulib-local/lib/unistr.h.diff | 19 | ||||
-rw-r--r-- | gnulib-local/lib/unitypes.h.diff | 19 | ||||
-rw-r--r-- | lib/Makefile.am | 45 | ||||
-rw-r--r-- | lib/stdint.mini.h | 128 |
11 files changed, 295 insertions, 2 deletions
@@ -1,3 +1,21 @@ +2008-04-10 Bruno Haible <bruno@clisp.org> + + Provide installable <stdbool.h>, <stdint.h> replacements. + * autogen.sh: Pass --local-dir option to gnulib-tool. + * configure.ac (AC_CONFIG_FILES): Add gnulib-local/Makefile. + * Makefile.am (SUBDIRS): Add gnulib-local. + * gnulib-local/Makefile.am: New file. + * gnulib-local/lib/unitypes.h.diff: New file. + * gnulib-local/lib/unistr.h.diff: New file. + * gnulib-local/lib/unictype.h.diff: New file. + * gnulib-local/lib/unicase.h.diff: New file. + * lib/stdint.mini.h: New file, a reduced version of gnulib's + lib/stdint.in.h. + * lib/Makefile.am (nodist_include_HEADERS): New variable. + (unistring-stdbool.h, unistring-stdint.h): New rules. + (BUILT_SOURCES, MOSTLYCLEANFILES, CLEANFILES): Update accordingly. + (EXTRA_DIST): Add stdint.mini.h. + 2008-04-09 Bruno Haible <bruno@clisp.org> Build and install documentation. diff --git a/Makefile.am b/Makefile.am index f4b9de4..1add17c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,7 +20,7 @@ AUTOMAKE_OPTIONS = 1.5 gnu no-dependencies ACLOCAL = build-aux/fixaclocal @ACLOCAL@ ACLOCAL_AMFLAGS = -I m4 -I gnulib-m4 -SUBDIRS = doc lib tests +SUBDIRS = doc gnulib-local lib tests EXTRA_DIST = \ version.sh BUGS DEPENDENCIES HACKING autogen.sh \ @@ -400,7 +400,7 @@ if test $skip_gnulib = false; then unicase/ulc-casexfrm ' $GNULIB_TOOL --lib=libunistring --source-base=lib --m4-base=gnulib-m4 --tests-base=tests \ - --with-tests --lgpl --makefile-name=Makefile.gnulib --libtool \ + --with-tests --lgpl --makefile-name=Makefile.gnulib --libtool --local-dir=gnulib-local \ --import $GNULIB_MODULES $GNULIB_TOOL --copy-file build-aux/config.guess; chmod a+x build-aux/config.guess $GNULIB_TOOL --copy-file build-aux/config.sub; chmod a+x build-aux/config.sub diff --git a/configure.ac b/configure.ac index eb0e868..859739f 100644 --- a/configure.ac +++ b/configure.ac @@ -63,6 +63,7 @@ AC_PATH_PROG([PERL], [perl], [$ac_aux_dir_abs/missing perl]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([doc/Makefile], [FIX_MAKEFILE_DISTRIB]) +AC_CONFIG_FILES([gnulib-local/Makefile]) AC_CONFIG_FILES([lib/Makefile]) AC_CONFIG_FILES([tests/Makefile]) AC_OUTPUT diff --git a/gnulib-local/Makefile.am b/gnulib-local/Makefile.am new file mode 100644 index 0000000..b6a02c1 --- /dev/null +++ b/gnulib-local/Makefile.am @@ -0,0 +1,25 @@ +## Makefile for the gnulib-local directory of GNU libunistring +## Copyright (C) 2006-2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. + +## Process this file with automake to produce Makefile.in. + +# Generate this list with +# find . '(' -name Makefile.am ')' -prune -o -type f '!' '(' -name '*.orig' -or -name '*~' ')' -printf '%P\n' | sort | tr '\012' @ | sed 's/@$/%/;s/@/ \\@/g' | tr @% '\012\012' +EXTRA_DIST = \ +lib/unicase.h.diff \ +lib/unictype.h.diff \ +lib/unistr.h.diff \ +lib/unitypes.h.diff diff --git a/gnulib-local/lib/unicase.h.diff b/gnulib-local/lib/unicase.h.diff new file mode 100644 index 0000000..1cf9eb3 --- /dev/null +++ b/gnulib-local/lib/unicase.h.diff @@ -0,0 +1,19 @@ +*** unicase.h.orig 2009-04-05 19:30:26.000000000 +0200 +--- unicase.h 2009-04-10 16:21:23.000000000 +0200 +*************** +*** 20,26 **** + #include "unitypes.h" + + /* Get bool. */ +! #include <stdbool.h> + + /* Get size_t. */ + #include <stddef.h> +--- 20,26 ---- + #include "unitypes.h" + + /* Get bool. */ +! #include <unistring-stdbool.h> + + /* Get size_t. */ + #include <stddef.h> diff --git a/gnulib-local/lib/unictype.h.diff b/gnulib-local/lib/unictype.h.diff new file mode 100644 index 0000000..65d5d53 --- /dev/null +++ b/gnulib-local/lib/unictype.h.diff @@ -0,0 +1,19 @@ +*** unictype.h.orig 2009-04-05 19:30:27.000000000 +0200 +--- unictype.h 2009-04-10 16:21:33.000000000 +0200 +*************** +*** 20,26 **** + #include "unitypes.h" + + /* Get bool. */ +! #include <stdbool.h> + + /* Get size_t. */ + #include <stddef.h> +--- 20,26 ---- + #include "unitypes.h" + + /* Get bool. */ +! #include <unistring-stdbool.h> + + /* Get size_t. */ + #include <stddef.h> diff --git a/gnulib-local/lib/unistr.h.diff b/gnulib-local/lib/unistr.h.diff new file mode 100644 index 0000000..24c2e94 --- /dev/null +++ b/gnulib-local/lib/unistr.h.diff @@ -0,0 +1,19 @@ +*** unistr.h.orig 2009-04-05 19:30:34.000000000 +0200 +--- unistr.h 2009-04-10 16:21:37.000000000 +0200 +*************** +*** 20,26 **** + #include "unitypes.h" + + /* Get bool. */ +! #include <stdbool.h> + + /* Get size_t. */ + #include <stddef.h> +--- 20,26 ---- + #include "unitypes.h" + + /* Get bool. */ +! #include <unistring-stdbool.h> + + /* Get size_t. */ + #include <stddef.h> diff --git a/gnulib-local/lib/unitypes.h.diff b/gnulib-local/lib/unitypes.h.diff new file mode 100644 index 0000000..f0544dd --- /dev/null +++ b/gnulib-local/lib/unitypes.h.diff @@ -0,0 +1,19 @@ +*** unitypes.h.orig 2009-04-05 19:30:36.000000000 +0200 +--- unitypes.h 2009-04-10 16:22:07.000000000 +0200 +*************** +*** 18,24 **** + #define _UNITYPES_H + + /* Get uint8_t, uint16_t, uint32_t. */ +! #include <stdint.h> + + /* Type representing a Unicode character. */ + typedef uint32_t ucs4_t; +--- 18,24 ---- + #define _UNITYPES_H + + /* Get uint8_t, uint16_t, uint32_t. */ +! #include <unistring-stdint.h> + + /* Type representing a Unicode character. */ + typedef uint32_t ucs4_t; diff --git a/lib/Makefile.am b/lib/Makefile.am index 86ab54e..36c19ca 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -45,6 +45,51 @@ include_HEADERS = \ # Rules generated and collected by gnulib-tool. include Makefile.gnulib +# The <stdbool.h> and <stdint.h> replacements that can be installed. +nodist_include_HEADERS = \ + unistring-stdbool.h \ + unistring-stdint.h + +unistring-stdbool.h : $(STDBOOL_H) + rm -f $@-t $@ + if test -n '$(STDBOOL_H)'; then \ + cp stdbool.h $@-t; \ + else \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + echo '#include <stdbool.h>'; \ + } > $@-t; \ + fi + mv $@-t $@ +BUILT_SOURCES += unistring-stdbool.h +MOSTLYCLEANFILES += unistring-stdbool.h-t +CLEANFILES += unistring-stdbool.h + +unistring-stdint.h : $(STDINT_H) stdint.mini.h + rm -f $@-t $@ + if test -n '$(STDINT_H)'; then \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ + -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ + -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ + -e 's/include_next/include/' \ + < $(srcdir)/stdint.mini.h; \ + } > $@-t; \ + else \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + echo '#include <stdint.h>'; \ + } > $@-t; \ + fi + mv $@-t $@ +BUILT_SOURCES += unistring-stdint.h +MOSTLYCLEANFILES += unistring-stdint.h-t +CLEANFILES += unistring-stdint.h +EXTRA_DIST += stdint.mini.h + # Libtool's library version information for libunistring. # See the libtool documentation, section "Library interface versions". LTV_CURRENT=0 diff --git a/lib/stdint.mini.h b/lib/stdint.mini.h new file mode 100644 index 0000000..d6f2cb0 --- /dev/null +++ b/lib/stdint.mini.h @@ -0,0 +1,128 @@ +/* Copyright (C) 2001-2002, 2004-2009 Free Software Foundation, Inc. + Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. + This file is part of gnulib. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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. */ + +/* + * Subset of ISO C 99 <stdint.h> for platforms that lack it. + * <http://www.opengroup.org/susv3xbd/stdint.h.html> + */ + +#ifndef _UNISTRING_STDINT_H + +/* When including a system file that in turn includes <inttypes.h>, + use the system <inttypes.h>, not our substitute. This avoids + problems with (for example) VMS, whose <sys/bitypes.h> includes + <inttypes.h>. */ +#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H + +/* Get those types that are already defined in other system include + files, so that we can "#define int8_t signed char" below without + worrying about a later system include file containing a "typedef + signed char int8_t;" that will get messed up by our macro. Our + macros should all be consistent with the system versions, except + for the "fast" types and macros, which we recommend against using + in public interfaces due to compiler differences. */ + +#if @HAVE_STDINT_H@ +# if defined __sgi && ! defined __c99 + /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users + with "This header file is to be used only for c99 mode compilations" + diagnostics. */ +# define __STDINT_H__ +# endif + /* Other systems may have an incomplete or buggy <stdint.h>. + Include it before <inttypes.h>, since any "#include <stdint.h>" + in <inttypes.h> would reinclude us, skipping our contents because + _UNISTRING_STDINT_H is defined. + The include_next requires a split double-inclusion guard. */ +# if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +# endif +# @INCLUDE_NEXT@ @NEXT_STDINT_H@ +#endif + +#if ! defined _UNISTRING_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H +#define _UNISTRING_STDINT_H + +/* <sys/types.h> defines some of the stdint.h types as well, on glibc, + IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>). + AIX 5.2 <sys/types.h> isn't needed and causes troubles. + MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but + relies on the system <stdint.h> definitions, so include + <sys/types.h> after @NEXT_STDINT_H@. */ +#if @HAVE_SYS_TYPES_H@ && ! defined _AIX +# include <sys/types.h> +#endif + +/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */ +#include <limits.h> + +#if @HAVE_INTTYPES_H@ + /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines + int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. + <inttypes.h> also defines intptr_t and uintptr_t. */ +# include <inttypes.h> +#elif @HAVE_SYS_INTTYPES_H@ + /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and + the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ +# include <sys/inttypes.h> +#endif + +#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ + /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines + int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is + included by <sys/types.h>. */ +# include <sys/bitypes.h> +#endif + +#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H + + +/* 7.18.1.1. Exact-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. */ + +#undef int8_t +#undef uint8_t +typedef signed char unistring_int8_t; +typedef unsigned char unistring_uint8_t; +#define int8_t unistring_int8_t +#define uint8_t unistring_uint8_t + +#undef int16_t +#undef uint16_t +typedef short int unistring_int16_t; +typedef unsigned short int unistring_uint16_t; +#define int16_t unistring_int16_t +#define uint16_t unistring_uint16_t + +#undef int32_t +#undef uint32_t +typedef int unistring_int32_t; +typedef unsigned int unistring_uint32_t; +#define int32_t unistring_int32_t +#define uint32_t unistring_uint32_t + +/* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */ +#define _UINT8_T +#define _UINT32_T +#define _UINT64_T + + +#endif /* _UNISTRING_STDINT_H */ +#endif /* !defined _UNISTRING_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ |