From ad2c44f8980dec7c5d7a7d9022d9e83f3078856c Mon Sep 17 00:00:00 2001
From: Incardona Pietro <incardon@mpi-cbg.de>
Date: Thu, 25 Nov 2021 11:47:48 +0100
Subject: [PATCH] clangomp

---
 configure             |  8 ++++++++
 install               | 13 +++++++++++++
 script/solve_clangomp | 19 +++++++++++++++++++
 3 files changed, 40 insertions(+)
 create mode 100755 script/solve_clangomp

diff --git a/configure b/configure
index a67917af6..d02859b34 100755
--- a/configure
+++ b/configure
@@ -597,6 +597,14 @@ if [ $? != 0 ]; then
 	    echo "Analyze error $ecod"
 	    exit $ecod
 	  fi
+	elif [ -f ../openfpm_devices/error_code ]; then
+          ecod=$(cat ../openfpm_devices/error_code)
+          if [ x"$ecod" == x"0" ]; then
+            exit 1
+          else
+            echo "Analyze error $ecod"
+            exit $ecod
+          fi
 	else
 	  exit 1
 	fi
diff --git a/install b/install
index d7f8e4411..6b7fc8730 100755
--- a/install
+++ b/install
@@ -9,6 +9,7 @@ source script/set_mpi
 source script/conf_PETSC
 source script/update_openfpm
 source script/solve_python
+source script/solve_clangomp
 source script/install_gdbgui
 
 
@@ -400,6 +401,18 @@ else
             ./script/install_VCDEVEL.sh $i_dir $ncore $CC $CXX
             configure_options=" $configure_options --with-vcdevel=$i_dir/VCDEVEL "
             VCDEVEL_installed=1
+        elif [ $conf_err -eq 220 ]; then
+	    if [ x"$platform" == x"OSX" ]; then
+            	echo "OpenMP has not been found for your compiler"
+            	if [ $CLANGOMP_installed -eq 1 ]; then
+                	echo "Error the installation of openmp for clang failed"
+                	exit 1
+            	fi
+            	solve_clangomp $platform
+            	CLANGOMP_installed=1
+	    else
+	        exit 1
+	    fi
         elif [ $conf_err -ne 0 ]; then
             echo "I do not know how to recover from this error"
             exit 1
diff --git a/script/solve_clangomp b/script/solve_clangomp
new file mode 100755
index 000000000..08048c06d
--- /dev/null
+++ b/script/solve_clangomp
@@ -0,0 +1,19 @@
+
+#! /bin/bash 
+
+function solve_clangomp() {        
+source script/show_solutions
+source script/discover_package_manager
+discover_package_manager $1
+pcman=$discover_package_manager_ret
+
+if [ x"$pcman" = x"" ]; then
+        exit 1
+fi
+
+if [ x"$1" = x"osx" ]; then 
+        commands[0]="$pcman install clang-omp"
+        possible_solutions "${commands[@]}"
+fi 
+}
+
-- 
GitLab