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.
 
 
 
 
 
 

165 lines
5.5 KiB

  1. dnl GNU Guix --- Functional package management for GNU
  2. dnl Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
  3. dnl Copyright © 2014 Mark H Weaver <mhw@netris.org>
  4. dnl
  5. dnl This file is part of GNU Guix.
  6. dnl
  7. dnl GNU Guix is free software; you can redistribute it and/or modify it
  8. dnl under the terms of the GNU General Public License as published by
  9. dnl the Free Software Foundation; either version 3 of the License, or (at
  10. dnl your option) any later version.
  11. dnl
  12. dnl GNU Guix is distributed in the hope that it will be useful, but
  13. dnl WITHOUT ANY WARRANTY; without even the implied warranty of
  14. dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. dnl GNU General Public License for more details.
  16. dnl
  17. dnl You should have received a copy of the GNU General Public License
  18. dnl along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  19. dnl GUIX_ASSERT_LIBGCRYPT_USABLE
  20. dnl
  21. dnl Assert that GNU libgcrypt is usable from Guile.
  22. AC_DEFUN([GUIX_ASSERT_LIBGCRYPT_USABLE],
  23. [AC_CACHE_CHECK([whether $LIBGCRYPT can be dynamically loaded],
  24. [guix_cv_libgcrypt_usable_p],
  25. [GUILE_CHECK([retval],
  26. [(dynamic-func \"gcry_md_hash_buffer\" (dynamic-link \"$LIBGCRYPT\"))])
  27. if test "$retval" = 0; then
  28. guix_cv_libgcrypt_usable_p="yes"
  29. else
  30. guix_cv_libgcrypt_usable_p="no"
  31. fi])
  32. if test "x$guix_cv_libgcrypt_usable_p" != "xyes"; then
  33. AC_MSG_ERROR([GNU libgcrypt does not appear to be usable; see `--with-libgcrypt-prefix' and `README'.])
  34. fi])
  35. dnl GUIX_SYSTEM_TYPE
  36. dnl
  37. dnl Determine the Guix host system type, and store it in the
  38. dnl `guix_system' variable.
  39. AC_DEFUN([GUIX_SYSTEM_TYPE], [
  40. AC_REQUIRE([AC_CANONICAL_HOST])
  41. AC_PATH_PROG([SED], [sed])
  42. AC_ARG_WITH(system, AC_HELP_STRING([--with-system=SYSTEM],
  43. [Platform identifier (e.g., `i686-linux').]),
  44. [guix_system="$withval"],
  45. [case "$host_cpu" in
  46. i*86)
  47. machine_name="i686";;
  48. amd64)
  49. machine_name="x86_64";;
  50. arm*)
  51. # TODO: If not cross-compiling, add a sanity check to make
  52. # sure this build machine has the needed features to
  53. # support executables compiled using our armhf gcc,
  54. # configured with:
  55. # --with-arch=armv7-a
  56. # --with-float=hard
  57. # --with-mode=thumb
  58. # --with-fpu=vfpv3-d16
  59. machine_name="armhf";;
  60. *)
  61. machine_name="$host_cpu";;
  62. esac
  63. case "$host_os" in
  64. linux-gnu*)
  65. # For backward compatibility, strip the `-gnu' part.
  66. guix_system="$machine_name-linux";;
  67. *)
  68. # Strip the version number from names such as `gnu0.3',
  69. # `darwin10.2.0', etc.
  70. guix_system="$machine_name-`echo $host_os | "$SED" -e's/[0-9.]*$//g'`";;
  71. esac])
  72. AC_MSG_CHECKING([for the Guix system type])
  73. AC_MSG_RESULT([$guix_system])
  74. AC_SUBST([guix_system])
  75. ])
  76. dnl GUIX_ASSERT_SUPPORTED_SYSTEM
  77. dnl
  78. dnl Assert that this is a system to which the distro is ported.
  79. AC_DEFUN([GUIX_ASSERT_SUPPORTED_SYSTEM], [
  80. AC_REQUIRE([GUIX_SYSTEM_TYPE])
  81. AC_ARG_WITH([courage], [AC_HELP_STRING([--with-courage],
  82. [Assert that even if this platform is unsupported, you will be
  83. courageous and port the GNU System distribution to it (see
  84. "GNU Distribution" in the manual.)])],
  85. [guix_courageous="$withval"],
  86. [guix_courageous="no"])
  87. # Currently only Linux-based systems are supported, and only on some
  88. # platforms.
  89. case "$guix_system" in
  90. x86_64-linux|i686-linux|armhf-linux|mips64el-linux)
  91. ;;
  92. *)
  93. if test "x$guix_courageous" = "xyes"; then
  94. AC_MSG_WARN([building Guix on `$guix_system', which is not supported])
  95. else
  96. AC_MSG_ERROR([`$guix_system' is not a supported platform.
  97. See "GNU Distribution" in the manual, or try `--with-courage'.])
  98. fi
  99. ;;
  100. esac
  101. ])
  102. dnl GUIX_ASSERT_GUILE_FEATURES FEATURES
  103. dnl
  104. dnl Assert that FEATURES are provided by $GUILE.
  105. AC_DEFUN([GUIX_ASSERT_GUILE_FEATURES], [
  106. for guix_guile_feature in $1
  107. do
  108. AC_MSG_CHECKING([whether $GUILE provides feature '$guix_guile_feature'])
  109. if "$GUILE" -c "(exit (provided? '$guix_guile_feature))"
  110. then
  111. AC_MSG_RESULT([yes])
  112. else
  113. AC_MSG_RESULT([no])
  114. AC_MSG_ERROR([$GUILE does not support feature '$guix_guile_feature', which is required.])
  115. fi
  116. done
  117. ])
  118. dnl GUIX_CHECK_SRFI_37
  119. dnl
  120. dnl Check whether SRFI-37 suffers from <http://bugs.gnu.org/13176>.
  121. dnl This bug was fixed in Guile 2.0.9.
  122. AC_DEFUN([GUIX_CHECK_SRFI_37], [
  123. AC_CACHE_CHECK([whether (srfi srfi-37) is affected by http://bugs.gnu.org/13176],
  124. [ac_cv_guix_srfi_37_broken],
  125. [if "$GUILE" -c "(use-modules (srfi srfi-37)) \
  126. (sigaction SIGALRM (lambda _ (primitive-exit 1))) \
  127. (alarm 1) \
  128. (define opts (list (option '(#\I) #f #t (lambda _ #t)))) \
  129. (args-fold '(\"-I\") opts (lambda _ (error)) (lambda _ #f) '())"
  130. then
  131. ac_cv_guix_srfi_37_broken=no
  132. else
  133. ac_cv_guix_srfi_37_broken=yes
  134. fi])
  135. ])
  136. dnl GUIX_CHECK_UNBUFFERED_CBIP
  137. dnl
  138. dnl Check whether 'setbvuf' works on custom binary input ports (CBIPs), as is
  139. dnl the case starting with Guile 2.0.10.
  140. AC_DEFUN([GUIX_CHECK_UNBUFFERED_CBIP], [
  141. AC_CACHE_CHECK([whether Guile's custom binary input ports support 'setvbuf'],
  142. [ac_cv_guix_cbips_support_setvbuf],
  143. [if "$GUILE" -c "(use-modules (rnrs io ports)) \
  144. (let ((p (make-custom-binary-input-port \"cbip\" pk #f #f #f))) \
  145. (setvbuf p _IONBF))" >&5 2>&1
  146. then
  147. ac_cv_guix_cbips_support_setvbuf=yes
  148. else
  149. ac_cv_guix_cbips_support_setvbuf=no
  150. fi])
  151. ])