mirror of
git://git.gnu.org.ua/wordsplit.git
synced 2025-04-26 00:29: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:
|
Modify the VPATH variable in your Makefile.am:
|
||||||
|
|
||||||
VPATH += $(srcdir)/wordsplit
|
VPATH = $(srcdir):$(srcdir)/wordsplit
|
||||||
|
|
||||||
Notice the use of "+=": it is necessary for the vpath builds to work.
|
|
||||||
|
|
||||||
Add wordsplit.c to the nodist_program_SOURCES variable:
|
Add wordsplit.c to the nodist_program_SOURCES variable:
|
||||||
|
|
||||||
|
@ -129,7 +127,7 @@ An example Makefile.am:
|
||||||
|
|
||||||
program_SOURCES = main.c
|
program_SOURCES = main.c
|
||||||
nodist_program_SOURCES = wordsplit.c
|
nodist_program_SOURCES = wordsplit.c
|
||||||
VPATH += $(srcdir)/wordsplit
|
VPATH = $(srcdir):$(srcdir)/wordsplit
|
||||||
EXTRA_DIST = wordsplit/wordsplit.c wordsplit/wordsplit.h
|
EXTRA_DIST = wordsplit/wordsplit.c wordsplit/wordsplit.h
|
||||||
AM_CPPFLAGS = -I$(srcdir)/wordsplit
|
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
|
program_SOURCES = main.c
|
||||||
LDADD = wordsplit.o
|
LDADD = wordsplit.o
|
||||||
VPATH += $(srcdir)/wordsplit
|
VPATH = $(srcdir):$(srcdir)/wordsplit
|
||||||
EXTRA_DIST = wordsplit/wordsplit.c wordsplit/wordsplit.h
|
EXTRA_DIST = wordsplit/wordsplit.c wordsplit/wordsplit.h
|
||||||
AM_CPPFLAGS = -I$(srcdir)/wordsplit
|
AM_CPPFLAGS = -I$(srcdir)/wordsplit
|
||||||
|
|
||||||
|
@ -153,10 +151,14 @@ already has an autotest-based testsuite.
|
||||||
|
|
||||||
** Additional files
|
** Additional files
|
||||||
|
|
||||||
To build the auxiliary tool wsp, you will need an additional file,
|
To build the auxiliary tool wsp, it is recommended to define the
|
||||||
wordsplit-version.h. Normally, it should contain only a definition
|
WORDSPLIT_VERSION macro to the actual version of the wordsplit
|
||||||
of the macro or variable WORDSPLIT_VERSION. The following shell
|
package. There are two ways of doing so. First, you can define
|
||||||
fragment can be used to create it:
|
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)
|
version=$(cd wordsplit; git describe)
|
||||||
cat > wordsplit-version.h <<EOF
|
cat > wordsplit-version.h <<EOF
|
||||||
|
@ -199,15 +201,15 @@ Then, add the following fragment to build the auxiliary files:
|
||||||
else \
|
else \
|
||||||
wsversion="unknown"; \
|
wsversion="unknown"; \
|
||||||
fi;\
|
fi;\
|
||||||
echo "#define WORDSPLIT_VERSION \"$wsversion\"";\
|
echo "#define WORDSPLIT_VERSION \"$wsversion\""; } > \
|
||||||
echo '#include <mailutils/wordsplit.h>'; } > \
|
|
||||||
> $(srcdir)/wordsplit-version.h
|
> $(srcdir)/wordsplit-version.h
|
||||||
|
|
||||||
|
AM_CPPFLAGS += -DHAVE_WORDSPLIT_VERSION_H
|
||||||
noinst_PROGRAMS += wsp
|
noinst_PROGRAMS += wsp
|
||||||
wsp_SOURCES =
|
wsp_SOURCES =
|
||||||
nodist_wsp_SOURCES = wsp.c
|
nodist_wsp_SOURCES = wsp.c
|
||||||
wsp.o: $(srcdir)/wordsplit-version.h
|
wsp.o: $(srcdir)/wordsplit-version.h
|
||||||
VPATH += $(top_srcdir)/libmailutils/wordsplit
|
VPATH = $(srcdir):$(top_srcdir)/wordsplit
|
||||||
|
|
||||||
* History
|
* History
|
||||||
|
|
||||||
|
|
10
wsp.c
10
wsp.c
|
@ -22,7 +22,11 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.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"
|
#include "wordsplit.h"
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
@ -96,6 +100,10 @@ struct wsopt
|
||||||
/* Index of the next argument in the argv */
|
/* Index of the next argument in the argv */
|
||||||
static int wsoptind = -1;
|
static int wsoptind = -1;
|
||||||
|
|
||||||
|
#ifndef WORDSPLIT_VERSION
|
||||||
|
# define "WORDSPLIT_VERSION not defined"
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
print_version (void)
|
print_version (void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue