autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (wishlist) Automated lib-config script generation


From: Roger Leigh
Subject: Re: (wishlist) Automated lib-config script generation
Date: Wed, 25 Jul 2001 23:32:39 +0100
User-agent: Mutt/1.2.5i

On Mon, Jul 23, 2001 at 02:01:02AM +0200, Guido Draheim wrote:
> 
> Tim Van Holder wrote:
> > 
> > > Nowadays, many shared libraries include a -config script e.g. libgtk
> > > [...]
> > > There is much duplication of code here.  Anyone wishing to use this
> > > scheme must duplicate the script and then amend it for their use, and
> > > also convert the m4 macro as well, to AM_PATH_<LIB>.  libtool could be
> > > used to automate this.  Currently I maintain the gimp-print build
> > 
> > It seems to me this really is something that would fall under autoconf's
> > jurisdiction, so I've CC'd that list.
> > 
> > >[...]
> > > To remove the need for m4 macro duplication, a single macro could be
> > > used instead.  E.g.:
> > >
> > > AC_PATH_LIB(libname, minimum_version, header, config-script)
> > > where libname is the name of the library to check for e.g. gtk, gimp.
> > >       minimum version is the lowest version to allow
> > >       header is the header to include when compiling the test program
> > >         (default libname/libname.h)
> > >       script is the config script to run (default libname-config)
> > 
> > This seems potentially useful, though it would depend on how compatible
> > <lib>-config scripts actually are (i.e. if gtk-config and sdl-config,
> > for example, were to take different options, the usefulness of this
> > macro would be limited at best).

Well, if there is a minumum requirement a config script has to conform to,
and they are all generated with the companion macro, there shouldn't be
a problem.

> > > AC_LIB_CONFIG(libname, location)
> > > this would generate the script libname-config in the specified
> > > location in the source tree.  The following variables would be used in
> > 
> > That should be be AC_CONFIG_LIBCONFIG, to match the existing
> > AC_CONFIG_* macros.  I'm not sure this has to be a specific macro though,
> > as it could be easily created using the existing config.status mechanism.
> > [...]
> 
> There is a generic-config macro that I'm using quite often. However it
> does not implant code into config.status - it would be best to have
> that done somehow. Anyway, check the m4 source in the ac-archive under:
> http://www.gnu.org/software/ac-archive/Miscellaneous/ac_create_generic_config.html

This is what I was looking for.  Will this ever be made part of the
autoconf distribution?

I hope you don't mind, I have made a few changes to the macro (see the 
attached file).  The changes:
* more flexible
  - include more detail in output script
  - use --prefix=DIR and --exec-prefix=DIR for --cflags and --libs output
* fixed a minor error in the script
* use library-specific variables, so there can be many libconfig scripts
  in a single package (one per library)
* Renamed to AC_CONFIG_LIBCONFIG
* generate library-config.in, which is then processed by config.status to
  make library-config (so variables are always valid (e.g. $prefix)

Is this OK?  This is my first real attempt at m4, so there may be cleaner
ways of doing some things (e.g. remove some of the `translit' macros).

I would also like to auto-generate version headers, using version variables
in configure.in to work with the lib-check macro.  I could add an optional
third header argument, or make an entirely separate macro
(AC_CONFIG_LIBHEADER?).  Which would be best?

> btw, it does complement a generic lib-check macro that can be found as:
> http://www.gnu.org/software/ac-archive/Miscellaneous/ac_path_generic.html

I'll have a look at this next.  I'll try to add support for the --prefix and
--exec-prefix options if that's OK.

Thanks for the pointers.  Feel free to use the attached macro for whatever
you wish.

Regards,
Roger

-- 
Roger Leigh ** Registration Number: 151826, http://counter.li.org **
Need Epson Stylus Utilities? http://gimp-print.sourceforge.net/
For GPG Public Key: finger address@hidden or see public keyservers.

Attachment: ac_create_libconfig.m4
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]