[vlc-devel] [PATCH] configure: Make the dirfd(3) check more portable

Kamil Rytarowski n54 at gmx.com
Sat Mar 17 21:14:07 CET 2018


Ping?

On 14.03.2018 06:46, Kamil Rytarowski wrote:
> Current POSIX specifies that dirfd(3) shall be a function and optionally
> a macro.
> 
> NetBSD uses traditionally a macro, without a function. This means that
> the AC_CHECK_FUNCS() check is insufficient and it misses the macro
> definition in the system headers. Replace this check with a
> AC_COMPILE_IFELSE() logic that covers such cases and can detect correctly
> the system feature.
> ---
>  configure.ac | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 7af0979cfe..3200bdea2e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -582,7 +582,7 @@ need_libc=false
>  
>  dnl Check for usual libc functions
>  AC_CHECK_FUNCS([accept4 daemon fcntl flock fstatvfs fork getenv getpwuid_r isatty memalign mkostemp mmap open_memstream newlocale openat pipe2 pread posix_fadvise posix_madvise posix_memalign setlocale stricmp strnicmp strptime uselocale])
> -AC_REPLACE_FUNCS([aligned_alloc atof atoll dirfd fdopendir flockfile fsync getdelim getpid lldiv memrchr nrand48 poll recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tdestroy tfind timegm timespec_get strverscmp pathconf])
> +AC_REPLACE_FUNCS([aligned_alloc atof atoll fdopendir flockfile fsync getdelim getpid lldiv memrchr nrand48 poll recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tdestroy tfind timegm timespec_get strverscmp pathconf])
>  AC_REPLACE_FUNCS([gettimeofday])
>  AC_CHECK_FUNC(fdatasync,,
>    [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
> @@ -590,6 +590,13 @@ AC_CHECK_FUNC(fdatasync,,
>  
>  VLC_REPLACE_DECL([realpath], [#include <stdlib.h>])
>  
> +dnl dirfd can be either a function or a macro (sometimes both)
> +AC_COMPILE_IFELSE([
> +    AC_LANG_PROGRAM([[#include <dirent.h>
> +        DIR *dir;]],[[
> +        return(dirfd(dir));]])
> +    ],[AC_DEFINE(HAVE_DIRFD,1,[Define to 1 if you have a dirfd function or macro])])
> +
>  dnl mingw64 implements those as static inline, not functions with C linkage
>  VLC_REPLACE_DECL([asprintf], [#include <stdio.h>])
>  VLC_REPLACE_DECL([vasprintf], [#include <stdio.h>])
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 850 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20180317/c1b092bd/attachment.sig>


More information about the vlc-devel mailing list