diff --git a/configure b/configure index 27fe98bd51d376355f5706cda5a56abe9d91fb64..5f33f9e6ef2351461c072baaccf0129d03493db6 100755 --- a/configure +++ b/configure @@ -3191,7 +3191,23 @@ fi -# Extract the first word of "mpicc", so it can be a program name with args. + +# Check whether --with-mpi or --without-mpi was given. +if test "${with_mpi+set}" = set; then + withval="$with_mpi" + if test x$withval = xyes; then + { { echo "$as_me:$LINENO: error: --with-mpi must be given a pathname" >&5 +echo "$as_me: error: --with-mpi must be given a pathname" >&2;} + { (exit 1); exit 1; }; } + else + MPICC="${withval}/bin/mpicc" + HAVE_MPICC="yes" + fi + +fi; + +if test x$HAVE_MPICC != xyes; then + # Extract the first word of "mpicc", so it can be a program name with args. set dummy mpicc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 @@ -3227,24 +3243,9 @@ else echo "${ECHO_T}no" >&6 fi -if test x$HAVE_MPICC != xyes; then - -# Check whether --with-mpi or --without-mpi was given. -if test "${with_mpi+set}" = set; then - withval="$with_mpi" - if test x$withval = xyes; then - { { echo "$as_me:$LINENO: error: --with-mpi must be given a pathname" >&5 -echo "$as_me: error: --with-mpi must be given a pathname" >&2;} - { (exit 1); exit 1; }; } - else - MPICC="${withval}/bin/mpicc" - GOT_MPICC="1" - fi - -fi; -else - GOT_MPICC="1" - MPICC=mpicc + if test x$HAVE_MPICC = xyes; then + MPICC=mpicc + fi fi @@ -3306,9 +3307,9 @@ fi; saveCC="$CC" CC="$MPICC" -if test x$GOT_MPICC != x1; then - { { echo "$as_me:$LINENO: error: must provide --with-mpi= argument to configure." >&5 -echo "$as_me: error: must provide --with-mpi= argument to configure." >&2;} +if test x$HAVE_MPICC != "xyes"; then + { { echo "$as_me:$LINENO: error: must provide --with-mpi= argument to configure if mpicc is not in path." >&5 +echo "$as_me: error: must provide --with-mpi= argument to configure if mpicc is not in path." >&2;} { (exit 1); exit 1; }; } fi if test x$GOT_ALIGNMENT != x1; then diff --git a/configure.in b/configure.in index 4869e542151970bd37f80479abd54b72cf4f59e5..c2e43d62229000d480afde56a76bd04126d4b664 100644 --- a/configure.in +++ b/configure.in @@ -13,20 +13,21 @@ AC_PROG_INSTALL CHECK_ZLIB -AC_CHECK_PROG(HAVE_MPICC, mpicc, yes, no) +AC_ARG_WITH(mpi, +[ --with-mpi= Location of the MPI installation], + if test x$withval = xyes; then + AC_MSG_ERROR(--with-mpi must be given a pathname) + else + MPICC="${withval}/bin/mpicc" + HAVE_MPICC="yes" + fi +) + if test x$HAVE_MPICC != xyes; then - AC_ARG_WITH(mpi, - [ --with-mpi= Location of the MPI installation], - if test x$withval = xyes; then - AC_MSG_ERROR(--with-mpi must be given a pathname) - else - MPICC="${withval}/bin/mpicc" - GOT_MPICC="1" - fi - ) -else - GOT_MPICC="1" - MPICC=mpicc + AC_CHECK_PROG(HAVE_MPICC, mpicc, yes, no) + if test x$HAVE_MPICC = xyes; then + MPICC=mpicc + fi fi AC_SUBST(MPICC) @@ -65,8 +66,8 @@ AC_ARG_WITH(log-path, saveCC="$CC" CC="$MPICC" -if test x$GOT_MPICC != x1; then - AC_MSG_ERROR(must provide --with-mpi= argument to configure.) +if test x$HAVE_MPICC != "xyes"; then + AC_MSG_ERROR(must provide --with-mpi= argument to configure if mpicc is not in path.) fi if test x$GOT_ALIGNMENT != x1; then AC_MSG_ERROR(must provide --with-mem-align= argument to configure.)