Verified Commit beb99d98 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Build system improvements for MSYS2

On Windows/MinGW, use the -static linking flag. This enforces static linking of
Boost libraries, which is needed on MSYS2.

Also, use AM_CXXFLAGS and AM_LDFLAGS variables for changing flags, since
CXXFLAGS and LDFLAGS are user variables.
parent f223af91
Pipeline #277 passed with stage
in 1 minute and 21 seconds
......@@ -30,23 +30,22 @@ AX_CXX_COMPILE_STDCXX_14
AC_CANONICAL_HOST
case ${host_os} in
*mingw32*)
# On mingw32, we don't want dynamic libgcc
# Note that static-libstdc++ is only supported since GCC 4.5 (but generates no error on older versions)
LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++ -static-libgfortran"
have_windows="yes"
# On Windows, we don't want dynamic linking
AM_LDFLAGS="-static"
AC_SUBST([AM_LDFLAGS])
;;
*cygwin*)
AC_MSG_WARN([You are compiling for the Cygwin target. This means that the preprocessor will])
AC_MSG_WARN([not run from MATLAB unless you add the Cygwin DLL to the path.])
AC_MSG_WARN([This is probably not what you want. Consider using a MinGW cross-compiler.])
have_windows="yes"
;;
esac
# Use C++ for testing headers
AC_LANG([C++])
CXXFLAGS="$CXXFLAGS -Wall -Wno-parentheses"
AM_CXXFLAGS="-Wall -Wno-parentheses"
AC_SUBST([AM_CXXFLAGS])
# If default 'ar' is not available, try to find one with a host prefix (see ticket #145)
AC_CHECK_PROGS([AR], [ar ${host_alias}-ar])
......
......@@ -65,7 +65,7 @@ EXTRA_DIST = \
# The -I. is for <FlexLexer.h>
dynare_m_CPPFLAGS = $(BOOST_CPPFLAGS) -I.
dynare_m_LDFLAGS = $(BOOST_LDFLAGS)
dynare_m_LDFLAGS = $(AM_LDFLAGS) $(BOOST_LDFLAGS)
dynare_m_LDADD = macro/libmacro.a $(BOOST_FILESYSTEM_LIB) $(BOOST_SYSTEM_LIB)
DynareFlex.cc FlexLexer.h: DynareFlex.ll
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment