[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Autoconf provides a set of macros that can be used to generate test source files. They are written to be language generic, i.e., they actually depend on the current language (see section 6.1 Language Choice) to "format" the output properly.
Note that the source is evaluated exactly once, like regular Autoconf macro arguments, and therefore (i) you may pass a macro invocation, (ii) if not, be sure to double quote if needed.
AC_DEFINE
performed so far.
For instance executing (observe the double quotation!):
AC_INIT(Autoconf Documentation, 2.57, [email protected]) AC_DEFINE([HELLO_WORLD], ["Hello, World\n"]) AC_LANG_CONFTEST( [AC_LANG_SOURCE([[const char hw[] = "Hello, World\n";]])]) gcc -E -dD conftest.c -o - |
results in:
# 1 "conftest.c" # 1169 "configure" # 1 "confdefs.h" 1 #define PACKAGE_NAME "Autoconf Documentation" #define PACKAGE_TARNAME "autoconf-documentation" #define PACKAGE_VERSION "2.57" #define PACKAGE_STRING "Autoconf Documentation 2.57" #define PACKAGE_BUGREPORT "[email protected]" #define HELLO_WORLD "Hello, World\n" # 1170 "configure" 2 const char hw[] = "Hello, World\n"; |
main
in
C). Since it uses AC_LANG_SOURCE
, the feature of the latter are
available.
For instance:
AC_INIT(Autoconf Documentation, 2.57, [email protected]) AC_DEFINE([HELLO_WORLD], ["Hello, World\n"]) AC_LANG_CONFTEST( [AC_LANG_PROGRAM([[const char hw[] = "Hello, World\n";]], [[fputs (hw, stdout);]])]) gcc -E -dD conftest.c -o - |
results in:
# 1 "conftest.c" # 1169 "configure" # 1 "confdefs.h" 1 #define PACKAGE_NAME "Autoconf Documentation" #define PACKAGE_TARNAME "autoconf-documentation" #define PACKAGE_VERSION "2.57" #define PACKAGE_STRING "Autoconf Documentation 2.57" #define PACKAGE_BUGREPORT "[email protected]" #define HELLO_WORLD "Hello, World\n" # 1170 "configure" 2 const char hw[] = "Hello, World\n"; int main () { fputs (hw, stdout); ; return 0; } |
main
in C). Since it uses AC_LANG_PROGRAMS
, the feature
of the latter are available.
This function will probably be replaced in the feature by a version which would enable specifying the arguments. The use of this macro is not encouraged, as it violates strongly the typing system.
main
in C): a
simple (function pointer) assignment. Since it uses
AC_LANG_PROGRAMS
, the feature of the latter are available.
As AC_LANG_CALL
, this macro is documented only for completeness.
It is considered to be severely broken, and in the future will be
removed in favor of actual function calls (with properly typed
arguments).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |