Index: ../trunk-jpl/src/c/modules/QmuStatisticsx/QmuStatisticsx.cpp =================================================================== --- ../trunk-jpl/src/c/modules/QmuStatisticsx/QmuStatisticsx.cpp (revision 25638) +++ ../trunk-jpl/src/c/modules/QmuStatisticsx/QmuStatisticsx.cpp (revision 25639) @@ -173,14 +173,14 @@ /*figure out size of file, and read the whole thing:*/ _printf0_(" reading file:\n"); - fseek (fid, 0, SEEK_END); + fseek(fid, 0, SEEK_END); length = ftell (fid); - fseek (fid, 0, SEEK_SET); + fseek(fid, 0, SEEK_SET); buffer = xNew(length); - fread (buffer, sizeof(char), length, fid); + fread(buffer, sizeof(char), length, fid); /*close file:*/ - fclose (fid); + fclose(fid); /*create a memory stream with this buffer:*/ _printf0_(" processing file:\n"); Index: ../trunk-jpl/m4/issm_options.m4 =================================================================== --- ../trunk-jpl/m4/issm_options.m4 (revision 25638) +++ ../trunk-jpl/m4/issm_options.m4 (revision 25639) @@ -191,9 +191,15 @@ ) AC_MSG_CHECKING([if this is a Mac build]) + MAC_FMEMOPEN=0 case "${host_os}" in *darwin*) IS_MAC=yes + if [[ $(system_profiler SPSoftwareDataType | $(which grep) "System Version:" | sed -e "s/[[:space:]]*System Version: macOS //" | cut -d "." -f 2) -ge 13 ]]; then + MAC_FMEMOPEN=yes + else + MAC_FMEMOPEN=no + fi ;; *) IS_MAC=no @@ -200,6 +206,7 @@ ;; esac AM_CONDITIONAL([MAC], [test "${IS_MAC}" == "yes"]) + AM_CONDITIONAL([MAC_FMEMOPEN], [test "${MAC_FMEMOPEN}" == "yes"]) AC_MSG_RESULT([${IS_MAC}]) IS_WINDOWS=no @@ -2331,7 +2338,7 @@ AC_DEFINE([_HAVE_GMSH_], [1], [with Gmsh in ISSM src]) AC_MSG_CHECKING(for Gmsh version) - GMSH_VERSION_MAJOR=`${GMSH_ROOT}/bin/gmsh -info | grep "Version" | sed -e "s/Version@<:@@<:@:blank:@:>@@:>@*:@<:@@<:@:blank:@:>@@:>@//" | cut -d "." -f1` + GMSH_VERSION_MAJOR=`${GMSH_ROOT}/bin/gmsh -info | grep "Version" | sed -e "s/Version@<:@@<:@:blank:@:>@@:>@*:@<:@@<:@:blank:@:>@@:>@//" | cut -d "." -f 1` AC_MSG_RESULT([${GMSH_VERSION_MAJOR}]) AC_DEFINE_UNQUOTED(_GMSH_VERSION_MAJOR_, $GMSH_VERSION_MAJOR, [Gmsh major version]) fi Index: ../trunk-jpl/src/c/modules/QmuStatisticsx/QmuStatisticsx.h =================================================================== --- ../trunk-jpl/src/c/modules/QmuStatisticsx/QmuStatisticsx.h (revision 25638) +++ ../trunk-jpl/src/c/modules/QmuStatisticsx/QmuStatisticsx.h (revision 25639) @@ -6,6 +6,10 @@ #include "../../classes/classes.h" +#if MAC && !MAC_FMEMOPEN +#include "../../ext/fmemopen/fmemopen.h" +#endif + int ComputeMeanVariance(Parameters* parameters,Results* results,int color, ISSM_MPI_Comm statcomm); int ComputeSampleSeries(Parameters* parameters,Results* results,int color, ISSM_MPI_Comm statcomm); int OutputStatistics(Parameters* parameters,Results* results,int color,ISSM_MPI_Comm statcomm); Index: ../trunk-jpl/src/c/Makefile.am =================================================================== --- ../trunk-jpl/src/c/Makefile.am (revision 25638) +++ ../trunk-jpl/src/c/Makefile.am (revision 25639) @@ -20,8 +20,18 @@ #}}} #Core sources +issm_sources = + +#GLIBC sources {{{ +if MAC +if !MAC_FMEMOPEN +issm_sources += \ + ./ext/fmemopen/fmemopen.c +endif +endif +#}}} + #BAMG sources {{{ -issm_sources = if BAMG issm_sources += \ ./bamg/BamgGeom.cpp \