summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2017-06-14 21:03:34 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2017-06-14 21:06:13 +0300
commit74e285e77d204d15ef2dedd40483003c3d5746a7 (patch)
tree6d4d33bf86fc05fe8b75fe83f3ccc1c5777d0f33
parent7ae106db9767abe3f7716a50bb8b189e47083efe (diff)
downloadmailutils-74e285e77d204d15ef2dedd40483003c3d5746a7.tar.gz
mailutils-74e285e77d204d15ef2dedd40483003c3d5746a7.tar.bz2
Require bison and flex
These are needed only during development cycle, as the created sources are included in the tarball. * am/bison.m4: New file. * am/flex.m4: New file. * configure.ac: Use MU_PROG_BISON and MU_PROG_FLEX * mu-aux/gylwrap: Drop support for alternative command line syntax and the --stdout option.
-rw-r--r--am/bison.m411
-rw-r--r--am/flex.m412
-rw-r--r--configure.ac6
-rw-r--r--include/mailutils/types.hin9
-rwxr-xr-xmu-aux/gylwrap105
5 files changed, 57 insertions, 86 deletions
diff --git a/am/bison.m4 b/am/bison.m4
new file mode 100644
index 000000000..875b326d0
--- /dev/null
+++ b/am/bison.m4
@@ -0,0 +1,11 @@
+# bison.m4 serial 1
+AC_DEFUN([MU_PROG_BISON],
+[
+ if test "x$ac_cv_prog_YACC" = x; then
+ AC_PROG_YACC
+ if ! $YACC --version 2>/dev/null | grep -q '^bison '; then
+ YACC="$SHELL $missing_dir/missing bison"
+ fi
+ fi
+])
+
diff --git a/am/flex.m4 b/am/flex.m4
new file mode 100644
index 000000000..58d2c4b0a
--- /dev/null
+++ b/am/flex.m4
@@ -0,0 +1,12 @@
+# flex.m4 serial 1
+AC_DEFUN([MU_PROG_FLEX],
+[
+ if test "x$LEX" = x; then
+ AC_PROG_LEX
+ if ! $LEX --version 2>/dev/null | grep -q '^flex '; then
+ LEX="$SHELL $missing_dir/missing flex"
+ AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
+ AC_SUBST([LEXLIB], [''])
+ fi
+])
+
diff --git a/configure.ac b/configure.ac
index b0c551e4f..86bc16faf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -72,7 +72,7 @@ AC_SUBST(MU_LIB_COMMON_INCLUDES,'-I${top_builddir} -I${top_srcdir}/include -I${
AC_SUBST(MU_APP_COMMON_INCLUDES,'-I${srcdir} -I${top_srcdir}/include -I${top_srcdir}/lib -I${top_srcdir}/lib/gnu -I${top_builddir}/lib/gnu -I${top_builddir} -I${top_builddir}/include')
# Use our replacement for the ylwrap tool
-AC_SUBST([MU_YLWRAP],'$(mu_aux_dir)/gylwrap --compatibility --')
+AC_SUBST([MU_YLWRAP],'$(mu_aux_dir)/gylwrap --')
dnl Check for programs
AC_PROG_CC
@@ -83,8 +83,8 @@ AC_PROG_INSTALL
AC_PROG_LN_S
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
-AC_PROG_YACC
-AM_PROG_LEX
+MU_PROG_BISON
+MU_PROG_LEX
AM_PROG_LIBTOOL
## Predefine several variables used to display configuration status
diff --git a/include/mailutils/types.hin b/include/mailutils/types.hin
index fa729fbb5..5c15c6253 100644
--- a/include/mailutils/types.hin
+++ b/include/mailutils/types.hin
@@ -149,8 +149,13 @@ typedef unsigned int mu_debug_level_t;
#define MU_DEFAULT_RECORD _MU_DEFAULT_RECORD_
-/* The use of this structure and associated ioctl is deprecated. This
- definition is provided for transition period */
+/* This structure used to be called mu_locus in mailutils up to
+ 3.2.91-46 [release-3.2-71-g719e64a]. It is superseded by
+ structs mu_locus_point and mu_locus_range, defined in
+ <mailutils/locus.h>.
+
+ This definition is provided for backward compatibility. Authors are
+ urged to switch to the new API as soon as their time permits. */
struct mu_locus_DEPRECATED
{
char *mu_file;
diff --git a/mu-aux/gylwrap b/mu-aux/gylwrap
index 55cca6b11..7dc0cc468 100755
--- a/mu-aux/gylwrap
+++ b/mu-aux/gylwrap
@@ -35,22 +35,9 @@ gylwrap - wrapper for yacc, lex and similar programs
=head1 SYNOPSIS
B<gylwrap>
-[B<-c?>]
-[B<--compatibility>]
-[B<--yyrepl=>I<PREFIX>]
-[B<--yysym=>I<STRING>]
-[B<--stdout>]
-[B<--help>]
-[B<--version>]
-I<COMMAND>
-I<INPUT>
-I<OUTPUT> I<DESIRED>...
-
-B<ylwrap>
[B<-?>]
[B<--yyrepl=>I<PREFIX>]
[B<--yysym=>I<STRING>]
-[B<--stdout>]
[B<--help>]
[B<--version>]
I<INPUT>
@@ -66,9 +53,9 @@ symbols to avoid clashes when multiple parsers and/or lexers are
linked in a single executable.
To achieve this, B<gylwrap> creates a temporary directory, changes
-to it, and runs I<COMMAND> (which may contain arguments and options)
-with I<INPUT> as its last argument. Upon successful exit, it processes
-the I<OUTPUT> I<DESIRED> pairs. Each I<OUTPUT> file is then renamed
+to it, and runs I<PROGRAM>, with I<ARGS> and I<INPUT> as its arguments.
+Upon successful exit from I<PROGRAM>, B<gylwrap> processes the
+I<OUTPUT>-I<DESIRED> pairs. Each I<OUTPUT> file is then renamed
to the file I<DESIRED>, taking care to fix up any eventual B<#line>
directives.
@@ -78,18 +65,11 @@ For a list of symbols that are subject for replacement, inspect the
B<@sym> variable at the start of the script. Additional names can be
added to this list using the B<--yysym> option.
-If given the B<--compatibility> option or if invoked as B<ylwrap>,
-the tool runs in compatibility mode, mimicking the behavior of the
-standard B<ylwrap> utility from GNU Automake. Command line arguments
-consist of two lists, separated by B<-->. The left-hand side list
-supplies the I<OUTPUT>,I<DESIRED> pairs, and the right-hand side one
-supplies the command and its arguments.
-
-In both modes, prior to running the command, the program looks for file
-B<gylwrap.conf> in the same directory as the I<INPUT> file. If found,
-the file is sourced. Empty lines and comments (introduced by the hash
-sign) are ignored. Rest of lines are either option assignements, or
-section headings.
+Prior to running the I<PROGRAM>, B<gylwrap> program checks whether the
+file named B<gylwrap.conf> exists in directory of the I<INPUT> file.
+If found, it is parsed as follows. Empty lines and comments (introduced
+by the hash sign) are ignored. Rest of lines are either option
+assignements, or section headings.
Option assignements have the form B<I<OPTION> = I<VALUE>>, and generally,
have the same meaning as the corresponding command line option without
@@ -101,10 +81,6 @@ the leading two dashes:
Replace the B<yy> prefix with I<PREFIX> in the identifiers.
-=item B<stdout = 1>
-
-Enable the B<--stdout> option.
-
=item B<yysym => I<NAME>
Add I<NAME> to the list of symbols suitable for prefix replacement.
@@ -126,14 +102,6 @@ command line argument.
=over 4
-=item B<-c>, B<--compatibility>
-
-Run in compatibility mode.
-
-=item B<--stdout>
-
-Redirect I<COMMAND>'s standard output to the first I<OUTPUT>.
-
=item B<--yyrepl=>I<PREFIX>
Replace the B<yy> prefix in global symbols with I<PREFIX>.
@@ -233,9 +201,6 @@ my $yyrx;
# String to replace the "yy" prefix with.
my $yyrepl;
-# If set, redirect the stdout from the command to the first output file.
-my $stdout;
-
# Input directory with special characters escaped, for "#line" directive
# fixup.
my $input_rx;
@@ -244,14 +209,12 @@ my $input_rx;
# input file name. Default entry is ''.
my %config;
-# Name of the first output file. This is used in compatibility mode to
-# avoid bailing out if one of the output files (except the principal one)
-# does not exist.
+# Name of the first output file. This is used to avoid bailing out if
+# one of the output files (except the principal one) does not exist.
my $parser;
# Name this program was invoked as.
my $progname = basename($0);
-my $compat = $progname eq 'ylwrap'; # True if running in compatibility mode
# List of files created during the run, for cleanup purposes.
my @created;
@@ -261,9 +224,7 @@ sub filter {
my $target = basename($to);
my $ifd;
unless (open($ifd, '<', $from)) {
- if ($compat) {
- return if $from ne $parser;
- }
+ return if $from ne $parser;
die "can't open input file $from: $!";
}
open(my $ofd, '>', $to)
@@ -296,8 +257,8 @@ sub readconf {
} elsif (/^\[(.+)\]/) {
$key = $1;
} elsif (m/(.+?)\s*=\s*(.+)$/) {
- if ($1 eq 'yysym') {
- push @{$config{$key}{$1}}, $2;
+ if ($1 eq 'yysym' || $1 eq 'flags') {
+ push @{$config{$key}{$1}}, (split /\s+/, $2);
} else {
$config{$key}{$1} = $2;
}
@@ -308,28 +269,20 @@ sub readconf {
close($fd);
}
-my ($command, $input, @output);
+my $input;
+my @output;
GetOptions("yyrepl=s" => \$yyrepl,
"yysym=s@" => \@yysym,
- "stdout" => \$stdout,
- "compatibility|c" => \$compat,
"help|?" => sub {
pod2usage(-exitstatus => 0, -verbose => 2);
}
) or exit(1);
-if ($compat) {
- $input = shift @ARGV;
- while (my $arg = shift @ARGV) {
- last if ($arg eq '--');
- push @output, $arg;
- }
- $command = join(' ', @ARGV);
-} else {
- pod2usage(-exitstatus => 1, -verbose => 0, -output => \*STDERR)
- unless @ARGV >= 2;
- ($command, $input, @output) = @ARGV;
+$input = shift @ARGV;
+while (my $arg = shift @ARGV) {
+ last if ($arg eq '--');
+ push @output, $arg;
}
pod2usage(-exitstatus => 1, -verbose => 0, -output => \*STDERR)
@@ -345,9 +298,6 @@ my $confile = "$input_dir/gylwrap.conf";
readconf($confile) if -r $confile;
my $input_base = basename($input);
-unless ($stdout) {
- $stdout = $config{$input_base}{stdout} || $config{''}{stdout};
-}
unless ($yyrepl) {
$yyrepl = $config{$input_base}{yyrepl} || $config{''}{yyrepl};
}
@@ -361,20 +311,13 @@ if ($yyrepl) {
}
}
-my $prog = $command;
-$prog =~ s/\s.*$//;
-
if (my $flags = $config{$input_base}{flags} || $config{''}{flags}) {
- $command .= ' ' . $flags;
+ push @ARGV, @$flags;
}
+push @ARGV, $input;
$parser = $output[0];
-$command .= ' '.$input;
-if ($stdout) {
- $command .= '>'.$parser;
-}
-
# Create working directory
my $wd = tempdir("ylXXXXXX", DIR => '.', CLEANUP => 1)
or die "cannot create temporary directory";
@@ -387,12 +330,12 @@ END {
chdir "..";
}
-system($command);
+system(@ARGV);
if ($? == -1) {
- print STDERR "$prog: $!\n";
+ print STDERR "$ARGV[0]: $!\n";
exit(127);
} elsif ($? & 127) {
- print STDERR "$prog died with signal ".($? & 127)."\n";
+ print STDERR "$ARGV[0] died with signal ".($? & 127)."\n";
exit(127);
} else {
my $code = $? >> 8;

Return to:

Send suggestions and report system problems to the System administrator.