1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
AC_DEFUN([SING_SHOW_FLAGS], [
echo "/* --------------- $1 --------------- */";
AC_MSG_CHECKING([ CFLAGS?..])
AC_MSG_RESULT(${CFLAGS:-unset})
AC_MSG_CHECKING([CXXFLAGS?..])
AC_MSG_RESULT(${CXXFLAGS:-unset})
AC_MSG_CHECKING([CPPFLAGS?..])
AC_MSG_RESULT(${CPPFLAGS:-unset})
AC_MSG_CHECKING([ DEFS?..])
AC_MSG_RESULT(${DEFS:-unset})
AC_MSG_CHECKING([ LDFLAGS?..])
AC_MSG_RESULT(${LDFLAGS:-unset})
AC_MSG_CHECKING([ LIBS?..])
AC_MSG_RESULT(${LIBS:-unset})
AC_MSG_CHECKING([ GCC?..])
AC_MSG_RESULT(${GCC:-unset})
AC_MSG_CHECKING([ CC?..])
AC_MSG_RESULT(${CC:-unset})
AC_MSG_CHECKING([ GXX?..])
AC_MSG_RESULT(${GXX:-unset})
AC_MSG_CHECKING([ CXX?..])
AC_MSG_RESULT(${CXX:-unset})
# echo "/* =============== $1 =============== */";
])
AC_DEFUN([SING_RESET_FLAGS], [
AC_MSG_WARN([Please note that we set empty defaults for \`CFLAGS' and \`CXXFLAGS' (instead of \`-g -O')])
: ${CFLAGS:=""}
: ${CXXFLAGS:=""}
])
AC_DEFUN([SING_CHECK_SET_ARGS], [
# SING_SHOW_FLAGS([Initial state?...])dnl
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug], [build the debugging version of the libraries]),
[ENABLE_DEBUG="$enableval"], [ENABLE_DEBUG=""])
AC_MSG_CHECKING([debugging checks should be embedded])
if test "x${ENABLE_DEBUG}" != xyes; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
fi
AC_ARG_ENABLE([optimizationflags],
AS_HELP_STRING([--disable-optimizationflags], [build the without default optimization flags]),
[ENABLE_OPTIMIZATION="$enableval"], [ENABLE_OPTIMIZATION="yeah"])
if test "x${ENABLE_DEBUG}" = xyes; then
SINGULAR_CFLAGS=""
if test "x${ENABLE_OPTIMIZATION}" = xyeah; then
ENABLE_OPTIMIZATION="no"
AC_MSG_WARN([Please note that we disable implicit (default) optimization flags since you have enabled the debug flags... ])
fi
else
SINGULAR_CFLAGS="-DSING_NDEBUG -DOM_NDEBUG"
# for now let '-DSING_NDEBUG -DOM_NDEBUG' be here...
AC_DEFINE([OM_NDEBUG],1,"Disable OM Debug")
AC_DEFINE([SING_NDEBUG],1,"Disable Singular Debug")
fi
if test "x${ENABLE_OPTIMIZATION}" = xyeah; then
ENABLE_OPTIMIZATION="yes"
fi
if test "x${ENABLE_OPTIMIZATION}" = xyes; then
if test "x${ENABLE_DEBUG}" = xyes; then
AC_MSG_WARN([Please note that you will be using our optimization flags together with debug flags... ])
fi
fi
AC_MSG_CHECKING([whether optimization flags should be used])
if test "x${ENABLE_OPTIMIZATION}" = xyes; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AM_CONDITIONAL(WANT_DEBUG, test x"${ENABLE_DEBUG}" = xyes)
AM_CONDITIONAL(WANT_OPTIMIZATIONFLAGS, test x"${ENABLE_OPTIMIZATION}" = xyes)
AC_DEFINE_UNQUOTED([SINGULAR_CFLAGS],"$SINGULAR_CFLAGS",[SINGULAR_CFLAGS])
AC_SUBST(SINGULAR_CFLAGS)
# SING_SHOW_FLAGS([checking flags....])
FLAGS="-pipe -fno-common"
AC_LANG_PUSH([C])
AX_APPEND_COMPILE_FLAGS(${FLAGS}, [CFLAGS])
AC_LANG_POP([C])
AC_LANG_PUSH([C++])
AX_APPEND_COMPILE_FLAGS(${FLAGS}, [CXXFLAGS])
# separate parts of Singular have to be real C++ :)
FFLAGS="-fexceptions -frtti"
AX_APPEND_COMPILE_FLAGS(${FFLAGS}, [FEXCEPTIONSFRTTI_CXXFLAGS])
AC_SUBST(FEXCEPTIONSFRTTI_CXXFLAGS)
AC_LANG_POP([C++])
AX_APPEND_LINK_FLAGS(${FLAGS})
if test "x${ENABLE_DEBUG}" = xyes; then
DBGFLAGS="-g -ftrapv -fdiagnostics-show-option -Wall -Wextra -fno-delete-null-pointer-checks"
# -pedantic too strict ??? -Wvla -Wno-long-long ???
AC_LANG_PUSH([C])
AX_APPEND_COMPILE_FLAGS(${DBGFLAGS}, [CFLAGS])
AC_LANG_POP([C])
AC_LANG_PUSH([C++])
AX_APPEND_COMPILE_FLAGS(${DBGFLAGS}, [CXXFLAGS])
AC_LANG_POP([C++])
AX_APPEND_LINK_FLAGS(${DBGFLAGS})
fi
## for clang: -Wunneeded-internal-declaration
if test "x${ENABLE_OPTIMIZATION}" != xno; then
OPTFLAGS="-g -O3 -Wno-unused-function -Wno-trigraphs -Wno-unused-parameter -Wunknown-pragmas -Wno-unused-variable -fomit-frame-pointer -fwrapv -fvisibility=default -finline-functions -fno-exceptions -fno-threadsafe-statics -fno-enforce-eh-specs -fconserve-space -funroll-loops -fno-delete-null-pointer-checks"
# -O3 - crashes gcc???!!!
# -fpermissive
AC_LANG_PUSH([C])
AX_APPEND_COMPILE_FLAGS(${OPTFLAGS}, [CFLAGS])
AC_LANG_POP([C])
AC_LANG_PUSH([C++])
AX_APPEND_COMPILE_FLAGS(${OPTFLAGS}, [CXXFLAGS])
AX_APPEND_COMPILE_FLAGS([-fno-rtti], [CXXFLAGS])
# AX_APPEND_COMPILE_FLAGS([-fno-threadsafe-statics -fno-enforce-eh-specs -fconserve-space], [CXXFLAGS])
### AX_APPEND_COMPILE_FLAGS([-fno-implicit-templates], [CXXFLAGS]) # problems due to STL
AC_LANG_POP([C++])
AX_APPEND_LINK_FLAGS(${OPTFLAGS})
# AX_APPEND_LINK_FLAGS([-fno-threadsafe-statics -fno-enforce-eh-specs -fconserve-space])
### AX_APPEND_LINK_FLAGS([-fno-implicit-templates]) # see above :(
# AX_APPEND_LINK_FLAGS([ ])
fi
FLAGS2="-Qunused-arguments"
AC_LANG_PUSH([C])
AX_APPEND_COMPILE_FLAGS(${FLAGS2}, [CFLAGS])
AC_LANG_POP([C])
AC_LANG_PUSH([C++])
AX_APPEND_COMPILE_FLAGS(${FLAGS2}, [CXXFLAGS])
AC_LANG_POP([C++])
AX_APPEND_LINK_FLAGS(${FLAGS2})
# SING_SHOW_FLAGS([before PROG_C_CC])
AC_PROG_CC
AC_PROG_CXX
])
|