Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to put helper-scripts with GNU autoconf/automake?

I'm working on a project that will be distributed with GNU autoconf/automake, and I have a set of bash scripts which call awk scripts. I would like the bash scripts to end up in the $PATH, but not the awk scripts. How should I insert these into the project? Should they be put in with other binaries?

Also, is there a way to determine the final location of the file after installation? I presume that /usr/local/bin isn't always where the executables end up...

like image 350
user17925 Avatar asked Jun 10 '26 12:06

user17925


1 Answers

You can just list the scripts that you want to be installed in Makefile.am:

bin_SCRIPTS = foo bar

This will cause foo and bar to be installed during make install. To get the path to their final location, you can use @bindir@ in foo.in and let configure build foo for you. For example, in configure.ac:

AC_CONFIG_FILES([foo bar])

and then in foo.in:

#!/bin/sh

prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
echo bindir = $bindir

Keep in mind that the person running configure may specify any of --prefix, --exec_prefix, or --bindir, and the installation may be redirected with a DESTDIR. Using the technique described here, DESTDIR will not be taken into account and the script will be installed in a location other than the path that it will echo. This is by design, and is the correct behavior, as usually a DESTDIR installation is used to create a tarball that will eventually be unpacked into the filesystem in such a way that the bindir in the script becomes valid.

like image 194
William Pursell Avatar answered Jun 15 '26 01:06

William Pursell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!