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: a07f3367d7,5e286d7d7d00a665 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.224.223.14 with SMTP id ii14mr5613984qab.3.1352412336747; Thu, 08 Nov 2012 14:05:36 -0800 (PST) Received: by 10.52.93.132 with SMTP id cu4mr2120582vdb.14.1352412336724; Thu, 08 Nov 2012 14:05:36 -0800 (PST) Path: gf5ni18188417qab.0!nntp.google.com!c7no12600179qap.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 8 Nov 2012 14:05:36 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=65.13.115.246; posting-account=p5rsXQoAAAB8KPnVlgg9E_vlm2dvVhfO NNTP-Posting-Host: 65.13.115.246 References: <967e4a44-2eb6-4d4b-b191-0e7a575da911@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <410f27aa-5e6d-48b8-a566-5cbe09ba06b0@googlegroups.com> Subject: Re: GNAT library directory - how to detect it at build time? From: rugxulo@gmail.com Injection-Date: Thu, 08 Nov 2012 22:05:36 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-11-08T14:05:36-08:00 List-Id: Hi, On Tuesday, October 30, 2012 4:02:31 AM UTC-5, Maciej Sobczak wrote: > > Yes, it helped. Not directly, but I have followed this idea and finally ended up with this: > > $ gnatgcc --print-search-dirs | grep 'install: ' | grep -o '/.*' > > The above command extracts the name of GNAT installation > directory, which I can then inject into the GNAT project > manager and use to portably link the final program. I > hope the above will help others as well. While I'm extremely noobish in all these things, I couldn't help but think you're doing it incorrectly. But my first instinct (basename or dirname) wouldn't work here (and I forgot I had GNAT installed on this machine, so I can actually test). Just for the record, a quick search shows that POSIX grep doesn't support '-o', so you may wish to avoid that (though further searches show some *BSDs do support it). The easier solution seems to be to just use AWK: (Thu Nov 08, 03:54 PM) /tmp/doydoy # gnatgcc --print-search-dirs | awk '/install:/ { print $2 }' /usr/lib/gcc/i486-linux-gnu/4.4.3/ http://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html