autoconf-patches
[Top][All Lists]
Advanced

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

FYI: Forbid LIBOBJ


From: Akim Demaille
Subject: FYI: Forbid LIBOBJ
Date: 07 Nov 2001 20:30:49 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

Users must not use LIBOBJS, because sh assignments are not visible if
you don't dig into configure, which Automake must not do.  Anything
that must be visible has to be done via a macro.

This is why I apply the following patch: to let the users know that
LIBOBJS must not be used, only AC_LIBOBJS etc. can.  Then Automake
will be able to move to traces peacefully.

BTW, now we now longer smash the multiple white lines.  I don't know
what is producing these lines, but this is typically why I had
implemented --smash.

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * lib/m4sugar/m4sugar.m4 (m4_pattern_forbid): Accepts $2.
        * lib/autoconf/general.m4 (AC_INTI): Forbid LIBOBJS.
        (_AC_LIBOBJ): s/LIBOBJS/LIB@&address@hidden/.
        * bin/autom4te.in (warn_forbidden): New.
        (handle_output): Use it.
        Read m4_pattern_forbid with messages.

Index: bin/autom4te.in
===================================================================
RCS file: /cvs/autoconf/bin/autom4te.in,v
retrieving revision 1.52
diff -u -u -r1.52 autom4te.in
--- bin/autom4te.in 2001/11/05 17:39:34 1.52
+++ bin/autom4te.in 2001/11/07 19:30:29
@@ -587,6 +587,29 @@
 }
 
 
+# warn_forbidden ($WHERE, $WORD, %FORBIDDEN)
+# ------------------------------------------
+# $WORD is forbidden.  Warn with a dedicated error message if in
+# %FORBIDDEN, otherwise, a simple `error: possibly undefined macro'
+# will do.
+sub warn_forbidden ($$%)
+{
+  my ($where, $word, %forbidden) = @_;
+  my $message;
+
+  for my $re (sort keys %forbidden)
+    {
+      if ($word =~ $re)
+       {
+         $message = $forbidden{$re};
+         last;
+       }
+    }
+  $message ||= "possibly undefined macro: $word";
+  warn "$where: error: $message\n";
+}
+
+
 # handle_output ($REQ, $OUTPUT)
 # -----------------------------
 # Run m4 on the input files, perform quadrigraphs substitution, check for
@@ -599,14 +622,18 @@
 
   # Load the forbidden/allowed patterns.
   handle_traces ($req, "$tmp/patterns",
-                ('m4_pattern_forbid' => 'forbid:$1',
+                ('m4_pattern_forbid' => 'forbid:$1:$2',
                  'm4_pattern_allow'  => 'allow:$1'));
   my @patterns = new Autom4te::XFile ("$tmp/patterns")->getlines;
   chomp @patterns;
-  my $forbidden = join ('|', map { /^forbid:(.*)/ } @patterns) || "^\$";
-  my $allowed   = join ('|', map { /^allow:(.*)/  } @patterns) || "^\$";
+  my %forbidden =
+    map { /^forbid:([^:]+):.+$/ => /^forbid:[^:]+:(.+)$/ } @patterns;
+  my $forbidden = join ('|', map { /^forbid:([^:]+)/ } @patterns) || "^\$";
+  my $allowed   = join ('|', map { /^allow:([^:]+)/  } @patterns) || "^\$";
 
   verbose "forbidden tokens: $forbidden";
+  verbose "forbidden token : $_ => $forbidden{$_}"
+    foreach (sort keys %forbidden);
   verbose "allowed   tokens: $allowed";
 
   # Read the (cached) raw M4 output, produce the actual result.  We
@@ -675,15 +702,16 @@
       # Complain once per word, but possibly several times per line.
       while (/$prohibited/)
        {
-         warn "$ARGV[$#ARGV]:$.: error: possibly undefined macro: $1\n";
-         delete $prohibited{$1};
+         my $word = $1;
+         warn_forbidden ("$ARGV[$#ARGV]:$.", $word, %forbidden);
+         delete $prohibited{$word};
          # If we're done, exit.
          return
            if ! %prohibited;
          $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b';
        }
     }
-  warn "$output:$prohibited{$_}: error: possibly undefined macro: $_\n"
+  warn_forbidden ("$output:$prohibited{$_}", $_, %forbidden)
     foreach (sort { $prohibited{$a} <=> $prohibited{$b} } keys %prohibited);
 }
 
Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvs/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.776
diff -u -u -r1.776 general.m4
--- lib/autoconf/general.m4 2001/10/18 23:40:44 1.776
+++ lib/autoconf/general.m4 2001/11/07 19:30:29
@@ -1224,6 +1224,8 @@
 [# Forbidden tokens and exceptions.
 m4_pattern_forbid([^_?A[CHUM]_])
 m4_pattern_forbid([_AC_])
+m4_pattern_forbid([^LIBOBJS$],
+                  [do not use LIBOBJ directly, use AC_LIBOBJS])
 # Actually reserved by M4sh.
 m4_pattern_allow([^AS_FLAGS$])
 AS_INIT
@@ -2342,8 +2344,8 @@
 [AS_LITERAL_IF([$1],
                [AC_LIBSOURCE([$1.c])],
                [$2])dnl
-AC_SUBST([LIBOBJS])dnl
-LIBOBJS="$LIBOBJS $1.$ac_objext"])
+AC_SUBST([LIB@&address@hidden)dnl
+LIB@&address@hidden"$LIB@&address@hidden $1.$ac_objext"])
 
 
 # AC_LIBOBJ(FILENAME-NOEXT)
Index: lib/m4sugar/m4sugar.m4
===================================================================
RCS file: /cvs/autoconf/lib/m4sugar/m4sugar.m4,v
retrieving revision 2.58
diff -u -u -r2.58 m4sugar.m4
--- lib/m4sugar/m4sugar.m4 2001/10/08 08:22:49 2.58
+++ lib/m4sugar/m4sugar.m4 2001/11/07 19:30:29
@@ -1222,8 +1222,8 @@
                          [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])])
 
 
-# m4_pattern_forbid(ERE)
-# ----------------------
+# m4_pattern_forbid(ERE, [WHY])
+# -----------------------------
 # Declare that no token matching the extended regular expression ERE
 # should be seen in the output but if...
 m4_define([m4_pattern_forbid], [])
Index: configure
===================================================================
RCS file: /cvs/autoconf/configure,v
retrieving revision 1.187
diff -u -u -r1.187 configure
--- configure 2001/11/05 17:39:33 1.187
+++ configure 2001/11/07 19:30:29
@@ -15,6 +15,7 @@
   as_expr=false
 fi
 
+
 ## --------------------- ##
 ## M4sh Initialization.  ##
 ## --------------------- ##
@@ -60,6 +61,7 @@
     { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } ||
       { LC_MESSAGES=C; export LC_MESSAGES; }
 
+
 # Name of the executable.
 as_me=`(basename "$0") 2>/dev/null ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
@@ -93,6 +95,7 @@
   rm -f conftest.sh
 fi
 
+
   as_lineno_1=$LINENO
   as_lineno_2=$LINENO
   as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
@@ -177,6 +180,7 @@
   exit
 }
 
+
 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
   *c*,-n*) ECHO_N= ECHO_C='
 ' ECHO_T='     ' ;;
@@ -216,6 +220,7 @@
 # Sed expression to map a string onto a valid variable name.
 as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
 
+
 # IFS
 # We need space, tab and new line, in precisely that order.
 as_nl='
@@ -225,6 +230,7 @@
 # CDPATH.
 $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; 
export CDPATH; }
 
+
 # Name of the host.
 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
 # so uname gets run too.
@@ -644,6 +650,7 @@
 
 test "$silent" = yes && exec 6>/dev/null
 
+
 # Find the source files, if location was not specified.
 if test -z "$srcdir"; then
   ac_srcdir_defaulted=yes
@@ -895,12 +902,14 @@
 
 cat >&5 <<_ACEOF
 
+
 ## ----------- ##
 ## Core tests. ##
 ## ----------- ##
 
 _ACEOF
 
+
 # Keep a trace of the command line.
 # Strip out --no-create and --no-recursion so they do not pile up.
 # Also quote any args containing shell meta-characters.
@@ -1073,6 +1082,33 @@
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext 
$LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 ac_aux_dir=
 for ac_dir in config $srcdir/config; do
   if test -f $ac_dir/install-sh; then
@@ -1100,6 +1136,7 @@
 
 ac_config_files="$ac_config_files config/Makefile"
 
+
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
 # incompatible versions:
@@ -1154,6 +1191,7 @@
 esac
 done
 
+
 fi
   if test "${ac_cv_path_install+set}" = set; then
     INSTALL=$ac_cv_path_install
@@ -1234,6 +1272,7 @@
 program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
 rm conftest.sed
 
+
 # expand $ac_aux_dir to an absolute path
 am_aux_dir=`cd $ac_aux_dir && pwd`
 
@@ -1327,6 +1366,7 @@
   AMDEPBACKSLASH='\'
 fi
 
+
 if test "x$enable_dependency_tracking" != xno; then
   AMDEP_TRUE=
   AMDEP_FALSE='#'
@@ -1335,6 +1375,9 @@
   AMDEP_FALSE=
 fi
 
+
+
+
 rm -f .deps 2>/dev/null
 mkdir .deps 2>/dev/null
 if test -d .deps; then
@@ -1345,6 +1388,7 @@
 fi
 rmdir .deps 2>/dev/null
 
+
 # test to see if srcdir already configured
 if test "`cd $srcdir && pwd`" != "`pwd`" &&
    test -f $srcdir/config.status; then
@@ -1361,10 +1405,12 @@
 #define PACKAGE "$PACKAGE"
 _ACEOF
 
+
 cat >>confdefs.h <<_ACEOF
 #define VERSION "$VERSION"
 _ACEOF
 
+
 # Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
 # the ones we care about.
 
@@ -1372,14 +1418,19 @@
 
 ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal"}
 
+
 AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
 
+
 AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake"}
 
+
 AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
 
+
 MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 
+
 AMTAR=${AMTAR-"${am_missing_run}tar"}
 
 install_sh=${install_sh-"$am_aux_dir/install-sh"}
@@ -1389,11 +1440,14 @@
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
 
+
 # Initialize the test suite and build position independent wrappers.
 ac_config_commands="$ac_config_commands tests/package.m4"
 
+
 ac_config_commands="$ac_config_commands tests/atconfig"
 
+
 ac_config_files="$ac_config_files tests/Makefile tests/atlocal"
 
 ac_config_files="$ac_config_files tests/autoconf:tests/wrapsh.in"
@@ -1449,6 +1503,8 @@
 echo "${ECHO_T}no" >&6
 fi
 
+
+
 # We use a path for GNU m4 so even if users have another m4 first in
 # their path, the installer can configure with a path that has GNU m4
 # first and get that path embedded in the installed autoconf and
@@ -1520,11 +1576,14 @@
 # This is needed because Automake does not seem to realize there is
 # a AC-SUBST inside AC-PROG-GNU-M4.  Grmph!
 
+
 # Man pages.
 ac_config_files="$ac_config_files man/Makefile"
 
+
 HELP2MAN=${HELP2MAN-"${am_missing_run}help2man"}
 
+
 # We use a path for perl so the #! line in autoscan will work.
 # Extract the first word of "perl", so it can be a program name with args.
 set dummy perl; ac_word=$2
@@ -1580,6 +1639,7 @@
 # Emacs modes.
 ac_config_files="$ac_config_files lib/emacs/Makefile"
 
+
 # Check whether --with-lispdir or --without-lispdir was given.
 if test "${with_lispdir+set}" = set; then
   withval="$with_lispdir"
@@ -1665,11 +1725,17 @@
 
 fi;
 
+
+
 # Automake can't see inner AC_SUBSTS (`aclocal' is bypassed), so we tag the
 # AC_SUBSTS here too.
 
+
+
+
 ac_config_files="$ac_config_files Makefile doc/Makefile lib/Makefile 
lib/Autom4te/Makefile lib/autoscan/Makefile lib/m4sugar/Makefile 
lib/autoconf/Makefile lib/autotest/Makefile bin/Makefile"
 
+
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -1776,6 +1842,8 @@
 DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
 rm -f confdef2opt.sed
 
+
+
 : ${CONFIG_STATUS=./config.status}
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
@@ -1839,6 +1907,7 @@
     { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } ||
       { LC_MESSAGES=C; export LC_MESSAGES; }
 
+
 # Name of the executable.
 as_me=`(basename "$0") 2>/dev/null ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
@@ -1872,6 +1941,7 @@
   rm -f conftest.sh
 fi
 
+
   as_lineno_1=$LINENO
   as_lineno_2=$LINENO
   as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
@@ -1958,6 +2028,7 @@
   exit
 }
 
+
 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
   *c*,-n*) ECHO_N= ECHO_C='
 ' ECHO_T='     ' ;;
@@ -1997,6 +2068,7 @@
 # Sed expression to map a string onto a valid variable name.
 as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
 
+
 # IFS
 # We need space, tab and new line, in precisely that order.
 as_nl='
@@ -2166,8 +2238,11 @@
 PACKAGE_STRING='$PACKAGE_STRING'
 PACKAGE_BUGREPORT='$PACKAGE_BUGREPORT'
 
+
 _ACEOF
 
+
+
 cat >>$CONFIG_STATUS <<\_ACEOF
 for ac_config_target in $ac_config_targets
 do
@@ -2424,6 +2499,7 @@
 ac_srcpath=`cd "$ac_dir" && cd $ac_srcdir && pwd`
 ac_top_srcpath=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
 
+
   case $INSTALL in
   [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
   *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
@@ -2563,6 +2639,7 @@
 ac_srcpath=`cd "$ac_dir" && cd $ac_srcdir && pwd`
 ac_top_srcpath=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
 
+
   { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
 echo "$as_me: executing $ac_dest commands" >&6;}
   case $ac_dest in
@@ -2605,6 +2682,7 @@
 chmod +x $CONFIG_STATUS
 ac_clean_files=$ac_clean_files_save
 
+
 # configure is writing to config.log, and then calls config.status.
 # config.status does its own redirection, appending to config.log.
 # Unfortunately, on DOS this fails, as config.log is still kept open
@@ -2631,5 +2709,7 @@
 
 Below you will find information on the status of this version of Autoconf.
 
+
 EOF
     sed -n '/^\* Status/,$p' $srcdir/BUGS
+



reply via email to

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