Skip to content
Snippets Groups Projects
Commit af10873c authored by Christian Engwer's avatar Christian Engwer
Browse files

[m4] check for parmetis.h in different places

we are now checking for different locations of parmetis.h. This makes it possible us the
scotch parmetis implementation (see FS#1370).
parent ee1c3c12
No related branches found
No related tags found
No related merge requests found
......@@ -4,67 +4,58 @@ dnl vi: set et ts=8 sw=2 sts=2:
# searches for ParMetis headers and libs
AC_DEFUN([DUNE_PATH_PARMETIS],[
AC_MSG_CHECKING(for ParMETIS library)
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_PATH_XTRA])
AC_REQUIRE([DUNE_MPI])
# default locations
PARMETIS_DEFAULT="/usr /usr/local"
INCLUDE_DEFAULT="include include/parmetis"
#
# USer hints ...
# User hints ...
#
AC_ARG_VAR([PARMETIS], [ParMETIS library location])
AC_ARG_WITH([parmetis],
[AC_HELP_STRING([--with-parmetis],[user defined path to ParMETIS library])],
[
# --with-parmetis supersedes $PARMETIS
PARMETIS=""
if test "$withval" != no ; then
if test -d "$withval" ; then
# get absolute path
with_parmetis=`eval cd $withval 2>&1 && pwd`
if test -f "$with_parmetis/include/parmetis.h" ; then
lib_path=lib
include_path=include
fi
AC_MSG_RESULT(yes)
else
with_parmetis="no"
AC_MSG_RESULT(no)
PARMETIS="$withval"
])
# set PARMETIS to the usual locations, in case it is not defined
if test -n "$PARMETIS" ; then PARMETIS_DEFAULT=""; fi
with_parmetis=""
include_path=""
lib_path=""
# check for parmtirs include path
for p in "$PARMETIS" $PARMETIS_DEFAULT; do
for i in $INCLUDE_DEFAULT; do
# AC_MSG_NOTICE( ... checking for $p/$i )
if test -f $p/$i/parmetis.h ; then
# AC_MSG_NOTICE( ... found $p/$i/parmetis.h )
with_parmetis="$p"
include_path="$i"
lib_path=lib
break 2;
fi
else
AC_MSG_RESULT(no)
fi
],
[
#echo with_parmetis1=$withparmetis PARMETIS=$PARMETIS
if test -n "$PARMETIS" ; then
if test -d "$PARMETIS" ; then
# get absolute path
with_parmetis=`eval cd $PARMETIS 2>&1 && pwd`
PARMETIS=""
AC_MSG_RESULT(yes)
else
PARMETIS=""
with_parmetis=no
AC_MSG_RESULT(no)
fi
else
with_parmetis=/usr/
include_path=include
lib_path=lib
if test ! -f "$with_parmetis/$include_path/parmetis.h" ; then
with_parmetis=/usr/local/
if test ! -f "$with_metis/$include_path/parmetis.h" ; then
with_parmetis="no"
AC_MSG_RESULT(failed)
else
AC_MSG_RESULT(yes)
fi
else
AC_MSG_RESULT(yes)
fi
fi
])
done
done
# report test result
if test -n "$with_parmetis" ; then
# defaultpath
PARMETIS_LIB_PATH="$with_parmetis/$lib_path"
PARMETIS_INCLUDE_PATH="$with_parmetis/$include_path"
AC_MSG_RESULT(yes)
else
if test -n "$PARMETIS" ; then
AC_MSG_ERROR(no)
else
AC_MSG_RESULT(no)
fi
fi
AC_MSG_NOTICE( PARMETIS: checking for $p/$i )
AC_ARG_WITH([parmetis-lib],
[AC_HELP_STRING([--with-parmetis-lib], [name of the parmetis libraries (default is parmetis)])],
,[with_parmetis_lib=parmetis])
......@@ -77,19 +68,15 @@ AC_DEFUN([DUNE_PATH_PARMETIS],[
ac_save_LDFLAGS="$LDFLAGS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_LIBS="$LIBS"
# call IMDX_LIB_METIS directly and not via AC_REQUIRE
# because AC_REQUIRE support not allow parameters
# without any parameters a missing METIS would halt configure
IMMDX_LIB_METIS(,[true])
## do nothing if --without-parmetis is used
if test x"$with_mpi" != x"no" && test x"$with_parmetis" != x"no" ; then
# defaultpath
PARMETIS_LIB_PATH="$with_parmetis/$lib_path"
PARMETIS_INCLUDE_PATH="$with_parmetis/$include_path"
PARMETIS_LIBS="-L$PARMETIS_LIB_PATH -l$with_metis_lib $DUNEMPILIBS -lm"
PARMETIS_LDFLAGS="$DUNEMPILDFLAGS"
......@@ -107,11 +94,11 @@ AC_DEFUN([DUNE_PATH_PARMETIS],[
PARMETIS_CPPFLAGS="${DUNEMPICPPFLAGS} ${PARMETIS_CPPFLAGS} -DENABLE_PARMETIS=1"
# AC_LANG_PUSH([C++])
# if header is found check for the libs
LIBS="$DUNEMPILIBS -lm $LIBS"
if test x$HAVE_PARMETIS = x1 ; then
DUNE_CHECK_LIB_EXT([$PARMETIS_LIB_PATH], [$with_metis_lib], [metis_partgraphkway],
[
......@@ -134,10 +121,10 @@ AC_DEFUN([DUNE_PATH_PARMETIS],[
fi
# AC_LANG_POP([C++])
# pre-set variable for summary
#with_parmetis="no"
# did it work?
AC_MSG_CHECKING(ParMETIS in $with_parmetis)
if test x$HAVE_PARMETIS = x1 ; then
......@@ -145,7 +132,7 @@ AC_DEFUN([DUNE_PATH_PARMETIS],[
AC_SUBST(PARMETIS_LDFLAGS, $PARMETIS_LDFLAGS)
AC_SUBST(PARMETIS_CPPFLAGS, $PARMETIS_CPPFLAGS)
AC_DEFINE(HAVE_PARMETIS,ENABLE_PARMETIS,[Define if you have the Parmetis library.
This is only true if MPI was found by configure
This is only true if MPI was found by configure
_and_ if the application uses the PARMETIS_CPPFLAGS])
AC_MSG_RESULT(ok)
......@@ -158,21 +145,21 @@ AC_DEFUN([DUNE_PATH_PARMETIS],[
else
with_parmetis="no"
AC_MSG_RESULT(failed)
fi
fi
# end of "no --without-parmetis"
else
with_parmetis="no"
fi
# tell automake
# tell automake
AM_CONDITIONAL(PARMETIS, test x$HAVE_PARMETIS = x1)
# restore variables
LDFLAGS="$ac_save_LDFLAGS"
CPPFLAGS="$ac_save_CPPFLAGS"
LIBS="$ac_save_LIBS"
DUNE_ADD_SUMMARY_ENTRY([ParMETIS],[$with_parmetis])
])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment