]> Savannah Git Hosting - gnulib.git/commitdiff
libposix: generate compile and runtime versions with configure
authorGary V. Vaughan <gary@gnu.org>
Wed, 8 Dec 2010 14:04:53 +0000 (21:04 +0700)
committerGary V. Vaughan <gary@gnu.org>
Wed, 8 Dec 2010 14:04:53 +0000 (21:04 +0700)
* 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>
ChangeLog
libposix/.gitignore
libposix/configure.ac
libposix/lib/version.c [new file with mode: 0644]
libposix/lib/version.h.in [new file with mode: 0644]
libposix/mk-tarball

index 91f772f78aaa506633118050bdca9f7607b8abfb..19fccf9eaafa1509e462523c06ffdff73e82d13d 100644 (file)
--- 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
index 871206de711a577ad06d916191770bccafbf07a2..5fbda6b01f454b63500deb5b67a852d161e7c789 100644 (file)
@@ -34,6 +34,8 @@ install-sh
 /lib/arpa
 /lib/pt_chown
 /lib/sys
+!lib/version.c
+!lib/version.h.in
 libtool
 ltmain.sh
 /m4
index 2d9809118c881e03c5e45d016fa02386d6016033..36c3fb4e82b4add318bf3e785b1ece7fe804ab09 100644 (file)
@@ -18,6 +18,7 @@ dnl AC_CONFIG_AUX_DIR([build-aux])
 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
diff --git a/libposix/lib/version.c b/libposix/lib/version.c
new file mode 100644 (file)
index 0000000..76165aa
--- /dev/null
@@ -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;
diff --git a/libposix/lib/version.h.in b/libposix/lib/version.h.in
new file mode 100644 (file)
index 0000000..5a0c487
--- /dev/null
@@ -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
index 1139476be8581130177cdf1901eb87b5074ca29d..127e6a050839fccc86e9e89b1482bf38df848d33 100755 (executable)
@@ -56,44 +56,6 @@ func_init()
     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_mkdistro()
 }
 
 func_init ${1+"$@"}
-func_mkver
 func_bootstrap
 func_mkdistro