Subject: Re: net/ORBit: question regarding Makefile variable
To: Georg Schwarz <>
From: Julio M. Merino Vidal <>
List: tech-pkg
Date: 03/09/2005 16:55:27
On Wed, 2005-03-09 at 14:50 +0100, Georg Schwarz wrote:
> net/ORBit in some of its Makefiles has
> ORBIT_HAVE_ALLOCA_H=1  (or =0, depending on the system)
> Now is this sufficient for a define ORBIT_HAVE_ALLOCA_H to be accessible
> in the C code?

It's in the Makefile because ORBIT_HAVE_ALLOCA_H was AC_SUBST'ed, but
AFAICS, it's not of any use in the Makefiles.

> config.h uses
> #include <alloca.h>
> #endif

Yep, and just before that there is a '#undef ORBIT_HAVE_ALLOCA_H' line
(see too).  I guess the original intention was that the
configure script could automatically modify that line to match the
running system: i.e., set to a #define when alloca is present and
working, or leave the #undef line otherwise.

But they got it wrong (why am I not surprised?).  AC_SUBST only sets the
variable in the Makefiles (in fact, any output files), not in config.h.
So the check doesn't work as expected.

So one solution is, as you said, modify the CPPFLAGS in all the files to use -DORBIT_HAVE_ALLOCA_H=$(ORBIT_HAVE_ALLOCA_H);
unfortunately, you'll probably need to modify many files in order to
get this working (because otherwise, the inclusion of config.h in some
subdirectories could not DTRT).

Another solution is to modify the script to use AC_DEFINE
and AC_SUBST for that variable.  That will (hopefully) do the trick and
set the proper value just before the #if construction you quoted, but
I'm afraid it'd result in a big patch for configure.

A third solution (after a second read of the mail) is to add your
CPPFLAGS construction from the configure script or from our package
Makefile.  This sounds like the easiest way to go.

To make things worse, our patch-ap looks like a "broken" workaround to
avoid this issue.  Could you try, after fixing the other issue, to
remove this one and see if everything keeps working?

BTW, the alloca check is broken anyway: it includes alloca.h which is
not present in NetBSD.  It should only include it in case HAVE_ALLOCA_H
is set; otherwise, use stdlib.h.

I'll happily review a patch for these three issues.


Julio M. Merino Vidal <>
The NetBSD Project -