]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/aclocal.m4
ncurses 6.2 - patch 20201031
[ncurses.git] / test / aclocal.m4
index 90903f5d6db0e6c931a28652c8d83518d9664e5b..813527050143cb3362a1fdbb346365f71cc1fff0 100644 (file)
@@ -27,7 +27,7 @@ dnl sale, use or other dealings in this Software without prior written       *
 dnl authorization.                                                           *
 dnl***************************************************************************
 dnl
-dnl $Id: aclocal.m4,v 1.183 2020/09/26 22:13:19 tom Exp $
+dnl $Id: aclocal.m4,v 1.184 2020/10/31 20:05:07 tom Exp $
 dnl
 dnl Author: Thomas E. Dickey
 dnl
@@ -568,7 +568,7 @@ if test "$cf_have_curses_lib" = no; then
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CLANG_COMPILER version: 3 updated: 2020/08/28 04:10:22
+dnl CF_CLANG_COMPILER version: 4 updated: 2020/10/31 15:46:50
 dnl -----------------
 dnl Check if the given compiler is really clang.  clang's C driver defines
 dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
@@ -587,21 +587,34 @@ ifelse([$2],,CLANG_COMPILER,[$2])=no
 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
        AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
        cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
-       ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
        AC_TRY_COMPILE([],[
 #ifdef __clang__
 #else
 make an error
 #endif
 ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
-cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
 ],[])
        ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
        AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
 fi
 
-if test "x$CLANG_COMPILER" = "xyes" ; then
-       CF_APPEND_TEXT(CFLAGS,-Wno-error=implicit-function-declaration)
+if test "x$ifelse([$2],,CLANG_COMPILER,[$2])" = "xyes" ; then
+       for cf_clang_opt in \
+               -Qunused-arguments \
+               -Wno-error=implicit-function-declaration
+       do
+               AC_MSG_CHECKING(if option $cf_clang_opt works)
+               AC_TRY_LINK([
+                       #include <stdio.h>],[
+                       printf("hello!\n");],[
+                       cf_clang_optok=yes],[
+                       cf_clang_optok=no])
+               AC_MSG_RESULT($cf_clang_optok)
+               if test $cf_clang_optok = yes; then
+                       CF_VERBOSE(adding option $cf_clang_opt)
+                       CF_APPEND_TEXT(CFLAGS,$cf_clang_opt)
+               fi
+       done
 fi
 ])
 dnl ---------------------------------------------------------------------------