summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2009-04-10 19:52:20 +0200
committerBruno Haible <bruno@clisp.org>2009-04-10 22:28:44 +0200
commitf942a32fae64439263111e4f682fbdaafe8f575d (patch)
tree8d4d6547bb0ec4154d72370d8e0a6ce2f1f85efe
parent64eec30401d5937d492deee444ac2125877580f2 (diff)
downloadlibunistring-f942a32fae64439263111e4f682fbdaafe8f575d.tar.gz
Replace HAVE_INLINE in installed include files.
-rw-r--r--ChangeLog11
-rwxr-xr-xautogen.sh6
-rw-r--r--gnulib-local/lib/unistr.h.diff13
-rw-r--r--lib/Makefile.am8
-rw-r--r--lib/unistring-inline.h68
-rw-r--r--lib/unistring-notinline.h23
6 files changed, 123 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index ac61d2f..f047cab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2008-04-10 Bruno Haible <bruno@clisp.org>
+ Replace HAVE_INLINE in installed include files.
+ * lib/unistring-inline.h: New file.
+ * lib/unistring-notinline.h: New file.
+ * autogen.sh: Postprocess unistr.h.
+ * gnulib-local/lib/unistr.h.diff: Also include unistring-inline.h.
+ * lib/Makefile.am (include_HEADERS): Add unistring-inline.h.
+ (noinst_HEADERS): New variable.
+ (AM_CPPFLAGS): Define IN_LIBUNISTRING.
+
+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.
diff --git a/autogen.sh b/autogen.sh
index a047652..2d75090 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -402,6 +402,12 @@ if test $skip_gnulib = false; then
$GNULIB_TOOL --lib=libunistring --source-base=lib --m4-base=gnulib-m4 --tests-base=tests \
--with-tests --lgpl --makefile-name=Makefile.gnulib --libtool --local-dir=gnulib-local \
--import $GNULIB_MODULES
+ # Change lib/unistr.h to be usable standalone.
+ sed -e 's/ifdef GNULIB_[A-Za-z0-9_]*/if 1/' -e 's/defined GNULIB_[A-Za-z0-9_]*/1/g' \
+ -e 's/HAVE_INLINE/UNISTRING_HAVE_INLINE/g' \
+ < lib/unistr.h \
+ > lib/unistr.h.tmp \
+ && mv lib/unistr.h.tmp lib/unistr.h
$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
# If we got no texinfo.tex so far, take the snapshot from gnulib.
diff --git a/gnulib-local/lib/unistr.h.diff b/gnulib-local/lib/unistr.h.diff
index 24c2e94..3989a24 100644
--- a/gnulib-local/lib/unistr.h.diff
+++ b/gnulib-local/lib/unistr.h.diff
@@ -1,7 +1,8 @@
-*** unistr.h.orig 2009-04-05 19:30:34.000000000 +0200
---- unistr.h 2009-04-10 16:21:37.000000000 +0200
+*** unistr.h.orig 2009-04-05 12:22:17.000000000 +0200
+--- unistr.h 2009-04-10 18:57:37.000000000 +0200
***************
-*** 20,26 ****
+*** 19,26 ****
+
#include "unitypes.h"
/* Get bool. */
@@ -9,9 +10,13 @@
/* Get size_t. */
#include <stddef.h>
---- 20,26 ----
+--- 19,29 ----
+
#include "unitypes.h"
++ /* Get inline if available. */
++ #include "unistring-inline.h"
++
/* Get bool. */
! #include <unistring-stdbool.h>
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 36c19ca..6292364 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -38,9 +38,13 @@ include_HEADERS = \
uniwbrk.h \
unilbrk.h \
uninorm.h \
- unicase.h
+ unicase.h \
+ unistring-inline.h
-#AM_CPPFLAGS =
+noinst_HEADERS = \
+ unistring-notinline.h
+
+AM_CPPFLAGS = -DIN_LIBUNISTRING
# Rules generated and collected by gnulib-tool.
include Makefile.gnulib
diff --git a/lib/unistring-inline.h b/lib/unistring-inline.h
new file mode 100644
index 0000000..bdb0b22
--- /dev/null
+++ b/lib/unistring-inline.h
@@ -0,0 +1,68 @@
+/* Decision whether to use 'inline' or not.
+ 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 Lesser 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
+ 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, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009. */
+
+#ifndef _UNISTRING_INLINE_H
+#define _UNISTRING_INLINE_H
+
+/* This is like the gl_INLINE macro in gnulib/m4/inline.m4, but makes its
+ decision based on defined preprocessor symbols rather than through
+ autoconf tests.
+ See <http://lists.gnu.org/archive/html/bug-gnulib/2006-11/msg00055.html> */
+
+/* Test for the 'inline' keyword or equivalent. ISO C 99 semantics is not
+ required, only that 'static inline' works.
+ Define 'inline' to a supported equivalent, or to nothing if not supported,
+ like AC_C_INLINE does. Also, define UNISTRING_HAVE_INLINE if 'inline' or an
+ equivalent is effectively supported, i.e. if the compiler is likely to
+ drop unused 'static inline' functions. */
+
+#if defined __GNUC__
+/* GNU C or GNU C++. */
+# if defined __NO_INLINE__
+/* GCC defines __NO_INLINE__ if not optimizing or if -fno-inline is
+ specified. */
+# define UNISTRING_HAVE_INLINE 0
+# else
+/* Whether 'inline' has the old GCC semantics or the ISO C 99 semantics,
+ does not matter. */
+# define UNISTRING_HAVE_INLINE 1
+# ifndef inline
+# define inline __inline__
+# endif
+# endif
+#elif defined __cplusplus
+/* Any other C++ compiler. */
+# define UNISTRING_HAVE_INLINE 1
+#else
+/* Any other C compiler. */
+# if defined __osf__
+/* OSF/1 cc has inline. */
+# define UNISTRING_HAVE_INLINE 1
+# elif defined _AIX || defined __sgi
+/* AIX 4 xlc, IRIX 6.5 cc have __inline. */
+# define UNISTRING_HAVE_INLINE 1
+# ifndef inline
+# define inline __inline
+# endif
+# else
+/* Some older C compiler. */
+# define UNISTRING_HAVE_INLINE 0
+# endif
+#endif
+
+#endif /* _UNISTRING_INLINE_H */
diff --git a/lib/unistring-notinline.h b/lib/unistring-notinline.h
new file mode 100644
index 0000000..8ef35ec
--- /dev/null
+++ b/lib/unistring-notinline.h
@@ -0,0 +1,23 @@
+/* Override decision whether to use 'inline' or not.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+
+ 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 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
+ 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, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009. */
+
+#include "unistring-inline.h"
+#undef UNISTRING_HAVE_INLINE
+#define UNISTRING_HAVE_INLINE 0
+#undef HAVE_INLINE
+#define HAVE_INLINE 0