From: Lars Hecking (lhecking at domain nmrc.ucc.ie)
Date: Mon 05 Apr 1999 - 19:43:21 IST
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
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:04:06 GMT