httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Kraemer <mar...@apache.org>
Subject [PATCH] Broken APR_CHECK_APR_DEFINE() macro in test for APR_HAVE_IPV6 and APR_HAS_RANDOM
Date Wed, 02 Nov 2005 12:31:23 GMT
Hi,

The APR_CHECK_APR_DEFINE() macro implements a test for an APR
define, used for instance in the configure script to test for
the availability of APR_HAVE_IPV6 and APR_HAS_RANDOM (why once
_HAVE_ and once _HAS_ btw?). This macro is broken because it
uses the equivalent of the following:

--snip--
...
ac_cpp='$CPP $CPPFLAGS'
CPP='cc -E'
CPPFLAGS='...whatever... -DAP_DEBUG'
INCLUDES='-I$(top_builddir)/srclib/apr/include -I$(top_builddir)/srclib/pcre -I. -I$(top_srcdir)/os/$(OS_DIR)
-I$(top_srcdir)/server/mpm/$(MPM_SUBDIR_NAME) -I$(top_srcdir)/modules/http -I$(top_srcdir)/modules/filters
-I$(top_srcdir)/modules/proxy -I$(top_srcdir)/include -I$(top_srcdir)/modules/generators -I$(top_srcdir)/modules/mappers
-I/opt/apache21/include/apr-1 -I/home/martin/SRC/openIS/work/httpd-2.1.8-beta/srclib/apr-util/../apr-iconv/include'
...
CPPFLAGS="$CPPFLAGS $INCLUDES"
...
if (eval "$ac_cpp conftest.$ac_ext") |
  $EGREP "YES_IS_DEFINED" ; then
  ac_cv_define_APR_HAS_RANDOM=yes
else
  ac_cv_define_APR_HAS_RANDOM=no
fi
--snip--

Now there are several problems with this:

* The contents of $INCLUDES is appended temporarily to CPPFLAGS.
  But the $INCLUDES definition is in Makefile syntax, while
  CPPFLAGS holds definitions in shell syntax. To be eval-able,
  the $(...) must be changed to ${...} (or the logic must be
  changed)

* There are $... references in the $INCLUDES definition which are
  not resolved in a single eval. The single eval will evaluate
  $ac_cpp (to the expansion of $CPP $CPPFLAGS). But any $-variables
  in the $CPPFLAGS (that were appended from the $INCLUDES line) will
  stay un-expanded. So, as is, the script will pass a literal
  '-I$(top_builddir)/srclib/apr/include' to the compiler, which in
  most cases will lead to $CC being unable to find <apr.h>

Using a replacement from $() to ${} plus using a second eval to expand
the ${top_builddir} fixes it, but that is IMHO an utterly ugly hack.
(Also, it introduces several other problems if shell special characters
appear in paths)

Suggestions welcome: how can the configure script be fixed in a clean
way?

   Martin
-- 
<Martin.Kraemer@Fujitsu-Siemens.com>         |     Fujitsu Siemens
Fon: +49-89-636-46021, FAX: +49-89-636-48332 | 81730  Munich,  Germany

Mime
View raw message