>>>>> "Alexandre" == Alexandre Oliva <[EMAIL PROTECTED]> writes:

Alexandre> On Jul 10, 2000, "Lars J. Aas" <[EMAIL PROTECTED]> wrote:
>> How about tagging it with "^/" instead?

Alexandre> How about `pwd`? :-)

I don't understand the pwd stuff, but here is my proposal.

To answer a question you will ask, yes AC_MSG_ERROR is embeddable
inside ` `, but you need to quote properly the \`.

It gives this:

  # First look for the input files in the build tree, otherwise in the
  # src tree.
  ac_file_inputs=`IFS=:
     for f in $ac_file_in; do
       case $f in
       -) echo $tmp/stdin ;;
       *) if test -f "$f"; then
            # Build tree
            echo $f
          elif test -f "$ac_given_srcdir/$f"; then
            # Source tree
            echo $ac_given_srcdir/$f
          else
            # /dev/null tree
            { echo "configure: error: cannot find input file \\\`$f'" >&2; exit 1; }
          fi;;
       esac
     done`

in configure.


Index: ChangeLog
from  Akim Demaille  <[EMAIL PROTECTED]>
        
        * acgeneral.m4 (_AC_OUTPUT_FILES, _AC_OUTPUT_HEADERS): Look for
        the input files first in $builddir, then $srcdir.
        Suggested by Lars J. Aas, designed by Alexandre Oliva.
        
Index: acgeneral.m4
===================================================================
RCS file: /cvs/autoconf/acgeneral.m4,v
retrieving revision 1.523
diff -u -r1.523 acgeneral.m4
--- acgeneral.m4        2000/07/10 14:44:02     1.523
+++ acgeneral.m4        2000/07/10 14:59:53
@@ -4631,18 +4631,25 @@
 
   # Don't redirect the output to AC_FILE directly: use `mv' so that
   # updating is atomic, and doesn't need trapping.
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
   ac_file_inputs=`IFS=:
-                  for f in $ac_file_in; do
-                    case $f in
-                    -) echo $tmp/stdin ;;
-                    *) echo $ac_given_srcdir/$f ;;
-                    esac
-                  done`
-  for ac_file_input in $ac_file_inputs;
-  do
-    test -f "$ac_file_input" ||
-        AC_MSG_ERROR(cannot find input file `$ac_file_input')
-  done
+     for f in $ac_file_in; do
+       case $f in
+       -) echo $tmp/stdin ;;
+       *) if test -f "$f"; then
+            # Build tree or absolute
+            echo $f
+          elif test -f "$ac_given_srcdir/$f"; then
+            # Source tree
+            echo $ac_given_srcdir/$f
+          else
+            # /dev/null tree
+            AC_MSG_ERROR([cannot find input file \\`$f'])
+          fi;;
+       esac
+     done`
 EOF
 cat >>$CONFIG_STATUS <<EOF
 dnl Neutralize VPATH when `$srcdir' = `.'.
@@ -4767,18 +4774,24 @@
 
   test x"$ac_file" != x- && echo creating $ac_file
 
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
   ac_file_inputs=`IFS=:
-                  for f in $ac_file_in; do
-                    case $f in
-                    -) echo $tmp/stdin ;;
-                    *) echo $ac_given_srcdir/$f ;;
-                    esac
-                  done`
-  for ac_file_input in $ac_file_inputs;
-  do
-    test -f "$ac_file_input" ||
-        AC_MSG_ERROR(cannot find input file `$ac_file_input')
-  done
+     for f in $ac_file_in; do
+       case $f in
+       -) echo $tmp/stdin ;;
+       *) if test -f "$f"; then
+            # Build tree or absolute
+            echo $f
+          elif test -f "$ac_given_srcdir/$f"; then
+            # Source tree
+            echo $ac_given_srcdir/$f
+          else
+            # /dev/null tree
+            AC_MSG_ERROR([cannot find input file \\`$f'])
+          fi;;
+       esac
+     done`
   # Remove the trailing spaces.
   sed 's/[[    ]]*$//' $ac_file_inputs >$tmp/in
 

Reply via email to