From 34afcb5b26c2b5ae2da30fba90095263f854cb94 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 7 Aug 2008 09:36:49 +0000 Subject: [PATCH] complete the MinGW inet_pton portability fix * gnulib/m4/inet_pton.m4: New file. Required for MinGW. * gnulib/m4/gnulib-comp.m4: Regenerate via gnulib-tool. --- ChangeLog | 6 ++++ gnulib/m4/gnulib-comp.m4 | 62 ++++++++++++++++++++++++++-------------- gnulib/m4/inet_pton.m4 | 27 +++++++++++++++++ 3 files changed, 73 insertions(+), 22 deletions(-) create mode 100644 gnulib/m4/inet_pton.m4 diff --git a/ChangeLog b/ChangeLog index ea6f1da522..fd7b4771dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Aug 7 13:30:44 CEST 2008 Jim Meyering + + complete the MinGW inet_pton portability fix + * gnulib/m4/inet_pton.m4: New file. Required for MinGW. + * gnulib/m4/gnulib-comp.m4: Regenerate via gnulib-tool. + Tue Aug 6 13:30:44 CEST 2008 Jim Meyering fix failing "make syntax-check" diff --git a/gnulib/m4/gnulib-comp.m4 b/gnulib/m4/gnulib-comp.m4 index 6341bc2438..239eb7a5f5 100644 --- a/gnulib/m4/gnulib-comp.m4 +++ b/gnulib/m4/gnulib-comp.m4 @@ -39,6 +39,8 @@ AC_DEFUN([gl_INIT], m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ])) m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS])) m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES])) + m4_pushdef([gl_LIBSOURCES_LIST], []) + m4_pushdef([gl_LIBSOURCES_DIR], []) gl_COMMON gl_source_base='gnulib/lib' gl_EOVERFLOW @@ -60,6 +62,8 @@ AC_DEFUN([gl_INIT], AC_SUBST([LTLIBINTL]) gl_INET_NTOP gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) + gl_INET_PTON + gl_ARPA_INET_MODULE_INDICATOR([inet_pton]) gl_FUNC_LSEEK gl_UNISTD_MODULE_INDICATOR([lseek]) gl_FUNC_MALLOC_POSIX @@ -107,6 +111,19 @@ AC_DEFUN([gl_INIT], AM_XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) gl_WCHAR_H gl_XSIZE + m4_ifval(gl_LIBSOURCES_LIST, [ + m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || + for gl_file in ]gl_LIBSOURCES_LIST[ ; do + if test ! -r ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file ; then + echo "missing file ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file" >&2 + exit 1 + fi + done])dnl + m4_if(m4_sysval, [0], [], + [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) + ]) + m4_popdef([gl_LIBSOURCES_DIR]) + m4_popdef([gl_LIBSOURCES_LIST]) m4_popdef([AC_LIBSOURCES]) m4_popdef([AC_REPLACE_FUNCS]) m4_popdef([AC_LIBOBJ]) @@ -129,6 +146,8 @@ AC_DEFUN([gl_INIT], m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ])) m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS])) m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES])) + m4_pushdef([gltests_LIBSOURCES_LIST], []) + m4_pushdef([gltests_LIBSOURCES_DIR], []) gl_COMMON gl_source_base='gnulib/tests' gt_TYPE_WCHAR_T @@ -136,6 +155,19 @@ AC_DEFUN([gl_INIT], AC_CHECK_FUNCS([shutdown]) abs_aux_dir=`cd "$ac_aux_dir"; pwd` AC_SUBST([abs_aux_dir]) + m4_ifval(gltests_LIBSOURCES_LIST, [ + m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ || + for gl_file in ]gltests_LIBSOURCES_LIST[ ; do + if test ! -r ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file ; then + echo "missing file ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file" >&2 + exit 1 + fi + done])dnl + m4_if(m4_sysval, [0], [], + [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) + ]) + m4_popdef([gltests_LIBSOURCES_DIR]) + m4_popdef([gltests_LIBSOURCES_LIST]) m4_popdef([AC_LIBSOURCES]) m4_popdef([AC_REPLACE_FUNCS]) m4_popdef([AC_LIBOBJ]) @@ -164,13 +196,6 @@ AC_DEFUN([gl_LIBOBJ], [ gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext" ]) -# m4_foreach_w is provided by autoconf-2.59c and later. -# This definition is to accommodate developers using versions -# of autoconf older than that. -m4_ifndef([m4_foreach_w], - [m4_define([m4_foreach_w], - [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) - # Like AC_REPLACE_FUNCS, except that the module name goes # into gl_LIBOBJS instead of into LIBOBJS. AC_DEFUN([gl_REPLACE_FUNCS], [ @@ -179,15 +204,14 @@ AC_DEFUN([gl_REPLACE_FUNCS], [ ]) # Like AC_LIBSOURCES, except the directory where the source file is -# expected is derived from the gnulib-tool parametrization, +# expected is derived from the gnulib-tool parameterization, # and alloca is special cased (for the alloca-opt module). # We could also entirely rely on EXTRA_lib..._SOURCES. AC_DEFUN([gl_LIBSOURCES], [ m4_foreach([_gl_NAME], [$1], [ m4_if(_gl_NAME, [alloca.c], [], [ - m4_syscmd([test -r gnulib/lib/]_gl_NAME[ || test ! -d gnulib/lib])dnl - m4_if(m4_sysval, [0], [], - [AC_FATAL([missing gnulib/lib/]_gl_NAME)]) + m4_define([gl_LIBSOURCES_DIR], [gnulib/lib]) + m4_append([gl_LIBSOURCES_LIST], _gl_NAME, [ ]) ]) ]) ]) @@ -199,13 +223,6 @@ AC_DEFUN([gltests_LIBOBJ], [ gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext" ]) -# m4_foreach_w is provided by autoconf-2.59c and later. -# This definition is to accommodate developers using versions -# of autoconf older than that. -m4_ifndef([m4_foreach_w], - [m4_define([m4_foreach_w], - [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) - # Like AC_REPLACE_FUNCS, except that the module name goes # into gltests_LIBOBJS instead of into LIBOBJS. AC_DEFUN([gltests_REPLACE_FUNCS], [ @@ -214,15 +231,14 @@ AC_DEFUN([gltests_REPLACE_FUNCS], [ ]) # Like AC_LIBSOURCES, except the directory where the source file is -# expected is derived from the gnulib-tool parametrization, +# expected is derived from the gnulib-tool parameterization, # and alloca is special cased (for the alloca-opt module). # We could also entirely rely on EXTRA_lib..._SOURCES. AC_DEFUN([gltests_LIBSOURCES], [ m4_foreach([_gl_NAME], [$1], [ m4_if(_gl_NAME, [alloca.c], [], [ - m4_syscmd([test -r gnulib/tests/]_gl_NAME[ || test ! -d gnulib/tests])dnl - m4_if(m4_sysval, [0], [], - [AC_FATAL([missing gnulib/tests/]_gl_NAME)]) + m4_define([gltests_LIBSOURCES_DIR], [gnulib/tests]) + m4_append([gltests_LIBSOURCES_LIST], _gl_NAME, [ ]) ]) ]) ]) @@ -253,6 +269,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/getpass.h lib/gettext.h lib/inet_ntop.c + lib/inet_pton.c lib/lseek.c lib/malloc.c lib/netinet_in.in.h @@ -307,6 +324,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/iconv.m4 m4/include_next.m4 m4/inet_ntop.m4 + m4/inet_pton.m4 m4/intdiv0.m4 m4/intl.m4 m4/intldir.m4 diff --git a/gnulib/m4/inet_pton.m4 b/gnulib/m4/inet_pton.m4 new file mode 100644 index 0000000000..a57e4c6cba --- /dev/null +++ b/gnulib/m4/inet_pton.m4 @@ -0,0 +1,27 @@ +# inet_pton.m4 serial 5 +dnl Copyright (C) 2006, 2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_INET_PTON], +[ + dnl Persuade Solaris to declare inet_ntop. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) + ARPA_INET_H='arpa/inet.h' + + AC_REPLACE_FUNCS(inet_pton) + gl_PREREQ_INET_PTON +]) + +# Prerequisites of lib/inet_pton.c. +AC_DEFUN([gl_PREREQ_INET_PTON], [ + AC_CHECK_DECLS([inet_pton],,,[#include ]) + if test $ac_cv_have_decl_inet_pton = no; then + HAVE_DECL_INET_PTON=0 + fi + AC_REQUIRE([gl_SOCKET_FAMILIES]) + AC_REQUIRE([AC_C_RESTRICT]) +])