Ville Laurikari | 1 Dec 20:17 2002
Picon
Picon

Re: AC_CHECK_FUNCS always succeeds on AIX with Autoconf 2.56

> Hi,
> 
>    I've looked into this problem and created patch. In fact I've only 
> put back the original code while maintaining the current one, i.e. `f' 
> is assigned both in global initialization and also in main(). I've tried 
> this fix on Linux with gcc 2.96, Sun with gcc 2.95 and SunCC 7.0, HP-UX 
> with gcc 3.0.4 and AIX with gcc 3.1.1 and IBM C/C++ 3.6.6. I'm not able 
> to check it with unbundled cc A.05.36 for ia64 so someone probably 
> should check it (this configuration is why the old test was changed).

I think a clean fix would be to generate code that calls the
function that is being tested.  A function call can never be optimized
away at any stage unless it is known that the function has no
side-effects.  If the compiler knows this about a function then the
function must exist, and the test should succeed anyway.

Like this:

main ()
{
  char (*f) () = $ac_func;
  f();
  return 0;
}

--

-- 
http://www.iki.fi/vl/

Simon Josefsson | 2 Dec 19:22 2002

AC_CHECK_TYPE documentation fix

?

Btw, the manual uses the obsolete 2.13 AC_CHECK_TYPE() usage in
several places.  (That usage seems rather useful though, so maybe it
should be unobsoleted.)

2002-12-02  Simon Josefsson  <jas <at> extundo.com>

	* doc/autoconf.texi (Obsolete Macros): Fix.

--- autoconf.texi.~1.715.~	Thu Nov 14 09:42:39 2002
+++ autoconf.texi	Mon Dec  2 19:19:51 2002
 <at>  <at>  -12436,7 +12436,7  <at>  <at> 
 This macro is equivalent to:

  <at> example
-AC_CHECK_TYPE([ <at> var{type}],
+AC_CHECK_TYPE([ <at> var{type}],,
               [AC_DEFINE([ <at> var{type}], [ <at> var{default}],
                          [Define to ` <at> var{default}' if <sys/types.h>
                           does not define.])])

Paul Eggert | 3 Dec 07:54 2002

Re: Patch: Too many files in AC_OUTPUT cause M4 error

> From: Martin Frydl <martin <at> systinet.com>
> Date: Fri, 22 Nov 2002 19:03:52 +0100

> I've created a patch which is aware of M4 problem and separates the
> task into two expressions - first removes the terminating space,
> then strips the leading one and puts brackets around.

Thanks for the detailed bug report, and for the patch.
I installed the following patch instead; it's a bit more conservative.

2002-12-02  Paul Eggert  <eggert <at> twinsun.com>

	* bin/autom4te.in (handle_traces): [^ *\(.*\) *$] ->
	[^ *\(.*[^ ]\)? *].  The old regular expression was obviously wrong,
	and it blunders into a GNU m4 bug as noted by Martin Frydl in
	<http://mail.gnu.org/pipermail/autoconf/2002-November/014524.html>.

Index: autom4te.in
===================================================================
RCS file: /cvsroot/autoconf/autoconf/bin/autom4te.in,v
retrieving revision 1.77
retrieving revision 1.78
diff -p -u -r1.77 -r1.78
--- autom4te.in	31 Oct 2002 08:37:20 -0000	1.77
+++ autom4te.in	3 Dec 2002 06:51:15 -0000	1.78
 <at>  <at>  -943,7 +943,7  <at>  <at>  sub handle_traces ($$%)
   define([at_flatten],
   [at_patsubst(at_patsubst(at_patsubst([[[$1]]], [\\\n]),
                            [[\n\t ]+], [ ]),
-               [^ *\(.*\) *$], [[\1]])])
(Continue reading)

Paul Eggert | 3 Dec 08:07 2002

Re: AC_CHECK_FUNCS always succeeds on AIX with Autoconf 2.56

Quoted from <http://mail.gnu.org/pipermail/autoconf/2002-November/014508.html>:

> From: Martin Frydl <martin <at> systinet.com>
> Date: Tue, 19 Nov 2002 13:36:20 +0100
> 
>    I've looked into this problem and created patch. In fact I've only 
> put back the original code while maintaining the current one, i.e. `f' 
> is assigned both in global initialization and also in main().

That seems to be the right approach, but I think it would be better
for 'main' to also use both instances of the function to affect the
exit status, as that will make it less likely for them to be optimized
away.  Also, I'd like to fix the problem with <assert.h> noted by
Momchil Velikov in
<http://mail.gnu.org/pipermail/autoconf/2002-November/014490.html>
So I installed the following patch.

2002-12-02  Paul Eggert  <eggert <at> twinsun.com>

	* lib/autoconf/c.m4 (AC_LANG_FUNC_LINK_TRY(C)): Use the function f
	nontrivially in main's body, so that f's external declaration is
	not optimized away in AIX.  This should fix the bug reported by
	Martin Frydl in
	<http://mail.gnu.org/pipermail/autoconf/2002-November/014508.html>.

	* lib/autoconf/c.m4 (AC_LANG_FUNC_LINK_TRY(C),
	_AC_PROG_PREPROC_WORKS_IFELSE): Use <limits.h> if __STDC__ is
	defined, to support freestanding compilers.  This should fix the
	bug reported by Momchil Velkov in
	<http://mail.gnu.org/pipermail/autoconf/2002-November/014490.html>.
(Continue reading)

Paul Eggert | 3 Dec 08:39 2002

Re: AC_CHECK_TYPE documentation fix

Thanks for the note about the missing comma.  I noticed another
bug on the next line too, so I installed this patch.

2002-12-02  Paul Eggert  <eggert <at> twinsun.com>

	* doc/autoconf.texi (Obsolete Macros): Fix typos (insert empty
	arg, AC_DEFINE -> AC_DEFINE_UNQUOTED) in documentation for
	obsolete AC_CHECK_TYPE.  The missing empty arg was reported
	by Simon Josefsson in
	<http://mail.gnu.org/pipermail/autoconf-patches/2002-December/008830.html>.

Index: autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.715
retrieving revision 1.716
diff -p -u -r1.715 -r1.716
--- autoconf.texi	14 Nov 2002 08:42:39 -0000	1.715
+++ autoconf.texi	3 Dec 2002 07:35:31 -0000	1.716
 <at>  <at>  -12436,10 +12436,10  <at>  <at>  builtin type  <at> var{default}, e.g.,  <at> samp{
 This macro is equivalent to:

  <at> example
-AC_CHECK_TYPE([ <at> var{type}],
-              [AC_DEFINE([ <at> var{type}], [ <at> var{default}],
-                         [Define to ` <at> var{default}' if <sys/types.h>
-                          does not define.])])
+AC_CHECK_TYPE([ <at> var{type}],,
+              [AC_DEFINE_UNQUOTED([ <at> var{type}], [ <at> var{default}],
+                                  [Define to ` <at> var{default}' if
(Continue reading)

Paul Eggert | 3 Dec 09:31 2002

Re: Patch: Too many files in AC_OUTPUT cause M4 error

In testing my patch I managed to find a old version of GNU m4 that
illustrates the limitation that you mentioned; and my patch tickled
that limitation as well.  So it looks like your "less conservative
patch" is better after all.  So I installed your patch instead,
as follows.  Thanks.

2002-12-02  Martin Frydl  <martin <at> systinet.com>
	
	* bin/autom4te.in (at_flatten): rewritten to avoid M4 problem when
	\(.*\) match is too long and there is something more to be checked.
	<http://mail.gnu.org/pipermail/autoconf/2002-November/014524.html>

Index: autom4te.in
===================================================================
RCS file: /cvsroot/autoconf/autoconf/bin/autom4te.in,v
retrieving revision 1.77
retrieving revision 1.79
diff -p -u -r1.77 -r1.79
--- autom4te.in	31 Oct 2002 08:37:20 -0000	1.77
+++ autom4te.in	3 Dec 2002 08:30:12 -0000	1.79
 <at>  <at>  -941,9 +941,10  <at>  <at>  sub handle_traces ($$%)
   # Note that the second pattern is `newline, tab or space'.  Don't lose
   # the tab!
   define([at_flatten],
-  [at_patsubst(at_patsubst(at_patsubst([[[$1]]], [\\\n]),
-                           [[\n\t ]+], [ ]),
-               [^ *\(.*\) *$], [[\1]])])
+  [at_patsubst(at_patsubst(at_patsubst(at_patsubst([[[[$1]]]], [\\\n]),
+                                       [[\n\t ]+], [ ]),
+                           [ *\(.\)$], [\1]),
(Continue reading)

Paul Eggert | 3 Dec 09:59 2002

Re: AC_CHECK_FUNCS always succeeds on AIX with Autoconf 2.56

I have prepared a new test version of Autoconf, Autoconf 2.57, which
should fix the AIX bug.  Can you please give it a try on an AIX host?

Also, Kevin Ryde, could you please also try Autoconf 2.57 on a recent
HP cc +O3?

If it works on AIX, I'll make it an official version; if not, we'll
need to prepare an Autoconf 2.58.

  ftp://alpha.gnu.org/gnu/autoconf/autoconf-2.57.tar.gz     (1.1 MB)
  ftp://alpha.gnu.org/gnu/autoconf/autoconf-2.57.tar.bz2    (811 kB)

Here are the MD5 and SHA1 signatures:

407ea53787ce13f5ca427e9a51e05bc2  autoconf-2.57.tar.bz2
7c0b1e10d57facb8b58f95cef0dee0f1  autoconf-2.57.tar.gz
2faead0127edb15fff9ad8b7a84837e32fa25921  autoconf-2.57.tar.bz2
957cb551fed9b7ed5b34f1207512dfb676731754  autoconf-2.57.tar.gz

Paolo Bonzini | 3 Dec 10:48 2002
Picon

Re: (no) over-writing generated files

> [generating header files with AC_OUTPUT causes full recompile]

Replicating in _AC_OUTPUT_FILES the same behavior of
_AC_OUTPUT_HEADERS would break Makefile dependencies and,
given the run-time of autoconf and automake :->, surely make
your compilation time longer...

This conservative solution might be an option.  Patch vs. 2.56.

Note however that if you're using automake, you should provide
timestamping manually.  For this reason, I'm myself against installing
this patch into autoconf, and suggest you to use AC_CONFIG_HEADERS
for your version.h file as well.

2002-12-03  Paolo Bonzini  <bonzini <at> gnu.org>

	* lib/autoconf/status.m4 (_AC_OUTPUT_FILES): Don't
	blindly copy .h files if unchanged.

Paolo

diff -rNU3 autoconf-2.56-save/lib/autoconf/status.m4 autoconf-2.56/lib/autoconf/status.m4
--- autoconf-2.56-save/lib/autoconf/status.m4	Tue Dec  3 10:30:09 2002
+++ autoconf-2.56/lib/autoconf/status.m4	Tue Dec  3 10:42:04 2002
 <at>  <at>  -1018,15 +1018,17  <at>  <at> 
 dnl The parens around the eval prevent an "illegal io" in Ultrix sh.
 " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
   rm -f $tmp/stdin
-dnl This would break Makefile dependencies.
-dnl  if diff $ac_file $tmp/out >/dev/null 2>&1; then
(Continue reading)

Martin Frydl | 3 Dec 18:07 2002

Re: AC_CHECK_FUNCS always succeeds on AIX with Autoconf 2.56

I've tested it on these platforms without any problems:
   AIX 4.3.3 with gcc 3.1.1 and IBM C/C++ 3.6.6
   HP-UX 11.0 with gcc 3.1
   Solaris 8 with gcc 2.95.2 and Sun Forte C/C++ 7.0
   RedHat Linux 7.1 with gcc 2.96
Note that I've tested only my project, not run `make check' from 
autoconf. This is because I don't have GNU m4 on these platforms and I'm 
also short of time.

Regards
   Martin

Paul Eggert wrote:
> I have prepared a new test version of Autoconf, Autoconf 2.57, which
> should fix the AIX bug.  Can you please give it a try on an AIX host?
> 
> Also, Kevin Ryde, could you please also try Autoconf 2.57 on a recent
> HP cc +O3?
> 
> If it works on AIX, I'll make it an official version; if not, we'll
> need to prepare an Autoconf 2.58.
> 
>   ftp://alpha.gnu.org/gnu/autoconf/autoconf-2.57.tar.gz     (1.1 MB)
>   ftp://alpha.gnu.org/gnu/autoconf/autoconf-2.57.tar.bz2    (811 kB)
> 
> Here are the MD5 and SHA1 signatures:
> 
> 407ea53787ce13f5ca427e9a51e05bc2  autoconf-2.57.tar.bz2
> 7c0b1e10d57facb8b58f95cef0dee0f1  autoconf-2.57.tar.gz
> 2faead0127edb15fff9ad8b7a84837e32fa25921  autoconf-2.57.tar.bz2
(Continue reading)

Kevin Ryde | 3 Dec 23:38 2002
Picon
Picon

Re: AC_CHECK_FUNCS always succeeds on AIX with Autoconf 2.56

Paul Eggert <eggert <at> twinsun.com> writes:
>
> Also, Kevin Ryde, could you please also try Autoconf 2.57 on a recent
> HP cc +O3?

Latest cvs looks fine on that compiler.  Just the initializer for the
global variable seems to do the trick, for what it's worth.

(This is the spe168 i2000 at testdrive.compaq.com if anyone else wants
to play with it themselves.)


Gmane