From: Akim Demaille Date: Sat, 25 Mar 2000 09:06:24 +0000 (+0000) Subject: * tests/semantics.m4 (AC_TRY_LINK_FUNC, AC_CHECK_LIB): New tests. X-Git-Tag: autoconf-2.50~1000 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd92d2bd3cb081f8e64cb1a062c53fdceeb1b90f;p=thirdparty%2Fautoconf.git * tests/semantics.m4 (AC_TRY_LINK_FUNC, AC_CHECK_LIB): New tests. --- diff --git a/ChangeLog b/ChangeLog index b2cd87657..5d9ed3f26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2000-03-25 Akim Demaille + + * tests/semantics.m4 (AC_TRY_LINK_FUNC, AC_CHECK_LIB): New tests. + 2000-03-25 Akim Demaille * acgeneral.m4 (AC_LANG_CALL, AC_LANG_CALL(C), AC_LANG_CALL(C++), diff --git a/tests/Makefile.am b/tests/Makefile.am index b397b35a0..7ee859835 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -47,15 +47,15 @@ testsuite: atgeneral.m4 atspecific.m4 suite.m4 macros.m4 $(SUITE) # 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? @@ -70,7 +70,7 @@ testsuite: atgeneral.m4 atspecific.m4 suite.m4 macros.m4 $(SUITE) # 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\ diff --git a/tests/semantics.m4 b/tests/semantics.m4 index 874e8f1e0..5919761f3 100644 --- a/tests/semantics.m4 +++ b/tests/semantics.m4 @@ -7,11 +7,29 @@ Semantics. 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;])], @@ -21,10 +39,10 @@ AT_TEST_MACRO(AC_CHECK_DECLS, ])]) -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( @@ -34,10 +52,10 @@ AT_TEST_MACRO(AC_CHECK_FUNCS, -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( @@ -47,10 +65,10 @@ AT_TEST_MACRO(AC_CHECK_HEADERS, -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 ;} ;])], @@ -61,12 +79,12 @@ AT_TEST_MACRO(AC_CHECK_MEMBERS, -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,, @@ -83,12 +101,12 @@ typedef struct -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 ;} ;])], @@ -99,10 +117,10 @@ AT_TEST_MACRO(AC_CHECK_TYPES, ])]) -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, @@ -114,7 +132,7 @@ AC_CHECK_TYPE(ptrdiff_t) 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) @@ -138,10 +156,10 @@ AT_CLEANUP(autoconf.err) -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