x_ac_pmix.m4 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. ##*****************************************************************************
  2. # AUTHOR:
  3. # Artem Polyakov <artpol84@gmail.com>
  4. #
  5. # SYNOPSIS:
  6. # X_AC_PMIX
  7. #
  8. # DESCRIPTION:
  9. # Determine if the PMIx libraries exists. Derived from "x_ac_hwloc.m4".
  10. ##*****************************************************************************
  11. AC_DEFUN([X_AC_PMIX],
  12. [
  13. _x_ac_pmix_dirs="/usr /usr/local"
  14. _x_ac_pmix_libs="lib64 lib"
  15. AC_ARG_WITH(
  16. [pmix],
  17. AS_HELP_STRING(--with-pmix=PATH,Specify path to pmix installation),
  18. [AS_IF([test "x$with_pmix" != xno],[_x_ac_pmix_dirs="$with_pmix $_x_ac_pmix_dirs"])])
  19. if [test "x$with_pmix" = xno]; then
  20. AC_MSG_WARN([support for pmix disabled])
  21. else
  22. AC_CACHE_CHECK(
  23. [for pmix installation],
  24. [x_ac_cv_pmix_dir],
  25. [
  26. for d in $_x_ac_pmix_dirs; do
  27. test -d "$d" || continue
  28. test -d "$d/include" || continue
  29. test -f "$d/include/pmix/pmix_common.h" || continue
  30. test -f "$d/include/pmix_server.h" || continue
  31. for d1 in $_x_ac_pmix_libs; do
  32. test -d "$d/$d1" || continue
  33. _x_ac_pmix_cppflags_save="$CPPFLAGS"
  34. CPPFLAGS="-I$d/include $CPPFLAGS"
  35. _x_ac_pmix_libs_save="$LIBS"
  36. LIBS="-L$d/$d1 -lpmix $LIBS"
  37. AC_LINK_IFELSE(
  38. [AC_LANG_CALL([], PMIx_Get_version)],
  39. AS_VAR_SET(x_ac_cv_pmix_dir, $d))
  40. CPPFLAGS="$_x_ac_pmix_cppflags_save"
  41. LIBS="$_x_ac_pmix_libs_save"
  42. test -n "$x_ac_cv_pmix_dir" && break
  43. done
  44. test -n "$x_ac_cv_pmix_dir" && break
  45. done
  46. ])
  47. if test -z "$x_ac_cv_pmix_dir"; then
  48. AC_MSG_WARN([unable to locate pmix installation])
  49. else
  50. AC_CACHE_CHECK(
  51. [for pmix library directory],
  52. [x_ac_cv_pmix_libdir],
  53. [
  54. for d1 in $_x_ac_pmix_libs; do
  55. d="$x_ac_cv_pmix_dir/$d1"
  56. test -d "$d" || continue
  57. _x_ac_pmix_cppflags_save="$CPPFLAGS"
  58. CPPFLAGS="-I$x_ac_cv_pmix_dir/include $CPPFLAGS"
  59. _x_ac_pmix_libs_save="$LIBS"
  60. LIBS="-L$d -lpmix $LIBS"
  61. AC_LINK_IFELSE(
  62. [AC_LANG_CALL([], PMIx_Get_version)],
  63. AS_VAR_SET(x_ac_cv_pmix_libdir, $d))
  64. CPPFLAGS="$_x_ac_pmix_cppflags_save"
  65. LIBS="$_x_ac_pmix_libs_save"
  66. test -n "$x_ac_cv_pmix_libdir" && break
  67. done
  68. ])
  69. PMIX_CPPFLAGS="-I$x_ac_cv_pmix_dir/include"
  70. if test "$ac_with_rpath" = "yes"; then
  71. PMIX_LDFLAGS="-Wl,-rpath -Wl,$x_ac_cv_pmix_libdir -L$x_ac_cv_pmix_libdir"
  72. else
  73. PMIX_LDFLAGS="-L$x_ac_cv_pmix_libdir"
  74. fi
  75. PMIX_LIBS="-lpmix"
  76. AC_DEFINE(HAVE_PMIX, 1, [Define to 1 if pmix library found])
  77. fi
  78. AC_SUBST(PMIX_LIBS)
  79. AC_SUBST(PMIX_CPPFLAGS)
  80. AC_SUBST(PMIX_LDFLAGS)
  81. fi
  82. AM_CONDITIONAL(HAVE_PMIX, test -n "$x_ac_cv_pmix_dir")
  83. ])