An Autotools-based build system affords you two main alternatives: you may specify the installation prefix (and other installation locations) either at configuration time or at build time.
To specify at configuration time, you use the --prefix
option to the configure
script, as ./configure --help
will describe to you. For example,
./configure --prefix=/opt/mypackage
Typically, one then proceeds with unadorned
make
sudo make install
To specify at build time, you configure without the --prefix
option, maybe simply
./configure
then you specify the prefix via the corresponding make
variable. It might in some cases suffice to specify it only to make install
, but in others you need to specify it to both make
runs, so it is wisest to adopt that as a general rule:
make prefix=/opt/mypackage
sudo make install prefix=/opt/mypackage
I note also that nothing should be installed directly in /opt
-- that is, /opt/bin
, /opt/lib
, etc. It ought instead to be installed in per-package subdirectories of /opt
, possibly even grouped under provider-associated subdirectories.