Hi,
This is mostly directed to Christian, but maybe someone else will also
know the
answer:
On Christian's suggestion, I've finally managed to get a stub class
compiled and
linked as both a dynamic library and as a loadable module on Mac OSX. I
would
now like to work through the brat Makefile.am files to produce both
libraries and loadable modules
for OSX. However, I'm having trouble seeing how to do this so that a OSX
build will coexist with the normal build instructions.
What somewhat works is the following:
------configure.in-------
AC_INIT(foo.cc)
AM_INIT_AUTOMAKE(foo, 1.0)
AM_CONDITIONAL(MACOSX, test `root-config --arch` = macosx )
AC_PROG_CXX
AC_DISABLE_STATIC
AM_PROG_LIBTOOL
AC_OUTPUT(Makefile)
-----Makefile.am-----
AM_CPPFLAGS := `root-config --cflags`
ROOTCONFIG = `root-config --glibs`
if MACOSX
pkglib_LTLIBRARIES = libfoo.la libfoo2.la
libfoo2_la_SOURCES = foo.cxx foodict.cc
libfoo2_la_LDFLAGS = -module -no-version $(ROOTCONFIG)
else
pkglib_LTLIBRARIES = libfoo.la
endif
pkginclude_HEADERS = foo.hh
libfoo_la_SOURCES = foo.cxx foodict.cc
libfoo_la_LDFLAGS = $(ROOTCONFIG)
%dict.cc %dict.h:%.hh
rootcint -f $*dict.cc -c -p $(AM_CPPFLAGS) $< Include.h LinkDef.h
However, I have the following problems:
For MacOSX
>>The loadable module library ends up with the name libfoo2.so. I
need to get this renamed to libfoo.so
>>automake complains about libfoo.la already being defined. It
appears that it does this check BEFORE
evaluating the conditional.
For Linux
>> Since linux doesn't distinguish between dynamic libraries and
loadable shared modules, I don't need the
libfoo2 stuff. Unfortunately since automake evaluates the
conditional AFTER looking at
consistency of the statements, the automake step fails. The only
way I've been able to get this running under linux is to
comment out all of the libfoo2 stuff.
Is there a cleaner way of handing conditionals? One that works!?
Thanks for any suggestions,
Regards
Steve
p.s. For completeness, here are the other files used in the test setup:
#######################----foo.hh----
#ifndef FOO
#define FOO
#ifndef ROOT_TObject
#include "TObject.h"
#endif
class Foo : public TObject
{
public:
Foo();
Foo(const Char_t * Name, const Char_t * Title);
virtual ~Foo();
ClassDef(Foo,0)
};
#endif
#######################----foo.cc----
#include "foo.hh"
ClassImp(Foo)
Foo::Foo()
{
//Default constructor.
}
Foo::Foo(const Char_t *name, const Char_t *title):TObject()
{
}
Foo::~Foo()
{
}
###########################-----LinkDef.h------
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class Foo;
#endif
#############################----Include.h-------
#ifndef LinkDefINC
#define LinkDefINC
#include "foo.hh"
#endif
This archive was generated by hypermail 2b30 : Fri Aug 30 2002 - 14:09:44 EDT