# and some are already tested elsewhere. EGREP_EXCLUDE must filter out
# the macros we don't want to test in syntax.m4.
#
-# - AC_CHECK decl, file, func, header, member, prog, sizeof, type
+# - AC_CHECK decl, file, func, header, lib, member, prog, sizeof, type
# Performed in the semantics tests.
# - AC_CONFIG
# They fail when the source does not exist.
# - AC_INIT
# AC_INIT includes all the AC_INIT macros. Note that there is an
# infinite m4 recursion if AC_INIT it used twice.
-# - AC_LANG
-# Requires an argument.
+# - AC_LANG*
+# Heavily used by other macros.
# - AC_PROG_(CC|CXX|F77)_(GNU|WORKS)
# are used in AC_PROG_CC etc.
# - AC_PATH_PROGS?
# We use the fact that automake will replace all the `\\\n' with ` '.
FILTER_MACROS = egrep -v -e \
`echo '^AC_ARG_VAR$$\
-^AC_CHECK_(DECL|FILE|FUNC|HEADER|MEMBER|PROG|SIZEOF|TYPE)S?$$\
+^AC_CHECK_(DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|TYPE)S?$$\
^AC_CONFIG\
^AC_INIT\
^AC_LANG\
EOF
-
-dnl AC_CHECK_DECLS
-dnl --------------
-dnl Check that it performs the correct actions:
-dnl Must define NEED_NO_DECL, but not NEED_YES_DECL.
+# AC_TRY_LINK_FUNC
+# ----------------
+AT_TEST_MACRO(AC_TRY_LINK_FUNC,
+[AC_TRY_LINK_FUNC(exit,, exit 1)
+AC_TRY_LINK_FUNC(Be_doomed_if_your_libc_has_a_function_named_like_this,
+ exit 1)])
+
+
+# AC_CHECK_LIB
+# ------------
+# Well, I can't imagine a system where `cos' is neither in libc, nor
+# in libm. Nor can I imagine a lib more likely to exists than libm.
+# But there are system without libm, on which we don't want to have
+# this test fail, so exit successfully if `cos' is in libc.
+AT_TEST_MACRO(AC_CHECK_LIB,
+[AC_TRY_LINK_FUNC(cos, exit 0)
+AC_CHECK_LIB(m, cos,, exit 1)])
+
+
+# AC_CHECK_DECLS
+# --------------
+# Check that it performs the correct actions:
+# Must define NEED_NO_DECL, but not NEED_YES_DECL.
AT_TEST_MACRO(AC_CHECK_DECLS,
[AC_CHECK_DECLS((yes, no),,,
[int yes = 1;])],
])])
-dnl AC_CHECK_FUNCS
-dnl --------------
-dnl Check that it performs the correct actions:
-dnl Must define HAVE_EXIT, but not HAVE_AUTOCONF_TIXE
+# AC_CHECK_FUNCS
+# --------------
+# Check that it performs the correct actions:
+# Must define HAVE_EXIT, but not HAVE_AUTOCONF_TIXE
AT_TEST_MACRO(AC_CHECK_FUNCS,
[AC_CHECK_FUNCS(exit autoconf_tixe)],
[AT_CHECK_DEFINES(
-dnl AC_CHECK_HEADERS
-dnl ----------------
-dnl Check that it performs the correct actions:
-dnl Must define HAVE_STDIO_H, but not HAVE_AUTOCONF_IO_H.
+# AC_CHECK_HEADERS
+# ----------------
+# Check that it performs the correct actions:
+# Must define HAVE_STDIO_H, but not HAVE_AUTOCONF_IO_H.
AT_TEST_MACRO(AC_CHECK_HEADERS,
[AC_CHECK_HEADERS(stdio.h autoconf_io.h)],
[AT_CHECK_DEFINES(
-dnl AC_CHECK_MEMBERS
-dnl ----------------
-dnl Check that it performs the correct actions.
-dnl Must define HAVE_STRUCT_YES_YES, but not HAVE_STRUCT_YES_NO.
+# AC_CHECK_MEMBERS
+# ----------------
+# Check that it performs the correct actions.
+# Must define HAVE_STRUCT_YES_YES, but not HAVE_STRUCT_YES_NO.
AT_TEST_MACRO(AC_CHECK_MEMBERS,
[AC_CHECK_MEMBERS((struct yes.yes, struct yes.no),,,
[struct yes { int yes ;} ;])],
-dnl AC_CHECK_SIZEOF
-dnl --------------
-dnl Check that it performs the correct actions.
-dnl Must define HAVE_STRUCT_YES, HAVE_INT, but not HAVE_STRUCT_NO.
-dnl `int' and `struct yes' are both checked to test both the compiler
-dnl builtin types, and defined types.
+# AC_CHECK_SIZEOF
+# --------------
+# Check that it performs the correct actions.
+# Must define HAVE_STRUCT_YES, HAVE_INT, but not HAVE_STRUCT_NO.
+# `int' and `struct yes' are both checked to test both the compiler
+# builtin types, and defined types.
AT_TEST_MACRO(AC_CHECK_SIZEOF,
[AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(charchar,,
-dnl AC_CHECK_TYPES
-dnl --------------
-dnl Check that it performs the correct actions.
-dnl Must define HAVE_STRUCT_YES, HAVE_INT, but not HAVE_STRUCT_NO.
-dnl `int' and `struct yes' are both checked to test both the compiler
-dnl builtin types, and defined types.
+# AC_CHECK_TYPES
+# --------------
+# Check that it performs the correct actions.
+# Must define HAVE_STRUCT_YES, HAVE_INT, but not HAVE_STRUCT_NO.
+# `int' and `struct yes' are both checked to test both the compiler
+# builtin types, and defined types.
AT_TEST_MACRO(AC_CHECK_TYPES,
[AC_CHECK_TYPES((int, struct yes, struct no),,,
[struct yes { int yes ;} ;])],
])])
-dnl AC_CHECK_TYPES
-dnl --------------
-dnl Check that we properly dispatch properly to the old implementation
-dnl or to the new one.
+# AC_CHECK_TYPES
+# --------------
+# Check that we properly dispatch properly to the old implementation
+# or to the new one.
AT_SETUP([AC_CHECK_TYPES])
AT_DATA(configure.in,
AC_CHECK_TYPE(ptrdiff_t, int)
AC_CHECK_TYPE(quad, long long)
AC_CHECK_TYPE(table_42, [int[42]])
-dnl Nice machine!
+# Nice machine!
AC_CHECK_TYPE(uint8_t, uint65536_t)
AC_CHECK_TYPE(a,b,c,d)
#to-here)
-dnl AC_CHECK_FILES
-dnl --------------
-dnl FIXME: To really test HAVE_AC_EXISTS2 and HAVE_AC_MISSING2 we need to
-dnl open AH_TEMPLATE to `configure.in', which is not yet the case.
+# AC_CHECK_FILES
+# --------------
+# FIXME: To really test HAVE_AC_EXISTS2 and HAVE_AC_MISSING2 we need to
+# open AH_TEMPLATE to `configure.in', which is not yet the case.
AT_TEST_MACRO(AC_CHECK_FILES,
[touch ac-exists1 ac-exists2
ac_exists2=ac-exists2