fliX
fliX

Reputation: 813

EXTRA_DIST not considered on VPATH Build

I have a project with the following directory structure (simplified):

configure.ac
Makefile.am
samples
src/Makefile.am
tests/openssh_keys
tests/Makefile.am

The top-level Makefile.am has the following content:

EXTRA_DIST = $(srcdir)/tests/openssh_keys \
             $(srcdir)/samples
SUBDIRS = src . tests

The directory 'openssh_keys' in 'tests' contains data that is needed for the unit tests. When Im creating a package with 'make dist' all files mentioned in EXTRA_DIST are properly included in the package. Im getting into trouble when using 'make distcheck' as this creates a VPATH Build. Unfortunately the files mentioned in EXTRA_DIST are not copied leading to an error when the test-cases are run.

Anyone has a proper solution for including the files mentioned in EXTRA_DIST even in a VPATH Build?

Upvotes: 3

Views: 640

Answers (1)

Diego Elio Pettenò
Diego Elio Pettenò

Reputation: 3240

I'm not sure what the error you're receiving as you didn't report it, but I found your repository and taken a look (I would suggest you to take a look at what you're writing in configure.ac because it could be simplified, but that's a different topic.)

From what I can see in the code, the problem is that you're not actually providing the test binary with a path where to find the files, and it instead looks for it in CWD-relative fashion. But make distcheck (and many distributions) use out-of-tree builds in which $(srcdir) is not ., and thus it fails.

EXTRA_DIST will not help you: that only tells automake to copy the files in the tarball, but not out of $(srcdir) ever. You should instead provide the test code itself a way to know where $(srcdir) dir is. Since you're not using a test driver or script, the least-changes suggestion I'd have would be

pam_openssh_x509_check_CPPFLAGS = -DKEYSDIR="\"$(srcdir)/openssh_keys\""

and then change the test source to

    char *directory = KEYSDIR;
    char *oneliner = KEYSDIR "/ssh_rsa.txt";

so that it would find them in the relative path (../../tests/openssh_keys).

Upvotes: 4

Related Questions