Now that Emacs is using gnulib I'd like to improve it to use more gnulib modules. I started with strftime, but ran into a problem with unwanted dependencies, and propose the following patch.
Bruno, could you please look into this when you have the time? One detail requires OSF expertise, which I lack. >From bd376d673a82007fef0b88cd24ffe16334f106d5 Mon Sep 17 00:00:00 2001 From: Paul Eggert <[email protected]> Date: Mon, 17 Jan 2011 23:14:33 -0800 Subject: [PATCH] strftime: remove dependencies on multibyte modules strftime depended on mbrlen, mbsinit, and wchar, but these modules are needed only if ! MULTIBYTE_IS_FORMAT_SAFE, and that is true only if __osf__ is defined, and I suspect OSF doesn't need these other modules. If my guess is wrong, we'll need to come up with a variant of strftime that doesn't need the multibyte modules. I discovered this problem when attempting modify Emacs to use the strftime module. With the previous gnulib, this caused Emacs to need 31 new files, ranging from lib/config.charset to m4/wint_t.m4. This was overkill and I expect would be offputting to the Emacs maintainers. After this change, only 6 new files are needed, namely strftime.[ch], srtftime.m4, stdbool.in.h, stdbool.m4, and tm_gmtoff.m4. * m4/strftime.m4 (gl_FUNC_STRFTIME): Do not require AC_TYPE_MBSTATE_T, and do not check for wchar.h. * modules/strftime (Files): Remove m4/mbstate_t.m4. (Depends-on): Remove mbrlen, mbsinit, wchar. --- ChangeLog | 23 +++++++++++++++++++++++ m4/strftime.m4 | 2 -- modules/strftime | 4 ---- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a61910..9b278e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2011-01-17 Paul Eggert <[email protected]> + + strftime: remove dependencies on multibyte modules + + strftime depended on mbrlen, mbsinit, and wchar, but these modules + are needed only if ! MULTIBYTE_IS_FORMAT_SAFE, and that is true + only if __osf__ is defined, and I suspect OSF doesn't need these + other modules. If my guess is wrong, we'll need to come up with a + variant of strftime that doesn't need the multibyte modules. + + I discovered this problem when attempting modify Emacs to use the + strftime module. With the previous gnulib, this caused Emacs to + need 31 new files, ranging from lib/config.charset to + m4/wint_t.m4. This was overkill and I expect would be offputting + to the Emacs maintainers. After this change, only 6 new files are + needed, namely strftime.[ch], srtftime.m4, stdbool.in.h, + stdbool.m4, and tm_gmtoff.m4. + + * m4/strftime.m4 (gl_FUNC_STRFTIME): Do not require AC_TYPE_MBSTATE_T, + and do not check for wchar.h. + * modules/strftime (Files): Remove m4/mbstate_t.m4. + (Depends-on): Remove mbrlen, mbsinit, wchar. + 2011-01-17 Eric Blake <[email protected]> sigaction: relax license from LGPLv3+ to LGPLv2+ diff --git a/m4/strftime.m4 b/m4/strftime.m4 index d2a6f7e..d9de341 100644 --- a/m4/strftime.m4 +++ b/m4/strftime.m4 @@ -21,11 +21,9 @@ AC_DEFUN([gl_FUNC_STRFTIME], # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE. AC_REQUIRE([AC_STRUCT_TIMEZONE]) - AC_REQUIRE([AC_TYPE_MBSTATE_T]) AC_REQUIRE([gl_TM_GMTOFF]) AC_CHECK_FUNCS_ONCE([tzset]) - AC_CHECK_HEADERS_ONCE([wchar.h]) AC_DEFINE([my_strftime], [nstrftime], [Define to the name of the strftime replacement function.]) diff --git a/modules/strftime b/modules/strftime index dc53916..0af5e13 100644 --- a/modules/strftime +++ b/modules/strftime @@ -4,17 +4,13 @@ nstrftime() function: convert date and time to string, with GNU extensions. Files: lib/strftime.h lib/strftime.c -m4/mbstate_t.m4 m4/tm_gmtoff.m4 m4/strftime.m4 Depends-on: extensions -mbrlen -mbsinit stdbool time_r -wchar configure.ac: gl_FUNC_GNU_STRFTIME -- 1.7.3
