Simon Josefsson wrote: > > Usually, if you're going to replace stdlib.h, the cost of replacing other > > headers is not much more. I don't think we need a separate module. > > The only reason would be if someone wanted to use stdlib.in.h from > gnulib and would not want to use stdint.in.h from gnulib -- if the > application doesn't use struct random_data that would be possible.
Or simply, a package that does not want to import so much from gnulib. Sam Steingold would say: "I need setenv(), which needs a declaration in <stdlib.h>, so I get gnulib's stdlib.h replacement. But why all this dozen of configure checks for stdint.h, when I don't need stdint.h? Nor do I need this 'struct random_data'!" The workaround would be to split the 'stdlib' module into 'stdlib' and 'stdlib-gnu'. Like in the attached patch. But I don't want to apply this patch - IMO it's too much complications for avoiding one dependency which 1. creates no executable code and 2. is likely to be dragged it by other dependencies anyway. Bruno --- lib/stdlib.in.h.orig 2009-03-24 23:42:08.000000000 +0100 +++ lib/stdlib.in.h 2009-03-24 23:31:26.000000000 +0100 @@ -43,15 +43,15 @@ /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included from <stdlib.h> if _REENTRANT is defined. Include it always. */ -#if @HAVE_RANDOM_H@ +#if @GNULIB_STDLIB_GNU@ && @HAVE_RANDOM_H@ # include <random.h> #endif -#if @GNULIB_RANDOM_R@ || !...@have_struct_random_data@ +#if @GNULIB_STDLIB_GNU@ && (@GNULIB_RANDOM_R@ || !...@have_struct_random_data@) # include <stdint.h> #endif -#if !...@have_struct_random_data@ +#if @GNULIB_STDLIB_GNU@ && !...@have_struct_random_data@ struct random_data { int32_t *fptr; /* Front pointer. */ --- m4/stdlib_h.m4.orig 2009-03-24 23:42:08.000000000 +0100 +++ m4/stdlib_h.m4 2009-03-24 23:23:15.000000000 +0100 @@ -45,6 +45,7 @@ GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) + GNULIB_STDLIB_GNU=0; AC_SUBST([GNULIB_STDLIB_GNU]) GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) --- modules/stdlib-gnu.orig 2008-06-06 22:36:48.000000000 +0200 +++ modules/stdlib-gnu 2009-03-24 23:24:23.000000000 +0100 @@ -0,0 +1,21 @@ +Description: +A GNU-like <stdlib.h>. + +Files: + +Depends-on: +stdlib + +configure.ac: +gl_STDLIB_MODULE_INDICATOR([stdlib-gnu]) + +Makefile.am: + +Include: +#include <stdlib.h> + +License: +LGPLv2+ + +Maintainer: +all --- modules/stdlib.orig 2009-03-24 23:42:08.000000000 +0100 +++ modules/stdlib 2009-03-24 23:23:34.000000000 +0100 @@ -1,5 +1,5 @@ Description: -A GNU-like <stdlib.h>. +A POSIX-like <stdlib.h>. Files: lib/stdlib.in.h @@ -9,7 +9,6 @@ include_next link-warning unistd -stdint configure.ac: gl_STDLIB_H @@ -38,6 +37,7 @@ -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \ -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \ -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \ + -e 's|@''GNULIB_STDLIB_GNU''@|$(GNULIB_STDLIB_GNU)|g' \ -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \ -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \ -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \ --- modules/getloadavg.orig 2009-03-24 23:42:08.000000000 +0100 +++ modules/getloadavg 2009-03-24 23:29:02.000000000 +0100 @@ -6,7 +6,7 @@ m4/getloadavg.m4 Depends-on: -stdlib +stdlib-gnu extensions cloexec xalloc --- modules/random_r.orig 2009-03-24 23:42:08.000000000 +0100 +++ modules/random_r 2009-03-24 23:29:06.000000000 +0100 @@ -6,7 +6,7 @@ m4/random_r.m4 Depends-on: -stdlib +stdlib-gnu stdint configure.ac: --- modules/rpmatch.orig 2009-03-24 23:42:08.000000000 +0100 +++ modules/rpmatch 2009-03-24 23:29:12.000000000 +0100 @@ -6,7 +6,7 @@ m4/rpmatch.m4 Depends-on: -stdlib +stdlib-gnu extensions stdbool gettext-h