>From abc08a2630c2e89c52ef876ef650e69d7d6a2215 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 13 Jul 2017 19:46:33 +0200 Subject: [PATCH 2/4] Improve cross-compilation guesses for native Windows. * m4/memchr.m4 (gl_FUNC_MEMCHR): Add cross-compilation guess for native Windows. * m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE): Don't use internals of memchr.m4. * m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE): Likewise. --- ChangeLog | 9 +++++++++ m4/memchr.m4 | 25 ++++++++++++++++++------- m4/strcasestr.m4 | 4 ++-- m4/strstr.m4 | 4 ++-- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5519ae2..8f7645a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,15 @@ 2017-07-13 Bruno Haible Improve cross-compilation guesses for native Windows. + * m4/memchr.m4 (gl_FUNC_MEMCHR): Add cross-compilation guess for native + Windows. + * m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE): Don't use internals of + memchr.m4. + * m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE): Likewise. + +2017-07-13 Bruno Haible + + Improve cross-compilation guesses for native Windows. * m4/fflush.m4 (gl_FUNC_FFLUSH_STDIN): Add cross-compilation guess for native Windows. (gl_FUNC_FFLUSH): Update accordingly. diff --git a/m4/memchr.m4 b/m4/memchr.m4 index b6ec814..62ce770 100644 --- a/m4/memchr.m4 +++ b/m4/memchr.m4 @@ -1,4 +1,4 @@ -# memchr.m4 serial 12 +# memchr.m4 serial 13 dnl Copyright (C) 2002-2004, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,6 +6,8 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_FUNC_MEMCHR], [ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + dnl Check for prerequisites for memory fence checks. gl_FUNC_MMAP_ANON AC_CHECK_HEADERS_ONCE([sys/mman.h]) @@ -73,12 +75,21 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], result |= 4; } return result; -]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no], - [dnl Be pessimistic for now. - gl_cv_func_memchr_works="guessing no"])]) - if test "$gl_cv_func_memchr_works" != yes; then - REPLACE_MEMCHR=1 - fi +]])], + [gl_cv_func_memchr_works=yes], + [gl_cv_func_memchr_works=no], + [case "$host_os" in + # Guess yes on native Windows. + mingw*) gl_cv_func_memchr_works="guessing yes" ;; + # Be pessimistic for now. + *) gl_cv_func_memchr_works="guessing no" ;; + esac + ]) + ]) + case "$gl_cv_func_memchr_works" in + *yes) ;; + *) REPLACE_MEMCHR=1 ;; + esac fi ]) diff --git a/m4/strcasestr.m4 b/m4/strcasestr.m4 index 3af9582..d454ad9 100644 --- a/m4/strcasestr.m4 +++ b/m4/strcasestr.m4 @@ -1,4 +1,4 @@ -# strcasestr.m4 serial 22 +# strcasestr.m4 serial 23 dnl Copyright (C) 2005, 2007-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -17,7 +17,7 @@ AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE], if test $ac_cv_func_strcasestr = no; then HAVE_STRCASESTR=0 else - if test "$gl_cv_func_memchr_works" != yes; then + if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then REPLACE_STRCASESTR=1 else dnl Detect http://sourceware.org/bugzilla/show_bug.cgi?id=12092. diff --git a/m4/strstr.m4 b/m4/strstr.m4 index 4b472ee..c6b7d64 100644 --- a/m4/strstr.m4 +++ b/m4/strstr.m4 @@ -1,4 +1,4 @@ -# strstr.m4 serial 18 +# strstr.m4 serial 19 dnl Copyright (C) 2008-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,7 +9,7 @@ AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], [ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MEMCHR]) - if test "$gl_cv_func_memchr_works" != yes; then + if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then REPLACE_STRSTR=1 else dnl Detect http://sourceware.org/bugzilla/show_bug.cgi?id=12092. -- 2.7.4