]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Use `mktemp -d' when possible to create securely a tmp work dir.
authorAkim Demaille <akim@epita.fr>
Wed, 29 Mar 2000 11:09:59 +0000 (11:09 +0000)
committerAkim Demaille <akim@epita.fr>
Wed, 29 Mar 2000 11:09:59 +0000 (11:09 +0000)
* autoconf.sh: Use it when possible to create the dir $tmp.
Stop using variables for tmp files, use their names in $tmp.
[install]: Use the new features of autoconf --trace.

ChangeLog
autoconf.in
autoconf.sh
bin/autoconf.in
configure

index eb49fc02897b8e6ec22b7a49f886e57e663c8654..cc109ca143a86539903a00ada1531f1a158ab857 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2000-03-29  Akim Demaille  <akim@epita.fr>
+
+       Use `mktemp -d' when possible to create securely a tmp work dir.
+
+       * autoconf.sh: Use it when possible to create the dir $tmp.
+       Stop using variables for tmp files, use their names in $tmp.
+       [install]: Use the new features of autoconf --trace.
+
 2000-03-28  Akim Demaille  <akim@epita.fr>
 
        Probably all the versions of bash up to 2.04 fail on
index 8e837e1287e9e844123be056a3c54c3062ca4421..7e5aca2e13409babf9b504f6e3275442adabf286 100644 (file)
@@ -99,18 +99,14 @@ outfile=
 # Exit status.
 status=0
 # Tasks:
+# - install
+#   Install links to the needed *.m4 extensions.
 # - trace
 #   Trace the first arguments of some macros
 # - script
 #   Produce the configure script (default)
 task=script
-: ${TMPDIR=/tmp}
-tmpbase=$TMPDIR/ac$$
-tmpin=${tmpbase}.in
-tmpout=${tmpbase}.out
-silent_m4=${tmpbase}silent.m4
-trace_m4=${tmpbase}trace.m4
-translate_awk=${tmpbase}trans.awk
+tmp=
 verbose=:
 
 # Parse command line
@@ -186,6 +182,19 @@ while test $# -gt 0 ; do
   esac
 done
 
+# Trap on 0 to stop playing with `rm'.
+$debug ||
+{
+  trap 'status=$?; rm -rf $tmp && exit $status' 0
+  trap 'exit $?' 1 2 13 15
+}
+
+# Temporary files.
+: ${TMPDIR=/tmp}
+{ tmp=`(mktemp -d -q "$TMPDIR/acXXXXXX") 2>/dev/null` && test -n "$tmp"; }  ||
+  { tmp=$TMPDIR/ac$$ && (umask 077 && mkdir $tmp); } ||
+  { echo "$me: cannot create a temporary directory in $TMPDIR" >&2; exit 1; }
+
 # Running m4.
 test -n "$localdir" && use_localdir="-I$localdir"
 run_m4="$M4 $use_localdir -I $AC_MACRODIR autoconf.m4"
@@ -202,15 +211,9 @@ case $# in
      exit 1 ;;
 esac
 
-# Trap on 0 to stop playing with `rm'.
-$debug ||
-{
-  trap 'status=$?; rm -f $tmpbase* && exit $status' 0
-  trap 'exit $?' 1 2 13 15
-}
-
+# We need an actual file.
 if test z$infile = z-; then
-  infile=$tmpin
+  infile=$tmp/stdin
   cat >$infile
 elif test ! -r "$infile"; then
   echo "$me: $infile: No such file or directory" >&2
@@ -232,16 +235,16 @@ case $task in
   ## Generate the script.  ##
   ## --------------------- ##
   script)
-  $run_m4f $infile >$tmpout || exit 2
+  $run_m4f $infile >$tmp/configure || exit 2
 
   # You could add your own prefixes to pattern if you wanted to check for
   # them too, e.g. pattern='\(AC_\|ILT_\)', except that UNIX sed doesn't do
   # alternation.
   pattern="A[CHM]_"
 
-  if grep "^[^#]*$pattern" $tmpout >/dev/null 2>&1; then
+  if grep "^[^#]*$pattern" $tmp/configure >/dev/null 2>&1; then
     echo "$me: undefined macros:" >&2
-    sed -n "s/^[^#]*\\($pattern[_A-Za-z0-9]*\\).*/\\1/p" $tmpout |
+    sed -n "s/^[^#]*\\($pattern[_A-Za-z0-9]*\\).*/\\1/p" $tmp/configure |
       while read macro; do
        grep -n "^[^#]*$macro" $infile /dev/null
        test $? = 1 && echo "***BUG in Autoconf--please report*** $macro"
@@ -279,7 +282,7 @@ case $task in
       while (sub(/@%:@/, "#"))
         continue
       print
-    }' <$tmpout >&4
+    }' <$tmp/configure >&4
   ;; # End of the task script.
 
 
@@ -290,11 +293,11 @@ case $task in
   trace)
   # `errprint' must be silent when we run `m4 --trace', otherwise there
   # can be warnings mixed with traces in m4's stderr.
-  cat >$silent_m4 <<\EOF
+  cat >$tmp/silent.m4 <<\EOF
 define(`errprint')dnl
 EOF
   # A program to trace m4 macros.
-  cat >$trace_m4 <<\EOF
+  cat >$tmp/trace.m4 <<\EOF
 divert(-1)
   changequote([, ])
   define([_at],
@@ -323,7 +326,7 @@ divert(-1)
          [_star([$1], args($@))])
 EOF
   # A program to translate user tracing requests into m4 macros.
-  cat >$translate_awk <<\EOF
+  cat >$tmp/translate.awk <<\EOF
 function trans (arg, sep)
 {
   # File name.
@@ -428,24 +431,24 @@ EOF
   do
     # The request may be several lines long, hence sed has to quit.
     trace_opt="$trace_opt -t "`echo "$trace" | sed -e 's/:.*//;q'`
-    echo "$trace" | $AWK -f $translate_awk >>$trace_m4 || exit 1
+    echo "$trace" | $AWK -f $tmp/translate.awk >>$tmp/trace.m4 || exit 1
   done
-  echo "divert(0)dnl" >>$trace_m4
+  echo "divert(0)dnl" >>$tmp/trace.m4
 
   # Do we trace the initialization?
   if $initialization; then
-    run_m4_trace="$run_m4 $trace_opt -daflq $silent"
+    run_m4_trace="$run_m4 $trace_opt -daflq $tmp/silent.m4"
   else
-    run_m4_trace="$run_m4f $trace_opt -daflq $silent"
+    run_m4_trace="$run_m4f $trace_opt -daflq $tmp/silent.m4"
   fi
 
   # Run m4 on the input file to get traces.
-  $verbose "Running $run_m4_trace $infile | $M4 $trace_m4" >&2
+  $verbose "Running $run_m4_trace $infile | $M4 $tmp/trace.m4" >&2
   $run_m4_trace $infile 2>&1 >/dev/null |
     sed -e 's/^m4trace:\([^:][^:]*\):\([0-9][0-9]*\): -\([0-9][0-9]*\)- \([^(][^(]*\)(\(.*\)$/AT_\4([\1], [\2], [\3], [\4], \5/' \
         -e 's/^m4trace:\([^:][^:]*\):\([0-9][0-9]*\): -\([0-9][0-9]*\)- \(.*\)$/AT_\4([\1], [\2], [\3], [\4])/' |
   # Now we are ready to run m4 to process the trace file.
-  $M4 $trace_m4 - |
+  $M4 $tmp/trace.m4 - |
   # It makes no sense to try to transform __oline__.
   sed '
     s/@<:@/[/g
@@ -464,7 +467,7 @@ EOF
   install)
   # An m4 program that reports what macros are requested, and where
   # they were defined.
-  cat >$tmpin <<\EOF
+  cat >$tmp/request.m4 <<\EOF
 dnl Keep the definition of the old AC_DEFUN
 define([AC_DEFUN_OLD], defn([AC_DEFUN]))
 
@@ -482,17 +485,20 @@ dnl protect the first argument of AC_DEFUN, then, if read a second time
 dnl this argument will be expanded, and we'll get pure junk out of m4.
 define([AC_INCLUDE])
 EOF
-  # Run m4 with all the library files, discard stdout, save stderr.
-  $verbose Running $run_m4f -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >&2
-  $run_m4f -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >/dev/null 2>$tmpout
-  # Keep only the good lines, there may be other outputs
-  grep '^[^: ]*:[0-9][0-9]*:[^:]*$' $tmpout >$tmpin
+
+  # Run m4 with all the library files, discard stdout, save stderr in
+  # $requested.
+  run_m4_request="$run_m4f -dipa -t m4_include -t m4_sinclude $tmp/request.m4"
+  $verbose $run_m4_request $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >&2
+  $run_m4_request $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile 2>&1 >/dev/null |
+    # Keep only the good lines, there may be other outputs
+    grep '^[^: ]*:[0-9][0-9]*:[^:]*$' >$tmp/requested
+
   # Extract the files that are not in the local dir, and install the links.
-  # Save in $tmpout the list of installed links.
-  >$tmpout
+  # Save in `installed' the list of installed links.
   $verbose "Required macros:" >&2
-  $verbose "`sed -e 's/^/| /' $tmpin`" >&2
-  cat $tmpin |
+  $verbose "`sed -e 's/^/| /' $tmp/requested`" >&2
+  cat $tmp/requested |
     while read line
     do
       file=`echo "$line" | sed -e 's/:.*//'`
@@ -510,7 +516,7 @@ EOF
            exit 1
          }
        fi
-        echo "$localdir/$filename" >>$tmpout
+        echo "$localdir/$filename" >>$tmp/installed
       fi
     done
   # Now that we have installed the links, and that we know that the
@@ -520,21 +526,20 @@ EOF
   export AC_MACRODIR
   # Not m4_s?include, because it would catch acsite and aclocal, which
   # we don't care about.
-  $0 -l "$localdir" -t AC_INCLUDE $infile |
-    sed -e 's/^[^:]*:[^:]*:[^:]*://g' |
+  $0 -l "$localdir" -t AC_INCLUDE:'$1' $infile |
     sort |
-    uniq >$tmpin
+    uniq >$tmp/included
   # All the included files are needed.
-  for file in `cat $tmpin`;
+  for file in `cat $tmp/included`;
   do
-    if fgrep "$file" $tmpout >/dev/null 2>&1; then :; else
+    if fgrep "$file" $tmp/installed >/dev/null 2>&1; then :; else
       echo "\`$file' is uselessly included" >&2
     fi
   done
   # All the needed files are included.
-  for file in `sort $tmpout | uniq`;
+  for file in `sort $tmp/installed | uniq`;
   do
-    if fgrep "$file" $tmpin >/dev/null 2>&1; then :; else
+    if fgrep "$file" $tmp/included >/dev/null 2>&1; then :; else
       echo "\`$file' is not included" >&2
     fi
   done
index 8e837e1287e9e844123be056a3c54c3062ca4421..7e5aca2e13409babf9b504f6e3275442adabf286 100644 (file)
@@ -99,18 +99,14 @@ outfile=
 # Exit status.
 status=0
 # Tasks:
+# - install
+#   Install links to the needed *.m4 extensions.
 # - trace
 #   Trace the first arguments of some macros
 # - script
 #   Produce the configure script (default)
 task=script
-: ${TMPDIR=/tmp}
-tmpbase=$TMPDIR/ac$$
-tmpin=${tmpbase}.in
-tmpout=${tmpbase}.out
-silent_m4=${tmpbase}silent.m4
-trace_m4=${tmpbase}trace.m4
-translate_awk=${tmpbase}trans.awk
+tmp=
 verbose=:
 
 # Parse command line
@@ -186,6 +182,19 @@ while test $# -gt 0 ; do
   esac
 done
 
+# Trap on 0 to stop playing with `rm'.
+$debug ||
+{
+  trap 'status=$?; rm -rf $tmp && exit $status' 0
+  trap 'exit $?' 1 2 13 15
+}
+
+# Temporary files.
+: ${TMPDIR=/tmp}
+{ tmp=`(mktemp -d -q "$TMPDIR/acXXXXXX") 2>/dev/null` && test -n "$tmp"; }  ||
+  { tmp=$TMPDIR/ac$$ && (umask 077 && mkdir $tmp); } ||
+  { echo "$me: cannot create a temporary directory in $TMPDIR" >&2; exit 1; }
+
 # Running m4.
 test -n "$localdir" && use_localdir="-I$localdir"
 run_m4="$M4 $use_localdir -I $AC_MACRODIR autoconf.m4"
@@ -202,15 +211,9 @@ case $# in
      exit 1 ;;
 esac
 
-# Trap on 0 to stop playing with `rm'.
-$debug ||
-{
-  trap 'status=$?; rm -f $tmpbase* && exit $status' 0
-  trap 'exit $?' 1 2 13 15
-}
-
+# We need an actual file.
 if test z$infile = z-; then
-  infile=$tmpin
+  infile=$tmp/stdin
   cat >$infile
 elif test ! -r "$infile"; then
   echo "$me: $infile: No such file or directory" >&2
@@ -232,16 +235,16 @@ case $task in
   ## Generate the script.  ##
   ## --------------------- ##
   script)
-  $run_m4f $infile >$tmpout || exit 2
+  $run_m4f $infile >$tmp/configure || exit 2
 
   # You could add your own prefixes to pattern if you wanted to check for
   # them too, e.g. pattern='\(AC_\|ILT_\)', except that UNIX sed doesn't do
   # alternation.
   pattern="A[CHM]_"
 
-  if grep "^[^#]*$pattern" $tmpout >/dev/null 2>&1; then
+  if grep "^[^#]*$pattern" $tmp/configure >/dev/null 2>&1; then
     echo "$me: undefined macros:" >&2
-    sed -n "s/^[^#]*\\($pattern[_A-Za-z0-9]*\\).*/\\1/p" $tmpout |
+    sed -n "s/^[^#]*\\($pattern[_A-Za-z0-9]*\\).*/\\1/p" $tmp/configure |
       while read macro; do
        grep -n "^[^#]*$macro" $infile /dev/null
        test $? = 1 && echo "***BUG in Autoconf--please report*** $macro"
@@ -279,7 +282,7 @@ case $task in
       while (sub(/@%:@/, "#"))
         continue
       print
-    }' <$tmpout >&4
+    }' <$tmp/configure >&4
   ;; # End of the task script.
 
 
@@ -290,11 +293,11 @@ case $task in
   trace)
   # `errprint' must be silent when we run `m4 --trace', otherwise there
   # can be warnings mixed with traces in m4's stderr.
-  cat >$silent_m4 <<\EOF
+  cat >$tmp/silent.m4 <<\EOF
 define(`errprint')dnl
 EOF
   # A program to trace m4 macros.
-  cat >$trace_m4 <<\EOF
+  cat >$tmp/trace.m4 <<\EOF
 divert(-1)
   changequote([, ])
   define([_at],
@@ -323,7 +326,7 @@ divert(-1)
          [_star([$1], args($@))])
 EOF
   # A program to translate user tracing requests into m4 macros.
-  cat >$translate_awk <<\EOF
+  cat >$tmp/translate.awk <<\EOF
 function trans (arg, sep)
 {
   # File name.
@@ -428,24 +431,24 @@ EOF
   do
     # The request may be several lines long, hence sed has to quit.
     trace_opt="$trace_opt -t "`echo "$trace" | sed -e 's/:.*//;q'`
-    echo "$trace" | $AWK -f $translate_awk >>$trace_m4 || exit 1
+    echo "$trace" | $AWK -f $tmp/translate.awk >>$tmp/trace.m4 || exit 1
   done
-  echo "divert(0)dnl" >>$trace_m4
+  echo "divert(0)dnl" >>$tmp/trace.m4
 
   # Do we trace the initialization?
   if $initialization; then
-    run_m4_trace="$run_m4 $trace_opt -daflq $silent"
+    run_m4_trace="$run_m4 $trace_opt -daflq $tmp/silent.m4"
   else
-    run_m4_trace="$run_m4f $trace_opt -daflq $silent"
+    run_m4_trace="$run_m4f $trace_opt -daflq $tmp/silent.m4"
   fi
 
   # Run m4 on the input file to get traces.
-  $verbose "Running $run_m4_trace $infile | $M4 $trace_m4" >&2
+  $verbose "Running $run_m4_trace $infile | $M4 $tmp/trace.m4" >&2
   $run_m4_trace $infile 2>&1 >/dev/null |
     sed -e 's/^m4trace:\([^:][^:]*\):\([0-9][0-9]*\): -\([0-9][0-9]*\)- \([^(][^(]*\)(\(.*\)$/AT_\4([\1], [\2], [\3], [\4], \5/' \
         -e 's/^m4trace:\([^:][^:]*\):\([0-9][0-9]*\): -\([0-9][0-9]*\)- \(.*\)$/AT_\4([\1], [\2], [\3], [\4])/' |
   # Now we are ready to run m4 to process the trace file.
-  $M4 $trace_m4 - |
+  $M4 $tmp/trace.m4 - |
   # It makes no sense to try to transform __oline__.
   sed '
     s/@<:@/[/g
@@ -464,7 +467,7 @@ EOF
   install)
   # An m4 program that reports what macros are requested, and where
   # they were defined.
-  cat >$tmpin <<\EOF
+  cat >$tmp/request.m4 <<\EOF
 dnl Keep the definition of the old AC_DEFUN
 define([AC_DEFUN_OLD], defn([AC_DEFUN]))
 
@@ -482,17 +485,20 @@ dnl protect the first argument of AC_DEFUN, then, if read a second time
 dnl this argument will be expanded, and we'll get pure junk out of m4.
 define([AC_INCLUDE])
 EOF
-  # Run m4 with all the library files, discard stdout, save stderr.
-  $verbose Running $run_m4f -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >&2
-  $run_m4f -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >/dev/null 2>$tmpout
-  # Keep only the good lines, there may be other outputs
-  grep '^[^: ]*:[0-9][0-9]*:[^:]*$' $tmpout >$tmpin
+
+  # Run m4 with all the library files, discard stdout, save stderr in
+  # $requested.
+  run_m4_request="$run_m4f -dipa -t m4_include -t m4_sinclude $tmp/request.m4"
+  $verbose $run_m4_request $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >&2
+  $run_m4_request $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile 2>&1 >/dev/null |
+    # Keep only the good lines, there may be other outputs
+    grep '^[^: ]*:[0-9][0-9]*:[^:]*$' >$tmp/requested
+
   # Extract the files that are not in the local dir, and install the links.
-  # Save in $tmpout the list of installed links.
-  >$tmpout
+  # Save in `installed' the list of installed links.
   $verbose "Required macros:" >&2
-  $verbose "`sed -e 's/^/| /' $tmpin`" >&2
-  cat $tmpin |
+  $verbose "`sed -e 's/^/| /' $tmp/requested`" >&2
+  cat $tmp/requested |
     while read line
     do
       file=`echo "$line" | sed -e 's/:.*//'`
@@ -510,7 +516,7 @@ EOF
            exit 1
          }
        fi
-        echo "$localdir/$filename" >>$tmpout
+        echo "$localdir/$filename" >>$tmp/installed
       fi
     done
   # Now that we have installed the links, and that we know that the
@@ -520,21 +526,20 @@ EOF
   export AC_MACRODIR
   # Not m4_s?include, because it would catch acsite and aclocal, which
   # we don't care about.
-  $0 -l "$localdir" -t AC_INCLUDE $infile |
-    sed -e 's/^[^:]*:[^:]*:[^:]*://g' |
+  $0 -l "$localdir" -t AC_INCLUDE:'$1' $infile |
     sort |
-    uniq >$tmpin
+    uniq >$tmp/included
   # All the included files are needed.
-  for file in `cat $tmpin`;
+  for file in `cat $tmp/included`;
   do
-    if fgrep "$file" $tmpout >/dev/null 2>&1; then :; else
+    if fgrep "$file" $tmp/installed >/dev/null 2>&1; then :; else
       echo "\`$file' is uselessly included" >&2
     fi
   done
   # All the needed files are included.
-  for file in `sort $tmpout | uniq`;
+  for file in `sort $tmp/installed | uniq`;
   do
-    if fgrep "$file" $tmpin >/dev/null 2>&1; then :; else
+    if fgrep "$file" $tmp/included >/dev/null 2>&1; then :; else
       echo "\`$file' is not included" >&2
     fi
   done
index 8e837e1287e9e844123be056a3c54c3062ca4421..7e5aca2e13409babf9b504f6e3275442adabf286 100644 (file)
@@ -99,18 +99,14 @@ outfile=
 # Exit status.
 status=0
 # Tasks:
+# - install
+#   Install links to the needed *.m4 extensions.
 # - trace
 #   Trace the first arguments of some macros
 # - script
 #   Produce the configure script (default)
 task=script
-: ${TMPDIR=/tmp}
-tmpbase=$TMPDIR/ac$$
-tmpin=${tmpbase}.in
-tmpout=${tmpbase}.out
-silent_m4=${tmpbase}silent.m4
-trace_m4=${tmpbase}trace.m4
-translate_awk=${tmpbase}trans.awk
+tmp=
 verbose=:
 
 # Parse command line
@@ -186,6 +182,19 @@ while test $# -gt 0 ; do
   esac
 done
 
+# Trap on 0 to stop playing with `rm'.
+$debug ||
+{
+  trap 'status=$?; rm -rf $tmp && exit $status' 0
+  trap 'exit $?' 1 2 13 15
+}
+
+# Temporary files.
+: ${TMPDIR=/tmp}
+{ tmp=`(mktemp -d -q "$TMPDIR/acXXXXXX") 2>/dev/null` && test -n "$tmp"; }  ||
+  { tmp=$TMPDIR/ac$$ && (umask 077 && mkdir $tmp); } ||
+  { echo "$me: cannot create a temporary directory in $TMPDIR" >&2; exit 1; }
+
 # Running m4.
 test -n "$localdir" && use_localdir="-I$localdir"
 run_m4="$M4 $use_localdir -I $AC_MACRODIR autoconf.m4"
@@ -202,15 +211,9 @@ case $# in
      exit 1 ;;
 esac
 
-# Trap on 0 to stop playing with `rm'.
-$debug ||
-{
-  trap 'status=$?; rm -f $tmpbase* && exit $status' 0
-  trap 'exit $?' 1 2 13 15
-}
-
+# We need an actual file.
 if test z$infile = z-; then
-  infile=$tmpin
+  infile=$tmp/stdin
   cat >$infile
 elif test ! -r "$infile"; then
   echo "$me: $infile: No such file or directory" >&2
@@ -232,16 +235,16 @@ case $task in
   ## Generate the script.  ##
   ## --------------------- ##
   script)
-  $run_m4f $infile >$tmpout || exit 2
+  $run_m4f $infile >$tmp/configure || exit 2
 
   # You could add your own prefixes to pattern if you wanted to check for
   # them too, e.g. pattern='\(AC_\|ILT_\)', except that UNIX sed doesn't do
   # alternation.
   pattern="A[CHM]_"
 
-  if grep "^[^#]*$pattern" $tmpout >/dev/null 2>&1; then
+  if grep "^[^#]*$pattern" $tmp/configure >/dev/null 2>&1; then
     echo "$me: undefined macros:" >&2
-    sed -n "s/^[^#]*\\($pattern[_A-Za-z0-9]*\\).*/\\1/p" $tmpout |
+    sed -n "s/^[^#]*\\($pattern[_A-Za-z0-9]*\\).*/\\1/p" $tmp/configure |
       while read macro; do
        grep -n "^[^#]*$macro" $infile /dev/null
        test $? = 1 && echo "***BUG in Autoconf--please report*** $macro"
@@ -279,7 +282,7 @@ case $task in
       while (sub(/@%:@/, "#"))
         continue
       print
-    }' <$tmpout >&4
+    }' <$tmp/configure >&4
   ;; # End of the task script.
 
 
@@ -290,11 +293,11 @@ case $task in
   trace)
   # `errprint' must be silent when we run `m4 --trace', otherwise there
   # can be warnings mixed with traces in m4's stderr.
-  cat >$silent_m4 <<\EOF
+  cat >$tmp/silent.m4 <<\EOF
 define(`errprint')dnl
 EOF
   # A program to trace m4 macros.
-  cat >$trace_m4 <<\EOF
+  cat >$tmp/trace.m4 <<\EOF
 divert(-1)
   changequote([, ])
   define([_at],
@@ -323,7 +326,7 @@ divert(-1)
          [_star([$1], args($@))])
 EOF
   # A program to translate user tracing requests into m4 macros.
-  cat >$translate_awk <<\EOF
+  cat >$tmp/translate.awk <<\EOF
 function trans (arg, sep)
 {
   # File name.
@@ -428,24 +431,24 @@ EOF
   do
     # The request may be several lines long, hence sed has to quit.
     trace_opt="$trace_opt -t "`echo "$trace" | sed -e 's/:.*//;q'`
-    echo "$trace" | $AWK -f $translate_awk >>$trace_m4 || exit 1
+    echo "$trace" | $AWK -f $tmp/translate.awk >>$tmp/trace.m4 || exit 1
   done
-  echo "divert(0)dnl" >>$trace_m4
+  echo "divert(0)dnl" >>$tmp/trace.m4
 
   # Do we trace the initialization?
   if $initialization; then
-    run_m4_trace="$run_m4 $trace_opt -daflq $silent"
+    run_m4_trace="$run_m4 $trace_opt -daflq $tmp/silent.m4"
   else
-    run_m4_trace="$run_m4f $trace_opt -daflq $silent"
+    run_m4_trace="$run_m4f $trace_opt -daflq $tmp/silent.m4"
   fi
 
   # Run m4 on the input file to get traces.
-  $verbose "Running $run_m4_trace $infile | $M4 $trace_m4" >&2
+  $verbose "Running $run_m4_trace $infile | $M4 $tmp/trace.m4" >&2
   $run_m4_trace $infile 2>&1 >/dev/null |
     sed -e 's/^m4trace:\([^:][^:]*\):\([0-9][0-9]*\): -\([0-9][0-9]*\)- \([^(][^(]*\)(\(.*\)$/AT_\4([\1], [\2], [\3], [\4], \5/' \
         -e 's/^m4trace:\([^:][^:]*\):\([0-9][0-9]*\): -\([0-9][0-9]*\)- \(.*\)$/AT_\4([\1], [\2], [\3], [\4])/' |
   # Now we are ready to run m4 to process the trace file.
-  $M4 $trace_m4 - |
+  $M4 $tmp/trace.m4 - |
   # It makes no sense to try to transform __oline__.
   sed '
     s/@<:@/[/g
@@ -464,7 +467,7 @@ EOF
   install)
   # An m4 program that reports what macros are requested, and where
   # they were defined.
-  cat >$tmpin <<\EOF
+  cat >$tmp/request.m4 <<\EOF
 dnl Keep the definition of the old AC_DEFUN
 define([AC_DEFUN_OLD], defn([AC_DEFUN]))
 
@@ -482,17 +485,20 @@ dnl protect the first argument of AC_DEFUN, then, if read a second time
 dnl this argument will be expanded, and we'll get pure junk out of m4.
 define([AC_INCLUDE])
 EOF
-  # Run m4 with all the library files, discard stdout, save stderr.
-  $verbose Running $run_m4f -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >&2
-  $run_m4f -dipa -t m4_include -t m4_sinclude $tmpin $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >/dev/null 2>$tmpout
-  # Keep only the good lines, there may be other outputs
-  grep '^[^: ]*:[0-9][0-9]*:[^:]*$' $tmpout >$tmpin
+
+  # Run m4 with all the library files, discard stdout, save stderr in
+  # $requested.
+  run_m4_request="$run_m4f -dipa -t m4_include -t m4_sinclude $tmp/request.m4"
+  $verbose $run_m4_request $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile >&2
+  $run_m4_request $localdir/*.m4 $AC_ACLOCALDIR/*.m4 $infile 2>&1 >/dev/null |
+    # Keep only the good lines, there may be other outputs
+    grep '^[^: ]*:[0-9][0-9]*:[^:]*$' >$tmp/requested
+
   # Extract the files that are not in the local dir, and install the links.
-  # Save in $tmpout the list of installed links.
-  >$tmpout
+  # Save in `installed' the list of installed links.
   $verbose "Required macros:" >&2
-  $verbose "`sed -e 's/^/| /' $tmpin`" >&2
-  cat $tmpin |
+  $verbose "`sed -e 's/^/| /' $tmp/requested`" >&2
+  cat $tmp/requested |
     while read line
     do
       file=`echo "$line" | sed -e 's/:.*//'`
@@ -510,7 +516,7 @@ EOF
            exit 1
          }
        fi
-        echo "$localdir/$filename" >>$tmpout
+        echo "$localdir/$filename" >>$tmp/installed
       fi
     done
   # Now that we have installed the links, and that we know that the
@@ -520,21 +526,20 @@ EOF
   export AC_MACRODIR
   # Not m4_s?include, because it would catch acsite and aclocal, which
   # we don't care about.
-  $0 -l "$localdir" -t AC_INCLUDE $infile |
-    sed -e 's/^[^:]*:[^:]*:[^:]*://g' |
+  $0 -l "$localdir" -t AC_INCLUDE:'$1' $infile |
     sort |
-    uniq >$tmpin
+    uniq >$tmp/included
   # All the included files are needed.
-  for file in `cat $tmpin`;
+  for file in `cat $tmp/included`;
   do
-    if fgrep "$file" $tmpout >/dev/null 2>&1; then :; else
+    if fgrep "$file" $tmp/installed >/dev/null 2>&1; then :; else
       echo "\`$file' is uselessly included" >&2
     fi
   done
   # All the needed files are included.
-  for file in `sort $tmpout | uniq`;
+  for file in `sort $tmp/installed | uniq`;
   do
-    if fgrep "$file" $tmpin >/dev/null 2>&1; then :; else
+    if fgrep "$file" $tmp/included >/dev/null 2>&1; then :; else
       echo "\`$file' is not included" >&2
     fi
   done
index 86914a8d5a009008e78858176f4aa2c78ac8dbf6..0969d1281f8bb8c7e3e4ecb021a5b6f008780569 100755 (executable)
--- a/configure
+++ b/configure
@@ -499,7 +499,7 @@ if test "$ac_init_help" = "recursive"; then
     case "$srcdir" in
     .) # No --srcdir option.  We are building in place.
       ac_sub_srcdir=$srcdir ;;
-    [/\\]* | ?:[/\\]* ) # Absolute path.
+    [\\/]* | ?:[\\/]* ) # Absolute path.
       ac_sub_srcdir=$srcdir/$ac_subdir ;;
     *) # Relative path.
       ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;;
@@ -905,7 +905,7 @@ if test "${ac_cv_path_M4+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" 1>&6
 else
   case "$M4" in
-  [/\\]* | ?:[/\\]*)
+  [\\/]* | ?:[\\/]*)
   ac_cv_path_M4="$M4" # Let the user override the test with a path.
   ;;
   *)
@@ -1008,7 +1008,7 @@ if test "${ac_cv_path_PERL+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" 1>&6
 else
   case "$PERL" in
-  [/\\]* | ?:[/\\]*)
+  [\\/]* | ?:[\\/]*)
   ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
   ;;
   *)
@@ -1446,7 +1446,7 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
   .)  srcdir=.
       if test -z "$ac_dots"; then top_srcdir=.
       else top_srcdir=`echo $ac_dots | sed 's%/$%%'`; fi ;;
-  [/\\]* | ?:[/\\]* )
+  [\\/]* | ?:[\\/]* )
       srcdir="$ac_given_srcdir$ac_dir_suffix";
       top_srcdir=$ac_given_srcdir ;;
   *) # Relative path.
@@ -1455,7 +1455,7 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
   esac
 
   case "$ac_given_INSTALL" in
-  [/\\$]* | ?:[/\\]* ) INSTALL="$ac_given_INSTALL" ;;
+  [\\/$]* | ?:[\\/]* ) INSTALL="$ac_given_INSTALL" ;;
   *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
   esac