1# -*- Autoconf -*- 2 3AU_ALIAS([ACX_SUPERLU], [AX_SUPERLU]) 4AC_DEFUN([ACX_SUPERLU], [ 5 6AC_REQUIRE([LX_FIND_MPI()]) 7AC_REQUIRE([ACX_PARMETIS]) 8 9dnl it is not exported outside the configure script 10have_superlu=no 11 12AC_ARG_WITH(superlu, 13 [AC_HELP_STRING([--with-superlu=yes/no/prefix], [use the superlu library for LU decomposition (default yes)])], 14 [libsuperlu_prefix="$withval"], 15 [libsuperlu_prefix="/usr/local"]) 16 17 AS_IF([test "$with_libsuperlu" != "no" -a $have_C_mpi == "yes"], 18 [ 19 AS_IF([test "$libsuperlu_prefix" == "yes"], [libsuperlu_prefix="/usr/local"]) 20 21 __ac_cppflags_=$CPPFLAGS 22 __ac_cc_compiler=$CC 23 CC=${MPICC} 24 CPPFLAGS+="-I${libsuperlu_prefix}/include -I${libsuperlu_prefix}/include/superlu_dist ${MPI_CFLAGS}" 25 26 AC_LANG_PUSH([C]) 27 AC_CHECK_HEADERS([superlu_ddefs.h], 28 [superlu_has_hdrs="yes"], 29 [superlu_has_hdrs="no"], 30 []) 31 AC_CHECK_HEADERS([superlu_dist/superlu_ddefs.h], 32 [superlu_has_hdrs="yes"], 33 [superlu_has_hdrs="no"], 34 []) 35 36 dnl check if superlu_dist needs parmetis. Fedora for instance 37 dnl does not provide parmetis and compiles superlu_dist 38 dnl without. So we check without parmetis and if it does not 39 dnl work check again with 40 41 AC_CHECK_LIB(superlu_dist, 42 [dCreate_CompCol_Matrix_dist], 43 [superlu_found=yes], 44 [superlu_found=no], 45 [-L${libsuperlu_prefix}/lib -lsuperlu_dist $MPI_CLDFLAGS -lpthread -lrt -lm]) 46 AC_MSG_CHECKING([whether superlu_dist can be linked without parmetis]) 47 48 AS_IF([test "$superlu_found" = "yes"], 49 [AC_MSG_RESULT(yes)], 50 [AC_MSG_RESULT(no) 51 AC_CHECK_LIB(superlu_dist, 52 [dCreate_CompCol_Matrix_dist], 53 [superlu_found=yes], 54 [superlu_found=no], 55 [-L${libsuperlu_prefix}/lib -lsuperlu_dist $PARMETIS_LDFLAGS $PARMETIS_LIBS $MPI_CLDFLAGS -lpthread -lrt -lm]) 56 ]) 57 58 AC_LANG_POP([C]) 59 60 CC=$__ac_cc_compiler 61 CPPFLAGS=$__ac_cppflags_ 62 AS_IF([test "$superlu_found" == "yes"], 63 [LIBSUPERLU_DIST_CFLAGS="-I${libsuperlu_prefix}/include" 64 LIBSUPERLU_DIST_LIBS="-lsuperlu_dist" 65 LIBSUPERLU_DIST_LDFLAGS="-L${libsuperlu_prefix}/lib" 66 have_superlu=yes 67 AC_DEFINE([HAVE_SUPERLU_DIST], 1, ["superlu is found"]) 68 ], [have_superlu=no]) 69 ]) 70 71 AC_SUBST(SUPERLU_DIST_CFLAGS) 72 AC_SUBST(SUPERLU_DIST_LIBS) 73 AC_SUBST(SUPERLU_DIST_LDFLAGS) 74 75 AS_IF([test "$superlu_found" == "yes"], [$1], [$2]) 76]) 77