[erlang-questions] Erlang and autoconf/make

Romain Lenglet rlenglet@REDACTED
Wed Nov 15 05:22:34 CET 2006


On Tuesday 14 November 2006 23:24, Pupeno wrote:
> > AC_INIT(Modules to write servers, 0.0.0, pupeno@REDACTED,
> > serlvers)
> > AC_COPYRIGHT(Copyright (C) 2006 Jose Pablo Pupeno Fernandez)
> >
> > dnl Require autoconf version >=2.59c. first one with erlang
> > macros
> > AC_PREREQ(2.59c)
> > dnl Require automake version >=1.9.5.
> > AM_INIT_AUTOMAKE(1.9.5)
> >
> > AC_ERLANG_NEED_ERLC
> >
> > AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(AC_PACKAGE_TARNAME,
> > AC_PACKAGE_VERSION)
> >
> > AC_CONFIG_FILES([Makefile src/Makefile])
> >
> > AC_OUTPUT
>
> No need for
>
> AC_ERLANG_SUBST_ROOT_DIR
> AC_ERLANG_SUBST_LIB_DIR
> AC_ERLANG_SUBST_INSTALL_LIB_DIR
>
> ?

The macros have dependencies between them, expressed 
by "AC_REQUIRE(..)" macro calls in their implementation.

For instance, if one writes
AC_REQUIRE(AC_ERLANG_NEED_ERLC)
then the macro AC_ERLANG_NEED_ERLC is called if and only if it 
has not already been called.

That way, AC_ERLANG_SUBST_INSTALL_LIB_DIR is required by 
AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(...,...).

And calls to AC_ERLANG_SUBST_ROOT_DIR and AC_ERLANG_SUBST_LIB_DIR 
were not necessary anyway in gtknode's configure.ac.
(By the way, Mats, I think that you should remove those calls in 
gtknode...)

I think that I added those explicit calls in gtknode's 
configure.ac, only to demonstrate the use of the available 
macros. (^_^)


It must be noted that AC_ERLANG_NEED_ERLC is also required by 
AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(...,...), since the ERLC 
variable (i.e., the erlc command) is used to compile tests 
written in Erlang, like in this macro.

However, since you explicitly use the ERLC variable in your 
Makefile.am, I think that it is better to explicitly keep the 
call to AC_ERLANG_NEED_ERLC in your configure.ac.
That way, if one day you need to comment out the call to 
AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(...,...), ERLC will still be 
substituted.

[...]
> > > and this is the main Makefile.am
> > > http://software.pupeno.com/Serlvers/src/Makefile.am
> > > And in that last one is where I am worried. I have to list
> > > the sources and the beam files, is that needed ? I have to
> > > also put the .app among the (automatically generated) beam
> > > files, is that needed as well ? I mean, isn't there a
> > > better way ?
> >
> > If your .app file is not generated,
>
> It can be generated ?

It could. Why not? (^_^)
Ruslan Babayev has thought of a way to substitute the version 
numbers in .app files, with the versions of actually installed 
libraries.

However, adding the support for that in Autoconf has been 
rejected by Autoconf maintainers. They reject anything that has 
to do with version numbers, since it is contrary to Autoconf's 
philosophy.
Anyway, we could do such substitutions easily with a short Erlang 
program. Any volunteer to develop that?

The configuration+build process would then be:

1) one checks with Autoconf that all required libraries are 
installed, and that they have all the required features 
(exported functions, etc.), etc.

2) at build time, one can generate the .app files to reflect the 
version numbers of the installed libraries.

[...]

Regards,

-- 
Romain LENGLET
Pr. Chiba Shigeru Group
Dept. of Mathematical and Computing Sciences
Tokyo Institute of Technology



More information about the erlang-questions mailing list