* tests/base.at, tests/compile.at, tests/foreign.at,
* tests/m4sh.at, tests/m4sugar.at, tests/mktests.sh,
* tests/semantics.at, tests/suite.at, tests/tools.at,
* tests/torture.at: Ask Autotest mode, not Autoconf mode.
2001-08-20 22:44:38 +08:00
|
|
|
# -*- Autotest -*-
|
2000-11-16 22:56:17 +08:00
|
|
|
|
2000-11-29 18:12:05 +08:00
|
|
|
AT_BANNER([Low level compiling/preprocessing macros.])
|
2000-11-16 22:56:17 +08:00
|
|
|
|
* AUTHORS, BUGS, ChangeLog, ChangeLog.0, ChangeLog.1,
ChangeLog.2, GNUmakefile, Makefile.maint, NEWS, README,
README-alpha, TODO, configure.ac, lib/autoconf/Makefile.am,
m4/atconfig.m4, m4/init.m4, m4/m4.m4, m4/missing.m4,
m4/sanity.m4, tests/README, tests/aclocal.m4,
tests/atspecific.m4, tests/base.at, tests/compile.at,
tests/foreign.at, tests/m4sh.at, tests/m4sugar.at,
tests/semantics.at, tests/suite.at, tests/tools.at,
tests/torture.at: Add copyright notice.
* tests/mktests.sh: Update year in copyright notice.
2001-08-12 21:05:11 +08:00
|
|
|
# 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.
|
|
|
|
|
|
|
|
|
2000-11-16 22:56:17 +08:00
|
|
|
# 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.
|
|
|
|
|
|
|
|
|
2001-01-19 22:03:14 +08:00
|
|
|
## ------------------------------------- ##
|
|
|
|
## AC_LANG, AC_LANG_PUSH & AC_LANG_POP. ##
|
|
|
|
## ------------------------------------- ##
|
|
|
|
|
|
|
|
AT_SETUP([AC_LANG, AC_LANG_PUSH & AC_LANG_POP])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT
|
|
|
|
# C
|
|
|
|
AC_LANG(C)
|
|
|
|
# C
|
|
|
|
AC_LANG_PUSH(C)
|
|
|
|
# C C
|
|
|
|
AC_LANG_PUSH(C++)
|
|
|
|
# C++ C C
|
|
|
|
AC_LANG(C++)
|
|
|
|
# C++ C C
|
|
|
|
AC_LANG_PUSH(Fortran 77)
|
|
|
|
# F77 C++ C C
|
|
|
|
AC_LANG_POP(Fortran 77)
|
|
|
|
# C++ C C
|
|
|
|
AC_LANG(C++)
|
|
|
|
# C++ C C
|
|
|
|
AC_LANG_POP(C++)
|
|
|
|
# C C
|
|
|
|
AC_LANG_POP(C)
|
|
|
|
# C
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK([sed -n 's/^ac_ext=//p' configure], 0,
|
|
|
|
[c
|
2001-01-24 00:50:19 +08:00
|
|
|
c
|
|
|
|
c
|
|
|
|
cc
|
2001-01-19 22:03:14 +08:00
|
|
|
cc
|
|
|
|
f
|
|
|
|
cc
|
2001-01-24 00:50:19 +08:00
|
|
|
cc
|
|
|
|
c
|
2001-01-19 22:03:14 +08:00
|
|
|
c
|
|
|
|
])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
|
|
|
## ------------ ##
|
2001-01-12 17:39:26 +08:00
|
|
|
## 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
|
2001-02-19 23:08:58 +08:00
|
|
|
AS_EXIT([0])
|
2001-01-12 17:39:26 +08:00
|
|
|
]])
|
|
|
|
|
|
|
|
|
2001-01-31 02:45:58 +08:00
|
|
|
|
|
|
|
## -------------------------- ##
|
|
|
|
## 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
|
2001-02-19 23:08:58 +08:00
|
|
|
AT_CHECK_CONFIGURE([], 77, ignore, ignore)
|
2001-01-31 02:45:58 +08:00
|
|
|
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
2000-12-15 19:50:18 +08:00
|
|
|
## ------------ ##
|
|
|
|
## 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
|
2001-01-12 17:39:26 +08:00
|
|
|
case $GCC,$ac_cv_c_const,$ac_cv_c_inline,$ac_cv_c_volatile in
|
2000-12-15 19:50:18 +08:00
|
|
|
yes,*no*)
|
|
|
|
AC_MSG_ERROR([failed to detect `const', `inline' or `volatile' support]);;
|
2001-01-12 17:39:26 +08:00
|
|
|
esac
|
|
|
|
]])
|
2000-12-15 19:50:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## --------------------------------- ##
|
|
|
|
## 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])
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-11-16 22:56:17 +08:00
|
|
|
## --------------------------- ##
|
|
|
|
## 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(
|
2001-02-16 07:36:48 +08:00
|
|
|
[[AC_PROG_CPP
|
2000-11-16 22:56:17 +08:00
|
|
|
# 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"
|
2001-02-16 07:36:48 +08:00
|
|
|
AC_CHECK_HEADERS(stdio.h autoconf_io.h)]])
|
2000-11-16 22:56:17 +08:00
|
|
|
|
|
|
|
AT_CHECK_DEFINES(
|
|
|
|
[/* #undef HAVE_AUTOCONF_IO_H */
|
|
|
|
#define HAVE_STDIO_H 1
|
|
|
|
])
|
|
|
|
|
2000-12-19 16:15:48 +08:00
|
|
|
AT_CLEANUP
|
2000-11-16 22:56:17 +08:00
|
|
|
|
|
|
|
|
|
|
|
## ------------------------------ ##
|
|
|
|
## AC_PROG_CPP without warnings. ##
|
|
|
|
## ------------------------------ ##
|
|
|
|
|
|
|
|
AT_SETUP([AC_PROG_CPP without warnings])
|
|
|
|
|
2001-05-10 23:41:16 +08:00
|
|
|
# Ignore if /lib/cpp doesn't work
|
|
|
|
AT_CHECK([/lib/cpp </dev/null || exit 77], [], [ignore], [ignore])
|
|
|
|
|
2001-05-11 23:54:43 +08:00
|
|
|
# A cpp which exit status is meaningless.
|
2000-11-16 22:56:17 +08:00
|
|
|
AT_DATA([mycpp],
|
|
|
|
[[#! /bin/sh
|
|
|
|
/lib/cpp ${1+"$@"}
|
|
|
|
exit 0
|
|
|
|
]])
|
|
|
|
|
|
|
|
chmod +x mycpp
|
|
|
|
|
|
|
|
_AT_CHECK_AC_MACRO(
|
2001-05-10 23:41:16 +08:00
|
|
|
[[CPP=./mycpp
|
2000-11-16 22:56:17 +08:00
|
|
|
AC_PROG_CPP
|
|
|
|
test "x$ac_c_preproc_warn_flag" != xyes &&
|
|
|
|
AC_MSG_ERROR([failed to detect preprocessor warning option])
|
2001-02-16 07:36:48 +08:00
|
|
|
AC_CHECK_HEADERS(stdio.h autoconf_io.h)]])
|
2000-11-16 22:56:17 +08:00
|
|
|
|
|
|
|
AT_CHECK_DEFINES(
|
|
|
|
[/* #undef HAVE_AUTOCONF_IO_H */
|
|
|
|
#define HAVE_STDIO_H 1
|
|
|
|
])
|
|
|
|
|
2000-12-19 16:15:48 +08:00
|
|
|
AT_CLEANUP
|
2000-11-16 22:56:17 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
2001-05-10 23:41:16 +08:00
|
|
|
## -------------------- ##
|
|
|
|
## 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
|
2001-05-19 23:35:29 +08:00
|
|
|
exec "$@"
|
2001-05-10 23:41:16 +08:00
|
|
|
]])
|
|
|
|
|
|
|
|
chmod +x mycc
|
|
|
|
|
2001-05-11 23:54:43 +08:00
|
|
|
# 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.
|
2001-05-10 23:41:16 +08:00
|
|
|
_AT_CHECK_AC_MACRO(
|
2001-05-19 23:35:29 +08:00
|
|
|
[[AC_PROG_CC
|
|
|
|
CC="./mycc $CC"
|
2001-05-10 23:41:16 +08:00
|
|
|
AC_PROG_CPP
|
|
|
|
# The test $CC compiler should have been selected.
|
2001-05-11 23:54:43 +08:00
|
|
|
test "$CPP" != "$CC -E" &&
|
2001-05-10 23:41:16 +08:00
|
|
|
AC_MSG_ERROR([error messages on stderr cause the preprocessor selection to fail])
|
2001-05-11 23:54:43 +08:00
|
|
|
|
|
|
|
# Exercise CPP.
|
2001-05-10 23:41:16 +08:00
|
|
|
AC_CHECK_HEADERS(stdio.h autoconf_io.h)]])
|
|
|
|
|
|
|
|
AT_CHECK_DEFINES(
|
|
|
|
[/* #undef HAVE_AUTOCONF_IO_H */
|
|
|
|
#define HAVE_STDIO_H 1
|
|
|
|
])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
2000-11-16 22:56:17 +08:00
|
|
|
## ------------------ ##
|
|
|
|
## AC_TRY_LINK_FUNC. ##
|
|
|
|
## ------------------ ##
|
|
|
|
|
|
|
|
AT_CHECK_MACRO([AC_TRY_LINK_FUNC],
|
2001-01-11 23:17:13 +08:00
|
|
|
[AC_TRY_LINK_FUNC(printf,,
|
|
|
|
[AC_MSG_ERROR([cannot find `printf'])])
|
2000-11-16 22:56:17 +08:00
|
|
|
AC_TRY_LINK_FUNC(Be_doomed_if_your_libc_has_a_function_named_like_this,
|
|
|
|
[AC_MSG_ERROR([found a nonexistent function])])])
|
2000-12-05 22:08:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## --------------------- ##
|
|
|
|
## Fortran 77 Compiler. ##
|
|
|
|
## --------------------- ##
|
|
|
|
|
|
|
|
|
|
|
|
AT_CHECK_MACRO([GNU Fortran 77],
|
|
|
|
[[AC_LANG(Fortran 77)
|
|
|
|
AC_LANG_COMPILER
|
|
|
|
|
2000-12-19 18:17:06 +08:00
|
|
|
if AC_TRY_COMMAND([$F77 --version | grep GNU >&2]); then
|
2001-05-19 23:15:54 +08:00
|
|
|
# Be sure to remove files which might be created by compilers that
|
|
|
|
# don't support --version.
|
|
|
|
rm -f a.exe a.out
|
2000-12-12 19:40:21 +08:00
|
|
|
# Has GNU in --version.
|
2000-12-15 18:55:10 +08:00
|
|
|
test "$G77" != yes &&
|
2000-12-12 19:51:26 +08:00
|
|
|
AC_MSG_ERROR([failed to recognize GNU Fortran 77 compiler])
|
2000-12-12 19:40:21 +08:00
|
|
|
else
|
2001-05-19 23:15:54 +08:00
|
|
|
# Be sure to remove files which might be created by compilers that
|
|
|
|
# don't support --version.
|
|
|
|
rm -f a.exe a.out
|
2000-12-12 19:40:21 +08:00
|
|
|
# Has not.
|
2000-12-15 18:55:10 +08:00
|
|
|
test "$G77" = yes &&
|
2000-12-12 19:51:26 +08:00
|
|
|
AC_MSG_ERROR([incorrectly recognized a GNU Fortran 77 compiler])
|
2001-05-19 23:15:54 +08:00
|
|
|
fi]])
|