]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - aclocal.m4
ncurses 6.2 - patch 20201031
[ncurses.git] / aclocal.m4
index 9808061a1a91c632829534b862aee48f853879f1..c4d5dbc51649d5cf6270262656425e33746dbc45 100644 (file)
@@ -29,7 +29,7 @@ dnl***************************************************************************
 dnl
 dnl Author: Thomas E. Dickey 1995-on
 dnl
-dnl $Id: aclocal.m4,v 1.935 2020/10/24 23:49:51 tom Exp $
+dnl $Id: aclocal.m4,v 1.938 2020/10/31 19:51:56 tom Exp $
 dnl Macros used in NCURSES auto-configuration script.
 dnl
 dnl These macros are maintained separately from NCURSES.  The copyright on
@@ -1480,7 +1480,7 @@ main(void)
 ])
 ])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
@@ -1499,21 +1499,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 ---------------------------------------------------------------------------