autoconf-patches
[Top][All Lists]
Advanced

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

[PATCH CVS] OS/2 tests


From: Ilya Zakharevich
Subject: [PATCH CVS] OS/2 tests
Date: Sat, 1 Mar 2003 01:15:43 -0800
User-agent: Mutt/1.4i

This patch fixes the problems autoconf has on OS/2.  3 chunks are related
to what I sent to this list before.  The remaining chunks are new.  With
these patches all the tests pass except test3 (which I will discuss
separately).

The first two chunks of the patch should replace the "skip
d:/OS2/INSTALL/install.exe" patch I sent earlier; I did not realize that
I needed to double [] in .m4 files.

The second chunk for the file m4sh.m4 is an implementation of the CONFIG_SHELL
patch I sent to this list before.  That time I sent it as a patch for
configure script; if what I sent was already converted to .m4 version, this
chunk should be skipped.

Below is the description of the remaining chunks.

 a) The remaining (3rd) chunk for autoconf/programs.m4:

      The trial Makefile had no SHELL= line (incompatible echo of CMD was
        used).

 b) autoconf/status.m4:

      `echo $srcdir/$f' was performed under influence of IFS=:.  If $srcdir
        had ":" in it (as in a full path of DOSISH systems), it would be
        replaced by " ".

 c) Autom4te/General.pm:

      /dev filesystem is not stat()able on OS/2.  Thus -e '/dev/null' would
      fail (see also the second part of "d").

 d) autotest/general.m4:

      it was assumed that _AS_PATH_WALK() would not use programs on PATH
        (see "g" which introduces dependence on tr).

      it turns out that cp is also doing stat() (compare with "c"), so
        "cp /dev/null fileName" would fail;

 e) m4sugar/m4sh.m4 (chunk 2 is described above):

      Make AS_EXECUTABLE_P test for .exe files too if $as_executable_ext2 is
        ".exe".  Set it under OS/2 (is there a better test?).

      if $PATH uses backslashes (as on DOSISH systems) as path separators,
      it becomes very tricky to construct "usable" names of executable (due
      to possible multiple interpolation); below is the short description of
      the problem:

         CVS autoconf correctely detects $PATH_SEPARATOR on OS/2.  It also
         correctly finds executables on PATH (with the fix above to
         AS_EXECUTABLE_P)

         However, configure scripts have problems with using the extracted
         file names, since they contain backslashes.  In fact, the generated
         sed substitutions are correct, e.g. subs.sed file contains something
         like

            s,@PERL@,i:\\emx.add\\BIN/perl,;t t

         which is absolutely OK for substitution, e.g., of the #! line of a
         script.  However, usually these substitutions are used only
         indirectly, e.g., the extracted Makefile contains

           PERL = i:\emx.add\BIN/perl

           edit = sed \
                 -e 's,@PERL\@,$(PERL),g'

         and this, obviously, fails.  Since configure has a very little chance
         to know how @PERL@ is going to be used, the reasonable solution must
         be to change all backslashes to slashes in file names.

         A radical solution would be to do something like metadist's
         Configure is doing:

            PATH=`print -r "$PATH" | tr '\\\\' / `

         Theoretically, there may be a program which specifically expects
         backslashes in PATH (although I do not know any such program).

      Here is how we fix this:

         Set variable PATH_SLASHIFY if PATH_SEPARATOR is ";".  In presense
         of this variable try (carefully, checking that it makes sense)
         to change all backslashes to slashes in data extracted from $PATH.

         Do the same when converting $0 to $as_me.

  f) tests/tools.at:

       Assumes that /bin/sh is present.

Thanks,
Ilya

diff -pru autoconf/lib/autoconf/programs.m4 autoconf.my/lib/autoconf/programs.m4
--- autoconf/lib/autoconf/programs.m4   Thu Oct 31 05:15:02 2002
+++ autoconf.my/lib/autoconf/programs.m4        Thu Feb 27 11:04:38 2003
@@ -307,6 +307,7 @@ AC_DEFUN([AC_PROG_INSTALL],
 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
 # ./install, which can be erroneously created by make from ./install.sh.
 AC_MSG_CHECKING([for a BSD-compatible install])
 if test -z "$INSTALL"; then
@@ -316,6 +317,7 @@ AC_CACHE_VAL(ac_cv_path_install,
 case $as_dir/ in
   ./ | .// | /[cC]/* | \
   /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:[[\\/]]os2[[\\/]]install[[\\/]]* | ?:[[\\/]]OS2[[\\/]]INSTALL[[\\/]]* | \
   /usr/ucb/* ) ;;
   *)
     # OSF1 and SCO ODT 3.0 have their own names for install.
@@ -460,9 +462,11 @@ AC_DEFUN([AC_PROG_MAKE_SET],
 [AC_MSG_CHECKING([whether ${MAKE-make} sets \$(MAKE)])
 set dummy ${MAKE-make}; ac_make=`echo "$[2]" | sed 'y,./+-,__p_,'`
 AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set,
-[cat >conftest.make <<\_ACEOF
+[cat >conftest.make <<_ACEOF
+SHELL=${CONFIG_SHELL-/bin/sh}
+
 all:
-       @echo 'ac_maketemp="$(MAKE)"'
+       @echo 'ac_maketemp="\$(MAKE)"'
 _ACEOF
 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
 eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
diff -pru autoconf/lib/autoconf/status.m4 autoconf.my/lib/autoconf/status.m4
--- autoconf/lib/autoconf/status.m4     Tue Nov 12 02:54:46 2002
+++ autoconf.my/lib/autoconf/status.m4  Thu Feb 27 22:51:46 2003
@@ -530,7 +530,7 @@ for ac_file in : $CONFIG_HEADERS; do tes
            echo $f
          elif test -f "$srcdir/$f"; then
            # Source tree
-           echo $srcdir/$f
+           echo "$srcdir/$f"
          else
            # /dev/null tree
            AC_MSG_ERROR([cannot find input file: $f])
@@ -986,7 +986,7 @@ AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
            echo $f
          elif test -f "$srcdir/$f"; then
            # Source tree
-           echo $srcdir/$f
+           echo "$srcdir/$f"
          else
            # /dev/null tree
            AC_MSG_ERROR([cannot find input file: $f])
diff -pru autoconf/lib/Autom4te/General.pm autoconf.my/lib/Autom4te/General.pm
--- autoconf/lib/Autom4te/General.pm    Tue Oct 15 23:38:50 2002
+++ autoconf.my/lib/Autom4te/General.pm Thu Feb 27 00:50:16 2003
@@ -261,7 +261,7 @@ sub find_file ($@)
   if (file_name_is_absolute ($filename))
     {
       error "no such file or directory: $filename"
-       unless $optional;
+       unless $optional or $^O eq 'os2' and $filename eq '/dev/null';
       return undef;
     }
 
diff -pru autoconf/lib/autotest/general.m4 autoconf.my/lib/autotest/general.m4
--- autoconf/lib/autotest/general.m4    Sun Oct 27 23:30:58 2002
+++ autoconf.my/lib/autotest/general.m4 Thu Feb 27 22:09:28 2003
@@ -373,19 +373,20 @@ _AS_PATH_WALK([$AUTOTEST_PATH $PATH],
 esac])
 
 # Now build and simplify PATH.
-PATH=
+at_path_reduced=
 _AS_PATH_WALK([$at_path],
 [as_dir=`(cd "$as_dir" && pwd) 2>/dev/null`
 test -d "$as_dir" || continue
-case $PATH in
+case $at_path_reduced in
                   $as_dir                 | \
                   $as_dir$PATH_SEPARATOR* | \
   *$PATH_SEPARATOR$as_dir                 | \
   *$PATH_SEPARATOR$as_dir$PATH_SEPARATOR* ) ;;
 
-  '') PATH=$as_dir ;;
-   *) PATH=$PATH$PATH_SEPARATOR$as_dir ;;
+  '') at_path_reduced=$as_dir ;;
+   *) at_path_reduced=$at_path_reduced$PATH_SEPARATOR$as_dir ;;
 esac])
+PATH="$at_path_reduced"
 export PATH
 
 # Setting up the FDs.
@@ -484,7 +485,7 @@ if diff /dev/null /dev/null >/dev/null 2
   at_devnull=/dev/null
 else
   at_devnull=$at_suite_dir/devnull
-  cp /dev/null $at_devnull
+  cp /dev/null $at_devnull || true > $at_devnull
 fi
 
 # Use `diff -u' when possible.
diff -pru autoconf/lib/m4sugar/m4sh.m4 autoconf.my/lib/m4sugar/m4sh.m4
--- autoconf/lib/m4sugar/m4sh.m4        Mon Nov  4 23:09:14 2002
+++ autoconf.my/lib/m4sugar/m4sh.m4     Thu Feb 27 15:06:20 2003
@@ -481,7 +481,7 @@ AS_BASENAME_SED([$1])])
 # Check whether a file is executable.
 m4_defun([AS_EXECUTABLE_P],
 [AS_REQUIRE([_AS_TEST_PREPARE])dnl
-$as_executable_p $1[]dnl
+test $as_executable_flag $1 -o \( -n "$as_executable_ext2" -a 
$as_executable_flag $1$as_executable_ext2 \) dnl
 ])# AS_EXECUTABLE_P
 
 
@@ -597,6 +597,51 @@ _AS_LINENO_WORKS || {
   # Exit status is that of the last command.
   exit
 }
+
+# /bin/sh is not necessarily present
+if test -z "$CONFIG_SHELL"; then
+  # pdksh sets $LINENO to 0 for -c argument; create a file
+  echo 'as_lineno_1=$LINENO'                                   > conf$$.sh
+  echo 'as_lineno_2=$LINENO'                                   >> conf$$.sh
+  echo 'as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`'     >> conf$$.sh
+  echo 'test "x$as_lineno_1" != "x$as_lineno_2" &&'            >> conf$$.sh
+  echo 'test "x$as_lineno_3"  = "x$as_lineno_2" '              >> conf$$.sh
+  # Test whether /bin/sh works on this system
+  if ! /bin/sh ./conf$$.sh 2>/dev/null; then
+    # Try without path
+    for as_base in sh bash ksh sh5; do
+      if (test -z "$as_CONFIG_SHELL" && $as_base ./conf$$.sh) 2>/dev/null; then
+       as_CONFIG_SHELL=$as_base
+      fi
+    done
+    if test -n "$as_CONFIG_SHELL"; then
+      # Find it on path
+      as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+      for as_dir in $PATH
+      do
+        IFS=$as_save_IFS
+        test -z "$as_dir" && as_dir=.
+       test "X$as_dir" = X. && as_dir=`pwd`
+        if (test -z "$CONFIG_SHELL" && "$as_dir/$as_CONFIG_SHELL" ./conf$$.sh) 
2>/dev/null; then
+          CONFIG_SHELL="$as_dir/$as_CONFIG_SHELL"
+        fi
+      done
+      if test -z "$CONFIG_SHELL"; then
+        # Last resort: without path
+        CONFIG_SHELL="$as_CONFIG_SHELL"
+      fi
+      if test -n "$PATH_SLASHIFY"; then
+       as_CONFIG_SHELL=`print -r "$CONFIG_SHELL" | tr '\\\\' / `
+        if ! test "X$as_CONFIG_SHELL" = "X$CONFIG_SHELL" && "$as_CONFIG_SHELL" 
./conf$$.sh ; then
+          CONFIG_SHELL="$as_CONFIG_SHELL"
+        fi      
+      fi
+      export CONFIG_SHELL
+    fi
+  fi
+  rm -f conf$$.sh
+fi
+
 ])# _AS_LINENO_PREPARE
 
 
@@ -638,6 +683,15 @@ if test "${PATH_SEPARATOR+set}" != set; 
   chmod +x conf$$.sh
   if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
     PATH_SEPARATOR=';'
+    PATH_SLASHIFY=yes
+    # We expect that AS_SHELL_SANITIZE already ran, but did not change as_me
+    if test -n "$as_me"; then
+      # remove backslashes from as_me
+      as_me_tmp=`print -r "$as_me" | tr '\\\\' /`
+      if test -f "$as_me_tmp" && cmp "$as_me_tmp" "$as_me" >/dev/null; then
+        as_me=`AS_BASENAME("$as_me")`
+      fi
+    fi
   else
     PATH_SEPARATOR=:
   fi
@@ -667,6 +721,9 @@ for as_dir in $as_dummy],
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
+  if test -n "$PATH_SLASHIFY"; then
+    as_dir=`print -r "$as_dir" | tr '\\\\' / `
+  fi
   $2
 done
 ])
@@ -726,12 +783,13 @@ exit 0
 _ASEOF
 chmod +x conf$$.file
 if test -x conf$$.file >/dev/null 2>&1; then
-  as_executable_p="test -x"
+  as_executable_flag="-x"
 elif test -f conf$$.file >/dev/null 2>&1; then
-  as_executable_p="test -f"
+  as_executable_flag="-f"
 else
   AS_ERROR([cannot check whether a file is executable on this system])
 fi
+as_executable_p="test $as_executable_flag"
 rm -f conf$$.file
 ])# _AS_BROKEN_TEST_PREPARE
 
@@ -739,7 +797,12 @@ rm -f conf$$.file
 # _AS_TEST_PREPARE
 # ----------------
 m4_defun([_AS_TEST_PREPARE],
-[as_executable_p="test -f"
+[as_executable_flag="-f"
+case `uname 2>/dev/null` in
+  [[oO]][[sS]]2 | [[oO]][[sS]]/2) as_executable_ext2=".exe" ;;
+  *) as_executable_ext2="";;
+esac
+as_executable_p="test $as_executable_flag"
 ])# _AS_BROKEN_TEST_PREPARE
 
 
diff -pru autoconf/tests/tools.at autoconf.my/tests/tools.at
--- autoconf/tests/tools.at     Tue Oct 22 01:20:18 2002
+++ autoconf.my/tests/tools.at  Thu Feb 27 15:47:10 2003
@@ -58,7 +58,7 @@ done
 
 # A script in charge of testing `/bin/sh -n'.
 AT_DATA([syntax.sh],
-[[(/bin/sh -n endless.sh) &
+[[($SHELL -n endless.sh) &
 sleep 2
 if kill $! >/dev/null 2>&1; then
   # We managed to kill the child, which means that we probably
@@ -68,17 +68,17 @@ fi
 ]])
 
 # If we can't trust sh, just skip.
-AT_CHECK([/bin/sh ./syntax.sh])
+AT_CHECK([$SHELL ./syntax.sh])
 
 # Specify the path to the tool, some shells don't honor PATH when
 # running `sh PROG'.
 
-AT_CHECK([/bin/sh -n $abs_top_builddir/bin/autoconf],   0)
+AT_CHECK([$SHELL -n $abs_top_builddir/bin/autoconf],   0)
 
 # These are not built, they are in the src tree.
-AT_CHECK([/bin/sh -n $abs_top_srcdir/config/install-sh], 0)
-AT_CHECK([/bin/sh -n $abs_top_srcdir/config/mkinstalldirs], 0)
-AT_CHECK([/bin/sh -n $abs_top_srcdir/config/missing], 0)
+AT_CHECK([$SHELL -n $abs_top_srcdir/config/install-sh], 0)
+AT_CHECK([$SHELL -n $abs_top_srcdir/config/mkinstalldirs], 0)
+AT_CHECK([$SHELL -n $abs_top_srcdir/config/missing], 0)
 
 AT_CLEANUP
 




reply via email to

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