erlang.at 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. # -*- Autotest -*-
  2. AT_BANNER([Erlang low level compiling and utility macros.])
  3. # Copyright (C) 2009-2012 Free Software Foundation, Inc.
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. # Since the macros which compile are required by most tests, check
  18. # them first. But remember that looking for a compiler is even more
  19. # primitive, so check those first.
  20. ## ----------------- ##
  21. ## Erlang Compiler. ##
  22. ## ----------------- ##
  23. AT_CHECK_MACRO([Erlang],
  24. [[AC_ERLANG_PATH_ERL([no])
  25. AC_ERLANG_PATH_ERLC([no])
  26. if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
  27. AC_LANG([Erlang])
  28. ## Can't compile, but can run an Erlang module:
  29. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [halt(0)])],
  30. [AC_MSG_RESULT([ok])
  31. AC_MSG_ERROR([compiling Erlang program should fail])],
  32. [AC_MSG_RESULT([failed])])
  33. AC_RUN_IFELSE([AC_LANG_PROGRAM([], [halt(0)])],
  34. [AC_MSG_RESULT([ok])],
  35. [AC_MSG_RESULT([failed])
  36. AC_MSG_ERROR([could not run test program])])
  37. ]],
  38. [AT_KEYWORDS([Erlang])])
  39. ## ---------------------- ##
  40. ## Erlang lib detection. ##
  41. ## ---------------------- ##
  42. AT_CHECK_MACRO([AC_ERLANG_CHECK_LIB],
  43. [[AC_ERLANG_PATH_ERL([no])
  44. AC_ERLANG_PATH_ERLC([no])
  45. if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
  46. AC_ERLANG_CHECK_LIB([stdlib],
  47. [AC_MSG_RESULT([ok])],
  48. [AC_MSG_RESULT([failed])])
  49. ## Test that the lib path detection really detected a directory:
  50. if test "$ERLANG_LIB_DIR_stdlib" != "not found" \
  51. && test ! -d "$ERLANG_LIB_DIR_stdlib"; then
  52. AC_MSG_ERROR([incorrect ERLANG_LIB_DIR_stdlib variable])
  53. fi
  54. ]],
  55. [AT_KEYWORDS([Erlang])])
  56. ## --------------------------- ##
  57. ## Erlang root dir detection. ##
  58. ## --------------------------- ##
  59. AT_CHECK_MACRO([AC_ERLANG_SUBST_ROOT_DIR],
  60. [[AC_ERLANG_PATH_ERL([no])
  61. AC_ERLANG_PATH_ERLC([no])
  62. if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
  63. AC_ERLANG_SUBST_ROOT_DIR
  64. ## Test that the root path detection really detected a directory:
  65. if test ! -d "$ERLANG_ROOT_DIR"; then
  66. AC_MSG_ERROR([incorrect ERLANG_ROOT_DIR variable])
  67. fi
  68. ]],
  69. [AT_KEYWORDS([Erlang])])
  70. ## -------------------------- ##
  71. ## Erlang lib dir detection. ##
  72. ## -------------------------- ##
  73. AT_CHECK_MACRO([AC_ERLANG_SUBST_LIB_DIR],
  74. [[AC_ERLANG_PATH_ERL([no])
  75. AC_ERLANG_PATH_ERLC([no])
  76. if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
  77. AC_ERLANG_SUBST_LIB_DIR
  78. ## Test that the lib path detection really detected a directory:
  79. if test ! -d "$ERLANG_LIB_DIR"; then
  80. AC_MSG_ERROR([incorrect ERLANG_LIB_DIR variable])
  81. fi
  82. ]],
  83. [AT_KEYWORDS([Erlang])])
  84. ## ----------------------------------- ##
  85. ## Erlang install base dir detection. ##
  86. ## ----------------------------------- ##
  87. AT_CHECK_MACRO([AC_ERLANG_SUBST_INSTALL_LIB_DIR],
  88. [AT_KEYWORDS([Erlang])])
  89. ## ---------------------------------- ##
  90. ## Erlang install lib dir detection. ##
  91. ## ---------------------------------- ##
  92. AT_CHECK_MACRO([AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR],
  93. [[AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR([test_blah], [1.24-b])
  94. ## Test that the generated directory name is well-formed:
  95. if test `echo "$ERLANG_INSTALL_LIB_DIR_test_blah" | sed -e 's/^.*\///'` != "test_blah-1.24-b"; then
  96. AC_MSG_ERROR([incorrect ERLANG_INSTALL_LIB_DIR_test_blah variable])
  97. fi
  98. ]],
  99. [AT_KEYWORDS([Erlang])])
  100. ## -------------------------- ##
  101. ## Erlang version detection. ##
  102. ## -------------------------- ##
  103. AT_CHECK_MACRO([AC_ERLANG_SUBST_ERTS_VER],
  104. [[AC_ERLANG_PATH_ERL([no])
  105. AC_ERLANG_PATH_ERLC([no])
  106. if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
  107. AC_ERLANG_SUBST_ERTS_VER
  108. ]],
  109. [AT_KEYWORDS([Erlang])])