mirror of
git://git.sv.gnu.org/autoconf
synced 2024-12-09 02:10:22 +08:00
55953c9b14
`0'. Test and fix. Reported by Assar Westerlund. * Makefile.am (maintainer-check): New target. * tests/Makefile.am (maintainer-check, maintainer-check-posix) (maintainer-check-c++, expr): Likewise. * configure.in (EXPR): Look for it. * tests/atgeneral.m4 (AT_CHECK): Propagate $2's default value. * tests/compile.at (Extensions): New test. * aclang.m4 (_AC_COMPILER_EXEEXT_DEFAULT, _AC_COMPILER_EXEEXT_O): Distinguish files with or without a dot.
160 lines
3.4 KiB
Plaintext
160 lines
3.4 KiB
Plaintext
# -*- autoconf -*-
|
|
|
|
AT_BANNER([Low level compiling/preprocessing macros.])
|
|
|
|
# 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
|
|
]])
|
|
|
|
|
|
## ------------ ##
|
|
## 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])
|
|
|
|
AT_DATA([mycpp],
|
|
[[#! /bin/sh
|
|
/lib/cpp ${1+"$@"}
|
|
exit 0
|
|
]])
|
|
|
|
chmod +x mycpp
|
|
|
|
_AT_CHECK_AC_MACRO(
|
|
[# Ignore if /lib/cpp doesn't work
|
|
if AC_TRY_COMMAND([/lib/cpp </dev/null >&2]); then :; else
|
|
AC_MSG_ERROR([preprocessor doesn't work], 77)
|
|
fi
|
|
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_TRY_LINK_FUNC. ##
|
|
## ------------------ ##
|
|
|
|
AT_CHECK_MACRO([AC_TRY_LINK_FUNC],
|
|
[AC_TRY_LINK_FUNC(printf,,
|
|
[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
|
|
# Has GNU in --version.
|
|
test "$G77" != yes &&
|
|
AC_MSG_ERROR([failed to recognize GNU Fortran 77 compiler])
|
|
else
|
|
# Has not.
|
|
test "$G77" = yes &&
|
|
AC_MSG_ERROR([incorrectly recognized a GNU Fortran 77 compiler])
|
|
fi
|
|
AS_EXIT(0)]])
|