x_ac_blcr.m4 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ##*****************************************************************************
  2. # AUTHOR:
  3. # Copied from x_ac_munge.
  4. #
  5. # SYNOPSIS:
  6. # X_AC_BLCR()
  7. #
  8. # DESCRIPTION:
  9. # Check the usual suspects for an BLCR installation,
  10. # updating CPPFLAGS and LDFLAGS as necessary.
  11. #
  12. # WARNINGS:
  13. # This macro must be placed after AC_PROG_CC and before AC_PROG_LIBTOOL.
  14. ##*****************************************************************************
  15. AC_DEFUN([X_AC_BLCR], [
  16. _x_ac_blcr_dirs="/usr /usr/local /opt/freeware /opt/blcr"
  17. _x_ac_blcr_libs="lib64 lib"
  18. AC_ARG_WITH(
  19. [blcr],
  20. AS_HELP_STRING(--with-blcr=PATH,Specify path to BLCR installation),
  21. [AS_IF([test "x$with_blcr" != xno],[_x_ac_blcr_dirs="$with_blcr $_x_ac_blcr_dirs"])])
  22. if [test "x$with_blcr" = xno]; then
  23. AC_MSG_WARN([support for blcr disabled])
  24. else
  25. AC_CACHE_CHECK(
  26. [for blcr installation],
  27. [x_ac_cv_blcr_dir],
  28. [
  29. for d in $_x_ac_blcr_dirs; do
  30. test -d "$d" || continue
  31. test -d "$d/include" || continue
  32. test -f "$d/include/libcr.h" || continue
  33. for bit in $_x_ac_blcr_libs; do
  34. test -d "$d/$bit" || continue
  35. _x_ac_blcr_libs_save="$LIBS"
  36. LIBS="-L$d/$bit -lcr $LIBS"
  37. AC_LINK_IFELSE(
  38. [AC_LANG_CALL([], cr_get_restart_info)],
  39. AS_VAR_SET(x_ac_cv_blcr_dir, $d))
  40. LIBS="$_x_ac_blcr_libs_save"
  41. test -n "$x_ac_cv_blcr_dir" && break
  42. done
  43. test -n "$x_ac_cv_blcr_dir" && break
  44. done
  45. ])
  46. if test -z "$x_ac_cv_blcr_dir"; then
  47. AC_MSG_WARN([unable to locate blcr installation])
  48. else
  49. BLCR_HOME="$x_ac_cv_blcr_dir"
  50. BLCR_LIBS="-lcr"
  51. BLCR_CPPFLAGS="-I$x_ac_cv_blcr_dir/include"
  52. BLCR_LDFLAGS="-L$x_ac_cv_blcr_dir/$bit"
  53. fi
  54. AC_DEFINE_UNQUOTED(BLCR_HOME, "$x_ac_cv_blcr_dir", [Define BLCR installation home])
  55. AC_SUBST(BLCR_HOME)
  56. AC_SUBST(BLCR_LIBS)
  57. AC_SUBST(BLCR_CPPFLAGS)
  58. AC_SUBST(BLCR_LDFLAGS)
  59. fi
  60. AM_CONDITIONAL(WITH_BLCR, test -n "$x_ac_cv_blcr_dir")
  61. ])