X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Faclocal.m4;h=cf4599e5b31af667836055392754b181d93d0357;hp=81c1b9f05d7b560cf07d5a9fca414cc770be1e97;hb=58552e8c761a70f8f0bd591fecdf576fa8216e3e;hpb=3e0f770501852be3a2cb05d8044219d7b04dbfad diff --git a/test/aclocal.m4 b/test/aclocal.m4 index 81c1b9f0..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.130 2016/06/25 20:29:33 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,11 +376,11 @@ ifelse([$3],,[ :]dnl ])dnl ])])dnl dnl --------------------------------------------------------------------------- -dnl CF_CC_ENV_FLAGS version: 4 updated: 2016/06/25 16:23:40 +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 with -dnl options, but eliminates a more common category of user confusion. +dnl into CC. This will not help with broken scripts that wrap the compiler +dnl with options, but eliminates a more common category of user confusion. dnl dnl In particular, it addresses the problem of being able to run the C dnl preprocessor in a consistent manner. @@ -399,9 +399,19 @@ case "$CC" in AC_MSG_RESULT(broken) AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options) # humor him... - cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]][[ ]]*//'` - CC=`echo "$CC " | sed -e 's/[[ ]]-[[IUD]][[^ ]][[^ ]]*//g' -e 's/[[ ]]*$//'` - CF_ADD_CFLAGS($cf_flags) + cf_flags=`echo "$CC" | sed -e 's/^.*[[ ]]\(-[[^ ]]\)/\1/'` + CC=`echo "$CC " | sed -e 's/[[ ]]-[[^ ]].*$//' -e 's/[[ ]]*$//'` + 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 @@ -1629,7 +1679,7 @@ if test $cf_cv_getopt_header = getopt.h ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07 +dnl CF_GNU_SOURCE version: 7 updated: 2016/08/05 05:15:37 dnl ------------- dnl Check if we must define _GNU_SOURCE to get a reasonable value for dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect @@ -1656,7 +1706,20 @@ make an error CPPFLAGS="$cf_save" ]) ]) -test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" + +if test "$cf_cv_gnu_source" = yes +then +AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ +CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" + AC_TRY_COMPILE([#include ],[ +#ifdef _DEFAULT_SOURCE +make an error +#endif], + [cf_cv_default_source=no], + [cf_cv_default_source=yes]) + ]) +test "$cf_cv_default_source" = yes && CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE" +fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_HEADER_PATH version: 13 updated: 2015/04/15 19:08:48 @@ -3431,7 +3494,7 @@ esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 50 updated: 2015/10/17 19:03:33 +dnl CF_XOPEN_SOURCE version: 52 updated: 2016/08/27 12:21:42 dnl --------------- dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, dnl or adapt to the vendor's definitions to get equivalent functionality, @@ -3451,7 +3514,7 @@ case $host_os in (aix[[4-7]]*) cf_xopen_source="-D_ALL_SOURCE" ;; -(cygwin|msys) +(msys) cf_XOPEN_SOURCE=600 ;; (darwin[[0-8]].*) @@ -3479,7 +3542,7 @@ case $host_os in cf_xopen_source="-D_SGI_SOURCE" cf_XOPEN_SOURCE= ;; -(linux*|gnu*|mint*|k*bsd*-gnu) +(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) CF_GNU_SOURCE ;; (minix*) @@ -3501,9 +3564,6 @@ case $host_os in (openbsd*) # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw ;; -(os2*) - cf_XOPEN_SOURCE= - ;; (osf[[45]]*) cf_xopen_source="-D_OSF_SOURCE" ;;