logo       

Re: Autoconf support suggestion: msg#00128

programming.swig

Subject: Re: Autoconf support suggestion

On Saturday 25 January 2003 18:50, Brian Shire wrote:
> Hi,
>
> I'm trying to work out a swig.m4 file myself for my projects, because I'm
> needing to configure/make multiple language modules for a few of my
> projects. (yay swig!). I've attached my current working copy for this.
> Although some of this should probably be coordinated somehow with existing
> macros java for example (maybe others?). It would be good if we could get
> this in the swig project so multiple inputs can be provided for stability
> and broader support.

This is exactly what I have in mind. The SWIG system should provide the
Autoconf macros for the target languages. This shouldn't be a big problem
since the SWIG 'configure.in' contains a lot useful stuff. A typical
'configure.in' of a project which uses SWIG and Autoconf may look like (I
don't use the AC_ prefix since they are not from the Autoconf project):
...
SWIG_PROG([required-version])
...
SWIG_PYTHON()
SWIG_PERL()
...

The SWIG_PROG() macro should provide $(SWIG) which can be used to invoke the
swig program. Then a SWIG_ENABLE_CXX() macro can for example add the C++
option to $(SWIG) and you don't have to take care about it in your Makefiles,
similar SWIG_MULTI_MODULE_SUPPORT().

I set $(SWIG) to 'false' if the swig program is not found on the build system,
because if you include the swig generated files in your distribution, you
normally don't need swig to build your project.

The SWIG_TARGET_LANG() macros should provide:
$(SWIG_TARGET_LANG_OPT) # For swig invocations
$(SWIG_CPPFLAGS)
$(SWIG_TARGET_LANG_LIB) # For multi module support

Example Makefile.am:
EXTRA_DIST = Project.i

CLEANFILES = wrap_* Project.py

AM_CPPFLAGS = -I$(top_srcdir)/include $(SWIG_PYTHON_CPPFLAGS)

AM_CXXFLAGS = -Wall

pythondir = $(prefix)/python

python_PYTHON = Project.py

libdir = $(prefix)/python

lib_LTLIBRARIES = libPythonProject.la

libPythonProject_la_SOURCES = wrap_Project.cpp
libPythonProject_la_LDFLAGS = -avoid-version -module

install-exec-hook:
$(mkinstalldirs) "$(DESTDIR)$(pythondir)"
cd "$(DESTDIR)$(pythondir)" && rm -f _Project.so && $(LN_S)
libPythonProject.so _Project.so

uninstall-local:
rm -f "$(DESTDIR)$(pythondir)/_Project.so"

%.py: wrap_%.cpp

wrap_%.cpp: %.i $(top_srcdir)/include/%.h
$(SWIG) $(SWIG_PYTHON_OPT) -I$(top_srcdir)/include -o $@ $<

> -Brian Shire
> <shire@xxxxxxxxxx>
> http://www.tekrat.com
>
> On Sat, Jan 25, 2003 at 02:22:34PM +0100, Sebastian Huber wrote:
> > Hello,
> > is it possible to add a few files to the next SWIG release, which may
> > help to improve the usage of SWIG within projects based on Autoconf. In
> > my opinion only two files are needed.
> >
> > swig-config.in:
> > This file will be installed in the 'bin' directory and provides
> > information about the installed SWIG system, e.g. 'swig-config --version'
> > -> SWIG version.
> >
> > swig.m4:
> > Developers which use SWIG and Autoconf can use this in their projects.
> > [...]

_______________________________________________
Swig maillist - Swig@xxxxxxxxxxxxxxx
http://mailman.cs.uchicago.edu/mailman/listinfo/swig



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise