Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

From: Ralf Wildenhues (Ralf.Wildenhues_at_[hidden])
Date: 2005-08-31 06:27:51


This is a rather subtle issue, and pretty ugly, unfortunately.
For the curious reader, here is a rather technical explanation:

Somewhere, inside some
  if test "$arch_..."
branching construct (but not inside an Autoconf macro definition!), the
configure.in script uses the macro AC_CHECK_HEADER. This macro requires
some other ones to work, so it AC_REQUIREs these; for example
AC_PROG_EGREP which define $EGREP. What autoconf then does is expand
these checks right before the expansion of AC_CHECK_HEADER, that is:
inside the shell branching construct.

Then, later on, AC_PROG_LIBTOOL is called. This macro also needs
AC_PROG_EGREP, so it also AC_REQUIREs it. Autoconf remembers that
it has already expanded the macro, so it is not expanded again.

Since the actual test for egrep now is hidden inside the shell branch,
it is not run in all cases. So further tests that stem from
AC_PROG_LIBTOOL fail.

Possible ideas to solve this:
- move AC_PROG_LIBTOOL up before the branch: does not work, the branch
  code modifies $CC.
- search for all AC_REQUIREd macros and call them by hand, outside the
  branch. Tedious and error-prone.
- rewrite major parts of configure.in to solve the logic. Not an
  option, OpenMPI wants as little changes as possible to this legacy
  external packages.
- try to use the experimental AS_IF() Autoconf macro which aims at
  solving (or at least mitigating) this issue. Not too good an idea.
- call a stub AC_CHECK_HEADER once outside any branches _before_ it's
  called inside so that required macros are expanded there.

The patch below implements that last possibility, by searching some
header name unlikely to be used seriously, and minimizing any
consequences.

Cheers,
Ralf

        * ompi/mca/io/romio/romio/configure.in: Insert stub call of
        AC_CHECK_HEADER to pull in required macros at top level instead
        of later in shell-conditional branch.

Index: ompi/mca/io/romio/romio/configure.in
===================================================================
--- ompi/mca/io/romio/romio/configure.in (revision 7105)
+++ ompi/mca/io/romio/romio/configure.in (working copy)
@@ -641,6 +641,8 @@
 # Open MPI: need to actually get the C compiler
 CFLAGS_save="$CFLAGS"
 AC_PROG_CC
+# Open MPI: pull in machinery necessary foe AC_HEADER_CHECK at top level.
+AC_CHECK_HEADER([foobar.h], [:], [:])
 CFLAGS="$CFLAGS_save"
 
 # Open MPI: this stuff is not necessary with modern versions of the