Paul Eggert wrote: > > What does "otherwise" mean? Either 'configure' finds the system's strstr > > OK or it finds problems. What is the third alternative? > > The third alternative is that 'configure' does not check whether the > the system's strstr is OK.
Ah, I see: this is the case when the gnulib module 'strstr' is not used. > Here's the proposal again, amended as per the above: > > #if @REPLACE_STRSTR@ > # undef strstr > # define strstr rpl_strstr > #endif > #if @REPLACE_STRSTR@ || ! @HAVE_DECL_STRSTR@ > extern char *strstr (char const *__haystack, char const *__needle); > #endif > > @REPLACE_STRSTR@ is: > > 0 if 'configure' checks the system strstr and found it to be OK > or absent. > > 1 if 'configure' checks the system strstr and found that it > exists but has problems. > > _GL_CHECK_PORTABILITY if 'configure' did not check the system > strstr. > > Maintainers can compile with -D_GL_CHECK_PORTABILITY to > enable portability checking. OK, I now better understand what you mean. The proposal I'm going for is basically: #if @GNULIB_STRSTR@ # if @REPLACE_STRSTR@ # undef strstr # define strstr rpl_strstr # endif # if @REPLACE_STRSTR@ || ! @HAVE_DECL_STRSTR@ extern char *strstr (char const *__haystack, char const *__needle); # endif #elif _GL_CHECK_PORTABILITY # define strstr strstr_in_unportable__use_gnulib_module_strstr #endif where @REPLACE_STRSTR@ is undefined in the "otherwise" case. What's the difference: 1) If the maintainer has not included the strstr module but uses the strstr function and activates _GL_CHECK_PORTABILITY: With your proposal he will get a link error about function 'rpl_strstr', and will likely report it as a bug in gnulib. With mine, he gets a link error about 'strstr_in_unportable__use_gnulib_module_strstr' and knows it's a problem in his use of gnulib. 2) If the maintainer has not included the strstr module but uses the strstr function and the installer does _not_ set _GL_CHECK_PORTABILITY: Your proposal will activate the "extern char *strstr ..." declaration, while mine won't. Bruno