summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4')
-rw-r--r--m4/ax_lib_readline.m415
-rw-r--r--m4/compiler_warnings.m433
2 files changed, 40 insertions, 8 deletions
diff --git a/m4/ax_lib_readline.m4 b/m4/ax_lib_readline.m4
index 72764fba5..fe56c5bfc 100644
--- a/m4/ax_lib_readline.m4
+++ b/m4/ax_lib_readline.m4
@@ -90,8 +90,11 @@ AC_DEFUN([AX_LIB_READLINE], [
AC_MSG_ERROR([readline library with terminfo support is required (one of ncurses, curses, or termcap)])
fi
+ ORIG_LIBS="$LIBS"
LIBS="$LIBS $ax_cv_lib_readline"
AC_CHECK_HEADERS(readline.h readline/readline.h)
+
+ # Check history
AC_CACHE_CHECK([whether readline supports history],
ax_cv_lib_readline_history, [
ax_cv_lib_readline_history="no"
@@ -101,6 +104,18 @@ AC_DEFUN([AX_LIB_READLINE], [
AC_MSG_ERROR(readline history support is required)
fi
AC_CHECK_HEADERS(history.h readline/history.h)
+
+ # check rl_echo_signal_char()
+ AC_CACHE_CHECK([whether readline supports rl_echo_signal_char()],
+ ax_cv_lib_readline_echo_signal_char, [
+ ax_cv_lib_readline_echo_signal_char="no"
+ AC_TRY_LINK_FUNC(rl_echo_signal_char, ax_cv_lib_readline_echo_signal_char="yes")
+ ])
+ if test "$ax_cv_lib_readline_echo_signal_char" != "yes"; then
+ AC_MSG_ERROR(rl_echo_signal_char() is required (install readline6?))
+ fi
+
+ LIBS="$ORIG_LIBS"
READLINE_LIBS="$ax_cv_lib_readline"
AC_SUBST(READLINE_LIBS)
])dnl
diff --git a/m4/compiler_warnings.m4 b/m4/compiler_warnings.m4
index 357ff0e7e..c05a26d09 100644
--- a/m4/compiler_warnings.m4
+++ b/m4/compiler_warnings.m4
@@ -5,32 +5,49 @@ AC_DEFUN([NM_COMPILER_WARNINGS],
AC_MSG_CHECKING(for more warnings)
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
AC_MSG_RESULT(yes)
- CFLAGS="-Wall -std=gnu89 $CFLAGS"
+ CFLAGS_SAVED="$CFLAGS"
+ CFLAGS_MORE_WARNINGS="-Wall -std=gnu89"
+
+ dnl clang only warns about unknown warnings, unless
+ dnl called with "-Werror=unknown-warning-option"
+ dnl Test if the compiler supports that, and if it does
+ dnl attach it to the CFLAGS.
+ CFLAGS_EXTRA="-Werror=unknown-warning-option"
+ CFLAGS="$CFLAGS_MORE_WARNINGS $CFLAGS_EXTRA $CFLAGS_SAVED"
+ AC_TRY_COMPILE([], [],
+ has_option=yes,
+ has_option=no,)
+ if test $has_option = no; then
+ CFLAGS_EXTRA=
+ fi
+ unset has_option
for option in -Wshadow -Wmissing-declarations -Wmissing-prototypes \
-Wdeclaration-after-statement -Wformat-security \
-Wfloat-equal -Wno-unused-parameter -Wno-sign-compare \
+ -Wstrict-prototypes \
-fno-strict-aliasing -Wno-unused-but-set-variable \
-Wundef -Wimplicit-function-declaration \
-Wpointer-arith -Winit-self \
- -Wmissing-include-dirs -Waggregate-return; do
- SAVE_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $option"
+ -Wmissing-include-dirs; do
+ CFLAGS="$CFLAGS_MORE_WARNINGS $CFLAGS_EXTRA $option $CFLAGS_SAVED"
AC_MSG_CHECKING([whether gcc understands $option])
AC_TRY_COMPILE([], [],
has_option=yes,
has_option=no,)
- if test $has_option = no; then
- CFLAGS="$SAVE_CFLAGS"
+ if test $has_option != no; then
+ CFLAGS_MORE_WARNINGS="$CFLAGS_MORE_WARNINGS $option"
fi
AC_MSG_RESULT($has_option)
unset has_option
- unset SAVE_CFLAGS
done
unset option
+ unset CFLAGS_EXTRA
if test "x$set_more_warnings" = xerror; then
- CFLAGS="$CFLAGS -Werror"
+ CFLAGS_MORE_WARNINGS="$CFLAGS_MORE_WARNINGS -Werror"
fi
+ CFLAGS="$CFLAGS_MORE_WARNINGS $CFLAGS_SAVED"
+ unset CFLAGS_SAVED
else
AC_MSG_RESULT(no)
fi