bug-gnulib
[Top][All Lists]
Advanced

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

Re: dirfd on AIX 7.1BETA


From: Rainer Tammer
Subject: Re: dirfd on AIX 7.1BETA
Date: Sat, 31 Jul 2010 08:20:10 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100701 SeaMonkey/2.0.6

Hello,

Bruno Haible wrote:
>> 2. dirfd
>>
>>         xlc  -g   -o test-canonicalize-lgpl test-canonicalize-lgpl.o
>> ../gllib/libgnu.a
>> ld: 0711-317 ERROR: Undefined symbol: .dirfd
>>     
> The logs say:
>
>   checking for dirfd... no
>   checking whether dirfd is declared... (cached) yes
>   checking whether dirfd is a macro... no
>
> The m4/dirfd.m4 macro is not yet prepared for this situation.
> This should fix it. (Jim, I expect you agree with this commit, since
> it merely applies the common gnulib idioms?)
>
>   
This should fix if for now, but according to the documentation the
dirfd() should be part
of libc.a, maybe this is only a glich in the AIX7BETA ?

-- man page --


    dirfd Subroutine

Purpose

Extracts the file descriptor used by a DIR stream.

Library

Standard C Library (*libc.a*)

Syntax

*#include <dirent.h>*

*int dirfd* *(* /dirp/ *)* *;*
*DIR ** /dirp/ *;*

-- man page --

I will check this with IBM. But for now this should cover the problem.
> 2010-07-30  Bruno Haible  <address@hidden>
>
>       dirfd: Avoid link error on AIX 7.1.
>       * lib/dirent.in.h (dirfd): Use modern idiom with REPLACE_DIRFD.
>       * m4/dirfd.m4 (gl_FUNC_DIRFD): If the function is declared but does not
>       exist, set REPLACE_DIRFD.
>       * m4/dirent_h.m4 (gl_DIRENT_H_DEFAULTS): Initialize REPLACE_DIRFD.
>       * modules/dirent (Makefile.am): Substitute REPLACE_DIRFD.
>       * doc/posix-functions/dirfd.texi: Update.
>       Reported by Rainer Tammer.
>
> --- lib/dirent.in.h.orig      Fri Jul 30 23:53:06 2010
> +++ lib/dirent.in.h   Fri Jul 30 23:37:57 2010
> @@ -50,11 +50,22 @@
>  _GL_CXXALIASWARN (closedir);
>  
>  #if @GNULIB_DIRFD@
> -# if address@hidden@ && !defined dirfd
>  /* Return the file descriptor associated with the given directory stream,
>     or -1 if none exists.  */
> -_GL_EXTERN_C int dirfd (DIR *dir) _GL_ARG_NONNULL ((1));
> +# if @REPLACE_DIRFD@
> +#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
> +#   undef dirfd
> +#   define dirfd rpl_dirfd
> +#  endif
> +_GL_FUNCDECL_RPL (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
> +_GL_CXXALIAS_RPL (dirfd, int, (DIR *));
> +# else
> +#  if !(@HAVE_DECL_DIRFD@ || defined dirfd)
> +_GL_FUNCDECL_SYS (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
> +#  endif
> +_GL_CXXALIAS_SYS (dirfd, int, (DIR *));
>  # endif
> +_GL_CXXALIASWARN (dirfd);
>  #elif defined GNULIB_POSIXCHECK
>  # undef dirfd
>  # if HAVE_RAW_DECL_DIRFD
> --- m4/dirfd.m4.orig  Fri Jul 30 23:53:06 2010
> +++ m4/dirfd.m4       Fri Jul 30 23:45:34 2010
> @@ -1,4 +1,4 @@
> -# serial 17   -*- Autoconf -*-
> +# serial 18   -*- Autoconf -*-
>  
>  dnl Find out how to get the file descriptor associated with an open DIR*.
>  
> @@ -40,11 +40,13 @@
>         gl_cv_func_dirfd_macro=yes,
>         gl_cv_func_dirfd_macro=no)])
>  
> -  # Use the replacement only if we have no function, macro,
> -  # or declaration with that name.
> -  if test $ac_cv_func_dirfd,$ac_cv_have_decl_dirfd,$gl_cv_func_dirfd_macro \
> -      = no,no,no; then
> -    AC_REPLACE_FUNCS([dirfd])
> +  # Use the replacement only if we have no function or macro with that name.
> +  if test $ac_cv_func_dirfd,$gl_cv_func_dirfd_macro = no,no; then
> +    if test $ac_cv_have_decl_dirfd = yes; then
> +      # If the system declares dirfd already, let's declare rpl_dirfd 
> instead.
> +      REPLACE_DIRFD=1
> +    fi
> +    AC_LIBOBJ([dirfd])
>      AC_CACHE_CHECK(
>                [how to get the file descriptor associated with an open DIR*],
>                     gl_cv_sys_dir_fd_member_name,
> --- m4/dirent_h.m4.orig       Fri Jul 30 23:53:06 2010
> +++ m4/dirent_h.m4    Fri Jul 30 23:39:00 2010
> @@ -1,4 +1,4 @@
> -# dirent_h.m4 serial 12
> +# dirent_h.m4 serial 13
>  dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
>  dnl This file is free software; the Free Software Foundation
>  dnl gives unlimited permission to copy and/or distribute it,
> @@ -51,6 +51,7 @@
>    HAVE_SCANDIR=1;       AC_SUBST([HAVE_SCANDIR])
>    HAVE_ALPHASORT=1;     AC_SUBST([HAVE_ALPHASORT])
>    REPLACE_CLOSEDIR=0;   AC_SUBST([REPLACE_CLOSEDIR])
> +  REPLACE_DIRFD=0;      AC_SUBST([REPLACE_DIRFD])
>    REPLACE_FDOPENDIR=0;  AC_SUBST([REPLACE_FDOPENDIR])
>    REPLACE_OPENDIR=0;    AC_SUBST([REPLACE_OPENDIR])
>  ])
> --- modules/dirent.orig       Fri Jul 30 23:53:06 2010
> +++ modules/dirent    Fri Jul 30 23:38:34 2010
> @@ -36,6 +36,7 @@
>             -e 's|@''HAVE_SCANDIR''@|$(HAVE_SCANDIR)|g' \
>             -e 's|@''HAVE_ALPHASORT''@|$(HAVE_ALPHASORT)|g' \
>             -e 's|@''REPLACE_CLOSEDIR''@|$(REPLACE_CLOSEDIR)|g' \
> +           -e 's|@''REPLACE_DIRFD''@|$(REPLACE_DIRFD)|g' \
>             -e 's|@''REPLACE_FDOPENDIR''@|$(REPLACE_FDOPENDIR)|g' \
>             -e 's|@''REPLACE_OPENDIR''@|$(REPLACE_OPENDIR)|g' \
>             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
> --- doc/posix-functions/dirfd.texi.orig       Fri Jul 30 23:53:06 2010
> +++ doc/posix-functions/dirfd.texi    Fri Jul 30 23:52:27 2010
> @@ -10,7 +10,7 @@
>  @itemize
>  @item
>  This function is missing on some platforms:
> -AIX 5.1, HP-UX 11, OSF/1 5.1, Solaris 10, mingw.
> +AIX 7.1, HP-UX 11, OSF/1 5.1, Solaris 10, mingw.
>  @end itemize
>  
>  Portability problems not fixed by Gnulib:
>
>
>   
Bye
  Rainer




reply via email to

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