git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Fwd: [PATCH v3] autoconf: Test FREAD_READS_DIRECTORIES

From
Mike Ralphson <mike.ralphson@gmail.com>
Date
Mar 4, 2008, 16:22 UTC
Message-ID
<e2b179460803040822v1161190n45c6080da36700c9@mail.gmail.com>
In-Reply-To
<e2b179460803040732k222651c2vdb04e553b8137891@mail.gmail.com>
On 04/03/2008, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 46 quoted lines
>  On Tue, 4 Mar 2008, Michal Rokos wrote:
>
>  > On Tuesday 04 March 2008 15:59:02 Johannes Schindelin wrote:
>  > > On Tue, 4 Mar 2008, Michal Rokos wrote:
>  > > > +AC_RUN_IFELSE(
>  > > > + [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
>  > > > +         [[char c;
>  > > > +         FILE *f = fopen(".", "r");
>  > > > +         if (! f) return 0;
>  > > > +         if (f && fread(&c, 1, 1, f) > 0) return 1]])],
>  > > > + [ac_cv_fread_reads_directories=no],
>  > > > + [ac_cv_fread_reads_directories=yes])
>  > >
>  > > I do not see the issue addressed that I saw on msysGit.
>  >
>  > ahh, sorry I've included some old one. Now it's
>  > +AC_RUN_IFELSE(
>  > +     [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
>  > +             [[char c;
>  > +             FILE *f = fopen(".", "r");
>  > +             return f && fread(&c, 1, 1, f)]])],
>  > +     [ac_cv_fread_reads_directories=no],
>  > +     [ac_cv_fread_reads_directories=yes])
>  >
>  > I've tried to reproduce, but I failed to do so. When I put "return 0;" it
>  > detect that "no"; when I return something else, "yes" is detected - as it
>  > should.
>
>
> I finally figured out what is going wrong.
>
>  But first let me say what a PITA it is to debug configure.  It is utterly,
>  completely painful!  When you insert random "exit"s, like you usually do
>  with scripts that are too garbled and complex and ugly to understand (the
>  worst Perl code I ever saw was not as ugly), it does not exit _at all_!
>
>  Turns out that the compilation fails:
>
>         ...\ld.exe: cannot find -lsocket 1 exit status
>
>  Nice.
>
>  FWIW it tries to link with
>
>         cc -o conftest.exe -g -O2   conftest.c  -liconv -lsocket >&5
>

Should probably have copied you on the mail below. Seems like you hit a similar problem.

With configure you have to always go back to the initial failure (which may have been reported as a success!) as all subsequent test results could be invalid.

Either the test to see whether gcc accepts -g is flawed (it doesn't check whether it actually works, only that the gcc wrapper accepts it; or -g only works if libg is available, and it fails to test for that...

---------- Forwarded message ----------
From: Mike Ralphson <mike.ralphson@gmail.com>
Date: 4 Mar 2008 15:32
Subject: Re: [PATCH v3] autoconf: Test FREAD_READS_DIRECTORIES
To: Michal Rokos <michal.rokos@nextsoft.cz>
Cc: GIT <git@vger.kernel.org>
On 04/03/2008, Michal Rokos <michal.rokos@nextsoft.cz> wrote:
 > Add test for FREAD_READS_DIRECTORIES to configure script.
 >
 >  When "." could be opened and fread reads more than 0 items,
 >  FREAD_READS_DIRECTORIES will be set.
On AIX 5.3 this appears to work correctly, i.e. it defines
 FREAD_READS_DIRECTORIES
 I've negatively tested it just by swapping the return values.
 It is susceptible to failing for other reasons than those expected
 (i.e. the configure script gets the libsocket test wrong on my
 platform if I forget to amend CFLAGS because libg is not available,
 and then various tests including this one fail because libsocket is
 erroneously linked in and the test programs fail to compile at all),
 but that is I think a wider issue with autoconf tests in general.
 So, with those caveats:
 Tested-by: Mike Ralphson <mike@abacus.co.uk>
 Patch to set this option by default on AIX for the non-autoconf
 Makefile to follow.
Previous: Mike Ralphson
Message 6 of 6 in “autoconf: Test FREAD_READS_DIRECTORIES”
  1. autoconf: Test FREAD_READS_DIRECTORIESMichal Rokos, Mar 4, 2008
  2. Johannes SchindelinMar 4, 2008
  3. Michal RokosMar 4, 2008
  4. Johannes SchindelinMar 4, 2008
  5. Mike RalphsonMar 4, 2008
  6. Fwd: [PATCH v3] autoconf: Test FREAD_READS_DIRECTORIESMike Ralphson, Mar 4, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.