X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=test%2Faclocal.m4;h=813527050143cb3362a1fdbb346365f71cc1fff0;hb=d1cc319afccb0d472465718a748664e7cef00840;hp=e149eaf2221de6d9d021aed3f14cdd9c50a621a4;hpb=1f7a36fe16b11bb4aab51be89bbc1b0f75936b78;p=ncurses.git diff --git a/test/aclocal.m4 b/test/aclocal.m4 index e149eaf2..81352705 100644 --- a/test/aclocal.m4 +++ b/test/aclocal.m4 @@ -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.182 2020/08/29 13:24:15 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 ],[ + 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 --------------------------------------------------------------------------- @@ -1311,9 +1324,15 @@ if test "x$with_string_hacks" = "xyes"; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ENABLE_WARNINGS version: 6 updated: 2020/08/28 04:10:22 +dnl CF_ENABLE_WARNINGS version: 7 updated: 2020/08/29 09:05:21 dnl ------------------ dnl Configure-option to enable gcc warnings +dnl +dnl $1 = extra options to add, if supported +dnl $2 = option for checking attributes. By default, this is done when +dnl warnings are enabled. For other values: +dnl yes: always do this, e.g., to use in generated library-headers +dnl no: never do this AC_DEFUN([CF_ENABLE_WARNINGS],[ if ( test "$GCC" = yes || test "$GXX" = yes ) then @@ -1328,9 +1347,10 @@ CF_ARG_ENABLE(warnings, AC_MSG_RESULT($with_warnings) if test "$with_warnings" = "yes" then - CF_GCC_ATTRIBUTES + ifelse($2,,[CF_GCC_ATTRIBUTES]) CF_GCC_WARNINGS($1) fi +ifelse($2,yes,[CF_GCC_ATTRIBUTES]) fi ])dnl dnl --------------------------------------------------------------------------- @@ -1599,14 +1619,14 @@ AC_CACHE_CHECK(for openpty header,cf_cv_func_openpty,[ ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GCC_ATTRIBUTES version: 18 updated: 2020/03/10 18:53:47 +dnl CF_GCC_ATTRIBUTES version: 19 updated: 2020/08/29 09:05:21 dnl ----------------- dnl Test for availability of useful gcc __attribute__ directives to quiet dnl compiler warnings. Though useful, not all are supported -- and contrary dnl to documentation, unrecognized directives cause older compilers to barf. AC_DEFUN([CF_GCC_ATTRIBUTES], [ -if test "$GCC" = yes +if ( test "$GCC" = yes || test "$GXX" = yes ) then cat > conftest.i <