You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

118 lines
3.7 KiB

  1. dnl GNU Guix --- Functional package management for GNU
  2. dnl Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
  3. dnl
  4. dnl This file is part of GNU Guix.
  5. dnl
  6. dnl GNU Guix is free software; you can redistribute it and/or modify it
  7. dnl under the terms of the GNU General Public License as published by
  8. dnl the Free Software Foundation; either version 3 of the License, or (at
  9. dnl your option) any later version.
  10. dnl
  11. dnl GNU Guix is distributed in the hope that it will be useful, but
  12. dnl WITHOUT ANY WARRANTY; without even the implied warranty of
  13. dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. dnl GNU General Public License for more details.
  15. dnl
  16. dnl You should have received a copy of the GNU General Public License
  17. dnl along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  18. dnl GUIX_ASSERT_LIBGCRYPT_USABLE
  19. dnl
  20. dnl Assert that GNU libgcrypt is usable from Guile.
  21. AC_DEFUN([GUIX_ASSERT_LIBGCRYPT_USABLE],
  22. [AC_CACHE_CHECK([whether $LIBGCRYPT can be dynamically loaded],
  23. [guix_cv_libgcrypt_usable_p],
  24. [GUILE_CHECK([retval],
  25. [(dynamic-func \"gcry_md_hash_buffer\" (dynamic-link \"$LIBGCRYPT\"))])
  26. if test "$retval" = 0; then
  27. guix_cv_libgcrypt_usable_p="yes"
  28. else
  29. guix_cv_libgcrypt_usable_p="no"
  30. fi])
  31. if test "x$guix_cv_libgcrypt_usable_p" != "xyes"; then
  32. AC_MSG_ERROR([GNU libgcrypt does not appear to be usable; see `--with-libgcrypt-prefix' and `README'.])
  33. fi])
  34. dnl GUIX_SYSTEM_TYPE
  35. dnl
  36. dnl Determine the Guix host system type, and store it in the
  37. dnl `guix_system' variable.
  38. AC_DEFUN([GUIX_SYSTEM_TYPE], [
  39. AC_REQUIRE([AC_CANONICAL_HOST])
  40. AC_PATH_PROG([SED], [sed])
  41. AC_ARG_WITH(system, AC_HELP_STRING([--with-system=SYSTEM],
  42. [Platform identifier (e.g., `i686-linux').]),
  43. [guix_system="$withval"],
  44. [case "$host_cpu" in
  45. i*86)
  46. machine_name="i686";;
  47. amd64)
  48. machine_name="x86_64";;
  49. *)
  50. machine_name="$host_cpu";;
  51. esac
  52. case "$host_os" in
  53. linux-gnu*)
  54. # For backward compatibility, strip the `-gnu' part.
  55. guix_system="$machine_name-linux";;
  56. *)
  57. # Strip the version number from names such as `gnu0.3',
  58. # `darwin10.2.0', etc.
  59. guix_system="$machine_name-`echo $host_os | "$SED" -e's/[0-9.]*$//g'`";;
  60. esac])
  61. AC_MSG_CHECKING([for the Guix system type])
  62. AC_MSG_RESULT([$guix_system])
  63. AC_SUBST([guix_system])
  64. ])
  65. dnl GUIX_ASSERT_SUPPORTED_SYSTEM
  66. dnl
  67. dnl Assert that this is a system to which the distro is ported.
  68. AC_DEFUN([GUIX_ASSERT_SUPPORTED_SYSTEM], [
  69. AC_REQUIRE([GUIX_SYSTEM_TYPE])
  70. AC_ARG_WITH([courage], [AC_HELP_STRING([--with-courage],
  71. [Assert that even if this platform is unsupported, you will be
  72. courageous and port the GNU System distribution to it (see
  73. "GNU Distribution" in the manual.)])],
  74. [guix_courageous="$withval"],
  75. [guix_courageous="no"])
  76. # Currently only Linux-based systems are supported, and only on some
  77. # platforms.
  78. case "$guix_system" in
  79. x86_64-linux|i686-linux)
  80. ;;
  81. *)
  82. if test "x$guix_courageous" = "xyes"; then
  83. AC_MSG_WARN([building Guix on `$guix_system', which is not supported])
  84. else
  85. AC_MSG_ERROR([`$guix_system' is not a supported platform.
  86. See "GNU Distribution" in the manual, or try `--with-courage'.])
  87. fi
  88. ;;
  89. esac
  90. ])
  91. dnl GUIX_ASSERT_GUILE_FEATURES FEATURES
  92. dnl
  93. dnl Assert that FEATURES are provided by $GUILE.
  94. AC_DEFUN([GUIX_ASSERT_GUILE_FEATURES], [
  95. for guix_guile_feature in $1
  96. do
  97. AC_MSG_CHECKING([whether $GUILE provides feature '$guix_guile_feature'])
  98. if "$GUILE" -c "(exit (provided? '$guix_guile_feature))"
  99. then
  100. AC_MSG_RESULT([yes])
  101. else
  102. AC_MSG_RESULT([no])
  103. AC_MSG_ERROR([$GUILE does not support feature '$guix_guile_feature', which is required.])
  104. fi
  105. done
  106. ])