Version 3 (modified by dmisev, 21 months ago) (diff)


Examples for autotools configuration

Below are two examples for introducing components which are compiled only optionally, through explicit specification of the corresponding parameter in the configure step (and before compilation through make).

HDF4 as optionally compiled package

Previous versions of rasdaman required that HDF4 libraries be installed on the system before rasdaman itself could be configured and, hence, successfully installed. However, getting and installing HDF4 libraries can be a daunting task. Making HDF4 support optional, therefore, can ease rasdaman system installation.

It is now possible to install rasdaman with/out HDF4 libraries. A configure parameter --with-hdf4 indicates that the corresponding libraries, libdf.a and libmhdf.a, are installed. Technically, if these libraries are found then variable HAVE_HDF gets assigned a value of 1. This variable is passed to the compiler where it controls conditional compilation in conversion/hdf.ccand conversion/ If --with-hdf4 is provided, but no HDF4 installed then an error message is generated.

If the user choses to configure rasdaman without invoking --with-hdf4 functionality, rasdaman will output a warning message that HDF4 presence was not checked but that the user would need them in order to use rasdaman.

To achieve this, the following piece of code that has been added in the script:

  [this feature enables the inclusion of hdf4 library during installation.])],

AC_MSG_NOTICE(using hdf4 library...$with_hdf4)

if test "$with_hdf4" == yes; then
  AC_CHECK_LIB([df], [main], ,[AC_MSG_FAILURE([--with-hdf4 was given but libdf.a was not found! Please install.])])
  AC_CHECK_LIB([mfhdf], [main], ,[AC_MSG_FAILURE([--with-hdf4 was given but libmfhdf.a was not found! Please install.])])

if test "\$with_hdf4" == no; then  ## the '\' is not part of the code 
  AC_MSG_NOTICE(Warning: presence of hdf4 libraries not checked. To run rasdaman you will need to have them installed!)

Further, in the conversion/ and conversion/ the conditional compilation variable HAVE_HDF has been included.

!NetCDF as ab optionally compiled package

Similarly, the following code in adds support for optional compilation of !NetCDF

      [this feature looks whether libnetcdf libraries are installed.])],

AC_MSG_NOTICE(checking for libnetcdf library...$with_hdf)

if test "$with_netcdf" == yes; then
  AC_CHECK_LIB([netcdf], [main], ,[AC_MSG_FAILURE([--with-netcdf was given but libnetcdf.a was not found! Please install.])])