autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

systems requiring exit?


From: Ilya N. Golubev
Subject: systems requiring exit?
Date: Tue, 07 Nov 2006 22:39:10 +0300

After release 2.59c `AC_PROG_CC' change <(autoconf) Guidelines>
changed its recommendation how to specify exit status for test
program from

> Test programs should `exit', not `return', from `main', because on
> some systems (old Suns, at least) the argument to `return' in `main'
> is ignored.

to

> Unless you arrange for `exit' to be declared, test
> programs should `return', not `exit', from `main', because on many
> systems `exit' is not declared by default.

Worse, among tests bundled with autoconf finding no one to determine
whether the argument to `return' in `main' is ignored, and, if yes,
how to call `exit' properly.  This effectively removes support for
systems with that ignoring, requring `return' in `main' to work
properly, and undermining the very purpose of autoconf as set forth in
<(autoconf) Shell Script Compiler>:

> `configure' must run on all those systems, and thus `configure' must
> limit itself to their lowest common denominator of features.

(That particular sentence is about shell code, but certainly bare
working shell code is worthless unless checks it does are useful.)

That systems ignoring `return' value are now rare is not a reason to
do so.  After all, systems which default shell has no functions are
even more rare.  Most likely in all systems where `return' works
properly shell also has functions.  (Please tell me if you know
otherwise.)  So restricting use of autoconf to systems with proper
`return' obviates vast majority of the uses of m4 in autoconf, and
very much of autoconf complexity.  Thus excluding such a "rare"
systems means completely different autoconf design.

A reasonable solution would be standard tests as described above:
whether the argument to `return' in `main' is ignored, and, if yes,
how to call `exit' properly.  Using it may even add some complexity to
user package, like distributing additional header file and `#include'
it (or even additonal m4 macro call) in test program code.  (So that
said header files checks for values accumulated in `confdefs.h',
declares `exit' as necessary defines macro that sets exit status as
appropriatte on this particular system.)

Have no systems with broken `return' at hand, not even any detailed
description of how that broken `return' would behave to test for, so
can not tell more about how these standard exit status setting tests
will work, let alone suggest code for them.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]