autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

05-ac-run.patch


From: Akim Demaille
Subject: 05-ac-run.patch
Date: Sun, 27 Oct 2002 19:15:08 +0100

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * doc/autoconf.texi (Run Time): Document AC_RUN_IFELSE.
        Move the documentation of AC_TRY_RUN to...
        (Obsolete Macros): here.
        Adjust all the old samples still using AC_TRY_RUN to AC_RUN_IFELSE.
        (autoconf Invocation): Remove the duplicates with `invoking
        autom4te'.
        * lib/autoconf/headers.m4 (AC_HEADER_STDC): Don't use AC_TRY_RUN.
        * lib/autoconf/c.m4 (AC_C_BIGENDIAN): Likewise.
        
        
Index: doc/autoconf.texi
--- doc/autoconf.texi Sun, 27 Oct 2002 18:08:52 +0100 akim
+++ doc/autoconf.texi Sun, 27 Oct 2002 18:34:30 +0100 akim
@@ -1235,36 +1235,10 @@ @node autoconf Invocation
 
 @cindex Back trace
 @cindex Macro invocation stack
address@hidden displays a back trace for errors, but not for
-warnings; if you want them, just pass @option{-W error}.  For instance,
-on this @file{configure.ac}:
-
address@hidden
-AC_DEFUN([INNER],
-[AC_TRY_RUN([exit (0)])])
-
-AC_DEFUN([OUTER],
-[INNER])
-
-AC_INIT
-OUTER
address@hidden example
-
address@hidden
-you get:
-
address@hidden
-$ @kbd{autoconf -Wcross}
-configure.ac:8: warning: AC_TRY_RUN called without default \
-to allow cross compiling
-$ @kbd{autoconf -Wcross,error}
-configure.ac:8: error: AC_TRY_RUN called without default \
-to allow cross compiling
-acgeneral.m4:3044: AC_TRY_RUN is expanded from...
-configure.ac:2: INNER is expanded from...
-configure.ac:5: OUTER is expanded from...
-configure.ac:8: the top level
address@hidden example
+Because @command{autoconf} uses @command{autom4te} behind the scenes, it
+displays a back trace for errors, but not for warnings; if you want
+them, just pass @option{-W error}.  @xref{Invoking autom4te}, for some
+examples.
 
 @item address@hidden:@var{format}]
 @itemx -t @var{macro}[:@var{format}]
@@ -1276,7 +1250,7 @@ configure.ac:8: the top level
 
 The @var{format} is a regular string, with newlines if desired, and
 several special escape codes.  It defaults to @samp{$f:$l:$n:$%}; see
-below for details on the @var{format}.
address@hidden autom4te}, for details on the @var{format}.
 
 @item --initialization
 @itemx -i
@@ -1289,55 +1263,8 @@ configure.ac:8: the top level
 It is often necessary to check the content of a @file{configure.ac}
 file, but parsing it yourself is extremely fragile and error-prone.  It
 is suggested that you rely upon @option{--trace} to scan
address@hidden
-
-The @var{format} of @option{--trace} can use the following special
-escapes:
-
address@hidden @samp
address@hidden $$
-The character @samp{$}.
-
address@hidden $f
-The filename from which @var{macro} is called.
-
address@hidden $l
-The line number from which @var{macro} is called.
-
address@hidden $d
-The depth of the @var{macro} call.  This is an M4 technical detail that
-you probably don't want to know about.
-
address@hidden $n
-The name of the @var{macro}.
-
address@hidden address@hidden
-The @var{num}th argument of the call to @var{macro}.
-
address@hidden $@@
address@hidden address@hidden@@
address@hidden address@hidden@address@hidden@@
-All the arguments passed to @var{macro}, separated by the character
address@hidden or the string @var{separator} (@samp{,} by default).  Each
-argument is quoted, i.e., enclosed in a pair of square brackets.
-
address@hidden $*
address@hidden address@hidden
address@hidden address@hidden@address@hidden
-As above, but the arguments are not quoted.
-
address@hidden $%
address@hidden address@hidden
address@hidden address@hidden@address@hidden
-As above, but the arguments are not quoted, all new line characters in
-the arguments are smashed, and the default separator is @samp{:}.
-
-The escape @samp{$%} produces single-line trace outputs (unless you put
-newlines in the @samp{separator}), while @samp{$@@} and @samp{$*} do
-not.
address@hidden table
-
-For instance, to find the list of variables that are substituted, use:
address@hidden  For instance, to find the list of variables that
+are substituted, use:
 
 @example
 @group
@@ -3386,8 +3313,9 @@ @node Libraries
 @defmac AC_SEARCH_LIBS (@var{function}, @var{search-libs}, 
@ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{other-libraries})
 @acindex SEARCH_LIBS
 Search for a library defining @var{function} if it's not already
-available.  This equates to calling @code{AC_TRY_LINK_FUNC} first
-with no libraries, then for each library listed in @var{search-libs}.
+available.  This equates to calling
address@hidden([AC_LANG_CALL(address@hidden)])} first with no
+libraries, then for each library listed in @var{search-libs}.
 
 Add @address@hidden to @code{LIBS} for the first library found
 to contain @var{function}, and run @var{action-if-found}.  If the
@@ -5030,7 +4958,7 @@ this:
 The following macros check for C compiler or machine architecture
 features.  To check for characteristics not listed here, use
 @code{AC_COMPILE_IFELSE} (@pxref{Running the Compiler}) or
address@hidden (@pxref{Run Time})
address@hidden (@pxref{Run Time}).
 
 @defmac AC_C_BACKSLASH_A
 @acindex HAVE_C_BACKSLASH_A
@@ -5284,8 +5212,8 @@ @node Fortran 77 Compiler
 
 The following macros check for Fortran 77 compiler characteristics.  To
 check for characteristics not listed here, use @code{AC_COMPILE_IFELSE}
-(@pxref{Running the Compiler}) or @code{AC_TRY_RUN} (@pxref{Run Time}),
-making sure to first set the current language to Fortran 77
+(@pxref{Running the Compiler}) or @code{AC_RUN_IFELSE} (@pxref{Run
+Time}), making sure to first set the current language to Fortran 77
 @code{AC_LANG(Fortran 77)} (@pxref{Language Choice}).
 
 
@@ -6107,24 +6035,22 @@ @node Run Time
 
 If you really need to test for a run-time behavior while configuring,
 you can write a test program to determine the result, and compile and
-run it using @code{AC_TRY_RUN}.  Avoid running test programs if
+run it using @code{AC_RUN_IFELSE}.  Avoid running test programs if
 possible, because this prevents people from configuring your package for
 cross-compiling.
 
address@hidden AC_TRY_RUN (@var{program}, @ovar{action-if-true}, 
@ovar{action-if-false}, @ovar{action-if-cross-compiling})
address@hidden TRY_RUN
address@hidden AC_RUN_IFELSE (@var{input}, @ovar{action-if-found}, 
@ovar{action-if-not-found}, @ovar{action-if-cross-compiling})
address@hidden RUN_IFELSE
 If @var{program} compiles and links successfully and returns an exit
 status of 0 when executed, run shell commands @var{action-if-true}.
 Otherwise, run shell commands @var{action-if-false}.
 
-This macro double quotes @var{program}, the text of a program in the
-current language (@pxref{Language Choice}), on which shell variable and
-back quote substitutions are performed.  This macro uses @code{CFLAGS}
-or @code{CXXFLAGS}, @code{CPPFLAGS}, @code{LDFLAGS}, and @code{LIBS}
-when compiling.
+The @var{input} can be made by @code{AC_LANG_PROGRAM} and friends.  This
+macro uses @code{CFLAGS} or @code{CXXFLAGS}, @code{CPPFLAGS},
address@hidden, and @code{LIBS}
 
-If the C compiler being used does not produce executables that run on
-the system where @command{configure} is being run, then the test program is
+If the compiler being used does not produce executables that run on the
+system where @command{configure} is being run, then the test program is
 not run.  If the optional shell commands @var{action-if-cross-compiling}
 are given, they are run instead.  Otherwise, @command{configure} prints
 an error message and exits.
@@ -6141,24 +6067,24 @@ @node Run Time
 
 Try to provide a pessimistic default value to use when cross-compiling
 makes run-time tests impossible.  You do this by passing the optional
-last argument to @code{AC_TRY_RUN}.  @command{autoconf} prints a warning
-message when creating @command{configure} each time it encounters a call to
address@hidden with no @var{action-if-cross-compiling} argument
-given.  You may ignore the warning, though users will not be able to
-configure your package for cross-compiling.  A few of the macros
-distributed with Autoconf produce this warning message.
+last argument to @code{AC_RUN_IFELSE}.  @command{autoconf} prints a
+warning message when creating @command{configure} each time it
+encounters a call to @code{AC_RUN_IFELSE} with no
address@hidden argument given.  You may ignore the
+warning, though users will not be able to configure your package for
+cross-compiling.  A few of the macros distributed with Autoconf produce
+this warning message.
 
 To configure for cross-compiling you can also choose a value for those
 parameters based on the canonical system name (@pxref{Manual
 Configuration}).  Alternatively, set up a test results cache file with
 the correct values for the host system (@pxref{Caching Results}).
 
-To provide a default for calls of @code{AC_TRY_RUN} that are embedded in
-other macros, including a few of the ones that come with Autoconf, you
-can call @code{AC_PROG_CC} before running them.  Then, if the shell
-variable @code{cross_compiling} is set to @samp{yes}, use an alternate
-method to get the results instead of calling the macros.
-
+To provide a default for calls of @code{AC_RUN_IFELSE} that are embedded
+in other macros, including a few of the ones that come with Autoconf,
+you can test whether the shell variable @code{cross_compiling} is set to
address@hidden, and then use an alternate method to get the results instead
+of calling the macros.
 
 
 @node Systemology
@@ -6230,18 +6156,18 @@ @node Multiple Cases
 AC_MSG_CHECKING([how to get file system type])
 fstype=no
 # The order of these tests is important.
-AC_TRY_CPP([#include <sys/statvfs.h>
-#include <sys/fstyp.h>],
-           [AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/statvfs.h>
+#include <sys/fstyp.h>]])],
+                  [AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4])
 if test $fstype = no; then
-  AC_TRY_CPP([#include <sys/statfs.h>
-#include <sys/fstyp.h>],
-             [AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3])
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/statfs.h>
+#include <sys/fstyp.h>]])],
+                  [AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3])
 fi
 if test $fstype = no; then
-  AC_TRY_CPP([#include <sys/statfs.h>
-#include <sys/vmount.h>],
-             [AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX])
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/statfs.h>
+#include <sys/vmount.h>]])]),
+                  [AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX])
 fi
 # (more cases omitted here)
 AC_MSG_RESULT([$fstype])
@@ -7455,7 +7381,7 @@ @node Invoking autom4te
 
 @example
 AC_DEFUN([INNER],
-[AC_TRY_RUN([exit (0)])])
+[AC_RUN_IFELSE([AC_LANG_PROGRAM([exit (0)])])])
 
 AC_DEFUN([OUTER],
 [INNER])
@@ -7469,17 +7395,18 @@ AC_DEFUN([OUTER],
 
 @example
 $ @kbd{autom4te -l autoconf -Wcross}
-configure.ac:8: warning: AC_TRY_RUN called without default \
+configure.ac:8: warning: AC_RUN_IFELSE called without default \
 to allow cross compiling
-$ @kbd{autom4te -l autoconf -Wcross,error}
-configure.ac:8: error: AC_TRY_RUN called without default \
+$ @kbd{autom4te -l autoconf -Wcross,error -f}
+configure.ac:8: error: AC_RUN_IFELSE called without default \
 to allow cross compiling
-acgeneral.m4:3044: AC_TRY_RUN is expanded from...
+acgeneral.m4:3044: AC_RUN_IFELSE is expanded from...
 configure.ac:2: INNER is expanded from...
 configure.ac:5: OUTER is expanded from...
 configure.ac:8: the top level
 @end example
 
+
 @item --melt
 @itemx -m
 Do not use frozen files.  Any argument @address@hidden will be
@@ -8366,7 +8293,7 @@ @node Coding Style
                                   [ac_cv_emxos2=no])])
 @end example
 
-When using @code{AC_TRY_RUN} or any macro that cannot work when
+When using @code{AC_RUN_IFELSE} or any macro that cannot work when
 cross-compiling, provide a pessimistic value (typically @samp{no}).
 
 Feel free to use various tricks to prevent auxiliary tools, such as
@@ -12419,11 +12346,12 @@ @node Obsolete Macros
 
 @defmac AC_COMPILE_CHECK (@var{echo-text}, @var{includes}, 
@var{function-body}, @var{action-if-found}, @ovar{action-if-not-found})
 @acindex COMPILE_CHECK
-This is an obsolete version of @code{AC_TRY_COMPILE} (@pxref{Running the
-Compiler}), with the addition that it prints @samp{checking for
address@hidden to the standard output first, if @var{echo-text} is
-non-empty.  Use @code{AC_MSG_CHECKING} and @code{AC_MSG_RESULT} instead
-to print messages (@pxref{Printing Messages}).
+This is an obsolete version of @code{AC_TRY_COMPILE} itself replaced by
address@hidden (@pxref{Running the Compiler}), with the
+addition that it prints @samp{checking for @var{echo-text}} to the
+standard output first, if @var{echo-text} is non-empty.  Use
address@hidden and @code{AC_MSG_RESULT} instead to print
+messages (@pxref{Printing Messages}).
 @end defmac
 
 @defmac AC_CONST
@@ -12985,7 +12913,7 @@ is:
 
 @defmac AC_TEST_PROGRAM
 @acindex TEST_PROGRAM
address@hidden
address@hidden, replaced with @code{AC_RUN_IFELSE}.
 @end defmac
 
 @defmac AC_TIMEZONE
@@ -13057,6 +12985,14 @@ is:
 address@hidden)], address@hidden,
 address@hidden)}.
 @end defmac
+
address@hidden AC_TRY_RUN (@var{program}, @ovar{action-if-true}, 
@ovar{action-if-false}, @ovar{action-if-cross-compiling})
address@hidden TRY_RUN
+Same as @samp{AC_RUN_IFELSE([AC_LANG_SOURCE(address@hidden,
address@hidden, address@hidden,
address@hidden)} (@pxref{Run Time}).
address@hidden defmac
+
 
 @defmac AC_UID_T
 @acindex UID_T
Index: lib/autoconf/c.m4
--- lib/autoconf/c.m4 Sun, 27 Oct 2002 17:17:47 +0100 akim
+++ lib/autoconf/c.m4 Sun, 27 Oct 2002 18:35:56 +0100 akim
@@ -892,8 +892,8 @@ AC_DEFUN([AC_C_BIGENDIAN],
 #endif
 ])], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=no])],
 [# It does not; compile a test program.
-AC_TRY_RUN(
-[int
+AC_RUN_IFELSE(
+[AC_LANG_SOURCE([[int
 main ()
 {
   /* Are we little or big endian?  From Harbison&Steele.  */
@@ -904,7 +904,9 @@ AC_DEFUN([AC_C_BIGENDIAN],
   } u;
   u.l = 1;
   exit (u.c[sizeof (long) - 1] == 1);
-}], [ac_cv_c_bigendian=no], [ac_cv_c_bigendian=yes],
+}]])],
+              [ac_cv_c_bigendian=no],
+              [ac_cv_c_bigendian=yes],
 [# try to guess the endianness by grepping values into an object file
   ac_cv_c_bigendian=unknown
   AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Index: lib/autoconf/headers.m4
--- lib/autoconf/headers.m4 Sun, 27 Oct 2002 18:08:52 +0100 akim
+++ lib/autoconf/headers.m4 Sun, 27 Oct 2002 18:38:19 +0100 akim
@@ -586,13 +586,14 @@ AC_DEFUN([AC_HEADER_STDC],
 
 if test $ac_cv_header_stdc = yes; then
   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  AC_TRY_RUN(
-[#include <ctype.h>
+  AC_RUN_IFELSE([AC_LANG_SOURCE(
+[[#include <ctype.h>
 #if ((' ' & 0x0FF) == 0x020)
 # define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
 # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
 #else
-# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
+# define ISLOWER(c) \
+                   (('a' <= (c) && (c) <= 'i') \
                      || ('j' <= (c) && (c) <= 'r') \
                      || ('s' <= (c) && (c) <= 'z'))
 # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
@@ -608,7 +609,7 @@ AC_DEFUN([AC_HEADER_STDC],
         || toupper (i) != TOUPPER (i))
       exit(2);
   exit (0);
-}], , ac_cv_header_stdc=no, :)
+}]])], , ac_cv_header_stdc=no, :)
 fi])
 if test $ac_cv_header_stdc = yes; then
   AC_DEFINE(STDC_HEADERS, 1,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]