From: Akim Demaille Date: Thu, 23 Mar 2000 18:15:28 +0000 (+0000) Subject: * acgeneral.m4 (AC_LANG_PROGRAM, AC_LANG_PROGRAM(C), X-Git-Tag: autoconf-2.50~1005 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df11184013d560303bf59862f4b4fdaa4ef74c0c;p=thirdparty%2Fautoconf.git * acgeneral.m4 (AC_LANG_PROGRAM, AC_LANG_PROGRAM(C), AC_LANG_PROGRAM(C++), AC_LANG_PROGRAM(FORTRAN77)): New macros. (AC_TRY_COMPILE, AC_TRY_LINK): Use them. --- diff --git a/ChangeLog b/ChangeLog index d8a17afd2..660ce98e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-03-23 Akim Demaille + + * acgeneral.m4 (AC_LANG_PROGRAM, AC_LANG_PROGRAM(C), + AC_LANG_PROGRAM(C++), AC_LANG_PROGRAM(FORTRAN77)): New macros. + (AC_TRY_COMPILE, AC_TRY_LINK): Use them. + 2000-03-23 Akim Demaille * acgeneral.m4 (_AC_INIT_PARSE_ARGS): Support --help={long, short, diff --git a/acgeneral.m4 b/acgeneral.m4 index 0b6b90055..e9e7fb01f 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -2168,12 +2168,22 @@ _AC_LANG_DISPATCH([$0], _AC_LANG_CURRENT, $@)]) # AC_LANG_SOURCE(BODY) # -------------------- -# Produce a valid source for the current language, which includes the BODY. -# Include the `#line' sync lines. +# Produce a valid source for the current language, which includes the +# BODY. Include the `#line' sync lines. AC_DEFUN([AC_LANG_SOURCE], [_AC_LANG_DISPATCH([$0], _AC_LANG_CURRENT, $@)]) +# AC_LANG_PROGRAM(PROLOGUE, BODY) +# ------------------------------- +# Produce a valid source for the current language. Prepend the +# PROLOGUE (typically CPP directives and/or declarations) to an +# execution the BODY (typically glued inside the `main' function, or +# equivalent). +AC_DEFUN([AC_LANG_PROGRAM], +[AC_LANG_SOURCE([_AC_LANG_DISPATCH([$0], _AC_LANG_CURRENT, $@)])]) + + # ---------------- # # The C language. # @@ -2199,12 +2209,28 @@ AU_DEFUN([AC_LANG_C], [AC_LANG(C)]) # AC_LANG_SOURCE(C)(BODY) # ----------------------- +# This sometimes fails to find confdefs.h, for some reason. +# #line __oline__ "[$]0" define([AC_LANG_SOURCE(C)], [#line __oline__ "configure" #include "confdefs.h" $1]) +# AC_LANG_PROGRAM(C)(PROLOGUE, BODY) +# ---------------------------------- +define([AC_LANG_PROGRAM(C)], +[$1 +int +main () +{ +dnl Do *not* indent the following line: there may be CPP directives. +dnl Don't move the `;' right after for the same reason. +$2 + ; + return 0; +}]) + # ------------------ # # The C++ language. # @@ -2239,6 +2265,20 @@ extern "C" void exit (int); $1]) +# AC_LANG_PROGRAM(C++)(PROLOGUE, BODY) +# ------------------------------------ +define([AC_LANG_PROGRAM(C++)], +[$1 +int +main () +{ +dnl Do *not* indent the following line: there may be CPP directives. +dnl Don't move the `;' right after for the same reason. +$2 + ; + return 0; +}]) + # ------------------------- # @@ -2270,6 +2310,14 @@ define([AC_LANG_SOURCE(FORTRAN77)], [$1]) +# AC_LANG_PROGRAM(FORTRAN77)(PROLOGUE, BODY) +# ------------------------------------------ +# Yes, we discard the PROLOGUE. +define([AC_LANG_PROGRAM(FORTRAN77)], +[ program main +$2 + end]) + @@ -2867,25 +2915,8 @@ rm -f conftest* # FIXME: Should INCLUDES be defaulted here? AC_DEFUN(AC_TRY_COMPILE, [cat >conftest.$ac_ext <conftest.$ac_ext <conftest.$ac_ext <conftest.$ac_ext <