Mercurial > hg > octave-lyh > gnulib-hg
changeset 6735:1f6871379885
* modules/inttypes: New file.
* modules/strtoimax, modules/strtoumax: Depend on inttypes.
* lib/inttypes.h: New file.
* lib/strtoimax.c: Assume <inttypes.h>.
* m4/_inttypes_h.m4, m4/full-header-path.m4, m4/include_next: New
files.
author | Derek R. Price <derek@ximbiot.com> |
---|---|
date | Tue, 18 Apr 2006 17:20:47 +0000 |
parents | 3e5ad4566013 |
children | 9ad514083e7f |
files | ChangeLog lib/ChangeLog lib/inttypes.h lib/strtoimax.c m4/ChangeLog m4/_inttypes_h.m4 m4/full-header-path.m4 m4/include_next.m4 modules/inttypes modules/strtoimax modules/strtoumax |
diffstat | 11 files changed, 177 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-04-18 Derek Price <derek@ximbiot.com> + Paul Eggert <eggert@cs.ucla.edu> + + * modules/inttypes: New file. + * modules/strtoimax, modules/strtoumax: Depend on inttypes. + 2006-04-12 Eric Blake <ebb9@byu.net> * modules/time_r (Makefile.am): Remove lib_SOURCES line, as this
--- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,9 @@ +2006-04-18 Derek Price <derek@ximbiot.com> + Paul Eggert <eggert@cs.ucla.edu> + + * lib/inttypes.h: New file. + * lib/strtoimax.c: Assume <inttypes.h>. + 2006-04-15 Paul Eggert <eggert@cs.ucla.edu> * utimens.c (futimens): glibc futimesat messes up if /proc
new file mode 100644 --- /dev/null +++ b/lib/inttypes.h @@ -0,0 +1,48 @@ +/* Copyright (C) 2006 Free Software Foundation, Inc. + Written by Derek Price & Paul Eggert. + This file is part of gnulib. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1, 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 Lesser 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. */ + +#ifndef INTTYPES_H +#define INTTYPES_H + +/* + * A wrapper for the ISO C 99 <inttypes.h>. + * <http://www.opengroup.org/onlinepubs/007904975/basedefs/inttypes.h.html> + * + * Currently, if the system <inttypes.h> is missing or not C99 compliant, then + * this header may only to provide the required <stdint.h> (which may be the + * *almost* C99 compliant one from GNULIB) and prototypes for the strtoimax and + * strtoumax functions. + */ + +#if HAVE_INTTYPES_H +# if HAVE_INCLUDE_NEXT +# include_next <inttypes.h> +# else +# include FULL_PATH_INTTYPES_H +# endif +#endif +#include <stdint.h> + +#if !HAVE_DECL_STRTOIMAX +intmax_t strtoimax (const char *, char **, int); +#endif +#if !HAVE_DECL_STRTOUMAX +uintmax_t strtoumax (const char *, char **, int); +#endif + +#endif /* INTTYPES_H */
--- a/lib/strtoimax.c +++ b/lib/strtoimax.c @@ -23,12 +23,8 @@ # include <config.h> #endif -#if HAVE_INTTYPES_H -# include <inttypes.h> -#endif -#if HAVE_STDINT_H -# include <stdint.h> -#endif +/* Verify interface. */ +#include <inttypes.h> #include <stdlib.h>
--- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,9 @@ +2006-04-18 Derek Price <derek@ximbiot.com> + Paul Eggert <eggert@cs.ucla.edu> + + * m4/_inttypes_h.m4, m4/full-header-path.m4, m4/include_next: New + files. + 2006-04-11 Paul Eggert <eggert@cs.ucla.edu> * time_r.m4 (gl_TIME_R): Add AC_LIBSOURCES for time_r.c and time_r.h.
new file mode 100644 --- /dev/null +++ b/m4/_inttypes_h.m4 @@ -0,0 +1,13 @@ +# _inttypes_h.m4 serial 1 +dnl Copyright (C) 2006 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 From Derek Price. + +AC_DEFUN([gl_INTTYPES_H], +[AC_LIBSOURCES([inttypes.h]) +gl_FULL_HEADER_PATH([inttypes.h]) +AC_CHECK_DECLS_ONCE([strtoimax strtoumax])dnl +])
new file mode 100644 --- /dev/null +++ b/m4/full-header-path.m4 @@ -0,0 +1,47 @@ +# full-header-path.m4 serial 1 +dnl Copyright (C) 2006 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 From Derek Price. + +# gl_FULL_HEADER_PATH(HEADER1 HEADER2 ...) +# ---------------------------------------- +# Find the full path to a header file, when the #include_next directive +# doesn't work and the header exists in the first place. If the header were +# sys/inttypes.h (and it existed and #include_next didn't work), this macro +# would define FULL_PATH_SYS_INTTYPES_H to the quoted full path to +# sys/inttypes.h in config.h +# (e.g. `#define FULL_PATH_SYS_INTTYPES_H "/usr/include/sys/inttypes.h"'). +AC_DEFUN([gl_FULL_HEADER_PATH], +[AC_LANG_PREPROC_REQUIRE()dnl +AC_REQUIRE([gl_INCLUDE_NEXT])dnl +if test $gl_cv_have_include_next = no; then +AC_FOREACH([gl_HEADER_NAME], [$1], + [AS_VAR_PUSHDEF([gl_full_header_path], + [gl_cv_full_path_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl + AC_CACHE_CHECK([full path to <]m4_quote(m4_defn([gl_HEADER_NAME]))[>], + m4_quote(m4_defn([gl_full_header_path])), + [AS_VAR_PUSHDEF([ac_header_exists], + [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl + AC_CHECK_HEADERS_ONCE(m4_quote(m4_defn([gl_HEADER_NAME])))dnl + if test AS_VAR_GET(ac_header_exists) = yes; then + AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]])]) +dnl eval is necessary to expand ac_cpp. +dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell. + AS_VAR_SET(gl_full_header_path, +[`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | +sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#;p;q;}'`]) + fi + AS_VAR_POPDEF([ac_header_exists])dnl + ])dnl + AC_DEFINE_UNQUOTED([FULL_PATH_]m4_quote(translit(m4_defn([gl_HEADER_NAME]), + [-./abcdefghijklmnopqrstuvwxyz], + [___ABCDEFGHIJKLMNOPQRSTUVWXYZ])), + ["AS_VAR_GET(gl_full_header_path)"], + [Define this to the full path to <]m4_quote(m4_defn([gl_HEADER_NAME]))[>.]) + AS_VAR_POPDEF([gl_full_header_path])dnl +])dnl +fi +])# gl_FULL_HEADER_PATH
new file mode 100644 --- /dev/null +++ b/m4/include_next.m4 @@ -0,0 +1,19 @@ +# include_next.m4 serial 1 +dnl Copyright (C) 2006 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 From Derek Price. + +AC_DEFUN([gl_INCLUDE_NEXT], +[AC_CACHE_CHECK([whether the preprocessor supports include_next], +[gl_cv_have_include_next], +[AC_PREPROC_IFELSE([#include_next <stddef.h>], + [gl_cv_have_include_next=yes], + [gl_cv_have_include_next=no])]) +if test $gl_cv_have_include_next = yes; then + AC_DEFINE([HAVE_INCLUDE_NEXT], 1, + [Define if your compiler supports the #include_next directive.]) +fi +])
new file mode 100644 --- /dev/null +++ b/modules/inttypes @@ -0,0 +1,28 @@ +Description: +A wrapper C99 <inttypes.h> header which will always include <stdint.h> +(possibly the *almost* C99 compliant GNULIB <stdint.h>) and prototypes for the +strtoimax & strtoumax functions. + +Files: +lib/inttypes.h +m4/include_next.m4 +m4/full-header-path.m4 +m4/_inttypes_h.m4 + +Depends-on: +stdint + +configure.ac: +gl_INTTYPES_H + +Makefile.am: + +Include: +#include <inttypes.h> + +License: +LGPL + +Maintainer: +Derek Price +