diff options
| author | David M. Syzdek <syzdek@bindlebinaries.com> | 2010-04-27 15:43:50 -0800 |
|---|---|---|
| committer | David M. Syzdek <syzdek@bindlebinaries.com> | 2010-04-27 15:43:50 -0800 |
| commit | f18b68bbd23a0bd553e69a1d67fb098aeb93cbda (patch) | |
| tree | d64111aa1282c12a9a8e59306222b18afddeb453 /m4/dmstools_git.m4 | |
| parent | b70f97018a004c118454b59e08bdabe88e4b32ae (diff) | |
| download | dmstools-f18b68bbd23a0bd553e69a1d67fb098aeb93cbda.tar.gz dmstools-f18b68bbd23a0bd553e69a1d67fb098aeb93cbda.tar.bz2 dmstools-f18b68bbd23a0bd553e69a1d67fb098aeb93cbda.tar.xz dmstools-f18b68bbd23a0bd553e69a1d67fb098aeb93cbda.zip | |
Adding m4 macros for Git versioning.
Diffstat (limited to 'm4/dmstools_git.m4')
| -rw-r--r-- | m4/dmstools_git.m4 | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/m4/dmstools_git.m4 b/m4/dmstools_git.m4 new file mode 100644 index 0000000..a48a0a3 --- /dev/null +++ b/m4/dmstools_git.m4 | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | # | ||
| 2 | # DMS Tools and Utilities | ||
| 3 | # Copyright (C) 2008 David M. Syzdek <david@syzdek.net> | ||
| 4 | # | ||
| 5 | # @SYZDEK_LICENSE_HEADER_START@ | ||
| 6 | # | ||
| 7 | # This program is free software; you can redistribute it and/or modify | ||
| 8 | # it under the terms of the GNU General Public License Version 2 as | ||
| 9 | # published by the Free Software Foundation. | ||
| 10 | # | ||
| 11 | # This program is distributed in the hope that it will be useful, | ||
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | # GNU General Public License for more details. | ||
| 15 | # | ||
| 16 | # You should have received a copy of the GNU General Public License | ||
| 17 | # along with this program; if not, write to the Free Software | ||
| 18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | # | ||
| 20 | # @SYZDEK_LICENSE_HEADER_END@ | ||
| 21 | # | ||
| 22 | # acinclude.m4 - custom m4 macros used by configure.ac | ||
| 23 | # | ||
| 24 | |||
| 25 | # AC_DMS_GIT_PACKAGE_VERSION() | ||
| 26 | # ----------------------------------- | ||
| 27 | AC_DEFUN([AC_DMS_GIT_PACKAGE_VERSION],[dnl | ||
| 28 | |||
| 29 | if test -f ${srcdir}/.git/config;then | ||
| 30 | GPV=$(git describe --abbrev=7 HEAD 2>/dev/null) | ||
| 31 | GPV=$(echo "$GPV" | sed -e 's/-/./g') | ||
| 32 | GPV=$(echo "$GPV" | sed -e 's/^v//g') | ||
| 33 | if test "x${GPV}" != "x";then | ||
| 34 | AC_MSG_NOTICE([using git package version ${GPV}]) | ||
| 35 | if test -d ${ac_aux_dir};then | ||
| 36 | echo ${GPV} > ${ac_aux_dir}/git-package-version | ||
| 37 | fi | ||
| 38 | fi | ||
| 39 | elif test -f ${ac_aux_dir}/git-package-version;then | ||
| 40 | GPV=$(cat ${ac_aux_dir}/git-package-version) | ||
| 41 | if test -d ${ac_aux_dir};then | ||
| 42 | AC_MSG_NOTICE([using cached git package version ${GPV}]) | ||
| 43 | fi | ||
| 44 | fi | ||
| 45 | |||
| 46 | if test "x${GPV}" = "x";then | ||
| 47 | AC_MSG_WARN([unable to determine package version from Git tags]) | ||
| 48 | else | ||
| 49 | # | ||
| 50 | # set internal variables | ||
| 51 | GIT_PACKAGE_VERSION=${GPV} | ||
| 52 | PACKAGE_VERSION=${GPV} | ||
| 53 | VERSION=${GPV} | ||
| 54 | # | ||
| 55 | # set substitution variables | ||
| 56 | AC_SUBST([GIT_PACKAGE_VERSION], [${GPV}]) | ||
| 57 | AC_SUBST([PACKAGE_VERSION], [${GPV}]) | ||
| 58 | AC_SUBST([VERSION], [${GPV}]) | ||
| 59 | # | ||
| 60 | # set C/C++/Objc preprocessor macros | ||
| 61 | AC_DEFINE_UNQUOTED([GIT_PACKAGE_VERSION], ["${GIT_PACKAGE_VERSION}"], [package version determined from git repository]) | ||
| 62 | AC_DEFINE_UNQUOTED([PACKAGE_VERSION], ["${GIT_PACKAGE_VERSION}"], [package version determined from git repository]) | ||
| 63 | AC_DEFINE_UNQUOTED([VERSION], ["${GIT_PACKAGE_VERSION}"], [package version determined from git repository]) | ||
| 64 | fi | ||
| 65 | ])dnl | ||
| 66 | |||
| 67 | # end of M4 file | ||
