Permalink
Browse files

Support building on OSX

Fixes #16
  • Loading branch information...
k4rtik committed Dec 20, 2014
1 parent 4f0a558 commit f6c00f0652e4143ebd07d7d9edff55a5722d6192
Showing with 27 additions and 1 deletion.
  1. +10 −1 Makefile.am
  2. +17 −0 configure.ac
View
@@ -1,3 +1,12 @@
+if OS_DARWIN
+platformsrc = pslib_osx.c
+endif
+
+if OS_LINUX
+platformsrc = pslib_linux.c
+endif
+
bin_PROGRAMS = driver
-driver_SOURCES = common.c driver.c pslib_linux.c
+driver_SOURCES = common.c driver.c $(platformsrc)
+
AUTOMAKE_OPTIONS = foreign
View
@@ -28,5 +28,22 @@ AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_REALLOC
AC_CHECK_FUNCS([getmntent memset strdup strncasecmp strndup strtol strtoul strtoull sysinfo])
+# Determine the host system
+AC_CANONICAL_SYSTEM
+
+case $host in
+ *-linux* ) os="linux"
+ ;;
+ *-darwin* ) os="darwin"
+ ;;
+ * ) os="Unsupported"
+ AC_MSG_ERROR([Your platform is currently not supported])
+ ;;
+esac
+
+# OS info for Automake
+AM_CONDITIONAL(OS_LINUX, test "x$os" = xlinux)
+AM_CONDITIONAL(OS_DARWIN, test "x$os" = xdarwin)
+
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

0 comments on commit f6c00f0

Please sign in to comment.