logo       

Re: Autoconf support suggestion: msg#00133

programming.swig

Subject: Re: Autoconf support suggestion

Sebastian Huber wrote:
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.
[...]


I'm sure we can put these autoconf macros into future SWIG releases.

Is there a reason why the swig-config needs to be a script? Would integrating the extra commandline options into the swig executable not suffice? Most of the command line arguments already exist. The version reporting has changed as the date and time stamp has been dropped.

The SWIG build has undergone some surgery since the 1.3.17 release and so the configure.in file has changed a bit. One thing which was not done, which ought to be, was to macro'ise all the different language detections as suggested in these emails. Currently the different language settings produced by configure.in are used by the test-suite and examples for testing SWIG using the installed languages on a box. It would make a lot of sense if the proposed autoconf macros are used by the test-suite as most of them perform the same functionality. As such they would need to fit in with the current SWIG test-suite. The steps to accepting these macros would be to move much of the contents of configure.in into macros and put them into a swig.m4 file. Running 'make -k check' before and after the changes on different systems will check that they still work as intended. We developers can help by running them on our different boxes. Please submit any patches against the CVS version and send to the swig-dev mailing list.

Thanks
William


_______________________________________________
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