Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuration files and log files installation with automake

Tags:

automake

Let's say I have a project like that:

(dev dir)
- README
- INSTALL
/ src
  - blah.cpp
  - blah.hpp
/ conf
  - blah_one.xml
  - blah_two.xml

I made out a configure.ac and Makefile.am to install binaries under (/usr/local)/bin . configure.ac is something like:

AC_INIT([blah], [0.1])
AC_PREREQ([2.67])
AM_INIT_AUTOMAKE([1.11])
AC_CONFIG_SRCDIR([src/blah.cpp])
AC_PROG_CXX
AC_LANG([C++])
AC_HEADER_STDC
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_OUTPUT

... Makefile is something like

SUBDIRS = src

...and src/Makefile.am is something like

bin_PROGRAMS = blah
blah_SOURCES = blah.cpp blah.hpp

It all works, and "make install" correctly install the binary under (/usr/local)/bin.

Now:

I want extend these to make the command "make install" (after configure, build and whatsoever) to install configuration files blah_one.xml and blah_two.xml under /etc/blah, and to "prepare" a log directory under /var/log/blah/

What is the correct way to do it?

like image 868
ElementalStorm Avatar asked Aug 25 '11 12:08

ElementalStorm


People also ask

What is an automake file?

Automake is a tool for automatically generating Makefile.in s from files called Makefile.am . Each Makefile.am is basically a series of make variable definitions1, with rules being thrown in occasionally. The generated Makefile.in s are compliant with the GNU Makefile standards.

What is the use of automake?

automake is a tool used for automatically generating Makefile.in files compliant with the set GNU Coding Standards. autoconf is required for the use of automake. automake manual can either be read on-line or downloaded in the PDF format. More formats are also offered for download or on-line reading.

What is configure AC file?

The configure.ac file is used to create the ./configure script. It consists of a series of macros which are processed and expanded by autoconf . These macros can check for packages and libraries, handle --enable and --with switches, and generate various files.


1 Answers

Well, I'd do this:

blahconfdir=$(sysconfdir)/blah
blahconf_DATA = blah_one.xml blah_two.xml
blahlogdir = $(localstatedir)/log/blah

then when you configure:

./configure --sysconfdir=/etc --localstatedir=/var

Without knowing details of your "prepare" step, it's hard to know what needs to happen, and how to get it to happen.

like image 187
ldav1s Avatar answered Sep 24 '22 15:09

ldav1s