bug-gnulib
[Top][All Lists]
Advanced

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

Re: [bug-gnulib] strndup module and crosscompiling


From: Bruno Haible
Subject: Re: [bug-gnulib] strndup module and crosscompiling
Date: Tue, 4 Jul 2006 18:31:21 +0200
User-agent: KMail/1.9.1

Martin Lambers wrote:
> gnulib/m4/strndup.m4 checks for a deficient strndup() function. When
> crosscompiling, it assumes that strndup() is broken if the target is AIX
> and that it is ok otherwise. 
> 
> This fails when crosscompiling to a target that has no strndup()
> function at all, such as MinGW: HAVE_STRNDUP will wrongly be defined to
> 1.

Thanks for reporting this. Does this patch work?

Bruno


2006-07-03  Bruno Haible  <address@hidden>

        * strndup.m4 (gl_FUNC_STRNDUP): When cross-compiling, check whether
        the function exists, before testing against AIX.
        Reported by Martin Lambers <address@hidden>.

*** gnulib-20060703/m4/strndup.m4       2006-05-30 22:24:54.000000000 +0200
--- gnulib-20060703-modified/m4/strndup.m4      2006-07-04 01:48:07.000000000 
+0200
***************
*** 1,4 ****
! # strndup.m4 serial 6
  dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # strndup.m4 serial 7
  dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 27,39 ****
    return s[13] != '\0';]])],
         [gl_cv_func_strndup=yes],
         [gl_cv_func_strndup=no],
!        [AC_EGREP_CPP([too risky], [
  #ifdef _AIX
!             too risky
  #endif
!           ],
!           [gl_cv_func_strndup=no],
!           [gl_cv_func_strndup=yes])])])
    if test $gl_cv_func_strndup = yes; then
      AC_DEFINE([HAVE_STRNDUP], 1,
        [Define if you have the strndup() function and it works.])
--- 27,41 ----
    return s[13] != '\0';]])],
         [gl_cv_func_strndup=yes],
         [gl_cv_func_strndup=no],
!        [AC_CHECK_FUNC([strndup],
!           [AC_EGREP_CPP([too risky], [
  #ifdef _AIX
!                too risky
  #endif
!              ],
!              [gl_cv_func_strndup=no],
!              [gl_cv_func_strndup=yes])],
!           [gl_cv_func_strndup=no])])])
    if test $gl_cv_func_strndup = yes; then
      AC_DEFINE([HAVE_STRNDUP], 1,
        [Define if you have the strndup() function and it works.])




reply via email to

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