For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > October 2004 > automake / autoconf question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author automake / autoconf question
Erwan Loisant

2004-10-25, 3:59 am

Hello.

I am packaging a library I made, and I have a (I think) basic question
on automake/autoconf. I am new to comp.unix.programmer and I hope my
question is not off-topic.

This is a C library, and I found good documentation on how to package
it in a clean way. However I also have Ruby bindings (a scripting
language) and to produce the Makefile of these bindings I need to
launch a given command (actually "ruby extconf.rb".

How can I modify my configure.in to say "in this directory, please
launch the given command /then/ make" ?

Heiko

2004-10-25, 4:01 pm

Erwan Loisant wrote:

> to produce the Makefile of these bindings I need to
> launch a given command (actually "ruby extconf.rb".
>
> How can I modify my configure.in to say "in this directory, please
> launch the given command /then/ make" ?


AFAIK you can just put your ruby command in configure.in. Something like:

AC_INIT([My Program], [0.2], [you@somewhere.com], [myprog])
AC_CONFIG_SRCDIR([main.c])
AC_PREREQ(2.57)
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([config.h])
AC_PROG_CC
AC_PROG_INSTALL

cd ruby/bindings/directory
ruby extconf.rb

AC_CONFIG_FILES([Makefile])
AC_OUTPUT


There's probably a more elegant way to do this, but for just one
ruby-command I wouldn't bother if it works.

Heiko


P.S. Note this example is actually for a autoconf version > 2.5x, but
this shouldn't make for your question.
Måns Rullgård

2004-10-25, 4:01 pm

Heiko <heiko.noordhof_A_xs4all.nl> writes:

> Erwan Loisant wrote:
>
>
> AFAIK you can just put your ruby command in configure.in. Something like:
>
> AC_INIT([My Program], [0.2], [you@somewhere.com], [myprog])
> AC_CONFIG_SRCDIR([main.c])
> AC_PREREQ(2.57)
> AM_INIT_AUTOMAKE
> AC_CONFIG_HEADERS([config.h])
> AC_PROG_CC
> AC_PROG_INSTALL
>
> cd ruby/bindings/directory
> ruby extconf.rb


Never change directories like that, do something like this instead:

(cd ruby/bindings/directory && ruby extconf.rb)

This will run the cd and ruby comands in a subshell, so the working
directory of the configure script doesn't change.

--
Måns Rullgård
mru@inprovide.com
Heiko

2004-10-25, 4:01 pm

Måns Rullgård wrote:

> Heiko <heiko.noordhof_A_xs4all.nl> writes:
>
>
> Never change directories like that, do something like this instead:
>
> (cd ruby/bindings/directory && ruby extconf.rb)
>
> This will run the cd and ruby comands in a subshell, so the working
> directory of the configure script doesn't change.


Oops...
Thanks for pointing that out.

Heiko
Erwan Loisant

2004-10-26, 3:56 am

It works. Thank you very much!

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com