From: Warren on
Vadim Godunko expounded in news:d50d540f-8fdf-40ae-9301-
4958c6bdff4f(a)q15g2000yqj.googlegroups.com:

> On Apr 21, 11:54�pm, Warren <ve3...(a)gmail.com> wrote:
>> Has anyone here had experience using GNAT with autoconf/automake?
>>
> I used them long time ago. I don't known any project which still use
> them now, but them was used in old versions of PolyORB and QtAda.

I just feel that if an Ada (gnat) based project is going
to gain any package-level respect from the maintainers
of Debian/etc., it will need to be autoconf ready.

This becomes especially crucial when you try to make the
project build under HPUX, Solaris, AIX and OSX in addition
to usual Linux/*BSD lineup. The environments are different
enough to frustrate any simple minded configuration
management system.

Warren
From: Warren on
Vadim Godunko expounded in news:5867de55-7ca2-4c64-a72f-d2343153eef0
@k36g2000yqn.googlegroups.com:

> On Apr 23, 5:44�pm, Warren <ve3...(a)gmail.com> wrote:
>>
>> For a basic interpreter, making use of ncurses, libgmp, libgsl,
>> and PostgreSQL etc., it is unavoidable. :) �I tried to avoid C++
>> like the plague, but ncurses requires a C++ main, if GNAT exceptions
>> are to work correctly. I'm not sure of the details why, but a GNAT
>> exception + ncurses and a C or gnat main leads to an abort.
>> Switching to a C++ main program has corrected that.
>>
> Did you try to pass -shared to gnatbind?

No, but is that really relevant?

The problem was not library linkage, but the fact that
if an exception was raised in the Ada modules, the
exception handler would not work -- the whole unit
would abort.

In fact I was able to interact with ncurses and everything
else C wise, until I did a "raise".

Warren
From: Warren on
Georg Bauhaus expounded in news:4bd023a8$0$6881$9b4e6d93(a)newsspool2.arcor-
online.net:

> On 21.04.10 21:54, Warren wrote:
>> Has anyone here had experience using GNAT with autoconf/automake?
>
> I think, no, I know I am not the only one having used
> GNU make in preference to the very thing that purports
> to solve the problem, that, actually, it is creating.
>
> automess.

Not much disagreement there, and I'm even less fond of
libtool. But it's going to be necessary for me to use
this for portability to all the platforms that I intend
to support.

Warren
From: Warren on
Stephen Leake expounded in news:82sk6nn4vn.fsf(a)stephe-leake.org:

> Warren <ve3wwg(a)gmail.com> writes:
>
>> Has anyone here had experience using GNAT with autoconf/automake?
>
> My advice is to stop using the autotools, and use gprbuild instead.
>
> gprbuild knows how to build C libraries and link them with Ada. It can
> also use a C main, if necessary.

Unfortunately, there is more to this than just the build.
I am mostly concerned about the ./configure and the generated
config.h file. Autoconf is critical for wide platform support.

But you gave me an idea. Maybe I can just use autoconf and do away
with automake and libtool. I still need to use the libtool's
library libtdl (I think it was), but that shouldn't be a problem.
That way I can still use make (gmake), as I have always done.

Warren
From: Warren on
Warren expounded in news:Xns9D6274A3FCC0CWarrensBlatherings@
188.40.43.245:

> Stephen Leake expounded in news:82sk6nn4vn.fsf(a)stephe-leake.org:
>
>> Warren <ve3wwg(a)gmail.com> writes:
>>
>>> Has anyone here had experience using GNAT with autoconf/automake?
....

Ok, I got this thang working together now, including
autoconf, automake and libtool. For anyone interested,
this is one way you can do it.

My executable is named z9. So in Makefile.am specify:

bin_PROGRAMS = z9

as per usual. I also build a static library containing
all the related C/C++ modules (mine included a C++ main
program, thanks to ncurses). So for the final target
specify something like:

z9$(EXEEXT): libz9.la
gnatmake $(AFLAGS) z9.adb
gnatbind -n z9.ali
libtool --mode=link --tag=CC gnatlink z9.ali --GCC=g++ \
--LINK=g++ -L. -lz9 -lncurses -lpanel -o z9

The $(EXEEXT) is necessary for Cygwin builds.

File libz9.la is the surrogate for the static library of
C/C++ programs, which is listed as a dependency to
cause it to be created by libtool first. The
AFLAGS is just GNAT compile options, of the form:

DEBUG = -g -O0
AFLAGS = $(DEBUG) -gnat05 -Wall -gnatwl ...

z9.adb was the starting point for my Ada code. It gets
invoked by the C++ main program. Specifying that, causes
all dependant Ada units to be compiled as usual by
gnatmake.

The libtool --mode=link is the tricky part:

You have to lie to libtool with --tag=CC (for C++) for
a C++ build.

I didn't try it, but presumably if you only have C
modules, --tag=C will work (also remove "--GCC=g++"
and "--LINK=g++" as well from the libtool command).

Then specify the entire rest of the gnatlink command line.
libtool does however require that you explicitly specify
the output file with the -o option ("-o z9", in this case).

Life is good, albeit a bit complex.

Warren