Add support for AmigaOS/AROS to tuklib_physmem().
authorLasse Collin <lasse.collin@tukaani.org>
Thu, 9 Oct 2014 16:41:51 +0000 (19:41 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Thu, 9 Oct 2014 16:41:51 +0000 (19:41 +0300)
Thanks to Fredrik Wikstrom.

m4/tuklib_physmem.m4
src/common/tuklib_physmem.c

index 124992565b8d060de9df3f0ac473956f9009e8d0..ea02208fd3eddf9ecb63031c3fa09d368f3270c2 100644 (file)
@@ -53,7 +53,8 @@ AC_CACHE_CHECK([how to detect the amount of physical memory],
 # a non-compilable text instead of #error to generate an error.
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
 #if defined(_WIN32) || defined(__CYGWIN__) || defined(__OS2__) \
-               || defined(__DJGPP__) || defined(__VMS)
+               || defined(__DJGPP__) || defined(__VMS) \
+               || defined(AMIGA) || defined(__AROS__)
 int main(void) { return 0; }
 #else
 compile error
index 623b6e70b7f28caeb718bfe43f4a6bc6d27ecabc..3cc7d12a171f46773ec6508016cd512b139134ab 100644 (file)
 #      include <syidef.h>
 #      include <ssdef.h>
 
+#elif defined(AMIGA) || defined(__AROS__)
+#      define __USE_INLINE__
+#      include <proto/exec.h>
+
 // AIX
 #elif defined(TUKLIB_PHYSMEM_AIX)
 #      include <sys/systemcfg.h>
@@ -119,6 +123,9 @@ tuklib_physmem(void)
        if (LIB$GETSYI(&val, &vms_mem, 0, 0, 0, 0) == SS$_NORMAL)
                ret = (uint64_t)vms_mem * 8192;
 
+#elif defined(AMIGA) || defined(__AROS__)
+       ret = AvailMem(MEMF_TOTAL);
+
 #elif defined(TUKLIB_PHYSMEM_AIX)
        ret = _system_configuration.physmem;