cu/installdirs.h: Installation Directories
[Utilities]

Data Structures

struct  cu_installdir
struct  cu_installdirs

Typedefs

typedef struct cu_installdircu_installdir_t
typedef struct cu_installdirscu_installdirs_t

Enumerations

enum  cu_installdir_key_t {
  CU_INSTALLDIR_PREFIX, CU_INSTALLDIR_EXEC_PREFIX, CU_INSTALLDIR_BINDIR, CU_INSTALLDIR_SBINDIR,
  CU_INSTALLDIR_LIBEXECDIR, CU_INSTALLDIR_SYSCONFDIR, CU_INSTALLDIR_SHAREDSTATEDIR, CU_INSTALLDIR_LOCALSTATEDIR,
  CU_INSTALLDIR_LIBDIR, CU_INSTALLDIR_INCLUDEDIR, CU_INSTALLDIR_DATAROOTDIR, CU_INSTALLDIR_DATADIR,
  CU_INSTALLDIR_INFODIR, CU_INSTALLDIR_LOCALEDIR, CU_INSTALLDIR_MANDIR, CU_INSTALLDIR_DOCDIR,
  CU_INSTALLDIR_HTMLDIR, CU_INSTALLDIR_DVIDIR, CU_INSTALLDIR_PDFDIR, CU_INSTALLDIR_PSDIR,
  CU_INSTALLDIR_NONE
}

Functions

void cu_installdirs_set (cu_installdirs_t installdirs, cu_installdir_key_t key, char const *dir)
cu_bool_t cu_installdirs_set_byname (cu_installdirs_t installdirs, char const *name, char const *dir)
void cu_installdirs_set_byenv (cu_installdirs_t installdirs, char const *var_prefix)
char const * cu_installdirs_get (cu_installdirs_t installdirs, cu_installdir_key_t key)
void cu_installdirs_finish (cu_installdirs_t installdirs)
void cu_installdirs_reset (cu_installdirs_t installdirs)
void cu_installdirs_dump (cu_installdirs_t installdirs)
char const * cuconf_get_installdir (cu_installdir_key_t key)

Detailed Description

This provides a way for an application or library to manage its installation directories. Prefix substitutions are handled by allowing each directory to refer to any of the others as its prefix.

A C source file which defines cu_installdirs_t with preliminary initialisation for a package is generated by invoking the Autoconf macro

 CUAC_CONFIG_INSTALLDIRS(foo_installdirs.c, foo_installdirs)

Then foo_installdirs can be used as

 #include <cu/installdirs.h>

 extern struct cu_installdirs foo_installdirs;

 void foo_init(void)
 {
     // ...
     cu_installdirs_finish(&foo_installdirs);
     // ...
 }

 char const *foo_get_installdir(cu_installdir_key_t key)
 {
     return foo_installdirs[key].dir;
 }

Typedef Documentation

An array describing the installation directories of a package.


Enumeration Type Documentation

A reference to one of the installation directories in cu_installdirs_t. In the following, typical values for a prefix of /usr are shown in paretheses.

Enumerator:
CU_INSTALLDIR_PREFIX 

The ${prefix} (/usr)

CU_INSTALLDIR_EXEC_PREFIX 

The ${exec_prefix} (/usr)

CU_INSTALLDIR_BINDIR 

The ${bindir} (/usr/bin)

CU_INSTALLDIR_SBINDIR 

The ${sbindir} (/usr/sbin)

CU_INSTALLDIR_LIBEXECDIR 

The ${libexecdir} (/usr/libexec)

CU_INSTALLDIR_SYSCONFDIR 

The ${sysconfdir} (/etc)

CU_INSTALLDIR_SHAREDSTATEDIR 

The ${sharedstatedir} (/var/com)

CU_INSTALLDIR_LOCALSTATEDIR 

The ${localstatedir} (/var/lib)

CU_INSTALLDIR_LIBDIR 

The ${libdir} (/usr/lib)

CU_INSTALLDIR_INCLUDEDIR 

The ${includedir} (/usr/include)

CU_INSTALLDIR_DATAROOTDIR 

The ${datarootdir} (/usr/share)

CU_INSTALLDIR_DATADIR 

The ${datadir} (/usr/share)

CU_INSTALLDIR_INFODIR 

The ${infodir} (/usr/share/info)

CU_INSTALLDIR_LOCALEDIR 

The ${localedir} (/usr/share/locale)

CU_INSTALLDIR_MANDIR 

The ${mandir} (/usr/share/man)

CU_INSTALLDIR_DOCDIR 

The ${docdir} (/usr/share/doc/foo-1.0)


Function Documentation

void cu_installdirs_dump ( cu_installdirs_t  installdirs  ) 

Prints out installdirs.

void cu_installdirs_finish ( cu_installdirs_t  installdirs  ) 

Completes the dir fields of the application's installation directory mapping, assuming the first two components have been initialised. This function is typically called during program initialisation.

char const* cu_installdirs_get ( cu_installdirs_t  installdirs,
cu_installdir_key_t  key 
)

Return the directory identified by key from installdirs.

void cu_installdirs_set ( cu_installdirs_t  installdirs,
cu_installdir_key_t  key,
char const *  dir 
)

Set the installation directory indicated by key to dir. The directory may be a prefix for other directories, in which case cu_installdirs_finish will substitute it. This function must be called before cu_installdirs_finish.

void cu_installdirs_set_byenv ( cu_installdirs_t  installdirs,
char const *  var_prefix 
)

Set installdirs according to environment variables named var_prefix followed by the common installation directory names. If var_prefix starts with an uppercase, the directory names are uppercased as well. E.g. calling cu_installdirs_set_byenv(&mydirs, "MYAPP_") will pick up $MYAPP_PREFIX, $MYAPP_EXEC_PREFIX, $MYAPP_SYSCONFDIR, etc. This function must be called before cu_installdirs_finish.

cu_bool_t cu_installdirs_set_byname ( cu_installdirs_t  installdirs,
char const *  name,
char const *  dir 
)

If found, sets the configuration directory named name in lowercase to dir and returns true, else returns false. This function must be called before cu_installdirs_finish.

char const* cuconf_get_installdir ( cu_installdir_key_t  key  ) 

The culibs installation directory key.

Generated 2009-11-23 for culibs-0.25 using Doxygen. Maintained by Petter Urkedal.