+2007-02-18 Bruno Haible <bruno@clisp.org>
+
+ * lib/stdlib_.h (getsubopt): New declaration, copied from getsubopt.h.
+ * modules/stdlib (stdlib.h): Also substitute GNULIB_GETSUBOPT and
+ HAVE_GETSUBOPT.
+ * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Also initialize
+ GNULIB_GETSUBOPT and HAVE_GETSUBOPT.
+ * lib/getsubopt.h: Remove file.
+ * modules/getsubopt (Files): Remove lib/getsubopt.h.
+ (Depends-on): Add stdlib.
+ (configure.ac): Invoke gl_STDLIB_MODULE_INDICATOR.
+ (Includes): Use <stdlib.h> instead of getsubopt.h.
+ * m4/getsubopt.m4 (gl_FUNC_GETSUBOPT): Require gl_STDLIB_H_DEFAULTS.
+ Set HAVE_GETSUBOPT.
+ * lib/getsubopt.c: Don't include getsubopt.h.
+
2007-02-18 Bruno Haible <bruno@clisp.org>
* modules/fchdir (Depends-on): Add dup2.
-/* Parse comma separate list into words.
+/* Parse comma separated list into words.
Copyright (C) 1996, 1997, 1999, 2004, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
#if !_LIBC
# include <config.h>
-# include "getsubopt.h"
#endif
#include <stdlib.h>
+++ /dev/null
-/* Parse comma separate list into words.
- Copyright (C) 2004-2005 Free Software Foundation, Inc.
- Contributed by Simon Josefsson <jas@extundo.com>, 2004.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Assuming *OPTIONP is a comma separated list of elements of the form
- "token" or "token=value", getsubopt parses the first of these elements.
- If the first element refers to a "token" that is member of the given
- NULL-terminated array of tokens:
- - It replaces the comma with a NUL byte, updates *OPTIONP to point past
- the first option and the comma, sets *VALUEP to the value of the
- element (or NULL if it doesn't contain an "=" sign),
- - It returns the index of the "token" in the given array of tokens.
- Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
- For more details see the POSIX:2001 specification.
- http://www.opengroup.org/susv3xsh/getsubopt.html */
-
-#if HAVE_GETSUBOPT
-
-/* Get getsubopt declaration. */
-#include <stdlib.h>
-
-#else
-
-extern int getsubopt (char **optionp, char *const *tokens, char **valuep);
-
-#endif
#endif
+#if @GNULIB_GETSUBOPT@
+/* Assuming *OPTIONP is a comma separated list of elements of the form
+ "token" or "token=value", getsubopt parses the first of these elements.
+ If the first element refers to a "token" that is member of the given
+ NULL-terminated array of tokens:
+ - It replaces the comma with a NUL byte, updates *OPTIONP to point past
+ the first option and the comma, sets *VALUEP to the value of the
+ element (or NULL if it doesn't contain an "=" sign),
+ - It returns the index of the "token" in the given array of tokens.
+ Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
+ For more details see the POSIX:2001 specification.
+ http://www.opengroup.org/susv3xsh/getsubopt.html */
+# if !@HAVE_GETSUBOPT@
+extern int getsubopt (char **optionp, char *const *tokens, char **valuep);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getsubopt
+# define getsubopt(o,t,v) \
+ (GL_LINK_WARNING ("getsubopt is unportable - "\
+ "use gnulib module getsubopt for portability"), \
+ getsubopt (o, t, v))
+#endif
+
+
#if @GNULIB_MKDTEMP@
# if !@HAVE_MKDTEMP@
/* Create a unique temporary directory from TEMPLATE.
mkdtemp (t))
#endif
+
#if @GNULIB_MKSTEMP@
# if @REPLACE_MKSTEMP@
/* Create a unique temporary file from TEMPLATE.
-# getsubopt.m4 serial 2
-dnl Copyright (C) 2004 Free Software Foundation, Inc.
+# getsubopt.m4 serial 3
+dnl Copyright (C) 2004, 2007 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.
dnl Persuade glibc <stdlib.h> to declare getsubopt().
AC_REQUIRE([AC_GNU_SOURCE])
- AC_REPLACE_FUNCS(getsubopt)
+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+ AC_CHECK_FUNCS_ONCE([getsubopt])
if test $ac_cv_func_getsubopt = no; then
+ HAVE_GETSUBOPT=0
+ AC_LIBOBJ([getsubopt])
gl_PREREQ_GETSUBOPT
fi
])
AC_DEFUN([gl_STDLIB_H_DEFAULTS],
[
- GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP])
- GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP])
+ GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT])
+ GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP])
+ GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP])
dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP])
- REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
+ HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT])
+ HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP])
+ REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
])
Description:
-getsubopt: Parse comma separate list into words.
+getsubopt: Parse comma separated list into words.
Files:
-lib/getsubopt.h
lib/getsubopt.c
m4/getsubopt.m4
Depends-on:
strchrnul
+stdlib
configure.ac:
gl_FUNC_GETSUBOPT
+gl_STDLIB_MODULE_INDICATOR([getsubopt])
Makefile.am:
Include:
-"getsubopt.h"
+<stdlib.h>
License:
LGPL
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''ABSOLUTE_STDLIB_H''@|$(ABSOLUTE_STDLIB_H)|g' \
+ -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
-e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
-e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
+ -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
-e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
-e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \