/config/ac_nodeupdown.m4

https://code.google.com/ · m4 · 77 lines · 52 code · 6 blank · 19 comment · 0 complexity · 4edf7236f517642b29174a3358470892 MD5 · raw file

  1. ##*****************************************************************************
  2. ## $Id$
  3. ##*****************************************************************************
  4. # AUTHOR:
  5. # Jim Garlick <garlick@llnl.gov>
  6. #
  7. # SYNOPSIS:
  8. # AC_NODEUPDOWN
  9. #
  10. # DESCRIPTION:
  11. # Checks for nodeupdown support.
  12. #
  13. # WARNINGS:
  14. # This macro must be placed after AC_PROG_CC or equivalent.
  15. ##*****************************************************************************
  16. AC_DEFUN([AC_NODEUPDOWN],
  17. [
  18. #
  19. # Check for whether to include libnodeupdown module
  20. #
  21. AC_MSG_CHECKING([for whether to build nodeupdown module])
  22. AC_ARG_WITH([nodeupdown],
  23. AC_HELP_STRING([--with-nodeupdown], [Build nodeupdown module]),
  24. [ case "$withval" in
  25. no) ac_with_libnodeupdown=no ;;
  26. yes) ac_with_libnodeupdown=yes ;;
  27. *) AC_MSG_RESULT([doh!])
  28. AC_MSG_ERROR([bad value "$withval" for --with-nodeupdown]) ;;
  29. esac
  30. ]
  31. )
  32. AC_MSG_RESULT([${ac_with_libnodeupdown=no}])
  33. if test "$ac_with_libnodeupdown" = "yes"; then
  34. AC_CHECK_LIB([nodeupdown], [nodeupdown_handle_create],
  35. [ac_found_libnodeupdown=yes], [])
  36. if test "$ac_found_libnodeupdown" != "yes" ; then
  37. AC_MSG_NOTICE([Cannot support nodeupdown without libnodeupdown])
  38. else
  39. # Which nodeupdown API version do we have?
  40. AC_TRY_COMPILE(
  41. [#include <nodeupdown.h>],
  42. [nodeupdown_load_data(NULL, NULL, NULL, NULL, 0,0);],
  43. ac_nodeupdown_load_data_6=yes,
  44. ac_nodeupdown_load_data_6=no)
  45. AC_TRY_COMPILE(
  46. [#include <nodeupdown.h>],
  47. [nodeupdown_load_data(NULL, NULL, 0, 0, NULL);],
  48. ac_nodeupdown_load_data_5=yes,
  49. ac_nodeupdown_load_data_5=no)
  50. if test "$ac_nodeupdown_load_data_6" = "yes"; then
  51. AC_DEFINE(HAVE_NODEUPDOWN_LOAD_DATA_6, 1,
  52. [6 param nodeupdown_load_data])
  53. ac_have_libnodeupdown=yes
  54. elif test "$ac_nodeupdown_load_data_5" = "yes"; then
  55. AC_DEFINE(HAVE_NODEUPDOWN_LOAD_DATA_5, 1,
  56. [5 param nodeupdown_load_data])
  57. ac_have_libnodeupdown=yes
  58. else
  59. AC_MSG_NOTICE([Unnkown libnodeupdown library])
  60. fi
  61. if test "$ac_have_libnodeupdown" = "yes"; then
  62. AC_ADD_STATIC_MODULE("nodeupdown")
  63. AC_DEFINE([HAVE_LIBNODEUPDOWN], [1],
  64. [Define if you have libnodeupdown.])
  65. NODEUPDOWN_LIBS="-lnodeupdown"
  66. fi
  67. fi
  68. fi
  69. AC_SUBST(HAVE_LIBNODEUPDOWN)
  70. AC_SUBST(NODEUPDOWN_LIBS)
  71. ])