diff --git a/configure.ac b/configure.ac
index c4bb901a70dd4e1a6b1f9e671aa132c01bdc195f..b0884c1370acfefeaa24de8def75da057f3d660d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,14 +50,14 @@ case "${host_os}" in
     ;;
   darwin*)
     SYS=darwin
-
-    AC_EGREP_CPP(yes,
-            [#import <TargetConditionals.h>
-             #if TARGET_OS_IPHONE
-             yes
-             #endif],
-             [HAVE_IOS="1"],
-             [HAVE_OSX="1"])
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+        [[#import <TargetConditionals.h>
+          #if TARGET_OS_IPHONE == 0
+          #error this is not an IPHONE
+          #endif
+        ]])],
+        [HAVE_IOS="1"],
+        [HAVE_OSX="1"])
     ;;
   mingw32*)
     SYS=mingw32
diff --git a/src/Makefile.am b/src/Makefile.am
index fc66aa6bbd39475b18eb014795f10ba6b6feff59..c26886ee551377344d812ffa29768a204c958493 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -75,6 +75,11 @@ libring_la_CFLAGS = \
 
 libring_la_CXXFLAGS = @JSONCPP_CFLAGS@
 
+if HAVE_LINUX
+#needed to compile the .so
+libring_la_CXXFLAGS += -fPIC
+endif
+
 libring_la_SOURCES = \
 		buildinfo.cpp \
 		conference.cpp \
@@ -112,7 +117,7 @@ libring_la_SOURCES = \
 		noncopyable.h \
 		utf8_utils.h \
 		ring_types.h \
-		compiler_intrinsics.h \
+		intrin.h \
 		array_size.h \
 		account_schema.h \
 		registration_states.h \