>From 2356b3663f8d08b7d3d1e4496f22dcea3c5b76b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Fri, 5 Jun 2015 18:49:48 +0100 Subject: [PATCH] build: improve checks for stdbuf support * configure.ac: Actually run the test program to verify the constructor attribute is supported, or when cross compiling enable -Werror so that warnings about ignored attributes are significant. Fixes a build failure on AIX. --- configure.ac | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index c159983..5e0d0ca 100644 --- a/configure.ac +++ b/configure.ac @@ -455,7 +455,11 @@ if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then fi AC_MSG_CHECKING([whether this is system supports stdbuf]) -AC_COMPILE_IFELSE( +ac_save_CFLAGS="$CFLAGS" +# Build with -Werror to detect warnings about +# about ignored "constructor" arguments. +CFLAGS="$CFLAGS -Werror" +AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ static int stdbuf = 0; @@ -471,7 +475,20 @@ AC_COMPILE_IFELSE( return !(stdbuf == 1);]]) ], [stdbuf_supported=yes], - [stdbuf_supported=no]) + [stdbuf_supported=no], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([[ + void __attribute__ ((constructor)) + stdbuf_cross_test (void) + #if __ELF__ + {} + #endif + ]]) + ], + [stdbuf_supported=yes], + [stdbuf_supported=no]) + ]) +CFLAGS="$ac_save_CFLAGS" AC_MSG_RESULT([$stdbuf_supported]) if test "$stdbuf_supported" = "yes" && test -z "$EXEEXT"; then gl_ADD_PROG([optional_bin_progs], [stdbuf]) -- 2.4.1