mirror of
git://git.gnu.org.ua/wordsplit.git
synced 2025-04-25 16:19:54 +03:00
Change in the testsuite
* wsp.c: Include wordsplit-version.h only if HAVE_WORDSPLIT_VERSION_H is defined and WORDSPLIT_VERSION is not. * README: Fix VPATH and WORDSPLIT_VERSION documentation.
This commit is contained in:
parent
6ab5387624
commit
403b1c769f
2 changed files with 23 additions and 13 deletions
26
README
26
README
|
@ -109,9 +109,7 @@ wordsplit API, install wordsplit.h to $(pkgincludedir), e.g.
|
|||
|
||||
Modify the VPATH variable in your Makefile.am:
|
||||
|
||||
VPATH += $(srcdir)/wordsplit
|
||||
|
||||
Notice the use of "+=": it is necessary for the vpath builds to work.
|
||||
VPATH = $(srcdir):$(srcdir)/wordsplit
|
||||
|
||||
Add wordsplit.c to the nodist_program_SOURCES variable:
|
||||
|
||||
|
@ -129,7 +127,7 @@ An example Makefile.am:
|
|||
|
||||
program_SOURCES = main.c
|
||||
nodist_program_SOURCES = wordsplit.c
|
||||
VPATH += $(srcdir)/wordsplit
|
||||
VPATH = $(srcdir):$(srcdir)/wordsplit
|
||||
EXTRA_DIST = wordsplit/wordsplit.c wordsplit/wordsplit.h
|
||||
AM_CPPFLAGS = -I$(srcdir)/wordsplit
|
||||
|
||||
|
@ -137,7 +135,7 @@ It is also possible to use LDADD as shown in the example below:
|
|||
|
||||
program_SOURCES = main.c
|
||||
LDADD = wordsplit.o
|
||||
VPATH += $(srcdir)/wordsplit
|
||||
VPATH = $(srcdir):$(srcdir)/wordsplit
|
||||
EXTRA_DIST = wordsplit/wordsplit.c wordsplit/wordsplit.h
|
||||
AM_CPPFLAGS = -I$(srcdir)/wordsplit
|
||||
|
||||
|
@ -153,10 +151,14 @@ already has an autotest-based testsuite.
|
|||
|
||||
** Additional files
|
||||
|
||||
To build the auxiliary tool wsp, you will need an additional file,
|
||||
wordsplit-version.h. Normally, it should contain only a definition
|
||||
of the macro or variable WORDSPLIT_VERSION. The following shell
|
||||
fragment can be used to create it:
|
||||
To build the auxiliary tool wsp, it is recommended to define the
|
||||
WORDSPLIT_VERSION macro to the actual version of the wordsplit
|
||||
package. There are two ways of doing so. First, you can define
|
||||
WORDSPLIT_VERSION in your config.h or pass its definition via the
|
||||
AM_CPPFLAGS variable. Secondly, you can create an additional file,
|
||||
wordsplit-version.h, containing its definition and define the
|
||||
HAVE_WORDSPLIT_VERSION_H macro to make sure it is included. The
|
||||
following shell fragment can be used to create the header:
|
||||
|
||||
version=$(cd wordsplit; git describe)
|
||||
cat > wordsplit-version.h <<EOF
|
||||
|
@ -199,15 +201,15 @@ Then, add the following fragment to build the auxiliary files:
|
|||
else \
|
||||
wsversion="unknown"; \
|
||||
fi;\
|
||||
echo "#define WORDSPLIT_VERSION \"$wsversion\"";\
|
||||
echo '#include <mailutils/wordsplit.h>'; } > \
|
||||
echo "#define WORDSPLIT_VERSION \"$wsversion\""; } > \
|
||||
> $(srcdir)/wordsplit-version.h
|
||||
|
||||
AM_CPPFLAGS += -DHAVE_WORDSPLIT_VERSION_H
|
||||
noinst_PROGRAMS += wsp
|
||||
wsp_SOURCES =
|
||||
nodist_wsp_SOURCES = wsp.c
|
||||
wsp.o: $(srcdir)/wordsplit-version.h
|
||||
VPATH += $(top_srcdir)/libmailutils/wordsplit
|
||||
VPATH = $(srcdir):$(top_srcdir)/wordsplit
|
||||
|
||||
* History
|
||||
|
||||
|
|
10
wsp.c
10
wsp.c
|
@ -22,7 +22,11 @@
|
|||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include "wordsplit-version.h"
|
||||
#ifndef WORDSPLIT_VERSION
|
||||
# ifdef HAVE_WORDSPLIT_VERSION_H
|
||||
# include "wordsplit-version.h"
|
||||
# endif
|
||||
#endif
|
||||
#include "wordsplit.h"
|
||||
|
||||
extern char **environ;
|
||||
|
@ -96,6 +100,10 @@ struct wsopt
|
|||
/* Index of the next argument in the argv */
|
||||
static int wsoptind = -1;
|
||||
|
||||
#ifndef WORDSPLIT_VERSION
|
||||
# define "WORDSPLIT_VERSION not defined"
|
||||
#endif
|
||||
|
||||
void
|
||||
print_version (void)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue