X-Git-Url: http://ncurses.scripts.mit.edu/?a=blobdiff_plain;ds=sidebyside;f=test%2Faclocal.m4;h=cf4599e5b31af667836055392754b181d93d0357;hb=7af63696972b12659832a1c3413d9ace9641c8f6;hp=4ac571ce26f55c03791b1acf09ea378dcaa83b56;hpb=4d01f5de859abce88a97e91460db7f3769eedbc1;p=ncurses.git diff --git a/test/aclocal.m4 b/test/aclocal.m4 index 4ac571ce..cf4599e5 100644 --- a/test/aclocal.m4 +++ b/test/aclocal.m4 @@ -26,7 +26,7 @@ dnl sale, use or other dealings in this Software without prior written * dnl authorization. * dnl*************************************************************************** dnl -dnl $Id: aclocal.m4,v 1.133 2016/08/27 16:27:51 tom Exp $ +dnl $Id: aclocal.m4,v 1.136 2016/10/08 21:36:55 tom Exp $ dnl dnl Author: Thomas E. Dickey dnl @@ -376,7 +376,7 @@ ifelse([$3],,[ :]dnl ])dnl ])])dnl dnl --------------------------------------------------------------------------- -dnl CF_CC_ENV_FLAGS version: 5 updated: 2016/08/27 11:24:46 +dnl CF_CC_ENV_FLAGS version: 6 updated: 2016/08/29 20:57:00 dnl --------------- dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content dnl into CC. This will not help with broken scripts that wrap the compiler @@ -401,7 +401,17 @@ case "$CC" in # humor him... cf_flags=`echo "$CC" | sed -e 's/^.*[[ ]]\(-[[^ ]]\)/\1/'` CC=`echo "$CC " | sed -e 's/[[ ]]-[[^ ]].*$//' -e 's/[[ ]]*$//'` - CF_ADD_CFLAGS($cf_flags) + for cf_arg in $cf_flags + do + case "x$cf_arg" in + (x-[[IUDfgOW]]*) + CF_ADD_CFLAGS($cf_flags) + ;; + (*) + CC="$CC $cf_arg" + ;; + esac + done CF_VERBOSE(resulting CC: '$CC') CF_VERBOSE(resulting CFLAGS: '$CFLAGS') CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS') @@ -1108,6 +1118,46 @@ if test "$cf_disable_rpath_hack" = no ; then fi ]) dnl --------------------------------------------------------------------------- +dnl CF_ENABLE_STRING_HACKS version: 5 updated: 2016/10/08 17:34:11 +dnl ---------------------- +dnl On a few platforms, the compiler and/or loader nags with untruthful +dnl comments stating that "most" uses of strcat/strcpy/sprintf are incorrect, +dnl and implying that most uses of the recommended alternatives are correct. +dnl +dnl Factually speaking, no one has actually counted the number of uses of these +dnl functions versus the total of incorrect uses. Samples of a few thousand +dnl instances are meaningless compared to the hundreds of millions of lines of +dnl existing C code. +dnl +dnl strlcat/strlcpy are (as of 2012) non-standard, and are available on some +dnl platforms, in implementations of varying quality. Likewise, snprintf is +dnl standard - but evolved through phases, and older implementations are likely +dnl to yield surprising results, as documented in manpages on various systems. +AC_DEFUN([CF_ENABLE_STRING_HACKS], +[ +AC_MSG_CHECKING(if you want to work around bogus compiler/loader warnings) +AC_ARG_ENABLE(string-hacks, + [ --enable-string-hacks work around bogus compiler/loader warnings], + [with_string_hacks=$enableval], + [with_string_hacks=no]) +AC_MSG_RESULT($with_string_hacks) + +if test "x$with_string_hacks" = "xyes"; then + AC_DEFINE(USE_STRING_HACKS,1,[Define to 1 to work around bogus compiler/loader warnings]) + AC_MSG_WARN(enabling string-hacks to work around bogus compiler/loader warnings) + AC_CHECK_FUNC(strlcat,[ + AC_DEFINE(HAVE_STRLCAT,1,[Define to 1 if we have strlcat function]) + ],[ + AC_CHECK_LIB(bsd,strlcat,[ + CF_ADD_LIB(bsd) + AC_CHECK_HEADERS(bsd/string.h) + AC_DEFINE(HAVE_STRLCAT,1,[Define to 1 if we have strlcat function]) + ]) + ]) + AC_CHECK_FUNCS( strlcpy snprintf ) +fi +])dnl +dnl --------------------------------------------------------------------------- dnl CF_ENABLE_WARNINGS version: 4 updated: 2009/07/26 17:53:03 dnl ------------------ dnl Configure-option to enable gcc warnings