autoconf-patches
[Top][All Lists]
Advanced

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

Re: AC_TRY_RUN doesn't set $? as documented


From: Akim Demaille
Subject: Re: AC_TRY_RUN doesn't set $? as documented
Date: 27 Sep 2001 15:34:54 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

| The following bug was reported against the Debian package for
| autoconf 2.13.  I was able to reproduce it with autoconf 2.52,
| using this configure.in fragment:
|       AC_TRY_RUN([int main(void){return 5;}], [echo success],
|                  [echo fail: "$?"], [echo cross-compile])
| which reports `fail: "0"' in my test run, whereas I expected to
| see `fail: "5"' if everything were correct.
| 
| Thanks,
| 
| Ben.
| 
| ----------------------------------------------------------------------
| Subject: Bug#113484: AC_TRY_RUN doesn't set $? as documented
| From: Richard Kettlewell <address@hidden>
| 
| Package: autoconf
| Version: 2.13
| 
| The manual says:
| 
|    - Macro: AC_TRY_RUN (PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE [,
|           ACTION-IF-CROSS-COMPILING]]])
|        PROGRAM is the text of a C program, on which shell variable and
|        backquote substitutions are performed.  If it compiles and links
|        successfully and returns an exit status of 0 when executed, run
|        shell commands ACTION-IF-TRUE.  Otherwise run shell commands
|        ACTION-IF-FALSE; the exit status of the program is available in
|                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|        the shell variable `$?'.  This macro uses `CFLAGS' or `CXXFLAGS',
|        ^^^^^^^^^^^^^^^^^^^^^^^
|        `CPPFLAGS', `LDFLAGS', and `LIBS' when compiling.
| 
| However this is not actually true, as trying to take advantage of this
| feature, or just looking at acgeneral.m4, reveals.
| 
| Sorry if this bug has already been reported, my net connection is
| currently down.
| 
| ttfn/rjk
| ----------------------------------------------------------------------

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        Fix the passing of $? to ACTION-IF-FAILED in AC_TRY_RUN, that
        generates too many bug reports.

        * lib/autoconf/general.m4 (_AC_RUN_IFELSE): Pass the right exit
        status when executing the ACTION-IF-FALSE.
        * tests/base.at (AC_TRY_*): Rename as...
        (AC_TRY_COMMAND): this.
        (AC_RUN_IFELSE): New.
        * tests/compile.at (Extensions, C keywords)
        (AC_PROG_CPP requires AC_PROG_CC, GNU Fortran 77)
        (Broken/missing compilers, AC_PROG_CPP with warnings)
        (AC_PROG_CPP without warnings, AC_PROG_CPP via CC): Move to...
        * tests/c.at (Extensions, C keywords)
        (Broken/missing compilers, AC_PROG_CPP with warnings)
        (AC_PROG_CPP without warnings, AC_PROG_CPP via CC)
        (AC_PROG_CPP requires AC_PROG_CC): here and...
        * tests/fortran.at (GNU Fortran 77): there.
        * doc/autoconf.texi (autoconf Invocation): Fix the example:
        AC_TRY_RUN is about compilation, not shell commands.
        (Test Programs): AC_TRY_RUN works as used to be advertised.

Index: NEWS
===================================================================
RCS file: /cvs/autoconf/NEWS,v
retrieving revision 1.196
diff -u -u -r1.196 NEWS
--- NEWS 2001/09/23 17:17:46 1.196
+++ NEWS 2001/09/27 13:24:32
@@ -36,6 +36,8 @@
 
 ** Bug fixes
 - The top level $prefix is propagated to the AC_CONFIG_SUBDIRS configures.
+- AC_TRY_RUN
+  Under the user pressure, $? is finally available.  Probably a mistake.
 
 ** C Macros
 - AC_C_BIGENDIAN supports the cross-compiling case.
Index: doc/autoconf.texi
===================================================================
RCS file: /cvs/autoconf/doc/autoconf.texi,v
retrieving revision 1.539
diff -u -u -r1.539 autoconf.texi
--- doc/autoconf.texi 2001/09/23 17:18:07 1.539
+++ doc/autoconf.texi 2001/09/27 13:24:33
@@ -1214,7 +1214,7 @@
 
 @example
 AC_DEFUN([INNER],
-[AC_TRY_RUN([true])])
+[AC_TRY_RUN([exit (0)])])
 
 AC_DEFUN([OUTER],
 [INNER])
@@ -5489,9 +5489,7 @@
 @acindex TRY_RUN
 If @var{program} compiles and links successfully and returns an exit
 status of 0 when executed, run shell commands @var{action-if-true}.
-Otherwise, run shell commands @var{action-if-false}; the exit status of
-the program should be available in the shell variable @samp{$?}, but has
-never been: don't depend on this.
+Otherwise, run shell commands @var{action-if-false}.
 
 This macro double quotes @var{program}, the text of a program in the
 current language (@pxref{Language Choice}), on which shell variable and
@@ -5504,6 +5502,15 @@
 not run.  If the optional shell commands @var{action-if-cross-compiling}
 are given, they are run instead.  Otherwise, @code{configure} prints
 an error message and exits.
+
+In the @var{action-if-false} section, the exit status of the program is
+available in the shell variable @samp{$?}, but be very careful to limit
+yourself to positive values smaller than 127; bigger values shall be
+saved into a file by the @var{program}.  Note also that you have simply
+no guarantee that this exit status is issued by the @var{program}, or by
+the failure of its compilation.  In other words, use this feature if
+sadist only, it was reestablished because the Autoconf maintainers grew
+tired of receiving ``bug reports''.
 @end defmac
 
 Try to provide a pessimistic default value to use when cross-compiling
Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvs/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.769
diff -u -u -r1.769 general.m4
--- lib/autoconf/general.m4 2001/09/23 17:17:46 1.769
+++ lib/autoconf/general.m4 2001/09/27 13:24:33
@@ -2337,7 +2337,9 @@
       [echo "$as_me: program exited with status $ac_status" >&AS_MESSAGE_LOG_FD
 echo "$as_me: failed program was:" >&AS_MESSAGE_LOG_FD
 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD
-m4_ifvaln([$3], [$3])dnl])[]dnl
+m4_ifvaln([$3],
+          [( exit $ac_status )
+$3])dnl])[]dnl
 rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext m4_ifval([$1],
                                                      [conftest.$ac_ext])[]dnl
 ])# _AC_RUN_IFELSE
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/autoconf/tests/Makefile.am,v
retrieving revision 1.71
diff -u -u -r1.71 Makefile.am
--- tests/Makefile.am 2001/09/23 17:17:47 1.71
+++ tests/Makefile.am 2001/09/27 13:24:33
@@ -39,7 +39,7 @@
        suite.at \
         m4sugar.at m4sh.at \
         base.at tools.at torture.at \
-       compile.at \
+       compile.at c.at fortran.at \
        semantics.at \
        foreign.at
 
Index: tests/Makefile.in
===================================================================
RCS file: /cvs/autoconf/tests/Makefile.in,v
retrieving revision 1.97
diff -u -u -r1.97 Makefile.in
--- tests/Makefile.in 2001/09/23 17:17:47 1.97
+++ tests/Makefile.in 2001/09/27 13:24:33
@@ -87,7 +87,7 @@
        suite.at \
         m4sugar.at m4sh.at \
         base.at tools.at torture.at \
-       compile.at \
+       compile.at c.at fortran.at \
        semantics.at \
        foreign.at
 
@@ -129,7 +129,7 @@
        autoupdate ifnames
 DIST_SOURCES =
 DIST_COMMON = README Makefile.am Makefile.in autom4te.in autoreconf.in \
-       autoupdate.in wrappl.in wrapsh.in
+       autoupdate.in configure configure.ac wrappl.in wrapsh.in
 all: all-am
 
 .SUFFIXES:
Index: tests/base.at
===================================================================
RCS file: /cvs/autoconf/tests/base.at,v
retrieving revision 1.28
diff -u -u -r1.28 base.at
--- tests/base.at 2001/09/18 12:26:36 1.28
+++ tests/base.at 2001/09/27 13:24:33
@@ -181,42 +181,6 @@
 AT_CLEANUP
 
 
-## ---------------------- ##
-## AC_REQUIRE & AC_LANG.  ##
-## ---------------------- ##
-
-AT_SETUP([AC_REQUIRE & AC_LANG])
-
-AT_DATA([configure.ac],
-[[AC_DEFUN([AC_F77_1],
-[AC_LANG_PUSH([Fortran 77])
-if test $ac_ext != f; then
-  AC_MSG_ERROR([F77_1: current shell language is $ac_ext, expected Fortran])
-fi
-AC_LANG_POP
-])
-
-
-AC_DEFUN([AC_F77_2],
-[AC_LANG_PUSH([Fortran 77])
-AC_REQUIRE([AC_F77_1])
-if test $ac_ext != f; then
-  AC_MSG_ERROR([F77_2: current shell language is $ac_ext, expected Fortran])
-fi
-AC_LANG_POP
-])
-
-AC_INIT
-AC_F77_2
-AS_EXIT(0)
-]])
-
-AT_CHECK_AUTOCONF
-AT_CHECK_CONFIGURE
-
-AT_CLEANUP
-
-
 ## ---------------- ##
 ## AC_CACHE_CHECK.  ##
 ## ---------------- ##
@@ -238,11 +202,11 @@
 AT_CLEANUP
 
 
-## ---------- ##
-## AC_TRY_*.  ##
-## ---------- ##
+## ---------------- ##
+## AC_TRY_COMMAND.  ##
+## ---------------- ##
 
-AT_SETUP([AC_TRY_*])
+AT_SETUP([AC_TRY_COMMAND])
 
 AT_DATA([configure.ac],
 [[AC_INIT
Index: tests/c.at
===================================================================
RCS file: c.at
diff -N c.at
--- /dev/null   Sat Apr 14 20:46:23 2001
+++ tests/c.at Thu Sep 27 09:24:33 2001
@@ -0,0 +1,211 @@
+#                                                      -*- Autotest -*-
+
+AT_BANNER([C low level compiling/preprocessing macros.])
+
+# Copyright 2000, 2001 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+
+# Since the macros which compile are required by most tests, check
+# them first.  But remember that looking for a compiler is even more
+# primitive, so check those first.
+
+
+## ------------ ##
+## Extensions.  ##
+## ------------ ##
+
+# As far as we know only `foo', `foo.exe' are possible executable,
+# and `foo.o', `foo.obj' are possible object files.  Autoconf must not
+# know that, but it is OK for the test suite to take this into account.
+AT_CHECK_MACRO([Extensions],
+[[AC_PROG_CC
+case $ac_exeext in
+  '' | '.exe' ) ;;
+  * ) AC_MSG_ERROR([suspicious executable suffix: $ac_exeext]);;
+esac
+
+case $ac_objext in
+  'o' | 'obj' ) ;;
+  * ) AC_MSG_ERROR([suspicious object suffix: $ac_objext]);;
+esac
+AS_EXIT([0])
+]])
+
+
+
+## -------------------------- ##
+## Broken/missing compilers.  ##
+## -------------------------- ##
+
+
+# Check that Autoconf correctly diagnoses broken compilers, and in
+# particular, if it does not exit 77, the test suite is in trouble...
+# FIXME: Once a precise message decided, check stderr of configure.
+AT_SETUP([Broken/missing compilers])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+CC=no-such-compiler
+AC_PROG_CC
+]])
+
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE([], 77, ignore, ignore)
+
+AT_CLEANUP
+
+
+## ------------ ##
+## C keywords.  ##
+## ------------ ##
+
+# GCC supports `const', `volatile', and `inline'.
+AT_CHECK_MACRO([C keywords],
+[[AC_PROG_CC
+AC_C_CONST
+AC_C_INLINE
+AC_C_VOLATILE
+case $GCC,$ac_cv_c_const,$ac_cv_c_inline,$ac_cv_c_volatile in
+ yes,*no*)
+   AC_MSG_ERROR([failed to detect `const', `inline' or `volatile' support]);;
+esac
+]])
+
+
+
+## --------------------------------- ##
+## AC_PROG_CPP requires AC_PROG_CC.  ##
+## --------------------------------- ##
+
+# Must invoke AC_PROG_CC.
+AT_CHECK_MACRO([AC_PROG_CPP requires AC_PROG_CC],
+[[AC_PROG_CPP
+test -z "$CC" &&
+   AC_MSG_ERROR([looked for a C preprocessor without looking for a compiler])
+]])
+
+
+
+## --------------------------- ##
+## AC_PROG_CPP with warnings.  ##
+## --------------------------- ##
+
+
+# It's Ok for strict preprocessors to produce warnings.
+
+AT_SETUP([AC_PROG_CPP with warnings])
+
+AT_DATA([mycpp],
+[[#! /bin/sh
+echo noise >&2
+exec ${1+"$@"}
+]])
+
+chmod +x mycpp
+
+_AT_CHECK_AC_MACRO(
+[[AC_PROG_CPP
+# If the preprocessor is not strict, just ignore
+test "x$ac_c_preproc_warn_flag" = xyes &&
+  AC_MSG_ERROR([preprocessor has no warning option], 77)
+CPP="./mycpp $CPP"
+AC_CHECK_HEADERS(stdio.h autoconf_io.h)]])
+
+AT_CHECK_DEFINES(
+[/* #undef HAVE_AUTOCONF_IO_H */
+#define HAVE_STDIO_H 1
+])
+
+AT_CLEANUP
+
+
+## ------------------------------ ##
+## AC_PROG_CPP without warnings.  ##
+## ------------------------------ ##
+
+AT_SETUP([AC_PROG_CPP without warnings])
+
+# Ignore if /lib/cpp doesn't work
+AT_CHECK([/lib/cpp </dev/null || exit 77], [], [ignore], [ignore])
+
+# A cpp which exit status is meaningless.
+AT_DATA([mycpp],
+[[#! /bin/sh
+/lib/cpp ${1+"$@"}
+exit 0
+]])
+
+chmod +x mycpp
+
+_AT_CHECK_AC_MACRO(
+[[CPP=./mycpp
+AC_PROG_CPP
+test "x$ac_c_preproc_warn_flag" != xyes &&
+  AC_MSG_ERROR([failed to detect preprocessor warning option])
+AC_CHECK_HEADERS(stdio.h autoconf_io.h)]])
+
+AT_CHECK_DEFINES(
+[/* #undef HAVE_AUTOCONF_IO_H */
+#define HAVE_STDIO_H 1
+])
+
+AT_CLEANUP
+
+
+
+## -------------------- ##
+## AC_PROG_CPP via CC.  ##
+## -------------------- ##
+
+
+# It's Ok for strict preprocessors to produce warnings.
+
+AT_SETUP([AC_PROG_CPP via CC])
+
+# Ignore if /lib/cpp doesn't work
+AT_CHECK([/lib/cpp </dev/null || exit 77], [], [ignore], [ignore])
+
+AT_DATA([mycc],
+[[#! /bin/sh
+echo "Annoying copyright message" >&2
+exec "$@"
+]])
+
+chmod +x mycc
+
+# We go through the following contortions, in order to have the
+# configure script go down the same codepaths as it would during a
+# normal CPP selection check.  If we explicitly set CPP, it goes down
+# a different codepath.
+_AT_CHECK_AC_MACRO(
+[[AC_PROG_CC
+CC="./mycc $CC"
+AC_PROG_CPP
+# The test $CC compiler should have been selected.
+test "$CPP" != "$CC -E" &&
+  AC_MSG_ERROR([error messages on stderr cause the preprocessor selection to 
fail])
+
+# Exercise CPP.
+AC_CHECK_HEADERS(stdio.h autoconf_io.h)]])
+
+AT_CHECK_DEFINES(
+[/* #undef HAVE_AUTOCONF_IO_H */
+#define HAVE_STDIO_H 1
+])
+
+AT_CLEANUP
Index: tests/compile.at
===================================================================
RCS file: /cvs/autoconf/tests/compile.at,v
retrieving revision 1.24
diff -u -u -r1.24 compile.at
--- tests/compile.at 2001/08/20 14:44:38 1.24
+++ tests/compile.at 2001/09/27 13:24:33
@@ -71,192 +71,75 @@
 AT_CLEANUP
 
 
-## ------------ ##
-## Extensions.  ##
-## ------------ ##
-
-# As far as we know only `foo', `foo.exe' are possible executable,
-# and `foo.o', `foo.obj' are possible object files.  Autoconf must not
-# know that, but it is OK for the test suite to take this into account.
-AT_CHECK_MACRO([Extensions],
-[[AC_PROG_CC
-case $ac_exeext in
-  '' | '.exe' ) ;;
-  * ) AC_MSG_ERROR([suspicious executable suffix: $ac_exeext]);;
-esac
-
-case $ac_objext in
-  'o' | 'obj' ) ;;
-  * ) AC_MSG_ERROR([suspicious object suffix: $ac_objext]);;
-esac
-AS_EXIT([0])
-]])
-
-
+## ---------------------- ##
+## AC_REQUIRE & AC_LANG.  ##
+## ---------------------- ##
 
-## -------------------------- ##
-## Broken/missing compilers.  ##
-## -------------------------- ##
+AT_SETUP([AC_REQUIRE & AC_LANG])
 
-
-# Check that Autoconf correctly diagnoses broken compilers, and in
-# particular, if it does not exit 77, the test suite is in trouble...
-# FIXME: Once a precise message decided, check stderr of configure.
-AT_SETUP([Broken/missing compilers])
-
 AT_DATA([configure.ac],
-[[AC_INIT
-CC=no-such-compiler
-AC_PROG_CC
-]])
-
-AT_CHECK_AUTOCONF
-AT_CHECK_CONFIGURE([], 77, ignore, ignore)
-
-AT_CLEANUP
-
-
-## ------------ ##
-## C keywords.  ##
-## ------------ ##
-
-# GCC supports `const', `volatile', and `inline'.
-AT_CHECK_MACRO([C keywords],
-[[AC_PROG_CC
-AC_C_CONST
-AC_C_INLINE
-AC_C_VOLATILE
-case $GCC,$ac_cv_c_const,$ac_cv_c_inline,$ac_cv_c_volatile in
- yes,*no*)
-   AC_MSG_ERROR([failed to detect `const', `inline' or `volatile' support]);;
-esac
-]])
-
-
-
-## --------------------------------- ##
-## AC_PROG_CPP requires AC_PROG_CC.  ##
-## --------------------------------- ##
-
-# Must invoke AC_PROG_CC.
-AT_CHECK_MACRO([AC_PROG_CPP requires AC_PROG_CC],
-[[AC_PROG_CPP
-test -z "$CC" &&
-   AC_MSG_ERROR([looked for a C preprocessor without looking for a compiler])
-]])
-
-
-
-## --------------------------- ##
-## AC_PROG_CPP with warnings.  ##
-## --------------------------- ##
-
-
-# It's Ok for strict preprocessors to produce warnings.
-
-AT_SETUP([AC_PROG_CPP with warnings])
-
-AT_DATA([mycpp],
-[[#! /bin/sh
-echo noise >&2
-exec ${1+"$@"}
-]])
-
-chmod +x mycpp
-
-_AT_CHECK_AC_MACRO(
-[[AC_PROG_CPP
-# If the preprocessor is not strict, just ignore
-test "x$ac_c_preproc_warn_flag" = xyes &&
-  AC_MSG_ERROR([preprocessor has no warning option], 77)
-CPP="./mycpp $CPP"
-AC_CHECK_HEADERS(stdio.h autoconf_io.h)]])
-
-AT_CHECK_DEFINES(
-[/* #undef HAVE_AUTOCONF_IO_H */
-#define HAVE_STDIO_H 1
+[[AC_DEFUN([AC_F77_1],
+[AC_LANG_PUSH([Fortran 77])
+if test $ac_ext != f; then
+  AC_MSG_ERROR([F77_1: current shell language is $ac_ext, expected Fortran])
+fi
+AC_LANG_POP
 ])
 
-AT_CLEANUP
 
+AC_DEFUN([AC_F77_2],
+[AC_LANG_PUSH([Fortran 77])
+AC_REQUIRE([AC_F77_1])
+if test $ac_ext != f; then
+  AC_MSG_ERROR([F77_2: current shell language is $ac_ext, expected Fortran])
+fi
+AC_LANG_POP
+])
 
-## ------------------------------ ##
-## AC_PROG_CPP without warnings.  ##
-## ------------------------------ ##
-
-AT_SETUP([AC_PROG_CPP without warnings])
-
-# Ignore if /lib/cpp doesn't work
-AT_CHECK([/lib/cpp </dev/null || exit 77], [], [ignore], [ignore])
-
-# A cpp which exit status is meaningless.
-AT_DATA([mycpp],
-[[#! /bin/sh
-/lib/cpp ${1+"$@"}
-exit 0
+AC_INIT
+AC_F77_2
+AS_EXIT(0)
 ]])
-
-chmod +x mycpp
 
-_AT_CHECK_AC_MACRO(
-[[CPP=./mycpp
-AC_PROG_CPP
-test "x$ac_c_preproc_warn_flag" != xyes &&
-  AC_MSG_ERROR([failed to detect preprocessor warning option])
-AC_CHECK_HEADERS(stdio.h autoconf_io.h)]])
-
-AT_CHECK_DEFINES(
-[/* #undef HAVE_AUTOCONF_IO_H */
-#define HAVE_STDIO_H 1
-])
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE
 
 AT_CLEANUP
 
 
+## --------------- ##
+## AC_RUN_IFELSE.  ##
+## --------------- ##
 
-## -------------------- ##
-## AC_PROG_CPP via CC.  ##
-## -------------------- ##
+AT_SETUP([AC_RUN_IFELSE])
 
-
-# It's Ok for strict preprocessors to produce warnings.
-
-AT_SETUP([AC_PROG_CPP via CC])
+AT_DATA([configure.ac],
+[[AC_INIT
 
-# Ignore if /lib/cpp doesn't work
-AT_CHECK([/lib/cpp </dev/null || exit 77], [], [ignore], [ignore])
+AC_RUN_IFELSE([AC_LANG_PROGRAM([], [exit (0)])],
+              [],
+              [AC_MSG_ERROR([saw `exit 0' as a failure])])
+
+AC_RUN_IFELSE([AC_LANG_PROGRAM([], [exit (2)])],
+              [AC_MSG_ERROR([saw `exit 2' as a success])],
+              [status=$?
+test $status != 2 &&
+  AC_MSG_ERROR([did not get as 2 exit status: $status])])
+
+# The old stinky one.
+AC_TRY_RUN([int main () { exit (3); }],
+           [AC_MSG_ERROR([saw `exit 3' as a success])],
+           [status=$?
+test $status != 3 &&
+  AC_MSG_ERROR([did not get 3 as exit status: $status])])
 
-AT_DATA([mycc],
-[[#! /bin/sh
-echo "Annoying copyright message" >&2
-exec "$@"
 ]])
-
-chmod +x mycc
 
-# We go through the following contortions, in order to have the
-# configure script go down the same codepaths as it would during a
-# normal CPP selection check.  If we explicitly set CPP, it goes down
-# a different codepath.
-_AT_CHECK_AC_MACRO(
-[[AC_PROG_CC
-CC="./mycc $CC"
-AC_PROG_CPP
-# The test $CC compiler should have been selected.
-test "$CPP" != "$CC -E" &&
-  AC_MSG_ERROR([error messages on stderr cause the preprocessor selection to 
fail])
-
-# Exercise CPP.
-AC_CHECK_HEADERS(stdio.h autoconf_io.h)]])
-
-AT_CHECK_DEFINES(
-[/* #undef HAVE_AUTOCONF_IO_H */
-#define HAVE_STDIO_H 1
-])
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE([-q])
 
 AT_CLEANUP
 
-
 ## ------------------ ##
 ## AC_TRY_LINK_FUNC.  ##
 ## ------------------ ##
@@ -266,30 +149,3 @@
                   [AC_MSG_ERROR([cannot find `printf'])])
 AC_TRY_LINK_FUNC(Be_doomed_if_your_libc_has_a_function_named_like_this,
                  [AC_MSG_ERROR([found a nonexistent function])])])
-
-
-
-## --------------------- ##
-## Fortran 77 Compiler.  ##
-## --------------------- ##
-
-
-AT_CHECK_MACRO([GNU Fortran 77],
-[[AC_LANG(Fortran 77)
-AC_LANG_COMPILER
-
-if AC_TRY_COMMAND([$F77 --version | grep GNU >&2]); then
-  # Be sure to remove files which might be created by compilers that
-  # don't support --version.
-  rm -f a.exe a.out
-  # Has GNU in --version.
-  test "$G77" != yes &&
-    AC_MSG_ERROR([failed to recognize GNU Fortran 77 compiler])
-else
-  # Be sure to remove files which might be created by compilers that
-  # don't support --version.
-  rm -f a.exe a.out
-  # Has not.
-  test "$G77" = yes &&
-    AC_MSG_ERROR([incorrectly recognized a GNU Fortran 77 compiler])
-fi]])
Index: tests/fortran.at
===================================================================
RCS file: fortran.at
diff -N fortran.at
--- /dev/null   Sat Apr 14 20:46:23 2001
+++ tests/fortran.at Thu Sep 27 09:24:33 2001
@@ -0,0 +1,51 @@
+#                                                      -*- Autotest -*-
+
+AT_BANNER([Fortran low level compiling/preprocessing macros.])
+
+# Copyright 2000, 2001 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+
+# Since the macros which compile are required by most tests, check
+# them first.  But remember that looking for a compiler is even more
+# primitive, so check those first.
+
+
+## --------------------- ##
+## Fortran 77 Compiler.  ##
+## --------------------- ##
+
+
+AT_CHECK_MACRO([GNU Fortran 77],
+[[AC_LANG(Fortran 77)
+AC_LANG_COMPILER
+
+if AC_TRY_COMMAND([$F77 --version | grep GNU >&2]); then
+  # Be sure to remove files which might be created by compilers that
+  # don't support --version.
+  rm -f a.exe a.out
+  # Has GNU in --version.
+  test "$G77" != yes &&
+    AC_MSG_ERROR([failed to recognize GNU Fortran 77 compiler])
+else
+  # Be sure to remove files which might be created by compilers that
+  # don't support --version.
+  rm -f a.exe a.out
+  # Has not.
+  test "$G77" = yes &&
+    AC_MSG_ERROR([incorrectly recognized a GNU Fortran 77 compiler])
+fi]])
Index: tests/suite.at
===================================================================
RCS file: /cvs/autoconf/tests/suite.at,v
retrieving revision 1.24
diff -u -u -r1.24 suite.at
--- tests/suite.at 2001/09/18 09:03:19 1.24
+++ tests/suite.at 2001/09/27 13:24:33
@@ -60,7 +60,9 @@
 
 # Language support.
 m4_include([aclang.at])
+m4_include([c.at])
 m4_include([acc.at])
+m4_include([fortran.at])
 m4_include([acfortran.at])
 
 # Checking that AC_CHECK_FOO macros work properly.




reply via email to

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