Adding a custom installation directory option to configure scripts created with Autoconf

configure In an accompanying message, scripts always include something like the following in the message:

  ...
 By default, `make install 'will install all the files in
 `/ usr / local / bin ',` / usr / local / lib' etc.  You can specify
 an installation prefix other than `/ usr / local 'using` --prefix',
 for instance `--prefix = $ HOME '.

 For better control, use the options below.

 Fine tuning of the installation directories:
   --bindir = DIR user executables [EPREFIX / bin]
   --sbindir = DIR system admin executables [EPREFIX / sbin]
   --libexecdir = DIR program executables [EPREFIX / libexec]
   --sysconfdir = DIR read-only single-machine data [PREFIX / etc]
   --sharedstatedir = DIR modifiable architecture-independent data [PREFIX / com]
   --localstatedir = DIR modifiable single-machine data [PREFIX / var]
   --libdir = DIR object code libraries [EPREFIX / lib]
   --includedir = DIR C header files [PREFIX / include]
   --oldincludedir = DIR C header files for non-gcc [/ usr / include]
   --datarootdir = DIR read-only arch.-independent data root [PREFIX / share]
   --datadir = DIR read-only architecture-independent data [DATAROOTDIR]
   --infodir = DIR info documentation [DATAROOTDIR / info]
   --localedir = DIR locale-dependent data [DATAROOTDIR / locale]
   --mandir = DIR man documentation [DATAROOTDIR / man]
   --docdir = DIR documentation root
                           [DATAROOTDIR / doc / gedit-line-ending-style-plugin]
   --htmldir = DIR html documentation [DOCDIR]
   --dvidir = DIR dvi documentation [DOCDIR]
   --pdfdir = DIR pdf documentation [DOCDIR]
   --psdir = DIR ps documentation [DOCDIR]

 Program names:
   --program-prefix = PREFIX prepend PREFIX to installed program names
 ...

What I would like to do is add "plugindir" to this section, as in:

  ...
   --dvidir = DIR dvi documentation [DOCDIR]
   --pdfdir = DIR pdf documentation [DOCDIR]
   --psdir = DIR ps documentation [DOCDIR]
   --plugindir = DIR Gedit plugin files [LIBDIR / gedit-2 / plugins]
 ...

so that users can pass --plugindir=... to the script configuration.

How can i do this?

+6
install autoconf automake configure
source share
3 answers

If I am right, these paths are set in the file share / autoconf / autoconf / general.m4. The list is hard-coded, so it’s hard to insert items into the list. You can add additional help information using the AS_HELP_STRING macro. There are a few examples that add plugindir, for example to gstreamer , gimp , but they do not have a custom plugins directory.

0
source share

Put the following lines in configure.ac , next to the beginning:

 AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir=DIR], [pkgconfig files])], [pkgconfigdir=$withval], [pkgconfigdir="\${libdir}/pkgconfig"]) AC_SUBST([pkgconfigdir], [$pkgconfigdir]) 

Then in Makefile.am you can access the directory as follows:

 pkgconfigdir = @ pkgconfigdir@ pkgconfig_DATA = mylibrary.pc 
+3
source share

I think you are on the right track with AC_SUBST.

Also, I think you can change or expand the -help configure output with AS_HELP_STRING.

See: http://www.gnu.org/s/hello/manual/autoconf/Pretty-Help-Strings.html

0
source share

All Articles