From: Gary V. Vaughan Date: Wed, 8 Dec 2010 14:04:53 +0000 (+0700) Subject: libposix: generate compile and runtime versions with configure X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=2ee8eb28789a46a8b9fe59ad82fb0491de6f688b;p=gnulib.git 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 --- diff --git a/ChangeLog b/ChangeLog index 91f772f78a..19fccf9eaa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2010-12-08 Gary V. Vaughan + + 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 libposix: version filter script was adding a newline diff --git a/libposix/.gitignore b/libposix/.gitignore index 871206de71..5fbda6b01f 100644 --- a/libposix/.gitignore +++ b/libposix/.gitignore @@ -34,6 +34,8 @@ install-sh /lib/arpa /lib/pt_chown /lib/sys +!lib/version.c +!lib/version.h.in libtool ltmain.sh /m4 diff --git a/libposix/configure.ac b/libposix/configure.ac index 2d9809118c..36c3fb4e82 100644 --- a/libposix/configure.ac +++ b/libposix/configure.ac @@ -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 index 0000000000..76165aaac6 --- /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 . */ + +#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 index 0000000000..5a0c487d52 --- /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 . */ + +#ifndef LIBPOSIX_VERSION +#define LIBPOSIX_VERSION "@PACKAGE_VERSION@" +extern char const libposix_version_string[]; +#endif diff --git a/libposix/mk-tarball b/libposix/mk-tarball index 1139476be8..127e6a0508 100755 --- a/libposix/mk-tarball +++ b/libposix/mk-tarball @@ -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