]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* acgeneral.m4 (AC_SHELL_MKDIR_P): New macro.
authorAkim Demaille <akim@epita.fr>
Tue, 4 Jul 2000 18:20:05 +0000 (18:20 +0000)
committerAkim Demaille <akim@epita.fr>
Tue, 4 Jul 2000 18:20:05 +0000 (18:20 +0000)
(_AC_OUTPUT_FILES, _AC_OUTPUT_HEADERS, _AC_OUTPUT_LINKS,
AC_PROG_INSTALL): Use AC_SHELL_MKDIR_P.
* tests/base.m4 (AC_SHELL_MKDIR_P): Test it.

ChangeLog
acgeneral.m4
lib/autoconf/general.m4
tests/base.m4

index 3c008f9e04d3f24c307e2a423d49d11ccb06da57..dbb43a0c242d5f4f023b6dde76630ded665a90b9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2000-07-03  Lars J. Aas  <larsa@sim.no>
+
+       * acgeneral.m4 (AC_SHELL_MKDIR_P): New macro.
+       (_AC_OUTPUT_FILES, _AC_OUTPUT_HEADERS, _AC_OUTPUT_LINKS,
+       AC_PROG_INSTALL): Use AC_SHELL_MKDIR_P.
+       * tests/base.m4 (AC_SHELL_MKDIR_P): Test it.
+
 2000-07-04  Akim Demaille  <akim@epita.fr>
 
        * acgeneral.m4 (AC_CACHE_LOAD): Be ready to read the cache even
index 068da2c67da156ba3f85508397be5d51ac503a78..7b02697a0703036d6f6f4eea483f396cc0d37580 100644 (file)
@@ -756,6 +756,22 @@ define([AC_SHELL_UNSET],
 [$ac_unset $1 || test "${$1+set}" != set || $1=$2 && export $1])
 
 
+# AC_SHELL_MKDIR_P(PATH)
+# ------------------------
+# Emulate `mkdir -p' with plain `mkdir'.
+define([AC_SHELL_MKDIR_P],
+[{ case $1 in
+  [[\\/]]* | ?:[[\\/]]* ) ac_incr_dir=;;
+  *)                      ac_incr_dir=.;;
+esac
+ac_dummy="$1"
+for ac_dir in `IFS=/; set X $ac_dummy; shift; echo "$[@]"`; do
+  ac_incr_dir=$ac_incr_dir/$ac_dir
+  test -d $ac_incr_dir || mkdir $ac_incr_dir
+done; }
+])# AC_SHELL_MKDIR_P
+
+
 ## --------------------------------------------------- ##
 ## Common m4/sh handling of variables (indirections).  ##
 ## --------------------------------------------------- ##
@@ -4502,10 +4518,7 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
   # Remove last slash and all that follows it.  Not all systems have dirname.
   ac_dir=`echo "$ac_file" | sed 's%/[[^/][^/]]*$%%'`
   if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-    # The file is in a subdirectory.
-dnl FIXME: should actually be mkinstalldirs (parents may have
-dnl to be created too).
-    test -d "$ac_dir" || mkdir "$ac_dir"
+    AC_SHELL_MKDIR_P("$ac_dir")
     ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
     # A "../" for each directory in $ac_dir_suffix.
     ac_dots=`echo "$ac_dir_suffix" | sed 's%/[[^/]]*%../%g'`
@@ -4772,10 +4785,7 @@ cat >>$CONFIG_STATUS <<\EOF
     # Remove last slash and all that follows it.  Not all systems have dirname.
     ac_dir=`echo "$ac_file" | sed 's%/[[^/][^/]]*$%%'`
     if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-      # The file is in a subdirectory.
-dnl FIXME: should actually be mkinstalldirs (parents may have
-dnl to be created too).
-      test -d "$ac_dir" || mkdir "$ac_dir"
+      AC_SHELL_MKDIR_P("$ac_dir")
     fi
     rm -f $ac_file
     mv $tmp/config.h $ac_file
@@ -4823,10 +4833,7 @@ for ac_file in : $CONFIG_LINKS; do test "x$ac_file" = x: && continue
   # Remove last slash and all that follows it.  Not all systems have dirname.
   ac_dest_dir=`echo $ac_dest | sed 's%/[[^/][^/]]*$%%'`
   if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then
-    # The dest file is in a subdirectory.
-dnl FIXME: should actually be mkinstalldirs (parents may have
-dnl to be created too).
-    test -d "$ac_dest_dir" || mkdir "$ac_dest_dir"
+    AC_SHELL_MKDIR_P("$ac_dest_dir")
     ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`"
     # A "../" for each directory in $ac_dest_dir_suffix.
     ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[[^/]]*%../%g'`
@@ -4935,14 +4942,12 @@ AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
     echo configuring in $ac_subdir
     case $srcdir in
     .) ;;
-    *)
-dnl FIXME: should actually be mkinstalldirs (parents may have
-dnl to be created too).
-      if test -d ./$ac_subdir || mkdir ./$ac_subdir; then :;
-      else
-        AC_MSG_ERROR(cannot create `pwd`/$ac_subdir)
-      fi
-      ;;
+    *) AC_SHELL_MKDIR_P(./$ac_subdir)
+       if test -d ./$ac_subdir; then :;
+       else
+         AC_MSG_ERROR(cannot create `pwd`/$ac_subdir)
+       fi
+       ;;
     esac
 
     ac_popdir=`pwd`
index 068da2c67da156ba3f85508397be5d51ac503a78..7b02697a0703036d6f6f4eea483f396cc0d37580 100644 (file)
@@ -756,6 +756,22 @@ define([AC_SHELL_UNSET],
 [$ac_unset $1 || test "${$1+set}" != set || $1=$2 && export $1])
 
 
+# AC_SHELL_MKDIR_P(PATH)
+# ------------------------
+# Emulate `mkdir -p' with plain `mkdir'.
+define([AC_SHELL_MKDIR_P],
+[{ case $1 in
+  [[\\/]]* | ?:[[\\/]]* ) ac_incr_dir=;;
+  *)                      ac_incr_dir=.;;
+esac
+ac_dummy="$1"
+for ac_dir in `IFS=/; set X $ac_dummy; shift; echo "$[@]"`; do
+  ac_incr_dir=$ac_incr_dir/$ac_dir
+  test -d $ac_incr_dir || mkdir $ac_incr_dir
+done; }
+])# AC_SHELL_MKDIR_P
+
+
 ## --------------------------------------------------- ##
 ## Common m4/sh handling of variables (indirections).  ##
 ## --------------------------------------------------- ##
@@ -4502,10 +4518,7 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
   # Remove last slash and all that follows it.  Not all systems have dirname.
   ac_dir=`echo "$ac_file" | sed 's%/[[^/][^/]]*$%%'`
   if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-    # The file is in a subdirectory.
-dnl FIXME: should actually be mkinstalldirs (parents may have
-dnl to be created too).
-    test -d "$ac_dir" || mkdir "$ac_dir"
+    AC_SHELL_MKDIR_P("$ac_dir")
     ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
     # A "../" for each directory in $ac_dir_suffix.
     ac_dots=`echo "$ac_dir_suffix" | sed 's%/[[^/]]*%../%g'`
@@ -4772,10 +4785,7 @@ cat >>$CONFIG_STATUS <<\EOF
     # Remove last slash and all that follows it.  Not all systems have dirname.
     ac_dir=`echo "$ac_file" | sed 's%/[[^/][^/]]*$%%'`
     if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-      # The file is in a subdirectory.
-dnl FIXME: should actually be mkinstalldirs (parents may have
-dnl to be created too).
-      test -d "$ac_dir" || mkdir "$ac_dir"
+      AC_SHELL_MKDIR_P("$ac_dir")
     fi
     rm -f $ac_file
     mv $tmp/config.h $ac_file
@@ -4823,10 +4833,7 @@ for ac_file in : $CONFIG_LINKS; do test "x$ac_file" = x: && continue
   # Remove last slash and all that follows it.  Not all systems have dirname.
   ac_dest_dir=`echo $ac_dest | sed 's%/[[^/][^/]]*$%%'`
   if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then
-    # The dest file is in a subdirectory.
-dnl FIXME: should actually be mkinstalldirs (parents may have
-dnl to be created too).
-    test -d "$ac_dest_dir" || mkdir "$ac_dest_dir"
+    AC_SHELL_MKDIR_P("$ac_dest_dir")
     ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`"
     # A "../" for each directory in $ac_dest_dir_suffix.
     ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[[^/]]*%../%g'`
@@ -4935,14 +4942,12 @@ AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
     echo configuring in $ac_subdir
     case $srcdir in
     .) ;;
-    *)
-dnl FIXME: should actually be mkinstalldirs (parents may have
-dnl to be created too).
-      if test -d ./$ac_subdir || mkdir ./$ac_subdir; then :;
-      else
-        AC_MSG_ERROR(cannot create `pwd`/$ac_subdir)
-      fi
-      ;;
+    *) AC_SHELL_MKDIR_P(./$ac_subdir)
+       if test -d ./$ac_subdir; then :;
+       else
+         AC_MSG_ERROR(cannot create `pwd`/$ac_subdir)
+       fi
+       ;;
     esac
 
     ac_popdir=`pwd`
index 9ad34b12cfc6e14cc569f18244bb0abd384950b2..7bbff8cf1041b7aa8fcf56c083f15f0c2997971d 100644 (file)
@@ -92,3 +92,29 @@ AT_CHECK([../autoconf -m .. -l $at_srcdir], 0, [], [])
 AT_CHECK([./configure], 0)
 
 AT_CLEANUP(configure)
+
+
+# AC_SHELL_MKDIR_P
+# ----------------
+
+# Build nested dirs.
+
+AT_SETUP(AC_SHELL_MKDIR_P)
+
+AT_DATA(configure.in,
+[[AC_DIVERT_POP()
+pwd=`pwd`
+set -e
+# Absolute
+AC_SHELL_MKDIR_P($pwd/1/2/3/4/5/6)
+test -d $pwd/1/2/3/4/5/6 || exit 1
+# Relative
+AC_SHELL_MKDIR_P(a/b/c/d/e/f)
+test -d a/b/c/d/e/f || exit 1
+exit 0
+]])
+
+AT_CHECK([../autoconf -m .. -l $at_srcdir], 0, [], [])
+AT_CHECK([./configure], 0)
+
+AT_CLEANUP(configure 1)