]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Rely on `$LINENO' when possible instead of `__oline__'.
authorAkim Demaille <akim@epita.fr>
Sat, 22 Sep 2001 15:20:44 +0000 (15:20 +0000)
committerAkim Demaille <akim@epita.fr>
Sat, 22 Sep 2001 15:20:44 +0000 (15:20 +0000)
* lib/m4sugar/m4sh.m4 (AS_SHELL_SANITIZE): Provide some form of
`$LINENO' support replacement when not supported.
(_AS_CR_PREPARE, _AS_TR_CPP_PREPARE, _AS_TR_SH_PREPARE): Invoke
them explicitly to be sure they are not output before this section
(via m4_require).  Cosmetic only.
* lib/autoconf/c.m4, lib/autoconf/general.m4,
* lib/autoconf/programs.m4: Replace all the occurrences of
`__oline__' with `$LINENO'.
* doc/autoconf.texi (Special Shell Variables): Document LINENO.

ChangeLog
NEWS
doc/autoconf.texi
lib/autoconf/c.m4
lib/autoconf/general.m4
lib/autoconf/programs.m4
lib/m4sugar/m4sh.m4

index 548549183838d4e6a121c0c83f4840e57da249b8..9c35ac11404a075c4489a31cf56ce383c98a9447 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2001-09-22  Akim Demaille  <akim@epita.fr>
+
+       Rely on `$LINENO' when possible instead of `__oline__'.
+
+       * lib/m4sugar/m4sh.m4 (AS_SHELL_SANITIZE): Provide some form of
+       `$LINENO' support replacement when not supported.
+       (_AS_CR_PREPARE, _AS_TR_CPP_PREPARE, _AS_TR_SH_PREPARE): Invoke
+       them explicitly to be sure they are not output before this section
+       (via m4_require).  Cosmetic only.
+       * lib/autoconf/c.m4, lib/autoconf/general.m4,
+       * lib/autoconf/programs.m4: Replace all the occurrences of
+       `__oline__' with `$LINENO'.
+       * doc/autoconf.texi (Special Shell Variables): Document LINENO.
+
 2001-09-21  Tim Van Holder  <tim.van.holder@pandora.be>
 
        * lib/autoconf/functions.m4 (_AC_FUNC_FORK): Replaceded an 8-bit
diff --git a/NEWS b/NEWS
index 989cb46a700076e4daf1058566b8671ae581a080..e9ba3da8c5eb315a07808c839cd4582fa1674c74 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,8 @@
 * Major changes in Autoconf 2.52e                       -*- outline -*-
-** Licensing
-  The Autoconf manual is now distributed under the terms of the GNU FDL.
+
 ** Requirements
-  Perl 5.005 is now required to run Autoconf.
+  Perl 5.005 is required.
+
 ** Documentation
 - AC_INIT
   Argument requirements, output variables, defined macros.
   First sketch of its documentation.
 - Double quoting macros
   AC_TRY_CPP, AC_TRY_COMPILE, AC_TRY_LINK and AC_TRY_RUN.
+- Licensing
+  The Autoconf manual is now distributed under the terms of the GNU FDL.
+
+** $LINENO
+  Is now used instead of hard coded line numbers.
+  This eases the comparison of `configure's, and diminishes the
+  pressure over control version archives.
+  Automatic replacement for shells that don't support this feature.
+
 ** autom4te
   New executable, used by the Autoconf suite to cache and speed up
-  some processing.
+  most processing.
+
 ** Standardization of the executables interface
 - --force, -f
   Supported by autom4te, autoconf and autoheader.
 - --include, -I
   Replaces --autoconf-dir and --localdir in autoconf, autoheader and
   autoupdate.
+
 ** Bug fixes
 - The top level $prefix is propagated to the AC_CONFIG_SUBDIRS configures.
+
 ** C Macros
 - AC_C_BIGENDIAN supports the cross-compiling case.
 - AC_C_BIGENDIAN accepts ACTION-IF-TRUE, ACTION-IF-FALSE, and
   ACTION-IF-UNKNOWN arguments.  All are facultative, and the default
   for ACTION-IF-TRUE is to define WORDS_BIGENDIAN like AC_C_BIGENDIAN
   always did.
+
 ** Generic macros
 - AC_CONFIG_COMMANDS, HEADERS, FILES, LINKS.
   Provide the user with srcdir, ac_top_srcdir, ac_top_builddir, ac_srcdir.
index 9a79712249d8c50702ed7dd8d4cccad10da10592..9c0aee241f23178a5561b371c73e21ab582e1c83 100644 (file)
@@ -8139,6 +8139,52 @@ characters explicitly instead of relying on ranges.
 using @samp{C} as a fall back value. see @ref{Limitations of Builtins},
 builtin @command{unset}, for more details.
 
+@item LINENO
+@evindex LINENO
+Most modern shells provide the current line number in @code{LINENO}.
+Its value is the line number of the beginning of the current command
+(see below the output of the here document).  The behavior wrt
+@command{eval} differs according to the shell, but, amusingly, not in
+the case of sub shells:
+
+@example
+@group
+$ cat lineno
+echo 1. $LINENO
+cat <<EOF
+3. $LINENO
+4. $LINENO
+EOF
+( echo 6. $LINENO )
+eval 'echo 7. $LINENO'
+@end group
+@group
+$ ash lineno
+1.
+3.
+4.
+6.
+7.
+@end group
+@group
+$ bash-2.03 lineno
+1. 1
+3. 2
+4. 2
+6. 6
+7. 1
+@end group
+@group
+$ zsh-3.1.9 lineno
+1. 1
+3. 2
+4. 2
+6. 6
+7. 7
+@end group
+@end example
+
+
 @item NULLCMD
 @evindex NULLCMD
 When executing the command @samp{>foo}, @command{zsh} executes
index a26dbba249c599adc64079beee44168e9a588a9b..d8dded2c1c9ff7c1e8c61a931936231711d816ed 100644 (file)
@@ -119,9 +119,9 @@ m4_define([_AC_LANG_ABBREV(C++)], [cxx])
 # AC_LANG_SOURCE(C)(BODY)
 # -----------------------
 # This sometimes fails to find confdefs.h, for some reason.
-# #line __oline__ "$[0]"
+# #line $LINENO "$[0]"
 m4_define([AC_LANG_SOURCE(C)],
-[#line __oline__ "configure"
+[#line $LINENO "configure"
 #include "confdefs.h"
 $1])
 
@@ -420,7 +420,7 @@ fi
 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
 
 # Provide some information about the compiler.
-echo "$as_me:__oline__:" \
+echo "$as_me:$LINENO:" \
      "checking for _AC_LANG compiler version" >&AS_MESSAGE_LOG_FD
 ac_compiler=`set X $ac_compile; echo $[2]`
 _AC_EVAL([$ac_compiler --version </dev/null >&AS_MESSAGE_LOG_FD])
@@ -631,7 +631,7 @@ AC_CHECK_TOOLS(CXX,
                g++)
 
 # Provide some information about the compiler.
-echo "$as_me:__oline__:" \
+echo "$as_me:$LINENO:" \
      "checking for _AC_LANG compiler version" >&AS_MESSAGE_LOG_FD
 ac_compiler=`set X $ac_compile; echo $[2]`
 _AC_EVAL([$ac_compiler --version </dev/null >&AS_MESSAGE_LOG_FD])
index a2c2e8dc322589040cd6df56026d2d13bf4b27de..445601b4a75399ab012d760be967a5f11853f717 100644 (file)
@@ -1936,7 +1936,7 @@ m4_define([AC_WARNING],
 # AC_MSG_CHECKING(FEATURE)
 # ------------------------
 m4_define([AC_MSG_CHECKING],
-[_AS_ECHO([$as_me:__oline__: checking $1], AS_MESSAGE_LOG_FD)
+[_AS_ECHO([$as_me:$LINENO: checking $1], AS_MESSAGE_LOG_FD)
 _AS_ECHO_N([checking $1... ])[]dnl
 ])
 
@@ -1944,7 +1944,7 @@ _AS_ECHO_N([checking $1... ])[]dnl
 # AC_MSG_RESULT(RESULT)
 # ---------------------
 m4_define([AC_MSG_RESULT],
-[_AS_ECHO([$as_me:__oline__: result: $1], AS_MESSAGE_LOG_FD)
+[_AS_ECHO([$as_me:$LINENO: result: $1], AS_MESSAGE_LOG_FD)
 _AS_ECHO([${ECHO_T}$1])[]dnl
 ])
 
@@ -1953,7 +1953,7 @@ _AS_ECHO([${ECHO_T}$1])[]dnl
 # ------------------------------
 # Likewise, but perform $ ` \ shell substitutions.
 m4_define([AC_MSG_RESULT_UNQUOTED],
-[_AS_ECHO_UNQUOTED([$as_me:__oline__: result: $1], AS_MESSAGE_LOG_FD)
+[_AS_ECHO_UNQUOTED([$as_me:$LINENO: result: $1], AS_MESSAGE_LOG_FD)
 _AS_ECHO_UNQUOTED([${ECHO_T}$1])[]dnl
 ])
 
@@ -1994,7 +1994,7 @@ AC_DEFUN([_AC_RUN_LOG],
 [{ ($2) >&AS_MESSAGE_LOG_FD
   ($1) 2>&AS_MESSAGE_LOG_FD
   ac_status=$?
-  echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+  echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
   (exit $ac_status); }])
 
 
@@ -2010,7 +2010,7 @@ AC_DEFUN([_AC_RUN_LOG_STDERR],
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&AS_MESSAGE_LOG_FD
-  echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+  echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
   (exit $ac_status); }])
 
 
@@ -2019,7 +2019,7 @@ AC_DEFUN([_AC_RUN_LOG_STDERR],
 # Eval COMMAND, save the exit status in ac_status, and log it.
 AC_DEFUN([_AC_EVAL],
 [_AC_RUN_LOG([eval $1],
-             [eval echo "$as_me:__oline__: \"$1\""])])
+             [eval echo "$as_me:$LINENO: \"$1\""])])
 
 
 # _AC_EVAL_STDERR(COMMAND)
@@ -2029,7 +2029,7 @@ AC_DEFUN([_AC_EVAL],
 # Note that when tracing, most shells will leave the traces in stderr
 AC_DEFUN([_AC_EVAL_STDERR],
 [_AC_RUN_LOG_STDERR([eval $1],
-                    [eval echo "$as_me:__oline__: \"$1\""])])
+                    [eval echo "$as_me:$LINENO: \"$1\""])])
 
 
 # AC_TRY_EVAL(VARIABLE)
@@ -2051,7 +2051,7 @@ AC_DEFUN([AC_TRY_COMMAND],
 # -------------------
 AC_DEFUN([AC_RUN_LOG],
 [_AC_RUN_LOG([$1],
-             [echo "$as_me:__oline__: AS_ESCAPE([$1])"])])
+             [echo "$as_me:$LINENO: AS_ESCAPE([$1])"])])
 
 
 ## ------------------ ##
index d1b656851f00f24fe10a9463580ea66f6001cae9..d4ddbf70f8bbfda775650d96e3b573ea4ba6338b 100644 (file)
@@ -78,7 +78,7 @@ m4_ifvaln([$6],
        continue
      fi])dnl
     ac_cv_prog_$1="$3"
-    echo "$as_me:__oline__: found $as_dir/$ac_word$ac_exec_ext" >&AS_MESSAGE_LOG_FD
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&AS_MESSAGE_LOG_FD
     break 2
   fi
 done])
@@ -146,7 +146,7 @@ AC_CACHE_VAL([ac_cv_path_$1],
 [for ac_exec_ext in '' $ac_executable_extensions; do
   if AS_EXECUTABLE_P(["$as_dir/$ac_word$ac_exec_ext"]); then
     ac_cv_path_$1="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:__oline__: found $as_dir/$ac_word$ac_exec_ext" >&AS_MESSAGE_LOG_FD
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&AS_MESSAGE_LOG_FD
     break 2
   fi
 done])
index 962f8f7cc8aa7846710859f958047e3c34a883ac..76c727b077b0171994bf6e024a1ed04f9396e4da 100644 (file)
@@ -112,12 +112,45 @@ fi
 # Name of the executable.
 as_me=`AS_BASENAME($[0])`
 
+# If LINENO is not supported by the shell, produce a version of this
+# script where LINENO is hard coded.  Rewrite if not up to date only.
+# Comparing LINENO against _oline_ is not a good solution, since in
+# the case of embedded executables (such as config.status within
+# configure) you'd compare LINENO wrt config.status vs. _oline_ vs
+# configure.  Hence a useless rewrite (not to mention the risk of
+# ``infinite'' rewrites.  Merely check that LINENO is incremented
+# between two lines, which is a property guaranteed for _oline_, hence
+# it protects us from repetitive rewrites.
+as_lineno_1=$LINENO
+as_lineno_2=$LINENO
+# Compute as_lineno_1 in two steps: some shells restart LINENO for
+# subshells.
+as_lineno_1=`(expr $as_lineno_1 + 1) 2>/dev/null`
+if test "x$as_lineno_1" != "x$as_lineno_2"; then
+  if test ! -f $as_me.lineno ||
+     test x`ls -1dt $as_me.lineno $as_me 2>/dev/null | sed 1q` \
+                != x$as_me.lineno; then
+     # Be sure to write the pattern so that it doesn't replace itself:
+     # it must not match itself.
+     awk '{
+            if ($[0] ~ /[[$]]LINENO/)
+              while (sub (/[[$]]LINENO/, NR))
+                continue
+            print
+          }' <$as_me >$as_me.lineno
+    chmod +x $as_me.lineno
+  fi
+  exec ${SHELL-/bin/sh} ./$as_me.lineno
+fi
+
+_AS_CR_PREPARE
 _AS_ECHO_N_PREPARE
 _AS_EXPR_PREPARE
 _AS_LN_S_PREPARE
 _AS_PATH_SEPARATOR_PREPARE
 _AS_TEST_PREPARE
-_AS_TR_PREPARE
+_AS_TR_CPP_PREPARE
+_AS_TR_SH_PREPARE
 _AS_UNSET_PREPARE
 
 # NLS nuisances.
@@ -303,7 +336,7 @@ m4_define([_AS_ECHO_N],
 # ----------------------------------------
 m4_define([AS_MESSAGE],
 [m4_ifset([AS_MESSAGE_LOG_FD],
-          [{ _AS_ECHO([$as_me:__oline__: $1], [AS_MESSAGE_LOG_FD])
+          [{ _AS_ECHO([$as_me:$LINENO: $1], [AS_MESSAGE_LOG_FD])
 _AS_ECHO([$as_me: $1], [$2]);}],
           [_AS_ECHO([$as_me: $1], [$2])])[]dnl
 ])