[svn-r1811] Purpose:

New feature
configure.in:
    When just --enable-parallel is used, will try to test if MPI and MPI-IO
    library codes are linkable.  If not, try -lmpi and -lmpio as the most
    commonly used library names for them.
    Also, set default value for RUNPARALLEL if not set.
    Now, for systems, like SGI Crays where there are the system supported
    MPI libraries, "./configure --enable-parallel" would configure
    correctly.
Configure:
    Derived from configure.in via autoconf.
Platform tested:
    SGI O2K.
This commit is contained in:
Albert Cheng 1999-11-02 22:16:41 -05:00
parent 0c6c14d08f
commit 8685a7fa7c
2 changed files with 188 additions and 12 deletions

173
configure vendored
View File

@ -6711,9 +6711,149 @@ case "X-$enable_parallel" in
X-yes)
# We want to compile a parallel library with a compiler that
# already knows how to link with MPI and MPI-IO.
# may already know how to link with MPI and MPI-IO.
echo "$ac_t""provided by compiler" 1>&6
PARALLEL=yes
# Try link a simple MPI program. If fail, try again with -lmpi.
cat > conftest.$ac_ext <<EOF
#line 6721 "configure"
#include "confdefs.h"
int main() {
MPI_Init()
; return 0; }
EOF
if { (eval echo configure:6728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
:
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
echo $ac_n "checking for MPI_Init in -lmpi""... $ac_c" 1>&6
echo "configure:6735: checking for MPI_Init in -lmpi" >&5
ac_lib_var=`echo mpi'_'MPI_Init | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lmpi $LIBS"
cat > conftest.$ac_ext <<EOF
#line 6743 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char MPI_Init();
int main() {
MPI_Init()
; return 0; }
EOF
if { (eval echo configure:6754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_lib=HAVE_LIB`echo mpi | sed -e 's/^a-zA-Z0-9_/_/g' \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF
LIBS="-lmpi $LIBS"
else
echo "$ac_t""no" 1>&6
PARALLEL=no
fi
fi
rm -f conftest*
# Then try link a simple MPI-IO program. If fail, try again with
# -lmpio.
if test "yes" = "$PARALLEL"; then
cat > conftest.$ac_ext <<EOF
#line 6789 "configure"
#include "confdefs.h"
int main() {
MPI_File_open()
; return 0; }
EOF
if { (eval echo configure:6796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
:
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
echo $ac_n "checking for MPI_File_open in -lmpio""... $ac_c" 1>&6
echo "configure:6803: checking for MPI_File_open in -lmpio" >&5
ac_lib_var=`echo mpio'_'MPI_File_open | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lmpio $LIBS"
cat > conftest.$ac_ext <<EOF
#line 6811 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char MPI_File_open();
int main() {
MPI_File_open()
; return 0; }
EOF
if { (eval echo configure:6822: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_lib=HAVE_LIB`echo mpio | sed -e 's/^a-zA-Z0-9_/_/g' \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF
LIBS="-lmpio $LIBS"
else
echo "$ac_t""no" 1>&6
PARALLEL=no
fi
fi
rm -f conftest*
fi
# Set RUNPARALLEL to mpirun if not set yet.
if test "yes" = "$PARALLEL" -a "X-" = "X-$RUNPARALLEL"; then
RUNPARALLEL="mpirun -np \$\${NPROCS:=2}"
fi
;;
X-mpich)
@ -6731,7 +6871,7 @@ case "X-$enable_parallel" in
# is missing.
PARALLEL=mpich
echo $ac_n "checking for MPI_Init in -lmpich""... $ac_c" 1>&6
echo "configure:6735: checking for MPI_Init in -lmpich" >&5
echo "configure:6875: checking for MPI_Init in -lmpich" >&5
ac_lib_var=`echo mpich'_'MPI_Init | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -6739,7 +6879,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lmpich $LIBS"
cat > conftest.$ac_ext <<EOF
#line 6743 "configure"
#line 6883 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -6750,7 +6890,7 @@ int main() {
MPI_Init()
; return 0; }
EOF
if { (eval echo configure:6754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:6894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -6799,13 +6939,34 @@ EOF
# Display what we found about running programs
echo $ac_n "checking prefix for running on one processor""... $ac_c" 1>&6
echo "configure:6803: checking prefix for running on one processor" >&5
echo "configure:6943: checking prefix for running on one processor" >&5
echo "$ac_t""$RUNSERIAL" 1>&6
echo $ac_n "checking prefix for running in parallel""... $ac_c" 1>&6
echo "configure:6806: checking prefix for running in parallel" >&5
echo "configure:6946: checking prefix for running in parallel" >&5
echo "$ac_t""$RUNPARALLEL" 1>&6
# Check that we can link a simple MPI and MPI-IO application
echo $ac_n "checking whether a simple MPI-IO program can be linked""... $ac_c" 1>&6
echo "configure:6951: checking whether a simple MPI-IO program can be linked" >&5
cat > conftest.$ac_ext <<EOF
#line 6953 "configure"
#include "confdefs.h"
int main() {
MPI_Init();MPI_File_open();
; return 0; }
EOF
if { (eval echo configure:6960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
echo "$ac_t""no" 1>&6
{ echo "configure: error: 'unable to link a simple MPI-IO application'" 1>&2; exit 1; }
fi
rm -f conftest*
# There *must* be some way to run in parallel even if it's just the

View File

@ -857,9 +857,24 @@ case "X-$enable_parallel" in
X-yes)
# We want to compile a parallel library with a compiler that
# already knows how to link with MPI and MPI-IO.
# may already know how to link with MPI and MPI-IO.
AC_MSG_RESULT(provided by compiler)
PARALLEL=yes
# Try link a simple MPI program. If fail, try again with -lmpi.
AC_TRY_LINK(,MPI_Init(),,AC_CHECK_LIB(mpi,MPI_Init,,PARALLEL=no))
# Then try link a simple MPI-IO program. If fail, try again with
# -lmpio.
if test "yes" = "$PARALLEL"; then
AC_TRY_LINK(,MPI_File_open(),,
AC_CHECK_LIB(mpio,MPI_File_open,,PARALLEL=no))
fi
# Set RUNPARALLEL to mpirun if not set yet.
if test "yes" = "$PARALLEL" -a "X-" = "X-$RUNPARALLEL"; then
RUNPARALLEL="mpirun -np \$\${NPROCS:=2}"
fi
;;
X-mpich)
@ -906,11 +921,11 @@ if test "X-" != "X-$PARALLEL"; then
AC_MSG_RESULT($RUNPARALLEL)
# Check that we can link a simple MPI and MPI-IO application
dnl AC_MSG_CHECKING(whether a simple MPI-IO program can be linked)
dnl AC_TRY_LINK(,[MPI_Init();MPI_File_open();],
dnl AC_MSG_RESULT(yes),
dnl AC_MSG_RESULT(no)
dnl AC_MSG_ERROR('unable to link a simple MPI-IO application'))
AC_MSG_CHECKING(whether a simple MPI-IO program can be linked)
AC_TRY_LINK(,[MPI_Init();MPI_File_open();],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
AC_MSG_ERROR('unable to link a simple MPI-IO application'))
# There *must* be some way to run in parallel even if it's just the