Miles writes:
> I'm trying to hack up a makefile for a project here, and I'm hitting a
> few probs. Basically, it's extending a makefile that already exists to
> add some new features into a CORBA ORB. I'm trying to add in an extra
> flag to the configure command, which will add an extra #define to a .h
> file. i.e.
>> "--enable-moss" - adds '#define HAVE_MOSS 1' to a config.h file
>> In the configure file, the enable flags copy the #defines to a
> confdefs.h file, which is then transformed into a sed script which puts
> the vals into config.h. My #define is getting through to the
> confdefs.h, but doesn't make it to the config.h file. The problem is
> somewhere in the sed bit, which I know sweet fsck-all about, never
> having looked at sed before. I know this isn't much info to go on, but
> can any sed-knowlegeable people here maybe take a guess at the reasons
> why one line in particular out of about 50 in the input to the sed
> script isn't getting echoed through?
Don't mess around with configure - you change configure.in and then use
autoconf to regenerate configure. confdefs.h is a temporary file created
by configure.
To add another --enable-moss option, put the following into configure.in:
AC_ARG_ENABLE(moss,dnl
[ --enable-moss Enable the miraculous moss feature],
ACTION-IF-GIVEN,
ACTION-IF-NOT-GIVEN
)dnl
If --enable-moss or --disable-moss is specified, ACTION-IF-GIVEN is
executed, otherwise ACTION-IF-NOT-GIVEN. These actions should access
one of two variables, enableval or enable_moss, test whether the variable
is set yes or no, and execute code accordingly. Example (using autoconf 2.13):
AC_ARG_ENABLE(moss,dnl
[ --enable-moss <help text>],
test "$enableval" = yes && \
AC_DEFINE(HAVE_MOSS,1,[<config.h help text for moss. ])
)
Here, ACTION-IF-NOT-GIVEN is empty. Replace the text in angle brackets <>
with your own. <help text> will appear with ./configure --help,
<config.h help text for moss. will accompany the define in config.h.
If you have only autoconf < 2.13, replace above AC_DEFINE with
AC_DEFINE(HAVE_MOSS,1), manually add
/* <config.h help text for moss. */
#undef HAVE_MOSS
to acconfig.h, and run autoheader to create config.h.in.
Recommended reading: the GNU autoconf manual.
--
i'm living so far beyond my income that we may almost be said to be
living apart.
-- e. e. cummings
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!