From ba3aa72e44fe2ea816d11efa2489d1e8dcfe674e Mon Sep 17 00:00:00 2001
From: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
Date: Tue, 31 May 2016 19:16:19 -0400
Subject: [PATCH] fix configure.ac

Into the darwin OS detection the AC_EGREP_CPP macro is used.
This causes an bugged configure file issued and this one
prevents Linux platform to generate shared-library.

Following this link:
https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/AC_005fACT_005fIFELSE-vs-AC_005fTRY_005fACT.html

Using AC_EGREP_CPP is a bad way to test a C preprocessor.
This patch changes this call by AC_COMPILE_IFELSE + AC_LANG_PROGRAM calls:
- this is a better way to process
- this fix the linux shared build

Change-Id: I150666f2bc45a48d021110025f2d486a9750d333
Tuleap: #699
---
 configure.ac    | 16 ++++++++--------
 src/Makefile.am |  7 ++++++-
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index c4bb901a70..b0884c1370 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 fc66aa6bbd..c26886ee55 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 \
-- 
GitLab