Skip to content

Commit

Permalink
configure: provide --enable-werror
Browse files Browse the repository at this point in the history
  • Loading branch information
bagder committed Mar 17, 2019
1 parent 157fd15 commit 1a60c01
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
37 changes: 37 additions & 0 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -472,3 +472,40 @@ m4_case([$1],
"
fi
])


dnl LIBSSH2_CHECK_OPTION_WERROR
dnl -------------------------------------------------
dnl Verify if configure has been invoked with option
dnl --enable-werror or --disable-werror, and set
dnl shell variable want_werror as appropriate.

AC_DEFUN([LIBSSH2_CHECK_OPTION_WERROR], [
AC_BEFORE([$0],[LIBSSH2_CHECK_COMPILER])dnl
AC_MSG_CHECKING([whether to enable compiler warnings as errors])
OPT_COMPILER_WERROR="default"
AC_ARG_ENABLE(werror,
AC_HELP_STRING([--enable-werror],[Enable compiler warnings as errors])
AC_HELP_STRING([--disable-werror],[Disable compiler warnings as errors]),
OPT_COMPILER_WERROR=$enableval)
case "$OPT_COMPILER_WERROR" in
no)
dnl --disable-werror option used
want_werror="no"
;;
default)
dnl configure option not specified
want_werror="no"
;;
*)
dnl --enable-werror option used
want_werror="yes"
;;
esac
AC_MSG_RESULT([$want_werror])
if test X"$want_werror" = Xyes; then
CFLAGS="$CFLAGS -Werror"
fi
])

6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ AC_C_BIGENDIAN
dnl check for how to do large files
AC_SYS_LARGEFILE

# Configure parameters


# Crypto backends

found_crypto=none
Expand Down Expand Up @@ -370,6 +367,9 @@ if test $missing_required_deps = 1; then
AC_MSG_ERROR([Required dependencies are missing!])
fi

# Configure parameters
LIBSSH2_CHECK_OPTION_WERROR

AC_CONFIG_FILES([Makefile
src/Makefile
tests/Makefile
Expand Down

0 comments on commit 1a60c01

Please sign in to comment.