Message ID | 528E8110.10406@mind.be |
---|---|
State | Superseded |
Headers | show |
Dear Arnout Vandecappelle, On Thu, 21 Nov 2013 22:54:24 +0100, Arnout Vandecappelle wrote: > You can give AC_TRY_RUN a fourth argument with actions to take when > cross-compiling. These actions are taken when compilation was successful. > Basically, the following patch should work: > > ---------------------------------- > Fix support for cross-compilation. > > The check for posix_fallocate doesn't handle the cross-compilation case. > Assume that it works, because cross-compilation for AIX or old glibc is > unlikely. > > Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> > --- > diff -Nrup lftp-4.4.10.orig/m4/lftp.m4 lftp-4.4.10/m4/lftp.m4 > --- lftp-4.4.10.orig/m4/lftp.m4 2013-03-19 13:25:50.000000000 +0100 > +++ lftp-4.4.10/m4/lftp.m4 2013-11-21 22:46:27.776820935 +0100 > @@ -271,6 +271,8 @@ AC_DEFUN([LFTP_POSIX_FALLOCATE_CHECK],[ > i_cv_posix_fallocate_works=yes > ], [ > i_cv_posix_fallocate_works=no > + ], [ > + i_cv_posix_fallocate_works=yes > ]) > ]) > if test x$i_cv_posix_fallocate_works = xyes; then > ---------------------------------- Seeing this, I believe that passing i_cv_posix_fallocate_works=yes in the ./configure environment is a better solution. Thomas
On 21/11/13 23:00, Thomas Petazzoni wrote: > Dear Arnout Vandecappelle, > > On Thu, 21 Nov 2013 22:54:24 +0100, Arnout Vandecappelle wrote: > >> You can give AC_TRY_RUN a fourth argument with actions to take when >> cross-compiling. These actions are taken when compilation was successful. >> Basically, the following patch should work: >> >> ---------------------------------- >> Fix support for cross-compilation. >> >> The check for posix_fallocate doesn't handle the cross-compilation case. >> Assume that it works, because cross-compilation for AIX or old glibc is >> unlikely. >> >> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> >> --- >> diff -Nrup lftp-4.4.10.orig/m4/lftp.m4 lftp-4.4.10/m4/lftp.m4 >> --- lftp-4.4.10.orig/m4/lftp.m4 2013-03-19 13:25:50.000000000 +0100 >> +++ lftp-4.4.10/m4/lftp.m4 2013-11-21 22:46:27.776820935 +0100 >> @@ -271,6 +271,8 @@ AC_DEFUN([LFTP_POSIX_FALLOCATE_CHECK],[ >> i_cv_posix_fallocate_works=yes >> ], [ >> i_cv_posix_fallocate_works=no >> + ], [ >> + i_cv_posix_fallocate_works=yes >> ]) >> ]) >> if test x$i_cv_posix_fallocate_works = xyes; then >> ---------------------------------- > > Seeing this, I believe that passing i_cv_posix_fallocate_works=yes in > the ./configure environment is a better solution. But that wouldn't detect the uClibc case when posix_fallocate isn't available... Regards, Arnout
Dear Arnout Vandecappelle, On Thu, 21 Nov 2013 23:19:10 +0100, Arnout Vandecappelle wrote: > > Seeing this, I believe that passing i_cv_posix_fallocate_works=yes in > > the ./configure environment is a better solution. > > But that wouldn't detect the uClibc case when posix_fallocate isn't > available... I thought there were two tests, with two different variables: * One testing if a program with posix_fallocate() can be *compiled*. This test we need to let it as it is. * One testing if a program with posix_fallocate() can *run*. This test we need to tell the configure script to just assume that posix_fallocate() works (but of course, making the assumption that a failure on the previous test will make the configure conclude that posix_fallocate is not available). Best regards, Thomas
On 22/11/13 09:15, Thomas Petazzoni wrote: > Dear Arnout Vandecappelle, > > On Thu, 21 Nov 2013 23:19:10 +0100, Arnout Vandecappelle wrote: > >>> Seeing this, I believe that passing i_cv_posix_fallocate_works=yes in >>> the ./configure environment is a better solution. >> >> But that wouldn't detect the uClibc case when posix_fallocate isn't >> available... > > I thought there were two tests, with two different variables: > > * One testing if a program with posix_fallocate() can be *compiled*. > This test we need to let it as it is. > > * One testing if a program with posix_fallocate() can *run*. This test > we need to tell the configure script to just assume that > posix_fallocate() works (but of course, making the assumption that > a failure on the previous test will make the configure conclude that > posix_fallocate is not available). Well, yes, there are two tests in configure, but only a single macro in lftp.m4. AC_TRY_RUN compiles the first argument and then tries to run it (if not cross-compiling). The second argument is executed if the run succeeds, the third argument if the compilation or the run fails, the fourth argument if compilation succeeds but it cannot be ran because you're cross-compiling. There are a number of other instances of AC_TRY_RUN in the lftp configure scripts, but the others all have the fourth argument. Regards, Arnout
On 11/22/2013 10:20 AM, Arnout Vandecappelle wrote: > > Well, yes, there are two tests in configure, but only a single macro > in lftp.m4. AC_TRY_RUN compiles the first argument and then tries to > run it (if not cross-compiling). The second argument is executed if > the run succeeds, the third argument if the compilation or the run > fails, the fourth argument if compilation succeeds but it cannot be > ran because you're cross-compiling. > > There are a number of other instances of AC_TRY_RUN in the lftp > configure scripts, but the others all have the fourth argument. I tried to add a 4th argument to the AC_TRY_RUN as you suggested in a previous mail: > + ], [ > + i_cv_posix_fallocate_works=yes But in case of cross-compiation, it always returns yes, even if posix_fallocate is not defined by the libc: autotools don't even try to compile in case of cross-compile. So it looks like a compile tested is needed in addition to the run test. I just sent a second revision of the patch with the compile test added. I tried it on two different buildroot repo, one with posix_fallocate, and the other without posix_fallocate. It's working good. Best regards, Arnaud
diff -Nrup lftp-4.4.10.orig/m4/lftp.m4 lftp-4.4.10/m4/lftp.m4 --- lftp-4.4.10.orig/m4/lftp.m4 2013-03-19 13:25:50.000000000 +0100 +++ lftp-4.4.10/m4/lftp.m4 2013-11-21 22:46:27.776820935 +0100 @@ -271,6 +271,8 @@ AC_DEFUN([LFTP_POSIX_FALLOCATE_CHECK],[ i_cv_posix_fallocate_works=yes ], [ i_cv_posix_fallocate_works=no + ], [ + i_cv_posix_fallocate_works=yes ]) ]) if test x$i_cv_posix_fallocate_works = xyes; then