You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Mo DeJong <md...@cygnus.com> on 2001/01/06 21:14:28 UTC

APR_MKDIR() attempt #2

I sent this patch in some time ago, but
I did not hear anything back so I though
I would post it again. This patch fixes
the build in the case where apr is
compiled in a build dir that is not
the src dir. This only matters when
another module uses the RUN_SUBDIR_CONFIG_NOW()
macro.

Mo DeJong
Red Hat Inc


Index: aclocal.m4
===================================================================
RCS file: /home/cvspublic/apr/aclocal.m4,v
retrieving revision 1.38
diff -u -r1.38 aclocal.m4
--- aclocal.m4	2000/12/20 16:20:05	1.38
+++ aclocal.m4	2001/01/06 20:10:01
@@ -331,7 +331,7 @@
 AC_DEFUN(APR_PREPARE_MM_DIR,[
 dnl #----------------------------- Prepare mm directory for VPATH support
 if test -n "$USE_MM" && test -n "$USE_VPATH"; then
-  test -d $mm_dir || $MKDIR $mm_dir
+  test -d $mm_dir || APR_MKDIR($mm_dir)
 
   for i in shtool config.guess config.sub fbtool ltconfig \
            ltmain.sh mm_vers.c; do
Index: apr_common.m4
===================================================================
RCS file: /home/cvspublic/apr/apr_common.m4,v
retrieving revision 1.9
diff -u -r1.9 apr_common.m4
--- apr_common.m4	2000/11/29 23:11:21	1.9
+++ apr_common.m4	2001/01/06 20:10:01
@@ -1,4 +1,39 @@
 dnl
+dnl APR_MKDIR(dir)
+dnl
+dnl This macro works like `mkdir -p $dir' on systems that do not
+dnl support the -p flag to mkdir
+dnl
+dnl Based on `mkinstalldirs' from Noah Friedman <fr...@prep.ai.mit.edu>
+dnl as of 1994-03-25, which was placed in the Public Domain.
+dnl Cleaned up for Apache's Autoconf-style Interface (APACI)
+dnl by Ralf S. Engelschall <rs...@apache.org>
+
+AC_DEFUN(APR_MKDIR, [
+  umask_saved=`umask`
+  umask 022
+
+  dir=$1
+  dirlist=`echo ":$dir" |\
+               sed -e 's/^:\//%/' -e 's/^://' -e 's/\// /g' -e 's/^%/\//'`
+
+  pathcomp=
+  for d in $dirlist; do
+    pathcomp="$pathcomp$d"
+    case "$pathcomp" in
+      -* ) pathcomp=./$pathcomp ;;
+    esac
+    if test ! -d "$pathcomp"; then
+      #echo "mkdir $pathcomp" 1>&2
+      mkdir "$pathcomp"
+    fi
+    pathcomp="$pathcomp/"
+  done
+  echo "mkdir -p $1"
+  umask $umask_saved > /dev/null
+])
+
+dnl
 dnl RUN_SUBDIR_CONFIG_NOW(dir [, sub-package-cmdline-args])
 dnl
 AC_DEFUN(RUN_SUBDIR_CONFIG_NOW, [
@@ -9,7 +44,7 @@
   ac_popdir=`pwd`
   ac_abs_srcdir=`(cd $srcdir/$1 && pwd)`
   apr_config_subdirs="$1"
-  test -d $1 || $srcdir/helpers/mkdir.sh $1
+  test -d $1 || APR_MKDIR($1)
   cd $1
 
 changequote(, )dnl
Index: configure.in
===================================================================
RCS file: /home/cvspublic/apr/configure.in,v
retrieving revision 1.205
diff -u -r1.205 configure.in
--- configure.in	2001/01/05 22:33:08	1.205
+++ configure.in	2001/01/06 20:10:02
@@ -26,7 +26,6 @@
 dnl XXX This assumes that APR "lives" under Apache.
 dnl XXX We'll need to fix this when we pull it out.
 abs_helpersdir=$abs_srcdir/helpers
-MKDIR=$abs_helpersdir/mkdir.sh
 
 if test "$abs_builddir" != "$abs_srcdir"; then
   USE_VPATH=1
@@ -866,7 +865,7 @@
 SUBDIRS="lib strings passwd tables "
 for dir in $MODULES
 do
-    test -d $dir || $MKDIR $dir
+    test -d $dir || APR_MKDIR($dir)
     if test -f $srcdir/$dir/$OSDIR/Makefile.in; then
         MAKEFILE2="$MAKEFILE2 $dir/$OSDIR/Makefile "
         SUBDIRS="$SUBDIRS $dir/$OSDIR "
@@ -891,7 +890,7 @@
 done
 
 dir=include/arch/unix
-test -d $dir || $MKDIR $dir
+test -d $dir || APR_MKDIR($dir)
 
 AC_OUTPUT($MAKEFILE1 $MAKEFILE2 $MAKEFILE3 include/apr.h APRVARS,[
 


Re: APR_MKDIR() attempt #2

Posted by Greg Stein <gs...@lyra.org>.
On Sat, Jan 06, 2001 at 12:14:28PM -0800, Mo DeJong wrote:
> I sent this patch in some time ago, but
> I did not hear anything back so I though
> I would post it again. This patch fixes
> the build in the case where apr is
> compiled in a build dir that is not
> the src dir. This only matters when
> another module uses the RUN_SUBDIR_CONFIG_NOW()
> macro.

I reviewed the patch quite a bit, but I don't recall the reason I had for
not applying it. (I think it was something about the APR_MKDIR func)

Note that Sascha has patched apr_common.m4 to use the $MKDIR variable.
Assuming the caller (Subversion) sets that, then we should be okay.
[ a one line patch to SVN's configure.in ]

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: APR_MKDIR() attempt #2

Posted by Branko Čibej <br...@xbc.nu>.
Mo DeJong wrote:

> I sent this patch in some time ago, but
> I did not hear anything back so I though
> I would post it again. This patch fixes
> the build in the case where apr is
> compiled in a build dir that is not
> the src dir. This only matters when
> another module uses the RUN_SUBDIR_CONFIG_NOW()
> macro.

I'd second this patch (we'll need it for Subversion), but I'm not 
qualified to decide if it's correct. It looks fine to me. Opinions?


-- 
Brane Čibej
    home:   <br...@xbc.nu>             http://www.xbc.nu/brane/
    work:   <br...@hermes.si>   http://www.hermes-softlab.com/
     ACM:   <br...@acm.org>            http://www.acm.org/