Distributing scripts using autotools
I would like to distribute my startup script with my app. Its called "blah" and it resides in the scripts/ folder of my project. I have this in my configure.ac:
...
AC_CONFIG_FILES([
Makefile
开发者_如何学运维scripts/Makefile
....
])
AC_CONFIG_FILES([scripts/blah], [chmod +x scripts/blah])
AC_OUTPUT
In the scripts directory I do have the following Makefile.am:
dist_bin_SCRIPTS = blah
CLEANFILES = $(bin_SCRIPTS)
In the same dir I do have "blah.in" file.
But when I do "make install" it does create scripts/blah, bot does not install it to the /usr/local/bin directory. What is wrong with my setup? Thanks
If you have AC_CONFIG_FILES([scripts/blah], ...)
to create script/blah
from script/blah.in
then you should only distribute script/blah.in
(this happens automatically as a side effect of using AC_CONFIG_FILES
) and not distribute script/blah
.
Your Makefile
should read
bin_SCRIPTS = blah # not dist_bin_SCRIPTS
CLEANFILES = $(bin_SCRIPTS)
If you simply want to distribute and install the script as-is, without generating it with configure
, use only
dist_bin_SCRIPTS = blah
and omit CLEANFILES
as well as the AC_CONFIG_FILES
line.
Now this is not your real bug. Looking at your github files I can see that scripts
does not appear in the SUBDIRS
variable of your root Makefile.am
. Therefore make install
is not recursing into that subdirectory and does not install the script.
Are you sure you need to specify:
AC_CONFIG_FILES([scripts/blah], [chmod +x scripts/blah])
?
For me, autotools generate blah.in, because they think, you blah script is a makefile. Try removing this line, tell what happens.
精彩评论