bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: memcmp and cross-compilation


From: Bruno Haible
Subject: Re: memcmp and cross-compilation
Date: Tue, 20 May 2008 13:01:45 +0200
User-agent: KMail/1.5.4

Simon Josefsson wrote:
> The patch below works in the sense that, for cross-compilations only, it
> will assume that memcmp works when it is declared.  This works better
> for MinGW.

This is good. It's the usual approach we take for cross-compiles in gnulib:
Put in the known cases into the autoconf macro.

>  AC_DEFUN([gl_FUNC_MEMCMP],
>  [
> +  if test $cross_compiling != no; then
> +    # AC_FUNC_MEMCMP as of 2.62 defaults to 'no' when cross compiling.
> +    # We default to yes if memcmp appears to exist, which works
> +    # better for MinGW.
> +    AC_CACHE_CHECK([whether cross-compiling target has memcmp],
> +                   [ac_cv_func_memcmp_working],
> +                   [AC_LINK_IFELSE([
> +                     AC_LANG_PROGRAM([[#include <string.h>
> +                             ]], [[int ret = memcmp ("foo", "bar", 0)]])],
> +                     [ac_cv_func_memcmp_working=yes],
> +                     [ac_cv_func_memcmp_working=no])])
> +  fi 
>    AC_FUNC_MEMCMP

OK.

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]