summary refs log tree commit diff
path: root/m4
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-12-13 22:14:25 +0100
committerLudovic Courtès <ludo@gnu.org>2012-12-13 22:14:25 +0100
commit1e9824513c570370638b1bfe33bf1dba1f12be4a (patch)
treecb7bd7f0bebd42dbeabf2c8f09ae1d5144ac969b /m4
parent70915c1a2ef72e7350b2a29d1d93e30643bce6f3 (diff)
parentb35c0f866c83288e64dcf5839d908705d416c317 (diff)
downloadguix-1e9824513c570370638b1bfe33bf1dba1f12be4a.tar.gz
Merge branch 'nix-integration'
Conflicts:
	tests/guix-package.sh
Diffstat (limited to 'm4')
-rw-r--r--m4/guix.m430
1 files changed, 30 insertions, 0 deletions
diff --git a/m4/guix.m4 b/m4/guix.m4
index 29f928f653..7d7d7381a0 100644
--- a/m4/guix.m4
+++ b/m4/guix.m4
@@ -33,3 +33,33 @@ AC_DEFUN([GUIX_ASSERT_LIBGCRYPT_USABLE],
    if test "x$guix_cv_libgcrypt_usable_p" != "xyes"; then
      AC_MSG_ERROR([GNU libgcrypt does not appear to be usable; see `--with-libgcrypt-prefix' and `README'.])
    fi])
+
+dnl GUIX_SYSTEM_TYPE
+dnl
+dnl Determine the Guix host system type, and store it in the
+dnl `guix_system' variable.
+AC_DEFUN([GUIX_SYSTEM_TYPE], [
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_ARG_WITH(system, AC_HELP_STRING([--with-system=SYSTEM],
+    [Platform identifier (e.g., `i686-linux').]),
+    [guix_system="$withval"],
+    [case "$host_cpu" in
+       i*86)
+	  machine_name="i686";;
+       amd64)
+	  machine_name="x86_64";;
+       *)
+	  machine_name="$host_cpu";;
+     esac
+
+     case "$host_os" in
+       linux-gnu*)
+	  # For backward compatibility, strip the `-gnu' part.
+	  guix_system="$machine_name-linux";;
+       *)
+	  # Strip the version number from names such as `gnu0.3',
+	  # `darwin10.2.0', etc.
+	  guix_system="$machine_name-`echo $host_os | "$SED" -e's/@<:@0-9.@:>@*$//g'`";;
+     esac])
+  AC_SUBST([guix_system])
+])