[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
creating C++ libs contitionally
From: |
Mattias Barthel |
Subject: |
creating C++ libs contitionally |
Date: |
Wed, 16 Feb 2005 18:50:10 +0100 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
Hello.
I am passing my Makefile.am's from 1.4 to 1.6.
Doing this I have encountered numerous incompatibility problems.
First when starting with 1.4, a part of the problem I bumped in to was
that libtool did not really understand .dll as an extension of a lib,
me having to make the Makefiles compatible with Windows.
The libs for Windows could also not be dependent of cygwin even tough
the compiling environment was cygwin.
Also, beeing C++ code libraries I could not use the
AC_LIBTOOL_WIN32_DLL macro in configure.in because
it seems to be dependent of that the lib is
writtien in C.
Finally I succeded to create a Makefile.am that "worked"
in both environments except for a small warning from automake.
"automake: perl/Makefile.am: `vhcore.dll' is not a standard libtool
library name"
But that was'nt really critical.
Here is one example that works for automake 1.4:
-------------------------------
AUTOMAKE_OPTIONS = foreign
basename = libbkswigptr
corename = $(basename)
INCLUDES = -I$(top_srcdir)/include -I$(PY_INC_DIR) -I.
CXXFLAGS = @CXXFLAGS@ -DSWIG_GLOBAL_MAPPING
includeswigdir = $(prefix)/include/vh/swig
includeswig_DATA = swigptr.swg
macropkglibdir = $(libdir)/$(MACRO_PACKAGE)
WANTED_LIBS = @WANTED_LIBS@
EXTRA_LTLIBRARIES = libbkswigptr.dll libbkswigptr.la
macropkglib_LTLIBRARIES = $(WANTED_LIBS)
libbkswigptr_dll_SOURCES = \
bkswigptr.cpp
libbkswigptr_dll_LDFLAGS = -shared -avoid-version -lstdc++
libbkswigptr_la_SOURCES = $(libbkswigptr_dll_SOURCES)
libbkswigptr_la_LDFLAGS = -avoid-version -lstdc++
CLEANFILES = *~
if INST_HOOK
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $(WANTED_LIBS)
else
CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS)
$(LDFLAGS) -o $@ -rpath $(macropkglibdir)
endif
MAINTAINERCLEANFILES = Makefile.in
------------------------------------------------------------------------------
INST_HOOK is a AM_CONDITIONAL which decides the type of linking
to be used in wether cygwin or Linux. Because libtool does not
understand C++ linking for Windows I am overriding CXXLINK in that case.
Changing some stuff in this Makefile.am I got it through automake 1.6
but now it doesn't compile.
New Makefile.am:
------------------------------------------------------------------------------
AUTOMAKE_OPTIONS = foreign
basename = libbkswigptr
corename = $(basename)
INCLUDES = -I$(top_srcdir)/include -I$(PY_INC_DIR) -I.
CXXFLAGS = @CXXFLAGS@ -DSWIG_GLOBAL_MAPPING
SOURCES = bkswigptr.cpp
if INST_HOOK
MYLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $(WANTED_LIBS)
else
MYLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS)
$(LDFLAGS) -o $@
endif
CXXLINK = $(MYLINK)
includeswigdir = $(prefix)/include/vh/swig
includeswig_DATA = swigptr.swg
macropkglibdir = $(libdir)/$(MACRO_PACKAGE)
WANTED_LIBS = @WANTED_LIBS@
EXTRA_LTLIBRARIES = libbkswigptr.la libbkswigptr.dll
macropkglib_LTLIBRARIES = $(WANTED_LIBS)
libbkswigptr_la_SOURCES = bkswigptr.cpp
libbkswigptr_la_LDFLAGS = -avoid-version -lstdc++ -rpath $(macropkglibdir)
libbkswigptr_dll_SOURCES = $(libbkswigptr_la_SOURCES)
libbkswigptr_dll_LDFLAGS = -shared -avoid-version -lstdc++
libbkswigptr_dll_CXXFLAGS = $(AM_CXXFLAGS)
CLEANFILES = *~
MAINTAINERCLEANFILES = Makefile.in
-------------------------------------
The question is, why does the Makefile
generated from the new Makefile.am not compile?
See output:
------------------------------------------------------------------------------
$ make
source='bkswigptr.cpp' object='bkswigptr.lo' libtool=yes \
depfile='.deps/bkswigptr.Plo' tmpdepfile='.deps/bkswigptr.TPlo' \
depmode=none /bin/sh ../config/depcomp \
/bin/sh ../libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I.
-I../config -I../include -I -I. -g -O2 -DSWIG_GLOBAL_MAPPING -c -o
bkswigptr.lo `test -f 'bkswigptr.cpp' || echo './'`bkswigptr.cpp
/bin/sh ../libtool --mode=link g++ -g -O2 -DSWIG_GLOBAL_MAPPING -o
libbkswigptr.la -avoid-version -lstdc++ -rpath /tmp/lib/vh bkswigptr.lo
mkdir .libs
rm -fr .libs/libbkswigptr.la .libs/libbkswigptr.* .libs/libbkswigptr.*
(cd . && ln -s bkswigptr.lo bkswigptr.o)
gcc -shared bkswigptr.lo -lstdc++ -Wl,-soname -Wl,libbkswigptr.so -o
.libs/libbkswigptr.so
gcc: bkswigptr.lo: No such file or directory
make: *** [libbkswigptr.la] Error 1
-------------------------------------------------------------------------------
Thanks in advance,
Mattias
--
Mattias Barthel, Software Engineer
CapGemini at Hewlett Packard
Tel. 34 93 582 26 02
E-mail: address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- creating C++ libs contitionally,
Mattias Barthel <=