From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,12c54a0f5a27d882 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!188.40.43.213.MISMATCH!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Warren Newsgroups: comp.lang.ada Subject: Re: Autoconf & gnat Help Needed Date: Thu, 22 Apr 2010 15:59:49 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <82sk6nn4vn.fsf@stephe-leake.org> Injection-Date: Thu, 22 Apr 2010 15:59:49 +0000 (UTC) Injection-Info: feeder.eternal-september.org; posting-host="9f8M0iN5t54V+4DF/iqO8g"; logging-data="1969"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18juxUpN4rE3Q5OqNgzPq421zGTwaEvYRA=" User-Agent: Xnews/5.04.25 X-Face: &6@]C2>ZS=NM|HE-^zWuryN#Z/2_.s9E|G&~DRi|sav9{E}XQJb*\_>=a5"q]\%A;5}LKP][1mA{gZ,Q!j Cancel-Lock: sha1:cDVLwstbpWnUGJdHqZOjcdI2eUw= Xref: g2news2.google.com comp.lang.ada:11109 Date: 2010-04-22T15:59:49+00:00 List-Id: Warren expounded in news:Xns9D6274A3FCC0CWarrensBlatherings@ 188.40.43.245: > Stephen Leake expounded in news:82sk6nn4vn.fsf@stephe-leake.org: > >> Warren 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