diff --git a/doc/manual/source/installation-and-configuration.rst b/doc/manual/source/installation-and-configuration.rst index 256c0d3b90689c90ec8ceeaabea144f613b93686..cc0a4f69e0a18c5c02b2c045c59c894d326927b9 100644 --- a/doc/manual/source/installation-and-configuration.rst +++ b/doc/manual/source/installation-and-configuration.rst @@ -97,14 +97,8 @@ Note that several versions of Dynare can coexist (by default in ``/Applications/Dynare``), as long as you correctly adjust your path settings (see :ref:`words-warning`). -To install Dynare for Octave, first install Homebrew following the -instructions on their site: `https://brew.sh/ -<https://brew.sh/>`__. Then install Octave, issuing the command ``brew -install octave`` at the Terminal prompt. You can then install the -latest stable version of Dynare by typing ``brew install dynare`` at -the Terminal prompt. You can also pass options to the installation -command. These options can be viewed by typing ``brew info dynare`` at -the Terminal prompt. +Dynare for Octave works with Octave installed via the package located here: +`https://octave-app.org <https://octave-app.org>`__. For other systems @@ -209,10 +203,10 @@ command; the packaging does it for you. Under Arch Linux, you need to do:: octave:1> addpath /usr/lib/dynare/matlab -Under macOS, assuming that you have installed Dynare and Octave via -Homebrew, type:: +Under macOS, assuming you have installed Octave via `https://octave-app.org +<https://octave-app.org>`__, type:: - octave:1> addpath /usr/local/opt/dynare/lib/dynare/matlab + octave:1> addpath /Applications/Dynare/4.x.y/matlab If you don’t want to type this command every time you run Octave, you can put it in a file called ``.octaverc`` in your home directory diff --git a/macOS/build.sh b/macOS/build.sh index 5de924a83bc20bdb60d2befe675ea3295e6ea603..625846f967545599b09050efe15267d5e117797f 100755 --- a/macOS/build.sh +++ b/macOS/build.sh @@ -152,15 +152,18 @@ cp -L "$ROOTDIR"/mex/matlab/* "$PKGFILES" ## Create mex for Octave ## cd "$ROOTDIR"/mex/build/octave -CC=$CC CXX=$CXX ./configure \ +OCTAVE_VERSION=$(grep OCTAVE_VERSION "$ROOTDIR"/macOS/deps/versions.mk | cut -d'=' -f2 | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') +OCTAVE_USR_DIR="/Applications/Octave-$OCTAVE_VERSION.app/Contents/Resources/usr" +OCTAVE_BIN_DIR="$OCTAVE_USR_DIR/Cellar/octave-octave-app@$OCTAVE_VERSION/$OCTAVE_VERSION/bin" +PATH="$OCTAVE_BIN_DIR:$PATH" CC=$CC CXX=$CXX ./configure \ PACKAGE_VERSION="$VERSION" \ PACKAGE_STRING="dynare $VERSION" \ CXXFLAGS=-I/usr/local/include \ - LDFLAGS="-static-libgcc -L/usr/local/lib" \ + LDFLAGS="-static-libgcc -L$OCTAVE_USR_DIR/lib " \ --with-gsl="$LIB64"/gsl \ --with-matio="$LIB64"/matio \ --with-slicot="$LIB64"/Slicot/with-underscore -make -j"$NTHREADS" +PATH="$OCTAVE_BIN_DIR:$PATH" make -j"$NTHREADS" cp -L "$ROOTDIR"/mex/octave/* "$PKGFILES"/mex/octave echo -e "function v = supported_octave_version\nv=\"$(octave --eval "disp(OCTAVE_VERSION)")\";\nend" > "$PKGFILES"/matlab/supported_octave_version.m diff --git a/macOS/deps/versions.mk b/macOS/deps/versions.mk index c3e232fe34baca6372497762adb337250baa1fd1..19f041cf5b8474883f39f03c5723fa075c32408a 100644 --- a/macOS/deps/versions.mk +++ b/macOS/deps/versions.mk @@ -1,2 +1,3 @@ SLICOT_VERSION = 5.0+20101122 X13AS_VERSION = 1.1_B39 +OCTAVE_VERSION = 4.4.1 diff --git a/mex/build/octave/configure.ac b/mex/build/octave/configure.ac index 56ebe1eb16a70417c2ef5dac78a5967109fb1532..efb587e3a46ab085eb90d6bcf9317cc7f97070f6 100644 --- a/mex/build/octave/configure.ac +++ b/mex/build/octave/configure.ac @@ -32,6 +32,14 @@ FFLAGS="$($MKOCTFILE -p FFLAGS) -Wall" CXXFLAGS="$($MKOCTFILE -p CXXFLAGS) -Wall -Wno-parentheses -Wold-style-cast" LDFLAGS="$($MKOCTFILE -p LFLAGS) $($MKOCTFILE -p LDFLAGS)" +AC_CANONICAL_HOST +case ${host_os} in + darwin*) + CXXFLAGS="$($MKOCTFILE -p ALL_CXXFLAGS) -Wall -Wno-parentheses -Wold-style-cast -O2" + LDFLAGS+="$($MKOCTFILE -p OCTAVE_LIBS)" + ;; +esac + OCTAVE_VERSION=$($MKOCTFILE -v 2>&1 | sed 's/mkoctfile, version //') AX_COMPARE_VERSION([$OCTAVE_VERSION], [lt], [4.2], [AC_MSG_ERROR([Your Octave is too old, please upgrade to version 4.2 at least (or disable Octave support with --disable-octave).])])