automake-patches
[Top][All Lists]
Advanced

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

[PATCH] Support `missing PROGNAME --version' (was Re: CONFIGURED_MAKEINF


From: Paolo Bonzini
Subject: [PATCH] Support `missing PROGNAME --version' (was Re: CONFIGURED_MAKEINFO and files sprayed into the build directory)
Date: Mon, 23 Aug 2004 09:25:50 +0200
User-agent: Mozilla Thunderbird 0.5 (Windows/20040207)

The problem arises when makeinfo is not installed.  When this is the
case, ${CONFIGURED_MAKEINFO} is set to "missing makeinfo".  It doesn't
really make sense to run `missing makeinfo --version'.  When `missing'
is run in this way, this fragement leads to $file containing the
output of sed --version:

    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
    if test -z "$file"; then
      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
       file=`sed -n '/address@hidden/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
    fi
    touch $file
>
Arguably, missing could be fixed, but I think it makes more sense to
not run missing in this way.  What do you think?  Should the Makefile
fragment just make sure the first word of ${CONFIGURED_MAKEINFO} is
not `missing' before running it with --version?

I'd rather fix missing since it is easy to do and it may as well help other programs. Here is a patch against Automake 1.9.1's script, which I'd like to import if the patch is accepted upstream.

In addition, this patch checks if flex and bison failed, trying to pass it --version. Before this patch, flex/lex and bison/yacc were grouped together, and since lex/yacc do not support --version it was not tried even for flex/bison.

Alexandre, is it ok for 1.9 branch and HEAD? (I do not have CVS access for Automake).

2004-08-22  Paolo Bonzini  <address@hidden>

        * missing: Handle all command line options together.  Add a
        separate case statement to detect failed runs, and fail
        silently there if --help or --version is passed to the program.

Paolo
--- missing.old 2003-09-06 23:10:39.000000000 +0200
+++ missing     2004-08-23 09:10:16.000000000 +0200
@@ -60,11 +60,6 @@
     msg="probably too old"
   fi
   ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case "$1" in
 
   -h|--h|--he|--hel|--help)
     echo "\
@@ -92,10 +87,12 @@
   yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
 
 Send bug reports to <address@hidden>."
+    exit 0
     ;;
 
   -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
     echo "missing $scriptversion (GNU Automake)"
+    exit 0
     ;;
 
   -*)
@@ -104,12 +101,41 @@
     exit 1
     ;;
 
-  aclocal*)
+esac
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+  lex|yacc)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  tar)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    fi
+    if test "x$2" == "x--version"; then
+       exit 1
+    fi
+    ;;
+
+  *)
     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
        # We have it, but it failed.
        exit 1
     fi
+    if test "x$2" == "x--version" || test "x$1" == "x--help"; then
+       exit 1
+    fi
+    ;;
+esac
 
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+  aclocal*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
@@ -119,11 +145,6 @@
     ;;
 
   autoconf)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`${configure_ac}'.  You might want to install the
@@ -133,11 +154,6 @@
     ;;
 
   autoheader)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`acconfig.h' or \`${configure_ac}'.  You might want
@@ -157,11 +173,6 @@
     ;;
 
   automake*)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
@@ -173,11 +184,6 @@
     ;;
 
   autom4te)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is needed, but is $msg.
          You might have modified some files without having the
@@ -254,11 +260,6 @@
     ;;
 
   help2man)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
         you modified a dependency of a manual page.  You may need the
@@ -279,11 +280,6 @@
     ;;
 
   makeinfo)
-    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
-       # We have makeinfo, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified a \`.texi' or \`.texinfo' file, or any other file
@@ -301,10 +297,6 @@
 
   tar)
     shift
-    if test -n "$run"; then
-      echo 1>&2 "ERROR: \`tar' requires --run"
-      exit 1
-    fi
 
     # We have already tried tar in the generic part.
     # Look for gnutar/gtar before invocation to avoid ugly error

reply via email to

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