John Levon wrote:
We have a C program which links to a C++ library, and we need to
tell automake to do the link in C++ mode to avoid undefined references
to the C++ standard library. How can we do it ?

The Makefile.am looks as follows :

---snip---
dist_sources = oprofiled.c opd_stats.c opd_kernel.c opd_image.c opd_sample_files.c \
opd_image.h opd_printf.h opd_stats.h opd_kernel.h opd_sample_files.h p_module.h
EXTRA_DIST = $(dist_sources)
if kernel_support
AM_CPPFLAGS=-I ${top_srcdir}/libabi -I ${top_srcdir}/libutil -I ${top_srcdir}/libop -I ${top_srcdir}/libdb
bin_PROGRAMS = oprofiled
oprofiled_SOURCES = $(dist_sources)
if enable_abi
oprofiled_LDADD = ../libabi/libabi.a ../libdb/libdb.a ../libop/libop.a ../libutil/libutil.a
else
oprofiled_LDADD = ../libdb/libdb.a ../libop/libop.a ../libutil/libutil.a
endif
endif
---snip---

libabi is the C++ library. It would be good to have a solution that
works for automake 1.5 upwards ...

You could always just add -lstdc++ to the oprofiled_LDADD variable.

(also, what is the "preferred" way to add a C/C++ flag from configure.in
?)

--[disable|enable]-c++ :) I'd have to do research and don't know off the top of my head. Perhaps the autoconf manual would be of help.

Earnie.



Reply via email to