Fix configure to work with Solaris Studio compilers

Passing -Werror in the scandir() checks caused Studio cc to report
"Unrecognized option errors", confusing configure into thinking that
scandir() was not available.   Use Studio equivalent flags instead.

Leaves -Werror as the default for all other compilers, including
unknown ones, to flag to them that they need to update their flags
as well if -Werror is not correct for them.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
Alan Coopersmith 2015-01-16 09:35:22 -08:00 committed by Akira TAGOH
parent 4d739d13f4
commit 694368667a
1 changed files with 12 additions and 1 deletions

View File

@ -103,11 +103,22 @@ if test "$os_win32" = "yes"; then
fi
AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
WARN_CFLAGS=""
WERROR_CFLAGS="-Werror"
WARNING_CPP_DIRECTIVE="no"
if test "x$GCC" = "xyes"; then
WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations \
-Wnested-externs -fno-strict-aliasing"
WARNING_CPP_DIRECTIVE="yes"
elif test "x$SUNCC" = "xyes"; then
WARN_CFLAGS="-v -fd"
WERROR_CFLAGS="-errtags \
-errwarn=%all,no%E_OLD_STYLE_FUNC_DEF,no%E_STATEMENT_NOT_REACHED"
WARNING_CPP_DIRECTIVE="yes"
fi
if test "x$WARNING_CPP_DIRECTIVE" = "xyes"; then
AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
[Can use #warning in C files])
fi
@ -159,7 +170,7 @@ AC_DEFINE_UNQUOTED([HAVE_POSIX_FADVISE], [$fc_func_posix_fadvise], [Define to 1
if test "$os_win32" = "no"; then
AC_MSG_CHECKING([for scandir])
fc_saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $WARN_CFLAGS -Werror"
CFLAGS="$CFLAGS $WARN_CFLAGS $WERROR_CFLAGS"
AC_TRY_COMPILE([
#include <dirent.h>
int main(void);