Merge pull request #197 from gonzalolarralde/host-install-path

os_string fixes for cross-compilation and Android when Swift is enabled
diff --git a/configure.ac b/configure.ac
index 98e1142..73d6613 100644
--- a/configure.ac
+++ b/configure.ac
@@ -194,6 +194,9 @@
    AC_DEFINE(HAVE_SWIFT, 1, [Define if building for Swift])
    SWIFTC="$swift_toolchain_path/bin/swiftc"
    case $target_os in
+      *android*)
+	    os_string="android"
+	    ;;
       linux*)
 	    os_string="linux"
 	    case $target_cpu in
@@ -215,6 +218,7 @@
 AC_SUBST([SWIFTC])
 AC_SUBST([SWIFTC_FLAGS])
 AC_SUBST([SWIFT_LIBDIR])
+AC_SUBST([OS_STRING], ["$os_string"])
 
 #
 # Enable use of gold linker when building the Swift overlay
diff --git a/src/Makefile.am b/src/Makefile.am
index 967d5a0..1e2ba65 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,7 @@
 #
 
 if HAVE_SWIFT
-swiftlibdir=${prefix}/lib/swift/linux
+swiftlibdir=${prefix}/lib/swift/${OS_STRING}
 swiftlib_LTLIBRARIES=libdispatch.la
 else
 lib_LTLIBRARIES=libdispatch.la
@@ -171,7 +171,7 @@
 	$(abs_builddir)/swift/Dispatch.swiftdoc \
 	$(SWIFT_OBJ_FILES)
 
-swiftmoddir=${prefix}/lib/swift/linux/${build_cpu}
+swiftmoddir=${prefix}/lib/swift/${OS_STRING}/${host_cpu}
 swiftmod_HEADERS=\
 	$(abs_builddir)/swift/Dispatch.swiftmodule \
 	$(abs_builddir)/swift/Dispatch.swiftdoc