autoconf/tests/semantics.m4
Akim Demaille 3c2a8f9b09 Start a new series of tests which check the semantics.
* acgeneral.m4 (AC_CHECK_MEMBER): It is not smart to define
ac_Foo, and use AC_Foo.  Got rid of AC_Member_Aggregate and
AC_Member_Member which were complicating more than simplifying.
(AC_CHECK_DECLS): Use m4 lists.
(AC_CHECK_TYPES): A comma was missing.
* autoheader.m4: (AC_CHECK_DECLS): Use m4 lists.
* doc/autoconf.texi (Generic Declarations): AC_CHECK_DELCS uses m4
lists.
* tests/semantics.m4: New file.  Collection of semantical tests:
verify that the tests are positive and negative when appropriate.
Test AC_CHECK_MEMBERS, AC_CHECK_DECLS and AC_CHECK_TYPES.
2000-02-07 11:54:29 +00:00

47 lines
1.3 KiB
Plaintext

# -*- autoconf -*-
cat <<EOF
Checking the semantics of some macros.
EOF
dnl Check that AC_CHECK_MEMBERS performs the correct actions:
dnl 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 ;} ;])],
[AT_CHECK([grep HAVE_STRUCT_YES_YES config.h],,
[#define HAVE_STRUCT_YES_YES 1
])
AT_CHECK([grep HAVE_STRUCT_YES_NO config.h],,
[/* #undef HAVE_STRUCT_YES_NO */
])])
dnl Check that AC_CHECK_TYPES performs the correct actions:
dnl Must define HAVE_STRUCT_YES, but not HAVE_STRUCT_NO.
AT_TEST_MACRO(AC_CHECK_TYPES,
[AC_CHECK_TYPES((struct yes, struct no),,,
[struct yes { int yes ;} ;])],
[AT_CHECK([grep HAVE_STRUCT_YES config.h],,
[#define HAVE_STRUCT_YES 1
])
AT_CHECK([grep HAVE_STRUCT_NO config.h],,
[/* #undef HAVE_STRUCT_NO */
])])
dnl Check that AC_CHECK_DECLS performs the correct actions:
dnl Must define NEED_NO_DECL, but not NEED_YES_DECL.
AT_TEST_MACRO(AC_CHECK_DECLS,
[AC_CHECK_DECLS((yes, no),,,
[int yes = 1;])],
[AT_CHECK([grep NEED_YES_DECL config.h],,
[/* #undef NEED_YES_DECL */
])
AT_CHECK([grep NEED_NO_DECL config.h],,
[#define NEED_NO_DECL 1
])])