2424 |
12 Feb 11 |
peter |
## $Id$ |
2424 |
12 Feb 11 |
peter |
2 |
|
4333 |
16 Mar 23 |
peter |
# serial 18 (yat 0.21) |
2424 |
12 Feb 11 |
peter |
4 |
|
2424 |
12 Feb 11 |
peter |
5 |
m4_define([yat_am_macros_copyright], [ |
2424 |
12 Feb 11 |
peter |
6 |
# |
4359 |
23 Aug 23 |
peter |
# Copyright (C) 2011, 2012, 2019, 2023 Peter Johansson |
2424 |
12 Feb 11 |
peter |
8 |
# |
2424 |
12 Feb 11 |
peter |
# This file is part of the yat library, http://dev.thep.lu.se/yat |
2424 |
12 Feb 11 |
peter |
10 |
# |
2424 |
12 Feb 11 |
peter |
# The yat library is free software; you can redistribute it and/or |
2424 |
12 Feb 11 |
peter |
# modify it under the terms of the GNU General Public License as |
2424 |
12 Feb 11 |
peter |
# published by the Free Software Foundation; either version 3 of the |
2424 |
12 Feb 11 |
peter |
# License, or (at your option) any later version. |
2424 |
12 Feb 11 |
peter |
15 |
# |
2424 |
12 Feb 11 |
peter |
# The yat library is distributed in the hope that it will be useful, |
2424 |
12 Feb 11 |
peter |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2424 |
12 Feb 11 |
peter |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2424 |
12 Feb 11 |
peter |
# General Public License for more details. |
2424 |
12 Feb 11 |
peter |
20 |
# |
2424 |
12 Feb 11 |
peter |
# You should have received a copy of the GNU General Public License |
2424 |
12 Feb 11 |
peter |
# along with yat. If not, see <http://www.gnu.org/licenses/>. |
2424 |
12 Feb 11 |
peter |
23 |
# |
2424 |
12 Feb 11 |
peter |
24 |
]) |
2424 |
12 Feb 11 |
peter |
25 |
|
2424 |
12 Feb 11 |
peter |
# YAT_HAVE_SVN_WC |
2424 |
12 Feb 11 |
peter |
27 |
# |
2424 |
12 Feb 11 |
peter |
# Test if we are building from a subversion repository and sets shell |
2424 |
12 Feb 11 |
peter |
# variable `have_svn_wc' to `yes' or `no'. Macro calls |
2424 |
12 Feb 11 |
peter |
# AC_SUBST([have_svn_wc]) and defines an Automake Conditional |
2424 |
12 Feb 11 |
peter |
# HAVE_SVN_WC. |
2424 |
12 Feb 11 |
peter |
32 |
# |
2424 |
12 Feb 11 |
peter |
33 |
AC_DEFUN([YAT_HAVE_SVN_WC], |
2424 |
12 Feb 11 |
peter |
34 |
[ |
2424 |
12 Feb 11 |
peter |
35 |
AC_MSG_CHECKING([if building from subversion wc]) |
2424 |
12 Feb 11 |
peter |
36 |
AS_IF([test -d $srcdir/.svn], [have_svn_wc=yes], [have_svn_wc=no]) |
2424 |
12 Feb 11 |
peter |
37 |
AM_CONDITIONAL([HAVE_SVN_WC], [test "x$have_svn_wc" = "xyes"]) |
2424 |
12 Feb 11 |
peter |
38 |
AC_SUBST([have_svn_wc]) |
2424 |
12 Feb 11 |
peter |
39 |
AC_MSG_RESULT([$have_svn_wc]) |
2424 |
12 Feb 11 |
peter |
40 |
]) # YAT_HAVE_SVN_WC |
2424 |
12 Feb 11 |
peter |
41 |
|
2424 |
12 Feb 11 |
peter |
42 |
|
2424 |
12 Feb 11 |
peter |
# YAT_PROG_MOVE_IF_CHANGE |
2424 |
12 Feb 11 |
peter |
44 |
# |
2536 |
31 Jul 11 |
peter |
# Create shell script move-if-change at autoconf time and AC_SUBST |
2536 |
31 Jul 11 |
peter |
# MOVE_IF_CHANGE |
2424 |
12 Feb 11 |
peter |
47 |
AC_DEFUN([YAT_PROG_MOVE_IF_CHANGE], |
2424 |
12 Feb 11 |
peter |
48 |
[ |
2552 |
14 Aug 11 |
peter |
49 |
m4_define([yat_MOVE_IF_CHANGE], m4_default([$1], [move-if-change])) |
2552 |
14 Aug 11 |
peter |
50 |
AC_SUBST([MOVE_IF_CHANGE], ['${SHELL} $(top_srcdir)/yat_MOVE_IF_CHANGE']) |
4326 |
12 Mar 23 |
peter |
51 |
|
4326 |
12 Mar 23 |
peter |
52 |
YAT_AC_WRITE_TO_FILE(yat_MOVE_IF_CHANGE,dnl |
4326 |
12 Mar 23 |
peter |
53 |
[#!/bin/sh |
2429 |
01 Mar 11 |
peter |
# Like mv ]$[1 ]$[2, but if the files are the same, just delete ]$[1. |
2424 |
12 Feb 11 |
peter |
# Status is zero if successful, nonzero otherwise. |
2424 |
12 Feb 11 |
peter |
56 |
|
4326 |
12 Mar 23 |
peter |
57 |
usage="]$[0: usage: ]$[0 SOURCE DEST" |
2424 |
12 Feb 11 |
peter |
58 |
|
4326 |
12 Mar 23 |
peter |
59 |
test ]$[# = 2 || { echo $usage >&2 && exit 1; } |
2424 |
12 Feb 11 |
peter |
60 |
|
4326 |
12 Mar 23 |
peter |
61 |
if test -r "]$[2" && cmp -s "]$[1" "]$[2"; then |
4326 |
12 Mar 23 |
peter |
62 |
rm -f "]$[1" |
2424 |
12 Feb 11 |
peter |
63 |
else |
4326 |
12 Mar 23 |
peter |
64 |
mv -f "]$[1" "]$[2" |
2424 |
12 Feb 11 |
peter |
65 |
fi |
4326 |
12 Mar 23 |
peter |
66 |
]) # YAT_AC_WRITE_TO_FILE |
2424 |
12 Feb 11 |
peter |
67 |
]) # YAT_PROG_MOVE_IF_CHANGE |
2424 |
12 Feb 11 |
peter |
68 |
|
2424 |
12 Feb 11 |
peter |
69 |
|
4326 |
12 Mar 23 |
peter |
# YAT_AM_LOCAL([am-file = yat_am_local.am]) |
4326 |
12 Mar 23 |
peter |
71 |
# ======================================================== |
2424 |
12 Feb 11 |
peter |
72 |
# |
4326 |
12 Mar 23 |
peter |
# This file and 'yat_svn_release.m4' contain several macros that |
4326 |
12 Mar 23 |
peter |
# create Automake snippets that need to be included in your |
4326 |
12 Mar 23 |
peter |
# Makefile.am. Some of macros AC_REQUIRE others, which makes it |
4326 |
12 Mar 23 |
peter |
# tedious to keep track of which files are generated and need to be |
4326 |
12 Mar 23 |
peter |
# included. If this macro has been called first, those macros append |
4326 |
12 Mar 23 |
peter |
# the Automake snippets to am-file instead, which makes it easier to |
4326 |
12 Mar 23 |
peter |
# include once. |
4326 |
12 Mar 23 |
peter |
80 |
AC_DEFUN([YAT_AM_LOCAL], |
4326 |
12 Mar 23 |
peter |
81 |
[ |
4326 |
12 Mar 23 |
peter |
82 |
m4_define([YAT_AM_LOCAL_FILE], [m4_default([$1], [yat_am_local.am])]) |
4326 |
12 Mar 23 |
peter |
83 |
_YAT_AM_TOP(YAT_AM_LOCAL_FILE) |
4326 |
12 Mar 23 |
peter |
84 |
]) |
4326 |
12 Mar 23 |
peter |
85 |
|
4326 |
12 Mar 23 |
peter |
86 |
|
4326 |
12 Mar 23 |
peter |
# YAT_SVN_REVISION([am-file = svn_revison.am], [revision-file = .revision]) |
4326 |
12 Mar 23 |
peter |
88 |
# |
4326 |
12 Mar 23 |
peter |
# Create a file, am-file, at Autoconf time that should be included in |
2424 |
12 Feb 11 |
peter |
# your top Makefile.am. The file creates make rules for creation of a |
2424 |
12 Feb 11 |
peter |
# file REVISION_FILE that will contain the current revision of the |
2424 |
12 Feb 11 |
peter |
# subversion wc. We use `svnversion' to generate the revision number, |
2424 |
12 Feb 11 |
peter |
# so `svnversion' (included in Apache Subversion) must be available |
2424 |
12 Feb 11 |
peter |
# when building in a subversion wc. When building in the tarball there |
2424 |
12 Feb 11 |
peter |
# is no need to re-generate `.revision' as the file is included in the |
2424 |
12 Feb 11 |
peter |
# distribution and the revision number is hopefully constant in a |
2424 |
12 Feb 11 |
peter |
# tarball release. |
2424 |
12 Feb 11 |
peter |
98 |
# |
2424 |
12 Feb 11 |
peter |
# You need to declare Automake variable in your Makefile.am |
2424 |
12 Feb 11 |
peter |
# 'EXTRA_DIST = ' |
2424 |
12 Feb 11 |
peter |
101 |
# |
4326 |
12 Mar 23 |
peter |
# You may want to use YAT_AM_LOCAL |
4326 |
12 Mar 23 |
peter |
103 |
# |
2424 |
12 Feb 11 |
peter |
104 |
AC_DEFUN([YAT_SVN_REVISION], |
2424 |
12 Feb 11 |
peter |
105 |
[ |
2424 |
12 Feb 11 |
peter |
106 |
AC_REQUIRE([YAT_HAVE_SVN_WC]) |
2424 |
12 Feb 11 |
peter |
107 |
AC_REQUIRE([YAT_PROG_MOVE_IF_CHANGE]) |
2424 |
12 Feb 11 |
peter |
108 |
AC_REQUIRE([_YAT_PROG_SVNVERSION]) |
2424 |
12 Feb 11 |
peter |
109 |
m4_pushdef([YAT_AM_FILE], [m4_default([$1], [svn_revision.am])]) |
2424 |
12 Feb 11 |
peter |
110 |
m4_pushdef([yat_svn_revision_FILE], m4_default([$2], [.revision])) |
2424 |
12 Feb 11 |
peter |
111 |
AS_VAR_IF([have_svn_wc], [yes], [ |
2424 |
12 Feb 11 |
peter |
112 |
AS_VAR_IF([SVNVERSION], [false], [ |
2680 |
09 Jan 12 |
peter |
113 |
AC_MSG_ERROR([could not find svnversion, which is |
2424 |
12 Feb 11 |
peter |
114 |
required when building from a subversion working copy]) |
2424 |
12 Feb 11 |
peter |
115 |
]) |
2424 |
12 Feb 11 |
peter |
116 |
]) |
2425 |
12 Feb 11 |
peter |
dnl create dummy file in 'svn export' |
2425 |
12 Feb 11 |
peter |
118 |
m4_syscmd([test -d .svn || test -r ]yat_svn_revision_FILE[ || \ |
2425 |
12 Feb 11 |
peter |
119 |
echo "exported" > ]yat_svn_revision_FILE[]) |
2424 |
12 Feb 11 |
peter |
120 |
|
2424 |
12 Feb 11 |
peter |
dnl write rules to create .revision |
4326 |
12 Mar 23 |
peter |
122 |
_YAT_AM_LOCAL_WRITE(YAT_AM_FILE,[ |
4326 |
12 Mar 23 |
peter |
123 |
EXTRA_DIST += $(srcdir)/]yat_svn_revision_FILE[ |
2424 |
12 Feb 11 |
peter |
124 |
if HAVE_SVN_WC |
2424 |
12 Feb 11 |
peter |
125 |
YAT_SVN_REVISION_FORCE: |
4326 |
12 Mar 23 |
peter |
126 |
$(srcdir)/]yat_svn_revision_FILE[: YAT_SVN_REVISION_FORCE |
4326 |
12 Mar 23 |
peter |
127 |
$(AM_V_at)$(SVNVERSION) $(srcdir) > ]$[@-t \ |
4326 |
12 Mar 23 |
peter |
128 |
&& $(MOVE_IF_CHANGE) ]$[@-t ]$[@ |
2424 |
12 Feb 11 |
peter |
129 |
endif |
4326 |
12 Mar 23 |
peter |
130 |
]) |
4326 |
12 Mar 23 |
peter |
dnl end YAT_AM_LOCAL_FILE |
2424 |
12 Feb 11 |
peter |
132 |
m4_popdef([YAT_AM_FILE]) |
2540 |
01 Aug 11 |
peter |
133 |
]) # YAT_SVN_REVISION |
2424 |
12 Feb 11 |
peter |
134 |
|
2424 |
12 Feb 11 |
peter |
135 |
|
2424 |
12 Feb 11 |
peter |
# YAT_REVISION_HEADER([AM_FILE = svn_revision_header.am], |
2424 |
12 Feb 11 |
peter |
# [HEADER = svn_revision.h], |
2424 |
12 Feb 11 |
peter |
# [DEFINE = SVN_REVISION], |
2424 |
12 Feb 11 |
peter |
# [REVISION = .revision]) |
2424 |
12 Feb 11 |
peter |
140 |
# |
2424 |
12 Feb 11 |
peter |
# Create make rules for creation of a C header file, which defines the |
2424 |
12 Feb 11 |
peter |
# current revision as DEFINE. The make rule is generated in file, |
2424 |
12 Feb 11 |
peter |
# AM_FILE, that should be included in your Makefile.am. The C header |
2424 |
12 Feb 11 |
peter |
# file, HEADER, in two steps. First, at Autoconf time HEADER.in is |
2424 |
12 Feb 11 |
peter |
# created. Then at Make time HEADER is created from files HEADER.in |
2424 |
12 Feb 11 |
peter |
# and REVISION. The latter file is supposed to contain the current |
2424 |
12 Feb 11 |
peter |
# revision and a convenient way to generate this file is to the use |
2501 |
28 Jun 11 |
peter |
# macro YAT_SVN_REVISION. You need to declare the following variables |
2424 |
12 Feb 11 |
peter |
# in your Makefile.am: |
2680 |
09 Jan 12 |
peter |
# BUILT_SOURCES = |
2680 |
09 Jan 12 |
peter |
# DISTCLEANFILES = |
2424 |
12 Feb 11 |
peter |
# EXTRA_DIST = |
2424 |
12 Feb 11 |
peter |
153 |
# |
4326 |
12 Mar 23 |
peter |
# You may want to use YAT_AM_LOCAL |
4326 |
12 Mar 23 |
peter |
155 |
# |
2424 |
12 Feb 11 |
peter |
156 |
AC_DEFUN([YAT_REVISION_HEADER], |
2424 |
12 Feb 11 |
peter |
157 |
[ |
2552 |
14 Aug 11 |
peter |
158 |
AC_REQUIRE([YAT_PROG_MOVE_IF_CHANGE]) |
2680 |
09 Jan 12 |
peter |
159 |
m4_pushdef([yat_AM_FILE], [m4_default([$1], [svn_revision_header.am])]) |
2424 |
12 Feb 11 |
peter |
160 |
m4_define([yat_HEADER_FILE], [m4_default([$2], [svn_revision.h])]) |
2680 |
09 Jan 12 |
peter |
161 |
m4_pushdef([yat_REVISION_DEFINE], [m4_default([$3], [SVN_REVISION])]) |
2539 |
31 Jul 11 |
peter |
162 |
m4_pushdef([yat_INPUT_FILE], [m4_default([$4], [.revision])]) |
2424 |
12 Feb 11 |
peter |
163 |
|
2424 |
12 Feb 11 |
peter |
dnl create svn_revision.h.in |
4326 |
12 Mar 23 |
peter |
165 |
YAT_AC_WRITE_TO_FILE([]yat_HEADER_FILE[.in-t],[ |
2424 |
12 Feb 11 |
peter |
166 |
/* created by $0 */ |
2424 |
12 Feb 11 |
peter |
#ifndef ]yat_REVISION_DEFINE[ |
4326 |
12 Mar 23 |
peter |
#define ]yat_REVISION_DEFINE[ "@]yat_REVISION_DEFINE[@" |
2424 |
12 Feb 11 |
peter |
#endif |
2424 |
12 Feb 11 |
peter |
170 |
]) |
2552 |
14 Aug 11 |
peter |
171 |
m4_syscmd([sh ]yat_MOVE_IF_CHANGE[ ]yat_HEADER_FILE[.in-t ]yat_HEADER_FILE[.in]) |
2424 |
12 Feb 11 |
peter |
dnl write make rule for svn_revision.h |
4326 |
12 Mar 23 |
peter |
173 |
_YAT_AM_LOCAL_WRITE(yat_AM_FILE,[ |
2424 |
12 Feb 11 |
peter |
174 |
EXTRA_DIST += $(srcdir)/]yat_HEADER_FILE[.in |
2424 |
12 Feb 11 |
peter |
175 |
DISTCLEANFILES += $(builddir)/]yat_HEADER_FILE[ |
2424 |
12 Feb 11 |
peter |
176 |
BUILT_SOURCES += $(builddir)/]yat_HEADER_FILE[ |
4326 |
12 Mar 23 |
peter |
177 |
$(builddir)/]yat_HEADER_FILE[: $(srcdir)/]yat_HEADER_FILE[.in $(srcdir)/]yat_INPUT_FILE[ |
2807 |
05 Aug 12 |
peter |
178 |
$(AM_V_at)revision=$$(cat $(srcdir)/]yat_INPUT_FILE[) \ |
4326 |
12 Mar 23 |
peter |
179 |
&& sed "s|@]yat_REVISION_DEFINE[@|$$revision|g" < $(srcdir)/]yat_HEADER_FILE[.in \ |
4326 |
12 Mar 23 |
peter |
180 |
> ]$[@-t && mv ]$[@-t ]$[@ |
4326 |
12 Mar 23 |
peter |
181 |
]) |
2424 |
12 Feb 11 |
peter |
182 |
m4_popdef([yat_AM_FILE]) |
2424 |
12 Feb 11 |
peter |
183 |
m4_popdef([yat_REVISION_DEFINE]) |
2424 |
12 Feb 11 |
peter |
184 |
m4_popdef([yat_INPUT_FILE]) |
2424 |
12 Feb 11 |
peter |
185 |
]) # YAT_REVISION_HEADER |
2424 |
12 Feb 11 |
peter |
186 |
|
2424 |
12 Feb 11 |
peter |
187 |
|
2540 |
01 Aug 11 |
peter |
# YAT_SVN_RELEASE_YEAR([AM_FILE = svn_release_year.am],[OUTPUT = .release_year]) |
2424 |
12 Feb 11 |
peter |
189 |
# |
2424 |
12 Feb 11 |
peter |
# Create file, AM_FILE, with make rules for creation of a file, |
2424 |
12 Feb 11 |
peter |
# OUTPUT, that holds the year the package was last modified. The rule |
2424 |
12 Feb 11 |
peter |
# is only active when building in subversion wc and the wc is modified |
2424 |
12 Feb 11 |
peter |
# compared to the repository. The value of OUTPUT is AC_SUBSTed and |
2424 |
12 Feb 11 |
peter |
# AC_DEFINEed and OUTPUT added to CONFIG_STATUS_DEPENDENCIES which |
2424 |
12 Feb 11 |
peter |
# means ./configure will be re-run when OUTPUT is updated. Typically |
2424 |
12 Feb 11 |
peter |
# it is a good idea to check in OUTPUT in repository because then |
2424 |
12 Feb 11 |
peter |
# OUTPUT will get expected value also in 'svn export' case. You need |
2501 |
28 Jun 11 |
peter |
# to declare the following variables in Makefile.am: |
2424 |
12 Feb 11 |
peter |
# CONFIG_STATUS_DEPENDENCIES = |
2424 |
12 Feb 11 |
peter |
# EXTRA_DIST = |
2424 |
12 Feb 11 |
peter |
201 |
# |
2424 |
12 Feb 11 |
peter |
202 |
AC_DEFUN([YAT_SVN_RELEASE_YEAR], |
2424 |
12 Feb 11 |
peter |
203 |
[ |
2424 |
12 Feb 11 |
peter |
204 |
AC_REQUIRE([YAT_HAVE_SVN_WC]) |
2424 |
12 Feb 11 |
peter |
205 |
AC_REQUIRE([_YAT_PROG_SVNVERSION]) |
2424 |
12 Feb 11 |
peter |
206 |
AC_REQUIRE([YAT_PROG_MOVE_IF_CHANGE]) |
4329 |
12 Mar 23 |
peter |
207 |
AC_REQUIRE([AX_PROG_DATE]) |
2680 |
09 Jan 12 |
peter |
208 |
m4_pushdef([YAT_am_file], [m4_default([$1], [svn_release_year.am])]) |
2680 |
09 Jan 12 |
peter |
209 |
m4_pushdef([YAT_release_year], [m4_default([$2], [.release_year])]) |
2424 |
12 Feb 11 |
peter |
# .release_year is generated during make so in order to avoid bootstrap problem |
2680 |
09 Jan 12 |
peter |
211 |
test -r $srcdir/YAT_release_year || date -u "+%Y" > $srcdir/YAT_release_year |
2424 |
12 Feb 11 |
peter |
# propagate RELEASE_YEAR from file .release_year |
2680 |
09 Jan 12 |
peter |
213 |
RELEASE_YEAR=`cat "$srcdir/YAT_release_year"` |
2424 |
12 Feb 11 |
peter |
214 |
AC_SUBST([RELEASE_YEAR]) |
2680 |
09 Jan 12 |
peter |
215 |
AC_DEFINE_UNQUOTED([RELEASE_YEAR], ["$RELEASE_YEAR"], |
2424 |
12 Feb 11 |
peter |
216 |
[Define year package was last modified]) |
2424 |
12 Feb 11 |
peter |
dnl generate make rule for .release_year |
4326 |
12 Mar 23 |
peter |
218 |
_YAT_AM_LOCAL_WRITE(YAT_am_file,[ |
4326 |
12 Mar 23 |
peter |
219 |
EXTRA_DIST += $(srcdir)/]YAT_release_year[ |
4326 |
12 Mar 23 |
peter |
220 |
CONFIG_STATUS_DEPENDENCIES += $(srcdir)/]YAT_release_year[ |
2424 |
12 Feb 11 |
peter |
221 |
RELEASE_YEAR_FORCE: |
2424 |
12 Feb 11 |
peter |
222 |
if HAVE_SVN_WC |
2680 |
09 Jan 12 |
peter |
223 |
$(srcdir)/YAT_release_year: RELEASE_YEAR_FORCE |
2807 |
05 Aug 12 |
peter |
224 |
$(AM_V_at)if $(SVNVERSION) $(srcdir) | grep 'M' > /dev/null; then \ |
4326 |
12 Mar 23 |
peter |
225 |
date -u "+%Y" > ]$[@-t \ |
4326 |
12 Mar 23 |
peter |
226 |
&& $(MOVE_IF_CHANGE) ]$[@-t ]$[@; \ |
2424 |
12 Feb 11 |
peter |
227 |
fi |
2424 |
12 Feb 11 |
peter |
228 |
endif |
4326 |
12 Mar 23 |
peter |
229 |
]) |
2680 |
09 Jan 12 |
peter |
230 |
m4_popdef([YAT_am_file]) |
2680 |
09 Jan 12 |
peter |
231 |
m4_popdef([YAT_release_year]) |
2424 |
12 Feb 11 |
peter |
232 |
]) # YAT_SVN_RELEASE_YEAR |
2424 |
12 Feb 11 |
peter |
233 |
|
2424 |
12 Feb 11 |
peter |
234 |
|
4320 |
21 Feb 23 |
peter |
# YAT_SVN_TIMESTAMP([AM_FILE = svn_timestamp.am]) |
4320 |
21 Feb 23 |
peter |
236 |
# |
4320 |
21 Feb 23 |
peter |
# Create a file, AM_FILE, at Autoconf time that should be included in |
4320 |
21 Feb 23 |
peter |
# your top Makefile.am. The file contains rules for creation of a file |
4320 |
21 Feb 23 |
peter |
# '.timestamp' and associated '.svn_timestamp', |
4320 |
21 Feb 23 |
peter |
# '$(srcdir)/.svn_export_timestamp' and '$(srcdir)/.tarball_timestamp' |
4320 |
21 Feb 23 |
peter |
# depending on whether building from subversion working-copy, |
4320 |
21 Feb 23 |
peter |
# subversion export, or a tarball, respectively. The macro inherits |
4320 |
21 Feb 23 |
peter |
# the same requirements from YAT_SVN_REVISION and in addition the |
4320 |
21 Feb 23 |
peter |
# Makefile.am needs to define Automake variable |
4320 |
21 Feb 23 |
peter |
# yat_am_dist_hooks = |
4320 |
21 Feb 23 |
peter |
# and let the dist hook depend on this variable |
4320 |
21 Feb 23 |
peter |
# dist-hook: $(yat_am_dist_hooks) |
4319 |
21 Feb 23 |
peter |
248 |
AC_DEFUN([YAT_SVN_TIMESTAMP], |
4319 |
21 Feb 23 |
peter |
249 |
[ |
4319 |
21 Feb 23 |
peter |
250 |
AC_REQUIRE([YAT_HAVE_SVN_WC]) |
4323 |
22 Feb 23 |
peter |
251 |
AC_REQUIRE([YAT_SVN_REVISION]) |
4321 |
21 Feb 23 |
peter |
252 |
AC_REQUIRE([_YAT_PROG_SVN]) |
4329 |
12 Mar 23 |
peter |
253 |
AC_REQUIRE([AX_PROG_DATE]) |
4329 |
12 Mar 23 |
peter |
254 |
|
4329 |
12 Mar 23 |
peter |
255 |
AS_IF([test x"$have_svn_wc" = x"yes" && \ |
4329 |
12 Mar 23 |
peter |
256 |
test x"$ax_cv_prog_date_gnu_date" != x"yes" && |
4329 |
12 Mar 23 |
peter |
257 |
test x"$ax_cv_prog_date_bsd_date" != x"yes"], [ |
4329 |
12 Mar 23 |
peter |
258 |
AC_MSG_ERROR([ when building from subversion wc, the 'date' program needs to either be GNU data with support for --date= or BSD data with support for -r option.]) |
4329 |
12 Mar 23 |
peter |
259 |
]) |
4329 |
12 Mar 23 |
peter |
260 |
|
4329 |
12 Mar 23 |
peter |
261 |
AM_CONDITIONAL([HAVE_DATE_GNU_DATE], |
4329 |
12 Mar 23 |
peter |
262 |
[test x"$ax_cv_prog_date_gnu_date" = x"yes"]) |
4329 |
12 Mar 23 |
peter |
263 |
|
4319 |
21 Feb 23 |
peter |
264 |
m4_pushdef([YAT_AM_FILE], [m4_default([$1], [svn_timestamp.am])]) |
4319 |
21 Feb 23 |
peter |
265 |
|
4319 |
21 Feb 23 |
peter |
dnl create dummy file in 'svn export' |
4319 |
21 Feb 23 |
peter |
267 |
m4_syscmd([test -d .svn || test -r .tarball_timestamp \ |
4319 |
21 Feb 23 |
peter |
268 |
|| test -e .svn_export_timestamp \ |
4319 |
21 Feb 23 |
peter |
269 |
|| date +%s > .svn_export_timestamp]) |
4319 |
21 Feb 23 |
peter |
270 |
|
4320 |
21 Feb 23 |
peter |
271 |
AC_MSG_CHECKING([if .tarball_timestamp exists]) |
4320 |
21 Feb 23 |
peter |
272 |
have_tarball_timestamp=no |
4320 |
21 Feb 23 |
peter |
273 |
test -e $srcdir/.tarball_timestamp && have_tarball_timestamp=yes |
4320 |
21 Feb 23 |
peter |
274 |
AC_MSG_RESULT([$have_tarball_timestamp]) |
4320 |
21 Feb 23 |
peter |
275 |
|
4320 |
21 Feb 23 |
peter |
276 |
AC_MSG_CHECKING([if .svn_export_timestamp exists]) |
4320 |
21 Feb 23 |
peter |
277 |
have_svn_export_timestamp=no |
4320 |
21 Feb 23 |
peter |
278 |
test -e $srcdir/.svn_export_timestamp && have_svn_export_timestamp=yes |
4320 |
21 Feb 23 |
peter |
279 |
AC_MSG_RESULT([$have_svn_export_timestamp]) |
4320 |
21 Feb 23 |
peter |
280 |
|
4319 |
21 Feb 23 |
peter |
281 |
AS_IF([test x"$have_svn_wc" = x"yes"], [ |
4319 |
21 Feb 23 |
peter |
282 |
yat_timestamp_source=.svn_timestamp |
4320 |
21 Feb 23 |
peter |
283 |
], [test x"$have_svn_export_timestamp" = x"yes"], [ |
4320 |
21 Feb 23 |
peter |
284 |
yat_timestamp_source='$(srcdir)/.svn_export_timestamp' |
4320 |
21 Feb 23 |
peter |
285 |
], [test x"$have_tarball_timestamp" = x"yes"], [ |
4320 |
21 Feb 23 |
peter |
286 |
yat_timestamp_source='$(srcdir)/.tarball_timestamp' |
4319 |
21 Feb 23 |
peter |
287 |
], [ |
4320 |
21 Feb 23 |
peter |
288 |
AC_MSG_ERROR([cannot find required file; |
4320 |
21 Feb 23 |
peter |
289 |
both .tarball_timestamp and .svn_export_timestamp are missing]) |
4319 |
21 Feb 23 |
peter |
290 |
]) |
4319 |
21 Feb 23 |
peter |
291 |
AC_SUBST([yat_timestamp_source]) |
4319 |
21 Feb 23 |
peter |
292 |
|
4319 |
21 Feb 23 |
peter |
dnl write rules to create .timestamp |
4326 |
12 Mar 23 |
peter |
294 |
_YAT_AM_LOCAL_WRITE(YAT_AM_FILE,[ |
4319 |
21 Feb 23 |
peter |
## The .timestamp reflects the last change to the svn repo, i.e., it |
4319 |
21 Feb 23 |
peter |
## changes via 'svn update' or 'svn commit', which is a subset of when |
4319 |
21 Feb 23 |
peter |
## .revision changes and only need to update the .timestamp when |
4319 |
21 Feb 23 |
peter |
## .revision has changed. |
4319 |
21 Feb 23 |
peter |
299 |
if HAVE_SVN_WC |
4319 |
21 Feb 23 |
peter |
300 |
.svn_timestamp: $(srcdir)/.revision |
4331 |
12 Mar 23 |
peter |
301 |
if HAVE_DATE_GNU_DATE |
4319 |
21 Feb 23 |
peter |
302 |
$(AM_V_at)date=$($(SVN) info $(scrdir) --show-item last-changed-date --no-newline); \ |
4326 |
12 Mar 23 |
peter |
303 |
date +%s --date="$$date" > ]$[@ |
4331 |
12 Mar 23 |
peter |
304 |
else |
4329 |
12 Mar 23 |
peter |
305 |
$(AM_V_at)date=$($(SVN) info $(scrdir) --show-item last-changed-date --no-newline); \ |
4329 |
12 Mar 23 |
peter |
306 |
date +%s -r "$$date" > ]$[@ |
4329 |
12 Mar 23 |
peter |
307 |
endif |
4329 |
12 Mar 23 |
peter |
308 |
|
4319 |
21 Feb 23 |
peter |
309 |
DISTCLEANFILES += .svn_timestamp |
4319 |
21 Feb 23 |
peter |
310 |
endif |
4319 |
21 Feb 23 |
peter |
311 |
|
4319 |
21 Feb 23 |
peter |
312 |
.timestamp: $(yat_timestamp_source) |
4326 |
12 Mar 23 |
peter |
313 |
$(AM_V_at)cp $(yat_timestamp_source) ]$[@ |
4319 |
21 Feb 23 |
peter |
314 |
|
4319 |
21 Feb 23 |
peter |
315 |
CLEANFILES += .timestamp |
4319 |
21 Feb 23 |
peter |
316 |
|
4319 |
21 Feb 23 |
peter |
317 |
yat_am_dist_hooks += yat_dist_tarball_timestamp |
4319 |
21 Feb 23 |
peter |
318 |
|
4319 |
21 Feb 23 |
peter |
319 |
if HAVE_SVN_WC |
4319 |
21 Feb 23 |
peter |
320 |
yat_dist_tarball_timestamp: .timestamp |
4319 |
21 Feb 23 |
peter |
321 |
$(AM_V_at)cp .timestamp $(distdir)/.tarball_timestamp |
4319 |
21 Feb 23 |
peter |
322 |
else |
4319 |
21 Feb 23 |
peter |
# in case some does a dist from a non-wc, use 'now' as timestamp |
4319 |
21 Feb 23 |
peter |
# (rather than timestamp file in builddir, which reflects the date of |
4319 |
21 Feb 23 |
peter |
# the previous release) |
4319 |
21 Feb 23 |
peter |
326 |
yat_dist_tarball_timestamp: |
4319 |
21 Feb 23 |
peter |
327 |
date +%s > $(distdir)/.tarball_timestamp |
4319 |
21 Feb 23 |
peter |
328 |
endif |
4326 |
12 Mar 23 |
peter |
329 |
]) dnl end of writing automake segment |
4319 |
21 Feb 23 |
peter |
330 |
]) # YAT_SVN_TIMESTAMP |
4319 |
21 Feb 23 |
peter |
331 |
|
4319 |
21 Feb 23 |
peter |
332 |
|
2457 |
01 Apr 11 |
peter |
### Private Macros ### |
2424 |
12 Feb 11 |
peter |
334 |
|
2424 |
12 Feb 11 |
peter |
# _YAT_AM_TOP(FILE) |
2424 |
12 Feb 11 |
peter |
336 |
# |
2424 |
12 Feb 11 |
peter |
# Write the header of a Automake snippet with the copyright noticed |
2424 |
12 Feb 11 |
peter |
# decalared in top of this file. |
2424 |
12 Feb 11 |
peter |
339 |
AC_DEFUN([_YAT_AM_TOP], |
2424 |
12 Feb 11 |
peter |
340 |
[ |
2424 |
12 Feb 11 |
peter |
341 |
AC_PREREQ([2.62]) |
4326 |
12 Mar 23 |
peter |
342 |
YAT_AC_WRITE_TO_FILE([$1],dnl |
4326 |
12 Mar 23 |
peter |
343 |
[# $1 generated automatically by GNU Autoconf |
2425 |
12 Feb 11 |
peter |
344 |
]yat_am_macros_copyright[ |
2737 |
30 May 12 |
peter |
# stub rule to work around bug in Automake 1.11 |
4326 |
12 Mar 23 |
peter |
346 |
$(top_srcdir)/$1: |
2424 |
12 Feb 11 |
peter |
347 |
|
2424 |
12 Feb 11 |
peter |
348 |
]) |
2424 |
12 Feb 11 |
peter |
349 |
]) # _YAT_AM_TOP |
2424 |
12 Feb 11 |
peter |
350 |
|
2424 |
12 Feb 11 |
peter |
351 |
|
4326 |
12 Mar 23 |
peter |
# _YAT_AM_LOCAL_WRITE |
4326 |
12 Mar 23 |
peter |
353 |
# =================== |
4326 |
12 Mar 23 |
peter |
354 |
# |
4326 |
12 Mar 23 |
peter |
355 |
# |
4326 |
12 Mar 23 |
peter |
356 |
AC_DEFUN([_YAT_AM_LOCAL_WRITE], |
4326 |
12 Mar 23 |
peter |
357 |
[ m4_ifndef([YAT_AM_LOCAL_FILE], [ |
4326 |
12 Mar 23 |
peter |
358 |
_YAT_AM_TOP([$1]) |
4326 |
12 Mar 23 |
peter |
359 |
YAT_AC_APPEND_TO_FILE([$1], [$2]) |
4326 |
12 Mar 23 |
peter |
360 |
], [ |
4326 |
12 Mar 23 |
peter |
361 |
YAT_AC_APPEND_TO_FILE(YAT_AM_LOCAL_FILE, [$2]) |
4326 |
12 Mar 23 |
peter |
362 |
]) |
2424 |
12 Feb 11 |
peter |
363 |
]) |
2424 |
12 Feb 11 |
peter |
364 |
|
2424 |
12 Feb 11 |
peter |
365 |
|
4321 |
21 Feb 23 |
peter |
# _YAT_PROG_SVN |
4321 |
21 Feb 23 |
peter |
367 |
# |
4321 |
21 Feb 23 |
peter |
# Wrapper around AC_CHECK_PROG to allow using it as argument to |
4321 |
21 Feb 23 |
peter |
# AC_REQUIRE |
4321 |
21 Feb 23 |
peter |
370 |
AC_DEFUN([_YAT_PROG_SVN], |
4321 |
21 Feb 23 |
peter |
371 |
[ |
4321 |
21 Feb 23 |
peter |
372 |
AC_CHECK_PROG([SVN], [svn], [svn], [false]) |
4333 |
16 Mar 23 |
peter |
373 |
AC_ARG_VAR([SVN], [svn program]) |
4321 |
21 Feb 23 |
peter |
374 |
]) |
4321 |
21 Feb 23 |
peter |
375 |
|
4321 |
21 Feb 23 |
peter |
376 |
|
2680 |
09 Jan 12 |
peter |
# _YAT_PROG_SVNVERSION |
2424 |
12 Feb 11 |
peter |
378 |
# |
4321 |
21 Feb 23 |
peter |
# Wrapper around AC_CHECK_PROG to allow using it as argument to |
2424 |
12 Feb 11 |
peter |
# AC_REQUIRE |
2424 |
12 Feb 11 |
peter |
381 |
AC_DEFUN([_YAT_PROG_SVNVERSION], |
2424 |
12 Feb 11 |
peter |
382 |
[ |
4321 |
21 Feb 23 |
peter |
383 |
AC_CHECK_PROG([SVNVERSION], [svnversion], [svnversion], [false]) |
4333 |
16 Mar 23 |
peter |
384 |
AC_ARG_VAR([SVNVERSION], [svnversion command]) |
2424 |
12 Feb 11 |
peter |
385 |
]) |