[Fontconfig] [PATCH] Fix configure to work with Solaris Studio compilers

Alan Coopersmith alan.coopersmith at oracle.com
Fri Jan 16 09:35:22 PST 2015


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 at oracle.com>
---
 configure.ac |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 457dc2c..9011f37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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);
-- 
1.7.9.2



More information about the Fontconfig mailing list