automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shared object and Makefile.am


From: Ralf Wildenhues
Subject: Re: shared object and Makefile.am
Date: Sat, 19 Jun 2010 14:50:10 +0200
User-agent: Mutt/1.5.20 (2010-04-22)

Hello Wesley,

* Wesley Smith wrote on Sat, Jun 19, 2010 at 02:40:53PM CEST:
> I'm trying to use autotools to compile shared object Lua modules.  The
> way these modules are named differs from the typical .so conventions
> because they're not actually libs one links against but are instead
> loaded by Lua itself.  For example, a Lua module binding OpenGL would
> look like opengl.so instead of libopengl.so.

Is that true for all systems, even those where the usual shared library
extension is different, e.g., .sl on HP-UX systems, .dll on w32 ones,
etc.?

You can avoid warnings about the 'lib' prefix by making these things
modules instead of libraries, as in
  lib_LTLIBRARIES = opengl.la
  opengl_la_LDFLAGS = -module -avoid-version

that will under the hood create a .so in the hidden .libs (or _libs)
subdirectory, and install them in the right place.  For modules however,
it is suggested to put them in package-specific directories such as
pkglibdir not in libdir; you'd get the former by adding them to
pkglib_LIBRARIES instead.

> INCLUDES = -I$(srcdir)/include -I/usr/include/lua5.1 -I/usr/include/GL

This is ok, but INCLUDES is an old name; use AM_CPPFLAGS instead.

> LIBS = -shared

This is wrong and broken.  LIBS is only for libraries, -l and -L flags.
For other link flags, use AM_LDFLAGS or per-target flags like in my
example above.  The -shared flag should not be needed at all for
libraries created by libtool, however: it will add that flags for you
it appropriate (or another one for a different compiler).

> $ autoreconf -i
> libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
> libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
> libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.

You can avoid those warnings by heeding them, and creating a m4
directory in your tree.

> opengl/Makefile.am:4: `opengl.so' is not a standard libtool library name
> opengl/Makefile.am:4: did you mean `libopengl.la'?
> autoreconf: automake failed with exit status: 1

Hope that helps.

Cheers,
Ralf



reply via email to

[Prev in Thread] Current Thread [Next in Thread]