Re: play nice with AC_CACHE_CHECK
Ralf Wildenhues [EMAIL PROTECTED] writes: * readline.m4 (gl_FUNC_READLINE): Rewrite the cached part of the test to be side-effect free by storing the result in the cache variable gl_cv_lib_readline, and moving the assignment of LIBREADLINE and LTLIBREADLINE outside the COMMANDS-TO-SET-IT. I installed this while we are waiting for your papers. I hope I didn't break any policy here, if so, please someone tell me and I'll back the change out until we have the papers. Thanks! Index: m4/readline.m4 === RCS file: /cvsroot/gnulib/gnulib/m4/readline.m4,v retrieving revision 1.4 diff -u -r1.4 readline.m4 --- m4/readline.m49 Jan 2006 21:42:56 - 1.4 +++ m4/readline.m43 Mar 2006 17:38:15 - @@ -42,23 +42,20 @@ AC_TRY_LINK([#include stdio.h #include readline/readline.h], [readline((char*)0);], -gl_cv_lib_readline=yes) - if test $gl_cv_lib_readline = yes; then -if test -n $extra_lib; then - LIBREADLINE=$LIBREADLINE -l$extra_lib - LTLIBREADLINE=$LTLIBREADLINE -l$extra_lib -fi -break +[gl_cv_lib_readline= -l$extra_lib]) + if test $gl_cv_lib_readline != no; then + break fi done LIBS=$am_save_LIBS ]) - if test $gl_cv_lib_readline = yes; then + if test $gl_cv_lib_readline != no; then AC_DEFINE(HAVE_READLINE, 1, [Define if you have the readline library.]) - fi - - if test $gl_cv_lib_readline = yes; then +if test $gl_cv_lib_readline != -l; then + LIBREADLINE=$LIBREADLINE$gl_cv_lib_readline + LTLIBREADLINE=$LTLIBREADLINE$gl_cv_lib_readline +fi AC_MSG_CHECKING([how to link with libreadline]) AC_MSG_RESULT([$LIBREADLINE]) else ___ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib
Re: play nice with AC_CACHE_CHECK
Hi Simon, * Simon Josefsson wrote on Fri, Mar 03, 2006 at 06:28:35PM CET: Ralf Wildenhues [EMAIL PROTECTED] writes: Would you install the remaining part of my patch as well, please? Have you signed copyright papers for gnulib? I can't find them. This process is not finished yet, unfortunately. Sorry about that (my fault as well). remember asking you about this before, FWIW, I don't.. but given the M-C-T and the slowness of all spam-checking-enabled mailing lists on gnu.org, you probably haven't received. I'm adding you in To: manually. Thanks. Btw, I tested the readline patch, and if no additional library is required, it will put '-lreadline -l' into the linker flags. Which breaks... maybe you can update it? Ouch. Darn. Next try below. Thanks for catching this! Cheers, Ralf * readline.m4 (gl_FUNC_READLINE): Rewrite the cached part of the test to be side-effect free by storing the result in the cache variable gl_cv_lib_readline, and moving the assignment of LIBREADLINE and LTLIBREADLINE outside the COMMANDS-TO-SET-IT. Index: m4/readline.m4 === RCS file: /cvsroot/gnulib/gnulib/m4/readline.m4,v retrieving revision 1.4 diff -u -r1.4 readline.m4 --- m4/readline.m4 9 Jan 2006 21:42:56 - 1.4 +++ m4/readline.m4 3 Mar 2006 17:38:15 - @@ -42,23 +42,20 @@ AC_TRY_LINK([#include stdio.h #include readline/readline.h], [readline((char*)0);], -gl_cv_lib_readline=yes) - if test $gl_cv_lib_readline = yes; then -if test -n $extra_lib; then - LIBREADLINE=$LIBREADLINE -l$extra_lib - LTLIBREADLINE=$LTLIBREADLINE -l$extra_lib -fi -break +[gl_cv_lib_readline= -l$extra_lib]) + if test $gl_cv_lib_readline != no; then + break fi done LIBS=$am_save_LIBS ]) - if test $gl_cv_lib_readline = yes; then + if test $gl_cv_lib_readline != no; then AC_DEFINE(HAVE_READLINE, 1, [Define if you have the readline library.]) - fi - - if test $gl_cv_lib_readline = yes; then +if test $gl_cv_lib_readline != -l; then + LIBREADLINE=$LIBREADLINE$gl_cv_lib_readline + LTLIBREADLINE=$LTLIBREADLINE$gl_cv_lib_readline +fi AC_MSG_CHECKING([how to link with libreadline]) AC_MSG_RESULT([$LIBREADLINE]) else ___ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib
Re: play nice with AC_CACHE_CHECK
2) Similar with getaddrinfo.m4, except there is no need to store additional information here. Beware, the getaddrinfo part of the patch is completely untested. The following patch to getaddrinfo HAS been tested: http://lists.gnu.org/archive/html/bug-gnulib/2006-02/msg00057.html And it is essential for CVS coreutils to compile on cygwin with caching on (sorry you had to duplicate my efforts) -- Eric Blake ___ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib
Re: play nice with AC_CACHE_CHECK
Hi Eric, * Eric Blake wrote on Thu, Feb 23, 2006 at 08:42:18PM CET: 2) Similar with getaddrinfo.m4, except there is no need to store additional information here. Beware, the getaddrinfo part of the patch is completely untested. The following patch to getaddrinfo HAS been tested: And it is essential for CVS coreutils to compile on cygwin with caching on (sorry you had to duplicate my efforts) Oh, I did not research much about pending patches; mine is essentially the same as yours, which is a good sign. So yours should be applied. Sorry about that. I audited all use of AC_CACHE_CHECK in gnulib. There is one more open candidate, AM_GNU_GETTEXT, which I assume to be problematic, but its logic is more involved. All other uses look fine. Cheers, Ralf ___ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib
Re: play nice with AC_CACHE_CHECK
Ralf Wildenhues [EMAIL PROTECTED] wrote: 1) readline.m4 gives different results with cached reruns: for example, on x86_64-unknown-linux-gnu: ./configure -C - LIBREADLINE=-lreadline -lncurses ./config.status --recheck - LIBREADLINE=-lreadline This is because the commands to set the cache variable `gl_cv_lib_readline' also adjust LIBREADLINE and LTLIBREADLINE. The patch below fixes that by (ab)using the cache variable to hold the test result contents, making the COMMANDS-TO-SET-IT argument of the AC_CACHE_CHECK macro side-effect free. Do you think the cache variable should be renamed (for users keeping the cache over the update; not that it was working well before anyway)? Good catch. I'm glad you didn't rename the cache variable. Having a conforming, well-known name is worth more than avoiding the possibility of a few ephemeral user problems. Besides, there may well be packages that test $gl_cv_lib_readline, and changing the name would make them fail. ___ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib