changeset 14118:733b45c14610

libposix: generate compile and runtime versions with configure * libposix/lib/version.c, libposix/lib/version.h.in: Templates for code to allow runtime and compile time checking of libposix version numbers. * libposix/configure.ac (AC_CONFIG_FILES): Use the already calculated libposix version number to generate libposix/ lib/version.h. * libposix/mk-tarball (func_mkver): Removed. Adjust all callers. Don't generate files required by the build in an optionally used script, and incidentally avoid recalculating the version number that configure already knows. Signed-off-by: Gary V. Vaughan <gary@gnu.org>
author Gary V. Vaughan <gary@gnu.org>
date Wed, 08 Dec 2010 21:04:53 +0700
parents ca7dbca5f7c7
children 9a45e81fffbe
files ChangeLog libposix/.gitignore libposix/configure.ac libposix/lib/version.c libposix/lib/version.h.in libposix/mk-tarball
diffstat 6 files changed, 56 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2010-12-08  Gary V. Vaughan  <gary@gnu.org>
+
+	libposix: generate compile and runtime versions with configure
+	* libposix/lib/version.c, libposix/lib/version.h.in: Templates
+	for code to allow runtime and compile time checking of libposix
+	version numbers.
+	* libposix/configure.ac (AC_CONFIG_FILES): Use the already
+	calculated libposix version number to generate libposix/
+	lib/version.h.
+	* libposix/mk-tarball (func_mkver): Removed. Adjust all callers.
+	Don't generate files required by the build in an optionally
+	used script, and incidentally avoid recalculating the version
+	number that configure already knows.
+
 2010-12-07  Gary V. Vaughan  <gary@gnu.org>
 
 	libposix: version filter script was adding a newline
--- a/libposix/.gitignore
+++ b/libposix/.gitignore
@@ -34,6 +34,8 @@
 /lib/arpa
 /lib/pt_chown
 /lib/sys
+!lib/version.c
+!lib/version.h.in
 libtool
 ltmain.sh
 /m4
--- a/libposix/configure.ac
+++ b/libposix/configure.ac
@@ -18,6 +18,7 @@
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADER([config.h])
 AC_CONFIG_FILES([Makefile lib/Makefile tests/Makefile])
+AC_CONFIG_FILES([lib/version.h])
 
 AM_INIT_AUTOMAKE([foreign])
 LT_INIT
new file mode 100644
--- /dev/null
+++ b/libposix/lib/version.c
@@ -0,0 +1,19 @@
+/* A C macro and symbol for compile- and run-time libposix version checking.
+   Copyright (C) 2010 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
+   Lesser 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/>.  */
+
+#include "version.h"
+
+char const libposix_version_string[] = LIBPOSIX_VERSION;
new file mode 100644
--- /dev/null
+++ b/libposix/lib/version.h.in
@@ -0,0 +1,20 @@
+/* A C macro and symbol for compile- and run-time libposix version checking.
+   Copyright (C) 2010 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
+   Lesser 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/>.  */
+
+#ifndef LIBPOSIX_VERSION
+#define LIBPOSIX_VERSION "@PACKAGE_VERSION@"
+extern char const libposix_version_string[];
+#endif
--- a/libposix/mk-tarball
+++ b/libposix/mk-tarball
@@ -56,44 +56,6 @@
     esac
 }
 
-func_mkver()
-{
-    {
-        echo '/*'
-        sed '1,/^$/d;s/^#/ */;/http:\/\/www\.gnu\.org/q' ${prognam}
-        echo ' */'
-
-        gv=`../build-aux/git-version-gen .tarball-version`
-        sedcmd='/^2[01][0-9][0-9]-[0-1][0-9]-[0-3][0-9]  /{
-	  s/ .*//
-	  s/-/./gp
-	  q
-	}'
-        dv=`sed -n "${sedcmd}" ${glibdir}/ChangeLog`
-        cat <<-_EOF_
-		#ifndef LIBPOSIX_GIT_VERSION
-		#define LIBPOSIX_GIT_VERSION "$gv"
-		#define LIBPOSIX_VERSION     "$dv"
-
-		extern char const libposix_git_version[];
-		extern char const libposix_version[];
-		#endif  /* LIBPOSIX_GIT_VERSION */
-	_EOF_
-    } > lib/version.h
-
-    {
-        sed -n '1,/^ \*\/$/p' lib/version.h
-
-        cat <<-_EOF_
-		#include "version.h"
-
-		char const libposix_git_version[] = LIBPOSIX_GIT_VERSION;
-		char const libposix_version[]     = LIBPOSIX_VERSION;
-	_EOF_
-
-    } > lib/version.c
-}
-
 func_bootstrap()
 {
     /bin/sh ./bootstrap \
@@ -111,7 +73,6 @@
 }
 
 func_init ${1+"$@"}
-func_mkver
 func_bootstrap
 func_mkdistro