summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2017-03-20 15:52:37 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2017-03-20 15:52:37 +0100
commit53eea5892cd1d51f802533adb9ea94e04b4ce86b (patch)
treeb6875f0aab543e1551c58bfe12d630717894284c /build
parent4d0d9ca396378813f8559f479ff9a64b0881a627 (diff)
parentcd32957185094680b84014e1ea8411ce6b142f74 (diff)
downloadastra-53eea5892cd1d51f802533adb9ea94e04b4ce86b.tar.gz
astra-53eea5892cd1d51f802533adb9ea94e04b4ce86b.tar.bz2
astra-53eea5892cd1d51f802533adb9ea94e04b4ce86b.tar.xz
astra-53eea5892cd1d51f802533adb9ea94e04b4ce86b.zip
Merge branch 'macOS'
Diffstat (limited to 'build')
-rw-r--r--build/linux/Makefile.in12
-rwxr-xr-xbuild/linux/autogen.sh7
-rw-r--r--build/linux/configure.ac21
3 files changed, 26 insertions, 14 deletions
diff --git a/build/linux/Makefile.in b/build/linux/Makefile.in
index 9066f0a..1c0c56a 100644
--- a/build/linux/Makefile.in
+++ b/build/linux/Makefile.in
@@ -4,6 +4,7 @@ cuda=@HAVECUDA@
matlab=@HAVEMATLAB@
python=@HAVEPYTHON@
boostutf=@HAVEBOOSTUTF@
+macos=@IS_MACOS@
MATLAB_ROOT=@MATLAB_ROOT@
octave=@HAVEOCTAVE@
@@ -49,7 +50,8 @@ CXXFLAGS+=-g -O3 -Wall -Wshadow
LIBS+=-lpthread
LDFLAGS+=-g
-CPPFLAGS+=@CPPFLAGS_OS@
+CXXFLAGS+=@CXXFLAGS_OS@
+LDFLAGS+=@LDFLAGS_OS@
BOOSTUTF_LIBS=@LIBS_BOOSTUTF@
@@ -64,9 +66,11 @@ endif
ifeq ($(matlab),yes)
# TODO: Do we also want -fopenmp for octave?
CPPFLAGS+=-I$(MATLAB_ROOT)/extern/include -DMATLAB_MEX_FILE
+ifeq ($(macos),no)
CXXFLAGS+=-fopenmp
LDFLAGS+=-fopenmp
endif
+endif
# MODLDFLAGS are the base LDFLAGS for matlab, octave, python modules
MODLDFLAGS=$(LDFLAGS) -L$(abs_top_builddir)/.libs
@@ -301,6 +305,12 @@ mex: $(MATLAB_MEX)
%.$(MEXSUFFIX): %.o $(MATLAB_CXX_OBJECTS) libastra.la
$(MEX) LDFLAGS="$(MEXLDFLAGS)" $(MEXFLAGS) $(LIBS) $(MEXLIBS) -lastra -output $* $*.o $(MATLAB_CXX_OBJECTS)
+ifeq ($(install_type),module)
+ifeq ($(macos),yes)
+ @# tell macOS dynamic loader to look in mex directory for libastra.0.dylib
+ install_name_tool -change `otool -DX .libs/$(SONAME)` @loader_path/$(SONAME) $@
+endif
+endif
ifeq ($(python),yes)
matlab/mex/astra_mex_plugin_c.$(MEXSUFFIX): matlab/mex/astra_mex_plugin_c.o $(MATLAB_CXX_OBJECTS) libastra.la
diff --git a/build/linux/autogen.sh b/build/linux/autogen.sh
index 544fdeb..bb3b5cc 100755
--- a/build/linux/autogen.sh
+++ b/build/linux/autogen.sh
@@ -12,8 +12,11 @@ if test $? -ne 0; then
exit 1
fi
-case `uname` in Darwin*) LIBTOOLIZEBIN=glibtoolize ;;
- *) LIBTOOLIZEBIN=libtoolize ;; esac
+case `uname` in
+ Darwin*)
+ test -x "`which glibtoolize 2>/dev/null`" && LIBTOOLIZEBIN=glibtoolize || LIBTOOLIZEBIN=libtoolize ;;
+ *)
+ LIBTOOLIZEBIN=libtoolize ;; esac
$LIBTOOLIZEBIN --install --force > /dev/null 2>&1
if test $? -ne 0; then
diff --git a/build/linux/configure.ac b/build/linux/configure.ac
index 46c84a5..b95d94f 100644
--- a/build/linux/configure.ac
+++ b/build/linux/configure.ac
@@ -102,14 +102,7 @@ if test x"$NVCC" != xno; then
HAVECUDA=yes
BACKUP_CUDA_LDFLAGS="$LDFLAGS"
if test x"$with_cuda" != x -a x"$with_cuda" != xyes; then
- case $host_cpu in
- x86_64)
- LDFLAGS_CUDA="-L$with_cuda/lib64"
- ;;
- *)
- LDFLAGS_CUDA="-L$with_cuda/lib"
- ;;
- esac
+ test -d $with_cuda/lib64 && LDFLAGS_CUDA="-L$with_cuda/lib64" || LDFLAGS_CUDA="-L$with_cuda/lib"
CPPFLAGS_CUDA="-I$with_cuda/include"
LDFLAGS="$LDFLAGS $LDFLAGS_CUDA"
fi
@@ -257,14 +250,20 @@ AC_SUBST(HAVEPYTHON)
AC_CANONICAL_HOST
case $host_os in
darwin* )
- CPPFLAGS_OS="-stdlib=libstdc++ -mmacosx-version-min=10.6"
+ CXXFLAGS_OS="-stdlib=libstdc++ -mmacosx-version-min=10.6"
+ LDFLAGS_OS="-stdlib=libstdc++"
+ IS_MACOS=yes
;;
*)
- CPPFLAGS_OS=""
+ CXXFLAGS_OS=""
+ LDFLAGS_OS=""
+ IS_MACOS=no
;;
esac
-AC_SUBST(CPPFLAGS_OS)
+AC_SUBST(CXXFLAGS_OS)
+AC_SUBST(LDFLAGS_OS)
+AC_SUBST(IS_MACOS)
# For some reason, some older versions of autoconf produce a config.status
# that disables all lines looking like VPATH=@srcdir@