2008-11-07 00:20:15 +00:00
|
|
|
AC_DEFUN([BOINC_SET_COMPILE_FLAGS],[
|
|
|
|
dnl This function sets the compiler flags depending upon options
|
|
|
|
dnl set on the configure command line.
|
|
|
|
|
2019-04-20 11:31:13 +00:00
|
|
|
AC_ARG_ENABLE(debug,
|
2008-11-07 00:20:15 +00:00
|
|
|
AS_HELP_STRING([--enable-debug],
|
|
|
|
[enable tracing and debugging flags for all components]),
|
|
|
|
[enable_debug="$enableval"],
|
|
|
|
[])
|
|
|
|
|
2019-04-20 11:31:13 +00:00
|
|
|
AC_ARG_ENABLE(optimize,
|
2008-11-07 00:20:15 +00:00
|
|
|
AS_HELP_STRING([--enable-optimize],
|
|
|
|
[enable optimization flags for all components]),
|
|
|
|
[enable_optimize="$enableval"],
|
|
|
|
[])
|
|
|
|
|
2019-04-20 11:31:13 +00:00
|
|
|
AC_ARG_ENABLE(generic-processor,
|
2008-11-07 00:20:15 +00:00
|
|
|
AS_HELP_STRING([--enable-generic-processor],
|
|
|
|
[build for a generic processor rather than a specific instruction set]),
|
|
|
|
[enable_generic_processor="$enableval"],
|
|
|
|
[])
|
|
|
|
|
2010-06-25 18:54:37 +00:00
|
|
|
dnl enable compiler warnings
|
|
|
|
if test x${ac_cv_c_compiler_gnu} = xyes ; then
|
|
|
|
BOINC_CHECK_CFLAG(-Wall)
|
|
|
|
BOINC_CHECK_CXXFLAG(-Wall)
|
|
|
|
fi
|
2008-11-07 00:20:15 +00:00
|
|
|
|
|
|
|
dnl enable debug mode on all components using standard debug flags
|
|
|
|
|
|
|
|
if test x${enable_debug} = xyes ; then
|
|
|
|
BOINC_CHECK_CFLAG(-g)
|
|
|
|
BOINC_CHECK_CXXFLAG(-g)
|
|
|
|
BOINC_CHECK_LDFLAG(-g)
|
|
|
|
CXXFLAGS="$CXXFLAGS -DDEBUG -D_DEBUG"
|
|
|
|
CFLAGS="$CFLAGS -DDEBUG -D_DEBUG"
|
2019-04-20 11:31:13 +00:00
|
|
|
fi
|
2008-11-07 00:20:15 +00:00
|
|
|
|
|
|
|
if test x${enable_optimize} = xyes ; then
|
2009-02-26 00:23:23 +00:00
|
|
|
if test x${ac_cv_c_compiler_gnu} = xyes ; then
|
|
|
|
BOINC_CHECK_CFLAG(-ffast-math)
|
|
|
|
else
|
|
|
|
BOINC_CHECK_CFLAG(-fast)
|
|
|
|
fi
|
2008-11-07 00:20:15 +00:00
|
|
|
BOINC_CHECK_CFLAG(-O3)
|
2009-02-26 00:23:23 +00:00
|
|
|
if test x${ac_cv_cxx_compiler_gnu} = xyes ; then
|
|
|
|
BOINC_CHECK_CXXFLAG(-ffast-math)
|
|
|
|
else
|
|
|
|
BOINC_CHECK_CXXFLAG(-fast)
|
|
|
|
fi
|
2009-01-22 22:26:39 +00:00
|
|
|
BOINC_CHECK_CXXFLAG(-O3)
|
2019-04-20 11:31:13 +00:00
|
|
|
fi
|
2008-11-07 00:20:15 +00:00
|
|
|
|
2009-01-22 21:39:40 +00:00
|
|
|
if test x${enable_generic_processor} = xyes ; then
|
2008-11-07 00:20:15 +00:00
|
|
|
case ${target} in
|
2019-04-20 11:31:13 +00:00
|
|
|
i*86-*-darwin*)
|
2008-11-07 00:20:15 +00:00
|
|
|
BOINC_CHECK_CFLAG(-march=pentium4)
|
|
|
|
BOINC_CHECK_CFLAG(-mtune=prescott)
|
2009-01-22 22:26:39 +00:00
|
|
|
BOINC_CHECK_CXXFLAG(-march=pentium4)
|
2008-11-07 00:20:15 +00:00
|
|
|
BOINC_CHECK_CXXFLAG(-mtune=prescott)
|
|
|
|
;;
|
2019-04-20 11:31:13 +00:00
|
|
|
i*86-*)
|
2008-11-07 00:20:15 +00:00
|
|
|
dnl gcc
|
2009-01-22 21:39:40 +00:00
|
|
|
if test x${ac_cv_c_compiler_gnu} = xyes ; then
|
|
|
|
BOINC_CHECK_CFLAG(-march=i486)
|
|
|
|
BOINC_CHECK_CFLAG(-mtune=generic)
|
|
|
|
else
|
2009-02-26 00:23:23 +00:00
|
|
|
dnl sun studio
|
|
|
|
BOINC_CHECK_CFLAG(-xarch=386)
|
2008-11-07 00:20:15 +00:00
|
|
|
dnl dmc
|
|
|
|
BOINC_CHECK_CFLAG(-3)
|
|
|
|
fi
|
2009-01-22 21:39:40 +00:00
|
|
|
if test x${ac_cv_cxx_compiler_gnu} = xyes ; then
|
|
|
|
BOINC_CHECK_CXXFLAG(-march=i486)
|
|
|
|
BOINC_CHECK_CXXFLAG(-mtune=generic)
|
|
|
|
else
|
2009-02-26 00:23:23 +00:00
|
|
|
BOINC_CHECK_CXXFLAG(-xarch=386)
|
2008-11-07 00:20:15 +00:00
|
|
|
BOINC_CHECK_CXXFLAG(-3)
|
|
|
|
fi
|
|
|
|
;;
|
2019-04-20 11:31:13 +00:00
|
|
|
x86_64-*|amd64-*)
|
2008-11-07 00:20:15 +00:00
|
|
|
dnl gcc
|
2009-02-26 00:23:23 +00:00
|
|
|
if test x${ac_cv_c_compiler_gnu} = xyes ; then
|
2019-04-20 11:31:13 +00:00
|
|
|
BOINC_CHECK_CFLAG(-msse2)
|
|
|
|
BOINC_CHECK_CFLAG(-march=opteron)
|
|
|
|
BOINC_CHECK_CFLAG(-mtune=generic)
|
2009-02-26 00:23:23 +00:00
|
|
|
else
|
2019-04-20 11:31:13 +00:00
|
|
|
BOINC_CHECK_CFLAG(-xarch=amd64)
|
2009-02-26 00:23:23 +00:00
|
|
|
fi
|
|
|
|
if test x${ac_cv_cxx_compiler_gnu} = xyes ; then
|
2019-04-20 11:31:13 +00:00
|
|
|
BOINC_CHECK_CXXFLAG(-msse2)
|
|
|
|
BOINC_CHECK_CXXFLAG(-march=opteron)
|
|
|
|
BOINC_CHECK_CXXFLAG(-mtune=generic)
|
2009-02-26 00:23:23 +00:00
|
|
|
else
|
|
|
|
BOINC_CHECK_CXXFLAG(-xarch=amd64)
|
|
|
|
fi
|
2008-11-07 00:20:15 +00:00
|
|
|
;;
|
|
|
|
sparc-*)
|
|
|
|
dnl gcc
|
2009-01-22 21:39:40 +00:00
|
|
|
if test x${ac_cv_c_compiler_gnu} = xyes ; then
|
2019-04-20 11:31:13 +00:00
|
|
|
BOINC_CHECK_CFLAG(-march=v8)
|
|
|
|
BOINC_CHECK_CFLAG(-mcpu=v8)
|
|
|
|
BOINC_CHECK_CFLAG(-mtune=ultrasparc)
|
2009-01-22 21:39:40 +00:00
|
|
|
else
|
2008-11-07 00:20:15 +00:00
|
|
|
dnl Studio 10
|
2019-04-20 11:31:13 +00:00
|
|
|
BOINC_CHECK_CFLAG(-xarch=v8)
|
2009-01-22 21:39:40 +00:00
|
|
|
fi
|
|
|
|
if test x${ac_cv_cxx_compiler_gnu} = xyes ; then
|
2019-04-20 11:31:13 +00:00
|
|
|
BOINC_CHECK_CXXFLAG(-march=v8)
|
|
|
|
BOINC_CHECK_CXXFLAG(-mcpu=v8)
|
|
|
|
BOINC_CHECK_CXXFLAG(-mtune=ultrasparc)
|
2009-01-22 21:39:40 +00:00
|
|
|
else
|
2019-04-20 11:31:13 +00:00
|
|
|
BOINC_CHECK_CXXFLAG(-xarch=v8)
|
2009-01-22 21:39:40 +00:00
|
|
|
fi
|
2008-11-07 00:20:15 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2019-04-20 10:06:24 +00:00
|
|
|
|
|
|
|
if test x${enable_unit_tests} = xyes ; then
|
|
|
|
BOINC_CHECK_CFLAG(--coverage)
|
|
|
|
BOINC_CHECK_CXXFLAG(--coverage)
|
|
|
|
LDFLAGS="$LDFLAGS --coverage"
|
|
|
|
fi
|
|
|
|
|
2008-11-07 00:20:15 +00:00
|
|
|
])
|