Leo
Leo

Reputation: 2072

File copied by `make dist` but not by `make distcheck`

In a project built with GNU Autotools, I have a script that needs to modified by make to contain the installation path. Here's a small example:

configure.ac:

AC_INIT(foobar, 1.0)
AC_PREREQ(2.66)
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE(foreign)
AC_CONFIG_FILES([Makefile blah/Makefile])
AC_OUTPUT

Makefile.am:

SUBDIRS = blah

blah/Makefile.am:

all: myscript

myscript: myscript.in
        sed -e 's,@datadir\@,$(pkgdatadir),g' myscript.in > myscript
        chmod +x myscript

EXTRA_DIST = myscript.in

./configure; make successfully creates myscript. Ditto for make dist; tar xvzf foobar-1.0.tar.gz; cd foobar-1.0; ./configure; make. However, make distcheck fails because the file myscript.in is missing (but it is copied successfully with make dist).

Any ideas why the file myscript.in is not being copied by make distcheck?

Upvotes: 2

Views: 1008

Answers (1)

William Pursell
William Pursell

Reputation: 212374

myscript.in is in the distribution tarball, but make distcheck does a VPATH build in which configure is run from a different directory. eg, instead of "./configure", it is doing something akin to "mkdir build-dir; cd build-dir; /path/to/configure;" In Makefile.am, you need to replace instances of "myscript.in" in the myscript rule and dependency line with "$(srcdir)/myscript.in"

Upvotes: 7

Related Questions