summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2009-04-22 03:05:40 +0200
committerBruno Haible <bruno@clisp.org>2009-04-22 03:05:40 +0200
commit7550f78f9b88f77309b1a233df6ef1f0e94f3035 (patch)
treed487c2e6e81da2a12e38e79071c39226c7e32b21
parent2ac3b7e93348881b383d0871ce2822031ba9d78b (diff)
downloadlibunistring-7550f78f9b88f77309b1a233df6ef1f0e94f3035.tar.gz
Add version metainformation.
-rw-r--r--ChangeLog13
-rw-r--r--configure.ac22
-rw-r--r--lib/Makefile.am9
-rw-r--r--lib/unistring/version.in.h39
-rw-r--r--lib/version.c23
-rw-r--r--woe32dll/unistring-exports.c2
6 files changed, 106 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 89d5ec7..f3c6404 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2008-04-21 Bruno Haible <bruno@clisp.org>
+
+ Add version metainformation.
+ * configure.ac (AC_CONFIG_SRCDIR): Use lib/unistring/version.in.h.
+ (HEXVERSION): New variable, computed from VERSION.
+ (AC_CONFIG_FILES): Add lib/unistring/version.h.
+ * lib/unistring/version.in.h: New file.
+ * lib/version.c: New file.
+ * lib/Makefile.am (libunistring_la_SOURCES): Add version.c.
+ (nobase_nodist_include_HEADERS): Add unistring/version.h.
+ (HEADERS_WITH_EXTERNS): Add unistring/version.in.h.
+ * woe32dll/unistring-exports.c: Add _libunistring_version.
+
2008-04-19 Bruno Haible <bruno@clisp.org>
Avoid compilation errors in tests/uninorm/test-nf*.c.
diff --git a/configure.ac b/configure.ac
index 67783d9..6961418 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT
-AC_CONFIG_SRCDIR([lib/Makefile.am])
+AC_CONFIG_SRCDIR([lib/unistring/version.in.h])
AC_CONFIG_AUX_DIR([build-aux])
. $srcdir/version.sh
AM_INIT_AUTOMAKE([libunistring], [$VERSION_NUMBER])
@@ -92,6 +92,25 @@ fi
dnl Check for prerequisites of exported.sh.
gt_GLOBAL_SYMBOL_PIPE
+dnl Substitutable version number.
+AC_PROG_AWK
+changequote(,)
+sed_extract_major='/^[0-9]/{s/^\([0-9]*\).*/\1/p;q;}
+i\
+0
+q
+'
+sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]\([0-9]*\).*/\1/p;q;}
+i\
+0
+q
+'
+changequote([,])
+version_major=`echo "${VERSION}" | sed -n -e "$sed_extract_major"`
+version_minor=`echo "${VERSION}" | sed -n -e "$sed_extract_minor"`
+HEXVERSION=0x`$AWK 'BEGIN { printf("%02d%02d"',"$version_major","$version_minor"') }'`
+AC_SUBST([HEXVERSION])
+
dnl Check for tools needed for formatting the documentation.
ac_aux_dir_abs=`cd $ac_aux_dir && pwd`
AC_PATH_PROG([TEXI2DVI], [texi2dvi], [$ac_aux_dir_abs/missing texi2dvi])
@@ -104,6 +123,7 @@ AC_CONFIG_FILES([doc/Makefile],
AC_CONFIG_FILES([gnulib-local/Makefile])
AC_CONFIG_FILES([lib/Makefile])
AC_CONFIG_FILES([lib/exported.sh])
+AC_CONFIG_FILES([lib/unistring/version.h:lib/unistring/version.in.h])
AC_CONFIG_FILES([lib/unistring/woe32dll.h:lib/unistring/woe32dll.in.h])
AC_CONFIG_FILES([tests/Makefile])
AC_OUTPUT
diff --git a/lib/Makefile.am b/lib/Makefile.am
index b06cf76..19b7562 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -49,6 +49,9 @@ AM_CPPFLAGS = -DIN_LIBUNISTRING
# Rules generated and collected by gnulib-tool.
include Makefile.gnulib
+# Additional source files.
+libunistring_la_SOURCES += version.c
+
# The <stdbool.h> and <stdint.h> replacements that can be installed.
nobase_nodist_include_HEADERS = \
unistring/stdbool.h \
@@ -118,6 +121,9 @@ BUILT_SOURCES += unistring/iconveh.h
MOSTLYCLEANFILES += unistring/iconveh.h-t
CLEANFILES += unistring/iconveh.h
+# unistring/version.h is public.
+nobase_nodist_include_HEADERS += unistring/version.h
+
# unistring/woe32dll.h is not public, but is included by other header files.
nobase_nodist_include_HEADERS += unistring/woe32dll.h
@@ -153,7 +159,8 @@ HEADERS_WITH_EXTERNS = \
uninorm.h \
unicase.h \
localcharset.h \
- iconveh.h
+ iconveh.h \
+ unistring/version.in.h
# List of exported symbols.
# We extract it from the header files that get installed, removing symbols
diff --git a/lib/unistring/version.in.h b/lib/unistring/version.in.h
new file mode 100644
index 0000000..47b736a
--- /dev/null
+++ b/lib/unistring/version.in.h
@@ -0,0 +1,39 @@
+/* Meta information about GNU libunistring.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2009.
+
+ 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/>. */
+
+#ifndef _UNISTRING_VERSION_H
+#define _UNISTRING_VERSION_H
+
+/* Get LIBUNISTRING_DLL_VARIABLE. */
+#include <unistring/woe32dll.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define _LIBUNISTRING_VERSION @HEXVERSION@ /* version number: (major<<8) + minor */
+extern LIBUNISTRING_DLL_VARIABLE const int _libunistring_version; /* Likewise */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _UNISTRING_VERSION_H */
diff --git a/lib/version.c b/lib/version.c
new file mode 100644
index 0000000..0b3bde1
--- /dev/null
+++ b/lib/version.c
@@ -0,0 +1,23 @@
+/* Version information about GNU libunistring.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2009.
+
+ 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/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include "unistring/version.h"
+
+const int _libunistring_version = _LIBUNISTRING_VERSION;
diff --git a/woe32dll/unistring-exports.c b/woe32dll/unistring-exports.c
index d10bd7e..52f30d1 100644
--- a/woe32dll/unistring-exports.c
+++ b/woe32dll/unistring-exports.c
@@ -139,3 +139,5 @@ VARIABLE(uninorm_nfc)
VARIABLE(uninorm_nfd)
VARIABLE(uninorm_nfkc)
VARIABLE(uninorm_nfkd)
+/* Variables declared in unistring/version.h */
+VARIABLE(_libunistring_version)