mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Added checks for compiler options.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
91a4598b54
commit
2ffb7c6719
@ -1,6 +1,7 @@
|
|||||||
m4_include([m4.include/ac_onceonly.m4])
|
m4_include([m4.include/ac_onceonly.m4])
|
||||||
m4_include([m4.include/ax_path_lib_pcre.m4])
|
m4_include([m4.include/ax_path_lib_pcre.m4])
|
||||||
m4_include([m4.include/dx_doxygen.m4])
|
m4_include([m4.include/dx_doxygen.m4])
|
||||||
|
m4_include([m4.include/mc-cflags.m4])
|
||||||
m4_include([m4.include/mc-check-search-type.m4])
|
m4_include([m4.include/mc-check-search-type.m4])
|
||||||
m4_include([m4.include/mc-mcserver.m4])
|
m4_include([m4.include/mc-mcserver.m4])
|
||||||
m4_include([m4.include/ac-get-fs-info.m4])
|
m4_include([m4.include/ac-get-fs-info.m4])
|
||||||
|
17
configure.ac
17
configure.ac
@ -515,19 +515,18 @@ if test "$GLIBC21" != yes; then
|
|||||||
AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
|
AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl If default CFLAGS is used with gcc, add -Wall
|
MC_CHECK_CFLAGS
|
||||||
if test -z "$ac_env_CFLAGS_set"; then
|
|
||||||
if test -n "$GCC"; then
|
CFLAGS_OPTS=" -O2 "
|
||||||
CFLAGS="$CFLAGS -Wall"
|
CFLAGS_EXTRA=""
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test x$USE_MAINTAINER_MODE = xyes; then
|
if test x$USE_MAINTAINER_MODE = xyes; then
|
||||||
CFLAGS_WARNINGS="-Wall -Werror -Wwrite-strings -Wnested-externs -Wsign-compare -Wuninitialized"
|
CFLAGS_EXTRA="-Werror"
|
||||||
CFLAGS_DEBUG="-g3 -O -ggdb"
|
CFLAGS_OPTS="-g3 -O -ggdb"
|
||||||
CFLAGS="$CFLAGS $CFLAGS_WARNINGS $CFLAGS_DEBUG"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CFLAGS="$CFLAGS $mc_configured_cflags $CFLAGS_OPTS $CFLAGS_EXTRA"
|
||||||
|
|
||||||
AC_SUBST(CFLAGS)
|
AC_SUBST(CFLAGS)
|
||||||
AC_SUBST(CPPFLAGS)
|
AC_SUBST(CPPFLAGS)
|
||||||
AC_SUBST(LDFLAGS)
|
AC_SUBST(LDFLAGS)
|
||||||
|
70
m4.include/mc-cflags.m4
Normal file
70
m4.include/mc-cflags.m4
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
dnl @synopsis MC_CHECK_CFLAGS
|
||||||
|
dnl
|
||||||
|
dnl Check flags supported by compilator
|
||||||
|
dnl
|
||||||
|
dnl @author Slava Zanko <slavazanko@gmail.com>
|
||||||
|
dnl @version 2009-10-29
|
||||||
|
dnl @license GPL
|
||||||
|
dnl @copyright Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
AC_DEFUN([MC_CHECK_ONE_CFLAG],[
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([if gcc accepts $1])
|
||||||
|
|
||||||
|
safe_CFLAGS=$CFLAGS
|
||||||
|
CFLAGS="$1"
|
||||||
|
|
||||||
|
AC_TRY_COMPILE(, [
|
||||||
|
return 0;
|
||||||
|
],
|
||||||
|
[
|
||||||
|
mc_check_one_cflag=yes
|
||||||
|
],
|
||||||
|
[
|
||||||
|
mc_check_one_cflag=no
|
||||||
|
])
|
||||||
|
|
||||||
|
CFLAGS=$safe_CFLAGS
|
||||||
|
AC_MSG_RESULT([$mc_check_one_cflag])
|
||||||
|
|
||||||
|
if test x$mc_check_one_cflag = xyes; then
|
||||||
|
mc_configured_cflags="$mc_configured_cflags $1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([MC_CHECK_CFLAGS],[
|
||||||
|
mc_configured_cflags=""
|
||||||
|
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wunused-result])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wimplicit-int])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wimplicit-function-declaration])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wmissing-braces])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wparentheses])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wreturn-type])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wswitch])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wunused-function])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wunused-label])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wunused-parameter])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wunused-value])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wunused-variable])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wuninitialized])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wdeclaration-after-statement])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wshadow])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wwrite-strings])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wsign-compare])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wmissing-parameter-type])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wmissing-prototypes])
|
||||||
|
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wmissing-declarations])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wnested-externs])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wno-unreachable-code])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wno-long-long])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wpointer-sign])
|
||||||
|
MC_CHECK_ONE_CFLAG([-Wcomment])
|
||||||
|
|
||||||
|
dnl MC_CHECK_ONE_CFLAG([-fno-stack-protector])
|
||||||
|
dnl MC_CHECK_ONE_CFLAG([-Wsequence-point])
|
||||||
|
dnl MC_CHECK_ONE_CFLAG([-Wstrict-aliasing])
|
||||||
|
dnl MC_CHECK_ONE_CFLAG([-Wformat])
|
||||||
|
])
|
Loading…
Reference in New Issue
Block a user