annotate m4/inet_ntop.m4 @ 12454:f7624052e60d

fcntl: support F_DUPFD_CLOEXEC on systems with fcntl Implement F_DUPFD_CLOEXEC. The unit test still fails on systems with other fcntl bugs (such as cygwin 1.5 mishandling F_DUPFD, or mingw lacking fcntl altogether). Passes on Linux, both with and without kernel support, and on cygwin 1.7. * modules/fcntl (Files): List new files. (configure.ac): Run a test. * m4/fcntl.m4 (gl_FUNC_FCNTL): New file. * lib/fcntl.c (rpl_fcntl): Likewise. * m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Add witness defaults. (gl_FCNTL_H): Always replace fcntl.h. * modules/fcntl-h (Makefile.am): Substitute witnesses. * lib/fcntl.in.h (fcntl): Declare replacement. (F_DUPFD_CLOEXEC, GNULIB_defined_F_DUPFD_CLOEXEC): New macro when needed, plus a witness. * doc/posix-functions/fcntl.texi (fcntl): Document this. * doc/posix-headers/fcntl.texi (fcntl.h): Likewise. * tests/test-fcntl.c: New file. * modules/fcntl-tests: Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Mon, 07 Dec 2009 11:50:59 -0700
parents 81468eb78706
children c2cbabec01dd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12238
66104f836834 Fix link error.
Bruno Haible <bruno@clisp.org>
parents: 12225
diff changeset
1 # inet_ntop.m4 serial 11
11007
f6cba5a556ce many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents: 10536
diff changeset
2 dnl Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
5825
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 AC_DEFUN([gl_INET_NTOP],
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 [
10018
8406478f0d13 Ensure the system declares inet_ntop, inet_pton when possible.
Bruno Haible <bruno@clisp.org>
parents: 10010
diff changeset
9 dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop.
8406478f0d13 Ensure the system declares inet_ntop, inet_pton when possible.
Bruno Haible <bruno@clisp.org>
parents: 10010
diff changeset
10 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
8406478f0d13 Ensure the system declares inet_ntop, inet_pton when possible.
Bruno Haible <bruno@clisp.org>
parents: 10010
diff changeset
11
10536
397ef6c67ada Avoid assigning ARPA_INET_H in different .m4 files.
Bruno Haible <bruno@clisp.org>
parents: 10032
diff changeset
12 gl_REPLACE_ARPA_INET_H
10010
d26ac8a528f7 Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents: 9993
diff changeset
13
12225
e06ba2ed6c0f Avoid link error for inet_ntop on Solaris.
Simon Josefsson <simon@josefsson.org>
parents: 11450
diff changeset
14 dnl Most platforms that provide inet_ntop define it in libc.
e06ba2ed6c0f Avoid link error for inet_ntop on Solaris.
Simon Josefsson <simon@josefsson.org>
parents: 11450
diff changeset
15 dnl Solaris 8..10 provide inet_ntop in libnsl instead.
11450
bbc8b00b08b5 Port inet_ntop to Solaris 8 (problem found in coreutils 7.2).
Paul Eggert <eggert@cs.ucla.edu>
parents: 11007
diff changeset
16 gl_save_LIBS=$LIBS
bbc8b00b08b5 Port inet_ntop to Solaris 8 (problem found in coreutils 7.2).
Paul Eggert <eggert@cs.ucla.edu>
parents: 11007
diff changeset
17 AC_SEARCH_LIBS([inet_ntop], [nsl], [],
bbc8b00b08b5 Port inet_ntop to Solaris 8 (problem found in coreutils 7.2).
Paul Eggert <eggert@cs.ucla.edu>
parents: 11007
diff changeset
18 [AC_REPLACE_FUNCS([inet_ntop])])
bbc8b00b08b5 Port inet_ntop to Solaris 8 (problem found in coreutils 7.2).
Paul Eggert <eggert@cs.ucla.edu>
parents: 11007
diff changeset
19 LIBS=$gl_save_LIBS
12225
e06ba2ed6c0f Avoid link error for inet_ntop on Solaris.
Simon Josefsson <simon@josefsson.org>
parents: 11450
diff changeset
20 INET_NTOP_LIB=
12241
81468eb78706 inet_ntop, inet_pton: Fix link error.
Simon Josefsson <simon@josefsson.org>
parents: 12238
diff changeset
21 if test "$ac_cv_search_inet_ntop" != "no" &&
81468eb78706 inet_ntop, inet_pton: Fix link error.
Simon Josefsson <simon@josefsson.org>
parents: 12238
diff changeset
22 test "$ac_cv_search_inet_ntop" != "none required"; then
12225
e06ba2ed6c0f Avoid link error for inet_ntop on Solaris.
Simon Josefsson <simon@josefsson.org>
parents: 11450
diff changeset
23 INET_NTOP_LIB="$ac_cv_search_inet_ntop"
e06ba2ed6c0f Avoid link error for inet_ntop on Solaris.
Simon Josefsson <simon@josefsson.org>
parents: 11450
diff changeset
24 fi
e06ba2ed6c0f Avoid link error for inet_ntop on Solaris.
Simon Josefsson <simon@josefsson.org>
parents: 11450
diff changeset
25 AC_SUBST([INET_NTOP_LIB])
11450
bbc8b00b08b5 Port inet_ntop to Solaris 8 (problem found in coreutils 7.2).
Paul Eggert <eggert@cs.ucla.edu>
parents: 11007
diff changeset
26
5825
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 gl_PREREQ_INET_NTOP
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 ])
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29
9993
4d5ba95a0dec Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents: 7100
diff changeset
30 # Prerequisites of lib/inet_ntop.c.
5825
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 AC_DEFUN([gl_PREREQ_INET_NTOP], [
6435
be00741570b7 Fix inet_ntop on mingw32.
Simon Josefsson <simon@josefsson.org>
parents: 5825
diff changeset
32 AC_CHECK_DECLS([inet_ntop],,,[#include <arpa/inet.h>])
10032
3e6530c5e7c2 Make sure inet_ntop/inet_pton is declared when needed.
Simon Josefsson <simon@josefsson.org>
parents: 10018
diff changeset
33 if test $ac_cv_have_decl_inet_ntop = no; then
3e6530c5e7c2 Make sure inet_ntop/inet_pton is declared when needed.
Simon Josefsson <simon@josefsson.org>
parents: 10018
diff changeset
34 HAVE_DECL_INET_NTOP=0
3e6530c5e7c2 Make sure inet_ntop/inet_pton is declared when needed.
Simon Josefsson <simon@josefsson.org>
parents: 10018
diff changeset
35 fi
5825
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 AC_REQUIRE([gl_SOCKET_FAMILIES])
7100
1401e9cfcacd Remove the 'restrict' module, and modify everybody to use AC_C_RESTRICT
Paul Eggert <eggert@cs.ucla.edu>
parents: 7061
diff changeset
37 AC_REQUIRE([AC_C_RESTRICT])
5825
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 ])