1.3.1 Linux/Unix with GNU auto-conf/make

To integrate LYRIC into a project that will use the library’s features with the GNU autoconf and automake tools, a set of M4 macros have been writen and put in the lyric.m4 file. This file was installed in prefix/share/aclocal.

The first step is to copy the lyric.m4 file into your project. Then you will have to integrate it into the acinclude.m4 file for your project. This is usually done with a command like:


  % cat lyric.m4 >> acinclude.m4

It is recommended that you add some rules to distribute lyric.m4 and to have acinclude.m4 be rebuilt automatically in your project’s top level Makefile.am file. These lines read:


  EXTRA_DIST = lyric.m4 other.files
  acinclude.m4: lyric.m4 other.m4
          rm -f $@
          cat $^ > $@

Now that you have included the M4 macros to auto-detect LYRIC, you have to add the call to the autoconf functions stored in lyric.m4 in your configure.in file. There are two things to add to your configure.in file:

  1. Set the language to compile and link the configure test programs to C++ with AC_LANG_CPLUSPLUS.
  2. Call the AM_PATH_LYRIC function to get the compiler and linker flags to use, and substitute the found values in the various Makefiles.

Some lines to build LYRIC in your project from your configure.in file will read:


  # Checks for programs
  AC_PROG_CC
  AC_PROG_CPP
  AC_PROG_CXX
  AC_PROG_CXXCPP
  AC_PROG_INSTALL
  AC_PROG_RANLIB
  AC_PROG_MAKE_SET
  
  # Set language to compile/link config test programs
  AC_LANG_CPLUSPLUS
  
  # Checks for libraries
  AM_PATH_LYRIC([MINIMUM_VERSION],
                [ACTION_IF_FOUND],
                [ACTION_IF_NOT_FOUND])

Note that both ACTION_IF_FOUND and ACTION_IF_NOT_FOUND are optional. The minimal call to detect LYRIC paths is:


  AM_PATH_LYRIC([2.1.9])

This will auto detect LYRIC with release version being at least 2.1.9.

Finally you must add some rules to your Makefile.am.