gcov: producing .gcda output from shared library?

I finally solved this problem by getting some help from the gcc guys. See the thread here: http://gcc.gnu.org/ml/gcc-help/2010-09/msg00130.html. It turns out that the .gcda files were being put in the .libs directory since that’s where the shared library (.so) files were. In order to get gcov to produce the output, I had to move the … Read more

Any difference between configure.ac and configure.in, and Makefile.am and Makefile.in?

configure.ac and configure.in are two possible names for the master Autoconf source file, which is processed by autoconf to generate the configure shell script. configure.ac is preferred for new packages, configure.in is an older name which still works. (The .in suffix is now recommended to be used only for files which will be processed by … Read more

Automake error ‘./ltmain.sh’ not found

In an autoconf/automake/libtool project you need to run: libtoolize: this copies/links a few support scripts, including ltmain.sh (which is the main component of libtool). aclocal: this looks up all m4 macros that your configure script will need, and make a local copy for easier access. autoheader: optional, if you want to use config.h/AC_CONFIG_HEADERS, otherwise all … Read more

What is the difference between LDADD and LIBADD?

Use the LIBADD primary for libraries, and LDADD for executables. If you were building a libtool library libfoo.la, that depended on another library libbar.la, you would use: libfoo_la_LIBADD = libbar.la If you had other non-libtool libraries, you would also add these with -L and -l options: libfoo_la_LIBADD = libbar.la -L/opt/local/lib -lpng Typically, you would use … Read more

Append compile flags to CFLAGS and CXXFLAGS while configuration/make

You almost have it right; why did you add the semicolon? To do it on the configure line: ./configure CFLAGS=’-g -O2 -w’ CXXFLAGS=’-g -O2 -w’ To do it on the make line: make CFLAGS=’-g -O2 -w’ CXXFLAGS=’-g -O2 -w’ However, that doesn’t really remove consider all warnings as errors; that removes all warnings. So specifying … Read more

Directory structure for a C++ library

One thing that’s very common among Unix libraries is that they are organized such that: ./ Makefile and configure scripts. ./src General sources ./include Header files that expose the public interface and are to be installed ./lib Library build directory ./bin Tools build directory ./tools Tools sources ./test Test suites that should be run during … Read more