Skip to content

Commit ff1e9d9

Browse files
authored
Merge pull request #3 from roystgnr/separate_mpi_include_lib
Add --with-mpi-include, --with-mpi-lib
2 parents 9bb972f + c084b2c commit ff1e9d9

File tree

2 files changed

+59
-4
lines changed

2 files changed

+59
-4
lines changed

acsm_compiler_control_args.m4

+51
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,57 @@ AC_ARG_WITH([mpi],
4242
])
4343
])
4444
45+
46+
AC_ARG_WITH([mpi],
47+
AS_HELP_STRING([--with-mpi@<:@=DIR@:>@],
48+
[Prefix where MPI is installed (default is MPIHOME and then MPI_HOME)]),
49+
[
50+
dnl We have no way of knowing whether the user explicitly enabled mpi
51+
dnl with --enable-mpi or whether it was set by default, so if the user
52+
dnl specified --with-mpi=no or --without-mpi we're just going to tell them they've given
53+
dnl competing options
54+
AS_IF([test "$enablempi" = yes && test "$withval" = no],
55+
[AC_MSG_ERROR([Did you mean to disable MPI? If you really mean it, use the --disable-mpi option instead])]
56+
)
57+
MPI="$withval"
58+
],
59+
[
60+
AS_ECHO(["note: MPI library path not given..."])
61+
AS_IF([test x"$MPIHOME" != x],
62+
[
63+
AS_ECHO(["trying prefix=$MPIHOME"])
64+
MPI=$MPIHOME
65+
],
66+
[
67+
AS_IF([test x"$MPI_HOME" != x],
68+
[
69+
AS_ECHO(["trying prefix=$MPI_HOME"])
70+
MPI=$MPI_HOME
71+
])
72+
])
73+
])
74+
75+
AC_ARG_WITH([mpi-include],
76+
AS_HELP_STRING([--with-mpi-include@<:@=DIR@:>@],
77+
[Prefix where MPI headers are installed (default is --with-mpi+/include)]),
78+
[
79+
MPI_INCLUDES_PATH="$withval"
80+
],
81+
[
82+
MPI_INCLUDES_PATH="$MPI/include"
83+
])
84+
85+
AC_ARG_WITH([mpi-lib],
86+
AS_HELP_STRING([--with-mpi-lib@<:@=DIR@:>@],
87+
[Prefix where MPI binaries are installed (default is --with-mpi+/lib)]),
88+
[
89+
MPI_LIBS_PATH="$withval"
90+
],
91+
[
92+
MPI_LIBS_PATH="$MPI/lib"
93+
])
94+
95+
#
4596
# --------------------------------------------------------------
4697
# Allow for disable-optional
4798
# --------------------------------------------------------------

acsm_mpi.m4

+8-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ AS_IF(
2424
])
2525
AC_LANG_POP([C++])
2626
],
27-
[test -n "$MPI"],
27+
[test -n "$MPI_LIBS_PATH" -a -n "$MPI_INCLUDES_PATH"],
2828
[
29-
MPI_LIBS_PATH="$MPI/lib"
30-
MPI_INCLUDES_PATH="$MPI/include"
29+
AS_ECHO(["note: Checking $MPI_LIBS_PATH and $MPI_INCLUDES_PATH for MPI"])
30+
dnl Default MPI_LIBS_PATH="$MPI/lib"
31+
dnl Default MPI_INCLUDES_PATH="$MPI/include"
3132
3233
MPI_LIBS_TO_TEST=""
3334
AS_IF([test -e $MPI_LIBS_PATH/libmpi.a], [MPI_LIBS_TO_TEST="$MPI_LIBS_PATH/libmpi.a $MPI_LIBS_TO_TEST"])
@@ -38,7 +39,7 @@ AS_IF(
3839
dnl look for LAM or other MPI implementation
3940
AS_IF([test x"$MPI_LIBS_TO_TEST" != x],
4041
[
41-
AS_ECHO(["note: testing $MPI_LIBS_PATH/libmpi(.a/.so)"])
42+
AS_ECHO(["note: testing $MPI_LIBS_PATH/libmpi(.a/.so/.dylib)"])
4243
4344
dnl Ensure the compiler finds the library...
4445
tmpLIBS=$LIBS
@@ -86,6 +87,9 @@ AS_IF(
8687
8788
AC_LANG_RESTORE
8889
LIBS=$tmpLIBS
90+
],
91+
[
92+
AS_ECHO(["note: Could not find $MPI_LIBS_PATH/libmpi(.a/.so/.dylib)"])
8993
])
9094
9195
dnl have we not found an implementation yet?

0 commit comments

Comments
 (0)