[SCM] GNU Autoconf source repository branch, master, updated. v2.67-37-g270b834

"Eric Blake" <[email protected]> Thu, 26 Aug 2010 22:24:51 +0000
Newsgroups gmane.comp.sysutils.autoconf.cvs
Message-ID <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Autoconf source repository".

http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=270b8340863c11c5e51bb2841a58974edf52e0db

The branch, master has been updated
       via  270b8340863c11c5e51bb2841a58974edf52e0db (commit)
       via  1e604ecfb2d49e6073c445623d894e9709e91b35 (commit)
      from  092a8b384812afab930f1e42c6dc213e0b32bdd2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 270b8340863c11c5e51bb2841a58974edf52e0db
Author: Eric Blake <[email protected]>
Date:   Thu Aug 26 16:10:44 2010 -0600

    docs: document m4_define_default
    
    * doc/autoconf.texi (Conditional constructs) <m4_define_default>:
    Document it, since gnulib wants to use it.
    * NEWS: Mention this.
    
    Signed-off-by: Eric Blake <[email protected]>

commit 1e604ecfb2d49e6073c445623d894e9709e91b35
Author: Eric Blake <[email protected]>
Date:   Thu Aug 26 15:07:38 2010 -0600

    autoconf: warn if AC_*_IFELSE lacks complete program
    
    * lib/autoconf/lang.m4 (AC_LANG_DEFINES_PROVIDED): New macro.
    (AC_LANG_SOURCE): Call it.
    (AC_LANG_CONFTEST): Add warning if new macro is not called.
    * lib/autoconf/c.m4 (_AC_LANG_OPENMP): Add missing AC_LANG_SOURCE.
    * lib/autoconf/fortran.m4 (AC_FC_FREEFORM, AC_FC_FIXEDFORM)
    (AC_FC_LINE_LENGTH, __AC_FC_NAME_MANGLING): Intentionally bypass
    AC_LANG_SOURCE.
    * lib/autoconf/programs.m4 (_AC_PROG_LEX_YYTEXT_DECL): Likewise.
    * tests/compile.at (AC_COMPILE_IFELSE): New test.
    * doc/autoconf.texi (Generating Sources) <AC_LANG_CONFTEST>:
    Document new warning.
    <AC_LANG_DEFINES_PROVIDED>: Document new macro.
    <AC_LANG_SOURCE>: Document use of new macro.
    * NEWS: Document the improvement.
    Suggested by Bruno Haible.
    
    Signed-off-by: Eric Blake <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                |   22 ++++++++++++++++++++++
 NEWS                     |    9 +++++++++
 doc/autoconf.texi        |   33 +++++++++++++++++++++++++++++++--
 lib/autoconf/c.m4        |    2 +-
 lib/autoconf/fortran.m4  |   16 ++++++++--------
 lib/autoconf/lang.m4     |   14 ++++++++++++--
 lib/autoconf/programs.m4 |    7 ++++---
 tests/compile.at         |   44 ++++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 131 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6ff1bc3..92132b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
 2010-08-26  Eric Blake  <[email protected]>
 
+	docs: document m4_define_default
+	* doc/autoconf.texi (Conditional constructs) <m4_define_default>:
+	Document it, since gnulib wants to use it.
+	* NEWS: Mention this.
+
+	autoconf: warn if AC_*_IFELSE lacks complete program
+	* lib/autoconf/lang.m4 (AC_LANG_DEFINES_PROVIDED): New macro.
+	(AC_LANG_SOURCE): Call it.
+	(AC_LANG_CONFTEST): Add warning if new macro is not called.
+	* lib/autoconf/c.m4 (_AC_LANG_OPENMP): Add missing AC_LANG_SOURCE.
+	* lib/autoconf/fortran.m4 (AC_FC_FREEFORM, AC_FC_FIXEDFORM)
+	(AC_FC_LINE_LENGTH, __AC_FC_NAME_MANGLING): Intentionally bypass
+	AC_LANG_SOURCE.
+	* lib/autoconf/programs.m4 (_AC_PROG_LEX_YYTEXT_DECL): Likewise.
+	* tests/compile.at (AC_COMPILE_IFELSE): New test.
+	* doc/autoconf.texi (Generating Sources) <AC_LANG_CONFTEST>:
+	Document new warning.
+	<AC_LANG_DEFINES_PROVIDED>: Document new macro.
+	<AC_LANG_SOURCE>: Document use of new macro.
+	* NEWS: Document the improvement.
+	Suggested by Bruno Haible.
+
 	autoconf: fix regression in AC_FUNC_SELECT_ARGTYPES
 	* lib/autoconf/functions.m4 (AC_FUNC_SELECT_ARGTYPES): Fix
 	quoting; regression from yesteray leaked '' into default value.
diff --git a/NEWS b/NEWS
index 3c0aed3..6010e7b 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,15 @@ GNU Autoconf NEWS - User visible changes.
 ** AC_INIT again allows URLs with '?' for its BUG-REPORT argument.
    Regression introduced in 2.66.
 
+** The macros AC_PREPROC_IFELSE, AC_COMPILE_IFELSE, AC_LINK_IFELSE, and
+   AC_RUN_IFELSE now warn if the first argument failed to use
+   AC_LANG_SOURCE or AC_LANG_PROGRAM to generate the conftest file
+   contents.  A new macro AC_LANG_DEFINES_PROVIDED exists if you have
+   a compelling reason why you cannot use AC_LANG_SOURCE but must
+   avoid the warning.
+
+** The macro m4_define_default is now documented.
+
 
 * Major changes in Autoconf 2.67 (2010-07-21) [stable]
   Released by Eric Blake, based on git versions 2.66.*.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 98dafa9..996525a 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -8730,15 +8730,38 @@ the results of all of the @code{AC_DEFINE} performed so far.
 Note that the @var{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.
+
+This macro issues a warning during @command{autoconf} processing if
+@var{source} does not include an expansion of the macro
+@code{AC_LANG_DEFINES_PROVIDED} (note that both @code{AC_LANG_SOURCE} and
+@code{AC_LANG_PROGRAM} call this macro, and thus avoid the warning).
+
+This macro is seldom called directly, but is used under the hood by more
+common macros such as @code{AC_COMPILE_IFELSE} and @code{AC_RUN_IFELSE}.
+@end defmac
+
+@defmac AC_LANG_DEFINES_PROVIDED
+@acindex{LANG_DEFINES_PROVIDED}
+This macro is called as a witness that the file
+@file{conftest.@var{extension}} appropriate for the current language is
+complete, including all previously determined results from
+@code{AC_DEFINE}.  This macro is seldom called directly, but exists if
+you have a compelling reason to write a conftest file without using
+@code{AC_LANG_SOURCE}, yet still want to avoid a syntax warning from
+@code{AC_LANG_CONFTEST}.
 @end defmac
 
 @defmac AC_LANG_SOURCE (@var{source})
 @acindex{LANG_SOURCE}
 Expands into the @var{source}, with the definition of
-all the @code{AC_DEFINE} performed so far.
+all the @code{AC_DEFINE} performed so far.  This macro includes an
+expansion of @code{AC_LANG_DEFINES_PROVIDED}.
+
+In many cases, you may find it more convenient to use the wrapper
+@code{AC_LANG_PROGRAM}.
 @end defmac
 
-For instance executing (observe the double quotation!):
+For instance, executing (observe the double quotation!):
 
 @example
 @c If you change this example, adjust tests/compile.at:AC_LANG_SOURCE example.
@@ -11763,6 +11786,12 @@ demo4([empty], [text])
 @end example
 @end defmac
 
+@defmac m4_define_default (@var{macro}, @ovar{default-definition})
+@msindex{define_default}
+If @var{macro} does not already have a definition, then define it to
+@var{default-definition}.
+@end defmac
+
 @defmac m4_ifblank (@var{cond}, @ovar{if-blank}, @ovar{if-text})
 @defmacx m4_ifnblank (@var{cond}, @ovar{if-text}, @ovar{if-blank})
 @msindex{ifblank}
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index 9a28adf..233644a 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -1930,7 +1930,7 @@ AC_DEFUN([AC_C_TYPEOF],
 # Expands to some language dependent source code for testing the presence of
 # OpenMP.
 AC_DEFUN([_AC_LANG_OPENMP],
-[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+[AC_LANG_SOURCE([_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])])
 
 # _AC_LANG_OPENMP(C)
 # ------------------
diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4
index 0a487ee..5e48468 100644
--- a/lib/autoconf/fortran.m4
+++ b/lib/autoconf/fortran.m4
@@ -897,13 +897,13 @@ AC_DEFUN([__AC_FC_NAME_MANGLING],
 [_AC_FORTRAN_ASSERT()dnl
 AC_CACHE_CHECK([for _AC_LANG name-mangling scheme],
 	       ac_cv_[]_AC_LANG_ABBREV[]_mangling,
-[AC_COMPILE_IFELSE(
+[AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED
 [      subroutine foobar()
       return
       end
       subroutine foo_bar()
       return
-      end],
+      end]],
 [mv conftest.$ac_objext cfortran_test.$ac_objext
 
   ac_save_LIBS=$LIBS
@@ -1186,12 +1186,12 @@ for ac_flag in none -ffree-form -FR -free -qfree -Mfree -Mfreeform \
 do
   test "x$ac_flag" != xnone && FCFLAGS="$ac_fc_freeform_FCFLAGS_save $ac_flag"
 dnl Use @&t@ below to ensure that editors don't turn 8+ spaces into tab.
-  AC_COMPILE_IFELSE([
+  AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[
   program freeform
        ! FIXME: how to best confuse non-freeform compilers?
        print *, 'Hello ', &
      @&t@     'world.'
-       end],
+       end]],
 		    [ac_cv_fc_freeform=$ac_flag; break])
 done
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
@@ -1241,10 +1241,10 @@ for ac_flag in none -ffixed-form -fixed -qfixed -Mfixed -fixedform "-f fixed" \
 	       +source=fixed -fix
 do
   test "x$ac_flag" != xnone && FCFLAGS="$ac_fc_fixedform_FCFLAGS_save $ac_flag"
-  AC_COMPILE_IFELSE([
+  AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[
 C     This comment should confuse free-form compilers.
       program main
-      end],
+      end]],
 		    [ac_cv_fc_fixedform=$ac_flag; break])
 done
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
@@ -1324,8 +1324,8 @@ for ac_flag in none \
 	       "-W $ac_fc_line_len" +extend_source -wide -e
 do
   test "x$ac_flag" != xnone && FCFLAGS="$ac_fc_line_length_FCFLAGS_save $ac_flag"
-  AC_COMPILE_IFELSE([$ac_fc_line_length_test
-      end subroutine],
+  AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[$ac_fc_line_length_test
+      end subroutine]],
 		    [ac_cv_fc_line_length=$ac_flag; break])
 done
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
diff --git a/lib/autoconf/lang.m4 b/lib/autoconf/lang.m4
index 3e8de53..bd4b68b 100644
--- a/lib/autoconf/lang.m4
+++ b/lib/autoconf/lang.m4
@@ -192,7 +192,10 @@ m4_define([AC_LANG_DEFINE],
 # ----------------------
 # Save the BODY in `conftest.$ac_ext'.  Add a trailing new line.
 AC_DEFUN([AC_LANG_CONFTEST],
-[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+[m4_pushdef([_AC_LANG_DEFINES_PROVIDED],
+  [m4_warn([syntax], [$0: no AC_LANG_SOURCE call detected in body])])]dnl
+[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]dnl
+[[]_AC_LANG_DEFINES_PROVIDED[]m4_popdef([_AC_LANG_DEFINES_PROVIDED])])
 
 
 # AC_LANG_CONFTEST()(BODY)
@@ -203,13 +206,20 @@ m4_define([AC_LANG_CONFTEST()],
 $1
 _ACEOF])
 
+# AC_LANG_DEFINES_PROVIDED
+# ------------------------
+# Witness macro that all prior AC_DEFINE results have been output
+# into the current expansion, to silence warning from AC_LANG_CONFTEST.
+m4_define([AC_LANG_DEFINES_PROVIDED],
+[m4_define([_$0])])
+
 
 # AC_LANG_SOURCE(BODY)
 # --------------------
 # Produce a valid source for the current language, which includes the
 # BODY, and as much as possible `confdefs.h'.
 AC_DEFUN([AC_LANG_SOURCE],
-[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+[AC_LANG_DEFINES_PROVIDED[]_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
 
 
 # AC_LANG_SOURCE()(BODY)
diff --git a/lib/autoconf/programs.m4 b/lib/autoconf/programs.m4
index 4b9060f..e7eeb6f 100644
--- a/lib/autoconf/programs.m4
+++ b/lib/autoconf/programs.m4
@@ -756,7 +756,8 @@ if test -z "${LEXLIB+set}"; then
     ac_cv_lib_lex='none needed'
     for ac_lib in '' -lfl -ll; do
       LIBS="$ac_lib $ac_save_LIBS"
-      AC_LINK_IFELSE([`cat $LEX_OUTPUT_ROOT.c`], [ac_cv_lib_lex=$ac_lib])
+      AC_LINK_IFELSE([AC_LANG_DEFINES_PROVIDED[`cat $LEX_OUTPUT_ROOT.c`]],
+	[ac_cv_lib_lex=$ac_lib])
       test "$ac_cv_lib_lex" != 'none needed' && break
     done
     LIBS=$ac_save_LIBS
@@ -772,9 +773,9 @@ AC_CACHE_CHECK(whether yytext is a pointer, ac_cv_prog_lex_yytext_pointer,
 ac_cv_prog_lex_yytext_pointer=no
 ac_save_LIBS=$LIBS
 LIBS="$LEXLIB $ac_save_LIBS"
-AC_LINK_IFELSE(
+AC_LINK_IFELSE([AC_LANG_DEFINES_PROVIDED
   [#define YYTEXT_POINTER 1
-`cat $LEX_OUTPUT_ROOT.c`],
+`cat $LEX_OUTPUT_ROOT.c`]],
   [ac_cv_prog_lex_yytext_pointer=yes])
 LIBS=$ac_save_LIBS
 ])
diff --git a/tests/compile.at b/tests/compile.at
index 6a1092b..dd7175b 100644
--- a/tests/compile.at
+++ b/tests/compile.at
@@ -260,11 +260,55 @@ fputs (hw, stdout);
 AT_CLEANUP
 
 
+## ------------------- ##
+## AC_COMPILE_IFELSE.  ##
+## ------------------- ##
+
+AT_SETUP([AC_COMPILE_IFELSE])
+AT_KEYWORDS([AC_LANG_DEFINES_PROVIDED])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_COMPILE_IFELSE([int main () { return 0; }], [],
+  [AC_MSG_ERROR([compiling trivial program failed])])
+]])
+
+AT_CHECK_AUTOCONF([], [], [], [stderr])
+AT_CHECK([grep 'no AC_LANG_SOURCE call detected in body' stderr], [], [ignore])
+AT_CHECK_AUTOCONF([-W no-syntax])
+AT_CHECK_CONFIGURE([-q])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED()int main () { return 0; }], [],
+  [AC_MSG_ERROR([compiling trivial program failed])])
+]])
+
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE([-q])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return 0])],
+	      [],
+	      [AC_MSG_ERROR([compiling `return 0' failed])])
+
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return 2])],
+	      [],
+	      [AC_MSG_ERROR([compiling `return 2' failed])])
+]])
+
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE([-q])
+
+AT_CLEANUP
+
 ## --------------- ##
 ## AC_RUN_IFELSE.  ##
 ## --------------- ##
 
 AT_SETUP([AC_RUN_IFELSE])
+AT_KEYWORDS([AC_TRY_RUN])
 
 AT_DATA([configure.ac],
 [[AC_INIT


hooks/post-receive
-- 
GNU Autoconf source repository