mirror of
git://git.sv.gnu.org/autoconf
synced 2024-12-09 02:10:22 +08:00
Coverage and doc fixes for AC_LANG_SOURCE and AC_LANG_PROGRAM.
* tests/compile.at (AC_LANG_SOURCE, AC_LANG_SOURCE(C++)) (AC_LANG_SOURCE example, AC_LANG_PROGRAM example): New tests. * doc/autoconf.texi (Generating Sources): Add markers for tested examples; update quoting, and update AC_INIT usage to also set optional URL arguments. Mention that the examples require gcc. Prompted by report from Brian J. Murrell. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
This commit is contained in:
parent
cddfaa966c
commit
c106e61216
@ -1,5 +1,13 @@
|
||||
2010-06-08 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
|
||||
|
||||
Coverage and doc fixes for AC_LANG_SOURCE and AC_LANG_PROGRAM.
|
||||
* tests/compile.at (AC_LANG_SOURCE, AC_LANG_SOURCE(C++))
|
||||
(AC_LANG_SOURCE example, AC_LANG_PROGRAM example): New tests.
|
||||
* doc/autoconf.texi (Generating Sources): Add markers for tested
|
||||
examples; update quoting, and update AC_INIT usage to also set
|
||||
optional URL arguments. Mention that the examples require gcc.
|
||||
Prompted by report from Brian J. Murrell.
|
||||
|
||||
Make AS_SET_CATFILE polymorphic, and add testsuite coverage.
|
||||
* lib/m4sugar/m4sh.m4 (AS_SET_CATFILE): Use AS_VAR_SET to set
|
||||
the variable.
|
||||
|
@ -8675,19 +8675,22 @@ all the @code{AC_DEFINE} performed so far.
|
||||
For instance executing (observe the double quotation!):
|
||||
|
||||
@example
|
||||
AC_INIT([Hello], [1.0], [bug-hello@@example.org])
|
||||
@c If you change this example, adjust tests/compile.at:AC_LANG_SOURCE example.
|
||||
AC_INIT([Hello], [1.0], [bug-hello@@example.org], [],
|
||||
[http://www.example.org/])
|
||||
AC_DEFINE([HELLO_WORLD], ["Hello, World\n"],
|
||||
[Greetings string.])
|
||||
AC_LANG(C)
|
||||
AC_LANG([C])
|
||||
AC_LANG_CONFTEST(
|
||||
[AC_LANG_SOURCE([[const char hw[] = "Hello, World\n";]])])
|
||||
gcc -E -dD -o - conftest.c
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
results in:
|
||||
on a system with @command{gcc} installed, results in:
|
||||
|
||||
@example
|
||||
@c If you change this example, adjust tests/compile.at:AC_LANG_SOURCE example.
|
||||
@dots{}
|
||||
# 1 "conftest.c"
|
||||
|
||||
@ -8696,6 +8699,7 @@ results in:
|
||||
#define PACKAGE_VERSION "1.0"
|
||||
#define PACKAGE_STRING "Hello 1.0"
|
||||
#define PACKAGE_BUGREPORT "bug-hello@@example.org"
|
||||
#define PACKAGE_URL "http://www.example.org/"
|
||||
#define HELLO_WORLD "Hello, World\n"
|
||||
|
||||
const char hw[] = "Hello, World\n";
|
||||
@ -8716,7 +8720,9 @@ available.
|
||||
For instance:
|
||||
|
||||
@example
|
||||
AC_INIT([Hello], [1.0], [bug-hello@@example.org])
|
||||
@c If you change this example, adjust tests/compile.at:AC_LANG_PROGRAM example.
|
||||
AC_INIT([Hello], [1.0], [bug-hello@@example.org], [],
|
||||
[http://www.example.org/])
|
||||
AC_DEFINE([HELLO_WORLD], ["Hello, World\n"],
|
||||
[Greetings string.])
|
||||
AC_LANG_CONFTEST(
|
||||
@ -8726,9 +8732,10 @@ gcc -E -dD -o - conftest.c
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
results in:
|
||||
on a system with @command{gcc} installed, results in:
|
||||
|
||||
@example
|
||||
@c If you change this example, adjust tests/compile.at:AC_LANG_PROGRAM example.
|
||||
@dots{}
|
||||
# 1 "conftest.c"
|
||||
|
||||
@ -8737,6 +8744,7 @@ results in:
|
||||
#define PACKAGE_VERSION "1.0"
|
||||
#define PACKAGE_STRING "Hello 1.0"
|
||||
#define PACKAGE_BUGREPORT "bug-hello@@example.org"
|
||||
#define PACKAGE_URL "http://www.example.org/"
|
||||
#define HELLO_WORLD "Hello, World\n"
|
||||
|
||||
const char hw[] = "Hello, World\n";
|
||||
|
140
tests/compile.at
140
tests/compile.at
@ -112,6 +112,146 @@ AT_CHECK_CONFIGURE
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
## ---------------- ##
|
||||
## AC_LANG_SOURCE. ##
|
||||
## ---------------- ##
|
||||
|
||||
AT_SETUP([AC_LANG_SOURCE])
|
||||
|
||||
AT_DATA([configure.ac],
|
||||
[[AC_INIT([pkg], [1.0])
|
||||
AC_PROG_CC
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef PACKAGE_NAME
|
||||
choke me
|
||||
#endif
|
||||
int main ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
]], [], [AC_MSG_FAILURE([confdefs not included])])])
|
||||
]])
|
||||
|
||||
AT_CHECK_AUTOCONF
|
||||
AT_CHECK_CONFIGURE
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
## --------------------- ##
|
||||
## AC_LANG_SOURCE(C++). ##
|
||||
## --------------------- ##
|
||||
|
||||
AT_SETUP([AC_LANG_SOURCE(C++)])
|
||||
|
||||
AT_DATA([configure.ac],
|
||||
[[AC_INIT([pkg], [1.0])
|
||||
AC_PROG_CXX
|
||||
AC_LANG([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef PACKAGE_NAME
|
||||
choke me
|
||||
#endif
|
||||
int main ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
]], [], [AC_MSG_FAILURE([confdefs not included])])])
|
||||
]])
|
||||
|
||||
AT_CHECK_AUTOCONF
|
||||
AT_CHECK_CONFIGURE
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
## ------------------------ ##
|
||||
## AC_LANG_SOURCE example. ##
|
||||
## ------------------------ ##
|
||||
|
||||
AT_SETUP([AC_LANG_SOURCE example])
|
||||
|
||||
AT_DATA([configure.ac],
|
||||
[[# Taken from autoconf.texi:Generating Sources.
|
||||
# The only change is to not fail if gcc doesn't work.
|
||||
AC_INIT([Hello], [1.0], [bug-hello@example.org], [],
|
||||
[http://www.example.org/])
|
||||
AC_DEFINE([HELLO_WORLD], ["Hello, World\n"],
|
||||
[Greetings string.])
|
||||
AC_LANG([C])
|
||||
AC_LANG_CONFTEST(
|
||||
[AC_LANG_SOURCE([[const char hw[] = "Hello, World\n";]])])
|
||||
gcc -E -dD -o - conftest.c || AS_EXIT([77])
|
||||
]])
|
||||
|
||||
AT_CHECK_AUTOCONF
|
||||
AT_CHECK_CONFIGURE([], [], [stdout])
|
||||
# Taken from autoconf.texi:Generating Sources.
|
||||
# Note that the output may contain more than one line matching
|
||||
# # 1 "conftest.c"
|
||||
# so delete everything until the last one.
|
||||
AT_CHECK([sed '1,/# 1 "conftest\.c"/d' stdout], [],
|
||||
[[
|
||||
#define PACKAGE_NAME "Hello"
|
||||
#define PACKAGE_TARNAME "hello"
|
||||
#define PACKAGE_VERSION "1.0"
|
||||
#define PACKAGE_STRING "Hello 1.0"
|
||||
#define PACKAGE_BUGREPORT "bug-hello@example.org"
|
||||
#define PACKAGE_URL "http://www.example.org/"
|
||||
#define HELLO_WORLD "Hello, World\n"
|
||||
|
||||
const char hw[] = "Hello, World\n";
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
## ------------------------- ##
|
||||
## AC_LANG_PROGRAM example. ##
|
||||
## ------------------------- ##
|
||||
|
||||
AT_SETUP([AC_LANG_PROGRAM example])
|
||||
|
||||
AT_DATA([configure.ac],
|
||||
[[# Taken from autoconf.texi:Generating Sources.
|
||||
# The only change is to not fail if gcc doesn't work.
|
||||
AC_INIT([Hello], [1.0], [bug-hello@example.org], [],
|
||||
[http://www.example.org/])
|
||||
AC_DEFINE([HELLO_WORLD], ["Hello, World\n"],
|
||||
[Greetings string.])
|
||||
AC_LANG_CONFTEST(
|
||||
[AC_LANG_PROGRAM([[const char hw[] = "Hello, World\n";]],
|
||||
[[fputs (hw, stdout);]])])
|
||||
gcc -E -dD -o - conftest.c || AS_EXIT([77])
|
||||
]])
|
||||
|
||||
AT_CHECK_AUTOCONF
|
||||
AT_CHECK_CONFIGURE([], [], [stdout])
|
||||
# Taken from autoconf.texi:Generating Sources.
|
||||
# Note that the output may contain more than one line matching
|
||||
# # 1 "conftest.c"
|
||||
# so delete everything until the last one.
|
||||
AT_CHECK([sed '1,/# 1 "conftest\.c"/d' stdout], [],
|
||||
[[
|
||||
#define PACKAGE_NAME "Hello"
|
||||
#define PACKAGE_TARNAME "hello"
|
||||
#define PACKAGE_VERSION "1.0"
|
||||
#define PACKAGE_STRING "Hello 1.0"
|
||||
#define PACKAGE_BUGREPORT "bug-hello@example.org"
|
||||
#define PACKAGE_URL "http://www.example.org/"
|
||||
#define HELLO_WORLD "Hello, World\n"
|
||||
|
||||
const char hw[] = "Hello, World\n";
|
||||
int
|
||||
main ()
|
||||
{
|
||||
fputs (hw, stdout);
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
## --------------- ##
|
||||
## AC_RUN_IFELSE. ##
|
||||
## --------------- ##
|
||||
|
Loading…
Reference in New Issue
Block a user